<commit_before>{# Sample Usage
  {% include "@bolt/chip.twig" with {
    text: "This is a chip",
    url: "http://google.com"  // Optional; When url is present, tag changes to `a`, otherwise tag would be `span`.
  } only %}
#}

{% set tags = ["span", "a"] %} {# Available Chip Tags #}
{% set prefix = "c-bolt-" %}

{% set attributes = create_attribute(attributes|default({})) %}


{% set componentName = "chip" %}
{% set baseClass = prefix ~ componentName %}

{% if url %}
  {% set tag = "a" %}
{% else %}
  {% set tag = tag in tags ? tag: "span" %}
{% endif %}


{% set classes = [
  baseClass
] %}


{% if url %}
  {% set attributes = attributes.setAttribute("href", url) %}
{% endif %}


<bolt-chip bolt-component>
  <{{ tag }} {{ attributes.addClass(classes | raw) }}>
    <span class="{{ "#{baseClass}__item-text" }}">{{ text }}</span>
  </{{ tag }}>
</bolt-chip><commit_msg>Chip - added schema validation<commit_after>{# Sample Usage
  {% include "@bolt/chip.twig" with {
    text: "This is a chip",
    url: "http://google.com"  // Optional; When url is present, tag changes to `a`, otherwise tag would be `span`.
  } only %}
#}

{% set tags = ["span", "a"] %} {# Available Chip Tags #}
{% set prefix = "c-bolt-" %}

{% set attributes = create_attribute(attributes|default({})) %}


{% set componentName = "chip" %}
{% set baseClass = prefix ~ componentName %}

{% if url %}
  {% set tag = "a" %}
{% else %}
  {% set tag = tag in tags ? tag: "span" %}
{% endif %}


{% set classes = [
  baseClass
] %}


{% if url %}
  {% set attributes = attributes.setAttribute("href", url) %}
{% endif %}


<bolt-chip bolt-component>
  <{{ tag }} {{ attributes.addClass(classes | raw) }}>
    <span class="{{ "#{baseClass}__item-text" }}">{{ text }}</span>
  </{{ tag }}>
</bolt-chip>

{% if enable_json_schema_validation %}
  {{ validate_data_schema('@bolt-components-chip/chip.schema.yml', _self) }}
{% endif %}
{'fraction_non_alphanumeric': 0.2161594963273872, 'fraction_numerical': 0.0, 'mean_word_length': 3.508274231678487, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, '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': '2224395', 'n_tokens_mistral': 718, 'n_tokens_neox': 623, 'n_words': 175}