@fremtind/jokul 0.8.1 → 0.9.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 (277) hide show
  1. package/build/NativeSelect-DOSP8-ZQ.js +2 -0
  2. package/build/NativeSelect-DOSP8-ZQ.js.map +1 -0
  3. package/build/NativeSelect-gBndJVSb.cjs +2 -0
  4. package/build/NativeSelect-gBndJVSb.cjs.map +1 -0
  5. package/build/build-stats.html +1 -1
  6. package/build/cjs/components/accordion/Accordion.js +2 -0
  7. package/build/cjs/components/accordion/Accordion.js.map +1 -0
  8. package/build/cjs/components/accordion/AccordionItem.js +2 -0
  9. package/build/cjs/components/accordion/AccordionItem.js.map +1 -0
  10. package/build/cjs/components/accordion/index.js +2 -0
  11. package/build/cjs/components/accordion/index.js.map +1 -0
  12. package/build/cjs/components/breadcrumb/Breadcrumb.js +2 -0
  13. package/build/cjs/components/breadcrumb/Breadcrumb.js.map +1 -0
  14. package/build/cjs/components/breadcrumb/BreadcrumbItem.js +2 -0
  15. package/build/cjs/components/breadcrumb/BreadcrumbItem.js.map +1 -0
  16. package/build/cjs/components/breadcrumb/index.js +2 -0
  17. package/build/cjs/components/breadcrumb/index.js.map +1 -0
  18. package/build/cjs/components/button/Button.js +2 -0
  19. package/build/cjs/components/button/Button.js.map +1 -0
  20. package/build/cjs/components/button/index.js +2 -0
  21. package/build/cjs/components/button/index.js.map +1 -0
  22. package/build/cjs/components/button/types.js +2 -0
  23. package/build/cjs/components/button/types.js.map +1 -0
  24. package/build/cjs/components/checkbox/Checkbox.js +2 -0
  25. package/build/cjs/components/checkbox/Checkbox.js.map +1 -0
  26. package/build/cjs/components/checkbox/index.js +2 -0
  27. package/build/cjs/components/checkbox/index.js.map +1 -0
  28. package/build/cjs/components/combobox/Combobox.js +2 -0
  29. package/build/cjs/components/combobox/Combobox.js.map +1 -0
  30. package/build/cjs/components/combobox/index.js +2 -0
  31. package/build/cjs/components/combobox/index.js.map +1 -0
  32. package/build/cjs/components/cookie-consent/CookieConsent.js +2 -0
  33. package/build/cjs/components/cookie-consent/CookieConsent.js.map +1 -0
  34. package/build/cjs/components/cookie-consent/CookieConsentContext.js +2 -0
  35. package/build/cjs/components/cookie-consent/CookieConsentContext.js.map +1 -0
  36. package/build/cjs/components/cookie-consent/CookieConsentModal.js +2 -0
  37. package/build/cjs/components/cookie-consent/CookieConsentModal.js.map +1 -0
  38. package/build/cjs/components/cookie-consent/consents/CustomConsents.js +2 -0
  39. package/build/cjs/components/cookie-consent/consents/CustomConsents.js.map +1 -0
  40. package/build/cjs/components/cookie-consent/consents/DefaultConsents.js +2 -0
  41. package/build/cjs/components/cookie-consent/consents/DefaultConsents.js.map +1 -0
  42. package/build/cjs/components/cookie-consent/consents/RequirementCheckbox.js +2 -0
  43. package/build/cjs/components/cookie-consent/consents/RequirementCheckbox.js.map +1 -0
  44. package/build/cjs/components/cookie-consent/cookieConsentUtils.js +2 -0
  45. package/build/cjs/components/cookie-consent/cookieConsentUtils.js.map +1 -0
  46. package/build/cjs/components/cookie-consent/index.js +2 -0
  47. package/build/cjs/components/cookie-consent/index.js.map +1 -0
  48. package/build/cjs/components/cookie-consent/types.js +2 -0
  49. package/build/cjs/components/cookie-consent/types.js.map +1 -0
  50. package/build/cjs/components/index.js +1 -1
  51. package/build/cjs/components/input-group/FieldGroup.js +1 -1
  52. package/build/cjs/components/input-group/FieldGroup.js.map +1 -1
  53. package/build/cjs/components/input-group/InputGroup.js +1 -1
  54. package/build/cjs/components/input-group/InputGroup.js.map +1 -1
  55. package/build/cjs/components/input-group/Label.js +1 -1
  56. package/build/cjs/components/input-group/Label.js.map +1 -1
  57. package/build/cjs/components/input-group/SupportLabel.js +1 -1
  58. package/build/cjs/components/input-group/SupportLabel.js.map +1 -1
  59. package/build/cjs/components/list/List.js +2 -0
  60. package/build/cjs/components/list/List.js.map +1 -0
  61. package/build/cjs/components/list/ListItem.js +2 -0
  62. package/build/cjs/components/list/ListItem.js.map +1 -0
  63. package/build/cjs/components/list/index.js +2 -0
  64. package/build/cjs/components/list/index.js.map +1 -0
  65. package/build/cjs/components/modal/Modal.js +2 -0
  66. package/build/cjs/components/modal/Modal.js.map +1 -0
  67. package/build/cjs/components/modal/index.js +2 -0
  68. package/build/cjs/components/modal/index.js.map +1 -0
  69. package/build/cjs/components/modal/useModal.js +2 -0
  70. package/build/cjs/components/modal/useModal.js.map +1 -0
  71. package/build/cjs/components/radio-button/BaseRadioButton.js +2 -0
  72. package/build/cjs/components/radio-button/BaseRadioButton.js.map +1 -0
  73. package/build/cjs/components/radio-button/RadioButton.js +2 -0
  74. package/build/cjs/components/radio-button/RadioButton.js.map +1 -0
  75. package/build/cjs/components/radio-button/RadioButtonGroup.js +2 -0
  76. package/build/cjs/components/radio-button/RadioButtonGroup.js.map +1 -0
  77. package/build/cjs/components/radio-button/index.js +2 -0
  78. package/build/cjs/components/radio-button/index.js.map +1 -0
  79. package/build/cjs/components/radio-button/radioGroupContext.js +2 -0
  80. package/build/cjs/components/radio-button/radioGroupContext.js.map +1 -0
  81. package/build/cjs/components/select/NativeSelect.js +2 -0
  82. package/build/cjs/components/select/NativeSelect.js.map +1 -0
  83. package/build/cjs/components/select/Select.js +2 -0
  84. package/build/cjs/components/select/Select.js.map +1 -0
  85. package/build/cjs/components/select/index.js +2 -0
  86. package/build/cjs/components/select/index.js.map +1 -0
  87. package/build/cjs/components/select/select-utils.js +2 -0
  88. package/build/cjs/components/select/select-utils.js.map +1 -0
  89. package/build/cjs/components/tag/Tag.js +1 -1
  90. package/build/cjs/components/tag/Tag.js.map +1 -1
  91. package/build/cjs/components/tooltip/PopupTip.js +1 -1
  92. package/build/cjs/components/tooltip/PopupTip.js.map +1 -1
  93. package/build/cjs/components/tooltip/TooltipContent.js +1 -1
  94. package/build/cjs/components/tooltip/TooltipContent.js.map +1 -1
  95. package/build/cjs/components/tooltip/TooltipTrigger.js +1 -1
  96. package/build/cjs/components/tooltip/TooltipTrigger.js.map +1 -1
  97. package/build/cjs/index.js +1 -1
  98. package/build/components/accordion/Accordion.d.ts +8 -0
  99. package/build/components/accordion/AccordionItem.d.ts +10 -0
  100. package/build/components/accordion/index.d.ts +4 -0
  101. package/build/components/breadcrumb/Breadcrumb.d.ts +6 -0
  102. package/build/components/breadcrumb/BreadcrumbItem.d.ts +10 -0
  103. package/build/components/breadcrumb/index.d.ts +4 -0
  104. package/build/components/button/Button.d.ts +7 -0
  105. package/build/components/button/index.d.ts +2 -0
  106. package/build/components/button/types.d.ts +19 -0
  107. package/build/components/checkbox/Checkbox.d.ts +17 -0
  108. package/build/components/checkbox/index.d.ts +2 -0
  109. package/build/components/combobox/Combobox.d.ts +39 -0
  110. package/build/components/combobox/index.d.ts +2 -0
  111. package/build/components/cookie-consent/CookieConsent.d.ts +6 -0
  112. package/build/components/cookie-consent/CookieConsentContext.d.ts +48 -0
  113. package/build/components/cookie-consent/CookieConsentModal.d.ts +3 -0
  114. package/build/components/cookie-consent/consents/CustomConsents.d.ts +9 -0
  115. package/build/components/cookie-consent/consents/DefaultConsents.d.ts +9 -0
  116. package/build/components/cookie-consent/consents/RequirementCheckbox.d.ts +9 -0
  117. package/build/components/cookie-consent/cookieConsentUtils.d.ts +23 -0
  118. package/build/components/cookie-consent/index.d.ts +5 -0
  119. package/build/components/cookie-consent/types.d.ts +12 -0
  120. package/build/components/index.d.ts +10 -0
  121. package/build/components/list/List.d.ts +8 -0
  122. package/build/components/list/ListItem.d.ts +8 -0
  123. package/build/components/list/index.d.ts +3 -0
  124. package/build/components/modal/Modal.d.ts +72 -0
  125. package/build/components/modal/index.d.ts +4 -0
  126. package/build/components/modal/useModal.d.ts +69 -0
  127. package/build/components/radio-button/BaseRadioButton.d.ts +10 -0
  128. package/build/components/radio-button/RadioButton.d.ts +15 -0
  129. package/build/components/radio-button/RadioButtonGroup.d.ts +24 -0
  130. package/build/components/radio-button/index.d.ts +6 -0
  131. package/build/components/radio-button/radioGroupContext.d.ts +16 -0
  132. package/build/components/select/NativeSelect.d.ts +19 -0
  133. package/build/components/select/Select.d.ts +53 -0
  134. package/build/components/select/index.d.ts +4 -0
  135. package/build/components/select/select-utils.d.ts +2 -0
  136. package/build/es/components/accordion/Accordion.js +2 -0
  137. package/build/es/components/accordion/Accordion.js.map +1 -0
  138. package/build/es/components/accordion/AccordionItem.js +2 -0
  139. package/build/es/components/accordion/AccordionItem.js.map +1 -0
  140. package/build/es/components/accordion/index.js +2 -0
  141. package/build/es/components/accordion/index.js.map +1 -0
  142. package/build/es/components/breadcrumb/Breadcrumb.js +2 -0
  143. package/build/es/components/breadcrumb/Breadcrumb.js.map +1 -0
  144. package/build/es/components/breadcrumb/BreadcrumbItem.js +2 -0
  145. package/build/es/components/breadcrumb/BreadcrumbItem.js.map +1 -0
  146. package/build/es/components/breadcrumb/index.js +2 -0
  147. package/build/es/components/breadcrumb/index.js.map +1 -0
  148. package/build/es/components/button/Button.js +2 -0
  149. package/build/es/components/button/Button.js.map +1 -0
  150. package/build/es/components/button/index.js +2 -0
  151. package/build/es/components/button/index.js.map +1 -0
  152. package/build/es/components/button/types.js +2 -0
  153. package/build/es/components/button/types.js.map +1 -0
  154. package/build/es/components/checkbox/Checkbox.js +2 -0
  155. package/build/es/components/checkbox/Checkbox.js.map +1 -0
  156. package/build/es/components/checkbox/index.js +2 -0
  157. package/build/es/components/checkbox/index.js.map +1 -0
  158. package/build/es/components/combobox/Combobox.js +2 -0
  159. package/build/es/components/combobox/Combobox.js.map +1 -0
  160. package/build/es/components/combobox/index.js +2 -0
  161. package/build/es/components/combobox/index.js.map +1 -0
  162. package/build/es/components/cookie-consent/CookieConsent.js +2 -0
  163. package/build/es/components/cookie-consent/CookieConsent.js.map +1 -0
  164. package/build/es/components/cookie-consent/CookieConsentContext.js +2 -0
  165. package/build/es/components/cookie-consent/CookieConsentContext.js.map +1 -0
  166. package/build/es/components/cookie-consent/CookieConsentModal.js +2 -0
  167. package/build/es/components/cookie-consent/CookieConsentModal.js.map +1 -0
  168. package/build/es/components/cookie-consent/consents/CustomConsents.js +2 -0
  169. package/build/es/components/cookie-consent/consents/CustomConsents.js.map +1 -0
  170. package/build/es/components/cookie-consent/consents/DefaultConsents.js +2 -0
  171. package/build/es/components/cookie-consent/consents/DefaultConsents.js.map +1 -0
  172. package/build/es/components/cookie-consent/consents/RequirementCheckbox.js +2 -0
  173. package/build/es/components/cookie-consent/consents/RequirementCheckbox.js.map +1 -0
  174. package/build/es/components/cookie-consent/cookieConsentUtils.js +2 -0
  175. package/build/es/components/cookie-consent/cookieConsentUtils.js.map +1 -0
  176. package/build/es/components/cookie-consent/index.js +2 -0
  177. package/build/es/components/cookie-consent/index.js.map +1 -0
  178. package/build/es/components/cookie-consent/types.js +2 -0
  179. package/build/es/components/cookie-consent/types.js.map +1 -0
  180. package/build/es/components/index.js +1 -1
  181. package/build/es/components/input-group/FieldGroup.js +1 -1
  182. package/build/es/components/input-group/FieldGroup.js.map +1 -1
  183. package/build/es/components/input-group/InputGroup.js +1 -1
  184. package/build/es/components/input-group/InputGroup.js.map +1 -1
  185. package/build/es/components/input-group/Label.js +1 -1
  186. package/build/es/components/input-group/Label.js.map +1 -1
  187. package/build/es/components/input-group/SupportLabel.js +1 -1
  188. package/build/es/components/input-group/SupportLabel.js.map +1 -1
  189. package/build/es/components/list/List.js +2 -0
  190. package/build/es/components/list/List.js.map +1 -0
  191. package/build/es/components/list/ListItem.js +2 -0
  192. package/build/es/components/list/ListItem.js.map +1 -0
  193. package/build/es/components/list/index.js +2 -0
  194. package/build/es/components/list/index.js.map +1 -0
  195. package/build/es/components/modal/Modal.js +2 -0
  196. package/build/es/components/modal/Modal.js.map +1 -0
  197. package/build/es/components/modal/index.js +2 -0
  198. package/build/es/components/modal/index.js.map +1 -0
  199. package/build/es/components/modal/useModal.js +2 -0
  200. package/build/es/components/modal/useModal.js.map +1 -0
  201. package/build/es/components/radio-button/BaseRadioButton.js +2 -0
  202. package/build/es/components/radio-button/BaseRadioButton.js.map +1 -0
  203. package/build/es/components/radio-button/RadioButton.js +2 -0
  204. package/build/es/components/radio-button/RadioButton.js.map +1 -0
  205. package/build/es/components/radio-button/RadioButtonGroup.js +2 -0
  206. package/build/es/components/radio-button/RadioButtonGroup.js.map +1 -0
  207. package/build/es/components/radio-button/index.js +2 -0
  208. package/build/es/components/radio-button/index.js.map +1 -0
  209. package/build/es/components/radio-button/radioGroupContext.js +2 -0
  210. package/build/es/components/radio-button/radioGroupContext.js.map +1 -0
  211. package/build/es/components/select/NativeSelect.js +2 -0
  212. package/build/es/components/select/NativeSelect.js.map +1 -0
  213. package/build/es/components/select/Select.js +2 -0
  214. package/build/es/components/select/Select.js.map +1 -0
  215. package/build/es/components/select/index.js +2 -0
  216. package/build/es/components/select/index.js.map +1 -0
  217. package/build/es/components/select/select-utils.js +2 -0
  218. package/build/es/components/select/select-utils.js.map +1 -0
  219. package/build/es/components/tag/Tag.js +1 -1
  220. package/build/es/components/tag/Tag.js.map +1 -1
  221. package/build/es/components/tooltip/PopupTip.js +1 -1
  222. package/build/es/components/tooltip/PopupTip.js.map +1 -1
  223. package/build/es/components/tooltip/TooltipContent.js +1 -1
  224. package/build/es/components/tooltip/TooltipContent.js.map +1 -1
  225. package/build/es/components/tooltip/TooltipTrigger.js +1 -1
  226. package/build/es/components/tooltip/TooltipTrigger.js.map +1 -1
  227. package/build/es/index.js +1 -1
  228. package/build/hooks/useAriaLiveRegion/useAriaLiveRegion.d.ts +1 -1
  229. package/package.json +26 -4
  230. package/src/components/accordion/styles/_index.scss +1 -0
  231. package/src/components/accordion/styles/accordion.css +166 -0
  232. package/src/components/accordion/styles/accordion.min.css +1 -0
  233. package/src/components/accordion/styles/accordion.scss +147 -0
  234. package/src/components/breadcrumb/styles/_index.scss +1 -0
  235. package/src/components/breadcrumb/styles/breadcrumb.css +29 -0
  236. package/src/components/breadcrumb/styles/breadcrumb.min.css +1 -0
  237. package/src/components/breadcrumb/styles/breadcrumb.scss +34 -0
  238. package/src/components/button/styles/_index.scss +1 -0
  239. package/src/components/button/styles/button.css +251 -0
  240. package/src/components/button/styles/button.min.css +1 -0
  241. package/src/components/button/styles/button.scss +294 -0
  242. package/src/components/checkbox/styles/_index.scss +1 -0
  243. package/src/components/checkbox/styles/checkbox.css +191 -0
  244. package/src/components/checkbox/styles/checkbox.min.css +1 -0
  245. package/src/components/checkbox/styles/checkbox.scss +229 -0
  246. package/src/components/combobox/styles/_index.scss +1 -0
  247. package/src/components/combobox/styles/combobox.css +337 -0
  248. package/src/components/combobox/styles/combobox.min.css +1 -0
  249. package/src/components/combobox/styles/combobox.scss +307 -0
  250. package/src/components/cookie-consent/styles/_index.scss +1 -0
  251. package/src/components/cookie-consent/styles/cookie-consent.css +94 -0
  252. package/src/components/cookie-consent/styles/cookie-consent.min.css +1 -0
  253. package/src/components/cookie-consent/styles/cookie-consent.scss +79 -0
  254. package/src/components/list/styles/_index.scss +1 -0
  255. package/src/components/list/styles/list.css +128 -0
  256. package/src/components/list/styles/list.min.css +1 -0
  257. package/src/components/list/styles/list.scss +166 -0
  258. package/src/components/loader/styles/loader.css +6 -6
  259. package/src/components/loader/styles/loader.min.css +1 -1
  260. package/src/components/loader/styles/skeleton-loader.css +5 -5
  261. package/src/components/loader/styles/skeleton-loader.min.css +1 -1
  262. package/src/components/modal/styles/_index.scss +1 -0
  263. package/src/components/modal/styles/modal.css +115 -0
  264. package/src/components/modal/styles/modal.min.css +1 -0
  265. package/src/components/modal/styles/modal.scss +100 -0
  266. package/src/components/radio-button/styles/_index.scss +1 -0
  267. package/src/components/radio-button/styles/radio-button.css +180 -0
  268. package/src/components/radio-button/styles/radio-button.min.css +1 -0
  269. package/src/components/radio-button/styles/radio-button.scss +201 -0
  270. package/src/components/select/styles/_index.scss +1 -0
  271. package/src/components/select/styles/select.css +350 -0
  272. package/src/components/select/styles/select.min.css +1 -0
  273. package/src/components/select/styles/select.scss +330 -0
  274. package/src/components/tooltip/styles/_index.scss +1 -0
  275. package/src/components/tooltip/styles/tooltip.css +136 -0
  276. package/src/components/tooltip/styles/tooltip.min.css +1 -0
  277. package/src/components/tooltip/styles/tooltip.scss +105 -0
@@ -1,2 +1,2 @@
1
- import{jsxs as e,jsx as o,Fragment as r}from"react/jsx-runtime";import t from"classnames";import"react";import"../../hooks/useScreen/useScreen.js";import{useId as s}from"../../hooks/useId/useId.js";import"../tooltip/Tooltip.js";import"../tooltip/TooltipContent.js";import"../tooltip/TooltipTrigger.js";import{PopupTip as i}from"../tooltip/PopupTip.js";import{Label as l}from"./Label.js";import{SupportLabel as p}from"./SupportLabel.js";const a=a=>{const{id:d,legend:n,labelProps:m,supportLabelProps:u,tooltipProps:c,className:j,children:b,helpLabel:f,errorLabel:h,density:g,"data-testautoid":y,...L}=a,T=s(d||"jkl-field-group",{generateSuffix:!d}),S=`${T}_support-label`,k=h||f,x=h?"error":f?"help":void 0,P=k?S:void 0;return e("fieldset",{id:T,className:t("jkl-field-group",j),"data-testautoid":y,...L,"aria-describedby":P,"data-density":g,children:[o("legend",{className:"jkl-field-group__legend",children:e(l,{...m,density:g,children:[!c&&n,c&&e(r,{children:[o("span",{style:{whiteSpace:"normal"},children:n})," ",o(i,{...c})]})]})}),b,(f||h)&&o(p,{...u,label:k,labelType:x,id:S,density:g})]})};export{a as FieldGroup};
1
+ import{jsxs as e,jsx as o,Fragment as r}from"react/jsx-runtime";import{c as t}from"../../../clsx-BeLtu-UY.js";import"react";import"../../hooks/useScreen/useScreen.js";import{useId as s}from"../../hooks/useId/useId.js";import"../tooltip/Tooltip.js";import"../tooltip/TooltipContent.js";import"../tooltip/TooltipTrigger.js";import{PopupTip as i}from"../tooltip/PopupTip.js";import{Label as l}from"./Label.js";import{SupportLabel as p}from"./SupportLabel.js";const a=a=>{const{id:d,legend:n,labelProps:m,supportLabelProps:u,tooltipProps:c,className:j,children:b,helpLabel:f,errorLabel:h,density:g,"data-testautoid":y,...L}=a,T=s(d||"jkl-field-group",{generateSuffix:!d}),x=`${T}_support-label`,S=h||f,k=h?"error":f?"help":void 0,P=S?x:void 0;return e("fieldset",{id:T,className:t("jkl-field-group",j),"data-testautoid":y,...L,"aria-describedby":P,"data-density":g,children:[o("legend",{className:"jkl-field-group__legend",children:e(l,{...m,density:g,children:[!c&&n,c&&e(r,{children:[o("span",{style:{whiteSpace:"normal"},children:n})," ",o(i,{...c})]})]})}),b,(f||h)&&o(p,{...u,label:S,labelType:k,id:x,density:g})]})};export{a as FieldGroup};
2
2
  //# sourceMappingURL=FieldGroup.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"FieldGroup.js","sources":["../../../../src/components/input-group/FieldGroup.tsx"],"sourcesContent":["import cn from \"classnames\";\nimport React, { FC, FieldsetHTMLAttributes } from \"react\";\nimport type { Density, DataTestAutoId } from \"../../core\";\nimport { useId } from \"../../hooks\";\nimport { PopupTip, type PopupTipProps } from \"../tooltip\";\nimport { Label, type LabelProps } from \"./Label\";\nimport { SupportLabel, type SupportLabelProps } from \"./SupportLabel\";\n\nexport interface FieldGroupProps extends DataTestAutoId, FieldsetHTMLAttributes<HTMLFieldSetElement> {\n legend: string;\n labelProps?: Omit<LabelProps, \"children\" | \"density\">;\n supportLabelProps?: Omit<SupportLabelProps, \"id\" | \"errorLabel\" | \"helpLabel\" | \"density\">;\n tooltipProps?: PopupTipProps;\n className?: string;\n helpLabel?: string;\n errorLabel?: string;\n density?: Density;\n}\n\nexport const FieldGroup: FC<FieldGroupProps> = (props) => {\n const {\n id,\n legend,\n labelProps,\n supportLabelProps,\n tooltipProps,\n className,\n children,\n helpLabel,\n errorLabel,\n density,\n \"data-testautoid\": testAutoId,\n ...rest\n } = props;\n\n const uid = useId(id || \"jkl-field-group\", { generateSuffix: !id });\n const supportId = `${uid}_support-label`;\n\n const supportText = errorLabel || helpLabel;\n const supportTextType = errorLabel ? \"error\" : helpLabel ? \"help\" : undefined;\n\n const describedBy = supportText ? supportId : undefined;\n\n return (\n <fieldset\n id={uid}\n className={cn(\"jkl-field-group\", className)}\n data-testautoid={testAutoId}\n {...rest}\n aria-describedby={describedBy}\n data-density={density}\n >\n <legend className=\"jkl-field-group__legend\">\n <Label {...labelProps} density={density}>\n {!tooltipProps && legend}\n {tooltipProps && (\n <>\n <span style={{ whiteSpace: \"normal\" }}>{legend}</span>\n {`\\u00A0`}\n <PopupTip {...tooltipProps} />\n </>\n )}\n </Label>\n </legend>\n {children}\n {(helpLabel || errorLabel) && (\n <SupportLabel\n {...supportLabelProps}\n label={supportText}\n labelType={supportTextType}\n id={supportId}\n density={density}\n />\n )}\n </fieldset>\n );\n};\n"],"names":["FieldGroup","props","id","legend","labelProps","supportLabelProps","tooltipProps","className","children","helpLabel","errorLabel","density","testAutoId","rest","uid","useId","generateSuffix","supportId","supportText","supportTextType","describedBy","jsxs","cn","jsx","Label","Fragment","style","whiteSpace","PopupTip","SupportLabel","label","labelType"],"mappings":"obAmBa,MAAAA,EAAmCC,IACtC,MACFC,GAAAA,EACAC,OAAAA,EACAC,WAAAA,EACAC,kBAAAA,EACAC,aAAAA,EACAC,UAAAA,EACAC,SAAAA,EACAC,UAAAA,EACAC,WAAAA,EACAC,QAAAA,EACA,kBAAmBC,KAChBC,GACHZ,EAEEa,EAAMC,EAAMb,GAAM,kBAAmB,CAAEc,gBAAiBd,IACxDe,EAAY,GAAGH,kBAEfI,EAAcR,GAAcD,EAC5BU,EAAkBT,EAAa,QAAUD,EAAY,YAAS,EAE9DW,EAAcF,EAAcD,OAAY,EAG1C,OAAAI,EAAC,WAAA,CACGnB,GAAIY,EACJP,UAAWe,EAAG,kBAAmBf,GACjC,kBAAiBK,KACbC,EACJ,mBAAkBO,EAClB,eAAcT,EAEdH,SAAA,CAAAe,EAAC,UAAOhB,UAAU,0BACdC,WAACgB,EAAO,IAAGpB,EAAYO,QAAAA,EAClBH,SAAA,EAACF,GAAgBH,EACjBG,GAEOe,EAAAI,EAAA,CAAAjB,SAAA,CAAAe,EAAC,QAAKG,MAAO,CAAEC,WAAY,UAAanB,SAAOL,IAC9C,IACDoB,EAACK,EAAU,IAAGtB,YAK7BE,GACCC,GAAaC,IACXa,EAACM,EAAA,IACOxB,EACJyB,MAAOZ,EACPa,UAAWZ,EACXjB,GAAIe,EACJN,QAAAA,MACJ"}
1
+ {"version":3,"file":"FieldGroup.js","sources":["../../../../src/components/input-group/FieldGroup.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport React, { FC, FieldsetHTMLAttributes } from \"react\";\nimport type { Density, DataTestAutoId } from \"../../core\";\nimport { useId } from \"../../hooks\";\nimport { PopupTip, type PopupTipProps } from \"../tooltip\";\nimport { Label, type LabelProps } from \"./Label\";\nimport { SupportLabel, type SupportLabelProps } from \"./SupportLabel\";\n\nexport interface FieldGroupProps extends DataTestAutoId, FieldsetHTMLAttributes<HTMLFieldSetElement> {\n legend: string;\n labelProps?: Omit<LabelProps, \"children\" | \"density\">;\n supportLabelProps?: Omit<SupportLabelProps, \"id\" | \"errorLabel\" | \"helpLabel\" | \"density\">;\n tooltipProps?: PopupTipProps;\n className?: string;\n helpLabel?: string;\n errorLabel?: string;\n density?: Density;\n}\n\nexport const FieldGroup: FC<FieldGroupProps> = (props) => {\n const {\n id,\n legend,\n labelProps,\n supportLabelProps,\n tooltipProps,\n className,\n children,\n helpLabel,\n errorLabel,\n density,\n \"data-testautoid\": testAutoId,\n ...rest\n } = props;\n\n const uid = useId(id || \"jkl-field-group\", { generateSuffix: !id });\n const supportId = `${uid}_support-label`;\n\n const supportText = errorLabel || helpLabel;\n const supportTextType = errorLabel ? \"error\" : helpLabel ? \"help\" : undefined;\n\n const describedBy = supportText ? supportId : undefined;\n\n return (\n <fieldset\n id={uid}\n className={clsx(\"jkl-field-group\", className)}\n data-testautoid={testAutoId}\n {...rest}\n aria-describedby={describedBy}\n data-density={density}\n >\n <legend className=\"jkl-field-group__legend\">\n <Label {...labelProps} density={density}>\n {!tooltipProps && legend}\n {tooltipProps && (\n <>\n <span style={{ whiteSpace: \"normal\" }}>{legend}</span>\n {`\\u00A0`}\n <PopupTip {...tooltipProps} />\n </>\n )}\n </Label>\n </legend>\n {children}\n {(helpLabel || errorLabel) && (\n <SupportLabel\n {...supportLabelProps}\n label={supportText}\n labelType={supportTextType}\n id={supportId}\n density={density}\n />\n )}\n </fieldset>\n );\n};\n"],"names":["FieldGroup","props","id","legend","labelProps","supportLabelProps","tooltipProps","className","children","helpLabel","errorLabel","density","testAutoId","rest","uid","useId","generateSuffix","supportId","supportText","supportTextType","describedBy","jsxs","clsx","jsx","Label","Fragment","style","whiteSpace","PopupTip","SupportLabel","label","labelType"],"mappings":"wcAmBa,MAAAA,EAAmCC,IACtC,MACFC,GAAAA,EACAC,OAAAA,EACAC,WAAAA,EACAC,kBAAAA,EACAC,aAAAA,EACAC,UAAAA,EACAC,SAAAA,EACAC,UAAAA,EACAC,WAAAA,EACAC,QAAAA,EACA,kBAAmBC,KAChBC,GACHZ,EAEEa,EAAMC,EAAMb,GAAM,kBAAmB,CAAEc,gBAAiBd,IACxDe,EAAY,GAAGH,kBAEfI,EAAcR,GAAcD,EAC5BU,EAAkBT,EAAa,QAAUD,EAAY,YAAS,EAE9DW,EAAcF,EAAcD,OAAY,EAG1C,OAAAI,EAAC,WAAA,CACGnB,GAAIY,EACJP,UAAWe,EAAK,kBAAmBf,GACnC,kBAAiBK,KACbC,EACJ,mBAAkBO,EAClB,eAAcT,EAEdH,SAAA,CAAAe,EAAC,UAAOhB,UAAU,0BACdC,WAACgB,EAAO,IAAGpB,EAAYO,QAAAA,EAClBH,SAAA,EAACF,GAAgBH,EACjBG,GAEOe,EAAAI,EAAA,CAAAjB,SAAA,CAAAe,EAAC,QAAKG,MAAO,CAAEC,WAAY,UAAanB,SAAOL,IAC9C,IACDoB,EAACK,EAAU,IAAGtB,YAK7BE,GACCC,GAAaC,IACXa,EAACM,EAAA,IACOxB,EACJyB,MAAOZ,EACPa,UAAWZ,EACXjB,GAAIe,EACJN,QAAAA,MACJ"}
@@ -1,2 +1,2 @@
1
- import{jsxs as e,Fragment as r,jsx as o}from"react/jsx-runtime";import i from"classnames";import t,{forwardRef as l}from"react";import"../../hooks/useScreen/useScreen.js";import{useId as s}from"../../hooks/useId/useId.js";import"../tooltip/Tooltip.js";import"../tooltip/TooltipContent.js";import"../tooltip/TooltipTrigger.js";import{PopupTip as p}from"../tooltip/PopupTip.js";import{Label as a}from"./Label.js";import{SupportLabel as n}from"./SupportLabel.js";const d=l(((l,d)=>{const{className:m,children:u,density:c,errorLabel:j,helpLabel:b,inline:h,label:f,labelProps:y,render:v,supportLabelProps:L,tooltipProps:S,id:T,...g}=l,k=s(T||"jkl-input",{generateSuffix:!T}),x=s("jkl-support-label"),I=j||b,P=j?"error":b?"help":void 0,w={"aria-describedby":I?x:void 0,"aria-invalid":!!j||void 0,id:k},N=v?()=>v(w):()=>{const e=t.Children.toArray(l.children)[0];if(t.isValidElement(e))return t.cloneElement(e,{...w,...e.props})};return e("div",{ref:d,className:i(m,"jkl-input-group",{"jkl-input-group--inline":h}),"data-density":c,...g,children:[e(a,{standAlone:!0,htmlFor:k,srOnly:h,...y,style:{whiteSpace:S?"nowrap":void 0,...null==y?void 0:y.style},density:c,children:[!S&&f,S&&e(r,{children:[o("span",{style:{whiteSpace:"normal"},children:f})," ",o(p,{...S})]})]}),N(),o(n,{srOnly:h,...L,label:I,labelType:P,id:x,density:c})]})}));d.displayName="InputGroup";export{d as InputGroup};
1
+ import{jsxs as e,Fragment as r,jsx as o}from"react/jsx-runtime";import{c as i}from"../../../clsx-BeLtu-UY.js";import t,{forwardRef as l}from"react";import"../../hooks/useScreen/useScreen.js";import{useId as s}from"../../hooks/useId/useId.js";import"../tooltip/Tooltip.js";import"../tooltip/TooltipContent.js";import"../tooltip/TooltipTrigger.js";import{PopupTip as p}from"../tooltip/PopupTip.js";import{Label as a}from"./Label.js";import{SupportLabel as n}from"./SupportLabel.js";const d=l(((l,d)=>{const{className:m,children:u,density:c,errorLabel:j,helpLabel:b,inline:h,label:f,labelProps:y,render:v,supportLabelProps:L,tooltipProps:S,id:T,...g}=l,k=s(T||"jkl-input",{generateSuffix:!T}),x=s("jkl-support-label"),I=j||b,P=j?"error":b?"help":void 0,w={"aria-describedby":I?x:void 0,"aria-invalid":!!j||void 0,id:k},N=v?()=>v(w):()=>{const e=t.Children.toArray(l.children)[0];if(t.isValidElement(e))return t.cloneElement(e,{...w,...e.props})};return e("div",{ref:d,className:i(m,"jkl-input-group",{"jkl-input-group--inline":h}),"data-density":c,...g,children:[e(a,{standAlone:!0,htmlFor:k,srOnly:h,...y,style:{whiteSpace:S?"nowrap":void 0,...null==y?void 0:y.style},density:c,children:[!S&&f,S&&e(r,{children:[o("span",{style:{whiteSpace:"normal"},children:f})," ",o(p,{...S})]})]}),N(),o(n,{srOnly:h,...L,label:I,labelType:P,id:x,density:c})]})}));d.displayName="InputGroup";export{d as InputGroup};
2
2
  //# sourceMappingURL=InputGroup.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"InputGroup.js","sources":["../../../../src/components/input-group/InputGroup.tsx"],"sourcesContent":["import cn from \"classnames\";\nimport React, { forwardRef, type CSSProperties, type ReactNode } from \"react\";\nimport { type WithOptionalChildren, type Density, type DataTestAutoId } from \"../../core\";\nimport { useId } from \"../../hooks\";\nimport { PopupTip, type PopupTipProps } from \"../tooltip\";\nimport { Label, type LabelProps } from \"./Label\";\nimport { SupportLabel, type SupportLabelProps } from \"./SupportLabel\";\n\nexport interface InputProps {\n \"aria-describedby\"?: string;\n \"aria-invalid\"?: boolean;\n id?: string;\n}\n\nexport type InputGroupProps = WithOptionalChildren &\n DataTestAutoId & {\n id?: string;\n className?: string;\n \"data-testid\"?: string;\n density?: Density;\n errorLabel?: ReactNode;\n helpLabel?: ReactNode;\n inline?: boolean;\n label: ReactNode;\n labelProps?: Omit<LabelProps, \"children\" | \"density\">;\n supportLabelProps?: Omit<SupportLabelProps, \"id\" | \"errorLabel\" | \"helpLabel\" | \"density\">;\n tooltipProps?: PopupTipProps;\n style?: CSSProperties;\n render?: (props: InputProps) => JSX.Element;\n };\n\nexport const InputGroup = forwardRef<HTMLDivElement, InputGroupProps>((props, ref) => {\n const {\n className,\n children,\n density,\n errorLabel,\n helpLabel,\n inline,\n label,\n labelProps,\n render,\n supportLabelProps,\n tooltipProps,\n id,\n ...rest\n } = props;\n\n const uid = useId(id || \"jkl-input\", { generateSuffix: !id });\n const supportId = useId(\"jkl-support-label\");\n\n const supportText = errorLabel || helpLabel;\n const supportTextType = errorLabel ? \"error\" : helpLabel ? \"help\" : undefined;\n\n const describedBy = supportText ? supportId : undefined;\n\n const inputProps: InputProps = {\n \"aria-describedby\": describedBy,\n \"aria-invalid\": Boolean(errorLabel) ? true : undefined,\n id: uid,\n };\n\n const renderInput = render\n ? () => render(inputProps)\n : () => {\n const input = React.Children.toArray(props.children)[0];\n\n if (!React.isValidElement<InputProps>(input)) return;\n\n return React.cloneElement<InputProps>(input, {\n ...inputProps,\n ...input.props,\n });\n };\n\n return (\n <div\n ref={ref}\n className={cn(className, \"jkl-input-group\", {\n \"jkl-input-group--inline\": inline,\n })}\n data-density={density}\n {...rest}\n >\n <Label\n standAlone\n htmlFor={uid}\n srOnly={inline}\n {...labelProps}\n style={{ whiteSpace: tooltipProps ? \"nowrap\" : undefined, ...labelProps?.style }}\n density={density}\n >\n {!tooltipProps && label}\n {tooltipProps && (\n <>\n <span style={{ whiteSpace: \"normal\" }}>{label}</span>\n {`\\u00A0`}\n <PopupTip {...tooltipProps} />\n </>\n )}\n </Label>\n {renderInput()}\n <SupportLabel\n srOnly={inline}\n {...supportLabelProps}\n label={supportText}\n labelType={supportTextType}\n id={supportId}\n density={density}\n />\n </div>\n );\n});\n\nInputGroup.displayName = \"InputGroup\";\n"],"names":["InputGroup","forwardRef","props","ref","className","children","density","errorLabel","helpLabel","inline","label","labelProps","render","supportLabelProps","tooltipProps","id","rest","uid","useId","generateSuffix","supportId","supportText","supportTextType","inputProps","renderInput","input","React","Children","toArray","isValidElement","cloneElement","jsxs","cn","Label","standAlone","htmlFor","srOnly","style","whiteSpace","Fragment","jsx","PopupTip","SupportLabel","labelType","displayName"],"mappings":"4cA+BO,MAAMA,EAAaC,GAA4C,CAACC,EAAOC,KACpE,MACFC,UAAAA,EACAC,SAAAA,EACAC,QAAAA,EACAC,WAAAA,EACAC,UAAAA,EACAC,OAAAA,EACAC,MAAAA,EACAC,WAAAA,EACAC,OAAAA,EACAC,kBAAAA,EACAC,aAAAA,EACAC,GAAAA,KACGC,GACHd,EAEEe,EAAMC,EAAMH,GAAM,YAAa,CAAEI,gBAAiBJ,IAClDK,EAAYF,EAAM,qBAElBG,EAAcd,GAAcC,EAC5Bc,EAAkBf,EAAa,QAAUC,EAAY,YAAS,EAI9De,EAAyB,CAC3B,mBAHgBF,EAAcD,OAAY,EAI1C,iBAAwBb,QAAqB,EAC7CQ,GAAIE,GAGFO,EAAcZ,EACd,IAAMA,EAAOW,GACb,KACI,MAAME,EAAQC,EAAMC,SAASC,QAAQ1B,EAAMG,UAAU,GAEhDqB,GAAAA,EAAMG,eAA2BJ,GAE/BC,OAAAA,EAAMI,aAAyBL,EAAO,IACtCF,KACAE,EAAMvB,OACZ,EAIP,OAAA6B,EAAC,MAAA,CACG5B,IAAAA,EACAC,UAAW4B,EAAG5B,EAAW,kBAAmB,CACxC,0BAA2BK,IAE/B,eAAcH,KACVU,EAEJX,SAAA,CAAA0B,EAACE,EAAA,CACGC,YAAU,EACVC,QAASlB,EACTmB,OAAQ3B,KACJE,EACJ0B,MAAO,CAAEC,WAAYxB,EAAe,cAAW,KAAc,MAAAH,OAAAA,EAAAA,EAAY0B,OACzE/B,QAAAA,EAECD,SAAA,EAACS,GAAgBJ,EACjBI,GAEOiB,EAAAQ,EAAA,CAAAlC,SAAA,CAAAmC,EAAC,QAAKH,MAAO,CAAEC,WAAY,UAAajC,SAAMK,IAC7C,IACD8B,EAACC,EAAU,IAAG3B,UAIzBU,IACDgB,EAACE,EAAA,CACGN,OAAQ3B,KACJI,EACJH,MAAOW,EACPsB,UAAWrB,EACXP,GAAIK,EACJd,QAAAA,MACJ,IAKZN,EAAW4C,YAAc"}
1
+ {"version":3,"file":"InputGroup.js","sources":["../../../../src/components/input-group/InputGroup.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport React, { forwardRef, type CSSProperties, type ReactNode } from \"react\";\nimport { type WithOptionalChildren, type Density, type DataTestAutoId } from \"../../core\";\nimport { useId } from \"../../hooks\";\nimport { PopupTip, type PopupTipProps } from \"../tooltip\";\nimport { Label, type LabelProps } from \"./Label\";\nimport { SupportLabel, type SupportLabelProps } from \"./SupportLabel\";\n\nexport interface InputProps {\n \"aria-describedby\"?: string;\n \"aria-invalid\"?: boolean;\n id?: string;\n}\n\nexport type InputGroupProps = WithOptionalChildren &\n DataTestAutoId & {\n id?: string;\n className?: string;\n \"data-testid\"?: string;\n density?: Density;\n errorLabel?: ReactNode;\n helpLabel?: ReactNode;\n inline?: boolean;\n label: ReactNode;\n labelProps?: Omit<LabelProps, \"children\" | \"density\">;\n supportLabelProps?: Omit<SupportLabelProps, \"id\" | \"errorLabel\" | \"helpLabel\" | \"density\">;\n tooltipProps?: PopupTipProps;\n style?: CSSProperties;\n render?: (props: InputProps) => JSX.Element;\n };\n\nexport const InputGroup = forwardRef<HTMLDivElement, InputGroupProps>((props, ref) => {\n const {\n className,\n children,\n density,\n errorLabel,\n helpLabel,\n inline,\n label,\n labelProps,\n render,\n supportLabelProps,\n tooltipProps,\n id,\n ...rest\n } = props;\n\n const uid = useId(id || \"jkl-input\", { generateSuffix: !id });\n const supportId = useId(\"jkl-support-label\");\n\n const supportText = errorLabel || helpLabel;\n const supportTextType = errorLabel ? \"error\" : helpLabel ? \"help\" : undefined;\n\n const describedBy = supportText ? supportId : undefined;\n\n const inputProps: InputProps = {\n \"aria-describedby\": describedBy,\n \"aria-invalid\": Boolean(errorLabel) ? true : undefined,\n id: uid,\n };\n\n const renderInput = render\n ? () => render(inputProps)\n : () => {\n const input = React.Children.toArray(props.children)[0];\n\n if (!React.isValidElement<InputProps>(input)) return;\n\n return React.cloneElement<InputProps>(input, {\n ...inputProps,\n ...input.props,\n });\n };\n\n return (\n <div\n ref={ref}\n className={clsx(className, \"jkl-input-group\", {\n \"jkl-input-group--inline\": inline,\n })}\n data-density={density}\n {...rest}\n >\n <Label\n standAlone\n htmlFor={uid}\n srOnly={inline}\n {...labelProps}\n style={{ whiteSpace: tooltipProps ? \"nowrap\" : undefined, ...labelProps?.style }}\n density={density}\n >\n {!tooltipProps && label}\n {tooltipProps && (\n <>\n <span style={{ whiteSpace: \"normal\" }}>{label}</span>\n {`\\u00A0`}\n <PopupTip {...tooltipProps} />\n </>\n )}\n </Label>\n {renderInput()}\n <SupportLabel\n srOnly={inline}\n {...supportLabelProps}\n label={supportText}\n labelType={supportTextType}\n id={supportId}\n density={density}\n />\n </div>\n );\n});\n\nInputGroup.displayName = \"InputGroup\";\n"],"names":["InputGroup","forwardRef","props","ref","className","children","density","errorLabel","helpLabel","inline","label","labelProps","render","supportLabelProps","tooltipProps","id","rest","uid","useId","generateSuffix","supportId","supportText","supportTextType","inputProps","renderInput","input","React","Children","toArray","isValidElement","cloneElement","jsxs","clsx","Label","standAlone","htmlFor","srOnly","style","whiteSpace","Fragment","jsx","PopupTip","SupportLabel","labelType","displayName"],"mappings":"geA+BO,MAAMA,EAAaC,GAA4C,CAACC,EAAOC,KACpE,MACFC,UAAAA,EACAC,SAAAA,EACAC,QAAAA,EACAC,WAAAA,EACAC,UAAAA,EACAC,OAAAA,EACAC,MAAAA,EACAC,WAAAA,EACAC,OAAAA,EACAC,kBAAAA,EACAC,aAAAA,EACAC,GAAAA,KACGC,GACHd,EAEEe,EAAMC,EAAMH,GAAM,YAAa,CAAEI,gBAAiBJ,IAClDK,EAAYF,EAAM,qBAElBG,EAAcd,GAAcC,EAC5Bc,EAAkBf,EAAa,QAAUC,EAAY,YAAS,EAI9De,EAAyB,CAC3B,mBAHgBF,EAAcD,OAAY,EAI1C,iBAAwBb,QAAqB,EAC7CQ,GAAIE,GAGFO,EAAcZ,EACd,IAAMA,EAAOW,GACb,KACI,MAAME,EAAQC,EAAMC,SAASC,QAAQ1B,EAAMG,UAAU,GAEhDqB,GAAAA,EAAMG,eAA2BJ,GAE/BC,OAAAA,EAAMI,aAAyBL,EAAO,IACtCF,KACAE,EAAMvB,OACZ,EAIP,OAAA6B,EAAC,MAAA,CACG5B,IAAAA,EACAC,UAAW4B,EAAK5B,EAAW,kBAAmB,CAC1C,0BAA2BK,IAE/B,eAAcH,KACVU,EAEJX,SAAA,CAAA0B,EAACE,EAAA,CACGC,YAAU,EACVC,QAASlB,EACTmB,OAAQ3B,KACJE,EACJ0B,MAAO,CAAEC,WAAYxB,EAAe,cAAW,KAAc,MAAAH,OAAAA,EAAAA,EAAY0B,OACzE/B,QAAAA,EAECD,SAAA,EAACS,GAAgBJ,EACjBI,GAEOiB,EAAAQ,EAAA,CAAAlC,SAAA,CAAAmC,EAAC,QAAKH,MAAO,CAAEC,WAAY,UAAajC,SAAMK,IAC7C,IACD8B,EAACC,EAAU,IAAG3B,UAIzBU,IACDgB,EAACE,EAAA,CACGN,OAAQ3B,KACJI,EACJH,MAAOW,EACPsB,UAAWrB,EACXP,GAAIK,EACJd,QAAAA,MACJ,IAKZN,EAAW4C,YAAc"}
@@ -1,2 +1,2 @@
1
- import{jsx as e}from"react/jsx-runtime";import a from"classnames";const s=({variant:s="small",density:n,srOnly:t,children:l,standAlone:o,htmlFor:r,className:c="",...i})=>{const d=a("jkl-label",c,{[`jkl-label--${s}`]:s,"jkl-label--sr-only":t}),m=o?"label":"span";return!o&&r&&(r=void 0,"production"!==process.env.NODE_ENV&&console.warn("WARNING: The standard Label component renders as a <span> element, which does not take a htmlFor prop. If you want the Label to belong to a specific input, use the standAlone prop, which renders as a <label> element instead. In most cases the Label component should not be used directly, as it is part of all our input components.")),e(m,{...i,className:d,htmlFor:r,"data-density":n,children:l})};export{s as Label};
1
+ import{jsx as e}from"react/jsx-runtime";import{c as a}from"../../../clsx-BeLtu-UY.js";const s=({variant:s="small",density:n,srOnly:t,children:l,standAlone:o,htmlFor:r,className:c="",...i})=>{const d=a("jkl-label",c,{[`jkl-label--${s}`]:s,"jkl-label--sr-only":t}),p=o?"label":"span";return!o&&r&&(r=void 0,"production"!==process.env.NODE_ENV&&console.warn("WARNING: The standard Label component renders as a <span> element, which does not take a htmlFor prop. If you want the Label to belong to a specific input, use the standAlone prop, which renders as a <label> element instead. In most cases the Label component should not be used directly, as it is part of all our input components.")),e(p,{...i,className:d,htmlFor:r,"data-density":n,children:l})};export{s as Label};
2
2
  //# sourceMappingURL=Label.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Label.js","sources":["../../../../src/components/input-group/Label.tsx"],"sourcesContent":["import classNames from \"classnames\";\nimport React, { type CSSProperties, type FC } from \"react\";\nimport type { WithChildren, Density } from \"../../core\";\n\nexport type LabelVariant = \"small\" | \"medium\" | \"large\";\n\nexport interface LabelProps extends WithChildren {\n id?: string;\n variant?: LabelVariant;\n density?: Density;\n srOnly?: boolean;\n standAlone?: boolean;\n htmlFor?: string;\n className?: string;\n style?: CSSProperties;\n}\n\nexport const Label: FC<LabelProps> = ({\n variant = \"small\",\n density,\n srOnly,\n children,\n standAlone,\n htmlFor,\n className = \"\",\n ...rest\n}) => {\n const labelClassNames = classNames(\"jkl-label\", className, {\n [`jkl-label--${variant}`]: variant,\n \"jkl-label--sr-only\": srOnly,\n });\n\n const C = standAlone ? \"label\" : \"span\";\n\n if (!standAlone && htmlFor) {\n htmlFor = undefined;\n if (process.env.NODE_ENV !== \"production\") {\n console.warn(\n \"WARNING: The standard Label component renders as a <span> element, which does not take a htmlFor prop. If you want the Label to belong to a specific input, use the standAlone prop, which renders as a <label> element instead. In most cases the Label component should not be used directly, as it is part of all our input components.\",\n );\n }\n }\n\n return (\n <C {...rest} className={labelClassNames} htmlFor={htmlFor} data-density={density}>\n {children}\n </C>\n );\n};\n"],"names":["Label","variant","density","srOnly","children","standAlone","htmlFor","className","rest","labelClassNames","classNames","C","process","env","NODE_ENV","console","warn","jsx"],"mappings":"kEAiBO,MAAMA,EAAwB,EACjCC,QAAAA,EAAU,QACVC,QAAAA,EACAC,OAAAA,EACAC,SAAAA,EACAC,WAAAA,EACAC,QAAAA,EACAC,UAAAA,EAAY,MACTC,MAEGC,MAAAA,EAAkBC,EAAW,YAAaH,EAAW,CACvD,CAAC,cAAcN,KAAYA,EAC3B,qBAAsBE,IAGpBQ,EAAIN,EAAa,QAAU,OAE7B,OAACA,GAAcC,IACLA,OAAA,EACmB,eAAzBM,QAAQC,IAAIC,UACJC,QAAAC,KACJ,+UAMRC,EAACN,MAAMH,EAAMD,UAAWE,EAAiBH,QAAAA,EAAkB,eAAcJ,EACpEE,SAAAA,GACL"}
1
+ {"version":3,"file":"Label.js","sources":["../../../../src/components/input-group/Label.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport React, { type CSSProperties, type FC } from \"react\";\nimport type { WithChildren, Density } from \"../../core\";\n\nexport type LabelVariant = \"small\" | \"medium\" | \"large\";\n\nexport interface LabelProps extends WithChildren {\n id?: string;\n variant?: LabelVariant;\n density?: Density;\n srOnly?: boolean;\n standAlone?: boolean;\n htmlFor?: string;\n className?: string;\n style?: CSSProperties;\n}\n\nexport const Label: FC<LabelProps> = ({\n variant = \"small\",\n density,\n srOnly,\n children,\n standAlone,\n htmlFor,\n className = \"\",\n ...rest\n}) => {\n const labelClassNames = clsx(\"jkl-label\", className, {\n [`jkl-label--${variant}`]: variant,\n \"jkl-label--sr-only\": srOnly,\n });\n\n const C = standAlone ? \"label\" : \"span\";\n\n if (!standAlone && htmlFor) {\n htmlFor = undefined;\n if (process.env.NODE_ENV !== \"production\") {\n console.warn(\n \"WARNING: The standard Label component renders as a <span> element, which does not take a htmlFor prop. If you want the Label to belong to a specific input, use the standAlone prop, which renders as a <label> element instead. In most cases the Label component should not be used directly, as it is part of all our input components.\",\n );\n }\n }\n\n return (\n <C {...rest} className={labelClassNames} htmlFor={htmlFor} data-density={density}>\n {children}\n </C>\n );\n};\n"],"names":["Label","variant","density","srOnly","children","standAlone","htmlFor","className","rest","labelClassNames","clsx","C","process","env","NODE_ENV","console","warn","jsx"],"mappings":"sFAiBO,MAAMA,EAAwB,EACjCC,QAAAA,EAAU,QACVC,QAAAA,EACAC,OAAAA,EACAC,SAAAA,EACAC,WAAAA,EACAC,QAAAA,EACAC,UAAAA,EAAY,MACTC,MAEGC,MAAAA,EAAkBC,EAAK,YAAaH,EAAW,CACjD,CAAC,cAAcN,KAAYA,EAC3B,qBAAsBE,IAGpBQ,EAAIN,EAAa,QAAU,OAE7B,OAACA,GAAcC,IACLA,OAAA,EACmB,eAAzBM,QAAQC,IAAIC,UACJC,QAAAC,KACJ,+UAMRC,EAACN,MAAMH,EAAMD,UAAWE,EAAiBH,QAAAA,EAAkB,eAAcJ,EACpEE,SAAAA,GACL"}
@@ -1,2 +1,2 @@
1
- import{jsxs as o,jsx as n}from"react/jsx-runtime";import i from"classnames";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 c}from"../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{SuccessIcon as s}from"../icon/icons/SuccessIcon.js";import{WarningIcon as r}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";const t=({id:t,helpLabel:m,errorLabel:p,label:e,labelType:a="help",density:l,className:j,srOnly:I,...u})=>{const h=p||m||e,b="error"===a,d="success"===a,f=h?i("jkl-form-support-label",j,{"jkl-form-support-label--sr-only":I,"jkl-form-support-label--help":"help"===a||m&&!p,"jkl-form-support-label--error":b,"jkl-form-support-label--warning":"warning"===a||p,"jkl-form-support-label--success":d}):"jkl-dormant-form-support-label";return o("span",{id:t,className:f,...h?u:{},"data-density":l,children:[n(b?c:d?s:r,{variant:"small",className:"jkl-form-support-label__icon"}),n("span",{children:p||m||e})]})};export{t as SupportLabel};
1
+ import{jsxs as o,jsx as n}from"react/jsx-runtime";import{c as i}from"../../../clsx-BeLtu-UY.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 c}from"../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{SuccessIcon as s}from"../icon/icons/SuccessIcon.js";import{WarningIcon as r}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";const t=({id:t,helpLabel:p,errorLabel:m,label:e,labelType:a="help",density:l,className:j,srOnly:I,...u})=>{const h=m||p||e,b="error"===a,d="success"===a,f=h?i("jkl-form-support-label",j,{"jkl-form-support-label--sr-only":I,"jkl-form-support-label--help":"help"===a||p&&!m,"jkl-form-support-label--error":b,"jkl-form-support-label--warning":"warning"===a||m,"jkl-form-support-label--success":d}):"jkl-dormant-form-support-label";return o("span",{id:t,className:f,...h?u:{},"data-density":l,children:[n(b?c:d?s:r,{variant:"small",className:"jkl-form-support-label__icon"}),n("span",{children:m||p||e})]})};export{t as SupportLabel};
2
2
  //# sourceMappingURL=SupportLabel.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SupportLabel.js","sources":["../../../../src/components/input-group/SupportLabel.tsx"],"sourcesContent":["import cn from \"classnames\";\nimport React, { type FC, type ReactNode } from \"react\";\nimport { type Density } from \"../../core\";\nimport { ErrorIcon, SuccessIcon, WarningIcon } from \"../icon\";\n\nexport type SupportLabelType = \"help\" | \"error\" | \"warning\" | \"success\";\n\nexport interface SupportLabelProps {\n /**\n * En ID er påkrevd for å kunne referere til SupportLabel med aria-describedby.\n *\n * @example\n * ```tsx\n * const uid = useId();\n * const supportId = useId();\n * const hasSupportText = helpLabel || errorLabel;\n * const describedBy = hasSupportText ? supportId : undefined;\n *\n * return (\n * <div>\n * <Label standAlone htmlFor={uid}>\n * Velg en tekst\n * </Label>\n * <select\n * id={uid}\n * aria-describedby={describedBy}\n * >\n * <option value=\"e\">Example</option>\n * </select>\n * <SupportLabel\n * id={supportId}\n * label={errorLabel}\n * labelType=\"error\"\n * density={density}\n * />\n * </div>\n * );\n * ```\n */\n id: string;\n /**\n * @deprecated Bruk `label` for å få samme resultat.\n */\n helpLabel?: ReactNode;\n /**\n * @deprecated Bruk `label` og `labelType=\"warning\"` for å få samme resultat.\n */\n errorLabel?: ReactNode;\n label?: ReactNode;\n /**\n * Bestemmer hvilket ikon som skal vises:\n *\n * - \"help\" viser ikke noe ikon\n * - \"warning\" viser WarningIcon, det som tidligere ble vist med `errorLabel`\n * - \"error\" viser ErrorIcon\n * - \"success\" viser SuccessIcon\n *\n * @default \"help\"\n */\n labelType?: SupportLabelType;\n density?: Density;\n className?: string;\n srOnly?: boolean;\n}\n\nexport const SupportLabel: FC<SupportLabelProps> = ({\n id,\n helpLabel,\n errorLabel,\n label,\n labelType = \"help\",\n density,\n className,\n srOnly,\n ...rest\n}) => {\n const hasLabel = errorLabel || helpLabel || label;\n\n const isHelp = labelType === \"help\" || (helpLabel && !errorLabel);\n const isWarning = labelType === \"warning\" || errorLabel;\n const isError = labelType === \"error\";\n const isSuccess = labelType === \"success\";\n\n const componentClassName = hasLabel\n ? cn(\"jkl-form-support-label\", className, {\n \"jkl-form-support-label--sr-only\": srOnly,\n \"jkl-form-support-label--help\": isHelp,\n \"jkl-form-support-label--error\": isError,\n \"jkl-form-support-label--warning\": isWarning,\n \"jkl-form-support-label--success\": isSuccess,\n })\n : \"jkl-dormant-form-support-label\";\n\n const restProps = hasLabel ? rest : {};\n\n const Icon = isError ? ErrorIcon : isSuccess ? SuccessIcon : WarningIcon;\n\n return (\n <span id={id} className={componentClassName} {...restProps} data-density={density}>\n <Icon variant=\"small\" className=\"jkl-form-support-label__icon\" />\n <span>{errorLabel || helpLabel || label}</span>\n </span>\n );\n};\n"],"names":["SupportLabel","id","helpLabel","errorLabel","label","labelType","density","className","srOnly","rest","hasLabel","isError","isSuccess","componentClassName","cn","jsxs","children","jsx","ErrorIcon","SuccessIcon","WarningIcon","variant"],"mappings":"+8CAiEO,MAAMA,EAAsC,EAC/CC,GAAAA,EACAC,UAAAA,EACAC,WAAAA,EACAC,MAAAA,EACAC,UAAAA,EAAY,OACZC,QAAAA,EACAC,UAAAA,EACAC,OAAAA,KACGC,MAEGC,MAAAA,EAAWP,GAAcD,GAAaE,EAItCO,EAAwB,UAAdN,EACVO,EAA0B,YAAdP,EAEZQ,EAAqBH,EACrBI,EAAG,yBAA0BP,EAAW,CACpC,kCAAmCC,EACnC,+BARmB,SAAdH,GAAyBH,IAAcC,EAS5C,gCAAiCQ,EACjC,kCATsB,YAAdN,GAA2BF,EAUnC,kCAAmCS,IAEvC,iCAOF,OAAAG,EAAC,QAAKd,GAAAA,EAAQM,UAAWM,KALXH,EAAWD,EAAO,GAK4B,eAAcH,EACtEU,SAAA,CAAAC,EAJKN,EAAUO,EAAYN,EAAYO,EAAcC,EAI/C,CAAAC,QAAQ,QAAQd,UAAU,iCAC/BU,EAAA,OAAA,CAAMD,SAAcb,GAAAD,GAAaE,MACtC"}
1
+ {"version":3,"file":"SupportLabel.js","sources":["../../../../src/components/input-group/SupportLabel.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport React, { type FC, type ReactNode } from \"react\";\nimport { type Density } from \"../../core\";\nimport { ErrorIcon, SuccessIcon, WarningIcon } from \"../icon\";\n\nexport type SupportLabelType = \"help\" | \"error\" | \"warning\" | \"success\";\n\nexport interface SupportLabelProps {\n /**\n * En ID er påkrevd for å kunne referere til SupportLabel med aria-describedby.\n *\n * @example\n * ```tsx\n * const uid = useId();\n * const supportId = useId();\n * const hasSupportText = helpLabel || errorLabel;\n * const describedBy = hasSupportText ? supportId : undefined;\n *\n * return (\n * <div>\n * <Label standAlone htmlFor={uid}>\n * Velg en tekst\n * </Label>\n * <select\n * id={uid}\n * aria-describedby={describedBy}\n * >\n * <option value=\"e\">Example</option>\n * </select>\n * <SupportLabel\n * id={supportId}\n * label={errorLabel}\n * labelType=\"error\"\n * density={density}\n * />\n * </div>\n * );\n * ```\n */\n id: string;\n /**\n * @deprecated Bruk `label` for å få samme resultat.\n */\n helpLabel?: ReactNode;\n /**\n * @deprecated Bruk `label` og `labelType=\"warning\"` for å få samme resultat.\n */\n errorLabel?: ReactNode;\n label?: ReactNode;\n /**\n * Bestemmer hvilket ikon som skal vises:\n *\n * - \"help\" viser ikke noe ikon\n * - \"warning\" viser WarningIcon, det som tidligere ble vist med `errorLabel`\n * - \"error\" viser ErrorIcon\n * - \"success\" viser SuccessIcon\n *\n * @default \"help\"\n */\n labelType?: SupportLabelType;\n density?: Density;\n className?: string;\n srOnly?: boolean;\n}\n\nexport const SupportLabel: FC<SupportLabelProps> = ({\n id,\n helpLabel,\n errorLabel,\n label,\n labelType = \"help\",\n density,\n className,\n srOnly,\n ...rest\n}) => {\n const hasLabel = errorLabel || helpLabel || label;\n\n const isHelp = labelType === \"help\" || (helpLabel && !errorLabel);\n const isWarning = labelType === \"warning\" || errorLabel;\n const isError = labelType === \"error\";\n const isSuccess = labelType === \"success\";\n\n const componentClassName = hasLabel\n ? clsx(\"jkl-form-support-label\", className, {\n \"jkl-form-support-label--sr-only\": srOnly,\n \"jkl-form-support-label--help\": isHelp,\n \"jkl-form-support-label--error\": isError,\n \"jkl-form-support-label--warning\": isWarning,\n \"jkl-form-support-label--success\": isSuccess,\n })\n : \"jkl-dormant-form-support-label\";\n\n const restProps = hasLabel ? rest : {};\n\n const Icon = isError ? ErrorIcon : isSuccess ? SuccessIcon : WarningIcon;\n\n return (\n <span id={id} className={componentClassName} {...restProps} data-density={density}>\n <Icon variant=\"small\" className=\"jkl-form-support-label__icon\" />\n <span>{errorLabel || helpLabel || label}</span>\n </span>\n );\n};\n"],"names":["SupportLabel","id","helpLabel","errorLabel","label","labelType","density","className","srOnly","rest","hasLabel","isError","isSuccess","componentClassName","clsx","jsxs","children","jsx","ErrorIcon","SuccessIcon","WarningIcon","variant"],"mappings":"m+CAiEO,MAAMA,EAAsC,EAC/CC,GAAAA,EACAC,UAAAA,EACAC,WAAAA,EACAC,MAAAA,EACAC,UAAAA,EAAY,OACZC,QAAAA,EACAC,UAAAA,EACAC,OAAAA,KACGC,MAEGC,MAAAA,EAAWP,GAAcD,GAAaE,EAItCO,EAAwB,UAAdN,EACVO,EAA0B,YAAdP,EAEZQ,EAAqBH,EACrBI,EAAK,yBAA0BP,EAAW,CACtC,kCAAmCC,EACnC,+BARmB,SAAdH,GAAyBH,IAAcC,EAS5C,gCAAiCQ,EACjC,kCATsB,YAAdN,GAA2BF,EAUnC,kCAAmCS,IAEvC,iCAOF,OAAAG,EAAC,QAAKd,GAAAA,EAAQM,UAAWM,KALXH,EAAWD,EAAO,GAK4B,eAAcH,EACtEU,SAAA,CAAAC,EAJKN,EAAUO,EAAYN,EAAYO,EAAcC,EAI/C,CAAAC,QAAQ,QAAQd,UAAU,iCAC/BU,EAAA,OAAA,CAAMD,SAAcb,GAAAD,GAAaE,MACtC"}
@@ -0,0 +1,2 @@
1
+ import{jsx as e}from"react/jsx-runtime";import{c as r}from"../../../clsx-BeLtu-UY.js";function s(s){return({children:d,className:t,...i})=>e("ordered"===s?"ol":"ul",{className:r("jkl-list",t,{"jkl-list--ordered":"ordered"===s}),"data-testid":"jkl-list",...i,children:d})}const d=s("unordered");d.displayName="UnorderedList";const t=s("ordered");t.displayName="OrderedList";const i=d;i.displayName="List";export{i as List,t as OrderedList,d as UnorderedList};
2
+ //# sourceMappingURL=List.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"List.js","sources":["../../../../src/components/list/List.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport React, { FC } from \"react\";\nimport { WithChildren } from \"../..\";\n\nexport interface ListProps extends WithChildren {\n className?: string;\n}\n\ntype ValidLists = \"unordered\" | \"ordered\";\n\nfunction makeListComponent(listType: ValidLists): FC<ListProps> {\n const BaseList: FC<ListProps> = ({ children, className, ...rest }) => {\n const C = listType === \"ordered\" ? \"ol\" : \"ul\";\n\n return (\n <C\n className={clsx(\"jkl-list\", className, {\n \"jkl-list--ordered\": listType === \"ordered\",\n })}\n data-testid=\"jkl-list\"\n {...rest}\n >\n {children}\n </C>\n );\n };\n return BaseList;\n}\n\nexport const UnorderedList = makeListComponent(\"unordered\");\nUnorderedList.displayName = \"UnorderedList\";\nexport const OrderedList = makeListComponent(\"ordered\");\nOrderedList.displayName = \"OrderedList\";\nexport const List = UnorderedList;\nList.displayName = \"List\";\n"],"names":["makeListComponent","listType","children","className","rest","jsx","clsx","UnorderedList","displayName","OrderedList","List"],"mappings":"sFAUA,SAASA,EAAkBC,GACS,MAAA,EAAGC,SAAAA,EAAUC,UAAAA,KAAcC,KAInDC,EAHmB,YAAbJ,EAAyB,KAAO,KAGrC,CACGE,UAAWG,EAAK,WAAYH,EAAW,CACnC,oBAAkC,YAAbF,IAEzB,cAAY,cACRG,EAEHF,SAAAA,GAKjB,CAEa,MAAAK,EAAgBP,EAAkB,aAC/CO,EAAcC,YAAc,gBACf,MAAAC,EAAcT,EAAkB,WAC7CS,EAAYD,YAAc,cACnB,MAAME,EAAOH,EACpBG,EAAKF,YAAc"}
@@ -0,0 +1,2 @@
1
+ import{jsx as s}from"react/jsx-runtime";import{c as t}from"../../../clsx-BeLtu-UY.js";function e(e){return({className:i,children:c,...m})=>s("li",{className:t("jkl-list__item",i,{"jkl-list__item--iconed":"normal"!==e,"jkl-list__item--check":"check"===e,"jkl-list__item--cross":"cross"===e}),"data-testid":"jkl-list-item",...m,children:c})}const i=e("normal");i.displayName="ListItem";const c=e("cross");c.displayName="CrossListItem";const m=e("check");m.displayName="CheckListItem";export{m as CheckListItem,c as CrossListItem,i as ListItem};
2
+ //# sourceMappingURL=ListItem.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ListItem.js","sources":["../../../../src/components/list/ListItem.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport React, { FC } from \"react\";\nimport { WithChildren } from \"../..\";\n\nexport interface ListItemProps extends WithChildren {\n className?: string;\n}\n\ntype ValidListItems = \"normal\" | \"check\" | \"cross\";\n\nfunction makeListItem(listItemType: ValidListItems): FC<ListItemProps> {\n const ListItem: FC<ListItemProps> = ({ className, children, ...rest }) => {\n return (\n <li\n className={clsx(\"jkl-list__item\", className, {\n \"jkl-list__item--iconed\": listItemType !== \"normal\",\n \"jkl-list__item--check\": listItemType === \"check\",\n \"jkl-list__item--cross\": listItemType === \"cross\",\n })}\n data-testid=\"jkl-list-item\"\n {...rest}\n >\n {children}\n </li>\n );\n };\n return ListItem;\n}\n\nexport const ListItem = makeListItem(\"normal\");\nListItem.displayName = \"ListItem\";\nexport const CrossListItem = makeListItem(\"cross\");\nCrossListItem.displayName = \"CrossListItem\";\nexport const CheckListItem = makeListItem(\"check\");\nCheckListItem.displayName = \"CheckListItem\";\n"],"names":["makeListItem","listItemType","className","children","rest","jsx","clsx","ListItem","displayName","CrossListItem","CheckListItem"],"mappings":"sFAUA,SAASA,EAAaC,GACkB,MAAA,EAAGC,UAAAA,EAAWC,SAAAA,KAAaC,KAEvDC,EAAC,KAAA,CACGH,UAAWI,EAAK,iBAAkBJ,EAAW,CACzC,yBAA2C,WAAjBD,EAC1B,wBAA0C,UAAjBA,EACzB,wBAA0C,UAAjBA,IAE7B,cAAY,mBACRG,EAEHD,SAAAA,GAKjB,CAEa,MAAAI,EAAWP,EAAa,UACrCO,EAASC,YAAc,WACV,MAAAC,EAAgBT,EAAa,SAC1CS,EAAcD,YAAc,gBACf,MAAAE,EAAgBV,EAAa,SAC1CU,EAAcF,YAAc"}
@@ -0,0 +1,2 @@
1
+ import{List as s,OrderedList as t,UnorderedList as e}from"./List.js";import{CheckListItem as i,CrossListItem as r,ListItem as L}from"./ListItem.js";export{i as CheckListItem,r as CrossListItem,s as List,L as ListItem,t as OrderedList,e as UnorderedList};
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 o}from"react/jsx-runtime";import{c as n}from"../../../clsx-BeLtu-UY.js";import{forwardRef as s}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 i}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";import{IconButton as c}from"../icon-button/IconButton.js";const a=s((({className:s,...i},c)=>o("div",{className:n("jkl-modal-container",s),...i,ref:c})));a.displayName="ModalContainer";const r=s((({className:s,transparent:i,...c},a)=>o("div",{className:n("jkl-modal-overlay",s,{"jkl-modal-overlay--transparent":i}),...c,ref:a})));r.displayName="ModalOverlay";const t=s((({className:s,component:i,padding:c,style:a,...r},t)=>o(i||"div",{className:n("jkl jkl-modal",s),style:{"--jkl-modal-padding":c?`var(--jkl-spacing-${c})`:void 0,...a},...r,ref:t})));t.displayName="Modal";const e=s((({className:s,...i},c)=>o("div",{className:n("jkl-modal-header",s),...i,ref:c})));e.displayName="ModalHeader";const m=s((({className:s,...i},c)=>o("p",{className:n("jkl-modal-title",s),...i,ref:c})));m.displayName="ModalTitle";const l=s((({className:s,...a},r)=>o(c,{className:n("jkl-modal-close",s),"data-testautoid":"jkl-modal-close",...a,ref:r,children:o(i,{variant:"medium"})})));l.displayName="ModalCloseButton";const d=s((({className:s,...i},c)=>o("div",{className:n("jkl-modal-body",s),...i,ref:c})));d.displayName="ModalBody";const p=s((({className:s,...i},c)=>o("div",{className:n("jkl-modal-actions",s),...i,ref:c})));p.displayName="ModalActions";export{t as Modal,p as ModalActions,d as ModalBody,l as ModalCloseButton,a as ModalContainer,e as ModalHeader,r as ModalOverlay,m as ModalTitle};
2
+ //# sourceMappingURL=Modal.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Modal.js","sources":["../../../../src/components/modal/Modal.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport React, { forwardRef } from \"react\";\nimport type { WithOptionalChildren } from \"../..\";\nimport { CloseIcon } from \"../icon\";\nimport { IconButton, type IconButtonProps } from \"../icon-button\";\nimport { ModalConfig } from \"./useModal\";\n\nexport interface ModalProps extends WithOptionalChildren {\n id?: string;\n className?: string;\n component?: React.ElementType;\n style?: React.CSSProperties;\n /**\n * Overstyrer padding på modalen via en CSS-variabel.\n */\n padding?: 16 | 24 | 40;\n}\n\ntype BaseModalProps = Omit<ModalProps, \"padding\" | \"component\">;\n\n/**\n * Ment å brukes med `useModal`.\n */\nexport const ModalContainer = forwardRef<HTMLDivElement, ModalConfig[\"container\"] & BaseModalProps>(\n ({ className, ...rest }, ref) => {\n return <div className={clsx(\"jkl-modal-container\", className)} {...rest} ref={ref} />;\n },\n);\nModalContainer.displayName = \"ModalContainer\";\n\ntype ModalOverlayProps = ModalConfig[\"overlay\"] &\n BaseModalProps & {\n /**\n * Rendre uten bakgrunnsfarge, men med click target for å lukke modalen ved klikk utenfor.\n */\n transparent?: boolean;\n };\n\n/**\n * Ment å brukes med `useModal`.\n */\nexport const ModalOverlay = forwardRef<HTMLDivElement, ModalOverlayProps>(\n ({ className, transparent, ...rest }, ref) => (\n <div\n className={clsx(\"jkl-modal-overlay\", className, {\n \"jkl-modal-overlay--transparent\": transparent,\n })}\n {...rest}\n ref={ref}\n />\n ),\n);\nModalOverlay.displayName = \"ModalOverlay\";\n\n/**\n * Ment å brukes med `useModal`.\n */\nexport const Modal = forwardRef<HTMLElement, ModalConfig[\"modal\"] & ModalProps>(\n ({ className, component, padding, style, ...rest }, ref) => {\n const C = component || \"div\";\n return (\n <C\n className={clsx(\"jkl jkl-modal\", className)}\n style={\n {\n \"--jkl-modal-padding\": padding ? `var(--jkl-spacing-${padding})` : undefined,\n ...style,\n } as React.CSSProperties\n }\n {...rest}\n ref={ref}\n />\n );\n },\n);\nModal.displayName = \"Modal\";\n\n/**\n * Ment å brukes med `useModal`.\n */\nexport const ModalHeader = forwardRef<HTMLDivElement, BaseModalProps>(({ className, ...rest }, ref) => (\n <div className={clsx(\"jkl-modal-header\", className)} {...rest} ref={ref} />\n));\nModalHeader.displayName = \"ModalHeader\";\n\n/**\n * Ment å brukes med `useModal`.\n */\nexport const ModalTitle = forwardRef<HTMLParagraphElement, ModalConfig[\"title\"] & BaseModalProps>(\n ({ className, ...rest }, ref) => <p className={clsx(\"jkl-modal-title\", className)} {...rest} ref={ref} />,\n);\nModalTitle.displayName = \"ModalTitle\";\n\n/**\n * Ment å brukes med `useModal`.\n */\nexport const ModalCloseButton = forwardRef<\n HTMLButtonElement,\n Omit<ModalConfig[\"closeButton\"], \"onClick\"> & BaseModalProps & IconButtonProps\n>(({ className, ...rest }, ref) => (\n <IconButton className={clsx(\"jkl-modal-close\", className)} data-testautoid=\"jkl-modal-close\" {...rest} ref={ref}>\n <CloseIcon variant=\"medium\" />\n </IconButton>\n));\nModalCloseButton.displayName = \"ModalCloseButton\";\n\n/**\n * Ment å brukes med `useModal`.\n */\nexport const ModalBody = forwardRef<HTMLDivElement, BaseModalProps>(({ className, ...rest }, ref) => (\n <div className={clsx(\"jkl-modal-body\", className)} {...rest} ref={ref} />\n));\nModalBody.displayName = \"ModalBody\";\n\n/**\n * Ment å brukes med `useModal`.\n */\nexport const ModalActions = forwardRef<HTMLDivElement, BaseModalProps>(({ className, ...rest }, ref) => (\n <div className={clsx(\"jkl-modal-actions\", className)} {...rest} ref={ref} />\n));\nModalActions.displayName = \"ModalActions\";\n"],"names":["ModalContainer","forwardRef","className","rest","ref","jsx","clsx","displayName","ModalOverlay","transparent","Modal","component","padding","style","ModalHeader","ModalTitle","ModalCloseButton","IconButton","children","CloseIcon","variant","ModalBody","ModalActions"],"mappings":"0gDAuBO,MAAMA,EAAiBC,GAC1B,EAAGC,UAAAA,KAAcC,GAAQC,IACdC,EAAC,OAAIH,UAAWI,EAAK,sBAAuBJ,MAAgBC,EAAMC,IAAAA,MAGjFJ,EAAeO,YAAc,iBAatB,MAAMC,EAAeP,GACxB,EAAGC,UAAAA,EAAWO,YAAAA,KAAgBN,GAAQC,IAClCC,EAAC,MAAA,CACGH,UAAWI,EAAK,oBAAqBJ,EAAW,CAC5C,iCAAkCO,OAElCN,EACJC,IAAAA,MAIZI,EAAaD,YAAc,eAKpB,MAAMG,EAAQT,GACjB,EAAGC,UAAAA,EAAWS,UAAAA,EAAWC,QAAAA,EAASC,MAAAA,KAAUV,GAAQC,IAG5CC,EAFMM,GAAa,MAElB,CACGT,UAAWI,EAAK,gBAAiBJ,GACjCW,MACI,CACI,sBAAuBD,EAAU,qBAAqBA,UAAa,KAChEC,MAGPV,EACJC,IAAAA,MAKhBM,EAAMH,YAAc,QAKb,MAAMO,EAAcb,GAA2C,EAAGC,UAAAA,KAAcC,GAAQC,MAC1F,MAAI,CAAAF,UAAWI,EAAK,mBAAoBJ,MAAgBC,EAAMC,IAAAA,MAEnEU,EAAYP,YAAc,cAKnB,MAAMQ,EAAad,GACtB,EAAGC,UAAAA,KAAcC,GAAQC,IAAQC,EAAC,IAAE,CAAAH,UAAWI,EAAK,kBAAmBJ,MAAgBC,EAAMC,IAAAA,MAEjGW,EAAWR,YAAc,aAKZ,MAAAS,EAAmBf,GAG9B,EAAGC,UAAAA,KAAcC,GAAQC,IACtBC,EAAAY,EAAA,CAAWf,UAAWI,EAAK,kBAAmBJ,GAAY,kBAAgB,qBAAsBC,EAAMC,IAAAA,EACnGc,SAAAb,EAACc,EAAU,CAAAC,QAAQ,eAG3BJ,EAAiBT,YAAc,mBAKxB,MAAMc,EAAYpB,GAA2C,EAAGC,UAAAA,KAAcC,GAAQC,MACxF,MAAI,CAAAF,UAAWI,EAAK,iBAAkBJ,MAAgBC,EAAMC,IAAAA,MAEjEiB,EAAUd,YAAc,YAKjB,MAAMe,EAAerB,GAA2C,EAAGC,UAAAA,KAAcC,GAAQC,MAC3F,MAAI,CAAAF,UAAWI,EAAK,oBAAqBJ,MAAgBC,EAAMC,IAAAA,MAEpEkB,EAAaf,YAAc"}
@@ -0,0 +1,2 @@
1
+ import{Modal as a,ModalActions as o,ModalBody as s,ModalCloseButton as l,ModalContainer as d,ModalHeader as M,ModalOverlay as e,ModalTitle as t}from"./Modal.js";import{useModal as r}from"./useModal.js";export{a as Modal,o as ModalActions,s as ModalBody,l as ModalCloseButton,d as ModalContainer,M as ModalHeader,e as ModalOverlay,t as ModalTitle,r as useModal};
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ import{useA11yDialog as o}from"react-a11y-dialog";import"react";import"../../hooks/useScreen/useScreen.js";import{useId as e}from"../../hooks/useId/useId.js";function a(a){const{id:s,role:l="dialog",closeButtonLabel:r="Lukk",...t}=a,i=e(s||"jkl-modal",{generateSuffix:!s}),[u,d]=o({id:i,role:l,...t}),{dialog:n,...c}=d;return[u,{modal:d.dialog,...c,closeButton:{...d.closeButton,"aria-label":r}}]}export{a as useModal};
2
+ //# sourceMappingURL=useModal.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useModal.js","sources":["../../../../src/components/modal/useModal.ts"],"sourcesContent":["import { A11yDialogConfig, A11yDialogProps, useA11yDialog } from \"react-a11y-dialog\";\nimport { useId } from \"../../hooks\";\n\nexport interface UseModalOptions extends Omit<A11yDialogProps, \"id\" | \"closeButtonPosition\"> {\n id?: string;\n /**\n * @default \"Lukk\"\n */\n closeButtonLabel?: string;\n /**\n * Sett til `alertdialog` om du ønsker å slå av muligheten til å lukke med ESC og klikk utenfor.\n *\n * @default \"dialog\"\n */\n role?: \"dialog\" | \"alertdialog\";\n /**\n * Påkrevd for universell utforming. Tittelen kan gjenbrukes som `children` i `<ModalTitle>` med en konstant.\n */\n title: string;\n}\n\nexport type ModalInstance = ReturnType<typeof useModal>[0];\n\nexport interface ModalConfig extends Omit<A11yDialogConfig, \"dialog\"> {\n modal: A11yDialogConfig[\"dialog\"];\n closeButton: A11yDialogConfig[\"closeButton\"] & {\n \"aria-label\": string;\n };\n}\n\n/**\n * @example\n * ```jsx\n * const heading = \"Bekreft sletting\";\n * const [instance, { title, overlay, container, modal, closeButton }] = useModal({ title: heading });\n *\n * useEffect(() => {\n * if (!instance) {\n * return;\n * }\n * instance.show();\n * }, [instance]);\n *\n * return ReactDOM.createPortal(\n * <ModalContainer {...container}>\n * <ModalOverlay {...overlay} />\n * <Modal {...modal}>\n * <ModalHeader>\n * <ModalTitle {...title}>{heading}</ModalTitle>\n * <ModalCloseButton {...closeButton} />\n * </ModalHeader>\n * <ModalBody>\n * Er du sikker på at du vil slette Foo Bar Baz?\n * </ModalBody>\n * <ModalActions>\n * <PrimaryButton\n * onClick={() => {\n * // Do the thing\n * instance?.hide()\n * }}\n * >\n * Bekreft\n * </PrimaryButton>\n * <TertiaryButton onClick={() => instance?.hide()}>\n * Avbryt\n * </TertiaryButton>\n * </ModalActions>\n * </Modal>\n * </ModalContainer>,\n * document.body,\n * );\n * ```\n */\nexport function useModal(props: UseModalOptions) {\n const { id: idProp, role = \"dialog\", closeButtonLabel = \"Lukk\", ...rest } = props;\n\n const id = useId(idProp || \"jkl-modal\", { generateSuffix: !idProp });\n\n const [instance, config] = useA11yDialog({\n id,\n role,\n ...rest,\n });\n\n const { dialog, ...restConfig } = config;\n\n const modalConfig: ModalConfig = {\n modal: config.dialog,\n ...restConfig,\n closeButton: {\n ...config.closeButton,\n \"aria-label\": closeButtonLabel,\n },\n };\n\n return [instance, modalConfig] as const;\n}\n"],"names":["useModal","props","id","idProp","role","closeButtonLabel","rest","useId","generateSuffix","instance","config","useA11yDialog","dialog","restConfig","modal","closeButton"],"mappings":"8JAyEO,SAASA,EAASC,GACf,MAAEC,GAAIC,EAAQC,KAAAA,EAAO,SAAUC,iBAAAA,EAAmB,UAAWC,GAASL,EAEtEC,EAAKK,EAAMJ,GAAU,YAAa,CAAEK,gBAAiBL,KAEpDM,EAAUC,GAAUC,EAAc,CACrCT,GAAAA,EACAE,KAAAA,KACGE,KAGCM,OAAAA,KAAWC,GAAeH,EAW3B,MAAA,CAACD,EATyB,CAC7BK,MAAOJ,EAAOE,UACXC,EACHE,YAAa,IACNL,EAAOK,YACV,aAAcV,IAK1B"}
@@ -0,0 +1,2 @@
1
+ import{jsxs as a,jsx as e}from"react/jsx-runtime";import{c as t}from"../../../clsx-BeLtu-UY.js";import{forwardRef as o}from"react";import"../../hooks/useScreen/useScreen.js";import{useId as s}from"../../hooks/useId/useId.js";const i=o(((o,i)=>{const{id:n,className:r,checked:d,children:l,label:u,density:c,inline:m,invalid:j,name:b,value:k,onChange:h,...p}=o,_=s(n||"jkl-radio-button",{generateSuffix:!n});return a("div",{className:t("jkl-radio-button",r,{"jkl-radio-button--inline":m,"jkl-radio-button--error":j}),"data-density":c,children:[e("input",{name:b,ref:i,...p,id:_,className:"jkl-radio-button__input",type:"radio",onChange:h,value:k,checked:d}),a("label",{"data-testid":"jkl-radio-button__label-tag",htmlFor:_,className:"jkl-radio-button__label",children:[e("span",{"aria-hidden":!0,className:"jkl-radio-button__dot"}),e("span",{className:"jkl-radio-button__text",children:u||l})]})]})}));i.displayName="BaseRadioButton";export{i as BaseRadioButton};
2
+ //# sourceMappingURL=BaseRadioButton.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BaseRadioButton.js","sources":["../../../../src/components/radio-button/BaseRadioButton.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport React, { ChangeEventHandler, forwardRef } from \"react\";\nimport { Density } from \"../..\";\nimport { useId } from \"../../hooks\";\nimport { RadioButtonProps } from \"./RadioButton\";\n\nexport interface BaseRadioButtonProps extends RadioButtonProps {\n inline?: boolean;\n density?: Density;\n invalid?: boolean;\n onChange?: ChangeEventHandler<HTMLInputElement>;\n}\n\nexport const BaseRadioButton = forwardRef<HTMLInputElement, BaseRadioButtonProps>((props, ref) => {\n const { id, className, checked, children, label, density, inline, invalid, name, value, onChange, ...rest } = props;\n\n const inputId = useId(id || \"jkl-radio-button\", { generateSuffix: !id });\n\n return (\n <div\n className={clsx(\"jkl-radio-button\", className, {\n \"jkl-radio-button--inline\": inline,\n \"jkl-radio-button--error\": invalid,\n })}\n data-density={density}\n >\n <input\n name={name}\n ref={ref}\n {...rest}\n id={inputId}\n className=\"jkl-radio-button__input\"\n type=\"radio\"\n onChange={onChange}\n value={value}\n checked={checked}\n />\n <label data-testid=\"jkl-radio-button__label-tag\" htmlFor={inputId} className=\"jkl-radio-button__label\">\n <span aria-hidden className=\"jkl-radio-button__dot\" />\n <span className=\"jkl-radio-button__text\">{label || children}</span>\n </label>\n </div>\n );\n});\n\nBaseRadioButton.displayName = \"BaseRadioButton\";\n"],"names":["BaseRadioButton","forwardRef","props","ref","id","className","checked","children","label","density","inline","invalid","name","value","onChange","rest","inputId","useId","generateSuffix","jsxs","clsx","jsx","type","htmlFor","displayName"],"mappings":"iOAaO,MAAMA,EAAkBC,GAAmD,CAACC,EAAOC,KACtF,MAAQC,GAAAA,EAAIC,UAAAA,EAAWC,QAAAA,EAASC,SAAAA,EAAUC,MAAAA,EAAOC,QAAAA,EAASC,OAAAA,EAAQC,QAAAA,EAASC,KAAAA,EAAMC,MAAAA,EAAOC,SAAAA,KAAaC,GAASb,EAExGc,EAAUC,EAAMb,GAAM,mBAAoB,CAAEc,gBAAiBd,IAG/D,OAAAe,EAAC,MAAA,CACGd,UAAWe,EAAK,mBAAoBf,EAAW,CAC3C,2BAA4BK,EAC5B,0BAA2BC,IAE/B,eAAcF,EAEdF,SAAA,CAAAc,EAAC,QAAA,CACGT,KAAAA,EACAT,IAAAA,KACIY,EACJX,GAAIY,EACJX,UAAU,0BACViB,KAAK,QACLR,SAAAA,EACAD,MAAAA,EACAP,QAAAA,MAEH,QAAM,CAAA,cAAY,8BAA8BiB,QAASP,EAASX,UAAU,0BACzEE,SAAA,CAAAc,EAAC,OAAK,CAAA,eAAW,EAAChB,UAAU,0BAC3BgB,EAAA,OAAA,CAAKhB,UAAU,yBAA0BE,YAASA,SACvD,IAKZP,EAAgBwB,YAAc"}
@@ -0,0 +1,2 @@
1
+ import{jsxs as o,Fragment as i,jsx as n}from"react/jsx-runtime";import{forwardRef as s}from"react";import"../../hooks/useScreen/useScreen.js";import{useId as c}from"../../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{SupportLabel as r}from"../input-group/SupportLabel.js";import"../input-group/InputGroup.js";import{BaseRadioButton as t}from"./BaseRadioButton.js";import{useRadioGroupContext as p}from"./radioGroupContext.js";const e=s(((s,e)=>{const{checked:m,value:a,supportLabelProps:j,helpLabel:u,...I}=s,{value:l,density:d,...h}=p(),f=c("jkl-support-label");return o(i,{children:[n(t,{...h,...I,ref:e,checked:typeof m<"u"?m:typeof l<"u"?a===l:void 0,value:a,"aria-describedby":u?f:void 0}),n(r,{...j,label:u,labelType:"help",id:f,density:d})]})}));e.displayName="RadioButton";export{e as RadioButton};
2
+ //# sourceMappingURL=RadioButton.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RadioButton.js","sources":["../../../../src/components/radio-button/RadioButton.tsx"],"sourcesContent":["import React, { forwardRef, InputHTMLAttributes, ChangeEventHandler, ReactNode } from \"react\";\nimport { useId } from \"../../hooks\";\nimport { SupportLabel, SupportLabelProps } from \"../input-group\";\nimport { BaseRadioButton } from \"./BaseRadioButton\";\nimport { useRadioGroupContext } from \"./radioGroupContext\";\n\nexport interface RadioButtonProps extends Omit<InputHTMLAttributes<HTMLInputElement>, \"children\"> {\n children?: ReactNode;\n value: string;\n /** Kan også settes på RadioButtonGroup, men settes på RadioButton f. eks. av react-hook-form */\n name?: string;\n /** Kan også settes på RadioButtonGroup, men settes på RadioButton f. eks. av react-hook-form */\n onChange?: ChangeEventHandler<HTMLInputElement>;\n /** @deprecated Bruk children */\n label?: ReactNode;\n helpLabel?: ReactNode;\n supportLabelProps?: Omit<SupportLabelProps, \"id\" | \"errorLabel\" | \"helpLabel\" | \"density\">;\n}\n\nexport const RadioButton = forwardRef<HTMLInputElement, RadioButtonProps>((props, ref) => {\n const { checked, value, supportLabelProps, helpLabel, ...rest } = props;\n const { value: selectedValue, density, ...context } = useRadioGroupContext();\n const supportId = useId(\"jkl-support-label\");\n\n return (\n <>\n <BaseRadioButton\n {...context}\n {...rest}\n ref={ref}\n checked={\n typeof checked !== \"undefined\"\n ? checked\n : typeof selectedValue !== \"undefined\"\n ? value === selectedValue\n : undefined\n }\n value={value}\n aria-describedby={helpLabel ? supportId : undefined}\n />\n <SupportLabel\n {...supportLabelProps}\n label={helpLabel}\n labelType={\"help\"}\n id={supportId}\n density={density}\n />\n </>\n );\n});\n\nRadioButton.displayName = \"RadioButton\";\n"],"names":["RadioButton","forwardRef","props","ref","checked","value","supportLabelProps","helpLabel","rest","selectedValue","density","context","useRadioGroupContext","supportId","useId","jsxs","Fragment","children","jsx","BaseRadioButton","SupportLabel","label","labelType","id","displayName"],"mappings":"o0DAmBO,MAAMA,EAAcC,GAA+C,CAACC,EAAOC,KACxE,MAAEC,QAAAA,EAASC,MAAAA,EAAOC,kBAAAA,EAAmBC,UAAAA,KAAcC,GAASN,GAC1DG,MAAOI,EAAeC,QAAAA,KAAYC,GAAYC,IAChDC,EAAYC,EAAM,qBAExB,OAEQC,EAAAC,EAAA,CAAAC,SAAA,CAAAC,EAACC,EAAA,IACOR,KACAH,EACJL,IAAAA,EACAC,eACWA,EAAY,IACbA,SACOK,EAAkB,IACzBJ,IAAUI,OACV,EAEVJ,MAAAA,EACA,mBAAkBE,EAAYM,OAAY,IAE9CK,EAACE,EAAA,IACOd,EACJe,MAAOd,EACPe,UAAW,OACXC,GAAIV,EACJH,QAAAA,MAER,IAIRV,EAAYwB,YAAc"}
@@ -0,0 +1,2 @@
1
+ import{jsx as o}from"react/jsx-runtime";import{FieldGroup as n}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{RadioGroupContextProvider as i}from"./radioGroupContext.js";const c=c=>{const{name:r,value:s,onChange:t,errorLabel:p,inline:e=!1,density:m,labelProps:a={variant:"medium"},...j}=c;return o(i,{state:{onChange:t,value:s,name:r,invalid:!!p,inline:e,density:m},children:o(n,{errorLabel:p,labelProps:a,"data-testid":"jkl-radio-button-group",density:m,...j,role:"radiogroup","aria-invalid":!!p})})};export{c as RadioButtonGroup};
2
+ //# sourceMappingURL=RadioButtonGroup.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RadioButtonGroup.js","sources":["../../../../src/components/radio-button/RadioButtonGroup.tsx"],"sourcesContent":["import React, { ChangeEventHandler, FC } from \"react\";\nimport { Density } from \"../..\";\nimport { FieldGroup, type FieldGroupProps } from \"../input-group\";\nimport { RadioGroupContextProvider } from \"./radioGroupContext\";\n\nexport interface RadioButtonGroupProps extends Omit<FieldGroupProps, \"onChange\"> {\n legend: string;\n /** Alle RadioButton i gruppen får dette som name. */\n name?: string;\n /** Om gruppen skal være controlled setter du den valgte verdien her. */\n value?: string;\n onChange?: ChangeEventHandler<HTMLInputElement>;\n helpLabel?: string;\n /**\n * Erstatter hjelpeteksten (hvis noen) med en feilmelding.\n * Merker samtidig alle RadioButton i gruppen som ugyldige.\n */\n errorLabel?: string;\n /**\n * Setter inline-modifieren på alle RadioButton i gruppen.\n * @default false\n */\n inline?: boolean;\n density?: Density;\n}\n\nexport const RadioButtonGroup: FC<RadioButtonGroupProps> = (props) => {\n const {\n name,\n value,\n onChange,\n errorLabel,\n inline = false,\n density,\n labelProps = { variant: \"medium\" },\n ...rest\n } = props;\n\n return (\n <RadioGroupContextProvider\n state={{\n onChange,\n value,\n name,\n invalid: Boolean(errorLabel),\n inline,\n density,\n }}\n >\n <FieldGroup\n errorLabel={errorLabel}\n labelProps={labelProps}\n data-testid=\"jkl-radio-button-group\"\n density={density}\n {...rest}\n role=\"radiogroup\"\n aria-invalid={Boolean(errorLabel)}\n />\n </RadioGroupContextProvider>\n );\n};\n"],"names":["RadioButtonGroup","props","name","value","onChange","errorLabel","inline","density","labelProps","variant","rest","jsx","RadioGroupContextProvider","state","invalid","children","FieldGroup","role"],"mappings":"6gDA0Ba,MAAAA,EAA+CC,IAClD,MACFC,KAAAA,EACAC,MAAAA,EACAC,SAAAA,EACAC,WAAAA,EACAC,OAAAA,GAAS,EACTC,QAAAA,EACAC,WAAAA,EAAa,CAAEC,QAAS,aACrBC,GACHT,EAGA,OAAAU,EAACC,EAAA,CACGC,MAAO,CACHT,SAAAA,EACAD,MAAAA,EACAD,KAAAA,EACAY,UAAiBT,EACjBC,OAAAA,EACAC,QAAAA,GAGJQ,SAAAJ,EAACK,EAAA,CACGX,WAAAA,EACAG,WAAAA,EACA,cAAY,yBACZD,QAAAA,KACIG,EACJO,KAAK,aACL,iBAAsBZ,KAC1B"}
@@ -0,0 +1,2 @@
1
+ import{RadioButton as o}from"./RadioButton.js";import{RadioButtonGroup as t}from"./RadioButtonGroup.js";import{BaseRadioButton as a}from"./BaseRadioButton.js";export{a as BaseRadioButton,o as RadioButton,t as RadioButtonGroup};
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}from"react/jsx-runtime";import{createContext as o,useContext as t}from"react";const i=o({name:void 0,value:void 0,onChange:()=>{},inline:!1,density:void 0,invalid:!1}),r=()=>t(i),a=({state:o,children:t})=>e(i.Provider,{value:o,children:t});export{a as RadioGroupContextProvider,r as useRadioGroupContext};
2
+ //# sourceMappingURL=radioGroupContext.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"radioGroupContext.js","sources":["../../../../src/components/radio-button/radioGroupContext.tsx"],"sourcesContent":["import React, { createContext, useContext, ChangeEventHandler } from \"react\";\nimport { Density, WithChildren } from \"../..\";\n\ntype RadioGroupContext = {\n name: string | undefined;\n value: string | undefined;\n inline: boolean;\n density?: Density;\n invalid: boolean;\n onChange: ChangeEventHandler<HTMLInputElement> | undefined;\n};\n\nconst radioGroupContext = createContext<RadioGroupContext>({\n name: undefined,\n value: undefined,\n onChange: () => {\n return;\n },\n inline: false,\n density: undefined,\n invalid: false,\n});\n\nexport const useRadioGroupContext = (): RadioGroupContext => useContext(radioGroupContext);\n\ninterface Props extends WithChildren {\n state: RadioGroupContext;\n}\n\nexport const RadioGroupContextProvider: React.FC<Props> = ({ state, children }) => (\n <radioGroupContext.Provider value={state}>{children}</radioGroupContext.Provider>\n);\n"],"names":["radioGroupContext","createContext","name","value","onChange","inline","density","invalid","useRadioGroupContext","useContext","RadioGroupContextProvider","state","children","jsx","Provider"],"mappings":"8FAYA,MAAMA,EAAoBC,EAAiC,CACvDC,UAAM,EACNC,WAAO,EACPC,SAAU,OAGVC,QAAQ,EACRC,aAAS,EACTC,SAAS,IAGAC,EAAuB,IAAyBC,EAAWT,GAM3DU,EAA6C,EAAGC,MAAAA,EAAOC,SAAAA,KAC/DC,EAAAb,EAAkBc,SAAlB,CAA2BX,MAAOQ,EAAQC,SAAAA"}
@@ -0,0 +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"../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"../radio-button/RadioButton.js";import"../radio-button/radioGroupContext.js";import"../radio-button/BaseRadioButton.js";import{N as o}from"../../../NativeSelect-DOSP8-ZQ.js";import"../tag/Tag.js";import"../../utilities/polymorphism/SlotComponent.js";import"../../utilities/valuePair.js";export{o as NativeSelect};
2
+ //# sourceMappingURL=NativeSelect.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NativeSelect.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -0,0 +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"../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"../radio-button/RadioButton.js";import"../radio-button/radioGroupContext.js";import"../radio-button/BaseRadioButton.js";import{S as o}from"../../../NativeSelect-DOSP8-ZQ.js";import"../tag/Tag.js";import"../../utilities/polymorphism/SlotComponent.js";import"../../utilities/valuePair.js";import"./select-utils.js";export{o as Select};
2
+ //# sourceMappingURL=Select.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Select.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ import{N as e,S as t}from"../../../NativeSelect-DOSP8-ZQ.js";export{e as NativeSelect,t as Select};
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ function e(e=""){return e.toLowerCase().replace(/[\W_]+/g,"")}function o(e,o){let l=null;o&&(l=e.querySelector('[aria-selected="true"]:not([hidden])')),(!o||!l)&&(l=e.querySelector('[role="option"]')),null==l||l.focus(),e.scrollTop=(null==l?void 0:l.offsetTop)||0}export{o as focusSelected,e as toLower};
2
+ //# sourceMappingURL=select-utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"select-utils.js","sources":["../../../../src/components/select/select-utils.ts"],"sourcesContent":["export function toLower(str = \"\") {\n return str.toLowerCase().replace(/[\\W_]+/g, \"\"); // strip all non-alphanumeric chars\n}\n\nexport function focusSelected(listEl: HTMLElement, selected: string | undefined) {\n let focusedItem: HTMLElement | null = null;\n if (selected) {\n // Move focus to selected option\n focusedItem = listEl.querySelector(`[aria-selected=\"true\"]:not([hidden])`);\n }\n if (!selected || !focusedItem) {\n // Move focus to first option if either no selected value or the value could not be found.\n // This may happen with searchable selects if the currently selected value is filtered out.\n focusedItem = listEl.querySelector('[role=\"option\"]');\n }\n focusedItem?.focus();\n // Make sure the selected/focused item is visible in the list if it scrolls\n listEl.scrollTop = focusedItem?.offsetTop || 0;\n}\n"],"names":["toLower","str","toLowerCase","replace","focusSelected","listEl","selected","focusedItem","querySelector","focus","scrollTop","offsetTop"],"mappings":"AAAgB,SAAAA,EAAQC,EAAM,IAC1B,OAAOA,EAAIC,cAAcC,QAAQ,UAAW,GAChD,CAEgB,SAAAC,EAAcC,EAAqBC,GAC/C,IAAIC,EAAkC,KAClCD,IAEcC,EAAAF,EAAOG,cAAc,2CAElCF,IAAaC,KAGAA,EAAAF,EAAOG,cAAc,oBAEvC,MAAAD,GAAAA,EAAaE,QAENJ,EAAAK,WAAY,MAAAH,OAAAA,EAAAA,EAAaI,YAAa,CACjD"}
@@ -1,2 +1,2 @@
1
- import{jsxs as o,jsx as n}from"react/jsx-runtime";import i from"classnames";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";import{IconButton as s}from"../icon-button/IconButton.js";function r(r){const t=({className:t,density:a,dismissAction:e,children:m,...j})=>o("span",{className:i("jkl-tag",{"jkl-tag--info":"info"===r,"jkl-tag--error":"error"===r,"jkl-tag--warning":"warning"===r,"jkl-tag--success":"success"===r},t),"data-density":a,...j,children:[m,e&&n(s,{className:"jkl-tag__dismiss-action",density:a,title:e.label,onClick:e.onClick,onFocus:e.onFocus,onBlur:e.onBlur,children:n(c,{variant:"small",bold:!0})})]});return t.displayName=function(o){switch(o){case"info":return"InfoTag";case"error":return"ErrorTag";case"warning":return"WarningTag";case"success":return"SuccessTag";default:return"Tag"}}(r),t}const t=r(),a=r("info"),e=r("error"),m=r("warning"),j=r("success");export{e as ErrorTag,a as InfoTag,j as SuccessTag,t as Tag,m as WarningTag};
1
+ import{jsxs as o,jsx as n}from"react/jsx-runtime";import{c as i}from"../../../clsx-BeLtu-UY.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{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";import{IconButton as s}from"../icon-button/IconButton.js";function r(r){const t=({className:t,density:a,dismissAction:e,children:m,...j})=>o("span",{className:i("jkl-tag",{"jkl-tag--info":"info"===r,"jkl-tag--error":"error"===r,"jkl-tag--warning":"warning"===r,"jkl-tag--success":"success"===r},t),"data-density":a,...j,children:[m,e&&n(s,{className:"jkl-tag__dismiss-action",density:a,title:e.label,onClick:e.onClick,onFocus:e.onFocus,onBlur:e.onBlur,children:n(c,{variant:"small",bold:!0})})]});return t.displayName=function(o){switch(o){case"info":return"InfoTag";case"error":return"ErrorTag";case"warning":return"WarningTag";case"success":return"SuccessTag";default:return"Tag"}}(r),t}const t=r(),a=r("info"),e=r("error"),m=r("warning"),j=r("success");export{e as ErrorTag,a as InfoTag,j as SuccessTag,t as Tag,m as WarningTag};
2
2
  //# sourceMappingURL=Tag.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Tag.js","sources":["../../../../src/components/tag/Tag.tsx"],"sourcesContent":["import cx from \"classnames\";\nimport React, { ButtonHTMLAttributes, FC, HTMLAttributes, MouseEventHandler } from \"react\";\nimport { Density } from \"../../core\";\nimport { CloseIcon } from \"../icon\";\nimport { IconButton } from \"../icon-button\";\n\nexport interface DismissAction extends Exclude<ButtonHTMLAttributes<HTMLButtonElement>, \"disabled\"> {\n label: string;\n onClick: MouseEventHandler<HTMLButtonElement>;\n}\n\nexport interface TagProps extends HTMLAttributes<HTMLSpanElement> {\n density?: Density;\n dismissAction?: DismissAction;\n}\n\ntype Variant = \"info\" | \"error\" | \"warning\" | \"success\";\n\nfunction getDisplayName(variant?: Variant) {\n switch (variant) {\n case \"info\":\n return \"InfoTag\";\n case \"error\":\n return \"ErrorTag\";\n case \"warning\":\n return \"WarningTag\";\n case \"success\":\n return \"SuccessTag\";\n default:\n return \"Tag\";\n }\n}\n\nfunction tagFactory(variant?: Variant) {\n const Tag: FC<TagProps> = ({ className, density, dismissAction, children, ...rest }) => (\n <span\n className={cx(\n \"jkl-tag\",\n {\n \"jkl-tag--info\": variant === \"info\",\n \"jkl-tag--error\": variant === \"error\",\n \"jkl-tag--warning\": variant === \"warning\",\n \"jkl-tag--success\": variant === \"success\",\n },\n className,\n )}\n data-density={density}\n {...rest}\n >\n {children}\n {dismissAction && (\n <IconButton\n className=\"jkl-tag__dismiss-action\"\n density={density}\n title={dismissAction.label}\n onClick={dismissAction.onClick}\n onFocus={dismissAction.onFocus}\n onBlur={dismissAction.onBlur}\n >\n <CloseIcon variant=\"small\" bold />\n </IconButton>\n )}\n </span>\n );\n Tag.displayName = getDisplayName(variant);\n return Tag;\n}\n\nexport const Tag = tagFactory();\nexport const InfoTag = tagFactory(\"info\");\nexport const ErrorTag = tagFactory(\"error\");\nexport const WarningTag = tagFactory(\"warning\");\nexport const SuccessTag = tagFactory(\"success\");\n"],"names":["tagFactory","variant","Tag","className","density","dismissAction","children","rest","jsxs","cx","jsx","IconButton","title","label","onClick","onFocus","onBlur","CloseIcon","bold","displayName","getDisplayName","InfoTag","ErrorTag","WarningTag","SuccessTag"],"mappings":"69CAiCA,SAASA,EAAWC,GACVC,MAAAA,EAAoB,EAAGC,UAAAA,EAAWC,QAAAA,EAASC,cAAAA,EAAeC,SAAAA,KAAaC,KACzEC,EAAC,OAAA,CACGL,UAAWM,EACP,UACA,CACI,gBAA6B,SAAZR,EACjB,iBAA8B,UAAZA,EAClB,mBAAgC,YAAZA,EACpB,mBAAgC,YAAZA,GAExBE,GAEJ,eAAcC,KACVG,EAEHD,SAAA,CAAAA,EACAD,GACGK,EAACC,EAAA,CACGR,UAAU,0BACVC,QAAAA,EACAQ,MAAOP,EAAcQ,MACrBC,QAAST,EAAcS,QACvBC,QAASV,EAAcU,QACvBC,OAAQX,EAAcW,OAEtBV,SAACI,EAAAO,EAAA,CAAUhB,QAAQ,QAAQiB,MAAI,SAK/ChB,OAAAA,EAAIiB,YA9CR,SAAwBlB,GACpB,OAAQA,GACJ,IAAK,OACM,MAAA,UACX,IAAK,QACM,MAAA,WACX,IAAK,UACM,MAAA,aACX,IAAK,UACM,MAAA,aACX,QACW,MAAA,MAEnB,CAiCsBmB,CAAenB,GAC1BC,CACX,CAEO,MAAMA,EAAMF,IACNqB,EAAUrB,EAAW,QACrBsB,EAAWtB,EAAW,SACtBuB,EAAavB,EAAW,WACxBwB,EAAaxB,EAAW"}
1
+ {"version":3,"file":"Tag.js","sources":["../../../../src/components/tag/Tag.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport React, { ButtonHTMLAttributes, FC, HTMLAttributes, MouseEventHandler } from \"react\";\nimport { Density } from \"../../core\";\nimport { CloseIcon } from \"../icon\";\nimport { IconButton } from \"../icon-button\";\n\nexport interface DismissAction extends Exclude<ButtonHTMLAttributes<HTMLButtonElement>, \"disabled\"> {\n label: string;\n onClick: MouseEventHandler<HTMLButtonElement>;\n}\n\nexport interface TagProps extends HTMLAttributes<HTMLSpanElement> {\n density?: Density;\n dismissAction?: DismissAction;\n}\n\ntype Variant = \"info\" | \"error\" | \"warning\" | \"success\";\n\nfunction getDisplayName(variant?: Variant) {\n switch (variant) {\n case \"info\":\n return \"InfoTag\";\n case \"error\":\n return \"ErrorTag\";\n case \"warning\":\n return \"WarningTag\";\n case \"success\":\n return \"SuccessTag\";\n default:\n return \"Tag\";\n }\n}\n\nfunction tagFactory(variant?: Variant) {\n const Tag: FC<TagProps> = ({ className, density, dismissAction, children, ...rest }) => (\n <span\n className={clsx(\n \"jkl-tag\",\n {\n \"jkl-tag--info\": variant === \"info\",\n \"jkl-tag--error\": variant === \"error\",\n \"jkl-tag--warning\": variant === \"warning\",\n \"jkl-tag--success\": variant === \"success\",\n },\n className,\n )}\n data-density={density}\n {...rest}\n >\n {children}\n {dismissAction && (\n <IconButton\n className=\"jkl-tag__dismiss-action\"\n density={density}\n title={dismissAction.label}\n onClick={dismissAction.onClick}\n onFocus={dismissAction.onFocus}\n onBlur={dismissAction.onBlur}\n >\n <CloseIcon variant=\"small\" bold />\n </IconButton>\n )}\n </span>\n );\n Tag.displayName = getDisplayName(variant);\n return Tag;\n}\n\nexport const Tag = tagFactory();\nexport const InfoTag = tagFactory(\"info\");\nexport const ErrorTag = tagFactory(\"error\");\nexport const WarningTag = tagFactory(\"warning\");\nexport const SuccessTag = tagFactory(\"success\");\n"],"names":["tagFactory","variant","Tag","className","density","dismissAction","children","rest","jsxs","clsx","jsx","IconButton","title","label","onClick","onFocus","onBlur","CloseIcon","bold","displayName","getDisplayName","InfoTag","ErrorTag","WarningTag","SuccessTag"],"mappings":"i/CAiCA,SAASA,EAAWC,GACVC,MAAAA,EAAoB,EAAGC,UAAAA,EAAWC,QAAAA,EAASC,cAAAA,EAAeC,SAAAA,KAAaC,KACzEC,EAAC,OAAA,CACGL,UAAWM,EACP,UACA,CACI,gBAA6B,SAAZR,EACjB,iBAA8B,UAAZA,EAClB,mBAAgC,YAAZA,EACpB,mBAAgC,YAAZA,GAExBE,GAEJ,eAAcC,KACVG,EAEHD,SAAA,CAAAA,EACAD,GACGK,EAACC,EAAA,CACGR,UAAU,0BACVC,QAAAA,EACAQ,MAAOP,EAAcQ,MACrBC,QAAST,EAAcS,QACvBC,QAASV,EAAcU,QACvBC,OAAQX,EAAcW,OAEtBV,SAACI,EAAAO,EAAA,CAAUhB,QAAQ,QAAQiB,MAAI,SAK/ChB,OAAAA,EAAIiB,YA9CR,SAAwBlB,GACpB,OAAQA,GACJ,IAAK,OACM,MAAA,UACX,IAAK,QACM,MAAA,WACX,IAAK,UACM,MAAA,aACX,IAAK,UACM,MAAA,aACX,QACW,MAAA,MAEnB,CAiCsBmB,CAAenB,GAC1BC,CACX,CAEO,MAAMA,EAAMF,IACNqB,EAAUrB,EAAW,QACrBsB,EAAWtB,EAAW,SACtBuB,EAAavB,EAAW,WACxBwB,EAAaxB,EAAW"}
@@ -1,2 +1,2 @@
1
- import{jsxs as o,jsx as n}from"react/jsx-runtime";import i from"classnames";import{useState as c}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"../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{QuestionIcon as s}from"../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{Tooltip as r}from"./Tooltip.js";import{TooltipContent as t}from"./TooltipContent.js";import{TooltipTrigger as m}from"./TooltipTrigger.js";const p=({content:p,triggerProps:e,...a})=>{const[j,l]=c(!1);return o(r,{triggerOn:"click",...a,children:[n(m,{children:o("button",{...e,onFocus:o=>{var n;l(!0),null==(n=null==e?void 0:e.onFocus)||n.call(e,o)},onBlur:o=>{var n;l(!1),null==(n=null==e?void 0:e.onBlur)||n.call(e,o)},type:"button",className:i("jkl-tooltip-question-button",null==e?void 0:e.className),children:[n(s,{variant:"inherit",bold:j}),n("span",{className:"jkl-sr-only",children:"Vis hjelpetekst"})]})}),n(t,{children:p})]})};export{p as PopupTip};
1
+ import{jsxs as o,jsx as n}from"react/jsx-runtime";import{c as i}from"../../../clsx-BeLtu-UY.js";import{useState as c}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"../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{QuestionIcon as s}from"../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{Tooltip as r}from"./Tooltip.js";import{TooltipContent as t}from"./TooltipContent.js";import{TooltipTrigger as m}from"./TooltipTrigger.js";const p=({content:p,triggerProps:e,...a})=>{const[j,l]=c(!1);return o(r,{triggerOn:"click",...a,children:[n(m,{children:o("button",{...e,onFocus:o=>{var n;l(!0),null==(n=null==e?void 0:e.onFocus)||n.call(e,o)},onBlur:o=>{var n;l(!1),null==(n=null==e?void 0:e.onBlur)||n.call(e,o)},type:"button",className:i("jkl-tooltip-question-button",null==e?void 0:e.className),children:[n(s,{variant:"inherit",bold:j}),n("span",{className:"jkl-sr-only",children:"Vis hjelpetekst"})]})}),n(t,{children:p})]})};export{p as PopupTip};
2
2
  //# sourceMappingURL=PopupTip.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"PopupTip.js","sources":["../../../../src/components/tooltip/PopupTip.tsx"],"sourcesContent":["import cn from \"classnames\";\nimport React, { useState, type FC, type ReactNode, HTMLProps, FocusEventHandler } from \"react\";\nimport { QuestionIcon } from \"../icon\";\nimport { Tooltip, type TooltipProps } from \"./Tooltip\";\nimport { TooltipContent } from \"./TooltipContent\";\nimport { TooltipTrigger } from \"./TooltipTrigger\";\n\nexport interface PopupTipProps extends Omit<TooltipProps, \"triggerOn\" | \"children\"> {\n /**\n * Innholdet i tooltipet som vises\n */\n content: ReactNode;\n /**\n * Eventuelle props du vil sette på trigger-knappen for tooltipet\n */\n triggerProps?: Omit<HTMLProps<HTMLButtonElement>, \"children\" | \"type\">;\n}\n\nexport const PopupTip: FC<PopupTipProps> = ({ content, triggerProps, ...tooltipProps }) => {\n const [isBold, setIsBold] = useState(false);\n\n const handleFocus: FocusEventHandler<HTMLButtonElement> = (event) => {\n setIsBold(true);\n triggerProps?.onFocus?.(event);\n };\n const handleBlur: FocusEventHandler<HTMLButtonElement> = (event) => {\n setIsBold(false);\n triggerProps?.onBlur?.(event);\n };\n\n return (\n <Tooltip triggerOn=\"click\" {...tooltipProps}>\n <TooltipTrigger>\n <button\n {...triggerProps}\n onFocus={handleFocus}\n onBlur={handleBlur}\n type=\"button\"\n className={cn(\"jkl-tooltip-question-button\", triggerProps?.className)}\n >\n <QuestionIcon variant=\"inherit\" bold={isBold} />\n <span className=\"jkl-sr-only\">Vis hjelpetekst</span>\n </button>\n </TooltipTrigger>\n <TooltipContent>{content}</TooltipContent>\n </Tooltip>\n );\n};\n"],"names":["PopupTip","content","triggerProps","tooltipProps","isBold","setIsBold","useState","jsxs","Tooltip","triggerOn","children","jsx","TooltipTrigger","onFocus","event","_a","call","onBlur","type","className","cn","QuestionIcon","variant","bold","TooltipContent"],"mappings":"wlDAkBO,MAAMA,EAA8B,EAAGC,QAAAA,EAASC,aAAAA,KAAiBC,MACpE,MAAOC,EAAQC,GAAaC,GAAS,GAYhC,OAAAC,EAAAC,EAAA,CAAQC,UAAU,WAAYN,EAC3BO,SAAA,CAAAC,EAACC,EACG,CAAAF,SAAAH,EAAC,SAAA,IACOL,EACJW,QAd2CC,UACvDT,GAAU,GACV,OAAAU,EAAA,MAAAb,OAAAA,EAAAA,EAAcW,UAAdE,EAAAC,KAAAd,EAAwBY,EAAAA,EAaZG,OAX0CH,UACtDT,GAAU,GACV,OAAAU,EAAA,MAAAb,OAAAA,EAAAA,EAAce,SAAdF,EAAAC,KAAAd,EAAuBY,EAAAA,EAUXI,KAAK,SACLC,UAAWC,EAAG,8BAA+B,MAAAlB,OAAA,EAAAA,EAAciB,WAE3DT,SAAA,CAAAC,EAACU,EAAa,CAAAC,QAAQ,UAAUC,KAAMnB,IACrCO,EAAA,OAAA,CAAKQ,UAAU,cAAcT,SAAe,yBAGrDC,EAACa,GAAgBd,SAAQT,MAC7B"}
1
+ {"version":3,"file":"PopupTip.js","sources":["../../../../src/components/tooltip/PopupTip.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport React, { useState, type FC, type ReactNode, HTMLProps, FocusEventHandler } from \"react\";\nimport { QuestionIcon } from \"../icon\";\nimport { Tooltip, type TooltipProps } from \"./Tooltip\";\nimport { TooltipContent } from \"./TooltipContent\";\nimport { TooltipTrigger } from \"./TooltipTrigger\";\n\nexport interface PopupTipProps extends Omit<TooltipProps, \"triggerOn\" | \"children\"> {\n /**\n * Innholdet i tooltipet som vises\n */\n content: ReactNode;\n /**\n * Eventuelle props du vil sette på trigger-knappen for tooltipet\n */\n triggerProps?: Omit<HTMLProps<HTMLButtonElement>, \"children\" | \"type\">;\n}\n\nexport const PopupTip: FC<PopupTipProps> = ({ content, triggerProps, ...tooltipProps }) => {\n const [isBold, setIsBold] = useState(false);\n\n const handleFocus: FocusEventHandler<HTMLButtonElement> = (event) => {\n setIsBold(true);\n triggerProps?.onFocus?.(event);\n };\n const handleBlur: FocusEventHandler<HTMLButtonElement> = (event) => {\n setIsBold(false);\n triggerProps?.onBlur?.(event);\n };\n\n return (\n <Tooltip triggerOn=\"click\" {...tooltipProps}>\n <TooltipTrigger>\n <button\n {...triggerProps}\n onFocus={handleFocus}\n onBlur={handleBlur}\n type=\"button\"\n className={clsx(\"jkl-tooltip-question-button\", triggerProps?.className)}\n >\n <QuestionIcon variant=\"inherit\" bold={isBold} />\n <span className=\"jkl-sr-only\">Vis hjelpetekst</span>\n </button>\n </TooltipTrigger>\n <TooltipContent>{content}</TooltipContent>\n </Tooltip>\n );\n};\n"],"names":["PopupTip","content","triggerProps","tooltipProps","isBold","setIsBold","useState","jsxs","Tooltip","triggerOn","children","jsx","TooltipTrigger","onFocus","event","_a","call","onBlur","type","className","clsx","QuestionIcon","variant","bold","TooltipContent"],"mappings":"4mDAkBO,MAAMA,EAA8B,EAAGC,QAAAA,EAASC,aAAAA,KAAiBC,MACpE,MAAOC,EAAQC,GAAaC,GAAS,GAYhC,OAAAC,EAAAC,EAAA,CAAQC,UAAU,WAAYN,EAC3BO,SAAA,CAAAC,EAACC,EACG,CAAAF,SAAAH,EAAC,SAAA,IACOL,EACJW,QAd2CC,UACvDT,GAAU,GACV,OAAAU,EAAA,MAAAb,OAAAA,EAAAA,EAAcW,UAAdE,EAAAC,KAAAd,EAAwBY,EAAAA,EAaZG,OAX0CH,UACtDT,GAAU,GACV,OAAAU,EAAA,MAAAb,OAAAA,EAAAA,EAAce,SAAdF,EAAAC,KAAAd,EAAuBY,EAAAA,EAUXI,KAAK,SACLC,UAAWC,EAAK,8BAA+B,MAAAlB,OAAA,EAAAA,EAAciB,WAE7DT,SAAA,CAAAC,EAACU,EAAa,CAAAC,QAAQ,UAAUC,KAAMnB,IACrCO,EAAA,OAAA,CAAKQ,UAAU,cAAcT,SAAe,yBAGrDC,EAACa,GAAgBd,SAAQT,MAC7B"}
@@ -1,2 +1,2 @@
1
- import{jsx as t,jsxs as e}from"react/jsx-runtime";import{useMergeRefs as r,FloatingPortal as o}from"@floating-ui/react";import a from"classnames";import{AnimatePresence as s,motion as i}from"framer-motion";import{forwardRef as n}from"react";import"../../hooks/useScreen/useScreen.js";import{useId as l}from"../../hooks/useId/useId.js";import{useTooltipContext as c}from"./Tooltip.js";function p(t,e=8){switch(!0){case t.startsWith("top"):return{top:e};case t.startsWith("left"):return{left:e,right:-e};case t.startsWith("bottom"):return{top:-e};case t.startsWith("right"):return{left:-e,right:e};default:return{top:e}}}const m=n((function({className:n,children:m,...d},u){const{triggerOn:f,arrowElement:h,isOpen:g,getFloatingProps:j,placement:k,isPositioned:x,middlewareData:{arrow:y},floatingStyles:w,refs:v}=c(),I=r([u,v.setFloating]),P=l("jkl-tooltip-content");let N;if(v.reference.current){const t=getComputedStyle(v.reference.current).getPropertyValue("--jkl-background-color");N=parseInt(t.replace("#",""),16)<8388607.5?"dark":"light"}return t(o,{children:e(s,{children:["hover"===f&&t("span",{ref:v.setDescription,hidden:!0,children:m},`${P}-trigger`),g&&t("span",{className:"jkl",children:e(i.span,{ref:I,initial:{opacity:0,...p(k,5)},animate:{opacity:1,...p(k,0)},exit:{opacity:0,...p(k,-5),transition:{ease:"easeIn",duration:.15}},transition:{ease:"easeOut",duration:.25},"data-placement":k,"aria-live":"click"===f?"assertive":void 0,className:a("jkl-tooltip-content",n),...j({...d,id:P}),style:{...w},"data-theme":N,children:[m,t("span",{"aria-hidden":!0,className:"jkl-tooltip-content__arrow",ref:h,style:{left:x?`${null==y?void 0:y.x}px`:"",top:x?`${null==y?void 0:y.y}px`:""}})]},P)},`${P}-wrapper`)]})})}));export{m as TooltipContent};
1
+ import{jsx as t,jsxs as e}from"react/jsx-runtime";import{useMergeRefs as r,FloatingPortal as o}from"@floating-ui/react";import{c as a}from"../../../clsx-BeLtu-UY.js";import{AnimatePresence as s,motion as i}from"framer-motion";import{forwardRef as n}from"react";import"../../hooks/useScreen/useScreen.js";import{useId as l}from"../../hooks/useId/useId.js";import{useTooltipContext as c}from"./Tooltip.js";function p(t,e=8){switch(!0){case t.startsWith("top"):return{top:e};case t.startsWith("left"):return{left:e,right:-e};case t.startsWith("bottom"):return{top:-e};case t.startsWith("right"):return{left:-e,right:e};default:return{top:e}}}const m=n((function({className:n,children:m,...d},u){const{triggerOn:f,arrowElement:h,isOpen:g,getFloatingProps:j,placement:k,isPositioned:x,middlewareData:{arrow:y},floatingStyles:w,refs:v}=c(),I=r([u,v.setFloating]),P=l("jkl-tooltip-content");let N;if(v.reference.current){const t=getComputedStyle(v.reference.current).getPropertyValue("--jkl-background-color");N=parseInt(t.replace("#",""),16)<8388607.5?"dark":"light"}return t(o,{children:e(s,{children:["hover"===f&&t("span",{ref:v.setDescription,hidden:!0,children:m},`${P}-trigger`),g&&t("span",{className:"jkl",children:e(i.span,{ref:I,initial:{opacity:0,...p(k,5)},animate:{opacity:1,...p(k,0)},exit:{opacity:0,...p(k,-5),transition:{ease:"easeIn",duration:.15}},transition:{ease:"easeOut",duration:.25},"data-placement":k,"aria-live":"click"===f?"assertive":void 0,className:a("jkl-tooltip-content",n),...j({...d,id:P}),style:{...w},"data-theme":N,children:[m,t("span",{"aria-hidden":!0,className:"jkl-tooltip-content__arrow",ref:h,style:{left:x?`${null==y?void 0:y.x}px`:"",top:x?`${null==y?void 0:y.y}px`:""}})]},P)},`${P}-wrapper`)]})})}));export{m as TooltipContent};
2
2
  //# sourceMappingURL=TooltipContent.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"TooltipContent.js","sources":["../../../../src/components/tooltip/TooltipContent.tsx"],"sourcesContent":["import { type Placement, useMergeRefs, FloatingPortal } from \"@floating-ui/react\";\nimport cn from \"classnames\";\nimport { AnimatePresence, motion } from \"framer-motion\";\nimport React, { HTMLProps, forwardRef } from \"react\";\nimport { useId } from \"../../hooks\";\nimport { useTooltipContext } from \"./Tooltip\";\n\nfunction getPositionAnimation(placement: Placement, value: number = 8) {\n switch (true) {\n case placement.startsWith(\"top\"):\n return {\n top: value,\n };\n case placement.startsWith(\"left\"):\n return {\n left: value,\n right: -value,\n };\n case placement.startsWith(\"bottom\"):\n return {\n top: -value,\n };\n case placement.startsWith(\"right\"):\n return {\n left: -value,\n right: value,\n };\n\n default:\n return {\n top: value,\n };\n }\n}\n\nexport const TooltipContent = forwardRef<HTMLDivElement, HTMLProps<HTMLDivElement>>(function TooltipContent(\n { className, children, ...props },\n forwardedRef,\n) {\n const {\n triggerOn,\n arrowElement,\n isOpen,\n getFloatingProps,\n placement,\n isPositioned,\n middlewareData: { arrow },\n floatingStyles,\n refs,\n } = useTooltipContext();\n const ref = useMergeRefs([forwardedRef, refs.setFloating]);\n const contentId = useId(\"jkl-tooltip-content\");\n\n // Siden tooltipet rendres på rot må vi hente lokal dark/light-verdi fra triggeren\n // Vi må gjøre dette for å ta hensyn til at tema kan styres lokalt for deler av UIet\n let theme: string | undefined;\n if (refs.reference.current) {\n const backgroundColor = getComputedStyle(refs.reference.current as HTMLElement).getPropertyValue(\n \"--jkl-background-color\",\n );\n // Sett theme til dark hvis bakgrunnsfargen er mørkere enn 50% av hvit\n // dette gir oss slingringsmonn i tilfelle verdien av Jøkuls bakgrunnsfarge endres\n theme = parseInt(backgroundColor.replace(\"#\", \"\"), 16) < 0xffffff / 2 ? \"dark\" : \"light\";\n }\n\n return (\n <FloatingPortal>\n <AnimatePresence>\n {/* For å kunne bruke tekstinnholdet i tooltip som beskrivende tekst, selv når ikke\n tooltip er synlig, må vi rendre et skjult element å referere til for å hente innholdet. */}\n {triggerOn === \"hover\" && (\n <span ref={refs.setDescription} hidden key={`${contentId}-trigger`}>\n {children}\n </span>\n )}\n {isOpen && (\n <span className=\"jkl\" key={`${contentId}-wrapper`}>\n <motion.span\n key={contentId}\n ref={ref}\n initial={{ opacity: 0, ...getPositionAnimation(placement, 5) }}\n animate={{ opacity: 1, ...getPositionAnimation(placement, 0) }}\n exit={{\n opacity: 0,\n ...getPositionAnimation(placement, -5),\n transition: { ease: \"easeIn\", duration: 0.15 },\n }}\n transition={{ ease: \"easeOut\", duration: 0.25 }}\n data-placement={placement}\n aria-live={triggerOn === \"click\" ? \"assertive\" : undefined}\n className={cn(\"jkl-tooltip-content\", className)}\n {...getFloatingProps({ ...props, id: contentId })}\n style={{ ...floatingStyles }}\n data-theme={theme}\n >\n {children}\n <span\n aria-hidden\n className=\"jkl-tooltip-content__arrow\"\n ref={arrowElement}\n style={{\n left: isPositioned ? `${arrow?.x}px` : \"\",\n top: isPositioned ? `${arrow?.y}px` : \"\",\n }}\n />\n </motion.span>\n </span>\n )}\n </AnimatePresence>\n </FloatingPortal>\n );\n});\n"],"names":["getPositionAnimation","placement","value","startsWith","top","left","right","TooltipContent","forwardRef","className","children","props","forwardedRef","triggerOn","arrowElement","isOpen","getFloatingProps","isPositioned","middlewareData","arrow","floatingStyles","refs","useTooltipContext","ref","useMergeRefs","setFloating","contentId","useId","theme","reference","current","backgroundColor","getComputedStyle","getPropertyValue","parseInt","replace","jsx","FloatingPortal","jsxs","AnimatePresence","setDescription","hidden","motion","span","initial","opacity","animate","exit","transition","ease","duration","cn","id","style","x","y"],"mappings":"gYAOA,SAASA,EAAqBC,EAAsBC,EAAgB,GAChE,QAAQ,GACJ,KAAKD,EAAUE,WAAW,OACf,MAAA,CACHC,IAAKF,GAEb,KAAKD,EAAUE,WAAW,QACf,MAAA,CACHE,KAAMH,EACNI,OAAQJ,GAEhB,KAAKD,EAAUE,WAAW,UACf,MAAA,CACHC,KAAMF,GAEd,KAAKD,EAAUE,WAAW,SACf,MAAA,CACHE,MAAOH,EACPI,MAAOJ,GAGf,QACW,MAAA,CACHE,IAAKF,GAGrB,CAEa,MAAAK,EAAiBC,GAAsD,UAC9EC,UAAAA,EAAWC,SAAAA,KAAaC,GAC1BC,GAEM,MACFC,UAAAA,EACAC,aAAAA,EACAC,OAAAA,EACAC,iBAAAA,EACAf,UAAAA,EACAgB,aAAAA,EACAC,gBAAkBC,MAAAA,GAClBC,eAAAA,EACAC,KAAAA,GACAC,IACEC,EAAMC,EAAa,CAACZ,EAAcS,EAAKI,cACvCC,EAAYC,EAAM,uBAIpBC,IAAAA,EACAP,GAAAA,EAAKQ,UAAUC,QAAS,CACxB,MAAMC,EAAkBC,iBAAiBX,EAAKQ,UAAUC,SAAwBG,iBAC5E,0BAIIL,EAAAM,SAASH,EAAgBI,QAAQ,IAAK,IAAK,IAAM,UAAe,OAAS,OACrF,CAGI,OAAAC,EAACC,EACG,CAAA3B,SAAA4B,EAACC,EAGI,CAAA7B,SAAA,CAAc,UAAAG,GACVuB,EAAA,OAAA,CAAKb,IAAKF,EAAKmB,eAAgBC,QAAM,EACjC/B,SAAAA,GADuC,GAAGgB,aAIlDX,GACGqB,EAAC,OAAK,CAAA3B,UAAU,MACZC,SAAA4B,EAACI,EAAOC,KAAP,CAEGpB,IAAAA,EACAqB,QAAS,CAAEC,QAAS,KAAM7C,EAAqBC,EAAW,IAC1D6C,QAAS,CAAED,QAAS,KAAM7C,EAAqBC,EAAW,IAC1D8C,KAAM,CACFF,QAAS,KACN7C,EAAqBC,GAAa,GACrC+C,WAAY,CAAEC,KAAM,SAAUC,SAAU,MAE5CF,WAAY,CAAEC,KAAM,UAAWC,SAAU,KACzC,iBAAgBjD,EAChB,YAAyB,UAAdY,EAAwB,iBAAc,EACjDJ,UAAW0C,EAAG,sBAAuB1C,MACjCO,EAAiB,IAAKL,EAAOyC,GAAI1B,IACrC2B,MAAO,IAAKjC,GACZ,aAAYQ,EAEXlB,SAAA,CAAAA,EACD0B,EAAC,OAAA,CACG,eAAW,EACX3B,UAAU,6BACVc,IAAKT,EACLuC,MAAO,CACHhD,KAAMY,EAAe,GAAG,MAAAE,OAAAA,EAAAA,EAAOmC,MAAQ,GACvClD,IAAKa,EAAe,GAAG,MAAAE,OAAAA,EAAAA,EAAOoC,MAAQ,QAxBzC7B,IAFc,GAAGA,iBAmClD"}
1
+ {"version":3,"file":"TooltipContent.js","sources":["../../../../src/components/tooltip/TooltipContent.tsx"],"sourcesContent":["import { type Placement, useMergeRefs, FloatingPortal } from \"@floating-ui/react\";\nimport clsx from \"clsx\";\nimport { AnimatePresence, motion } from \"framer-motion\";\nimport React, { HTMLProps, forwardRef } from \"react\";\nimport { useId } from \"../../hooks\";\nimport { useTooltipContext } from \"./Tooltip\";\n\nfunction getPositionAnimation(placement: Placement, value: number = 8) {\n switch (true) {\n case placement.startsWith(\"top\"):\n return {\n top: value,\n };\n case placement.startsWith(\"left\"):\n return {\n left: value,\n right: -value,\n };\n case placement.startsWith(\"bottom\"):\n return {\n top: -value,\n };\n case placement.startsWith(\"right\"):\n return {\n left: -value,\n right: value,\n };\n\n default:\n return {\n top: value,\n };\n }\n}\n\nexport const TooltipContent = forwardRef<HTMLDivElement, HTMLProps<HTMLDivElement>>(function TooltipContent(\n { className, children, ...props },\n forwardedRef,\n) {\n const {\n triggerOn,\n arrowElement,\n isOpen,\n getFloatingProps,\n placement,\n isPositioned,\n middlewareData: { arrow },\n floatingStyles,\n refs,\n } = useTooltipContext();\n const ref = useMergeRefs([forwardedRef, refs.setFloating]);\n const contentId = useId(\"jkl-tooltip-content\");\n\n // Siden tooltipet rendres på rot må vi hente lokal dark/light-verdi fra triggeren\n // Vi må gjøre dette for å ta hensyn til at tema kan styres lokalt for deler av UIet\n let theme: string | undefined;\n if (refs.reference.current) {\n const backgroundColor = getComputedStyle(refs.reference.current as HTMLElement).getPropertyValue(\n \"--jkl-background-color\",\n );\n // Sett theme til dark hvis bakgrunnsfargen er mørkere enn 50% av hvit\n // dette gir oss slingringsmonn i tilfelle verdien av Jøkuls bakgrunnsfarge endres\n theme = parseInt(backgroundColor.replace(\"#\", \"\"), 16) < 0xffffff / 2 ? \"dark\" : \"light\";\n }\n\n return (\n <FloatingPortal>\n <AnimatePresence>\n {/* For å kunne bruke tekstinnholdet i tooltip som beskrivende tekst, selv når ikke\n tooltip er synlig, må vi rendre et skjult element å referere til for å hente innholdet. */}\n {triggerOn === \"hover\" && (\n <span ref={refs.setDescription} hidden key={`${contentId}-trigger`}>\n {children}\n </span>\n )}\n {isOpen && (\n <span className=\"jkl\" key={`${contentId}-wrapper`}>\n <motion.span\n key={contentId}\n ref={ref}\n initial={{ opacity: 0, ...getPositionAnimation(placement, 5) }}\n animate={{ opacity: 1, ...getPositionAnimation(placement, 0) }}\n exit={{\n opacity: 0,\n ...getPositionAnimation(placement, -5),\n transition: { ease: \"easeIn\", duration: 0.15 },\n }}\n transition={{ ease: \"easeOut\", duration: 0.25 }}\n data-placement={placement}\n aria-live={triggerOn === \"click\" ? \"assertive\" : undefined}\n className={clsx(\"jkl-tooltip-content\", className)}\n {...getFloatingProps({ ...props, id: contentId })}\n style={{ ...floatingStyles }}\n data-theme={theme}\n >\n {children}\n <span\n aria-hidden\n className=\"jkl-tooltip-content__arrow\"\n ref={arrowElement}\n style={{\n left: isPositioned ? `${arrow?.x}px` : \"\",\n top: isPositioned ? `${arrow?.y}px` : \"\",\n }}\n />\n </motion.span>\n </span>\n )}\n </AnimatePresence>\n </FloatingPortal>\n );\n});\n"],"names":["getPositionAnimation","placement","value","startsWith","top","left","right","TooltipContent","forwardRef","className","children","props","forwardedRef","triggerOn","arrowElement","isOpen","getFloatingProps","isPositioned","middlewareData","arrow","floatingStyles","refs","useTooltipContext","ref","useMergeRefs","setFloating","contentId","useId","theme","reference","current","backgroundColor","getComputedStyle","getPropertyValue","parseInt","replace","jsx","FloatingPortal","jsxs","AnimatePresence","setDescription","hidden","motion","span","initial","opacity","animate","exit","transition","ease","duration","clsx","id","style","x","y"],"mappings":"oZAOA,SAASA,EAAqBC,EAAsBC,EAAgB,GAChE,QAAQ,GACJ,KAAKD,EAAUE,WAAW,OACf,MAAA,CACHC,IAAKF,GAEb,KAAKD,EAAUE,WAAW,QACf,MAAA,CACHE,KAAMH,EACNI,OAAQJ,GAEhB,KAAKD,EAAUE,WAAW,UACf,MAAA,CACHC,KAAMF,GAEd,KAAKD,EAAUE,WAAW,SACf,MAAA,CACHE,MAAOH,EACPI,MAAOJ,GAGf,QACW,MAAA,CACHE,IAAKF,GAGrB,CAEa,MAAAK,EAAiBC,GAAsD,UAC9EC,UAAAA,EAAWC,SAAAA,KAAaC,GAC1BC,GAEM,MACFC,UAAAA,EACAC,aAAAA,EACAC,OAAAA,EACAC,iBAAAA,EACAf,UAAAA,EACAgB,aAAAA,EACAC,gBAAkBC,MAAAA,GAClBC,eAAAA,EACAC,KAAAA,GACAC,IACEC,EAAMC,EAAa,CAACZ,EAAcS,EAAKI,cACvCC,EAAYC,EAAM,uBAIpBC,IAAAA,EACAP,GAAAA,EAAKQ,UAAUC,QAAS,CACxB,MAAMC,EAAkBC,iBAAiBX,EAAKQ,UAAUC,SAAwBG,iBAC5E,0BAIIL,EAAAM,SAASH,EAAgBI,QAAQ,IAAK,IAAK,IAAM,UAAe,OAAS,OACrF,CAGI,OAAAC,EAACC,EACG,CAAA3B,SAAA4B,EAACC,EAGI,CAAA7B,SAAA,CAAc,UAAAG,GACVuB,EAAA,OAAA,CAAKb,IAAKF,EAAKmB,eAAgBC,QAAM,EACjC/B,SAAAA,GADuC,GAAGgB,aAIlDX,GACGqB,EAAC,OAAK,CAAA3B,UAAU,MACZC,SAAA4B,EAACI,EAAOC,KAAP,CAEGpB,IAAAA,EACAqB,QAAS,CAAEC,QAAS,KAAM7C,EAAqBC,EAAW,IAC1D6C,QAAS,CAAED,QAAS,KAAM7C,EAAqBC,EAAW,IAC1D8C,KAAM,CACFF,QAAS,KACN7C,EAAqBC,GAAa,GACrC+C,WAAY,CAAEC,KAAM,SAAUC,SAAU,MAE5CF,WAAY,CAAEC,KAAM,UAAWC,SAAU,KACzC,iBAAgBjD,EAChB,YAAyB,UAAdY,EAAwB,iBAAc,EACjDJ,UAAW0C,EAAK,sBAAuB1C,MACnCO,EAAiB,IAAKL,EAAOyC,GAAI1B,IACrC2B,MAAO,IAAKjC,GACZ,aAAYQ,EAEXlB,SAAA,CAAAA,EACD0B,EAAC,OAAA,CACG,eAAW,EACX3B,UAAU,6BACVc,IAAKT,EACLuC,MAAO,CACHhD,KAAMY,EAAe,GAAG,MAAAE,OAAAA,EAAAA,EAAOmC,MAAQ,GACvClD,IAAKa,EAAe,GAAG,MAAAE,OAAAA,EAAAA,EAAOoC,MAAQ,QAxBzC7B,IAFc,GAAGA,iBAmClD"}
@@ -1,2 +1,2 @@
1
- import{jsx as e}from"react/jsx-runtime";import{useMergeRefs as r}from"@floating-ui/react";import t from"classnames";import o,{forwardRef as n}from"react";import{useTooltipContext as s}from"./Tooltip.js";const l=n((function({children:n,className:l,...a},i){var p,c;const{isOpen:f,setOpen:m,getReferenceProps:u,refs:d,triggerOn:g}=s(),x=n.ref,b=r([x,d.setReference,i]),j=()=>{"click"===g&&m(!1)},B=[null==(p=d.reference.current)?void 0:p.textContent,null==(c=d.description.current)?void 0:c.textContent].filter(Boolean).join(". ");return o.isValidElement(n)?o.cloneElement(n,u({ref:b,"aria-label":B,...n.props,...a,className:t(n.props.className,l),"data-tooltip-shown":f,style:{...n.props.style},tabIndex:"click"===g?0:void 0,onBlur:()=>{n.props.onBlur&&n.props.onBlur(),j()}})):e("button",{"data-tooltip-shown":f,...u({className:t(l,"jkl-tooltip-trigger"),type:"button",ref:b,onBlur:j,"aria-label":B,...a}),children:n})}));export{l as TooltipTrigger};
1
+ import{jsx as e}from"react/jsx-runtime";import{useMergeRefs as r}from"@floating-ui/react";import{c as t}from"../../../clsx-BeLtu-UY.js";import o,{forwardRef as s}from"react";import{useTooltipContext as n}from"./Tooltip.js";const l=s((function({children:s,className:l,...i},a){var p,c;const{isOpen:f,setOpen:m,getReferenceProps:u,refs:d,triggerOn:g}=n(),x=s.ref,j=r([x,d.setReference,a]),b=()=>{"click"===g&&m(!1)},B=[null==(p=d.reference.current)?void 0:p.textContent,null==(c=d.description.current)?void 0:c.textContent].filter(Boolean).join(". ");return o.isValidElement(s)?o.cloneElement(s,u({ref:j,"aria-label":B,...s.props,...i,className:t(s.props.className,l),"data-tooltip-shown":f,style:{...s.props.style},tabIndex:"click"===g?0:void 0,onBlur:()=>{s.props.onBlur&&s.props.onBlur(),b()}})):e("button",{"data-tooltip-shown":f,...u({className:t(l,"jkl-tooltip-trigger"),type:"button",ref:j,onBlur:b,"aria-label":B,...i}),children:s})}));export{l as TooltipTrigger};
2
2
  //# sourceMappingURL=TooltipTrigger.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"TooltipTrigger.js","sources":["../../../../src/components/tooltip/TooltipTrigger.tsx"],"sourcesContent":["import { useMergeRefs } from \"@floating-ui/react\";\nimport cn from \"classnames\";\nimport React, { forwardRef, type HTMLProps } from \"react\";\nimport { useTooltipContext } from \"./Tooltip\";\n\nexport const TooltipTrigger = forwardRef<HTMLElement, HTMLProps<HTMLElement>>(function TooltipTrigger(\n { children, className, ...props },\n forwardedRef,\n) {\n const { isOpen, setOpen, getReferenceProps, refs, triggerOn } = useTooltipContext();\n const childrenRef = (children as any).ref;\n const ref = useMergeRefs([childrenRef, refs.setReference, forwardedRef]);\n\n const handleBlur = () => {\n triggerOn === \"click\" && setOpen(false);\n };\n\n const ariaLabel = [\n (refs.reference.current as HTMLElement | null)?.textContent,\n refs.description.current?.textContent,\n ]\n .filter(Boolean)\n .join(\". \");\n\n if (React.isValidElement(children)) {\n return React.cloneElement(\n children,\n getReferenceProps({\n ref,\n \"aria-label\": ariaLabel,\n ...children.props,\n ...props,\n className: cn(children.props.className, className),\n \"data-tooltip-shown\": isOpen,\n style: { ...children.props.style },\n tabIndex: triggerOn === \"click\" ? 0 : undefined,\n onBlur: () => {\n children.props.onBlur && children.props.onBlur();\n handleBlur();\n },\n }),\n );\n }\n\n return (\n <button\n data-tooltip-shown={isOpen}\n {...getReferenceProps({\n className: cn(className, \"jkl-tooltip-trigger\"),\n // Sørg for at vi ikke sender inn skjemaer ved klikk på knappen\n type: \"button\",\n ref,\n onBlur: handleBlur,\n \"aria-label\": ariaLabel,\n ...props,\n })}\n >\n {children}\n </button>\n );\n});\n"],"names":["TooltipTrigger","forwardRef","children","className","props","forwardedRef","isOpen","setOpen","getReferenceProps","refs","triggerOn","useTooltipContext","childrenRef","ref","useMergeRefs","setReference","handleBlur","ariaLabel","_a","reference","current","textContent","_b","description","filter","Boolean","join","React","isValidElement","cloneElement","cn","style","tabIndex","onBlur","jsx","type"],"mappings":"2MAKa,MAAAA,EAAiBC,GAAgD,UACxEC,SAAAA,EAAUC,UAAAA,KAAcC,GAC1BC,WAEM,MAAEC,OAAAA,EAAQC,QAAAA,EAASC,kBAAAA,EAAmBC,KAAAA,EAAMC,UAAAA,GAAcC,IAC1DC,EAAeV,EAAiBW,IAChCA,EAAMC,EAAa,CAACF,EAAaH,EAAKM,aAAcV,IAEpDW,EAAa,KACD,UAAAN,GAAWH,GAAQ,EAAK,EAGpCU,EAAY,CACb,OAAAC,EAAAT,EAAKU,UAAUC,gBAAfF,EAA+CG,YAChD,OAAAC,EAAAb,EAAKc,YAAYH,gBAAjBE,EAA0BD,aAEzBG,OAAOC,SACPC,KAAK,MAEN,OAAAC,EAAMC,eAAe1B,GACdyB,EAAME,aACT3B,EACAM,EAAkB,CACdK,IAAAA,EACA,aAAcI,KACXf,EAASE,SACTA,EACHD,UAAW2B,EAAG5B,EAASE,MAAMD,UAAWA,GACxC,qBAAsBG,EACtByB,MAAO,IAAK7B,EAASE,MAAM2B,OAC3BC,SAAwB,UAAdtB,EAAwB,OAAI,EACtCuB,OAAQ,KACJ/B,EAASE,MAAM6B,QAAU/B,EAASE,MAAM6B,SAC7BjB,QAOvBkB,EAAC,SAAA,CACG,qBAAoB5B,KAChBE,EAAkB,CAClBL,UAAW2B,EAAG3B,EAAW,uBAEzBgC,KAAM,SACNtB,IAAAA,EACAoB,OAAQjB,EACR,aAAcC,KACXb,IAGNF,SAAAA,GAGb"}
1
+ {"version":3,"file":"TooltipTrigger.js","sources":["../../../../src/components/tooltip/TooltipTrigger.tsx"],"sourcesContent":["import { useMergeRefs } from \"@floating-ui/react\";\nimport clsx from \"clsx\";\nimport React, { forwardRef, type HTMLProps } from \"react\";\nimport { useTooltipContext } from \"./Tooltip\";\n\nexport const TooltipTrigger = forwardRef<HTMLElement, HTMLProps<HTMLElement>>(function TooltipTrigger(\n { children, className, ...props },\n forwardedRef,\n) {\n const { isOpen, setOpen, getReferenceProps, refs, triggerOn } = useTooltipContext();\n const childrenRef = (children as any).ref;\n const ref = useMergeRefs([childrenRef, refs.setReference, forwardedRef]);\n\n const handleBlur = () => {\n triggerOn === \"click\" && setOpen(false);\n };\n\n const ariaLabel = [\n (refs.reference.current as HTMLElement | null)?.textContent,\n refs.description.current?.textContent,\n ]\n .filter(Boolean)\n .join(\". \");\n\n if (React.isValidElement(children)) {\n return React.cloneElement(\n children,\n getReferenceProps({\n ref,\n \"aria-label\": ariaLabel,\n ...children.props,\n ...props,\n className: clsx(children.props.className, className),\n \"data-tooltip-shown\": isOpen,\n style: { ...children.props.style },\n tabIndex: triggerOn === \"click\" ? 0 : undefined,\n onBlur: () => {\n children.props.onBlur && children.props.onBlur();\n handleBlur();\n },\n }),\n );\n }\n\n return (\n <button\n data-tooltip-shown={isOpen}\n {...getReferenceProps({\n className: clsx(className, \"jkl-tooltip-trigger\"),\n // Sørg for at vi ikke sender inn skjemaer ved klikk på knappen\n type: \"button\",\n ref,\n onBlur: handleBlur,\n \"aria-label\": ariaLabel,\n ...props,\n })}\n >\n {children}\n </button>\n );\n});\n"],"names":["TooltipTrigger","forwardRef","children","className","props","forwardedRef","isOpen","setOpen","getReferenceProps","refs","triggerOn","useTooltipContext","childrenRef","ref","useMergeRefs","setReference","handleBlur","ariaLabel","_a","reference","current","textContent","_b","description","filter","Boolean","join","React","isValidElement","cloneElement","clsx","style","tabIndex","onBlur","jsx","type"],"mappings":"+NAKa,MAAAA,EAAiBC,GAAgD,UACxEC,SAAAA,EAAUC,UAAAA,KAAcC,GAC1BC,WAEM,MAAEC,OAAAA,EAAQC,QAAAA,EAASC,kBAAAA,EAAmBC,KAAAA,EAAMC,UAAAA,GAAcC,IAC1DC,EAAeV,EAAiBW,IAChCA,EAAMC,EAAa,CAACF,EAAaH,EAAKM,aAAcV,IAEpDW,EAAa,KACD,UAAAN,GAAWH,GAAQ,EAAK,EAGpCU,EAAY,CACb,OAAAC,EAAAT,EAAKU,UAAUC,gBAAfF,EAA+CG,YAChD,OAAAC,EAAAb,EAAKc,YAAYH,gBAAjBE,EAA0BD,aAEzBG,OAAOC,SACPC,KAAK,MAEN,OAAAC,EAAMC,eAAe1B,GACdyB,EAAME,aACT3B,EACAM,EAAkB,CACdK,IAAAA,EACA,aAAcI,KACXf,EAASE,SACTA,EACHD,UAAW2B,EAAK5B,EAASE,MAAMD,UAAWA,GAC1C,qBAAsBG,EACtByB,MAAO,IAAK7B,EAASE,MAAM2B,OAC3BC,SAAwB,UAAdtB,EAAwB,OAAI,EACtCuB,OAAQ,KACJ/B,EAASE,MAAM6B,QAAU/B,EAASE,MAAM6B,SAC7BjB,QAOvBkB,EAAC,SAAA,CACG,qBAAoB5B,KAChBE,EAAkB,CAClBL,UAAW2B,EAAK3B,EAAW,uBAE3BgC,KAAM,SACNtB,IAAAA,EACAoB,OAAQjB,EACR,aAAcC,KACXb,IAGNF,SAAAA,GAGb"}