@saasmakers/ui 2.0.39 → 2.0.41
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.
|
@@ -65,7 +65,7 @@ function onKeyDown(event: KeyboardEvent) {
|
|
|
65
65
|
'h-2.5 w-2.5': size === '3xs',
|
|
66
66
|
'h-3 w-3': size === '2xs',
|
|
67
67
|
'h-3.5 w-3.5': size === 'xs',
|
|
68
|
-
'h-4 w-4': size === 'sm',
|
|
68
|
+
'h-4.5 w-4.5': size === 'sm',
|
|
69
69
|
'h-5 w-5': size === 'base',
|
|
70
70
|
'h-5.5 w-5.5': size === 'lg',
|
|
71
71
|
'h-6 w-6': size === 'xl',
|
|
@@ -38,7 +38,15 @@ function onClose(event: KeyboardEvent | MouseEvent) {
|
|
|
38
38
|
@keydown.space.prevent="onClose"
|
|
39
39
|
>
|
|
40
40
|
<div class="pointer-events-none flex items-center flex-initial">
|
|
41
|
+
<BaseEmoji
|
|
42
|
+
v-if="emoji"
|
|
43
|
+
:clickable="false"
|
|
44
|
+
:emoji="emoji"
|
|
45
|
+
size="sm"
|
|
46
|
+
/>
|
|
47
|
+
|
|
41
48
|
<BaseIcon
|
|
49
|
+
v-else
|
|
42
50
|
size="xl"
|
|
43
51
|
:status="status"
|
|
44
52
|
/>
|
|
@@ -79,7 +87,7 @@ function onClose(event: KeyboardEvent | MouseEvent) {
|
|
|
79
87
|
|
|
80
88
|
<template v-if="hasClose">
|
|
81
89
|
<BaseIcon
|
|
82
|
-
class="ml-
|
|
90
|
+
class="ml-1.5 text-gray-400 transition-colors flex-initial dark:text-gray-500"
|
|
83
91
|
:class="{
|
|
84
92
|
'group-hover:text-red-600 dark:group-hover:text-red-400': status === 'error',
|
|
85
93
|
'group-hover:text-indigo-600 dark:group-hover:text-indigo-400': status === 'info',
|
|
@@ -30,6 +30,7 @@ function onToastClose(_event: KeyboardEvent | MouseEvent, toast: BaseToast) {
|
|
|
30
30
|
:id="toast.id"
|
|
31
31
|
:key="toast.id"
|
|
32
32
|
:action="toast.action"
|
|
33
|
+
:emoji="toast.emoji"
|
|
33
34
|
:has-active-shortcut="toast.id === activeShortcutToastId"
|
|
34
35
|
:status="toast.status"
|
|
35
36
|
:text="toast.text"
|
|
@@ -19,6 +19,7 @@ export default function useToast() {
|
|
|
19
19
|
|
|
20
20
|
const createToast = (params: {
|
|
21
21
|
action?: BaseToastAction
|
|
22
|
+
emoji?: string
|
|
22
23
|
i18nParams?: Record<string, number | string>
|
|
23
24
|
message: string
|
|
24
25
|
replaceAll?: boolean
|
|
@@ -36,8 +37,19 @@ export default function useToast() {
|
|
|
36
37
|
? params.message
|
|
37
38
|
: nuxtApp.$i18n.t(`toasts.${params.message}`, params.i18nParams ?? {})
|
|
38
39
|
|
|
39
|
-
const fingerprint = getFingerprint(
|
|
40
|
-
|
|
40
|
+
const fingerprint = getFingerprint({
|
|
41
|
+
actionLabel: params.action?.label,
|
|
42
|
+
emoji: params.emoji,
|
|
43
|
+
status: params.status,
|
|
44
|
+
text,
|
|
45
|
+
})
|
|
46
|
+
|
|
47
|
+
const existingToast = toasts.value.find(item => getFingerprint({
|
|
48
|
+
actionLabel: item.action?.label,
|
|
49
|
+
emoji: item.emoji,
|
|
50
|
+
status: item.status,
|
|
51
|
+
text: item.text,
|
|
52
|
+
}) === fingerprint)
|
|
41
53
|
|
|
42
54
|
if (existingToast) {
|
|
43
55
|
if (params.action) {
|
|
@@ -51,6 +63,7 @@ export default function useToast() {
|
|
|
51
63
|
|
|
52
64
|
const toast: BaseToast = {
|
|
53
65
|
action: params.action,
|
|
66
|
+
emoji: params.emoji,
|
|
54
67
|
id: crypto.randomUUID(),
|
|
55
68
|
status: params.status ?? 'success',
|
|
56
69
|
text,
|
|
@@ -86,10 +99,28 @@ function closeToast(toastId: string) {
|
|
|
86
99
|
toasts.value = toasts.value.filter(item => item.id !== toastId)
|
|
87
100
|
}
|
|
88
101
|
|
|
89
|
-
function getFingerprint(
|
|
90
|
-
|
|
102
|
+
function getFingerprint(params: {
|
|
103
|
+
actionLabel?: BaseTextText
|
|
104
|
+
emoji?: string
|
|
105
|
+
status?: BaseStatus
|
|
106
|
+
text: BaseTextText
|
|
107
|
+
}): string {
|
|
108
|
+
const normalize = (value: BaseTextText) => typeof value === 'string' ? value : JSON.stringify(value)
|
|
109
|
+
|
|
110
|
+
const parts = [
|
|
111
|
+
params.status ?? 'success',
|
|
112
|
+
normalize(params.text),
|
|
113
|
+
]
|
|
114
|
+
|
|
115
|
+
if (params.actionLabel) {
|
|
116
|
+
parts.push(normalize(params.actionLabel))
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
if (params.emoji) {
|
|
120
|
+
parts.push(params.emoji)
|
|
121
|
+
}
|
|
91
122
|
|
|
92
|
-
return
|
|
123
|
+
return parts.join(':')
|
|
93
124
|
}
|
|
94
125
|
|
|
95
126
|
function scheduleDismiss(toastId: string, hasAction: boolean) {
|
package/app/types/bases.d.ts
CHANGED
package/nuxt.config.ts
CHANGED
|
@@ -145,5 +145,12 @@ export default defineNuxtConfig({
|
|
|
145
145
|
rules: uno.rules,
|
|
146
146
|
shortcuts: uno.shortcuts,
|
|
147
147
|
theme: uno.theme,
|
|
148
|
+
content: {
|
|
149
|
+
// Force consumers to scan layer classes even when resolved from node_modules,
|
|
150
|
+
// otherwise transition utilities used only here are purged during their prod build.
|
|
151
|
+
filesystem: [
|
|
152
|
+
path.join(currentDir, 'app/**/*.{vue,ts}'),
|
|
153
|
+
],
|
|
154
|
+
},
|
|
148
155
|
},
|
|
149
156
|
})
|