import '../../../globals.js';
// Copyright 2021-2023, University of Colorado Boulder
/**
 * A section of content in a PreferencesPanel of the PreferencseDialog. Handles layout for the title of the section
 * and its content. The preferences panels are responsible for layout of multiple PreferencesTabPanelSections.
 *
 * @author Jesse Greenberg (PhET Interactive Simulations)
 */
import optionize, { combineOptions } from '../../../phet-core/js/optionize.js';
import { AlignGroup, Node, VBox } from '../../../scenery/js/imports.js';
import joist from '../joist.js';
import PreferencesDialog from './PreferencesDialog.js';
class PreferencesPanelSection extends VBox {
    constructor(providedOptions) {
        const options = optionize()({
            spacing: PreferencesDialog.CONTENT_SPACING,
            titleNode: null,
            contentNode: null,
            contentNodeOptions: {},
            contentLeftMargin: 30
        }, providedOptions);
        // layout - supports the layout of contentNode nested under the titleNode with indentation
        const sectionAlignGroup = new AlignGroup({ matchVertical: false });
        const sectionChildren = [];
        if (options.titleNode) {
            sectionChildren.push(sectionAlignGroup.createBox(options.titleNode, {
                xAlign: 'left'
            }));
        }
        if (options.contentNode) {
            const contentNodeOptions = combineOptions({ children: [options.contentNode] }, options.contentNodeOptions);
            sectionChildren.push(sectionAlignGroup.createBox(new Node(contentNodeOptions), {
                leftMargin: options.contentLeftMargin,
                xAlign: 'left'
            }));
        }
        options.children = sectionChildren;
        super(options);
    }
}
joist.register('PreferencesPanelSection', PreferencesPanelSection);
export default PreferencesPanelSection;
//# sourceMappingURL=PreferencesPanelSection.js.map