"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.DEFAULT_RIGHT_ICON_NAME = exports.DEFAULT_LEFT_ICON_NAME = void 0;
const tslib_1 = require("tslib");
const react_1 = tslib_1.__importStar(require("react"));
const native_1 = require("@platformbuilders/helpers/native");
const enums_1 = require("../../enums");
const styles_1 = require("./styles");
exports.DEFAULT_LEFT_ICON_NAME = 'arrow-left';
exports.DEFAULT_RIGHT_ICON_NAME = 'times';
const Header = ({ children, title, theme = enums_1.HeaderTheme.PRIMARY, subtitle = '', accessibilityLeftIcon = '', accessibilityRightIcon = '', showLeftIcon = true, showRightIcon = true, leftIconName = exports.DEFAULT_LEFT_ICON_NAME, rightIconName = exports.DEFAULT_RIGHT_ICON_NAME, onPressLeftIcon, onPressRightIcon, }) => {
    const hasChildren = react_1.Children.count(children) > 0;
    const isIOSPlatform = (0, native_1.isIOS)();
    const isThemePrimary = theme === enums_1.HeaderTheme.PRIMARY;
    return (<styles_1.Wrapper isThemePrimary={isThemePrimary} isIOSPlatform={isIOSPlatform}>
      <styles_1.ContentWrapper isIOSPlatform={isIOSPlatform} isThemePrimary={isThemePrimary}>
        {showLeftIcon && leftIconName?.length > 0 && (<styles_1.StyledIcon isThemePrimary={isThemePrimary} accessibility={accessibilityLeftIcon || leftIconName} type={enums_1.IconFonts.FontAwesome} onPress={onPressLeftIcon} name={leftIconName}/>)}
        {hasChildren ? (children) : (<styles_1.TextWrapper>
            <styles_1.Title isThemePrimary={isThemePrimary}>{title}</styles_1.Title>
            {subtitle?.length > 0 && (<styles_1.Subtitle isThemePrimary={isThemePrimary}>{subtitle}</styles_1.Subtitle>)}
          </styles_1.TextWrapper>)}
        {showRightIcon && rightIconName?.length > 0 && (<styles_1.StyledIcon isThemePrimary={isThemePrimary} accessibility={accessibilityRightIcon || rightIconName} type={enums_1.IconFonts.FontAwesome} onPress={onPressRightIcon} name={rightIconName}/>)}
      </styles_1.ContentWrapper>
    </styles_1.Wrapper>);
};
exports.default = Header;
//# sourceMappingURL=index.js.map