Heray-Was-Here
Server : Apache
System : Linux vps103298.mylogin.co 4.18.0-513.11.1.el8_9.x86_64 #1 SMP Wed Jan 17 02:00:40 EST 2024 x86_64
User : calvet ( 273824)
PHP Version : 7.4.33
Disable Function : NONE
Directory :  /usr/local/lib/node_modules/@google/gemini-cli/dist/src/ui/components/shared/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //usr/local/lib/node_modules/@google/gemini-cli/dist/src/ui/components/shared/RadioButtonSelect.js
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import { Text, Box } from 'ink';
import SelectInput from 'ink-select-input';
import { Colors } from '../../colors.js';
/**
 * A specialized SelectInput component styled to look like radio buttons.
 * It uses '◉' for selected and '○' for unselected items.
 *
 * @template T The type of the value associated with each radio item.
 */
export function RadioButtonSelect({ items, initialIndex, onSelect, onHighlight, isFocused, // This prop indicates if the current RadioButtonSelect group is focused
 }) {
    const handleSelect = (item) => {
        onSelect(item.value);
    };
    const handleHighlight = (item) => {
        if (onHighlight) {
            onHighlight(item.value);
        }
    };
    /**
     * Custom indicator component displaying radio button style (◉/○).
     * Color changes based on whether the item is selected and if its group is focused.
     */
    function DynamicRadioIndicator({ isSelected = false, }) {
        return (_jsx(Box, { minWidth: 2, flexShrink: 0, children: _jsx(Text, { color: isSelected ? Colors.AccentGreen : Colors.Foreground, children: isSelected ? '●' : '○' }) }));
    }
    /**
     * Custom item component for displaying the label.
     * Color changes based on whether the item is selected and if its group is focused.
     * Now also handles displaying theme type with custom color.
     */
    function CustomThemeItemComponent(props) {
        const { isSelected = false, label } = props;
        const itemWithThemeProps = props;
        let textColor = Colors.Foreground;
        if (isSelected) {
            textColor = Colors.AccentGreen;
        }
        else if (itemWithThemeProps.disabled === true) {
            textColor = Colors.Gray;
        }
        if (itemWithThemeProps.themeNameDisplay &&
            itemWithThemeProps.themeTypeDisplay) {
            return (_jsxs(Text, { color: textColor, wrap: "truncate", children: [itemWithThemeProps.themeNameDisplay, ' ', _jsx(Text, { color: Colors.Gray, children: itemWithThemeProps.themeTypeDisplay })] }));
        }
        return (_jsx(Text, { color: textColor, wrap: "truncate", children: label }));
    }
    initialIndex = initialIndex ?? 0;
    return (_jsx(SelectInput, { indicatorComponent: DynamicRadioIndicator, itemComponent: CustomThemeItemComponent, items: items, initialIndex: initialIndex, onSelect: handleSelect, onHighlight: handleHighlight, isFocused: isFocused }));
}
//# sourceMappingURL=RadioButtonSelect.js.map

Hry