Skip to content

Commit 2e683fa

Browse files
committed
fix(styled): defaultProps override
1 parent 7eaeb3c commit 2e683fa

File tree

5 files changed

+13
-4
lines changed

5 files changed

+13
-4
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
'@pandacss/generator': patch
3+
---
4+
5+
Fix issue where specifying `defaultProps.children` in the `styled` or `createStyleContext` factories makes it impossible
6+
to override children.
7+
8+
The fix ensures that explicitly passed children take precedence over default children in React, Preact, and Qwik JSX
9+
factories.

packages/generator/src/artifacts/preact-jsx/jsx.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ export function generatePreactJsxFactory(ctx: Context) {
7171
...normalizeHTMLProps(htmlProps),
7272
ref,
7373
className: classes()
74-
}, combinedProps.children ?? children)
74+
}, children ?? combinedProps.children)
7575
})
7676
7777
const name = getDisplayName(__base__)

packages/generator/src/artifacts/qwik-jsx/jsx.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ export function generateQwikJsxFactory(ctx: Context) {
6868
...elementProps,
6969
...normalizeHTMLProps(htmlProps),
7070
class: classes(),
71-
}, combinedProps.children ?? children)
71+
}, children ?? combinedProps.children)
7272
}
7373
7474
const name = getDisplayName(__base__)

packages/generator/src/artifacts/react-jsx/jsx.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ export function generateReactJsxFactory(ctx: Context) {
6868
...elementProps,
6969
...normalizeHTMLProps(htmlProps),
7070
className: classes(),
71-
}, combinedProps.children ?? children)
71+
}, children ?? combinedProps.children)
7272
})
7373
7474
const name = getDisplayName(__base__)

packages/studio/styled-system/jsx/factory.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ function styledFn(Dynamic, configOrCva = {}, options = {}) {
5757
...elementProps,
5858
...normalizeHTMLProps(htmlProps),
5959
className: classes(),
60-
}, combinedProps.children ?? children)
60+
}, children ?? combinedProps.children)
6161
})
6262

6363
const name = getDisplayName(__base__)

0 commit comments

Comments
 (0)