@designsystem-se/af 39.2.1 → 39.2.3

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 (216) hide show
  1. package/components/digi-bar-chart.js +67 -17
  2. package/components/digi-calendar-datepicker.js +1 -1
  3. package/components/digi-calendar-week-view.js +51 -6
  4. package/components/digi-calendar.js +1 -1
  5. package/components/digi-chart-line.js +57 -14
  6. package/components/digi-expandable-accordion.js +18 -11
  7. package/components/digi-expandable-faq-item.js +21 -14
  8. package/components/digi-info-card.js +3 -3
  9. package/components/digi-navigation-vertical-menu.js +27 -13
  10. package/components/digi-tablist.js +36 -13
  11. package/components/{p-CrUxQ9d0.js → p-C5A2t93y.js} +1 -1
  12. package/custom-elements.json +1 -1
  13. package/dist/cjs/button-size.enum-DgyvMkwE.js +7 -0
  14. package/dist/cjs/{button-variation.enum-ngMqFLdW.js → button-variation.enum-DkUalo9f.js} +0 -6
  15. package/dist/cjs/digi-arbetsformedlingen.cjs.js +1 -1
  16. package/dist/cjs/digi-bar-chart.cjs.entry.js +67 -17
  17. package/dist/cjs/digi-button.cjs.entry.js +131 -0
  18. package/dist/cjs/{digi-button_5.cjs.entry.js → digi-calendar-week-view.cjs.entry.js} +117 -261
  19. package/dist/cjs/{digi-calendar-datepicker.cjs.entry.js → digi-calendar_19.cjs.entry.js} +1611 -55
  20. package/dist/cjs/digi-chart-line.cjs.entry.js +57 -14
  21. package/dist/cjs/digi-code-block_3.cjs.entry.js +6 -12
  22. package/dist/cjs/digi-code-example.cjs.entry.js +4 -3
  23. package/dist/cjs/digi-dialog.cjs.entry.js +6 -12
  24. package/dist/cjs/digi-footer.cjs.entry.js +5 -11
  25. package/dist/cjs/digi-form-error-list.cjs.entry.js +5 -11
  26. package/dist/cjs/digi-form-file-upload.cjs.entry.js +9 -10
  27. package/dist/cjs/digi-form-input-search.cjs.entry.js +5 -6
  28. package/dist/cjs/digi-form-receipt.cjs.entry.js +5 -11
  29. package/dist/cjs/digi-form-select-filter.cjs.entry.js +6 -12
  30. package/dist/cjs/digi-header-navigation.cjs.entry.js +5 -11
  31. package/dist/cjs/digi-header.cjs.entry.js +5 -11
  32. package/dist/cjs/digi-info-card.cjs.entry.js +3 -3
  33. package/dist/cjs/digi-navigation-pagination.cjs.entry.js +5 -11
  34. package/dist/cjs/digi-navigation-vertical-menu.cjs.entry.js +27 -13
  35. package/dist/cjs/digi-notification-alert.cjs.entry.js +5 -11
  36. package/dist/cjs/digi-notification-error-page.cjs.entry.js +5 -11
  37. package/dist/cjs/digi-tablist.cjs.entry.js +36 -13
  38. package/dist/cjs/digi-title-logo.cjs.entry.js +5 -11
  39. package/dist/cjs/digi-tools-feedback.cjs.entry.js +7 -13
  40. package/dist/cjs/{form-input-type.enum-DvF_MTHK.js → form-input-type.enum-CCCcY8gv.js} +7 -0
  41. package/dist/cjs/{form-file-upload-variation.enum-xcEOoggr.js → form-validation-message-variation.enum-DgkifAnP.js} +7 -0
  42. package/dist/cjs/index-Cn1hHaSy.js +6 -42
  43. package/dist/cjs/{index-Bdlw-Iuy.js → index-DUQtADgG.js} +189 -19
  44. package/dist/cjs/index.cjs.js +59 -65
  45. package/dist/cjs/loader.cjs.js +1 -1
  46. package/dist/cjs/{typography-variation.enum-BDSt7CVI.js → typography-variation.enum-CVUvogxJ.js} +86 -0
  47. package/dist/collection/components/_calendar/calendar/calendar.css +5 -6
  48. package/dist/collection/components/_calendar/week-view/calendar-week-view.js +53 -8
  49. package/dist/collection/components/_chart/bar-chart/bar-chart.css +1 -1
  50. package/dist/collection/components/_chart/bar-chart/bar-chart.js +66 -16
  51. package/dist/collection/components/_chart/chart-line/chart-line.js +57 -14
  52. package/dist/collection/components/_expandable/expandable-accordion/expandable-accordion.js +18 -11
  53. package/dist/collection/components/_expandable/expandable-faq-item/expandable-faq-item.js +21 -14
  54. package/dist/collection/components/_info-card/info-card/info-card.js +5 -5
  55. package/dist/collection/components/_navigation/navigation-tablist/navigation-tablist.js +36 -13
  56. package/dist/collection/components/_navigation/navigation-vertical-menu/navigation-vertical-menu.js +27 -13
  57. package/dist/digi-arbetsformedlingen/digi-arbetsformedlingen.esm.js +1 -1
  58. package/dist/digi-arbetsformedlingen/index.esm.js +1 -1
  59. package/dist/digi-arbetsformedlingen/p-0230ec9b.entry.js +1 -0
  60. package/dist/digi-arbetsformedlingen/p-04bbbd14.entry.js +1 -0
  61. package/dist/digi-arbetsformedlingen/p-0cf25433.entry.js +1 -0
  62. package/dist/digi-arbetsformedlingen/p-17824a0b.entry.js +1 -0
  63. package/dist/digi-arbetsformedlingen/p-25815f15.entry.js +1 -0
  64. package/dist/digi-arbetsformedlingen/p-3d4ac22e.entry.js +1 -0
  65. package/dist/digi-arbetsformedlingen/p-47513f97.entry.js +1 -0
  66. package/dist/digi-arbetsformedlingen/p-4aefce1e.entry.js +1 -0
  67. package/dist/digi-arbetsformedlingen/p-6e256f0c.entry.js +1 -0
  68. package/dist/digi-arbetsformedlingen/p-870a00f8.entry.js +1 -0
  69. package/dist/digi-arbetsformedlingen/p-88dc2ed4.entry.js +1 -0
  70. package/dist/digi-arbetsformedlingen/p-9n7Okhf1.js +1 -0
  71. package/dist/digi-arbetsformedlingen/p-C6S1HfeA.js +1 -0
  72. package/dist/digi-arbetsformedlingen/p-C7xgnp99.js +1 -0
  73. package/dist/digi-arbetsformedlingen/p-Cnyfh_8_.js +1 -0
  74. package/dist/digi-arbetsformedlingen/p-Zivp2NJB.js +1 -0
  75. package/dist/digi-arbetsformedlingen/p-a1deddb1.entry.js +1 -0
  76. package/dist/digi-arbetsformedlingen/p-a29b6fff.entry.js +1 -0
  77. package/dist/digi-arbetsformedlingen/{p-375ea6f8.entry.js → p-ace2e5fd.entry.js} +1 -1
  78. package/dist/digi-arbetsformedlingen/p-b411a549.entry.js +1 -0
  79. package/dist/digi-arbetsformedlingen/p-b7712996.entry.js +1 -0
  80. package/dist/digi-arbetsformedlingen/p-bfccf413.entry.js +1 -0
  81. package/dist/digi-arbetsformedlingen/p-cdd65abb.entry.js +1 -0
  82. package/dist/digi-arbetsformedlingen/p-d4406627.entry.js +1 -0
  83. package/dist/digi-arbetsformedlingen/p-dd95c75e.entry.js +1 -0
  84. package/dist/digi-arbetsformedlingen/p-e5396b1e.entry.js +1 -0
  85. package/dist/digi-arbetsformedlingen/p-e7c10f6a.entry.js +1 -0
  86. package/dist/digi-arbetsformedlingen/p-f91295ac.entry.js +1 -0
  87. package/dist/digi-arbetsformedlingen/p-ffb4fac6.entry.js +1 -0
  88. package/dist/digi-arbetsformedlingen/p-y5Nm4oWF.js +1 -0
  89. package/dist/esm/button-size.enum-C7xgnp99.js +7 -0
  90. package/dist/esm/{button-variation.enum-BMQm4N5I.js → button-variation.enum-y5Nm4oWF.js} +1 -7
  91. package/dist/esm/digi-arbetsformedlingen.js +1 -1
  92. package/dist/esm/digi-bar-chart.entry.js +67 -17
  93. package/dist/esm/digi-button.entry.js +129 -0
  94. package/dist/esm/{digi-button_5.entry.js → digi-calendar-week-view.entry.js} +56 -196
  95. package/dist/esm/{digi-calendar-datepicker.entry.js → digi-calendar_19.entry.js} +1555 -17
  96. package/dist/esm/digi-chart-line.entry.js +57 -14
  97. package/dist/esm/digi-code-block_3.entry.js +5 -11
  98. package/dist/esm/digi-code-example.entry.js +2 -1
  99. package/dist/esm/digi-dialog.entry.js +5 -11
  100. package/dist/esm/digi-footer.entry.js +5 -11
  101. package/dist/esm/digi-form-error-list.entry.js +5 -11
  102. package/dist/esm/digi-form-file-upload.entry.js +1 -2
  103. package/dist/esm/digi-form-input-search.entry.js +1 -2
  104. package/dist/esm/digi-form-receipt.entry.js +5 -11
  105. package/dist/esm/digi-form-select-filter.entry.js +5 -11
  106. package/dist/esm/digi-header-navigation.entry.js +5 -11
  107. package/dist/esm/digi-header.entry.js +5 -11
  108. package/dist/esm/digi-info-card.entry.js +3 -3
  109. package/dist/esm/digi-navigation-pagination.entry.js +5 -11
  110. package/dist/esm/digi-navigation-vertical-menu.entry.js +27 -13
  111. package/dist/esm/digi-notification-alert.entry.js +5 -11
  112. package/dist/esm/digi-notification-error-page.entry.js +5 -11
  113. package/dist/esm/digi-tablist.entry.js +37 -14
  114. package/dist/esm/digi-title-logo.entry.js +5 -11
  115. package/dist/esm/digi-tools-feedback.entry.js +5 -11
  116. package/dist/esm/{form-input-type.enum-BSJH8Lpg.js → form-input-type.enum-C6S1HfeA.js} +8 -1
  117. package/dist/esm/{form-file-upload-variation.enum-BfyJgcLA.js → form-validation-message-variation.enum-9n7Okhf1.js} +8 -1
  118. package/dist/esm/index-BnKuq1L7.js +6 -42
  119. package/dist/esm/{index-B1Je6g2n.js → index-Cnyfh_8_.js} +170 -3
  120. package/dist/esm/index.js +5 -11
  121. package/dist/esm/loader.js +1 -1
  122. package/dist/esm/{typography-variation.enum-4smNltRI.js → typography-variation.enum-Zivp2NJB.js} +87 -1
  123. package/dist/types/components/_calendar/week-view/calendar-week-view.d.ts +4 -2
  124. package/dist/types/components/_chart/bar-chart/bar-chart.d.ts +4 -2
  125. package/dist/types/components/_chart/chart-line/chart-line.d.ts +3 -1
  126. package/dist/types/components/_info-card/info-card/info-card.d.ts +2 -2
  127. package/dist/types/components/_navigation/navigation-tablist/navigation-tablist.d.ts +4 -2
  128. package/dist/types/components/_navigation/navigation-vertical-menu/navigation-vertical-menu.d.ts +7 -2
  129. package/dist/types/components.d.ts +7 -7
  130. package/hydrate/index.js +278 -92
  131. package/hydrate/index.mjs +278 -92
  132. package/package.json +1 -1
  133. package/dist/cjs/digi-calendar_2.cjs.entry.js +0 -490
  134. package/dist/cjs/digi-expandable-accordion.cjs.entry.js +0 -121
  135. package/dist/cjs/digi-expandable-faq-item.cjs.entry.js +0 -119
  136. package/dist/cjs/digi-form-input.cjs.entry.js +0 -205
  137. package/dist/cjs/digi-form-label_3.cjs.entry.js +0 -147
  138. package/dist/cjs/digi-form-select_2.cjs.entry.js +0 -201
  139. package/dist/cjs/digi-icon-chevron-down.cjs.entry.js +0 -28
  140. package/dist/cjs/digi-icon-validation-error_2.cjs.entry.js +0 -51
  141. package/dist/cjs/digi-typography-heading-jumbo.cjs.entry.js +0 -46
  142. package/dist/cjs/digi-util-keydown-handler.cjs.entry.js +0 -81
  143. package/dist/cjs/expandable-accordion-header-level.enum-CjL9V3Kt.js +0 -11
  144. package/dist/cjs/expandable-faq-item-variation.enum-aKkYAQgd.js +0 -18
  145. package/dist/cjs/form-input-search-variation.enum-VVfvlVeM.js +0 -8
  146. package/dist/cjs/form-input-variation.enum-kpoXNUuI.js +0 -29
  147. package/dist/cjs/form-select-variation.enum-e6wjWyaS.js +0 -16
  148. package/dist/cjs/form-validation-message-variation.enum-BA5nmCiw.js +0 -8
  149. package/dist/cjs/index-Snltmefx.js +0 -174
  150. package/dist/cjs/index-r0sb9TCr.js +0 -66
  151. package/dist/cjs/typography-heading-jumbo-variation.enum-Di1Jeh0G.js +0 -17
  152. package/dist/digi-arbetsformedlingen/p-037a35bd.entry.js +0 -1
  153. package/dist/digi-arbetsformedlingen/p-09b52191.entry.js +0 -1
  154. package/dist/digi-arbetsformedlingen/p-0c88f210.entry.js +0 -1
  155. package/dist/digi-arbetsformedlingen/p-151248bf.entry.js +0 -1
  156. package/dist/digi-arbetsformedlingen/p-26099889.entry.js +0 -1
  157. package/dist/digi-arbetsformedlingen/p-3239fb1a.entry.js +0 -1
  158. package/dist/digi-arbetsformedlingen/p-3c1f9629.entry.js +0 -1
  159. package/dist/digi-arbetsformedlingen/p-4ddcae7b.entry.js +0 -1
  160. package/dist/digi-arbetsformedlingen/p-4smNltRI.js +0 -1
  161. package/dist/digi-arbetsformedlingen/p-52a27991.entry.js +0 -1
  162. package/dist/digi-arbetsformedlingen/p-626c1bf5.entry.js +0 -1
  163. package/dist/digi-arbetsformedlingen/p-674a7a94.entry.js +0 -1
  164. package/dist/digi-arbetsformedlingen/p-6931825c.entry.js +0 -1
  165. package/dist/digi-arbetsformedlingen/p-6c1fd994.entry.js +0 -1
  166. package/dist/digi-arbetsformedlingen/p-7682ad6f.entry.js +0 -1
  167. package/dist/digi-arbetsformedlingen/p-7688502e.entry.js +0 -1
  168. package/dist/digi-arbetsformedlingen/p-7f180ce2.entry.js +0 -1
  169. package/dist/digi-arbetsformedlingen/p-88bec555.entry.js +0 -1
  170. package/dist/digi-arbetsformedlingen/p-91265ee0.entry.js +0 -1
  171. package/dist/digi-arbetsformedlingen/p-9a4eecde.entry.js +0 -1
  172. package/dist/digi-arbetsformedlingen/p-B8hpiXmh.js +0 -1
  173. package/dist/digi-arbetsformedlingen/p-BMQm4N5I.js +0 -1
  174. package/dist/digi-arbetsformedlingen/p-BSJH8Lpg.js +0 -1
  175. package/dist/digi-arbetsformedlingen/p-BfyJgcLA.js +0 -1
  176. package/dist/digi-arbetsformedlingen/p-BixPaBHw.js +0 -1
  177. package/dist/digi-arbetsformedlingen/p-BvWKyXb_.js +0 -1
  178. package/dist/digi-arbetsformedlingen/p-C6B2KRZo.js +0 -1
  179. package/dist/digi-arbetsformedlingen/p-CgSR-RTl.js +0 -1
  180. package/dist/digi-arbetsformedlingen/p-DCS1KcvC.js +0 -1
  181. package/dist/digi-arbetsformedlingen/p-DNjGvZvz.js +0 -1
  182. package/dist/digi-arbetsformedlingen/p-DfWZa2Wv.js +0 -1
  183. package/dist/digi-arbetsformedlingen/p-DwNlf6Sh.js +0 -1
  184. package/dist/digi-arbetsformedlingen/p-a556608d.entry.js +0 -1
  185. package/dist/digi-arbetsformedlingen/p-a9a1bf57.entry.js +0 -1
  186. package/dist/digi-arbetsformedlingen/p-b3410fbd.entry.js +0 -1
  187. package/dist/digi-arbetsformedlingen/p-d07a1377.entry.js +0 -1
  188. package/dist/digi-arbetsformedlingen/p-d0b3c35b.entry.js +0 -1
  189. package/dist/digi-arbetsformedlingen/p-e002ceb8.entry.js +0 -1
  190. package/dist/digi-arbetsformedlingen/p-e6ee5a17.entry.js +0 -1
  191. package/dist/digi-arbetsformedlingen/p-e7b311da.entry.js +0 -1
  192. package/dist/digi-arbetsformedlingen/p-ec6dd177.entry.js +0 -1
  193. package/dist/digi-arbetsformedlingen/p-ee58a938.entry.js +0 -1
  194. package/dist/digi-arbetsformedlingen/p-eee1b91f.entry.js +0 -1
  195. package/dist/digi-arbetsformedlingen/p-fea63204.entry.js +0 -1
  196. package/dist/digi-arbetsformedlingen/p-ff73fa2f.entry.js +0 -1
  197. package/dist/digi-arbetsformedlingen/p-xwICssEK.js +0 -1
  198. package/dist/esm/digi-calendar_2.entry.js +0 -487
  199. package/dist/esm/digi-expandable-accordion.entry.js +0 -119
  200. package/dist/esm/digi-expandable-faq-item.entry.js +0 -117
  201. package/dist/esm/digi-form-input.entry.js +0 -203
  202. package/dist/esm/digi-form-label_3.entry.js +0 -143
  203. package/dist/esm/digi-form-select_2.entry.js +0 -198
  204. package/dist/esm/digi-icon-chevron-down.entry.js +0 -26
  205. package/dist/esm/digi-icon-validation-error_2.entry.js +0 -48
  206. package/dist/esm/digi-typography-heading-jumbo.entry.js +0 -44
  207. package/dist/esm/digi-util-keydown-handler.entry.js +0 -79
  208. package/dist/esm/expandable-accordion-header-level.enum-DwNlf6Sh.js +0 -11
  209. package/dist/esm/expandable-faq-item-variation.enum-C6B2KRZo.js +0 -18
  210. package/dist/esm/form-input-search-variation.enum-BvWKyXb_.js +0 -8
  211. package/dist/esm/form-input-variation.enum-DfWZa2Wv.js +0 -29
  212. package/dist/esm/form-select-variation.enum-DCS1KcvC.js +0 -16
  213. package/dist/esm/form-validation-message-variation.enum-B8hpiXmh.js +0 -8
  214. package/dist/esm/index-BixPaBHw.js +0 -170
  215. package/dist/esm/index-BsIL3T_0.js +0 -63
  216. package/dist/esm/typography-heading-jumbo-variation.enum-DNjGvZvz.js +0 -17
@@ -51,6 +51,33 @@ exports.DialogVariation = void 0;
51
51
  DialogVariation["SECONDARY"] = "secondary";
52
52
  })(exports.DialogVariation || (exports.DialogVariation = {}));
53
53
 
54
+ exports.ExpandableAccordionHeaderLevel = void 0;
55
+ (function (ExpandableAccordionHeaderLevel) {
56
+ ExpandableAccordionHeaderLevel["H1"] = "h1";
57
+ ExpandableAccordionHeaderLevel["H2"] = "h2";
58
+ ExpandableAccordionHeaderLevel["H3"] = "h3";
59
+ ExpandableAccordionHeaderLevel["H4"] = "h4";
60
+ ExpandableAccordionHeaderLevel["H5"] = "h5";
61
+ ExpandableAccordionHeaderLevel["H6"] = "h6";
62
+ })(exports.ExpandableAccordionHeaderLevel || (exports.ExpandableAccordionHeaderLevel = {}));
63
+
64
+ exports.ExpandableFaqItemHeadingLevel = void 0;
65
+ (function (ExpandableFaqItemHeadingLevel) {
66
+ ExpandableFaqItemHeadingLevel["H1"] = "h1";
67
+ ExpandableFaqItemHeadingLevel["H2"] = "h2";
68
+ ExpandableFaqItemHeadingLevel["H3"] = "h3";
69
+ ExpandableFaqItemHeadingLevel["H4"] = "h4";
70
+ ExpandableFaqItemHeadingLevel["H5"] = "h5";
71
+ ExpandableFaqItemHeadingLevel["H6"] = "h6";
72
+ })(exports.ExpandableFaqItemHeadingLevel || (exports.ExpandableFaqItemHeadingLevel = {}));
73
+
74
+ exports.ExpandableFaqItemVariation = void 0;
75
+ (function (ExpandableFaqItemVariation) {
76
+ ExpandableFaqItemVariation["PRIMARY"] = "primary";
77
+ ExpandableFaqItemVariation["SECONDARY"] = "secondary";
78
+ ExpandableFaqItemVariation["TERTIARY"] = "tertiary";
79
+ })(exports.ExpandableFaqItemVariation || (exports.ExpandableFaqItemVariation = {}));
80
+
54
81
  exports.FooterVariation = void 0;
55
82
  (function (FooterVariation) {
56
83
  FooterVariation["LARGE"] = "large";
@@ -67,6 +94,34 @@ exports.FormErrorListHeadingLevel = void 0;
67
94
  FormErrorListHeadingLevel["H6"] = "h6";
68
95
  })(exports.FormErrorListHeadingLevel || (exports.FormErrorListHeadingLevel = {}));
69
96
 
97
+ exports.FormInputMode = void 0;
98
+ (function (FormInputMode) {
99
+ FormInputMode["DEFAULT"] = "";
100
+ FormInputMode["NONE"] = "none";
101
+ FormInputMode["TEXT"] = "text";
102
+ FormInputMode["DECIMAL"] = "decimal";
103
+ FormInputMode["NUMERIC"] = "numeric";
104
+ FormInputMode["TEL"] = "tel";
105
+ FormInputMode["SEARCH"] = "search";
106
+ FormInputMode["EMAIL"] = "email";
107
+ FormInputMode["URL"] = "url";
108
+ })(exports.FormInputMode || (exports.FormInputMode = {}));
109
+
110
+ exports.FormInputValidation = void 0;
111
+ (function (FormInputValidation) {
112
+ FormInputValidation["SUCCESS"] = "success";
113
+ FormInputValidation["ERROR"] = "error";
114
+ FormInputValidation["WARNING"] = "warning";
115
+ FormInputValidation["NEUTRAL"] = "neutral";
116
+ })(exports.FormInputValidation || (exports.FormInputValidation = {}));
117
+
118
+ exports.FormInputVariation = void 0;
119
+ (function (FormInputVariation) {
120
+ FormInputVariation["SMALL"] = "small";
121
+ FormInputVariation["MEDIUM"] = "medium";
122
+ FormInputVariation["LARGE"] = "large";
123
+ })(exports.FormInputVariation || (exports.FormInputVariation = {}));
124
+
70
125
  exports.FormFieldsetValidation = void 0;
71
126
  (function (FormFieldsetValidation) {
72
127
  FormFieldsetValidation["SUCCESS"] = "success";
@@ -122,6 +177,21 @@ exports.FormSelectFilterValidation = void 0;
122
177
  FormSelectFilterValidation["NEUTRAL"] = "neutral";
123
178
  })(exports.FormSelectFilterValidation || (exports.FormSelectFilterValidation = {}));
124
179
 
180
+ exports.FormSelectValidation = void 0;
181
+ (function (FormSelectValidation) {
182
+ FormSelectValidation["SUCCESS"] = "success";
183
+ FormSelectValidation["ERROR"] = "error";
184
+ FormSelectValidation["WARNING"] = "warning";
185
+ FormSelectValidation["NEUTRAL"] = "neutral";
186
+ })(exports.FormSelectValidation || (exports.FormSelectValidation = {}));
187
+
188
+ exports.FormSelectVariation = void 0;
189
+ (function (FormSelectVariation) {
190
+ FormSelectVariation["SMALL"] = "small";
191
+ FormSelectVariation["MEDIUM"] = "medium";
192
+ FormSelectVariation["LARGE"] = "large";
193
+ })(exports.FormSelectVariation || (exports.FormSelectVariation = {}));
194
+
125
195
  exports.HeaderCenterContentWidth = void 0;
126
196
  (function (HeaderCenterContentWidth) {
127
197
  HeaderCenterContentWidth["DEFAULT"] = "none";
@@ -231,6 +301,22 @@ exports.FeedbackVariation = void 0;
231
301
  FeedbackVariation["SECONDARY"] = "secondary";
232
302
  })(exports.FeedbackVariation || (exports.FeedbackVariation = {}));
233
303
 
304
+ exports.TypographyHeadingJumboLevel = void 0;
305
+ (function (TypographyHeadingJumboLevel) {
306
+ TypographyHeadingJumboLevel["H1"] = "h1";
307
+ TypographyHeadingJumboLevel["H2"] = "h2";
308
+ TypographyHeadingJumboLevel["H3"] = "h3";
309
+ TypographyHeadingJumboLevel["H4"] = "h4";
310
+ TypographyHeadingJumboLevel["H5"] = "h5";
311
+ TypographyHeadingJumboLevel["H6"] = "h6";
312
+ })(exports.TypographyHeadingJumboLevel || (exports.TypographyHeadingJumboLevel = {}));
313
+
314
+ exports.TypographyHeadingJumboVariation = void 0;
315
+ (function (TypographyHeadingJumboVariation) {
316
+ TypographyHeadingJumboVariation["PRIMARY"] = "primary";
317
+ TypographyHeadingJumboVariation["SECONDARY"] = "secondary";
318
+ })(exports.TypographyHeadingJumboVariation || (exports.TypographyHeadingJumboVariation = {}));
319
+
234
320
  exports.TypographyVariation = void 0;
235
321
  (function (TypographyVariation) {
236
322
  TypographyVariation["SMALL"] = "small";
@@ -97,17 +97,13 @@ License: none (public domain)
97
97
  border-radius: 4px 0 0 0;
98
98
  }
99
99
  :host .digi-calendar__header--month-step .digi-calendar__month-select-button:focus-visible:not(.digi-calendar__date--not-selectable), :host .digi-calendar__header--month-step .digi-calendar__month-select-button:active:not(.digi-calendar__date--not-selectable) {
100
- --digi--calendar--header--button--background: var(
101
- --digi--calendar--header--button--background--hover
102
- );
100
+ --digi--calendar--header--button--background: var(--digi--calendar--header--button--background--hover);
103
101
  text-decoration: underline;
104
102
  cursor: pointer;
105
103
  }
106
104
  @media (any-hover: hover) {
107
105
  :host .digi-calendar__header--month-step .digi-calendar__month-select-button:hover:not(.digi-calendar__date--not-selectable) {
108
- --digi--calendar--header--button--background: var(
109
- --digi--calendar--header--button--background--hover
110
- );
106
+ --digi--calendar--header--button--background: var(--digi--calendar--header--button--background--hover);
111
107
  text-decoration: underline;
112
108
  cursor: pointer;
113
109
  }
@@ -124,6 +120,9 @@ License: none (public domain)
124
120
  table-layout: fixed;
125
121
  margin-bottom: var(--digi--margin--medium);
126
122
  }
123
+ :host .digi-calendar__table th {
124
+ text-align: center;
125
+ }
127
126
  :host .digi-calendar__table-header-week {
128
127
  font-style: italic;
129
128
  padding: var(--digi--calendar--table-header--padding);
@@ -3,6 +3,7 @@ import { h } from "@stencil/core";
3
3
  import { format, getISOWeek, addDays, subDays, setDay } from "date-fns";
4
4
  import svlocale from "date-fns/locale/sv";
5
5
  import { randomIdGenerator } from "../../../global/utils/randomIdGenerator";
6
+ import { logger } from "../../../global/utils/logger";
6
7
  import { ButtonVariation } from "../../_button/button/button-variation.enum";
7
8
  import { CalendarWeekViewHeadingLevel } from "./calendar-week-view-heading-level.enum";
8
9
  /**
@@ -51,7 +52,30 @@ export class CalendarWeekView {
51
52
  this.weekDays = [...newDates];
52
53
  }
53
54
  afDatesUpdate() {
54
- const dateList = [...JSON.parse(this.afDates)];
55
+ // Angular/React can connect the element before afDates is set.
56
+ if (this.afDates == null || this.afDates === '') {
57
+ return;
58
+ }
59
+ const hadDates = this.dates.length > 0;
60
+ let dateList;
61
+ try {
62
+ if (Array.isArray(this.afDates)) {
63
+ dateList = [...this.afDates];
64
+ }
65
+ else if (typeof this.afDates === 'string') {
66
+ dateList = JSON.parse(this.afDates);
67
+ }
68
+ else {
69
+ return;
70
+ }
71
+ }
72
+ catch (_a) {
73
+ logger.warn(`Invalid JSON in "af-dates" attribute`, this.hostElement);
74
+ return;
75
+ }
76
+ if (!Array.isArray(dateList)) {
77
+ return;
78
+ }
55
79
  this.dates = [
56
80
  ...dateList.sort((a, b) => {
57
81
  const c = new Date(a);
@@ -59,6 +83,9 @@ export class CalendarWeekView {
59
83
  return this.getTime(c) - this.getTime(d);
60
84
  })
61
85
  ];
86
+ if (!hadDates && this.dates.length > 0) {
87
+ this.initDates();
88
+ }
62
89
  }
63
90
  /**
64
91
  * Kan användas för att manuellt sätta om det aktiva datumet. Formatet måste vara 'yyyy-MM-dd'.
@@ -82,6 +109,9 @@ export class CalendarWeekView {
82
109
  this.afOnWeekChange.emit('next');
83
110
  }
84
111
  initDates() {
112
+ if (this.dates.length === 0) {
113
+ return;
114
+ }
85
115
  this.minDate = new Date(this.dates[0]);
86
116
  this.maxDate = new Date(this.dates[this.dates.length - 1]);
87
117
  this.selectedDate = format(new Date(this.dates[0]), 'yyyy-MM-dd', {
@@ -93,9 +123,23 @@ export class CalendarWeekView {
93
123
  }
94
124
  componentWillLoad() {
95
125
  this.afDatesUpdate();
96
- this.initDates();
126
+ // Angular attaches the host first and binds `[afDates]` on the next frame
127
+ // (Stencil 4.36+). @Watch skips that first assignment, so if dates are not
128
+ // here yet, wait one frame. React/vanilla that already set the prop skip
129
+ // the delay.
130
+ if (this.dates.length === 0) {
131
+ return new Promise((resolve) => {
132
+ requestAnimationFrame(() => {
133
+ this.afDatesUpdate();
134
+ resolve();
135
+ });
136
+ });
137
+ }
97
138
  }
98
139
  componentDidLoad() {
140
+ if (this.dates.length === 0) {
141
+ this.afDatesUpdate();
142
+ }
99
143
  this.afOnReady.emit();
100
144
  }
101
145
  get prevWeekText() {
@@ -119,7 +163,7 @@ export class CalendarWeekView {
119
163
  format(new Date(lastDate), 'MMMM yyyy', { locale: svlocale });
120
164
  }
121
165
  render() {
122
- return (h("div", { key: '967ccb9710018973a960ae36d52157ba85dacfed', class: "digi-calendar-week-view" }, h("nav", { key: '6a9137d8f8a8e652d26d099ae652cb76e5665b51', class: "digi-calendar-week-view__timepicker" }, h("div", { key: 'a2b8aaeaa93e391e65847b2ea8f9b455e86474f1', class: "digi-calendar-week-view__dates" }, h("div", { key: '0cc675c0cd67d042e5e27a38a6665ab30e516cea', class: "digi-calendar-week-view__flex" }, h("digi-typography", { key: 'd47f59955354cb435dc80895059c6e4fd6eefa8a' }, h(this.afHeadingLevel, { key: 'f01725e82afff23b8ae357b30af909b325d85279', role: "status", class: "digi-calendar-week-view__heading" }, h("span", { key: 'bbfab19eec8776e640ed235654c0fd960faf5722', class: "digi-calendar-week-view__month" }, this.currentMonth), h("span", { key: 'a3a52801083cd83351056d474e01df926d8b0117', class: "digi-calendar-week-view__week" }, ' ', "v.", this.currentWeek))), h("ul", { key: 'a3f3703318fa5400cd32ee5d3af896900a032acd', class: "digi-calendar-week-view__date-list" }, this.weekDays.map((dateItem) => {
166
+ return (h("div", { key: '44d49828a7f43a1f3943aaf0af4139f402844bf0', class: "digi-calendar-week-view" }, h("nav", { key: '44ba98a7c433077c2c11c55b150a5cc2f1d38ac2', class: "digi-calendar-week-view__timepicker" }, h("div", { key: '160ce73dc293abd69193c2b1750c9fd7400b8804', class: "digi-calendar-week-view__dates" }, h("div", { key: '2d60245978d9c7615f3ff5ec7b9d8d628e16f843', class: "digi-calendar-week-view__flex" }, h("digi-typography", { key: '23a1c94d0575061951f67f46782144de52e5e662' }, h(this.afHeadingLevel, { key: 'a183705a035f4d3d57ced74920221f40bbe6019f', role: "status", class: "digi-calendar-week-view__heading" }, h("span", { key: '147910745991716f3557491c6e6aa702f479e8c7', class: "digi-calendar-week-view__month" }, this.currentMonth), h("span", { key: '0d91367cd6066a2b35349edd0ff93e20b5326f04', class: "digi-calendar-week-view__week" }, ' ', "v.", this.currentWeek))), h("ul", { key: 'fdff670cf241e05920e19e0ce6e601b62ae9a3f0', class: "digi-calendar-week-view__date-list" }, this.weekDays.map((dateItem) => {
123
167
  const date = format(new Date(dateItem), 'd', {
124
168
  locale: svlocale
125
169
  });
@@ -139,15 +183,15 @@ export class CalendarWeekView {
139
183
  } }, day), h("span", { class: "digi-calendar-week-view__date-button-date" }, date), h("span", { "aria-hidden": "true", class: {
140
184
  'digi-calendar-week-view__date-button-circle': dateItem === this.todaysDate
141
185
  } })))));
142
- })))), h("digi-button", { key: '2edb685459c4cbf8a0120ab340672b17d0ea3f9f', onClick: () => this.prevWeek(), class: {
186
+ })))), h("digi-button", { key: 'dbae5227d0316a5a67febc7de83b1c4c5cfc1044', onClick: () => this.prevWeek(), class: {
143
187
  'digi-calendar-week-view__week-button digi-calendar-week-view__week-button--previous': true,
144
188
  'digi-calendar-week-view__week-button--keep-left': this.currentWeek == getISOWeek(this.maxDate),
145
189
  'digi-calendar-week-view__week-button--hidden': !(this.currentWeek > getISOWeek(this.minDate))
146
- }, "af-variation": "secondary" }, h("digi-icon-chevron-left", { key: '8948b12a1654f9ef46728ea8de3b1df5f40addcd', slot: "icon" }), this.prevWeekText), h("digi-button", { key: '729ed8eebce68168b66c5365588a52b1279eec3f', onClick: () => this.nextWeek(), class: {
190
+ }, "af-variation": "secondary" }, h("digi-icon-chevron-left", { key: '65d0f656a0d35911d39f9b8e9ade224be54d4371', slot: "icon" }), this.prevWeekText), h("digi-button", { key: '68d9b3d6c929d0185f412add980a542b3c86fbb2', onClick: () => this.nextWeek(), class: {
147
191
  'digi-calendar-week-view__week-button digi-calendar-week-view__week-button--next': true,
148
192
  'digi-calendar-week-view__week-button--keep-right': this.currentWeek == getISOWeek(this.minDate),
149
193
  'digi-calendar-week-view__week-button--hidden': !(this.currentWeek < getISOWeek(this.maxDate))
150
- }, "af-variation": "secondary" }, h("digi-icon-chevron-right", { key: '75bf1669a5d9dd3f618661c79202dc8e69f6c8ea', slot: "icon-secondary" }), this.nextWeekText)), h("div", { key: 'c7379a321936f28783d2f7a4e1e94d0b119de471', role: "status", "aria-live": "assertive", class: "digi-calendar-week-view__result", id: `${this.afId}-result` }, h("digi-typography", { key: 'f7e55435a94c5bff18a3b4b7bfa5d397291f7e8c' }, h("slot", { key: '7c59e144a47c721f5f4a454b9776c708f6d2f15c' })))));
194
+ }, "af-variation": "secondary" }, h("digi-icon-chevron-right", { key: 'a9e688f815a5053aa709cfeb9359131f73df21c0', slot: "icon-secondary" }), this.nextWeekText)), h("div", { key: '7d1073f6cd1982fda2ce7dcb60532c94bd1d0634', role: "status", "aria-live": "assertive", class: "digi-calendar-week-view__result", id: `${this.afId}-result` }, h("digi-typography", { key: 'db7ce0ca80485df1e4ae67200f2cd90cc80938d5' }, h("slot", { key: 'f08f447ae89612dfcea56c638024220bc29e7914' })))));
151
195
  }
152
196
  static get is() { return "digi-calendar-week-view"; }
153
197
  static get encapsulation() { return "scoped"; }
@@ -205,8 +249,8 @@ export class CalendarWeekView {
205
249
  "type": "string",
206
250
  "mutable": true,
207
251
  "complexType": {
208
- "original": "string",
209
- "resolved": "string",
252
+ "original": "string | string[]",
253
+ "resolved": "string | string[]",
210
254
  "references": {}
211
255
  },
212
256
  "required": false,
@@ -373,6 +417,7 @@ export class CalendarWeekView {
373
417
  }
374
418
  };
375
419
  }
420
+ static get elementRef() { return "hostElement"; }
376
421
  static get watchers() {
377
422
  return [{
378
423
  "propName": "selectedDate",
@@ -1,7 +1,7 @@
1
1
  /** Do not touch! Autogenerated
2
2
  */
3
3
  :host {
4
- width: 100%;
4
+ height: 100%;
5
5
  display: flex;
6
6
  flex-direction: column;
7
7
  min-width: 0;
@@ -3,6 +3,7 @@ import { h, Host } from "@stencil/core";
3
3
  import * as d3 from "d3";
4
4
  import { _t } from "../../../text";
5
5
  import { randomIdGenerator } from "../../../global/utils/randomIdGenerator";
6
+ import { logger } from "../../../global/utils/logger";
6
7
  import { BarChartVariation } from "./bar-chart-variation.enum";
7
8
  /**
8
9
  *
@@ -177,6 +178,8 @@ export class barChart {
177
178
  };
178
179
  // Resizing chart while loading
179
180
  this.loadingResize = () => {
181
+ if (!this.barSelection || !this.xScale)
182
+ return;
180
183
  const newHeight = this.setDims();
181
184
  this.barChartContainer.attr('transform', `translate(${this.margin.left + this.tickPadding + this.yTickSize},0)`);
182
185
  this.margin.right =
@@ -442,6 +445,8 @@ export class barChart {
442
445
  return toReturn;
443
446
  };
444
447
  this.adjustBarSize = () => {
448
+ if (!this.barSelection)
449
+ return;
445
450
  this.barSelection
446
451
  .selectAll('.bar')
447
452
  .attr('x', this.xFunction)
@@ -874,13 +879,13 @@ export class barChart {
874
879
  this.initBarText();
875
880
  };
876
881
  // Removes resize observer for chart and inits table
877
- this.activateTable = (event) => {
882
+ this.activateTable = () => {
878
883
  this.closeTooltip();
879
884
  this.barChartObserver.disconnect();
880
885
  this.status.innerHTML = '<p>Visas som tabell</p>';
881
886
  d3.select(this.host).select('.tableButton').style('display', 'none');
882
887
  d3.select(this.host).select('.chartButton').style('display', null);
883
- event.target.nextSibling.lastChild.focus();
888
+ this.focusHostButton('.chartButton');
884
889
  const duration = 150;
885
890
  this.svg
886
891
  .attr('opacity', 1)
@@ -911,11 +916,11 @@ export class barChart {
911
916
  .style('opacity', 0);
912
917
  };
913
918
  // Removes observer and calls init functions for line chart
914
- this.reInitChart = (event) => {
919
+ this.reInitChart = () => {
915
920
  this.status.innerHTML = '<p>Visas som diagram</p>';
916
921
  d3.select(this.host).select('.tableButton').style('display', null);
917
922
  d3.select(this.host).select('.chartButton').style('display', 'none');
918
- event.target.previousSibling.lastChild.focus();
923
+ this.focusHostButton('.tableButton');
919
924
  const table = d3.select(this.tableDiv);
920
925
  const duration = 150;
921
926
  table
@@ -941,14 +946,33 @@ export class barChart {
941
946
  });
942
947
  };
943
948
  }
944
- afChartDataUpdate(data) {
945
- if ((typeof data === 'string' && Object.keys(JSON.parse(data)).length > 0) ||
946
- (typeof data !== 'string' && Object.keys(data).length > 0)) {
947
- if (typeof data != 'string')
948
- this.chartData = data;
949
- else
950
- this.chartData = JSON.parse(data);
951
- this.series = this.chartData.data.series.map((serie) => serie.title);
949
+ afChartDataUpdate() {
950
+ const data = this.afChartData;
951
+ // Angular/React can connect the element before afChartData is set.
952
+ if (data == null || data === '') {
953
+ this.mappedData = this.reshapeData();
954
+ return;
955
+ }
956
+ try {
957
+ let parsed;
958
+ if (typeof data === 'string') {
959
+ parsed = JSON.parse(data);
960
+ }
961
+ else if (typeof data === 'object') {
962
+ parsed = data;
963
+ }
964
+ else {
965
+ this.mappedData = this.reshapeData();
966
+ return;
967
+ }
968
+ if (parsed && Object.keys(parsed).length > 0) {
969
+ this.chartData = parsed;
970
+ this.series = this.chartData.data.series.map((serie) => serie.title);
971
+ }
972
+ }
973
+ catch (_a) {
974
+ logger.warn(`Invalid JSON in "af-chart-data" attribute`, this.hostElement);
975
+ return;
952
976
  }
953
977
  this.mappedData = this.reshapeData();
954
978
  // checking for width of each tick
@@ -959,6 +983,17 @@ export class barChart {
959
983
  if (this.dataWidth > 1)
960
984
  this.barGap = 1;
961
985
  }
986
+ hasChartData() {
987
+ return !!this.chartData && Object.keys(this.chartData).length > 0;
988
+ }
989
+ focusHostButton(selector) {
990
+ var _a, _b;
991
+ const host = this.host;
992
+ const button = (_b = (_a = host === null || host === void 0 ? void 0 : host.querySelector(selector)) === null || _a === void 0 ? void 0 : _a.querySelector('button')) !== null && _b !== void 0 ? _b : host === null || host === void 0 ? void 0 : host.querySelector(selector);
993
+ if (button && typeof button.focus === 'function') {
994
+ button.focus();
995
+ }
996
+ }
962
997
  initSvg() {
963
998
  var _a, _b, _c, _d, _e, _f, _g;
964
999
  // Fetch number formatting
@@ -1526,10 +1561,25 @@ export class barChart {
1526
1561
  Math.min(255, Math.max(0, parseInt(color, 16) + amount)).toString(16)).substr(-2)));
1527
1562
  }
1528
1563
  componentWillLoad() {
1529
- this.afChartDataUpdate(this.afChartData);
1564
+ this.afChartDataUpdate();
1565
+ // Angular attaches the host first and binds `[afChartData]` on the next
1566
+ // frame (Stencil 4.36+). @Watch skips that first assignment, so if chart
1567
+ // data is not here yet, wait one frame. React/vanilla that already set
1568
+ // the prop skip the delay.
1569
+ if (!this.hasChartData()) {
1570
+ return new Promise((resolve) => {
1571
+ requestAnimationFrame(() => {
1572
+ this.afChartDataUpdate();
1573
+ resolve();
1574
+ });
1575
+ });
1576
+ }
1530
1577
  }
1531
1578
  componentDidLoad() {
1532
- if (!this.chartData || Object.keys(this.chartData).length === 0) {
1579
+ if (!this.hasChartData()) {
1580
+ this.afChartDataUpdate();
1581
+ }
1582
+ if (!this.hasChartData()) {
1533
1583
  this.loading = true;
1534
1584
  return this.initEmpty();
1535
1585
  }
@@ -1548,7 +1598,7 @@ export class barChart {
1548
1598
  }
1549
1599
  componentDidUpdate() {
1550
1600
  if (this.tableDiv.style['display'] != 'block' &&
1551
- Object.keys(this.chartData).length === 0) {
1601
+ !this.hasChartData()) {
1552
1602
  // Disconnect old barchartobserver while doing resizing
1553
1603
  this.barChartObserver.disconnect();
1554
1604
  return this.loadingState();
@@ -1628,7 +1678,7 @@ export class barChart {
1628
1678
  if (this.chartData.infoText)
1629
1679
  heading = `${heading}<span style="display:block;margin-top:0.25rem;font-size:0.875rem;color:var(--digi--global--color--neutral--grayscale--darkest-3)">${this.chartData.infoText}</span>`;
1630
1680
  }
1631
- return (h(Host, { key: 'cb70095467051cf1142891bc63694623e707d92f', ref: (el) => (this.host = el) }, h("svg", { key: 'c040fe2f27d9a5e3de1471fe7e4d853757f6a754', xmlns: "http://www.w3.org/2000/svg", width: "0", height: "0" }, h("defs", { key: '17fd52f2cac5a3225e097aee80e8dc1a99909840' }, h("pattern", { key: '2940e729359dad1acc4635363cd5a8f3ee4d8ea1', id: "prognosis", patternUnits: "userSpaceOnUse", width: "8", height: "8", patternTransform: "rotate(45)" }, h("rect", { key: '4b47d41ea9f4699a4bcc7b0f04d00b8bbd124946', width: "8", height: "8", fill: "white" }), h("line", { key: 'd5c3a32fb715a5271a784771d9812ea599390fc3', x1: "0", y: "0", x2: "0", y2: "12", stroke: this.evalColorVar(this.colorPalettes[0]), "stroke-width": "8" })), h("pattern", { key: '8038bb4d62fd87a118e0bcf4e750165eed48f789', id: "prognosisInactive", patternUnits: "userSpaceOnUse", width: "8", height: "8", patternTransform: "rotate(45)" }, h("rect", { key: 'b1247b7d27e73836c7b5a05fb77a872e89853d3b', width: "8", height: "8", fill: "white" }), h("line", { key: '14265bcba469f08b890654315a86d6278271d64d', x1: "0", y: "0", x2: "0", y2: "12", stroke: this.evalColorVar('--digi--color--background--secondary-accent'), "stroke-width": "8" })), h("pattern", { key: '4069999fd742795379f093c83c00cca488b6139c', id: "prognosisHighlight", patternUnits: "userSpaceOnUse", width: "8", height: "8", patternTransform: "rotate(45)" }, h("rect", { key: 'c525ae39e05acf3e7522f1b92feffdfe5221e528', width: "8", height: "8", fill: "white" }), h("line", { key: 'fa183e0678f6f3794e094b97975fe96955b49e0a', x1: "0", y: "0", x2: "0", y2: "12", stroke: this.adjustColor(this.colorFunction(0), 50), "stroke-width": "8" })))), h("div", { key: 'b6e46d7f4701775a177b02a98f46ca40308e9938', class: "topWrapper", ref: (el) => (this.titleDiv = el) }, h("digi-typography", { key: '88d49833d43776a2bc23d7f73bb8cc9442350634', class: "chartTitle", innerHTML: heading }), h("digi-button", { key: '75e2ef09c3f9f91a08b3596d02ad308b244586bb', class: "buttonWrapper tableButton", "af-size": "medium", "af-variation": "function", "af-full-width": "false", onAfOnClick: this.activateTable, afAriaLabel: `Visa tabell ${((_a = this.chartData) === null || _a === void 0 ? void 0 : _a.title) ? (_b = this.chartData) === null || _b === void 0 ? void 0 : _b.title.toLowerCase() : ''}` }, h("digi-icon-table", { key: '7712b56f991bb5214aa3bebb9e380221156b6bbf', slot: "icon" }), "Visa tabell"), h("digi-button", { key: 'b9d442ea0b62303c2bf1018651ce3206063f3b35', style: { display: 'none' }, class: "buttonWrapper chartButton", "af-size": "medium", "af-variation": "function", "af-full-width": "false", onAfOnClick: this.reInitChart, afAriaLabel: `Visa diagram ${((_c = this.chartData) === null || _c === void 0 ? void 0 : _c.title) ? (_d = this.chartData) === null || _d === void 0 ? void 0 : _d.title.toLowerCase() : ''}` }, h("digi-icon-chart", { key: '260c432d04f8ea00216cd485b5ec3a29df4b4db1', slot: "icon" }), "Visa diagram"), h("div", { key: 'a7fd6276b5738e9cf040f0e9b99e983b27ec25cf', class: "scChartStatus", role: "status", ref: (el) => (this.status = el) })), h("div", { key: '705ec9e3931b91009ff565bbd8f4ba300bd8dbd7', class: "svgWrap", ref: (el) => (this.chartDiv = el) }, h("div", { key: '242fd5b7afba36df00aa7fb256bd8578712d25e7', class: "chartTooltip", id: this.afId }, h("div", { key: '6417cc30962396164fe4840ecfef62c4ef7591d6', class: "tooltipHead" }, h("digi-icon-x", { key: 'dc4edb442bfb342fbdb64b06e70f1e19ccc5ffb1', class: "tooltipClose" })), h("div", { key: 'da625c879d4c0eebffa02193dc36d794c755b768', class: "tooltipBody" }), this.afVariation === BarChartVariation.Horizontal ? (h("digi-icon-caret-up", { class: "caret" })) : (h("digi-icon-caret-down", { class: "caret" })))), h("div", { key: 'a003a616c2ee8b848d402b38009261539ebf0c50', class: "legendWrap", ref: (el) => (this.legendDiv = el) }, h("div", { key: '44a6db8daa836ccf910aafd6fd996f153c337bf4', class: "legend" })), h("div", { key: 'a872281035f2799fe8aa9128a953d0c5d9f6b2cc', class: "table", ref: (el) => (this.tableDiv = el) }, ' ')));
1681
+ return (h(Host, { key: '003845ddc03e2027721d5e75c82816faae5bde63', ref: (el) => (this.host = el) }, h("svg", { key: '054049009c8618211f9009961d238992c3d03c0e', xmlns: "http://www.w3.org/2000/svg", width: "0", height: "0" }, h("defs", { key: '16f32628ffd79e24b66e749666eccd6ae283a5b8' }, h("pattern", { key: '8aa5e0923086f740eeb02d71690ed16086205b0a', id: "prognosis", patternUnits: "userSpaceOnUse", width: "8", height: "8", patternTransform: "rotate(45)" }, h("rect", { key: '237569e79095a4a7c084aa91fd637dfbe385ca8b', width: "8", height: "8", fill: "white" }), h("line", { key: '6edeac6a60cef51561c8fd803b2e277b19b740bf', x1: "0", y: "0", x2: "0", y2: "12", stroke: this.evalColorVar(this.colorPalettes[0]), "stroke-width": "8" })), h("pattern", { key: 'bd40402b6fd33d50fc4dca709380108fe054f74c', id: "prognosisInactive", patternUnits: "userSpaceOnUse", width: "8", height: "8", patternTransform: "rotate(45)" }, h("rect", { key: 'a5dcf48112b024982f3410bc51eb05002c8c8dcc', width: "8", height: "8", fill: "white" }), h("line", { key: 'b76b6ae15b8a0ee9c37c28bf3f66613c9df1e9b8', x1: "0", y: "0", x2: "0", y2: "12", stroke: this.evalColorVar('--digi--color--background--secondary-accent'), "stroke-width": "8" })), h("pattern", { key: 'ef4782b914f2599424d5f3e6715cb69c4f0e4728', id: "prognosisHighlight", patternUnits: "userSpaceOnUse", width: "8", height: "8", patternTransform: "rotate(45)" }, h("rect", { key: '6501ba8a46f53b6c3309486d0795d348a8ec1fff', width: "8", height: "8", fill: "white" }), h("line", { key: 'b184212878587e1e15ebf40a472333851270b287', x1: "0", y: "0", x2: "0", y2: "12", stroke: this.adjustColor(this.colorFunction(0), 50), "stroke-width": "8" })))), h("div", { key: '02b5c9c63c327995f9603ffc84ab0455137ff43d', class: "topWrapper", ref: (el) => (this.titleDiv = el) }, h("digi-typography", { key: 'd8944066ab1a86ed71af7de4a018ef422cea75e9', class: "chartTitle", innerHTML: heading }), h("digi-button", { key: '6bc1e5870432720980fc8dad25abc5f2cb474daf', class: "buttonWrapper tableButton", "af-size": "medium", "af-variation": "function", "af-full-width": "false", onAfOnClick: this.activateTable, afAriaLabel: `Visa tabell ${((_a = this.chartData) === null || _a === void 0 ? void 0 : _a.title) ? (_b = this.chartData) === null || _b === void 0 ? void 0 : _b.title.toLowerCase() : ''}` }, h("digi-icon-table", { key: '5a8b44b3a201b4866b89fc4328ff0b46ac47c6e1', slot: "icon" }), "Visa tabell"), h("digi-button", { key: 'cd0d60a025d5fa0e62cb5f6a322cf3f97c0bd02e', style: { display: 'none' }, class: "buttonWrapper chartButton", "af-size": "medium", "af-variation": "function", "af-full-width": "false", onAfOnClick: this.reInitChart, afAriaLabel: `Visa diagram ${((_c = this.chartData) === null || _c === void 0 ? void 0 : _c.title) ? (_d = this.chartData) === null || _d === void 0 ? void 0 : _d.title.toLowerCase() : ''}` }, h("digi-icon-chart", { key: '8f4e4f1bdabffd7ffd1532453b534a823ef65006', slot: "icon" }), "Visa diagram"), h("div", { key: '22535e8bfb69f96152e61295019d463cb69b70c3', class: "scChartStatus", role: "status", ref: (el) => (this.status = el) })), h("div", { key: '55e25140585469497ec501cd133cfc710bb88b43', class: "svgWrap", ref: (el) => (this.chartDiv = el) }, h("div", { key: '4d8cd2eb832770f94fdff5eec2f084e4ba5c96b8', class: "chartTooltip", id: this.afId }, h("div", { key: 'b805b20b746ce940ae5c20ef34898c3409cffecd', class: "tooltipHead" }, h("digi-icon-x", { key: 'c162d2b1e6e7aafddf0ac194705b436a5b02b392', class: "tooltipClose" })), h("div", { key: 'cdc876d4c88f50c7d95c22f4d0f683c2a5564235', class: "tooltipBody" }), this.afVariation === BarChartVariation.Horizontal ? (h("digi-icon-caret-up", { class: "caret" })) : (h("digi-icon-caret-down", { class: "caret" })))), h("div", { key: '8cb986f7466fdb42f6dc840c1371b25978ae4c66', class: "legendWrap", ref: (el) => (this.legendDiv = el) }, h("div", { key: '6761a567c03c8ade4206fb89cf9e7bd792c36e71', class: "legend" })), h("div", { key: 'ac251b6078602f9319447cfaa6444f0129e46c0f', class: "table", ref: (el) => (this.tableDiv = el) }, ' ')));
1632
1682
  }
1633
1683
  static get is() { return "digi-bar-chart"; }
1634
1684
  static get encapsulation() { return "scoped"; }
@@ -3,6 +3,7 @@ import { _t } from "../../../text";
3
3
  import { h } from "@stencil/core";
4
4
  import * as d3 from "d3";
5
5
  import { randomIdGenerator } from "../../../global/utils/randomIdGenerator";
6
+ import { logger } from "../../../global/utils/logger";
6
7
  /**
7
8
  *
8
9
  * @enums myEnum - chart-line-myEnum.enum.ts
@@ -891,14 +892,14 @@ export class ChartLine {
891
892
  });
892
893
  };
893
894
  // Removes resize observer for chart and inits table
894
- this.activateTable = (event) => {
895
+ this.activateTable = () => {
895
896
  this.closeTooltip();
896
897
  this.lineChartObserver.disconnect();
897
898
  this.tableObserver.observe(this._chartDiv);
898
899
  this._status.innerHTML = '<p>Visas som tabell</p>';
899
900
  d3.select(this._host).select('.tableButton').style('display', 'none');
900
901
  d3.select(this._host).select('.chartButton').style('display', null);
901
- event.target.nextSibling.lastChild.focus();
902
+ this.focusHostButton('.chartButton');
902
903
  const duration = 150;
903
904
  this._svg
904
905
  .attr('opacity', 1)
@@ -929,12 +930,12 @@ export class ChartLine {
929
930
  this.setTableDimensions();
930
931
  };
931
932
  // Removes observer and calls init functions for line chart
932
- this.reInitChart = (event) => {
933
+ this.reInitChart = () => {
933
934
  this.tableObserver.disconnect();
934
935
  this._status.innerHTML = '<p>Visas som diagram</p>';
935
936
  d3.select(this._host).select('.tableButton').style('display', null);
936
937
  d3.select(this._host).select('.chartButton').style('display', 'none');
937
- event.target.previousSibling.lastChild.focus();
938
+ this.focusHostButton('.tableButton');
938
939
  const table = d3.select(this._tableDiv);
939
940
  table
940
941
  .style('opacity', 1)
@@ -961,15 +962,40 @@ export class ChartLine {
961
962
  }
962
963
  afChartDataUpdate() {
963
964
  const data = this.afChartData;
964
- if (typeof data === 'object') {
965
- this._chartData = Object.assign({}, data);
965
+ // Angular/React can connect the element before afChartData is set.
966
+ if (data == null || data === '') {
967
+ return;
968
+ }
969
+ try {
970
+ if (typeof data === 'object') {
971
+ this._chartData = Object.assign({}, data);
972
+ }
973
+ else if (typeof data === 'string') {
974
+ this._chartData = JSON.parse(data);
975
+ }
976
+ else {
977
+ return;
978
+ }
979
+ }
980
+ catch (_a) {
981
+ logger.warn(`Invalid JSON in "af-chart-data" attribute`, this.element);
966
982
  return;
967
983
  }
968
- this._chartData = JSON.parse(data);
969
984
  // Making deep copy of this
970
985
  if (this._chartData.data)
971
986
  this._coreSeries = JSON.parse(JSON.stringify(this._chartData.data.series));
972
987
  }
988
+ hasChartData() {
989
+ return !!this._chartData && Object.keys(this._chartData).length > 0;
990
+ }
991
+ focusHostButton(selector) {
992
+ var _a, _b;
993
+ const host = this._host;
994
+ const button = (_b = (_a = host === null || host === void 0 ? void 0 : host.querySelector(selector)) === null || _a === void 0 ? void 0 : _a.querySelector('button')) !== null && _b !== void 0 ? _b : host === null || host === void 0 ? void 0 : host.querySelector(selector);
995
+ if (button && typeof button.focus === 'function') {
996
+ button.focus();
997
+ }
998
+ }
973
999
  initSvg() {
974
1000
  this.margin.bottom =
975
1001
  Number(window
@@ -1439,9 +1465,24 @@ export class ChartLine {
1439
1465
  }
1440
1466
  componentWillLoad() {
1441
1467
  this.afChartDataUpdate();
1468
+ // Angular attaches the host first and binds `[afChartData]` on the next
1469
+ // frame (Stencil 4.36+). @Watch skips that first assignment, so if chart
1470
+ // data is not here yet, wait one frame. React/vanilla that already set
1471
+ // the prop skip the delay.
1472
+ if (!this.hasChartData()) {
1473
+ return new Promise((resolve) => {
1474
+ requestAnimationFrame(() => {
1475
+ this.afChartDataUpdate();
1476
+ resolve();
1477
+ });
1478
+ });
1479
+ }
1442
1480
  }
1443
1481
  componentDidLoad() {
1444
- if (Object.keys(this._chartData).length === 0)
1482
+ if (!this.hasChartData()) {
1483
+ this.afChartDataUpdate();
1484
+ }
1485
+ if (!this.hasChartData())
1445
1486
  return this.initEmpty();
1446
1487
  // clearing selection
1447
1488
  this._selectedLines = [];
@@ -1457,7 +1498,7 @@ export class ChartLine {
1457
1498
  this._prevHeight = d3.select(this._titleDiv).style('height');
1458
1499
  }
1459
1500
  componentDidUpdate() {
1460
- if (Object.keys(this._chartData).length === 0)
1501
+ if (!this.hasChartData())
1461
1502
  return this.loadingState();
1462
1503
  // clearing selection
1463
1504
  this._selectedLines = [];
@@ -1614,11 +1655,13 @@ export class ChartLine {
1614
1655
  }
1615
1656
  render() {
1616
1657
  let heading = '';
1617
- if (!this._chartData.subTitle)
1618
- heading = `<${this.afHeadingLevel}>${this._chartData.title}</${this.afHeadingLevel}>`;
1619
- else
1620
- heading = `<${this.afHeadingLevel}>${this._chartData.title}</${this.afHeadingLevel}><p>${this._chartData.subTitle}</p>`;
1621
- return (h("host", { key: 'a21c09ee91ccabf90f91d2344d301d26710f9a60', ref: (el) => (this._host = el) }, h("div", { key: 'c97af6a0bbc28675a19c843a3c355b35397e5804', class: "topWrapper", ref: (el) => (this._titleDiv = el) }, h("digi-typography", { key: '76085c6924fd317d4a281e93ca4623b85f0fb867', class: "chartTitle", innerHTML: heading }), h("digi-button", { key: '241e30b3094e8eea86c7c24bb2a90f67ea04ef6f', class: "buttonWrapper tableButton", "af-size": "medium", "af-variation": "function", "af-full-width": "false", onAfOnClick: this.activateTable, afAriaLabel: `Visa tabell ${this._chartData.title ? this._chartData.title.toLowerCase() : ''}` }, h("digi-icon-table", { key: '5cc0d03d40d076481d14d0478390b131cdaa61f7', slot: "icon" }), "Visa tabell"), h("digi-button", { key: '241d3e97b9a21f556b3e46cebc63c77ce106d26c', style: { display: 'none' }, class: "buttonWrapper chartButton", "af-size": "medium", "af-variation": "function", "af-full-width": "false", onAfOnClick: this.reInitChart, afAriaLabel: `Visa diagram ${this._chartData.title ? this._chartData.title.toLowerCase() : ''}` }, h("digi-icon-chart", { key: 'f0a5c78bc5e04db994559f2ce1a13c0e7285c36d', slot: "icon" }), "Visa diagram"), h("div", { key: 'f7ebab0f90d1a9f9a306470c93ccaaaf0461a9a7', class: "scChartStatus", role: "status", ref: (el) => (this._status = el) })), h("div", { key: '75672c02d61a14741348dc183782df71f3a4db19', class: "chartTooltip", id: this.afId }, h("div", { key: 'b4e03381d825d68af2bdbf859458896c639b6559', class: "tooltipHead" }, h("digi-icon-x", { key: '1301ab00ff3818e0940e69f17aa09b296c04a86c', class: "close" }), ' '), h("div", { key: 'eb01d362db4495c0a3d4396ad4c71c2a952114ad', class: "tooltipBody" })), h("div", { key: 'accd6776d3db14c662ff84b2e826f6cf713ff38d', class: "chart", ref: (el) => (this._chartDiv = el) }), h("div", { key: '507dfba00c88d5b371fd8304053b9b7762506d25', class: "legend", ref: (el) => (this._legendDiv = el) }), h("div", { key: 'cb3fc091c6a557bfd62e8f7d59863e973da0ee53', class: "table", ref: (el) => (this._tableDiv = el) }, ' ')));
1658
+ if (this._chartData) {
1659
+ if (!this._chartData.subTitle)
1660
+ heading = `<${this.afHeadingLevel}>${this._chartData.title}</${this.afHeadingLevel}>`;
1661
+ else
1662
+ heading = `<${this.afHeadingLevel}>${this._chartData.title}</${this.afHeadingLevel}><p>${this._chartData.subTitle}</p>`;
1663
+ }
1664
+ return (h("host", { key: '93603df9b78fcce8b5735b4a874f879cf7b2326e', ref: (el) => (this._host = el) }, h("div", { key: '094a790864b72bbb9a802b461db06ce312c627c8', class: "topWrapper", ref: (el) => (this._titleDiv = el) }, h("digi-typography", { key: '5f4bd51fdfef816b0e127d1177c60f8310952173', class: "chartTitle", innerHTML: heading }), h("digi-button", { key: '8ae72950c5cf052ed71c2ba4e91b254b8d36cfd0', class: "buttonWrapper tableButton", "af-size": "medium", "af-variation": "function", "af-full-width": "false", onAfOnClick: this.activateTable, afAriaLabel: `Visa tabell ${this._chartData.title ? this._chartData.title.toLowerCase() : ''}` }, h("digi-icon-table", { key: '750f1b621eb0a1a54ec810aa63624237bd98f9ea', slot: "icon" }), "Visa tabell"), h("digi-button", { key: '1cf33daaaa8adf9c5352286d6172d7c258098c29', style: { display: 'none' }, class: "buttonWrapper chartButton", "af-size": "medium", "af-variation": "function", "af-full-width": "false", onAfOnClick: this.reInitChart, afAriaLabel: `Visa diagram ${this._chartData.title ? this._chartData.title.toLowerCase() : ''}` }, h("digi-icon-chart", { key: '9dce5df1a96d4b818597854f7ee238fefda2c686', slot: "icon" }), "Visa diagram"), h("div", { key: '204f5824b2f34b3a1a1401ed4434e1fcb16a2549', class: "scChartStatus", role: "status", ref: (el) => (this._status = el) })), h("div", { key: 'b164f59f1c741db5493af57510eab2987cabefc6', class: "chartTooltip", id: this.afId }, h("div", { key: 'e84bf8a85a745977006d50f296d1afee2ee35698', class: "tooltipHead" }, h("digi-icon-x", { key: '77bcd0342c828dbcbe020a9ffefe4ae6f3086572', class: "close" }), ' '), h("div", { key: '330f69a58082f72b528095ef49a2371fc8b0d8e5', class: "tooltipBody" })), h("div", { key: '62eb27ac8f184476d50332344711ca381e8adf59', class: "chart", ref: (el) => (this._chartDiv = el) }), h("div", { key: 'ad70790d3a2fd5851c4351e41f2436a34169a819', class: "legend", ref: (el) => (this._legendDiv = el) }), h("div", { key: '30d4791a9b808555f03d1830aaec0221c1bc3b37', class: "table", ref: (el) => (this._tableDiv = el) }, ' ')));
1622
1665
  }
1623
1666
  static get is() { return "digi-chart-line"; }
1624
1667
  static get encapsulation() { return "scoped"; }