"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.LayoutToolbar = exports.ToolbarGroup = exports.ToolbarDivider = exports.ToolbarItem = void 0;
const jsx_runtime_1 = require("react/jsx-runtime");
const prop_types_1 = __importDefault(require("prop-types"));
const ThemeProvider_js_1 = require("./ThemeProvider.js");
/**
 * ToolbarItem component for layout toolbar actions
 * @param {Object} props - Component props
 * @param {React.ReactNode} props.children - Child components
 * @param {string} props.className - Additional CSS classes
 * @param {Function} props.onClick - Click handler
 * @param {string} props.tooltip - Tooltip text
 * @param {string} props.icon - Icon name or component
 * @returns {React.ReactElement} ToolbarItem component
 */
const ToolbarItem = ({ children, className = '', onClick, tooltip, icon, ...rest }) => {
    return ((0, jsx_runtime_1.jsxs)("button", { className: `bf-layout-toolbar__item ${className}`, onClick: onClick, title: tooltip, type: "button", ...rest, children: [icon && (0, jsx_runtime_1.jsx)("span", { className: "bf-layout-toolbar__item-icon", children: icon }), children && (0, jsx_runtime_1.jsx)("span", { className: "bf-layout-toolbar__item-text", children: children })] }));
};
exports.ToolbarItem = ToolbarItem;
exports.ToolbarItem.propTypes = {
    children: prop_types_1.default.node,
    className: prop_types_1.default.string,
    onClick: prop_types_1.default.func,
    tooltip: prop_types_1.default.string,
    icon: prop_types_1.default.oneOfType([prop_types_1.default.string, prop_types_1.default.node])
};
/**
 * ToolbarDivider component
 * @returns {React.ReactElement} ToolbarDivider component
 */
const ToolbarDivider = () => ((0, jsx_runtime_1.jsx)("div", { className: "bf-layout-toolbar__divider" }));
exports.ToolbarDivider = ToolbarDivider;
/**
 * ToolbarGroup component
 * @param {Object} props - Component props
 * @param {React.ReactNode} props.children - Child components
 * @param {string} props.className - Additional CSS classes
 * @param {string} props.label - Group label
 * @returns {React.ReactElement} ToolbarGroup component
 */
const ToolbarGroup = ({ children, className = '', label, ...rest }) => {
    return ((0, jsx_runtime_1.jsxs)("div", { className: `bf-layout-toolbar__group ${className}`, ...rest, children: [label && (0, jsx_runtime_1.jsx)("div", { className: "bf-layout-toolbar__group-label", children: label }), (0, jsx_runtime_1.jsx)("div", { className: "bf-layout-toolbar__group-items", children: children })] }));
};
exports.ToolbarGroup = ToolbarGroup;
exports.ToolbarGroup.propTypes = {
    children: prop_types_1.default.node,
    className: prop_types_1.default.string,
    label: prop_types_1.default.string
};
/**
 * LayoutToolbar component for layout customization
 * @param {Object} props - Component props
 * @param {React.ReactNode} props.children - Child components
 * @param {string} props.className - Additional CSS classes
 * @param {Object} props.style - Additional inline styles
 * @param {string} props.position - Toolbar position (top, bottom, left, right)
 * @param {boolean} props.floating - Whether the toolbar is floating
 * @param {boolean} props.collapsed - Whether the toolbar is collapsed
 * @param {Function} props.onToggleCollapse - Collapse toggle handler
 * @param {boolean} props.showThemeToggle - Whether to show theme toggle button
 * @returns {React.ReactElement} LayoutToolbar component
 */
const LayoutToolbar = ({ children, className = '', style = {}, position = 'top', floating = false, collapsed = false, onToggleCollapse, showThemeToggle = true, ...rest }) => {
    const { theme, toggleTheme } = (0, ThemeProvider_js_1.useTheme)();
    const toolbarClasses = [
        'bf-layout-toolbar',
        `bf-layout-toolbar--${position}`,
        floating ? 'bf-layout-toolbar--floating' : '',
        collapsed ? 'bf-layout-toolbar--collapsed' : '',
        className
    ].filter(Boolean).join(' ');
    return ((0, jsx_runtime_1.jsxs)("div", { className: toolbarClasses, style: style, ...rest, children: [onToggleCollapse && ((0, jsx_runtime_1.jsx)(exports.ToolbarItem, { className: "bf-layout-toolbar__collapse-button", onClick: onToggleCollapse, tooltip: collapsed ? 'Expand toolbar' : 'Collapse toolbar', icon: collapsed ? '⟩' : '⟨' })), (0, jsx_runtime_1.jsxs)("div", { className: "bf-layout-toolbar__content", children: [children, showThemeToggle && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(exports.ToolbarDivider, {}), (0, jsx_runtime_1.jsx)(exports.ToolbarItem, { onClick: toggleTheme, tooltip: `Switch to ${theme === 'light' ? 'dark' : 'light'} theme`, icon: theme === 'light' ? '🌙' : '☀️', children: theme === 'light' ? 'Dark mode' : 'Light mode' })] }))] })] }));
};
exports.LayoutToolbar = LayoutToolbar;
exports.LayoutToolbar.propTypes = {
    children: prop_types_1.default.node,
    className: prop_types_1.default.string,
    style: prop_types_1.default.object,
    position: prop_types_1.default.oneOf(['top', 'bottom', 'left', 'right']),
    floating: prop_types_1.default.bool,
    collapsed: prop_types_1.default.bool,
    onToggleCollapse: prop_types_1.default.func,
    showThemeToggle: prop_types_1.default.bool
};
// Export sub-components
exports.LayoutToolbar.Item = exports.ToolbarItem;
exports.LayoutToolbar.Divider = exports.ToolbarDivider;
exports.LayoutToolbar.Group = exports.ToolbarGroup;
exports.default = exports.LayoutToolbar;
//# sourceMappingURL=LayoutToolbar.js.map