<commit_before>###*
# @overview Defines the `HasLabelViewTrait` which can be added to a view or
# view component to add a label property.
#
# @module stout-ui/component/HasLabelViewTrait
###
Foundation = require 'stout-core/base/Foundation'

# Require necessary shared variables.
require '../vars/component'


###*
# The class name of the select box label, applied if using the `label` property.
# @type string
# @const
# @private
###
LABEL_CLS = vars.readPrefixed 'component/label-class'



###*
# The HasLabelViewTrait simply defines a view or component that has a `label`
# property. When setting the `label` property, the `content` property is
# automatically set with the associated HTML string for the label. This
# generalizes the common label-property pattern.
#
# @exports stout-ui/component/HasLabelViewTrait
# @mixin
###
module.exports = class HasLabelViewTrait extends Foundation

  ###*
  # The label.
  #
  # @member {string} label
  # @memberof stout-ui/component/HasLabelViewTrait#
  ###
  @property 'label',
    default: ''
    set: (l) ->
      @contents = "<span class=#{LABEL_CLS}>#{l}</span>"
      l


  ###*
  # Init this trait by syncing with the view's context.
  #
  #
  # @method initTrait
  # @memberof stout-ui/component/HasLabelViewTrait#
  # @private
  ###
  initTrait: ->
    @syncProperty @context, 'label', inherit: false
<commit_msg>Update HasLabelViewTrait to override #contents member.<commit_after>###*
# @overview Defines the `HasLabelViewTrait` which can be added to a view or
# view component to add a label property.
#
# @module stout-ui/component/HasLabelViewTrait
###
Foundation = require 'stout-core/base/Foundation'

# Require necessary shared variables.
require '../vars/component'


###*
# The class name of the select box label, applied if using the `label` property.
# @type string
# @const
# @private
###
LABEL_CLS = vars.readPrefixed 'component/label-class'



###*
# The HasLabelViewTrait simply defines a view or component that has a `label`
# property. When setting the `label` property, the `content` property is
# automatically set with the associated HTML string for the label. This
# generalizes the common label-property pattern.
#
# @exports stout-ui/component/HasLabelViewTrait
# @mixin
###
module.exports = class HasLabelViewTrait extends Foundation

  ###*
  # The label.
  #
  # @member {string} label
  # @memberof stout-ui/component/HasLabelViewTrait#
  ###
  @property 'label',
    default: ''


  @property 'contents',
    get: ->
      "<span class=#{LABEL_CLS}>#{@label}</span>"


  ###*
  # Init this trait by syncing with the view's context.
  #
  #
  # @method initTrait
  # @memberof stout-ui/component/HasLabelViewTrait#
  # @private
  ###
  initTrait: ->
    @syncProperty @context, 'label', inherit: false

{'fraction_non_alphanumeric': 0.12464080459770115, 'fraction_numerical': 0.0, 'mean_word_length': 4.018018018018018, 'pattern_counts': {'":': 0, '<': 7, '<?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': '7376659', 'n_tokens_mistral': 874, 'n_tokens_neox': 852, 'n_words': 272}