// Copyright 2020-2025, University of Colorado Boulder
/**
 * Help section for explaining how to use a keyboard to interact with a ComboBox.
 *
 * @author Michael Kauzmann (PhET Interactive Simulations)
 */
import { string_scenery_phet_keyboardHelpDialog_comboBox_headingString_StringProperty } from '../../strings/keyboardHelpDialog/comboBox/headingString.js';
import { string_scenery_phet_keyboardHelpDialog_comboBox_option_StringProperty } from '../../strings/keyboardHelpDialog/comboBox/option.js';
import { string_scenery_phet_keyboardHelpDialog_comboBox_options_StringProperty } from '../../strings/keyboardHelpDialog/comboBox/options.js';
import { string_scenery_phet_keyboardHelpDialog_comboBox_popUpListPattern_StringProperty } from '../../strings/keyboardHelpDialog/comboBox/popUpListPattern.js';
import { string_scenery_phet_a11y_keyboardHelpDialog_comboBox_popUpListPatternDescription_StringProperty } from '../../strings/a11y/keyboardHelpDialog/comboBox/popUpListPatternDescription.js';
import { string_scenery_phet_keyboardHelpDialog_comboBox_moveThroughPattern_StringProperty } from '../../strings/keyboardHelpDialog/comboBox/moveThroughPattern.js';
import { string_scenery_phet_a11y_keyboardHelpDialog_comboBox_moveThroughPatternDescription_StringProperty } from '../../strings/a11y/keyboardHelpDialog/comboBox/moveThroughPatternDescription.js';
import { string_scenery_phet_keyboardHelpDialog_comboBox_chooseNewPattern_StringProperty } from '../../strings/keyboardHelpDialog/comboBox/chooseNewPattern.js';
import { string_scenery_phet_a11y_keyboardHelpDialog_comboBox_chooseNewPatternDescription_StringProperty } from '../../strings/a11y/keyboardHelpDialog/comboBox/chooseNewPatternDescription.js';
import { string_scenery_phet_keyboardHelpDialog_comboBox_closeWithoutChanging_StringProperty } from '../../strings/keyboardHelpDialog/comboBox/closeWithoutChanging.js';
import { string_scenery_phet_a11y_keyboardHelpDialog_comboBox_closeWithoutChangingDescription_StringProperty } from '../../strings/a11y/keyboardHelpDialog/comboBox/closeWithoutChangingDescription.js';
import '../../../../globals.js';
import PatternStringProperty from '../../../../axon/js/PatternStringProperty.js';
import StringProperty from '../../../../axon/js/StringProperty.js';
import optionize from '../../../../phet-core/js/optionize.js';
import Tandem from '../../../../tandem/js/Tandem.js';
import sceneryPhet from '../../sceneryPhet.js';
import TextKeyNode from '../TextKeyNode.js';
import KeyboardHelpIconFactory from './KeyboardHelpIconFactory.js';
import KeyboardHelpSection from './KeyboardHelpSection.js';
import KeyboardHelpSectionRow from './KeyboardHelpSectionRow.js';
export default class ComboBoxKeyboardHelpSection extends KeyboardHelpSection {
    constructor(providedOptions) {
        const options = optionize()({
            // SelfOptions
            headingString: string_scenery_phet_keyboardHelpDialog_comboBox_headingString_StringProperty,
            thingAsLowerCaseSingular: string_scenery_phet_keyboardHelpDialog_comboBox_option_StringProperty,
            thingAsLowerCasePlural: string_scenery_phet_keyboardHelpDialog_comboBox_options_StringProperty,
            // KeyboardHelpSectionOptions
            a11yContentTagName: 'ol', // ordered list
            vBoxOptions: {
                spacing: 8 // A bit tighter so that it looks like one set of instructions
            }
        }, providedOptions);
        // options may be string or TReadOnlyProperty<string>, so ensure that we have a TReadOnlyProperty<string>.
        const thingAsLowerCasePluralStringProperty = (typeof options.thingAsLowerCasePlural === 'string') ?
            new StringProperty(options.thingAsLowerCasePlural) :
            options.thingAsLowerCasePlural;
        const thingAsLowerCaseSingularStringProperty = (typeof options.thingAsLowerCaseSingular === 'string') ?
            new StringProperty(options.thingAsLowerCaseSingular) :
            options.thingAsLowerCaseSingular;
        // Create a PatternStringProperty that fills in a plural/singular pattern, and support dynamic locale.
        const createPatternStringProperty = (providedStringProperty) => {
            return new PatternStringProperty(providedStringProperty, {
                thingPlural: thingAsLowerCasePluralStringProperty,
                thingSingular: thingAsLowerCaseSingularStringProperty
            }, { tandem: Tandem.OPT_OUT });
        };
        const spaceKeyNode = TextKeyNode.space();
        const enterKeyNode = TextKeyNode.enter();
        const spaceOrEnterIcon = KeyboardHelpIconFactory.iconOrIcon(spaceKeyNode, enterKeyNode);
        const popUpList = KeyboardHelpSectionRow.labelWithIcon(createPatternStringProperty(string_scenery_phet_keyboardHelpDialog_comboBox_popUpListPattern_StringProperty), spaceOrEnterIcon, {
            labelInnerContent: createPatternStringProperty(string_scenery_phet_a11y_keyboardHelpDialog_comboBox_popUpListPatternDescription_StringProperty)
        });
        const moveThrough = KeyboardHelpSectionRow.labelWithIcon(createPatternStringProperty(string_scenery_phet_keyboardHelpDialog_comboBox_moveThroughPattern_StringProperty), KeyboardHelpIconFactory.upDownArrowKeysRowIcon(), {
            labelInnerContent: createPatternStringProperty(string_scenery_phet_a11y_keyboardHelpDialog_comboBox_moveThroughPatternDescription_StringProperty)
        });
        const chooseNew = KeyboardHelpSectionRow.labelWithIcon(createPatternStringProperty(string_scenery_phet_keyboardHelpDialog_comboBox_chooseNewPattern_StringProperty), enterKeyNode, {
            labelInnerContent: createPatternStringProperty(string_scenery_phet_a11y_keyboardHelpDialog_comboBox_chooseNewPatternDescription_StringProperty)
        });
        const escapeKeyNode = TextKeyNode.esc();
        const closeWithoutChanging = KeyboardHelpSectionRow.labelWithIcon(string_scenery_phet_keyboardHelpDialog_comboBox_closeWithoutChanging_StringProperty, escapeKeyNode, {
            labelInnerContent: string_scenery_phet_a11y_keyboardHelpDialog_comboBox_closeWithoutChangingDescription_StringProperty
        });
        // order the rows of content
        const rows = [popUpList, moveThrough, chooseNew, closeWithoutChanging];
        super(options.headingString, rows, options);
    }
}
sceneryPhet.register('ComboBoxKeyboardHelpSection', ComboBoxKeyboardHelpSection);
