<commit_before>import component from 'kompo';
const {construct} = component;

import {addClasses, create} from 'kompo-util';

export default construct('div', function({
    defaultClass,
    classes,
    defaultOptionIndex,
    options,
    optionClass,
    callback
}) {
    this.classList.add(defaultClass);
    addClasses(this, classes);
    
    const props = this.kompo.props,
        keys = Object.keys(options);
    
    for(let i = 0, l = keys.length; i < l; ++i) {
        const a = create('a', {'class': optionClass}),
            key = keys[i],
            value = options[key];
        
        a.textContent = value;

        if (defaultOptionIndex === i) {
            setSelected(props, a, key, value);
        }
        
        a.addEventListener('click', e => {
            e.preventDefault();
            
            if (props.selected === a) return;

            setSelected(props, a, key, value);
            if (callback) callback(e, key, value);
        });

        this.appendChild(a);
    }
}, {
    defaultClass: 'o-Radio',
    classes: [],
    defaultOptionIndex: undefined,<commit_msg>Added href to radio options<commit_after>import component from 'kompo';
const {construct} = component;

import {addClasses, create} from 'kompo-util';

export default construct('div', function({
    defaultClass,
    classes,
    defaultOptionIndex,
    options,
    optionClass,
    callback
}) {
    this.classList.add(defaultClass);
    addClasses(this, classes);
    
    const props = this.kompo.props,
        keys = Object.keys(options);
    
    for(let i = 0, l = keys.length; i < l; ++i) {
        const key = keys[i],
            value = options[key],
            a = create('a', {'class': optionClass, href: '#'+key});
        
        a.textContent = value;

        if (defaultOptionIndex === i) {
            setSelected(props, a, key, value);
        }
        
        a.addEventListener('click', e => {
            e.preventDefault();
            
            if (props.selected === a) return;

            setSelected(props, a, key, value);
            if (callback) callback(e, key, value);
        });

        this.appendChild(a);
    }
}, {
    defaultClass: 'o-Radio',
    classes: [],
    defaultOptionIndex: undefined,
{'fraction_non_alphanumeric': 0.1363435148295706, 'fraction_numerical': 0.0008853474988933156, 'mean_word_length': 2.074829931972789, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3061174', 'n_tokens_mistral': 653, 'n_tokens_neox': 648, 'n_words': 161}