@italia/dropdown 0.1.0-alpha.2
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/AUTHORS +3 -0
- package/LICENSE +18 -0
- package/README.md +26 -0
- package/custom-elements.json +745 -0
- package/dist/src/index.d.ts +3 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +8 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/it-dropdown-item.d.ts +18 -0
- package/dist/src/it-dropdown-item.d.ts.map +1 -0
- package/dist/src/it-dropdown-item.js +763 -0
- package/dist/src/it-dropdown-item.js.map +1 -0
- package/dist/src/it-dropdown.d.ts +42 -0
- package/dist/src/it-dropdown.d.ts.map +1 -0
- package/dist/src/it-dropdown.js +1015 -0
- package/dist/src/it-dropdown.js.map +1 -0
- package/package.json +72 -0
- package/styles/globals.scss +15 -0
|
@@ -0,0 +1,745 @@
|
|
|
1
|
+
{
|
|
2
|
+
"schemaVersion": "1.0.0",
|
|
3
|
+
"readme": "",
|
|
4
|
+
"modules": [
|
|
5
|
+
{
|
|
6
|
+
"kind": "javascript-module",
|
|
7
|
+
"path": "src/index.ts",
|
|
8
|
+
"declarations": [],
|
|
9
|
+
"exports": [
|
|
10
|
+
{
|
|
11
|
+
"kind": "js",
|
|
12
|
+
"name": "ItDropdown",
|
|
13
|
+
"declaration": {
|
|
14
|
+
"name": "ItDropdown",
|
|
15
|
+
"module": "./it-dropdown.js"
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
"kind": "js",
|
|
20
|
+
"name": "ItDropdownItem",
|
|
21
|
+
"declaration": {
|
|
22
|
+
"name": "ItDropdownItem",
|
|
23
|
+
"module": "./it-dropdown-item.js"
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
]
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
"kind": "javascript-module",
|
|
30
|
+
"path": "src/it-dropdown-item.ts",
|
|
31
|
+
"declarations": [
|
|
32
|
+
{
|
|
33
|
+
"kind": "class",
|
|
34
|
+
"description": "",
|
|
35
|
+
"name": "ItDropdownItem",
|
|
36
|
+
"members": [
|
|
37
|
+
{
|
|
38
|
+
"kind": "field",
|
|
39
|
+
"name": "label",
|
|
40
|
+
"type": {
|
|
41
|
+
"text": "string"
|
|
42
|
+
},
|
|
43
|
+
"default": "''",
|
|
44
|
+
"attribute": "label"
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
"kind": "field",
|
|
48
|
+
"name": "value",
|
|
49
|
+
"type": {
|
|
50
|
+
"text": "string"
|
|
51
|
+
},
|
|
52
|
+
"default": "''",
|
|
53
|
+
"attribute": "value"
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
"kind": "field",
|
|
57
|
+
"name": "href",
|
|
58
|
+
"type": {
|
|
59
|
+
"text": "string | undefined"
|
|
60
|
+
},
|
|
61
|
+
"attribute": "href"
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
"kind": "field",
|
|
65
|
+
"name": "active",
|
|
66
|
+
"type": {
|
|
67
|
+
"text": "boolean"
|
|
68
|
+
},
|
|
69
|
+
"default": "false",
|
|
70
|
+
"attribute": "active",
|
|
71
|
+
"reflects": true
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
"kind": "field",
|
|
75
|
+
"name": "large",
|
|
76
|
+
"type": {
|
|
77
|
+
"text": "boolean"
|
|
78
|
+
},
|
|
79
|
+
"default": "false",
|
|
80
|
+
"attribute": "large",
|
|
81
|
+
"reflects": true
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
"kind": "field",
|
|
85
|
+
"name": "separator",
|
|
86
|
+
"type": {
|
|
87
|
+
"text": "boolean"
|
|
88
|
+
},
|
|
89
|
+
"default": "false",
|
|
90
|
+
"attribute": "separator",
|
|
91
|
+
"reflects": true
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
"kind": "field",
|
|
95
|
+
"name": "dark",
|
|
96
|
+
"type": {
|
|
97
|
+
"text": "boolean"
|
|
98
|
+
},
|
|
99
|
+
"default": "false",
|
|
100
|
+
"attribute": "dark",
|
|
101
|
+
"reflects": true
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
"kind": "field",
|
|
105
|
+
"name": "fullWidth",
|
|
106
|
+
"type": {
|
|
107
|
+
"text": "boolean"
|
|
108
|
+
},
|
|
109
|
+
"default": "false",
|
|
110
|
+
"attribute": "full-width",
|
|
111
|
+
"reflects": true
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
"kind": "field",
|
|
115
|
+
"name": "itRole",
|
|
116
|
+
"type": {
|
|
117
|
+
"text": "string | undefined"
|
|
118
|
+
},
|
|
119
|
+
"attribute": "it-role"
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
"kind": "field",
|
|
123
|
+
"name": "disabled",
|
|
124
|
+
"type": {
|
|
125
|
+
"text": "boolean | undefined"
|
|
126
|
+
},
|
|
127
|
+
"attribute": "disabled",
|
|
128
|
+
"reflects": true
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
"kind": "method",
|
|
132
|
+
"name": "getFocusableElement",
|
|
133
|
+
"privacy": "public",
|
|
134
|
+
"return": {
|
|
135
|
+
"type": {
|
|
136
|
+
"text": "HTMLElement | null"
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
"kind": "method",
|
|
142
|
+
"name": "handlePress",
|
|
143
|
+
"parameters": [
|
|
144
|
+
{
|
|
145
|
+
"name": "event",
|
|
146
|
+
"type": {
|
|
147
|
+
"text": "KeyboardEvent | MouseEvent"
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
]
|
|
151
|
+
}
|
|
152
|
+
],
|
|
153
|
+
"attributes": [
|
|
154
|
+
{
|
|
155
|
+
"name": "label",
|
|
156
|
+
"type": {
|
|
157
|
+
"text": "string"
|
|
158
|
+
},
|
|
159
|
+
"default": "''",
|
|
160
|
+
"fieldName": "label"
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
"name": "value",
|
|
164
|
+
"type": {
|
|
165
|
+
"text": "string"
|
|
166
|
+
},
|
|
167
|
+
"default": "''",
|
|
168
|
+
"fieldName": "value"
|
|
169
|
+
},
|
|
170
|
+
{
|
|
171
|
+
"name": "href",
|
|
172
|
+
"type": {
|
|
173
|
+
"text": "string | undefined"
|
|
174
|
+
},
|
|
175
|
+
"fieldName": "href"
|
|
176
|
+
},
|
|
177
|
+
{
|
|
178
|
+
"name": "active",
|
|
179
|
+
"type": {
|
|
180
|
+
"text": "boolean"
|
|
181
|
+
},
|
|
182
|
+
"default": "false",
|
|
183
|
+
"fieldName": "active"
|
|
184
|
+
},
|
|
185
|
+
{
|
|
186
|
+
"name": "large",
|
|
187
|
+
"type": {
|
|
188
|
+
"text": "boolean"
|
|
189
|
+
},
|
|
190
|
+
"default": "false",
|
|
191
|
+
"fieldName": "large"
|
|
192
|
+
},
|
|
193
|
+
{
|
|
194
|
+
"name": "separator",
|
|
195
|
+
"type": {
|
|
196
|
+
"text": "boolean"
|
|
197
|
+
},
|
|
198
|
+
"default": "false",
|
|
199
|
+
"fieldName": "separator"
|
|
200
|
+
},
|
|
201
|
+
{
|
|
202
|
+
"name": "dark",
|
|
203
|
+
"type": {
|
|
204
|
+
"text": "boolean"
|
|
205
|
+
},
|
|
206
|
+
"default": "false",
|
|
207
|
+
"fieldName": "dark"
|
|
208
|
+
},
|
|
209
|
+
{
|
|
210
|
+
"name": "full-width",
|
|
211
|
+
"type": {
|
|
212
|
+
"text": "boolean"
|
|
213
|
+
},
|
|
214
|
+
"default": "false",
|
|
215
|
+
"fieldName": "fullWidth"
|
|
216
|
+
},
|
|
217
|
+
{
|
|
218
|
+
"name": "it-role",
|
|
219
|
+
"type": {
|
|
220
|
+
"text": "string | undefined"
|
|
221
|
+
},
|
|
222
|
+
"fieldName": "itRole"
|
|
223
|
+
},
|
|
224
|
+
{
|
|
225
|
+
"name": "disabled",
|
|
226
|
+
"type": {
|
|
227
|
+
"text": "boolean | undefined"
|
|
228
|
+
},
|
|
229
|
+
"fieldName": "disabled"
|
|
230
|
+
}
|
|
231
|
+
],
|
|
232
|
+
"superclass": {
|
|
233
|
+
"name": "BaseComponent",
|
|
234
|
+
"package": "@italia/globals"
|
|
235
|
+
},
|
|
236
|
+
"tagName": "it-dropdown-item",
|
|
237
|
+
"customElement": true
|
|
238
|
+
}
|
|
239
|
+
],
|
|
240
|
+
"exports": [
|
|
241
|
+
{
|
|
242
|
+
"kind": "js",
|
|
243
|
+
"name": "ItDropdownItem",
|
|
244
|
+
"declaration": {
|
|
245
|
+
"name": "ItDropdownItem",
|
|
246
|
+
"module": "src/it-dropdown-item.ts"
|
|
247
|
+
}
|
|
248
|
+
},
|
|
249
|
+
{
|
|
250
|
+
"kind": "custom-element-definition",
|
|
251
|
+
"name": "it-dropdown-item",
|
|
252
|
+
"declaration": {
|
|
253
|
+
"name": "ItDropdownItem",
|
|
254
|
+
"module": "src/it-dropdown-item.ts"
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
]
|
|
258
|
+
},
|
|
259
|
+
{
|
|
260
|
+
"kind": "javascript-module",
|
|
261
|
+
"path": "src/it-dropdown.ts",
|
|
262
|
+
"declarations": [
|
|
263
|
+
{
|
|
264
|
+
"kind": "class",
|
|
265
|
+
"description": "",
|
|
266
|
+
"name": "ItDropdown",
|
|
267
|
+
"members": [
|
|
268
|
+
{
|
|
269
|
+
"kind": "field",
|
|
270
|
+
"name": "shadowRootOptions",
|
|
271
|
+
"type": {
|
|
272
|
+
"text": "object"
|
|
273
|
+
},
|
|
274
|
+
"static": true,
|
|
275
|
+
"default": "{ ...LitElement.shadowRootOptions, delegatesFocus: true, }"
|
|
276
|
+
},
|
|
277
|
+
{
|
|
278
|
+
"kind": "field",
|
|
279
|
+
"name": "label",
|
|
280
|
+
"type": {
|
|
281
|
+
"text": "string | undefined"
|
|
282
|
+
},
|
|
283
|
+
"attribute": "label"
|
|
284
|
+
},
|
|
285
|
+
{
|
|
286
|
+
"kind": "field",
|
|
287
|
+
"name": "disabled",
|
|
288
|
+
"type": {
|
|
289
|
+
"text": "boolean"
|
|
290
|
+
},
|
|
291
|
+
"default": "false",
|
|
292
|
+
"attribute": "disabled",
|
|
293
|
+
"reflects": true
|
|
294
|
+
},
|
|
295
|
+
{
|
|
296
|
+
"kind": "field",
|
|
297
|
+
"name": "size",
|
|
298
|
+
"type": {
|
|
299
|
+
"text": "Size | undefined"
|
|
300
|
+
},
|
|
301
|
+
"attribute": "size"
|
|
302
|
+
},
|
|
303
|
+
{
|
|
304
|
+
"kind": "field",
|
|
305
|
+
"name": "variant",
|
|
306
|
+
"type": {
|
|
307
|
+
"text": "Variant | undefined"
|
|
308
|
+
},
|
|
309
|
+
"default": "'primary'",
|
|
310
|
+
"attribute": "variant"
|
|
311
|
+
},
|
|
312
|
+
{
|
|
313
|
+
"kind": "field",
|
|
314
|
+
"name": "alignment",
|
|
315
|
+
"type": {
|
|
316
|
+
"text": "string"
|
|
317
|
+
},
|
|
318
|
+
"default": "'bottom-start'",
|
|
319
|
+
"attribute": "alignment"
|
|
320
|
+
},
|
|
321
|
+
{
|
|
322
|
+
"kind": "field",
|
|
323
|
+
"name": "dark",
|
|
324
|
+
"type": {
|
|
325
|
+
"text": "boolean"
|
|
326
|
+
},
|
|
327
|
+
"default": "false",
|
|
328
|
+
"attribute": "dark"
|
|
329
|
+
},
|
|
330
|
+
{
|
|
331
|
+
"kind": "field",
|
|
332
|
+
"name": "fullWidth",
|
|
333
|
+
"type": {
|
|
334
|
+
"text": "boolean"
|
|
335
|
+
},
|
|
336
|
+
"default": "false",
|
|
337
|
+
"attribute": "full-width",
|
|
338
|
+
"reflects": true
|
|
339
|
+
},
|
|
340
|
+
{
|
|
341
|
+
"kind": "field",
|
|
342
|
+
"name": "itRole",
|
|
343
|
+
"type": {
|
|
344
|
+
"text": "string"
|
|
345
|
+
},
|
|
346
|
+
"default": "'menu'",
|
|
347
|
+
"attribute": "it-role"
|
|
348
|
+
},
|
|
349
|
+
{
|
|
350
|
+
"kind": "field",
|
|
351
|
+
"name": "itAriaLabel",
|
|
352
|
+
"type": {
|
|
353
|
+
"text": "string"
|
|
354
|
+
},
|
|
355
|
+
"default": "''",
|
|
356
|
+
"attribute": "it-aria-label"
|
|
357
|
+
},
|
|
358
|
+
{
|
|
359
|
+
"kind": "field",
|
|
360
|
+
"name": "_popoverOpen",
|
|
361
|
+
"type": {
|
|
362
|
+
"text": "boolean"
|
|
363
|
+
},
|
|
364
|
+
"privacy": "private",
|
|
365
|
+
"default": "false"
|
|
366
|
+
},
|
|
367
|
+
{
|
|
368
|
+
"kind": "field",
|
|
369
|
+
"name": "_buttonId",
|
|
370
|
+
"privacy": "private"
|
|
371
|
+
},
|
|
372
|
+
{
|
|
373
|
+
"kind": "field",
|
|
374
|
+
"name": "_menuId",
|
|
375
|
+
"privacy": "private"
|
|
376
|
+
},
|
|
377
|
+
{
|
|
378
|
+
"kind": "field",
|
|
379
|
+
"name": "_slotEl",
|
|
380
|
+
"type": {
|
|
381
|
+
"text": "HTMLSlotElement"
|
|
382
|
+
},
|
|
383
|
+
"privacy": "private"
|
|
384
|
+
},
|
|
385
|
+
{
|
|
386
|
+
"kind": "field",
|
|
387
|
+
"name": "_ariaNav",
|
|
388
|
+
"privacy": "private",
|
|
389
|
+
"default": "new AriaKeyboardListController(this)"
|
|
390
|
+
},
|
|
391
|
+
{
|
|
392
|
+
"kind": "field",
|
|
393
|
+
"name": "_triggerEl",
|
|
394
|
+
"type": {
|
|
395
|
+
"text": "HTMLElement | null"
|
|
396
|
+
},
|
|
397
|
+
"privacy": "private",
|
|
398
|
+
"readonly": true
|
|
399
|
+
},
|
|
400
|
+
{
|
|
401
|
+
"kind": "field",
|
|
402
|
+
"name": "_onTriggerClick",
|
|
403
|
+
"privacy": "private"
|
|
404
|
+
},
|
|
405
|
+
{
|
|
406
|
+
"kind": "field",
|
|
407
|
+
"name": "_onPopoverOpen",
|
|
408
|
+
"privacy": "private"
|
|
409
|
+
},
|
|
410
|
+
{
|
|
411
|
+
"kind": "field",
|
|
412
|
+
"name": "_onPopoverClose",
|
|
413
|
+
"privacy": "private"
|
|
414
|
+
},
|
|
415
|
+
{
|
|
416
|
+
"kind": "field",
|
|
417
|
+
"name": "_menuItems",
|
|
418
|
+
"privacy": "private",
|
|
419
|
+
"readonly": true
|
|
420
|
+
},
|
|
421
|
+
{
|
|
422
|
+
"kind": "method",
|
|
423
|
+
"name": "_setChildrenProperties",
|
|
424
|
+
"privacy": "private"
|
|
425
|
+
},
|
|
426
|
+
{
|
|
427
|
+
"kind": "field",
|
|
428
|
+
"name": "_onKeyDown",
|
|
429
|
+
"privacy": "private"
|
|
430
|
+
}
|
|
431
|
+
],
|
|
432
|
+
"attributes": [
|
|
433
|
+
{
|
|
434
|
+
"name": "label",
|
|
435
|
+
"type": {
|
|
436
|
+
"text": "string | undefined"
|
|
437
|
+
},
|
|
438
|
+
"fieldName": "label"
|
|
439
|
+
},
|
|
440
|
+
{
|
|
441
|
+
"name": "disabled",
|
|
442
|
+
"type": {
|
|
443
|
+
"text": "boolean"
|
|
444
|
+
},
|
|
445
|
+
"default": "false",
|
|
446
|
+
"fieldName": "disabled"
|
|
447
|
+
},
|
|
448
|
+
{
|
|
449
|
+
"name": "size",
|
|
450
|
+
"type": {
|
|
451
|
+
"text": "Size | undefined"
|
|
452
|
+
},
|
|
453
|
+
"fieldName": "size"
|
|
454
|
+
},
|
|
455
|
+
{
|
|
456
|
+
"name": "variant",
|
|
457
|
+
"type": {
|
|
458
|
+
"text": "Variant | undefined"
|
|
459
|
+
},
|
|
460
|
+
"default": "'primary'",
|
|
461
|
+
"fieldName": "variant"
|
|
462
|
+
},
|
|
463
|
+
{
|
|
464
|
+
"name": "alignment",
|
|
465
|
+
"type": {
|
|
466
|
+
"text": "string"
|
|
467
|
+
},
|
|
468
|
+
"default": "'bottom-start'",
|
|
469
|
+
"fieldName": "alignment"
|
|
470
|
+
},
|
|
471
|
+
{
|
|
472
|
+
"name": "dark",
|
|
473
|
+
"type": {
|
|
474
|
+
"text": "boolean"
|
|
475
|
+
},
|
|
476
|
+
"default": "false",
|
|
477
|
+
"fieldName": "dark"
|
|
478
|
+
},
|
|
479
|
+
{
|
|
480
|
+
"name": "full-width",
|
|
481
|
+
"type": {
|
|
482
|
+
"text": "boolean"
|
|
483
|
+
},
|
|
484
|
+
"default": "false",
|
|
485
|
+
"fieldName": "fullWidth"
|
|
486
|
+
},
|
|
487
|
+
{
|
|
488
|
+
"name": "it-role",
|
|
489
|
+
"type": {
|
|
490
|
+
"text": "string"
|
|
491
|
+
},
|
|
492
|
+
"default": "'menu'",
|
|
493
|
+
"fieldName": "itRole"
|
|
494
|
+
},
|
|
495
|
+
{
|
|
496
|
+
"name": "it-aria-label",
|
|
497
|
+
"type": {
|
|
498
|
+
"text": "string"
|
|
499
|
+
},
|
|
500
|
+
"default": "''",
|
|
501
|
+
"fieldName": "itAriaLabel"
|
|
502
|
+
}
|
|
503
|
+
],
|
|
504
|
+
"superclass": {
|
|
505
|
+
"name": "BaseComponent",
|
|
506
|
+
"package": "@italia/globals"
|
|
507
|
+
},
|
|
508
|
+
"tagName": "it-dropdown",
|
|
509
|
+
"customElement": true
|
|
510
|
+
}
|
|
511
|
+
],
|
|
512
|
+
"exports": [
|
|
513
|
+
{
|
|
514
|
+
"kind": "js",
|
|
515
|
+
"name": "ItDropdown",
|
|
516
|
+
"declaration": {
|
|
517
|
+
"name": "ItDropdown",
|
|
518
|
+
"module": "src/it-dropdown.ts"
|
|
519
|
+
}
|
|
520
|
+
},
|
|
521
|
+
{
|
|
522
|
+
"kind": "custom-element-definition",
|
|
523
|
+
"name": "it-dropdown",
|
|
524
|
+
"declaration": {
|
|
525
|
+
"name": "ItDropdown",
|
|
526
|
+
"module": "src/it-dropdown.ts"
|
|
527
|
+
}
|
|
528
|
+
}
|
|
529
|
+
]
|
|
530
|
+
},
|
|
531
|
+
{
|
|
532
|
+
"kind": "javascript-module",
|
|
533
|
+
"path": "stories/it-dropdown.stories.ts",
|
|
534
|
+
"declarations": [
|
|
535
|
+
{
|
|
536
|
+
"kind": "variable",
|
|
537
|
+
"name": "meta",
|
|
538
|
+
"default": "{ title: 'Componenti/Dropdown', component: 'it-dropdown', tags: ['autodocs'], args: { label: 'Apri dropdown', disabled: false, alignment: undefined, variant: 'primary', size: undefined, 'it-role': undefined, dark: false, 'full-width': false, }, argTypes: { label: { control: 'text' }, disabled: { control: 'boolean' }, alignment: { control: 'select', options: [ 'top', 'right', 'bottom', 'left', 'top-start', 'top-end', 'right-start', 'right-end', 'bottom-start', 'bottom-end', 'left-start', 'left-end', ], }, variant: { control: 'select', options: ['primary', 'secondary', 'success', 'danger', 'warning', 'light', 'link'], }, size: { control: 'select', options: ['sm', 'lg'], }, 'it-role': { control: 'select', options: ['menu', 'list'], }, dark: { control: 'boolean' }, 'full-width': { control: 'boolean' }, }, decorators: [(Story) => html`<div style=${containerStyle}>${Story()}</div>`], parameters: { docs: { description: { component: ` <Description>Attiva o disattiva overlay contestuali per visualizzare liste di link ed altro ancora con questi menu a tendina.</Description> Per la creazione di un dropdown è necessario utilizzare il componente \\`<it-dropdown>\\` che può contenere al suo interno uno o più \\`<it-dropdown-item>\\`. È necessario specificare l'etichetta del menu tramite l'attributo \\`label\\`. È possibile specificare una variante tramite l'attributo \\`variant\\`, questa verrà applicata al pulsante di attivazione del menu. <div class=\"callout callout-success\"><div class=\"callout-inner\"><div class=\"callout-title\"><span class=\"text\">Accessibilità</span></div> <p>Lo standard <a href=\"https://www.w3.org/TR/wai-aria/\">WAI ARIA</a> definisce un widget con proprietà <a href=\"https://www.w3.org/TR/wai-aria/#menu\">\\`role=\"menu\"\\`</a>, specifica per i menu applicativi con link o azioni. Questi menu possono contenere solo voci di menu, voci di menu di caselle di controllo, voci di menu dei pulsanti di opzione, gruppi di pulsanti di opzione e sottomenu.</p> <p>I dropdown di **Dev Kit Italia** sono progettati per essere invece generici e applicabili a una varietà di situazioni. Per questo motivo, il componente \\`it-dropdown\\` ha come ruolo predefinito il ruolo \\`menu\\` e gestisce automaticamente il ruolo degli elementi interni, ma gli autori potranno modificare il ruolo del Dropdown generato da questo componente ad una semplice lista impostando l'attributo \\`it-role=\"list\"\\`.</p> <p>Questo componente comprende di base il supporto per la maggior parte delle interazioni standard del menu della tastiera, come la possibilità di spostarsi tra i singoli elementi \\`it-dropdown-item\\` usando i tasti freccia, e chiude il menu con il tasto ESC.</p> </div></div> `, }, }, }, } satisfies Meta<DropdownProps>"
|
|
539
|
+
},
|
|
540
|
+
{
|
|
541
|
+
"kind": "variable",
|
|
542
|
+
"name": "Base",
|
|
543
|
+
"type": {
|
|
544
|
+
"text": "Story"
|
|
545
|
+
},
|
|
546
|
+
"default": "{ render: (args) => html` <it-dropdown label=${args.label} ?disabled=${args.disabled} alignment=${ifDefined(args.alignment)} size=${ifDefined(args.size)} variant=${args.variant} it-role=${ifDefined(args['it-role'])} ?dark=${args.dark} ?full-width=${args['full-width']} > <it-dropdown-item href=\"#\">Azione 1</it-dropdown-item> <it-dropdown-item href=\"#\">Azione 2</it-dropdown-item> <it-dropdown-item href=\"#\">Azione 3</it-dropdown-item> </it-dropdown> `, parameters: { ...meta.parameters, docs: { source: { excludeDecorators: true }, canvas: { sourceState: 'shown' }, }, }, tags: ['!autodocs', '!dev'], }"
|
|
547
|
+
},
|
|
548
|
+
{
|
|
549
|
+
"kind": "variable",
|
|
550
|
+
"name": "Varianti",
|
|
551
|
+
"type": {
|
|
552
|
+
"text": "Story"
|
|
553
|
+
},
|
|
554
|
+
"default": "{ name: 'Dropdown button varianti', render: () => html` <it-dropdown label=\"Primario\" variant=\"primary\"> <it-dropdown-item href=\"#\">Azione 1</it-dropdown-item> <it-dropdown-item href=\"#\">Azione 2</it-dropdown-item> <it-dropdown-item href=\"#\">Azione 3</it-dropdown-item> </it-dropdown> <it-dropdown label=\"Secondario\" variant=\"secondary\"> <it-dropdown-item href=\"#\">Azione 1</it-dropdown-item> <it-dropdown-item href=\"#\">Azione 2</it-dropdown-item> <it-dropdown-item href=\"#\">Azione 3</it-dropdown-item> </it-dropdown> <it-dropdown label=\"Success\" variant=\"success\"> <it-dropdown-item href=\"#\">Azione 1</it-dropdown-item> <it-dropdown-item href=\"#\">Azione 2</it-dropdown-item> <it-dropdown-item href=\"#\">Azione 3</it-dropdown-item> </it-dropdown> <it-dropdown label=\"Danger\" variant=\"danger\"> <it-dropdown-item href=\"#\">Azione 1</it-dropdown-item> <it-dropdown-item href=\"#\">Azione 2</it-dropdown-item> <it-dropdown-item href=\"#\">Azione 3</it-dropdown-item> </it-dropdown> `, decorators: [(Story) => html`<div style=\"${containerStyle}gap:0.5rem;flex-wrap:wrap;display:flex\">${Story()}</div>`], argTypes: { ...disabledControls() }, parameters: { ...meta.parameters, docs: { source: { excludeDecorators: true }, description: { story: 'Ovviamente sono disponibili tutte le varianti già disponibili per i pulsanti. Di seguito, un esempio di utilizzo con le varianti `primary`, `secondary`, `success` e `danger`.', }, }, }, }"
|
|
555
|
+
},
|
|
556
|
+
{
|
|
557
|
+
"kind": "variable",
|
|
558
|
+
"name": "Direzioni",
|
|
559
|
+
"type": {
|
|
560
|
+
"text": "Story"
|
|
561
|
+
},
|
|
562
|
+
"default": "{ render: () => html` <it-dropdown label=\"Giù\" alignment=\"bottom-start\"> <it-dropdown-item href=\"#\">Azione 1</it-dropdown-item> <it-dropdown-item href=\"#\">Azione 2</it-dropdown-item> <it-dropdown-item href=\"#\">Azione 3</it-dropdown-item> </it-dropdown> <it-dropdown label=\"Su\" alignment=\"top-start\"> <it-dropdown-item href=\"#\">Azione 1</it-dropdown-item> <it-dropdown-item href=\"#\">Azione 2</it-dropdown-item> <it-dropdown-item href=\"#\">Azione 3</it-dropdown-item> </it-dropdown> <it-dropdown label=\"Sinistra\" alignment=\"left\"> <it-dropdown-item href=\"#\">Azione 1</it-dropdown-item> <it-dropdown-item href=\"#\">Azione 2</it-dropdown-item> <it-dropdown-item href=\"#\">Azione 3</it-dropdown-item> </it-dropdown> <it-dropdown label=\"Destra\" alignment=\"right\"> <it-dropdown-item href=\"#\">Azione 1</it-dropdown-item> <it-dropdown-item href=\"#\">Azione 2</it-dropdown-item> <it-dropdown-item href=\"#\">Azione 3</it-dropdown-item> </it-dropdown> `, decorators: [ (Story) => html`<div style=\"${containerStyle}gap:2rem;flex-wrap:wrap;align-items:space-between;justify-content:center;flex-direction:column;\" > ${Story()} </div>`, ], argTypes: { ...disabledControls() }, parameters: { ...meta.parameters, docs: { source: { excludeDecorators: true }, description: { story: `Per aprire le voci di menu in direzioni diverse, è possibile utilizzare l'attributo \\`alignment\\` con i valori \\`top\\`, \\`right\\`, \\`bottom\\`, \\`left\\`, \\`top-start\\`, \\`top-end\\`, \\`right-start\\`, \\`right-end\\`, \\`bottom-start\\`, \\`bottom-end\\`, \\`left-start\\` e \\`left-end\\`. I valori \\`top\\`, \\`right\\`, \\`bottom\\` e \\`left\\` aprono il menu in direzioni standard, centrate rispetto al trigger, mentre i valori \\`top-start\\`, \\`top-end\\`, \\`right-start\\`, \\`right-end\\`, \\`bottom-start\\`, \\`bottom-end\\`, \\`left-start\\` e \\`left-end\\` permettono di specificare la posizione esatta del menu rispetto al trigger. `, }, }, }, }"
|
|
563
|
+
},
|
|
564
|
+
{
|
|
565
|
+
"kind": "variable",
|
|
566
|
+
"name": "MenuVociAttive",
|
|
567
|
+
"type": {
|
|
568
|
+
"text": "Story"
|
|
569
|
+
},
|
|
570
|
+
"default": "{ name: 'Menu con voci attive', render: (args) => html` <it-dropdown label=${args.label} variant=${args.variant}> <it-dropdown-item href=\"#\" active>Attivo</it-dropdown-item> <it-dropdown-item href=\"#\">Non attivo</it-dropdown-item> <it-dropdown-item href=\"#\">Non attivo</it-dropdown-item> </it-dropdown> `, argTypes: { ...disabledControls(['label', 'variant']) }, parameters: { ...meta.parameters, docs: { source: { excludeDecorators: true }, description: { story: `Aggiungere l'attributo active agli elementi del dropdown che si vogliono mostrare come attivi. Per questioni di accessibilità il componente aggiungerà automaticamente <span class=\"visually-hidden\"> attivo</span> in coda al testo degli elementi attivi.`, }, }, }, }"
|
|
571
|
+
},
|
|
572
|
+
{
|
|
573
|
+
"kind": "variable",
|
|
574
|
+
"name": "MenuDisabilitato",
|
|
575
|
+
"type": {
|
|
576
|
+
"text": "Story"
|
|
577
|
+
},
|
|
578
|
+
"default": "{ name: 'Menu disabilitato', args: { disabled: true }, render: (args) => html` <it-dropdown label=${args.label} ?disabled=${args.disabled} variant=${args.variant}> <it-dropdown-item href=\"#\">Azione 1</it-dropdown-item> <it-dropdown-item href=\"#\">Azione 2</it-dropdown-item> <it-dropdown-item href=\"#\">Azione 3</it-dropdown-item> </it-dropdown> `, argTypes: { ...disabledControls(['label', 'variant']) }, parameters: { ...meta.parameters, docs: { source: { excludeDecorators: true }, description: { story: `Aggiungere l'attributo \\`disabled\\` al dropdown per **disabilitarlo** completamente.`, }, }, }, }"
|
|
579
|
+
},
|
|
580
|
+
{
|
|
581
|
+
"kind": "variable",
|
|
582
|
+
"name": "MenuVociDisabilitate",
|
|
583
|
+
"type": {
|
|
584
|
+
"text": "Story"
|
|
585
|
+
},
|
|
586
|
+
"default": "{ name: 'Menu con voci disabilitate', render: (args) => html` <it-dropdown label=${args.label} variant=${args.variant}> <it-dropdown-item href=\"#\">Azione 1</it-dropdown-item> <it-dropdown-item href=\"#\" disabled>Azione 2</it-dropdown-item> <it-dropdown-item href=\"#\">Azione 3</it-dropdown-item> </it-dropdown> `, argTypes: { ...disabledControls(['label', 'variant']) }, parameters: { ...meta.parameters, docs: { source: { excludeDecorators: true }, description: { story: `Aggiungere l'attributo \\`disabled\\` agli elementi del dropdown che si vogliono mostrare come **disabilitati**.`, }, }, }, }"
|
|
587
|
+
},
|
|
588
|
+
{
|
|
589
|
+
"kind": "variable",
|
|
590
|
+
"name": "MenuIntestazioniSeparatori",
|
|
591
|
+
"type": {
|
|
592
|
+
"text": "Story"
|
|
593
|
+
},
|
|
594
|
+
"default": "{ name: 'Menu con intestazioni e separatori', render: (args) => html` <it-dropdown label=\"Item con separatore e header\" variant=${args.variant}> <h4 slot=\"header\" class=\"link-list-heading dropdown-header\">Intestazione</h4> <it-dropdown-item href=\"#\">Prima voce</it-dropdown-item> <it-dropdown-item separator></it-dropdown-item> <it-dropdown-item href=\"#\">Dopo separatore</it-dropdown-item> </it-dropdown> `, argTypes: { ...disabledControls(['variant']) }, parameters: { ...meta.parameters, docs: { source: { excludeDecorators: true }, description: { story: `All'interno del menu dropdown possono essere inseriti header e separatori.`, }, }, }, }"
|
|
595
|
+
},
|
|
596
|
+
{
|
|
597
|
+
"kind": "variable",
|
|
598
|
+
"name": "MenuVociGrandi",
|
|
599
|
+
"type": {
|
|
600
|
+
"text": "Story"
|
|
601
|
+
},
|
|
602
|
+
"default": "{ name: 'Menu con voci grandi', render: (args) => html` <it-dropdown label=${args.label} variant=${args.variant}> <it-dropdown-item href=\"#\">Azione 1</it-dropdown-item> <it-dropdown-item href=\"#\">Azione 2</it-dropdown-item> <it-dropdown-item href=\"#\" large>Grande</it-dropdown-item> </it-dropdown> `, argTypes: { ...disabledControls(['label', 'variant']) }, parameters: { ...meta.parameters, docs: { source: { excludeDecorators: true }, description: { story: `Per aumentare la dimensione degli elementi contenuti nel dropdown è sufficiente aggiungere agli stessi l'attributo \\`large\\`.`, }, }, }, }"
|
|
603
|
+
},
|
|
604
|
+
{
|
|
605
|
+
"kind": "variable",
|
|
606
|
+
"name": "MenuATuttaLarghezza",
|
|
607
|
+
"type": {
|
|
608
|
+
"text": "Story"
|
|
609
|
+
},
|
|
610
|
+
"default": "{ name: 'Menu a tutta larghezza', args: { 'full-width': true }, render: (args) => html` <it-dropdown label=${args.label} ?disabled=${args.disabled} alignment=${ifDefined(args.alignment)} size=${ifDefined(args.size)} variant=${ifDefined(args.variant)} it-role=${ifDefined(args['it-role'])} ?dark=${args.dark} ?full-width=${args['full-width']} style=\"width: 100%;\" > <it-dropdown-item href=\"#\">Azione 1</it-dropdown-item> <it-dropdown-item href=\"#\">Azione 2</it-dropdown-item> <it-dropdown-item href=\"#\">Azione 3</it-dropdown-item> </it-dropdown> `, decorators: [(Story) => html`<div style=\"${containerStyle}min-width:300px\">${Story()}</div>`], parameters: { ...meta.parameters, docs: { source: { excludeDecorators: true }, description: { story: `Per ottenere un dropdown menu largo quanto l’elemento che contiene il dropdown button è sufficiente aggiungere l'attributo \\`full-width\\`. I link e testi contenuti al suo interno saranno disposti in orizzontale.`, }, }, }, }"
|
|
611
|
+
},
|
|
612
|
+
{
|
|
613
|
+
"kind": "variable",
|
|
614
|
+
"name": "MenuIconaDestra",
|
|
615
|
+
"type": {
|
|
616
|
+
"text": "Story"
|
|
617
|
+
},
|
|
618
|
+
"default": "{ name: 'Menu con icona a destra', render: (args) => html` <it-dropdown label=${args.label} variant=${args.variant}> <it-dropdown-item href=\"#\"> Azione 1 <it-icon slot=\"suffix\" name=\"it-star-outline\" size=\"sm\" color=\"primary\"></it-icon> </it-dropdown-item> <it-dropdown-item href=\"#\"> Azione 2 <it-icon slot=\"suffix\" name=\"it-star-outline\" size=\"sm\" color=\"primary\"></it-icon> </it-dropdown-item> <it-dropdown-item href=\"#\"> Azione 3 <it-icon slot=\"suffix\" name=\"it-star-outline\" size=\"sm\" color=\"primary\"></it-icon> </it-dropdown-item> </it-dropdown> `, argTypes: { ...disabledControls(['label', 'variant']) }, parameters: { ...meta.parameters, docs: { source: { excludeDecorators: true }, description: { story: `Agli elementi contenuti nel menu può essere aggiunta un’icona illustrativa allineata a destra utilizzando lo slot \\`suffix\\``, }, }, }, }"
|
|
619
|
+
},
|
|
620
|
+
{
|
|
621
|
+
"kind": "variable",
|
|
622
|
+
"name": "MenuIconaSinistra",
|
|
623
|
+
"type": {
|
|
624
|
+
"text": "Story"
|
|
625
|
+
},
|
|
626
|
+
"default": "{ name: 'Menu con icona a sinistra', render: (args) => html` <it-dropdown label=${args.label} variant=${args.variant}> <it-dropdown-item href=\"#\"> <it-icon slot=\"prefix\" name=\"it-star-outline\" size=\"sm\" color=\"primary\"></it-icon> Azione 1 </it-dropdown-item> <it-dropdown-item href=\"#\"> <it-icon slot=\"prefix\" name=\"it-star-outline\" size=\"sm\" color=\"primary\"></it-icon> Azione 2 </it-dropdown-item> <it-dropdown-item href=\"#\"> <it-icon slot=\"prefix\" name=\"it-star-outline\" size=\"sm\" color=\"primary\"></it-icon> Azione 3 </it-dropdown-item> </it-dropdown> `, argTypes: { ...disabledControls(['label', 'variant']) }, parameters: { ...meta.parameters, docs: { source: { excludeDecorators: true }, description: { story: `Agli elementi contenuti nel menu può essere aggiunta un’icona illustrativa allineata a sinistra utilizzando lo slot \\`prefix\\``, }, }, }, }"
|
|
627
|
+
},
|
|
628
|
+
{
|
|
629
|
+
"kind": "variable",
|
|
630
|
+
"name": "MenuScuro",
|
|
631
|
+
"type": {
|
|
632
|
+
"text": "Story"
|
|
633
|
+
},
|
|
634
|
+
"default": "{ name: 'Menu scuro', args: { dark: true }, render: (args) => html` <it-dropdown label=${args.label} variant=${args.variant} dark> <h4 slot=\"header\" class=\"link-list-heading dropdown-header\">Intestazione</h4> <it-dropdown-item href=\"#\">Azione 1</it-dropdown-item> <it-dropdown-item href=\"#\">Azione 2</it-dropdown-item> <it-dropdown-item separator></it-dropdown-item> <it-dropdown-item href=\"#\">Azione 3</it-dropdown-item> </it-dropdown> `, argTypes: { ...disabledControls(['label', 'variant']) }, parameters: { ...meta.parameters, docs: { source: { excludeDecorators: true }, description: { story: `Aggiungendo l'attributo \\`dark\\` al dropdown si ottiene una versione con un colore primario scuro. Link ed elementi interni vengono declinati di conseguenza.`, }, }, }, }"
|
|
635
|
+
}
|
|
636
|
+
],
|
|
637
|
+
"exports": [
|
|
638
|
+
{
|
|
639
|
+
"kind": "js",
|
|
640
|
+
"name": "default",
|
|
641
|
+
"declaration": {
|
|
642
|
+
"name": "meta",
|
|
643
|
+
"module": "stories/it-dropdown.stories.ts"
|
|
644
|
+
}
|
|
645
|
+
},
|
|
646
|
+
{
|
|
647
|
+
"kind": "js",
|
|
648
|
+
"name": "Base",
|
|
649
|
+
"declaration": {
|
|
650
|
+
"name": "Base",
|
|
651
|
+
"module": "stories/it-dropdown.stories.ts"
|
|
652
|
+
}
|
|
653
|
+
},
|
|
654
|
+
{
|
|
655
|
+
"kind": "js",
|
|
656
|
+
"name": "Varianti",
|
|
657
|
+
"declaration": {
|
|
658
|
+
"name": "Varianti",
|
|
659
|
+
"module": "stories/it-dropdown.stories.ts"
|
|
660
|
+
}
|
|
661
|
+
},
|
|
662
|
+
{
|
|
663
|
+
"kind": "js",
|
|
664
|
+
"name": "Direzioni",
|
|
665
|
+
"declaration": {
|
|
666
|
+
"name": "Direzioni",
|
|
667
|
+
"module": "stories/it-dropdown.stories.ts"
|
|
668
|
+
}
|
|
669
|
+
},
|
|
670
|
+
{
|
|
671
|
+
"kind": "js",
|
|
672
|
+
"name": "MenuVociAttive",
|
|
673
|
+
"declaration": {
|
|
674
|
+
"name": "MenuVociAttive",
|
|
675
|
+
"module": "stories/it-dropdown.stories.ts"
|
|
676
|
+
}
|
|
677
|
+
},
|
|
678
|
+
{
|
|
679
|
+
"kind": "js",
|
|
680
|
+
"name": "MenuDisabilitato",
|
|
681
|
+
"declaration": {
|
|
682
|
+
"name": "MenuDisabilitato",
|
|
683
|
+
"module": "stories/it-dropdown.stories.ts"
|
|
684
|
+
}
|
|
685
|
+
},
|
|
686
|
+
{
|
|
687
|
+
"kind": "js",
|
|
688
|
+
"name": "MenuVociDisabilitate",
|
|
689
|
+
"declaration": {
|
|
690
|
+
"name": "MenuVociDisabilitate",
|
|
691
|
+
"module": "stories/it-dropdown.stories.ts"
|
|
692
|
+
}
|
|
693
|
+
},
|
|
694
|
+
{
|
|
695
|
+
"kind": "js",
|
|
696
|
+
"name": "MenuIntestazioniSeparatori",
|
|
697
|
+
"declaration": {
|
|
698
|
+
"name": "MenuIntestazioniSeparatori",
|
|
699
|
+
"module": "stories/it-dropdown.stories.ts"
|
|
700
|
+
}
|
|
701
|
+
},
|
|
702
|
+
{
|
|
703
|
+
"kind": "js",
|
|
704
|
+
"name": "MenuVociGrandi",
|
|
705
|
+
"declaration": {
|
|
706
|
+
"name": "MenuVociGrandi",
|
|
707
|
+
"module": "stories/it-dropdown.stories.ts"
|
|
708
|
+
}
|
|
709
|
+
},
|
|
710
|
+
{
|
|
711
|
+
"kind": "js",
|
|
712
|
+
"name": "MenuATuttaLarghezza",
|
|
713
|
+
"declaration": {
|
|
714
|
+
"name": "MenuATuttaLarghezza",
|
|
715
|
+
"module": "stories/it-dropdown.stories.ts"
|
|
716
|
+
}
|
|
717
|
+
},
|
|
718
|
+
{
|
|
719
|
+
"kind": "js",
|
|
720
|
+
"name": "MenuIconaDestra",
|
|
721
|
+
"declaration": {
|
|
722
|
+
"name": "MenuIconaDestra",
|
|
723
|
+
"module": "stories/it-dropdown.stories.ts"
|
|
724
|
+
}
|
|
725
|
+
},
|
|
726
|
+
{
|
|
727
|
+
"kind": "js",
|
|
728
|
+
"name": "MenuIconaSinistra",
|
|
729
|
+
"declaration": {
|
|
730
|
+
"name": "MenuIconaSinistra",
|
|
731
|
+
"module": "stories/it-dropdown.stories.ts"
|
|
732
|
+
}
|
|
733
|
+
},
|
|
734
|
+
{
|
|
735
|
+
"kind": "js",
|
|
736
|
+
"name": "MenuScuro",
|
|
737
|
+
"declaration": {
|
|
738
|
+
"name": "MenuScuro",
|
|
739
|
+
"module": "stories/it-dropdown.stories.ts"
|
|
740
|
+
}
|
|
741
|
+
}
|
|
742
|
+
]
|
|
743
|
+
}
|
|
744
|
+
]
|
|
745
|
+
}
|