@@ -226,21 +226,35 @@ fn transform_element(
226226 continue ;
227227 }
228228 }
229- hast:: PropertyValue :: String ( x) => Some ( Lit :: Str ( Str {
229+ hast:: PropertyValue :: String ( x) => Some ( JSXAttrValue :: Lit ( Lit :: Str ( Str {
230230 value : x. clone ( ) . into ( ) ,
231231 span : swc_core:: common:: DUMMY_SP ,
232232 raw : None ,
233- } ) ) ,
234- hast:: PropertyValue :: CommaSeparated ( x) => Some ( Lit :: Str ( Str {
233+ } ) ) ) ,
234+ hast:: PropertyValue :: CommaSeparated ( x) => Some ( JSXAttrValue :: Lit ( Lit :: Str ( Str {
235235 value : x. join ( ", " ) . into ( ) ,
236236 span : swc_core:: common:: DUMMY_SP ,
237237 raw : None ,
238- } ) ) ,
239- hast:: PropertyValue :: SpaceSeparated ( x) => Some ( Lit :: Str ( Str {
238+ } ) ) ) ,
239+ hast:: PropertyValue :: SpaceSeparated ( x) => Some ( JSXAttrValue :: Lit ( Lit :: Str ( Str {
240240 value : x. join ( " " ) . into ( ) ,
241241 span : swc_core:: common:: DUMMY_SP ,
242242 raw : None ,
243- } ) ) ,
243+ } ) ) ) ,
244+ hast:: PropertyValue :: JsxExpression ( x) => {
245+ Some ( JSXAttrValue :: JSXExprContainer ( JSXExprContainer {
246+ expr : JSXExpr :: Expr (
247+ parse_expression_to_tree (
248+ & x,
249+ & MdxExpressionKind :: AttributeValueExpression ,
250+ & [ ] ,
251+ context. location ,
252+ ) ?
253+ . unwrap ( ) ,
254+ ) ,
255+ span : swc_core:: common:: DUMMY_SP ,
256+ } ) )
257+ }
244258 } ;
245259
246260 // Turn property case into either React-specific case, or HTML
@@ -250,7 +264,7 @@ fn transform_element(
250264
251265 attrs. push ( JSXAttrOrSpread :: JSXAttr ( JSXAttr {
252266 name : create_jsx_attr_name_from_str ( & attr_name) ,
253- value : value . map ( JSXAttrValue :: Lit ) ,
267+ value,
254268 span : swc_core:: common:: DUMMY_SP ,
255269 } ) ) ;
256270
0 commit comments