{"version":3,"file":"BottomNavigation.cjs","sources":["../../../../src/components/navigation/bottom-navigation/BottomNavigation.tsx"],"sourcesContent":["import { memo, useCallback, useMemo, useState } from 'react'\r\n\r\nimport BottomNavigationItem from '@components/navigation/bottom-navigation/components/bottom-navigation-item/BottomNavigationItem.tsx'\r\nimport BottomNavigationList from '@components/navigation/bottom-navigation/components/bottom-navigation-list/BottomNavigationList.tsx'\r\nimport { BottomNavigationContext } from '@components/navigation/bottom-navigation/context/BottomNavigation.context.ts'\r\nimport { BOTTOM_NAVIGATION_STYLES } from '@components/navigation/bottom-navigation/styles/BottomNavigation.css.ts'\r\nimport type { BottomNavigationCompound } from '@components/navigation/bottom-navigation/types/BottomNavigationCompound.ts'\r\nimport type { BottomNavigationProps } from '@components/navigation/bottom-navigation/types/BottomNavigation.props.ts'\r\nimport { cn } from '@utils/cn.ts'\r\n\r\n/**\r\n * Mobile-first navigation landmark with a full-width bottom presentation.\r\n *\r\n * Compose `BottomNavigation`, `BottomNavigation.List`, and\r\n * `BottomNavigation.Item`. Items can be links or native buttons and selection\r\n * supports both controlled and uncontrolled state.\r\n */\r\nconst BottomNavigation = memo<BottomNavigationProps>(\r\n    ({\r\n        'aria-label': ariaLabel,\r\n        'aria-labelledby': ariaLabelledBy,\r\n        children,\r\n        value,\r\n        defaultValue,\r\n        onValueChange,\r\n        bordered = false,\r\n        className,\r\n        ref,\r\n        ...props\r\n    }) => {\r\n        const [internalValue, setInternalValue] = useState(defaultValue)\r\n        const isControlled = value !== undefined\r\n        const selectedValue = isControlled ? value : internalValue\r\n        const handleValueChange = useCallback(\r\n            (nextValue: string) => {\r\n                if (!isControlled) {\r\n                    setInternalValue(nextValue)\r\n                }\r\n                onValueChange?.(nextValue)\r\n            },\r\n            [isControlled, onValueChange],\r\n        )\r\n        const contextValue = useMemo(\r\n            () => ({\r\n                value: selectedValue,\r\n                onValueChange: handleValueChange,\r\n            }),\r\n            [handleValueChange, selectedValue],\r\n        )\r\n\r\n        return (\r\n            <BottomNavigationContext.Provider value={contextValue}>\r\n                <nav\r\n                    ref={ref}\r\n                    {...props}\r\n                    aria-label={ariaLabel}\r\n                    aria-labelledby={ariaLabelledBy}\r\n                    className={cn(\r\n                        BOTTOM_NAVIGATION_STYLES.root,\r\n                        bordered && BOTTOM_NAVIGATION_STYLES.bordered,\r\n                        className,\r\n                    )}\r\n                >\r\n                    {children}\r\n                </nav>\r\n            </BottomNavigationContext.Provider>\r\n        )\r\n    },\r\n) as unknown as BottomNavigationCompound\r\n\r\nBottomNavigation.displayName = 'BottomNavigation'\r\nBottomNavigation.List = BottomNavigationList\r\nBottomNavigation.Item = BottomNavigationItem\r\n\r\nexport default BottomNavigation\r\n"],"names":["BottomNavigation","memo","ariaLabel","ariaLabelledBy","children","value","defaultValue","onValueChange","bordered","className","ref","props","internalValue","setInternalValue","useState","isControlled","selectedValue","handleValueChange","useCallback","nextValue","contextValue","useMemo","jsx","BottomNavigationContext","cn","BOTTOM_NAVIGATION_STYLES","BottomNavigationList","BottomNavigationItem"],"mappings":"+VAiBMA,EAAmBC,EAAAA,KACrB,CAAC,CACG,aAAcC,EACd,kBAAmBC,EACnB,SAAAC,EACA,MAAAC,EACA,aAAAC,EACA,cAAAC,EACA,SAAAC,EAAW,GACX,UAAAC,EACA,IAAAC,EACA,GAAGC,CAAA,IACD,CACF,KAAM,CAACC,EAAeC,CAAgB,EAAIC,EAAAA,SAASR,CAAY,EACzDS,EAAeV,IAAU,OACzBW,EAAgBD,EAAeV,EAAQO,EACvCK,EAAoBC,EAAAA,YACrBC,GAAsB,CACdJ,GACDF,EAAiBM,CAAS,EAE9BZ,IAAgBY,CAAS,CAC7B,EACA,CAACJ,EAAcR,CAAa,CAAA,EAE1Ba,EAAeC,EAAAA,QACjB,KAAO,CACH,MAAOL,EACP,cAAeC,CAAA,GAEnB,CAACA,EAAmBD,CAAa,CAAA,EAGrC,OACIM,EAAAA,IAACC,EAAAA,wBAAwB,SAAxB,CAAiC,MAAOH,EACrC,SAAAE,EAAAA,IAAC,MAAA,CACG,IAAAZ,EACC,GAAGC,EACJ,aAAYT,EACZ,kBAAiBC,EACjB,UAAWqB,EAAAA,GACPC,EAAAA,yBAAyB,KACzBjB,GAAYiB,EAAAA,yBAAyB,SACrChB,CAAA,EAGH,SAAAL,CAAA,CAAA,EAET,CAER,CACJ,EAEAJ,EAAiB,YAAc,mBAC/BA,EAAiB,KAAO0B,EACxB1B,EAAiB,KAAO2B"}