@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
@@ -0,0 +1,205 @@
1
+ 'use strict';
2
+
3
+ var index = require('./index-tbq85ezH.js');
4
+ var randomIdGenerator_util = require('./randomIdGenerator.util-C8XR2Tn1.js');
5
+ var formInputType_enum = require('./form-input-type.enum-DvF_MTHK.js');
6
+ var formInputVariation_enum = require('./form-input-variation.enum-kpoXNUuI.js');
7
+
8
+ 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}`;
9
+
10
+ const FormInput = class {
11
+ constructor(hostRef) {
12
+ index.registerInstance(this, hostRef);
13
+ this.afOnChange = index.createEvent(this, "afOnChange", 7);
14
+ this.afOnBlur = index.createEvent(this, "afOnBlur", 7);
15
+ this.afOnKeyup = index.createEvent(this, "afOnKeyup", 7);
16
+ this.afOnFocus = index.createEvent(this, "afOnFocus", 7);
17
+ this.afOnFocusout = index.createEvent(this, "afOnFocusout", 7);
18
+ this.afOnInput = index.createEvent(this, "afOnInput", 7);
19
+ this.afOnDirty = index.createEvent(this, "afOnDirty", 7);
20
+ this.afOnTouched = index.createEvent(this, "afOnTouched", 7);
21
+ this.afOnReady = index.createEvent(this, "afOnReady", 3);
22
+ this.hasActiveValidationMessage = false;
23
+ this.dirty = false;
24
+ this.touched = false;
25
+ /**
26
+ * Sätter attributet 'type'.
27
+ * @en Input type attribute
28
+ */
29
+ this.afType = formInputType_enum.FormInputType.TEXT;
30
+ /**
31
+ * Sätter attributet 'inputmode'.
32
+ * @en Inputmode type attribute
33
+ */
34
+ this.afInputmode = formInputVariation_enum.FormInputMode.DEFAULT;
35
+ /**
36
+ * Layout för hur inmatningsfältet ska visas då det finns en knapp
37
+ * @en Input layout when there is a button
38
+ */
39
+ this.afButtonVariation = formInputType_enum.FormInputButtonVariation.PRIMARY;
40
+ /**
41
+ * Sätter variant. Kan vara 'small', 'medium' eller 'large'
42
+ * @en Set input variation.
43
+ */
44
+ this.afVariation = formInputVariation_enum.FormInputVariation.MEDIUM;
45
+ /**
46
+ * Sätter attributet 'id'. Om inget väljs så skapas ett slumpmässigt id.
47
+ * @en Input id attribute. Defaults to random string.
48
+ */
49
+ this.afId = randomIdGenerator_util.randomIdGenerator('digi-form-input');
50
+ /**
51
+ * Sätt denna till true om formuläret innehåller fler obligatoriska fält än valfria.
52
+ * @en Set this to true if the form contains more required fields than optional fields.
53
+ */
54
+ this.afAnnounceIfOptional = false;
55
+ /**
56
+ * Sätter valideringsstatus. Kan vara 'success', 'error', 'warning', 'neutral' eller ingenting.
57
+ * @en Set input validation status
58
+ */
59
+ this.afValidation = formInputVariation_enum.FormInputValidation.NEUTRAL;
60
+ /**
61
+ * Om värdet är true får felmeddelandet attributet role="alert".
62
+ * Om felet visas tillsammans med flera andra fel (till exempel efter servervalidering) ska värdet sättas till false.
63
+ * @en If the value is true, the error message gets the attribute role="alert".
64
+ * If the error is shown together with multiple errors (for example after server-side validation), the value should be set to false.
65
+ */
66
+ this.afErrorMessageIsAlert = true;
67
+ }
68
+ onValueChanged(value) {
69
+ this.afValue = value;
70
+ }
71
+ onAfValueChanged(value) {
72
+ this.value = value;
73
+ if (this._input && this._input.value !== String(value !== null && value !== void 0 ? value : '')) {
74
+ this._input.value = String(value !== null && value !== void 0 ? value : '');
75
+ }
76
+ }
77
+ get errorMessageIsAlert() {
78
+ return (this.afErrorMessageIsAlert !== false &&
79
+ this.afErrorMessageIsAlert !== 'false');
80
+ }
81
+ afValidationTextWatch() {
82
+ this.setActiveValidationMessage();
83
+ }
84
+ /**
85
+ * Hämtar en referens till inputelementet. Bra för att t.ex. sätta fokus programmatiskt.
86
+ * @en Returns a reference to the input element. Handy for setting focus programmatically.
87
+ */
88
+ async afMGetFormControlElement() {
89
+ return this._input;
90
+ }
91
+ /**
92
+ * Lyssnar på om fokus sätts på custom-elementet och propagerar ner det till själva input-elementet.
93
+ * @en Listens for when focus is set on the custom element and propagates it down to the actual input element.
94
+ */
95
+ focusOnInput() {
96
+ this._input.focus();
97
+ }
98
+ componentWillLoad() {
99
+ this.afValue ? (this.value = this.afValue) : (this.afValue = this.value);
100
+ this.setActiveValidationMessage();
101
+ this.setHasButton();
102
+ }
103
+ componentWillUpdate() {
104
+ this.setHasButton();
105
+ }
106
+ componentDidLoad() {
107
+ this.afOnReady.emit();
108
+ }
109
+ setActiveValidationMessage() {
110
+ this.hasActiveValidationMessage = !!this.afValidationText;
111
+ }
112
+ get cssModifiers() {
113
+ return {
114
+ 'digi-form-input--small': this.afVariation === formInputVariation_enum.FormInputVariation.SMALL,
115
+ 'digi-form-input--medium': this.afVariation === formInputVariation_enum.FormInputVariation.MEDIUM,
116
+ 'digi-form-input--large': this.afVariation === formInputVariation_enum.FormInputVariation.LARGE,
117
+ 'digi-form-input--neutral': this.afValidation === formInputVariation_enum.FormInputValidation.NEUTRAL,
118
+ 'digi-form-input--success': this.afValidation === formInputVariation_enum.FormInputValidation.SUCCESS,
119
+ 'digi-form-input--error': this.afValidation === formInputVariation_enum.FormInputValidation.ERROR,
120
+ 'digi-form-input--warning': this.afValidation === formInputVariation_enum.FormInputValidation.WARNING,
121
+ [`digi-form-input--button-variation-${this.afButtonVariation}`]: !!this.afButtonVariation,
122
+ [`digi-form-input--has-button-${this.hasButton}`]: true,
123
+ 'digi-form-input--empty': !this.afValue &&
124
+ (!this.afValidation ||
125
+ this.afValidation === formInputVariation_enum.FormInputValidation.NEUTRAL)
126
+ };
127
+ }
128
+ blurHandler(e) {
129
+ const trimableTypes = [
130
+ formInputType_enum.FormInputType.TEXT,
131
+ formInputType_enum.FormInputType.EMAIL,
132
+ formInputType_enum.FormInputType.SEARCH,
133
+ formInputType_enum.FormInputType.TEL,
134
+ formInputType_enum.FormInputType.URL
135
+ ];
136
+ const shouldTrim = this.afTrimValue && trimableTypes.includes(this.afType);
137
+ if (shouldTrim && typeof e.target.value === 'string') {
138
+ const trimmedValue = e.target.value.trim();
139
+ if (trimmedValue !== e.target.value) {
140
+ this.afValue = this.value = trimmedValue;
141
+ if (this._input) {
142
+ this._input.value = trimmedValue;
143
+ }
144
+ // Emittar afOnInput så Angulars value accessor får det trimmade värdet
145
+ this.afOnInput.emit(e);
146
+ }
147
+ }
148
+ if (!this.touched) {
149
+ this.afOnTouched.emit(e);
150
+ this.touched = true;
151
+ }
152
+ this.afOnBlur.emit(e);
153
+ }
154
+ changeHandler(e) {
155
+ this.setActiveValidationMessage();
156
+ this.afOnChange.emit(e);
157
+ }
158
+ focusHandler(e) {
159
+ this.afOnFocus.emit(e);
160
+ }
161
+ focusoutHandler(e) {
162
+ this.afOnFocusout.emit(e);
163
+ }
164
+ keyupHandler(e) {
165
+ this.afOnKeyup.emit(e);
166
+ }
167
+ inputHandler(e) {
168
+ this.afValue = this.value =
169
+ this.afType === formInputType_enum.FormInputType.NUMBER
170
+ ? parseFloat(e.target.value)
171
+ : e.target.value;
172
+ if (!this.dirty) {
173
+ this.afOnDirty.emit(e);
174
+ this.dirty = true;
175
+ }
176
+ this.setActiveValidationMessage();
177
+ this.afOnInput.emit(e);
178
+ }
179
+ setHasButton() {
180
+ this.hasButton = !!this.hostElement.querySelector('[slot="button"]');
181
+ }
182
+ render() {
183
+ return (index.h(index.Host, { key: '2739bdd7385125581d7ea9c25a3610f5950c6a74', tabindex: -1 }, index.h("div", { key: '7e261c1e2fc4f37f4ddda861872a470c89181e16', class: Object.assign({ 'digi-form-input': true }, this.cssModifiers) }, index.h("digi-form-label", { key: '7e8fd283dedf0a851c714331ae640f7c74176bde', class: "digi-form-input__label", afFor: this.afId, afLabel: this.afLabel, afDescription: this.afLabelDescription, afRequired: this.afRequired, afAnnounceIfOptional: this.afAnnounceIfOptional, afRequiredText: this.afRequiredText, afAnnounceIfOptionalText: this.afAnnounceIfOptionalText }), index.h("div", { key: '68d715181c180ebaf957dfb46afb63b19b8a8188', class: "digi-form-input__input-wrapper" }, index.h("input", Object.assign({ key: 'e25ab871e988f9e8bd0837f75403e85f7423805f', class: "digi-form-input__input", ref: (el) => (this._input = el), onBlur: (e) => this.blurHandler(e), onChange: (e) => this.changeHandler(e), onFocus: (e) => this.focusHandler(e), onFocusout: (e) => this.focusoutHandler(e), onKeyUp: (e) => this.keyupHandler(e), onInput: (e) => this.inputHandler(e), "aria-activedescendant": this.afAriaActivedescendant, "aria-describedby": `${this.afAriaDescribedby} ${this.afId}--validation-message`, "aria-labelledby": this.afAriaLabelledby, "aria-autocomplete": this.afAriaAutocomplete, "aria-invalid": this.afValidation === formInputVariation_enum.FormInputValidation.ERROR
184
+ ? 'true'
185
+ : '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 == formInputVariation_enum.FormInputMode.DEFAULT
186
+ ? {}
187
+ : { inputmode: this.afInputmode }))), index.h("slot", { key: 'c14ae079a53099fc3928bcf3ac7f5517c20b0f36', name: "button" })), index.h("div", { key: '75d6afa176cd8620e31c384e169b3c84a3bb584d', class: "digi-form-input__footer" }, index.h("div", { key: '81029d425aae06e3c72c08afe982f2ff1a7bb81d', class: "digi-form-input__validation", "aria-atomic": "true", role: this.errorMessageIsAlert ? 'alert' : null, id: `${this.afId}--validation-message` }, this.hasActiveValidationMessage &&
188
+ this.afValidation != formInputVariation_enum.FormInputValidation.NEUTRAL && (index.h("digi-form-validation-message", { key: '9a8fec12db8c78a037a9b70194b32814d7641dad', class: "digi-form-input__validation-message", "af-variation": this.afValidation }, this.afValidationText)))))));
189
+ }
190
+ get hostElement() { return index.getElement(this); }
191
+ static get watchers() { return {
192
+ "value": [{
193
+ "onValueChanged": 0
194
+ }],
195
+ "afValue": [{
196
+ "onAfValueChanged": 0
197
+ }],
198
+ "afValidationText": [{
199
+ "afValidationTextWatch": 0
200
+ }]
201
+ }; }
202
+ };
203
+ FormInput.style = formInputCss();
204
+
205
+ exports.digi_form_input = FormInput;
@@ -0,0 +1,147 @@
1
+ 'use strict';
2
+
3
+ var index = require('./index-tbq85ezH.js');
4
+ var randomIdGenerator_util = require('./randomIdGenerator.util-C8XR2Tn1.js');
5
+ var logger_util = require('./logger.util-DUhrcCTY.js');
6
+ var text = require('./text-Cu3CaHGj.js');
7
+ var formValidationMessageVariation_enum = require('./form-validation-message-variation.enum-BA5nmCiw.js');
8
+
9
+ 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)}`;
10
+
11
+ const FormLabel = class {
12
+ constructor(hostRef) {
13
+ index.registerInstance(this, hostRef);
14
+ /**
15
+ * Sätter attributet 'id'. Om inget väljs så skapas ett slumpmässigt id.
16
+ * @en Set id attribute. Defaults to random string.
17
+ */
18
+ this.afId = randomIdGenerator_util.randomIdGenerator('digi-form-label');
19
+ /**
20
+ * Sätt denna till true om formuläret innehåller fler obligatoriska fält än valfria.
21
+ * @en Set this to true if the form contains more required fields than optional fields.
22
+ */
23
+ this.afAnnounceIfOptional = false;
24
+ /**
25
+ * Sätter text för afRequired.
26
+ * @en Set text for afRequired.
27
+ */
28
+ this.afRequiredText = text._t.required.toLowerCase();
29
+ /**
30
+ * Sätter text för afAnnounceIfOptional.
31
+ * @en Set text for afAnnounceIfOptional.
32
+ */
33
+ this.afAnnounceIfOptionalText = text._t.optional.toLowerCase();
34
+ }
35
+ componentWillLoad() {
36
+ this.setLabelText();
37
+ this.validateFor();
38
+ this.handleSlotVisibility();
39
+ }
40
+ validateFor() {
41
+ if (this.afFor == null) {
42
+ logger_util.logger.warn(`digi-form-label must have a for attribute. Please add a for attribute using af-for`, this.hostElement);
43
+ }
44
+ }
45
+ setLabelText() {
46
+ this.labelText = `${this.afLabel} ${this.requiredText}`;
47
+ if (!this.afLabel) {
48
+ logger_util.logger.warn(`digi-form-label must have a label. Please add a label using af-label`, this.hostElement);
49
+ }
50
+ }
51
+ handleSlotVisibility() {
52
+ this.hasActionSlot = !!this.hostElement.querySelector('[slot="actions"]');
53
+ }
54
+ get requiredText() {
55
+ if (this.afRequired && !this.afAnnounceIfOptional) {
56
+ return this.afRequiredText ? ` (${this.afRequiredText})` : '';
57
+ }
58
+ else if (!this.afRequired && this.afAnnounceIfOptional) {
59
+ return this.afAnnounceIfOptionalText
60
+ ? ` (${this.afAnnounceIfOptionalText})`
61
+ : '';
62
+ }
63
+ else {
64
+ return '';
65
+ }
66
+ }
67
+ render() {
68
+ return (index.h("div", { key: 'ac9aec4d1d20cc37694af578a97a16a17291c9f3', class: "digi-form-label" }, index.h("div", { key: 'bf27c3012d1973798095e6b832572fc20863c5f1', class: "digi-form-label__label-group" }, this.afFor && this.afLabel && (index.h("label", { key: '75435e49548e4fa27330a35b033689a0ed9e99a7', class: "digi-form-label__label", htmlFor: this.afFor, id: this.afId }, index.h("span", { key: '0527ddcebbd2a1b215f42eaed06ba7fc28633d43', class: "digi-form-label__label--label" }, this.labelText), this.afDescription && (index.h("span", { key: '8a3b3e6a0ec0a97adb0760b390f0ddb34b3e0b87', class: "digi-form-label__label--description" }, this.afDescription)))), this.hasActionSlot && (index.h("div", { key: 'f2e6ad691a5cbc57b990416097454a393da35c01', class: "digi-form-label__actions" }, index.h("slot", { key: '1fab5cca94da7ad0f2b617db7f713d3b4d17c52d', name: "actions" }))))));
69
+ }
70
+ get hostElement() { return index.getElement(this); }
71
+ static get watchers() { return {
72
+ "afFor": [{
73
+ "validateFor": 0
74
+ }],
75
+ "afLabel": [{
76
+ "setLabelText": 0
77
+ }],
78
+ "afRequired": [{
79
+ "setLabelText": 0
80
+ }],
81
+ "afAnnounceIfOptional": [{
82
+ "setLabelText": 0
83
+ }]
84
+ }; }
85
+ };
86
+ FormLabel.style = formLabelCss();
87
+
88
+ 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)}`;
89
+
90
+ const FormValidationMessage = class {
91
+ constructor(hostRef) {
92
+ index.registerInstance(this, hostRef);
93
+ /**
94
+ * Sätter valideringsstatus. Kan vara 'success', 'error' eller 'warning'.
95
+ * @en Set validation status
96
+ */
97
+ this.afVariation = formValidationMessageVariation_enum.FormValidationMessageVariation.SUCCESS;
98
+ }
99
+ get cssModifiers() {
100
+ return {
101
+ 'digi-form-validation-message--success': this.afVariation === formValidationMessageVariation_enum.FormValidationMessageVariation.SUCCESS,
102
+ 'digi-form-validation-message--error': this.afVariation === formValidationMessageVariation_enum.FormValidationMessageVariation.ERROR,
103
+ 'digi-form-validation-message--warning': this.afVariation === formValidationMessageVariation_enum.FormValidationMessageVariation.WARNING
104
+ };
105
+ }
106
+ get icon() {
107
+ switch (this.afVariation) {
108
+ case formValidationMessageVariation_enum.FormValidationMessageVariation.SUCCESS:
109
+ return index.h("digi-icon-validation-success", null);
110
+ case formValidationMessageVariation_enum.FormValidationMessageVariation.ERROR:
111
+ return index.h("digi-icon-validation-error", null);
112
+ case formValidationMessageVariation_enum.FormValidationMessageVariation.WARNING:
113
+ return index.h("digi-icon-validation-warning", { class: "warning" });
114
+ }
115
+ }
116
+ render() {
117
+ return (index.h("div", { key: '5c89cb2cfe7085ec0203814f2c7a43c9fe518db4', class: Object.assign({ 'digi-form-validation-message': true }, this.cssModifiers) }, index.h("div", { key: 'cb85b6a6e02b081710f80ad7bbbe96e182d8c353', class: "digi-form-validation-message__icon", "aria-hidden": "true" }, this.icon), index.h("span", { key: '9b1689dcad19fd3f033c679f496a1c94348f393b', class: "digi-form-validation-message__text" }, index.h("slot", { key: '794c1b1c0771cae8c0b19bd7123f7f5bc28e99b7' }))));
118
+ }
119
+ get hostElement() { return index.getElement(this); }
120
+ };
121
+ FormValidationMessage.style = formValidationMessageCss();
122
+
123
+ 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)}`;
124
+
125
+ const IconCheckCircle = class {
126
+ constructor(hostRef) {
127
+ index.registerInstance(this, hostRef);
128
+ /**
129
+ * För att dölja ikonen för skärmläsare. Default är satt till true.
130
+ * @en Hides the icon for screen readers. Default is set to true.
131
+ */
132
+ this.afSvgAriaHidden = true;
133
+ this.titleId = randomIdGenerator_util.randomIdGenerator('icontitle');
134
+ }
135
+ render() {
136
+ return (index.h("svg", { key: '1c9dcaf014e400504cbce24f69c67bdbb1dc0361', class: "digi-icon-validation-success", width: "25", height: "25", viewBox: "0 0 25 25", "aria-hidden": this.afSvgAriaHidden ? 'true' : 'false', "aria-labelledby": this.afSvgAriaLabelledby
137
+ ? this.afSvgAriaLabelledby
138
+ : this.afTitle
139
+ ? this.titleId
140
+ : undefined, xmlns: "http://www.w3.org/2000/svg" }, this.afTitle && index.h("title", { key: 'ed5b4d39b987b025d99ef2ce2153a8de749f587e', id: this.titleId }, this.afTitle), this.afDesc && index.h("desc", { key: '7c5175b745577dd9076170ba83fa00f8cc03c4a2' }, this.afDesc), index.h("path", { key: 'f9cb601de2dfbf7959b2b43023692e111f1fbf91', class: "digi-icon-validation-success__shape", d: "M25 12.5C25 19.404 19.404 25 12.5 25S0 19.404 0 12.5 5.596 0 12.5 0 25 5.596 25 12.5zm-13.946 6.619l9.274-9.275a.806.806 0 000-1.14l-1.14-1.14a.806.806 0 00-1.14 0l-7.564 7.563-3.531-3.531a.807.807 0 00-1.14 0l-1.141 1.14a.806.806 0 000 1.14l5.242 5.243a.806.806 0 001.14 0z", fill: "currentColor", "fill-rule": "nonzero" })));
141
+ }
142
+ };
143
+ IconCheckCircle.style = iconValidationSuccessCss();
144
+
145
+ exports.digi_form_label = FormLabel;
146
+ exports.digi_form_validation_message = FormValidationMessage;
147
+ exports.digi_icon_validation_success = IconCheckCircle;
@@ -1,24 +1,28 @@
1
1
  'use strict';
2
2
 
3
3
  var index = require('./index-tbq85ezH.js');
4
- var typographyVariation_enum = require('./typography-variation.enum-4snUBTF7.js');
4
+ var typographyVariation_enum = require('./typography-variation.enum-BDSt7CVI.js');
5
5
  require('./badge-notification-shape.enum-CEyEo2G5.js');
6
6
  require('./badge-status-variation.enum-XX8d--rj.js');
7
- require('./code-example-variation.enum-BCENTUV2.js');
8
- require('./form-input-type.enum-B2CsNSBg.js');
9
- require('./button-variation.enum-DkUalo9f.js');
7
+ require('./button-variation.enum-ngMqFLdW.js');
8
+ require('./button-type.enum-2UH0KkO-.js');
10
9
  require('./calendar-week-view-heading-level.enum-NEkm5SUq.js');
11
10
  require('./bar-chart-variation.enum-BZFN4377.js');
11
+ require('./code-example-variation.enum-Cq-BioXW.js');
12
12
  require('./code-variation.enum-BM-hhQuD.js');
13
13
  require('./expandable-accordion-header-level.enum-CjL9V3Kt.js');
14
14
  require('./expandable-faq-item-variation.enum-aKkYAQgd.js');
15
15
  require('./expandable-faq-variation.enum-FEybT9s4.js');
16
16
  require('./footer-card-variation.enum-BPnpkC45.js');
17
17
  require('./form-checkbox-variation.enum-BfOGU4Qt.js');
18
- require('./form-validation-message-variation.enum-DgkifAnP.js');
18
+ require('./form-file-upload-variation.enum-xcEOoggr.js');
19
+ require('./form-input-search-variation.enum-VVfvlVeM.js');
20
+ require('./form-input-type.enum-DvF_MTHK.js');
21
+ require('./form-input-variation.enum-kpoXNUuI.js');
19
22
  require('./form-radiogroup-validation.enum-DBDbjF6N.js');
20
23
  require('./form-select-variation.enum-e6wjWyaS.js');
21
24
  require('./form-textarea-variation.enum-BcEyaR5W.js');
25
+ require('./form-validation-message-variation.enum-BA5nmCiw.js');
22
26
  require('./info-card-multi-type.enum-pqhvdrsN.js');
23
27
  require('./info-card-variation.enum-B1cqmknX.js');
24
28
  require('./layout-container-max-width.enum-DqWtU7WK.js');