1- import { chakra , forwardRef , SystemProps } from "@chakra-ui/system" ;
1+ import {
2+ chakra ,
3+ forwardRef ,
4+ type MergeWithAs ,
5+ SystemProps ,
6+ } from "@chakra-v2/react" ;
27import {
38 __DEV__ ,
49 AlignContent ,
@@ -23,56 +28,64 @@ export interface FlexItemProps extends WithChildren, SafeFlexItemProps {
2328 order ?: number ;
2429}
2530
26- export const FlexItem = forwardRef < FlexItemProps , "div" > ( function FlexItem (
27- {
28- alignSelf,
29- grow,
30- shrink = 1 ,
31- basis = "auto" ,
32- children,
33- overflowAnchor,
34- order,
35- ...props
31+ export const FlexItem = forwardRef < MergeWithAs < { } , { } , FlexItemProps > , "div" > (
32+ function FlexItem (
33+ {
34+ alignSelf,
35+ grow,
36+ shrink = 1 ,
37+ basis = "auto" ,
38+ children,
39+ overflowAnchor,
40+ order,
41+ as,
42+ ...props
43+ } ,
44+ ref ,
45+ ) {
46+ return (
47+ < chakra . div
48+ ref = { ref }
49+ as = { as }
50+ display = "flex"
51+ overflow = "visible"
52+ alignItems = "stretch"
53+ flexDirection = { unsafeCoerce ( "var(--pcss-flex-child-direction)" ) }
54+ flexGrow = {
55+ grow !== undefined
56+ ? grow
57+ : unsafeCoerce ( "var(--pcss-flex-child-grow)" )
58+ }
59+ flexShrink = { shrink }
60+ flexBasis = { basis }
61+ order = { order }
62+ justifyContent = {
63+ alignSelf ?? unsafeCoerce ( "var(--pcss-flex-align-items)" )
64+ }
65+ minW = { shrink > 0 ? "var(--pcss-flex-child-shrink-width)" : "auto" }
66+ minH = { shrink > 0 ? "var(--pcss-flex-child-shrink-height)" : "auto" }
67+ __css = { {
68+ "& > *" : {
69+ flexGrow :
70+ alignSelf === "stretch"
71+ ? 1
72+ : alignSelf !== undefined
73+ ? 0
74+ : unsafeCoerce ( "var(--pcss-flex-grandchild-grow)" ) ,
75+ flexShrink : 1 ,
76+ flexBasis : "auto" ,
77+ minWidth : "var(--pcss-flex-grandchild-shrink-width)" ,
78+ minHeight : "var(--pcss-flex-grandchild-shrink-height)" ,
79+ } ,
80+ overflowAnchor,
81+ } }
82+ { ...props }
83+ >
84+ { children }
85+ </ chakra . div >
86+ ) ;
3687 } ,
37- ref ,
38- ) {
39- return (
40- < chakra . div
41- ref = { ref }
42- display = "flex"
43- overflow = "visible"
44- alignItems = "stretch"
45- flexDirection = { unsafeCoerce ( "var(--pcss-flex-child-direction)" ) }
46- flexGrow = {
47- grow !== undefined ? grow : unsafeCoerce ( "var(--pcss-flex-child-grow)" )
48- }
49- flexShrink = { shrink }
50- flexBasis = { basis }
51- order = { order }
52- justifyContent = { alignSelf ?? unsafeCoerce ( "var(--pcss-flex-align-items)" ) }
53- minW = { shrink > 0 ? "var(--pcss-flex-child-shrink-width)" : "auto" }
54- minH = { shrink > 0 ? "var(--pcss-flex-child-shrink-height)" : "auto" }
55- __css = { {
56- "& > *" : {
57- flexGrow :
58- alignSelf === "stretch"
59- ? 1
60- : alignSelf !== undefined
61- ? 0
62- : unsafeCoerce ( "var(--pcss-flex-grandchild-grow)" ) ,
63- flexShrink : 1 ,
64- flexBasis : "auto" ,
65- minWidth : "var(--pcss-flex-grandchild-shrink-width)" ,
66- minHeight : "var(--pcss-flex-grandchild-shrink-height)" ,
67- } ,
68- overflowAnchor,
69- } }
70- { ...props }
71- >
72- { children }
73- </ chakra . div >
74- ) ;
75- } ) ;
88+ ) ;
7689
7790if ( __DEV__ ) {
7891 FlexItem . displayName = "FlexItem" ;
0 commit comments