@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,1262 +0,0 @@
1
- import { r as registerInstance, c as createEvent, h, a as Host, d as getElement, F as Fragment } from './index-Co_lVhh_.js';
2
- import { r as randomIdGenerator } from './randomIdGenerator.util-BGaIliX6.js';
3
- import { B as ButtonSize } from './code-example-variation.enum-Ooszw6tl.js';
4
- import { B as ButtonType, b as FormInputType, a as FormInputButtonVariation } from './form-input-type.enum-CN1mgrt1.js';
5
- import { B as ButtonVariation } from './button-variation.enum-y5Nm4oWF.js';
6
- import { e as FormInputMode, g as FormInputVariation, f as FormInputValidation, o as FormSelectFilterValidation } from './typography-variation.enum-BDBYHWrh.js';
7
- import { l as logger } from './logger.util-DdB9j8uV.js';
8
- import { _ as _t } from './text-DsO1BTml.js';
9
- import { d as detectClickOutside } from './detectClickOutside.util-ROzp1Ej2.js';
10
- import { d as detectFocusOutside } from './detectFocusOutside.util-aFLLVVle.js';
11
- import './badge-notification-shape.enum-CKoZU0-H.js';
12
- import './badge-status-variation.enum-C0A-p3cU.js';
13
- import './calendar-week-view-heading-level.enum-DH_-wpLB.js';
14
- import './bar-chart-variation.enum-DPeoHh1J.js';
15
- import './code-variation.enum-qc6KRZue.js';
16
- import './expandable-accordion-header-level.enum-DwNlf6Sh.js';
17
- import './expandable-faq-item-variation.enum-C6B2KRZo.js';
18
- import './expandable-faq-variation.enum-CES5gUEo.js';
19
- import './footer-card-variation.enum-DzSu1-K0.js';
20
- import './form-checkbox-variation.enum-6-MpaVf8.js';
21
- import { c as FormValidationMessageVariation } from './form-validation-message-variation.enum-9n7Okhf1.js';
22
- import './form-radiogroup-validation.enum-DcnvI7UR.js';
23
- import './form-select-variation.enum-DCS1KcvC.js';
24
- import './form-textarea-variation.enum-DogB9kfH.js';
25
- import './info-card-multi-type.enum-CkIb3cUS.js';
26
- import './info-card-variation.enum-_ycZeBN4.js';
27
- import './layout-container-max-width.enum-CuhrrYGE.js';
28
- import './layout-block-variation.enum-CWFirwyE.js';
29
- import './layout-columns-variation.enum-DJCufAhy.js';
30
- import './link-button-variation.enum-CPzcg9n3.js';
31
- import './list-type.enum-CsNHGpkJ.js';
32
- import './loader-skeleton-variation.enum-D_VIx0pC.js';
33
- import './loader-spinner-size.enum-ArGkfrXt.js';
34
- import './logo-color.enum-Chk3GCYK.js';
35
- import './media-figure-alignment.enum-evtVuhQt.js';
36
- import './navigation-sidebar-variation.enum-V-HTxO5a.js';
37
- import './navigation-vertical-menu-variation.enum-DPkRL9Bv.js';
38
- import './progress-circle-role.enum-w8pbG68a.js';
39
- import './progress-indicator-variation.enum-DMrSPsPW.js';
40
- import './progress-list-item-variation.enum-DXqRzyRP.js';
41
- import './progress-list-variation.enum-DoZkBEe8.js';
42
- import './progressbar-variation.enum-m9xS70Ez.js';
43
- import './quote-image-inner-position.enum-CmH9mJ43.js';
44
- import './table-variation.enum-DBcU_EnL.js';
45
- import './tag-media-icon.enum-BvcVTm_t.js';
46
- import './tag-size.enum-bQJ38En_.js';
47
- import './tools-feedback-banner-type.enum-DrVSK7Ws.js';
48
- import './tools-feedback-rating-variation.enum-CAmn5qzb.js';
49
- import './tools-theme-provider.brand.enum-DpDyNuVC.js';
50
- import './typography-heading-jumbo-variation.enum-DNjGvZvz.js';
51
- import './typography-meta-variation.enum-CHxBAbI8.js';
52
- import './typography-time-variation.enum-rhVqmQwC.js';
53
- import './util-breakpoint-observer-breakpoints.enum-DPq588Q4.js';
54
- import { K as KEY_CODE, k as keyboardHandler } from './keyboardHandler.util-CflatMTG.js';
55
- import './detectClosest.util-DwBvm-Nc.js';
56
-
57
- 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)}`;
58
-
59
- const Button = class {
60
- constructor(hostRef) {
61
- registerInstance(this, hostRef);
62
- this.afOnClick = createEvent(this, "afOnClick", 7);
63
- this.afOnFocus = createEvent(this, "afOnFocus", 7);
64
- this.afOnBlur = createEvent(this, "afOnBlur", 7);
65
- this.afOnReady = createEvent(this, "afOnReady", 3);
66
- /**
67
- * Sätter knappens storlek. 'medium' är förvalt.
68
- * @en Set button size. Defaults to medium size.
69
- */
70
- this.afSize = ButtonSize.MEDIUM;
71
- /**
72
- * Sätt variant. Om varianten är 'tertiary' så krävs även en ikon.
73
- * @en Set button variation. If set to FUNCTION, the button also needs an icon.
74
- */
75
- this.afVariation = ButtonVariation.PRIMARY;
76
- /**
77
- * Sätt attributet 'type'.
78
- * @en Set button `type` attribute.
79
- */
80
- this.afType = ButtonType.BUTTON;
81
- /**
82
- * Sätter attributet 'id'. Om inget väljs så skapas ett slumpmässigt id.
83
- * @en Input id attribute. Defaults to random string.
84
- */
85
- this.afId = randomIdGenerator('digi-button');
86
- /**
87
- * Sätter knappens bredd till 100%.
88
- * @en Set button width to 100%.
89
- */
90
- this.afFullWidth = false;
91
- }
92
- fullWidthHandler() {
93
- this.isFullSize = this.afFullWidth;
94
- }
95
- /**
96
- * Hämta en referens till buttonelementet. Bra för att t.ex. sätta fokus programmatiskt.
97
- * @en Returns a reference to the button element. Handy for setting focus programmatically.
98
- */
99
- async afMGetButtonElement() {
100
- return this._button;
101
- }
102
- componentWillLoad() {
103
- this.setHasIcon();
104
- this.fullWidthHandler();
105
- }
106
- componentWillUpdate() {
107
- this.setHasIcon();
108
- }
109
- componentDidLoad() {
110
- this.afOnReady.emit();
111
- }
112
- setHasIcon() {
113
- const icon = !!this.hostElement.querySelector('[slot="icon"]');
114
- const iconSecondary = !!this.hostElement.querySelector('[slot="icon-secondary"]');
115
- if (icon) {
116
- this.hasIcon = icon;
117
- }
118
- if (iconSecondary) {
119
- this.hasIconSecondary = iconSecondary;
120
- }
121
- }
122
- get cssModifiers() {
123
- return {
124
- [`digi-button--variation-${this.afVariation}`]: !!this.afVariation,
125
- [`digi-button--size-${this.afSize}`]: !!this.afSize,
126
- 'digi-button--icon': this.hasIcon,
127
- 'digi-button--icon-secondary': this.hasIconSecondary,
128
- 'digi-button--full-width': this.isFullSize
129
- };
130
- }
131
- get pressedState() {
132
- if (this.afAriaPressed === null || this.afAriaPressed === undefined) {
133
- return;
134
- }
135
- return this.afAriaPressed ? 'true' : 'false';
136
- }
137
- get expandedState() {
138
- if (this.afAriaExpanded === null || this.afAriaExpanded === undefined) {
139
- return;
140
- }
141
- return this.afAriaExpanded ? 'true' : 'false';
142
- }
143
- get hasPopup() {
144
- if (this.afAriaHaspopup === null || this.afAriaHaspopup === undefined) {
145
- return;
146
- }
147
- return this.afAriaHaspopup ? 'true' : 'false';
148
- }
149
- clickHandler(e) {
150
- this.afOnClick.emit(e);
151
- }
152
- focusHandler(e) {
153
- this.afOnFocus.emit(e);
154
- }
155
- blurHandler(e) {
156
- this.afOnBlur.emit(e);
157
- }
158
- render() {
159
- return (h(Host, { key: '3a398d75ad83e3caa9ec54928544d5bf8315d30f' }, h("button", { key: '2159552d7e8064acbb6da5c02c28ead3d4985e85', class: Object.assign({ 'digi-button': true }, this.cssModifiers), type: this.afType, role: this.afRole, ref: (el) => {
160
- var _a, _b, _c;
161
- this._button = el;
162
- (_a = this === null || this === void 0 ? void 0 : this.afInputRef) === null || _a === void 0 ? void 0 : _a.call(this, el);
163
- // Stencil has a bug wiith form attribute so we need to set it like this
164
- // https://github.com/ionic-team/stencil/issues/2703
165
- this.afForm
166
- ? (_b = this._button) === null || _b === void 0 ? void 0 : _b.setAttribute('form', this.afForm)
167
- : (_c = this._button) === null || _c === void 0 ? void 0 : _c.removeAttribute('form');
168
- }, 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 && (h("span", { key: '1188d5cb005a51e4e065b70663d06877db3a1477', class: "digi-button__icon" }, h("slot", { key: 'f90319563c18e1f82fa13f478b4d4d13ce3e9bf7', name: "icon" }))), h("span", { key: '17dce8eed2e845ca6166cf85a1c0252c2c0b8037', class: "digi-button__text" }, h("slot", { key: '2f637e48b837ecd0f0f2333349f328c497aee650' })), this.hasIconSecondary && (h("span", { key: '49ffd3361b0cc00c074e1ce332dab2de33127fcc', class: "digi-button__icon digi-button__icon--secondary" }, h("slot", { key: '367d3ba37e2fd0b7e83d600f35d02d4df303c1c0', name: "icon-secondary" }))))));
169
- }
170
- get hostElement() { return getElement(this); }
171
- static get watchers() { return {
172
- "afFullWidth": [{
173
- "fullWidthHandler": 0
174
- }]
175
- }; }
176
- };
177
- Button.style = buttonCss();
178
-
179
- 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}`;
180
-
181
- const FormInput = class {
182
- constructor(hostRef) {
183
- registerInstance(this, hostRef);
184
- this.afOnChange = createEvent(this, "afOnChange", 7);
185
- this.afOnBlur = createEvent(this, "afOnBlur", 7);
186
- this.afOnKeyup = createEvent(this, "afOnKeyup", 7);
187
- this.afOnFocus = createEvent(this, "afOnFocus", 7);
188
- this.afOnFocusout = createEvent(this, "afOnFocusout", 7);
189
- this.afOnInput = createEvent(this, "afOnInput", 7);
190
- this.afOnDirty = createEvent(this, "afOnDirty", 7);
191
- this.afOnTouched = createEvent(this, "afOnTouched", 7);
192
- this.afOnReady = createEvent(this, "afOnReady", 3);
193
- this.hasActiveValidationMessage = false;
194
- this.dirty = false;
195
- this.touched = false;
196
- /**
197
- * Sätter attributet 'type'.
198
- * @en Input type attribute
199
- */
200
- this.afType = FormInputType.TEXT;
201
- /**
202
- * Sätter attributet 'inputmode'.
203
- * @en Inputmode type attribute
204
- */
205
- this.afInputmode = FormInputMode.DEFAULT;
206
- /**
207
- * Layout för hur inmatningsfältet ska visas då det finns en knapp
208
- * @en Input layout when there is a button
209
- */
210
- this.afButtonVariation = FormInputButtonVariation.PRIMARY;
211
- /**
212
- * Sätter variant. Kan vara 'small', 'medium' eller 'large'
213
- * @en Set input variation.
214
- */
215
- this.afVariation = FormInputVariation.MEDIUM;
216
- /**
217
- * Sätter attributet 'id'. Om inget väljs så skapas ett slumpmässigt id.
218
- * @en Input id attribute. Defaults to random string.
219
- */
220
- this.afId = randomIdGenerator('digi-form-input');
221
- /**
222
- * Sätt denna till true om formuläret innehåller fler obligatoriska fält än valfria.
223
- * @en Set this to true if the form contains more required fields than optional fields.
224
- */
225
- this.afAnnounceIfOptional = false;
226
- /**
227
- * Sätter valideringsstatus. Kan vara 'success', 'error', 'warning', 'neutral' eller ingenting.
228
- * @en Set input validation status
229
- */
230
- this.afValidation = FormInputValidation.NEUTRAL;
231
- /**
232
- * Om värdet är true får felmeddelandet attributet role="alert".
233
- * Om felet visas tillsammans med flera andra fel (till exempel efter servervalidering) ska värdet sättas till false.
234
- * @en If the value is true, the error message gets the attribute role="alert".
235
- * If the error is shown together with multiple errors (for example after server-side validation), the value should be set to false.
236
- */
237
- this.afErrorMessageIsAlert = true;
238
- }
239
- onValueChanged(value) {
240
- this.afValue = value;
241
- }
242
- onAfValueChanged(value) {
243
- this.value = value;
244
- if (this._input && this._input.value !== String(value !== null && value !== void 0 ? value : '')) {
245
- this._input.value = String(value !== null && value !== void 0 ? value : '');
246
- }
247
- }
248
- get errorMessageIsAlert() {
249
- return (this.afErrorMessageIsAlert !== false &&
250
- this.afErrorMessageIsAlert !== 'false');
251
- }
252
- afValidationTextWatch() {
253
- this.setActiveValidationMessage();
254
- }
255
- /**
256
- * Hämtar en referens till inputelementet. Bra för att t.ex. sätta fokus programmatiskt.
257
- * @en Returns a reference to the input element. Handy for setting focus programmatically.
258
- */
259
- async afMGetFormControlElement() {
260
- return this._input;
261
- }
262
- /**
263
- * Lyssnar på om fokus sätts på custom-elementet och propagerar ner det till själva input-elementet.
264
- * @en Listens for when focus is set on the custom element and propagates it down to the actual input element.
265
- */
266
- focusOnInput() {
267
- this._input.focus();
268
- }
269
- componentWillLoad() {
270
- this.afValue ? (this.value = this.afValue) : (this.afValue = this.value);
271
- this.setActiveValidationMessage();
272
- this.setHasButton();
273
- }
274
- componentWillUpdate() {
275
- this.setHasButton();
276
- }
277
- componentDidLoad() {
278
- this.afOnReady.emit();
279
- }
280
- setActiveValidationMessage() {
281
- this.hasActiveValidationMessage = !!this.afValidationText;
282
- }
283
- get cssModifiers() {
284
- return {
285
- 'digi-form-input--small': this.afVariation === FormInputVariation.SMALL,
286
- 'digi-form-input--medium': this.afVariation === FormInputVariation.MEDIUM,
287
- 'digi-form-input--large': this.afVariation === FormInputVariation.LARGE,
288
- 'digi-form-input--neutral': this.afValidation === FormInputValidation.NEUTRAL,
289
- 'digi-form-input--success': this.afValidation === FormInputValidation.SUCCESS,
290
- 'digi-form-input--error': this.afValidation === FormInputValidation.ERROR,
291
- 'digi-form-input--warning': this.afValidation === FormInputValidation.WARNING,
292
- [`digi-form-input--button-variation-${this.afButtonVariation}`]: !!this.afButtonVariation,
293
- [`digi-form-input--has-button-${this.hasButton}`]: true,
294
- 'digi-form-input--empty': !this.afValue &&
295
- (!this.afValidation ||
296
- this.afValidation === FormInputValidation.NEUTRAL)
297
- };
298
- }
299
- blurHandler(e) {
300
- const trimableTypes = [
301
- FormInputType.TEXT,
302
- FormInputType.EMAIL,
303
- FormInputType.SEARCH,
304
- FormInputType.TEL,
305
- FormInputType.URL
306
- ];
307
- const shouldTrim = this.afTrimValue && trimableTypes.includes(this.afType);
308
- if (shouldTrim && typeof e.target.value === 'string') {
309
- const trimmedValue = e.target.value.trim();
310
- if (trimmedValue !== e.target.value) {
311
- this.afValue = this.value = trimmedValue;
312
- if (this._input) {
313
- this._input.value = trimmedValue;
314
- }
315
- // Emittar afOnInput så Angulars value accessor får det trimmade värdet
316
- this.afOnInput.emit(e);
317
- }
318
- }
319
- if (!this.touched) {
320
- this.afOnTouched.emit(e);
321
- this.touched = true;
322
- }
323
- this.afOnBlur.emit(e);
324
- }
325
- changeHandler(e) {
326
- this.setActiveValidationMessage();
327
- this.afOnChange.emit(e);
328
- }
329
- focusHandler(e) {
330
- this.afOnFocus.emit(e);
331
- }
332
- focusoutHandler(e) {
333
- this.afOnFocusout.emit(e);
334
- }
335
- keyupHandler(e) {
336
- this.afOnKeyup.emit(e);
337
- }
338
- inputHandler(e) {
339
- this.afValue = this.value =
340
- this.afType === FormInputType.NUMBER
341
- ? parseFloat(e.target.value)
342
- : e.target.value;
343
- if (!this.dirty) {
344
- this.afOnDirty.emit(e);
345
- this.dirty = true;
346
- }
347
- this.setActiveValidationMessage();
348
- this.afOnInput.emit(e);
349
- }
350
- setHasButton() {
351
- this.hasButton = !!this.hostElement.querySelector('[slot="button"]');
352
- }
353
- render() {
354
- return (h(Host, { key: '2739bdd7385125581d7ea9c25a3610f5950c6a74', tabindex: -1 }, h("div", { key: '7e261c1e2fc4f37f4ddda861872a470c89181e16', class: Object.assign({ 'digi-form-input': true }, this.cssModifiers) }, 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 }), h("div", { key: '68d715181c180ebaf957dfb46afb63b19b8a8188', class: "digi-form-input__input-wrapper" }, 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 === FormInputValidation.ERROR
355
- ? 'true'
356
- : '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 == FormInputMode.DEFAULT
357
- ? {}
358
- : { inputmode: this.afInputmode }))), h("slot", { key: 'c14ae079a53099fc3928bcf3ac7f5517c20b0f36', name: "button" })), h("div", { key: '75d6afa176cd8620e31c384e169b3c84a3bb584d', class: "digi-form-input__footer" }, h("div", { key: '81029d425aae06e3c72c08afe982f2ff1a7bb81d', class: "digi-form-input__validation", "aria-atomic": "true", role: this.errorMessageIsAlert ? 'alert' : null, id: `${this.afId}--validation-message` }, this.hasActiveValidationMessage &&
359
- this.afValidation != FormInputValidation.NEUTRAL && (h("digi-form-validation-message", { key: '9a8fec12db8c78a037a9b70194b32814d7641dad', class: "digi-form-input__validation-message", "af-variation": this.afValidation }, this.afValidationText)))))));
360
- }
361
- get hostElement() { return getElement(this); }
362
- static get watchers() { return {
363
- "value": [{
364
- "onValueChanged": 0
365
- }],
366
- "afValue": [{
367
- "onAfValueChanged": 0
368
- }],
369
- "afValidationText": [{
370
- "afValidationTextWatch": 0
371
- }]
372
- }; }
373
- };
374
- FormInput.style = formInputCss();
375
-
376
- 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)}`;
377
-
378
- const FormLabel = class {
379
- constructor(hostRef) {
380
- registerInstance(this, hostRef);
381
- /**
382
- * Sätter attributet 'id'. Om inget väljs så skapas ett slumpmässigt id.
383
- * @en Set id attribute. Defaults to random string.
384
- */
385
- this.afId = randomIdGenerator('digi-form-label');
386
- /**
387
- * Sätt denna till true om formuläret innehåller fler obligatoriska fält än valfria.
388
- * @en Set this to true if the form contains more required fields than optional fields.
389
- */
390
- this.afAnnounceIfOptional = false;
391
- /**
392
- * Sätter text för afRequired.
393
- * @en Set text for afRequired.
394
- */
395
- this.afRequiredText = _t.required.toLowerCase();
396
- /**
397
- * Sätter text för afAnnounceIfOptional.
398
- * @en Set text for afAnnounceIfOptional.
399
- */
400
- this.afAnnounceIfOptionalText = _t.optional.toLowerCase();
401
- }
402
- componentWillLoad() {
403
- this.setLabelText();
404
- this.validateFor();
405
- this.handleSlotVisibility();
406
- }
407
- validateFor() {
408
- if (this.afFor == null) {
409
- logger.warn(`digi-form-label must have a for attribute. Please add a for attribute using af-for`, this.hostElement);
410
- }
411
- }
412
- setLabelText() {
413
- this.labelText = `${this.afLabel} ${this.requiredText}`;
414
- if (!this.afLabel) {
415
- logger.warn(`digi-form-label must have a label. Please add a label using af-label`, this.hostElement);
416
- }
417
- }
418
- handleSlotVisibility() {
419
- this.hasActionSlot = !!this.hostElement.querySelector('[slot="actions"]');
420
- }
421
- get requiredText() {
422
- if (this.afRequired && !this.afAnnounceIfOptional) {
423
- return this.afRequiredText ? ` (${this.afRequiredText})` : '';
424
- }
425
- else if (!this.afRequired && this.afAnnounceIfOptional) {
426
- return this.afAnnounceIfOptionalText
427
- ? ` (${this.afAnnounceIfOptionalText})`
428
- : '';
429
- }
430
- else {
431
- return '';
432
- }
433
- }
434
- render() {
435
- return (h("div", { key: 'ac9aec4d1d20cc37694af578a97a16a17291c9f3', class: "digi-form-label" }, h("div", { key: 'bf27c3012d1973798095e6b832572fc20863c5f1', class: "digi-form-label__label-group" }, this.afFor && this.afLabel && (h("label", { key: '75435e49548e4fa27330a35b033689a0ed9e99a7', class: "digi-form-label__label", htmlFor: this.afFor, id: this.afId }, h("span", { key: '0527ddcebbd2a1b215f42eaed06ba7fc28633d43', class: "digi-form-label__label--label" }, this.labelText), this.afDescription && (h("span", { key: '8a3b3e6a0ec0a97adb0760b390f0ddb34b3e0b87', class: "digi-form-label__label--description" }, this.afDescription)))), this.hasActionSlot && (h("div", { key: 'f2e6ad691a5cbc57b990416097454a393da35c01', class: "digi-form-label__actions" }, h("slot", { key: '1fab5cca94da7ad0f2b617db7f713d3b4d17c52d', name: "actions" }))))));
436
- }
437
- get hostElement() { return getElement(this); }
438
- static get watchers() { return {
439
- "afFor": [{
440
- "validateFor": 0
441
- }],
442
- "afLabel": [{
443
- "setLabelText": 0
444
- }],
445
- "afRequired": [{
446
- "setLabelText": 0
447
- }],
448
- "afAnnounceIfOptional": [{
449
- "setLabelText": 0
450
- }]
451
- }; }
452
- };
453
- FormLabel.style = formLabelCss();
454
-
455
- 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}`;
456
-
457
- const FormSelectFilter = class {
458
- constructor(hostRef) {
459
- registerInstance(this, hostRef);
460
- this.afOnFocusout = createEvent(this, "afOnFocusout", 7);
461
- this.afOnSubmitFilters = createEvent(this, "afOnSubmitFilters", 7);
462
- this.afOnFilterClosed = createEvent(this, "afOnFilterClosed", 7);
463
- this.afOnResetFilters = createEvent(this, "afOnResetFilters", 7);
464
- this.afOnSelect = createEvent(this, "afOnSelect", 7);
465
- this.afOnQueryChanged = createEvent(this, "afOnQueryChanged", 7);
466
- this.isOpen = false;
467
- this.focusListItemIndex = 0;
468
- this.focusInList = false;
469
- this._filteredResult = [];
470
- this._selectedItems = [];
471
- this._searchQuery = '';
472
- /** True when `value` was set from outside (e.g. Angular CVA) — then value is selection master. */
473
- this._valueIsMaster = false;
474
- /** Guards internal `value` writes so they don't flip `_valueIsMaster`. */
475
- this._updatingValueInternally = false;
476
- /**
477
- * Sätter väljarens validering
478
- * @en Set select validation
479
- */
480
- this.afValidation = FormSelectFilterValidation.NEUTRAL;
481
- /**
482
- * Normalt betonas ett obligatoriskt fält visuellt och semantiskt.
483
- * Detta vänder på det och betonar fältet om det inte krävs.
484
- * Ställ in detta till sant om ditt formulär innehåller fler obligatoriska fält än inte.
485
- * @en Normally a required field is visually and semantically emphasized.
486
- * This flips that and emphasizes the field if it is not required.
487
- * Set this to true if your form contains more required fields than not.
488
- */
489
- this.afAnnounceIfOptional = false;
490
- /**
491
- * Sorterar listan i alfabetisk ordning.
492
- * @en Sort the list in alphabetical order.
493
- */
494
- this.sortAlphabetically = true;
495
- /**
496
- * @ignore
497
- * Propertyn `value` finns inte dokumenterad på komponentens sida på dokumentationswebben, utan
498
- * är endast till för att användas tillsammans med Angulars Control Value Accessors (CVA).
499
- * Används CVA för att hantera komponentens värden så ska inte afListItems användas för att
500
- * påverka vilka val som är gjorda eller ej.
501
- * Exempel på båda sätten att hantera datat finns i Angular Playground.
502
- */
503
- this.value = [];
504
- /**
505
- * Sätts till true om det ska gå att välja flera val från listan.
506
- * @en Set to true if you should be able to choose multiple items from the list.
507
- */
508
- this.afMultipleItems = false;
509
- /**
510
- * 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.
511
- * @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.
512
- */
513
- this.afId = randomIdGenerator('digi-form-select-filter');
514
- /**
515
- * Texten i rensaknappen
516
- * @en Set the reset button text
517
- */
518
- this.afResetButtonText = _t.clear;
519
- /**
520
- * Döljer rensaknappen när värdet sätts till true
521
- * @en Hides the reset button when set to true
522
- */
523
- this.afHideResetButton = false;
524
- /**
525
- * Text som visas när sökningen inte ger några resultat.
526
- * @en Text that is shown the the search gives no result.
527
- */
528
- this.afEmptySearchMessage = 'Inga sökträffar för';
529
- /**
530
- * Om värdet är true får felmeddelandet attributet role="alert".
531
- * Om felet visas tillsammans med flera andra fel (till exempel efter servervalidering) ska värdet sättas till false.
532
- * @en If the value is true, the error message gets the attribute role="alert".
533
- * If the error is shown together with multiple errors (for example after server-side validation), the value should be set to false.
534
- */
535
- this.afErrorMessageIsAlert = true;
536
- }
537
- onValueChanged(newValue) {
538
- let parsedValue;
539
- if (typeof newValue === 'string') {
540
- parsedValue = newValue ? JSON.parse(newValue) : [];
541
- }
542
- else {
543
- parsedValue = newValue || [];
544
- }
545
- if (!this._updatingValueInternally) {
546
- this._valueIsMaster = true;
547
- }
548
- this.value = parsedValue;
549
- this.syncValueAndSelectedListItems('valueChange');
550
- }
551
- handleListItems() {
552
- if (this.afListItems) {
553
- try {
554
- if (this.afListItems.constructor === Array) {
555
- this._afListItems = this.afListItems;
556
- }
557
- else if (typeof this.afListItems === 'string') {
558
- this._afListItems = JSON.parse(this.afListItems);
559
- }
560
- else {
561
- throw `Invalid type in "af-list-items" attribute`;
562
- }
563
- this.giveItemsValueIfNoneExist();
564
- this.sortListAlphabetically();
565
- this.syncValueAndSelectedListItems('afListItemsChange');
566
- this.filterResults();
567
- }
568
- catch (e) {
569
- logger.warn(`Invalid JSON in "af-list-items" attribute`, this.hostElement, e);
570
- return;
571
- }
572
- }
573
- }
574
- get errorMessageIsAlert() {
575
- return (this.afErrorMessageIsAlert !== false &&
576
- this.afErrorMessageIsAlert !== 'false');
577
- }
578
- /**
579
- * Funktion för att rensa valda värden från komponenten
580
- * @en Function for clearing selected values from component
581
- */
582
- async afMReset() {
583
- this.resetSelectItems();
584
- }
585
- /**
586
- * Funktion för att stänga dropdownen
587
- * @en Function for closing the dropdown
588
- */
589
- async afMCloseDropdown() {
590
- this.setClosed();
591
- }
592
- clickHandler(e) {
593
- const target = e.target;
594
- const selector = `#${this.afId}-identifier`;
595
- if (detectClickOutside(target, selector) && this.isOpen) {
596
- this.emitFilterClosedEvent();
597
- }
598
- }
599
- focusoutHandler(e) {
600
- const target = e.target;
601
- const selector = `#${this.afId}-identifier`;
602
- const focusOutsideFilter = detectFocusOutside(target, selector);
603
- if (focusOutsideFilter && this.isOpen) {
604
- this.emitFilterClosedEvent();
605
- }
606
- else {
607
- this.focusInList = !detectFocusOutside(target, `#${this.afId}-select-filter-list`);
608
- }
609
- }
610
- /**
611
- * Lyssnar på om fokus sätts på custom-elementet och propagerar ner det till toggle-knappen.
612
- * @en Listens for when focus is set on the custom element and propagates it down to the toggle butto.
613
- */
614
- focusOnElement() {
615
- this._toggleButton.focus();
616
- }
617
- componentWillLoad() {
618
- this.bootstrapInitialValue();
619
- this.handleListItems();
620
- // Angular attaches the host first and binds `[afListItems]` / CVA `value` on
621
- // the next frame (Stencil 4.36+). @Watch skips that first assignment, so if
622
- // the list is not here yet, wait one frame. React/vanilla that already set
623
- // the prop skip the delay.
624
- if (!this.afListItems) {
625
- return new Promise((resolve) => {
626
- requestAnimationFrame(() => {
627
- this.bootstrapInitialValue();
628
- this.handleListItems();
629
- resolve();
630
- });
631
- });
632
- }
633
- }
634
- bootstrapInitialValue() {
635
- if (typeof this.value === 'string') {
636
- const parsed = this.value ? JSON.parse(this.value) : [];
637
- this._updatingValueInternally = true;
638
- this.value = parsed;
639
- this._updatingValueInternally = false;
640
- }
641
- if (Array.isArray(this.value) && this.value.length > 0) {
642
- this._valueIsMaster = true;
643
- }
644
- }
645
- /**
646
- * Keep `value` and `afListItems[].selected` in sync.
647
- * - If `value` was set externally (`_valueIsMaster`), value wins on list updates.
648
- * - Otherwise selection is seeded from `afListItems[].selected` (React/vanilla data-as-master).
649
- * Does not emit `afOnSelect` — that is reserved for user interaction so Angular Control Value Accessors
650
- * does not get feedback loops on prop sync.
651
- */
652
- syncValueAndSelectedListItems(whereDidTheChangeComeFrom) {
653
- if (!this._afListItems) {
654
- return;
655
- }
656
- if (whereDidTheChangeComeFrom === 'afListItemsChange') {
657
- if (this._valueIsMaster) {
658
- this.applyValueToListItems(this.value);
659
- }
660
- else {
661
- this._selectedItems = this._afListItems.filter((item) => item.selected);
662
- this.setValueInternally([...this._selectedItems]);
663
- }
664
- return;
665
- }
666
- this.applyValueToListItems(this.value);
667
- }
668
- applyValueToListItems(value) {
669
- const selectedValues = new Set((value !== null && value !== void 0 ? value : []).map((item) => item.value));
670
- this._afListItems.forEach((item) => {
671
- item.selected = selectedValues.has(item.value);
672
- });
673
- this._selectedItems = this._afListItems.filter((item) => selectedValues.has(item.value));
674
- }
675
- setValueInternally(nextValue) {
676
- this._updatingValueInternally = true;
677
- this.value = nextValue;
678
- this._updatingValueInternally = false;
679
- }
680
- setClosed(focusToggleButton = false) {
681
- this.isOpen = false;
682
- if (focusToggleButton) {
683
- document.getElementById(`${this.afId}`).focus();
684
- }
685
- this.setScroll(0);
686
- this._searchQuery = '';
687
- this.afOnQueryChanged.emit('');
688
- this.afOnSubmitFilters.emit(this._selectedItems);
689
- this.filterResults();
690
- }
691
- setScroll(scrollY) {
692
- document.querySelector(`#${this.afId}-dropdown-menu .digi-form-select-filter__scroll`).scrollTop = scrollY;
693
- }
694
- setOpen() {
695
- this.isOpen = true;
696
- this.focusListItemIndex = 0;
697
- setTimeout(() => {
698
- this.setFocusSearch();
699
- }, 50);
700
- }
701
- giveItemsValueIfNoneExist() {
702
- this._afListItems
703
- .filter((item) => {
704
- return item.value === undefined;
705
- })
706
- .forEach((item) => {
707
- item.value = item.label;
708
- });
709
- }
710
- sortListAlphabetically() {
711
- if (!this.sortAlphabetically) {
712
- return;
713
- }
714
- this._afListItems.sort((a, b) => {
715
- if (a.label < b.label) {
716
- return -1;
717
- }
718
- if (a.label > b.label) {
719
- return 1;
720
- }
721
- return 0;
722
- });
723
- }
724
- toggleDropdown() {
725
- return this.isOpen ? this.setClosed() : this.setOpen();
726
- }
727
- inputItem(identifier, index) {
728
- const item = this.hostElement
729
- .querySelectorAll(`#${identifier} .digi-form-select-filter__item`)
730
- .item(index);
731
- return item;
732
- }
733
- emitFilterClosedEvent() {
734
- this.setClosed(true);
735
- this.afOnFilterClosed.emit();
736
- }
737
- setFocusItem() {
738
- const element = this.inputItem(`${this.afId}-select-filter-list`, this.focusListItemIndex);
739
- if (element) {
740
- element.focus();
741
- }
742
- }
743
- setFocusSearch() {
744
- const element = this.hostElement.querySelector('input');
745
- if (element) {
746
- element.focus();
747
- }
748
- }
749
- incrementFocusItem() {
750
- const listLength = this.showNeutralValue
751
- ? this._filteredResult.length
752
- : this._filteredResult.length - 1;
753
- if (this.focusListItemIndex < listLength) {
754
- this.focusListItemIndex = this.focusListItemIndex + 1;
755
- this.setFocusItem();
756
- return;
757
- }
758
- else {
759
- if (!this.afMultipleItems) {
760
- this.focusListItemIndex = 0;
761
- this.setFocusItem();
762
- return;
763
- }
764
- }
765
- this.tabHandler();
766
- }
767
- decrementFocusItem() {
768
- if (this.focusListItemIndex === 0) {
769
- this.setFocusSearch();
770
- return;
771
- }
772
- if (this.focusListItemIndex > 0) {
773
- this.focusListItemIndex = this.focusListItemIndex - 1;
774
- }
775
- this.setFocusItem();
776
- }
777
- downHandler(e) {
778
- e.detail.preventDefault();
779
- if (e.detail.code === 'ArrowDown' || e.detail.code === 'ArrowRight') {
780
- this.incrementFocusItem();
781
- }
782
- }
783
- upHandler(e) {
784
- e.detail.preventDefault();
785
- if (e.detail.code === 'ArrowUp' || e.detail.code === 'ArrowLeft') {
786
- this.decrementFocusItem();
787
- }
788
- }
789
- homeHandler(e) {
790
- e.detail.preventDefault();
791
- this.focusListItemIndex = 0;
792
- this.setFocusItem();
793
- }
794
- endHandler(e) {
795
- e.detail.preventDefault();
796
- this.focusListItemIndex = this.showNeutralValue
797
- ? this._filteredResult.length
798
- : this._filteredResult.length - 1;
799
- this.setFocusItem();
800
- }
801
- enterHandler(e) {
802
- e.detail.preventDefault();
803
- e.detail.target.click();
804
- }
805
- spaceHandler(e) {
806
- e.detail.preventDefault();
807
- e.detail.target.click();
808
- }
809
- escHandler() {
810
- if (this.isOpen) {
811
- this.setClosed(true);
812
- }
813
- }
814
- tabHandler() {
815
- if (this.isOpen && this.focusInList) {
816
- if (this.afMultipleItems && this._submitButton) {
817
- setTimeout(() => {
818
- var _a;
819
- if (this._submitButton) {
820
- (_a = this._submitButton.querySelector('button')) === null || _a === void 0 ? void 0 : _a.focus();
821
- }
822
- }, 10);
823
- }
824
- else {
825
- this.setClosed(true);
826
- }
827
- }
828
- }
829
- shiftHandler() {
830
- if (this.isOpen && this.focusInList) {
831
- if (this.afMultipleItems && this._toggleButton) {
832
- this._toggleButton.querySelector('button').focus();
833
- }
834
- else {
835
- this.setFocusSearch();
836
- }
837
- }
838
- }
839
- filterResults() {
840
- if (this._searchQuery && this._searchQuery.length > 0) {
841
- this._filteredResult = this._afListItems.filter((item) => {
842
- return item.label
843
- .toLowerCase()
844
- .includes(this._searchQuery.toLowerCase());
845
- });
846
- }
847
- else {
848
- this._filteredResult = this._afListItems;
849
- }
850
- }
851
- inputSearchKeyboardHandler(e) {
852
- if (e.code === 'ArrowDown') {
853
- e.preventDefault();
854
- this.setFocusItem();
855
- }
856
- if (e.code === 'Enter' && this._searchQuery !== '') {
857
- e.preventDefault();
858
- this.setFocusItem();
859
- }
860
- }
861
- inputSearchInputHandler(e) {
862
- this._searchQuery = e.target.value;
863
- this.afOnQueryChanged.emit(this._searchQuery);
864
- this.filterResults();
865
- }
866
- resetSelectItems(close = false) {
867
- this._selectedItems = [];
868
- this.setValueInternally([]);
869
- this.afOnSelect.emit([]);
870
- this._searchQuery = '';
871
- this.filterResults();
872
- if (close) {
873
- this.emitFilterClosedEvent();
874
- }
875
- this.afOnResetFilters.emit();
876
- }
877
- selectItemHandler(item) {
878
- if (this.afMultipleItems) {
879
- item.selected = !item.selected;
880
- if (this._selectedItems.filter((x) => {
881
- return x.value === item.value;
882
- }).length > 0) {
883
- //ITEM VALUE ALREADY EXISTS IN LIST, DELETE FROM LIST
884
- this._selectedItems.splice(this._selectedItems.findIndex((e) => e.value === item.value), 1);
885
- }
886
- else {
887
- this._selectedItems = [...this._selectedItems, item];
888
- }
889
- }
890
- else {
891
- this._selectedItems.forEach((item) => {
892
- item.selected = false;
893
- });
894
- item.selected = true;
895
- this._selectedItems = [item];
896
- this.emitFilterClosedEvent();
897
- }
898
- this.setValueInternally([...this._selectedItems]);
899
- this.afOnSelect.emit(this._selectedItems);
900
- this.filterResults();
901
- }
902
- isSelected(textValue) {
903
- if (textValue && this._selectedItems && this._selectedItems.length > 0) {
904
- return (this._selectedItems.filter((item) => {
905
- return item.value === textValue;
906
- }).length > 0);
907
- }
908
- return false;
909
- }
910
- get cssModifiers() {
911
- return {
912
- 'digi-form-select-filter--open': this.isOpen,
913
- 'digi-form-select-filter--neutral': this.afValidation === FormSelectFilterValidation.NEUTRAL,
914
- 'digi-form-select-filter--success': this.afValidation === FormSelectFilterValidation.SUCCESS,
915
- 'digi-form-select-filter--warning': this.afValidation === FormSelectFilterValidation.WARNING,
916
- 'digi-form-select-filter--error': this.afValidation === FormSelectFilterValidation.ERROR
917
- };
918
- }
919
- get cssModifiersToggleButtonIndicator() {
920
- return {
921
- 'digi-form-select-filter__toggle-button-indicator--active': this._selectedItems.length > 0
922
- };
923
- }
924
- get cssModifiersToggleButtonWrapper() {
925
- return {
926
- 'digi-form-select-filter__toggle-button-wrapper--activated': this._selectedItems.length > 0
927
- };
928
- }
929
- buttonText(isAriaLabel) {
930
- const ariaLabelText = (text = '') => {
931
- return isAriaLabel ? text : '';
932
- };
933
- if (this._selectedItems && this._selectedItems.length === 1) {
934
- return (ariaLabelText(this.afFilterButtonTextLabel + ': ') +
935
- this._selectedItems[0].label);
936
- }
937
- else if (this._selectedItems &&
938
- this._selectedItems.length > 0 &&
939
- this.afMultipleItems) {
940
- if (this.afFilterButtonTextMultipleValues) {
941
- return (ariaLabelText(this.afFilterButtonTextLabel + ': ') +
942
- this.afFilterButtonTextMultipleValues.replace('{count}', this._selectedItems.length.toString()));
943
- }
944
- else {
945
- return (ariaLabelText(this.afFilterButtonTextLabel + ': ') +
946
- `${this._selectedItems.length} valda`);
947
- }
948
- }
949
- else {
950
- return (ariaLabelText(this.afFilterButtonTextLabel
951
- ? this.afFilterButtonTextLabel + ': '
952
- : '') + this.afFilterButtonText);
953
- }
954
- }
955
- get renderButtonLabel() {
956
- return this.buttonText(false);
957
- }
958
- get ariaLabel() {
959
- return this.buttonText(true);
960
- }
961
- get showNeutralValue() {
962
- return (!this.afMultipleItems &&
963
- this.afFilterButtonText &&
964
- this._searchQuery.length === 0);
965
- }
966
- showValidation() {
967
- return !this.afDisableValidation &&
968
- this.afValidation !== FormSelectFilterValidation.NEUTRAL &&
969
- this.afValidationText
970
- ? true
971
- : false;
972
- }
973
- renderEmptyStateBox() {
974
- let statusMessage = '';
975
- if (this._filteredResult && this._filteredResult.length > 0) {
976
- statusMessage = `${this._filteredResult.length} sökträff${this._filteredResult.length > 1 ? 'ar' : ''}`;
977
- }
978
- else if (this._filteredResult.length === 0) {
979
- statusMessage = `${this.afEmptySearchMessage} ${this._searchQuery}`;
980
- }
981
- return (h(Fragment, null, h("div", { role: "status", id: `${this.afId}-searchstatus`, class: {
982
- 'digi-form-select-filter__search-status': true,
983
- 'digi--a11y--sr-only': this._filteredResult && this._filteredResult.length > 0
984
- } }, h("span", null, " ", statusMessage, " "), h("div", { class: {
985
- hidden: this._filteredResult && this._filteredResult.length > 0
986
- } }, h("slot", { name: "empty-search-result" })))));
987
- }
988
- render() {
989
- return (h(Host, { key: '2e7276930637366cbcb14168102afb82393708f5', tabindex: -1 }, h("div", { key: 'a5620907d2399c0561b6b3b604220c3bf82ded6b', class: Object.assign({ 'digi-form-select-filter': true }, this.cssModifiers), role: "application", id: `${this.afId}-identifier` }, 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 }), h("digi-util-keydown-handler", { key: '035ffc46a22218d42d892c89592993a7694b2be2', onAfOnEsc: () => this.escHandler() }, 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 }, h("div", { key: '8bb88747afac881b3667ecb60c4adbe36c1325f8', class: Object.assign({ 'digi-form-filter__toggle-button-wrapper': true }, this.cssModifiersToggleButtonWrapper) }, h("digi-icon-check", { key: 'a809c5fa00dd4d2a50662aeed3d673cda0289d80', class: Object.assign({ 'digi-form-select-filter__toggle-button-indicator': true }, this.cssModifiersToggleButtonIndicator), slot: "icon" }), h("span", { key: 'a5e7f4b998d38a7d912a25b2d7fb0b852b920dc3', class: "digi-form-select-filter__toggle-button-text" }, this.renderButtonLabel)), h("digi-icon-chevron-down", { key: 'ef852d8060bacbdef9707dcb23ed3ae1f98cc33f', class: "digi-form-select-filter__toggle-icon" })), h("div", { key: '5c5e41376cf7264e837bed3905c971dd0adee156', id: `${this.afId}-dropdown-menu`, tabindex: this.isOpen ? '-1' : undefined, class: {
990
- 'digi-form-select-filter__dropdown': true,
991
- 'digi-form-select-filter__dropdown--right': this.afAlignRight,
992
- 'digi-form-select-filter__dropdown--hidden': !this.isOpen
993
- } }, h("fieldset", { key: 'daa4e02e97f5907fc89aeb7a337bd97ceba1c148' }, h("div", { key: '99cd8af83d9b1410610f4e49a6759fac20c6955f', class: "digi-form-select-filter__header" }, h("legend", { key: '0ed1e17842e0795194c4b74d9600f17c3d2e63b0', class: "digi-form-select-filter__legend" }, this.afFilterButtonTextLabel), h("digi-form-input", { key: 'c35f93cb680c6f6e902f281ff597108a9106b016', afLabel: this.afName, afId: `${this.afId}-search`, afVariation: FormInputVariation.MEDIUM, afType: FormInputType.SEARCH, afValidation: FormInputValidation.NEUTRAL, onAfOnFocus: () => {
994
- this.focusListItemIndex = 0;
995
- }, onAfOnKeyup: (e) => {
996
- this.inputSearchKeyboardHandler(e.detail);
997
- }, 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()), h("div", { key: '4e2c4a6e6039f8f3efe8cfc75bb302214704073e', class: "digi-form-select-filter__scroll" }, 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() }, 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
998
- ? 'false'
999
- : this.afValidation ===
1000
- FormSelectFilterValidation.ERROR
1001
- ? 'true'
1002
- : 'false', "aria-errormessage": `${this.afId}--validation-message`, "aria-required": this.afMultipleItems
1003
- ? false
1004
- : this.afRequired
1005
- ? 'true'
1006
- : 'false' }, this.showNeutralValue && (h("li", { key: '0d51a466af769e3b687805b4cb8027bcac8b5112', class: "digi-form-select-filter__item", role: "radio", "aria-required": this.afMultipleItems
1007
- ? 'false'
1008
- : this.afRequired
1009
- ? 'true'
1010
- : 'false', "aria-checked": this._selectedItems.length === 0 ? 'true' : 'false', onClick: () => this.resetSelectItems(true), tabIndex: 0, "aria-label": this.afFilterButtonText }, this._selectedItems.length === 0 && (h("digi-icon-check", { key: '84264b690e6a8b4cd792f6543f00a7f5e559fe06', class: "digi-form-select-filter__item__icon", "aria-hidden": 'true' })), this.afFilterButtonText)), this._filteredResult &&
1011
- this._filteredResult.map((item, index) => {
1012
- return (h("li", { class: "digi-form-select-filter__item", key: index, dir: item.dir, lang: item.lang, "aria-checked": this.isSelected(item.value) ? 'true' : 'false', role: this.afMultipleItems ? 'checkbox' : 'radio', "aria-required": this.afMultipleItems
1013
- ? 'false'
1014
- : this.afRequired
1015
- ? 'true'
1016
- : 'false', "aria-invalid": this.afMultipleItems
1017
- ? this.afValidation ===
1018
- FormSelectFilterValidation.ERROR
1019
- ? 'true'
1020
- : 'false'
1021
- : 'false', "aria-errormessage": `${this.afId}--validation-message`, onClick: () => this.selectItemHandler(item), tabIndex: this.showNeutralValue
1022
- ? -1
1023
- : index === 0
1024
- ? 0
1025
- : -1 }, this.isSelected(item.value) && (h("digi-icon-check", { class: "digi-form-select-filter__item__icon", "aria-hidden": 'true' })), item.label));
1026
- }))))), this.afMultipleItems && (h("div", { key: '79def162604c33d3c6acffd7464f2d44f4cf6229', class: "digi-form-select-filter__footer" }, !this.afHideResetButton && (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)), h("digi-util-keydown-handler", { key: '0fe5d9f9d899d3ddeaf6447485bf5f655e6270ff', onAfOnUp: () => this.setFocusItem() }, h("digi-button", { key: '0c14fea74bd16712355a8fafdc17408674ae0489', ref: (el) => (this._submitButton = el), "af-variation": "primary", "af-aria-label": this.afSubmitButtonTextAriaLabel, onClick: () => {
1027
- this.setClosed(true);
1028
- }, class: "digi-form-select-filter__submit-button" }, this.afSubmitButtonText)))))), h("div", { key: 'eb9dd0d0150b043458211e89c1311d9c7103d46f', class: "digi-form-select__footer" }, h("div", { key: 'f7aca001f6b2580600c1e823e307a4352811bb66', "aria-atomic": "true", role: this.errorMessageIsAlert ? 'alert' : null, id: `${this.afId}--validation-message` }, this.showValidation() && (h("digi-form-validation-message", { key: '5802021f469405694a75378fc8830720a9275d41', "af-variation": this.afValidation }, this.afValidationText)))))));
1029
- }
1030
- get hostElement() { return getElement(this); }
1031
- static get watchers() { return {
1032
- "value": [{
1033
- "onValueChanged": 0
1034
- }],
1035
- "afListItems": [{
1036
- "handleListItems": 0
1037
- }]
1038
- }; }
1039
- };
1040
- FormSelectFilter.style = formSelectFilterCss();
1041
-
1042
- 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)}`;
1043
-
1044
- const FormValidationMessage = class {
1045
- constructor(hostRef) {
1046
- registerInstance(this, hostRef);
1047
- /**
1048
- * Sätter valideringsstatus. Kan vara 'success', 'error' eller 'warning'.
1049
- * @en Set validation status
1050
- */
1051
- this.afVariation = FormValidationMessageVariation.SUCCESS;
1052
- }
1053
- get cssModifiers() {
1054
- return {
1055
- 'digi-form-validation-message--success': this.afVariation === FormValidationMessageVariation.SUCCESS,
1056
- 'digi-form-validation-message--error': this.afVariation === FormValidationMessageVariation.ERROR,
1057
- 'digi-form-validation-message--warning': this.afVariation === FormValidationMessageVariation.WARNING
1058
- };
1059
- }
1060
- get icon() {
1061
- switch (this.afVariation) {
1062
- case FormValidationMessageVariation.SUCCESS:
1063
- return h("digi-icon-validation-success", null);
1064
- case FormValidationMessageVariation.ERROR:
1065
- return h("digi-icon-validation-error", null);
1066
- case FormValidationMessageVariation.WARNING:
1067
- return h("digi-icon-validation-warning", { class: "warning" });
1068
- }
1069
- }
1070
- render() {
1071
- return (h("div", { key: '5c89cb2cfe7085ec0203814f2c7a43c9fe518db4', class: Object.assign({ 'digi-form-validation-message': true }, this.cssModifiers) }, h("div", { key: 'cb85b6a6e02b081710f80ad7bbbe96e182d8c353', class: "digi-form-validation-message__icon", "aria-hidden": "true" }, this.icon), h("span", { key: '9b1689dcad19fd3f033c679f496a1c94348f393b', class: "digi-form-validation-message__text" }, h("slot", { key: '794c1b1c0771cae8c0b19bd7123f7f5bc28e99b7' }))));
1072
- }
1073
- get hostElement() { return getElement(this); }
1074
- };
1075
- FormValidationMessage.style = formValidationMessageCss();
1076
-
1077
- 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)}`;
1078
-
1079
- const IconCheck = class {
1080
- constructor(hostRef) {
1081
- registerInstance(this, hostRef);
1082
- /**
1083
- * För att dölja ikonen för skärmläsare. Default är satt till true.
1084
- * @en Hides the icon for screen readers. Default is set to true.
1085
- */
1086
- this.afSvgAriaHidden = true;
1087
- this.titleId = randomIdGenerator('icontitle');
1088
- }
1089
- render() {
1090
- return (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
1091
- ? this.afSvgAriaLabelledby
1092
- : this.afTitle
1093
- ? this.titleId
1094
- : undefined }, this.afTitle && h("title", { key: 'bef781ca98e73396b1fe60b65796e2a1e2f9dc05', id: this.titleId }, this.afTitle), this.afDesc && h("desc", { key: '9d4a13004fbaaed886b59fc22dbee79245af10de' }, this.afDesc), 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" })));
1095
- }
1096
- };
1097
- IconCheck.style = iconCheckCss();
1098
-
1099
- 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)}`;
1100
-
1101
- const IconChevronDown = class {
1102
- constructor(hostRef) {
1103
- registerInstance(this, hostRef);
1104
- /**
1105
- * För att dölja ikonen för skärmläsare. Default är satt till true.
1106
- * @en Hides the icon for screen readers. Default is set to true.
1107
- */
1108
- this.afSvgAriaHidden = true;
1109
- this.titleId = randomIdGenerator('icontitle');
1110
- }
1111
- render() {
1112
- return (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
1113
- ? this.afSvgAriaLabelledby
1114
- : this.afTitle
1115
- ? this.titleId
1116
- : undefined }, this.afTitle && h("title", { key: '4692fea634337c2e89e5eeac67c707c84f919563', id: this.titleId }, this.afTitle), this.afDesc && h("desc", { key: '3948943affb34ebc1967aeb54389b0c3230e6daf' }, this.afDesc), 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" })));
1117
- }
1118
- };
1119
- IconChevronDown.style = iconChevronDownCss();
1120
-
1121
- 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)}`;
1122
-
1123
- const IconValidationError = class {
1124
- constructor(hostRef) {
1125
- registerInstance(this, hostRef);
1126
- /**
1127
- * För att dölja ikonen för skärmläsare. Default är satt till true.
1128
- * @en Hides the icon for screen readers. Default is set to true.
1129
- */
1130
- this.afSvgAriaHidden = true;
1131
- this.titleId = randomIdGenerator('icontitle');
1132
- }
1133
- render() {
1134
- return (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
1135
- ? this.afSvgAriaLabelledby
1136
- : this.afTitle
1137
- ? this.titleId
1138
- : undefined }, this.afTitle && h("title", { key: '5e08a1b947d534b913fff06e02109b53c607a0be', id: this.titleId }, this.afTitle), this.afDesc && h("desc", { key: 'f016b92eb4957943a5308d12db1ce2f1b73fae3f' }, this.afDesc), 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" })));
1139
- }
1140
- };
1141
- IconValidationError.style = iconValidationErrorCss();
1142
-
1143
- 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)}`;
1144
-
1145
- const IconCheckCircle = class {
1146
- constructor(hostRef) {
1147
- registerInstance(this, hostRef);
1148
- /**
1149
- * För att dölja ikonen för skärmläsare. Default är satt till true.
1150
- * @en Hides the icon for screen readers. Default is set to true.
1151
- */
1152
- this.afSvgAriaHidden = true;
1153
- this.titleId = randomIdGenerator('icontitle');
1154
- }
1155
- render() {
1156
- return (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
1157
- ? this.afSvgAriaLabelledby
1158
- : this.afTitle
1159
- ? this.titleId
1160
- : undefined, xmlns: "http://www.w3.org/2000/svg" }, this.afTitle && h("title", { key: 'ed5b4d39b987b025d99ef2ce2153a8de749f587e', id: this.titleId }, this.afTitle), this.afDesc && h("desc", { key: '7c5175b745577dd9076170ba83fa00f8cc03c4a2' }, this.afDesc), 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" })));
1161
- }
1162
- };
1163
- IconCheckCircle.style = iconValidationSuccessCss();
1164
-
1165
- 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)}`;
1166
-
1167
- const IconValidationWarning = class {
1168
- constructor(hostRef) {
1169
- registerInstance(this, hostRef);
1170
- /**
1171
- * För att dölja ikonen för skärmläsare. Default är satt till true.
1172
- * @en Hides the icon for screen readers. Default is set to true.
1173
- */
1174
- this.afSvgAriaHidden = true;
1175
- this.titleId = randomIdGenerator('icontitle');
1176
- }
1177
- render() {
1178
- return (h("div", { key: '7017a09730cca2dafe42548b11d18e34a693f81b' }, 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
1179
- ? this.afSvgAriaLabelledby
1180
- : this.afTitle
1181
- ? this.titleId
1182
- : undefined }, this.afTitle && h("title", { key: '25751b0fd552d8dcabc3402345ba8528126dd973', id: this.titleId }, this.afTitle), this.afDesc && h("desc", { key: '41476cbdf1b92dd9b7c44d8791481a5cf00186ca' }, this.afDesc), h("g", { key: '6607df5c4713e5680fcaa2e9ea29b7cab5064e3d', fill: "none", "fill-rule": "evenodd" }, h("circle", { key: 'c87e6472093671bc2f1f6b3d7eb0b34f512468c1', cx: "9", cy: "9", r: "6.75", fill: "#333" }), 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" })))));
1183
- }
1184
- };
1185
- IconValidationWarning.style = iconValidationWarningCss();
1186
-
1187
- const UtilKeydownHandler = class {
1188
- constructor(hostRef) {
1189
- registerInstance(this, hostRef);
1190
- this.afOnEsc = createEvent(this, "afOnEsc", 7);
1191
- this.afOnEnter = createEvent(this, "afOnEnter", 7);
1192
- this.afOnTab = createEvent(this, "afOnTab", 7);
1193
- this.afOnSpace = createEvent(this, "afOnSpace", 7);
1194
- this.afOnShiftTab = createEvent(this, "afOnShiftTab", 7);
1195
- this.afOnUp = createEvent(this, "afOnUp", 7);
1196
- this.afOnDown = createEvent(this, "afOnDown", 7);
1197
- this.afOnLeft = createEvent(this, "afOnLeft", 7);
1198
- this.afOnRight = createEvent(this, "afOnRight", 7);
1199
- this.afOnHome = createEvent(this, "afOnHome", 7);
1200
- this.afOnEnd = createEvent(this, "afOnEnd", 7);
1201
- this.afOnKeyDown = createEvent(this, "afOnKeyDown", 7);
1202
- }
1203
- keydownHandler(e) {
1204
- const key = keyboardHandler(e);
1205
- switch (key) {
1206
- case KEY_CODE.SHIFT_TAB:
1207
- this.afOnShiftTab.emit(e);
1208
- break;
1209
- case KEY_CODE.DOWN_ARROW:
1210
- this.afOnDown.emit(e);
1211
- this.afOnKeyDown.emit(e);
1212
- break;
1213
- case KEY_CODE.UP_ARROW:
1214
- this.afOnUp.emit(e);
1215
- this.afOnKeyDown.emit(e);
1216
- break;
1217
- case KEY_CODE.LEFT_ARROW:
1218
- this.afOnLeft.emit(e);
1219
- this.afOnKeyDown.emit(e);
1220
- break;
1221
- case KEY_CODE.RIGHT_ARROW:
1222
- this.afOnRight.emit(e);
1223
- this.afOnKeyDown.emit(e);
1224
- break;
1225
- case KEY_CODE.ENTER:
1226
- this.afOnEnter.emit(e);
1227
- this.afOnKeyDown.emit(e);
1228
- break;
1229
- case KEY_CODE.ESCAPE:
1230
- this.afOnEsc.emit(e);
1231
- this.afOnKeyDown.emit(e);
1232
- break;
1233
- case KEY_CODE.TAB:
1234
- this.afOnTab.emit(e);
1235
- this.afOnKeyDown.emit(e);
1236
- break;
1237
- case KEY_CODE.SPACE:
1238
- this.afOnSpace.emit(e);
1239
- this.afOnKeyDown.emit(e);
1240
- break;
1241
- case KEY_CODE.HOME:
1242
- this.afOnHome.emit(e);
1243
- this.afOnKeyDown.emit(e);
1244
- break;
1245
- case KEY_CODE.END:
1246
- this.afOnEnd.emit(e);
1247
- this.afOnKeyDown.emit(e);
1248
- break;
1249
- case KEY_CODE.ANY:
1250
- this.afOnKeyDown.emit(e);
1251
- break;
1252
- default:
1253
- this.afOnKeyDown.emit(e);
1254
- return;
1255
- }
1256
- }
1257
- render() {
1258
- return h("slot", { key: 'c0a9e056eb5e48ce215370d38ee65a62ca2e33d9' });
1259
- }
1260
- };
1261
-
1262
- export { Button as digi_button, FormInput as digi_form_input, FormLabel as digi_form_label, FormSelectFilter as digi_form_select_filter, FormValidationMessage as digi_form_validation_message, IconCheck as digi_icon_check, IconChevronDown as digi_icon_chevron_down, IconValidationError as digi_icon_validation_error, IconCheckCircle as digi_icon_validation_success, IconValidationWarning as digi_icon_validation_warning, UtilKeydownHandler as digi_util_keydown_handler };