/* @oracle/oraclejet-preact: undefined */
'use strict';

var jsxRuntime = require('preact/jsx-runtime');
require('preact/hooks');
require('./LayerHost-8ec73638.js');
var compat = require('preact/compat');
require('./UNSAFE_Text/themes/TextStyles.css.js');
require('./Flex-da9f223a.js');
var useTabBarContext = require('./useTabBarContext-2a6a796c.js');
require('./flexitem-fee13e26.js');
require('./dimensions-b4be9793.js');
require('./boxalignment-28ee3565.js');
require('./logger-2b636482.js');


require('./UNSAFE_TabBarCommon/themes/redwood/TabBarItemVariants.css.js');
require('./ConveyorBeltContext-bfe84b44.js');
require('./VisBusyStateContext-223f53dd.js');
require('preact');


require('./hooks/UNSAFE_useTooltip/themes/redwood/TooltipContentVariants.css.js');
require('./tooltipUtils-d461919d.js');

require('./Floating-dd6667de.js');

require('./keyboardUtils-c071859a.js');
require('./tabbableUtils-66ae6ba3.js');
require('./CollectionInteractionContext-f84ff7a1.js');

require('./Sheet-78113d87.js');

var TabBarLayout = require('./TabBarLayout-5cf3939d.js');
var UNSAFE_TabBar_themes_TabBarStyles_css = require('./UNSAFE_TabBar/themes/TabBarStyles.css.js');
var useTabBar = require('./useTabBar-697db61c.js');
var Menu = require('./Menu-77687523.js');
require('./MenuItem-1878e08e.js');
require('./SelectMenuGroupContext-bbb4f7e0.js');
require('./UNSAFE_Separator/themes/SeparatorStyles.css.js');


require('./UNSAFE_Menu/themes/redwood/MenuSeparatorVariants.css.js');

/**
 * The internal component used to render a custom context menu
 */
function TabBarContextMenu({ contextMenuConfig, contextMenuContext, ...menuProps }) {
    const accessibleLabel = contextMenuConfig.accessibleLabel;
    const menuItems = contextMenuConfig.itemsRenderer(contextMenuContext);
    if (menuItems == null) {
        return null;
    }
    return (jsxRuntime.jsx(jsxRuntime.Fragment, { children: jsxRuntime.jsx(Menu.Menu, { ...menuProps, ...(accessibleLabel && {
                'aria-label': accessibleLabel
            }), children: menuProps.isOpen && contextMenuConfig.itemsRenderer(contextMenuContext) }) }));
}

/**
 * A tab bar allows navigation between different content sections.
 */
const TabBar = compat.forwardRef(({ children, layout = 'stretch', display = 'standard', size = 'md', edge = 'top', selection, onSelect, onRemove, 'aria-describedby': ariaDescribedBy, 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledby, contextMenuConfig }, ref) => {
    const rootRef = ref;
    const { rootProps, tabBarContext, menuProps, contextMenuContext } = useTabBar.useTabBar({
        class: UNSAFE_TabBar_themes_TabBarStyles_css.styles.tabBarBase,
        edge: edge,
        onRemove,
        onSelect,
        ref: rootRef,
        selection,
        size,
        children,
        contextMenuConfig
    });
    return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(useTabBarContext.TabBarContext.Provider, { value: tabBarContext, children: jsxRuntime.jsx("div", { ...rootProps, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledby, "aria-describedby": ariaDescribedBy, children: jsxRuntime.jsx(TabBarLayout.TabBarLayout, { layout: layout, display: display, children: children }) }) }), contextMenuConfig && (jsxRuntime.jsx(TabBarContextMenu, { ...menuProps, contextMenuConfig: contextMenuConfig, contextMenuContext: contextMenuContext }))] }));
});

exports.TabBar = TabBar;
//# sourceMappingURL=TabBar-ae497b21.js.map
