<commit_before><template>

  <KTextbox
    ref="textbox"
    :value="value"
    :disabled="$attrs.disabled"
    :label="coreString('fullNameLabel')"
    :autofocus="$attrs.autofocus"
    :maxlength="120"
    :invalid="Boolean(shownInvalidText)"
    :invalidText="shownInvalidText"
    :autocomplete="$attrs.autocomplete"
    @blur="blurred = true"
    @input="$emit('update:value', $event)"
  />

</template>


<script>

  import commonCoreStrings from 'kolibri.coreVue.mixins.commonCoreStrings';

  export default {
    name: 'FullNameTextbox',
    mixins: [commonCoreStrings],
    // NOTE: 'value' and 'isValid' must be .sync'd with parent
    // You can also pass 'disabled', 'autofocus', and 'autocomplete'
    props: {
      value: {
        type: String,
        default: '',
      },
      shouldValidate: {
        type: Boolean,
      },
    },
    data() {
      return {
        blurred: false,
      };
    },
    computed: {
      invalidText() {
        if (this.value === '') {
          return this.coreString('requiredFieldError');
        }
        return '';
      },
      shownInvalidText() {
        if (this.blurred || this.shouldValidate) {
          return this.invalidText;
        }
        return '';
      },
      valid() {
        return this.invalidText === '';
      },
    },
    watch: {
      valid: {
        handler(value) {
          this.$emit('update:isValid', value);
        },
        immediate: true,
      },
    },
    methods: {<commit_msg>Trim full name before validation<commit_after><template>

  <KTextbox
    ref="textbox"
    :value="value"
    :disabled="$attrs.disabled"
    :label="coreString('fullNameLabel')"
    :autofocus="$attrs.autofocus"
    :maxlength="120"
    :invalid="Boolean(shownInvalidText)"
    :invalidText="shownInvalidText"
    :autocomplete="$attrs.autocomplete"
    @blur="blurred = true"
    @input="$emit('update:value', $event)"
  />

</template>


<script>

  import commonCoreStrings from 'kolibri.coreVue.mixins.commonCoreStrings';

  export default {
    name: 'FullNameTextbox',
    mixins: [commonCoreStrings],
    // NOTE: 'value' and 'isValid' must be .sync'd with parent
    // You can also pass 'disabled', 'autofocus', and 'autocomplete'
    props: {
      value: {
        type: String,
        default: '',
      },
      shouldValidate: {
        type: Boolean,
      },
    },
    data() {
      return {
        blurred: false,
      };
    },
    computed: {
      isFullNameValid() {
        return this.value && this.value.trim() !== '';
      },
      invalidText() {
        if (!this.isFullNameValid) {
          return this.coreString('requiredFieldError');
        }
        return '';
      },
      shownInvalidText() {
        if (this.blurred || this.shouldValidate) {
          return this.invalidText;
        }
        return '';
      },
    },
    watch: {
      isFullNameValid: {
        handler(value) {
          this.$emit('update:isValid', value);
        },
        immediate: true,
      },
    },
    methods: {
{'fraction_non_alphanumeric': 0.14897824653922215, 'fraction_numerical': 0.001977587343441002, 'mean_word_length': 2.1516095534787123, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, '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': '3871041', 'n_tokens_mistral': 940, 'n_tokens_neox': 922, 'n_words': 167}