@statistikzh/leu 0.22.1 → 0.23.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/.release-please-manifest.json +1 -1
- package/CHANGELOG.md +7 -0
- package/dist/Accordion.js +1 -1
- package/dist/Button.js +1 -1
- package/dist/ButtonGroup.js +1 -1
- package/dist/ChartWrapper.js +1 -1
- package/dist/Checkbox.js +1 -1
- package/dist/CheckboxGroup.js +1 -1
- package/dist/Chip.js +1 -1
- package/dist/ChipGroup.js +1 -1
- package/dist/ChipLink.js +1 -1
- package/dist/ChipRemovable.js +1 -1
- package/dist/ChipSelectable.js +1 -1
- package/dist/Dialog.js +1 -1
- package/dist/Dropdown.js +1 -1
- package/dist/FileInput.js +1 -1
- package/dist/Icon.js +1 -1
- package/dist/Input.js +1 -1
- package/dist/{LeuElement-DfsEye-A.js → LeuElement-CWseJvWv.js} +1 -1
- package/dist/Menu.js +1 -1
- package/dist/MenuItem.js +1 -1
- package/dist/Message.js +1 -1
- package/dist/Pagination.js +1 -1
- package/dist/Placeholder.js +1 -1
- package/dist/Popup.d.ts +16 -0
- package/dist/Popup.js +20 -2
- package/dist/ProgressBar.js +1 -1
- package/dist/Radio.js +1 -1
- package/dist/RadioGroup.js +1 -1
- package/dist/Range.js +1 -1
- package/dist/ScrollTop.js +1 -1
- package/dist/Select.js +1 -1
- package/dist/Spinner.js +1 -1
- package/dist/Table.js +1 -1
- package/dist/Tag.js +1 -1
- package/dist/VisuallyHidden.js +1 -1
- package/dist/components/popup/Popup.d.ts +16 -0
- package/dist/components/popup/Popup.d.ts.map +1 -1
- package/dist/components/popup/stories/popup.stories.d.ts +2 -0
- package/dist/components/popup/stories/popup.stories.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/leu-accordion.js +1 -1
- package/dist/leu-button-group.js +1 -1
- package/dist/leu-button.js +1 -1
- package/dist/leu-chart-wrapper.js +1 -1
- package/dist/leu-checkbox-group.js +1 -1
- package/dist/leu-checkbox.js +1 -1
- package/dist/leu-chip-group.js +1 -1
- package/dist/leu-chip-link.js +1 -1
- package/dist/leu-chip-removable.js +1 -1
- package/dist/leu-chip-selectable.js +1 -1
- package/dist/leu-dialog.js +1 -1
- package/dist/leu-dropdown.js +1 -1
- package/dist/leu-file-input.js +1 -1
- package/dist/leu-icon.js +1 -1
- package/dist/leu-input.js +1 -1
- package/dist/leu-menu-item.js +1 -1
- package/dist/leu-menu.js +1 -1
- package/dist/leu-message.js +1 -1
- package/dist/leu-pagination.js +1 -1
- package/dist/leu-placeholder.js +1 -1
- package/dist/leu-popup.js +1 -1
- package/dist/leu-progress-bar.js +1 -1
- package/dist/leu-radio-group.js +1 -1
- package/dist/leu-radio.js +1 -1
- package/dist/leu-range.js +1 -1
- package/dist/leu-scroll-top.js +1 -1
- package/dist/leu-select.js +1 -1
- package/dist/leu-spinner.js +1 -1
- package/dist/leu-table.js +1 -1
- package/dist/leu-tag.js +1 -1
- package/dist/leu-visually-hidden.js +1 -1
- package/dist/vscode.html-custom-data.json +87 -72
- package/dist/vue/index.d.ts +89 -82
- package/dist/web-types.json +193 -163
- package/package.json +1 -1
- package/src/components/popup/Popup.ts +37 -0
- package/src/components/popup/stories/popup.stories.ts +10 -0
- package/src/components/popup/test/popup.test.ts +27 -0
- package/web-test-runner.config.mjs +10 -0
package/dist/web-types.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://raw.githubusercontent.com/JetBrains/web-types/master/schema/web-types.json",
|
|
3
3
|
"name": "@statistikzh/leu",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.23.0",
|
|
5
5
|
"description-markup": "markdown",
|
|
6
6
|
"contributions": {
|
|
7
7
|
"html": {
|
|
@@ -212,74 +212,44 @@
|
|
|
212
212
|
}
|
|
213
213
|
},
|
|
214
214
|
{
|
|
215
|
-
"name": "leu-
|
|
216
|
-
"description": "
|
|
215
|
+
"name": "leu-chart-wrapper",
|
|
216
|
+
"description": "A wrapper element for charts.\n---\n\n\n### **Slots:**\n - **title** - The title of the chart. Use a heading tag (h2-4) depending on your context.\n- **description** - A description of the chart. Content is wrapped in a `<p>` tag by the component.\n- **chart** - The actual chart\n- **caption** - A caption for the chart, e.g. a source or explanation of the data.\n- **download** - A download button or dropdown to export the chart in different formats.",
|
|
217
217
|
"doc-url": "",
|
|
218
218
|
"attributes": [
|
|
219
219
|
{
|
|
220
|
-
"name": "
|
|
220
|
+
"name": "pending",
|
|
221
|
+
"description": "Whether the chart is currently loading or not.\nWhen set to `true`, a spinner will be shown in the chart container.",
|
|
221
222
|
"value": { "type": "boolean", "default": "false" }
|
|
222
|
-
}
|
|
223
|
+
}
|
|
224
|
+
],
|
|
225
|
+
"slots": [
|
|
223
226
|
{
|
|
224
|
-
"name": "
|
|
225
|
-
"
|
|
227
|
+
"name": "title",
|
|
228
|
+
"description": "The title of the chart. Use a heading tag (h2-4) depending on your context."
|
|
226
229
|
},
|
|
227
230
|
{
|
|
228
|
-
"name": "
|
|
229
|
-
"
|
|
231
|
+
"name": "description",
|
|
232
|
+
"description": "A description of the chart. Content is wrapped in a `<p>` tag by the component."
|
|
230
233
|
},
|
|
231
|
-
{ "name": "
|
|
232
|
-
],
|
|
233
|
-
"events": [],
|
|
234
|
-
"js": {
|
|
235
|
-
"properties": [
|
|
236
|
-
{ "name": "checked", "type": "boolean" },
|
|
237
|
-
{ "name": "disabled", "type": "boolean" },
|
|
238
|
-
{ "name": "value", "type": "string" },
|
|
239
|
-
{ "name": "name", "type": "string" }
|
|
240
|
-
],
|
|
241
|
-
"events": []
|
|
242
|
-
}
|
|
243
|
-
},
|
|
244
|
-
{
|
|
245
|
-
"name": "leu-checkbox-group",
|
|
246
|
-
"description": "\n---\n\n\n### **Slots:**\n - _default_ - Place the checkboxes inside the default slot.",
|
|
247
|
-
"doc-url": "",
|
|
248
|
-
"attributes": [
|
|
234
|
+
{ "name": "chart", "description": "The actual chart" },
|
|
249
235
|
{
|
|
250
|
-
"name": "
|
|
251
|
-
"description": "
|
|
252
|
-
"value": {
|
|
253
|
-
"type": "\"horizontal\" | \"vertical\"",
|
|
254
|
-
"default": "\"horizontal\""
|
|
255
|
-
}
|
|
236
|
+
"name": "caption",
|
|
237
|
+
"description": "A caption for the chart, e.g. a source or explanation of the data."
|
|
256
238
|
},
|
|
257
239
|
{
|
|
258
|
-
"name": "
|
|
259
|
-
"description": "
|
|
260
|
-
"value": { "type": "string | undefined" }
|
|
261
|
-
}
|
|
262
|
-
],
|
|
263
|
-
"slots": [
|
|
264
|
-
{
|
|
265
|
-
"name": "",
|
|
266
|
-
"description": "Place the checkboxes inside the default slot."
|
|
240
|
+
"name": "download",
|
|
241
|
+
"description": "A download button or dropdown to export the chart in different formats."
|
|
267
242
|
}
|
|
268
243
|
],
|
|
269
244
|
"events": [],
|
|
270
245
|
"js": {
|
|
271
246
|
"properties": [
|
|
272
247
|
{
|
|
273
|
-
"name": "
|
|
274
|
-
"description": "
|
|
275
|
-
"type": "
|
|
276
|
-
},
|
|
277
|
-
{
|
|
278
|
-
"name": "label",
|
|
279
|
-
"description": "The label of the checkbox group",
|
|
280
|
-
"type": "string | undefined"
|
|
248
|
+
"name": "pending",
|
|
249
|
+
"description": "Whether the chart is currently loading or not.\nWhen set to `true`, a spinner will be shown in the chart container.",
|
|
250
|
+
"type": "boolean"
|
|
281
251
|
},
|
|
282
|
-
{ "name": "
|
|
252
|
+
{ "name": "hasSlotController" }
|
|
283
253
|
],
|
|
284
254
|
"events": []
|
|
285
255
|
}
|
|
@@ -312,44 +282,74 @@
|
|
|
312
282
|
}
|
|
313
283
|
},
|
|
314
284
|
{
|
|
315
|
-
"name": "leu-
|
|
316
|
-
"description": "
|
|
285
|
+
"name": "leu-checkbox",
|
|
286
|
+
"description": "\n---\n",
|
|
317
287
|
"doc-url": "",
|
|
318
288
|
"attributes": [
|
|
319
289
|
{
|
|
320
|
-
"name": "
|
|
321
|
-
"description": "Whether the chart is currently loading or not.\nWhen set to `true`, a spinner will be shown in the chart container.",
|
|
290
|
+
"name": "checked",
|
|
322
291
|
"value": { "type": "boolean", "default": "false" }
|
|
323
|
-
}
|
|
324
|
-
],
|
|
325
|
-
"slots": [
|
|
292
|
+
},
|
|
326
293
|
{
|
|
327
|
-
"name": "
|
|
328
|
-
"
|
|
294
|
+
"name": "disabled",
|
|
295
|
+
"value": { "type": "boolean", "default": "false" }
|
|
329
296
|
},
|
|
330
297
|
{
|
|
331
|
-
"name": "
|
|
332
|
-
"
|
|
298
|
+
"name": "value",
|
|
299
|
+
"value": { "type": "string", "default": "\"\"" }
|
|
333
300
|
},
|
|
334
|
-
{ "name": "
|
|
301
|
+
{ "name": "name", "value": { "type": "string", "default": "\"\"" } }
|
|
302
|
+
],
|
|
303
|
+
"events": [],
|
|
304
|
+
"js": {
|
|
305
|
+
"properties": [
|
|
306
|
+
{ "name": "checked", "type": "boolean" },
|
|
307
|
+
{ "name": "disabled", "type": "boolean" },
|
|
308
|
+
{ "name": "value", "type": "string" },
|
|
309
|
+
{ "name": "name", "type": "string" }
|
|
310
|
+
],
|
|
311
|
+
"events": []
|
|
312
|
+
}
|
|
313
|
+
},
|
|
314
|
+
{
|
|
315
|
+
"name": "leu-checkbox-group",
|
|
316
|
+
"description": "\n---\n\n\n### **Slots:**\n - _default_ - Place the checkboxes inside the default slot.",
|
|
317
|
+
"doc-url": "",
|
|
318
|
+
"attributes": [
|
|
335
319
|
{
|
|
336
|
-
"name": "
|
|
337
|
-
"description": "
|
|
320
|
+
"name": "orientation",
|
|
321
|
+
"description": "Defines how the checkboxes should be aligned.",
|
|
322
|
+
"value": {
|
|
323
|
+
"type": "\"horizontal\" | \"vertical\"",
|
|
324
|
+
"default": "\"horizontal\""
|
|
325
|
+
}
|
|
338
326
|
},
|
|
339
327
|
{
|
|
340
|
-
"name": "
|
|
341
|
-
"description": "
|
|
328
|
+
"name": "label",
|
|
329
|
+
"description": "The label of the checkbox group",
|
|
330
|
+
"value": { "type": "string | undefined" }
|
|
331
|
+
}
|
|
332
|
+
],
|
|
333
|
+
"slots": [
|
|
334
|
+
{
|
|
335
|
+
"name": "",
|
|
336
|
+
"description": "Place the checkboxes inside the default slot."
|
|
342
337
|
}
|
|
343
338
|
],
|
|
344
339
|
"events": [],
|
|
345
340
|
"js": {
|
|
346
341
|
"properties": [
|
|
347
342
|
{
|
|
348
|
-
"name": "
|
|
349
|
-
"description": "
|
|
350
|
-
"type": "
|
|
343
|
+
"name": "orientation",
|
|
344
|
+
"description": "Defines how the checkboxes should be aligned.",
|
|
345
|
+
"type": "\"horizontal\" | \"vertical\""
|
|
351
346
|
},
|
|
352
|
-
{
|
|
347
|
+
{
|
|
348
|
+
"name": "label",
|
|
349
|
+
"description": "The label of the checkbox group",
|
|
350
|
+
"type": "string | undefined"
|
|
351
|
+
},
|
|
352
|
+
{ "name": "value" }
|
|
353
353
|
],
|
|
354
354
|
"events": []
|
|
355
355
|
}
|
|
@@ -410,87 +410,6 @@
|
|
|
410
410
|
"events": []
|
|
411
411
|
}
|
|
412
412
|
},
|
|
413
|
-
{
|
|
414
|
-
"name": "leu-file-input",
|
|
415
|
-
"description": "\n---\n\n\n### **Events:**\n - **input**\n- **change**",
|
|
416
|
-
"doc-url": "",
|
|
417
|
-
"attributes": [
|
|
418
|
-
{
|
|
419
|
-
"name": "label",
|
|
420
|
-
"value": { "type": "string", "default": "\"\"" }
|
|
421
|
-
},
|
|
422
|
-
{
|
|
423
|
-
"name": "accept",
|
|
424
|
-
"description": "A list of acceptable file types. Must be a comma-separated list of [unique file type specifiers](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file#unique_file_type_specifiers).",
|
|
425
|
-
"value": { "type": "string", "default": "\"\"" }
|
|
426
|
-
},
|
|
427
|
-
{
|
|
428
|
-
"name": "disabled",
|
|
429
|
-
"description": "Whether the file input is disabled.",
|
|
430
|
-
"value": { "type": "boolean", "default": "false" }
|
|
431
|
-
},
|
|
432
|
-
{
|
|
433
|
-
"name": "multiple",
|
|
434
|
-
"description": "Whether the file input allows multiple files.",
|
|
435
|
-
"value": { "type": "boolean", "default": "false" }
|
|
436
|
-
},
|
|
437
|
-
{
|
|
438
|
-
"name": "required",
|
|
439
|
-
"description": "Whether the file input is required.",
|
|
440
|
-
"value": { "type": "boolean", "default": "false" }
|
|
441
|
-
},
|
|
442
|
-
{
|
|
443
|
-
"name": "variant",
|
|
444
|
-
"description": "The variant of the file list item. `filled` renders a gray background.",
|
|
445
|
-
"value": {
|
|
446
|
-
"type": "\"filled\" | \"transparent\"",
|
|
447
|
-
"default": "\"filled\""
|
|
448
|
-
}
|
|
449
|
-
}
|
|
450
|
-
],
|
|
451
|
-
"events": [
|
|
452
|
-
{ "name": "input", "type": "CustomEvent" },
|
|
453
|
-
{ "name": "change", "type": "CustomEvent" }
|
|
454
|
-
],
|
|
455
|
-
"js": {
|
|
456
|
-
"properties": [
|
|
457
|
-
{ "name": "label", "type": "string" },
|
|
458
|
-
{
|
|
459
|
-
"name": "accept",
|
|
460
|
-
"description": "A list of acceptable file types. Must be a comma-separated list of [unique file type specifiers](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file#unique_file_type_specifiers).",
|
|
461
|
-
"type": "string"
|
|
462
|
-
},
|
|
463
|
-
{
|
|
464
|
-
"name": "disabled",
|
|
465
|
-
"description": "Whether the file input is disabled.",
|
|
466
|
-
"type": "boolean"
|
|
467
|
-
},
|
|
468
|
-
{
|
|
469
|
-
"name": "multiple",
|
|
470
|
-
"description": "Whether the file input allows multiple files.",
|
|
471
|
-
"type": "boolean"
|
|
472
|
-
},
|
|
473
|
-
{
|
|
474
|
-
"name": "required",
|
|
475
|
-
"description": "Whether the file input is required.",
|
|
476
|
-
"type": "boolean"
|
|
477
|
-
},
|
|
478
|
-
{
|
|
479
|
-
"name": "variant",
|
|
480
|
-
"description": "The variant of the file list item. `filled` renders a gray background.",
|
|
481
|
-
"type": "\"filled\" | \"transparent\""
|
|
482
|
-
},
|
|
483
|
-
{ "name": "files", "type": "File[]" },
|
|
484
|
-
{ "name": "input", "type": "HTMLInputElement" },
|
|
485
|
-
{ "name": "form" },
|
|
486
|
-
{ "name": "name" }
|
|
487
|
-
],
|
|
488
|
-
"events": [
|
|
489
|
-
{ "name": "input", "type": "CustomEvent" },
|
|
490
|
-
{ "name": "change", "type": "CustomEvent" }
|
|
491
|
-
]
|
|
492
|
-
}
|
|
493
|
-
},
|
|
494
413
|
{
|
|
495
414
|
"name": "leu-chip-group",
|
|
496
415
|
"description": "\n---\n\n\n### **Slots:**\n - _default_ - Place leu-chip-* elements inside this slot\n\n### **CSS Properties:**\n - **--leu-chip-group-gap** - The gap between the chips _(default: undefined)_",
|
|
@@ -687,26 +606,84 @@
|
|
|
687
606
|
}
|
|
688
607
|
},
|
|
689
608
|
{
|
|
690
|
-
"name": "leu-
|
|
691
|
-
"description": "
|
|
609
|
+
"name": "leu-file-input",
|
|
610
|
+
"description": "\n---\n\n\n### **Events:**\n - **input**\n- **change**",
|
|
692
611
|
"doc-url": "",
|
|
693
612
|
"attributes": [
|
|
694
613
|
{
|
|
695
|
-
"name": "
|
|
696
|
-
"
|
|
697
|
-
|
|
614
|
+
"name": "label",
|
|
615
|
+
"value": { "type": "string", "default": "\"\"" }
|
|
616
|
+
},
|
|
617
|
+
{
|
|
618
|
+
"name": "accept",
|
|
619
|
+
"description": "A list of acceptable file types. Must be a comma-separated list of [unique file type specifiers](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file#unique_file_type_specifiers).",
|
|
620
|
+
"value": { "type": "string", "default": "\"\"" }
|
|
621
|
+
},
|
|
622
|
+
{
|
|
623
|
+
"name": "disabled",
|
|
624
|
+
"description": "Whether the file input is disabled.",
|
|
625
|
+
"value": { "type": "boolean", "default": "false" }
|
|
626
|
+
},
|
|
627
|
+
{
|
|
628
|
+
"name": "multiple",
|
|
629
|
+
"description": "Whether the file input allows multiple files.",
|
|
630
|
+
"value": { "type": "boolean", "default": "false" }
|
|
631
|
+
},
|
|
632
|
+
{
|
|
633
|
+
"name": "required",
|
|
634
|
+
"description": "Whether the file input is required.",
|
|
635
|
+
"value": { "type": "boolean", "default": "false" }
|
|
636
|
+
},
|
|
637
|
+
{
|
|
638
|
+
"name": "variant",
|
|
639
|
+
"description": "The variant of the file list item. `filled` renders a gray background.",
|
|
640
|
+
"value": {
|
|
641
|
+
"type": "\"filled\" | \"transparent\"",
|
|
642
|
+
"default": "\"filled\""
|
|
643
|
+
}
|
|
698
644
|
}
|
|
699
645
|
],
|
|
700
|
-
"events": [
|
|
646
|
+
"events": [
|
|
647
|
+
{ "name": "input", "type": "CustomEvent" },
|
|
648
|
+
{ "name": "change", "type": "CustomEvent" }
|
|
649
|
+
],
|
|
701
650
|
"js": {
|
|
702
651
|
"properties": [
|
|
652
|
+
{ "name": "label", "type": "string" },
|
|
703
653
|
{
|
|
704
|
-
"name": "
|
|
705
|
-
"description": "
|
|
706
|
-
"type": "
|
|
707
|
-
}
|
|
654
|
+
"name": "accept",
|
|
655
|
+
"description": "A list of acceptable file types. Must be a comma-separated list of [unique file type specifiers](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file#unique_file_type_specifiers).",
|
|
656
|
+
"type": "string"
|
|
657
|
+
},
|
|
658
|
+
{
|
|
659
|
+
"name": "disabled",
|
|
660
|
+
"description": "Whether the file input is disabled.",
|
|
661
|
+
"type": "boolean"
|
|
662
|
+
},
|
|
663
|
+
{
|
|
664
|
+
"name": "multiple",
|
|
665
|
+
"description": "Whether the file input allows multiple files.",
|
|
666
|
+
"type": "boolean"
|
|
667
|
+
},
|
|
668
|
+
{
|
|
669
|
+
"name": "required",
|
|
670
|
+
"description": "Whether the file input is required.",
|
|
671
|
+
"type": "boolean"
|
|
672
|
+
},
|
|
673
|
+
{
|
|
674
|
+
"name": "variant",
|
|
675
|
+
"description": "The variant of the file list item. `filled` renders a gray background.",
|
|
676
|
+
"type": "\"filled\" | \"transparent\""
|
|
677
|
+
},
|
|
678
|
+
{ "name": "files", "type": "File[]" },
|
|
679
|
+
{ "name": "input", "type": "HTMLInputElement" },
|
|
680
|
+
{ "name": "form" },
|
|
681
|
+
{ "name": "name" }
|
|
708
682
|
],
|
|
709
|
-
"events": [
|
|
683
|
+
"events": [
|
|
684
|
+
{ "name": "input", "type": "CustomEvent" },
|
|
685
|
+
{ "name": "change", "type": "CustomEvent" }
|
|
686
|
+
]
|
|
710
687
|
}
|
|
711
688
|
},
|
|
712
689
|
{
|
|
@@ -949,6 +926,29 @@
|
|
|
949
926
|
]
|
|
950
927
|
}
|
|
951
928
|
},
|
|
929
|
+
{
|
|
930
|
+
"name": "leu-icon",
|
|
931
|
+
"description": "A component to render all defined zhWeb icons.\nThe `fill` of the icon is set to `currentColor` and\ncan be overriden by setting the css `color` property.\nIf the icon name is not found, a placeholder will be displayed.\n---\n\n\n### **CSS Properties:**\n - **--leu-icon-size** - The size of the icon. _(default: undefined)_",
|
|
932
|
+
"doc-url": "",
|
|
933
|
+
"attributes": [
|
|
934
|
+
{
|
|
935
|
+
"name": "name",
|
|
936
|
+
"description": "The name of the icon to display.",
|
|
937
|
+
"value": { "type": "IconPathName | \"\"", "default": "\"\"" }
|
|
938
|
+
}
|
|
939
|
+
],
|
|
940
|
+
"events": [],
|
|
941
|
+
"js": {
|
|
942
|
+
"properties": [
|
|
943
|
+
{
|
|
944
|
+
"name": "name",
|
|
945
|
+
"description": "The name of the icon to display.",
|
|
946
|
+
"type": "IconPathName | \"\""
|
|
947
|
+
}
|
|
948
|
+
],
|
|
949
|
+
"events": []
|
|
950
|
+
}
|
|
951
|
+
},
|
|
952
952
|
{
|
|
953
953
|
"name": "leu-menu",
|
|
954
954
|
"description": "\n---\n",
|
|
@@ -1247,6 +1247,21 @@
|
|
|
1247
1247
|
"type": "\"width\" | \"height\" | \"both\" | undefined"
|
|
1248
1248
|
}
|
|
1249
1249
|
},
|
|
1250
|
+
{
|
|
1251
|
+
"name": "offset-main-axis",
|
|
1252
|
+
"description": "Offsets the popup along the main axis.",
|
|
1253
|
+
"value": { "type": "number | undefined" }
|
|
1254
|
+
},
|
|
1255
|
+
{
|
|
1256
|
+
"name": "offset-cross-axis",
|
|
1257
|
+
"description": "Offsets the popup along the cross axis.",
|
|
1258
|
+
"value": { "type": "number | undefined" }
|
|
1259
|
+
},
|
|
1260
|
+
{
|
|
1261
|
+
"name": "offset-alignment-axis",
|
|
1262
|
+
"description": "Offsets the popup along the alignment axis.\nOverrides the `offsetCrossAxis` value.",
|
|
1263
|
+
"value": { "type": "number | undefined" }
|
|
1264
|
+
},
|
|
1250
1265
|
{
|
|
1251
1266
|
"name": "autoSize",
|
|
1252
1267
|
"value": {
|
|
@@ -1271,6 +1286,21 @@
|
|
|
1271
1286
|
"name": "matchSize",
|
|
1272
1287
|
"type": "\"width\" | \"height\" | \"both\" | undefined"
|
|
1273
1288
|
},
|
|
1289
|
+
{
|
|
1290
|
+
"name": "offsetMainAxis",
|
|
1291
|
+
"description": "Offsets the popup along the main axis.",
|
|
1292
|
+
"type": "number | undefined"
|
|
1293
|
+
},
|
|
1294
|
+
{
|
|
1295
|
+
"name": "offsetCrossAxis",
|
|
1296
|
+
"description": "Offsets the popup along the cross axis.",
|
|
1297
|
+
"type": "number | undefined"
|
|
1298
|
+
},
|
|
1299
|
+
{
|
|
1300
|
+
"name": "offsetAlignmentAxis",
|
|
1301
|
+
"description": "Offsets the popup along the alignment axis.\nOverrides the `offsetCrossAxis` value.",
|
|
1302
|
+
"type": "number | undefined"
|
|
1303
|
+
},
|
|
1274
1304
|
{
|
|
1275
1305
|
"name": "autoSize",
|
|
1276
1306
|
"type": "| \"width\"\n | \"height\"\n | \"both\" | undefined"
|
package/package.json
CHANGED
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
Placement,
|
|
8
8
|
shift,
|
|
9
9
|
size,
|
|
10
|
+
offset,
|
|
10
11
|
} from "@floating-ui/dom"
|
|
11
12
|
|
|
12
13
|
import { LeuElement } from "../../lib/LeuElement.js"
|
|
@@ -58,6 +59,28 @@ export class LeuPopup extends LeuElement {
|
|
|
58
59
|
@property({ type: String, reflect: true })
|
|
59
60
|
matchSize?: "width" | "height" | "both"
|
|
60
61
|
|
|
62
|
+
/**
|
|
63
|
+
* Offsets the popup along the main axis.
|
|
64
|
+
* @link https://floating-ui.com/docs/offset#mainaxis
|
|
65
|
+
*/
|
|
66
|
+
@property({ type: Number, reflect: true, attribute: "offset-main-axis" })
|
|
67
|
+
offsetMainAxis?: number
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Offsets the popup along the cross axis.
|
|
71
|
+
* @link https://floating-ui.com/docs/offset#crossaxis
|
|
72
|
+
*/
|
|
73
|
+
@property({ type: Number, reflect: true, attribute: "offset-cross-axis" })
|
|
74
|
+
offsetCrossAxis?: number
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Offsets the popup along the alignment axis.
|
|
78
|
+
* Overrides the `offsetCrossAxis` value.
|
|
79
|
+
* @link https://floating-ui.com/docs/offset#alignmentaxis
|
|
80
|
+
*/
|
|
81
|
+
@property({ type: Number, reflect: true, attribute: "offset-alignment-axis" })
|
|
82
|
+
offsetAlignmentAxis?: number
|
|
83
|
+
|
|
61
84
|
@property({ type: String, reflect: true }) autoSize?:
|
|
62
85
|
| "width"
|
|
63
86
|
| "height"
|
|
@@ -116,6 +139,20 @@ export class LeuPopup extends LeuElement {
|
|
|
116
139
|
|
|
117
140
|
const middleware = []
|
|
118
141
|
|
|
142
|
+
if (
|
|
143
|
+
this.offsetAlignmentAxis ||
|
|
144
|
+
this.offsetMainAxis ||
|
|
145
|
+
this.offsetCrossAxis
|
|
146
|
+
) {
|
|
147
|
+
middleware.push(
|
|
148
|
+
offset({
|
|
149
|
+
mainAxis: this.offsetMainAxis,
|
|
150
|
+
crossAxis: this.offsetCrossAxis,
|
|
151
|
+
alignmentAxis: this.offsetAlignmentAxis,
|
|
152
|
+
}),
|
|
153
|
+
)
|
|
154
|
+
}
|
|
155
|
+
|
|
119
156
|
if (this.matchSize) {
|
|
120
157
|
middleware.push(
|
|
121
158
|
size({
|
|
@@ -43,6 +43,9 @@ function Template(args = {}) {
|
|
|
43
43
|
?flip=${args.flip}
|
|
44
44
|
?shift=${args.shift}
|
|
45
45
|
placement=${ifDefined(args.placement)}
|
|
46
|
+
offset-main-axis=${ifDefined(args.offsetMainAxis)}
|
|
47
|
+
offset-cross-axis=${ifDefined(args.offsetCrossAxis)}
|
|
48
|
+
offset-alignment-axis=${ifDefined(args.offsetAlignmentAxis)}
|
|
46
49
|
>
|
|
47
50
|
<leu-button slot="anchor">Open popup</leu-button>
|
|
48
51
|
<div style=${styleMap(popupStyles)}>Popup content</div>
|
|
@@ -55,6 +58,8 @@ Regular.args = {
|
|
|
55
58
|
placement: "bottom-start",
|
|
56
59
|
flip: true,
|
|
57
60
|
shift: true,
|
|
61
|
+
offsetMainAxis: 0,
|
|
62
|
+
offsetAlignmentAxis: 0,
|
|
58
63
|
}
|
|
59
64
|
|
|
60
65
|
export const VirtualElement = {
|
|
@@ -64,6 +69,9 @@ export const VirtualElement = {
|
|
|
64
69
|
?flip=${args.flip}
|
|
65
70
|
?shift=${args.shift}
|
|
66
71
|
placement=${ifDefined(args.placement)}
|
|
72
|
+
offset-main-axis=${ifDefined(args.offsetMainAxis)}
|
|
73
|
+
offset-cross-axis=${ifDefined(args.offsetCrossAxis)}
|
|
74
|
+
offset-alignment-axis=${ifDefined(args.offsetAlignmentAxis)}
|
|
67
75
|
>
|
|
68
76
|
<div style=${styleMap(popupStyles)}>Popup content</div>
|
|
69
77
|
</leu-popup>
|
|
@@ -103,5 +111,7 @@ export const VirtualElement = {
|
|
|
103
111
|
placement: "bottom-start",
|
|
104
112
|
flip: true,
|
|
105
113
|
shift: true,
|
|
114
|
+
offsetMainAxis: 8,
|
|
115
|
+
offsetAlignmentAxis: 8,
|
|
106
116
|
},
|
|
107
117
|
}
|
|
@@ -60,4 +60,31 @@ describe("LeuPopup", () => {
|
|
|
60
60
|
expect(popupContent.style.left).to.equal("32px")
|
|
61
61
|
expect(popupContent.style.top).to.equal("125px")
|
|
62
62
|
})
|
|
63
|
+
|
|
64
|
+
it("applies offset properties correctly", async () => {
|
|
65
|
+
const popup = await fixture<LeuPopup>(
|
|
66
|
+
html`<leu-popup
|
|
67
|
+
?active=${true}
|
|
68
|
+
placement="bottom-start"
|
|
69
|
+
offset-main-axis="12"
|
|
70
|
+
offset-cross-axis="9"
|
|
71
|
+
>
|
|
72
|
+
<div
|
|
73
|
+
slot="anchor"
|
|
74
|
+
style="width: 16px; height: 16px; position: absolute; top: 0; left: 0;"
|
|
75
|
+
></div>
|
|
76
|
+
<div style="background: white; padding: 0.5rem">Popup content</div>
|
|
77
|
+
</leu-popup>`,
|
|
78
|
+
)
|
|
79
|
+
|
|
80
|
+
await new Promise<void>((resolve) => {
|
|
81
|
+
requestAnimationFrame(() => resolve())
|
|
82
|
+
})
|
|
83
|
+
|
|
84
|
+
const popupContent =
|
|
85
|
+
popup.shadowRoot!.querySelector<HTMLDivElement>(".popup")
|
|
86
|
+
|
|
87
|
+
expect(popupContent.style.left).to.equal("9px") // offset-cross-axis
|
|
88
|
+
expect(popupContent.style.top).to.equal("28px") // offset-main-axis + anchor height
|
|
89
|
+
})
|
|
63
90
|
})
|
|
@@ -64,6 +64,16 @@ export default /** @type {import("@web/test-runner").TestRunnerConfig} */ ({
|
|
|
64
64
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
65
65
|
<link rel="stylesheet" href="dist/theme.css" />
|
|
66
66
|
<link rel="stylesheet" href="https://www.web.statistik.zh.ch/leu/styles/fonts.css" />
|
|
67
|
+
<style>
|
|
68
|
+
*, *::before, *::after {
|
|
69
|
+
box-sizing: border-box;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
*:not(dialog) {
|
|
73
|
+
margin: 0;
|
|
74
|
+
}
|
|
75
|
+
</style>
|
|
76
|
+
|
|
67
77
|
</head>
|
|
68
78
|
<body>
|
|
69
79
|
<script type="module" src="${testFramework}"></script>
|