<commit_before>import QBtn from './QBtn'
import QBtnGroup from './QBtnGroup'

export default {
  name: 'q-btn-toggle',
  props: {
    value: {
      required: true
    },
    // To avoid seeing the active raise shadow through the transparent button, give it a color (even white).
    color: String,
    textColor: String,
    toggleColor: {
      type: String,
      default: 'primary'
    },
    textToggleColor: String,
    options: {
      type: Array,
      required: true,
      validator: v => v.every(opt => ('label' in opt || 'icon' in opt) && 'value' in opt)
    },
    readonly: Boolean,
    disable: Boolean,
    noCaps: Boolean,
    noWrap: Boolean,
    outline: Boolean,
    flat: Boolean,
    dense: Boolean,
    rounded: Boolean,
    push: Boolean,
    size: String,
    glossy: Boolean,
    noRipple: Boolean,
    waitForRipple: Boolean
  },
  computed: {
    val () {
      return this.options.map(opt => opt.value === this.value)
    }
  },
  methods: {
    set (value, opt) {
      if (this.readonly) {
        return
      }
      this.$emit('input', value, opt)
      this.$nextTick(() => {
        if (JSON.stringify(value) !== JSON.stringify(this.value)) {
          this.$emit('change', value, opt)
        }
      })
    }
  },
  render (h) {
    return h(QBtnGroup, {
      staticClass: 'q-btn-toggle',
      props: {
        outline: this.outline,
        flat: this.flat,
        rounded: this.rounded,
        push: this.push
      }
    },
    this.options.map(
      (opt, i) => h(QBtn, {
        key: `${opt.label}${opt.icon}${opt.iconRight}`,
        on: { click: () => this.set(opt.value, opt) },
        props: {
          disable: this.disable,
          label: opt.label,
          // Colors come from the button specific options first, then from general props
          color: this.val[i] ? opt.toggleColor || this.toggleColor : opt.color || this.color,
          textColor: this.val[i] ? opt.textToggleColor || this.textToggleColor : opt.textColor || this.textColor,
          icon: opt.icon,
          iconRight: opt.iconRight,
          noCaps: this.noCaps,
          noWrap: this.noWrap,
          outline: this.outline,
          flat: this.flat,
          rounded: this.rounded,
          push: this.push,
          glossy: this.glossy,
          size: this.size,
          dense: this.dense,
          noRipple: this.noRipple,
          waitForRipple: this.waitForRipple,<commit_msg>refactor(QBtnToggle): consistency in props naming -> toggle-text-color<commit_after>import QBtn from './QBtn'
import QBtnGroup from './QBtnGroup'

export default {
  name: 'q-btn-toggle',
  props: {
    value: {
      required: true
    },
    // To avoid seeing the active raise shadow through the transparent button, give it a color (even white).
    color: String,
    textColor: String,
    toggleColor: {
      type: String,
      default: 'primary'
    },
    toggleTextColor: String,
    options: {
      type: Array,
      required: true,
      validator: v => v.every(opt => ('label' in opt || 'icon' in opt) && 'value' in opt)
    },
    readonly: Boolean,
    disable: Boolean,
    noCaps: Boolean,
    noWrap: Boolean,
    outline: Boolean,
    flat: Boolean,
    dense: Boolean,
    rounded: Boolean,
    push: Boolean,
    size: String,
    glossy: Boolean,
    noRipple: Boolean,
    waitForRipple: Boolean
  },
  computed: {
    val () {
      return this.options.map(opt => opt.value === this.value)
    }
  },
  methods: {
    set (value, opt) {
      if (this.readonly) {
        return
      }
      this.$emit('input', value, opt)
      this.$nextTick(() => {
        if (JSON.stringify(value) !== JSON.stringify(this.value)) {
          this.$emit('change', value, opt)
        }
      })
    }
  },
  render (h) {
    return h(QBtnGroup, {
      staticClass: 'q-btn-toggle',
      props: {
        outline: this.outline,
        flat: this.flat,
        rounded: this.rounded,
        push: this.push
      }
    },
    this.options.map(
      (opt, i) => h(QBtn, {
        key: `${opt.label}${opt.icon}${opt.iconRight}`,
        on: { click: () => this.set(opt.value, opt) },
        props: {
          disable: this.disable,
          label: opt.label,
          // Colors come from the button specific options first, then from general props
          color: this.val[i] ? opt.toggleColor || this.toggleColor : opt.color || this.color,
          textColor: this.val[i] ? opt.toggleTextColor || this.toggleTextColor : opt.textColor || this.textColor,
          icon: opt.icon,
          iconRight: opt.iconRight,
          noCaps: this.noCaps,
          noWrap: this.noWrap,
          outline: this.outline,
          flat: this.flat,
          rounded: this.rounded,
          push: this.push,
          glossy: this.glossy,
          size: this.size,
          dense: this.dense,
          noRipple: this.noRipple,
          waitForRipple: this.waitForRipple,
{'fraction_non_alphanumeric': 0.13291268064319153, 'fraction_numerical': 0.0, 'mean_word_length': 2.0258620689655173, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 16, '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': '2248174', 'n_tokens_mistral': 1560, 'n_tokens_neox': 1548, 'n_words': 384}