@saasmakers/ui 1.4.1 → 1.4.3
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.
|
@@ -15,61 +15,6 @@ const emit = defineEmits<{
|
|
|
15
15
|
|
|
16
16
|
const { getIcon } = useLayerIcons()
|
|
17
17
|
|
|
18
|
-
const actionPillClasses = computed(() => {
|
|
19
|
-
switch (props.status) {
|
|
20
|
-
case 'error':
|
|
21
|
-
return 'bg-red-600/20 text-red-400 hover:bg-red-600/30 focus-visible:ring-red-500 dark:bg-red-400/15 dark:text-red-400 dark:hover:bg-red-400/25'
|
|
22
|
-
case 'info':
|
|
23
|
-
return 'bg-indigo-600/20 text-indigo-400 hover:bg-indigo-600/30 focus-visible:ring-indigo-500 dark:bg-indigo-400/15 dark:text-indigo-400 dark:hover:bg-indigo-400/25'
|
|
24
|
-
case 'success':
|
|
25
|
-
return 'bg-green-600/20 text-green-400 hover:bg-green-600/30 focus-visible:ring-green-500 dark:bg-green-400/15 dark:text-green-400 dark:hover:bg-green-400/25'
|
|
26
|
-
case 'warning':
|
|
27
|
-
return 'bg-orange-600/20 text-orange-400 hover:bg-orange-600/30 focus-visible:ring-orange-500 dark:bg-orange-400/15 dark:text-orange-400 dark:hover:bg-orange-400/25'
|
|
28
|
-
default:
|
|
29
|
-
return ''
|
|
30
|
-
}
|
|
31
|
-
})
|
|
32
|
-
|
|
33
|
-
const closeHoverClasses = computed(() => {
|
|
34
|
-
switch (props.status) {
|
|
35
|
-
case 'error':
|
|
36
|
-
return 'hover:text-red-600 dark:hover:text-red-400'
|
|
37
|
-
case 'info':
|
|
38
|
-
return 'hover:text-indigo-600 dark:hover:text-indigo-400'
|
|
39
|
-
case 'success':
|
|
40
|
-
return 'hover:text-green-600 dark:hover:text-green-400'
|
|
41
|
-
case 'warning':
|
|
42
|
-
return 'hover:text-orange-600 dark:hover:text-orange-400'
|
|
43
|
-
default:
|
|
44
|
-
return ''
|
|
45
|
-
}
|
|
46
|
-
})
|
|
47
|
-
|
|
48
|
-
const isDismissibleByClick = computed(() => {
|
|
49
|
-
return props.hasClose && !props.action
|
|
50
|
-
})
|
|
51
|
-
|
|
52
|
-
const rootInteractiveBindings = computed(() => {
|
|
53
|
-
if (!isDismissibleByClick.value) {
|
|
54
|
-
return {}
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
return {
|
|
58
|
-
onClick: onClose,
|
|
59
|
-
onKeydown: (event: KeyboardEvent) => {
|
|
60
|
-
if (event.key === 'Enter' || event.key === ' ') {
|
|
61
|
-
if (event.key === ' ') {
|
|
62
|
-
event.preventDefault()
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
onClose(event)
|
|
66
|
-
}
|
|
67
|
-
},
|
|
68
|
-
role: 'button' as const,
|
|
69
|
-
tabindex: 0,
|
|
70
|
-
}
|
|
71
|
-
})
|
|
72
|
-
|
|
73
18
|
function onAction(event: KeyboardEvent | MouseEvent) {
|
|
74
19
|
if (props.action) {
|
|
75
20
|
emit('action', event as MouseEvent, props)
|
|
@@ -85,9 +30,13 @@ function onClose(event: KeyboardEvent | MouseEvent) {
|
|
|
85
30
|
|
|
86
31
|
<template>
|
|
87
32
|
<div
|
|
88
|
-
|
|
89
|
-
class="
|
|
90
|
-
|
|
33
|
+
class="group flex select-none items-center border border-gray-700 rounded-full bg-gray-900 px-3 py-2 text-base text-white font-normal dark:border-gray-700 dark:bg-gray-800 dark:text-gray-100"
|
|
34
|
+
:class="{ 'cursor-pointer': hasClose }"
|
|
35
|
+
role="button"
|
|
36
|
+
tabindex="0"
|
|
37
|
+
@click="onClose"
|
|
38
|
+
@keydown.enter="onClose"
|
|
39
|
+
@keydown.space.prevent="onClose"
|
|
91
40
|
>
|
|
92
41
|
<BaseIcon
|
|
93
42
|
class="pointer-events-none flex-initial"
|
|
@@ -97,8 +46,13 @@ function onClose(event: KeyboardEvent | MouseEvent) {
|
|
|
97
46
|
|
|
98
47
|
<button
|
|
99
48
|
v-if="action"
|
|
100
|
-
class="ml-2 rounded-
|
|
101
|
-
:class="
|
|
49
|
+
class="ml-2 rounded-md px-2 py-0.5 transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-offset-gray-900 dark:focus-visible:ring-offset-gray-800"
|
|
50
|
+
:class="{
|
|
51
|
+
'bg-red-600/20 text-red-400 hover:bg-red-600/30 focus-visible:ring-red-500 dark:bg-red-400/15 dark:text-red-400 dark:hover:bg-red-400/25': status === 'error',
|
|
52
|
+
'bg-indigo-600/20 text-indigo-400 hover:bg-indigo-600/30 focus-visible:ring-indigo-500 dark:bg-indigo-400/15 dark:text-indigo-400 dark:hover:bg-indigo-400/25': status === 'info',
|
|
53
|
+
'bg-green-600/20 text-green-400 hover:bg-green-600/30 focus-visible:ring-green-500 dark:bg-green-400/15 dark:text-green-400 dark:hover:bg-green-400/25': status === 'success',
|
|
54
|
+
'bg-orange-600/20 text-orange-400 hover:bg-orange-600/30 focus-visible:ring-orange-500 dark:bg-orange-400/15 dark:text-orange-400 dark:hover:bg-orange-400/25': status === 'warning',
|
|
55
|
+
}"
|
|
102
56
|
type="button"
|
|
103
57
|
@click.stop="onAction"
|
|
104
58
|
>
|
|
@@ -106,6 +60,7 @@ function onClose(event: KeyboardEvent | MouseEvent) {
|
|
|
106
60
|
bold
|
|
107
61
|
class="pointer-events-none"
|
|
108
62
|
no-wrap
|
|
63
|
+
size="sm"
|
|
109
64
|
:text="action.label"
|
|
110
65
|
uppercase
|
|
111
66
|
/>
|
|
@@ -114,21 +69,7 @@ function onClose(event: KeyboardEvent | MouseEvent) {
|
|
|
114
69
|
<template v-if="hasClose">
|
|
115
70
|
<div class="ml-2 mr-1.5 h-5 border-l border-gray-700 flex-initial dark:border-gray-600" />
|
|
116
71
|
|
|
117
|
-
<button
|
|
118
|
-
v-if="action"
|
|
119
|
-
class="cursor-pointer bg-transparent text-gray-500 flex-initial dark:text-gray-500"
|
|
120
|
-
:class="closeHoverClasses"
|
|
121
|
-
type="button"
|
|
122
|
-
@click.stop="onClose"
|
|
123
|
-
>
|
|
124
|
-
<BaseIcon
|
|
125
|
-
class="pointer-events-none"
|
|
126
|
-
:icon="getIcon('close')"
|
|
127
|
-
/>
|
|
128
|
-
</button>
|
|
129
|
-
|
|
130
72
|
<BaseIcon
|
|
131
|
-
v-else
|
|
132
73
|
class="text-gray-500 flex-initial dark:text-gray-500"
|
|
133
74
|
:class="{
|
|
134
75
|
'group-hover:text-red-600 dark:group-hover:text-red-400': status === 'error',
|