desy-html 5.3.0 → 6.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.
- package/config/tailwind.config.js +10 -10
- package/docs/_include.template-header.njk +8 -0
- package/docs/_macro.example-render.njk +8 -0
- package/docs/componentes.html +6 -0
- package/docs/ds/_ds.example.accordion.njk +61 -0
- package/docs/ds/_ds.example.footer.njk +7 -128
- package/docs/ds/_ds.example.header.njk +118 -0
- package/docs/ds/_ds.example.layout.njk +16 -6
- package/docs/ds/_ds.example.menu-navigation.njk +494 -0
- package/docs/ds/_ds.example.searchbar.njk +39 -0
- package/docs/ds/_ds.example.table.njk +432 -0
- package/docs/ds/_ds.example.toggle.njk +55 -35
- package/docs/ds/_ds.section.layout.njk +12 -12
- package/docs/ds/_ds.section.navigation.njk +5 -0
- package/docs/ds/_ds.section.textos.njk +27 -0
- package/docs/examples-accordion-history.html +5 -0
- package/docs/examples-menu-navigation.html +5 -0
- package/docs/index.html +39 -0
- package/gulpfile.js +7 -6
- package/package.json +6 -7
- package/src/css/base.css +4 -0
- package/src/css/styles.css +1 -0
- package/src/js/aria/accordion.js +16 -5
- package/src/js/aria/disclosureMenu.js +153 -0
- package/src/js/desy-html.js +15 -0
- package/src/js/index.js +2 -0
- package/src/templates/components/accordion/_examples.accordion.njk +70 -2
- package/src/templates/components/accordion/_template.accordion.njk +18 -8
- package/src/templates/components/accordion/params.accordion.yaml +38 -0
- package/src/templates/components/accordion-history/_examples.accordion-history.njk +356 -0
- package/src/templates/components/accordion-history/_macro.accordion-history.njk +3 -0
- package/src/templates/components/accordion-history/_template.accordion-history.njk +209 -0
- package/src/templates/components/accordion-history/params.accordion-history.yaml +125 -0
- package/src/templates/components/button/_examples.button.njk +7 -0
- package/src/templates/components/button/_styles.button.css +27 -0
- package/src/templates/components/button/_template.button.njk +1 -1
- package/src/templates/components/button-loader/_template.button-loader.njk +6 -6
- package/src/templates/components/file-upload/_template.file-upload.njk +1 -1
- package/src/templates/components/footer/_examples.footer.njk +46 -136
- package/src/templates/components/footer/_template.footer.njk +35 -28
- package/src/templates/components/footer/params.footer.yaml +18 -0
- package/src/templates/components/header/_examples.header.njk +166 -0
- package/src/templates/components/header/_template.header.header__navigation.njk +2 -2
- package/src/templates/components/header/_template.header.njk +7 -3
- package/src/templates/components/header/params.header.yaml +24 -0
- package/src/templates/components/item/_examples.item.njk +1 -1
- package/src/templates/components/item/_template.item.njk +3 -3
- package/src/templates/components/listbox/_styles.listbox.css +7 -4
- package/src/templates/components/menu-horizontal/_examples.menu-horizontal.njk +25 -0
- package/src/templates/components/menu-horizontal/_styles.menu-horizontal.css +26 -0
- package/src/templates/components/menu-horizontal/_template.menu-horizontal.njk +1 -1
- package/src/templates/components/menu-navigation/_examples.menu-navigation.njk +1080 -0
- package/src/templates/components/menu-navigation/_macro.menu-navigation.njk +3 -0
- package/src/templates/components/menu-navigation/_styles.menu-navigation.css +216 -0
- package/src/templates/components/menu-navigation/_template.menu-navigation.njk +116 -0
- package/src/templates/components/menu-navigation/params.menu-navigation.yaml +93 -0
- package/src/templates/components/menubar/_examples.menubar.njk +1 -1
- package/src/templates/components/menubar/_styles.menubar.css +26 -5
- package/src/templates/components/modal/_examples.modal.njk +62 -0
- package/src/templates/components/modal/_template.modal.njk +21 -4
- package/src/templates/components/modal/params.modal.yaml +2 -2
- package/src/templates/components/searchbar/_examples.searchbar.njk +12 -1
- package/src/templates/components/searchbar/_template.searchbar.njk +8 -8
- package/src/templates/components/spinner/_styles.spinner.css +1 -0
- package/src/templates/components/spinner/_template.spinner.njk +4 -4
- package/src/templates/components/table-advanced/_examples.table-advanced.njk +182 -5
- package/src/templates/components/table-advanced/_template.table-advanced.njk +26 -2
- package/src/templates/components/table-advanced/params.table-advanced.yaml +5 -0
- package/src/templates/components/toggle/_examples.toggle.njk +33 -11
- package/src/templates/components/toggle/_template.toggle.njk +3 -1
- package/src/templates/components/toggle/params.toggle.yaml +4 -0
- package/src/templates/components/tree/_examples.tree.njk +580 -32
- package/src/templates/components/tree/_template.tree.njk +1 -1
- package/config/clean-css.js +0 -25
|
@@ -0,0 +1,356 @@
|
|
|
1
|
+
{% set exampleComponent = "accordion-history" %}
|
|
2
|
+
{% set examples = [
|
|
3
|
+
{
|
|
4
|
+
"name": "default",
|
|
5
|
+
"description": "Assumes allowMultiple and allowToggle are both false",
|
|
6
|
+
"data": {
|
|
7
|
+
"idPrefix": "accordion-example",
|
|
8
|
+
"headingLevel": 3,
|
|
9
|
+
"items": [
|
|
10
|
+
{
|
|
11
|
+
"headerText": "Accordion Item 1",
|
|
12
|
+
"html": "<div class=\" w-48 p-2 \"><div class=\" border-4 border-dashed border-gray-200 rounded-lg h-40 \"></div></div>"
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
"headerText": "Accordion Item 2",
|
|
16
|
+
"html": "<div class=\" w-48 p-2 \"><div class=\" border-4 border-dashed border-gray-200 rounded-lg h-40 \"></div></div>"
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
"headerText": "Accordion Item 3",
|
|
20
|
+
"html": "<div class=\" w-48 p-2 \"><div class=\" border-4 border-dashed border-gray-200 rounded-lg h-40 \"></div></div>"
|
|
21
|
+
}
|
|
22
|
+
]
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
"name": "with status",
|
|
27
|
+
"description": "Set status to each item: past, current and pending",
|
|
28
|
+
"data": {
|
|
29
|
+
"idPrefix": "accordion-status",
|
|
30
|
+
"headingLevel": 3,
|
|
31
|
+
"items": [
|
|
32
|
+
{
|
|
33
|
+
"headerText": "Accordion Item muted",
|
|
34
|
+
"html": "<div class=\" w-48 p-2 \"><div class=\" border-4 border-dashed border-gray-200 rounded-lg h-40 \"></div></div>",
|
|
35
|
+
"status": "muted"
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
"headerText": "Accordion Item currentmuted",
|
|
39
|
+
"html": "<div class=\" w-48 p-2 \"><div class=\" border-4 border-dashed border-gray-200 rounded-lg h-40 \"></div></div>",
|
|
40
|
+
"status": "currentmuted"
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
"headerText": "Accordion Item past",
|
|
44
|
+
"html": "<div class=\" w-48 p-2 \"><div class=\" border-4 border-dashed border-gray-200 rounded-lg h-40 \"></div></div>",
|
|
45
|
+
"status": "past"
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
"headerText": "Accordion Item current",
|
|
49
|
+
"html": "<div class=\" w-48 p-2 \"><div class=\" border-4 border-dashed border-gray-200 rounded-lg h-40 \"></div></div>",
|
|
50
|
+
"status": "current"
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
"headerText": "Accordion Item pending",
|
|
54
|
+
"html": "<div class=\" w-48 p-2 \"><div class=\" border-4 border-dashed border-gray-200 rounded-lg h-40 \"></div></div>",
|
|
55
|
+
"status": "pending"
|
|
56
|
+
}
|
|
57
|
+
]
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
"name": "Allow multiple",
|
|
62
|
+
"description": "allowMultiple = true. Assumes allowToggle is true",
|
|
63
|
+
"data": {
|
|
64
|
+
"idPrefix": "allowmultiple-example",
|
|
65
|
+
"headingLevel": 3,
|
|
66
|
+
"allowMultiple": true,
|
|
67
|
+
"items": [
|
|
68
|
+
{
|
|
69
|
+
"headerText": "Accordion Item 1",
|
|
70
|
+
"html": "<div class=\" w-48 p-2 \"><div class=\" border-4 border-dashed border-gray-200 rounded-lg h-40 \"></div></div>"
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
"headerText": "Accordion Item 2",
|
|
74
|
+
"html": "<div class=\" w-48 p-2 \"><div class=\" border-4 border-dashed border-gray-200 rounded-lg h-40 \"></div></div>"
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
"headerText": "Accordion Item 3",
|
|
78
|
+
"html": "<div class=\" w-48 p-2 \"><div class=\" border-4 border-dashed border-gray-200 rounded-lg h-40 \"></div></div>"
|
|
79
|
+
}
|
|
80
|
+
]
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
"name": "Allow toggle",
|
|
85
|
+
"description": "allowToggle = true. Assumes allowMultiple is false",
|
|
86
|
+
"data": {
|
|
87
|
+
"idPrefix": "allowtoggle-example",
|
|
88
|
+
"headingLevel": 3,
|
|
89
|
+
"allowToggle": true,
|
|
90
|
+
"items": [
|
|
91
|
+
{
|
|
92
|
+
"headerText": "Accordion Item 1",
|
|
93
|
+
"html": "<div class=\" w-48 p-2 \"><div class=\" border-4 border-dashed border-gray-200 rounded-lg h-40 \"></div></div>"
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
"headerText": "Accordion Item 2",
|
|
97
|
+
"html": "<div class=\" w-48 p-2 \"><div class=\" border-4 border-dashed border-gray-200 rounded-lg h-40 \"></div></div>"
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
"headerText": "Accordion Item 3",
|
|
101
|
+
"html": "<div class=\" w-48 p-2 \"><div class=\" border-4 border-dashed border-gray-200 rounded-lg h-40 \"></div></div>"
|
|
102
|
+
}
|
|
103
|
+
]
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
"name": "With one item opened",
|
|
108
|
+
"data": {
|
|
109
|
+
"idPrefix": "with-one-item-opened-example",
|
|
110
|
+
"headingLevel": 3,
|
|
111
|
+
"allowToggle": true,
|
|
112
|
+
"items": [
|
|
113
|
+
{
|
|
114
|
+
"headerText": "Accordion Item 1",
|
|
115
|
+
"html": "<div class=\" w-48 p-2 \"><div class=\" border-4 border-dashed border-gray-200 rounded-lg h-40 \"></div></div>"
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
"headerText": "Accordion Item 2",
|
|
119
|
+
"html": "<div class=\" w-48 p-2 \"><div class=\" border-4 border-dashed border-gray-200 rounded-lg h-40 \"></div></div>",
|
|
120
|
+
"open": true
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
"headerText": "Accordion Item 3",
|
|
124
|
+
"html": "<div class=\" w-48 p-2 \"><div class=\" border-4 border-dashed border-gray-200 rounded-lg h-40 \"></div></div>"
|
|
125
|
+
}
|
|
126
|
+
]
|
|
127
|
+
}
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
"name": "With 2 items opened",
|
|
131
|
+
"data": {
|
|
132
|
+
"idPrefix": "with-2-items-opened-example",
|
|
133
|
+
"headingLevel": 3,
|
|
134
|
+
"allowMultiple": true,
|
|
135
|
+
"items": [
|
|
136
|
+
{
|
|
137
|
+
"headerText": "Accordion Item 1",
|
|
138
|
+
"html": "<div class=\" w-48 p-2 \"><div class=\" border-4 border-dashed border-gray-200 rounded-lg h-40 \"></div></div>",
|
|
139
|
+
"open": true
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
"headerText": "Accordion Item 2",
|
|
143
|
+
"html": "<div class=\" w-48 p-2 \"><div class=\" border-4 border-dashed border-gray-200 rounded-lg h-40 \"></div></div>"
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
"headerText": "Accordion Item 3",
|
|
147
|
+
"html": "<div class=\" w-48 p-2 \"><div class=\" border-4 border-dashed border-gray-200 rounded-lg h-40 \"></div></div>",
|
|
148
|
+
"open": true
|
|
149
|
+
}
|
|
150
|
+
]
|
|
151
|
+
}
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
"name": "disabled and allowToggle and allowMultiple",
|
|
155
|
+
"description": "will hide the show/hide info and disable click in items",
|
|
156
|
+
"data": {
|
|
157
|
+
"idPrefix": "accordion-disabled",
|
|
158
|
+
"headingLevel": 3,
|
|
159
|
+
"allowToggle": true,
|
|
160
|
+
"allowMultiple": true,
|
|
161
|
+
"items": [
|
|
162
|
+
{
|
|
163
|
+
"headerText": "Accordion Item not disabled",
|
|
164
|
+
"html": "<div class=\" w-48 p-2 \"><div class=\" border-4 border-dashed border-gray-200 rounded-lg h-40 \"></div></div>"
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
"headerText": "Accordion Item disabled",
|
|
168
|
+
"html": "<div class=\" w-48 p-2 \"><div class=\" border-4 border-dashed border-gray-200 rounded-lg h-40 \"></div></div>",
|
|
169
|
+
"disabled": true
|
|
170
|
+
},
|
|
171
|
+
{
|
|
172
|
+
"headerText": "Accordion Item disabled and open",
|
|
173
|
+
"html": "<div class=\" w-48 p-2 \"><div class=\" border-4 border-dashed border-gray-200 rounded-lg h-40 \"></div></div>",
|
|
174
|
+
"disabled": true,
|
|
175
|
+
"open": true
|
|
176
|
+
}
|
|
177
|
+
]
|
|
178
|
+
}
|
|
179
|
+
},
|
|
180
|
+
{
|
|
181
|
+
"name": "With heading",
|
|
182
|
+
"data": {
|
|
183
|
+
"idPrefix": "heading-example",
|
|
184
|
+
"headingLevel": 3,
|
|
185
|
+
"heading": {
|
|
186
|
+
"text": "Accordion example"
|
|
187
|
+
},
|
|
188
|
+
"items": [
|
|
189
|
+
{
|
|
190
|
+
"headerText": "Accordion Item 1",
|
|
191
|
+
"html": "<div class=\" w-48 p-2 \"><div class=\" border-4 border-dashed border-gray-200 rounded-lg h-40 \"></div></div>"
|
|
192
|
+
},
|
|
193
|
+
{
|
|
194
|
+
"headerText": "Accordion Item 2",
|
|
195
|
+
"html": "<div class=\" w-48 p-2 \"><div class=\" border-4 border-dashed border-gray-200 rounded-lg h-40 \"></div></div>"
|
|
196
|
+
},
|
|
197
|
+
{
|
|
198
|
+
"headerText": "Accordion Item 3",
|
|
199
|
+
"html": "<div class=\" w-48 p-2 \"><div class=\" border-4 border-dashed border-gray-200 rounded-lg h-40 \"></div></div>"
|
|
200
|
+
}
|
|
201
|
+
]
|
|
202
|
+
}
|
|
203
|
+
},
|
|
204
|
+
{
|
|
205
|
+
"name": "With heading level 4",
|
|
206
|
+
"description": "headingLevel is 4 in this example. The headings in this component start with h4 in this example. h4 for the heading and h5 inside the buttons.",
|
|
207
|
+
"data": {
|
|
208
|
+
"idPrefix": "accordion-heading-level-example",
|
|
209
|
+
"headingLevel": 4,
|
|
210
|
+
"heading": {
|
|
211
|
+
"text": "This header starts with h4"
|
|
212
|
+
},
|
|
213
|
+
"items": [
|
|
214
|
+
{
|
|
215
|
+
"headerText": "This is Item 1 with h5",
|
|
216
|
+
"html": "<div class=\" w-48 p-2 \"><div class=\" border-4 border-dashed border-gray-200 rounded-lg h-40 \"></div></div>"
|
|
217
|
+
},
|
|
218
|
+
{
|
|
219
|
+
"headerText": "This is Item 2 with h5",
|
|
220
|
+
"html": "<div class=\" w-48 p-2 \"><div class=\" border-4 border-dashed border-gray-200 rounded-lg h-40 \"></div></div>"
|
|
221
|
+
},
|
|
222
|
+
{
|
|
223
|
+
"headerText": "This is Item 3 with h5",
|
|
224
|
+
"html": "<div class=\" w-48 p-2 \"><div class=\" border-4 border-dashed border-gray-200 rounded-lg h-40 \"></div></div>"
|
|
225
|
+
}
|
|
226
|
+
]
|
|
227
|
+
}
|
|
228
|
+
},
|
|
229
|
+
{
|
|
230
|
+
"name": "With heading and show controls",
|
|
231
|
+
"data": {
|
|
232
|
+
"idPrefix": "heading-and-show-controls-example",
|
|
233
|
+
"headingLevel": 3,
|
|
234
|
+
"heading": {
|
|
235
|
+
"text": "Accordion example"
|
|
236
|
+
},
|
|
237
|
+
"showControl": true,
|
|
238
|
+
"allowMultiple": true,
|
|
239
|
+
"items": [
|
|
240
|
+
{
|
|
241
|
+
"headerText": "Accordion Item 1",
|
|
242
|
+
"html": "<div class=\" w-48 p-2 \"><div class=\" border-4 border-dashed border-gray-200 rounded-lg h-40 \"></div></div>"
|
|
243
|
+
},
|
|
244
|
+
{
|
|
245
|
+
"headerText": "Accordion Item 2",
|
|
246
|
+
"html": "<div class=\" w-48 p-2 \"><div class=\" border-4 border-dashed border-gray-200 rounded-lg h-40 \"></div></div>",
|
|
247
|
+
"open": true
|
|
248
|
+
},
|
|
249
|
+
{
|
|
250
|
+
"headerText": "Accordion Item 3",
|
|
251
|
+
"html": "<div class=\" w-48 p-2 \"><div class=\" border-4 border-dashed border-gray-200 rounded-lg h-40 \"></div></div>"
|
|
252
|
+
}
|
|
253
|
+
]
|
|
254
|
+
}
|
|
255
|
+
},
|
|
256
|
+
{
|
|
257
|
+
"name": "with custom show/hide info",
|
|
258
|
+
"description": "The last item has empty strings to don't show any info",
|
|
259
|
+
"data": {
|
|
260
|
+
"idPrefix": "accordion-show-hide",
|
|
261
|
+
"headingLevel": 3,
|
|
262
|
+
"allowMultiple": true,
|
|
263
|
+
"items": [
|
|
264
|
+
{
|
|
265
|
+
"headerText": "Accordion Item 1",
|
|
266
|
+
"html": "<div class=\" w-48 p-2 \"><div class=\" border-4 border-dashed border-gray-200 rounded-lg h-40 \"></div></div>",
|
|
267
|
+
"show": {
|
|
268
|
+
"text": "Expandir detalles"
|
|
269
|
+
},
|
|
270
|
+
"hide": {
|
|
271
|
+
"text": "Contraer"
|
|
272
|
+
}
|
|
273
|
+
},
|
|
274
|
+
{
|
|
275
|
+
"headerText": "Accordion Item 2",
|
|
276
|
+
"html": "<div class=\" w-48 p-2 \"><div class=\" border-4 border-dashed border-gray-200 rounded-lg h-40 \"></div></div>",
|
|
277
|
+
"show": {
|
|
278
|
+
"html": '<svg class="w-4 h-4" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48 48"><path d="M14 7a1 1 0 0 0-1-1H8.25A.25.25 0 0 1 8 5.75V1a1 1 0 0 0-2 0v4.75a.25.25 0 0 1-.25.25H1a1 1 0 0 0 0 2h4.75a.25.25 0 0 1 .25.25V13a1 1 0 0 0 2 0V8.25A.25.25 0 0 1 8.25 8H13a1 1 0 0 0 1-1Z" fill="currentColor" transform="scale(3.42857)"/></svg>'
|
|
279
|
+
},
|
|
280
|
+
"hide": {
|
|
281
|
+
"html": '<svg class="w-4 h-4" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48 48"><path d="M13 8H1a1 1 0 0 1 0-2h12a1 1 0 0 1 0 2Z" fill="currentColor" transform="scale(3.42857)"/></svg>'
|
|
282
|
+
}
|
|
283
|
+
},
|
|
284
|
+
{
|
|
285
|
+
"headerText": "Accordion Item 3",
|
|
286
|
+
"html": "<div class=\" w-48 p-2 \"><div class=\" border-4 border-dashed border-gray-200 rounded-lg h-40 \"></div></div>",
|
|
287
|
+
"show": {
|
|
288
|
+
"text": ""
|
|
289
|
+
},
|
|
290
|
+
"hide": {
|
|
291
|
+
"text": ""
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
]
|
|
295
|
+
}
|
|
296
|
+
},
|
|
297
|
+
{
|
|
298
|
+
"name": "With classes applied",
|
|
299
|
+
"description": "Show code to display the classes applied in html",
|
|
300
|
+
"data": {
|
|
301
|
+
"idPrefix": "classes-example",
|
|
302
|
+
"headingLevel": 3,
|
|
303
|
+
"classes": "px-lg pt-base border-t border-b border-neutral-base",
|
|
304
|
+
"items": [
|
|
305
|
+
{
|
|
306
|
+
"headerText": "Accordion Item 1",
|
|
307
|
+
"html": "<div class=\" w-48 p-2 \"><div class=\" border-4 border-dashed border-gray-200 rounded-lg h-40 \"></div></div>"
|
|
308
|
+
},
|
|
309
|
+
{
|
|
310
|
+
"headerText": "Accordion Item 2",
|
|
311
|
+
"html": "<div class=\" w-48 p-2 \"><div class=\" border-4 border-dashed border-gray-200 rounded-lg h-40 \"></div></div>",
|
|
312
|
+
"classes": "py-sm bg-neutral-light border-neutral-base rounded-lg",
|
|
313
|
+
"open": true
|
|
314
|
+
},
|
|
315
|
+
{
|
|
316
|
+
"headerText": "Accordion Item 3",
|
|
317
|
+
"html": "<div class=\" w-48 p-2 \"><div class=\" border-4 border-dashed border-gray-200 rounded-lg h-40 \"></div></div>"
|
|
318
|
+
}
|
|
319
|
+
]
|
|
320
|
+
}
|
|
321
|
+
},
|
|
322
|
+
{
|
|
323
|
+
"name": "With attributes applied",
|
|
324
|
+
"description": "Show code to display the attributes applied in html",
|
|
325
|
+
"data": {
|
|
326
|
+
"idPrefix": "attributes-example",
|
|
327
|
+
"headingLevel": 3,
|
|
328
|
+
"attributes": {
|
|
329
|
+
"id": "accordion-test"
|
|
330
|
+
},
|
|
331
|
+
"items": [
|
|
332
|
+
{
|
|
333
|
+
"headerText": "Accordion Item 1",
|
|
334
|
+
"html": "<div class=\" w-48 p-2 \"><div class=\" border-4 border-dashed border-gray-200 rounded-lg h-40 \"></div></div>",
|
|
335
|
+
"attributes": {
|
|
336
|
+
"data-attr": "accordion-item-test-a"
|
|
337
|
+
}
|
|
338
|
+
},
|
|
339
|
+
{
|
|
340
|
+
"headerText": "Accordion Item 2",
|
|
341
|
+
"html": "<div class=\" w-48 p-2 \"><div class=\" border-4 border-dashed border-gray-200 rounded-lg h-40 \"></div></div>",
|
|
342
|
+
"attributes": {
|
|
343
|
+
"data-attr": "accordion-item-test-b"
|
|
344
|
+
}
|
|
345
|
+
},
|
|
346
|
+
{
|
|
347
|
+
"headerText": "Accordion Item 3",
|
|
348
|
+
"html": "<div class=\" w-48 p-2 \"><div class=\" border-4 border-dashed border-gray-200 rounded-lg h-40 \"></div></div>",
|
|
349
|
+
"attributes": {
|
|
350
|
+
"data-attr": "accordion-item-test-c"
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
]
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
] %}
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
{% set idPrefix = params.idPrefix %}
|
|
2
|
+
{% set conditionalValue = false %}
|
|
3
|
+
{% for item in params.items %}
|
|
4
|
+
{% if item %}
|
|
5
|
+
{%- if item.id -%}
|
|
6
|
+
{%- set id = item.id -%}
|
|
7
|
+
{%- else -%}
|
|
8
|
+
{#- The first id should not have a number suffix so it's easy to link to from the error summary component -#}
|
|
9
|
+
{%- if loop.first -%}
|
|
10
|
+
{%- set id = idPrefix %}
|
|
11
|
+
{%- else -%}
|
|
12
|
+
{%- set id = idPrefix + "-" + loop.index0 -%}
|
|
13
|
+
{%- endif -%}
|
|
14
|
+
{%- endif -%}
|
|
15
|
+
{%- if item.open -%}
|
|
16
|
+
{%- set conditionalValue = id -%}
|
|
17
|
+
{%- endif -%}
|
|
18
|
+
{% endif %}
|
|
19
|
+
{% endfor %}
|
|
20
|
+
|
|
21
|
+
{#- This solution must be redone well because it has bugs:
|
|
22
|
+
1. If there are multiple opened items at init, it will only open the last one. It should open all of them marked as open.
|
|
23
|
+
2. If there are one item opened at init and allowToggle=true, the button text ('Mostrar/Ocultar') only shows 'Ocultar' without changing to 'Mostrar'. It should change to 'Mostrar' when closed.
|
|
24
|
+
-#}
|
|
25
|
+
<!-- accordion-history -->
|
|
26
|
+
<div
|
|
27
|
+
x-ref="accordion"
|
|
28
|
+
x-data="{
|
|
29
|
+
showAll: true,
|
|
30
|
+
buttonText: 'Mostrar todo',
|
|
31
|
+
toggleShow: function(){
|
|
32
|
+
var buttons = this.$refs.accordion.querySelectorAll('.Accordion-trigger');
|
|
33
|
+
buttons.forEach((button) => {
|
|
34
|
+
if(this.showAll == true){
|
|
35
|
+
if(button.getAttribute('aria-expanded') == 'false'){
|
|
36
|
+
button.click();
|
|
37
|
+
}
|
|
38
|
+
} else {
|
|
39
|
+
if(button.getAttribute('aria-expanded') == 'true'){
|
|
40
|
+
button.click();
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
this.showAll = !this.showAll;
|
|
45
|
+
if(this.showAll) {
|
|
46
|
+
this.buttonText = 'Mostrar todo';
|
|
47
|
+
} else {
|
|
48
|
+
this.buttonText = 'Ocultar todo';
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}"
|
|
52
|
+
{%- if params.classes %} class="{{ params.classes }}"{% endif %}
|
|
53
|
+
{%- for attribute, value in params.attributes %} {{attribute}}="{{value}}"{% endfor %}>
|
|
54
|
+
<div class="flex justify-between">
|
|
55
|
+
{% if params.heading.html or params.heading.text %}
|
|
56
|
+
{% set headingAttributes %}class="{% if params.heading.classes %}{{ params.heading.classes }}{% else %}c-h2 mb-base{% endif %}"{% endset %}
|
|
57
|
+
{% set headingContent %}{{ params.heading.html | safe if params.heading.html else params.heading.text }}{% endset %}
|
|
58
|
+
{% if params.headingLevel == "1" %}
|
|
59
|
+
<h1 {{ headingAttributes | safe }}>{{ headingContent | safe }}</h1>
|
|
60
|
+
{% elseif params.headingLevel == "2" %}
|
|
61
|
+
<h2 {{ headingAttributes | safe }}>{{ headingContent | safe }}</h2>
|
|
62
|
+
{% elseif params.headingLevel == "3" %}
|
|
63
|
+
<h3 {{ headingAttributes | safe }}>{{ headingContent | safe }}</h3>
|
|
64
|
+
{% elseif params.headingLevel == "4" %}
|
|
65
|
+
<h4 {{ headingAttributes | safe }}>{{ headingContent | safe }}</h4>
|
|
66
|
+
{% elseif params.headingLevel == "5" %}
|
|
67
|
+
<h5 {{ headingAttributes | safe }}>{{ headingContent | safe }}</h5>
|
|
68
|
+
{% else %}
|
|
69
|
+
<h2 {{ headingAttributes | safe }}>{{ headingContent | safe }}</h2>
|
|
70
|
+
{% endif %}
|
|
71
|
+
{% endif %}
|
|
72
|
+
{% if params.showControl %}
|
|
73
|
+
<button
|
|
74
|
+
x-ref="button"
|
|
75
|
+
@click="toggleShow"
|
|
76
|
+
x-text="buttonText"
|
|
77
|
+
class="ml-auto py-base text-sm text-neutral-dark underline focus:text-black focus:bg-warning-base focus:outline-none focus:shadow-outline-focus">
|
|
78
|
+
Mostrar todo
|
|
79
|
+
</button>
|
|
80
|
+
{% endif %}
|
|
81
|
+
</div>
|
|
82
|
+
<div class="Accordion pl-lg" {%- if params.allowToggle == true %} data-allow-toggle{% endif %} {%- if params.allowMultiple == true %} data-allow-multiple{% endif %}>
|
|
83
|
+
{% for item in params.items %}
|
|
84
|
+
{% if item %}
|
|
85
|
+
{%- if item.id -%}
|
|
86
|
+
{%- set id = item.id -%}
|
|
87
|
+
{%- else -%}
|
|
88
|
+
{#- The first id should not have a number suffix so it's easy to link to from the error summary component -#}
|
|
89
|
+
{%- if loop.first -%}
|
|
90
|
+
{%- set id = idPrefix %}
|
|
91
|
+
{%- else -%}
|
|
92
|
+
{%- set id = idPrefix + "-" + loop.index0 -%}
|
|
93
|
+
{%- endif -%}
|
|
94
|
+
{%- endif -%}
|
|
95
|
+
|
|
96
|
+
<div class="relative -my-px px-xs py-sm border-t border-b border-neutral-base">
|
|
97
|
+
{% set insideContent %}
|
|
98
|
+
<button
|
|
99
|
+
id="{{ id }}-title"
|
|
100
|
+
class="Accordion-trigger group relative w-full py-sm font-semibold text-left cursor-pointer focus:bg-warning-base focus:outline-none focus:shadow-outline-focus focus:text-black {%- if item.disabled %} cursor-not-allowed{% endif %}"
|
|
101
|
+
aria-controls="{{ id }}"
|
|
102
|
+
{% if item.open %}
|
|
103
|
+
aria-expanded = "true"
|
|
104
|
+
{% else %}
|
|
105
|
+
aria-expanded = "false"
|
|
106
|
+
{% endif %}
|
|
107
|
+
{% if item.disabled %} disabled{% endif %}
|
|
108
|
+
>
|
|
109
|
+
{{ item.headerHtml | safe if item.headerHtml else item.headerText }}
|
|
110
|
+
<span
|
|
111
|
+
class="absolute inset-y-0 right-0 py-sm font-normal text-sm text-neutral-dark underline group-focus:text-black pointer-events-none {%- if item.disabled %} hidden{% endif %}" aria-hidden="true">
|
|
112
|
+
<span class="Accordion-show {%- if item.open %} hidden{%else%}{%endif%} {%- if item.show.classes %} {{ item.show.classes }}{%endif%}">
|
|
113
|
+
{% if item.show %}
|
|
114
|
+
{{ item.show.html | safe if item.show.html else item.show.text }}
|
|
115
|
+
{% else %}
|
|
116
|
+
Mostrar
|
|
117
|
+
{% endif %}
|
|
118
|
+
</span>
|
|
119
|
+
<span class="Accordion-hide {%- if item.open %}{%else%} hidden{%endif%} {%- if item.hide.classes %} {{ item.hide.classes }}{%endif%}">
|
|
120
|
+
{% if item.hide %}
|
|
121
|
+
{{ item.hide.html | safe if item.hide.html else item.hide.text }}
|
|
122
|
+
{% else %}
|
|
123
|
+
Ocultar
|
|
124
|
+
{% endif %}
|
|
125
|
+
</span>
|
|
126
|
+
</span>
|
|
127
|
+
</button>
|
|
128
|
+
{% endset %}
|
|
129
|
+
{% if params.headingLevel == "1" %}
|
|
130
|
+
<h2>{{ insideContent | safe }}</h2>
|
|
131
|
+
{% elseif params.headingLevel == "2" %}
|
|
132
|
+
<h3>{{ insideContent | safe }}</h3>
|
|
133
|
+
{% elseif params.headingLevel == "3" %}
|
|
134
|
+
<h4>{{ insideContent | safe }}</h4>
|
|
135
|
+
{% elseif params.headingLevel == "4" %}
|
|
136
|
+
<h5>{{ insideContent | safe }}</h5>
|
|
137
|
+
{% elseif params.headingLevel == "5" %}
|
|
138
|
+
<h6>{{ insideContent | safe }}</h6>
|
|
139
|
+
{% else %}
|
|
140
|
+
<h3>{{ insideContent | safe }}</h3>
|
|
141
|
+
{% endif %}
|
|
142
|
+
<p class="sr-only" aria-hidden="true">Haz click en el botón anterior para mostrar u ocultar</p>
|
|
143
|
+
{% if not loop.first %}
|
|
144
|
+
{% if item.status == 'current' %}
|
|
145
|
+
<div class="absolute -top-px -left-5 h-6 border-2 border-primary-base"></div>
|
|
146
|
+
{% elseif item.status == 'pending' %}
|
|
147
|
+
<div class="absolute -top-px -left-5 h-6 border-2 border-neutral-light"></div>
|
|
148
|
+
{% elseif item.status == 'muted' %}
|
|
149
|
+
<div class="absolute -top-px -left-5 h-6 border-2 border-neutral-base"></div>
|
|
150
|
+
{% elseif item.status == 'currentmuted' %}
|
|
151
|
+
<div class="absolute -top-px -left-5 h-6 border-2 border-neutral-base"></div>
|
|
152
|
+
{% else %}
|
|
153
|
+
<div class="absolute -top-px -left-5 h-6 border-2 border-primary-base"></div>
|
|
154
|
+
{% endif %}
|
|
155
|
+
{% endif %}
|
|
156
|
+
{% if not loop.last %}
|
|
157
|
+
{% if item.status == 'current' %}
|
|
158
|
+
<div class="absolute top-6 bottom-0 -left-5 border-2 border-neutral-light"></div>
|
|
159
|
+
{% elseif item.status == 'pending' %}
|
|
160
|
+
<div class="absolute top-6 bottom-0 -left-5 border-2 border-neutral-light"></div>
|
|
161
|
+
{% elseif item.status == 'muted' %}
|
|
162
|
+
<div class="absolute top-6 bottom-0 -left-5 border-2 border-neutral-base"></div>
|
|
163
|
+
{% elseif item.status == 'currentmuted' %}
|
|
164
|
+
<div class="absolute top-6 bottom-0 -left-5 border-2 border-neutral-light"></div>
|
|
165
|
+
{% else %}
|
|
166
|
+
<div class="absolute top-6 bottom-0 -left-5 border-2 border-primary-base"></div>
|
|
167
|
+
{% endif %}
|
|
168
|
+
{% endif %}
|
|
169
|
+
{% if item.status == 'current' %}
|
|
170
|
+
<div class="absolute top-5 -left-6 w-3 h-3 bg-white ring-2 ring-primary-base rounded-full" role="img"><p class="sr-only">Estado: actual</p></div>
|
|
171
|
+
{% elseif item.status == 'pending' %}
|
|
172
|
+
<div class="absolute top-5 -left-6 w-3 h-3 bg-white border-2 border-neutral-base rounded-full" role="img"><p class="sr-only">Estado: pendiente</p></div>
|
|
173
|
+
{% elseif item.status == 'muted' %}
|
|
174
|
+
<div class="absolute top-5 -left-6 w-3 h-3 bg-neutral-base border-2 border-neutral-base rounded-full" role="img"><p class="sr-only">Estado: pasado</p></div>
|
|
175
|
+
{% elseif item.status == 'currentmuted' %}
|
|
176
|
+
<div class="absolute top-5 -left-6 w-3 h-3 bg-neutral-base ring-2 ring-neutral-base rounded-full" role="img"><p class="sr-only">Estado: actual</p></div>
|
|
177
|
+
{% else %}
|
|
178
|
+
<div class="absolute top-5 -left-6 w-3 h-3 bg-primary-base border-2 border-primary-base rounded-full" role="img"><p class="sr-only">Estado: pasado</p></div>
|
|
179
|
+
{% endif %}
|
|
180
|
+
<div
|
|
181
|
+
{% if not item.open %}
|
|
182
|
+
hidden = ""
|
|
183
|
+
{% endif %}
|
|
184
|
+
{%- if id %}
|
|
185
|
+
id="{{ id }}"
|
|
186
|
+
{% endif %}
|
|
187
|
+
class="Accordion-panel relative {%- if item.classes %} {{ item.classes }}{% endif %}"
|
|
188
|
+
{%- for attribute, value in item.attributes %} {{attribute}}="{{value}}"{% endfor %}>
|
|
189
|
+
{% if not loop.last %}
|
|
190
|
+
{% if item.status == 'current' %}
|
|
191
|
+
<div class="absolute top-4 bottom-0 -left-6 -my-sm border-2 border-neutral-light"></div>
|
|
192
|
+
{% elseif item.status == 'pending' %}
|
|
193
|
+
<div class="absolute top-4 bottom-0 -left-6 -my-sm border-2 border-neutral-light"></div>
|
|
194
|
+
{% elseif item.status == 'muted' %}
|
|
195
|
+
<div class="absolute top-4 bottom-0 -left-6 -my-sm border-2 border-neutral-base"></div>
|
|
196
|
+
{% elseif item.status == 'currentmuted' %}
|
|
197
|
+
<div class="absolute top-4 bottom-0 -left-6 -my-sm border-2 border-neutral-light"></div>
|
|
198
|
+
{% else %}
|
|
199
|
+
<div class="absolute top-4 bottom-0 -left-6 -my-sm border-2 border-primary-base"></div>
|
|
200
|
+
{% endif %}
|
|
201
|
+
{% endif %}
|
|
202
|
+
{{ item.html | safe if item.html else item.text }}
|
|
203
|
+
</div>
|
|
204
|
+
</div>
|
|
205
|
+
{% endif %}
|
|
206
|
+
{% endfor %}
|
|
207
|
+
</div>
|
|
208
|
+
</div>
|
|
209
|
+
<!-- /accordion-history -->
|