@dataloop-ai/components 0.20.224 → 0.20.225
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.
package/package.json
CHANGED
|
@@ -119,7 +119,7 @@ import { Animation } from '../types'
|
|
|
119
119
|
import { v4 } from 'uuid'
|
|
120
120
|
|
|
121
121
|
const DEFAULT_ACTION_BUTTON_STYLES =
|
|
122
|
-
'min-width:73px; max-width:
|
|
122
|
+
'min-width:73px; max-width:150px; height:24px; max-height:24px; padding:0 8px; border-radius:2px;'
|
|
123
123
|
|
|
124
124
|
export default defineComponent({
|
|
125
125
|
name: 'ToastComponent',
|
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
v-if="!isSVG"
|
|
4
4
|
:id="uuid"
|
|
5
5
|
:style="[inlineStyles, computedStyles]"
|
|
6
|
+
@mouseenter="onMouseEnter"
|
|
7
|
+
@mouseleave="onMouseLeave"
|
|
6
8
|
@click="$emit('click', $event)"
|
|
7
9
|
@mousedown="$emit('mousedown', $event)"
|
|
8
10
|
@mouseup="$emit('mouseup', $event)"
|
|
@@ -26,6 +28,8 @@
|
|
|
26
28
|
v-else
|
|
27
29
|
:id="uuid"
|
|
28
30
|
:style="[inlineStyles, computedStyles]"
|
|
31
|
+
@mouseenter="onMouseEnter"
|
|
32
|
+
@mouseleave="onMouseLeave"
|
|
29
33
|
@click="$emit('click', $event)"
|
|
30
34
|
@mousedown="$emit('mousedown', $event)"
|
|
31
35
|
@mouseup="$emit('mouseup', $event)"
|
|
@@ -46,6 +50,7 @@ import {
|
|
|
46
50
|
onMounted,
|
|
47
51
|
onUnmounted,
|
|
48
52
|
ref,
|
|
53
|
+
useSlots,
|
|
49
54
|
toRefs,
|
|
50
55
|
watch
|
|
51
56
|
} from 'vue-demi'
|
|
@@ -97,11 +102,34 @@ export default defineComponent({
|
|
|
97
102
|
const { styles, color, size, icon, svg, inline, svgSource, tooltip } =
|
|
98
103
|
toRefs(props)
|
|
99
104
|
|
|
105
|
+
const slots = useSlots()
|
|
100
106
|
const svgIcon = ref(null)
|
|
101
107
|
const isDestroyed = ref(false)
|
|
102
108
|
const uuid = `dl-icon-${v4()}`
|
|
103
109
|
const externalIconSource = 'material-icons'
|
|
104
110
|
const logger = loggerFactory('dl-icon')
|
|
111
|
+
const isHovered = ref(false)
|
|
112
|
+
|
|
113
|
+
const hasDefaultSlot = computed<boolean>(() => {
|
|
114
|
+
const slot = slots.default
|
|
115
|
+
if (!slot) return false
|
|
116
|
+
return slot().length > 0
|
|
117
|
+
})
|
|
118
|
+
|
|
119
|
+
const isInfoDefault = computed<boolean>(() => {
|
|
120
|
+
return (
|
|
121
|
+
icon.value === 'icon-dl-info' &&
|
|
122
|
+
!color.value &&
|
|
123
|
+
!hasDefaultSlot.value
|
|
124
|
+
)
|
|
125
|
+
})
|
|
126
|
+
|
|
127
|
+
const effectiveColor = computed<string | null>(() => {
|
|
128
|
+
if (isInfoDefault.value) {
|
|
129
|
+
return isHovered.value ? 'dell-blue-600' : 'dell-blue-500'
|
|
130
|
+
}
|
|
131
|
+
return color.value
|
|
132
|
+
})
|
|
105
133
|
|
|
106
134
|
const computedStyles = computed<Record<string, string>>(() => {
|
|
107
135
|
const generatedStyles = isString(styles.value)
|
|
@@ -121,12 +149,12 @@ export default defineComponent({
|
|
|
121
149
|
const cssIconVars = computed<Record<string, string>>(() => {
|
|
122
150
|
return {
|
|
123
151
|
'--dl-icon-font-size': `${size.value}`,
|
|
124
|
-
'--dl-icon-color':
|
|
152
|
+
'--dl-icon-color': effectiveColor.value
|
|
125
153
|
? // todo: remove this. this is needed for now until the swap of DLBTN in OA
|
|
126
154
|
getColor(
|
|
127
|
-
|
|
155
|
+
effectiveColor.value === 'secondary'
|
|
128
156
|
? 'q-color-secondary'
|
|
129
|
-
:
|
|
157
|
+
: effectiveColor.value,
|
|
130
158
|
'dell-gray-800'
|
|
131
159
|
)
|
|
132
160
|
: 'inherit'
|
|
@@ -164,6 +192,18 @@ export default defineComponent({
|
|
|
164
192
|
return { display: inline.value ? 'inline-flex' : 'flex' }
|
|
165
193
|
})
|
|
166
194
|
|
|
195
|
+
const onMouseEnter = () => {
|
|
196
|
+
if (isInfoDefault.value) {
|
|
197
|
+
isHovered.value = true
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
const onMouseLeave = () => {
|
|
202
|
+
if (isInfoDefault.value) {
|
|
203
|
+
isHovered.value = false
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
|
|
167
207
|
const loadSvg = () => {
|
|
168
208
|
return new Promise<void>((resolve, reject) => {
|
|
169
209
|
const loadedIcon = icon.value
|
|
@@ -239,7 +279,9 @@ export default defineComponent({
|
|
|
239
279
|
loadSvg,
|
|
240
280
|
isDestroyed,
|
|
241
281
|
externalIcon,
|
|
242
|
-
inlineStyles
|
|
282
|
+
inlineStyles,
|
|
283
|
+
onMouseEnter,
|
|
284
|
+
onMouseLeave
|
|
243
285
|
}
|
|
244
286
|
}
|
|
245
287
|
})
|