desy-html 6.6.0 → 7.0.1
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.
- package/docs/_include.template-header.njk +3 -0
- package/docs/ds/_ds.example.typography.njk +1 -1
- package/docs/ds/_ds.section.typography.njk +1 -1
- package/docs/index.html +11 -1
- package/package.json +12 -12
- package/src/js/aria/toggle.js +3 -0
- package/src/js/aria/treeitem.js +11 -4
- package/src/templates/components/button/_examples.button.njk +9 -0
- package/src/templates/components/card/_examples.card.njk +11 -11
- package/src/templates/components/checkboxes/params.checkboxes.yaml +0 -10
- package/src/templates/components/collapsible/_examples.collapsible.njk +2 -2
- package/src/templates/components/error-message/params.error-message.yaml +1 -15
- package/src/templates/components/header/_examples.header.njk +50 -14
- package/src/templates/components/header/_template.header.njk +1 -1
- package/src/templates/components/header/params.header.yaml +0 -20
- package/src/templates/components/header-advanced/_examples.header-advanced.njk +15 -13
- package/src/templates/components/header-advanced/params.header-advanced.yaml +0 -20
- package/src/templates/components/links-list/_examples.links-list.njk +9 -9
- package/src/templates/components/menu-navigation/params.menu-navigation.yaml +0 -10
- package/src/templates/components/menu-vertical/_template.menu-vertical.njk +1 -5
- package/src/templates/components/menu-vertical/params.menu-vertical.yaml +0 -15
- package/src/templates/components/radios/params.radios.yaml +0 -10
- package/src/templates/components/table/params.table.yaml +1 -1
- package/src/templates/components/table-advanced/_template.table-advanced.njk +1 -1
- package/src/templates/components/table-advanced/params.table-advanced.yaml +2 -1
- package/src/templates/components/toggle/_examples.toggle.njk +36 -0
- package/src/templates/components/toggle/_template.toggle.njk +6 -1
- package/docs/examples-header-2.html +0 -5
- package/src/templates/components/header/_examples.header-2.njk +0 -555
|
@@ -43,21 +43,21 @@
|
|
|
43
43
|
"href": "#",
|
|
44
44
|
"text": "Item 1",
|
|
45
45
|
"icon": {
|
|
46
|
-
"html": iconSimple
|
|
46
|
+
"html": iconSimple
|
|
47
47
|
}
|
|
48
48
|
},
|
|
49
49
|
{
|
|
50
50
|
"href": "#",
|
|
51
51
|
"text": "Item 2",
|
|
52
52
|
"icon": {
|
|
53
|
-
"html": iconSimple
|
|
53
|
+
"html": iconSimple
|
|
54
54
|
}
|
|
55
55
|
},
|
|
56
56
|
{
|
|
57
57
|
"href": "#",
|
|
58
58
|
"text": "Item 3",
|
|
59
59
|
"icon": {
|
|
60
|
-
"html": iconSimple
|
|
60
|
+
"html": iconSimple
|
|
61
61
|
}
|
|
62
62
|
}
|
|
63
63
|
],
|
|
@@ -76,7 +76,7 @@
|
|
|
76
76
|
"text": "Item grande con icono",
|
|
77
77
|
"classes": "flex justify-between items-center py-base text-2xl",
|
|
78
78
|
"icon": {
|
|
79
|
-
"html": iconComplex
|
|
79
|
+
"html": iconComplex
|
|
80
80
|
}
|
|
81
81
|
},
|
|
82
82
|
{
|
|
@@ -84,7 +84,7 @@
|
|
|
84
84
|
"text": "Item grande con icono",
|
|
85
85
|
"classes": "flex justify-between items-center py-base text-2xl",
|
|
86
86
|
"icon": {
|
|
87
|
-
"html": iconComplex
|
|
87
|
+
"html": iconComplex
|
|
88
88
|
}
|
|
89
89
|
},
|
|
90
90
|
{
|
|
@@ -92,7 +92,7 @@
|
|
|
92
92
|
"text": "Item grande con icono",
|
|
93
93
|
"classes": "flex justify-between items-center py-base text-2xl",
|
|
94
94
|
"icon": {
|
|
95
|
-
"html": iconComplex
|
|
95
|
+
"html": iconComplex
|
|
96
96
|
}
|
|
97
97
|
}
|
|
98
98
|
],
|
|
@@ -111,7 +111,7 @@
|
|
|
111
111
|
"text": "Item 1",
|
|
112
112
|
"containerClasses": "px-base border border-neutral-base my-sm",
|
|
113
113
|
"icon": {
|
|
114
|
-
"html": iconSimple
|
|
114
|
+
"html": iconSimple
|
|
115
115
|
}
|
|
116
116
|
},
|
|
117
117
|
{
|
|
@@ -119,7 +119,7 @@
|
|
|
119
119
|
"text": "Item 2",
|
|
120
120
|
"containerClasses": "my-base px-base border border-neutral-base rounded",
|
|
121
121
|
"icon": {
|
|
122
|
-
"html": iconSimple
|
|
122
|
+
"html": iconSimple
|
|
123
123
|
}
|
|
124
124
|
},
|
|
125
125
|
{
|
|
@@ -127,7 +127,7 @@
|
|
|
127
127
|
"text": "Item 3",
|
|
128
128
|
"containerClasses": "px-base border border-neutral-base my-sm",
|
|
129
129
|
"icon": {
|
|
130
|
-
"html": iconSimple
|
|
130
|
+
"html": iconSimple
|
|
131
131
|
}
|
|
132
132
|
}
|
|
133
133
|
],
|
|
@@ -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.
|
|
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,11 +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
35
|
- name: divider
|
|
41
36
|
required: false
|
|
42
37
|
description: If true, a divider border will be shown after the item.
|
|
@@ -76,13 +71,3 @@ params:
|
|
|
76
71
|
type: object
|
|
77
72
|
required: false
|
|
78
73
|
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
|
|
@@ -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
|
|
@@ -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
|
-
##
|
|
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>
|
|
@@ -124,4 +124,5 @@ accessibilityCriteria: |
|
|
|
124
124
|
4. La primera fila de la tabla no puede tener todas las celdas unidas, o se interpreta que se está simulando un caption.
|
|
125
125
|
5. Después de un encabezado (h1, h2…) no puede ir directamente una tabla, o se entiende que se está usando el encabezado para lo que debería ser el <caption>
|
|
126
126
|
6. La tabla debe tener una descripción especialmente si la tabla es grande o compleja, tiene varios niveles de encabezados, tiene totales o enlaces, etc. La descripción intenta suplir la primera impresión que tienen de la tabla las personas que pueden verla, por ejemplo, vemos que en la última columna hay enlaces o en la última fila hay totales. Como en HTML 5 ya no está admitido el atributo summary en las tablas, lo que se hace es poner la descripción en un párrafo antes de la tabla y asociarlo a la tabla con aria-describedby (así se evita también el error 5). El caption y la descripción no deben ser iguales.
|
|
127
|
-
7. El validador del OAW dará error si hay tablas de una única columna y 3 o más filas con texto menor de 150 caracteres, pues considerará que se está simulando una lista.
|
|
127
|
+
7. El validador del OAW dará error si hay tablas de una única columna y 3 o más filas con texto menor de 150 caracteres, pues considerará que se está simulando una lista.
|
|
128
|
+
8. Las tablas complejas como esta deben tener una descripción. La descripción se incluye en un texto visible antes de la tabla (aunque puede estar en un <details>) y se asocia a la tabla mediante el atributo aria-describedby de la tabla.
|
|
@@ -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 %}
|