@statistikzh/leu 0.14.4 → 0.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (140) hide show
  1. package/.release-please-manifest.json +1 -1
  2. package/CHANGELOG.md +8 -0
  3. package/dist/Accordion.js +2 -30
  4. package/dist/Button.d.ts +56 -68
  5. package/dist/Button.js +74 -52
  6. package/dist/ButtonGroup.d.ts +9 -9
  7. package/dist/ButtonGroup.js +30 -20
  8. package/dist/ChartWrapper.d.ts +38 -0
  9. package/dist/ChartWrapper.js +153 -0
  10. package/dist/Checkbox.d.ts +6 -21
  11. package/dist/Checkbox.js +17 -9
  12. package/dist/CheckboxGroup.d.ts +13 -14
  13. package/dist/CheckboxGroup.js +18 -11
  14. package/dist/Chip.js +1 -1
  15. package/dist/ChipGroup.js +1 -1
  16. package/dist/ChipLink.js +1 -1
  17. package/dist/ChipRemovable.js +1 -1
  18. package/dist/ChipSelectable.js +1 -1
  19. package/dist/Dialog.js +1 -1
  20. package/dist/Dropdown.js +3 -1
  21. package/dist/Icon.js +1 -1
  22. package/dist/Input.js +1 -1
  23. package/dist/{LeuElement-x8UlIDDl.js → LeuElement-BhAmogDy.js} +1 -1
  24. package/dist/Menu.js +1 -1
  25. package/dist/MenuItem.js +1 -1
  26. package/dist/Pagination.d.ts +40 -28
  27. package/dist/Pagination.js +39 -14
  28. package/dist/Placeholder.d.ts +27 -0
  29. package/dist/Placeholder.js +90 -0
  30. package/dist/Popup.js +1 -1
  31. package/dist/Radio.d.ts +6 -21
  32. package/dist/Radio.js +17 -9
  33. package/dist/RadioGroup.d.ts +28 -23
  34. package/dist/RadioGroup.js +29 -16
  35. package/dist/Range.js +1 -1
  36. package/dist/ScrollTop.d.ts +0 -1
  37. package/dist/ScrollTop.js +3 -1
  38. package/dist/Select.js +3 -1
  39. package/dist/Spinner.js +1 -1
  40. package/dist/Table.d.ts +0 -1
  41. package/dist/Table.js +3 -1
  42. package/dist/VisuallyHidden.js +1 -1
  43. package/dist/_tslib-CNEFicEt.js +30 -0
  44. package/dist/components/button/Button.d.ts +55 -67
  45. package/dist/components/button/Button.d.ts.map +1 -1
  46. package/dist/components/button/stories/button.stories.d.ts.map +1 -1
  47. package/dist/components/button-group/ButtonGroup.d.ts +9 -9
  48. package/dist/components/button-group/ButtonGroup.d.ts.map +1 -1
  49. package/dist/components/checkbox/Checkbox.d.ts +6 -21
  50. package/dist/components/checkbox/Checkbox.d.ts.map +1 -1
  51. package/dist/components/checkbox/CheckboxGroup.d.ts +13 -14
  52. package/dist/components/checkbox/CheckboxGroup.d.ts.map +1 -1
  53. package/dist/components/icon/stories/icon.stories.d.ts +10 -0
  54. package/dist/components/icon/stories/icon.stories.d.ts.map +1 -1
  55. package/dist/components/pagination/Pagination.d.ts +40 -27
  56. package/dist/components/pagination/Pagination.d.ts.map +1 -1
  57. package/dist/components/pagination/stories/pagination.stories.d.ts +10 -2
  58. package/dist/components/pagination/stories/pagination.stories.d.ts.map +1 -1
  59. package/dist/components/placeholder/Placeholder.d.ts +23 -0
  60. package/dist/components/placeholder/Placeholder.d.ts.map +1 -0
  61. package/dist/components/placeholder/leu-placeholder.d.ts +3 -0
  62. package/dist/components/placeholder/leu-placeholder.d.ts.map +1 -0
  63. package/dist/components/placeholder/stories/placeholder.stories.d.ts +27 -0
  64. package/dist/components/placeholder/stories/placeholder.stories.d.ts.map +1 -0
  65. package/dist/components/placeholder/test/placeholder.test.d.ts +2 -0
  66. package/dist/components/placeholder/test/placeholder.test.d.ts.map +1 -0
  67. package/dist/components/radio/Radio.d.ts +6 -21
  68. package/dist/components/radio/Radio.d.ts.map +1 -1
  69. package/dist/components/radio/RadioGroup.d.ts +28 -23
  70. package/dist/components/radio/RadioGroup.d.ts.map +1 -1
  71. package/dist/components/visualization/ChartWrapper.d.ts +34 -0
  72. package/dist/components/visualization/ChartWrapper.d.ts.map +1 -0
  73. package/dist/components/visualization/leu-chart-wrapper.d.ts +3 -0
  74. package/dist/components/visualization/leu-chart-wrapper.d.ts.map +1 -0
  75. package/dist/components/visualization/stories/chart-wrapper.stories.d.ts +28 -0
  76. package/dist/components/visualization/stories/chart-wrapper.stories.d.ts.map +1 -0
  77. package/dist/components/visualization/test/chart-wrapper.test.d.ts +2 -0
  78. package/dist/components/visualization/test/chart-wrapper.test.d.ts.map +1 -0
  79. package/dist/index.js +3 -2
  80. package/dist/leu-accordion.js +2 -1
  81. package/dist/leu-button-group.js +8 -1
  82. package/dist/leu-button.d.ts +0 -1
  83. package/dist/leu-button.js +3 -1
  84. package/dist/leu-chart-wrapper.d.ts +6 -0
  85. package/dist/leu-chart-wrapper.js +11 -0
  86. package/dist/leu-checkbox-group.js +5 -1
  87. package/dist/leu-checkbox.js +3 -1
  88. package/dist/leu-chip-group.js +1 -1
  89. package/dist/leu-chip-link.js +1 -1
  90. package/dist/leu-chip-removable.js +1 -1
  91. package/dist/leu-chip-selectable.js +1 -1
  92. package/dist/leu-dialog.js +1 -1
  93. package/dist/leu-dropdown.js +3 -1
  94. package/dist/leu-icon.js +1 -1
  95. package/dist/leu-input.js +1 -1
  96. package/dist/leu-menu-item.js +1 -1
  97. package/dist/leu-menu.js +1 -1
  98. package/dist/leu-pagination.d.ts +0 -1
  99. package/dist/leu-pagination.js +3 -1
  100. package/dist/leu-placeholder.d.ts +4 -0
  101. package/dist/leu-placeholder.js +7 -0
  102. package/dist/leu-popup.js +1 -1
  103. package/dist/leu-radio-group.js +4 -1
  104. package/dist/leu-radio.js +3 -1
  105. package/dist/leu-range.js +1 -1
  106. package/dist/leu-scroll-top.d.ts +0 -1
  107. package/dist/leu-scroll-top.js +3 -1
  108. package/dist/leu-select.js +3 -1
  109. package/dist/leu-spinner.js +1 -1
  110. package/dist/leu-table.d.ts +0 -1
  111. package/dist/leu-table.js +3 -1
  112. package/dist/leu-visually-hidden.js +1 -1
  113. package/dist/lib/a11y.d.ts +2 -2
  114. package/dist/vscode.html-custom-data.json +92 -22
  115. package/dist/vue/index.d.ts +78 -38
  116. package/dist/web-types.json +208 -66
  117. package/package.json +1 -1
  118. package/release-please-config.json +0 -2
  119. package/scripts/generate-component/templates/stories/[name].stories.ts +17 -4
  120. package/src/components/button/Button.ts +95 -79
  121. package/src/components/button/stories/button.stories.ts +5 -6
  122. package/src/components/button-group/ButtonGroup.ts +18 -13
  123. package/src/components/checkbox/Checkbox.ts +13 -15
  124. package/src/components/checkbox/CheckboxGroup.ts +20 -16
  125. package/src/components/icon/stories/icon.stories.ts +27 -0
  126. package/src/components/pagination/Pagination.ts +45 -32
  127. package/src/components/pagination/stories/pagination.stories.ts +28 -17
  128. package/src/components/placeholder/Placeholder.ts +33 -0
  129. package/src/components/placeholder/leu-placeholder.ts +5 -0
  130. package/src/components/placeholder/placeholder.css +59 -0
  131. package/src/components/placeholder/stories/placeholder.stories.ts +34 -0
  132. package/src/components/placeholder/test/placeholder.test.ts +31 -0
  133. package/src/components/radio/Radio.ts +13 -15
  134. package/src/components/radio/RadioGroup.ts +42 -28
  135. package/src/components/visualization/ChartWrapper.ts +75 -0
  136. package/src/components/visualization/chart-wrapper.css +78 -0
  137. package/src/components/visualization/leu-chart-wrapper.ts +5 -0
  138. package/src/components/visualization/stories/chart-wrapper.stories.ts +52 -0
  139. package/src/components/visualization/test/chart-wrapper.test.ts +74 -0
  140. package/src/lib/a11y.ts +2 -2
@@ -2,7 +2,7 @@ import type { DefineComponent } from "vue";
2
2
 
3
3
  import type { LeuAccordion } from "../Accordion.js";
4
4
  import type { LeuButton } from "../Button.js";
5
- import type { LeuButtonGroup, CustomEvent } from "../ButtonGroup.js";
5
+ import type { LeuButtonGroup } from "../ButtonGroup.js";
6
6
  import type { LeuCheckbox } from "../Checkbox.js";
7
7
  import type { LeuCheckboxGroup } from "../CheckboxGroup.js";
8
8
  import type { LeuChipGroup } from "../ChipGroup.js";
@@ -16,6 +16,7 @@ import type { LeuInput, CustomEvent } from "../Input.js";
16
16
  import type { LeuMenu } from "../Menu.js";
17
17
  import type { LeuMenuItem } from "../MenuItem.js";
18
18
  import type { LeuPagination, CustomEvent } from "../Pagination.js";
19
+ import type { LeuPlaceholder } from "../Placeholder.js";
19
20
  import type { LeuPopup } from "../Popup.js";
20
21
  import type { LeuRadio } from "../Radio.js";
21
22
  import type { LeuRadioGroup } from "../RadioGroup.js";
@@ -24,6 +25,7 @@ import type { LeuScrollTop } from "../ScrollTop.js";
24
25
  import type { LeuSelect } from "../Select.js";
25
26
  import type { LeuSpinner } from "../Spinner.js";
26
27
  import type { LeuTable } from "../Table.js";
28
+ import type { LeuChartWrapper } from "../ChartWrapper.js";
27
29
  import type { LeuVisuallyHidden } from "../VisuallyHidden.js";
28
30
 
29
31
  type LeuAccordionProps = {
@@ -38,35 +40,41 @@ type LeuAccordionProps = {
38
40
  };
39
41
 
40
42
  type LeuButtonProps = {
41
- /** */
43
+ /** `aria-label` of the underlying button elements.
44
+ Use it to provide a label when only an icon is visible. */
42
45
  label?: LeuButton["label"];
43
- /** */
46
+ /** The size of the button. */
44
47
  size?: LeuButton["size"];
45
- /** */
48
+ /** The visual variant of the button. */
46
49
  variant?: LeuButton["variant"];
47
- /** */
50
+ /** The `type` of the underlying button element. */
48
51
  type?: LeuButton["type"];
49
- /** */
52
+ /** The `role` of the underlying button element. */
50
53
  componentRole?: LeuButton["componentRole"];
51
- /** */
54
+ /** Whether the button is disabled or not. */
52
55
  disabled?: LeuButton["disabled"];
53
- /** Only taken into account if no Label and an Icon is set */
56
+ /** Whether the button should be round.
57
+ Can only be applied when the button contains an icon without a visible label. */
54
58
  round?: LeuButton["round"];
55
- /** */
59
+ /** Whether the button is active or not.
60
+ Depending on the `componentRole`, it applies `aria-checked` or `aria-selected` to the underlying button element. */
56
61
  active?: LeuButton["active"];
57
- /** will be used on dark Background */
62
+ /** Wheter the colors should be inverted. For use on dark backgrounds. */
58
63
  inverted?: LeuButton["inverted"];
59
- /** Only taken into account if variant is "ghost" */
64
+ /** Whether the button is expanded or not.
65
+ Only has an effect on the variant `ghost` to show an expanding icon.
66
+ If the property is not set, the icon will not be shown.
67
+ If it is set, the icon will either show an expanded or collapsed state. */
60
68
  expanded?: LeuButton["expanded"];
61
69
  /** Alters the shape of the button to be full width of its parent container */
62
70
  fluid?: LeuButton["fluid"];
63
71
  };
64
72
 
65
73
  type LeuButtonGroupProps = {
66
- /** The value of the currenty selected (active) button */
74
+ /** The value of the currently selected (active) button */
67
75
  value?: LeuButtonGroup["value"];
68
76
  /** When the value of the group changes by clicking a button */
69
- oninput?: (e: CustomEvent<CustomEvent>) => void;
77
+ oninput?: (e: CustomEvent<never>) => void;
70
78
  };
71
79
 
72
80
  type LeuCheckboxProps = {
@@ -81,14 +89,12 @@ type LeuCheckboxProps = {
81
89
  };
82
90
 
83
91
  type LeuCheckboxGroupProps = {
84
- /** */
92
+ /** Defines how the checkboxes should be aligned. */
85
93
  orientation?: LeuCheckboxGroup["orientation"];
86
- /** */
94
+ /** The label of the checkbox group */
87
95
  label?: LeuCheckboxGroup["label"];
88
96
  /** */
89
97
  value?: LeuCheckboxGroup["value"];
90
- /** */
91
- items?: LeuCheckboxGroup["items"];
92
98
  };
93
99
 
94
100
  type LeuChipGroupProps = {
@@ -252,17 +258,18 @@ type LeuMenuItemProps = {
252
258
  type LeuPaginationProps = {
253
259
  /** */
254
260
  defaultPage?: LeuPagination["defaultPage"];
255
- /** */
261
+ /** Number of items per page. */
256
262
  itemsPerPage?: LeuPagination["itemsPerPage"];
257
- /** */
263
+ /** Total number of items to paginate. */
258
264
  numOfItems?: LeuPagination["numOfItems"];
259
- /** */
260
- _page?: LeuPagination["_page"];
261
- /** */
265
+ /** The current page number. This is a 1-based index.
266
+ When setting this value, it will be clamped
267
+ to the range of valid pages. */
262
268
  page?: LeuPagination["page"];
263
- /** */
269
+ /** The index of the first item on the current page. */
264
270
  startIndex?: LeuPagination["startIndex"];
265
- /** */
271
+ /** The index of the last item on the current page.
272
+ This is exclusive, meaning it is one past the last item. */
266
273
  endIndex?: LeuPagination["endIndex"];
267
274
  /** */
268
275
  _maxPage?: LeuPagination["_maxPage"];
@@ -270,6 +277,8 @@ type LeuPaginationProps = {
270
277
  "onleu:pagechange"?: (e: CustomEvent<CustomEvent>) => void;
271
278
  };
272
279
 
280
+ type LeuPlaceholderProps = {};
281
+
273
282
  type LeuPopupProps = {
274
283
  /** */
275
284
  anchor?: LeuPopup["anchor"];
@@ -309,22 +318,12 @@ type LeuRadioProps = {
309
318
  };
310
319
 
311
320
  type LeuRadioGroupProps = {
312
- /** */
321
+ /** Defines how the radio buttons should be aligned. */
313
322
  orientation?: LeuRadioGroup["orientation"];
314
- /** */
323
+ /** The label of the radio group */
315
324
  label?: LeuRadioGroup["label"];
316
325
  /** */
317
326
  value?: LeuRadioGroup["value"];
318
- /** */
319
- handleFocusIn?: LeuRadioGroup["handleFocusIn"];
320
- /** */
321
- handleKeyDown?: LeuRadioGroup["handleKeyDown"];
322
- /** */
323
- handleInput?: LeuRadioGroup["handleInput"];
324
- /** */
325
- _currentIndex?: LeuRadioGroup["_currentIndex"];
326
- /** */
327
- items?: LeuRadioGroup["items"];
328
327
  };
329
328
 
330
329
  type LeuRangeProps = {
@@ -427,6 +426,14 @@ type LeuTableProps = {
427
426
  _resizeObserver?: LeuTable["_resizeObserver"];
428
427
  };
429
428
 
429
+ type LeuChartWrapperProps = {
430
+ /** Whether the chart is currently loading or not.
431
+ When set to `true`, a spinner will be shown in the chart container. */
432
+ pending?: LeuChartWrapper["pending"];
433
+ /** */
434
+ hasSlotController?: LeuChartWrapper["hasSlotController"];
435
+ };
436
+
430
437
  type LeuVisuallyHiddenProps = {};
431
438
 
432
439
  export type CustomElements = {
@@ -453,7 +460,8 @@ export type CustomElements = {
453
460
  "leu-button": DefineComponent<LeuButtonProps>;
454
461
 
455
462
  /**
456
- *
463
+ * A radio input-like button group component.
464
+ * It allows only one button to be active at a time.
457
465
  * ---
458
466
  *
459
467
  *
@@ -476,6 +484,9 @@ export type CustomElements = {
476
484
  *
477
485
  * ---
478
486
  *
487
+ *
488
+ * ### **Slots:**
489
+ * - _default_ - Place the checkboxes inside the default slot.
479
490
  */
480
491
  "leu-checkbox-group": DefineComponent<LeuCheckboxGroupProps>;
481
492
 
@@ -613,6 +624,18 @@ export type CustomElements = {
613
624
  */
614
625
  "leu-pagination": DefineComponent<LeuPaginationProps>;
615
626
 
627
+ /**
628
+ * * A placeholder to display when no content is available.
629
+ * ---
630
+ *
631
+ *
632
+ * ### **Slots:**
633
+ * - **title** - The placeholders title. Use a heading tag (h1-6) depeneding on your context.
634
+ * - **description** - A description of the placeholder. Content is wrapped in a `<p>` tag by the component.
635
+ * - **cta** - A call to action button like "Reload" or "Create". Add a single `<leu-button>`.
636
+ */
637
+ "leu-placeholder": DefineComponent<LeuPlaceholderProps>;
638
+
616
639
  /**
617
640
  *
618
641
  * ---
@@ -628,9 +651,12 @@ export type CustomElements = {
628
651
  "leu-radio": DefineComponent<LeuRadioProps>;
629
652
 
630
653
  /**
631
- *
654
+ * Handles a group of radio buttons, allowing only one to be selected at a time. It provides keyboard navigation and manages focus within the group.
632
655
  * ---
633
656
  *
657
+ *
658
+ * ### **Slots:**
659
+ * - _default_ - Place the radio buttons inside the default slot.
634
660
  */
635
661
  "leu-radio-group": DefineComponent<LeuRadioGroupProps>;
636
662
 
@@ -687,6 +713,20 @@ export type CustomElements = {
687
713
  */
688
714
  "leu-table": DefineComponent<LeuTableProps>;
689
715
 
716
+ /**
717
+ * A wrapper element for charts.
718
+ * ---
719
+ *
720
+ *
721
+ * ### **Slots:**
722
+ * - **title** - The title of the chart. Use a heading tag (h2-4) depending on your context.
723
+ * - **description** - A description of the chart. Content is wrapped in a `<p>` tag by the component.
724
+ * - **chart** - The actual chart
725
+ * - **caption** - A caption for the chart, e.g. a source or explanation of the data.
726
+ * - **download** - A download button or dropdown to export the chart in different formats.
727
+ */
728
+ "leu-chart-wrapper": DefineComponent<LeuChartWrapperProps>;
729
+
690
730
  /**
691
731
  *
692
732
  * ---