'use client' import { forwardRef } from 'react' import classNames from 'classnames' import { isInteger, isNil } from '~/src/utils/type' import type LegacyStackItemProps from './LegacyStackItem.types' import styles from './LegacyStackItem.module.scss' const sanitizeWeight = (weight: number): number => { if (weight < 0) { return 0 } if (!isInteger(weight)) { return 0 } return weight } /** * @deprecated Use layout components(`Box`, `Stack`) that support flex item related properties (`shrink`, `grow`) instead. * @example * * ``` * * * { ... } * * * * ``` * * * `StackItem` is used along `Stack`. * It inherits the default settings from `Stack`, * but allows to override some props to customize the behavior * of particular item. * * If you are not using `StackItem` as the direct child of `Stack`, * be reminded to forward props in `StackItemProps` to `StackItem` component, * or manually implement the behavior compatible with `StackItem`. */ export const LegacyStackItem = forwardRef( function StackItem( { as = 'div', children, style, className, direction, justify, align, size, weight = 0, grow = false, shrink = false, marginBefore = 0, marginAfter = 0, ...rest }, forwardedRef ) { const Comp = as return ( {children} ) } )