@@ -10,7 +10,7 @@ import { VIcon } from '@/components/VIcon'
1010// Composables
1111import { useTextColor } from '@/composables/color'
1212import { makeComponentProps } from '@/composables/component'
13- import { useDefaults , useSlotDefaults } from '@/composables/defaults'
13+ import { useSlotDefaults } from '@/composables/defaults'
1414import { makeDensityProps , useDensity } from '@/composables/density'
1515import { makeDimensionProps , useDimension } from '@/composables/dimensions'
1616import { makeElevationProps , useElevation } from '@/composables/elevation'
@@ -107,33 +107,32 @@ export const VAlert = genericComponent<VAlertSlots>()({
107107 } ,
108108
109109 setup ( props , { emit, slots } ) {
110- const _props = useDefaults ( props )
111110 const { getSlotDefaultsInfo } = useSlotDefaults ( )
112- const isActive = useProxiedModel ( _props , 'modelValue' )
111+ const isActive = useProxiedModel ( props , 'modelValue' )
113112 const icon = toRef ( ( ) => {
114- if ( _props . icon === false ) return undefined
115- if ( ! _props . type ) return _props . icon
113+ if ( props . icon === false ) return undefined
114+ if ( ! props . type ) return props . icon
116115
117- return _props . icon ?? `$${ _props . type } `
116+ return props . icon ?? `$${ props . type } `
118117 } )
119118
120- const { iconSize } = useIconSizes ( _props , ( ) => _props . prominent ? 44 : undefined )
121- const { themeClasses } = provideTheme ( _props )
119+ const { iconSize } = useIconSizes ( props , ( ) => props . prominent ? 44 : undefined )
120+ const { themeClasses } = provideTheme ( props )
122121 const { colorClasses, colorStyles, variantClasses } = useVariant ( ( ) => ( {
123- color : _props . color ?? _props . type ,
124- variant : _props . variant ,
122+ color : props . color ?? props . type ,
123+ variant : props . variant ,
125124 } ) )
126- const { densityClasses } = useDensity ( _props )
127- const { dimensionStyles } = useDimension ( _props )
128- const { elevationClasses } = useElevation ( _props )
129- const { locationStyles } = useLocation ( _props )
130- const { positionClasses } = usePosition ( _props )
131- const { roundedClasses } = useRounded ( _props )
132- const { textColorClasses, textColorStyles } = useTextColor ( ( ) => _props . borderColor )
125+ const { densityClasses } = useDensity ( props )
126+ const { dimensionStyles } = useDimension ( props )
127+ const { elevationClasses } = useElevation ( props )
128+ const { locationStyles } = useLocation ( props )
129+ const { positionClasses } = usePosition ( props )
130+ const { roundedClasses } = useRounded ( props )
131+ const { textColorClasses, textColorStyles } = useTextColor ( ( ) => props . borderColor )
133132 const { t } = useLocale ( )
134133
135134 const closeProps = toRef ( ( ) => ( {
136- 'aria-label' : t ( _props . closeLabel ) ,
135+ 'aria-label' : t ( props . closeLabel ) ,
137136 onClick ( e : MouseEvent ) {
138137 isActive . value = false
139138
@@ -144,49 +143,46 @@ export const VAlert = genericComponent<VAlertSlots>()({
144143 // Helper function to wrap slot content with defaults
145144 function wrapSlot ( slotName : string , slotFn : ( ( ) => any ) | undefined , fallbackContent ?: any ) {
146145 const slotDefaultsInfo = getSlotDefaultsInfo ( slotName )
147-
148- if ( ! slotDefaultsInfo && ! slotFn ) {
149- return fallbackContent
150- }
146+ const content = slotFn ? slotFn ( ) : fallbackContent
151147
152148 if ( ! slotDefaultsInfo ) {
153- return slotFn ?. ( ) ?? fallbackContent
149+ return content
154150 }
155151
156152 const { componentDefaults, directProps } = slotDefaultsInfo
157153
158154 return (
159155 < VDefaultsProvider defaults = { componentDefaults as any } >
160156 < div { ...directProps } >
161- { slotFn ?. ( ) ?? fallbackContent }
157+ { content }
162158 </ div >
163159 </ VDefaultsProvider >
164160 )
165161 }
166162
167163 return ( ) => {
168164 const hasPrepend = ! ! ( slots . prepend || icon . value )
169- const hasTitle = ! ! ( slots . title || _props . title )
170- const hasClose = ! ! ( slots . close || _props . closable )
165+ const hasTitle = ! ! ( slots . title || props . title )
166+ const hasClose = ! ! ( slots . close || props . closable )
171167
172168 const iconProps = {
173- density : _props . density ,
169+ density : props . density ,
174170 icon : icon . value ,
175- size : _props . iconSize || _props . prominent
171+ size : props . iconSize || props . prominent
176172 ? iconSize . value
177173 : undefined ,
178174 }
179175
180176 return isActive . value && (
181- < _props . tag
177+ < props . tag
182178 class = { [
183179 'v-alert' ,
184- _props . border && {
185- 'v-alert--border' : ! ! _props . border ,
186- [ `v-alert--border-${ _props . border === true ? 'start' : _props . border } ` ] : true ,
180+ props . border && {
181+ 'v-alert--border' : ! ! props . border ,
182+ [ `v-alert--border-${ props . border === true ? 'start' : props . border } ` ] : true ,
187183 } ,
188184 {
189- 'v-alert--prominent' : _props . prominent ,
185+ 'v-alert--prominent' : props . prominent ,
190186 } ,
191187 themeClasses . value ,
192188 colorClasses . value ,
@@ -195,19 +191,19 @@ export const VAlert = genericComponent<VAlertSlots>()({
195191 positionClasses . value ,
196192 roundedClasses . value ,
197193 variantClasses . value ,
198- _props . class ,
194+ props . class ,
199195 ] }
200196 style = { [
201197 colorStyles . value ,
202198 dimensionStyles . value ,
203199 locationStyles . value ,
204- _props . style ,
200+ props . style ,
205201 ] }
206202 role = "alert"
207203 >
208204 { genOverlays ( false , 'v-alert' ) }
209205
210- { _props . border && (
206+ { props . border && (
211207 < div
212208 key = "border"
213209 class = { [
@@ -237,11 +233,11 @@ export const VAlert = genericComponent<VAlertSlots>()({
237233 < div class = "v-alert__content" >
238234 { hasTitle && (
239235 < VAlertTitle key = "title" >
240- { wrapSlot ( 'title' , slots . title , _props . title ) }
236+ { wrapSlot ( 'title' , slots . title , props . title ) }
241237 </ VAlertTitle >
242238 ) }
243239
244- { wrapSlot ( 'text' , slots . text , _props . text ) }
240+ { wrapSlot ( 'text' , slots . text , props . text ) }
245241
246242 { wrapSlot ( 'default' , slots . default ) }
247243 </ div >
@@ -257,7 +253,7 @@ export const VAlert = genericComponent<VAlertSlots>()({
257253 { ! slots . close ? (
258254 < VBtn
259255 key = "close-btn"
260- icon = { _props . closeIcon }
256+ icon = { props . closeIcon }
261257 size = "x-small"
262258 variant = "text"
263259 { ...closeProps . value }
@@ -267,7 +263,7 @@ export const VAlert = genericComponent<VAlertSlots>()({
267263 key = "close-defaults"
268264 defaults = { {
269265 VBtn : {
270- icon : _props . closeIcon ,
266+ icon : props . closeIcon ,
271267 size : 'x-small' ,
272268 variant : 'text' ,
273269 } ,
@@ -278,7 +274,7 @@ export const VAlert = genericComponent<VAlertSlots>()({
278274 ) }
279275 </ div >
280276 ) }
281- </ _props . tag >
277+ </ props . tag >
282278 )
283279 }
284280 } ,
0 commit comments