@fremtind/jokul 0.11.0 → 0.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (261) hide show
  1. package/README.md +76 -0
  2. package/build/NativeSelect-CNcZmpDZ.cjs +2 -0
  3. package/build/{NativeSelect-BxgwmRDc.cjs.map → NativeSelect-CNcZmpDZ.cjs.map} +1 -1
  4. package/build/NativeSelect-CfNZEQF0.js +2 -0
  5. package/build/{NativeSelect-DwtOOfyt.js.map → NativeSelect-CfNZEQF0.js.map} +1 -1
  6. package/build/build-stats.html +1 -1
  7. package/build/cjs/components/datepicker/DatePicker.js +1 -1
  8. package/build/cjs/components/datepicker/DatePicker.js.map +1 -1
  9. package/build/cjs/components/datepicker/internal/Calendar.js +1 -1
  10. package/build/cjs/components/datepicker/internal/Calendar.js.map +1 -1
  11. package/build/cjs/components/feedback/Feedback.js +2 -0
  12. package/build/cjs/components/feedback/Feedback.js.map +1 -0
  13. package/build/cjs/components/feedback/FeedbackSuccess.js +2 -0
  14. package/build/cjs/components/feedback/FeedbackSuccess.js.map +1 -0
  15. package/build/cjs/components/feedback/FeedbackValues.js +2 -0
  16. package/build/cjs/components/feedback/FeedbackValues.js.map +1 -0
  17. package/build/cjs/components/feedback/feedbackContext.js +2 -0
  18. package/build/cjs/components/feedback/feedbackContext.js.map +1 -0
  19. package/build/cjs/components/feedback/followup/Followup.js +2 -0
  20. package/build/cjs/components/feedback/followup/Followup.js.map +1 -0
  21. package/build/cjs/components/feedback/followup/followupContext.js +2 -0
  22. package/build/cjs/components/feedback/followup/followupContext.js.map +1 -0
  23. package/build/cjs/components/feedback/followup/useFollowup.js +2 -0
  24. package/build/cjs/components/feedback/followup/useFollowup.js.map +1 -0
  25. package/build/cjs/components/feedback/index.js +2 -0
  26. package/build/cjs/components/feedback/index.js.map +1 -0
  27. package/build/cjs/components/feedback/main-question/MainQuestion.js +2 -0
  28. package/build/cjs/components/feedback/main-question/MainQuestion.js.map +1 -0
  29. package/build/cjs/components/feedback/main-question/mainQuestionContext.js +2 -0
  30. package/build/cjs/components/feedback/main-question/mainQuestionContext.js.map +1 -0
  31. package/build/cjs/components/feedback/main-question/useMainQuestion.js +2 -0
  32. package/build/cjs/components/feedback/main-question/useMainQuestion.js.map +1 -0
  33. package/build/cjs/components/feedback/presets.js +2 -0
  34. package/build/cjs/components/feedback/presets.js.map +1 -0
  35. package/build/cjs/components/feedback/questions/AddonQuestion.js +2 -0
  36. package/build/cjs/components/feedback/questions/AddonQuestion.js.map +1 -0
  37. package/build/cjs/components/feedback/questions/CheckboxQuestion.js +2 -0
  38. package/build/cjs/components/feedback/questions/CheckboxQuestion.js.map +1 -0
  39. package/build/cjs/components/feedback/questions/ContactQuestion.js +2 -0
  40. package/build/cjs/components/feedback/questions/ContactQuestion.js.map +1 -0
  41. package/build/cjs/components/feedback/questions/RadioQuestion.js +2 -0
  42. package/build/cjs/components/feedback/questions/RadioQuestion.js.map +1 -0
  43. package/build/cjs/components/feedback/questions/SmileyQuestion.js +2 -0
  44. package/build/cjs/components/feedback/questions/SmileyQuestion.js.map +1 -0
  45. package/build/cjs/components/feedback/questions/TextQuestion.js +2 -0
  46. package/build/cjs/components/feedback/questions/TextQuestion.js.map +1 -0
  47. package/build/cjs/components/feedback/questions/index.js +2 -0
  48. package/build/cjs/components/feedback/questions/index.js.map +1 -0
  49. package/build/cjs/components/feedback/questions/smileyUtils.js +2 -0
  50. package/build/cjs/components/feedback/questions/smileyUtils.js.map +1 -0
  51. package/build/cjs/components/feedback/types.js +2 -0
  52. package/build/cjs/components/feedback/types.js.map +1 -0
  53. package/build/cjs/components/feedback/utils.js +2 -0
  54. package/build/cjs/components/feedback/utils.js.map +1 -0
  55. package/build/cjs/components/index.js +1 -1
  56. package/build/cjs/components/message/DismissButton.js +2 -0
  57. package/build/cjs/components/message/DismissButton.js.map +1 -0
  58. package/build/cjs/components/message/FormErrorMessage.js +2 -0
  59. package/build/cjs/components/message/FormErrorMessage.js.map +1 -0
  60. package/build/cjs/components/message/Message.js +2 -0
  61. package/build/cjs/components/message/Message.js.map +1 -0
  62. package/build/cjs/components/message/index.js +2 -0
  63. package/build/cjs/components/message/index.js.map +1 -0
  64. package/build/cjs/components/select/NativeSelect.js +1 -1
  65. package/build/cjs/components/select/Select.js +1 -1
  66. package/build/cjs/components/select/index.js +1 -1
  67. package/build/cjs/components/text-input/BaseTextInput.js +1 -1
  68. package/build/cjs/components/text-input/BaseTextInput.js.map +1 -1
  69. package/build/cjs/components/text-input/TextArea.js +1 -1
  70. package/build/cjs/components/text-input/TextArea.js.map +1 -1
  71. package/build/cjs/components/text-input/TextInput.js +1 -1
  72. package/build/cjs/components/text-input/TextInput.js.map +1 -1
  73. package/build/cjs/index.js +1 -1
  74. package/build/cjs/utilities/index.js +1 -1
  75. package/build/cjs/utilities/validators/hasMinimumWords/hasMinimumWords.js +2 -0
  76. package/build/cjs/utilities/validators/hasMinimumWords/hasMinimumWords.js.map +1 -0
  77. package/build/cjs/utilities/validators/hasNoIllegalCharacters/hasNoIllegalCharacters.js +2 -0
  78. package/build/cjs/utilities/validators/hasNoIllegalCharacters/hasNoIllegalCharacters.js.map +1 -0
  79. package/build/cjs/utilities/validators/index.js +2 -0
  80. package/build/cjs/utilities/validators/index.js.map +1 -0
  81. package/build/cjs/utilities/validators/isExactLength/isExactLength.js +2 -0
  82. package/build/cjs/utilities/validators/isExactLength/isExactLength.js.map +1 -0
  83. package/build/cjs/utilities/validators/isInteger/isInteger.js +2 -0
  84. package/build/cjs/utilities/validators/isInteger/isInteger.js.map +1 -0
  85. package/build/cjs/utilities/validators/isValidChassisnummer/isValidChassisnummer.js +2 -0
  86. package/build/cjs/utilities/validators/isValidChassisnummer/isValidChassisnummer.js.map +1 -0
  87. package/build/cjs/utilities/validators/isValidDogId/isValidDogId.js +2 -0
  88. package/build/cjs/utilities/validators/isValidDogId/isValidDogId.js.map +1 -0
  89. package/build/cjs/utilities/validators/isValidEpost/isValidEpost.js +2 -0
  90. package/build/cjs/utilities/validators/isValidEpost/isValidEpost.js.map +1 -0
  91. package/build/cjs/utilities/validators/isValidFodselsnummer/isValidFodselsnummer.js +2 -0
  92. package/build/cjs/utilities/validators/isValidFodselsnummer/isValidFodselsnummer.js.map +1 -0
  93. package/build/cjs/utilities/validators/isValidKortnummer/isValidKortnummer.js +2 -0
  94. package/build/cjs/utilities/validators/isValidKortnummer/isValidKortnummer.js.map +1 -0
  95. package/build/cjs/utilities/validators/isValidName/isValidName.js +2 -0
  96. package/build/cjs/utilities/validators/isValidName/isValidName.js.map +1 -0
  97. package/build/cjs/utilities/validators/isValidOrganisasjonsnummer/isValidOrganisasjonsnummer.js +2 -0
  98. package/build/cjs/utilities/validators/isValidOrganisasjonsnummer/isValidOrganisasjonsnummer.js.map +1 -0
  99. package/build/cjs/utilities/validators/isValidRegistreringsnummer/isValidRegistreringsnummer.js +2 -0
  100. package/build/cjs/utilities/validators/isValidRegistreringsnummer/isValidRegistreringsnummer.js.map +1 -0
  101. package/build/cjs/utilities/validators/isValidTelefonnummer/isValidTelefonnummer.js +2 -0
  102. package/build/cjs/utilities/validators/isValidTelefonnummer/isValidTelefonnummer.js.map +1 -0
  103. package/build/components/feedback/Feedback.d.ts +42 -0
  104. package/build/components/feedback/FeedbackSuccess.d.ts +3 -0
  105. package/build/components/feedback/FeedbackValues.d.ts +6 -0
  106. package/build/components/feedback/feedbackContext.d.ts +19 -0
  107. package/build/components/feedback/followup/Followup.d.ts +14 -0
  108. package/build/components/feedback/followup/followupContext.d.ts +9 -0
  109. package/build/components/feedback/followup/useFollowup.d.ts +19 -0
  110. package/build/components/feedback/index.d.ts +3 -0
  111. package/build/components/feedback/main-question/MainQuestion.d.ts +16 -0
  112. package/build/components/feedback/main-question/mainQuestionContext.d.ts +9 -0
  113. package/build/components/feedback/main-question/useMainQuestion.d.ts +13 -0
  114. package/build/components/feedback/presets.d.ts +6 -0
  115. package/build/components/feedback/questions/AddonQuestion.d.ts +7 -0
  116. package/build/components/feedback/questions/CheckboxQuestion.d.ts +3 -0
  117. package/build/components/feedback/questions/ContactQuestion.d.ts +28 -0
  118. package/build/components/feedback/questions/RadioQuestion.d.ts +3 -0
  119. package/build/components/feedback/questions/SmileyQuestion.d.ts +3 -0
  120. package/build/components/feedback/questions/TextQuestion.d.ts +3 -0
  121. package/build/components/feedback/questions/index.d.ts +6 -0
  122. package/build/components/feedback/questions/smileyUtils.d.ts +4 -0
  123. package/build/components/feedback/types.d.ts +86 -0
  124. package/build/components/feedback/utils.d.ts +4 -0
  125. package/build/components/index.d.ts +2 -0
  126. package/build/components/message/DismissButton.d.ts +5 -0
  127. package/build/components/message/FormErrorMessage.d.ts +14 -0
  128. package/build/components/message/Message.d.ts +19 -0
  129. package/build/components/message/index.d.ts +2 -0
  130. package/build/es/components/datepicker/DatePicker.js +1 -1
  131. package/build/es/components/datepicker/DatePicker.js.map +1 -1
  132. package/build/es/components/datepicker/internal/Calendar.js +1 -1
  133. package/build/es/components/datepicker/internal/Calendar.js.map +1 -1
  134. package/build/es/components/feedback/Feedback.js +2 -0
  135. package/build/es/components/feedback/Feedback.js.map +1 -0
  136. package/build/es/components/feedback/FeedbackSuccess.js +2 -0
  137. package/build/es/components/feedback/FeedbackSuccess.js.map +1 -0
  138. package/build/es/components/feedback/FeedbackValues.js +2 -0
  139. package/build/es/components/feedback/FeedbackValues.js.map +1 -0
  140. package/build/es/components/feedback/feedbackContext.js +2 -0
  141. package/build/es/components/feedback/feedbackContext.js.map +1 -0
  142. package/build/es/components/feedback/followup/Followup.js +2 -0
  143. package/build/es/components/feedback/followup/Followup.js.map +1 -0
  144. package/build/es/components/feedback/followup/followupContext.js +2 -0
  145. package/build/es/components/feedback/followup/followupContext.js.map +1 -0
  146. package/build/es/components/feedback/followup/useFollowup.js +2 -0
  147. package/build/es/components/feedback/followup/useFollowup.js.map +1 -0
  148. package/build/es/components/feedback/index.js +2 -0
  149. package/build/es/components/feedback/index.js.map +1 -0
  150. package/build/es/components/feedback/main-question/MainQuestion.js +2 -0
  151. package/build/es/components/feedback/main-question/MainQuestion.js.map +1 -0
  152. package/build/es/components/feedback/main-question/mainQuestionContext.js +2 -0
  153. package/build/es/components/feedback/main-question/mainQuestionContext.js.map +1 -0
  154. package/build/es/components/feedback/main-question/useMainQuestion.js +2 -0
  155. package/build/es/components/feedback/main-question/useMainQuestion.js.map +1 -0
  156. package/build/es/components/feedback/presets.js +2 -0
  157. package/build/es/components/feedback/presets.js.map +1 -0
  158. package/build/es/components/feedback/questions/AddonQuestion.js +2 -0
  159. package/build/es/components/feedback/questions/AddonQuestion.js.map +1 -0
  160. package/build/es/components/feedback/questions/CheckboxQuestion.js +2 -0
  161. package/build/es/components/feedback/questions/CheckboxQuestion.js.map +1 -0
  162. package/build/es/components/feedback/questions/ContactQuestion.js +2 -0
  163. package/build/es/components/feedback/questions/ContactQuestion.js.map +1 -0
  164. package/build/es/components/feedback/questions/RadioQuestion.js +2 -0
  165. package/build/es/components/feedback/questions/RadioQuestion.js.map +1 -0
  166. package/build/es/components/feedback/questions/SmileyQuestion.js +2 -0
  167. package/build/es/components/feedback/questions/SmileyQuestion.js.map +1 -0
  168. package/build/es/components/feedback/questions/TextQuestion.js +2 -0
  169. package/build/es/components/feedback/questions/TextQuestion.js.map +1 -0
  170. package/build/es/components/feedback/questions/index.js +2 -0
  171. package/build/es/components/feedback/questions/index.js.map +1 -0
  172. package/build/es/components/feedback/questions/smileyUtils.js +2 -0
  173. package/build/es/components/feedback/questions/smileyUtils.js.map +1 -0
  174. package/build/es/components/feedback/types.js +2 -0
  175. package/build/es/components/feedback/types.js.map +1 -0
  176. package/build/es/components/feedback/utils.js +2 -0
  177. package/build/es/components/feedback/utils.js.map +1 -0
  178. package/build/es/components/index.js +1 -1
  179. package/build/es/components/message/DismissButton.js +2 -0
  180. package/build/es/components/message/DismissButton.js.map +1 -0
  181. package/build/es/components/message/FormErrorMessage.js +2 -0
  182. package/build/es/components/message/FormErrorMessage.js.map +1 -0
  183. package/build/es/components/message/Message.js +2 -0
  184. package/build/es/components/message/Message.js.map +1 -0
  185. package/build/es/components/message/index.js +2 -0
  186. package/build/es/components/message/index.js.map +1 -0
  187. package/build/es/components/select/NativeSelect.js +1 -1
  188. package/build/es/components/select/Select.js +1 -1
  189. package/build/es/components/select/index.js +1 -1
  190. package/build/es/components/text-input/BaseTextInput.js +1 -1
  191. package/build/es/components/text-input/BaseTextInput.js.map +1 -1
  192. package/build/es/components/text-input/TextArea.js +1 -1
  193. package/build/es/components/text-input/TextArea.js.map +1 -1
  194. package/build/es/components/text-input/TextInput.js +1 -1
  195. package/build/es/components/text-input/TextInput.js.map +1 -1
  196. package/build/es/index.js +1 -1
  197. package/build/es/utilities/index.js +1 -1
  198. package/build/es/utilities/validators/hasMinimumWords/hasMinimumWords.js +2 -0
  199. package/build/es/utilities/validators/hasMinimumWords/hasMinimumWords.js.map +1 -0
  200. package/build/es/utilities/validators/hasNoIllegalCharacters/hasNoIllegalCharacters.js +2 -0
  201. package/build/es/utilities/validators/hasNoIllegalCharacters/hasNoIllegalCharacters.js.map +1 -0
  202. package/build/es/utilities/validators/index.js +2 -0
  203. package/build/es/utilities/validators/index.js.map +1 -0
  204. package/build/es/utilities/validators/isExactLength/isExactLength.js +2 -0
  205. package/build/es/utilities/validators/isExactLength/isExactLength.js.map +1 -0
  206. package/build/es/utilities/validators/isInteger/isInteger.js +2 -0
  207. package/build/es/utilities/validators/isInteger/isInteger.js.map +1 -0
  208. package/build/es/utilities/validators/isValidChassisnummer/isValidChassisnummer.js +2 -0
  209. package/build/es/utilities/validators/isValidChassisnummer/isValidChassisnummer.js.map +1 -0
  210. package/build/es/utilities/validators/isValidDogId/isValidDogId.js +2 -0
  211. package/build/es/utilities/validators/isValidDogId/isValidDogId.js.map +1 -0
  212. package/build/es/utilities/validators/isValidEpost/isValidEpost.js +2 -0
  213. package/build/es/utilities/validators/isValidEpost/isValidEpost.js.map +1 -0
  214. package/build/es/utilities/validators/isValidFodselsnummer/isValidFodselsnummer.js +2 -0
  215. package/build/es/utilities/validators/isValidFodselsnummer/isValidFodselsnummer.js.map +1 -0
  216. package/build/es/utilities/validators/isValidKortnummer/isValidKortnummer.js +2 -0
  217. package/build/es/utilities/validators/isValidKortnummer/isValidKortnummer.js.map +1 -0
  218. package/build/es/utilities/validators/isValidName/isValidName.js +2 -0
  219. package/build/es/utilities/validators/isValidName/isValidName.js.map +1 -0
  220. package/build/es/utilities/validators/isValidOrganisasjonsnummer/isValidOrganisasjonsnummer.js +2 -0
  221. package/build/es/utilities/validators/isValidOrganisasjonsnummer/isValidOrganisasjonsnummer.js.map +1 -0
  222. package/build/es/utilities/validators/isValidRegistreringsnummer/isValidRegistreringsnummer.js +2 -0
  223. package/build/es/utilities/validators/isValidRegistreringsnummer/isValidRegistreringsnummer.js.map +1 -0
  224. package/build/es/utilities/validators/isValidTelefonnummer/isValidTelefonnummer.js +2 -0
  225. package/build/es/utilities/validators/isValidTelefonnummer/isValidTelefonnummer.js.map +1 -0
  226. package/build/utilities/index.d.ts +1 -0
  227. package/build/utilities/validators/hasMinimumWords/hasMinimumWords.d.ts +10 -0
  228. package/build/utilities/validators/hasNoIllegalCharacters/hasNoIllegalCharacters.d.ts +7 -0
  229. package/build/utilities/validators/index.d.ts +12 -0
  230. package/build/utilities/validators/isExactLength/isExactLength.d.ts +7 -0
  231. package/build/utilities/validators/isInteger/isInteger.d.ts +7 -0
  232. package/build/utilities/validators/isValidChassisnummer/isValidChassisnummer.d.ts +7 -0
  233. package/build/utilities/validators/isValidDogId/isValidDogId.d.ts +7 -0
  234. package/build/utilities/validators/isValidEpost/isValidEpost.d.ts +7 -0
  235. package/build/utilities/validators/isValidFodselsnummer/isValidFodselsnummer.d.ts +30 -0
  236. package/build/utilities/validators/isValidKortnummer/isValidKortnummer.d.ts +6 -0
  237. package/build/utilities/validators/isValidName/isValidName.d.ts +7 -0
  238. package/build/utilities/validators/isValidOrganisasjonsnummer/isValidOrganisasjonsnummer.d.ts +6 -0
  239. package/build/utilities/validators/isValidRegistreringsnummer/isValidRegistreringsnummer.d.ts +12 -0
  240. package/build/utilities/validators/isValidTelefonnummer/isValidTelefonnummer.d.ts +7 -0
  241. package/package.json +6 -2
  242. package/src/components/button/styles/button.css +4 -4
  243. package/src/components/button/styles/button.min.css +1 -1
  244. package/src/components/checkbox/styles/checkbox.css +4 -4
  245. package/src/components/checkbox/styles/checkbox.min.css +1 -1
  246. package/src/components/feedback/styles/_index.scss +1 -0
  247. package/src/components/feedback/styles/feedback.css +104 -0
  248. package/src/components/feedback/styles/feedback.min.css +1 -0
  249. package/src/components/feedback/styles/feedback.scss +103 -0
  250. package/src/components/loader/styles/loader.css +6 -6
  251. package/src/components/loader/styles/loader.min.css +1 -1
  252. package/src/components/loader/styles/skeleton-loader.css +5 -5
  253. package/src/components/loader/styles/skeleton-loader.min.css +1 -1
  254. package/src/components/message/styles/_index.scss +1 -0
  255. package/src/components/message/styles/message.css +203 -0
  256. package/src/components/message/styles/message.min.css +1 -0
  257. package/src/components/message/styles/message.scss +180 -0
  258. package/src/components/radio-button/styles/radio-button.css +2 -2
  259. package/src/components/radio-button/styles/radio-button.min.css +1 -1
  260. package/build/NativeSelect-BxgwmRDc.cjs +0 -2
  261. package/build/NativeSelect-DwtOOfyt.js +0 -2
@@ -0,0 +1,2 @@
1
+ import{useState as e,useRef as t,useEffect as s,useCallback as u}from"react";const a=a=>{const[n,r]=e(),[i,o]=e(),[m,l]=e(!1),c=t({onSubmit:a,currentValue:n,message:i,submitted:m});s((()=>{c.current={...c.current,onSubmit:a,currentValue:n,message:i,submitted:m}}),[a,n,i,m]);const d=u(((e=!0)=>{const{message:t,currentValue:s,submitted:u,onSubmit:a}=c.current;if(!u&&void 0!==s){a({feedbackValue:Array.isArray(s)?s.map((e=>e.value)):null==s?void 0:s.value,intentionalSubmit:e,...e&&t?{message:t}:{}})}}),[]),b=u((()=>d(!1)),[d]);return s((()=>(typeof window<"u"&&window.addEventListener("beforeunload",b),()=>{b(),window.removeEventListener("beforeunload",b)})),[b]),{currentValue:n,setCurrentValue:r,message:i,setMessage:o,submitted:m,handleSubmit:()=>{d(),l(!0)}}};export{a as useMainQuestion};
2
+ //# sourceMappingURL=useMainQuestion.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useMainQuestion.js","sources":["../../../../../src/components/feedback/main-question/useMainQuestion.ts"],"sourcesContent":["import { useState, useRef, useCallback, useEffect, SetStateAction, Dispatch } from \"react\";\nimport { FeedbackType, FeedbackOption } from \"../types\";\n\ntype Value = FeedbackOption<string | number> | FeedbackOption<string | number>[] | undefined;\n\ntype MainQuestion = {\n currentValue: Value;\n setCurrentValue: Dispatch<SetStateAction<Value>>;\n message: string | undefined;\n setMessage: Dispatch<SetStateAction<string | undefined>>;\n submitted: boolean;\n handleSubmit: () => void;\n};\n\nexport const useMainQuestion = (onSubmit: (f: FeedbackType) => void): MainQuestion => {\n const [currentValue, setCurrentValue] = useState<FeedbackOption | FeedbackOption[]>();\n const [message, setMessage] = useState<string>();\n const [submitted, setSubmitted] = useState(false);\n\n const feedbackRef = useRef({\n onSubmit,\n currentValue,\n message,\n submitted,\n });\n\n useEffect(() => {\n feedbackRef.current = {\n ...feedbackRef.current,\n onSubmit,\n currentValue,\n message,\n submitted,\n };\n }, [onSubmit, currentValue, message, submitted]);\n\n const submitHandler = useCallback((intentionalSubmit = true) => {\n const { message, currentValue, submitted, onSubmit } = feedbackRef.current;\n\n if (!submitted && currentValue !== undefined) {\n const feedbackValue = Array.isArray(currentValue)\n ? currentValue.map((option) => option.value)\n : currentValue?.value;\n onSubmit({\n feedbackValue,\n intentionalSubmit,\n ...(intentionalSubmit && message ? { message } : {}),\n });\n }\n }, []);\n\n const autoSubmit = useCallback(() => submitHandler(false), [submitHandler]);\n\n useEffect(() => {\n if (typeof window !== \"undefined\") {\n window.addEventListener(\"beforeunload\", autoSubmit);\n }\n return () => {\n autoSubmit();\n window.removeEventListener(\"beforeunload\", autoSubmit);\n };\n }, [autoSubmit]);\n\n const handleSubmit = () => {\n submitHandler();\n setSubmitted(true);\n };\n\n return {\n currentValue,\n setCurrentValue,\n message,\n setMessage,\n submitted,\n handleSubmit,\n };\n};\n"],"names":["useMainQuestion","onSubmit","currentValue","setCurrentValue","useState","message","setMessage","submitted","setSubmitted","feedbackRef","useRef","useEffect","current","submitHandler","useCallback","intentionalSubmit","feedbackValue","Array","isArray","map","option","value","autoSubmit","window","addEventListener","removeEventListener","handleSubmit"],"mappings":"6EAca,MAAAA,EAAmBC,IACtB,MAACC,EAAcC,GAAmBC,KACjCC,EAASC,GAAcF,KACvBG,EAAWC,GAAgBJ,GAAS,GAErCK,EAAcC,EAAO,CACvBT,SAAAA,EACAC,aAAAA,EACAG,QAAAA,EACAE,UAAAA,IAGJI,GAAU,KACNF,EAAYG,QAAU,IACfH,EAAYG,QACfX,SAAAA,EACAC,aAAAA,EACAG,QAAAA,EACAE,UAAAA,EAAA,GAEL,CAACN,EAAUC,EAAcG,EAASE,IAErC,MAAMM,EAAgBC,GAAY,CAACC,GAAoB,KAC7C,MAAEV,QAAAA,EAASH,aAAAA,EAAcK,UAAAA,EAAWN,SAAAA,GAAaQ,EAAYG,QAE/D,IAACL,QAA8B,IAAjBL,EAA4B,CAI1CD,EAAS,CACLe,cAJkBC,MAAMC,QAAQhB,GAC9BA,EAAaiB,KAAKC,GAAWA,EAAOC,QACpCnB,MAAAA,SAAAA,EAAcmB,MAGhBN,kBAAAA,KACIA,GAAqBV,EAAU,CAAEA,QAAAA,GAAY,CAAC,GAE1D,IACD,IAEGiB,EAAaR,GAAY,IAAMD,GAAc,IAAQ,CAACA,IAE5DF,OAAAA,GAAU,YACKY,OAAW,KACXA,OAAAC,iBAAiB,eAAgBF,GAErC,KACQA,IACJC,OAAAE,oBAAoB,eAAgBH,EAAU,IAE1D,CAACA,IAOG,CACHpB,aAAAA,EACAC,gBAAAA,EACAE,QAAAA,EACAC,WAAAA,EACAC,UAAAA,EACAmB,aAXiB,KACHb,IACdL,GAAa,EAAI,EASjB"}
@@ -0,0 +1,2 @@
1
+ import{defaultOptions as e}from"./questions/smileyUtils.js";const a={type:"smiley",label:"Hvor fornøyd er du med denne nettsiden?",options:e,addOnQuestion:!0},t={"Fant du":{type:"radio",label:"Fant du det du lette etter?",options:[{label:"Ja",value:"ja",textAreaLabel:"Så bra! Har du noen tilbakemeldinger kan du skrive dem her."},{label:"Nei",value:"nei",textAreaLabel:"Det var leit! Fortell oss gjerne hva du savner, så kan vi gjøre sidene våre bedre."}],addOnQuestion:!0},"Fikk du gjort":{type:"radio",label:"Fikk du gjort det du skulle?",options:[{label:"Ja",value:"ja",textAreaLabel:"Så bra! Har du noen tilbakemeldinger kan du skrive dem her."},{label:"Nei",value:"nei",textAreaLabel:"Det var leit! Fortell oss gjerne hva du savner, så kan vi gjøre sidene våre bedre."}],addOnQuestion:!0},"Hvor fornøyd 5":a,Smileys:a};export{t as PRESETS};
2
+ //# sourceMappingURL=presets.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"presets.js","sources":["../../../../src/components/feedback/presets.tsx"],"sourcesContent":["import { ComponentProps } from \"react\";\nimport { defaultOptions as smileyOptions } from \"./questions/smileyUtils\";\nimport { Feedback } from \"./\";\n\ntype FeedbackProps = ComponentProps<typeof Feedback>;\ntype PresetProperties = Pick<FeedbackProps, \"label\" | \"type\" | \"options\" | \"addOnQuestion\">;\n\nconst smileyQuestion: PresetProperties = {\n type: \"smiley\",\n label: \"Hvor fornøyd er du med denne nettsiden?\",\n options: smileyOptions,\n addOnQuestion: true,\n};\n\nexport const PRESETS: Record<string, PresetProperties> = {\n \"Fant du\": {\n type: \"radio\",\n label: \"Fant du det du lette etter?\",\n options: [\n {\n label: \"Ja\",\n value: \"ja\",\n textAreaLabel: \"Så bra! Har du noen tilbakemeldinger kan du skrive dem her.\",\n },\n {\n label: \"Nei\",\n value: \"nei\",\n textAreaLabel: \"Det var leit! Fortell oss gjerne hva du savner, så kan vi gjøre sidene våre bedre.\",\n },\n ],\n addOnQuestion: true,\n },\n \"Fikk du gjort\": {\n type: \"radio\",\n label: \"Fikk du gjort det du skulle?\",\n options: [\n {\n label: \"Ja\",\n value: \"ja\",\n textAreaLabel: \"Så bra! Har du noen tilbakemeldinger kan du skrive dem her.\",\n },\n {\n label: \"Nei\",\n value: \"nei\",\n textAreaLabel: \"Det var leit! Fortell oss gjerne hva du savner, så kan vi gjøre sidene våre bedre.\",\n },\n ],\n addOnQuestion: true,\n },\n \"Hvor fornøyd 5\": smileyQuestion,\n Smileys: smileyQuestion,\n};\n"],"names":["smileyQuestion","type","label","options","smileyOptions","addOnQuestion","PRESETS","value","textAreaLabel","Smileys"],"mappings":"4DAOA,MAAMA,EAAmC,CACrCC,KAAM,SACNC,MAAO,0CACPC,QAASC,EACTC,eAAe,GAGNC,EAA4C,CACrD,UAAW,CACPL,KAAM,QACNC,MAAO,8BACPC,QAAS,CACL,CACID,MAAO,KACPK,MAAO,KACPC,cAAe,+DAEnB,CACIN,MAAO,MACPK,MAAO,MACPC,cAAe,uFAGvBH,eAAe,GAEnB,gBAAiB,CACbJ,KAAM,QACNC,MAAO,+BACPC,QAAS,CACL,CACID,MAAO,KACPK,MAAO,KACPC,cAAe,+DAEnB,CACIN,MAAO,MACPK,MAAO,MACPC,cAAe,uFAGvBH,eAAe,GAEnB,iBAAkBL,EAClBS,QAAST"}
@@ -0,0 +1,2 @@
1
+ import{jsxs as e,Fragment as t,jsx as r}from"react/jsx-runtime";import{useState as n,useEffect as a}from"react";import"../../text-input/BaseTextArea.js";import"../../text-input/BaseTextInput.js";import{TextArea as s}from"../../text-input/TextArea.js";import"../../text-input/TextInput.js";import{useFeedbackContext as o}from"../feedbackContext.js";import{useMainQuestionContext as i}from"../main-question/mainQuestionContext.js";const l=({helpLabel:l="Ikke skriv personlige opplysninger. Tilbakemeldinger som kommer inn her blir ikke besvart, men brukt i videre arbeid med å forbedre tjenestene våre.",label:u})=>{const{counter:d}=o(),p=i(),[m,c]=n();if(a((()=>{var e,t,r;const n=Array.isArray(null==p?void 0:p.currentValue)?null==(e=null==p?void 0:p.currentValue[0].textAreaLabel)?void 0:e.toString():null==(r=null==(t=null==p?void 0:p.currentValue)?void 0:t.textAreaLabel)?void 0:r.toString();c(n||u)}),[null==p?void 0:p.currentValue,u]),!p)return console.error("Addon question must be used inside a MainQuestion context provider"),null;const{message:x,setMessage:b}=p;return e(t,{children:[void 0!==p.currentValue&&e("div",{className:"jkl-sr-only","aria-live":"polite",children:[m," ",l]}),r(s,{startOpen:!0,rows:4,"data-testid":"jkl-feedback__open-question",className:"jkl-spacing-xl--bottom jkl-spacing-xl--top",label:m,labelProps:{srOnly:!0},placeholder:m,helpLabel:l,value:x||"",onChange:e=>b(e.target.value),counter:d})]})};export{l as AddonQuestion};
2
+ //# sourceMappingURL=AddonQuestion.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AddonQuestion.js","sources":["../../../../../src/components/feedback/questions/AddonQuestion.tsx"],"sourcesContent":["import React, { ChangeEventHandler, useEffect, useState } from \"react\";\nimport { TextArea } from \"../../text-input\";\nimport { useFeedbackContext } from \"../feedbackContext\";\nimport { useMainQuestionContext } from \"../main-question/mainQuestionContext\";\n\ninterface Props {\n label?: string;\n helpLabel?: string;\n}\n\nexport const AddonQuestion: React.FC<Props> = ({\n helpLabel = \"Ikke skriv personlige opplysninger. Tilbakemeldinger som kommer inn her blir ikke besvart, men brukt i videre arbeid med å forbedre tjenestene våre.\",\n label,\n}) => {\n const { counter } = useFeedbackContext();\n const context = useMainQuestionContext();\n const [dynamicLabel, setDynamicLabel] = useState<string>();\n\n useEffect(() => {\n const labelFromValue = Array.isArray(context?.currentValue)\n ? context?.currentValue[0].textAreaLabel?.toString()\n : context?.currentValue?.textAreaLabel?.toString();\n setDynamicLabel(labelFromValue || label);\n }, [context?.currentValue, label]);\n\n if (!context) {\n console.error(\"Addon question must be used inside a MainQuestion context provider\");\n return null;\n }\n\n const { message, setMessage } = context;\n const handleChange: ChangeEventHandler<HTMLTextAreaElement> = (e) => setMessage(e.target.value);\n\n return (\n <>\n {context.currentValue !== undefined && (\n <div className=\"jkl-sr-only\" aria-live=\"polite\">\n {dynamicLabel} {helpLabel}\n </div>\n )}\n <TextArea\n startOpen\n rows={4}\n data-testid=\"jkl-feedback__open-question\"\n className=\"jkl-spacing-xl--bottom jkl-spacing-xl--top\"\n label={dynamicLabel}\n labelProps={{ srOnly: true }}\n placeholder={dynamicLabel}\n helpLabel={helpLabel}\n value={message || \"\"}\n onChange={handleChange}\n counter={counter}\n />\n </>\n );\n};\n"],"names":["AddonQuestion","helpLabel","label","counter","useFeedbackContext","context","useMainQuestionContext","dynamicLabel","setDynamicLabel","useState","useEffect","labelFromValue","Array","isArray","currentValue","_a","textAreaLabel","toString","_c","_b","console","error","message","setMessage","jsxs","Fragment","children","className","jsx","TextArea","startOpen","rows","labelProps","srOnly","placeholder","value","onChange","e","target"],"mappings":"6aAUO,MAAMA,EAAiC,EAC1CC,UAAAA,EAAY,uJACZC,MAAAA,MAEM,MAAEC,QAAAA,GAAYC,IACdC,EAAUC,KACTC,EAAcC,GAAmBC,IASxC,GAPAC,GAAU,eACN,MAAMC,EAAiBC,MAAMC,QAAQ,MAAAR,OAAAA,EAAAA,EAASS,cACxC,OAAAC,EAAA,MAAAV,OAAAA,EAAAA,EAASS,aAAa,GAAGE,oBAAzB,EAAAD,EAAwCE,WACxC,OAAAC,EAAA,OAAAC,EAAA,MAAAd,OAAA,EAAAA,EAASS,mBAATK,EAAAA,EAAuBH,oBAAvB,EAAAE,EAAsCD,WAC5CT,EAAgBG,GAAkBT,EAAK,GACxC,CAAC,MAAAG,OAAA,EAAAA,EAASS,aAAcZ,KAEtBG,EACO,OAAAe,QAAAC,MAAM,sEACP,KAGL,MAAEC,QAAAA,EAASC,WAAAA,GAAelB,EAGhC,OAESmB,EAAAC,EAAA,CAAAC,SAAA,MAAyB,IAAzBrB,EAAQS,cACLU,EAAC,OAAIG,UAAU,cAAc,YAAU,SAClCD,SAAA,CAAAnB,EAAa,IAAEN,KAGxB2B,EAACC,EAAA,CACGC,WAAS,EACTC,KAAM,EACN,cAAY,8BACZJ,UAAU,6CACVzB,MAAOK,EACPyB,WAAY,CAAEC,QAAQ,GACtBC,YAAa3B,EACbN,UAAAA,EACAkC,MAAOb,GAAW,GAClBc,SAnBmDC,GAAMd,EAAWc,EAAEC,OAAOH,OAoB7EhC,QAAAA,MAER"}
@@ -0,0 +1,2 @@
1
+ import{jsx as o}from"react/jsx-runtime";import{useRef as n,useEffect as i}from"react";import{Checkbox as c}from"../../checkbox/Checkbox.js";import{FieldGroup as r}from"../../input-group/FieldGroup.js";import"../../input-group/InputGroup.js";import"../../icon/Icon.js";import"../../icon/icons/animated/ArrowVerticalAnimated.js";import"../../icon/icons/animated/ArrowHorizontalAnimated.js";import"../../icon/icons/animated/PlusRemoveAnimated.js";import"../../icon/icons/ArrowDownIcon.js";import"../../icon/icons/ArrowLeftIcon.js";import"../../icon/icons/ArrowNorthEastIcon.js";import"../../icon/icons/ArrowRightIcon.js";import"../../icon/icons/ArrowUpIcon.js";import"../../icon/icons/CalendarIcon.js";import"../../icon/icons/CheckIcon.js";import"../../icon/icons/ChevronDownIcon.js";import"../../icon/icons/ChevronLeftIcon.js";import"../../icon/icons/ChevronRightIcon.js";import"../../icon/icons/ChevronUpIcon.js";import"../../icon/icons/CloseIcon.js";import"../../icon/icons/CopyIcon.js";import"../../icon/icons/DotsIcon.js";import"../../icon/icons/DragIcon.js";import"../../icon/icons/ErrorIcon.js";import"../../icon/icons/GreenCheckIcon.js";import"../../icon/icons/HamburgerIcon.js";import"../../icon/icons/InfoIcon.js";import"../../icon/icons/LinkIcon.js";import"../../icon/icons/PlusIcon.js";import"../../icon/icons/QuestionIcon.js";import"../../icon/icons/RedCrossIcon.js";import"../../icon/icons/SearchIcon.js";import"../../icon/icons/SuccessIcon.js";import"../../icon/icons/WarningIcon.js";import"../../icon/icons/MinusIcon.js";import"../../icon/icons/ThumbDownIcon.js";import"../../icon/icons/ThumbUpIcon.js";import"../../icon/icons/TrashCanIcon.js";import"../../icon/icons/PenIcon.js";import{useFollowUpContext as s}from"../followup/followupContext.js";import{useMainQuestionContext as t}from"../main-question/mainQuestionContext.js";const e=({label:e,name:m,options:p,helpLabel:a,autoFocus:u=!1})=>{const l=s(),j=t(),I=l||j,d=n(null);i((()=>{u&&d.current&&d.current.focus()}),[u,d]);const f=o=>{const{value:n}=o.target,i=null==p?void 0:p.find((o=>o.value.toString()===n));if(i){if(null==I||!I.currentValue)return void(null==I||I.setCurrentValue([i]));if(Array.isArray(null==I?void 0:I.currentValue)){const o=I.currentValue.find((o=>o===i));o?I.setCurrentValue((n=>n.filter((n=>n!==o)))):I.setCurrentValue((o=>[...o,i]))}}};return I?o(r,{labelProps:{variant:"large"},legend:e,helpLabel:a,children:null==p?void 0:p.map(((n,i)=>o(c,{name:m||e,value:n.value.toString(),onChange:f,ref:0===i?d:void 0,children:n.label},`${e}-${n.value}`)))}):(console.error("Questions must be used inside a Followup or Feedback context provider"),null)};export{e as CheckboxQuestion};
2
+ //# sourceMappingURL=CheckboxQuestion.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CheckboxQuestion.js","sources":["../../../../../src/components/feedback/questions/CheckboxQuestion.tsx"],"sourcesContent":["import React, { ChangeEventHandler, useEffect, useRef } from \"react\";\nimport { Checkbox } from \"../../checkbox\";\nimport { FieldGroup } from \"../../input-group\";\nimport { useFollowUpContext } from \"../followup/followupContext\";\nimport { useMainQuestionContext } from \"../main-question/mainQuestionContext\";\nimport { FeedbackOption, QuestionProps } from \"../types\";\n\nexport const CheckboxQuestion: React.FC<QuestionProps> = ({ label, name, options, helpLabel, autoFocus = false }) => {\n const followupContext = useFollowUpContext();\n const feedbackContext = useMainQuestionContext();\n const context = followupContext || feedbackContext;\n const ref = useRef<HTMLInputElement>(null);\n\n useEffect(() => {\n if (autoFocus && ref.current) {\n ref.current.focus();\n }\n }, [autoFocus, ref]);\n\n const handleChange: ChangeEventHandler<HTMLInputElement> = (event) => {\n const { value } = event.target;\n const matchingOption = options?.find((option) => option.value.toString() === value);\n if (!matchingOption) return;\n\n if (!context?.currentValue) {\n context?.setCurrentValue([matchingOption]);\n return;\n }\n\n if (Array.isArray(context?.currentValue)) {\n const found = context.currentValue.find((option) => option === matchingOption);\n if (found) {\n context.setCurrentValue((oldValues) =>\n (oldValues as FeedbackOption[]).filter((option) => option !== found),\n );\n } else {\n context.setCurrentValue((oldValues) => [...(oldValues as FeedbackOption[]), matchingOption]);\n }\n }\n };\n\n if (!context) {\n console.error(\"Questions must be used inside a Followup or Feedback context provider\");\n return null;\n }\n\n return (\n <FieldGroup labelProps={{ variant: \"large\" }} legend={label} helpLabel={helpLabel}>\n {options?.map((option, i) => (\n <Checkbox\n key={`${label}-${option.value}`}\n name={name || label}\n value={option.value.toString()}\n onChange={handleChange}\n ref={i === 0 ? ref : undefined}\n >\n {option.label}\n </Checkbox>\n ))}\n </FieldGroup>\n );\n};\n"],"names":["CheckboxQuestion","label","name","options","helpLabel","autoFocus","followupContext","useFollowUpContext","feedbackContext","useMainQuestionContext","context","ref","useRef","useEffect","current","focus","handleChange","event","value","target","matchingOption","find","option","toString","currentValue","setCurrentValue","Array","isArray","found","oldValues","filter","jsx","FieldGroup","labelProps","variant","legend","children","map","i","Checkbox","onChange","console","error"],"mappings":"kzDAOa,MAAAA,EAA4C,EAAGC,MAAAA,EAAOC,KAAAA,EAAMC,QAAAA,EAASC,UAAAA,EAAWC,UAAAA,GAAY,MAC/FC,MAAAA,EAAkBC,IAClBC,EAAkBC,IAClBC,EAAUJ,GAAmBE,EAC7BG,EAAMC,EAAyB,MAErCC,GAAU,KACFR,GAAaM,EAAIG,SACjBH,EAAIG,QAAQC,UAEjB,CAACV,EAAWM,IAETK,MAAAA,EAAsDC,IAClD,MAAEC,MAAAA,GAAUD,EAAME,OAClBC,EAAiB,MAAAjB,OAAAA,EAAAA,EAASkB,MAAMC,GAAWA,EAAOJ,MAAMK,aAAeL,IAC7E,GAAKE,EAED,CAAA,GAAC,MAAAV,IAAAA,EAASc,aAEV,YADS,MAAAd,GAAAA,EAAAe,gBAAgB,CAACL,KAI9B,GAAIM,MAAMC,QAAQ,MAAAjB,OAAAA,EAAAA,EAASc,cAAe,CACtC,MAAMI,EAAQlB,EAAQc,aAAaH,MAAMC,GAAWA,IAAWF,IAC3DQ,EACQlB,EAAAe,iBAAiBI,GACpBA,EAA+BC,QAAQR,GAAWA,IAAWM,MAGlElB,EAAQe,iBAAiBI,GAAc,IAAKA,EAAgCT,IAEpF,CAAA,GAGCV,OAAAA,EAMAqB,EAAAC,EAAA,CAAWC,WAAY,CAAEC,QAAS,SAAWC,OAAQlC,EAAOG,UAAAA,EACxDgC,SAAA,MAAAjC,OAAA,EAAAA,EAASkC,KAAI,CAACf,EAAQgB,IACnBP,EAACQ,EAAA,CAEGrC,KAAMA,GAAQD,EACdiB,MAAOI,EAAOJ,MAAMK,WACpBiB,SAAUxB,EACVL,IAAW,IAAN2B,EAAU3B,OAAM,EAEpByB,SAAOd,EAAArB,OANH,GAAGA,KAASqB,EAAOJ,cARpCuB,QAAQC,MAAM,yEACP,KAAA"}
@@ -0,0 +1,2 @@
1
+ import{jsx as e,jsxs as t}from"react/jsx-runtime";import{useState as o,useRef as r,useEffect as a}from"react";import"../../../utilities/polymorphism/SlotComponent.js";import{isValidEpost as n}from"../../../utilities/validators/isValidEpost/isValidEpost.js";import{isValidTelefonnummer as i}from"../../../utilities/validators/isValidTelefonnummer/isValidTelefonnummer.js";import{PrimaryButton as s,TertiaryButton as l}from"../../button/Button.js";import"../../text-input/BaseTextArea.js";import"../../text-input/BaseTextInput.js";import"../../text-input/TextArea.js";import{TextInput as m}from"../../text-input/TextInput.js";import{useFeedbackContext as p}from"../feedbackContext.js";import{FeedbackSuccess as u}from"../FeedbackSuccess.js";const d={title:"Takk for tiden din!",children:"Neste gang vi gjennomfører intervjuer og tester kan det hende vi tar kontakt med deg. Dine innspill hjelper oss med å gjøre nettsidene bedre for deg og alle andre som bruker dem."},c=({label:c="Kan vi kontakte deg for flere innspill?",sendButtonLabel:f="Sett meg på lista!",withPhone:g=!1,onSubmit:k,successMessage:j=d,children:v})=>{const[h,b]=o(""),[x,E]=o(""),[S,T]=o({}),C=r(null),N=r(null),[y,B]=o(!1),[V,D]=o(!1),{contactSubmitted:P,setContactSubmitted:F}=p(),I="string"==typeof v?"p":"div",L=(e,t)=>{const o=(e=>e&&""!==e?n(e)?void 0:"Skriv inn en gyldig e-postadresse":"Du må oppgi e-postadresse for at vi kan kontakte deg")(e),r=(e=>e&&""!==e?i(e)?void 0:"Skriv inn et gyldig telefonnummer":"Du må oppgi telefonnummer for at vi kan kontakte deg")(t);return T({email:o,phone:r}),{emailError:o,phoneError:r}};a((()=>{if(y){const{emailError:e,phoneError:t}=L(h,x);!e&&(!g||!t)&&B(!1)}}),[h,x,y,g]);const A=e=>t=>e(t.target.value);return V?null:P?e(u,{...j}):t("form",{className:"jkl-spacing-xl--top",onSubmit:e=>{var t,o;e.preventDefault();const{emailError:r,phoneError:a}=L(h,x);return r?(B(!0),void(null==(t=C.current)||t.focus())):g&&a?(B(!0),void(null==(o=N.current)||o.focus())):(k({email:h,phone:g?x:void 0}),void F(!0))},children:[e("p",{className:"jkl-heading-4 jkl-spacing-xs--bottom",children:c}),v&&e(I,{className:"jkl-body",children:v}),e(m,{ref:C,className:"jkl-spacing-l--top",label:"E-post",labelProps:{variant:"small"},autoComplete:"email",name:"email",value:h,onChange:A(b),errorLabel:S.email}),g&&e(m,{ref:N,className:"jkl-spacing-l--top",label:"Telefonnummer",labelProps:{variant:"small"},autoComplete:"tel",name:"phone",value:x,onChange:A(E),errorLabel:S.phone}),t("div",{className:"jkl-spacing-xl--top",children:[e(s,{type:"submit",className:"jkl-spacing-xl--right",children:f}),e(l,{onClick:()=>D(!0),children:"Nei takk"})]})]})};export{c as ContactQuestion};
2
+ //# sourceMappingURL=ContactQuestion.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ContactQuestion.js","sources":["../../../../../src/components/feedback/questions/ContactQuestion.tsx"],"sourcesContent":["import React, { ChangeEvent, FC, ReactNode, useEffect, useRef, useState } from \"react\";\nimport { isValidEpost, isValidTelefonnummer } from \"../../../utilities\";\nimport { PrimaryButton, TertiaryButton } from \"../../button\";\nimport { TextInput } from \"../../text-input\";\nimport { useFeedbackContext } from \"../feedbackContext\";\nimport { FeedbackSuccess } from \"../FeedbackSuccess\";\n\nconst validateEmail = (email?: string) => {\n if (!email || email === \"\") {\n return \"Du må oppgi e-postadresse for at vi kan kontakte deg\";\n }\n if (!isValidEpost(email)) {\n return \"Skriv inn en gyldig e-postadresse\";\n }\n return;\n};\n\nconst validatePhone = (phone?: string) => {\n if (!phone || phone === \"\") {\n return \"Du må oppgi telefonnummer for at vi kan kontakte deg\";\n }\n if (!isValidTelefonnummer(phone)) {\n return \"Skriv inn et gyldig telefonnummer\";\n }\n return;\n};\n\nconst defaultSuccessMessage = {\n title: \"Takk for tiden din!\",\n children:\n \"Neste gang vi gjennomfører intervjuer og tester kan det hende vi tar kontakt med deg. Dine innspill hjelper oss med å gjøre nettsidene bedre for deg og alle andre som bruker dem.\",\n};\n\ninterface Props {\n /**\n * Lar deg tilpasse spørsmålsteksten.\n * @default \"Kan vi kontakte deg for flere innspill?\"\n * */\n label?: string;\n /**\n * Lar deg tilpasse teksten på knappen for innsending.\n * @default \"Sett meg på lista!\"\n * */\n sendButtonLabel?: string;\n /** Sett til true om du også vil spørre om brukjerens telefonnummer i tillegg til epost */\n withPhone?: boolean;\n /** Her kan du legge inn eventuelt annet innhold du vil ha med. Kommer mellom overskriften og feltene for utfylling */\n children?: ReactNode;\n onSubmit: (values: { email: string; phone?: string }) => void;\n /** Lar deg tilpasse meldingen som kommer når brukeren sender inn skjemaet. */\n successMessage?: {\n title: string;\n children: ReactNode;\n };\n}\n\nexport const ContactQuestion: FC<Props> = ({\n label = \"Kan vi kontakte deg for flere innspill?\",\n sendButtonLabel = \"Sett meg på lista!\",\n withPhone = false,\n onSubmit,\n successMessage = defaultSuccessMessage,\n children,\n}) => {\n const [email, setEmail] = useState(\"\");\n const [phone, setPhone] = useState(\"\");\n const [errors, setErrors] = useState<{ email?: string; phone?: string }>({});\n const emailRef = useRef<HTMLInputElement>(null);\n const phoneRef = useRef<HTMLInputElement>(null);\n const [shouldValidate, setShouldValidate] = useState(false);\n\n const [noThanks, setNoThanks] = useState(false);\n const { contactSubmitted, setContactSubmitted } = useFeedbackContext();\n\n const ChildrenWrapper = typeof children === \"string\" ? \"p\" : \"div\";\n\n const validate = (email: string, phone: string) => {\n const emailError = validateEmail(email);\n const phoneError = validatePhone(phone);\n setErrors({ email: emailError, phone: phoneError });\n return { emailError, phoneError };\n };\n\n useEffect(() => {\n if (shouldValidate) {\n const { emailError, phoneError } = validate(email, phone);\n\n if (!emailError && (!withPhone || !phoneError)) {\n setShouldValidate(false);\n }\n }\n }, [email, phone, shouldValidate, withPhone]);\n\n const handleChange = (consumer: (value: string) => void) => (e: ChangeEvent<HTMLInputElement>) =>\n consumer(e.target.value);\n\n const handleSubmit: React.FormEventHandler = (e) => {\n e.preventDefault();\n\n const { emailError, phoneError } = validate(email, phone);\n if (emailError) {\n setShouldValidate(true);\n emailRef.current?.focus();\n return;\n }\n if (withPhone && phoneError) {\n setShouldValidate(true);\n phoneRef.current?.focus();\n return;\n }\n\n onSubmit({ email, phone: withPhone ? phone : undefined });\n setContactSubmitted(true);\n };\n\n if (noThanks) {\n return null;\n }\n\n if (contactSubmitted) {\n return <FeedbackSuccess {...successMessage} />;\n }\n\n return (\n <form className=\"jkl-spacing-xl--top\" onSubmit={handleSubmit}>\n <p className=\"jkl-heading-4 jkl-spacing-xs--bottom\">{label}</p>\n {children && <ChildrenWrapper className=\"jkl-body\">{children}</ChildrenWrapper>}\n\n <TextInput\n ref={emailRef}\n className=\"jkl-spacing-l--top\"\n label=\"E-post\"\n labelProps={{ variant: \"small\" }}\n autoComplete=\"email\"\n name=\"email\"\n value={email}\n onChange={handleChange(setEmail)}\n errorLabel={errors.email}\n />\n {withPhone && (\n <TextInput\n ref={phoneRef}\n className=\"jkl-spacing-l--top\"\n label=\"Telefonnummer\"\n labelProps={{ variant: \"small\" }}\n autoComplete=\"tel\"\n name=\"phone\"\n value={phone}\n onChange={handleChange(setPhone)}\n errorLabel={errors.phone}\n />\n )}\n\n <div className=\"jkl-spacing-xl--top\">\n <PrimaryButton type=\"submit\" className=\"jkl-spacing-xl--right\">\n {sendButtonLabel}\n </PrimaryButton>\n <TertiaryButton onClick={() => setNoThanks(true)}>Nei takk</TertiaryButton>\n </div>\n </form>\n );\n};\n"],"names":["defaultSuccessMessage","title","children","ContactQuestion","label","sendButtonLabel","withPhone","onSubmit","successMessage","email","setEmail","useState","phone","setPhone","errors","setErrors","emailRef","useRef","phoneRef","shouldValidate","setShouldValidate","noThanks","setNoThanks","contactSubmitted","setContactSubmitted","useFeedbackContext","ChildrenWrapper","validate","emailError","isValidEpost","validateEmail","phoneError","isValidTelefonnummer","validatePhone","useEffect","handleChange","consumer","e","target","value","jsx","FeedbackSuccess","jsxs","className","preventDefault","_a","current","focus","_b","TextInput","ref","labelProps","variant","autoComplete","name","onChange","errorLabel","PrimaryButton","type","TertiaryButton","onClick"],"mappings":"muBAOA,MAoBMA,EAAwB,CAC1BC,MAAO,sBACPC,SACI,sLA0BKC,EAA6B,EACtCC,MAAAA,EAAQ,0CACRC,gBAAAA,EAAkB,qBAClBC,UAAAA,GAAY,EACZC,SAAAA,EACAC,eAAAA,EAAiBR,EACjBE,SAAAA,MAEA,MAAOO,EAAOC,GAAYC,EAAS,KAC5BC,EAAOC,GAAYF,EAAS,KAC5BG,EAAQC,GAAaJ,EAA6C,CAAE,GACrEK,EAAWC,EAAyB,MACpCC,EAAWD,EAAyB,OACnCE,EAAgBC,GAAqBT,GAAS,IAE9CU,EAAUC,GAAeX,GAAS,IACjCY,iBAAAA,EAAkBC,oBAAAA,GAAwBC,IAE5CC,EAAsC,iBAAbxB,EAAwB,IAAM,MAEvDyB,EAAW,CAAClB,EAAeG,KACvB,MAAAgB,EAtEQ,CAACnB,GACdA,GAAmB,KAAVA,EAGToB,EAAapB,QAAd,EACO,oCAHA,uDAoEYqB,CAAcrB,GAC3BsB,EA7DQ,CAACnB,GACdA,GAAmB,KAAVA,EAGToB,EAAqBpB,QAAtB,EACO,oCAHA,uDA2DYqB,CAAcrB,GACjC,OAAAG,EAAU,CAAEN,MAAOmB,EAAYhB,MAAOmB,IAC/B,CAAEH,WAAAA,EAAYG,WAAAA,IAGzBG,GAAU,KACN,GAAIf,EAAgB,CACV,MAAES,WAAAA,EAAYG,WAAAA,GAAeJ,EAASlB,EAAOG,IAE9CgB,KAAgBtB,IAAcyB,IAC/BX,GAAkB,EAE1B,IACD,CAACX,EAAOG,EAAOO,EAAgBb,IAE5B,MAAA6B,EAAgBC,GAAuCC,GACzDD,EAASC,EAAEC,OAAOC,OAqBtB,OAAIlB,EACO,KAGPE,EACOiB,EAACC,EAAiB,IAAGjC,IAI3BkC,EAAA,OAAA,CAAKC,UAAU,sBAAsBpC,SA5BI8B,YAC1CA,EAAEO,iBAEI,MAAEhB,WAAAA,EAAYG,WAAAA,GAAeJ,EAASlB,EAAOG,GACnD,OAAIgB,GACAR,GAAkB,QAClB,OAAAyB,EAAA7B,EAAS8B,UAATD,EAAkBE,UAGlBzC,GAAayB,GACbX,GAAkB,QAClB,OAAA4B,EAAA9B,EAAS4B,UAATE,EAAkBD,WAItBxC,EAAS,CAAEE,MAAAA,EAAOG,MAAON,EAAYM,OAAQ,SAC7CY,GAAoB,GAAI,EAapBtB,SAAA,CAACsC,EAAA,IAAA,CAAEG,UAAU,uCAAwCzC,SAAME,IAC1DF,GAAYsC,EAACd,EAAgB,CAAAiB,UAAU,WAAYzC,SAAAA,IAEpDsC,EAACS,EAAA,CACGC,IAAKlC,EACL2B,UAAU,qBACVvC,MAAM,SACN+C,WAAY,CAAEC,QAAS,SACvBC,aAAa,QACbC,KAAK,QACLf,MAAO9B,EACP8C,SAAUpB,EAAazB,GACvB8C,WAAY1C,EAAOL,QAEtBH,GACGkC,EAACS,EAAA,CACGC,IAAKhC,EACLyB,UAAU,qBACVvC,MAAM,gBACN+C,WAAY,CAAEC,QAAS,SACvBC,aAAa,MACbC,KAAK,QACLf,MAAO3B,EACP2C,SAAUpB,EAAatB,GACvB2C,WAAY1C,EAAOF,QAI3B8B,EAAC,MAAI,CAAAC,UAAU,sBACXzC,SAAA,CAAAsC,EAACiB,EAAc,CAAAC,KAAK,SAASf,UAAU,wBAClCzC,SACLG,MACCsD,EAAe,CAAAC,QAAS,IAAMtC,GAAY,GAAOpB,SAAQ,kBAElE"}
@@ -0,0 +1,2 @@
1
+ import{jsx as o}from"react/jsx-runtime";import{useId as e,useRef as t,useEffect as n,useMemo as u}from"react";import{RadioButton as l}from"../../radio-button/RadioButton.js";import{RadioButtonGroup as r}from"../../radio-button/RadioButtonGroup.js";import"../../radio-button/BaseRadioButton.js";import{useFollowUpContext as a}from"../followup/followupContext.js";import{useMainQuestionContext as i}from"../main-question/mainQuestionContext.js";const s=({label:s,name:d,options:m,helpLabel:p,autoFocus:v=!1})=>{const c=a(),f=i(),b=c||f,g=e(),x=(null==m?void 0:m.length)||0,j=t(null);n((()=>{v&&j.current&&j.current.focus()}),[v,j]);const R=u((()=>{var o;return Array.isArray(null==b?void 0:b.currentValue)?null==b?void 0:b.currentValue[0].value.toString():null==(o=null==b?void 0:b.currentValue)?void 0:o.value.toString()}),[null==b?void 0:b.currentValue]);return b?o(r,{legend:s,labelProps:{variant:"large"},name:`${g}-${d||s}`,inline:x<3,value:R||"",onChange:o=>{const e=null==m?void 0:m.find((e=>e.value.toString()===o.target.value));null==b||b.setCurrentValue(e)},helpLabel:p,children:null==m?void 0:m.map(((e,t)=>o(l,{ref:0===t?j:void 0,label:e.label,value:String(e.value)},`${g}-${d||s}-${e.value}`)))}):(console.error("Questions must be used inside a Followup or Feedback context provider"),null)};export{s as RadioQuestion};
2
+ //# sourceMappingURL=RadioQuestion.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RadioQuestion.js","sources":["../../../../../src/components/feedback/questions/RadioQuestion.tsx"],"sourcesContent":["import React, { ChangeEventHandler, useEffect, useId, useMemo, useRef } from \"react\";\nimport { RadioButton, RadioButtonGroup } from \"../../radio-button\";\nimport { useFollowUpContext } from \"../followup/followupContext\";\nimport { useMainQuestionContext } from \"../main-question/mainQuestionContext\";\nimport { QuestionProps } from \"../types\";\n\nexport const RadioQuestion: React.FC<QuestionProps> = ({ label, name, options, helpLabel, autoFocus = false }) => {\n const followupContext = useFollowUpContext();\n const feedbackContext = useMainQuestionContext();\n const context = followupContext || feedbackContext;\n const id = useId();\n\n const numOptions = options?.length || 0;\n\n const ref = useRef<HTMLInputElement>(null);\n useEffect(() => {\n if (autoFocus && ref.current) {\n ref.current.focus();\n }\n }, [autoFocus, ref]);\n\n const handleChange: ChangeEventHandler<HTMLInputElement> = (e) => {\n const option = options?.find((option) => option.value.toString() === e.target.value);\n context?.setCurrentValue(option);\n };\n\n const selectedValue = useMemo(\n () =>\n Array.isArray(context?.currentValue)\n ? context?.currentValue[0].value.toString()\n : context?.currentValue?.value.toString(),\n [context?.currentValue],\n );\n\n if (!context) {\n console.error(\"Questions must be used inside a Followup or Feedback context provider\");\n return null;\n }\n\n return (\n <RadioButtonGroup\n legend={label}\n labelProps={{ variant: \"large\" }}\n name={`${id}-${name || label}`}\n inline={numOptions < 3}\n value={selectedValue || \"\"}\n onChange={handleChange}\n helpLabel={helpLabel}\n >\n {options?.map((option, i) => (\n <RadioButton\n ref={i === 0 ? ref : undefined}\n key={`${id}-${name || label}-${option.value}`}\n label={option.label}\n value={String(option.value)}\n />\n ))}\n </RadioButtonGroup>\n );\n};\n"],"names":["RadioQuestion","label","name","options","helpLabel","autoFocus","followupContext","useFollowUpContext","feedbackContext","useMainQuestionContext","context","id","useId","numOptions","length","ref","useRef","useEffect","current","focus","handleChange","selectedValue","useMemo","Array","isArray","currentValue","value","toString","_a","jsx","RadioButtonGroup","legend","labelProps","variant","inline","onChange","e","option","find","target","setCurrentValue","children","map","i","RadioButton","String","console","error"],"mappings":"2bAMa,MAAAA,EAAyC,EAAGC,MAAAA,EAAOC,KAAAA,EAAMC,QAAAA,EAASC,UAAAA,EAAWC,UAAAA,GAAY,MAC5FC,MAAAA,EAAkBC,IAClBC,EAAkBC,IAClBC,EAAUJ,GAAmBE,EAC7BG,EAAKC,IAELC,GAAa,MAAAV,OAAAA,EAAAA,EAASW,SAAU,EAEhCC,EAAMC,EAAyB,MACrCC,GAAU,KACFZ,GAAaU,EAAIG,SACjBH,EAAIG,QAAQC,UAEjB,CAACd,EAAWU,IAETK,MAKAC,EAAgBC,GAClB,WACU,OAAAC,MAAAC,QAAQ,MAAAd,OAAAA,EAAAA,EAASe,cACjB,MAAAf,SAAAA,EAASe,aAAa,GAAGC,MAAMC,WAC/B,OAAAC,EAAA,MAAAlB,OAAA,EAAAA,EAASe,mBAAT,EAAAG,EAAuBF,MAAMC,UAAA,GACvC,CAAC,MAAAjB,OAAAA,EAAAA,EAASe,eAGd,OAAKf,EAMDmB,EAACC,EAAA,CACGC,OAAQ9B,EACR+B,WAAY,CAAEC,QAAS,SACvB/B,KAAM,GAAGS,KAAMT,GAAQD,IACvBiC,OAAQrB,EAAa,EACrBa,MAAOL,GAAiB,GACxBc,SAzBoDC,IAClD,MAAAC,EAAS,MAAAlC,OAAAA,EAAAA,EAASmC,MAAMD,GAAWA,EAAOX,MAAMC,aAAeS,EAAEG,OAAOb,QAC9E,MAAAhB,GAAAA,EAAS8B,gBAAgBH,EAAAA,EAwBrBjC,UAAAA,EAECqC,SAAS,MAAAtC,OAAAA,EAAAA,EAAAuC,KAAI,CAACL,EAAQM,IACnBd,EAACe,EAAA,CACG7B,IAAW,IAAN4B,EAAU5B,OAAM,EAErBd,MAAOoC,EAAOpC,MACdyB,MAAOmB,OAAOR,EAAOX,QAFhB,GAAGf,KAAMT,GAAQD,KAASoC,EAAOX,cAjBlDoB,QAAQC,MAAM,yEACP,KAAA"}
@@ -0,0 +1,2 @@
1
+ import{jsx as o,jsxs as n}from"react/jsx-runtime";import{useId as i,useMemo as s,Fragment as e}from"react";import{FieldGroup as r}from"../../input-group/FieldGroup.js";import"../../input-group/InputGroup.js";import"../../icon/Icon.js";import"../../icon/icons/animated/ArrowVerticalAnimated.js";import"../../icon/icons/animated/ArrowHorizontalAnimated.js";import"../../icon/icons/animated/PlusRemoveAnimated.js";import"../../icon/icons/ArrowDownIcon.js";import"../../icon/icons/ArrowLeftIcon.js";import"../../icon/icons/ArrowNorthEastIcon.js";import"../../icon/icons/ArrowRightIcon.js";import"../../icon/icons/ArrowUpIcon.js";import"../../icon/icons/CalendarIcon.js";import"../../icon/icons/CheckIcon.js";import"../../icon/icons/ChevronDownIcon.js";import"../../icon/icons/ChevronLeftIcon.js";import"../../icon/icons/ChevronRightIcon.js";import"../../icon/icons/ChevronUpIcon.js";import"../../icon/icons/CloseIcon.js";import"../../icon/icons/CopyIcon.js";import"../../icon/icons/DotsIcon.js";import"../../icon/icons/DragIcon.js";import"../../icon/icons/ErrorIcon.js";import"../../icon/icons/GreenCheckIcon.js";import"../../icon/icons/HamburgerIcon.js";import"../../icon/icons/InfoIcon.js";import"../../icon/icons/LinkIcon.js";import"../../icon/icons/PlusIcon.js";import"../../icon/icons/QuestionIcon.js";import"../../icon/icons/RedCrossIcon.js";import"../../icon/icons/SearchIcon.js";import"../../icon/icons/SuccessIcon.js";import"../../icon/icons/WarningIcon.js";import"../../icon/icons/MinusIcon.js";import"../../icon/icons/ThumbDownIcon.js";import"../../icon/icons/ThumbUpIcon.js";import"../../icon/icons/TrashCanIcon.js";import"../../icon/icons/PenIcon.js";import{useFollowUpContext as c}from"../followup/followupContext.js";import{useMainQuestionContext as t}from"../main-question/mainQuestionContext.js";import{getSmiley as l,defaultOptions as a}from"./smileyUtils.js";const m=o=>"number"!=typeof o.value||![1,2,3,4,5].includes(o.value),u=({label:u,name:p="smiley",helpLabel:j,options:d=a})=>{const I=c(),v=t(),h=I||v,f=i(),C=o=>{console.log(o.target.value);const n=null==d?void 0:d.find((n=>n.value.toString()===o.target.value));null==h||h.setCurrentValue(n)},g=s((()=>{var o;return Array.isArray(null==h?void 0:h.currentValue)?null==h?void 0:h.currentValue[0].value:null==(o=null==h?void 0:h.currentValue)?void 0:o.value}),[null==h?void 0:h.currentValue]);return d.some(m)?(console.error("SmileyQuestion må ha tallene 1 til 5 som verdier for alternativene sine"),null):h&&d?o(r,{labelProps:{variant:"large"},legend:u,helpLabel:j,children:o("div",{className:"jkl-feedback-smileys",children:d.map((i=>n(e,{children:[o("input",{className:"jkl-sr-only",id:`${f}-${p}-${i.value}`,name:`${f}-${p}`,type:"radio",value:i.value,onChange:C,checked:g===i.value}),n("label",{className:"jkl-feedback-smiley-option",htmlFor:`${f}-${p}-${i.value}`,children:[o("span",{className:"jkl-sr-only",children:i.label}),l(Number(i.value))]})]},i.value)))})}):(console.error("Questions must be used inside a Followup or Feedback context provider"),null)};export{u as SmileyQuestion};
2
+ //# sourceMappingURL=SmileyQuestion.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SmileyQuestion.js","sources":["../../../../../src/components/feedback/questions/SmileyQuestion.tsx"],"sourcesContent":["import React, { Fragment, ChangeEventHandler, useMemo, useId } from \"react\";\nimport { FieldGroup } from \"../../input-group\";\nimport { useFollowUpContext } from \"../followup/followupContext\";\nimport { useMainQuestionContext } from \"../main-question/mainQuestionContext\";\nimport { FeedbackOption, QuestionProps } from \"../types\";\nimport { defaultOptions, getSmiley } from \"./smileyUtils\";\n\nconst isNotInScale = (option: FeedbackOption) =>\n typeof option.value !== \"number\" || ![1, 2, 3, 4, 5].includes(option.value);\n\nexport const SmileyQuestion: React.FC<QuestionProps> = ({\n label,\n name = \"smiley\",\n helpLabel,\n options = defaultOptions,\n}) => {\n const followupContext = useFollowUpContext();\n const feedbackContext = useMainQuestionContext();\n const context = followupContext || feedbackContext;\n const id = useId();\n\n const handleChange: ChangeEventHandler<HTMLInputElement> = (e) => {\n console.log(e.target.value);\n const option = options?.find((option) => option.value.toString() === e.target.value);\n context?.setCurrentValue(option);\n };\n\n const selectedValue = useMemo(\n () => (Array.isArray(context?.currentValue) ? context?.currentValue[0].value : context?.currentValue?.value),\n [context?.currentValue],\n );\n\n if (options.some(isNotInScale)) {\n console.error(\"SmileyQuestion må ha tallene 1 til 5 som verdier for alternativene sine\");\n return null;\n }\n\n if (!context || !options) {\n console.error(\"Questions must be used inside a Followup or Feedback context provider\");\n return null;\n }\n\n return (\n <FieldGroup labelProps={{ variant: \"large\" }} legend={label} helpLabel={helpLabel}>\n <div className=\"jkl-feedback-smileys\">\n {options.map((option) => (\n <Fragment key={option.value}>\n <input\n className=\"jkl-sr-only\"\n id={`${id}-${name}-${option.value}`}\n name={`${id}-${name}`}\n type=\"radio\"\n value={option.value}\n onChange={handleChange}\n checked={selectedValue === option.value}\n />\n <label className=\"jkl-feedback-smiley-option\" htmlFor={`${id}-${name}-${option.value}`}>\n <span className=\"jkl-sr-only\">{option.label}</span>\n {getSmiley(Number(option.value))}\n </label>\n </Fragment>\n ))}\n </div>\n </FieldGroup>\n );\n};\n"],"names":["isNotInScale","option","value","includes","SmileyQuestion","label","name","helpLabel","options","defaultOptions","followupContext","useFollowUpContext","feedbackContext","useMainQuestionContext","context","id","useId","handleChange","e","console","log","target","find","toString","setCurrentValue","selectedValue","useMemo","Array","isArray","currentValue","_a","some","error","FieldGroup","labelProps","variant","legend","children","jsx","className","map","Fragment","type","onChange","checked","jsxs","htmlFor","getSmiley","Number"],"mappings":"k1DAOA,MAAMA,EAAgBC,GACM,iBAAjBA,EAAOC,QAAuB,CAAC,EAAG,EAAG,EAAG,EAAG,GAAGC,SAASF,EAAOC,OAE5DE,EAA0C,EACnDC,MAAAA,EACAC,KAAAA,EAAO,SACPC,UAAAA,EACAC,QAAAA,EAAUC,MAEV,MAAMC,EAAkBC,IAClBC,EAAkBC,IAClBC,EAAUJ,GAAmBE,EAC7BG,EAAKC,IAELC,EAAsDC,IAChDC,QAAAC,IAAIF,EAAEG,OAAOnB,OACf,MAAAD,EAAS,MAAAO,OAAAA,EAAAA,EAASc,MAAMrB,GAAWA,EAAOC,MAAMqB,aAAeL,EAAEG,OAAOnB,QAC9E,MAAAY,GAAAA,EAASU,gBAAgBvB,EAAAA,EAGvBwB,EAAgBC,GAClB,WAAO,OAAAC,MAAMC,QAAQ,MAAAd,OAAA,EAAAA,EAASe,cAAgB,MAAAf,OAAAA,EAAAA,EAASe,aAAa,GAAG3B,MAAQ,OAAA4B,EAAA,MAAAhB,SAAAA,EAASe,qBAATC,EAAuB5B,KAAA,GACtG,CAAC,MAAAY,OAAAA,EAAAA,EAASe,eAGVrB,OAAAA,EAAQuB,KAAK/B,IACbmB,QAAQa,MAAM,2EACP,MAGNlB,GAAYN,IAMZyB,EAAW,CAAAC,WAAY,CAAEC,QAAS,SAAWC,OAAQ/B,EAAOE,UAAAA,EACzD8B,SAACC,EAAA,MAAA,CAAIC,UAAU,uBACVF,SAAA7B,EAAQgC,KAAKvC,KACTwC,EACG,CAAAJ,SAAA,CAAAC,EAAC,QAAA,CACGC,UAAU,cACVxB,GAAI,GAAGA,KAAMT,KAAQL,EAAOC,QAC5BI,KAAM,GAAGS,KAAMT,IACfoC,KAAK,QACLxC,MAAOD,EAAOC,MACdyC,SAAU1B,EACV2B,QAASnB,IAAkBxB,EAAOC,QAErC2C,EAAA,QAAA,CAAMN,UAAU,6BAA6BO,QAAS,GAAG/B,KAAMT,KAAQL,EAAOC,QAC3EmC,SAAA,CAAAC,EAAC,OAAK,CAAAC,UAAU,cAAeF,SAAApC,EAAOI,QACrC0C,EAAUC,OAAO/C,EAAOC,aAZlBD,EAAOC,cARlCiB,QAAQa,MAAM,yEACP,KAwBP"}
@@ -0,0 +1,2 @@
1
+ import{jsx as e}from"react/jsx-runtime";import{useRef as t,useEffect as r,useMemo as o}from"react";import"../../text-input/BaseTextArea.js";import"../../text-input/BaseTextInput.js";import{TextArea as n}from"../../text-input/TextArea.js";import"../../text-input/TextInput.js";import{useFeedbackContext as u}from"../feedbackContext.js";import{useFollowUpContext as a}from"../followup/followupContext.js";import{useMainQuestionContext as l}from"../main-question/mainQuestionContext.js";const s=({label:s,name:i,helpLabel:m="Ikke skriv personlige opplysninger. Tilbakemeldinger som kommer inn her blir ikke besvart, men brukt i videre arbeid med å forbedre tjenestene våre.",autoFocus:p=!1})=>{const{counter:c}=u(),x=a(),v=l(),b=x||v,d=t(null);r((()=>{p&&d.current&&d.current.focus()}),[p,d]);const f=o((()=>{var e;return Array.isArray(null==b?void 0:b.currentValue)?null==b?void 0:b.currentValue[0].value.toString():null==(e=null==b?void 0:b.currentValue)?void 0:e.value.toString()}),[null==b?void 0:b.currentValue]);return b?e(n,{ref:d,label:s,labelProps:{variant:"large"},name:i||s,startOpen:!0,rows:5,value:f,onChange:e=>{const t={label:s,name:i||s,type:"text",value:e.target.value};null==b||b.setCurrentValue(t)},helpLabel:m,counter:c}):(console.error("Questions must be used inside a Followup or Feedback context provider"),null)};export{s as TextQuestion};
2
+ //# sourceMappingURL=TextQuestion.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TextQuestion.js","sources":["../../../../../src/components/feedback/questions/TextQuestion.tsx"],"sourcesContent":["import React, { ChangeEventHandler, useEffect, useMemo, useRef } from \"react\";\nimport { TextArea } from \"../../text-input\";\nimport { useFeedbackContext } from \"../feedbackContext\";\nimport { useFollowUpContext } from \"../followup/followupContext\";\nimport { useMainQuestionContext } from \"../main-question/mainQuestionContext\";\nimport { QuestionProps, FeedbackAnswer } from \"../types\";\n\nexport const TextQuestion: React.FC<QuestionProps> = ({\n label,\n name,\n helpLabel = \"Ikke skriv personlige opplysninger. Tilbakemeldinger som kommer inn her blir ikke besvart, men brukt i videre arbeid med å forbedre tjenestene våre.\",\n autoFocus = false,\n}) => {\n const { counter } = useFeedbackContext();\n const followupContext = useFollowUpContext();\n const feedbackContext = useMainQuestionContext();\n const context = followupContext || feedbackContext;\n const ref = useRef<HTMLTextAreaElement>(null);\n\n useEffect(() => {\n if (autoFocus && ref.current) {\n ref.current.focus();\n }\n }, [autoFocus, ref]);\n\n const handleChange: ChangeEventHandler<HTMLTextAreaElement> = (e) => {\n const value: FeedbackAnswer = {\n label,\n name: name || label,\n type: \"text\",\n value: e.target.value,\n };\n context?.setCurrentValue(value);\n };\n\n const currentValue = useMemo(\n () =>\n Array.isArray(context?.currentValue)\n ? context?.currentValue[0].value.toString()\n : context?.currentValue?.value.toString(),\n [context?.currentValue],\n );\n\n if (!context) {\n console.error(\"Questions must be used inside a Followup or Feedback context provider\");\n return null;\n }\n\n return (\n <TextArea\n ref={ref}\n label={label}\n labelProps={{ variant: \"large\" }}\n name={name || label}\n startOpen\n rows={5}\n value={currentValue}\n onChange={handleChange}\n helpLabel={helpLabel}\n counter={counter}\n />\n );\n};\n"],"names":["TextQuestion","label","name","helpLabel","autoFocus","counter","useFeedbackContext","followupContext","useFollowUpContext","feedbackContext","useMainQuestionContext","context","ref","useRef","useEffect","current","focus","handleChange","currentValue","useMemo","Array","isArray","value","toString","_a","jsx","TextArea","labelProps","variant","startOpen","rows","onChange","e","type","target","setCurrentValue","console","error"],"mappings":"oeAOO,MAAMA,EAAwC,EACjDC,MAAAA,EACAC,KAAAA,EACAC,UAAAA,EAAY,uJACZC,UAAAA,GAAY,MAEN,MAAEC,QAAAA,GAAYC,IACdC,EAAkBC,IAClBC,EAAkBC,IAClBC,EAAUJ,GAAmBE,EAC7BG,EAAMC,EAA4B,MAExCC,GAAU,KACFV,GAAaQ,EAAIG,SACjBH,EAAIG,QAAQC,UAEjB,CAACZ,EAAWQ,IAETK,MAUAC,EAAeC,GACjB,WACU,OAAAC,MAAAC,QAAQ,MAAAV,OAAAA,EAAAA,EAASO,cACjB,MAAAP,SAAAA,EAASO,aAAa,GAAGI,MAAMC,WAC/B,OAAAC,EAAA,MAAAb,OAAA,EAAAA,EAASO,mBAAT,EAAAM,EAAuBF,MAAMC,UAAA,GACvC,CAAC,MAAAZ,OAAAA,EAAAA,EAASO,eAGd,OAAKP,EAMDc,EAACC,EAAA,CACGd,IAAAA,EACAX,MAAAA,EACA0B,WAAY,CAAEC,QAAS,SACvB1B,KAAMA,GAAQD,EACd4B,WAAS,EACTC,KAAM,EACNR,MAAOJ,EACPa,SAhCuDC,IAC3D,MAAMV,EAAwB,CAC1BrB,MAAAA,EACAC,KAAMA,GAAQD,EACdgC,KAAM,OACNX,MAAOU,EAAEE,OAAOZ,OAEpB,MAAAX,GAAAA,EAASwB,gBAAgBb,EAAAA,EA0BrBnB,UAAAA,EACAE,QAAAA,KAfJ+B,QAAQC,MAAM,yEACP,KAAA"}
@@ -0,0 +1,2 @@
1
+ import{CheckboxQuestion as o}from"./CheckboxQuestion.js";import{RadioQuestion as s}from"./RadioQuestion.js";import{TextQuestion as t}from"./TextQuestion.js";import{SmileyQuestion as i}from"./SmileyQuestion.js";import{AddonQuestion as e}from"./AddonQuestion.js";import{ContactQuestion as n}from"./ContactQuestion.js";export{e as AddonQuestion,o as CheckboxQuestion,n as ContactQuestion,s as RadioQuestion,i as SmileyQuestion,t as TextQuestion};
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ import{jsx as e,jsxs as r}from"react/jsx-runtime";const t=[{label:"Veldig misfornøyd",value:1,textAreaLabel:"Det var leit! Fortell oss gjerne hva du savner, så kan vi gjøre sidene våre bedre."},{label:"Litt misfornøyd",value:2,textAreaLabel:"Det var leit! Fortell oss gjerne hva du savner, så kan vi gjøre sidene våre bedre."},{label:"Midt på treet",value:3,textAreaLabel:"Fortell oss gjerne hva du savner, så kan vi gjøre sidene våre bedre."},{label:"Ganske fornøyd",value:4,textAreaLabel:"Så bra! Har du noen tilbakemeldinger kan du skrive dem her."},{label:"Veldig fornøyd",value:5,textAreaLabel:"Så bra! Har du noen tilbakemeldinger kan du skrive dem her."}],l=({children:t})=>r("svg",{className:"jkl-feedback-smiley-option__icon","aria-hidden":!0,viewBox:"0 0 40 40",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[e("circle",{cx:"20",cy:"20",r:"19",stroke:"currentColor",strokeWidth:"2"}),t]}),o=()=>r(l,{children:[e("path",{d:"M10 30C10 24.4772 14.4772 20 20 20C25.5228 20 30 24.4772 30 30",stroke:"currentColor",strokeWidth:"2"}),e("path",{d:"M10 13.9865H16.6667",stroke:"currentColor",strokeWidth:"2"}),e("path",{d:"M23.3333 13.9865H29.9999",stroke:"currentColor",strokeWidth:"2"})]}),c=()=>r(l,{children:[e("path",{d:"M10 28.75C10 28.75 13.75 23.3334 20 23.3334C26.25 23.3334 30 28.75 30 28.75",stroke:"currentColor",strokeWidth:"2"}),e("circle",{cx:"12.5",cy:"14.5",r:"1.5",fill:"currentColor"}),e("circle",{cx:"27.5",cy:"14.5",r:"1.5",fill:"currentColor"})]}),a=()=>r(l,{children:[e("path",{d:"M9.15283 25.6986H30.8477",stroke:"currentColor",strokeWidth:"2"}),e("circle",{cx:"12.5",cy:"14.5",r:"1.5",fill:"currentColor"}),e("circle",{cx:"27.5",cy:"14.5",r:"1.5",fill:"currentColor"})]}),i=()=>r(l,{children:[e("path",{d:"M10 23.3334C10 23.3334 12.9167 30 20 30C27.0833 30 30 23.3334 30 23.3334",stroke:"currentColor",strokeWidth:"2"}),e("circle",{cx:"12.5",cy:"14.5",r:"1.5",fill:"currentColor"}),e("circle",{cx:"27.5",cy:"14.5",r:"1.5",fill:"currentColor"})]}),n=()=>r(l,{children:[e("path",{d:"M30 21C30 26.5228 25.5228 31 20 31C14.4772 31 10 26.5228 10 21",stroke:"currentColor",strokeWidth:"2"}),e("path",{d:"M24 14.5H29",stroke:"currentColor",strokeWidth:"2"}),e("circle",{cx:"12.5",cy:"14.5",r:"1.5",fill:"currentColor"})]}),s=r=>{switch(r){case 1:return e(o,{});case 2:return e(c,{});case 3:default:return e(a,{});case 4:return e(i,{});case 5:return e(n,{})}};export{t as defaultOptions,s as getSmiley};
2
+ //# sourceMappingURL=smileyUtils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"smileyUtils.js","sources":["../../../../../src/components/feedback/questions/smileyUtils.tsx"],"sourcesContent":["import React, { FC } from \"react\";\nimport { WithChildren } from \"../../..\";\nimport { FeedbackOption } from \"../types\";\n\nexport const defaultOptions: FeedbackOption<number>[] = [\n {\n label: \"Veldig misfornøyd\",\n value: 1,\n textAreaLabel: \"Det var leit! Fortell oss gjerne hva du savner, så kan vi gjøre sidene våre bedre.\",\n },\n {\n label: \"Litt misfornøyd\",\n value: 2,\n textAreaLabel: \"Det var leit! Fortell oss gjerne hva du savner, så kan vi gjøre sidene våre bedre.\",\n },\n {\n label: \"Midt på treet\",\n value: 3,\n textAreaLabel: \"Fortell oss gjerne hva du savner, så kan vi gjøre sidene våre bedre.\",\n },\n {\n label: \"Ganske fornøyd\",\n value: 4,\n textAreaLabel: \"Så bra! Har du noen tilbakemeldinger kan du skrive dem her.\",\n },\n {\n label: \"Veldig fornøyd\",\n value: 5,\n textAreaLabel: \"Så bra! Har du noen tilbakemeldinger kan du skrive dem her.\",\n },\n];\n\nconst Smiley: FC<WithChildren> = ({ children }) => (\n <svg\n className=\"jkl-feedback-smiley-option__icon\"\n aria-hidden\n viewBox=\"0 0 40 40\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <circle cx=\"20\" cy=\"20\" r=\"19\" stroke=\"currentColor\" strokeWidth=\"2\" />\n {children}\n </svg>\n);\n\nconst VeldigSurSmiley = () => (\n <Smiley>\n <path\n d=\"M10 30C10 24.4772 14.4772 20 20 20C25.5228 20 30 24.4772 30 30\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n />\n <path d=\"M10 13.9865H16.6667\" stroke=\"currentColor\" strokeWidth=\"2\" />\n <path d=\"M23.3333 13.9865H29.9999\" stroke=\"currentColor\" strokeWidth=\"2\" />\n </Smiley>\n);\n\nconst LittSurSmiley = () => (\n <Smiley>\n <path\n d=\"M10 28.75C10 28.75 13.75 23.3334 20 23.3334C26.25 23.3334 30 28.75 30 28.75\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n />\n <circle cx=\"12.5\" cy=\"14.5\" r=\"1.5\" fill=\"currentColor\" />\n <circle cx=\"27.5\" cy=\"14.5\" r=\"1.5\" fill=\"currentColor\" />\n </Smiley>\n);\n\nconst NoytralSmiley = () => (\n <Smiley>\n <path d=\"M9.15283 25.6986H30.8477\" stroke=\"currentColor\" strokeWidth=\"2\" />\n <circle cx=\"12.5\" cy=\"14.5\" r=\"1.5\" fill=\"currentColor\" />\n <circle cx=\"27.5\" cy=\"14.5\" r=\"1.5\" fill=\"currentColor\" />\n </Smiley>\n);\n\nconst LittGladSmiley = () => (\n <Smiley>\n <path\n d=\"M10 23.3334C10 23.3334 12.9167 30 20 30C27.0833 30 30 23.3334 30 23.3334\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n />\n <circle cx=\"12.5\" cy=\"14.5\" r=\"1.5\" fill=\"currentColor\" />\n <circle cx=\"27.5\" cy=\"14.5\" r=\"1.5\" fill=\"currentColor\" />\n </Smiley>\n);\n\nconst VeldigGladSmiley = () => (\n <Smiley>\n <path\n d=\"M30 21C30 26.5228 25.5228 31 20 31C14.4772 31 10 26.5228 10 21\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n />\n <path d=\"M24 14.5H29\" stroke=\"currentColor\" strokeWidth=\"2\" />\n <circle cx=\"12.5\" cy=\"14.5\" r=\"1.5\" fill=\"currentColor\" />\n </Smiley>\n);\n\nexport const getSmiley = (value: number) => {\n switch (value) {\n case 1:\n return <VeldigSurSmiley />;\n case 2:\n return <LittSurSmiley />;\n case 3:\n return <NoytralSmiley />;\n case 4:\n return <LittGladSmiley />;\n case 5:\n return <VeldigGladSmiley />;\n\n default:\n return <NoytralSmiley />;\n }\n};\n"],"names":["defaultOptions","label","value","textAreaLabel","Smiley","children","jsxs","className","viewBox","fill","xmlns","jsx","cx","cy","r","stroke","strokeWidth","VeldigSurSmiley","d","LittSurSmiley","NoytralSmiley","LittGladSmiley","VeldigGladSmiley","getSmiley"],"mappings":"kDAIO,MAAMA,EAA2C,CACpD,CACIC,MAAO,oBACPC,MAAO,EACPC,cAAe,sFAEnB,CACIF,MAAO,kBACPC,MAAO,EACPC,cAAe,sFAEnB,CACIF,MAAO,gBACPC,MAAO,EACPC,cAAe,wEAEnB,CACIF,MAAO,iBACPC,MAAO,EACPC,cAAe,+DAEnB,CACIF,MAAO,iBACPC,MAAO,EACPC,cAAe,gEAIjBC,EAA2B,EAAGC,SAAAA,KAChCC,EAAC,MAAA,CACGC,UAAU,mCACV,eAAW,EACXC,QAAQ,YACRC,KAAK,OACLC,MAAM,6BAENL,SAAA,CAACM,EAAA,SAAA,CAAOC,GAAG,KAAKC,GAAG,KAAKC,EAAE,KAAKC,OAAO,eAAeC,YAAY,MAChEX,KAIHY,EAAkB,IACpBX,EAACF,EACG,CAAAC,SAAA,CAAAM,EAAC,OAAA,CACGO,EAAE,iEACFH,OAAO,eACPC,YAAY,QAEf,OAAK,CAAAE,EAAE,sBAAsBH,OAAO,eAAeC,YAAY,QAC/D,OAAK,CAAAE,EAAE,2BAA2BH,OAAO,eAAeC,YAAY,SAIvEG,EAAgB,IAClBb,EAACF,EACG,CAAAC,SAAA,CAAAM,EAAC,OAAA,CACGO,EAAE,8EACFH,OAAO,eACPC,YAAY,MAEhBL,EAAC,UAAOC,GAAG,OAAOC,GAAG,OAAOC,EAAE,MAAML,KAAK,iBACzCE,EAAC,UAAOC,GAAG,OAAOC,GAAG,OAAOC,EAAE,MAAML,KAAK,oBAI3CW,EAAgB,IAClBd,EAACF,EACG,CAAAC,SAAA,CAAAM,EAAC,QAAKO,EAAE,2BAA2BH,OAAO,eAAeC,YAAY,MACrEL,EAAC,UAAOC,GAAG,OAAOC,GAAG,OAAOC,EAAE,MAAML,KAAK,iBACzCE,EAAC,UAAOC,GAAG,OAAOC,GAAG,OAAOC,EAAE,MAAML,KAAK,oBAI3CY,EAAiB,IACnBf,EAACF,EACG,CAAAC,SAAA,CAAAM,EAAC,OAAA,CACGO,EAAE,2EACFH,OAAO,eACPC,YAAY,MAEhBL,EAAC,UAAOC,GAAG,OAAOC,GAAG,OAAOC,EAAE,MAAML,KAAK,iBACzCE,EAAC,UAAOC,GAAG,OAAOC,GAAG,OAAOC,EAAE,MAAML,KAAK,oBAI3Ca,EAAmB,IACrBhB,EAACF,EACG,CAAAC,SAAA,CAAAM,EAAC,OAAA,CACGO,EAAE,iEACFH,OAAO,eACPC,YAAY,QAEf,OAAK,CAAAE,EAAE,cAAcH,OAAO,eAAeC,YAAY,MACxDL,EAAC,UAAOC,GAAG,OAAOC,GAAG,OAAOC,EAAE,MAAML,KAAK,oBAIpCc,EAAarB,IACtB,OAAQA,GACJ,KAAK,EACD,SAAQe,EAAgB,CAAA,GAC5B,KAAK,EACD,SAAQE,EAAc,CAAA,GAC1B,KAAK,EAOL,QACI,SAAQC,EAAc,CAAA,GAN1B,KAAK,EACD,SAAQC,EAAe,CAAA,GAC3B,KAAK,EACD,SAAQC,EAAiB,CAAA,GAIjC"}
@@ -0,0 +1,2 @@
1
+
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ import t from"react";import{CheckboxQuestion as e}from"./questions/CheckboxQuestion.js";import{RadioQuestion as s}from"./questions/RadioQuestion.js";import{TextQuestion as o}from"./questions/TextQuestion.js";import{SmileyQuestion as i}from"./questions/SmileyQuestion.js";import"react/jsx-runtime";import"../text-input/BaseTextArea.js";import"../text-input/BaseTextInput.js";import"../text-input/TextArea.js";import"../text-input/TextInput.js";import"./feedbackContext.js";import"./main-question/mainQuestionContext.js";import"../../utilities/polymorphism/SlotComponent.js";import"../button/Button.js";import"../message/Message.js";import"../message/FormErrorMessage.js";function r(...e){return s=>t.Children.map(s,(s=>{if(t.isValidElement(s)&&e.includes(s.type))return s}))}const n=t=>{switch(t){case"radio":default:return s;case"checkbox":return e;case"text":return o;case"smiley":return i}};export{r as getChildrenOfType,n as getQuestionFromType};
2
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","sources":["../../../../src/components/feedback/utils.ts"],"sourcesContent":["import React, { JSXElementConstructor, FC } from \"react\";\nimport { CheckboxQuestion, RadioQuestion, TextQuestion, SmileyQuestion } from \"./questions\";\nimport { QuestionProps, QuestionType } from \"./types\";\n\nexport function getChildrenOfType<P>(...allowedTypes: Array<string | JSXElementConstructor<P>>) {\n return (\n children: React.ReactNode,\n ): React.ReactElement<P, string | React.JSXElementConstructor<unknown>>[] | null | undefined =>\n React.Children.map(children, (child) => {\n if (React.isValidElement<P>(child) && allowedTypes.includes(child.type)) {\n return child;\n }\n return undefined;\n });\n}\n\nexport const getQuestionFromType = (type: QuestionType): FC<QuestionProps> => {\n switch (type) {\n case \"radio\":\n return RadioQuestion;\n case \"checkbox\":\n return CheckboxQuestion;\n case \"text\":\n return TextQuestion;\n case \"smiley\":\n return SmileyQuestion;\n\n default:\n return RadioQuestion;\n }\n};\n"],"names":["getChildrenOfType","allowedTypes","children","React","Children","map","child","isValidElement","includes","type","getQuestionFromType","RadioQuestion","CheckboxQuestion","TextQuestion","SmileyQuestion"],"mappings":"8pBAIO,SAASA,KAAwBC,GACpC,OACIC,GAEAC,EAAMC,SAASC,IAAIH,GAAWI,IACtB,GAAAH,EAAMI,eAAkBD,IAAUL,EAAaO,SAASF,EAAMG,MACvDH,OAAAA,CAAAA,GAIvB,CAEa,MAAAI,EAAuBD,IAChC,OAAQA,GACJ,IAAK,QASL,QACWE,OAAAA,EARX,IAAK,WACMC,OAAAA,EACX,IAAK,OACMC,OAAAA,EACX,IAAK,SACMC,OAAAA,EAIf"}
@@ -1,2 +1,2 @@
1
- import{AccordionItem as o}from"./accordion/AccordionItem.js";import{Accordion as s}from"./accordion/Accordion.js";import{Breadcrumb as a}from"./breadcrumb/Breadcrumb.js";import{BreadcrumbItem as r}from"./breadcrumb/BreadcrumbItem.js";import{Button as n,PrimaryButton as t,SecondaryButton as e,TertiaryButton as i}from"./button/Button.js";import{Card as c}from"./card/Card.js";import{CardImage as m}from"./card/CardImage.js";import{InfoBlock as p,NavCard as l}from"./card/NavCard.js";import{TaskCard as I}from"./card/TaskCard.js";import{InfoCard as d}from"./card/InfoCard.js";import{Checkbox as u}from"./checkbox/Checkbox.js";import{Combobox as f,getComboboxValuePair as j}from"./combobox/Combobox.js";import{CookieConsent as C}from"./cookie-consent/CookieConsent.js";import{CookieConsentProvider as k,useCookieConsent as T}from"./cookie-consent/CookieConsentContext.js";import{isCorrectFormat as b,isWithinLowerBound as g,isWithinUpperBound as h}from"./datepicker/validation.js";import{dayMonthYearRegex as B,formatInput as A,isBlurTargetOutside as S,parseDateString as L}from"./datepicker/utils.js";import{DatePicker as x}from"./datepicker/DatePicker.js";import{Icon as w}from"./icon/Icon.js";import{ArrowVerticalAnimated as v}from"./icon/icons/animated/ArrowVerticalAnimated.js";import{ArrowHorizontalAnimated as R}from"./icon/icons/animated/ArrowHorizontalAnimated.js";import{PlusRemoveAnimated as M}from"./icon/icons/animated/PlusRemoveAnimated.js";import{ArrowDownIcon as P}from"./icon/icons/ArrowDownIcon.js";import{ArrowLeftIcon as D}from"./icon/icons/ArrowLeftIcon.js";import{ArrowNorthEastIcon as y}from"./icon/icons/ArrowNorthEastIcon.js";import{ArrowRightIcon as G}from"./icon/icons/ArrowRightIcon.js";import{ArrowUpIcon as U}from"./icon/icons/ArrowUpIcon.js";import{CalendarIcon as N}from"./icon/icons/CalendarIcon.js";import{CheckIcon as E}from"./icon/icons/CheckIcon.js";import{ChevronDownIcon as H}from"./icon/icons/ChevronDownIcon.js";import{ChevronLeftIcon as O}from"./icon/icons/ChevronLeftIcon.js";import{ChevronRightIcon as W}from"./icon/icons/ChevronRightIcon.js";import{ChevronUpIcon as F}from"./icon/icons/ChevronUpIcon.js";import{CloseIcon as V}from"./icon/icons/CloseIcon.js";import{CopyIcon as z}from"./icon/icons/CopyIcon.js";import{DotsIcon as Q}from"./icon/icons/DotsIcon.js";import{DragIcon as Y}from"./icon/icons/DragIcon.js";import{ErrorIcon as q}from"./icon/icons/ErrorIcon.js";import{GreenCheckIcon as J}from"./icon/icons/GreenCheckIcon.js";import{HamburgerIcon as K}from"./icon/icons/HamburgerIcon.js";import{InfoIcon as X}from"./icon/icons/InfoIcon.js";import{LinkIcon as Z}from"./icon/icons/LinkIcon.js";import{PlusIcon as $}from"./icon/icons/PlusIcon.js";import{QuestionIcon as _}from"./icon/icons/QuestionIcon.js";import{RedCrossIcon as oo}from"./icon/icons/RedCrossIcon.js";import{SearchIcon as so}from"./icon/icons/SearchIcon.js";import{SuccessIcon as ao}from"./icon/icons/SuccessIcon.js";import{WarningIcon as ro}from"./icon/icons/WarningIcon.js";import{MinusIcon as no}from"./icon/icons/MinusIcon.js";import{ThumbDownIcon as to}from"./icon/icons/ThumbDownIcon.js";import{ThumbUpIcon as eo}from"./icon/icons/ThumbUpIcon.js";import{TrashCanIcon as io}from"./icon/icons/TrashCanIcon.js";import{PenIcon as co}from"./icon/icons/PenIcon.js";import{IconButton as mo}from"./icon-button/IconButton.js";import{Image as po}from"./image/Image.js";import{FieldGroup as lo}from"./input-group/FieldGroup.js";import{InputGroup as Io}from"./input-group/InputGroup.js";import{Label as uo}from"./input-group/Label.js";import{SupportLabel as fo}from"./input-group/SupportLabel.js";import{Link as jo}from"./link/Link.js";import{NavLink as Co}from"./link/NavLink.js";import{LinkList as ko}from"./link-list/LinkList.js";import{List as To,OrderedList as bo,UnorderedList as go}from"./list/List.js";import{CheckListItem as ho,CrossListItem as Bo,ListItem as Ao}from"./list/ListItem.js";import{Loader as So}from"./loader/Loader.js";import{SkeletonAnimation as Lo}from"./loader/skeletons/SkeletonAnimation.js";import{SkeletonButton as xo}from"./loader/skeletons/SkeletonButton.js";import{SkeletonCheckboxGroup as wo}from"./loader/skeletons/SkeletonCheckboxGroup.js";import{SkeletonElement as vo}from"./loader/skeletons/SkeletonElement.js";import{SkeletonInput as Ro}from"./loader/skeletons/SkeletonInput.js";import{SkeletonRadioButtonGroup as Mo}from"./loader/skeletons/SkeletonRadioButtonGroup.js";import{SkeletonTable as Po,SkeletonTableHeader as Do,SkeletonTableRow as yo}from"./loader/skeletons/SkeletonTable.js";import{SkeletonTextArea as Go}from"./loader/skeletons/SkeletonTextArea.js";import{Modal as Uo,ModalActions as No,ModalBody as Eo,ModalCloseButton as Ho,ModalContainer as Oo,ModalHeader as Wo,ModalOverlay as Fo,ModalTitle as Vo}from"./modal/Modal.js";import{useModal as zo}from"./modal/useModal.js";import{default as Qo}from"./popover/Popover.js";import{RadioButton as Yo}from"./radio-button/RadioButton.js";import{RadioButtonGroup as qo}from"./radio-button/RadioButtonGroup.js";import{BaseRadioButton as Jo}from"./radio-button/BaseRadioButton.js";import{N as Ko,S as Xo}from"../../NativeSelect-DwtOOfyt.js";import{ErrorTag as Zo,InfoTag as $o,SuccessTag as _o,Tag as os,WarningTag as ss}from"./tag/Tag.js";import{BaseTextArea as as}from"./text-input/BaseTextArea.js";import{BaseTextInput as rs}from"./text-input/BaseTextInput.js";import{TextArea as ns}from"./text-input/TextArea.js";import{TextInput as ts}from"./text-input/TextInput.js";import{Tooltip as es}from"./tooltip/Tooltip.js";import{TooltipContent as is}from"./tooltip/TooltipContent.js";import{TooltipTrigger as cs}from"./tooltip/TooltipTrigger.js";import{PopupTip as ms}from"./tooltip/PopupTip.js";import{ScreenReaderOnly as ps}from"./ScreenReaderOnly.js";export{s as Accordion,o as AccordionItem,P as ArrowDownIcon,R as ArrowHorizontalAnimated,D as ArrowLeftIcon,y as ArrowNorthEastIcon,G as ArrowRightIcon,U as ArrowUpIcon,v as ArrowVerticalAnimated,Jo as BaseRadioButton,as as BaseTextArea,rs as BaseTextInput,a as Breadcrumb,r as BreadcrumbItem,n as Button,N as CalendarIcon,c as Card,m as CardImage,E as CheckIcon,ho as CheckListItem,u as Checkbox,H as ChevronDownIcon,O as ChevronLeftIcon,W as ChevronRightIcon,F as ChevronUpIcon,V as CloseIcon,f as Combobox,C as CookieConsent,k as CookieConsentProvider,z as CopyIcon,Bo as CrossListItem,x as DatePicker,Q as DotsIcon,Y as DragIcon,q as ErrorIcon,Zo as ErrorTag,lo as FieldGroup,J as GreenCheckIcon,K as HamburgerIcon,w as Icon,mo as IconButton,po as Image,p as InfoBlock,d as InfoCard,X as InfoIcon,$o as InfoTag,Io as InputGroup,uo as Label,jo as Link,Z as LinkIcon,ko as LinkList,To as List,Ao as ListItem,So as Loader,no as MinusIcon,Uo as Modal,No as ModalActions,Eo as ModalBody,Ho as ModalCloseButton,Oo as ModalContainer,Wo as ModalHeader,Fo as ModalOverlay,Vo as ModalTitle,Ko as NativeSelect,l as NavCard,Co as NavLink,bo as OrderedList,co as PenIcon,$ as PlusIcon,M as PlusRemoveAnimated,Qo as Popover,ms as PopupTip,t as PrimaryButton,_ as QuestionIcon,Yo as RadioButton,qo as RadioButtonGroup,oo as RedCrossIcon,ps as ScreenReaderOnly,so as SearchIcon,e as SecondaryButton,Xo as Select,Lo as SkeletonAnimation,xo as SkeletonButton,wo as SkeletonCheckboxGroup,vo as SkeletonElement,Ro as SkeletonInput,Mo as SkeletonRadioButtonGroup,Po as SkeletonTable,Do as SkeletonTableHeader,yo as SkeletonTableRow,Go as SkeletonTextArea,ao as SuccessIcon,_o as SuccessTag,fo as SupportLabel,os as Tag,I as TaskCard,i as TertiaryButton,ns as TextArea,ts as TextInput,to as ThumbDownIcon,eo as ThumbUpIcon,es as Tooltip,is as TooltipContent,cs as TooltipTrigger,io as TrashCanIcon,go as UnorderedList,ro as WarningIcon,ss as WarningTag,B as dayMonthYearRegex,A as formatInput,j as getComboboxValuePair,S as isBlurTargetOutside,b as isCorrectFormat,g as isWithinLowerBound,h as isWithinUpperBound,L as parseDateString,T as useCookieConsent,zo as useModal};
1
+ import{AccordionItem as o}from"./accordion/AccordionItem.js";import{Accordion as s}from"./accordion/Accordion.js";import{Breadcrumb as a}from"./breadcrumb/Breadcrumb.js";import{BreadcrumbItem as r}from"./breadcrumb/BreadcrumbItem.js";import{Button as n,PrimaryButton as e,SecondaryButton as t,TertiaryButton as i}from"./button/Button.js";import{Card as c}from"./card/Card.js";import{CardImage as m}from"./card/CardImage.js";import{InfoBlock as p,NavCard as d}from"./card/NavCard.js";import{TaskCard as l}from"./card/TaskCard.js";import{InfoCard as I}from"./card/InfoCard.js";import{Checkbox as u}from"./checkbox/Checkbox.js";import{Combobox as f,getComboboxValuePair as j}from"./combobox/Combobox.js";import{CookieConsent as k}from"./cookie-consent/CookieConsent.js";import{CookieConsentProvider as C,useCookieConsent as g}from"./cookie-consent/CookieConsentContext.js";import{isCorrectFormat as T,isWithinLowerBound as b,isWithinUpperBound as S}from"./datepicker/validation.js";import{dayMonthYearRegex as h,formatInput as B,isBlurTargetOutside as A,parseDateString as L}from"./datepicker/utils.js";import{DatePicker as M}from"./datepicker/DatePicker.js";import{Feedback as x}from"./feedback/Feedback.js";import{PRESETS as w}from"./feedback/presets.js";import{Icon as R}from"./icon/Icon.js";import{ArrowVerticalAnimated as v}from"./icon/icons/animated/ArrowVerticalAnimated.js";import{ArrowHorizontalAnimated as P}from"./icon/icons/animated/ArrowHorizontalAnimated.js";import{PlusRemoveAnimated as D}from"./icon/icons/animated/PlusRemoveAnimated.js";import{ArrowDownIcon as E}from"./icon/icons/ArrowDownIcon.js";import{ArrowLeftIcon as y}from"./icon/icons/ArrowLeftIcon.js";import{ArrowNorthEastIcon as G}from"./icon/icons/ArrowNorthEastIcon.js";import{ArrowRightIcon as U}from"./icon/icons/ArrowRightIcon.js";import{ArrowUpIcon as N}from"./icon/icons/ArrowUpIcon.js";import{CalendarIcon as F}from"./icon/icons/CalendarIcon.js";import{CheckIcon as W}from"./icon/icons/CheckIcon.js";import{ChevronDownIcon as H}from"./icon/icons/ChevronDownIcon.js";import{ChevronLeftIcon as O}from"./icon/icons/ChevronLeftIcon.js";import{ChevronRightIcon as V}from"./icon/icons/ChevronRightIcon.js";import{ChevronUpIcon as z}from"./icon/icons/ChevronUpIcon.js";import{CloseIcon as Q}from"./icon/icons/CloseIcon.js";import{CopyIcon as Y}from"./icon/icons/CopyIcon.js";import{DotsIcon as q}from"./icon/icons/DotsIcon.js";import{DragIcon as J}from"./icon/icons/DragIcon.js";import{ErrorIcon as K}from"./icon/icons/ErrorIcon.js";import{GreenCheckIcon as X}from"./icon/icons/GreenCheckIcon.js";import{HamburgerIcon as Z}from"./icon/icons/HamburgerIcon.js";import{InfoIcon as $}from"./icon/icons/InfoIcon.js";import{LinkIcon as _}from"./icon/icons/LinkIcon.js";import{PlusIcon as oo}from"./icon/icons/PlusIcon.js";import{QuestionIcon as so}from"./icon/icons/QuestionIcon.js";import{RedCrossIcon as ao}from"./icon/icons/RedCrossIcon.js";import{SearchIcon as ro}from"./icon/icons/SearchIcon.js";import{SuccessIcon as no}from"./icon/icons/SuccessIcon.js";import{WarningIcon as eo}from"./icon/icons/WarningIcon.js";import{MinusIcon as to}from"./icon/icons/MinusIcon.js";import{ThumbDownIcon as io}from"./icon/icons/ThumbDownIcon.js";import{ThumbUpIcon as co}from"./icon/icons/ThumbUpIcon.js";import{TrashCanIcon as mo}from"./icon/icons/TrashCanIcon.js";import{PenIcon as po}from"./icon/icons/PenIcon.js";import{IconButton as lo}from"./icon-button/IconButton.js";import{Image as Io}from"./image/Image.js";import{FieldGroup as uo}from"./input-group/FieldGroup.js";import{InputGroup as fo}from"./input-group/InputGroup.js";import{Label as jo}from"./input-group/Label.js";import{SupportLabel as ko}from"./input-group/SupportLabel.js";import{Link as Co}from"./link/Link.js";import{NavLink as go}from"./link/NavLink.js";import{LinkList as To}from"./link-list/LinkList.js";import{List as bo,OrderedList as So,UnorderedList as ho}from"./list/List.js";import{CheckListItem as Bo,CrossListItem as Ao,ListItem as Lo}from"./list/ListItem.js";import{Loader as Mo}from"./loader/Loader.js";import{SkeletonAnimation as xo}from"./loader/skeletons/SkeletonAnimation.js";import{SkeletonButton as wo}from"./loader/skeletons/SkeletonButton.js";import{SkeletonCheckboxGroup as Ro}from"./loader/skeletons/SkeletonCheckboxGroup.js";import{SkeletonElement as vo}from"./loader/skeletons/SkeletonElement.js";import{SkeletonInput as Po}from"./loader/skeletons/SkeletonInput.js";import{SkeletonRadioButtonGroup as Do}from"./loader/skeletons/SkeletonRadioButtonGroup.js";import{SkeletonTable as Eo,SkeletonTableHeader as yo,SkeletonTableRow as Go}from"./loader/skeletons/SkeletonTable.js";import{SkeletonTextArea as Uo}from"./loader/skeletons/SkeletonTextArea.js";import{ErrorMessage as No,InfoMessage as Fo,SuccessMessage as Wo,WarningMessage as Ho}from"./message/Message.js";import{FormErrorMessage as Oo}from"./message/FormErrorMessage.js";import{Modal as Vo,ModalActions as zo,ModalBody as Qo,ModalCloseButton as Yo,ModalContainer as qo,ModalHeader as Jo,ModalOverlay as Ko,ModalTitle as Xo}from"./modal/Modal.js";import{useModal as Zo}from"./modal/useModal.js";import{default as $o}from"./popover/Popover.js";import{RadioButton as _o}from"./radio-button/RadioButton.js";import{RadioButtonGroup as os}from"./radio-button/RadioButtonGroup.js";import{BaseRadioButton as ss}from"./radio-button/BaseRadioButton.js";import{N as as,S as rs}from"../../NativeSelect-CfNZEQF0.js";import{ErrorTag as ns,InfoTag as es,SuccessTag as ts,Tag as is,WarningTag as cs}from"./tag/Tag.js";import{BaseTextArea as ms}from"./text-input/BaseTextArea.js";import{BaseTextInput as ps}from"./text-input/BaseTextInput.js";import{TextArea as ds}from"./text-input/TextArea.js";import{TextInput as ls}from"./text-input/TextInput.js";import{Tooltip as Is}from"./tooltip/Tooltip.js";import{TooltipContent as us}from"./tooltip/TooltipContent.js";import{TooltipTrigger as fs}from"./tooltip/TooltipTrigger.js";import{PopupTip as js}from"./tooltip/PopupTip.js";import{ScreenReaderOnly as ks}from"./ScreenReaderOnly.js";export{s as Accordion,o as AccordionItem,E as ArrowDownIcon,P as ArrowHorizontalAnimated,y as ArrowLeftIcon,G as ArrowNorthEastIcon,U as ArrowRightIcon,N as ArrowUpIcon,v as ArrowVerticalAnimated,ss as BaseRadioButton,ms as BaseTextArea,ps as BaseTextInput,a as Breadcrumb,r as BreadcrumbItem,n as Button,F as CalendarIcon,c as Card,m as CardImage,W as CheckIcon,Bo as CheckListItem,u as Checkbox,H as ChevronDownIcon,O as ChevronLeftIcon,V as ChevronRightIcon,z as ChevronUpIcon,Q as CloseIcon,f as Combobox,k as CookieConsent,C as CookieConsentProvider,Y as CopyIcon,Ao as CrossListItem,M as DatePicker,q as DotsIcon,J as DragIcon,K as ErrorIcon,No as ErrorMessage,ns as ErrorTag,x as Feedback,uo as FieldGroup,Oo as FormErrorMessage,X as GreenCheckIcon,Z as HamburgerIcon,R as Icon,lo as IconButton,Io as Image,p as InfoBlock,I as InfoCard,$ as InfoIcon,Fo as InfoMessage,es as InfoTag,fo as InputGroup,jo as Label,Co as Link,_ as LinkIcon,To as LinkList,bo as List,Lo as ListItem,Mo as Loader,to as MinusIcon,Vo as Modal,zo as ModalActions,Qo as ModalBody,Yo as ModalCloseButton,qo as ModalContainer,Jo as ModalHeader,Ko as ModalOverlay,Xo as ModalTitle,as as NativeSelect,d as NavCard,go as NavLink,So as OrderedList,w as PRESETS,po as PenIcon,oo as PlusIcon,D as PlusRemoveAnimated,$o as Popover,js as PopupTip,e as PrimaryButton,so as QuestionIcon,_o as RadioButton,os as RadioButtonGroup,ao as RedCrossIcon,ks as ScreenReaderOnly,ro as SearchIcon,t as SecondaryButton,rs as Select,xo as SkeletonAnimation,wo as SkeletonButton,Ro as SkeletonCheckboxGroup,vo as SkeletonElement,Po as SkeletonInput,Do as SkeletonRadioButtonGroup,Eo as SkeletonTable,yo as SkeletonTableHeader,Go as SkeletonTableRow,Uo as SkeletonTextArea,no as SuccessIcon,Wo as SuccessMessage,ts as SuccessTag,ko as SupportLabel,is as Tag,l as TaskCard,i as TertiaryButton,ds as TextArea,ls as TextInput,io as ThumbDownIcon,co as ThumbUpIcon,Is as Tooltip,us as TooltipContent,fs as TooltipTrigger,mo as TrashCanIcon,ho as UnorderedList,eo as WarningIcon,Ho as WarningMessage,cs as WarningTag,h as dayMonthYearRegex,B as formatInput,j as getComboboxValuePair,A as isBlurTargetOutside,T as isCorrectFormat,b as isWithinLowerBound,S as isWithinUpperBound,L as parseDateString,g as useCookieConsent,Zo as useModal};
2
2
  //# sourceMappingURL=index.js.map
@@ -0,0 +1,2 @@
1
+ import{jsxs as o,jsx as n}from"react/jsx-runtime";import{forwardRef as i}from"react";import"../icon/Icon.js";import"../icon/icons/animated/ArrowVerticalAnimated.js";import"../icon/icons/animated/ArrowHorizontalAnimated.js";import"../icon/icons/animated/PlusRemoveAnimated.js";import"../icon/icons/ArrowDownIcon.js";import"../icon/icons/ArrowLeftIcon.js";import"../icon/icons/ArrowNorthEastIcon.js";import"../icon/icons/ArrowRightIcon.js";import"../icon/icons/ArrowUpIcon.js";import"../icon/icons/CalendarIcon.js";import"../icon/icons/CheckIcon.js";import"../icon/icons/ChevronDownIcon.js";import"../icon/icons/ChevronLeftIcon.js";import"../icon/icons/ChevronRightIcon.js";import"../icon/icons/ChevronUpIcon.js";import{CloseIcon as c}from"../icon/icons/CloseIcon.js";import"../icon/icons/CopyIcon.js";import"../icon/icons/DotsIcon.js";import"../icon/icons/DragIcon.js";import"../icon/icons/ErrorIcon.js";import"../icon/icons/GreenCheckIcon.js";import"../icon/icons/HamburgerIcon.js";import"../icon/icons/InfoIcon.js";import"../icon/icons/LinkIcon.js";import"../icon/icons/PlusIcon.js";import"../icon/icons/QuestionIcon.js";import"../icon/icons/RedCrossIcon.js";import"../icon/icons/SearchIcon.js";import"../icon/icons/SuccessIcon.js";import"../icon/icons/WarningIcon.js";import"../icon/icons/MinusIcon.js";import"../icon/icons/ThumbDownIcon.js";import"../icon/icons/ThumbUpIcon.js";import"../icon/icons/TrashCanIcon.js";import"../icon/icons/PenIcon.js";const s=i((({label:i="Lukk",...s},r)=>o("button",{ref:r,type:"button",title:i,...s,children:[n(c,{variant:"small",bold:!0}),n("span",{className:"jkl-sr-only",children:i})]})));s.displayName="DismissButton";export{s as DismissButton};
2
+ //# sourceMappingURL=DismissButton.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DismissButton.js","sources":["../../../../src/components/message/DismissButton.tsx"],"sourcesContent":["import React, { ButtonHTMLAttributes, forwardRef } from \"react\";\nimport { CloseIcon } from \"../icon\";\n\nexport interface DismissButtonProps extends Exclude<ButtonHTMLAttributes<HTMLButtonElement>, \"disabled\"> {\n label?: string;\n}\n\nexport const DismissButton = forwardRef<HTMLButtonElement, DismissButtonProps>(({ label = \"Lukk\", ...rest }, ref) => {\n return (\n <button ref={ref} type=\"button\" title={label} {...rest}>\n <CloseIcon variant=\"small\" bold />\n <span className=\"jkl-sr-only\">{label}</span>\n </button>\n );\n});\n\nDismissButton.displayName = \"DismissButton\";\n"],"names":["DismissButton","forwardRef","label","rest","ref","jsxs","type","title","children","jsx","CloseIcon","variant","bold","className","displayName"],"mappings":"46CAOa,MAAAA,EAAgBC,GAAkD,EAAGC,MAAAA,EAAQ,UAAWC,GAAQC,IAErGC,EAAC,UAAOD,IAAAA,EAAUE,KAAK,SAASC,MAAOL,KAAWC,EAC9CK,SAAA,CAAAC,EAACC,EAAU,CAAAC,QAAQ,QAAQC,MAAI,IAC9BH,EAAA,OAAA,CAAKI,UAAU,cAAeL,SAAMN,SAKjDF,EAAcc,YAAc"}
@@ -0,0 +1,2 @@
1
+ import{jsx as e}from"react/jsx-runtime";import{c as s}from"../../../clsx-BeLtu-UY.js";import{forwardRef as r,useRef as t,useEffect as a}from"react";import{useAnimatedHeight as o}from"../../hooks/useAnimatedHeight/useAnimatedHeight.js";import"../../hooks/useScreen/useScreen.js";import"../../hooks/useId/useId.js";import{ErrorMessage as i}from"./Message.js";const m={title:"Feil og mangler i skjemaet"},l=r(((r,l)=>{const{className:n,errors:c,isSubmitted:d,isValid:u,messageProps:f,...g}=r,p=d&&!u,[h]=o(p,{display:"grid"}),j=t(c);a((()=>{j.current=c}),[c]);const k=c.length>j.current.length;return e("div",{ref:l,className:s("jkl-form-error-message",n),...g,children:e(i,{...m,...f,ref:h,role:k?"alert":"presentation",children:e("ul",{className:"jkl-list",children:c.filter((e=>typeof e<"u")).map((s=>e("li",{className:"jkl-list__item",children:s},s)))})})})}));l.displayName="FormErrorMessage";export{l as FormErrorMessage};
2
+ //# sourceMappingURL=FormErrorMessage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FormErrorMessage.js","sources":["../../../../src/components/message/FormErrorMessage.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport React, { forwardRef, useEffect, useRef } from \"react\";\nimport { useAnimatedHeight } from \"../../hooks\";\nimport { MessageProps, ErrorMessage } from \"./Message\";\n\nexport interface FormErrorMessageProps {\n className?: string;\n id?: string;\n /**\n * @default { title: \"Feil og mangler i skjemaet\" }\n */\n messageProps?: Partial<MessageProps>;\n errors: (string | undefined)[];\n isSubmitted: boolean;\n isValid: boolean;\n}\n\nconst defaultMessageProps = {\n title: \"Feil og mangler i skjemaet\",\n};\n\nexport const FormErrorMessage = forwardRef<HTMLDivElement, FormErrorMessageProps>(\n (props, forwardedRef): JSX.Element | null => {\n const { className, errors, isSubmitted, isValid, messageProps, ...rest } = props;\n\n const showSummary = isSubmitted && !isValid;\n\n const [messageRef] = useAnimatedHeight<HTMLDivElement>(showSummary, { display: \"grid\" });\n\n const previousErrors = useRef<Array<string | undefined>>(errors);\n useEffect(() => {\n previousErrors.current = errors;\n }, [errors]);\n const hasNewErrors = errors.length > previousErrors.current.length;\n\n return (\n <div ref={forwardedRef} className={clsx(\"jkl-form-error-message\", className)} {...rest}>\n <ErrorMessage\n {...defaultMessageProps}\n {...messageProps}\n ref={messageRef}\n role={hasNewErrors ? \"alert\" : \"presentation\"} // Unngå å repetere hele oppsummeringen etter hvert som feilene rettes\n >\n <ul className=\"jkl-list\">\n {errors\n .filter((error) => typeof error !== \"undefined\")\n .map((error) => (\n <li className=\"jkl-list__item\" key={error}>\n {error}\n </li>\n ))}\n </ul>\n </ErrorMessage>\n </div>\n );\n },\n);\n\nFormErrorMessage.displayName = \"FormErrorMessage\";\n"],"names":["defaultMessageProps","title","FormErrorMessage","forwardRef","props","forwardedRef","className","errors","isSubmitted","isValid","messageProps","rest","showSummary","messageRef","useAnimatedHeight","display","previousErrors","useRef","useEffect","current","hasNewErrors","length","jsx","ref","clsx","children","ErrorMessage","role","filter","error","map","displayName"],"mappings":"qWAiBA,MAAMA,EAAsB,CACxBC,MAAO,8BAGEC,EAAmBC,GAC5B,CAACC,EAAOC,KACE,MAAEC,UAAAA,EAAWC,OAAAA,EAAQC,YAAAA,EAAaC,QAAAA,EAASC,aAAAA,KAAiBC,GAASP,EAErEQ,EAAcJ,IAAgBC,GAE7BI,GAAcC,EAAkCF,EAAa,CAAEG,QAAS,SAEzEC,EAAiBC,EAAkCV,GACzDW,GAAU,KACNF,EAAeG,QAAUZ,CAAAA,GAC1B,CAACA,IACJ,MAAMa,EAAeb,EAAOc,OAASL,EAAeG,QAAQE,OAGxD,OAAAC,EAAC,MAAI,CAAAC,IAAKlB,EAAcC,UAAWkB,EAAK,yBAA0BlB,MAAgBK,EAC9Ec,SAAAH,EAACI,EAAA,IACO1B,KACAU,EACJa,IAAKV,EACLc,KAAMP,EAAe,QAAU,eAE/BK,SAAAH,EAAC,MAAGhB,UAAU,WACTmB,WACIG,QAAQC,UAAiBA,EAAU,MACnCC,KAAKD,GACDP,EAAA,KAAA,CAAGhB,UAAU,iBACTmB,SAAAI,GAD+BA,UAMxD,IAKZ3B,EAAiB6B,YAAc"}
@@ -0,0 +1,2 @@
1
+ import{jsx as s,jsxs as o}from"react/jsx-runtime";import{c as n}from"../../../clsx-BeLtu-UY.js";import i,{forwardRef as c}from"react";import"../../hooks/useScreen/useScreen.js";import{useId as e}from"../../hooks/useId/useId.js";import"../icon/Icon.js";import"../icon/icons/animated/ArrowVerticalAnimated.js";import"../icon/icons/animated/ArrowHorizontalAnimated.js";import"../icon/icons/animated/PlusRemoveAnimated.js";import"../icon/icons/ArrowDownIcon.js";import"../icon/icons/ArrowLeftIcon.js";import"../icon/icons/ArrowNorthEastIcon.js";import"../icon/icons/ArrowRightIcon.js";import"../icon/icons/ArrowUpIcon.js";import"../icon/icons/CalendarIcon.js";import"../icon/icons/CheckIcon.js";import"../icon/icons/ChevronDownIcon.js";import"../icon/icons/ChevronLeftIcon.js";import"../icon/icons/ChevronRightIcon.js";import"../icon/icons/ChevronUpIcon.js";import"../icon/icons/CloseIcon.js";import"../icon/icons/CopyIcon.js";import"../icon/icons/DotsIcon.js";import"../icon/icons/DragIcon.js";import{ErrorIcon as r}from"../icon/icons/ErrorIcon.js";import"../icon/icons/GreenCheckIcon.js";import"../icon/icons/HamburgerIcon.js";import{InfoIcon as a}from"../icon/icons/InfoIcon.js";import"../icon/icons/LinkIcon.js";import"../icon/icons/PlusIcon.js";import"../icon/icons/QuestionIcon.js";import"../icon/icons/RedCrossIcon.js";import"../icon/icons/SearchIcon.js";import{SuccessIcon as t}from"../icon/icons/SuccessIcon.js";import{WarningIcon as m}from"../icon/icons/WarningIcon.js";import"../icon/icons/MinusIcon.js";import"../icon/icons/ThumbDownIcon.js";import"../icon/icons/ThumbUpIcon.js";import"../icon/icons/TrashCanIcon.js";import"../icon/icons/PenIcon.js";import{DismissButton as l}from"./DismissButton.js";const j=o=>{switch(o){case"error":return s(r,{className:"jkl-message__icon"});case"info":return s(a,{className:"jkl-message__icon"});case"success":return s(t,{className:"jkl-message__icon"});case"warning":return s(m,{className:"jkl-message__icon"});default:return null}};function p(r){const a=c(((c,a)=>{const{id:t,title:m,fullWidth:p,density:d,className:I="",dismissed:u,dismissAction:g,children:h,role:f,...k}=c,N=e(t||"jkl-message",{generateSuffix:!t}),_=i.Children.map(h,(s=>"string"==typeof s)),w=null!=_&&_[0]?s("p",{children:h}):h;return o("div",{...k,id:t,ref:a,className:n("jkl-message","jkl-message--"+r,I,{"jkl-message--full":p,"jkl-message--dismissed":u}),role:f,"data-density":d,children:[j(r),o("div",{className:"jkl-message__content","data-theme":"light",children:[m&&s("p",{className:"jkl-message__title",children:m}),s("div",{className:"jkl-message__message",children:w})]}),(null==g?void 0:g.handleDismiss)&&s(l,{"aria-controls":N,className:"jkl-message__dismiss-button",label:g.buttonTitle||"Lukk",onClick:g.handleDismiss})]})}));return a.displayName="Message",a}const d=p("info");d.displayName="InfoMessage";const I=p("error");I.displayName="ErrorMessage";const u=p("warning");u.displayName="WarningMessage";const g=p("success");g.displayName="SuccessMessage";export{I as ErrorMessage,d as InfoMessage,g as SuccessMessage,u as WarningMessage};
2
+ //# sourceMappingURL=Message.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Message.js","sources":["../../../../src/components/message/Message.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport React, { AriaRole, forwardRef } from \"react\";\nimport { Density, WithChildren } from \"../..\";\nimport { useId } from \"../../hooks\";\nimport { ErrorIcon, InfoIcon, SuccessIcon, WarningIcon } from \"../icon\";\nimport { DismissButton } from \"./DismissButton\";\n\nexport interface MessageProps extends WithChildren {\n id?: string;\n title?: string;\n fullWidth?: boolean;\n density?: Density;\n className?: string;\n dismissed?: boolean;\n dismissAction?: {\n handleDismiss: () => void;\n buttonTitle?: string;\n };\n role?: AriaRole;\n}\n\ntype messageTypes = \"info\" | \"error\" | \"success\" | \"warning\";\n\nconst getIcon = (messageType: messageTypes) => {\n switch (messageType) {\n case \"error\":\n return <ErrorIcon className=\"jkl-message__icon\" />;\n case \"info\":\n return <InfoIcon className=\"jkl-message__icon\" />;\n case \"success\":\n return <SuccessIcon className=\"jkl-message__icon\" />;\n case \"warning\":\n return <WarningIcon className=\"jkl-message__icon\" />;\n default:\n return null;\n }\n};\n\nfunction messageFactory(messageType: messageTypes) {\n const Message = forwardRef<HTMLDivElement, MessageProps>((props, ref) => {\n const {\n id,\n title,\n fullWidth,\n density,\n className = \"\",\n dismissed,\n dismissAction,\n children,\n role,\n ...rest\n } = props;\n\n const boxId = useId(id || \"jkl-message\", { generateSuffix: !id });\n\n const hasStringChild = React.Children.map(children, (child) => typeof child === \"string\");\n const newChildren = hasStringChild?.[0] ? <p>{children}</p> : children;\n\n return (\n <div\n {...rest}\n id={id}\n ref={ref}\n className={clsx(\"jkl-message\", \"jkl-message--\" + messageType, className, {\n \"jkl-message--full\": fullWidth,\n \"jkl-message--dismissed\": dismissed,\n })}\n role={role}\n data-density={density}\n >\n {getIcon(messageType)}\n <div className=\"jkl-message__content\" data-theme=\"light\">\n {title && <p className=\"jkl-message__title\">{title}</p>}\n <div className=\"jkl-message__message\">{newChildren}</div>\n </div>\n {dismissAction?.handleDismiss && (\n <DismissButton\n aria-controls={boxId}\n className=\"jkl-message__dismiss-button\"\n label={dismissAction.buttonTitle || \"Lukk\"}\n onClick={dismissAction.handleDismiss}\n />\n )}\n </div>\n );\n });\n\n Message.displayName = \"Message\";\n\n return Message;\n}\n\nexport const InfoMessage = messageFactory(\"info\");\nInfoMessage.displayName = \"InfoMessage\";\nexport const ErrorMessage = messageFactory(\"error\");\nErrorMessage.displayName = \"ErrorMessage\";\nexport const WarningMessage = messageFactory(\"warning\");\nWarningMessage.displayName = \"WarningMessage\";\nexport const SuccessMessage = messageFactory(\"success\");\nSuccessMessage.displayName = \"SuccessMessage\";\n"],"names":["getIcon","messageType","jsx","ErrorIcon","className","InfoIcon","SuccessIcon","WarningIcon","messageFactory","Message","forwardRef","props","ref","id","title","fullWidth","density","dismissed","dismissAction","children","role","rest","boxId","useId","generateSuffix","hasStringChild","React","Children","map","child","newChildren","jsxs","clsx","handleDismiss","DismissButton","label","buttonTitle","onClick","displayName","InfoMessage","ErrorMessage","WarningMessage","SuccessMessage"],"mappings":"6qDAuBA,MAAMA,EAAWC,IACb,OAAQA,GACJ,IAAK,QACM,OAAAC,EAACC,EAAU,CAAAC,UAAU,sBAChC,IAAK,OACM,OAAAF,EAACG,EAAS,CAAAD,UAAU,sBAC/B,IAAK,UACM,OAAAF,EAACI,EAAY,CAAAF,UAAU,sBAClC,IAAK,UACM,OAAAF,EAACK,EAAY,CAAAH,UAAU,sBAClC,QACW,OAAA,KACf,EAGJ,SAASI,EAAeP,GACpB,MAAMQ,EAAUC,GAAyC,CAACC,EAAOC,KACvD,MACFC,GAAAA,EACAC,MAAAA,EACAC,UAAAA,EACAC,QAAAA,EACAZ,UAAAA,EAAY,GACZa,UAAAA,EACAC,cAAAA,EACAC,SAAAA,EACAC,KAAAA,KACGC,GACHV,EAEEW,EAAQC,EAAMV,GAAM,cAAe,CAAEW,gBAAiBX,IAEtDY,EAAiBC,EAAMC,SAASC,IAAIT,GAAWU,GAA2B,iBAAVA,IAChEC,EAAc,MAAAL,GAAAA,EAAiB,GAAMvB,EAAA,IAAA,CAAGiB,SAAAA,IAAgBA,EAG1D,OAAAY,EAAC,MAAA,IACOV,EACJR,GAAAA,EACAD,IAAAA,EACAR,UAAW4B,EAAK,cAAe,gBAAkB/B,EAAaG,EAAW,CACrE,oBAAqBW,EACrB,yBAA0BE,IAE9BG,KAAAA,EACA,eAAcJ,EAEbG,SAAA,CAAAnB,EAAQC,GACR8B,EAAA,MAAA,CAAI3B,UAAU,uBAAuB,aAAW,QAC5Ce,SAAA,CAAAL,GAAUZ,EAAA,IAAA,CAAEE,UAAU,qBAAsBe,SAAML,IAClDZ,EAAA,MAAA,CAAIE,UAAU,uBAAwBe,SAAYW,QAEtD,MAAAZ,OAAA,EAAAA,EAAee,gBACZ/B,EAACgC,EAAA,CACG,gBAAeZ,EACflB,UAAU,8BACV+B,MAAOjB,EAAckB,aAAe,OACpCC,QAASnB,EAAce,kBAC3B,IAMhBxB,OAAAA,EAAQ6B,YAAc,UAEf7B,CACX,CAEa,MAAA8B,EAAc/B,EAAe,QAC1C+B,EAAYD,YAAc,cACb,MAAAE,EAAehC,EAAe,SAC3CgC,EAAaF,YAAc,eACd,MAAAG,EAAiBjC,EAAe,WAC7CiC,EAAeH,YAAc,iBAChB,MAAAI,EAAiBlC,EAAe,WAC7CkC,EAAeJ,YAAc"}
@@ -0,0 +1,2 @@
1
+ import{ErrorMessage as s,InfoMessage as e,SuccessMessage as r,WarningMessage as a}from"./Message.js";import{FormErrorMessage as o}from"./FormErrorMessage.js";export{s as ErrorMessage,o as FormErrorMessage,e as InfoMessage,r as SuccessMessage,a as WarningMessage};
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -1,2 +1,2 @@
1
- import"react/jsx-runtime";import"../../../clsx-BeLtu-UY.js";import"react";import"../../hooks/useScreen/useScreen.js";import"../../hooks/useId/useId.js";import"../icon/Icon.js";import"../icon/icons/animated/ArrowVerticalAnimated.js";import"../icon/icons/animated/ArrowHorizontalAnimated.js";import"../icon/icons/animated/PlusRemoveAnimated.js";import"../icon/icons/ArrowDownIcon.js";import"../icon/icons/ArrowLeftIcon.js";import"../icon/icons/ArrowNorthEastIcon.js";import"../icon/icons/ArrowRightIcon.js";import"../icon/icons/ArrowUpIcon.js";import"../icon/icons/CalendarIcon.js";import"../icon/icons/CheckIcon.js";import"../icon/icons/ChevronDownIcon.js";import"../icon/icons/ChevronLeftIcon.js";import"../icon/icons/ChevronRightIcon.js";import"../icon/icons/ChevronUpIcon.js";import"../icon/icons/CloseIcon.js";import"../icon/icons/CopyIcon.js";import"../icon/icons/DotsIcon.js";import"../icon/icons/DragIcon.js";import"../icon/icons/ErrorIcon.js";import"../icon/icons/GreenCheckIcon.js";import"../icon/icons/HamburgerIcon.js";import"../icon/icons/InfoIcon.js";import"../icon/icons/LinkIcon.js";import"../icon/icons/PlusIcon.js";import"../icon/icons/QuestionIcon.js";import"../icon/icons/RedCrossIcon.js";import"../icon/icons/SearchIcon.js";import"../icon/icons/SuccessIcon.js";import"../icon/icons/WarningIcon.js";import"../icon/icons/MinusIcon.js";import"../icon/icons/ThumbDownIcon.js";import"../icon/icons/ThumbUpIcon.js";import"../icon/icons/TrashCanIcon.js";import"../icon/icons/PenIcon.js";import"../button/Button.js";import"../card/Card.js";import"../card/CardImage.js";import"../card/NavCard.js";import"../checkbox/Checkbox.js";import"../combobox/Combobox.js";import"../cookie-consent/CookieConsentContext.js";import"react-dom";import"../modal/Modal.js";import"react-a11y-dialog";import"../list/List.js";import"../list/ListItem.js";import"../datepicker/DatePicker.js";import"../icon-button/IconButton.js";import"../tooltip/Tooltip.js";import"../tooltip/TooltipContent.js";import"../tooltip/TooltipTrigger.js";import"../input-group/InputGroup.js";import"../link/Link.js";import"../link/NavLink.js";import"../link-list/LinkList.js";import"../popover/Popover.js";import"../radio-button/RadioButton.js";import"../radio-button/radioGroupContext.js";import"../radio-button/BaseRadioButton.js";import{N as o}from"../../../NativeSelect-DwtOOfyt.js";import"../tag/Tag.js";import"../text-input/BaseTextArea.js";import"../text-input/BaseTextInput.js";import"../text-input/TextArea.js";import"../text-input/TextInput.js";import"../../utilities/polymorphism/SlotComponent.js";import"../../utilities/valuePair.js";export{o as NativeSelect};
1
+ import"react/jsx-runtime";import"../../../clsx-BeLtu-UY.js";import"react";import"../../hooks/useScreen/useScreen.js";import"../../hooks/useId/useId.js";import"../icon/Icon.js";import"../icon/icons/animated/ArrowVerticalAnimated.js";import"../icon/icons/animated/ArrowHorizontalAnimated.js";import"../icon/icons/animated/PlusRemoveAnimated.js";import"../icon/icons/ArrowDownIcon.js";import"../icon/icons/ArrowLeftIcon.js";import"../icon/icons/ArrowNorthEastIcon.js";import"../icon/icons/ArrowRightIcon.js";import"../icon/icons/ArrowUpIcon.js";import"../icon/icons/CalendarIcon.js";import"../icon/icons/CheckIcon.js";import"../icon/icons/ChevronDownIcon.js";import"../icon/icons/ChevronLeftIcon.js";import"../icon/icons/ChevronRightIcon.js";import"../icon/icons/ChevronUpIcon.js";import"../icon/icons/CloseIcon.js";import"../icon/icons/CopyIcon.js";import"../icon/icons/DotsIcon.js";import"../icon/icons/DragIcon.js";import"../icon/icons/ErrorIcon.js";import"../icon/icons/GreenCheckIcon.js";import"../icon/icons/HamburgerIcon.js";import"../icon/icons/InfoIcon.js";import"../icon/icons/LinkIcon.js";import"../icon/icons/PlusIcon.js";import"../icon/icons/QuestionIcon.js";import"../icon/icons/RedCrossIcon.js";import"../icon/icons/SearchIcon.js";import"../icon/icons/SuccessIcon.js";import"../icon/icons/WarningIcon.js";import"../icon/icons/MinusIcon.js";import"../icon/icons/ThumbDownIcon.js";import"../icon/icons/ThumbUpIcon.js";import"../icon/icons/TrashCanIcon.js";import"../icon/icons/PenIcon.js";import"../button/Button.js";import"../card/Card.js";import"../card/CardImage.js";import"../card/NavCard.js";import"../checkbox/Checkbox.js";import"../combobox/Combobox.js";import"../cookie-consent/CookieConsentContext.js";import"react-dom";import"../modal/Modal.js";import"react-a11y-dialog";import"../list/List.js";import"../list/ListItem.js";import"../datepicker/DatePicker.js";import"../feedback/feedbackContext.js";import"../message/Message.js";import"../message/FormErrorMessage.js";import"../tooltip/Tooltip.js";import"../tooltip/TooltipContent.js";import"../tooltip/TooltipTrigger.js";import"../input-group/InputGroup.js";import"../feedback/followup/followupContext.js";import"../feedback/main-question/mainQuestionContext.js";import"../radio-button/RadioButton.js";import"../radio-button/radioGroupContext.js";import"../radio-button/BaseRadioButton.js";import"../text-input/BaseTextArea.js";import"../text-input/BaseTextInput.js";import"../text-input/TextArea.js";import"../text-input/TextInput.js";import"../../utilities/polymorphism/SlotComponent.js";import"../../utilities/valuePair.js";import"../icon-button/IconButton.js";import"../link/Link.js";import"../link/NavLink.js";import"../link-list/LinkList.js";import"../popover/Popover.js";import{N as o}from"../../../NativeSelect-CfNZEQF0.js";import"../tag/Tag.js";export{o as NativeSelect};
2
2
  //# sourceMappingURL=NativeSelect.js.map
@@ -1,2 +1,2 @@
1
- import"react/jsx-runtime";import"../../../clsx-BeLtu-UY.js";import"react";import"../../hooks/useAnimatedHeight/useAnimatedHeight.js";import"../../hooks/usePreviousValue/usePreviousValue.js";import"../../hooks/useScreen/useScreen.js";import"../../hooks/useId/useId.js";import"../../hooks/useListNavigation/useListNavigation.js";import"../icon/Icon.js";import"../icon/icons/animated/ArrowVerticalAnimated.js";import"../icon/icons/animated/ArrowHorizontalAnimated.js";import"../icon/icons/animated/PlusRemoveAnimated.js";import"../icon/icons/ArrowDownIcon.js";import"../icon/icons/ArrowLeftIcon.js";import"../icon/icons/ArrowNorthEastIcon.js";import"../icon/icons/ArrowRightIcon.js";import"../icon/icons/ArrowUpIcon.js";import"../icon/icons/CalendarIcon.js";import"../icon/icons/CheckIcon.js";import"../icon/icons/ChevronDownIcon.js";import"../icon/icons/ChevronLeftIcon.js";import"../icon/icons/ChevronRightIcon.js";import"../icon/icons/ChevronUpIcon.js";import"../icon/icons/CloseIcon.js";import"../icon/icons/CopyIcon.js";import"../icon/icons/DotsIcon.js";import"../icon/icons/DragIcon.js";import"../icon/icons/ErrorIcon.js";import"../icon/icons/GreenCheckIcon.js";import"../icon/icons/HamburgerIcon.js";import"../icon/icons/InfoIcon.js";import"../icon/icons/LinkIcon.js";import"../icon/icons/PlusIcon.js";import"../icon/icons/QuestionIcon.js";import"../icon/icons/RedCrossIcon.js";import"../icon/icons/SearchIcon.js";import"../icon/icons/SuccessIcon.js";import"../icon/icons/WarningIcon.js";import"../icon/icons/MinusIcon.js";import"../icon/icons/ThumbDownIcon.js";import"../icon/icons/ThumbUpIcon.js";import"../icon/icons/TrashCanIcon.js";import"../icon/icons/PenIcon.js";import"../button/Button.js";import"../card/Card.js";import"../card/CardImage.js";import"../card/NavCard.js";import"../checkbox/Checkbox.js";import"../combobox/Combobox.js";import"../cookie-consent/CookieConsentContext.js";import"react-dom";import"../modal/Modal.js";import"react-a11y-dialog";import"../list/List.js";import"../list/ListItem.js";import"../datepicker/DatePicker.js";import"../icon-button/IconButton.js";import"../tooltip/Tooltip.js";import"../tooltip/TooltipContent.js";import"../tooltip/TooltipTrigger.js";import"../input-group/InputGroup.js";import"../link/Link.js";import"../link/NavLink.js";import"../link-list/LinkList.js";import"../popover/Popover.js";import"../radio-button/RadioButton.js";import"../radio-button/radioGroupContext.js";import"../radio-button/BaseRadioButton.js";import{S as o}from"../../../NativeSelect-DwtOOfyt.js";import"../tag/Tag.js";import"../text-input/BaseTextArea.js";import"../text-input/BaseTextInput.js";import"../text-input/TextArea.js";import"../text-input/TextInput.js";import"../../utilities/polymorphism/SlotComponent.js";import"../../utilities/valuePair.js";import"./select-utils.js";export{o as Select};
1
+ import"react/jsx-runtime";import"../../../clsx-BeLtu-UY.js";import"react";import"../../hooks/useAnimatedHeight/useAnimatedHeight.js";import"../../hooks/usePreviousValue/usePreviousValue.js";import"../../hooks/useScreen/useScreen.js";import"../../hooks/useId/useId.js";import"../../hooks/useListNavigation/useListNavigation.js";import"../icon/Icon.js";import"../icon/icons/animated/ArrowVerticalAnimated.js";import"../icon/icons/animated/ArrowHorizontalAnimated.js";import"../icon/icons/animated/PlusRemoveAnimated.js";import"../icon/icons/ArrowDownIcon.js";import"../icon/icons/ArrowLeftIcon.js";import"../icon/icons/ArrowNorthEastIcon.js";import"../icon/icons/ArrowRightIcon.js";import"../icon/icons/ArrowUpIcon.js";import"../icon/icons/CalendarIcon.js";import"../icon/icons/CheckIcon.js";import"../icon/icons/ChevronDownIcon.js";import"../icon/icons/ChevronLeftIcon.js";import"../icon/icons/ChevronRightIcon.js";import"../icon/icons/ChevronUpIcon.js";import"../icon/icons/CloseIcon.js";import"../icon/icons/CopyIcon.js";import"../icon/icons/DotsIcon.js";import"../icon/icons/DragIcon.js";import"../icon/icons/ErrorIcon.js";import"../icon/icons/GreenCheckIcon.js";import"../icon/icons/HamburgerIcon.js";import"../icon/icons/InfoIcon.js";import"../icon/icons/LinkIcon.js";import"../icon/icons/PlusIcon.js";import"../icon/icons/QuestionIcon.js";import"../icon/icons/RedCrossIcon.js";import"../icon/icons/SearchIcon.js";import"../icon/icons/SuccessIcon.js";import"../icon/icons/WarningIcon.js";import"../icon/icons/MinusIcon.js";import"../icon/icons/ThumbDownIcon.js";import"../icon/icons/ThumbUpIcon.js";import"../icon/icons/TrashCanIcon.js";import"../icon/icons/PenIcon.js";import"../button/Button.js";import"../card/Card.js";import"../card/CardImage.js";import"../card/NavCard.js";import"../checkbox/Checkbox.js";import"../combobox/Combobox.js";import"../cookie-consent/CookieConsentContext.js";import"react-dom";import"../modal/Modal.js";import"react-a11y-dialog";import"../list/List.js";import"../list/ListItem.js";import"../datepicker/DatePicker.js";import"../feedback/feedbackContext.js";import"../message/Message.js";import"../message/FormErrorMessage.js";import"../tooltip/Tooltip.js";import"../tooltip/TooltipContent.js";import"../tooltip/TooltipTrigger.js";import"../input-group/InputGroup.js";import"../feedback/followup/followupContext.js";import"../feedback/main-question/mainQuestionContext.js";import"../radio-button/RadioButton.js";import"../radio-button/radioGroupContext.js";import"../radio-button/BaseRadioButton.js";import"../text-input/BaseTextArea.js";import"../text-input/BaseTextInput.js";import"../text-input/TextArea.js";import"../text-input/TextInput.js";import"../../utilities/polymorphism/SlotComponent.js";import"../../utilities/valuePair.js";import"../icon-button/IconButton.js";import"../link/Link.js";import"../link/NavLink.js";import"../link-list/LinkList.js";import"../popover/Popover.js";import{S as o}from"../../../NativeSelect-CfNZEQF0.js";import"../tag/Tag.js";import"./select-utils.js";export{o as Select};
2
2
  //# sourceMappingURL=Select.js.map
@@ -1,2 +1,2 @@
1
- import{N as e,S as t}from"../../../NativeSelect-DwtOOfyt.js";export{e as NativeSelect,t as Select};
1
+ import{N as e,S as t}from"../../../NativeSelect-CfNZEQF0.js";export{e as NativeSelect,t as Select};
2
2
  //# sourceMappingURL=index.js.map
@@ -1,2 +1,2 @@
1
- import{jsxs as t,jsx as n}from"react/jsx-runtime";import i from"classnames";import{forwardRef as a}from"react";import{IconButton as e}from"../icon-button/IconButton.js";function s(t,n){return t?{width:t}:n?{width:`calc(${Math.min(n,40)}ch + 24px)`}:void 0}const o=a(((a,o)=>{const{action:l,align:r="left","aria-invalid":c,className:u="",density:p,maxLength:m,style:d,type:x="text",unit:h,width:f,...j}=a;return t("div",{className:"jkl-text-input-wrapper","data-invalid":c,style:{...d,...s(f,m)},children:[n("input",{"aria-invalid":c,ref:o,className:i("jkl-text-input__input",u,{"jkl-text-input__input--align-right":"right"===r}),maxLength:m,type:x,...j}),h&&n("span",{className:"jkl-text-input__unit",children:h}),l&&n(e,{density:p,className:i("jkl-text-input-action-button",l.className),title:l.label,onClick:l.onClick,onFocus:l.onFocus,onBlur:l.onBlur,ref:l.buttonRef,type:l.type||"button",children:l.icon})]})}));o.displayName="BaseInputField";export{o as BaseTextInput};
1
+ import{jsxs as t,jsx as n}from"react/jsx-runtime";import{c as i}from"../../../clsx-BeLtu-UY.js";import{forwardRef as a}from"react";import{IconButton as e}from"../icon-button/IconButton.js";function s(t,n){return t?{width:t}:n?{width:`calc(${Math.min(n,40)}ch + 24px)`}:void 0}const o=a(((a,o)=>{const{action:l,align:r="left","aria-invalid":c,className:u="",density:p,maxLength:m,style:d,type:x="text",unit:h,width:f,...j}=a;return t("div",{className:"jkl-text-input-wrapper","data-invalid":c,style:{...d,...s(f,m)},children:[n("input",{"aria-invalid":c,ref:o,className:i("jkl-text-input__input",u,{"jkl-text-input__input--align-right":"right"===r}),maxLength:m,type:x,...j}),h&&n("span",{className:"jkl-text-input__unit",children:h}),l&&n(e,{density:p,className:i("jkl-text-input-action-button",l.className),title:l.label,onClick:l.onClick,onFocus:l.onFocus,onBlur:l.onBlur,ref:l.buttonRef,type:l.type||"button",children:l.icon})]})}));o.displayName="BaseInputField";export{o as BaseTextInput};
2
2
  //# sourceMappingURL=BaseTextInput.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"BaseTextInput.js","sources":["../../../../src/components/text-input/BaseTextInput.tsx"],"sourcesContent":["import cn from \"classnames\";\nimport React, {\n type CSSProperties,\n forwardRef,\n type MouseEventHandler,\n type ReactNode,\n InputHTMLAttributes,\n HTMLProps,\n} from \"react\";\nimport { Density } from \"../../core\";\nimport { IconProps } from \"../icon\";\nimport { IconButton } from \"../icon-button\";\n\nfunction getWidthAsStyle(width?: string, maxLength?: number): CSSProperties | undefined {\n if (width) {\n return { width }; // prioritize width prop\n }\n\n if (maxLength) {\n // adapt to maxLength, but capped at 40ch\n const length = `${Math.min(maxLength, 40)}ch`;\n const padding = \"24px\"; // left + right padding\n return { width: `calc(${length} + ${padding})` };\n }\n\n return undefined;\n}\n\ninterface ActionBaseProps extends Exclude<HTMLProps<HTMLButtonElement>, \"disabled\"> {\n icon: React.ReactElement<IconProps>;\n label: string;\n buttonRef?: React.Ref<HTMLButtonElement>;\n}\n\nexport interface ActionButton extends ActionBaseProps {\n type?: \"button\" | \"reset\";\n onClick: MouseEventHandler<HTMLButtonElement>;\n}\n\nexport interface ActionSubmit extends ActionBaseProps {\n type: \"submit\";\n onClick?: MouseEventHandler<HTMLButtonElement>;\n}\n\nexport type Action = ActionButton | ActionSubmit;\n\nexport interface BaseTextInputProps extends Omit<InputHTMLAttributes<HTMLInputElement>, \"children\"> {\n /**\n * Brukes til inputfelter hvor det brukes maskering, for formatering av store tall. Brukes typisk bare til valuta.\n * @default \"left\"\n */\n align?: \"left\" | \"right\";\n action?: Action;\n density?: Density;\n /**\n * Benevnelse for feltet. Unngå å bruke både benevnelse og handling samtidig\n * @example \"kr\"\n * */\n unit?: ReactNode;\n width?: string;\n}\n\nexport const BaseTextInput = forwardRef<HTMLInputElement, BaseTextInputProps>((props, ref) => {\n const {\n action,\n align = \"left\",\n \"aria-invalid\": ariaInvalid,\n className = \"\",\n density,\n maxLength,\n style,\n type = \"text\",\n unit,\n width,\n ...rest\n } = props;\n\n return (\n <div\n className=\"jkl-text-input-wrapper\"\n data-invalid={ariaInvalid}\n style={{ ...style, ...getWidthAsStyle(width, maxLength) }}\n >\n <input\n aria-invalid={ariaInvalid}\n ref={ref}\n className={cn(\"jkl-text-input__input\", className, {\n \"jkl-text-input__input--align-right\": align === \"right\",\n })}\n maxLength={maxLength}\n type={type}\n {...rest}\n />\n {unit && <span className=\"jkl-text-input__unit\">{unit}</span>}\n {action && (\n <IconButton\n density={density}\n className={cn(\"jkl-text-input-action-button\", action.className)}\n title={action.label}\n onClick={action.onClick}\n onFocus={action.onFocus}\n onBlur={action.onBlur}\n ref={action.buttonRef}\n type={action.type || \"button\"}\n >\n {action.icon}\n </IconButton>\n )}\n </div>\n );\n});\n\nBaseTextInput.displayName = \"BaseInputField\";\n"],"names":["getWidthAsStyle","width","maxLength","Math","min","BaseTextInput","forwardRef","props","ref","action","align","ariaInvalid","className","density","style","type","unit","rest","jsxs","children","jsx","cn","IconButton","title","label","onClick","onFocus","onBlur","buttonRef","icon","displayName"],"mappings":"yKAaA,SAASA,EAAgBC,EAAgBC,GACjCD,OAAAA,EACO,CAAEA,MAAAA,GAGTC,EAIO,CAAED,MAAO,QAFEE,KAAKC,IAAIF,EAAW,sBAFtCA,CAQR,CAoCO,MAAMG,EAAgBC,GAAiD,CAACC,EAAOC,KAC5E,MACFC,OAAAA,EACAC,MAAAA,EAAQ,OACR,eAAgBC,EAChBC,UAAAA,EAAY,GACZC,QAAAA,EACAX,UAAAA,EACAY,MAAAA,EACAC,KAAAA,EAAO,OACPC,KAAAA,EACAf,MAAAA,KACGgB,GACHV,EAGA,OAAAW,EAAC,MAAA,CACGN,UAAU,yBACV,eAAcD,EACdG,MAAO,IAAKA,KAAUd,EAAgBC,EAAOC,IAE7CiB,SAAA,CAAAC,EAAC,QAAA,CACG,eAAcT,EACdH,IAAAA,EACAI,UAAWS,EAAG,wBAAyBT,EAAW,CAC9C,qCAAgD,UAAVF,IAE1CR,UAAAA,EACAa,KAAAA,KACIE,IAEPD,GAAQI,EAAC,OAAK,CAAAR,UAAU,uBAAwBO,SAAKH,IACrDP,GACGW,EAACE,EAAA,CACGT,QAAAA,EACAD,UAAWS,EAAG,+BAAgCZ,EAAOG,WACrDW,MAAOd,EAAOe,MACdC,QAAShB,EAAOgB,QAChBC,QAASjB,EAAOiB,QAChBC,OAAQlB,EAAOkB,OACfnB,IAAKC,EAAOmB,UACZb,KAAMN,EAAOM,MAAQ,SAEpBI,SAAOV,EAAAoB,SACZ,IAMhBxB,EAAcyB,YAAc"}
1
+ {"version":3,"file":"BaseTextInput.js","sources":["../../../../src/components/text-input/BaseTextInput.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport React, {\n type CSSProperties,\n forwardRef,\n type MouseEventHandler,\n type ReactNode,\n InputHTMLAttributes,\n HTMLProps,\n} from \"react\";\nimport { Density } from \"../../core\";\nimport { IconProps } from \"../icon\";\nimport { IconButton } from \"../icon-button\";\n\nfunction getWidthAsStyle(width?: string, maxLength?: number): CSSProperties | undefined {\n if (width) {\n return { width }; // prioritize width prop\n }\n\n if (maxLength) {\n // adapt to maxLength, but capped at 40ch\n const length = `${Math.min(maxLength, 40)}ch`;\n const padding = \"24px\"; // left + right padding\n return { width: `calc(${length} + ${padding})` };\n }\n\n return undefined;\n}\n\ninterface ActionBaseProps extends Exclude<HTMLProps<HTMLButtonElement>, \"disabled\"> {\n icon: React.ReactElement<IconProps>;\n label: string;\n buttonRef?: React.Ref<HTMLButtonElement>;\n}\n\nexport interface ActionButton extends ActionBaseProps {\n type?: \"button\" | \"reset\";\n onClick: MouseEventHandler<HTMLButtonElement>;\n}\n\nexport interface ActionSubmit extends ActionBaseProps {\n type: \"submit\";\n onClick?: MouseEventHandler<HTMLButtonElement>;\n}\n\nexport type Action = ActionButton | ActionSubmit;\n\nexport interface BaseTextInputProps extends Omit<InputHTMLAttributes<HTMLInputElement>, \"children\"> {\n /**\n * Brukes til inputfelter hvor det brukes maskering, for formatering av store tall. Brukes typisk bare til valuta.\n * @default \"left\"\n */\n align?: \"left\" | \"right\";\n action?: Action;\n density?: Density;\n /**\n * Benevnelse for feltet. Unngå å bruke både benevnelse og handling samtidig\n * @example \"kr\"\n * */\n unit?: ReactNode;\n width?: string;\n}\n\nexport const BaseTextInput = forwardRef<HTMLInputElement, BaseTextInputProps>((props, ref) => {\n const {\n action,\n align = \"left\",\n \"aria-invalid\": ariaInvalid,\n className = \"\",\n density,\n maxLength,\n style,\n type = \"text\",\n unit,\n width,\n ...rest\n } = props;\n\n return (\n <div\n className=\"jkl-text-input-wrapper\"\n data-invalid={ariaInvalid}\n style={{ ...style, ...getWidthAsStyle(width, maxLength) }}\n >\n <input\n aria-invalid={ariaInvalid}\n ref={ref}\n className={clsx(\"jkl-text-input__input\", className, {\n \"jkl-text-input__input--align-right\": align === \"right\",\n })}\n maxLength={maxLength}\n type={type}\n {...rest}\n />\n {unit && <span className=\"jkl-text-input__unit\">{unit}</span>}\n {action && (\n <IconButton\n density={density}\n className={clsx(\"jkl-text-input-action-button\", action.className)}\n title={action.label}\n onClick={action.onClick}\n onFocus={action.onFocus}\n onBlur={action.onBlur}\n ref={action.buttonRef}\n type={action.type || \"button\"}\n >\n {action.icon}\n </IconButton>\n )}\n </div>\n );\n});\n\nBaseTextInput.displayName = \"BaseInputField\";\n"],"names":["getWidthAsStyle","width","maxLength","Math","min","BaseTextInput","forwardRef","props","ref","action","align","ariaInvalid","className","density","style","type","unit","rest","jsxs","children","jsx","clsx","IconButton","title","label","onClick","onFocus","onBlur","buttonRef","icon","displayName"],"mappings":"6LAaA,SAASA,EAAgBC,EAAgBC,GACjCD,OAAAA,EACO,CAAEA,MAAAA,GAGTC,EAIO,CAAED,MAAO,QAFEE,KAAKC,IAAIF,EAAW,sBAFtCA,CAQR,CAoCO,MAAMG,EAAgBC,GAAiD,CAACC,EAAOC,KAC5E,MACFC,OAAAA,EACAC,MAAAA,EAAQ,OACR,eAAgBC,EAChBC,UAAAA,EAAY,GACZC,QAAAA,EACAX,UAAAA,EACAY,MAAAA,EACAC,KAAAA,EAAO,OACPC,KAAAA,EACAf,MAAAA,KACGgB,GACHV,EAGA,OAAAW,EAAC,MAAA,CACGN,UAAU,yBACV,eAAcD,EACdG,MAAO,IAAKA,KAAUd,EAAgBC,EAAOC,IAE7CiB,SAAA,CAAAC,EAAC,QAAA,CACG,eAAcT,EACdH,IAAAA,EACAI,UAAWS,EAAK,wBAAyBT,EAAW,CAChD,qCAAgD,UAAVF,IAE1CR,UAAAA,EACAa,KAAAA,KACIE,IAEPD,GAAQI,EAAC,OAAK,CAAAR,UAAU,uBAAwBO,SAAKH,IACrDP,GACGW,EAACE,EAAA,CACGT,QAAAA,EACAD,UAAWS,EAAK,+BAAgCZ,EAAOG,WACvDW,MAAOd,EAAOe,MACdC,QAAShB,EAAOgB,QAChBC,QAASjB,EAAOiB,QAChBC,OAAQlB,EAAOkB,OACfnB,IAAKC,EAAOmB,UACZb,KAAMN,EAAOM,MAAQ,SAEpBI,SAAOV,EAAAoB,SACZ,IAMhBxB,EAAcyB,YAAc"}
@@ -1,2 +1,2 @@
1
- import{jsx as o}from"react/jsx-runtime";import n from"classnames";import{forwardRef as i}from"react";import"../../hooks/useScreen/useScreen.js";import"../../hooks/useId/useId.js";import"../tooltip/Tooltip.js";import"../tooltip/TooltipContent.js";import"../tooltip/TooltipTrigger.js";import"../icon/Icon.js";import"../icon/icons/animated/ArrowVerticalAnimated.js";import"../icon/icons/animated/ArrowHorizontalAnimated.js";import"../icon/icons/animated/PlusRemoveAnimated.js";import"../icon/icons/ArrowDownIcon.js";import"../icon/icons/ArrowLeftIcon.js";import"../icon/icons/ArrowNorthEastIcon.js";import"../icon/icons/ArrowRightIcon.js";import"../icon/icons/ArrowUpIcon.js";import"../icon/icons/CalendarIcon.js";import"../icon/icons/CheckIcon.js";import"../icon/icons/ChevronDownIcon.js";import"../icon/icons/ChevronLeftIcon.js";import"../icon/icons/ChevronRightIcon.js";import"../icon/icons/ChevronUpIcon.js";import"../icon/icons/CloseIcon.js";import"../icon/icons/CopyIcon.js";import"../icon/icons/DotsIcon.js";import"../icon/icons/DragIcon.js";import"../icon/icons/ErrorIcon.js";import"../icon/icons/GreenCheckIcon.js";import"../icon/icons/HamburgerIcon.js";import"../icon/icons/InfoIcon.js";import"../icon/icons/LinkIcon.js";import"../icon/icons/PlusIcon.js";import"../icon/icons/QuestionIcon.js";import"../icon/icons/RedCrossIcon.js";import"../icon/icons/SearchIcon.js";import"../icon/icons/SuccessIcon.js";import"../icon/icons/WarningIcon.js";import"../icon/icons/MinusIcon.js";import"../icon/icons/ThumbDownIcon.js";import"../icon/icons/ThumbUpIcon.js";import"../icon/icons/TrashCanIcon.js";import"../icon/icons/PenIcon.js";import{InputGroup as r}from"../input-group/InputGroup.js";import{BaseTextArea as s}from"./BaseTextArea.js";const c=i(((i,c)=>{const{autoExpand:t,className:e,counter:p,density:a,errorLabel:m,helpLabel:j,inline:l,label:I,labelProps:u,startOpen:d,supportLabelProps:h,tooltipProps:x,...A}=i,b={label:I,density:a,errorLabel:m,helpLabel:j,labelProps:u,inline:l,supportLabelProps:h,tooltipProps:x},C={autoExpand:t,counter:p,startOpen:d};return o(r,{className:n("jkl-text-area",e,{"jkl-text-area--start-open":d,"jkl-text-area--auto-expand":t}),"data-testid":"jkl-text-area",...b,children:o(s,{ref:c,...A,...C})})}));c.displayName="TextArea";export{c as TextArea};
1
+ import{jsx as o}from"react/jsx-runtime";import{c as n}from"../../../clsx-BeLtu-UY.js";import{forwardRef as i}from"react";import"../../hooks/useScreen/useScreen.js";import"../../hooks/useId/useId.js";import"../tooltip/Tooltip.js";import"../tooltip/TooltipContent.js";import"../tooltip/TooltipTrigger.js";import"../icon/Icon.js";import"../icon/icons/animated/ArrowVerticalAnimated.js";import"../icon/icons/animated/ArrowHorizontalAnimated.js";import"../icon/icons/animated/PlusRemoveAnimated.js";import"../icon/icons/ArrowDownIcon.js";import"../icon/icons/ArrowLeftIcon.js";import"../icon/icons/ArrowNorthEastIcon.js";import"../icon/icons/ArrowRightIcon.js";import"../icon/icons/ArrowUpIcon.js";import"../icon/icons/CalendarIcon.js";import"../icon/icons/CheckIcon.js";import"../icon/icons/ChevronDownIcon.js";import"../icon/icons/ChevronLeftIcon.js";import"../icon/icons/ChevronRightIcon.js";import"../icon/icons/ChevronUpIcon.js";import"../icon/icons/CloseIcon.js";import"../icon/icons/CopyIcon.js";import"../icon/icons/DotsIcon.js";import"../icon/icons/DragIcon.js";import"../icon/icons/ErrorIcon.js";import"../icon/icons/GreenCheckIcon.js";import"../icon/icons/HamburgerIcon.js";import"../icon/icons/InfoIcon.js";import"../icon/icons/LinkIcon.js";import"../icon/icons/PlusIcon.js";import"../icon/icons/QuestionIcon.js";import"../icon/icons/RedCrossIcon.js";import"../icon/icons/SearchIcon.js";import"../icon/icons/SuccessIcon.js";import"../icon/icons/WarningIcon.js";import"../icon/icons/MinusIcon.js";import"../icon/icons/ThumbDownIcon.js";import"../icon/icons/ThumbUpIcon.js";import"../icon/icons/TrashCanIcon.js";import"../icon/icons/PenIcon.js";import{InputGroup as r}from"../input-group/InputGroup.js";import{BaseTextArea as s}from"./BaseTextArea.js";const c=i(((i,c)=>{const{autoExpand:t,className:e,counter:p,density:a,errorLabel:m,helpLabel:j,inline:l,label:I,labelProps:u,startOpen:d,supportLabelProps:h,tooltipProps:x,...A}=i,b={label:I,density:a,errorLabel:m,helpLabel:j,labelProps:u,inline:l,supportLabelProps:h,tooltipProps:x},C={autoExpand:t,counter:p,startOpen:d};return o(r,{className:n("jkl-text-area",e,{"jkl-text-area--start-open":d,"jkl-text-area--auto-expand":t}),"data-testid":"jkl-text-area",...b,children:o(s,{ref:c,...A,...C})})}));c.displayName="TextArea";export{c as TextArea};
2
2
  //# sourceMappingURL=TextArea.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"TextArea.js","sources":["../../../../src/components/text-input/TextArea.tsx"],"sourcesContent":["import cn from \"classnames\";\nimport React, { forwardRef } from \"react\";\nimport { InputGroup, InputGroupProps } from \"../input-group\";\nimport { BaseTextArea, BaseTextAreaProps } from \"./BaseTextArea\";\n\nexport interface TextAreaProps extends Omit<InputGroupProps, \"children\">, BaseTextAreaProps {}\n\nexport const TextArea = forwardRef<HTMLTextAreaElement, TextAreaProps>((props, ref) => {\n const {\n autoExpand,\n className,\n counter,\n density,\n errorLabel,\n helpLabel,\n inline,\n label,\n labelProps,\n startOpen,\n supportLabelProps,\n tooltipProps,\n ...rest\n } = props;\n const inputGroupProps = {\n label,\n density,\n errorLabel,\n helpLabel,\n labelProps,\n inline,\n supportLabelProps,\n tooltipProps,\n };\n const textAreaProps = { autoExpand, counter, startOpen };\n return (\n <InputGroup\n className={cn(\"jkl-text-area\", className, {\n \"jkl-text-area--start-open\": startOpen,\n \"jkl-text-area--auto-expand\": autoExpand,\n })}\n data-testid=\"jkl-text-area\"\n {...inputGroupProps}\n >\n <BaseTextArea ref={ref} {...rest} {...textAreaProps} />\n </InputGroup>\n );\n});\nTextArea.displayName = \"TextArea\";\n"],"names":["TextArea","forwardRef","props","ref","autoExpand","className","counter","density","errorLabel","helpLabel","inline","label","labelProps","startOpen","supportLabelProps","tooltipProps","rest","inputGroupProps","textAreaProps","jsx","InputGroup","cn","children","BaseTextArea","displayName"],"mappings":"ysDAOO,MAAMA,EAAWC,GAA+C,CAACC,EAAOC,KACrE,MACFC,WAAAA,EACAC,UAAAA,EACAC,QAAAA,EACAC,QAAAA,EACAC,WAAAA,EACAC,UAAAA,EACAC,OAAAA,EACAC,MAAAA,EACAC,WAAAA,EACAC,UAAAA,EACAC,kBAAAA,EACAC,aAAAA,KACGC,GACHd,EACEe,EAAkB,CACpBN,MAAAA,EACAJ,QAAAA,EACAC,WAAAA,EACAC,UAAAA,EACAG,WAAAA,EACAF,OAAAA,EACAI,kBAAAA,EACAC,aAAAA,GAEEG,EAAgB,CAAEd,WAAAA,EAAYE,QAAAA,EAASO,UAAAA,GAEzC,OAAAM,EAACC,EAAA,CACGf,UAAWgB,EAAG,gBAAiBhB,EAAW,CACtC,4BAA6BQ,EAC7B,6BAA8BT,IAElC,cAAY,mBACRa,EAEJK,WAACC,EAAa,CAAApB,IAAAA,KAAca,KAAUE,KAAe,IAIjElB,EAASwB,YAAc"}
1
+ {"version":3,"file":"TextArea.js","sources":["../../../../src/components/text-input/TextArea.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport React, { forwardRef } from \"react\";\nimport { InputGroup, InputGroupProps } from \"../input-group\";\nimport { BaseTextArea, BaseTextAreaProps } from \"./BaseTextArea\";\n\nexport interface TextAreaProps extends Omit<InputGroupProps, \"children\">, BaseTextAreaProps {}\n\nexport const TextArea = forwardRef<HTMLTextAreaElement, TextAreaProps>((props, ref) => {\n const {\n autoExpand,\n className,\n counter,\n density,\n errorLabel,\n helpLabel,\n inline,\n label,\n labelProps,\n startOpen,\n supportLabelProps,\n tooltipProps,\n ...rest\n } = props;\n const inputGroupProps = {\n label,\n density,\n errorLabel,\n helpLabel,\n labelProps,\n inline,\n supportLabelProps,\n tooltipProps,\n };\n const textAreaProps = { autoExpand, counter, startOpen };\n return (\n <InputGroup\n className={clsx(\"jkl-text-area\", className, {\n \"jkl-text-area--start-open\": startOpen,\n \"jkl-text-area--auto-expand\": autoExpand,\n })}\n data-testid=\"jkl-text-area\"\n {...inputGroupProps}\n >\n <BaseTextArea ref={ref} {...rest} {...textAreaProps} />\n </InputGroup>\n );\n});\nTextArea.displayName = \"TextArea\";\n"],"names":["TextArea","forwardRef","props","ref","autoExpand","className","counter","density","errorLabel","helpLabel","inline","label","labelProps","startOpen","supportLabelProps","tooltipProps","rest","inputGroupProps","textAreaProps","jsx","InputGroup","clsx","children","BaseTextArea","displayName"],"mappings":"6tDAOO,MAAMA,EAAWC,GAA+C,CAACC,EAAOC,KACrE,MACFC,WAAAA,EACAC,UAAAA,EACAC,QAAAA,EACAC,QAAAA,EACAC,WAAAA,EACAC,UAAAA,EACAC,OAAAA,EACAC,MAAAA,EACAC,WAAAA,EACAC,UAAAA,EACAC,kBAAAA,EACAC,aAAAA,KACGC,GACHd,EACEe,EAAkB,CACpBN,MAAAA,EACAJ,QAAAA,EACAC,WAAAA,EACAC,UAAAA,EACAG,WAAAA,EACAF,OAAAA,EACAI,kBAAAA,EACAC,aAAAA,GAEEG,EAAgB,CAAEd,WAAAA,EAAYE,QAAAA,EAASO,UAAAA,GAEzC,OAAAM,EAACC,EAAA,CACGf,UAAWgB,EAAK,gBAAiBhB,EAAW,CACxC,4BAA6BQ,EAC7B,6BAA8BT,IAElC,cAAY,mBACRa,EAEJK,WAACC,EAAa,CAAApB,IAAAA,KAAca,KAAUE,KAAe,IAIjElB,EAASwB,YAAc"}
@@ -1,2 +1,2 @@
1
- import{jsx as o}from"react/jsx-runtime";import i from"classnames";import{forwardRef as n}from"react";import"../../hooks/useScreen/useScreen.js";import"../../hooks/useId/useId.js";import"../tooltip/Tooltip.js";import"../tooltip/TooltipContent.js";import"../tooltip/TooltipTrigger.js";import"../icon/Icon.js";import"../icon/icons/animated/ArrowVerticalAnimated.js";import"../icon/icons/animated/ArrowHorizontalAnimated.js";import"../icon/icons/animated/PlusRemoveAnimated.js";import"../icon/icons/ArrowDownIcon.js";import"../icon/icons/ArrowLeftIcon.js";import"../icon/icons/ArrowNorthEastIcon.js";import"../icon/icons/ArrowRightIcon.js";import"../icon/icons/ArrowUpIcon.js";import"../icon/icons/CalendarIcon.js";import"../icon/icons/CheckIcon.js";import"../icon/icons/ChevronDownIcon.js";import"../icon/icons/ChevronLeftIcon.js";import"../icon/icons/ChevronRightIcon.js";import"../icon/icons/ChevronUpIcon.js";import"../icon/icons/CloseIcon.js";import"../icon/icons/CopyIcon.js";import"../icon/icons/DotsIcon.js";import"../icon/icons/DragIcon.js";import"../icon/icons/ErrorIcon.js";import"../icon/icons/GreenCheckIcon.js";import"../icon/icons/HamburgerIcon.js";import"../icon/icons/InfoIcon.js";import"../icon/icons/LinkIcon.js";import"../icon/icons/PlusIcon.js";import"../icon/icons/QuestionIcon.js";import"../icon/icons/RedCrossIcon.js";import"../icon/icons/SearchIcon.js";import"../icon/icons/SuccessIcon.js";import"../icon/icons/WarningIcon.js";import"../icon/icons/MinusIcon.js";import"../icon/icons/ThumbDownIcon.js";import"../icon/icons/ThumbUpIcon.js";import"../icon/icons/TrashCanIcon.js";import"../icon/icons/PenIcon.js";import{InputGroup as s}from"../input-group/InputGroup.js";import{BaseTextInput as c}from"./BaseTextInput.js";const r=n(((n,r)=>{const{label:t,className:p,density:e,errorLabel:m,helpLabel:a,inline:j,inputClassName:l,labelProps:I,supportLabelProps:u,tooltipProps:d,...h}=n;return o(s,{label:t,density:e,errorLabel:m,helpLabel:a,labelProps:I,inline:j,supportLabelProps:u,tooltipProps:d,className:i(p,"jkl-text-input",{"jkl-text-input--inline":j}),"data-testid":"jkl-text-input",density:j?"compact":e,children:o(c,{ref:r,...h,className:l})})}));r.displayName="TextInput";export{r as TextInput};
1
+ import{jsx as o}from"react/jsx-runtime";import{c as i}from"../../../clsx-BeLtu-UY.js";import{forwardRef as n}from"react";import"../../hooks/useScreen/useScreen.js";import"../../hooks/useId/useId.js";import"../tooltip/Tooltip.js";import"../tooltip/TooltipContent.js";import"../tooltip/TooltipTrigger.js";import"../icon/Icon.js";import"../icon/icons/animated/ArrowVerticalAnimated.js";import"../icon/icons/animated/ArrowHorizontalAnimated.js";import"../icon/icons/animated/PlusRemoveAnimated.js";import"../icon/icons/ArrowDownIcon.js";import"../icon/icons/ArrowLeftIcon.js";import"../icon/icons/ArrowNorthEastIcon.js";import"../icon/icons/ArrowRightIcon.js";import"../icon/icons/ArrowUpIcon.js";import"../icon/icons/CalendarIcon.js";import"../icon/icons/CheckIcon.js";import"../icon/icons/ChevronDownIcon.js";import"../icon/icons/ChevronLeftIcon.js";import"../icon/icons/ChevronRightIcon.js";import"../icon/icons/ChevronUpIcon.js";import"../icon/icons/CloseIcon.js";import"../icon/icons/CopyIcon.js";import"../icon/icons/DotsIcon.js";import"../icon/icons/DragIcon.js";import"../icon/icons/ErrorIcon.js";import"../icon/icons/GreenCheckIcon.js";import"../icon/icons/HamburgerIcon.js";import"../icon/icons/InfoIcon.js";import"../icon/icons/LinkIcon.js";import"../icon/icons/PlusIcon.js";import"../icon/icons/QuestionIcon.js";import"../icon/icons/RedCrossIcon.js";import"../icon/icons/SearchIcon.js";import"../icon/icons/SuccessIcon.js";import"../icon/icons/WarningIcon.js";import"../icon/icons/MinusIcon.js";import"../icon/icons/ThumbDownIcon.js";import"../icon/icons/ThumbUpIcon.js";import"../icon/icons/TrashCanIcon.js";import"../icon/icons/PenIcon.js";import{InputGroup as s}from"../input-group/InputGroup.js";import{BaseTextInput as c}from"./BaseTextInput.js";const r=n(((n,r)=>{const{label:t,className:p,density:e,errorLabel:m,helpLabel:a,inline:j,inputClassName:l,labelProps:I,supportLabelProps:u,tooltipProps:d,...h}=n;return o(s,{label:t,density:e,errorLabel:m,helpLabel:a,labelProps:I,inline:j,supportLabelProps:u,tooltipProps:d,className:i(p,"jkl-text-input",{"jkl-text-input--inline":j}),"data-testid":"jkl-text-input",density:j?"compact":e,children:o(c,{ref:r,...h,className:l})})}));r.displayName="TextInput";export{r as TextInput};
2
2
  //# sourceMappingURL=TextInput.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"TextInput.js","sources":["../../../../src/components/text-input/TextInput.tsx"],"sourcesContent":["import cn from \"classnames\";\nimport React, { forwardRef } from \"react\";\nimport { InputGroup, InputGroupProps } from \"../input-group\";\nimport { BaseTextInput, BaseTextInputProps } from \"./BaseTextInput\";\n\nexport interface TextInputProps extends Omit<InputGroupProps, \"children\">, BaseTextInputProps {\n \"data-testautoid\"?: string;\n inline?: boolean;\n inputClassName?: string;\n}\n\nexport const TextInput = forwardRef<HTMLInputElement, TextInputProps>((props, ref) => {\n const {\n label,\n className,\n density,\n errorLabel,\n helpLabel,\n inline,\n inputClassName,\n labelProps,\n supportLabelProps,\n tooltipProps,\n ...rest\n } = props;\n const inputGroupProps = {\n label,\n density,\n errorLabel,\n helpLabel,\n labelProps,\n inline,\n supportLabelProps,\n tooltipProps,\n };\n return (\n <InputGroup\n {...inputGroupProps}\n className={cn(className, \"jkl-text-input\", {\n \"jkl-text-input--inline\": inline,\n })}\n data-testid=\"jkl-text-input\"\n density={inline ? \"compact\" : density}\n >\n <BaseTextInput ref={ref} {...rest} className={inputClassName} />\n </InputGroup>\n );\n});\n\nTextInput.displayName = \"TextInput\";\n"],"names":["TextInput","forwardRef","props","ref","label","className","density","errorLabel","helpLabel","inline","inputClassName","labelProps","supportLabelProps","tooltipProps","rest","jsx","InputGroup","cn","children","BaseTextInput","displayName"],"mappings":"2sDAWO,MAAMA,EAAYC,GAA6C,CAACC,EAAOC,KACpE,MACFC,MAAAA,EACAC,UAAAA,EACAC,QAAAA,EACAC,WAAAA,EACAC,UAAAA,EACAC,OAAAA,EACAC,eAAAA,EACAC,WAAAA,EACAC,kBAAAA,EACAC,aAAAA,KACGC,GACHZ,EAYA,OAAAa,EAACC,EAAA,CAVDZ,MAAAA,EACAE,QAAAA,EACAC,WAAAA,EACAC,UAAAA,EACAG,WAAAA,EACAF,OAAAA,EACAG,kBAAAA,EACAC,aAAAA,EAKIR,UAAWY,EAAGZ,EAAW,iBAAkB,CACvC,yBAA0BI,IAE9B,cAAY,iBACZH,QAASG,EAAS,UAAYH,EAE9BY,WAACC,EAAc,CAAAhB,IAAAA,KAAcW,EAAMT,UAAWK,KAAgB,IAK1EV,EAAUoB,YAAc"}
1
+ {"version":3,"file":"TextInput.js","sources":["../../../../src/components/text-input/TextInput.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport React, { forwardRef } from \"react\";\nimport { InputGroup, InputGroupProps } from \"../input-group\";\nimport { BaseTextInput, BaseTextInputProps } from \"./BaseTextInput\";\n\nexport interface TextInputProps extends Omit<InputGroupProps, \"children\">, BaseTextInputProps {\n \"data-testautoid\"?: string;\n inline?: boolean;\n inputClassName?: string;\n}\n\nexport const TextInput = forwardRef<HTMLInputElement, TextInputProps>((props, ref) => {\n const {\n label,\n className,\n density,\n errorLabel,\n helpLabel,\n inline,\n inputClassName,\n labelProps,\n supportLabelProps,\n tooltipProps,\n ...rest\n } = props;\n const inputGroupProps = {\n label,\n density,\n errorLabel,\n helpLabel,\n labelProps,\n inline,\n supportLabelProps,\n tooltipProps,\n };\n return (\n <InputGroup\n {...inputGroupProps}\n className={clsx(className, \"jkl-text-input\", {\n \"jkl-text-input--inline\": inline,\n })}\n data-testid=\"jkl-text-input\"\n density={inline ? \"compact\" : density}\n >\n <BaseTextInput ref={ref} {...rest} className={inputClassName} />\n </InputGroup>\n );\n});\n\nTextInput.displayName = \"TextInput\";\n"],"names":["TextInput","forwardRef","props","ref","label","className","density","errorLabel","helpLabel","inline","inputClassName","labelProps","supportLabelProps","tooltipProps","rest","jsx","InputGroup","clsx","children","BaseTextInput","displayName"],"mappings":"+tDAWO,MAAMA,EAAYC,GAA6C,CAACC,EAAOC,KACpE,MACFC,MAAAA,EACAC,UAAAA,EACAC,QAAAA,EACAC,WAAAA,EACAC,UAAAA,EACAC,OAAAA,EACAC,eAAAA,EACAC,WAAAA,EACAC,kBAAAA,EACAC,aAAAA,KACGC,GACHZ,EAYA,OAAAa,EAACC,EAAA,CAVDZ,MAAAA,EACAE,QAAAA,EACAC,WAAAA,EACAC,UAAAA,EACAG,WAAAA,EACAF,OAAAA,EACAG,kBAAAA,EACAC,aAAAA,EAKIR,UAAWY,EAAKZ,EAAW,iBAAkB,CACzC,yBAA0BI,IAE9B,cAAY,iBACZH,QAASG,EAAS,UAAYH,EAE9BY,WAACC,EAAc,CAAAhB,IAAAA,KAAcW,EAAMT,UAAWK,KAAgB,IAK1EV,EAAUoB,YAAc"}