{"version":3,"file":"BottomNavigation.cjs","sources":["../../../../src/components/navigation/bottom-navigation/BottomNavigation.tsx"],"sourcesContent":["import { memo, useCallback, useMemo, useState } from 'react'\n\nimport BottomNavigationItem from '@components/navigation/bottom-navigation/components/bottom-navigation-item/BottomNavigationItem.tsx'\nimport BottomNavigationList from '@components/navigation/bottom-navigation/components/bottom-navigation-list/BottomNavigationList.tsx'\nimport { BottomNavigationContext } from '@components/navigation/bottom-navigation/context/BottomNavigation.context.ts'\nimport { BOTTOM_NAVIGATION_STYLES } from '@components/navigation/bottom-navigation/styles/BottomNavigation.css.ts'\nimport type { BottomNavigationCompound } from '@components/navigation/bottom-navigation/types/BottomNavigationCompound.ts'\nimport type { BottomNavigationProps } from '@components/navigation/bottom-navigation/types/BottomNavigation.props.ts'\nimport { cn } from '@utils/cn.ts'\n\n/**\n * Mobile-first navigation landmark with a full-width bottom presentation.\n *\n * Compose `BottomNavigation`, `BottomNavigation.List`, and\n * `BottomNavigation.Item`. Items can be links or native buttons and selection\n * supports both controlled and uncontrolled state.\n */\nconst BottomNavigation = memo<BottomNavigationProps>(\n    ({\n        'aria-label': ariaLabel,\n        'aria-labelledby': ariaLabelledBy,\n        children,\n        value,\n        defaultValue,\n        onValueChange,\n        bordered = false,\n        className,\n        ref,\n        ...props\n    }) => {\n        const [internalValue, setInternalValue] = useState(defaultValue)\n        const isControlled = value !== undefined\n        const selectedValue = isControlled ? value : internalValue\n        const handleValueChange = useCallback(\n            (nextValue: string) => {\n                if (!isControlled) {\n                    setInternalValue(nextValue)\n                }\n                onValueChange?.(nextValue)\n            },\n            [isControlled, onValueChange],\n        )\n        const contextValue = useMemo(\n            () => ({\n                value: selectedValue,\n                onValueChange: handleValueChange,\n            }),\n            [handleValueChange, selectedValue],\n        )\n\n        return (\n            <BottomNavigationContext.Provider value={contextValue}>\n                <nav\n                    ref={ref}\n                    {...props}\n                    aria-label={ariaLabel}\n                    aria-labelledby={ariaLabelledBy}\n                    className={cn(\n                        BOTTOM_NAVIGATION_STYLES.root,\n                        bordered && BOTTOM_NAVIGATION_STYLES.bordered,\n                        className,\n                    )}\n                >\n                    {children}\n                </nav>\n            </BottomNavigationContext.Provider>\n        )\n    },\n) as unknown as BottomNavigationCompound\n\nBottomNavigation.displayName = 'BottomNavigation'\nBottomNavigation.List = BottomNavigationList\nBottomNavigation.Item = BottomNavigationItem\n\nexport default BottomNavigation\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"}