desy-html 5.1.1 → 5.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,6 +2,7 @@
2
2
  {% from "../fieldset/_macro.fieldset.njk" import componentFieldset %}
3
3
  {% from "../hint/_macro.hint.njk" import componentHint %}
4
4
  {% from "../label/_macro.label.njk" import componentLabel %}
5
+ {% from "../searchbar/_macro.searchbar.njk" import componentSearchbar %}
5
6
 
6
7
  {#- If an id 'prefix' is not passed, fall back to using the name attribute
7
8
  instead. We need this for error messages and hints as well -#}
@@ -28,14 +29,13 @@
28
29
  <div x-data="{ isChecked: {% if not item.checked %}false{% else %}true{% endif %} }" {%- if item.indeterminateChecked %} x-init="$refs.inputCheck.indeterminate=$refs.inputCheck.readOnly=true"{% endif %} class="{%- if params.hasDividers %} border-t border-b border-neutral-base -mb-px{% endif %} {%- if item.classes %} {{ item.classes }}{% endif %}">
29
30
  <div class="relative flex items-start py-xs">
30
31
  <div class="flex items-center mx-sm">
31
- <input x-model="isChecked" x-ref="inputCheck" class="w-6 h-6 transition duration-150 ease-in-out border-black focus:border-black focus:shadow-outline-focus-input focus:ring-4 focus:ring-offset-0 focus:ring-warning-base disabled:bg-neutral-base disabled:border-neutral-base text-primary-base" id="{{ id }}-input" name="{{ name }}" {%- if type == 'checkbox' %} type="checkbox"{% else %} type="radio"{% endif -%} value="{{ item.value }}"
32
+ <input x-model="isChecked" x-ref="inputCheck" class="w-6 h-6 transition duration-150 ease-in-out border-black focus:border-black focus:shadow-outline-focus-input focus:ring-4 focus:ring-offset-0 focus:ring-warning-base disabled:bg-neutral-base disabled:border-neutral-base text-primary-base" id="{{ id }}-input" name="{{ name }}" {%- if type == 'checkbox' %} type="checkbox"{% else %} type="radio"{% endif %} value="{{ item.value }}"
32
33
  {{-" checked" if item.checked }}
33
34
  {{-" disabled" if item.disabled }}
34
35
  {%- if itemDescribedBy %} aria-describedby="{{ itemDescribedBy }}"{% endif -%}
35
36
  {%- if params.errorMessage %} aria-invalid="true"{% endif -%}
36
37
  {%- for attribute, value in item.attributes %} {{ attribute }}="{{ value }}"{% endfor -%}
37
- {%- if item.isIndeterminate %} onclick="if (this.readOnly) this.checked=this.readOnly=false; else if (!this.checked) this.readOnly=this.indeterminate=true;"{% endif %}
38
- {%- if item.indeterminateChecked %} onclick="if (this.readOnly) this.checked=this.readOnly=false; else if (!this.checked) this.readOnly=this.indeterminate=true;"{% endif %}>
38
+ {%- if item.isIndeterminate or item.indeterminateChecked %} onclick="if (this.readOnly) this.checked=this.readOnly=false; else if (!this.checked) this.readOnly=this.indeterminate=true;"{% endif %}>
39
39
  </div>
40
40
  <div class="flex-1 pt-0.5 leading-5">
41
41
  {{ componentLabel({
@@ -63,14 +63,14 @@
63
63
  {% macro childrenTree(itemNode, id, name, type) %}
64
64
  {% if itemNode.sub %}
65
65
  <div class="w-full h-full">
66
- <span class="w-full flex items-center relative focus:bg-warning-base focus:outline-none focus:shadow-outline-focus focus:text-black text-left {%- if itemNode.classes %} {{ itemNode.classes }}{% endif %}"
66
+ <div class="w-full flex items-center relative focus:bg-warning-base focus:outline-none focus:shadow-outline-focus focus:text-black text-left {%- if itemNode.classes %} {{ itemNode.classes }}{% endif %}"
67
67
  {%- for attribute, value in itemNode.attributes %} {{ attribute }}="{{ value }}"{% endfor -%}>
68
68
  <span class="absolute top-3 -left-4 flex items-center w-4 h-2.5 text-primary-base font-bold">
69
69
  <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 10 10" width="10" height="10" aria-hidden="true" class="c-tree__minus"><path fill="currentColor" d="M9.286 5.714H.714a.714.714 0 010-1.428h8.572a.714.714 0 010 1.428z"/></svg>
70
70
  <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 10 10" width="10" height="10" aria-hidden="true" class="c-tree__plus"><path fill="currentColor" d="M9.286 4.286H5.893a.179.179 0 01-.179-.179V.714a.714.714 0 00-1.428 0v3.393a.179.179 0 01-.179.179H.714a.714.714 0 000 1.428h3.393a.179.179 0 01.179.179v3.393a.714.714 0 001.428 0V5.893a.179.179 0 01.179-.179h3.393a.714.714 0 000-1.428z"/></svg>
71
71
  </span>
72
72
  {{ checkboxItem(itemNode, id, name, type) }}
73
- </span>
73
+ </div>
74
74
  </div>
75
75
  {% else %}
76
76
  {{ checkboxItem(itemNode, id, name, type) }}
@@ -92,9 +92,9 @@
92
92
  {% else %}
93
93
  <div {%- if subitem.id %} id="{{ id }}"{% endif %} class="block {%- if subitem.classes %} {{ subitem.classes }}{% endif %} {%- if subitem.active %} font-bold{% endif %}" {%- if subitem.title %} title="{{ subitem.title }}"{% endif %} {%- if subitem.active %} aria-current="page"{% endif %} {%- if subitem.disabled %} disabled="disabled" aria-disabled="true" tabindex="-1"{% endif %} {%- for attribute, value in subitem.attributes %} {{ attribute }}="{{ value }}"{% endfor -%}>
94
94
  {% if subitem.active %}
95
- <strong>
95
+ <div class="font-bold">
96
96
  {{ checkboxItem(subitem, subId, name, type) }}
97
- </strong>
97
+ </div>
98
98
  {% else %}
99
99
  {{ checkboxItem(subitem, subId, name, type) }}
100
100
  {% endif %}
@@ -132,7 +132,10 @@
132
132
  visuallyHiddenText: params.errorMessage.visuallyHiddenText
133
133
  }) | indent(2) | trim }}
134
134
  {% endif %}
135
- <ul class="c-tree {%- if params.classes %} {{ params.classes }}{% endif %}" role="tree" aria-labelledby="{{ idPrefix }}-heading" {%- for attribute, value in params.attributes %} {{ attribute }}="{{ value }}"{% endfor %} data-module="c-tree">
135
+ {% if params.searchbar %}
136
+ {{ componentSearchbar(params.searchbar) }}
137
+ {% endif %}
138
+ <ul class="c-tree {%- if params.classes %} {{ params.classes }}{% endif %}" role="tree" {%- for attribute, value in params.attributes %} {{ attribute }}="{{ value }}"{% endfor %} data-module="c-tree">
136
139
  {% for item in params.items %}
137
140
  {% if item %}
138
141
  {#- If the user explicitly sets an id, use this instead of the regular idPrefix -#}
@@ -3,6 +3,10 @@ params:
3
3
  type: string
4
4
  required: false
5
5
  description: Type of input control to render. Admitted values are `checkbox` and `radio` or not set. Defaults to `radio`.
6
+ - name: searchbar
7
+ type: component
8
+ required: false
9
+ description: A searchbar component to filter the items. Inherits all the searchbar component params.
6
10
  - name: describedBy
7
11
  type: string
8
12
  required: false