desy-html 6.5.0 → 7.0.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.
Files changed (156) hide show
  1. package/config/tailwind.config.js +32 -2
  2. package/docs/_global.head.njk +2 -0
  3. package/docs/_include.template-header.njk +11 -0
  4. package/docs/_macro.example-render.njk +8 -0
  5. package/docs/catalogo.html +2 -0
  6. package/docs/componentes.html +6 -0
  7. package/docs/ds/_ds.example.card.njk +199 -0
  8. package/docs/ds/_ds.example.checkboxes.njk +4 -4
  9. package/docs/ds/_ds.example.header-advanced.njk +0 -75
  10. package/docs/ds/_ds.example.links-list.njk +171 -0
  11. package/docs/ds/_ds.example.pills.njk +1 -1
  12. package/docs/ds/_ds.example.textos.njk +3 -1
  13. package/docs/ds/_ds.example.typography.njk +1 -1
  14. package/docs/ds/_ds.section.informacion.njk +13 -0
  15. package/docs/ds/_ds.section.navigation.njk +4 -0
  16. package/docs/ds/_ds.section.textos.njk +44 -20
  17. package/docs/ds/_ds.section.typography.njk +1 -1
  18. package/docs/examples-card.html +5 -0
  19. package/docs/examples-links-list.html +5 -0
  20. package/docs/index.html +15 -17
  21. package/package.json +12 -13
  22. package/src/css/component.text.css +14 -0
  23. package/src/js/aria/tabs.js +3 -1
  24. package/src/js/aria/toggle.js +3 -0
  25. package/src/js/aria/treeitem.js +11 -4
  26. package/src/templates/components/button/_examples.button.njk +9 -0
  27. package/src/templates/components/button-loader/_template.button-loader.njk +3 -15
  28. package/src/templates/components/card/_examples.card.njk +277 -0
  29. package/src/templates/components/card/_macro.card.njk +3 -0
  30. package/src/templates/components/card/_template.card.njk +35 -0
  31. package/src/templates/components/card/params.card.yaml +113 -0
  32. package/src/templates/components/checkboxes/params.checkboxes.yaml +0 -10
  33. package/src/templates/components/collapsible/_template.collapsible.njk +1 -1
  34. package/src/templates/components/error-message/params.error-message.yaml +1 -15
  35. package/src/templates/components/header/_examples.header.njk +50 -14
  36. package/src/templates/components/header/_template.header.njk +1 -1
  37. package/src/templates/components/header/params.header.yaml +0 -20
  38. package/src/templates/components/header-advanced/_examples.header-advanced.njk +4 -4
  39. package/src/templates/components/header-advanced/_template.header-advanced.njk +1 -1
  40. package/src/templates/components/header-advanced/params.header-advanced.yaml +0 -20
  41. package/src/templates/components/links-list/_examples.links-list.njk +504 -0
  42. package/src/templates/components/links-list/_macro.links-list.njk +3 -0
  43. package/src/templates/components/links-list/_template.links-list.njk +92 -0
  44. package/src/templates/components/links-list/params.links-list.yaml +82 -0
  45. package/src/templates/components/menu-navigation/params.menu-navigation.yaml +0 -10
  46. package/src/templates/components/menu-vertical/_template.menu-vertical.njk +1 -5
  47. package/src/templates/components/menu-vertical/params.menu-vertical.yaml +0 -19
  48. package/src/templates/components/radios/params.radios.yaml +0 -10
  49. package/src/templates/components/table/_examples.table.njk +4 -48
  50. package/src/templates/components/table/params.table.yaml +1 -1
  51. package/src/templates/components/table-advanced/_examples.table-advanced.njk +6 -51
  52. package/src/templates/components/toggle/_examples.toggle.njk +36 -0
  53. package/src/templates/components/toggle/_template.toggle.njk +6 -1
  54. package/docs/examples-header-2.html +0 -5
  55. package/src/templates/components/header/_examples.header-2.njk +0 -555
  56. package/test/backstop_config/backstop.config.js +0 -35
  57. package/test/backstop_config/scenarios/components_a.js +0 -31
  58. package/test/backstop_config/scenarios/components_b.js +0 -31
  59. package/test/backstop_config/scenarios/components_c.js +0 -31
  60. package/test/backstop_config/scenarios/components_d.js +0 -49
  61. package/test/backstop_config/scenarios/components_e.js +0 -22
  62. package/test/backstop_config/scenarios/components_f.js +0 -31
  63. package/test/backstop_config/scenarios/components_h.js +0 -40
  64. package/test/backstop_config/scenarios/components_i.js +0 -40
  65. package/test/backstop_config/scenarios/components_l.js +0 -22
  66. package/test/backstop_config/scenarios/components_m.js +0 -58
  67. package/test/backstop_config/scenarios/components_n.js +0 -22
  68. package/test/backstop_config/scenarios/components_p.js +0 -22
  69. package/test/backstop_config/scenarios/components_r.js +0 -13
  70. package/test/backstop_config/scenarios/components_s.js +0 -58
  71. package/test/backstop_config/scenarios/components_t.js +0 -67
  72. package/test/backstop_config/scenarios/home.js +0 -12
  73. package/test/backstop_config/scenarios/styles.js +0 -13
  74. package/test/backstop_config/scenarios.js +0 -39
  75. package/test/backstop_data/bitmaps_reference/Desy_Accordion_0_document_0_desktop.png +0 -0
  76. package/test/backstop_data/bitmaps_reference/Desy_Accordion_history_0_document_0_desktop.png +0 -0
  77. package/test/backstop_data/bitmaps_reference/Desy_Alert_0_document_0_desktop.png +0 -0
  78. package/test/backstop_data/bitmaps_reference/Desy_Breadcrumbs_0_document_0_desktop.png +0 -0
  79. package/test/backstop_data/bitmaps_reference/Desy_Button_0_document_0_desktop.png +0 -0
  80. package/test/backstop_data/bitmaps_reference/Desy_Button_loader_0_document_0_desktop.png +0 -0
  81. package/test/backstop_data/bitmaps_reference/Desy_Character_count_0_document_0_desktop.png +0 -0
  82. package/test/backstop_data/bitmaps_reference/Desy_Checkboxes_0_document_0_desktop.png +0 -0
  83. package/test/backstop_data/bitmaps_reference/Desy_Collapsible_0_document_0_desktop.png +0 -0
  84. package/test/backstop_data/bitmaps_reference/Desy_Date_input_0_document_0_desktop.png +0 -0
  85. package/test/backstop_data/bitmaps_reference/Desy_Description_list_0_document_0_desktop.png +0 -0
  86. package/test/backstop_data/bitmaps_reference/Desy_Details_0_document_0_desktop.png +0 -0
  87. package/test/backstop_data/bitmaps_reference/Desy_Dialog_0_document_0_desktop.png +0 -0
  88. package/test/backstop_data/bitmaps_reference/Desy_Dropdown_0_document_0_desktop.png +0 -0
  89. package/test/backstop_data/bitmaps_reference/Desy_Error_message_0_document_0_desktop.png +0 -0
  90. package/test/backstop_data/bitmaps_reference/Desy_Error_summary_0_document_0_desktop.png +0 -0
  91. package/test/backstop_data/bitmaps_reference/Desy_Fieldset_0_document_0_desktop.png +0 -0
  92. package/test/backstop_data/bitmaps_reference/Desy_File_upload_0_document_0_desktop.png +0 -0
  93. package/test/backstop_data/bitmaps_reference/Desy_Footer_0_document_0_desktop.png +0 -0
  94. package/test/backstop_data/bitmaps_reference/Desy_Header_0_document_0_desktop.png +0 -0
  95. package/test/backstop_data/bitmaps_reference/Desy_Header_advanced_0_document_0_desktop.png +0 -0
  96. package/test/backstop_data/bitmaps_reference/Desy_Header_mini_0_document_0_desktop.png +0 -0
  97. package/test/backstop_data/bitmaps_reference/Desy_Hint_0_document_0_desktop.png +0 -0
  98. package/test/backstop_data/bitmaps_reference/Desy_Home_0_document_0_desktop.png +0 -0
  99. package/test/backstop_data/bitmaps_reference/Desy_Input_0_document_0_desktop.png +0 -0
  100. package/test/backstop_data/bitmaps_reference/Desy_Input_group_0_document_0_desktop.png +0 -0
  101. package/test/backstop_data/bitmaps_reference/Desy_Item_0_document_0_desktop.png +0 -0
  102. package/test/backstop_data/bitmaps_reference/Desy_Label_0_document_0_desktop.png +0 -0
  103. package/test/backstop_data/bitmaps_reference/Desy_Listbox_0_document_0_desktop.png +0 -0
  104. package/test/backstop_data/bitmaps_reference/Desy_Media_object_0_document_0_desktop.png +0 -0
  105. package/test/backstop_data/bitmaps_reference/Desy_Menu_horizontal_0_document_0_desktop.png +0 -0
  106. package/test/backstop_data/bitmaps_reference/Desy_Menu_navigation_0_document_0_desktop.png +0 -0
  107. package/test/backstop_data/bitmaps_reference/Desy_Menu_vertical_0_document_0_desktop.png +0 -0
  108. package/test/backstop_data/bitmaps_reference/Desy_Menubar_0_document_0_desktop.png +0 -0
  109. package/test/backstop_data/bitmaps_reference/Desy_Modal_0_document_0_desktop.png +0 -0
  110. package/test/backstop_data/bitmaps_reference/Desy_Nav_0_document_0_desktop.png +0 -0
  111. package/test/backstop_data/bitmaps_reference/Desy_Notification_0_document_0_desktop.png +0 -0
  112. package/test/backstop_data/bitmaps_reference/Desy_Pagination_0_document_0_desktop.png +0 -0
  113. package/test/backstop_data/bitmaps_reference/Desy_Pill_0_document_0_desktop.png +0 -0
  114. package/test/backstop_data/bitmaps_reference/Desy_Searchbar_0_document_0_desktop.png +0 -0
  115. package/test/backstop_data/bitmaps_reference/Desy_Select_0_document_0_desktop.png +0 -0
  116. package/test/backstop_data/bitmaps_reference/Desy_Skip_link_0_document_0_desktop.png +0 -0
  117. package/test/backstop_data/bitmaps_reference/Desy_Spinner_0_document_0_desktop.png +0 -0
  118. package/test/backstop_data/bitmaps_reference/Desy_Status_0_document_0_desktop.png +0 -0
  119. package/test/backstop_data/bitmaps_reference/Desy_Status_item_0_document_0_desktop.png +0 -0
  120. package/test/backstop_data/bitmaps_reference/Desy_Styles_0_document_0_desktop.png +0 -0
  121. package/test/backstop_data/bitmaps_reference/Desy_Table_0_document_0_desktop.png +0 -0
  122. package/test/backstop_data/bitmaps_reference/Desy_Table_advanced_0_document_0_desktop.png +0 -0
  123. package/test/backstop_data/bitmaps_reference/Desy_Tabs_0_document_0_desktop.png +0 -0
  124. package/test/backstop_data/bitmaps_reference/Desy_Textarea_0_document_0_desktop.png +0 -0
  125. package/test/backstop_data/bitmaps_reference/Desy_Toggle_0_document_0_desktop.png +0 -0
  126. package/test/backstop_data/bitmaps_reference/Desy_Tooltip_0_document_0_desktop.png +0 -0
  127. package/test/backstop_data/bitmaps_reference/Desy_Tree_0_document_0_desktop.png +0 -0
  128. package/test/backstop_data/engine_scripts/cookies.json +0 -14
  129. package/test/backstop_data/engine_scripts/imageStub.jpg +0 -0
  130. package/test/backstop_data/engine_scripts/playwright/clickAndHoverHelper.js +0 -43
  131. package/test/backstop_data/engine_scripts/playwright/interceptImages.js +0 -31
  132. package/test/backstop_data/engine_scripts/playwright/loadCookies.js +0 -16
  133. package/test/backstop_data/engine_scripts/playwright/onBefore.js +0 -5
  134. package/test/backstop_data/engine_scripts/playwright/onReady.js +0 -6
  135. package/test/backstop_data/engine_scripts/playwright/overrideCSS.js +0 -27
  136. package/test/backstop_data/engine_scripts/puppet/clickAndHoverHelper.js +0 -39
  137. package/test/backstop_data/engine_scripts/puppet/ignoreCSP.js +0 -65
  138. package/test/backstop_data/engine_scripts/puppet/interceptImages.js +0 -37
  139. package/test/backstop_data/engine_scripts/puppet/loadCookies.js +0 -33
  140. package/test/backstop_data/engine_scripts/puppet/onBefore.js +0 -3
  141. package/test/backstop_data/engine_scripts/puppet/onReady.js +0 -6
  142. package/test/backstop_data/engine_scripts/puppet/overrideCSS.js +0 -15
  143. package/test/backstop_data/html_report/a96f14595379b7c348d66e115ec65a93.png +0 -0
  144. package/test/backstop_data/html_report/assets/fonts/Lato-Bold.ttf +0 -0
  145. package/test/backstop_data/html_report/assets/fonts/Lato-Regular.ttf +0 -0
  146. package/test/backstop_data/html_report/assets/fonts/lato-bold-webfont.woff +0 -0
  147. package/test/backstop_data/html_report/assets/fonts/lato-bold-webfont.woff2 +0 -0
  148. package/test/backstop_data/html_report/assets/fonts/lato-regular-webfont.woff +0 -0
  149. package/test/backstop_data/html_report/assets/fonts/lato-regular-webfont.woff2 +0 -0
  150. package/test/backstop_data/html_report/b815e28b1e230cff6e9d7b749edcd562.png +0 -0
  151. package/test/backstop_data/html_report/config.js +0 -1335
  152. package/test/backstop_data/html_report/diff.js +0 -1843
  153. package/test/backstop_data/html_report/diverged.js +0 -340
  154. package/test/backstop_data/html_report/divergedWorker.js +0 -6
  155. package/test/backstop_data/html_report/index.html +0 -49
  156. package/test/backstop_data/html_report/index_bundle.js +0 -2
@@ -0,0 +1,92 @@
1
+ {#- If an id 'prefix' is not passed, fall back to using the name attribute
2
+ instead. -#}
3
+ {% set idPrefix = params.idPrefix if params.idPrefix else "links-list-item" %}
4
+
5
+ {% set arrow %}
6
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 140 140" class="self-center" aria-hidden="true" focusable="false" width="1em" height="1em"><path d="M102.07 27.93l35 35a10 10 0 010 14.14l-35 35a10 10 0 01-14.14-14.14l13.66-13.66A2.5 2.5 0 0099.82 80H10a10 10 0 010-20h89.82a2.5 2.5 0 001.77-4.27L87.93 42.07a10 10 0 0114.14-14.14z" fill="currentColor"></path></svg>
7
+ {% endset %}
8
+
9
+
10
+ {% set innerHtml %}
11
+ <ul>
12
+ {% for item in params.items %}
13
+ {% if item %}
14
+ {#- If the user explicitly sets an id, use this instead of the regular idPrefix -#}
15
+ {%- if item.id -%}
16
+ {%- set id = item.id -%}
17
+ {%- else -%}
18
+ {#- The first id should not have a number suffix so it's easy to link to from the error summary component -#}
19
+ {%- if loop.first -%}
20
+ {%- set id = idPrefix %}
21
+ {% else %}
22
+ {%- set id = idPrefix + "-" + loop.index -%}
23
+ {%- endif -%}
24
+ {%- endif -%}
25
+ {% set subId = "sub-" + id %}
26
+ <li class="{% if item.containerClasses %}{{ item.containerClasses }}{% else %}px-base border-y border-neutral-base -my-px{% endif %}">
27
+ {% if item.href %}
28
+ <a {%- if id %} id="{{ id }}"{% endif %} href="{{ item.href }}" class="c-link {%- if item.classes %} {{ item.classes }}{% else %} flex justify-between items-center gap-base flex-1 py-base{% endif %} {%- if item.disabled %} text-neutral-base no-underline pointer-events-none{% endif %} {%- if item.active %} font-bold{% endif %}" {%- if item.title %} title="{{ item.title }}"{% endif %}{%- if item.active %} aria-current="page"{% endif %} {% if item.disabled %} aria-disabled="true" tabindex="-1"{% endif %} {% if item.target %} target="{{ item.target }}"{% endif %}{%- for attribute, value in item.attributes %} {{ attribute }}="{{ value }}"{% endfor -%}>
29
+ <div class="flex gap-base justify-between items-center flex-1">
30
+ {% if item.icon %}
31
+ <div class="{% if item.icon.containerClasses %}{{ item.icon.containerClasses }}{% else %}self-center h-full{% endif %}">
32
+ {% if item.icon.html %}
33
+ {{ item.icon.html | safe }}
34
+ {% endif %}
35
+ </div>
36
+ {% endif %}
37
+ <div class="flex-1">
38
+ {% if item.active %}
39
+ <strong>{{ item.html | safe if item.html else item.text }}</strong>
40
+ {% else %}
41
+ {{ item.html | safe if item.html else item.text }}
42
+ {% endif %}
43
+ </div>
44
+ </div>
45
+ {{ arrow | safe }}
46
+ </a>
47
+ {% else %}
48
+ <div {%- if id %} id="{{ id }}"{% endif %} class="{%- if item.classes %} {{ item.classes }}{% else %} flex justify-between items-center gap-base flex-1 py-base{% endif %} {%- if item.disabled %} text-neutral-base no-underline pointer-events-none{% endif %} {%- if item.active %} font-bold{% endif %}" {%- if item.title %} title="{{ item.title }}"{% endif %}{%- if item.active %} aria-current="page"{% endif %} {% if item.disabled %} aria-disabled="true" tabindex="-1"{% endif %} {% if item.target %} target="{{ item.target }}"{% endif %}{%- for attribute, value in item.attributes %} {{ attribute }}="{{ value }}"{% endfor -%}>
49
+ <div class="flex gap-base justify-between items-center flex-1">
50
+ {% if item.icon %}
51
+ <div class="{% if item.icon.containerClasses %}{{ item.icon.containerClasses }}{% else %}self-center h-full{% endif %}">
52
+ {% if item.icon.html %}
53
+ {{ item.icon.html | safe }}
54
+ {% endif %}
55
+ </div>
56
+ {% endif %}
57
+ <div class="flex-1">
58
+ {% if item.active %}
59
+ <strong>{{ item.html | safe if item.html else item.text }}</strong>
60
+ {% else %}
61
+ {{ item.html | safe if item.html else item.text }}
62
+ {% endif %}
63
+ </div>
64
+ </div>
65
+ </div>
66
+ {% endif %}
67
+ {% if item.sub.html %}
68
+ <div class="{%- if item.sub.classes %} {{ item.sub.classes }}{% else %} c-paragraph-base text-neutral-dark -mt-base mr-lg{% endif %}" id="{{ subId }}">
69
+ {{ item.sub.html | safe }}
70
+ </div>
71
+ {% endif %}
72
+ </li>
73
+ {% endif %}
74
+ {% endfor %}
75
+ </ul>
76
+ {% endset -%}
77
+
78
+ <!-- links-list -->
79
+
80
+
81
+ {% if params.hasNav == false %}
82
+ <div {%- if params.classes %} class="{{ params.classes }}"{% endif %}
83
+ {%- for attribute, value in params.attributes %} {{ attribute }}="{{ value }}"{% endfor -%}>
84
+ {{ innerHtml | trim | safe }}
85
+ </div>
86
+ {% else %}
87
+ <nav {%- if params.classes %} class="{{ params.classes }}"{% endif %}
88
+ {%- for attribute, value in params.attributes %} {{ attribute }}="{{ value }}"{% endfor -%}>
89
+ {{ innerHtml | trim | safe }}
90
+ </nav>
91
+ {% endif %}
92
+ <!-- /links-list -->
@@ -0,0 +1,82 @@
1
+ params:
2
+ - name: idPrefix
3
+ type: string
4
+ required: false
5
+ description: String to prefix id for each item if no id is specified on each item.
6
+ - name: hasNav
7
+ type: boolean
8
+ required: false
9
+ description: Defaults to `true`. If `false`, there will be no nav assuming the component will be wrapped with a custom nav with it's own aria-label.
10
+ - name: items
11
+ type: array
12
+ required: true
13
+ description: Array of nav items objects.
14
+ params:
15
+ - name: href
16
+ type: string
17
+ required: false
18
+ description: Item link.
19
+ - name: target
20
+ type: string
21
+ required: false
22
+ description: The target where the item should link to.
23
+ - name: text
24
+ type: string
25
+ required: true
26
+ description: If `html` is set, this is not required. Text to use within each nav item label. If `html` is provided, the `text` argument will be ignored.
27
+ - name: html
28
+ type: string
29
+ required: true
30
+ description: If `text` is set, this is not required. HTML to use within each nav item label. If `html` is provided, the `text` argument will be ignored.
31
+ - name: id
32
+ type: string
33
+ required: false
34
+ description: Specific id attribute for the item. If omitted, then idPrefix option will be applied.
35
+ - name: disabled
36
+ type: boolean
37
+ required: false
38
+ description: If true, nav will be disabled.
39
+ - name: sub
40
+ type: boolean
41
+ required: false
42
+ description: If true, content provided will be revealed when the item is expanded.
43
+ - name: html
44
+ type: string
45
+ required: true
46
+ description: Provide content for the sub.
47
+ - name: classes
48
+ type: string
49
+ required: false
50
+ description: Classes to add to the sub container.
51
+ - name: icon
52
+ type: object
53
+ required: false
54
+ description: This is the optional icon at left
55
+ - name: html
56
+ type: string
57
+ required: true
58
+ description: Use this html to insert a custom svg inline icon. If this is set, the type are not used.
59
+ - name: containerClasses
60
+ type: string
61
+ required: false
62
+ description: Classes applied to the parent div of icon. Useful to vertical align the icon.
63
+ - name: containerClasses
64
+ type: string
65
+ required: false
66
+ description: Classes to add to the parent `<li> of the item.
67
+ - name: classes
68
+ type: string
69
+ required: false
70
+ description: Classes to add to the item.
71
+ - name: attributes
72
+ type: object
73
+ required: false
74
+ description: HTML attributes (for example data attributes) to add to the item.
75
+ - name: classes
76
+ type: string
77
+ required: false
78
+ description: Classes to add to the nav container.
79
+ - name: attributes
80
+ type: object
81
+ required: false
82
+ description: HTML attributes (for example data attributes) to add to the nav container.
@@ -76,13 +76,3 @@ params:
76
76
  type: object
77
77
  required: false
78
78
  description: HTML attributes (for example data attributes) to add to the nav container.
79
-
80
- accessibilityCriteria: |
81
- ## sub reveals
82
- Must:
83
- - be visible as static content if JavaScript is unavailable or fails
84
- - be hidden if JavaScript is available and is collapsed
85
- - indicate if content is expanded or collapsed
86
- - indicate that there is collapsed content to interact with
87
-
88
- Note that alphagov have known issues against this criteria: https://github.com/alphagov/govuk_elements/issues/575
@@ -1,11 +1,7 @@
1
1
  {#- If an id 'prefix' is not passed, fall back to using the name attribute
2
- instead. We need this for error messages and hints as well -#}
2
+ instead. -#}
3
3
  {% set idPrefix = params.idPrefix if params.idPrefix else "nav-item" %}
4
4
 
5
- {#- fieldset is false by default -#}
6
- {% set hasFieldset = true if params.fieldset else false %}
7
-
8
- {#- Capture the HTML so we can optionally nest it in a fieldset -#}
9
5
  {% set innerHtml %}
10
6
  <ul class="text-base">
11
7
  {% for item in params.items %}
@@ -32,15 +32,6 @@ params:
32
32
  type: string
33
33
  required: false
34
34
  description: Specific id attribute for the item. If omitted, then idPrefix option will be applied.
35
- - name: hint
36
- type: object
37
- required: false
38
- description: Provide hint to each nav item.
39
- isComponent: true
40
- - name: expanded
41
- type: boolean
42
- required: false
43
- description: If true, nav sub will be expanded.
44
35
  - name: divider
45
36
  required: false
46
37
  description: If true, a divider border will be shown after the item.
@@ -80,13 +71,3 @@ params:
80
71
  type: object
81
72
  required: false
82
73
  description: HTML attributes (for example data attributes) to add to the nav container.
83
-
84
- accessibilityCriteria: |
85
- ## sub reveals
86
- Must:
87
- - be visible as static content if JavaScript is unavailable or fails
88
- - be hidden if JavaScript is available and is collapsed
89
- - indicate if content is expanded or collapsed
90
- - indicate that there is collapsed content to interact with
91
-
92
- Note that alphagov have known issues against this criteria: https://github.com/alphagov/govuk_elements/issues/575
@@ -102,13 +102,3 @@ params:
102
102
  type: object
103
103
  required: false
104
104
  description: HTML attributes (for example data attributes) to add to the radio input tag.
105
-
106
- accessibilityCriteria: |
107
- ## Conditional reveals
108
- Must:
109
- - be visible as static content if JavaScript is unavailable or fails
110
- - be hidden if JavaScript is available and is collapsed
111
- - indicate if content is expanded or collapsed
112
- - indicate that there is collapsed content to interact with
113
-
114
- Note that we have known issues against this criteria: https://github.com/alphagov/govuk_elements/issues/575
@@ -1,54 +1,10 @@
1
1
  {% set exampleComponent = "table" %}
2
2
  {% set examples = [
3
3
  {
4
- "name": "default",
5
- "data": {
6
- "rows": [
7
- [
8
- {
9
- "text": "January"
10
- },
11
- {
12
- "text": "85€",
13
- "classes": "text-right"
14
- },
15
- {
16
- "text": "95€",
17
- "classes": "text-right"
18
- }
19
- ],
20
- [
21
- {
22
- "text": "February"
23
- },
24
- {
25
- "text": "75€",
26
- "classes": "text-right"
27
- },
28
- {
29
- "text": "55€",
30
- "classes": "text-right"
31
- }
32
- ],
33
- [
34
- {
35
- "text": "March"
36
- },
37
- {
38
- "text": "165€",
39
- "classes": "text-right"
40
- },
41
- {
42
- "text": "125€",
43
- "classes": "text-right"
44
- }
45
- ]
46
- ]
47
- }
48
- },
49
- {
50
- "name": "table with head",
4
+ "name": "table default",
51
5
  "data": {
6
+ "caption": "Caption de la tabla",
7
+ "captionClasses": "sr-only mb-base font-bold text-left text-lg",
52
8
  "head": [
53
9
  {
54
10
  "text": "Month you apply"
@@ -106,7 +62,7 @@
106
62
  }
107
63
  },
108
64
  {
109
- "name": "table with head and caption",
65
+ "name": "table with caption visible",
110
66
  "data": {
111
67
  "caption": "Caption 1: Months and rates",
112
68
  "captionClasses": "mb-base font-bold text-left text-lg",
@@ -88,7 +88,7 @@ params:
88
88
  description: HTML attributes (for example data attributes) to add to the table container.
89
89
 
90
90
  accessibilityCriteria: |
91
- ## Tables must:
91
+ ## Las tablas deben:
92
92
  1. Debe tener al menos una celda de encabezado (TH) en las filas o columnas exteriores.
93
93
  2. Si la tabla tiene más de un nivel de encabezado (si hay elementos th en dos filas o en dos columnas) las celdas de datos y de encabezado deben estar asociadas con los atributos id (en los th) /headers (en los td).
94
94
  3. El título de la tabla debe estar marcado como <caption>
@@ -1,56 +1,11 @@
1
1
  {% set exampleComponent = "table-advanced" %}
2
2
  {% set examples = [
3
3
  {
4
- "name": "default",
4
+ "name": "table default",
5
5
  "data": {
6
- "rows": [
7
- [
8
- {
9
- "text": "January"
10
- },
11
- {
12
- "text": "85€",
13
- "classes": "text-right"
14
- },
15
- {
16
- "text": "95€",
17
- "classes": "text-right"
18
- }
19
- ],
20
- [
21
- {
22
- "text": "February"
23
- },
24
- {
25
- "text": "75€",
26
- "classes": "text-right"
27
- },
28
- {
29
- "text": "55€",
30
- "classes": "text-right"
31
- }
32
- ],
33
- [
34
- {
35
- "text": "March"
36
- },
37
- {
38
- "text": "165€",
39
- "classes": "text-right"
40
- },
41
- {
42
- "text": "125€",
43
- "classes": "text-right"
44
- }
45
- ]
46
- ],
47
- "classes": "min-w-full"
48
- }
49
- },
50
- {
51
- "name": "table with head",
52
- "data": {
53
- "idPrefix": "table-with-head",
6
+ "idPrefix": "table-default",
7
+ "caption": "Caption de la tabla",
8
+ "captionClasses": "sr-only mb-base font-bold text-left text-lg",
54
9
  "head": [
55
10
  {
56
11
  "text": "Month you apply"
@@ -109,10 +64,10 @@
109
64
  }
110
65
  },
111
66
  {
112
- "name": "table with head and caption",
67
+ "name": "table with caption visible",
113
68
  "description": "Also with firstCellIsHeader: true",
114
69
  "data": {
115
- "idPrefix": "table-with-head-and-caption",
70
+ "idPrefix": "table-with-caption",
116
71
  "caption": "Caption 1: Months and rates",
117
72
  "captionClasses": "mb-base font-bold text-left text-lg",
118
73
  "firstCellIsHeader": true,
@@ -52,6 +52,22 @@
52
52
  }
53
53
  }
54
54
  },
55
+ {
56
+ "name": "Pressed",
57
+ "description": "pressed = true. If pressed is true the toggle is on.",
58
+ "data": {
59
+ "pressed": true,
60
+ "classes": "c-button",
61
+ "offState": {
62
+ "classes": "",
63
+ "html": '<span class="inline-flex"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48 48" class="self-center mr-2" aria-hidden="true" width="1em" height="1em"><path d="M6.41 10.78a.25.25 0 0 0 0 .34l2.16 2.41a1.35 1.35 0 0 0 .8.27 1.31 1.31 0 0 0 1.31-1.31V7.12a.26.26 0 0 0-.43-.18ZM.26 13.81a.76.76 0 0 0 1 0l12.5-12.5a.76.76 0 0 0 .18-.31.71.71 0 0 0 .06-.24.73.73 0 0 0-.19-.49.74.74 0 0 0-1.06 0l-2 2a.26.26 0 0 1-.19.07.25.25 0 0 1-.18-.08 1.23 1.23 0 0 0-1-.45 1.29 1.29 0 0 0-.8.27L5.74 5.21a.23.23 0 0 1-.19.09H4.42a1.75 1.75 0 0 0-1.75 1.75v1.5A1.78 1.78 0 0 0 3 9.61a.25.25 0 0 1 0 .33L.22 12.73a.75.75 0 0 0 0 1.06Z" fill="currentColor" transform="scale(3.42857)"/></svg>Reproducir sonido</span>'
64
+ },
65
+ "onState": {
66
+ "classes": "c-button--has-selection",
67
+ "html": '<span class="inline-flex"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48 48" class="self-center mr-2" aria-hidden="true" width="1em" height="1em"><path d="M12 2.21a.75.75 0 0 0-1.06 0 .75.75 0 0 0 0 1.06 5.26 5.26 0 0 1 0 7.46.75.75 0 0 0 0 1.06.75.75 0 0 0 1.06 0 6.74 6.74 0 0 0 0-9.58Z" fill="currentColor" transform="scale(3.42857)"/><path d="M10.34 4.89a.75.75 0 0 0-1.23.85 2.23 2.23 0 0 1 0 2.52.74.74 0 0 0 .19 1 .75.75 0 0 0 1-.19 3.7 3.7 0 0 0 0-4.22ZM6.69 1a1.35 1.35 0 0 0-.8.27L3.07 4.42a.27.27 0 0 1-.19.08H1.75A1.76 1.76 0 0 0 0 6.25v1.5A1.76 1.76 0 0 0 1.75 9.5h1.13a.27.27 0 0 1 .19.08l2.82 3.15a1.35 1.35 0 0 0 .8.27A1.31 1.31 0 0 0 8 11.69V2.31A1.31 1.31 0 0 0 6.69 1Z" fill="currentColor" transform="scale(3.42857)"/></svg>Reproducir sonido</span>'
68
+ }
69
+ }
70
+ },
55
71
  {
56
72
  "name": "isSwitch",
57
73
  "description": "Switch appearance, no change of button text, only changes in visual state. It needs an outer element with an id to use it with its aria-labelledby.",
@@ -71,6 +87,26 @@
71
87
  }
72
88
  }
73
89
  },
90
+ {
91
+ "name": "isSwitch pressed",
92
+ "description": "Switch appearance, no change of button text, only changes in visual state. It needs an outer element with an id to use it with its aria-labelledby.",
93
+ "data": {
94
+ "classes": "",
95
+ "pressed": true,
96
+ "isSwitch": true,
97
+ "offState": {
98
+ "classes": "",
99
+ "html": '<span class="flex align-center justify-between gap-xs"><span class="text-sm" aria-hidden="true">Off</span><span class="bg-neutral-base relative inline-flex flex-shrink-0 h-5 w-9 border-2 border-neutral-base rounded-full cursor-pointer focus:outline-none focus-visible:ring-2 focus-visible:ring-white focus-visible:ring-opacity-75"><span class="sr-only">Off</span><span aria-hidden="true" class="translate-x-0 pointer-events-none inline-block h-4 w-4 rounded-full bg-white shadow-lg transform ring-0 transition ease-in-out duration-200" /></span></span><span class="text-sm" aria-hidden="true">On</span></span>'
100
+ },
101
+ "onState": {
102
+ "classes": "",
103
+ "html": '<span class="flex align-center justify-between gap-xs"><span class="text-sm" aria-hidden="true">Off</span><span class="bg-primary-base relative inline-flex flex-shrink-0 h-5 w-9 border-2 border-primary-base rounded-full cursor-pointer focus:outline-none focus-visible:ring-2 focus-visible:ring-white focus-visible:ring-opacity-75"><span class="sr-only">On</span><span aria-hidden="true" class="translate-x-4 pointer-events-none inline-block h-4 w-4 rounded-full bg-white shadow-lg transform ring-0 transition ease-in-out duration-200" /></span></span><span class="text-sm" aria-hidden="true">On</span></span>'
104
+ },
105
+ "attributes": {
106
+ "aria-labelledby": "id-text"
107
+ }
108
+ }
109
+ },
74
110
  {
75
111
  "name": "isSwitch small",
76
112
  "description": "Switch appearance, no change of button text, only changes in visual state. It needs an outer element with an id to use it with its aria-labelledby.",
@@ -3,11 +3,16 @@
3
3
  >
4
4
  <!-- Button -->
5
5
  <button
6
- {% if params.isSwitch %}
6
+ {% if params.isSwitch and params.pressed == null %}
7
7
  role = "switch"
8
8
  aria-checked="false"
9
+ {% elseif params.isSwitch and params.pressed == true %}
10
+ role = "switch"
11
+ aria-checked="true"
9
12
  {% elseif params.isExpandible == false %}
10
13
  aria-pressed="false"
14
+ {% elseif params.pressed == true %}
15
+ aria-pressed="true"
11
16
  {% else %}
12
17
  aria-expanded="false"
13
18
  {% endif %}
@@ -1,5 +0,0 @@
1
- {% set title = "Header. Componente, parámetros y ejemplos. Documentación de desy-html. Gobierno de Aragón" %}
2
- {% extends "_template.examples.njk" %}
3
- {% block contentBlock %}
4
- {% import "components/header/_examples.header-2.njk" as exampleData %}
5
- {% endblock %}