@designsystem-se/af 39.1.0-beta.2 → 39.1.0-beta.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 (185) hide show
  1. package/components/digi-bar-chart.js +1 -1
  2. package/components/digi-button.js +1 -1
  3. package/components/digi-calendar-week-view.js +2 -2
  4. package/components/digi-chart-line.js +1 -1
  5. package/components/digi-code-block.js +1 -1
  6. package/components/digi-code-example.js +2 -2
  7. package/components/digi-context-menu.js +1 -1
  8. package/components/digi-dialog.js +1 -1
  9. package/components/digi-form-category-filter.js +1 -1
  10. package/components/digi-form-error-list.js +2 -2
  11. package/components/digi-form-file-upload.js +1 -1
  12. package/components/digi-form-filter.js +1 -1
  13. package/components/digi-form-input-search.js +2 -2
  14. package/components/digi-form-select-filter.js +1 -1
  15. package/components/digi-header-navigation.js +1 -1
  16. package/components/digi-header.js +2 -2
  17. package/components/digi-navigation-pagination.js +1 -1
  18. package/components/digi-navigation-sidebar-button.js +1 -1
  19. package/components/digi-navigation-sidebar.js +1 -1
  20. package/components/digi-notification-alert.js +1 -1
  21. package/components/digi-tag.js +1 -1
  22. package/components/digi-tools-feedback-banner.js +7 -2
  23. package/components/digi-tools-feedback.js +1 -1
  24. package/components/p-3IdGnhr5.js +172 -0
  25. package/components/{p-DDZ0nalw.js → p-B-hL6z4l.js} +1 -1
  26. package/components/{p-Dq9EWvk8.js → p-BOM-CTrq.js} +1 -1
  27. package/components/{p-C32dTT4K.js → p-BZkK1uIs.js} +1 -1
  28. package/dist/cjs/button-type.enum-2UH0KkO-.js +8 -0
  29. package/dist/cjs/{button-variation.enum-DkUalo9f.js → button-variation.enum-ngMqFLdW.js} +6 -0
  30. package/dist/cjs/{code-example-variation.enum-BCENTUV2.js → code-example-variation.enum-Cq-BioXW.js} +0 -6
  31. package/dist/cjs/digi-arbetsformedlingen.cjs.js +1 -1
  32. package/dist/cjs/{digi-calendar-week-view.cjs.entry.js → digi-button_5.cjs.entry.js} +260 -72
  33. package/dist/cjs/digi-calendar-datepicker.cjs.entry.js +10 -6
  34. package/dist/cjs/digi-code-block_3.cjs.entry.js +10 -6
  35. package/dist/cjs/digi-code-example.cjs.entry.js +4 -4
  36. package/dist/cjs/digi-dialog.cjs.entry.js +10 -6
  37. package/dist/cjs/digi-footer.cjs.entry.js +9 -5
  38. package/dist/cjs/digi-form-error-list.cjs.entry.js +9 -5
  39. package/dist/cjs/digi-form-file-upload.cjs.entry.js +11 -10
  40. package/dist/cjs/digi-form-input-search.cjs.entry.js +9 -7
  41. package/dist/cjs/digi-form-input.cjs.entry.js +205 -0
  42. package/dist/cjs/digi-form-label_3.cjs.entry.js +147 -0
  43. package/dist/cjs/digi-form-receipt.cjs.entry.js +9 -5
  44. package/dist/cjs/digi-form-select-filter.cjs.entry.js +649 -0
  45. package/dist/cjs/digi-header-navigation.cjs.entry.js +9 -5
  46. package/dist/cjs/digi-header.cjs.entry.js +9 -5
  47. package/dist/cjs/digi-icon-check.cjs.entry.js +28 -0
  48. package/dist/cjs/digi-icon-chevron-down.cjs.entry.js +28 -0
  49. package/dist/cjs/digi-icon-validation-error_2.cjs.entry.js +51 -0
  50. package/dist/cjs/digi-navigation-pagination.cjs.entry.js +9 -5
  51. package/dist/cjs/digi-notification-alert.cjs.entry.js +9 -5
  52. package/dist/cjs/digi-notification-error-page.cjs.entry.js +9 -5
  53. package/dist/cjs/digi-title-logo.cjs.entry.js +9 -5
  54. package/dist/cjs/digi-tools-feedback-banner.cjs.entry.js +7 -2
  55. package/dist/cjs/digi-tools-feedback.cjs.entry.js +11 -7
  56. package/dist/cjs/digi-util-keydown-handler.cjs.entry.js +81 -0
  57. package/dist/cjs/{form-validation-message-variation.enum-DgkifAnP.js → form-file-upload-variation.enum-xcEOoggr.js} +0 -7
  58. package/dist/cjs/form-input-search-variation.enum-VVfvlVeM.js +8 -0
  59. package/dist/cjs/{form-input-type.enum-B2CsNSBg.js → form-input-type.enum-DvF_MTHK.js} +0 -14
  60. package/dist/cjs/form-input-variation.enum-kpoXNUuI.js +29 -0
  61. package/dist/cjs/form-validation-message-variation.enum-BA5nmCiw.js +8 -0
  62. package/dist/cjs/index-tbq85ezH.js +26 -10
  63. package/dist/cjs/index.cjs.js +52 -48
  64. package/dist/cjs/loader.cjs.js +1 -1
  65. package/dist/cjs/{typography-variation.enum-4snUBTF7.js → typography-variation.enum-BDSt7CVI.js} +0 -28
  66. package/dist/collection/components/_button/button/button.css +23 -0
  67. package/dist/collection/components/_calendar/week-view/calendar-week-view.css +36 -47
  68. package/dist/collection/components/_form/form-file-upload/form-file-upload.css +11 -15
  69. package/dist/collection/components/_form/form-input-search/form-input-search.css +0 -4
  70. package/dist/collection/components/_tools/tools-feedback-banner/tools-feedback-banner.js +7 -2
  71. package/dist/collection/design-tokens/components/_button.variables.scss +6 -0
  72. package/dist/collection/design-tokens/components/_logo.variables.scss +17 -15
  73. package/dist/digi-arbetsformedlingen/design-tokens/components/_button.variables.scss +6 -0
  74. package/dist/digi-arbetsformedlingen/digi-arbetsformedlingen.esm.js +1 -1
  75. package/dist/digi-arbetsformedlingen/index.esm.js +1 -1
  76. package/dist/digi-arbetsformedlingen/p-0a993ca4.entry.js +1 -0
  77. package/dist/digi-arbetsformedlingen/p-0b0009eb.entry.js +1 -0
  78. package/dist/digi-arbetsformedlingen/p-21853656.entry.js +1 -0
  79. package/dist/digi-arbetsformedlingen/p-23d8d58c.entry.js +1 -0
  80. package/dist/digi-arbetsformedlingen/p-28f335d8.entry.js +1 -0
  81. package/dist/digi-arbetsformedlingen/p-2f65802b.entry.js +1 -0
  82. package/dist/digi-arbetsformedlingen/{p-77d355fe.entry.js → p-4336cdff.entry.js} +1 -1
  83. package/dist/digi-arbetsformedlingen/p-4c9a428d.entry.js +1 -0
  84. package/dist/digi-arbetsformedlingen/p-4ee14c12.entry.js +1 -0
  85. package/dist/digi-arbetsformedlingen/p-4smNltRI.js +1 -0
  86. package/dist/digi-arbetsformedlingen/p-5c7e6e61.entry.js +1 -0
  87. package/dist/digi-arbetsformedlingen/p-60928fb0.entry.js +1 -0
  88. package/dist/digi-arbetsformedlingen/p-68e721b1.entry.js +1 -0
  89. package/dist/digi-arbetsformedlingen/p-7da0451b.entry.js +1 -0
  90. package/dist/digi-arbetsformedlingen/p-87e306b0.entry.js +1 -0
  91. package/dist/digi-arbetsformedlingen/p-8848ce2b.entry.js +1 -0
  92. package/dist/digi-arbetsformedlingen/p-91a0e1ca.entry.js +1 -0
  93. package/dist/digi-arbetsformedlingen/p-9d3da044.entry.js +1 -0
  94. package/dist/digi-arbetsformedlingen/p-B8hpiXmh.js +1 -0
  95. package/dist/digi-arbetsformedlingen/p-BMQm4N5I.js +1 -0
  96. package/dist/digi-arbetsformedlingen/p-BSJH8Lpg.js +1 -0
  97. package/dist/digi-arbetsformedlingen/p-BfyJgcLA.js +1 -0
  98. package/dist/digi-arbetsformedlingen/p-BvWKyXb_.js +1 -0
  99. package/dist/digi-arbetsformedlingen/p-DGI7Jkg2.js +1 -0
  100. package/dist/digi-arbetsformedlingen/p-DShzaNrQ.js +1 -0
  101. package/dist/digi-arbetsformedlingen/p-DfWZa2Wv.js +1 -0
  102. package/dist/digi-arbetsformedlingen/p-a563f0f4.entry.js +1 -0
  103. package/dist/digi-arbetsformedlingen/p-ad7e2dc6.entry.js +1 -0
  104. package/dist/digi-arbetsformedlingen/p-beab4698.entry.js +1 -0
  105. package/dist/digi-arbetsformedlingen/p-c9c140af.entry.js +1 -0
  106. package/dist/digi-arbetsformedlingen/p-d62e264c.entry.js +1 -0
  107. package/dist/digi-arbetsformedlingen/p-ef47f143.entry.js +1 -0
  108. package/dist/digi-arbetsformedlingen/p-f9a2a80e.entry.js +1 -0
  109. package/dist/digi-arbetsformedlingen/p-feaeab97.entry.js +1 -0
  110. package/dist/digi-arbetsformedlingen/{p-DbBOgLZR.js → p-xwICssEK.js} +1 -1
  111. package/dist/esm/button-type.enum-DShzaNrQ.js +8 -0
  112. package/dist/esm/{button-variation.enum-y5Nm4oWF.js → button-variation.enum-BMQm4N5I.js} +7 -1
  113. package/dist/esm/{code-example-variation.enum-Ooszw6tl.js → code-example-variation.enum-DGI7Jkg2.js} +1 -7
  114. package/dist/esm/digi-arbetsformedlingen.js +1 -1
  115. package/dist/esm/{digi-calendar-week-view.entry.js → digi-button_5.entry.js} +190 -6
  116. package/dist/esm/digi-calendar-datepicker.entry.js +10 -6
  117. package/dist/esm/digi-code-block_3.entry.js +9 -5
  118. package/dist/esm/digi-code-example.entry.js +2 -2
  119. package/dist/esm/digi-dialog.entry.js +9 -5
  120. package/dist/esm/digi-footer.entry.js +9 -5
  121. package/dist/esm/digi-form-error-list.entry.js +9 -5
  122. package/dist/esm/digi-form-file-upload.entry.js +3 -2
  123. package/dist/esm/digi-form-input-search.entry.js +4 -2
  124. package/dist/esm/digi-form-input.entry.js +203 -0
  125. package/dist/esm/digi-form-label_3.entry.js +143 -0
  126. package/dist/esm/digi-form-receipt.entry.js +9 -5
  127. package/dist/esm/digi-form-select-filter.entry.js +647 -0
  128. package/dist/esm/digi-header-navigation.entry.js +9 -5
  129. package/dist/esm/digi-header.entry.js +9 -5
  130. package/dist/esm/digi-icon-check.entry.js +26 -0
  131. package/dist/esm/digi-icon-chevron-down.entry.js +26 -0
  132. package/dist/esm/digi-icon-validation-error_2.entry.js +48 -0
  133. package/dist/esm/digi-navigation-pagination.entry.js +9 -5
  134. package/dist/esm/digi-notification-alert.entry.js +9 -5
  135. package/dist/esm/digi-notification-error-page.entry.js +9 -5
  136. package/dist/esm/digi-title-logo.entry.js +9 -5
  137. package/dist/esm/digi-tools-feedback-banner.entry.js +7 -2
  138. package/dist/esm/digi-tools-feedback.entry.js +9 -5
  139. package/dist/esm/digi-util-keydown-handler.entry.js +79 -0
  140. package/dist/esm/{form-validation-message-variation.enum-9n7Okhf1.js → form-file-upload-variation.enum-BfyJgcLA.js} +1 -8
  141. package/dist/esm/form-input-search-variation.enum-BvWKyXb_.js +8 -0
  142. package/dist/esm/{form-input-type.enum-CN1mgrt1.js → form-input-type.enum-BSJH8Lpg.js} +1 -15
  143. package/dist/esm/form-input-variation.enum-DfWZa2Wv.js +29 -0
  144. package/dist/esm/form-validation-message-variation.enum-B8hpiXmh.js +8 -0
  145. package/dist/esm/{index-DnTiPaEs.js → index-B1Je6g2n.js} +1 -1
  146. package/dist/esm/index-Co_lVhh_.js +26 -10
  147. package/dist/esm/index.js +9 -5
  148. package/dist/esm/loader.js +1 -1
  149. package/dist/esm/{typography-variation.enum-BDBYHWrh.js → typography-variation.enum-4smNltRI.js} +1 -29
  150. package/dist/types/components/_tools/tools-feedback-banner/tools-feedback-banner.d.ts +1 -0
  151. package/hydrate/index.js +11 -6
  152. package/hydrate/index.mjs +11 -6
  153. package/package.json +1 -1
  154. package/components/p--RxphPe_.js +0 -172
  155. package/dist/cjs/digi-button_11.cjs.entry.js +0 -1274
  156. package/dist/cjs/digi-icon-chevron-left_2.cjs.entry.js +0 -51
  157. package/dist/cjs/digi-typography.cjs.entry.js +0 -22
  158. package/dist/digi-arbetsformedlingen/p-0dc8c1f1.entry.js +0 -1
  159. package/dist/digi-arbetsformedlingen/p-14d011c8.entry.js +0 -1
  160. package/dist/digi-arbetsformedlingen/p-31d3b121.entry.js +0 -1
  161. package/dist/digi-arbetsformedlingen/p-38d6c196.entry.js +0 -1
  162. package/dist/digi-arbetsformedlingen/p-44c16261.entry.js +0 -1
  163. package/dist/digi-arbetsformedlingen/p-45f30e15.entry.js +0 -1
  164. package/dist/digi-arbetsformedlingen/p-478dd735.entry.js +0 -1
  165. package/dist/digi-arbetsformedlingen/p-591509af.entry.js +0 -1
  166. package/dist/digi-arbetsformedlingen/p-8c4b642e.entry.js +0 -1
  167. package/dist/digi-arbetsformedlingen/p-8fb4e6a3.entry.js +0 -1
  168. package/dist/digi-arbetsformedlingen/p-93367afb.entry.js +0 -1
  169. package/dist/digi-arbetsformedlingen/p-9n7Okhf1.js +0 -1
  170. package/dist/digi-arbetsformedlingen/p-BDBYHWrh.js +0 -1
  171. package/dist/digi-arbetsformedlingen/p-CN1mgrt1.js +0 -1
  172. package/dist/digi-arbetsformedlingen/p-Ooszw6tl.js +0 -1
  173. package/dist/digi-arbetsformedlingen/p-aaeddc10.entry.js +0 -1
  174. package/dist/digi-arbetsformedlingen/p-ab84eed8.entry.js +0 -1
  175. package/dist/digi-arbetsformedlingen/p-bd635299.entry.js +0 -1
  176. package/dist/digi-arbetsformedlingen/p-c273763e.entry.js +0 -1
  177. package/dist/digi-arbetsformedlingen/p-c73ddbe2.entry.js +0 -1
  178. package/dist/digi-arbetsformedlingen/p-cd90ab0b.entry.js +0 -1
  179. package/dist/digi-arbetsformedlingen/p-cfe0bcf9.entry.js +0 -1
  180. package/dist/digi-arbetsformedlingen/p-d441cad3.entry.js +0 -1
  181. package/dist/digi-arbetsformedlingen/p-fd330ef0.entry.js +0 -1
  182. package/dist/digi-arbetsformedlingen/p-y5Nm4oWF.js +0 -1
  183. package/dist/esm/digi-button_11.entry.js +0 -1262
  184. package/dist/esm/digi-icon-chevron-left_2.entry.js +0 -48
  185. package/dist/esm/digi-typography.entry.js +0 -20
@@ -1,1274 +0,0 @@
1
- 'use strict';
2
-
3
- var index = require('./index-tbq85ezH.js');
4
- var randomIdGenerator_util = require('./randomIdGenerator.util-C8XR2Tn1.js');
5
- var codeExampleVariation_enum = require('./code-example-variation.enum-BCENTUV2.js');
6
- var formInputType_enum = require('./form-input-type.enum-B2CsNSBg.js');
7
- var buttonVariation_enum = require('./button-variation.enum-DkUalo9f.js');
8
- var typographyVariation_enum = require('./typography-variation.enum-4snUBTF7.js');
9
- var logger_util = require('./logger.util-DUhrcCTY.js');
10
- var text = require('./text-Cu3CaHGj.js');
11
- var detectClickOutside_util = require('./detectClickOutside.util-DKR8Sdiw.js');
12
- var detectFocusOutside_util = require('./detectFocusOutside.util-BNHrXMJ2.js');
13
- require('./badge-notification-shape.enum-CEyEo2G5.js');
14
- require('./badge-status-variation.enum-XX8d--rj.js');
15
- require('./calendar-week-view-heading-level.enum-NEkm5SUq.js');
16
- require('./bar-chart-variation.enum-BZFN4377.js');
17
- require('./code-variation.enum-BM-hhQuD.js');
18
- require('./expandable-accordion-header-level.enum-CjL9V3Kt.js');
19
- require('./expandable-faq-item-variation.enum-aKkYAQgd.js');
20
- require('./expandable-faq-variation.enum-FEybT9s4.js');
21
- require('./footer-card-variation.enum-BPnpkC45.js');
22
- require('./form-checkbox-variation.enum-BfOGU4Qt.js');
23
- var formValidationMessageVariation_enum = require('./form-validation-message-variation.enum-DgkifAnP.js');
24
- require('./form-radiogroup-validation.enum-DBDbjF6N.js');
25
- require('./form-select-variation.enum-e6wjWyaS.js');
26
- require('./form-textarea-variation.enum-BcEyaR5W.js');
27
- require('./info-card-multi-type.enum-pqhvdrsN.js');
28
- require('./info-card-variation.enum-B1cqmknX.js');
29
- require('./layout-container-max-width.enum-DqWtU7WK.js');
30
- require('./layout-block-variation.enum-BldWvnDk.js');
31
- require('./layout-columns-variation.enum-OgD-hvRN.js');
32
- require('./link-button-variation.enum-03cHZQxx.js');
33
- require('./list-type.enum-CkFOn-eB.js');
34
- require('./loader-skeleton-variation.enum-UvPtdesw.js');
35
- require('./loader-spinner-size.enum-u5AQs-UJ.js');
36
- require('./logo-color.enum-BJZv-f6R.js');
37
- require('./media-figure-alignment.enum-BWO1sg67.js');
38
- require('./navigation-sidebar-variation.enum-70NIGQoi.js');
39
- require('./navigation-vertical-menu-variation.enum-7IUICId3.js');
40
- require('./progress-circle-role.enum-DCkczyl8.js');
41
- require('./progress-indicator-variation.enum-3KORUGDH.js');
42
- require('./progress-list-item-variation.enum-Dk3YS--x.js');
43
- require('./progress-list-variation.enum-BvLLJK9O.js');
44
- require('./progressbar-variation.enum-CnRJPSs7.js');
45
- require('./quote-image-inner-position.enum-CLifVlj0.js');
46
- require('./table-variation.enum-DlDZKXbq.js');
47
- require('./tag-media-icon.enum-DzhiwvjI.js');
48
- require('./tag-size.enum-DFom3Smn.js');
49
- require('./tools-feedback-banner-type.enum-Dyeg3XNb.js');
50
- require('./tools-feedback-rating-variation.enum-CBI4GhXs.js');
51
- require('./tools-theme-provider.brand.enum-BzduvCUY.js');
52
- require('./typography-heading-jumbo-variation.enum-Di1Jeh0G.js');
53
- require('./typography-meta-variation.enum-lvDemnSz.js');
54
- require('./typography-time-variation.enum-D2gIVzYH.js');
55
- require('./util-breakpoint-observer-breakpoints.enum-zoJiezkV.js');
56
- var keyboardHandler_util = require('./keyboardHandler.util-Co9WoNpM.js');
57
- require('./detectClosest.util-D1z809xM.js');
58
-
59
- const buttonCss = () => `.sc-digi-button-h{--digi--button--color--background--primary--default:var(--digi--color--background--interactive--default--primary);--digi--button--color--background--primary--hover:var(--digi--color--background--interactive--hover--primary);--digi--button--color--background--primary--focus:var(--digi--color--background--interactive--hover--primary);--digi--button--color--background--primary--active:var(--digi--color--background--interactive--hover--primary);--digi--button--color--background--secondary--default:var(--digi--color--background--interactive--default--secondary);--digi--button--color--background--secondary--hover:var(--digi--color--background--interactive--hover--secondary);--digi--button--color--background--secondary--focus:var(--digi--color--background--interactive--hover--secondary);--digi--button--color--background--secondary--active:var(--digi--color--background--interactive--hover--secondary);--digi--button--color--background--function--default:transparent;--digi--button--color--background--function--hover:transparent;--digi--button--color--background--function--focus:transparent;--digi--button--color--background--function--active:transparent;--digi--button--color--text--primary--default:var(--digi--color--text--interactive--secondary);--digi--button--color--text--primary--hover:var(--digi--color--text--interactive--secondary);--digi--button--color--text--primary--focus:var(--digi--color--text--interactive--secondary);--digi--button--color--text--primary--active:var(--digi--color--text--interactive--secondary);--digi--button--color--text--secondary--default:var(--digi--color--text--interactive--brand-primary);--digi--button--color--text--secondary--hover:var(--digi--color--text--interactive--brand-primary);--digi--button--color--text--secondary--focus:var(--digi--color--text--interactive--brand-primary);--digi--button--color--text--secondary--active:var(--digi--color--text--interactive--brand-primary);--digi--button--color--text--function--default:var(--digi--color--text--interactive--primary);--digi--button--color--text--function--hover:var(--digi--color--text--interactive--primary);--digi--button--color--text--function--focus:var(--digi--color--text--interactive--primary);--digi--button--color--text--function--active:var(--digi--color--text--interactive--primary);--digi--button--color--border--primary--default:var(--digi--color--background--interactive--default--primary);--digi--button--color--border--primary--hover:var(--digi--color--background--interactive--hover--primary);--digi--button--color--border--primary--focus:var(--digi--color--background--interactive--default--primary);--digi--button--color--border--primary--active:var(--digi--color--background--interactive--default--primary);--digi--button--color--border--secondary--default:var(--digi--color--border--interactive--default--primary);--digi--button--color--border--secondary--hover:var(--digi--color--border--interactive--hover--secondary);--digi--button--color--border--secondary--focus:var(--digi--color--border--interactive--default--primary);--digi--button--color--border--secondary--active:var(--digi--color--border--interactive--default--primary);--digi--button--color--border--function--default:initial;--digi--button--color--border--function--hover:initial;--digi--button--color--border--function--focus:initial;--digi--button--color--border--function--active:initial;--digi--button--color--icon--primary--default:var(--digi--color--icon--secondary);--digi--button--color--icon--primary--hover:var(--digi--color--icon--secondary);--digi--button--color--icon--primary--focus:var(--digi--color--icon--secondary);--digi--button--color--icon--primary--active:var(--digi--color--icon--secondary);--digi--button--color--icon--secondary--default:var(--digi--color--icon--brand-primary);--digi--button--color--icon--secondary--hover:var(--digi--color--icon--brand-primary);--digi--button--color--icon--secondary--focus:var(--digi--color--icon--brand-primary);--digi--button--color--icon--secondary--active:var(--digi--color--icon--brand-primary);--digi--button--color--icon--function--default:var(--digi--color--icon--cta);--digi--button--color--icon--function--hover:var(--digi--color--icon--cta);--digi--button--color--icon--function--focus:var(--digi--color--icon--cta);--digi--button--color--icon--function--active:var(--digi--color--icon--cta);--digi--button--border-width--primary--default:var(--digi--border-width--primary);--digi--button--border-width--primary--hover:var(--digi--border-width--primary);--digi--button--border-width--secondary--default:var(--digi--border-width--primary);--digi--button--border-width--secondary--hover:var(--digi--border-width--primary);--digi--button--border-width--function--default:initial;--digi--button--border-width--function--hover:initial;--digi--button--border-style--primary--default:var(--digi--border-style--primary);--digi--button--border-style--primary--hover:var(--digi--border-style--primary);--digi--button--border-style--primary--focus:var(--digi--border-style--primary);--digi--button--border-style--primary--active:var(--digi--border-style--primary);--digi--button--border-style--secondary--default:var(--digi--border-style--primary);--digi--button--border-style--secondary--hover:var(--digi--border-style--primary);--digi--button--border-style--secondary--focus:var(--digi--border-style--primary);--digi--button--border-style--secondary--active:var(--digi--border-style--primary);--digi--button--border-style--function--default:var(--digi--border-style--secondary);--digi--button--border-style--function--hover:var(--digi--border-style--secondary);--digi--button--border-style--function--focus:var(--digi--border-style--secondary);--digi--button--border-style--function--active:var(--digi--border-style--secondary);--digi--button--border-radius--primary--default:var(--digi--border-radius--secondary);--digi--button--border-radius--primary--hover:var(--digi--border-radius--secondary);--digi--button--border-radius--primary--focus:var(--digi--border-radius--secondary);--digi--button--border-radius--primary--active:var(--digi--border-radius--secondary);--digi--button--border-radius--secondary--default:var(--digi--border-radius--secondary);--digi--button--border-radius--secondary--hover:var(--digi--border-radius--secondary);--digi--button--border-radius--secondary--focus:var(--digi--border-radius--secondary);--digi--button--border-radius--secondary--active:var(--digi--border-radius--secondary);--digi--button--border-radius--function--default:initial;--digi--button--border-radius--function--hover:initial;--digi--button--border-radius--function--focus:initial;--digi--button--border-radius--function--active:initial;--digi--button--padding--small:var(--digi--gutter--button-block-small) var(--digi--gutter--button-inline-small);--digi--button--padding--medium:var(--digi--gutter--button-block-medium) var(--digi--gutter--button-inline-medium);--digi--button--font-size--small:var(--digi--global--typography--font-size--interaction-small);--digi--button--font-size--medium:var(--digi--global--typography--font-size--interaction-medium);--digi--button--font-family:var(--digi--global--typography--font-family--default);--digi--button--font-weight--default:var(--digi--typography--button--font-weight--desktop);--digi--button--font-weight--function:var(--digi--typography--label--font-weight--desktop);--digi--button--width:initial;--digi--button--display:initial;--digi--button--justify-content--default:initial;--digi--button--justify-content--full-width:center;--digi--button--align-items:center;--digi--button--text-align--default:initial;--digi--button--text-align--full-width:center;--digi--button--outline--default:initial;--digi--button--outline--focus:initial;--digi--button--cursor:pointer;--digi--button--icon--spacing:var(--digi--gutter--large);--digi--button--min-height--small:unset}.sc-digi-button-h .digi-button--variation-primary.sc-digi-button{--COLOR--BACKGROUND--DEFAULT:var(--digi--button--color--background--primary--default);--COLOR--BACKGROUND--HOVER:var(--digi--button--color--background--primary--hover);--COLOR--BACKGROUND--FOCUS:var(--digi--button--color--background--primary--focus);--COLOR--BACKGROUND--ACTIVE:var(--digi--button--color--background--primary--active);--COLOR--TEXT--DEFAULT:var(--digi--button--color--text--primary--default);--COLOR--TEXT--HOVER:var(--digi--button--color--text--primary--hover);--COLOR--TEXT--FOCUS:var(--digi--button--color--text--primary--focus);--COLOR--TEXT--ACTIVE:var(--digi--button--color--text--primary--active);--COLOR--ICON--DEFAULT:var(--digi--button--color--icon--primary--default);--COLOR--ICON--HOVER:var(--digi--button--color--icon--primary--hover);--COLOR--ICON--FOCUS:var(--digi--button--color--icon--primary--focus);--COLOR--ICON--ACTIVE:var(--digi--button--color--icon--primary--active);--COLOR--BORDER--DEFAULT:var(--digi--button--color--border--primary--default);--COLOR--BORDER--HOVER:var(--digi--button--color--border--primary--hover);--COLOR--BORDER--FOCUS:var(--digi--button--color--border--primary--focus);--COLOR--BORDER--ACTIVE:var(--digi--button--color--border--primary--active);--BORDER-RADIUS--DEFAULT:var(--digi--button--border-radius--primary--default);--BORDER-RADIUS--HOVER:var(--digi--button--border-radius--primary--hover);--BORDER-RADIUS--FOCUS:var(--digi--button--border-radius--primary--focus);--BORDER-RADIUS--ACTIVE:var(--digi--button--border-radius--primary--active);--BORDER-WIDTH--DEFAULT:var(--digi--button--border-width--primary--default);--BORDER-WIDTH--HOVER:var(--digi--button--border-width--primary--hover);--BORDER-WIDTH--FOCUS:var(--digi--button--border-width--primary--focus);--BORDER-WIDTH--ACTIVE:var(--digi--button--border-width--primary--active);--BORDER-STYLE--DEFAULT:var(--digi--button--border-style--primary--default);--BORDER-STYLE--HOVER:var(--digi--button--border-style--primary--hover);--BORDER-STYLE--FOCUS:var(--digi--button--border-style--primary--focus);--BORDER-STYLE--ACTIVE:var(--digi--button--border-style--primary--active);--FONT-WEIGHT:var(--digi--button--font-weight--default)}.sc-digi-button-h .digi-button--variation-secondary.sc-digi-button{--COLOR--BACKGROUND--DEFAULT:var(--digi--button--color--background--secondary--default);--COLOR--BACKGROUND--HOVER:var(--digi--button--color--background--secondary--hover);--COLOR--BACKGROUND--FOCUS:var(--digi--button--color--background--secondary--focus);--COLOR--BACKGROUND--ACTIVE:var(--digi--button--color--background--secondary--active);--COLOR--TEXT--DEFAULT:var(--digi--button--color--text--secondary--default);--COLOR--TEXT--HOVER:var(--digi--button--color--text--secondary--hover);--COLOR--TEXT--FOCUS:var(--digi--button--color--text--secondary--focus);--COLOR--TEXT--ACTIVE:var(--digi--button--color--text--secondary--active);--COLOR--ICON--DEFAULT:var(--digi--button--color--icon--secondary--default);--COLOR--ICON--HOVER:var(--digi--button--color--icon--secondary--hover);--COLOR--ICON--FOCUS:var(--digi--button--color--icon--secondary--focus);--COLOR--ICON--ACTIVE:var(--digi--button--color--icon--secondary--active);--COLOR--BORDER--DEFAULT:var(--digi--button--color--border--secondary--default);--COLOR--BORDER--HOVER:var(--digi--button--color--border--secondary--hover);--COLOR--BORDER--FOCUS:var(--digi--button--color--border--secondary--focus);--COLOR--BORDER--ACTIVE:var(--digi--button--color--border--secondary--active);--BORDER-RADIUS--DEFAULT:var(--digi--button--border-radius--secondary--default);--BORDER-RADIUS--HOVER:var(--digi--button--border-radius--secondary--hover);--BORDER-RADIUS--FOCUS:var(--digi--button--border-radius--secondary--focus);--BORDER-RADIUS--ACTIVE:var(--digi--button--border-radius--secondary--active);--BORDER-WIDTH--DEFAULT:var(--digi--button--border-width--secondary--default);--BORDER-WIDTH--HOVER:var(--digi--button--border-width--secondary--hover);--BORDER-WIDTH--FOCUS:var(--digi--button--border-width--secondary--focus);--BORDER-WIDTH--ACTIVE:var(--digi--button--border-width--secondary--active);--BORDER-STYLE--DEFAULT:var(--digi--button--border-style--secondary--default);--BORDER-STYLE--HOVER:var(--digi--button--border-style--secondary--hover);--BORDER-STYLE--FOCUS:var(--digi--button--border-style--secondary--focus);--BORDER-STYLE--ACTIVE:var(--digi--button--border-style--secondary--active);--FONT-WEIGHT:var(--digi--button--font-weight--default)}.sc-digi-button-h .digi-button--variation-function.sc-digi-button{--COLOR--BACKGROUND--DEFAULT:var(--digi--button--color--background--function--default);--COLOR--BACKGROUND--HOVER:var(--digi--button--color--background--function--hover);--COLOR--BACKGROUND--FOCUS:var(--digi--button--color--background--function--focus);--COLOR--BACKGROUND--ACTIVE:var(--digi--button--color--background--function--active);--COLOR--TEXT--DEFAULT:var(--digi--button--color--text--function--default);--COLOR--TEXT--HOVER:var(--digi--button--color--text--function--hover);--COLOR--TEXT--FOCUS:var(--digi--button--color--text--function--focus);--COLOR--TEXT--ACTIVE:var(--digi--button--color--text--function--active);--COLOR--ICON--DEFAULT:var(--digi--button--color--icon--function--default);--COLOR--ICON--HOVER:var(--digi--button--color--icon--function--hover);--COLOR--ICON--FOCUS:var(--digi--button--color--icon--function--focus);--COLOR--ICON--ACTIVE:var(--digi--button--color--icon--function--active);--COLOR--BORDER--DEFAULT:var(--digi--button--color--border--function--default);--COLOR--BORDER--HOVER:var(--digi--button--color--border--function--hover);--COLOR--BORDER--FOCUS:var(--digi--button--color--border--function--focus);--COLOR--BORDER--ACTIVE:var(--digi--button--color--border--function--active);--BORDER-RADIUS--DEFAULT:var(--digi--button--border-radius--function--default);--BORDER-RADIUS--HOVER:var(--digi--button--border-radius--function--hover);--BORDER-RADIUS--FOCUS:var(--digi--button--border-radius--function--focus);--BORDER-RADIUS--ACTIVE:var(--digi--button--border-radius--function--active);--BORDER-WIDTH--DEFAULT:var(--digi--button--border-width--function--default);--BORDER-WIDTH--HOVER:var(--digi--button--border-width--function--hover);--BORDER-WIDTH--FOCUS:var(--digi--button--border-width--function--focus);--BORDER-WIDTH--ACTIVE:var(--digi--button--border-width--function--active);--BORDER-STYLE--DEFAULT:var(--digi--button--border-style--function--default);--BORDER-STYLE--HOVER:var(--digi--button--border-style--function--hover);--BORDER-STYLE--FOCUS:var(--digi--button--border-style--function--focus);--BORDER-STYLE--ACTIVE:var(--digi--button--border-style--function--active);--FONT-WEIGHT:var(--digi--button--font-weight--function)}.sc-digi-button-h .digi-button--variation-function.sc-digi-button:hover,.sc-digi-button-h .digi-button--variation-function.sc-digi-button:focus{text-decoration:underline}.sc-digi-button-h .digi-button--size-small.sc-digi-button{--FONT-SIZE:var(--digi--button--font-size--small);--PADDING:var(--digi--button--padding--small);--MIN-HEIGHT:var(--digi--button--min-height--small)}.sc-digi-button-h .digi-button--size-medium.sc-digi-button{--FONT-SIZE:var(--digi--button--font-size--medium);--PADDING:var(--digi--button--padding--medium);--MIN-HEIGHT:var(--digi--button--min-height--small)}.sc-digi-button-h .digi-button.sc-digi-button-s>[slot^=icon],.sc-digi-button-h .digi-button .sc-digi-button-s>[slot^=icon]{--digi--icon--height:1em;--digi--icon--width:1em;--digi--icon--color:var(--COLOR--ICON--DEFAULT);min-height:0}.sc-digi-button-h .digi-button.sc-digi-button{font-family:var(--digi--button--font-family);background:var(--COLOR--BACKGROUND--DEFAULT);color:var(--COLOR--TEXT--DEFAULT);padding:var(--PADDING);border-radius:var(--BORDER-RADIUS--DEFAULT);border-width:var(--BORDER-WIDTH--DEFAULT);border-style:var(--BORDER-STYLE--DEFAULT);border-color:var(--COLOR--BORDER--DEFAULT);font-weight:var(--FONT-WEIGHT);font-size:var(--FONT-SIZE);outline:var(--digi--button--outline--default);text-align:var(--digi--button--text-align--default);width:var(--digi--button--width);display:var(--digi--button--display);justify-content:var(--digi--button--justify-content--default);cursor:var(--digi--button--cursor);min-height:var(--MIN-HEIGHT);align-items:var(--digi--button--align-items);white-space:nowrap}@media (any-hover: hover){.sc-digi-button-h .digi-button.sc-digi-button:hover{background:var(--COLOR--BACKGROUND--HOVER);border-radius:var(--BORDER-RADIUS--HOVER);border-width:var(--BORDER-WIDTH--HOVER);border-style:var(--BORDER-STYLE--HOVER);border-color:var(--COLOR--BORDER--HOVER);color:var(--COLOR--TEXT--HOVER)}.sc-digi-button-h .digi-button:hover.sc-digi-button-s>[slot^=icon],.sc-digi-button-h .digi-button:hover .sc-digi-button-s>[slot^=icon]{--digi--icon--color:var(--COLOR--ICON--HOVER)}}.sc-digi-button-h .digi-button.sc-digi-button:focus-visible{background:var(--COLOR--BACKGROUND--FOCUS);color:var(--COLOR--TEXT--FOCUS);border-style:var(--BORDER-STYLE--FOCUS);border-color:var(--COLOR--BORDER--FOCUS);outline:2px solid black;outline-offset:2px;box-shadow:0px 0px 0px 5px white}.sc-digi-button-h .digi-button:focus-visible.sc-digi-button-s>[slot^=icon],.sc-digi-button-h .digi-button:focus-visible .sc-digi-button-s>[slot^=icon]{--digi--icon--color:var(--COLOR--ICON--FOCUS)}.sc-digi-button-h .digi-button.sc-digi-button:active{background:var(--COLOR--BACKGROUND--ACTIVE);color:var(--COLOR--TEXT--ACTIVE)}.sc-digi-button-h .digi-button:active.sc-digi-button-s>[slot^=icon],.sc-digi-button-h .digi-button:active .sc-digi-button-s>[slot^=icon]{--digi--icon--color:var(--COLOR--ICON--ACTIVE)}.sc-digi-button-h .digi-button--icon.sc-digi-button,.sc-digi-button-h .digi-button--icon-secondary.sc-digi-button{--digi--button--display:flex;align-items:center;justify-content:var(--digi--button--justify-content--default);gap:var(--digi--button--icon--spacing)}.sc-digi-button-h .digi-button--full-width.sc-digi-button{--digi--button--width:100%;--digi--button--text-align--default:var(--digi--button--text-align--full-width);--digi--button--justify-content--default:var(--digi--button--justify-content--full-width)}`;
60
-
61
- const Button = class {
62
- constructor(hostRef) {
63
- index.registerInstance(this, hostRef);
64
- this.afOnClick = index.createEvent(this, "afOnClick", 7);
65
- this.afOnFocus = index.createEvent(this, "afOnFocus", 7);
66
- this.afOnBlur = index.createEvent(this, "afOnBlur", 7);
67
- this.afOnReady = index.createEvent(this, "afOnReady", 3);
68
- /**
69
- * Sätter knappens storlek. 'medium' är förvalt.
70
- * @en Set button size. Defaults to medium size.
71
- */
72
- this.afSize = codeExampleVariation_enum.ButtonSize.MEDIUM;
73
- /**
74
- * Sätt variant. Om varianten är 'tertiary' så krävs även en ikon.
75
- * @en Set button variation. If set to FUNCTION, the button also needs an icon.
76
- */
77
- this.afVariation = buttonVariation_enum.ButtonVariation.PRIMARY;
78
- /**
79
- * Sätt attributet 'type'.
80
- * @en Set button `type` attribute.
81
- */
82
- this.afType = formInputType_enum.ButtonType.BUTTON;
83
- /**
84
- * Sätter attributet 'id'. Om inget väljs så skapas ett slumpmässigt id.
85
- * @en Input id attribute. Defaults to random string.
86
- */
87
- this.afId = randomIdGenerator_util.randomIdGenerator('digi-button');
88
- /**
89
- * Sätter knappens bredd till 100%.
90
- * @en Set button width to 100%.
91
- */
92
- this.afFullWidth = false;
93
- }
94
- fullWidthHandler() {
95
- this.isFullSize = this.afFullWidth;
96
- }
97
- /**
98
- * Hämta en referens till buttonelementet. Bra för att t.ex. sätta fokus programmatiskt.
99
- * @en Returns a reference to the button element. Handy for setting focus programmatically.
100
- */
101
- async afMGetButtonElement() {
102
- return this._button;
103
- }
104
- componentWillLoad() {
105
- this.setHasIcon();
106
- this.fullWidthHandler();
107
- }
108
- componentWillUpdate() {
109
- this.setHasIcon();
110
- }
111
- componentDidLoad() {
112
- this.afOnReady.emit();
113
- }
114
- setHasIcon() {
115
- const icon = !!this.hostElement.querySelector('[slot="icon"]');
116
- const iconSecondary = !!this.hostElement.querySelector('[slot="icon-secondary"]');
117
- if (icon) {
118
- this.hasIcon = icon;
119
- }
120
- if (iconSecondary) {
121
- this.hasIconSecondary = iconSecondary;
122
- }
123
- }
124
- get cssModifiers() {
125
- return {
126
- [`digi-button--variation-${this.afVariation}`]: !!this.afVariation,
127
- [`digi-button--size-${this.afSize}`]: !!this.afSize,
128
- 'digi-button--icon': this.hasIcon,
129
- 'digi-button--icon-secondary': this.hasIconSecondary,
130
- 'digi-button--full-width': this.isFullSize
131
- };
132
- }
133
- get pressedState() {
134
- if (this.afAriaPressed === null || this.afAriaPressed === undefined) {
135
- return;
136
- }
137
- return this.afAriaPressed ? 'true' : 'false';
138
- }
139
- get expandedState() {
140
- if (this.afAriaExpanded === null || this.afAriaExpanded === undefined) {
141
- return;
142
- }
143
- return this.afAriaExpanded ? 'true' : 'false';
144
- }
145
- get hasPopup() {
146
- if (this.afAriaHaspopup === null || this.afAriaHaspopup === undefined) {
147
- return;
148
- }
149
- return this.afAriaHaspopup ? 'true' : 'false';
150
- }
151
- clickHandler(e) {
152
- this.afOnClick.emit(e);
153
- }
154
- focusHandler(e) {
155
- this.afOnFocus.emit(e);
156
- }
157
- blurHandler(e) {
158
- this.afOnBlur.emit(e);
159
- }
160
- render() {
161
- return (index.h(index.Host, { key: '3a398d75ad83e3caa9ec54928544d5bf8315d30f' }, index.h("button", { key: '2159552d7e8064acbb6da5c02c28ead3d4985e85', class: Object.assign({ 'digi-button': true }, this.cssModifiers), type: this.afType, role: this.afRole, ref: (el) => {
162
- var _a, _b, _c;
163
- this._button = el;
164
- (_a = this === null || this === void 0 ? void 0 : this.afInputRef) === null || _a === void 0 ? void 0 : _a.call(this, el);
165
- // Stencil has a bug wiith form attribute so we need to set it like this
166
- // https://github.com/ionic-team/stencil/issues/2703
167
- this.afForm
168
- ? (_b = this._button) === null || _b === void 0 ? void 0 : _b.setAttribute('form', this.afForm)
169
- : (_c = this._button) === null || _c === void 0 ? void 0 : _c.removeAttribute('form');
170
- }, id: this.afId, tabindex: this.afTabindex, "aria-label": this.afAriaLabel, "aria-labelledby": this.afAriaLabelledby, "aria-controls": this.afAriaControls, "aria-pressed": this.pressedState, "aria-expanded": this.expandedState, "aria-haspopup": this.hasPopup, "aria-current": this.afAriaCurrent, "aria-checked": this.afAriaChecked, onClick: (e) => this.clickHandler(e), onFocus: (e) => this.focusHandler(e), onBlur: (e) => this.blurHandler(e), autoFocus: this.afAutofocus ? this.afAutofocus : null, form: this.afForm, lang: this.afLang, dir: this.afDir }, this.hasIcon && (index.h("span", { key: '1188d5cb005a51e4e065b70663d06877db3a1477', class: "digi-button__icon" }, index.h("slot", { key: 'f90319563c18e1f82fa13f478b4d4d13ce3e9bf7', name: "icon" }))), index.h("span", { key: '17dce8eed2e845ca6166cf85a1c0252c2c0b8037', class: "digi-button__text" }, index.h("slot", { key: '2f637e48b837ecd0f0f2333349f328c497aee650' })), this.hasIconSecondary && (index.h("span", { key: '49ffd3361b0cc00c074e1ce332dab2de33127fcc', class: "digi-button__icon digi-button__icon--secondary" }, index.h("slot", { key: '367d3ba37e2fd0b7e83d600f35d02d4df303c1c0', name: "icon-secondary" }))))));
171
- }
172
- get hostElement() { return index.getElement(this); }
173
- static get watchers() { return {
174
- "afFullWidth": [{
175
- "fullWidthHandler": 0
176
- }]
177
- }; }
178
- };
179
- Button.style = buttonCss();
180
-
181
- const formInputCss = () => `.sc-digi-form-input-h{--digi--form-input--height--small:var(--digi--input-height--small);--digi--form-input--height--medium:var(--digi--input-height--medium);--digi--form-input--height--large:var(--digi--input-height--large);--digi--form-input--border-radius:var(--digi--border-radius--input);--digi--form-input--padding:0 var(--digi--gutter--medium);--digi--form-input--background--empty:var(--digi--color--background--interactive--default--input-elements);--digi--form-input--background--neutral:var(--digi--color--background--interactive--default--input-elements);--digi--form-input--background--success:var(--digi--color--background--interactive--validation--success);--digi--form-input--background--warning:var(--digi--color--background--interactive--validation--warning);--digi--form-input--background--error:var(--digi--color--background--interactive--validation--error);--digi--form-input--border--neutral:var(--digi--border-width--input-regular) solid;--digi--form-input--border--error:var(--digi--border-width--input-validation) solid;--digi--form-input--border--success:var(--digi--border-width--input-validation) solid;--digi--form-input--border--warning:var(--digi--border-width--input-validation) solid;--digi--form-input--border-color--neutral:var(--digi--color--border--interactive--default--on-input);--digi--form-input--border-color--success:var(--digi--color--border--interactive--validation--success);--digi--form-input--border-color--warning:var(--digi--color--border--interactive--validation--warning);--digi--form-input--border-color--error:var(--digi--color--border--interactive--validation--error)}.sc-digi-form-input-h .digi-form-input.sc-digi-form-input{display:flex;flex-direction:column;gap:0.4em}.sc-digi-form-input-h .digi-form-input--small.sc-digi-form-input{--HEIGHT:var(--digi--form-input--height--small)}.sc-digi-form-input-h .digi-form-input--medium.sc-digi-form-input{--HEIGHT:var(--digi--form-input--height--medium)}.sc-digi-form-input-h .digi-form-input--large.sc-digi-form-input{--HEIGHT:var(--digi--form-input--height--large)}.sc-digi-form-input-h .digi-form-input--neutral.sc-digi-form-input{--BORDER:var(--digi--form-input--border--neutral);--BORDER-COLOR:var(--digi--form-input--border-color--neutral);--BACKGROUND:var(--digi--form-input--background--neutral)}.sc-digi-form-input-h .digi-form-input--empty.sc-digi-form-input:not(:focus-within){--BACKGROUND:var(--digi--form-input--background--empty)}.sc-digi-form-input-h .digi-form-input--success.sc-digi-form-input{--BORDER:var(--digi--form-input--border--success);--BORDER-COLOR:var(--digi--form-input--border-color--success);--BACKGROUND:var(--digi--form-input--background--success)}.sc-digi-form-input-h .digi-form-input--warning.sc-digi-form-input{--BORDER:var(--digi--form-input--border--warning);--BORDER-COLOR:var(--digi--form-input--border-color--warning);--BACKGROUND:var(--digi--form-input--background--warning)}.sc-digi-form-input-h .digi-form-input--error.sc-digi-form-input{--BORDER:var(--digi--form-input--border--error);--BORDER-COLOR:var(--digi--form-input--border-color--error);--BACKGROUND:var(--digi--form-input--background--error)}.digi-form-input__input-wrapper.sc-digi-form-input{position:relative;display:flex}.digi-form-input__input-wrapper.sc-digi-form-input-s>[slot^=button] button,.digi-form-input__input-wrapper .sc-digi-form-input-s>[slot^=button] button{--MIN-HEIGHT:100%}.digi-form-input--button-variation-primary .digi-form-input__input-wrapper.sc-digi-form-input-s>[slot^=button] button,.digi-form-input__input-wrapper .sc-digi-form-input-s>[slot^=button] button{border-start-start-radius:0;border-end-start-radius:0}.digi-form-input--button-variation-secondary.digi-form-input--has-button-true.sc-digi-form-input .digi-form-input__input-wrapper.sc-digi-form-input{gap:var(--digi--gutter--medium);flex-wrap:wrap}.digi-form-input__input.sc-digi-form-input{flex:1;height:var(--HEIGHT);font-family:var(--digi--global--typography--font-family--default);font-size:var(--digi--typography--body--font-size--desktop);padding:var(--digi--form-input--padding);color:var(--digi--color--text--primary);background:var(--BACKGROUND);border:var(--BORDER);border-color:var(--BORDER-COLOR);border-radius:var(--digi--form-input--border-radius);box-sizing:border-box}.digi-form-input__input.sc-digi-form-input:focus-visible{outline:2px solid black;outline-offset:2px;box-shadow:0px 0px 0px 5px white}.digi-form-input--button-variation-primary.digi-form-input--has-button-true.sc-digi-form-input .digi-form-input__input.sc-digi-form-input{border-end-end-radius:0;border-start-end-radius:0}`;
182
-
183
- const FormInput = class {
184
- constructor(hostRef) {
185
- index.registerInstance(this, hostRef);
186
- this.afOnChange = index.createEvent(this, "afOnChange", 7);
187
- this.afOnBlur = index.createEvent(this, "afOnBlur", 7);
188
- this.afOnKeyup = index.createEvent(this, "afOnKeyup", 7);
189
- this.afOnFocus = index.createEvent(this, "afOnFocus", 7);
190
- this.afOnFocusout = index.createEvent(this, "afOnFocusout", 7);
191
- this.afOnInput = index.createEvent(this, "afOnInput", 7);
192
- this.afOnDirty = index.createEvent(this, "afOnDirty", 7);
193
- this.afOnTouched = index.createEvent(this, "afOnTouched", 7);
194
- this.afOnReady = index.createEvent(this, "afOnReady", 3);
195
- this.hasActiveValidationMessage = false;
196
- this.dirty = false;
197
- this.touched = false;
198
- /**
199
- * Sätter attributet 'type'.
200
- * @en Input type attribute
201
- */
202
- this.afType = formInputType_enum.FormInputType.TEXT;
203
- /**
204
- * Sätter attributet 'inputmode'.
205
- * @en Inputmode type attribute
206
- */
207
- this.afInputmode = typographyVariation_enum.FormInputMode.DEFAULT;
208
- /**
209
- * Layout för hur inmatningsfältet ska visas då det finns en knapp
210
- * @en Input layout when there is a button
211
- */
212
- this.afButtonVariation = formInputType_enum.FormInputButtonVariation.PRIMARY;
213
- /**
214
- * Sätter variant. Kan vara 'small', 'medium' eller 'large'
215
- * @en Set input variation.
216
- */
217
- this.afVariation = typographyVariation_enum.FormInputVariation.MEDIUM;
218
- /**
219
- * Sätter attributet 'id'. Om inget väljs så skapas ett slumpmässigt id.
220
- * @en Input id attribute. Defaults to random string.
221
- */
222
- this.afId = randomIdGenerator_util.randomIdGenerator('digi-form-input');
223
- /**
224
- * Sätt denna till true om formuläret innehåller fler obligatoriska fält än valfria.
225
- * @en Set this to true if the form contains more required fields than optional fields.
226
- */
227
- this.afAnnounceIfOptional = false;
228
- /**
229
- * Sätter valideringsstatus. Kan vara 'success', 'error', 'warning', 'neutral' eller ingenting.
230
- * @en Set input validation status
231
- */
232
- this.afValidation = typographyVariation_enum.FormInputValidation.NEUTRAL;
233
- /**
234
- * Om värdet är true får felmeddelandet attributet role="alert".
235
- * Om felet visas tillsammans med flera andra fel (till exempel efter servervalidering) ska värdet sättas till false.
236
- * @en If the value is true, the error message gets the attribute role="alert".
237
- * If the error is shown together with multiple errors (for example after server-side validation), the value should be set to false.
238
- */
239
- this.afErrorMessageIsAlert = true;
240
- }
241
- onValueChanged(value) {
242
- this.afValue = value;
243
- }
244
- onAfValueChanged(value) {
245
- this.value = value;
246
- if (this._input && this._input.value !== String(value !== null && value !== void 0 ? value : '')) {
247
- this._input.value = String(value !== null && value !== void 0 ? value : '');
248
- }
249
- }
250
- get errorMessageIsAlert() {
251
- return (this.afErrorMessageIsAlert !== false &&
252
- this.afErrorMessageIsAlert !== 'false');
253
- }
254
- afValidationTextWatch() {
255
- this.setActiveValidationMessage();
256
- }
257
- /**
258
- * Hämtar en referens till inputelementet. Bra för att t.ex. sätta fokus programmatiskt.
259
- * @en Returns a reference to the input element. Handy for setting focus programmatically.
260
- */
261
- async afMGetFormControlElement() {
262
- return this._input;
263
- }
264
- /**
265
- * Lyssnar på om fokus sätts på custom-elementet och propagerar ner det till själva input-elementet.
266
- * @en Listens for when focus is set on the custom element and propagates it down to the actual input element.
267
- */
268
- focusOnInput() {
269
- this._input.focus();
270
- }
271
- componentWillLoad() {
272
- this.afValue ? (this.value = this.afValue) : (this.afValue = this.value);
273
- this.setActiveValidationMessage();
274
- this.setHasButton();
275
- }
276
- componentWillUpdate() {
277
- this.setHasButton();
278
- }
279
- componentDidLoad() {
280
- this.afOnReady.emit();
281
- }
282
- setActiveValidationMessage() {
283
- this.hasActiveValidationMessage = !!this.afValidationText;
284
- }
285
- get cssModifiers() {
286
- return {
287
- 'digi-form-input--small': this.afVariation === typographyVariation_enum.FormInputVariation.SMALL,
288
- 'digi-form-input--medium': this.afVariation === typographyVariation_enum.FormInputVariation.MEDIUM,
289
- 'digi-form-input--large': this.afVariation === typographyVariation_enum.FormInputVariation.LARGE,
290
- 'digi-form-input--neutral': this.afValidation === typographyVariation_enum.FormInputValidation.NEUTRAL,
291
- 'digi-form-input--success': this.afValidation === typographyVariation_enum.FormInputValidation.SUCCESS,
292
- 'digi-form-input--error': this.afValidation === typographyVariation_enum.FormInputValidation.ERROR,
293
- 'digi-form-input--warning': this.afValidation === typographyVariation_enum.FormInputValidation.WARNING,
294
- [`digi-form-input--button-variation-${this.afButtonVariation}`]: !!this.afButtonVariation,
295
- [`digi-form-input--has-button-${this.hasButton}`]: true,
296
- 'digi-form-input--empty': !this.afValue &&
297
- (!this.afValidation ||
298
- this.afValidation === typographyVariation_enum.FormInputValidation.NEUTRAL)
299
- };
300
- }
301
- blurHandler(e) {
302
- const trimableTypes = [
303
- formInputType_enum.FormInputType.TEXT,
304
- formInputType_enum.FormInputType.EMAIL,
305
- formInputType_enum.FormInputType.SEARCH,
306
- formInputType_enum.FormInputType.TEL,
307
- formInputType_enum.FormInputType.URL
308
- ];
309
- const shouldTrim = this.afTrimValue && trimableTypes.includes(this.afType);
310
- if (shouldTrim && typeof e.target.value === 'string') {
311
- const trimmedValue = e.target.value.trim();
312
- if (trimmedValue !== e.target.value) {
313
- this.afValue = this.value = trimmedValue;
314
- if (this._input) {
315
- this._input.value = trimmedValue;
316
- }
317
- // Emittar afOnInput så Angulars value accessor får det trimmade värdet
318
- this.afOnInput.emit(e);
319
- }
320
- }
321
- if (!this.touched) {
322
- this.afOnTouched.emit(e);
323
- this.touched = true;
324
- }
325
- this.afOnBlur.emit(e);
326
- }
327
- changeHandler(e) {
328
- this.setActiveValidationMessage();
329
- this.afOnChange.emit(e);
330
- }
331
- focusHandler(e) {
332
- this.afOnFocus.emit(e);
333
- }
334
- focusoutHandler(e) {
335
- this.afOnFocusout.emit(e);
336
- }
337
- keyupHandler(e) {
338
- this.afOnKeyup.emit(e);
339
- }
340
- inputHandler(e) {
341
- this.afValue = this.value =
342
- this.afType === formInputType_enum.FormInputType.NUMBER
343
- ? parseFloat(e.target.value)
344
- : e.target.value;
345
- if (!this.dirty) {
346
- this.afOnDirty.emit(e);
347
- this.dirty = true;
348
- }
349
- this.setActiveValidationMessage();
350
- this.afOnInput.emit(e);
351
- }
352
- setHasButton() {
353
- this.hasButton = !!this.hostElement.querySelector('[slot="button"]');
354
- }
355
- render() {
356
- return (index.h(index.Host, { key: '2739bdd7385125581d7ea9c25a3610f5950c6a74', tabindex: -1 }, index.h("div", { key: '7e261c1e2fc4f37f4ddda861872a470c89181e16', class: Object.assign({ 'digi-form-input': true }, this.cssModifiers) }, index.h("digi-form-label", { key: '7e8fd283dedf0a851c714331ae640f7c74176bde', class: "digi-form-input__label", afFor: this.afId, afLabel: this.afLabel, afDescription: this.afLabelDescription, afRequired: this.afRequired, afAnnounceIfOptional: this.afAnnounceIfOptional, afRequiredText: this.afRequiredText, afAnnounceIfOptionalText: this.afAnnounceIfOptionalText }), index.h("div", { key: '68d715181c180ebaf957dfb46afb63b19b8a8188', class: "digi-form-input__input-wrapper" }, index.h("input", Object.assign({ key: 'e25ab871e988f9e8bd0837f75403e85f7423805f', class: "digi-form-input__input", ref: (el) => (this._input = el), onBlur: (e) => this.blurHandler(e), onChange: (e) => this.changeHandler(e), onFocus: (e) => this.focusHandler(e), onFocusout: (e) => this.focusoutHandler(e), onKeyUp: (e) => this.keyupHandler(e), onInput: (e) => this.inputHandler(e), "aria-activedescendant": this.afAriaActivedescendant, "aria-describedby": `${this.afAriaDescribedby} ${this.afId}--validation-message`, "aria-labelledby": this.afAriaLabelledby, "aria-autocomplete": this.afAriaAutocomplete, "aria-invalid": this.afValidation === typographyVariation_enum.FormInputValidation.ERROR
357
- ? 'true'
358
- : 'false', "aria-controls": this.afAriaControls, autocomplete: this.afAutocomplete, autofocus: this.afAutofocus ? this.afAutofocus : null, maxLength: this.afMaxlength, minLength: this.afMinlength, max: this.afMax, min: this.afMin, step: this.afStep, list: this.afList, role: this.afRole, dirName: this.afDirname, required: this.afRequired, id: this.afId, name: this.afName, type: this.afType, value: this.afValue }, (this.afInputmode == typographyVariation_enum.FormInputMode.DEFAULT
359
- ? {}
360
- : { inputmode: this.afInputmode }))), index.h("slot", { key: 'c14ae079a53099fc3928bcf3ac7f5517c20b0f36', name: "button" })), index.h("div", { key: '75d6afa176cd8620e31c384e169b3c84a3bb584d', class: "digi-form-input__footer" }, index.h("div", { key: '81029d425aae06e3c72c08afe982f2ff1a7bb81d', class: "digi-form-input__validation", "aria-atomic": "true", role: this.errorMessageIsAlert ? 'alert' : null, id: `${this.afId}--validation-message` }, this.hasActiveValidationMessage &&
361
- this.afValidation != typographyVariation_enum.FormInputValidation.NEUTRAL && (index.h("digi-form-validation-message", { key: '9a8fec12db8c78a037a9b70194b32814d7641dad', class: "digi-form-input__validation-message", "af-variation": this.afValidation }, this.afValidationText)))))));
362
- }
363
- get hostElement() { return index.getElement(this); }
364
- static get watchers() { return {
365
- "value": [{
366
- "onValueChanged": 0
367
- }],
368
- "afValue": [{
369
- "onAfValueChanged": 0
370
- }],
371
- "afValidationText": [{
372
- "afValidationTextWatch": 0
373
- }]
374
- }; }
375
- };
376
- FormInput.style = formInputCss();
377
-
378
- const formLabelCss = () => `.sc-digi-form-label-h .digi-form-label.sc-digi-form-label{font-family:var(--digi--global--typography--font-family--default);font-size:var(--digi--typography--label--font-size--desktop);color:var(--digi--color--text--primary);display:flex;flex-direction:column}.sc-digi-form-label-h .digi-form-label__label--label.sc-digi-form-label{font-weight:var(--digi--typography--label--font-weight--desktop)}.sc-digi-form-label-h .digi-form-label__label--label.sc-digi-form-label,.sc-digi-form-label-h .digi-form-label__label--description.sc-digi-form-label{line-height:var(--digi--typography--label--line-height--desktop);cursor:pointer;display:block}.sc-digi-form-label-h .digi-form-label__label-group.sc-digi-form-label{display:inline-flex;align-items:center;gap:var(--digi--gutter--icon)}.sc-digi-form-label-h .digi-form-label__description.sc-digi-form-label{max-width:var(--digi--paragraph-width--medium);line-height:var(--digi--typography--label-description--line-height--desktop);font-size:var(--digi--typography--label-description--font-size--desktop)}`;
379
-
380
- const FormLabel = class {
381
- constructor(hostRef) {
382
- index.registerInstance(this, hostRef);
383
- /**
384
- * Sätter attributet 'id'. Om inget väljs så skapas ett slumpmässigt id.
385
- * @en Set id attribute. Defaults to random string.
386
- */
387
- this.afId = randomIdGenerator_util.randomIdGenerator('digi-form-label');
388
- /**
389
- * Sätt denna till true om formuläret innehåller fler obligatoriska fält än valfria.
390
- * @en Set this to true if the form contains more required fields than optional fields.
391
- */
392
- this.afAnnounceIfOptional = false;
393
- /**
394
- * Sätter text för afRequired.
395
- * @en Set text for afRequired.
396
- */
397
- this.afRequiredText = text._t.required.toLowerCase();
398
- /**
399
- * Sätter text för afAnnounceIfOptional.
400
- * @en Set text for afAnnounceIfOptional.
401
- */
402
- this.afAnnounceIfOptionalText = text._t.optional.toLowerCase();
403
- }
404
- componentWillLoad() {
405
- this.setLabelText();
406
- this.validateFor();
407
- this.handleSlotVisibility();
408
- }
409
- validateFor() {
410
- if (this.afFor == null) {
411
- logger_util.logger.warn(`digi-form-label must have a for attribute. Please add a for attribute using af-for`, this.hostElement);
412
- }
413
- }
414
- setLabelText() {
415
- this.labelText = `${this.afLabel} ${this.requiredText}`;
416
- if (!this.afLabel) {
417
- logger_util.logger.warn(`digi-form-label must have a label. Please add a label using af-label`, this.hostElement);
418
- }
419
- }
420
- handleSlotVisibility() {
421
- this.hasActionSlot = !!this.hostElement.querySelector('[slot="actions"]');
422
- }
423
- get requiredText() {
424
- if (this.afRequired && !this.afAnnounceIfOptional) {
425
- return this.afRequiredText ? ` (${this.afRequiredText})` : '';
426
- }
427
- else if (!this.afRequired && this.afAnnounceIfOptional) {
428
- return this.afAnnounceIfOptionalText
429
- ? ` (${this.afAnnounceIfOptionalText})`
430
- : '';
431
- }
432
- else {
433
- return '';
434
- }
435
- }
436
- render() {
437
- return (index.h("div", { key: 'ac9aec4d1d20cc37694af578a97a16a17291c9f3', class: "digi-form-label" }, index.h("div", { key: 'bf27c3012d1973798095e6b832572fc20863c5f1', class: "digi-form-label__label-group" }, this.afFor && this.afLabel && (index.h("label", { key: '75435e49548e4fa27330a35b033689a0ed9e99a7', class: "digi-form-label__label", htmlFor: this.afFor, id: this.afId }, index.h("span", { key: '0527ddcebbd2a1b215f42eaed06ba7fc28633d43', class: "digi-form-label__label--label" }, this.labelText), this.afDescription && (index.h("span", { key: '8a3b3e6a0ec0a97adb0760b390f0ddb34b3e0b87', class: "digi-form-label__label--description" }, this.afDescription)))), this.hasActionSlot && (index.h("div", { key: 'f2e6ad691a5cbc57b990416097454a393da35c01', class: "digi-form-label__actions" }, index.h("slot", { key: '1fab5cca94da7ad0f2b617db7f713d3b4d17c52d', name: "actions" }))))));
438
- }
439
- get hostElement() { return index.getElement(this); }
440
- static get watchers() { return {
441
- "afFor": [{
442
- "validateFor": 0
443
- }],
444
- "afLabel": [{
445
- "setLabelText": 0
446
- }],
447
- "afRequired": [{
448
- "setLabelText": 0
449
- }],
450
- "afAnnounceIfOptional": [{
451
- "setLabelText": 0
452
- }]
453
- }; }
454
- };
455
- FormLabel.style = formLabelCss();
456
-
457
- const formSelectFilterCss = () => `.sc-digi-form-select-filter-h{--digi--form-select-filter--footer--background:var(--digi--color--background--secondary);--digi--form-select-filter--scroll--max-height:10.625rem;--digi--form-select-filter--scroll--padding:var(--digi--padding--small);--digi--form-select-filter--reset-button--margin-right:var(--digi--padding--small);--digi--form-select-filter--legend__border-bottom:var(--digi--border-width--primary) solid var(--digi--color--divider--primary);--digi--form-select-filter--list--margin:0;--digi--form-select-filter--list--padding:var(--digi--gutter--small) 0 0 0;--digi--form-select-filter--item--margin:var(--digi--gutter--small) 0;--digi--form-select-filter--toggle-icon--transition:ease-in-out 0.2s all;--digi--form-select-filter--dropdown--border-radius:var(--digi--border-radius--input);--digi--form-select-filter--dropdown--background:var(--digi--color--background--interactive--default--input-elements);--digi--form-select-filter--dropdown--min-width:18.75rem;--digi--form-select-filter--dropdown--margin-top:var(--digi--gutter--small);--digi--form-select-filter--dropdown--z-index:999;--digi--form-select-filter--dropdown--header--background:var(--digi--color--background--secondary-accent);--digi--form-select-filter--dropdown--item--cursor:pointer;--digi--form-select-filter--dropdown--item--height:auto;--digi--form-select-filter--dropdown--item--min-height:1.5rem;--digi--form-select-filter--dropdown--item--color:var(--digi--color--text--primary);--digi--form-select-filter--dropdown--item--font-size:var(--digi--typography--body--font-size--desktop);--digi--form-select-filter--dropdown--item--font-family:var(--digi--global--typography--font-family--default);--digi--form-select-filter--dropdown--item--font-weight--default:var(--digi--typography--link--font-weight--desktop);--digi--form-select-filter--dropdown--item--font-weight--selected:var(--digi--typography--link-bold--font-weight--desktop);--digi--form-select-filter--dropdown--item--font-weight--hover:var(--digi--typography--link-bold--font-weight--desktop);--digi--form-select-filter--dropdown--item--letter-spacing:0px;--digi--form-select-filter--dropdown--item--line-height:1.5;--digi--form-select-filter--dropdown--item--margin-bottom:0px;--digi--form-select-filter--dropdown--item--border-width:var(--digi--border-width--primary);--digi--form-select-filter--dropdown--item--border-type:var(--digi--border-style--primary);--digi--form-select-filter--dropdown--item--border-color:var(--digi--color--divider--primary);--digi--form-select-filter--dropdown--item--padding-y:var(--digi--margin--small);--digi--form-select-filter--dropdown--item--padding-x:var(--digi--margin--largest);--digi--form-select-filter--dropdown--item--multiple--padding-y:var(--digi--margin--small);--digi--form-select-filter--dropdown--item--multiple--padding-x:var(--digi--padding--largest-2);--digi--form-select-filter--dropdown--item--background-color--default:var(--digi--color--background--interactive--default--input-elements);--digi--form-select-filter--dropdown--item--background-color--focus:var(--digi--color--background--interactive--hover--quarternary);--digi--form-select-filter--dropdown--item--background-color--hover:var(--digi--color--background--interactive--hover--quarternary);--digi--form-select-filter--dropdown--item--background-color--active:var(--digi--color--background--interactive--selected--tertiary);--digi--form-select-filter--dropdown--item--background-color--selected:var(--digi--color--background--interactive--selected--tertiary);--digi--form-select-filter--dropdown--item--checkbox--background-color:var(--digi--color--background--interactive--default--input-elements);--digi--form-select-filter--dropdown--item--checkbox--background-color--selected:var(--digi--color--marking--indication--primary);--digi--form-select-filter--dropdown--item--checkbox--border-color:var(--digi--color--border--interactive--default--on-input);--digi--form-select-filter--dropdown--item--checkbox--border-width:var(--digi--border-width--primary);--digi--form-select-filter--dropdown--item--checkbox--border-style:var(--digi--border-style--primary);--digi--form-select-filter--dropdown--item--checkbox--border-radius:var(--digi--border-radius--tertiary);--digi--form-select-filter--dropdown--item--checkbox--width:1.25rem;--digi--form-select-filter--dropdown--item--checkbox--height:1.25rem;--digi--form-select-filter--toggle-button-indicator--color--default:var(--digi--color--background--interactive--default--input-elements);--digi--form-select-filter--toggle-button-indicator--color--active:var(--digi--color--marking--indication--primary);--digi--form-select-filter--toggle-button-indicator--width:1rem;--digi--form-select-filter--toggle-button-indicator--height:1rem;--digi--form-select-filter--toggle-button-indicator--margin-right:var(--digi--margin--small);--digi--form-select-filter--toggle-button-indicator--margin-left:calc(var(--digi--margin--smaller) * -1);--digi--form-select-filter--toggle-button--text--margin-right:var(--digi--margin--smaller);--digi--form-select-filter--toggle-button-indicator--color:var(--digi--color--marking--indication--primary);--digi--form-select-filter--toggle-icon--width:0.875rem;--digi--form-select-filter--toggle-icon--height:0.875rem;--digi--form-select-filter--search-input--border-radius:var(--digi--border-radius--input);--digi--form-select-filter--search-input--border-width:var(--digi--border-width--input-regular);--digi--form-select-filter--search-input--border-style:var(--digi--border-style--primary);--digi--form-select-filter--search-input--border-color:var(--digi--form-select-filter--toggle-button--border-width--neutral);--digi--form-select-filter--search-input--height:var(--digi--input-height--medium);--digi--form-select-filter--search-input--width:100%;--digi--form-select-filter--legend--font-weight:var(--digi--typography--preamble--font-weight--desktop);--digi--form-select-filter--legend--font-family:var(--digi--global--typography--font-family--default);--digi--form-select-filter--legend--font-size:var(--digi--typography--preamble--font-size--desktop);--digi--form-select-filter--toggle-button--border-width--neutral:var(--digi--border-width--input-regular);--digi--form-select-filter--toggle-button--border-color--neutral:var(--digi--color--border--interactive--default--on-input);--digi--form-select-filter--toggle-button--background--neutral:var(--digi--color--background--interactive--default--input-elements);--digi--form-select-filter--toggle-button--border-width--success:var(--digi--border-width--input-validation);--digi--form-select-filter--toggle-button--border-color--success:var(--digi--color--border--interactive--validation--success);--digi--form-select-filter--toggle-button--background--success:var(--digi--color--background--interactive--validation--success);--digi--form-select-filter--toggle-button--border-width--warning:var(--digi--border-width--input-validation);--digi--form-select-filter--toggle-button--border-color--warning:var(--digi--color--border--interactive--validation--warning);--digi--form-select-filter--toggle-button--background--warning:var(--digi--color--background--interactive--validation--warning);--digi--form-select-filter--toggle-button--border-width--error:var(--digi--border-width--input-validation);--digi--form-select-filter--toggle-button--border-color--error:var(--digi--color--border--interactive--validation--error);--digi--form-select-filter--toggle-button--background--error:var(--digi--color--background--interactive--validation--error);box-sizing:content-box}.sc-digi-form-select-filter-h .digi--a11y--sr-only.sc-digi-form-select-filter{border:0;clip:rect(1px, 1px, 1px, 1px);-webkit-clip-path:inset(50%);clip-path:inset(50%);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px;white-space:nowrap}.sc-digi-form-select-filter-h .digi-form-select-filter.sc-digi-form-select-filter{display:flex;flex-direction:column;gap:0.4em;position:relative;--INDICATOR--BACKGROUND:var(--digi--form-select-filter--toggle-button-indicator--color--default);--SCROLL--MAX-HEIGHT:var(--digi--form-select-filter--scroll--max-height)}.sc-digi-form-select-filter-h .digi-form-select-filter--neutral.sc-digi-form-select-filter{--BORDER-WIDTH:var( --digi--form-select-filter--toggle-button--border-width--neutral );--BORDER-COLOR:var( --digi--form-select-filter--toggle-button--border-color--neutral );--BACKGROUND:var( --digi--form-select-filter--toggle-button--background--neutral )}.sc-digi-form-select-filter-h .digi-form-select-filter--success.sc-digi-form-select-filter{--BORDER-WIDTH:var( --digi--form-select-filter--toggle-button--border-width--success );--BORDER-COLOR:var( --digi--form-select-filter--toggle-button--border-color--success );--BACKGROUND:var( --digi--form-select-filter--toggle-button--background--success )}.sc-digi-form-select-filter-h .digi-form-select-filter--warning.sc-digi-form-select-filter{--BORDER-WIDTH:var( --digi--form-select-filter--toggle-button--border-width--warning );--BORDER-COLOR:var( --digi--form-select-filter--toggle-button--border-color--warning );--BACKGROUND:var( --digi--form-select-filter--toggle-button--background--warning )}.sc-digi-form-select-filter-h .digi-form-select-filter--error.sc-digi-form-select-filter{--BORDER-WIDTH:var( --digi--form-select-filter--toggle-button--border-width--error );--BORDER-COLOR:var( --digi--form-select-filter--toggle-button--border-color--error );--BACKGROUND:var( --digi--form-select-filter--toggle-button--background--error )}.sc-digi-form-select-filter-h .digi-form-select-filter--open.sc-digi-form-select-filter .digi-form-select-filter__toggle-icon.sc-digi-form-select-filter{transform:rotate(-180deg)}.sc-digi-form-select-filter-h .digi-form-select-filter__toggle-button.sc-digi-form-select-filter{background:var(--BACKGROUND);border:var(--BORDER-WIDTH) solid var(--BORDER-COLOR);border-radius:var(--digi--border-radius--input);color:var(--digi--color--text--primary);cursor:pointer;display:flex;justify-content:space-between;align-items:center;font-weight:400;font-size:var(--digi--typography--body--font-size--desktop);width:100%;padding:0 var(--digi--gutter--medium);min-height:var(--digi--input-height--medium);font-family:var(--digi--global--typography--font-family--default)}.sc-digi-form-select-filter-h .digi-form-select-filter__toggle-button.sc-digi-form-select-filter:focus-visible,.sc-digi-form-select-filter-h .digi-form-select-filter__toggle-button.sc-digi-form-select-filter:focus{outline:2px solid black;outline-offset:2px;box-shadow:0px 0px 0px 5px white}.sc-digi-form-select-filter-h .digi-form-select-filter__toggle-icon.sc-digi-form-select-filter{transition:var(--digi--form-select-filter--toggle-icon--transition)}.sc-digi-form-select-filter-h .digi-form-select-filter__toggle-icon.sc-digi-form-select-filter-s>[slot^=icon],.sc-digi-form-select-filter-h .digi-form-select-filter__toggle-icon .sc-digi-form-select-filter-s>[slot^=icon]{--digi--icon--width:var(--digi--form-select-filter--toggle-icon--width);--digi--icon--height:var(--digi--form-select-filter--toggle-icon--height)}.sc-digi-form-select-filter-h .digi-form-select-filter__legend.sc-digi-form-select-filter{font-weight:var(--digi--form-select-filter--legend--font-weight);font-family:var(--digi--form-select-filter--legend--font-family);font-size:var(--digi--form-select-filter--legend--font-size);border:0;padding:0;margin:0;border:0;clip:rect(1px, 1px, 1px, 1px);-webkit-clip-path:inset(50%);clip-path:inset(50%);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px;white-space:nowrap}.sc-digi-form-select-filter-h .digi-form-select-filter__scroll.sc-digi-form-select-filter{max-height:var(--SCROLL--MAX-HEIGHT);overflow-y:auto}.sc-digi-form-select-filter-h .digi-form-select-filter__header.sc-digi-form-select-filter{background-color:var(--digi--form-select-filter--dropdown--header--background);padding:12px 12px 22px}.sc-digi-form-select-filter-h .digi-form-select-filter__header.sc-digi-form-select-filter input.sc-digi-form-select-filter{border-radius:var(--digi--form-select-filter--search-input--border-radius);border-width:var(--digi--form-select-filter--search-input--border-width);border-style:var(--digi--form-select-filter--search-input--border-style);border-color:var(--digi--form-select-filter--search-input--border-color);height:var(--digi--form-select-filter--search-input--height);width:var(--digi--form-select-filter--search-input--width)}.sc-digi-form-select-filter-h .digi-form-select-filter__header.sc-digi-form-select-filter legend.sc-digi-form-select-filter{width:100%;border-bottom:var(--digi--form-select-filter--legend__border-bottom)}.sc-digi-form-select-filter-h .digi-form-select-filter__footer.sc-digi-form-select-filter{display:flex;align-items:center;justify-content:center;background:var(--digi--form-select-filter--footer--background);padding:var(--digi--form-select-filter--scroll--padding)}.sc-digi-form-select-filter-h .digi-form-select-filter__reset-button.sc-digi-form-select-filter{display:inline-block;margin-right:var(--digi--form-select-filter--reset-button--margin-right)}.sc-digi-form-select-filter-h .digi-form-select-filter__dropdown.sc-digi-form-select-filter{box-shadow:0 2px 6px 0 rgba(0, 0, 0, 0.7);min-width:var(--digi--form-select-filter--dropdown--min-width);width:100%;position:absolute;z-index:var(--digi--form-select-filter--dropdown--z-index);background:var(--digi--form-select-filter--dropdown--background);border-radius:var(--digi--form-select-filter--dropdown--border-radius);overflow:hidden;margin-top:var(--digi--form-select-filter--dropdown--margin-top)}.sc-digi-form-select-filter-h .digi-form-select-filter__dropdown.sc-digi-form-select-filter fieldset.sc-digi-form-select-filter{border:none;padding:0;margin:0}@media (min-width: 48rem){.sc-digi-form-select-filter-h .digi-form-select-filter__dropdown--right.sc-digi-form-select-filter{right:0}}.sc-digi-form-select-filter-h .digi-form-select-filter__dropdown--hidden.sc-digi-form-select-filter{display:none}.sc-digi-form-select-filter-h .digi-form-select-filter__label.sc-digi-form-select-filter{display:block}.sc-digi-form-select-filter-h .digi-form-select-filter__toggle-button-wrapper--activated.sc-digi-form-select-filter{display:flex;align-items:center}.sc-digi-form-select-filter-h .digi-form-select-filter__toggle-button-indicator.sc-digi-form-select-filter{display:none;--digi--icon--color:var(--digi--form-select-filter--toggle-button-indicator--color)}.sc-digi-form-select-filter-h .digi-form-select-filter__toggle-button-indicator--active.sc-digi-form-select-filter{display:flex;margin-right:var(--digi--form-select-filter--toggle-button-indicator--margin-right);width:var(--digi--form-select-filter--toggle-button-indicator--width);height:var(--digi--form-select-filter--toggle-button-indicator--height)}.sc-digi-form-select-filter-h .digi-form-select-filter__search-status.sc-digi-form-select-filter{font-family:var(--digi--global--typography--font-family--default);font-size:var(--digi--typography--label--font-size--desktop);color:var(--digi--color--text--primary)}.sc-digi-form-select-filter-h .digi-form-select-filter__list.sc-digi-form-select-filter{margin:var(--digi--form-select-filter--list--margin);padding:0;max-width:100%}.sc-digi-form-select-filter-h .digi-form-select-filter__item.sc-digi-form-select-filter{background-color:var(--digi--form-select-filter--dropdown--item--background-color--default);border-width:0;box-sizing:border-box;border-bottom-width:var(--digi--form-select-filter--dropdown--item--border-width);border-style:var(--digi--form-select-filter--dropdown--item--border-type);border-color:var(--digi--form-select-filter--dropdown--item--border-color);cursor:var(--digi--form-select-filter--dropdown--item--cursor);color:var(--digi--form-select-filter--dropdown--item--color);display:block;font-size:var(--digi--form-select-filter--dropdown--item--font-size);font-family:var(--digi--form-select-filter--dropdown--item--font-family);font-weight:var(--digi--form-select-filter--dropdown--item--font-weight--default);padding:var(--digi--form-select-filter--dropdown--item--padding-y) var(--digi--form-select-filter--dropdown--item--padding-x);position:relative;height:var(--digi--form-select-filter--dropdown--item--height);min-height:var(--digi--form-select-filter--dropdown--item--min-height);margin-bottom:var(--digi--form-select-filter--dropdown--item--margin-bottom);letter-spacing:var(--digi--form-select-filter--dropdown--item--letter-spacing);line-height:var(--digi--form-select-filter--dropdown--item--line-height)}.sc-digi-form-select-filter-h .digi-form-select-filter__item.sc-digi-form-select-filter:focus-visible{background-color:var(--digi--form-select-filter--dropdown--item--background-color--focus);outline:2px solid black;outline-offset:-3px;box-shadow:0px 0px 0px 5px inset white}.sc-digi-form-select-filter-h .digi-form-select-filter__item.sc-digi-form-select-filter:hover{background-color:var(--digi--form-select-filter--dropdown--item--background-color--hover);font-weight:var(--digi--form-select-filter--dropdown--item--font-weight--hover)}.sc-digi-form-select-filter-h .digi-form-select-filter__item.sc-digi-form-select-filter:active{background-color:var(--digi--form-select-filter--dropdown--item--background-color--active)}.sc-digi-form-select-filter-h .digi-form-select-filter__item[aria-checked=true].sc-digi-form-select-filter{font-weight:var(--digi--form-select-filter--dropdown--item--font-weight--selected);background-color:var(--digi--form-select-filter--dropdown--item--background-color--selected)}.sc-digi-form-select-filter-h .digi-form-select-filter__item[dir=rtl].sc-digi-form-select-filter{text-align:right}.sc-digi-form-select-filter-h .digi-form-select-filter__item[role=radio].sc-digi-form-select-filter .digi-form-select-filter__item__icon.sc-digi-form-select-filter{position:absolute;width:13px;height:25px;left:7px}.sc-digi-form-select-filter-h .digi-form-select-filter__item[role=radio][dir=rtl].sc-digi-form-select-filter::before{right:3px}.sc-digi-form-select-filter-h .digi-form-select-filter__item[role=radio][dir=rtl].sc-digi-form-select-filter .digi-form-select-filter__item__icon.sc-digi-form-select-filter{left:auto;right:7px}.sc-digi-form-select-filter-h .digi-form-select-filter__item[role=checkbox].sc-digi-form-select-filter{padding:var(--digi--form-select-filter--dropdown--item--multiple--padding-y) var(--digi--form-select-filter--dropdown--item--multiple--padding-x)}.sc-digi-form-select-filter-h .digi-form-select-filter__item[role=checkbox][aria-checked=true].sc-digi-form-select-filter:before{background:var(--digi--form-select-filter--dropdown--item--checkbox--background-color--selected);border-color:var(--digi--form-select-filter--dropdown--item--checkbox--background-color--selected)}.sc-digi-form-select-filter-h .digi-form-select-filter__item[role=checkbox].sc-digi-form-select-filter::before{content:"";position:absolute;background-color:var(--digi--form-select-filter--dropdown--item--checkbox--background-color);border-color:var(--digi--form-select-filter--dropdown--item--checkbox--border-color);border-width:var(--digi--form-select-filter--dropdown--item--checkbox--border-width);border-style:var(--digi--form-select-filter--dropdown--item--checkbox--border-style);height:var(--digi--form-select-filter--dropdown--item--checkbox--width);width:var(--digi--form-select-filter--dropdown--item--checkbox--height);border-radius:var(--digi--form-select-filter--dropdown--item--checkbox--border-radius);left:12px;transform:translateY(1px)}.sc-digi-form-select-filter-h .digi-form-select-filter__item[role=checkbox].sc-digi-form-select-filter .digi-form-select-filter__item__icon.sc-digi-form-select-filter{position:absolute;width:13px;left:16px;--digi--icon--color:white}.sc-digi-form-select-filter-h .digi-form-select-filter__item[role=checkbox][dir=rtl].sc-digi-form-select-filter::before{right:12px}.sc-digi-form-select-filter-h .digi-form-select-filter__item[role=checkbox][dir=rtl].sc-digi-form-select-filter .digi-form-select-filter__item__icon.sc-digi-form-select-filter{left:auto;right:16px}.sc-digi-form-select-filter-h .digi-form-select-filter__toggle-button-text.sc-digi-form-select-filter{margin-right:var(--digi--form-select-filter--toggle-button--text--margin-right)}.sc-digi-form-select-filter-h .hidden.sc-digi-form-select-filter{display:none}`;
458
-
459
- const FormSelectFilter = class {
460
- constructor(hostRef) {
461
- index.registerInstance(this, hostRef);
462
- this.afOnFocusout = index.createEvent(this, "afOnFocusout", 7);
463
- this.afOnSubmitFilters = index.createEvent(this, "afOnSubmitFilters", 7);
464
- this.afOnFilterClosed = index.createEvent(this, "afOnFilterClosed", 7);
465
- this.afOnResetFilters = index.createEvent(this, "afOnResetFilters", 7);
466
- this.afOnSelect = index.createEvent(this, "afOnSelect", 7);
467
- this.afOnQueryChanged = index.createEvent(this, "afOnQueryChanged", 7);
468
- this.isOpen = false;
469
- this.focusListItemIndex = 0;
470
- this.focusInList = false;
471
- this._filteredResult = [];
472
- this._selectedItems = [];
473
- this._searchQuery = '';
474
- /** True when `value` was set from outside (e.g. Angular CVA) — then value is selection master. */
475
- this._valueIsMaster = false;
476
- /** Guards internal `value` writes so they don't flip `_valueIsMaster`. */
477
- this._updatingValueInternally = false;
478
- /**
479
- * Sätter väljarens validering
480
- * @en Set select validation
481
- */
482
- this.afValidation = typographyVariation_enum.FormSelectFilterValidation.NEUTRAL;
483
- /**
484
- * Normalt betonas ett obligatoriskt fält visuellt och semantiskt.
485
- * Detta vänder på det och betonar fältet om det inte krävs.
486
- * Ställ in detta till sant om ditt formulär innehåller fler obligatoriska fält än inte.
487
- * @en Normally a required field is visually and semantically emphasized.
488
- * This flips that and emphasizes the field if it is not required.
489
- * Set this to true if your form contains more required fields than not.
490
- */
491
- this.afAnnounceIfOptional = false;
492
- /**
493
- * Sorterar listan i alfabetisk ordning.
494
- * @en Sort the list in alphabetical order.
495
- */
496
- this.sortAlphabetically = true;
497
- /**
498
- * @ignore
499
- * Propertyn `value` finns inte dokumenterad på komponentens sida på dokumentationswebben, utan
500
- * är endast till för att användas tillsammans med Angulars Control Value Accessors (CVA).
501
- * Används CVA för att hantera komponentens värden så ska inte afListItems användas för att
502
- * påverka vilka val som är gjorda eller ej.
503
- * Exempel på båda sätten att hantera datat finns i Angular Playground.
504
- */
505
- this.value = [];
506
- /**
507
- * Sätts till true om det ska gå att välja flera val från listan.
508
- * @en Set to true if you should be able to choose multiple items from the list.
509
- */
510
- this.afMultipleItems = false;
511
- /**
512
- * Prefixet för alla komponentens olika interna 'id'-attribut på dropdowns, filterlistor etc. Ex. 'my-cool-id' genererar 'my-cool-id-filter-list', 'my-cool-id-dropdown-menu' och så vidare. Ges inget värde så genereras ett slumpmässigt.
513
- * @en Prefix for all id attributes inside the component. Example: 'my-cool-id' generates 'my-cool-id-filter-list', 'my-cool-id-dropdown-menu' and so on. Defaults to random string.
514
- */
515
- this.afId = randomIdGenerator_util.randomIdGenerator('digi-form-select-filter');
516
- /**
517
- * Texten i rensaknappen
518
- * @en Set the reset button text
519
- */
520
- this.afResetButtonText = text._t.clear;
521
- /**
522
- * Döljer rensaknappen när värdet sätts till true
523
- * @en Hides the reset button when set to true
524
- */
525
- this.afHideResetButton = false;
526
- /**
527
- * Text som visas när sökningen inte ger några resultat.
528
- * @en Text that is shown the the search gives no result.
529
- */
530
- this.afEmptySearchMessage = 'Inga sökträffar för';
531
- /**
532
- * Om värdet är true får felmeddelandet attributet role="alert".
533
- * Om felet visas tillsammans med flera andra fel (till exempel efter servervalidering) ska värdet sättas till false.
534
- * @en If the value is true, the error message gets the attribute role="alert".
535
- * If the error is shown together with multiple errors (for example after server-side validation), the value should be set to false.
536
- */
537
- this.afErrorMessageIsAlert = true;
538
- }
539
- onValueChanged(newValue) {
540
- let parsedValue;
541
- if (typeof newValue === 'string') {
542
- parsedValue = newValue ? JSON.parse(newValue) : [];
543
- }
544
- else {
545
- parsedValue = newValue || [];
546
- }
547
- if (!this._updatingValueInternally) {
548
- this._valueIsMaster = true;
549
- }
550
- this.value = parsedValue;
551
- this.syncValueAndSelectedListItems('valueChange');
552
- }
553
- handleListItems() {
554
- if (this.afListItems) {
555
- try {
556
- if (this.afListItems.constructor === Array) {
557
- this._afListItems = this.afListItems;
558
- }
559
- else if (typeof this.afListItems === 'string') {
560
- this._afListItems = JSON.parse(this.afListItems);
561
- }
562
- else {
563
- throw `Invalid type in "af-list-items" attribute`;
564
- }
565
- this.giveItemsValueIfNoneExist();
566
- this.sortListAlphabetically();
567
- this.syncValueAndSelectedListItems('afListItemsChange');
568
- this.filterResults();
569
- }
570
- catch (e) {
571
- logger_util.logger.warn(`Invalid JSON in "af-list-items" attribute`, this.hostElement, e);
572
- return;
573
- }
574
- }
575
- }
576
- get errorMessageIsAlert() {
577
- return (this.afErrorMessageIsAlert !== false &&
578
- this.afErrorMessageIsAlert !== 'false');
579
- }
580
- /**
581
- * Funktion för att rensa valda värden från komponenten
582
- * @en Function for clearing selected values from component
583
- */
584
- async afMReset() {
585
- this.resetSelectItems();
586
- }
587
- /**
588
- * Funktion för att stänga dropdownen
589
- * @en Function for closing the dropdown
590
- */
591
- async afMCloseDropdown() {
592
- this.setClosed();
593
- }
594
- clickHandler(e) {
595
- const target = e.target;
596
- const selector = `#${this.afId}-identifier`;
597
- if (detectClickOutside_util.detectClickOutside(target, selector) && this.isOpen) {
598
- this.emitFilterClosedEvent();
599
- }
600
- }
601
- focusoutHandler(e) {
602
- const target = e.target;
603
- const selector = `#${this.afId}-identifier`;
604
- const focusOutsideFilter = detectFocusOutside_util.detectFocusOutside(target, selector);
605
- if (focusOutsideFilter && this.isOpen) {
606
- this.emitFilterClosedEvent();
607
- }
608
- else {
609
- this.focusInList = !detectFocusOutside_util.detectFocusOutside(target, `#${this.afId}-select-filter-list`);
610
- }
611
- }
612
- /**
613
- * Lyssnar på om fokus sätts på custom-elementet och propagerar ner det till toggle-knappen.
614
- * @en Listens for when focus is set on the custom element and propagates it down to the toggle butto.
615
- */
616
- focusOnElement() {
617
- this._toggleButton.focus();
618
- }
619
- componentWillLoad() {
620
- this.bootstrapInitialValue();
621
- this.handleListItems();
622
- // Angular attaches the host first and binds `[afListItems]` / CVA `value` on
623
- // the next frame (Stencil 4.36+). @Watch skips that first assignment, so if
624
- // the list is not here yet, wait one frame. React/vanilla that already set
625
- // the prop skip the delay.
626
- if (!this.afListItems) {
627
- return new Promise((resolve) => {
628
- requestAnimationFrame(() => {
629
- this.bootstrapInitialValue();
630
- this.handleListItems();
631
- resolve();
632
- });
633
- });
634
- }
635
- }
636
- bootstrapInitialValue() {
637
- if (typeof this.value === 'string') {
638
- const parsed = this.value ? JSON.parse(this.value) : [];
639
- this._updatingValueInternally = true;
640
- this.value = parsed;
641
- this._updatingValueInternally = false;
642
- }
643
- if (Array.isArray(this.value) && this.value.length > 0) {
644
- this._valueIsMaster = true;
645
- }
646
- }
647
- /**
648
- * Keep `value` and `afListItems[].selected` in sync.
649
- * - If `value` was set externally (`_valueIsMaster`), value wins on list updates.
650
- * - Otherwise selection is seeded from `afListItems[].selected` (React/vanilla data-as-master).
651
- * Does not emit `afOnSelect` — that is reserved for user interaction so Angular Control Value Accessors
652
- * does not get feedback loops on prop sync.
653
- */
654
- syncValueAndSelectedListItems(whereDidTheChangeComeFrom) {
655
- if (!this._afListItems) {
656
- return;
657
- }
658
- if (whereDidTheChangeComeFrom === 'afListItemsChange') {
659
- if (this._valueIsMaster) {
660
- this.applyValueToListItems(this.value);
661
- }
662
- else {
663
- this._selectedItems = this._afListItems.filter((item) => item.selected);
664
- this.setValueInternally([...this._selectedItems]);
665
- }
666
- return;
667
- }
668
- this.applyValueToListItems(this.value);
669
- }
670
- applyValueToListItems(value) {
671
- const selectedValues = new Set((value !== null && value !== void 0 ? value : []).map((item) => item.value));
672
- this._afListItems.forEach((item) => {
673
- item.selected = selectedValues.has(item.value);
674
- });
675
- this._selectedItems = this._afListItems.filter((item) => selectedValues.has(item.value));
676
- }
677
- setValueInternally(nextValue) {
678
- this._updatingValueInternally = true;
679
- this.value = nextValue;
680
- this._updatingValueInternally = false;
681
- }
682
- setClosed(focusToggleButton = false) {
683
- this.isOpen = false;
684
- if (focusToggleButton) {
685
- document.getElementById(`${this.afId}`).focus();
686
- }
687
- this.setScroll(0);
688
- this._searchQuery = '';
689
- this.afOnQueryChanged.emit('');
690
- this.afOnSubmitFilters.emit(this._selectedItems);
691
- this.filterResults();
692
- }
693
- setScroll(scrollY) {
694
- document.querySelector(`#${this.afId}-dropdown-menu .digi-form-select-filter__scroll`).scrollTop = scrollY;
695
- }
696
- setOpen() {
697
- this.isOpen = true;
698
- this.focusListItemIndex = 0;
699
- setTimeout(() => {
700
- this.setFocusSearch();
701
- }, 50);
702
- }
703
- giveItemsValueIfNoneExist() {
704
- this._afListItems
705
- .filter((item) => {
706
- return item.value === undefined;
707
- })
708
- .forEach((item) => {
709
- item.value = item.label;
710
- });
711
- }
712
- sortListAlphabetically() {
713
- if (!this.sortAlphabetically) {
714
- return;
715
- }
716
- this._afListItems.sort((a, b) => {
717
- if (a.label < b.label) {
718
- return -1;
719
- }
720
- if (a.label > b.label) {
721
- return 1;
722
- }
723
- return 0;
724
- });
725
- }
726
- toggleDropdown() {
727
- return this.isOpen ? this.setClosed() : this.setOpen();
728
- }
729
- inputItem(identifier, index) {
730
- const item = this.hostElement
731
- .querySelectorAll(`#${identifier} .digi-form-select-filter__item`)
732
- .item(index);
733
- return item;
734
- }
735
- emitFilterClosedEvent() {
736
- this.setClosed(true);
737
- this.afOnFilterClosed.emit();
738
- }
739
- setFocusItem() {
740
- const element = this.inputItem(`${this.afId}-select-filter-list`, this.focusListItemIndex);
741
- if (element) {
742
- element.focus();
743
- }
744
- }
745
- setFocusSearch() {
746
- const element = this.hostElement.querySelector('input');
747
- if (element) {
748
- element.focus();
749
- }
750
- }
751
- incrementFocusItem() {
752
- const listLength = this.showNeutralValue
753
- ? this._filteredResult.length
754
- : this._filteredResult.length - 1;
755
- if (this.focusListItemIndex < listLength) {
756
- this.focusListItemIndex = this.focusListItemIndex + 1;
757
- this.setFocusItem();
758
- return;
759
- }
760
- else {
761
- if (!this.afMultipleItems) {
762
- this.focusListItemIndex = 0;
763
- this.setFocusItem();
764
- return;
765
- }
766
- }
767
- this.tabHandler();
768
- }
769
- decrementFocusItem() {
770
- if (this.focusListItemIndex === 0) {
771
- this.setFocusSearch();
772
- return;
773
- }
774
- if (this.focusListItemIndex > 0) {
775
- this.focusListItemIndex = this.focusListItemIndex - 1;
776
- }
777
- this.setFocusItem();
778
- }
779
- downHandler(e) {
780
- e.detail.preventDefault();
781
- if (e.detail.code === 'ArrowDown' || e.detail.code === 'ArrowRight') {
782
- this.incrementFocusItem();
783
- }
784
- }
785
- upHandler(e) {
786
- e.detail.preventDefault();
787
- if (e.detail.code === 'ArrowUp' || e.detail.code === 'ArrowLeft') {
788
- this.decrementFocusItem();
789
- }
790
- }
791
- homeHandler(e) {
792
- e.detail.preventDefault();
793
- this.focusListItemIndex = 0;
794
- this.setFocusItem();
795
- }
796
- endHandler(e) {
797
- e.detail.preventDefault();
798
- this.focusListItemIndex = this.showNeutralValue
799
- ? this._filteredResult.length
800
- : this._filteredResult.length - 1;
801
- this.setFocusItem();
802
- }
803
- enterHandler(e) {
804
- e.detail.preventDefault();
805
- e.detail.target.click();
806
- }
807
- spaceHandler(e) {
808
- e.detail.preventDefault();
809
- e.detail.target.click();
810
- }
811
- escHandler() {
812
- if (this.isOpen) {
813
- this.setClosed(true);
814
- }
815
- }
816
- tabHandler() {
817
- if (this.isOpen && this.focusInList) {
818
- if (this.afMultipleItems && this._submitButton) {
819
- setTimeout(() => {
820
- var _a;
821
- if (this._submitButton) {
822
- (_a = this._submitButton.querySelector('button')) === null || _a === void 0 ? void 0 : _a.focus();
823
- }
824
- }, 10);
825
- }
826
- else {
827
- this.setClosed(true);
828
- }
829
- }
830
- }
831
- shiftHandler() {
832
- if (this.isOpen && this.focusInList) {
833
- if (this.afMultipleItems && this._toggleButton) {
834
- this._toggleButton.querySelector('button').focus();
835
- }
836
- else {
837
- this.setFocusSearch();
838
- }
839
- }
840
- }
841
- filterResults() {
842
- if (this._searchQuery && this._searchQuery.length > 0) {
843
- this._filteredResult = this._afListItems.filter((item) => {
844
- return item.label
845
- .toLowerCase()
846
- .includes(this._searchQuery.toLowerCase());
847
- });
848
- }
849
- else {
850
- this._filteredResult = this._afListItems;
851
- }
852
- }
853
- inputSearchKeyboardHandler(e) {
854
- if (e.code === 'ArrowDown') {
855
- e.preventDefault();
856
- this.setFocusItem();
857
- }
858
- if (e.code === 'Enter' && this._searchQuery !== '') {
859
- e.preventDefault();
860
- this.setFocusItem();
861
- }
862
- }
863
- inputSearchInputHandler(e) {
864
- this._searchQuery = e.target.value;
865
- this.afOnQueryChanged.emit(this._searchQuery);
866
- this.filterResults();
867
- }
868
- resetSelectItems(close = false) {
869
- this._selectedItems = [];
870
- this.setValueInternally([]);
871
- this.afOnSelect.emit([]);
872
- this._searchQuery = '';
873
- this.filterResults();
874
- if (close) {
875
- this.emitFilterClosedEvent();
876
- }
877
- this.afOnResetFilters.emit();
878
- }
879
- selectItemHandler(item) {
880
- if (this.afMultipleItems) {
881
- item.selected = !item.selected;
882
- if (this._selectedItems.filter((x) => {
883
- return x.value === item.value;
884
- }).length > 0) {
885
- //ITEM VALUE ALREADY EXISTS IN LIST, DELETE FROM LIST
886
- this._selectedItems.splice(this._selectedItems.findIndex((e) => e.value === item.value), 1);
887
- }
888
- else {
889
- this._selectedItems = [...this._selectedItems, item];
890
- }
891
- }
892
- else {
893
- this._selectedItems.forEach((item) => {
894
- item.selected = false;
895
- });
896
- item.selected = true;
897
- this._selectedItems = [item];
898
- this.emitFilterClosedEvent();
899
- }
900
- this.setValueInternally([...this._selectedItems]);
901
- this.afOnSelect.emit(this._selectedItems);
902
- this.filterResults();
903
- }
904
- isSelected(textValue) {
905
- if (textValue && this._selectedItems && this._selectedItems.length > 0) {
906
- return (this._selectedItems.filter((item) => {
907
- return item.value === textValue;
908
- }).length > 0);
909
- }
910
- return false;
911
- }
912
- get cssModifiers() {
913
- return {
914
- 'digi-form-select-filter--open': this.isOpen,
915
- 'digi-form-select-filter--neutral': this.afValidation === typographyVariation_enum.FormSelectFilterValidation.NEUTRAL,
916
- 'digi-form-select-filter--success': this.afValidation === typographyVariation_enum.FormSelectFilterValidation.SUCCESS,
917
- 'digi-form-select-filter--warning': this.afValidation === typographyVariation_enum.FormSelectFilterValidation.WARNING,
918
- 'digi-form-select-filter--error': this.afValidation === typographyVariation_enum.FormSelectFilterValidation.ERROR
919
- };
920
- }
921
- get cssModifiersToggleButtonIndicator() {
922
- return {
923
- 'digi-form-select-filter__toggle-button-indicator--active': this._selectedItems.length > 0
924
- };
925
- }
926
- get cssModifiersToggleButtonWrapper() {
927
- return {
928
- 'digi-form-select-filter__toggle-button-wrapper--activated': this._selectedItems.length > 0
929
- };
930
- }
931
- buttonText(isAriaLabel) {
932
- const ariaLabelText = (text = '') => {
933
- return isAriaLabel ? text : '';
934
- };
935
- if (this._selectedItems && this._selectedItems.length === 1) {
936
- return (ariaLabelText(this.afFilterButtonTextLabel + ': ') +
937
- this._selectedItems[0].label);
938
- }
939
- else if (this._selectedItems &&
940
- this._selectedItems.length > 0 &&
941
- this.afMultipleItems) {
942
- if (this.afFilterButtonTextMultipleValues) {
943
- return (ariaLabelText(this.afFilterButtonTextLabel + ': ') +
944
- this.afFilterButtonTextMultipleValues.replace('{count}', this._selectedItems.length.toString()));
945
- }
946
- else {
947
- return (ariaLabelText(this.afFilterButtonTextLabel + ': ') +
948
- `${this._selectedItems.length} valda`);
949
- }
950
- }
951
- else {
952
- return (ariaLabelText(this.afFilterButtonTextLabel
953
- ? this.afFilterButtonTextLabel + ': '
954
- : '') + this.afFilterButtonText);
955
- }
956
- }
957
- get renderButtonLabel() {
958
- return this.buttonText(false);
959
- }
960
- get ariaLabel() {
961
- return this.buttonText(true);
962
- }
963
- get showNeutralValue() {
964
- return (!this.afMultipleItems &&
965
- this.afFilterButtonText &&
966
- this._searchQuery.length === 0);
967
- }
968
- showValidation() {
969
- return !this.afDisableValidation &&
970
- this.afValidation !== typographyVariation_enum.FormSelectFilterValidation.NEUTRAL &&
971
- this.afValidationText
972
- ? true
973
- : false;
974
- }
975
- renderEmptyStateBox() {
976
- let statusMessage = '';
977
- if (this._filteredResult && this._filteredResult.length > 0) {
978
- statusMessage = `${this._filteredResult.length} sökträff${this._filteredResult.length > 1 ? 'ar' : ''}`;
979
- }
980
- else if (this._filteredResult.length === 0) {
981
- statusMessage = `${this.afEmptySearchMessage} ${this._searchQuery}`;
982
- }
983
- return (index.h(index.Fragment, null, index.h("div", { role: "status", id: `${this.afId}-searchstatus`, class: {
984
- 'digi-form-select-filter__search-status': true,
985
- 'digi--a11y--sr-only': this._filteredResult && this._filteredResult.length > 0
986
- } }, index.h("span", null, " ", statusMessage, " "), index.h("div", { class: {
987
- hidden: this._filteredResult && this._filteredResult.length > 0
988
- } }, index.h("slot", { name: "empty-search-result" })))));
989
- }
990
- render() {
991
- return (index.h(index.Host, { key: '2e7276930637366cbcb14168102afb82393708f5', tabindex: -1 }, index.h("div", { key: 'a5620907d2399c0561b6b3b604220c3bf82ded6b', class: Object.assign({ 'digi-form-select-filter': true }, this.cssModifiers), role: "application", id: `${this.afId}-identifier` }, index.h("digi-form-label", { key: '151c3656f03d8b8b7639daf0e26631722a1f6878', afLabel: this.afFilterButtonTextLabel, afFor: `${this.afId}`, afId: `${this.afId}-label`, class: "digi-form-select-filter__label", afDescription: this.afDescription, afRequired: this.afRequired, afAnnounceIfOptional: this.afAnnounceIfOptional, afRequiredText: this.afRequiredText, afAnnounceIfOptionalText: this.afAnnounceIfOptionalText }), index.h("digi-util-keydown-handler", { key: '035ffc46a22218d42d892c89592993a7694b2be2', onAfOnEsc: () => this.escHandler() }, index.h("button", { key: 'b8fedc87ecf0b1cf26e2b123c97fcd7ff6287e0b', type: "button", id: `${this.afId}`, class: "digi-form-select-filter__toggle-button", onClick: () => this.toggleDropdown(), ref: (el) => (this._toggleButton = el), "aria-haspopup": "true", "aria-label": this.ariaLabel, "aria-describedby": `${this.afFilterButtonAriaDescribedby} ${this.afId}--validation-message`, "aria-controls": `${this.afId}-dropdown-menu`, "aria-expanded": this.isOpen }, index.h("div", { key: '8bb88747afac881b3667ecb60c4adbe36c1325f8', class: Object.assign({ 'digi-form-filter__toggle-button-wrapper': true }, this.cssModifiersToggleButtonWrapper) }, index.h("digi-icon-check", { key: 'a809c5fa00dd4d2a50662aeed3d673cda0289d80', class: Object.assign({ 'digi-form-select-filter__toggle-button-indicator': true }, this.cssModifiersToggleButtonIndicator), slot: "icon" }), index.h("span", { key: 'a5e7f4b998d38a7d912a25b2d7fb0b852b920dc3', class: "digi-form-select-filter__toggle-button-text" }, this.renderButtonLabel)), index.h("digi-icon-chevron-down", { key: 'ef852d8060bacbdef9707dcb23ed3ae1f98cc33f', class: "digi-form-select-filter__toggle-icon" })), index.h("div", { key: '5c5e41376cf7264e837bed3905c971dd0adee156', id: `${this.afId}-dropdown-menu`, tabindex: this.isOpen ? '-1' : undefined, class: {
992
- 'digi-form-select-filter__dropdown': true,
993
- 'digi-form-select-filter__dropdown--right': this.afAlignRight,
994
- 'digi-form-select-filter__dropdown--hidden': !this.isOpen
995
- } }, index.h("fieldset", { key: 'daa4e02e97f5907fc89aeb7a337bd97ceba1c148' }, index.h("div", { key: '99cd8af83d9b1410610f4e49a6759fac20c6955f', class: "digi-form-select-filter__header" }, index.h("legend", { key: '0ed1e17842e0795194c4b74d9600f17c3d2e63b0', class: "digi-form-select-filter__legend" }, this.afFilterButtonTextLabel), index.h("digi-form-input", { key: 'c35f93cb680c6f6e902f281ff597108a9106b016', afLabel: this.afName, afId: `${this.afId}-search`, afVariation: typographyVariation_enum.FormInputVariation.MEDIUM, afType: formInputType_enum.FormInputType.SEARCH, afValidation: typographyVariation_enum.FormInputValidation.NEUTRAL, onAfOnFocus: () => {
996
- this.focusListItemIndex = 0;
997
- }, onAfOnKeyup: (e) => {
998
- this.inputSearchKeyboardHandler(e.detail);
999
- }, onAfOnInput: (e) => this.inputSearchInputHandler(e.detail), afValue: this._searchQuery, class: "digi-form-select-filter__search-input", afAriaControls: `${this.afId}-select-filter-list`, afAutocomplete: "off", afAriaAutocomplete: "none" }), this.renderEmptyStateBox()), index.h("div", { key: '4e2c4a6e6039f8f3efe8cfc75bb302214704073e', class: "digi-form-select-filter__scroll" }, index.h("digi-util-keydown-handler", { key: '751ad128164783be9f7d32d5418d8b99a2be24e3', onAfOnDown: (e) => this.downHandler(e), onAfOnRight: (e) => this.downHandler(e), onAfOnUp: (e) => this.upHandler(e), onAfOnLeft: (e) => this.upHandler(e), onAfOnHome: (e) => this.homeHandler(e), onAfOnEnd: (e) => this.endHandler(e), onAfOnEnter: (e) => this.enterHandler(e), onAfOnSpace: (e) => this.spaceHandler(e), onAfOnTab: () => this.tabHandler(), onAfOnShiftTab: () => this.shiftHandler() }, index.h("ul", { key: '2879b7c081ea2097bd17a9c0f0967b78b9a5d665', class: "digi-form-select-filter__list", "aria-labelledby": `${this.afId}`, id: `${this.afId}-select-filter-list`, role: this.afMultipleItems ? '' : 'radiogroup', "aria-invalid": this.afMultipleItems
1000
- ? 'false'
1001
- : this.afValidation ===
1002
- typographyVariation_enum.FormSelectFilterValidation.ERROR
1003
- ? 'true'
1004
- : 'false', "aria-errormessage": `${this.afId}--validation-message`, "aria-required": this.afMultipleItems
1005
- ? false
1006
- : this.afRequired
1007
- ? 'true'
1008
- : 'false' }, this.showNeutralValue && (index.h("li", { key: '0d51a466af769e3b687805b4cb8027bcac8b5112', class: "digi-form-select-filter__item", role: "radio", "aria-required": this.afMultipleItems
1009
- ? 'false'
1010
- : this.afRequired
1011
- ? 'true'
1012
- : 'false', "aria-checked": this._selectedItems.length === 0 ? 'true' : 'false', onClick: () => this.resetSelectItems(true), tabIndex: 0, "aria-label": this.afFilterButtonText }, this._selectedItems.length === 0 && (index.h("digi-icon-check", { key: '84264b690e6a8b4cd792f6543f00a7f5e559fe06', class: "digi-form-select-filter__item__icon", "aria-hidden": 'true' })), this.afFilterButtonText)), this._filteredResult &&
1013
- this._filteredResult.map((item, index$1) => {
1014
- return (index.h("li", { class: "digi-form-select-filter__item", key: index$1, dir: item.dir, lang: item.lang, "aria-checked": this.isSelected(item.value) ? 'true' : 'false', role: this.afMultipleItems ? 'checkbox' : 'radio', "aria-required": this.afMultipleItems
1015
- ? 'false'
1016
- : this.afRequired
1017
- ? 'true'
1018
- : 'false', "aria-invalid": this.afMultipleItems
1019
- ? this.afValidation ===
1020
- typographyVariation_enum.FormSelectFilterValidation.ERROR
1021
- ? 'true'
1022
- : 'false'
1023
- : 'false', "aria-errormessage": `${this.afId}--validation-message`, onClick: () => this.selectItemHandler(item), tabIndex: this.showNeutralValue
1024
- ? -1
1025
- : index$1 === 0
1026
- ? 0
1027
- : -1 }, this.isSelected(item.value) && (index.h("digi-icon-check", { class: "digi-form-select-filter__item__icon", "aria-hidden": 'true' })), item.label));
1028
- }))))), this.afMultipleItems && (index.h("div", { key: '79def162604c33d3c6acffd7464f2d44f4cf6229', class: "digi-form-select-filter__footer" }, !this.afHideResetButton && (index.h("digi-button", { key: '3ee850fa06c38590c50dcfba11251bd6a4ed5626', "af-variation": "secondary", "af-aria-label": this.afResetButtonTextAriaLabel, onClick: () => this.resetSelectItems(), class: "digi-form-select-filter__reset-button" }, this.afResetButtonText)), index.h("digi-util-keydown-handler", { key: '0fe5d9f9d899d3ddeaf6447485bf5f655e6270ff', onAfOnUp: () => this.setFocusItem() }, index.h("digi-button", { key: '0c14fea74bd16712355a8fafdc17408674ae0489', ref: (el) => (this._submitButton = el), "af-variation": "primary", "af-aria-label": this.afSubmitButtonTextAriaLabel, onClick: () => {
1029
- this.setClosed(true);
1030
- }, class: "digi-form-select-filter__submit-button" }, this.afSubmitButtonText)))))), index.h("div", { key: 'eb9dd0d0150b043458211e89c1311d9c7103d46f', class: "digi-form-select__footer" }, index.h("div", { key: 'f7aca001f6b2580600c1e823e307a4352811bb66', "aria-atomic": "true", role: this.errorMessageIsAlert ? 'alert' : null, id: `${this.afId}--validation-message` }, this.showValidation() && (index.h("digi-form-validation-message", { key: '5802021f469405694a75378fc8830720a9275d41', "af-variation": this.afValidation }, this.afValidationText)))))));
1031
- }
1032
- get hostElement() { return index.getElement(this); }
1033
- static get watchers() { return {
1034
- "value": [{
1035
- "onValueChanged": 0
1036
- }],
1037
- "afListItems": [{
1038
- "handleListItems": 0
1039
- }]
1040
- }; }
1041
- };
1042
- FormSelectFilter.style = formSelectFilterCss();
1043
-
1044
- const formValidationMessageCss = () => `.sc-digi-form-validation-message-h{--digi--form-validation-message--icon-color--success:var(--digi--color--icon--validation--success);--digi--form-validation-message--icon-color--warning:var(--digi--color--icon--validation--warning);--digi--form-validation-message--icon-color--error:var(--digi--color--icon--validation--error)}.sc-digi-form-validation-message-h .digi-form-validation-message.sc-digi-form-validation-message{display:flex;flex-wrap:wrap;align-items:center}.sc-digi-form-validation-message-h .digi-form-validation-message--success.sc-digi-form-validation-message{--ICON-COLOR:var(--digi--form-validation-message--icon-color--success)}.sc-digi-form-validation-message-h .digi-form-validation-message--warning.sc-digi-form-validation-message{--ICON-COLOR:var(--digi--form-validation-message--icon-color--warning)}.sc-digi-form-validation-message-h .digi-form-validation-message--error.sc-digi-form-validation-message{--ICON-COLOR:var(--digi--form-validation-message--icon-color--error)}.sc-digi-form-validation-message-h .digi-form-validation-message__icon.sc-digi-form-validation-message{color:var(--ICON-COLOR);margin-inline-end:var(--digi--gutter--icon)}.sc-digi-form-validation-message-h .digi-form-validation-message__icon.sc-digi-form-validation-message>*.sc-digi-form-validation-message{--digi--icon--width:1.25em;--digi--icon--height:1.25em;--digi--icon--color:var(--ICON-COLOR);display:flex}.sc-digi-form-validation-message-h .digi-form-validation-message__icon.sc-digi-form-validation-message .warning.sc-digi-form-validation-message{top:3px;position:relative}.sc-digi-form-validation-message-h .digi-form-validation-message__text.sc-digi-form-validation-message{flex:1;font-family:var(--digi--global--typography--font-family--default);font-size:var(--digi--typography--tag--font-size--desktop);color:var(--digi--color--text--primary)}`;
1045
-
1046
- const FormValidationMessage = class {
1047
- constructor(hostRef) {
1048
- index.registerInstance(this, hostRef);
1049
- /**
1050
- * Sätter valideringsstatus. Kan vara 'success', 'error' eller 'warning'.
1051
- * @en Set validation status
1052
- */
1053
- this.afVariation = formValidationMessageVariation_enum.FormValidationMessageVariation.SUCCESS;
1054
- }
1055
- get cssModifiers() {
1056
- return {
1057
- 'digi-form-validation-message--success': this.afVariation === formValidationMessageVariation_enum.FormValidationMessageVariation.SUCCESS,
1058
- 'digi-form-validation-message--error': this.afVariation === formValidationMessageVariation_enum.FormValidationMessageVariation.ERROR,
1059
- 'digi-form-validation-message--warning': this.afVariation === formValidationMessageVariation_enum.FormValidationMessageVariation.WARNING
1060
- };
1061
- }
1062
- get icon() {
1063
- switch (this.afVariation) {
1064
- case formValidationMessageVariation_enum.FormValidationMessageVariation.SUCCESS:
1065
- return index.h("digi-icon-validation-success", null);
1066
- case formValidationMessageVariation_enum.FormValidationMessageVariation.ERROR:
1067
- return index.h("digi-icon-validation-error", null);
1068
- case formValidationMessageVariation_enum.FormValidationMessageVariation.WARNING:
1069
- return index.h("digi-icon-validation-warning", { class: "warning" });
1070
- }
1071
- }
1072
- render() {
1073
- return (index.h("div", { key: '5c89cb2cfe7085ec0203814f2c7a43c9fe518db4', class: Object.assign({ 'digi-form-validation-message': true }, this.cssModifiers) }, index.h("div", { key: 'cb85b6a6e02b081710f80ad7bbbe96e182d8c353', class: "digi-form-validation-message__icon", "aria-hidden": "true" }, this.icon), index.h("span", { key: '9b1689dcad19fd3f033c679f496a1c94348f393b', class: "digi-form-validation-message__text" }, index.h("slot", { key: '794c1b1c0771cae8c0b19bd7123f7f5bc28e99b7' }))));
1074
- }
1075
- get hostElement() { return index.getElement(this); }
1076
- };
1077
- FormValidationMessage.style = formValidationMessageCss();
1078
-
1079
- const iconCheckCss = () => `.sc-digi-icon-check-h{--digi--icon--color:var(--digi--color--icon--primary);--digi--icon--width:initial;--digi--icon--height:auto;display:flex;min-height:1.4em;align-items:center}.sc-digi-icon-check-h svg.sc-digi-icon-check{color:var(--digi--icon--color);max-width:var(--digi--icon--width);max-height:var(--digi--icon--height);width:var(--digi--icon--width, auto);height:var(--digi--icon--height, auto)}`;
1080
-
1081
- const IconCheck = class {
1082
- constructor(hostRef) {
1083
- index.registerInstance(this, hostRef);
1084
- /**
1085
- * För att dölja ikonen för skärmläsare. Default är satt till true.
1086
- * @en Hides the icon for screen readers. Default is set to true.
1087
- */
1088
- this.afSvgAriaHidden = true;
1089
- this.titleId = randomIdGenerator_util.randomIdGenerator('icontitle');
1090
- }
1091
- render() {
1092
- return (index.h("svg", { key: '6f876190ee1cdd56d449aab39acdd01f080d6cd6', class: "digi-icon-check", width: "23", height: "18", viewBox: "0 0 23 18", xmlns: "http://www.w3.org/2000/svg", "aria-hidden": this.afSvgAriaHidden ? 'true' : 'false', "aria-labelledby": this.afSvgAriaLabelledby
1093
- ? this.afSvgAriaLabelledby
1094
- : this.afTitle
1095
- ? this.titleId
1096
- : undefined }, this.afTitle && index.h("title", { key: 'bef781ca98e73396b1fe60b65796e2a1e2f9dc05', id: this.titleId }, this.afTitle), this.afDesc && index.h("desc", { key: '9d4a13004fbaaed886b59fc22dbee79245af10de' }, this.afDesc), index.h("path", { key: '102e5f0057f44c0e8a33888386a7777a4ce58b96', class: "digi-icon-check__shape", d: "M20.547.18L7.315 13.627 2.453 8.686a.597.597 0 00-.853 0L.177 10.132a.62.62 0 000 .868l6.711 6.82c.236.24.618.24.854 0L22.823 2.493a.62.62 0 000-.867L21.4.18a.597.597 0 00-.853 0z", fill: "currentColor", "fill-rule": "nonzero" })));
1097
- }
1098
- };
1099
- IconCheck.style = iconCheckCss();
1100
-
1101
- const iconChevronDownCss = () => `.sc-digi-icon-chevron-down-h{--digi--icon--color:var(--digi--color--icon--primary);--digi--icon--width:initial;--digi--icon--height:auto;display:flex;min-height:1.4em;align-items:center}.sc-digi-icon-chevron-down-h svg.sc-digi-icon-chevron-down{color:var(--digi--icon--color);max-width:var(--digi--icon--width);max-height:var(--digi--icon--height);width:var(--digi--icon--width, auto);height:var(--digi--icon--height, auto)}`;
1102
-
1103
- const IconChevronDown = class {
1104
- constructor(hostRef) {
1105
- index.registerInstance(this, hostRef);
1106
- /**
1107
- * För att dölja ikonen för skärmläsare. Default är satt till true.
1108
- * @en Hides the icon for screen readers. Default is set to true.
1109
- */
1110
- this.afSvgAriaHidden = true;
1111
- this.titleId = randomIdGenerator_util.randomIdGenerator('icontitle');
1112
- }
1113
- render() {
1114
- return (index.h("svg", { key: '14c50bb9ce94f2ae7e6b89e99417668515a0e1fa', class: "digi-icon-chevron-down", width: "14", height: "8", viewBox: "0 0 14 8", xmlns: "http://www.w3.org/2000/svg", "aria-hidden": this.afSvgAriaHidden ? 'true' : 'false', "aria-labelledby": this.afSvgAriaLabelledby
1115
- ? this.afSvgAriaLabelledby
1116
- : this.afTitle
1117
- ? this.titleId
1118
- : undefined }, this.afTitle && index.h("title", { key: '4692fea634337c2e89e5eeac67c707c84f919563', id: this.titleId }, this.afTitle), this.afDesc && index.h("desc", { key: '3948943affb34ebc1967aeb54389b0c3230e6daf' }, this.afDesc), index.h("path", { key: '252f72d574b43e0d794341fa05f5a2cf39cedb4d', class: "digi-icon-chevron-down__shape", d: "M1 1l6.074 6L13 1.147", stroke: "currentColor", "stroke-width": "2", fill: "none", "fill-rule": "evenodd" })));
1119
- }
1120
- };
1121
- IconChevronDown.style = iconChevronDownCss();
1122
-
1123
- const iconValidationErrorCss = () => `.sc-digi-icon-validation-error-h{--digi--icon--color:var(--digi--color--icon--primary);--digi--icon--width:initial;--digi--icon--height:auto;display:flex;min-height:1.4em;align-items:center}.sc-digi-icon-validation-error-h svg.sc-digi-icon-validation-error{color:var(--digi--icon--color);max-width:var(--digi--icon--width);max-height:var(--digi--icon--height);width:var(--digi--icon--width, auto);height:var(--digi--icon--height, auto)}`;
1124
-
1125
- const IconValidationError = class {
1126
- constructor(hostRef) {
1127
- index.registerInstance(this, hostRef);
1128
- /**
1129
- * För att dölja ikonen för skärmläsare. Default är satt till true.
1130
- * @en Hides the icon for screen readers. Default is set to true.
1131
- */
1132
- this.afSvgAriaHidden = true;
1133
- this.titleId = randomIdGenerator_util.randomIdGenerator('icontitle');
1134
- }
1135
- render() {
1136
- return (index.h("svg", { key: 'b20fb61395f90adad2b9e5be72d3e2ea3c5a3feb', class: "digi-icon-validation-error", width: "48", height: "48", viewBox: "0 0 48 48", xmlns: "http://www.w3.org/2000/svg", "aria-hidden": this.afSvgAriaHidden ? 'true' : 'false', "aria-labelledby": this.afSvgAriaLabelledby
1137
- ? this.afSvgAriaLabelledby
1138
- : this.afTitle
1139
- ? this.titleId
1140
- : undefined }, this.afTitle && index.h("title", { key: '5e08a1b947d534b913fff06e02109b53c607a0be', id: this.titleId }, this.afTitle), this.afDesc && index.h("desc", { key: 'f016b92eb4957943a5308d12db1ce2f1b73fae3f' }, this.afDesc), index.h("path", { key: 'f5ba662eeb6689959a6990ae2e880edc42670490', class: "digi-icon-validation-error__shape", d: "M34.4328058,0 C35.5494848,0 36.5900526,0.609146757 37.1483921,1.58958113 L47.5812454,19.9104189 C48.1395849,20.8909496 48.1395849,22.1090504 47.5812454,23.0895811 L37.1483921,41.4104189 C36.5900526,42.3908532 35.5494848,43 34.4328058,43 L13.5671942,43 C12.4505152,43 11.4099474,42.3908532 10.8516079,41.4104189 L0.41875464,23.0895811 C-0.13958488,22.1090504 -0.13958488,20.8909496 0.41875464,19.9104189 L10.8516079,1.58958113 C11.4099474,0.609146757 12.4505152,0 13.5671942,0 Z M18.6736823,12.3728178 C18.2711762,11.964729 17.6203819,11.964729 17.2178757,12.3728178 L15.2825964,14.334939 C14.8800903,14.7430278 14.8800903,15.4028485 15.2825964,15.8109373 L20.6089616,21.2111779 L15.2825964,26.6114185 C14.8800903,27.0195074 14.8800903,27.6793281 15.2825964,28.0874169 L17.2178757,30.049538 C17.6203819,30.4576269 18.2711762,30.4576269 18.6736823,30.049538 L24.0000475,24.6492974 L29.3264127,30.049538 C29.7289188,30.4576269 30.3797132,30.4576269 30.7822193,30.049538 L32.7174986,28.0874169 C33.1200048,27.6793281 33.1200048,27.0195074 32.7174986,26.6114185 L27.3911334,21.2111779 L32.7174986,15.8109373 C33.1200048,15.4028485 33.1200048,14.7430278 32.7174986,14.334939 L30.7822193,12.3728178 C30.3797132,11.964729 29.7289188,11.964729 29.3264127,12.3728178 L24.0000475,17.7730584 Z", fill: "currentColor", "fill-rule": "nonzero" })));
1141
- }
1142
- };
1143
- IconValidationError.style = iconValidationErrorCss();
1144
-
1145
- const iconValidationSuccessCss = () => `.sc-digi-icon-validation-success-h{--digi--icon--color:var(--digi--color--icon--primary);--digi--icon--width:initial;--digi--icon--height:auto;display:flex;min-height:1.4em;align-items:center}.sc-digi-icon-validation-success-h svg.sc-digi-icon-validation-success{color:var(--digi--icon--color);max-width:var(--digi--icon--width);max-height:var(--digi--icon--height);width:var(--digi--icon--width, auto);height:var(--digi--icon--height, auto)}`;
1146
-
1147
- const IconCheckCircle = class {
1148
- constructor(hostRef) {
1149
- index.registerInstance(this, hostRef);
1150
- /**
1151
- * För att dölja ikonen för skärmläsare. Default är satt till true.
1152
- * @en Hides the icon for screen readers. Default is set to true.
1153
- */
1154
- this.afSvgAriaHidden = true;
1155
- this.titleId = randomIdGenerator_util.randomIdGenerator('icontitle');
1156
- }
1157
- render() {
1158
- return (index.h("svg", { key: '1c9dcaf014e400504cbce24f69c67bdbb1dc0361', class: "digi-icon-validation-success", width: "25", height: "25", viewBox: "0 0 25 25", "aria-hidden": this.afSvgAriaHidden ? 'true' : 'false', "aria-labelledby": this.afSvgAriaLabelledby
1159
- ? this.afSvgAriaLabelledby
1160
- : this.afTitle
1161
- ? this.titleId
1162
- : undefined, xmlns: "http://www.w3.org/2000/svg" }, this.afTitle && index.h("title", { key: 'ed5b4d39b987b025d99ef2ce2153a8de749f587e', id: this.titleId }, this.afTitle), this.afDesc && index.h("desc", { key: '7c5175b745577dd9076170ba83fa00f8cc03c4a2' }, this.afDesc), index.h("path", { key: 'f9cb601de2dfbf7959b2b43023692e111f1fbf91', class: "digi-icon-validation-success__shape", d: "M25 12.5C25 19.404 19.404 25 12.5 25S0 19.404 0 12.5 5.596 0 12.5 0 25 5.596 25 12.5zm-13.946 6.619l9.274-9.275a.806.806 0 000-1.14l-1.14-1.14a.806.806 0 00-1.14 0l-7.564 7.563-3.531-3.531a.807.807 0 00-1.14 0l-1.141 1.14a.806.806 0 000 1.14l5.242 5.243a.806.806 0 001.14 0z", fill: "currentColor", "fill-rule": "nonzero" })));
1163
- }
1164
- };
1165
- IconCheckCircle.style = iconValidationSuccessCss();
1166
-
1167
- const iconValidationWarningCss = () => `.sc-digi-icon-validation-warning-h{--digi--icon--color:var(--digi--color--icon--primary);--digi--icon--width:initial;--digi--icon--height:auto;display:flex;min-height:1.4em;align-items:center}.sc-digi-icon-validation-warning-h svg.sc-digi-icon-validation-warning{color:var(--digi--icon--color);max-width:var(--digi--icon--width);max-height:var(--digi--icon--height);width:var(--digi--icon--width, auto);height:var(--digi--icon--height, auto)}`;
1168
-
1169
- const IconValidationWarning = class {
1170
- constructor(hostRef) {
1171
- index.registerInstance(this, hostRef);
1172
- /**
1173
- * För att dölja ikonen för skärmläsare. Default är satt till true.
1174
- * @en Hides the icon for screen readers. Default is set to true.
1175
- */
1176
- this.afSvgAriaHidden = true;
1177
- this.titleId = randomIdGenerator_util.randomIdGenerator('icontitle');
1178
- }
1179
- render() {
1180
- return (index.h("div", { key: '7017a09730cca2dafe42548b11d18e34a693f81b' }, index.h("svg", { key: 'd56b196f88aaf6dd87bb416e422d399667e80202', class: "digi-icon-validation-warning", width: "18", height: "18", viewBox: "0 0 18 18", xmlns: "http://www.w3.org/2000/svg", "aria-hidden": this.afSvgAriaHidden ? 'true' : 'false', "aria-labelledby": this.afSvgAriaLabelledby
1181
- ? this.afSvgAriaLabelledby
1182
- : this.afTitle
1183
- ? this.titleId
1184
- : undefined }, this.afTitle && index.h("title", { key: '25751b0fd552d8dcabc3402345ba8528126dd973', id: this.titleId }, this.afTitle), this.afDesc && index.h("desc", { key: '41476cbdf1b92dd9b7c44d8791481a5cf00186ca' }, this.afDesc), index.h("g", { key: '6607df5c4713e5680fcaa2e9ea29b7cab5064e3d', fill: "none", "fill-rule": "evenodd" }, index.h("circle", { key: 'c87e6472093671bc2f1f6b3d7eb0b34f512468c1', cx: "9", cy: "9", r: "6.75", fill: "#333" }), index.h("path", { key: '17b79d3e780ecbb2394b38586388ea457c65a2f7', d: "m18 9c0 4.9717-4.0298 9-9 9-4.9702 0-9-4.0283-9-9 0-4.9688 4.0298-9 9-9 4.9702 0 9 4.0312 9 9zm-9 1.8145c-0.92196 0-1.6694 0.7474-1.6694 1.6694 0 0.92196 0.7474 1.6694 1.6694 1.6694s1.6694-0.7474 1.6694-1.6694c0-0.92196-0.7474-1.6694-1.6694-1.6694zm-1.3157-1.065c0.012593 0.23095 0.20355 0.41175 0.43483 0.41175h1.7618c0.23128 0 0.42224-0.1808 0.43483-0.41175l0.2692-4.9355c0.013609-0.24946-0.18501-0.45922-0.43483-0.45922h-2.3002c-0.24982 0-0.4484 0.20976-0.43479 0.45922l0.2692 4.9355z", fill: "#FFE200" })))));
1185
- }
1186
- };
1187
- IconValidationWarning.style = iconValidationWarningCss();
1188
-
1189
- const UtilKeydownHandler = class {
1190
- constructor(hostRef) {
1191
- index.registerInstance(this, hostRef);
1192
- this.afOnEsc = index.createEvent(this, "afOnEsc", 7);
1193
- this.afOnEnter = index.createEvent(this, "afOnEnter", 7);
1194
- this.afOnTab = index.createEvent(this, "afOnTab", 7);
1195
- this.afOnSpace = index.createEvent(this, "afOnSpace", 7);
1196
- this.afOnShiftTab = index.createEvent(this, "afOnShiftTab", 7);
1197
- this.afOnUp = index.createEvent(this, "afOnUp", 7);
1198
- this.afOnDown = index.createEvent(this, "afOnDown", 7);
1199
- this.afOnLeft = index.createEvent(this, "afOnLeft", 7);
1200
- this.afOnRight = index.createEvent(this, "afOnRight", 7);
1201
- this.afOnHome = index.createEvent(this, "afOnHome", 7);
1202
- this.afOnEnd = index.createEvent(this, "afOnEnd", 7);
1203
- this.afOnKeyDown = index.createEvent(this, "afOnKeyDown", 7);
1204
- }
1205
- keydownHandler(e) {
1206
- const key = keyboardHandler_util.keyboardHandler(e);
1207
- switch (key) {
1208
- case keyboardHandler_util.KEY_CODE.SHIFT_TAB:
1209
- this.afOnShiftTab.emit(e);
1210
- break;
1211
- case keyboardHandler_util.KEY_CODE.DOWN_ARROW:
1212
- this.afOnDown.emit(e);
1213
- this.afOnKeyDown.emit(e);
1214
- break;
1215
- case keyboardHandler_util.KEY_CODE.UP_ARROW:
1216
- this.afOnUp.emit(e);
1217
- this.afOnKeyDown.emit(e);
1218
- break;
1219
- case keyboardHandler_util.KEY_CODE.LEFT_ARROW:
1220
- this.afOnLeft.emit(e);
1221
- this.afOnKeyDown.emit(e);
1222
- break;
1223
- case keyboardHandler_util.KEY_CODE.RIGHT_ARROW:
1224
- this.afOnRight.emit(e);
1225
- this.afOnKeyDown.emit(e);
1226
- break;
1227
- case keyboardHandler_util.KEY_CODE.ENTER:
1228
- this.afOnEnter.emit(e);
1229
- this.afOnKeyDown.emit(e);
1230
- break;
1231
- case keyboardHandler_util.KEY_CODE.ESCAPE:
1232
- this.afOnEsc.emit(e);
1233
- this.afOnKeyDown.emit(e);
1234
- break;
1235
- case keyboardHandler_util.KEY_CODE.TAB:
1236
- this.afOnTab.emit(e);
1237
- this.afOnKeyDown.emit(e);
1238
- break;
1239
- case keyboardHandler_util.KEY_CODE.SPACE:
1240
- this.afOnSpace.emit(e);
1241
- this.afOnKeyDown.emit(e);
1242
- break;
1243
- case keyboardHandler_util.KEY_CODE.HOME:
1244
- this.afOnHome.emit(e);
1245
- this.afOnKeyDown.emit(e);
1246
- break;
1247
- case keyboardHandler_util.KEY_CODE.END:
1248
- this.afOnEnd.emit(e);
1249
- this.afOnKeyDown.emit(e);
1250
- break;
1251
- case keyboardHandler_util.KEY_CODE.ANY:
1252
- this.afOnKeyDown.emit(e);
1253
- break;
1254
- default:
1255
- this.afOnKeyDown.emit(e);
1256
- return;
1257
- }
1258
- }
1259
- render() {
1260
- return index.h("slot", { key: 'c0a9e056eb5e48ce215370d38ee65a62ca2e33d9' });
1261
- }
1262
- };
1263
-
1264
- exports.digi_button = Button;
1265
- exports.digi_form_input = FormInput;
1266
- exports.digi_form_label = FormLabel;
1267
- exports.digi_form_select_filter = FormSelectFilter;
1268
- exports.digi_form_validation_message = FormValidationMessage;
1269
- exports.digi_icon_check = IconCheck;
1270
- exports.digi_icon_chevron_down = IconChevronDown;
1271
- exports.digi_icon_validation_error = IconValidationError;
1272
- exports.digi_icon_validation_success = IconCheckCircle;
1273
- exports.digi_icon_validation_warning = IconValidationWarning;
1274
- exports.digi_util_keydown_handler = UtilKeydownHandler;