{"version":3,"sources":["../src/SectionHeading/SectionHeading.tsx"],"sourcesContent":["import * as React from 'react';\nimport { clsx } from 'clsx';\nimport { SectionIcon, SectionIconVariant } from '../SectionIcon';\n\nexport interface SectionHeadingButton {\n  /**\n   * The label for the button\n   */\n  label: string;\n  /**\n   * Optional icon to display before the label\n   */\n  icon?: React.ReactNode;\n  /**\n   * Click handler for the button\n   */\n  onClick?: () => void;\n}\n\nexport interface SectionHeadingButtonGroupItem {\n  /**\n   * The label for the button\n   */\n  label: string;\n  /**\n   * Optional icon to display before the label\n   */\n  icon?: React.ReactNode;\n  /**\n   * Optional value identifier\n   */\n  value?: string;\n}\n\nexport interface SectionHeadingProps {\n  /**\n   * The heading title text\n   */\n  title: string;\n  /**\n   * Show an icon badge next to the title.\n   * Can be a boolean (defaults to 'info') or a specific variant.\n   * Available variants: 'warning', 'danger', 'info', 'success'\n   */\n  icon?: boolean | SectionIconVariant;\n  /**\n   * Avatar configuration - can be an image URL or initials\n   */\n  avatar?: {\n    src?: string;\n    initials?: string;\n    alt?: string;\n  };\n  /**\n   * Primary button configuration (mutually exclusive with buttonGroup)\n   */\n  button?: SectionHeadingButton;\n  /**\n   * Button group configuration (mutually exclusive with button)\n   */\n  buttonGroup?: {\n    items: SectionHeadingButtonGroupItem[];\n    activeIndex?: number;\n    onChange?: (index: number) => void;\n  };\n  /**\n   * Additional CSS class name\n   */\n  className?: string;\n  /**\n   * Additional inline styles\n   */\n  style?: React.CSSProperties;\n}\n\n// Placeholder icon for avatar\nconst AvatarPlaceholder = () => (\n  <svg width=\"22\" height=\"33\" viewBox=\"0 0 22 33\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n    <circle cx=\"11\" cy=\"7\" r=\"7\" fill=\"#d1d1d1\" />\n    <ellipse cx=\"11\" cy=\"33\" rx=\"11\" ry=\"11\" fill=\"#d1d1d1\" />\n  </svg>\n);\n\n// Arbor Design System section heading styles\nconst sectionHeadingStyles = {\n  container: {\n    display: 'flex',\n    alignItems: 'center',\n    gap: '12px',\n    padding: '8px',\n    borderBottom: '1px solid #f8f8f8',\n    fontFamily: \"'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif\",\n    minHeight: '56px',\n    boxSizing: 'border-box' as const,\n  },\n  title: {\n    fontSize: '22px',\n    fontWeight: '600',\n    color: '#2f2f2f',\n    lineHeight: '1.25',\n    flex: 1,\n    overflow: 'hidden',\n    textOverflow: 'ellipsis',\n    whiteSpace: 'nowrap' as const,\n    margin: 0,\n  },\n  titleWithIcon: {\n    display: 'flex',\n    alignItems: 'center',\n    gap: '8px',\n    flex: 1,\n  },\n  iconBadge: {\n    display: 'flex',\n    alignItems: 'center',\n    flexShrink: 0,\n  },\n  avatar: {\n    width: '48px',\n    height: '48px',\n    borderRadius: '8px',\n    border: '1px solid #efefef',\n    backgroundColor: '#f8f8f8',\n    flexShrink: 0,\n    overflow: 'hidden',\n    display: 'flex',\n    alignItems: 'center',\n    justifyContent: 'center',\n  },\n  avatarImage: {\n    width: '100%',\n    height: '100%',\n    objectFit: 'cover' as const,\n  },\n  avatarInitials: {\n    fontSize: '18px',\n    fontWeight: '600',\n    color: '#595959',\n  },\n  button: {\n    display: 'inline-flex',\n    alignItems: 'center',\n    justifyContent: 'center',\n    gap: '8px',\n    height: '32px',\n    padding: '0 16px',\n    backgroundColor: '#0e8a0e',\n    color: '#ffffff',\n    border: 'none',\n    borderRadius: '99px',\n    fontSize: '13px',\n    fontWeight: '600',\n    cursor: 'pointer',\n    transition: 'background-color 0.15s ease-in-out',\n    whiteSpace: 'nowrap' as const,\n    flexShrink: 0,\n  },\n  buttonHover: {\n    backgroundColor: '#005700',\n  },\n  buttonGroup: {\n    container: {\n      display: 'inline-flex',\n      alignItems: 'center',\n      gap: '8px',\n      padding: '8px',\n      backgroundColor: '#ffffff',\n      border: '1px solid #efefef',\n      borderRadius: '99px',\n      flexShrink: 0,\n    },\n    button: {\n      base: {\n        display: 'inline-flex',\n        alignItems: 'center',\n        justifyContent: 'center',\n        gap: '8px',\n        padding: '8px 16px',\n        borderRadius: '99px',\n        border: 'none',\n        cursor: 'pointer',\n        fontSize: '13px',\n        fontWeight: '600',\n        lineHeight: '1.5',\n        transition: 'all 0.15s ease-in-out',\n        outline: 'none',\n        whiteSpace: 'nowrap' as const,\n      },\n      default: {\n        backgroundColor: 'transparent',\n        color: '#595959',\n      },\n      hover: {\n        backgroundColor: '#f8f8f8',\n        color: '#2f2f2f',\n      },\n      active: {\n        backgroundColor: '#0e8a0e',\n        color: '#ffffff',\n      },\n      activeHover: {\n        backgroundColor: '#005700',\n        color: '#ffffff',\n      },\n    },\n  },\n};\n\n/**\n * SectionHeading component - Arbor Design System\n *\n * A flexible section heading component that can include an icon, avatar,\n * button, or button group. Button and button group are mutually exclusive.\n *\n * @example\n * ```tsx\n * // Basic heading\n * <SectionHeading title=\"Section Title\" />\n *\n * // With icon\n * <SectionHeading title=\"Section Title\" icon />\n *\n * // With avatar\n * <SectionHeading\n *   title=\"User Profile\"\n *   avatar={{ src: \"/avatar.jpg\", alt: \"User\" }}\n * />\n *\n * // With button\n * <SectionHeading\n *   title=\"Section Title\"\n *   button={{ label: \"Add Item\", onClick: () => {} }}\n * />\n *\n * // With button group\n * <SectionHeading\n *   title=\"Section Title\"\n *   buttonGroup={{\n *     items: [{ label: \"Day\" }, { label: \"Week\" }],\n *     activeIndex: 0,\n *     onChange: (index) => {}\n *   }}\n * />\n * ```\n */\nexport const SectionHeading = React.forwardRef<HTMLDivElement, SectionHeadingProps>(\n  ({ title, icon, avatar, button, buttonGroup, className, style, ...props }, ref) => {\n    const [buttonHovered, setButtonHovered] = React.useState(false);\n    const [hoveredGroupIndex, setHoveredGroupIndex] = React.useState<number | null>(null);\n\n    // Warn if both button and buttonGroup are provided\n    if (button && buttonGroup) {\n      console.warn('SectionHeading: button and buttonGroup are mutually exclusive. Only button will be rendered.');\n    }\n\n    const renderAvatar = () => {\n      if (!avatar) return null;\n\n      return (\n        <div style={sectionHeadingStyles.avatar}>\n          {avatar.src ? (\n            <img\n              src={avatar.src}\n              alt={avatar.alt || 'Avatar'}\n              style={sectionHeadingStyles.avatarImage}\n            />\n          ) : avatar.initials ? (\n            <span style={sectionHeadingStyles.avatarInitials}>{avatar.initials}</span>\n          ) : (\n            <AvatarPlaceholder />\n          )}\n        </div>\n      );\n    };\n\n    const renderTitle = () => {\n      if (icon) {\n        // Determine the icon variant - default to 'info' if boolean true\n        const iconVariant: SectionIconVariant = typeof icon === 'string' ? icon : 'info';\n\n        return (\n          <div style={sectionHeadingStyles.titleWithIcon}>\n            <h2 style={{ ...sectionHeadingStyles.title, flex: 'none' }}>{title}</h2>\n            <div style={sectionHeadingStyles.iconBadge}>\n              <SectionIcon variant={iconVariant} />\n            </div>\n          </div>\n        );\n      }\n\n      return <h2 style={sectionHeadingStyles.title}>{title}</h2>;\n    };\n\n    const renderButton = () => {\n      if (!button) return null;\n\n      return (\n        <button\n          type=\"button\"\n          style={{\n            ...sectionHeadingStyles.button,\n            ...(buttonHovered && sectionHeadingStyles.buttonHover),\n          }}\n          onClick={button.onClick}\n          onMouseEnter={() => setButtonHovered(true)}\n          onMouseLeave={() => setButtonHovered(false)}\n        >\n          {button.icon && (\n            <span style={{ display: 'flex', alignItems: 'center', width: '16px', height: '16px' }}>\n              {button.icon}\n            </span>\n          )}\n          {button.label}\n        </button>\n      );\n    };\n\n    const renderButtonGroup = () => {\n      if (!buttonGroup || button) return null;\n\n      const { items, activeIndex = 0, onChange } = buttonGroup;\n\n      return (\n        <div style={sectionHeadingStyles.buttonGroup.container}>\n          {items.slice(0, 4).map((item, index) => {\n            const isActive = index === activeIndex;\n            const isHovered = hoveredGroupIndex === index;\n\n            let btnStyle: React.CSSProperties = {\n              ...sectionHeadingStyles.buttonGroup.button.base,\n            };\n\n            if (isActive) {\n              btnStyle = {\n                ...btnStyle,\n                ...sectionHeadingStyles.buttonGroup.button.active,\n                ...(isHovered && sectionHeadingStyles.buttonGroup.button.activeHover),\n              };\n            } else {\n              btnStyle = {\n                ...btnStyle,\n                ...sectionHeadingStyles.buttonGroup.button.default,\n                ...(isHovered && sectionHeadingStyles.buttonGroup.button.hover),\n              };\n            }\n\n            return (\n              <button\n                key={item.value || index}\n                type=\"button\"\n                style={btnStyle}\n                onClick={() => {\n                  if (index !== activeIndex && onChange) {\n                    onChange(index);\n                  }\n                }}\n                onMouseEnter={() => setHoveredGroupIndex(index)}\n                onMouseLeave={() => setHoveredGroupIndex(null)}\n              >\n                {item.icon && (\n                  <span style={{ display: 'flex', alignItems: 'center', width: '16px', height: '16px' }}>\n                    {item.icon}\n                  </span>\n                )}\n                {item.label}\n              </button>\n            );\n          })}\n        </div>\n      );\n    };\n\n    return (\n      <div\n        ref={ref}\n        className={clsx('arbor-section-heading', className)}\n        style={{ ...sectionHeadingStyles.container, ...style }}\n        {...props}\n      >\n        {renderAvatar()}\n        {renderTitle()}\n        {renderButton()}\n        {renderButtonGroup()}\n      </div>\n    );\n  }\n);\n\nSectionHeading.displayName = 'SectionHeading';\n"],"mappings":";;;;;AAAA,YAAY,WAAW;AACvB,SAAS,YAAY;AA4EnB,SACE,KADF;AADF,IAAM,oBAAoB,MACxB,qBAAC,SAAI,OAAM,MAAK,QAAO,MAAK,SAAQ,aAAY,MAAK,QAAO,OAAM,8BAChE;AAAA,sBAAC,YAAO,IAAG,MAAK,IAAG,KAAI,GAAE,KAAI,MAAK,WAAU;AAAA,EAC5C,oBAAC,aAAQ,IAAG,MAAK,IAAG,MAAK,IAAG,MAAK,IAAG,MAAK,MAAK,WAAU;AAAA,GAC1D;AAIF,IAAM,uBAAuB;AAAA,EAC3B,WAAW;AAAA,IACT,SAAS;AAAA,IACT,YAAY;AAAA,IACZ,KAAK;AAAA,IACL,SAAS;AAAA,IACT,cAAc;AAAA,IACd,YAAY;AAAA,IACZ,WAAW;AAAA,IACX,WAAW;AAAA,EACb;AAAA,EACA,OAAO;AAAA,IACL,UAAU;AAAA,IACV,YAAY;AAAA,IACZ,OAAO;AAAA,IACP,YAAY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