@fremtind/jokul 0.1.1

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 (358) hide show
  1. package/LICENSE +21 -0
  2. package/build/build-stats.html +4842 -0
  3. package/build/cjs/components/ScreenReaderOnly.js +2 -0
  4. package/build/cjs/components/ScreenReaderOnly.js.map +1 -0
  5. package/build/cjs/components/SlotComponent.js +2 -0
  6. package/build/cjs/components/SlotComponent.js.map +1 -0
  7. package/build/cjs/components/index.js +2 -0
  8. package/build/cjs/components/index.js.map +1 -0
  9. package/build/cjs/components/navigation/Link.js +2 -0
  10. package/build/cjs/components/navigation/Link.js.map +1 -0
  11. package/build/cjs/components/navigation/NavLink.js +2 -0
  12. package/build/cjs/components/navigation/NavLink.js.map +1 -0
  13. package/build/cjs/components/navigation/index.js +2 -0
  14. package/build/cjs/components/navigation/index.js.map +1 -0
  15. package/build/cjs/core/as-child.js +2 -0
  16. package/build/cjs/core/as-child.js.map +1 -0
  17. package/build/cjs/core/index.js +2 -0
  18. package/build/cjs/core/index.js.map +1 -0
  19. package/build/cjs/core/polymorphism.js +2 -0
  20. package/build/cjs/core/polymorphism.js.map +1 -0
  21. package/build/cjs/core/tokens.js +2 -0
  22. package/build/cjs/core/tokens.js.map +1 -0
  23. package/build/cjs/core/types.js +2 -0
  24. package/build/cjs/core/types.js.map +1 -0
  25. package/build/cjs/core/utils/breakpoints.js +2 -0
  26. package/build/cjs/core/utils/breakpoints.js.map +1 -0
  27. package/build/cjs/core/utils/density.js +2 -0
  28. package/build/cjs/core/utils/density.js.map +1 -0
  29. package/build/cjs/core/utils/getValuePair.js +2 -0
  30. package/build/cjs/core/utils/getValuePair.js.map +1 -0
  31. package/build/cjs/core/utils/index.js +2 -0
  32. package/build/cjs/core/utils/index.js.map +1 -0
  33. package/build/cjs/core/utils/mergeProps.js +2 -0
  34. package/build/cjs/core/utils/mergeProps.js.map +1 -0
  35. package/build/cjs/core/utils/mergeRefs.js +2 -0
  36. package/build/cjs/core/utils/mergeRefs.js.map +1 -0
  37. package/build/cjs/core/utils/motion.js +2 -0
  38. package/build/cjs/core/utils/motion.js.map +1 -0
  39. package/build/cjs/core/utils/tabListener.js +2 -0
  40. package/build/cjs/core/utils/tabListener.js.map +1 -0
  41. package/build/cjs/hooks/index.js +2 -0
  42. package/build/cjs/hooks/index.js.map +1 -0
  43. package/build/cjs/hooks/mediaQueryUtils.js +2 -0
  44. package/build/cjs/hooks/mediaQueryUtils.js.map +1 -0
  45. package/build/cjs/hooks/useAnimatedDetails/index.js +2 -0
  46. package/build/cjs/hooks/useAnimatedDetails/index.js.map +1 -0
  47. package/build/cjs/hooks/useAnimatedDetails/useAnimatedDetails.js +2 -0
  48. package/build/cjs/hooks/useAnimatedDetails/useAnimatedDetails.js.map +1 -0
  49. package/build/cjs/hooks/useAnimatedHeight/index.js +2 -0
  50. package/build/cjs/hooks/useAnimatedHeight/index.js.map +1 -0
  51. package/build/cjs/hooks/useAnimatedHeight/types.js +2 -0
  52. package/build/cjs/hooks/useAnimatedHeight/types.js.map +1 -0
  53. package/build/cjs/hooks/useAnimatedHeight/useAnimatedHeight.js +2 -0
  54. package/build/cjs/hooks/useAnimatedHeight/useAnimatedHeight.js.map +1 -0
  55. package/build/cjs/hooks/useAnimatedHeight/useAnimatedHeightBetween.js +2 -0
  56. package/build/cjs/hooks/useAnimatedHeight/useAnimatedHeightBetween.js.map +1 -0
  57. package/build/cjs/hooks/useAnimatedHeight/useAutoAnimateHeight.js +2 -0
  58. package/build/cjs/hooks/useAnimatedHeight/useAutoAnimateHeight.js.map +1 -0
  59. package/build/cjs/hooks/useAriaLiveRegion/index.js +2 -0
  60. package/build/cjs/hooks/useAriaLiveRegion/index.js.map +1 -0
  61. package/build/cjs/hooks/useAriaLiveRegion/useAriaLiveRegion.js +2 -0
  62. package/build/cjs/hooks/useAriaLiveRegion/useAriaLiveRegion.js.map +1 -0
  63. package/build/cjs/hooks/useBrowserPreferences/index.js +2 -0
  64. package/build/cjs/hooks/useBrowserPreferences/index.js.map +1 -0
  65. package/build/cjs/hooks/useBrowserPreferences/useBrowserPreferences.js +2 -0
  66. package/build/cjs/hooks/useBrowserPreferences/useBrowserPreferences.js.map +1 -0
  67. package/build/cjs/hooks/useClickOutside/index.js +2 -0
  68. package/build/cjs/hooks/useClickOutside/index.js.map +1 -0
  69. package/build/cjs/hooks/useClickOutside/useClickOutside.js +2 -0
  70. package/build/cjs/hooks/useClickOutside/useClickOutside.js.map +1 -0
  71. package/build/cjs/hooks/useElementDimensions/index.js +2 -0
  72. package/build/cjs/hooks/useElementDimensions/index.js.map +1 -0
  73. package/build/cjs/hooks/useElementDimensions/useElementDimensions.js +2 -0
  74. package/build/cjs/hooks/useElementDimensions/useElementDimensions.js.map +1 -0
  75. package/build/cjs/hooks/useFocusOutside/index.js +2 -0
  76. package/build/cjs/hooks/useFocusOutside/index.js.map +1 -0
  77. package/build/cjs/hooks/useFocusOutside/useFocusOutside.js +2 -0
  78. package/build/cjs/hooks/useFocusOutside/useFocusOutside.js.map +1 -0
  79. package/build/cjs/hooks/useId/index.js +2 -0
  80. package/build/cjs/hooks/useId/index.js.map +1 -0
  81. package/build/cjs/hooks/useId/useId.js +2 -0
  82. package/build/cjs/hooks/useId/useId.js.map +1 -0
  83. package/build/cjs/hooks/useIntersectionObserver/index.js +2 -0
  84. package/build/cjs/hooks/useIntersectionObserver/index.js.map +1 -0
  85. package/build/cjs/hooks/useIntersectionObserver/useIntersectionObserver.js +2 -0
  86. package/build/cjs/hooks/useIntersectionObserver/useIntersectionObserver.js.map +1 -0
  87. package/build/cjs/hooks/useKeyListener/index.js +2 -0
  88. package/build/cjs/hooks/useKeyListener/index.js.map +1 -0
  89. package/build/cjs/hooks/useKeyListener/useKeyListener.js +2 -0
  90. package/build/cjs/hooks/useKeyListener/useKeyListener.js.map +1 -0
  91. package/build/cjs/hooks/useListNavigation/index.js +2 -0
  92. package/build/cjs/hooks/useListNavigation/index.js.map +1 -0
  93. package/build/cjs/hooks/useListNavigation/useListNavigation.js +2 -0
  94. package/build/cjs/hooks/useListNavigation/useListNavigation.js.map +1 -0
  95. package/build/cjs/hooks/useLocalStorage/index.js +2 -0
  96. package/build/cjs/hooks/useLocalStorage/index.js.map +1 -0
  97. package/build/cjs/hooks/useLocalStorage/useLocalStorage.js +2 -0
  98. package/build/cjs/hooks/useLocalStorage/useLocalStorage.js.map +1 -0
  99. package/build/cjs/hooks/useMutationObserver/index.js +2 -0
  100. package/build/cjs/hooks/useMutationObserver/index.js.map +1 -0
  101. package/build/cjs/hooks/useMutationObserver/useMutationObserver.js +2 -0
  102. package/build/cjs/hooks/useMutationObserver/useMutationObserver.js.map +1 -0
  103. package/build/cjs/hooks/usePreviousValue/index.js +2 -0
  104. package/build/cjs/hooks/usePreviousValue/index.js.map +1 -0
  105. package/build/cjs/hooks/usePreviousValue/usePreviousValue.js +2 -0
  106. package/build/cjs/hooks/usePreviousValue/usePreviousValue.js.map +1 -0
  107. package/build/cjs/hooks/useProgressiveImg/index.js +2 -0
  108. package/build/cjs/hooks/useProgressiveImg/index.js.map +1 -0
  109. package/build/cjs/hooks/useProgressiveImg/useProgressiveImg.js +2 -0
  110. package/build/cjs/hooks/useProgressiveImg/useProgressiveImg.js.map +1 -0
  111. package/build/cjs/hooks/useScreen/index.js +2 -0
  112. package/build/cjs/hooks/useScreen/index.js.map +1 -0
  113. package/build/cjs/hooks/useScreen/state.js +2 -0
  114. package/build/cjs/hooks/useScreen/state.js.map +1 -0
  115. package/build/cjs/hooks/useScreen/useScreen.js +2 -0
  116. package/build/cjs/hooks/useScreen/useScreen.js.map +1 -0
  117. package/build/cjs/hooks/useScrollIntoView/index.js +2 -0
  118. package/build/cjs/hooks/useScrollIntoView/index.js.map +1 -0
  119. package/build/cjs/hooks/useScrollIntoView/useScrollIntoView.js +2 -0
  120. package/build/cjs/hooks/useScrollIntoView/useScrollIntoView.js.map +1 -0
  121. package/build/cjs/hooks/useSwipeGesture/index.js +2 -0
  122. package/build/cjs/hooks/useSwipeGesture/index.js.map +1 -0
  123. package/build/cjs/hooks/useSwipeGesture/useSwipeGesture.js +2 -0
  124. package/build/cjs/hooks/useSwipeGesture/useSwipeGesture.js.map +1 -0
  125. package/build/clsx-BeLtu-UY.js +2 -0
  126. package/build/clsx-BeLtu-UY.js.map +1 -0
  127. package/build/clsx-E3yX_9sL.cjs +2 -0
  128. package/build/clsx-E3yX_9sL.cjs.map +1 -0
  129. package/build/components/ScreenReaderOnly.d.ts +6 -0
  130. package/build/components/SlotComponent.d.ts +7 -0
  131. package/build/components/index.d.ts +2 -0
  132. package/build/components/navigation/Link.d.ts +5 -0
  133. package/build/components/navigation/NavLink.d.ts +6 -0
  134. package/build/components/navigation/index.d.ts +2 -0
  135. package/build/core/as-child.d.ts +39 -0
  136. package/build/core/index.d.ts +7 -0
  137. package/build/core/polymorphism.d.ts +11 -0
  138. package/build/core/tokens.d.ts +351 -0
  139. package/build/core/types.d.ts +42 -0
  140. package/build/core/utils/breakpoints.d.ts +6 -0
  141. package/build/core/utils/density.d.ts +1 -0
  142. package/build/core/utils/getValuePair.d.ts +2 -0
  143. package/build/core/utils/index.d.ts +8 -0
  144. package/build/core/utils/mergeProps.d.ts +3 -0
  145. package/build/core/utils/mergeRefs.d.ts +3 -0
  146. package/build/core/utils/motion.d.ts +16 -0
  147. package/build/core/utils/tabListener.d.ts +1 -0
  148. package/build/es/components/ScreenReaderOnly.js +2 -0
  149. package/build/es/components/ScreenReaderOnly.js.map +1 -0
  150. package/build/es/components/SlotComponent.js +2 -0
  151. package/build/es/components/SlotComponent.js.map +1 -0
  152. package/build/es/components/index.js +2 -0
  153. package/build/es/components/index.js.map +1 -0
  154. package/build/es/components/navigation/Link.js +2 -0
  155. package/build/es/components/navigation/Link.js.map +1 -0
  156. package/build/es/components/navigation/NavLink.js +2 -0
  157. package/build/es/components/navigation/NavLink.js.map +1 -0
  158. package/build/es/components/navigation/index.js +2 -0
  159. package/build/es/components/navigation/index.js.map +1 -0
  160. package/build/es/core/as-child.js +2 -0
  161. package/build/es/core/as-child.js.map +1 -0
  162. package/build/es/core/index.js +2 -0
  163. package/build/es/core/index.js.map +1 -0
  164. package/build/es/core/polymorphism.js +2 -0
  165. package/build/es/core/polymorphism.js.map +1 -0
  166. package/build/es/core/tokens.js +2 -0
  167. package/build/es/core/tokens.js.map +1 -0
  168. package/build/es/core/types.js +2 -0
  169. package/build/es/core/types.js.map +1 -0
  170. package/build/es/core/utils/breakpoints.js +2 -0
  171. package/build/es/core/utils/breakpoints.js.map +1 -0
  172. package/build/es/core/utils/density.js +2 -0
  173. package/build/es/core/utils/density.js.map +1 -0
  174. package/build/es/core/utils/getValuePair.js +2 -0
  175. package/build/es/core/utils/getValuePair.js.map +1 -0
  176. package/build/es/core/utils/index.js +2 -0
  177. package/build/es/core/utils/index.js.map +1 -0
  178. package/build/es/core/utils/mergeProps.js +2 -0
  179. package/build/es/core/utils/mergeProps.js.map +1 -0
  180. package/build/es/core/utils/mergeRefs.js +2 -0
  181. package/build/es/core/utils/mergeRefs.js.map +1 -0
  182. package/build/es/core/utils/motion.js +2 -0
  183. package/build/es/core/utils/motion.js.map +1 -0
  184. package/build/es/core/utils/tabListener.js +2 -0
  185. package/build/es/core/utils/tabListener.js.map +1 -0
  186. package/build/es/hooks/index.js +2 -0
  187. package/build/es/hooks/index.js.map +1 -0
  188. package/build/es/hooks/mediaQueryUtils.js +2 -0
  189. package/build/es/hooks/mediaQueryUtils.js.map +1 -0
  190. package/build/es/hooks/useAnimatedDetails/index.js +2 -0
  191. package/build/es/hooks/useAnimatedDetails/index.js.map +1 -0
  192. package/build/es/hooks/useAnimatedDetails/useAnimatedDetails.js +2 -0
  193. package/build/es/hooks/useAnimatedDetails/useAnimatedDetails.js.map +1 -0
  194. package/build/es/hooks/useAnimatedHeight/index.js +2 -0
  195. package/build/es/hooks/useAnimatedHeight/index.js.map +1 -0
  196. package/build/es/hooks/useAnimatedHeight/types.js +2 -0
  197. package/build/es/hooks/useAnimatedHeight/types.js.map +1 -0
  198. package/build/es/hooks/useAnimatedHeight/useAnimatedHeight.js +2 -0
  199. package/build/es/hooks/useAnimatedHeight/useAnimatedHeight.js.map +1 -0
  200. package/build/es/hooks/useAnimatedHeight/useAnimatedHeightBetween.js +2 -0
  201. package/build/es/hooks/useAnimatedHeight/useAnimatedHeightBetween.js.map +1 -0
  202. package/build/es/hooks/useAnimatedHeight/useAutoAnimateHeight.js +2 -0
  203. package/build/es/hooks/useAnimatedHeight/useAutoAnimateHeight.js.map +1 -0
  204. package/build/es/hooks/useAriaLiveRegion/index.js +2 -0
  205. package/build/es/hooks/useAriaLiveRegion/index.js.map +1 -0
  206. package/build/es/hooks/useAriaLiveRegion/useAriaLiveRegion.js +2 -0
  207. package/build/es/hooks/useAriaLiveRegion/useAriaLiveRegion.js.map +1 -0
  208. package/build/es/hooks/useBrowserPreferences/index.js +2 -0
  209. package/build/es/hooks/useBrowserPreferences/index.js.map +1 -0
  210. package/build/es/hooks/useBrowserPreferences/useBrowserPreferences.js +2 -0
  211. package/build/es/hooks/useBrowserPreferences/useBrowserPreferences.js.map +1 -0
  212. package/build/es/hooks/useClickOutside/index.js +2 -0
  213. package/build/es/hooks/useClickOutside/index.js.map +1 -0
  214. package/build/es/hooks/useClickOutside/useClickOutside.js +2 -0
  215. package/build/es/hooks/useClickOutside/useClickOutside.js.map +1 -0
  216. package/build/es/hooks/useElementDimensions/index.js +2 -0
  217. package/build/es/hooks/useElementDimensions/index.js.map +1 -0
  218. package/build/es/hooks/useElementDimensions/useElementDimensions.js +2 -0
  219. package/build/es/hooks/useElementDimensions/useElementDimensions.js.map +1 -0
  220. package/build/es/hooks/useFocusOutside/index.js +2 -0
  221. package/build/es/hooks/useFocusOutside/index.js.map +1 -0
  222. package/build/es/hooks/useFocusOutside/useFocusOutside.js +2 -0
  223. package/build/es/hooks/useFocusOutside/useFocusOutside.js.map +1 -0
  224. package/build/es/hooks/useId/index.js +2 -0
  225. package/build/es/hooks/useId/index.js.map +1 -0
  226. package/build/es/hooks/useId/useId.js +2 -0
  227. package/build/es/hooks/useId/useId.js.map +1 -0
  228. package/build/es/hooks/useIntersectionObserver/index.js +2 -0
  229. package/build/es/hooks/useIntersectionObserver/index.js.map +1 -0
  230. package/build/es/hooks/useIntersectionObserver/useIntersectionObserver.js +2 -0
  231. package/build/es/hooks/useIntersectionObserver/useIntersectionObserver.js.map +1 -0
  232. package/build/es/hooks/useKeyListener/index.js +2 -0
  233. package/build/es/hooks/useKeyListener/index.js.map +1 -0
  234. package/build/es/hooks/useKeyListener/useKeyListener.js +2 -0
  235. package/build/es/hooks/useKeyListener/useKeyListener.js.map +1 -0
  236. package/build/es/hooks/useListNavigation/index.js +2 -0
  237. package/build/es/hooks/useListNavigation/index.js.map +1 -0
  238. package/build/es/hooks/useListNavigation/useListNavigation.js +2 -0
  239. package/build/es/hooks/useListNavigation/useListNavigation.js.map +1 -0
  240. package/build/es/hooks/useLocalStorage/index.js +2 -0
  241. package/build/es/hooks/useLocalStorage/index.js.map +1 -0
  242. package/build/es/hooks/useLocalStorage/useLocalStorage.js +2 -0
  243. package/build/es/hooks/useLocalStorage/useLocalStorage.js.map +1 -0
  244. package/build/es/hooks/useMutationObserver/index.js +2 -0
  245. package/build/es/hooks/useMutationObserver/index.js.map +1 -0
  246. package/build/es/hooks/useMutationObserver/useMutationObserver.js +2 -0
  247. package/build/es/hooks/useMutationObserver/useMutationObserver.js.map +1 -0
  248. package/build/es/hooks/usePreviousValue/index.js +2 -0
  249. package/build/es/hooks/usePreviousValue/index.js.map +1 -0
  250. package/build/es/hooks/usePreviousValue/usePreviousValue.js +2 -0
  251. package/build/es/hooks/usePreviousValue/usePreviousValue.js.map +1 -0
  252. package/build/es/hooks/useProgressiveImg/index.js +2 -0
  253. package/build/es/hooks/useProgressiveImg/index.js.map +1 -0
  254. package/build/es/hooks/useProgressiveImg/useProgressiveImg.js +2 -0
  255. package/build/es/hooks/useProgressiveImg/useProgressiveImg.js.map +1 -0
  256. package/build/es/hooks/useScreen/index.js +2 -0
  257. package/build/es/hooks/useScreen/index.js.map +1 -0
  258. package/build/es/hooks/useScreen/state.js +2 -0
  259. package/build/es/hooks/useScreen/state.js.map +1 -0
  260. package/build/es/hooks/useScreen/useScreen.js +2 -0
  261. package/build/es/hooks/useScreen/useScreen.js.map +1 -0
  262. package/build/es/hooks/useScrollIntoView/index.js +2 -0
  263. package/build/es/hooks/useScrollIntoView/index.js.map +1 -0
  264. package/build/es/hooks/useScrollIntoView/useScrollIntoView.js +2 -0
  265. package/build/es/hooks/useScrollIntoView/useScrollIntoView.js.map +1 -0
  266. package/build/es/hooks/useSwipeGesture/index.js +2 -0
  267. package/build/es/hooks/useSwipeGesture/index.js.map +1 -0
  268. package/build/es/hooks/useSwipeGesture/useSwipeGesture.js +2 -0
  269. package/build/es/hooks/useSwipeGesture/useSwipeGesture.js.map +1 -0
  270. package/build/hooks/index.d.ts +18 -0
  271. package/build/hooks/mediaQueryUtils.d.ts +21 -0
  272. package/build/hooks/useAnimatedDetails/index.d.ts +1 -0
  273. package/build/hooks/useAnimatedDetails/useAnimatedDetails.d.ts +20 -0
  274. package/build/hooks/useAnimatedHeight/index.d.ts +4 -0
  275. package/build/hooks/useAnimatedHeight/types.d.ts +26 -0
  276. package/build/hooks/useAnimatedHeight/useAnimatedHeight.d.ts +10 -0
  277. package/build/hooks/useAnimatedHeight/useAnimatedHeightBetween.d.ts +10 -0
  278. package/build/hooks/useAnimatedHeight/useAutoAnimateHeight.d.ts +20 -0
  279. package/build/hooks/useAriaLiveRegion/index.d.ts +1 -0
  280. package/build/hooks/useAriaLiveRegion/useAriaLiveRegion.d.ts +15 -0
  281. package/build/hooks/useBrowserPreferences/index.d.ts +1 -0
  282. package/build/hooks/useBrowserPreferences/useBrowserPreferences.d.ts +12 -0
  283. package/build/hooks/useClickOutside/index.d.ts +1 -0
  284. package/build/hooks/useClickOutside/useClickOutside.d.ts +7 -0
  285. package/build/hooks/useElementDimensions/index.d.ts +1 -0
  286. package/build/hooks/useElementDimensions/useElementDimensions.d.ts +11 -0
  287. package/build/hooks/useFocusOutside/index.d.ts +1 -0
  288. package/build/hooks/useFocusOutside/useFocusOutside.d.ts +7 -0
  289. package/build/hooks/useId/index.d.ts +1 -0
  290. package/build/hooks/useId/useId.d.ts +11 -0
  291. package/build/hooks/useIntersectionObserver/index.d.ts +1 -0
  292. package/build/hooks/useIntersectionObserver/useIntersectionObserver.d.ts +13 -0
  293. package/build/hooks/useKeyListener/index.d.ts +1 -0
  294. package/build/hooks/useKeyListener/useKeyListener.d.ts +8 -0
  295. package/build/hooks/useListNavigation/index.d.ts +1 -0
  296. package/build/hooks/useListNavigation/useListNavigation.d.ts +7 -0
  297. package/build/hooks/useLocalStorage/index.d.ts +1 -0
  298. package/build/hooks/useLocalStorage/useLocalStorage.d.ts +1 -0
  299. package/build/hooks/useMutationObserver/index.d.ts +1 -0
  300. package/build/hooks/useMutationObserver/useMutationObserver.d.ts +9 -0
  301. package/build/hooks/usePreviousValue/index.d.ts +1 -0
  302. package/build/hooks/usePreviousValue/usePreviousValue.d.ts +6 -0
  303. package/build/hooks/useProgressiveImg/index.d.ts +1 -0
  304. package/build/hooks/useProgressiveImg/useProgressiveImg.d.ts +10 -0
  305. package/build/hooks/useScreen/index.d.ts +2 -0
  306. package/build/hooks/useScreen/state.d.ts +17 -0
  307. package/build/hooks/useScreen/useScreen.d.ts +6 -0
  308. package/build/hooks/useScrollIntoView/index.d.ts +1 -0
  309. package/build/hooks/useScrollIntoView/useScrollIntoView.d.ts +11 -0
  310. package/build/hooks/useSwipeGesture/index.d.ts +1 -0
  311. package/build/hooks/useSwipeGesture/useSwipeGesture.d.ts +27 -0
  312. package/package.json +83 -0
  313. package/src/components/navigation/styles/link.css +152 -0
  314. package/src/components/navigation/styles/link.min.css +1 -0
  315. package/src/components/navigation/styles/link.scss +138 -0
  316. package/src/core/jkl/_colors.scss +26 -0
  317. package/src/core/jkl/_convert.scss +96 -0
  318. package/src/core/jkl/_helpers.scss +20 -0
  319. package/src/core/jkl/_index.scss +18 -0
  320. package/src/core/jkl/_legacy-tokens.scss +22 -0
  321. package/src/core/jkl/_motion.scss +62 -0
  322. package/src/core/jkl/_navigation.scss +9 -0
  323. package/src/core/jkl/_ornaments.scss +26 -0
  324. package/src/core/jkl/_reset.scss +43 -0
  325. package/src/core/jkl/_responsive-units.scss +30 -0
  326. package/src/core/jkl/_screenreader.scss +59 -0
  327. package/src/core/jkl/_screens.scss +135 -0
  328. package/src/core/jkl/_shadows.scss +25 -0
  329. package/src/core/jkl/_spacing.scss +210 -0
  330. package/src/core/jkl/_theme.scss +144 -0
  331. package/src/core/jkl/_tokens.scss +148 -0
  332. package/src/core/jkl/_typography.scss +327 -0
  333. package/src/core/jkl/_underline.scss +16 -0
  334. package/src/core/jkl/_z-index.scss +23 -0
  335. package/src/core/styles/_color-tokens.scss +75 -0
  336. package/src/core/styles/_headings.scss +29 -0
  337. package/src/core/styles/_index.scss +10 -0
  338. package/src/core/styles/_legacy-tokens.scss +26 -0
  339. package/src/core/styles/_normalize.scss +250 -0
  340. package/src/core/styles/_paragraphs.scss +16 -0
  341. package/src/core/styles/_reset.scss +66 -0
  342. package/src/core/styles/_screen-reader.scss +9 -0
  343. package/src/core/styles/_spacing.scss +75 -0
  344. package/src/core/styles/_tokens.scss +114 -0
  345. package/src/core/styles/core.css +1614 -0
  346. package/src/core/styles/core.min.css +1 -0
  347. package/src/core/styles/core.scss +71 -0
  348. package/src/core/styles/vind/_flex.scss +113 -0
  349. package/src/core/styles/vind/_font.scss +19 -0
  350. package/src/core/styles/vind/_margin.scss +43 -0
  351. package/src/core/styles/vind/_padding.scss +43 -0
  352. package/src/core/styles/vind/_space-between.scss +13 -0
  353. package/src/core/styles/vind/_typography.scss +47 -0
  354. package/src/core/styles/vind/_vind.scss +6 -0
  355. package/src/core/styles/vind.css +1742 -0
  356. package/src/core/styles/vind.min.css +1 -0
  357. package/src/core/styles/vind.scss +3 -0
  358. package/src/core/tokens.less +196 -0
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime");exports.ScreenReaderOnly=({children:r,showOnFocus:s,...l})=>e.jsx("span",{...l,className:"jkl-sr-only"+(s?" jkl-sr-only--focusable":""),children:r});
2
+ //# sourceMappingURL=ScreenReaderOnly.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ScreenReaderOnly.js","sources":["../../../src/components/ScreenReaderOnly.tsx"],"sourcesContent":["import React, { FC } from \"react\";\nimport type { WithChildren } from \"../core\";\n\nexport interface ScreenReaderOnlyProps extends WithChildren {\n showOnFocus?: boolean;\n}\n\nexport const ScreenReaderOnly: FC<ScreenReaderOnlyProps> = ({ children, showOnFocus, ...rest }) => (\n <span {...rest} className={`jkl-sr-only${showOnFocus ? \" jkl-sr-only--focusable\" : \"\"}`}>\n {children}\n </span>\n);\n"],"names":["children","showOnFocus","rest","jsx","className"],"mappings":"8IAO2D,EAAGA,SAAAA,EAAUC,YAAAA,KAAgBC,KACpFC,EAAAA,IAAC,OAAM,IAAGD,EAAME,UAAW,eAAcH,EAAc,0BAA4B,IAC9ED,SAAAA"}
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react"),r=require("../core/utils/mergeRefs.js"),t=require("../core/utils/mergeProps.js"),n=e.forwardRef((function({children:n,...o},i){if(e.isValidElement(n))return e.cloneElement(n,{...t.mergeProps(o,n.props),ref:r.mergeRefs(i,n.ref)});if(e.Children.count(n)>1)throw new Error("Du kan kun bruke ett enkelt React-element som children i en komponent med asChild");return null}));exports.SlotComponent=n;
2
+ //# sourceMappingURL=SlotComponent.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SlotComponent.js","sources":["../../../src/components/SlotComponent.tsx"],"sourcesContent":["import React from \"react\";\nimport { mergeRefs, mergeProps } from \"../core/utils\";\n\nexport type SlotComponentProps = React.HTMLAttributes<HTMLElement> & {\n children: React.ReactElement | false | null;\n};\n\nexport const SlotComponent = React.forwardRef<HTMLElement, SlotComponentProps>(function SlotComponent(\n { children, ...slotProps },\n forwardedRef,\n) {\n if (React.isValidElement(children)) {\n return React.cloneElement(children as React.ReactElement, {\n ...mergeProps(slotProps, children.props),\n ref: mergeRefs(forwardedRef, (children as any).ref),\n });\n }\n\n if (React.Children.count(children) > 1) {\n throw new Error(\"Du kan kun bruke ett enkelt React-element som children i en komponent med asChild\");\n }\n\n return null;\n});\n"],"names":["SlotComponent","React","forwardRef","children","slotProps","forwardedRef","isValidElement","cloneElement","mergeProps","props","ref","mergeRefs","Children","count","Error"],"mappings":"0LAOaA,EAAgBC,EAAMC,YAA4C,UACzEC,SAAAA,KAAaC,GACfC,GAEI,GAAAJ,EAAMK,eAAeH,GACd,OAAAF,EAAMM,aAAaJ,EAAgC,IACnDK,aAAWJ,EAAWD,EAASM,OAClCC,IAAKC,EAAAA,UAAUN,EAAeF,EAAiBO,OAIvD,GAAIT,EAAMW,SAASC,MAAMV,GAAY,EAC3B,MAAA,IAAIW,MAAM,qFAGb,OAAA,IACX"}
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./SlotComponent.js"),o=require("./ScreenReaderOnly.js");exports.SlotComponent=e.SlotComponent,exports.ScreenReaderOnly=o.ScreenReaderOnly;
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),r=require("../../../clsx-E3yX_9sL.cjs");exports.Link=({external:l=!1,className:s="",children:t,...c})=>e.jsx("a",{className:r.clsx("jkl-link",s,{"jkl-link--external":l}),...c,children:t});
2
+ //# sourceMappingURL=Link.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Link.js","sources":["../../../../src/components/navigation/Link.tsx"],"sourcesContent":["import { clsx } from \"clsx\";\nimport React, { AnchorHTMLAttributes, FC } from \"react\";\n\nexport interface LinkProps extends AnchorHTMLAttributes<HTMLAnchorElement> {\n external?: boolean;\n}\n\nexport const Link: FC<LinkProps> = ({ external = false, className = \"\", children, ...rest }) => (\n <a\n className={clsx(\"jkl-link\", className, {\n \"jkl-link--external\": external,\n })}\n {...rest}\n >\n {children}\n </a>\n);\n"],"names":["external","className","children","rest","jsx","clsx"],"mappings":"0KAOmC,EAAGA,SAAAA,GAAW,EAAOC,UAAAA,EAAY,GAAIC,SAAAA,KAAaC,KACjFC,EAAAA,IAAC,IAAA,CACGH,UAAWI,EAAAA,KAAK,WAAYJ,EAAW,CACnC,qBAAsBD,OAEtBG,EAEHD,SAAAA"}
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),a=require("../../../clsx-E3yX_9sL.cjs");exports.NavLink=({active:c=!1,back:l=!1,className:i,children:r,...s})=>e.jsx("a",{className:a.clsx("jkl-nav-link",{"jkl-nav-link--active":c,"jkl-nav-link--back":l},i),...s,children:r});
2
+ //# sourceMappingURL=NavLink.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NavLink.js","sources":["../../../../src/components/navigation/NavLink.tsx"],"sourcesContent":["import { clsx } from \"clsx\";\nimport React, { AnchorHTMLAttributes, FC } from \"react\";\n\nexport interface NavLinkProps extends AnchorHTMLAttributes<HTMLAnchorElement> {\n active?: boolean;\n back?: boolean;\n}\n\nexport const NavLink: FC<NavLinkProps> = ({ active = false, back = false, className, children, ...rest }) => (\n <a\n className={clsx(\n \"jkl-nav-link\",\n {\n \"jkl-nav-link--active\": active,\n \"jkl-nav-link--back\": back,\n },\n className,\n )}\n {...rest}\n >\n {children}\n </a>\n);\n"],"names":["active","back","className","children","rest","jsx","clsx"],"mappings":"6KAQyC,EAAGA,OAAAA,GAAS,EAAOC,KAAAA,GAAO,EAAOC,UAAAA,EAAWC,SAAAA,KAAaC,KAC9FC,EAAAA,IAAC,IAAA,CACGH,UAAWI,EAAAA,KACP,eACA,CACI,uBAAwBN,EACxB,qBAAsBC,GAE1BC,MAEAE,EAEHD,SAAAA"}
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./Link.js"),i=require("./NavLink.js");exports.Link=e.Link,exports.NavLink=i.NavLink;
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ //# sourceMappingURL=as-child.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"as-child.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./utils/tabListener.js"),r=require("./utils/getValuePair.js"),s=require("./utils/breakpoints.js"),t=require("./utils/motion.js"),i=require("./utils/mergeRefs.js"),o=require("./utils/mergeProps.js"),u=require("./tokens.js");exports.initTabListener=e.initTabListener,exports.getValuePair=r.getValuePair,exports.breakpoints=s.breakpoints,exports.easings=t.easings,exports.timings=t.timings,exports.mergeRefs=i.mergeRefs,exports.mergeProps=o.mergeProps,exports.tokens=u;
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ //# sourceMappingURL=polymorphism.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"polymorphism.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ "use strict";module.exports={color:{brand:{snohvit:"#F9F9F9",varde:"#E0DBD4",granitt:"#1B1917",hvit:"#FFFFFF",svart:"#000000",skifer:"#313030",fjellgra:"#444141",stein:"#636060",svaberg:"#C8C5C3",dis:"#ECE9E5",sand:"#F4F2EF"},functional:{info:"#D3D3F6",infoDark:"#A9A9CA",success:"#ACD3B5",successDark:"#94B79B",warning:"#EFDD9E",warningDark:"#DECC8D",error:"#F6B3B3",errorDark:"#DE9E9E"},background:{page:{light:"#F4F2EF",dark:"#1B1917"},pageVariant:{light:"#F9F9F9",dark:"#1B1917"},container:{light:"#F9F9F9",dark:"#313030"},containerLow:{light:"#ECE9E5",dark:"#000000"},containerHigh:{light:"#FFFFFF",dark:"#313030"},containerInverted:{light:"#1B1917",dark:"#F9F9F9"},containerSubdued:{light:"#C8C5C3",dark:"#636060"},input:{base:{light:"transparent",dark:"transparent"},focus:{light:"#FFFFFF",dark:"#313030"}},action:{light:"#1B1917",dark:"#F9F9F9"},interactive:{light:"transparent",dark:"transparent"},interactiveHover:{light:"#ECE9E5",dark:"#444141"},interactiveSelected:{light:"#E0DBD4",dark:"#636060"},alert:{neutral:{light:"#E0DBD4",dark:"#E0DBD4"},info:{light:"#D3D3F6",dark:"#A9A9CA"},success:{light:"#ACD3B5",dark:"#94B79B"},warning:{light:"#EFDD9E",dark:"#DECC8D"},error:{light:"#F6B3B3",dark:"#DE9E9E"}}},text:{default:{light:"#1B1917",dark:"#F9F9F9"},subdued:{light:"#636060",dark:"#C8C5C3"},inverted:{light:"#F9F9F9",dark:"#1B1917"},onAction:{light:"#F9F9F9",dark:"#1B1917"},interactive:{light:"#1B1917",dark:"#F9F9F9"},interactiveHover:{light:"#636060",dark:"#C8C5C3"},onAlert:{light:"#1B1917",dark:"#1B1917"}},border:{action:{light:"#1B1917",dark:"#F9F9F9"},input:{light:"#636060",dark:"#C8C5C3"},inputFocus:{light:"#1B1917",dark:"#F9F9F9"},separator:{light:"#C8C5C3",dark:"#636060"},separatorStrong:{light:"#636060",dark:"#C8C5C3"},separatorHover:{light:"#1B1917",dark:"#F9F9F9"},subdued:{light:"#C8C5C3",dark:"#636060"}},svart:"#000",granitt:"#1b1917",skifer:"#313030",fjellgra:"#444141",stein:"#636060",svaberg:"#c8c5c3",varde:"#e0dbd4",dis:"#ece9e5",sand:"#f4f2ef",snohvit:"#f9f9f9",hvit:"#fff",suksess:"#acd3b5",suksessDark:"#94b79b",feil:"#f6b3b3",feilDark:"#de9e9e",info:"#d3d3f6",infoDark:"#a9a9ca",advarsel:"#efdd9e",advarselDark:"#decc8d"},spacing:{0:"0",2:"0.125rem",4:"0.25rem",8:"0.5rem",12:"0.75rem",16:"1rem",24:"1.5rem",32:"2rem",40:"2.5rem",64:"4rem",104:"6.5rem",168:"10.5rem"},icon:{weight:{normal:"300",bold:"500"}},typography:{weight:{normal:"400",bold:"700"},font:{size:{16:"1rem",18:"1.125rem",20:"1.25rem",21:"1.3125rem",23:"1.4375rem",25:"1.5625rem",26:"1.625rem",28:"1.75rem",30:"1.875rem",36:"2.25rem",44:"2.75rem",56:"3.5rem"}},line:{height:{24:"1.5rem",28:"1.75rem",32:"2rem",36:"2.25rem",40:"2.5rem",44:"2.75rem",52:"3.25rem",64:"4rem"}},title:{small:{fontSize:"2.25rem",lineHeight:"2.75rem",fontWeight:"400"},base:{fontSize:"3.5rem",lineHeight:"4rem",fontWeight:"400"}},titleSmall:{small:{fontSize:"1.875rem",lineHeight:"2.25rem",fontWeight:"400"},base:{fontSize:"2.75rem",lineHeight:"3.25rem",fontWeight:"400"}},heading_1:{small:{fontSize:"1.625rem",lineHeight:"2rem",fontWeight:"400"},base:{fontSize:"2.25rem",lineHeight:"2.75rem",fontWeight:"400"}},heading_2:{small:{fontSize:"1.4375rem",lineHeight:"2rem",fontWeight:"400"},base:{fontSize:"1.75rem",lineHeight:"2.5rem",fontWeight:"400"}},heading_3:{small:{fontSize:"1.3125rem",lineHeight:"1.75rem",fontWeight:"700"},base:{fontSize:"1.5625rem",lineHeight:"2rem",fontWeight:"700"}},heading_4:{small:{fontSize:"1.125rem",lineHeight:"1.5rem",fontWeight:"700"},base:{fontSize:"1.3125rem",lineHeight:"1.75rem",fontWeight:"700"}},heading_5:{small:{fontSize:"1rem",lineHeight:"1.5rem",fontWeight:"700"},base:{fontSize:"1rem",lineHeight:"1.5rem",fontWeight:"700"}},body:{small:{fontSize:"1.125rem",lineHeight:"1.75rem",fontWeight:"400"},base:{fontSize:"1.25rem",lineHeight:"2rem",fontWeight:"400"}},small:{small:{fontSize:"1rem",lineHeight:"1.5rem",fontWeight:"400"},base:{fontSize:"1rem",lineHeight:"1.5rem",fontWeight:"400"}}}};
2
+ //# sourceMappingURL=tokens.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tokens.js","sources":["../../../src/core/tokens.ts"],"sourcesContent":["/**\n * Do not edit directly\n * Generated on Tue, 10 Sep 2024 05:21:22 GMT\n */\n\nexport default {\n color: {\n brand: {\n snohvit: \"#F9F9F9\",\n varde: \"#E0DBD4\",\n granitt: \"#1B1917\",\n hvit: \"#FFFFFF\",\n svart: \"#000000\",\n skifer: \"#313030\",\n fjellgra: \"#444141\",\n stein: \"#636060\",\n svaberg: \"#C8C5C3\",\n dis: \"#ECE9E5\",\n sand: \"#F4F2EF\",\n },\n functional: {\n info: \"#D3D3F6\",\n infoDark: \"#A9A9CA\",\n success: \"#ACD3B5\",\n successDark: \"#94B79B\",\n warning: \"#EFDD9E\",\n warningDark: \"#DECC8D\",\n error: \"#F6B3B3\",\n errorDark: \"#DE9E9E\",\n },\n background: {\n page: {\n light: \"#F4F2EF\",\n dark: \"#1B1917\",\n },\n pageVariant: {\n light: \"#F9F9F9\",\n dark: \"#1B1917\",\n },\n container: {\n light: \"#F9F9F9\",\n dark: \"#313030\",\n },\n containerLow: {\n light: \"#ECE9E5\",\n dark: \"#000000\",\n },\n containerHigh: {\n light: \"#FFFFFF\",\n dark: \"#313030\",\n },\n containerInverted: {\n light: \"#1B1917\",\n dark: \"#F9F9F9\",\n },\n containerSubdued: {\n light: \"#C8C5C3\",\n dark: \"#636060\",\n },\n input: {\n base: {\n light: \"transparent\",\n dark: \"transparent\",\n },\n focus: {\n light: \"#FFFFFF\",\n dark: \"#313030\",\n },\n },\n action: {\n light: \"#1B1917\",\n dark: \"#F9F9F9\",\n },\n interactive: {\n light: \"transparent\",\n dark: \"transparent\",\n },\n interactiveHover: {\n light: \"#ECE9E5\",\n dark: \"#444141\",\n },\n interactiveSelected: {\n light: \"#E0DBD4\",\n dark: \"#636060\",\n },\n alert: {\n neutral: {\n light: \"#E0DBD4\",\n dark: \"#E0DBD4\",\n },\n info: {\n light: \"#D3D3F6\",\n dark: \"#A9A9CA\",\n },\n success: {\n light: \"#ACD3B5\",\n dark: \"#94B79B\",\n },\n warning: {\n light: \"#EFDD9E\",\n dark: \"#DECC8D\",\n },\n error: {\n light: \"#F6B3B3\",\n dark: \"#DE9E9E\",\n },\n },\n },\n text: {\n default: {\n light: \"#1B1917\",\n dark: \"#F9F9F9\",\n },\n subdued: {\n light: \"#636060\",\n dark: \"#C8C5C3\",\n },\n inverted: {\n light: \"#F9F9F9\",\n dark: \"#1B1917\",\n },\n onAction: {\n light: \"#F9F9F9\",\n dark: \"#1B1917\",\n },\n interactive: {\n light: \"#1B1917\",\n dark: \"#F9F9F9\",\n },\n interactiveHover: {\n light: \"#636060\",\n dark: \"#C8C5C3\",\n },\n onAlert: {\n light: \"#1B1917\",\n dark: \"#1B1917\",\n },\n },\n border: {\n action: {\n light: \"#1B1917\",\n dark: \"#F9F9F9\",\n },\n input: {\n light: \"#636060\",\n dark: \"#C8C5C3\",\n },\n inputFocus: {\n light: \"#1B1917\",\n dark: \"#F9F9F9\",\n },\n separator: {\n light: \"#C8C5C3\",\n dark: \"#636060\",\n },\n separatorStrong: {\n light: \"#636060\",\n dark: \"#C8C5C3\",\n },\n separatorHover: {\n light: \"#1B1917\",\n dark: \"#F9F9F9\",\n },\n subdued: {\n light: \"#C8C5C3\",\n dark: \"#636060\",\n },\n },\n svart: \"#000\",\n granitt: \"#1b1917\",\n skifer: \"#313030\",\n fjellgra: \"#444141\",\n stein: \"#636060\",\n svaberg: \"#c8c5c3\",\n varde: \"#e0dbd4\",\n dis: \"#ece9e5\",\n sand: \"#f4f2ef\",\n snohvit: \"#f9f9f9\",\n hvit: \"#fff\",\n suksess: \"#acd3b5\",\n suksessDark: \"#94b79b\",\n feil: \"#f6b3b3\",\n feilDark: \"#de9e9e\",\n info: \"#d3d3f6\",\n infoDark: \"#a9a9ca\",\n advarsel: \"#efdd9e\",\n advarselDark: \"#decc8d\",\n },\n spacing: {\n 0: \"0\",\n 2: \"0.125rem\",\n 4: \"0.25rem\",\n 8: \"0.5rem\",\n 12: \"0.75rem\",\n 16: \"1rem\",\n 24: \"1.5rem\",\n 32: \"2rem\",\n 40: \"2.5rem\",\n 64: \"4rem\",\n 104: \"6.5rem\",\n 168: \"10.5rem\",\n },\n icon: {\n weight: {\n normal: \"300\",\n bold: \"500\",\n },\n },\n typography: {\n weight: {\n normal: \"400\",\n bold: \"700\",\n },\n font: {\n size: {\n 16: \"1rem\",\n 18: \"1.125rem\",\n 20: \"1.25rem\",\n 21: \"1.3125rem\",\n 23: \"1.4375rem\",\n 25: \"1.5625rem\",\n 26: \"1.625rem\",\n 28: \"1.75rem\",\n 30: \"1.875rem\",\n 36: \"2.25rem\",\n 44: \"2.75rem\",\n 56: \"3.5rem\",\n },\n },\n line: {\n height: {\n 24: \"1.5rem\",\n 28: \"1.75rem\",\n 32: \"2rem\",\n 36: \"2.25rem\",\n 40: \"2.5rem\",\n 44: \"2.75rem\",\n 52: \"3.25rem\",\n 64: \"4rem\",\n },\n },\n title: {\n small: {\n fontSize: \"2.25rem\",\n lineHeight: \"2.75rem\",\n fontWeight: \"400\",\n },\n base: {\n fontSize: \"3.5rem\",\n lineHeight: \"4rem\",\n fontWeight: \"400\",\n },\n },\n titleSmall: {\n small: {\n fontSize: \"1.875rem\",\n lineHeight: \"2.25rem\",\n fontWeight: \"400\",\n },\n base: {\n fontSize: \"2.75rem\",\n lineHeight: \"3.25rem\",\n fontWeight: \"400\",\n },\n },\n heading_1: {\n small: {\n fontSize: \"1.625rem\",\n lineHeight: \"2rem\",\n fontWeight: \"400\",\n },\n base: {\n fontSize: \"2.25rem\",\n lineHeight: \"2.75rem\",\n fontWeight: \"400\",\n },\n },\n heading_2: {\n small: {\n fontSize: \"1.4375rem\",\n lineHeight: \"2rem\",\n fontWeight: \"400\",\n },\n base: {\n fontSize: \"1.75rem\",\n lineHeight: \"2.5rem\",\n fontWeight: \"400\",\n },\n },\n heading_3: {\n small: {\n fontSize: \"1.3125rem\",\n lineHeight: \"1.75rem\",\n fontWeight: \"700\",\n },\n base: {\n fontSize: \"1.5625rem\",\n lineHeight: \"2rem\",\n fontWeight: \"700\",\n },\n },\n heading_4: {\n small: {\n fontSize: \"1.125rem\",\n lineHeight: \"1.5rem\",\n fontWeight: \"700\",\n },\n base: {\n fontSize: \"1.3125rem\",\n lineHeight: \"1.75rem\",\n fontWeight: \"700\",\n },\n },\n heading_5: {\n small: {\n fontSize: \"1rem\",\n lineHeight: \"1.5rem\",\n fontWeight: \"700\",\n },\n base: {\n fontSize: \"1rem\",\n lineHeight: \"1.5rem\",\n fontWeight: \"700\",\n },\n },\n body: {\n small: {\n fontSize: \"1.125rem\",\n lineHeight: \"1.75rem\",\n fontWeight: \"400\",\n },\n base: {\n fontSize: \"1.25rem\",\n lineHeight: \"2rem\",\n fontWeight: \"400\",\n },\n },\n small: {\n small: {\n fontSize: \"1rem\",\n lineHeight: \"1.5rem\",\n fontWeight: \"400\",\n },\n base: {\n fontSize: \"1rem\",\n lineHeight: \"1.5rem\",\n fontWeight: \"400\",\n },\n },\n },\n};\n"],"names":["color","brand","snohvit","varde","granitt","hvit","svart","skifer","fjellgra","stein","svaberg","dis","sand","functional","info","infoDark","success","successDark","warning","warningDark","error","errorDark","background","page","light","dark","pageVariant","container","containerLow","containerHigh","containerInverted","containerSubdued","input","base","focus","action","interactive","interactiveHover","interactiveSelected","alert","neutral","text","default","subdued","inverted","onAction","onAlert","border","inputFocus","separator","separatorStrong","separatorHover","suksess","suksessDark","feil","feilDark","advarsel","advarselDark","spacing","icon","weight","normal","bold","typography","font","size","line","height","title","small","fontSize","lineHeight","fontWeight","titleSmall","heading_1","heading_2","heading_3","heading_4","heading_5","body"],"mappings":"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"}
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});exports.breakpoints={medium:680,large:1200,xl:1600};
2
+ //# sourceMappingURL=breakpoints.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"breakpoints.js","sources":["../../../../src/core/utils/breakpoints.ts"],"sourcesContent":["export type Breakpoint = keyof typeof breakpoints;\n\nexport const breakpoints = {\n medium: 680,\n large: 1200,\n xl: 1600,\n};\n"],"names":["medium","large","xl"],"mappings":"oGAE2B,CACvBA,OAAQ,IACRC,MAAO,KACPC,GAAI"}
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ //# sourceMappingURL=density.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"density.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"}),exports.getValuePair=function(e){return"string"==typeof e?{value:e,label:e}:e};
2
+ //# sourceMappingURL=getValuePair.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getValuePair.js","sources":["../../../../src/core/utils/getValuePair.ts"],"sourcesContent":["import { ValuePair } from \"../index\";\n\nexport function getValuePair(item: string | ValuePair): ValuePair {\n return typeof item === \"string\" ? { value: item, label: item } : item;\n}\n"],"names":["item","value","label"],"mappings":"qGAEO,SAAsBA,GAClB,MAAgB,iBAATA,EAAoB,CAAEC,MAAOD,EAAME,MAAOF,GAASA,CACrE"}
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./tabListener.js"),r=require("./getValuePair.js"),s=require("./breakpoints.js"),t=require("./motion.js"),i=require("./mergeRefs.js"),o=require("./mergeProps.js");exports.initTabListener=e.initTabListener,exports.getValuePair=r.getValuePair,exports.breakpoints=s.breakpoints,exports.easings=t.easings,exports.timings=t.timings,exports.mergeRefs=i.mergeRefs,exports.mergeProps=o.mergeProps;
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"}),exports.mergeProps=function(e,t){const o={...t};for(const n in t){const r=e[n],s=t[n];/^on[A-Z]/.test(n)&&(r&&s?o[n]=(...e)=>{s(...e),r(...e)}:r&&(o[n]=r)),"style"===n&&(o[n]={...r,...s}),"className"===n&&(o[n]=[r,s].filter(Boolean).join(" "))}return{...e,...o}};
2
+ //# sourceMappingURL=mergeProps.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mergeProps.js","sources":["../../../../src/core/utils/mergeProps.ts"],"sourcesContent":["export function mergeProps(baseProps: Record<string, any>, addedProps: Record<string, any>) {\n const overrides = { ...addedProps };\n\n for (const prop in addedProps) {\n const basePropValue = baseProps[prop];\n const addedPropValue = addedProps[prop];\n\n if (/^on[A-Z]/.test(prop)) {\n // Propen er en event handler. Slå sammen hvis\n // den finnes på både base og added\n if (basePropValue && addedPropValue) {\n overrides[prop] = (...args: unknown[]) => {\n addedPropValue(...args);\n basePropValue(...args);\n };\n } else if (basePropValue) {\n overrides[prop] = basePropValue;\n }\n }\n\n if (prop === \"style\") {\n overrides[prop] = { ...basePropValue, ...addedPropValue };\n }\n\n if (prop === \"className\") {\n overrides[prop] = [basePropValue, addedPropValue].filter(Boolean).join(\" \");\n }\n }\n\n return { ...baseProps, ...overrides };\n}\n"],"names":["baseProps","addedProps","overrides","prop","basePropValue","addedPropValue","test","args","filter","Boolean","join"],"mappings":"mGAAgB,SAAWA,EAAgCC,GACjD,MAAAC,EAAY,IAAKD,GAEvB,IAAWE,MAAAA,KAAQF,EAAY,CACrB,MAAAG,EAAgBJ,EAAUG,GAC1BE,EAAiBJ,EAAWE,GAE9B,WAAWG,KAAKH,KAGZC,GAAiBC,EACPH,EAAAC,GAAQ,IAAII,KAClBF,KAAkBE,GAClBH,KAAiBG,EAAI,EAElBH,IACPF,EAAUC,GAAQC,IAIb,UAATD,IACAD,EAAUC,GAAQ,IAAKC,KAAkBC,IAGhC,cAATF,IACUD,EAAAC,GAAQ,CAACC,EAAeC,GAAgBG,OAAOC,SAASC,KAAK,KAE/E,CAEA,MAAO,IAAKV,KAAcE,EAC9B"}
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"}),exports.mergeRefs=function(...e){return t=>e.forEach((e=>{"function"==typeof e?e(t):null!=e&&(e.current=t)}))};
2
+ //# sourceMappingURL=mergeRefs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mergeRefs.js","sources":["../../../../src/core/utils/mergeRefs.ts"],"sourcesContent":["import React from \"react\";\n\nexport type PossibleRef<T> = React.LegacyRef<T> | undefined;\n\nexport function mergeRefs<T>(...possibleRefs: PossibleRef<T>[]): React.RefCallback<T> {\n return (instance) =>\n possibleRefs.forEach((ref) => {\n if (typeof ref === \"function\") {\n ref(instance);\n } else if (ref !== null && ref !== undefined) {\n (ref as React.MutableRefObject<T | null>).current = instance;\n }\n });\n}\n"],"names":["possibleRefs","instance","forEach","ref","current"],"mappings":"kGAIO,YAAyBA,GAC5B,OAAQC,GACJD,EAAaE,SAASC,IACC,mBAARA,EACPA,EAAIF,GACW,MAARE,IACNA,EAAyCC,QAAUH,EACxD,GAEZ"}
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=Object.freeze({standard:"ease",entrance:"ease-out",exit:"ease-in",easeInBounceOut:"cubic-bezier(0, 0, 0.375, 1.17)",focus:"cubic-bezier(0.6, 0.2, 0.35, 1)"}),s=Object.freeze({energetic:"75ms",snappy:"100ms",productive:"150ms",expressive:"250ms",lazy:"400ms"});exports.easings=e,exports.timings=s;
2
+ //# sourceMappingURL=motion.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"motion.js","sources":["../../../../src/core/utils/motion.ts"],"sourcesContent":["export type Easing = keyof typeof easings;\n\nexport const easings = Object.freeze({\n standard: \"ease\",\n entrance: \"ease-out\",\n exit: \"ease-in\",\n easeInBounceOut: \"cubic-bezier(0, 0, 0.375, 1.17)\",\n focus: \"cubic-bezier(0.6, 0.2, 0.35, 1)\",\n});\n\nexport type Timing = keyof typeof timings;\n\nexport const timings = Object.freeze({\n energetic: \"75ms\",\n snappy: \"100ms\",\n productive: \"150ms\",\n expressive: \"250ms\",\n lazy: \"400ms\",\n});\n"],"names":["easings","Object","freeze","standard","entrance","exit","easeInBounceOut","focus","timings","energetic","snappy","productive","expressive","lazy"],"mappings":"gFAEa,MAAAA,EAAUC,OAAOC,OAAO,CACjCC,SAAU,OACVC,SAAU,WACVC,KAAM,UACNC,gBAAiB,kCACjBC,MAAO,oCAKEC,EAAUP,OAAOC,OAAO,CACjCO,UAAW,OACXC,OAAQ,QACRC,WAAY,QACZC,WAAY,QACZC,KAAM"}
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});let t=!1,e=!1,o=!1;const n={mousedown:function(){if(!t&&!o){t=!0,e=!1;const o=document.querySelector("html");null==o||o.setAttribute("data-mousenavigation","true"),null==o||o.removeAttribute("data-touchnavigation"),u(),i("touchstart"),i("keydown")}},keydown:function(o){if("Tab"===o.key){const o=document.querySelector("html");u(),null==o||o.removeAttribute("data-mousenavigation"),null==o||o.removeAttribute("data-touchnavigation"),t=!1,e=!1,i("touchstart"),i("mousedown")}},touchstart:function(){if(!e){t=!1,e=!0;const o=document.querySelector("html");null==o||o.setAttribute("data-touchnavigation","true"),null==o||o.removeAttribute("data-mousenavigation"),u(),i("touchstart"),i("keydown"),i("mousedown")}o=!0,setTimeout((()=>{o=!1}),150)}};function u(){Object.keys(n).forEach((t=>{document.removeEventListener(t,n[t])}))}function i(t){document.addEventListener(t,n[t])}exports.initTabListener=function(){typeof document<"u"&&(i("touchstart"),i("mousedown"))};
2
+ //# sourceMappingURL=tabListener.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tabListener.js","sources":["../../../../src/core/utils/tabListener.ts"],"sourcesContent":["let mousenavigation = false;\nlet touchnavigation = false;\nlet touchEventFired = false;\n\nconst listeners = {\n mousedown: handleMouseDown as EventListener,\n keydown: handleKeydown as EventListener,\n touchstart: handleTouchStart as EventListener,\n};\n\nfunction removeAllListeners() {\n (Object.keys(listeners) as Array<keyof typeof listeners>).forEach((listenerType) => {\n document.removeEventListener(listenerType, listeners[listenerType]);\n });\n}\n\nfunction addListener(listenerType: keyof typeof listeners) {\n document.addEventListener(listenerType, listeners[listenerType]);\n}\n\nfunction handleMouseDown() {\n if (!mousenavigation && !touchEventFired) {\n mousenavigation = true;\n touchnavigation = false;\n const htmlElement = document.querySelector(\"html\");\n htmlElement?.setAttribute(\"data-mousenavigation\", \"true\");\n htmlElement?.removeAttribute(\"data-touchnavigation\");\n\n // Reset listeners\n removeAllListeners();\n addListener(\"touchstart\");\n addListener(\"keydown\");\n }\n}\n\nfunction handleKeydown(event: KeyboardEvent) {\n if (event.key === \"Tab\") {\n const htmlElement = document.querySelector(\"html\");\n removeAllListeners();\n htmlElement?.removeAttribute(\"data-mousenavigation\");\n htmlElement?.removeAttribute(\"data-touchnavigation\");\n mousenavigation = false;\n touchnavigation = false;\n\n // Reset listeners\n addListener(\"touchstart\");\n addListener(\"mousedown\");\n }\n}\n\nfunction handleTouchStart() {\n if (!touchnavigation) {\n mousenavigation = false;\n touchnavigation = true;\n const htmlElement = document.querySelector(\"html\");\n htmlElement?.setAttribute(\"data-touchnavigation\", \"true\");\n htmlElement?.removeAttribute(\"data-mousenavigation\");\n\n // Reset listeners\n removeAllListeners();\n addListener(\"touchstart\");\n addListener(\"keydown\");\n addListener(\"mousedown\");\n }\n\n // Most touch devices fire both touch and mouse events on touch (in that order)\n // see https://w3c.github.io/touch-events/#mouse-events\n // Set a check variable to avoid resetting the data-attribute:\n touchEventFired = true;\n setTimeout(() => {\n touchEventFired = false;\n }, 150); // Yes, it can take this long between the events\n}\n\nexport function initTabListener(): void {\n if (typeof document !== \"undefined\") {\n addListener(\"touchstart\");\n addListener(\"mousedown\");\n }\n}\n"],"names":["mousenavigation","touchnavigation","touchEventFired","listeners","mousedown","htmlElement","document","querySelector","setAttribute","removeAttribute","removeAllListeners","addListener","keydown","event","key","touchstart","setTimeout","Object","keys","forEach","listenerType","removeEventListener","addEventListener"],"mappings":"gFAAA,IAAIA,GAAkB,EAClBC,GAAkB,EAClBC,GAAkB,EAEtB,MAAMC,EAAY,CACdC,UAeJ,WACQ,IAACJ,IAAoBE,EAAiB,CACpBF,GAAA,EACAC,GAAA,EACZ,MAAAI,EAAcC,SAASC,cAAc,QAC9B,MAAAF,GAAAA,EAAAG,aAAa,uBAAwB,QAClD,MAAAH,GAAAA,EAAaI,gBAAgB,wBAGVC,IACnBC,EAAY,cACZA,EAAY,UAChB,CACJ,EA3BIC,QA6BJ,SAAuBC,GACf,GAAc,QAAdA,EAAMC,IAAe,CACf,MAAAT,EAAcC,SAASC,cAAc,QACxBG,IACnB,MAAAL,GAAAA,EAAaI,gBAAgB,wBAC7B,MAAAJ,GAAAA,EAAaI,gBAAgB,wBACXT,GAAA,EACAC,GAAA,EAGlBU,EAAY,cACZA,EAAY,YAChB,CACJ,EAzCII,WA2CJ,WACI,IAAKd,EAAiB,CACAD,GAAA,EACAC,GAAA,EACZ,MAAAI,EAAcC,SAASC,cAAc,QAC9B,MAAAF,GAAAA,EAAAG,aAAa,uBAAwB,QAClD,MAAAH,GAAAA,EAAaI,gBAAgB,wBAGVC,IACnBC,EAAY,cACZA,EAAY,WACZA,EAAY,YAChB,CAKkBT,GAAA,EAClBc,YAAW,KACWd,GAAA,CAAA,GACnB,IACP,GA9DA,SAASQ,IACJO,OAAOC,KAAKf,GAA6CgB,SAASC,IAC/Dd,SAASe,oBAAoBD,EAAcjB,EAAUiB,GAAa,GAE1E,CAEA,SAAST,EAAYS,GACjBd,SAASgB,iBAAiBF,EAAcjB,EAAUiB,GACtD,yBAwDO,kBACQd,SAAa,MACpBK,EAAY,cACZA,EAAY,aAEpB"}
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./useAnimatedDetails/useAnimatedDetails.js"),s=require("./useAnimatedHeight/useAnimatedHeight.js"),r=require("./useAnimatedHeight/useAnimatedHeightBetween.js"),u=require("./useAnimatedHeight/useAutoAnimateHeight.js"),i=require("./useBrowserPreferences/useBrowserPreferences.js"),t=require("./useIntersectionObserver/useIntersectionObserver.js"),o=require("./useLocalStorage/useLocalStorage.js"),n=require("./useMutationObserver/useMutationObserver.js"),a=require("./usePreviousValue/usePreviousValue.js"),g=require("./useProgressiveImg/useProgressiveImg.js"),c=require("./useScreen/useScreen.js"),l=require("./useScrollIntoView/useScrollIntoView.js"),d=require("./useAriaLiveRegion/useAriaLiveRegion.js"),m=require("./useClickOutside/useClickOutside.js"),p=require("./useFocusOutside/useFocusOutside.js"),v=require("./useElementDimensions/useElementDimensions.js"),A=require("./useId/useId.js"),j=require("./useKeyListener/useKeyListener.js"),x=require("./useListNavigation/useListNavigation.js"),q=require("./useSwipeGesture/useSwipeGesture.js");exports.useAnimatedDetails=e.useAnimatedDetails,exports.useAnimatedHeight=s.useAnimatedHeight,exports.useAnimatedHeightBetween=r.useAnimatedHeightBetween,exports.useAutoAnimatedHeight=u.useAutoAnimatedHeight,exports.useBrowserPreferences=i.useBrowserPreferences,exports.useIntersectionObserver=t.useIntersectionObserver,exports.useLocalStorage=o.useLocalStorage,exports.useMutationObserver=n.useMutationObserver,exports.usePreviousValue=a.usePreviousValue,exports.useProgressiveImg=g.useProgressiveImg,exports.useScreen=c.useScreen,exports.useScrollIntoView=l.useScrollIntoView,exports.useAriaLiveRegion=d.useAriaLiveRegion,exports.useClickOutside=m.useClickOutside,exports.useFocusOutside=p.useFocusOutside,exports.useElementDimensions=v.useElementDimensions,exports.useId=A.useId,exports.useKeyListener=j.useKeyListener,exports.useListNavigation=x.useListNavigation,exports.useSwipeGesture=q.useSwipeGesture;
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"}),exports.addMediaQueryListener=function(e,t){typeof e.addEventListener<"u"?e.addEventListener("change",t):e.addListener(t)},exports.getInitialMediaQueryMatch=function(e){return!!window.matchMedia&&window.matchMedia(e).matches},exports.removeMediaQueryListener=function(e,t){typeof e.removeEventListener<"u"?e.removeEventListener("change",t):e.removeListener(t)};
2
+ //# sourceMappingURL=mediaQueryUtils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mediaQueryUtils.js","sources":["../../../src/hooks/mediaQueryUtils.ts"],"sourcesContent":["/**\n * Sjekker om et CSS Media Query matcher nettleserens egenskaper\n *\n * @param mediaQuery CSS Media Query som skal sjekkes. F.eks. `(orientation: portrait)`\n * @returns om det er match på queryen\n */\nexport function getInitialMediaQueryMatch(mediaQuery: string): boolean {\n if (!window.matchMedia) {\n // Enhetstester\n return false;\n }\n return window.matchMedia(mediaQuery).matches;\n}\n/**\n * Lytt på endringer i match mot et CSS Media Query\n *\n * @param queryList en MediaQueryList initiert med `window.matchMedia(<CSS Media Query>)`\n * @param callback funksjon som kalles når match for `queryList` endres\n */\nexport function addMediaQueryListener(queryList: MediaQueryList, callback: (e: MediaQueryListEvent) => void) {\n if (typeof queryList.addEventListener !== \"undefined\") {\n queryList.addEventListener(\"change\", callback);\n } else {\n queryList.addListener(callback);\n }\n}\n\n/**\n * Fjern en lytter fra en MediaQueryList\n *\n * @param queryList en MediaQueryList initiert med `window.matchMedia(<CSS Media Query>)`\n * @param callback lytter som skal fjernes\n */\nexport function removeMediaQueryListener(queryList: MediaQueryList, callback: (e: MediaQueryListEvent) => void) {\n if (typeof queryList.removeEventListener !== \"undefined\") {\n queryList.removeEventListener(\"change\", callback);\n } else {\n queryList.removeListener(callback);\n }\n}\n"],"names":["queryList","callback","addEventListener","addListener","mediaQuery","window","matchMedia","matches","removeEventListener","removeListener"],"mappings":"8GAmBgB,SAAsBA,EAA2BC,UAClDD,EAAUE,iBAAqB,IAC5BF,EAAAE,iBAAiB,SAAUD,GAErCD,EAAUG,YAAYF,EAE9B,oCAnBO,SAAmCG,GAClC,QAACC,OAAOC,YAILD,OAAOC,WAAWF,GAAYG,OACzC,mCAqBgB,SAAyBP,EAA2BC,UACrDD,EAAUQ,oBAAwB,IAC/BR,EAAAQ,oBAAoB,SAAUP,GAExCD,EAAUS,eAAeR,EAEjC"}
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./useAnimatedDetails.js");exports.useAnimatedDetails=e.useAnimatedDetails;
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react");exports.useAnimatedDetails=({onOpenChange:r,isExpanded:t})=>{const n=e.useRef(null),u=e.useRef(null),c=e.useRef(null),s=e.useRef(null),[i,o]=e.useState(!1),[a,f]=e.useState(!1);e.useEffect((()=>{l(t)}),[t]);const l=e=>{n.current&&u.current&&(n.current.open=e,s.current=null,o(!1),f(!1),n.current.style.overflow="",n.current.style.height="")};return{detailsRef:n,summaryRef:u,contentRef:c,onSummaryClick:e=>{e.preventDefault(),n.current&&u.current&&(n.current.style.overflow="hidden",i||!n.current.open?(e=>{n.current&&u.current&&(n.current.style.height=`${n.current.offsetHeight}px`,n.current.open=!0,requestAnimationFrame((()=>{if(n.current&&u.current&&c.current){f(!0),r(!0,e);const t=n.current.offsetHeight,i=u.current.offsetHeight+c.current.offsetHeight;s.current&&s.current.cancel(),n.current.animate&&(s.current=n.current.animate({height:[`${t}px`,`${i}px`]},{duration:150,easing:"ease"}),s.current.onfinish=()=>l(!0),s.current.oncancel=()=>f(!1))}})))})(e):(a||n.current.open)&&(e=>{if(n.current&&u.current){o(!0),r(!1,e);const t=n.current.offsetHeight,c=u.current.offsetHeight;s.current&&s.current.cancel(),n.current.animate&&(s.current=n.current.animate({height:[`${t}px`,`${c}px`]},{duration:150,easing:"ease"}),s.current.onfinish=()=>l(!1),s.current.oncancel=()=>o(!1))}})(e))}}};
2
+ //# sourceMappingURL=useAnimatedDetails.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useAnimatedDetails.js","sources":["../../../../src/hooks/useAnimatedDetails/useAnimatedDetails.ts"],"sourcesContent":["import { useEffect, useRef, useState } from \"react\";\n\n/**\n * Lar deg animere et HTML details element med en summary trigger og noe innhold.\n * HTML strukturen din bør se ut som omtrent\n * <details ref={detailsRef}>\n * <summary ref={summaryRef} onClick={onSummaryClick}>Trigger for å åpne</summary>\n * <div ref={contentRef}>Ekspanderbart innhold</div>\n * </details>\n *\n * @param onOpenChange Callback med informasjon om når elementet åpner/lukker seg.\n * @param isExpanded Styr åpning/lukking utenfra.\n */\nexport const useAnimatedDetails = ({\n onOpenChange,\n isExpanded,\n}: {\n onOpenChange: (open: boolean, e: React.MouseEvent<HTMLElement>) => void;\n isExpanded: boolean;\n}): {\n detailsRef: React.RefObject<HTMLDetailsElement>;\n summaryRef: React.RefObject<HTMLButtonElement>;\n contentRef: React.RefObject<HTMLDivElement>;\n onSummaryClick: React.MouseEventHandler<HTMLElement>;\n} => {\n const detailsRef = useRef<HTMLDetailsElement>(null);\n const summaryRef = useRef<HTMLButtonElement>(null);\n const contentRef = useRef<HTMLDivElement>(null);\n const animation = useRef<Animation | null>(null);\n\n const [isClosing, setIsClosing] = useState(false);\n const [isExpanding, setIsExpanding] = useState(false);\n\n useEffect(() => {\n onAnimationFinish(isExpanded);\n }, [isExpanded]);\n\n const onAnimationFinish = (open: boolean) => {\n if (detailsRef.current && summaryRef.current) {\n detailsRef.current.open = open;\n animation.current = null;\n setIsClosing(false);\n setIsExpanding(false);\n detailsRef.current.style.overflow = \"\";\n detailsRef.current.style.height = \"\";\n }\n };\n\n const open = (e: React.MouseEvent<HTMLElement>) => {\n if (detailsRef.current && summaryRef.current) {\n detailsRef.current.style.height = `${detailsRef.current.offsetHeight}px`;\n detailsRef.current.open = true;\n requestAnimationFrame(() => {\n if (detailsRef.current && summaryRef.current && contentRef.current) {\n setIsExpanding(true);\n onOpenChange(true, e);\n const startHeight = detailsRef.current.offsetHeight;\n const endHeight = summaryRef.current.offsetHeight + contentRef.current.offsetHeight;\n\n if (animation.current) {\n animation.current.cancel();\n }\n\n if (detailsRef.current.animate) {\n animation.current = detailsRef.current.animate(\n {\n height: [`${startHeight}px`, `${endHeight}px`],\n },\n {\n duration: 150,\n easing: \"ease\",\n },\n );\n animation.current.onfinish = () => onAnimationFinish(true);\n animation.current.oncancel = () => setIsExpanding(false);\n }\n }\n });\n }\n };\n\n const close = (e: React.MouseEvent<HTMLElement>) => {\n if (detailsRef.current && summaryRef.current) {\n setIsClosing(true);\n onOpenChange(false, e);\n const startHeight = detailsRef.current.offsetHeight;\n const endHeight = summaryRef.current.offsetHeight;\n if (animation.current) {\n animation.current.cancel();\n }\n\n if (detailsRef.current.animate) {\n animation.current = detailsRef.current.animate(\n {\n height: [`${startHeight}px`, `${endHeight}px`],\n },\n {\n duration: 150,\n easing: \"ease\",\n },\n );\n animation.current.onfinish = () => onAnimationFinish(false);\n animation.current.oncancel = () => setIsClosing(false);\n }\n }\n };\n\n const onSummaryClick = (e: React.MouseEvent<HTMLElement>) => {\n e.preventDefault();\n if (detailsRef.current && summaryRef.current) {\n detailsRef.current.style.overflow = \"hidden\";\n if (isClosing || !detailsRef.current.open) {\n open(e);\n } else if (isExpanding || detailsRef.current.open) {\n close(e);\n }\n }\n };\n\n return { detailsRef, summaryRef, contentRef, onSummaryClick };\n};\n"],"names":["onOpenChange","isExpanded","detailsRef","useRef","summaryRef","contentRef","animation","isClosing","setIsClosing","useState","isExpanding","setIsExpanding","useEffect","onAnimationFinish","open","current","style","overflow","height","onSummaryClick","e","preventDefault","offsetHeight","requestAnimationFrame","startHeight","endHeight","cancel","animate","duration","easing","onfinish","oncancel","close"],"mappings":"oIAakC,EAC9BA,aAAAA,EACAC,WAAAA,MAUM,MAAAC,EAAaC,SAA2B,MACxCC,EAAaD,SAA0B,MACvCE,EAAaF,SAAuB,MACpCG,EAAYH,SAAyB,OAEpCI,EAAWC,GAAgBC,YAAS,IACpCC,EAAaC,GAAkBF,YAAS,GAE/CG,EAAAA,WAAU,KACNC,EAAkBZ,EAAU,GAC7B,CAACA,IAEE,MAAAY,EAAqBC,IACnBZ,EAAWa,SAAWX,EAAWW,UACjCb,EAAWa,QAAQD,KAAOA,EAC1BR,EAAUS,QAAU,KACpBP,GAAa,GACbG,GAAe,GACJT,EAAAa,QAAQC,MAAMC,SAAW,GACzBf,EAAAa,QAAQC,MAAME,OAAS,GAAA,EA2E1C,MAAO,CAAEhB,WAAAA,EAAYE,WAAAA,EAAYC,WAAAA,EAAYc,eAZrBC,IACpBA,EAAEC,iBACEnB,EAAWa,SAAWX,EAAWW,UACtBb,EAAAa,QAAQC,MAAMC,SAAW,SAChCV,IAAcL,EAAWa,QAAQD,KA/D/BM,KACNlB,EAAWa,SAAWX,EAAWW,UACjCb,EAAWa,QAAQC,MAAME,OAAS,GAAGhB,EAAWa,QAAQO,iBACxDpB,EAAWa,QAAQD,MAAO,EAC1BS,uBAAsB,KAClB,GAAIrB,EAAWa,SAAWX,EAAWW,SAAWV,EAAWU,QAAS,CAChEJ,GAAe,GACfX,GAAa,EAAMoB,GACb,MAAAI,EAActB,EAAWa,QAAQO,aACjCG,EAAYrB,EAAWW,QAAQO,aAAejB,EAAWU,QAAQO,aAEnEhB,EAAUS,SACVT,EAAUS,QAAQW,SAGlBxB,EAAWa,QAAQY,UACTrB,EAAAS,QAAUb,EAAWa,QAAQY,QACnC,CACIT,OAAQ,CAAC,GAAGM,MAAiB,GAAGC,QAEpC,CACIG,SAAU,IACVC,OAAQ,SAGhBvB,EAAUS,QAAQe,SAAW,IAAMjB,GAAkB,GACrDP,EAAUS,QAAQgB,SAAW,IAAMpB,GAAe,GAE1D,KAER,EAkCQG,CAAKM,IACEV,GAAeR,EAAWa,QAAQD,OAhCtCM,KACP,GAAAlB,EAAWa,SAAWX,EAAWW,QAAS,CAC1CP,GAAa,GACbR,GAAa,EAAOoB,GACd,MAAAI,EAActB,EAAWa,QAAQO,aACjCG,EAAYrB,EAAWW,QAAQO,aACjChB,EAAUS,SACVT,EAAUS,QAAQW,SAGlBxB,EAAWa,QAAQY,UACTrB,EAAAS,QAAUb,EAAWa,QAAQY,QACnC,CACIT,OAAQ,CAAC,GAAGM,MAAiB,GAAGC,QAEpC,CACIG,SAAU,IACVC,OAAQ,SAGhBvB,EAAUS,QAAQe,SAAW,IAAMjB,GAAkB,GACrDP,EAAUS,QAAQgB,SAAW,IAAMvB,GAAa,GAExD,GAUQwB,CAAMZ,GAAC,EAKyC"}
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./useAnimatedHeight.js"),t=require("./useAnimatedHeightBetween.js"),i=require("./useAutoAnimateHeight.js");exports.useAnimatedHeight=e.useAnimatedHeight,exports.useAnimatedHeightBetween=t.useAnimatedHeightBetween,exports.useAutoAnimatedHeight=i.useAutoAnimatedHeight;
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react"),t=require("../../core/utils/motion.js"),r=require("../useBrowserPreferences/useBrowserPreferences.js"),n=require("../usePreviousValue/usePreviousValue.js");exports.useAnimatedHeight=function(i,s){const l=n.usePreviousValue(i),o=(null==s?void 0:s.easing)||"standard",u=(null==s?void 0:s.timing)||"productive",a=(null==s?void 0:s.display)||"block",c=`${t.timings[u]} height ${t.easings[o]}`,{prefersReducedMotion:d}=r.useBrowserPreferences(),v=e.useRef(),f=e.useRef(),y=e.useRef(null);function m(e){var t;const r=y.current;r&&e.target===r&&(i?r.removeAttribute("style"):(r.removeAttribute("style"),r.style.display="none"),null==(t=null==s?void 0:s.onTransitionEnd)||t.call(s,i,y))}const g=e.useCallback((()=>{var e,t,r,n;const o=y.current;if(o&&void 0!==l){if(i){if(i&&l)return}else if(o.style.display="none",!l)return;if(null==(e=null==s?void 0:s.onTransitionStart)||e.call(s,i,y),d)return o.removeAttribute("style"),i&&(null==(t=null==s?void 0:s.onFirstVisible)||t.call(s,i,y)),void(null==(r=null==s?void 0:s.onTransitionEnd)||r.call(s,i,y));if(o.style.transition=c,o.style.display=a,o.style.overflow="hidden",i)null==(n=null==s?void 0:s.onFirstVisible)||n.call(s,i,y),o.style.height="0",o.style.height=`${o.scrollHeight}px`;else{if(0===o.scrollHeight)return void o.removeAttribute("style");o.style.height=`${o.scrollHeight}px`,v.current=requestAnimationFrame((()=>{f.current=requestAnimationFrame((()=>{o.style.height="0px"}))}))}}}),[i,s,l,c,d,a]);return e.useEffect((()=>{g()}),[i,g]),e.useEffect((()=>{const e=y.current;return e&&e.addEventListener("transitionend",m),()=>{e&&e.removeEventListener("transitionend",m)}}),[i]),e.useEffect((()=>{const e=v.current,t=f.current;return()=>{e&&cancelAnimationFrame(e),t&&cancelAnimationFrame(t)}}),[v,f]),[y,g]};
2
+ //# sourceMappingURL=useAnimatedHeight.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useAnimatedHeight.js","sources":["../../../../src/hooks/useAnimatedHeight/useAnimatedHeight.ts"],"sourcesContent":["import { type RefObject, useCallback, useEffect, useRef } from \"react\";\nimport { easings, timings } from \"../../core\";\nimport { useBrowserPreferences } from \"../useBrowserPreferences/useBrowserPreferences\";\nimport { usePreviousValue } from \"../usePreviousValue/usePreviousValue\";\nimport { UseAnimatedHeightOptions } from \"./types\";\n\nconst defaultDisplay = \"block\";\nconst defaultEasing = \"standard\";\nconst defaultTiming = \"productive\";\n\n/**\n * Lar deg animere et element opp til sin maksimale høyde, eller ned til 0.\n *\n * @param isOpen Om elementet er åpent eller lukket.\n * @param options Konfigurer display-property, easing og timing, og eventuelle callbacks for life cycle til animasjonen.\n * @returns Ref til elementet som skal animeres, og en funksjon for å trigge animasjonen manuelt.\n */\nexport function useAnimatedHeight<T extends HTMLElement>(\n isOpen: boolean,\n options?: UseAnimatedHeightOptions<T>,\n): [RefObject<T>, () => void] {\n const wasOpen = usePreviousValue(isOpen);\n const easing = options?.easing || defaultEasing;\n const timing = options?.timing || defaultTiming;\n const display = options?.display || defaultDisplay;\n const transition = `${timings[timing]} height ${easings[easing]}`;\n\n const { prefersReducedMotion } = useBrowserPreferences();\n\n const raf1 = useRef<number>();\n const raf2 = useRef<number>();\n const elementRef = useRef<T>(null);\n\n function handleTransitionEnd(event: TransitionEvent) {\n const element = elementRef.current;\n\n // Ignore bubbling transitions from within container\n if (element && event.target === element) {\n if (isOpen) {\n element.removeAttribute(\"style\");\n } else {\n element.removeAttribute(\"style\");\n element.style.display = \"none\";\n }\n options?.onTransitionEnd?.(isOpen, elementRef);\n }\n }\n\n const runAnimation = useCallback(() => {\n const element = elementRef.current;\n\n // Ikke kjør animasjonen hvis elementet ikke er rendret,\n // eller hvis det er første render.\n if (!element || wasOpen === undefined) {\n return;\n }\n\n if (!isOpen) {\n element.style.display = \"none\";\n if (!wasOpen) {\n // Første render eller rerender med isOpen false\n return;\n }\n } else if (isOpen && wasOpen) {\n // Re-render etter å ha vært lukket, men forblitt åpen.\n return;\n }\n\n options?.onTransitionStart?.(isOpen, elementRef);\n\n if (prefersReducedMotion) {\n element.removeAttribute(\"style\");\n if (isOpen) {\n options?.onFirstVisible?.(isOpen, elementRef);\n }\n options?.onTransitionEnd?.(isOpen, elementRef); // make sure to call callback when animation is off\n return;\n }\n\n element.style.transition = transition;\n element.style.display = display;\n element.style.overflow = \"hidden\";\n\n if (isOpen) {\n options?.onFirstVisible?.(isOpen, elementRef);\n element.style.height = \"0\";\n element.style.height = `${element.scrollHeight}px`;\n } else {\n // If the scrollHeight is 0 it means that we are transitioning from height 0 -> 0.\n // This causes the \"transitionend\"-event to never fire and the element gets stuck with\n // style: height: 0; display: block; overflow:hidden\n if (element.scrollHeight === 0) {\n element.removeAttribute(\"style\");\n return;\n }\n\n element.style.height = `${element.scrollHeight}px`;\n\n raf1.current = requestAnimationFrame(() => {\n raf2.current = requestAnimationFrame(() => {\n element.style.height = `${0}px`;\n });\n });\n }\n }, [isOpen, options, wasOpen, transition, prefersReducedMotion, display]);\n\n useEffect(() => {\n runAnimation();\n }, [isOpen, runAnimation]);\n\n useEffect(() => {\n const element = elementRef.current;\n if (element) {\n element.addEventListener(\"transitionend\", handleTransitionEnd);\n }\n\n return () => {\n if (element) {\n element.removeEventListener(\"transitionend\", handleTransitionEnd);\n }\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [isOpen]);\n\n useEffect(() => {\n const r1 = raf1.current;\n const r2 = raf2.current;\n return () => {\n r1 && cancelAnimationFrame(r1);\n r2 && cancelAnimationFrame(r2);\n };\n }, [raf1, raf2]);\n\n return [elementRef, runAnimation];\n}\n"],"names":["isOpen","options","wasOpen","usePreviousValue","easing","timing","display","transition","timings","easings","prefersReducedMotion","useBrowserPreferences","raf1","useRef","raf2","elementRef","handleTransitionEnd","event","element","current","target","removeAttribute","style","_a","onTransitionEnd","call","runAnimation","useCallback","onTransitionStart","_b","onFirstVisible","_c","overflow","_d","height","scrollHeight","requestAnimationFrame","useEffect","addEventListener","removeEventListener","r1","r2","cancelAnimationFrame"],"mappings":"+RAiBgB,SACZA,EACAC,GAEM,MAAAC,EAAUC,mBAAiBH,GAC3BI,GAAS,MAAAH,OAAA,EAAAA,EAASG,SAfN,WAgBZC,GAAS,MAAAJ,OAAA,EAAAA,EAASI,SAfN,aAgBZC,GAAU,MAAAL,OAAA,EAAAA,EAASK,UAlBN,QAmBbC,EAAa,GAAGC,EAAAA,QAAQH,aAAkBI,EAAAA,QAAQL,MAEhDM,qBAAAA,GAAyBC,EAAAA,wBAE3BC,EAAOC,EAAAA,SACPC,EAAOD,EAAAA,SACPE,EAAaF,SAAU,MAE7B,SAASG,EAAoBC,SACzB,MAAMC,EAAUH,EAAWI,QAGvBD,GAAWD,EAAMG,SAAWF,IACxBlB,EACAkB,EAAQG,gBAAgB,UAExBH,EAAQG,gBAAgB,SACxBH,EAAQI,MAAMhB,QAAU,QAEnB,OAAAiB,EAAA,MAAAtB,SAAAA,EAAAuB,kBAAAD,EAAAE,KAAAxB,EAAkBD,EAAQe,GAE3C,CAEM,MAAAW,EAAeC,EAAAA,aAAY,iBAC7B,MAAMT,EAAUH,EAAWI,QAIvB,GAACD,QAAuB,IAAZhB,EAIhB,CAAKF,GAAAA,GAML,GAAWA,GAAUE,EAEjB,eAPAgB,EAAQI,MAAMhB,QAAU,QACnBJ,EAED,OASR,GAFS,OAAAqB,EAAA,MAAAtB,OAAA,EAAAA,EAAA2B,oBAAAL,EAAAE,KAAAxB,EAAoBD,EAAQe,GAEjCL,EAMA,OALAQ,EAAQG,gBAAgB,SACpBrB,IACS,OAAA6B,EAAA,MAAA5B,SAAAA,EAAA6B,iBAAAD,EAAAJ,KAAAxB,EAAiBD,EAAQe,SAE7B,OAAAgB,EAAA,MAAA9B,OAAA,EAAAA,EAAAuB,kBAAAO,EAAAN,KAAAxB,EAAkBD,EAAQe,IAQvC,GAJAG,EAAQI,MAAMf,WAAaA,EAC3BW,EAAQI,MAAMhB,QAAUA,EACxBY,EAAQI,MAAMU,SAAW,SAErBhC,EACS,OAAAiC,EAAA,MAAAhC,SAAAA,EAAA6B,iBAAAG,EAAAR,KAAAxB,EAAiBD,EAAQe,GAClCG,EAAQI,MAAMY,OAAS,IACvBhB,EAAQI,MAAMY,OAAS,GAAGhB,EAAQiB,qBAC/B,CAIC,GAAyB,IAAzBjB,EAAQiB,aAER,YADAjB,EAAQG,gBAAgB,SAI5BH,EAAQI,MAAMY,OAAS,GAAGhB,EAAQiB,iBAE7BvB,EAAAO,QAAUiB,uBAAsB,KAC5BtB,EAAAK,QAAUiB,uBAAsB,KACzBlB,EAAAI,MAAMY,OAAS,QAC1B,GAET,CAAA,IACD,CAAClC,EAAQC,EAASC,EAASK,EAAYG,EAAsBJ,IAEhE+B,OAAAA,EAAAA,WAAU,KACOX,MACd,CAAC1B,EAAQ0B,IAEZW,EAAAA,WAAU,KACN,MAAMnB,EAAUH,EAAWI,QAC3B,OAAID,GACQA,EAAAoB,iBAAiB,gBAAiBtB,GAGvC,KACCE,GACQA,EAAAqB,oBAAoB,gBAAiBvB,EAAmB,CACpE,GAGL,CAAChB,IAEJqC,EAAAA,WAAU,KACN,MAAMG,EAAK5B,EAAKO,QACVsB,EAAK3B,EAAKK,QAChB,MAAO,KACHqB,GAAME,qBAAqBF,GAC3BC,GAAMC,qBAAqBD,EAAE,CAAA,GAElC,CAAC7B,EAAME,IAEH,CAACC,EAAYW,EACxB"}
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react"),t=require("../../core/utils/motion.js"),r=require("../useBrowserPreferences/useBrowserPreferences.js"),n=require("../usePreviousValue/usePreviousValue.js");exports.useAnimatedHeightBetween=function(s,i){const o=n.usePreviousValue(s),u=(null==i?void 0:i.easing)||"standard",a=(null==i?void 0:i.timing)||"productive",l=`${t.timings[a]} height ${t.easings[u]}`,{prefersReducedMotion:c}=r.useBrowserPreferences(),d=e.useRef(),f=e.useRef(),y=e.useRef(null),p=e.useCallback((e=>{var t;const r=y.current;r&&e.target===r&&(r.removeAttribute("style"),null==(t=null==i?void 0:i.onTransitionEnd)||t.call(i,s,y))}),[i,s]),v=e.useCallback((()=>{var e,t;const r=y.current;if(r&&(void 0===o&&(r.dataset.expanded=s?"true":"false"),!(!s&&!o||s&&o))){if(null==(e=null==i?void 0:i.onTransitionStart)||e.call(i,s,y),c)return r.removeAttribute("style"),r.dataset.expanded=s?"true":"false",void(null==(t=null==i?void 0:i.onTransitionEnd)||t.call(i,s,y));s?function(e,t,r,n){const s=e.current;if(!s)return;s.removeAttribute("style");const i=s.scrollHeight;r.current=requestAnimationFrame((()=>{s.style.removeProperty("transition"),s.dataset.expanded="false";const e=s.getBoundingClientRect().height;s.style.setProperty("height",`${e}px`),s.style.setProperty("overflow-y","hidden"),n.current=requestAnimationFrame((()=>{s.style.setProperty("transition",t),s.style.setProperty("height",`${i}px`),s.dataset.expanded="true"}))}))}(y,l,d,f):function(e,t,r,n){const s=e.current;if(!s)return;s.removeAttribute("style");const i=s.scrollHeight;r.current=requestAnimationFrame((()=>{s.style.removeProperty("transition"),s.dataset.expanded="false";const e=s.getBoundingClientRect().height;s.dataset.expanded="true",s.style.setProperty("height",`${i}px`),s.style.setProperty("overflow-y","hidden"),n.current=requestAnimationFrame((()=>{s.style.setProperty("transition",t),s.style.setProperty("height",`${e}px`),s.dataset.expanded="false"}))}))}(y,l,d,f)}}),[o,s,i,c,l]);return e.useEffect((()=>{v()}),[s,v]),e.useEffect((()=>{const e=y.current;return e&&e.addEventListener("transitionend",p),()=>{e&&e.removeEventListener("transitionend",p)}}),[s]),e.useEffect((()=>{const e=d.current,t=f.current;return()=>{e&&cancelAnimationFrame(e),t&&cancelAnimationFrame(t)}}),[d,f]),[y,v]};
2
+ //# sourceMappingURL=useAnimatedHeightBetween.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useAnimatedHeightBetween.js","sources":["../../../../src/hooks/useAnimatedHeight/useAnimatedHeightBetween.ts"],"sourcesContent":["import { type RefObject, useCallback, useEffect, useRef } from \"react\";\nimport { timings, easings } from \"../../core\";\nimport { useBrowserPreferences } from \"../useBrowserPreferences/useBrowserPreferences\";\nimport { usePreviousValue } from \"../usePreviousValue/usePreviousValue\";\nimport { UseAnimatedHeightOptions } from \"./types\";\n\nconst defaultEasing = \"standard\";\nconst defaultTiming = \"productive\";\n\nfunction collapseElement<T extends HTMLElement>(\n elementRef: RefObject<T>,\n transition: string,\n raf1: React.MutableRefObject<number | undefined>,\n raf2: React.MutableRefObject<number | undefined>,\n) {\n const element = elementRef.current;\n\n if (!element) return;\n\n element.removeAttribute(\"style\");\n const expandedHeight = element.scrollHeight;\n\n raf1.current = requestAnimationFrame(() => {\n // Hent kollapset høyde\n element.style.removeProperty(\"transition\");\n element.dataset[\"expanded\"] = \"false\";\n const collapsedHeight = element.getBoundingClientRect().height;\n element.dataset[\"expanded\"] = \"true\";\n\n // Sett høyde tilbake til utvidet høyde\n element.style.setProperty(\"height\", `${expandedHeight}px`);\n element.style.setProperty(\"overflow-y\", \"hidden\");\n\n raf2.current = requestAnimationFrame(() => {\n // Sett høyde til kollapset høyde og start transition\n element.style.setProperty(\"transition\", transition);\n element.style.setProperty(\"height\", `${collapsedHeight}px`);\n element.dataset[\"expanded\"] = \"false\";\n });\n });\n}\n\nfunction expandElement<T extends HTMLElement>(\n elementRef: RefObject<T>,\n transition: string,\n raf1: React.MutableRefObject<number | undefined>,\n raf2: React.MutableRefObject<number | undefined>,\n) {\n const element = elementRef.current;\n\n if (!element) return;\n\n element.removeAttribute(\"style\");\n const expandedHeight = element.scrollHeight;\n\n raf1.current = requestAnimationFrame(() => {\n // Hent utvidet høyde\n element.style.removeProperty(\"transition\");\n element.dataset[\"expanded\"] = \"false\";\n const collapsedHeight = element.getBoundingClientRect().height;\n\n // Sett høyde tilbake til kollapset høyde\n element.style.setProperty(\"height\", `${collapsedHeight}px`);\n element.style.setProperty(\"overflow-y\", \"hidden\");\n\n raf2.current = requestAnimationFrame(() => {\n // Sett høyde til utvidet høyde og start transition\n element.style.setProperty(\"transition\", transition);\n element.style.setProperty(\"height\", `${expandedHeight}px`);\n element.dataset[\"expanded\"] = \"true\";\n });\n });\n}\n\n/**\n * Lar deg enklere animere mellom to tilstander, gitt ved å sette `data-expanded` på et element til `true` eller `false`.\n * Du bestemmer selv hvilke stiler elementet skal ha i de to tilstandene (vha CSS/Sass), og høyden animeres dersom den endrer seg.\n * @param isExpanded indikerer om elementet skal være utvidet eller ikke\n * @param options konfigurasjon for animasjonen, og lyttere for når animasjonen starter og slutter\n * @returns En tuple med referanse til elementet og en funksjon som kan trigge animasjonen\n */\nexport function useAnimatedHeightBetween<T extends HTMLElement>(\n isExpanded: boolean,\n options?: Omit<UseAnimatedHeightOptions<T>, \"display\" | \"onFirstVisible\">,\n): [RefObject<T>, () => void] {\n const wasExpanded = usePreviousValue(isExpanded);\n const easing = options?.easing || defaultEasing;\n const timing = options?.timing || defaultTiming;\n const transition = `${timings[timing]} height ${easings[easing]}`;\n\n const { prefersReducedMotion } = useBrowserPreferences();\n\n const raf1 = useRef<number>();\n const raf2 = useRef<number>();\n const elementRef = useRef<T>(null);\n\n const handleTransitionEnd = useCallback(\n (event: TransitionEvent) => {\n const element = elementRef.current;\n\n // Ignore bubbling transitions from within container\n if (element && event.target === element) {\n element.removeAttribute(\"style\");\n options?.onTransitionEnd?.(isExpanded, elementRef);\n }\n },\n [options, isExpanded],\n );\n\n const runAnimation = useCallback(() => {\n const element = elementRef.current;\n\n if (!element) return;\n\n if (wasExpanded === undefined) {\n // Første render\n element.dataset[\"expanded\"] = isExpanded ? \"true\" : \"false\";\n }\n\n if ((!isExpanded && !wasExpanded) || (isExpanded && wasExpanded)) {\n // Ingen endring\n return;\n }\n\n options?.onTransitionStart?.(isExpanded, elementRef);\n\n if (prefersReducedMotion) {\n element.removeAttribute(\"style\");\n element.dataset[\"expanded\"] = isExpanded ? \"true\" : \"false\";\n options?.onTransitionEnd?.(isExpanded, elementRef); // make sure to call callback when animation is off\n return;\n }\n\n if (isExpanded) {\n expandElement(elementRef, transition, raf1, raf2);\n } else {\n collapseElement(elementRef, transition, raf1, raf2);\n }\n }, [wasExpanded, isExpanded, options, prefersReducedMotion, transition]);\n\n useEffect(() => {\n runAnimation();\n }, [isExpanded, runAnimation]);\n\n useEffect(() => {\n const element = elementRef.current;\n if (element) {\n element.addEventListener(\"transitionend\", handleTransitionEnd);\n }\n\n return () => {\n if (element) {\n element.removeEventListener(\"transitionend\", handleTransitionEnd);\n }\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [isExpanded]);\n\n useEffect(() => {\n const r1 = raf1.current;\n const r2 = raf2.current;\n return () => {\n r1 && cancelAnimationFrame(r1);\n r2 && cancelAnimationFrame(r2);\n };\n }, [raf1, raf2]);\n\n return [elementRef, runAnimation];\n}\n"],"names":["isExpanded","options","wasExpanded","usePreviousValue","easing","timing","transition","timings","easings","prefersReducedMotion","useBrowserPreferences","raf1","useRef","raf2","elementRef","handleTransitionEnd","useCallback","event","element","current","target","removeAttribute","_a","onTransitionEnd","call","runAnimation","dataset","expanded","onTransitionStart","_b","expandedHeight","scrollHeight","requestAnimationFrame","style","removeProperty","collapsedHeight","getBoundingClientRect","height","setProperty","expandElement","collapseElement","useEffect","addEventListener","removeEventListener","r1","r2","cancelAnimationFrame"],"mappings":"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"}
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react"),r=require("../../core/utils/motion.js"),t=require("../useBrowserPreferences/useBrowserPreferences.js"),n=require("../usePreviousValue/usePreviousValue.js");exports.useAutoAnimatedHeight=function(s,i){const o=n.usePreviousValue(s),[u,l]=e.useState(0),a=(null==i?void 0:i.easing)||"standard",c=(null==i?void 0:i.timing)||"expressive",d=`${r.timings[c]} height ${r.easings[a]}`,{prefersReducedMotion:v}=t.useBrowserPreferences(),f=e.useRef(),m=e.useRef(),y=e.useRef(null),g=e.useCallback((e=>{var r;const t=y.current;t&&e.target===t&&(t.removeAttribute("style"),null==(r=null==i?void 0:i.onTransitionEnd)||r.call(i,y))}),[i]),p=e.useCallback((()=>{const e=y.current;if(!e)return;e.removeAttribute("style");const r=e.scrollHeight;f.current=requestAnimationFrame((()=>{e.style.removeProperty("transition"),e.style.setProperty("height",`${u}px`),e.style.setProperty("overflow-y","hidden"),m.current=requestAnimationFrame((()=>{e.style.setProperty("transition",d),e.style.setProperty("height",`${r}px`)}))})),l(r)}),[d,u]),P=e.useCallback((()=>{var e,r;const t=y.current;if(t){if(void 0===o)return void l(t.scrollHeight);if(s!==o){if(null==(e=null==i?void 0:i.onTransitionStart)||e.call(i,y),v)return void(null==(r=null==i?void 0:i.onTransitionEnd)||r.call(i,y));p()}}}),[p,s,o,i,v]);return e.useEffect((()=>{P()}),[s,P]),e.useEffect((()=>{const e=y.current;return e&&e.addEventListener("transitionend",g),()=>{e&&e.removeEventListener("transitionend",g)}}),[g]),e.useEffect((()=>{const e=f.current,r=m.current;return()=>{e&&cancelAnimationFrame(e),r&&cancelAnimationFrame(r)}}),[f,m]),y};
2
+ //# sourceMappingURL=useAutoAnimateHeight.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useAutoAnimateHeight.js","sources":["../../../../src/hooks/useAnimatedHeight/useAutoAnimateHeight.ts"],"sourcesContent":["import { RefObject, useCallback, useEffect, useRef, useState } from \"react\";\nimport { easings, timings, type Easing, type Timing } from \"../../core\";\nimport { useBrowserPreferences } from \"../useBrowserPreferences/useBrowserPreferences\";\nimport { usePreviousValue } from \"../usePreviousValue/usePreviousValue\";\n\nconst defaultEasing = \"standard\";\nconst defaultTiming = \"expressive\";\n\nexport type UseAutoAnimatedHeightOptions<T extends HTMLElement> = {\n easing?: Easing;\n /**\n * Overstyr standard timing\n * @default \"expressive\"\n */\n timing?: Timing;\n onTransitionStart?: (ref: RefObject<T>) => void;\n onTransitionEnd?: (ref: RefObject<T>) => void;\n};\n\n/**\n * Gjør det enklere å animere høyden på et element når innholdet endrer seg, men kan brukes på mer generelt grunnlag.\n * Hooken tar inn en triggerverdi, og når denne endrer seg animeres høyden på elementet dersom den har endret seg.\n * @param trigger verdien som brukes til å trigge animasjonen. Dersom denne endrer seg animeres høyden på elementet.\n * @param options konfigurasjon for animasjonen, og lyttere for når animasjonen starter og slutter\n * @returns en referanse til elementet som skal animeres\n */\nexport function useAutoAnimatedHeight<T extends HTMLElement = HTMLElement>(\n trigger: any,\n options?: UseAutoAnimatedHeightOptions<T>,\n) {\n const previousTriggerValue = usePreviousValue(trigger);\n const [previousHeight, setPreviousHeight] = useState(0);\n\n const easing = options?.easing || defaultEasing;\n const timing = options?.timing || defaultTiming;\n const transition = `${timings[timing]} height ${easings[easing]}`;\n\n const { prefersReducedMotion } = useBrowserPreferences();\n\n const raf1 = useRef<number>();\n const raf2 = useRef<number>();\n const elementRef = useRef<T>(null);\n\n const handleTransitionEnd = useCallback(\n (event: TransitionEvent) => {\n const element = elementRef.current;\n\n // Ignore bubbling transitions from within container\n if (element && event.target === element) {\n element.removeAttribute(\"style\");\n options?.onTransitionEnd?.(elementRef);\n }\n },\n [options],\n );\n\n const animateElement = useCallback(() => {\n const element = elementRef.current;\n\n if (!element) return;\n\n element.removeAttribute(\"style\");\n const newHeight = element.scrollHeight;\n\n raf1.current = requestAnimationFrame(() => {\n // Sett høyde tilbake til forrige høyde\n element.style.removeProperty(\"transition\");\n element.style.setProperty(\"height\", `${previousHeight}px`);\n element.style.setProperty(\"overflow-y\", \"hidden\");\n\n raf2.current = requestAnimationFrame(() => {\n // Sett høyde til kollapset høyde og start transition\n element.style.setProperty(\"transition\", transition);\n element.style.setProperty(\"height\", `${newHeight}px`);\n });\n });\n\n setPreviousHeight(newHeight);\n }, [transition, previousHeight]);\n\n const runAnimation = useCallback(() => {\n const element = elementRef.current;\n\n if (!element) return;\n\n if (previousTriggerValue === undefined) {\n // Første render\n setPreviousHeight(element.scrollHeight);\n return;\n }\n\n if (trigger === previousTriggerValue) {\n // Ingen endring\n return;\n }\n\n options?.onTransitionStart?.(elementRef);\n\n if (prefersReducedMotion) {\n options?.onTransitionEnd?.(elementRef); // make sure to call callback when animation is off\n return;\n }\n\n animateElement();\n }, [animateElement, trigger, previousTriggerValue, options, prefersReducedMotion]);\n\n useEffect(() => {\n runAnimation();\n }, [trigger, runAnimation]);\n\n useEffect(() => {\n const element = elementRef.current;\n if (element) {\n element.addEventListener(\"transitionend\", handleTransitionEnd);\n }\n\n return () => {\n if (element) {\n element.removeEventListener(\"transitionend\", handleTransitionEnd);\n }\n };\n }, [handleTransitionEnd]);\n\n useEffect(() => {\n const r1 = raf1.current;\n const r2 = raf2.current;\n return () => {\n r1 && cancelAnimationFrame(r1);\n r2 && cancelAnimationFrame(r2);\n };\n }, [raf1, raf2]);\n\n return elementRef;\n}\n"],"names":["trigger","options","previousTriggerValue","usePreviousValue","previousHeight","setPreviousHeight","useState","easing","timing","transition","timings","easings","prefersReducedMotion","useBrowserPreferences","raf1","useRef","raf2","elementRef","handleTransitionEnd","useCallback","event","element","current","target","removeAttribute","_a","onTransitionEnd","call","animateElement","newHeight","scrollHeight","requestAnimationFrame","style","removeProperty","setProperty","runAnimation","onTransitionStart","_b","useEffect","addEventListener","removeEventListener","r1","r2","cancelAnimationFrame"],"mappings":"mSA0BgB,SACZA,EACAC,GAEM,MAAAC,EAAuBC,mBAAiBH,IACvCI,EAAgBC,GAAqBC,WAAS,GAE/CC,GAAS,MAAAN,OAAAA,EAAAA,EAASM,SA5BN,WA6BZC,GAAS,MAAAP,OAAAA,EAAAA,EAASO,SA5BN,aA6BZC,EAAa,GAAGC,EAAAA,QAAQF,aAAkBG,EAAAA,QAAQJ,MAEhDK,qBAAAA,GAAyBC,EAAAA,wBAE3BC,EAAOC,EAAAA,SACPC,EAAOD,EAAAA,SACPE,EAAaF,SAAU,MAEvBG,EAAsBC,EAAAA,aACvBC,UACG,MAAMC,EAAUJ,EAAWK,QAGvBD,GAAWD,EAAMG,SAAWF,IAC5BA,EAAQG,gBAAgB,SACxB,OAAAC,EAAA,MAAAxB,OAAAA,EAAAA,EAASyB,kBAATD,EAAAE,KAAA1B,EAA2BgB,MAGnC,CAAChB,IAGC2B,EAAiBT,EAAAA,aAAY,KAC/B,MAAME,EAAUJ,EAAWK,QAE3B,IAAKD,EAAS,OAEdA,EAAQG,gBAAgB,SACxB,MAAMK,EAAYR,EAAQS,aAErBhB,EAAAQ,QAAUS,uBAAsB,KAEzBV,EAAAW,MAAMC,eAAe,cAC7BZ,EAAQW,MAAME,YAAY,SAAU,GAAG9B,OAC/BiB,EAAAW,MAAME,YAAY,aAAc,UAEnClB,EAAAM,QAAUS,uBAAsB,KAEzBV,EAAAW,MAAME,YAAY,aAAczB,GACxCY,EAAQW,MAAME,YAAY,SAAU,GAAGL,MAAa,GACvD,IAGLxB,EAAkBwB,EAAS,GAC5B,CAACpB,EAAYL,IAEV+B,EAAehB,EAAAA,aAAY,aAC7B,MAAME,EAAUJ,EAAWK,QAE3B,GAAKD,EAEL,CAAInB,QAAyB,IAAzBA,EAGA,YADAG,EAAkBgB,EAAQS,cAI9B,GAAI9B,IAAYE,EAOhB,IAFA,OAAAuB,EAAA,MAAAxB,OAAAA,EAAAA,EAASmC,oBAATX,EAAAE,KAAA1B,EAA6BgB,GAEzBL,EAEA,YADA,OAAAyB,EAAA,MAAApC,OAAA,EAAAA,EAASyB,kBAATW,EAAAV,KAAA1B,EAA2BgB,IAIhBW,QAChB,CAACA,EAAgB5B,EAASE,EAAsBD,EAASW,IAE5D0B,OAAAA,EAAAA,WAAU,KACOH,MACd,CAACnC,EAASmC,IAEbG,EAAAA,WAAU,KACN,MAAMjB,EAAUJ,EAAWK,QAC3B,OAAID,GACQA,EAAAkB,iBAAiB,gBAAiBrB,GAGvC,KACCG,GACQA,EAAAmB,oBAAoB,gBAAiBtB,EAAmB,CACpE,GAEL,CAACA,IAEJoB,EAAAA,WAAU,KACN,MAAMG,EAAK3B,EAAKQ,QACVoB,EAAK1B,EAAKM,QAChB,MAAO,KACHmB,GAAME,qBAAqBF,GAC3BC,GAAMC,qBAAqBD,EAAE,CAAA,GAElC,CAAC5B,EAAME,IAEHC,CACX"}
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./useAriaLiveRegion.js");exports.useAriaLiveRegion=e.useAriaLiveRegion;
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react"),r=require("../usePreviousValue/usePreviousValue.js");exports.useAriaLiveRegion=function(i,s){const t=r.usePreviousValue(i),[u,o]=e.useState(!1);return e.useEffect((()=>{if(Array.isArray(i)&&Array.isArray(t)){for(let e=0;e<i.length;e++)if(i[e]!==t[e]&&!u){o(!0);break}}else t&&i!==t&&!u&&o(!0)}),[i,t,u]),{"aria-live":u?(null==s?void 0:s.politeness)||"polite":void 0}};
2
+ //# sourceMappingURL=useAriaLiveRegion.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useAriaLiveRegion.js","sources":["../../../../src/hooks/useAriaLiveRegion/useAriaLiveRegion.ts"],"sourcesContent":["import { useEffect, useState } from \"react\";\nimport { usePreviousValue } from \"../usePreviousValue\";\n\nexport interface UseAriaLiveRegionOptions {\n /**\n * @default \"polite\"\n */\n politeness?: \"polite\" | \"assertive\" | \"off\";\n}\n\n/**\n * Hjelper for å bare sette aria-live dersom det har skjedd en endring. Unngår at innholdet annonseres ved sidelasting.\n * @param watch Verdi som indikerer at det har skjedd en endring. For eksempel en boolean som styrer en loader, eller selve teksten som skal bli lest opp.\n * @param options Bestem om aria-live skal være polite, assertive eller off.\n * @returns\n */\nexport function useAriaLiveRegion(watch: unknown | unknown[], options?: UseAriaLiveRegionOptions) {\n const previousValue = usePreviousValue(watch);\n\n const [hasChanged, setHasChanged] = useState(false);\n useEffect(() => {\n if (Array.isArray(watch) && Array.isArray(previousValue)) {\n for (let i = 0; i < watch.length; i++) {\n if (watch[i] !== previousValue[i] && !hasChanged) {\n setHasChanged(true);\n break;\n }\n }\n } else if (previousValue && watch !== previousValue && !hasChanged) {\n setHasChanged(true);\n }\n }, [watch, previousValue, hasChanged]);\n\n return {\n \"aria-live\": hasChanged ? options?.politeness || \"polite\" : undefined,\n };\n}\n"],"names":["watch","options","previousValue","usePreviousValue","hasChanged","setHasChanged","useState","useEffect","Array","isArray","i","length","politeness"],"mappings":"wLAgBgB,SAAkBA,EAA4BC,GACpD,MAAAC,EAAgBC,mBAAiBH,IAEhCI,EAAYC,GAAiBC,YAAS,GAC7CC,OAAAA,EAAAA,WAAU,KACN,GAAIC,MAAMC,QAAQT,IAAUQ,MAAMC,QAAQP,IACtC,IAAS,IAAAQ,EAAI,EAAGA,EAAIV,EAAMW,OAAQD,IAC9B,GAAIV,EAAMU,KAAOR,EAAcQ,KAAON,EAAY,CAC9CC,GAAc,GACd,KACJ,OAEGH,GAAiBF,IAAUE,IAAkBE,GACpDC,GAAc,EAAI,GAEvB,CAACL,EAAOE,EAAeE,IAEnB,CACH,YAAaA,GAAa,MAAAH,SAAAA,EAASW,aAAc,cAAW,EAEpE"}
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./useBrowserPreferences.js");exports.useBrowserPreferences=e.useBrowserPreferences;
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react"),r=require("../mediaQueryUtils.js"),t="(prefers-reduced-motion: reduce)",a="(prefers-color-scheme: light)",i="(forced-colors: active)",d={prefersReducedMotion:!1,prefersColorScheme:"light",forcedColors:!1},o=(e,r)=>{switch(r.type){case"COLOR_SCHEME_CHANGED":return{...e,prefersColorScheme:r.value};case"REDUCED_MOTION_CHANGED":return{...e,prefersReducedMotion:r.value};case"FORCED_COLORS_CHANGED":return{...e,forcedColors:r.value};default:return e}};exports.useBrowserPreferences=()=>{const[u,c]=e.useState(!1),[s,n]=e.useReducer(o,d);return e.useEffect((()=>{c(!0);const e=r.getInitialMediaQueryMatch(t),d=r.getInitialMediaQueryMatch(a)?"light":"dark",o=r.getInitialMediaQueryMatch(i);n({type:"REDUCED_MOTION_CHANGED",value:e}),n({type:"COLOR_SCHEME_CHANGED",value:d}),n({type:"FORCED_COLORS_CHANGED",value:o})}),[]),e.useEffect((()=>{if(!u||!window.matchMedia)return;const e=e=>{n({type:"REDUCED_MOTION_CHANGED",value:e.matches})},d=e=>{n({type:"COLOR_SCHEME_CHANGED",value:e.matches?"light":"dark"})},o=e=>{n({type:"FORCED_COLORS_CHANGED",value:e.matches})};return r.addMediaQueryListener(window.matchMedia(t),e),r.addMediaQueryListener(window.matchMedia(a),d),r.addMediaQueryListener(window.matchMedia(i),o),()=>{r.removeMediaQueryListener(window.matchMedia(t),e),r.removeMediaQueryListener(window.matchMedia(a),d),r.removeMediaQueryListener(window.matchMedia(i),o)}}),[u]),{...s}};
2
+ //# sourceMappingURL=useBrowserPreferences.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useBrowserPreferences.js","sources":["../../../../src/hooks/useBrowserPreferences/useBrowserPreferences.tsx"],"sourcesContent":["import { Reducer, useEffect, useReducer, useState } from \"react\";\nimport { ColorScheme } from \"../../core\";\nimport { addMediaQueryListener, getInitialMediaQueryMatch, removeMediaQueryListener } from \"../mediaQueryUtils\";\n\ntype BrowserPreferences = {\n prefersReducedMotion: boolean;\n prefersColorScheme: ColorScheme;\n forcedColors: boolean;\n};\n\nenum ActionType {\n PrefersColorScheme = \"COLOR_SCHEME_CHANGED\",\n PrefersReducedMotion = \"REDUCED_MOTION_CHANGED\",\n ForcedColors = \"FORCED_COLORS_CHANGED\",\n}\n\ntype Action =\n | {\n type: ActionType.PrefersColorScheme;\n value: ColorScheme;\n }\n | {\n type: ActionType.PrefersReducedMotion;\n value: boolean;\n }\n | {\n type: ActionType.ForcedColors;\n value: boolean;\n };\n\nconst PREFERS_REDUCED_MOTION = \"(prefers-reduced-motion: reduce)\";\nconst PREFERS_LIGHT_COLOR_SCHEME = \"(prefers-color-scheme: light)\";\nconst FORCED_COLORS = \"(forced-colors: active)\";\n\nconst initialState: BrowserPreferences = {\n prefersReducedMotion: false,\n prefersColorScheme: \"light\",\n forcedColors: false,\n};\n\nconst reducer: Reducer<BrowserPreferences, Action> = (state, action) => {\n switch (action.type) {\n case ActionType.PrefersColorScheme:\n return {\n ...state,\n prefersColorScheme: action.value,\n };\n case ActionType.PrefersReducedMotion:\n return {\n ...state,\n prefersReducedMotion: action.value,\n };\n case ActionType.ForcedColors:\n return {\n ...state,\n forcedColors: action.value,\n };\n default:\n return state;\n }\n};\n\n/**\n * Hook som gir informasjon om brukerens foretrukne konfigurasjon.\n * @returns Objekt med informasjon om brukerens foretrukne tema (lyst vs mørkt), redusert bevegelse, og høykontrast (forced colors).\n */\nexport const useBrowserPreferences = (): BrowserPreferences => {\n const [hasMounted, setHasMounted] = useState(false);\n\n const [state, dispatch] = useReducer(reducer, initialState);\n\n useEffect(() => {\n setHasMounted(true);\n const prefersReducedMotion = getInitialMediaQueryMatch(PREFERS_REDUCED_MOTION);\n const prefersColorScheme = getInitialMediaQueryMatch(PREFERS_LIGHT_COLOR_SCHEME) ? \"light\" : \"dark\";\n const forcedColors = getInitialMediaQueryMatch(FORCED_COLORS);\n dispatch({ type: ActionType.PrefersReducedMotion, value: prefersReducedMotion });\n dispatch({ type: ActionType.PrefersColorScheme, value: prefersColorScheme });\n dispatch({ type: ActionType.ForcedColors, value: forcedColors });\n }, []);\n\n useEffect(() => {\n if (!hasMounted || !window.matchMedia) {\n return;\n }\n const onPrefersReducedMotionChange = (e: MediaQueryListEvent) => {\n dispatch({ type: ActionType.PrefersReducedMotion, value: e.matches });\n };\n const onPrefersColorSchemeChange = (e: MediaQueryListEvent) => {\n dispatch({ type: ActionType.PrefersColorScheme, value: e.matches ? \"light\" : \"dark\" });\n };\n const onForcedColorsChange = (e: MediaQueryListEvent) => {\n dispatch({ type: ActionType.ForcedColors, value: e.matches });\n };\n\n addMediaQueryListener(window.matchMedia(PREFERS_REDUCED_MOTION), onPrefersReducedMotionChange);\n addMediaQueryListener(window.matchMedia(PREFERS_LIGHT_COLOR_SCHEME), onPrefersColorSchemeChange);\n addMediaQueryListener(window.matchMedia(FORCED_COLORS), onForcedColorsChange);\n\n return () => {\n removeMediaQueryListener(window.matchMedia(PREFERS_REDUCED_MOTION), onPrefersReducedMotionChange);\n removeMediaQueryListener(window.matchMedia(PREFERS_LIGHT_COLOR_SCHEME), onPrefersColorSchemeChange);\n removeMediaQueryListener(window.matchMedia(FORCED_COLORS), onForcedColorsChange);\n };\n }, [hasMounted]);\n\n return { ...state };\n};\n"],"names":["PREFERS_REDUCED_MOTION","PREFERS_LIGHT_COLOR_SCHEME","FORCED_COLORS","initialState","prefersReducedMotion","prefersColorScheme","forcedColors","reducer","state","action","type","value","hasMounted","setHasMounted","useState","dispatch","useReducer","useEffect","getInitialMediaQueryMatch","window","matchMedia","onPrefersReducedMotionChange","e","matches","onPrefersColorSchemeChange","onForcedColorsChange","addMediaQueryListener","removeMediaQueryListener"],"mappings":"4IA8BMA,EAAyB,mCACzBC,EAA6B,gCAC7BC,EAAgB,0BAEhBC,EAAmC,CACrCC,sBAAsB,EACtBC,mBAAoB,QACpBC,cAAc,GAGZC,EAA+C,CAACC,EAAOC,KACzD,OAAQA,EAAOC,MACX,IAAK,uBACM,MAAA,IACAF,EACHH,mBAAoBI,EAAOE,OAEnC,IAAK,yBACM,MAAA,IACAH,EACHJ,qBAAsBK,EAAOE,OAErC,IAAK,wBACM,MAAA,IACAH,EACHF,aAAcG,EAAOE,OAE7B,QACW,OAAAH,EACf,gCAOiC,KACjC,MAAOI,EAAYC,GAAiBC,YAAS,IAEtCN,EAAOO,GAAYC,EAAAA,WAAWT,EAASJ,GAE9Cc,OAAAA,EAAAA,WAAU,KACNJ,GAAc,GACR,MAAAT,EAAuBc,4BAA0BlB,GACjDK,EAAqBa,EAAAA,0BAA0BjB,GAA8B,QAAU,OACvFK,EAAeY,4BAA0BhB,GAC/Ca,EAAS,CAAEL,KAAM,yBAAiCC,MAAOP,IACzDW,EAAS,CAAEL,KAAM,uBAA+BC,MAAON,IACvDU,EAAS,CAAEL,KAAM,wBAAyBC,MAAOL,GAAc,GAChE,IAEHW,EAAAA,WAAU,KACN,IAAKL,IAAeO,OAAOC,WACvB,OAEE,MAAAC,EAAgCC,IAClCP,EAAS,CAAEL,KAAM,yBAAiCC,MAAOW,EAAEC,SAAS,EAElEC,EAA8BF,IACvBP,EAAA,CAAEL,KAAM,uBAA+BC,MAAOW,EAAEC,QAAU,QAAU,QAAQ,EAEnFE,EAAwBH,IAC1BP,EAAS,CAAEL,KAAM,wBAAyBC,MAAOW,EAAEC,SAAS,EAGhEG,OAAAA,EAAAA,sBAAsBP,OAAOC,WAAWpB,GAAyBqB,GACjEK,EAAAA,sBAAsBP,OAAOC,WAAWnB,GAA6BuB,GACrEE,EAAAA,sBAAsBP,OAAOC,WAAWlB,GAAgBuB,GAEjD,KACHE,EAAAA,yBAAyBR,OAAOC,WAAWpB,GAAyBqB,GACpEM,EAAAA,yBAAyBR,OAAOC,WAAWnB,GAA6BuB,GACxEG,EAAAA,yBAAyBR,OAAOC,WAAWlB,GAAgBuB,EAAoB,CAAA,GAEpF,CAACb,IAEG,IAAKJ"}
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./useClickOutside.js");exports.useClickOutside=e.useClickOutside;
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react");exports.useClickOutside=function(t,n){function c(e){null!=t&&t.current&&!t.current.contains(e.target)&&n()}e.useEffect((()=>(t&&document&&document.addEventListener("click",c),()=>{document&&document.removeEventListener("click",c)})))};
2
+ //# sourceMappingURL=useClickOutside.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useClickOutside.js","sources":["../../../../src/hooks/useClickOutside/useClickOutside.ts"],"sourcesContent":["import { RefObject, useEffect } from \"react\";\n\n/**\n * Hook for å sette opp en lytter ved klikk utenfor et element.\n * @param ref Elementet du ønsker å sjekke om en klikk er utenfor.\n * @param fn Callback-funksjon som kalles når det klikkes utenfor elementet.\n */\nexport function useClickOutside(ref: RefObject<HTMLElement> | null, fn: () => void): void {\n function handleClickOutside(event: MouseEvent) {\n if (ref?.current && !ref.current.contains(event.target as Node)) {\n fn();\n }\n }\n\n useEffect(() => {\n if (ref) {\n document && document.addEventListener(\"click\", handleClickOutside);\n }\n return () => {\n document && document.removeEventListener(\"click\", handleClickOutside);\n };\n });\n}\n"],"names":["ref","fn","handleClickOutside","event","current","contains","target","useEffect","document","addEventListener","removeEventListener"],"mappings":"iIAOgB,SAAgBA,EAAoCC,GAChE,SAASC,EAAmBC,GACpB,MAAAH,GAAAA,EAAKI,UAAYJ,EAAII,QAAQC,SAASF,EAAMG,SACzCL,GAEX,CAEAM,EAAAA,WAAU,KACFP,GACYQ,UAAAA,SAASC,iBAAiB,QAASP,GAE5C,KACSM,UAAAA,SAASE,oBAAoB,QAASR,EAAkB,IAGhF"}
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./useElementDimensions.js");exports.useElementDimensions=e.useElementDimensions;
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react");exports.useElementDimensions=function(t=200){const r=e.useRef(null),[n,i]=e.useState({height:0,width:0}),o=e.useMemo((()=>function(e,t){let r=!1;return(...n)=>{if(r)return;const i=e(...n);return 0!==t&&(r=!0,window.setTimeout((()=>{r=!1}),t)),i}}((()=>{var e,t;return i({height:(null==(e=r.current)?void 0:e.scrollHeight)||0,width:(null==(t=r.current)?void 0:t.scrollWidth)||0})}),t)),[t]);return e.useEffect((()=>{var e,t;return i({height:(null==(e=r.current)?void 0:e.scrollHeight)||0,width:(null==(t=r.current)?void 0:t.scrollWidth)||0}),typeof window<"u"&&window.addEventListener("resize",o),()=>{typeof window<"u"&&window.removeEventListener("resize",o)}}),[o]),[r,n]};
2
+ //# sourceMappingURL=useElementDimensions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useElementDimensions.js","sources":["../../../../src/hooks/useElementDimensions/useElementDimensions.ts"],"sourcesContent":["import { RefObject, useEffect, useMemo, useRef, useState } from \"react\";\n\n// TODO: Denne er sikkert nyttig flere steder enn her!\n// eslint-disable-next-line\nfunction throttle<R, A extends any[]>(fn: (...args: A) => R, delay: number) {\n let wait = false;\n\n return (...args: A) => {\n if (wait) return undefined;\n\n const result = fn(...args);\n\n if (delay !== 0) {\n wait = true;\n window.setTimeout(() => {\n wait = false;\n }, delay);\n }\n\n return result;\n };\n}\n\nexport type Dimensions = {\n height: number;\n width: number;\n};\n\n/**\n * Lar deg måle størrelsen på et element, og oppdatere målene når vinduet endrer størrelse.\n * @param throttleDelay Antall milisekunder som skal gå mellom hver gang dimensjonene oppdateres.\n * @returns Ref til elementet som skal måles, og dimensjonene til elementet.\n */\nexport function useElementDimensions<T extends HTMLElement>(throttleDelay = 200): [RefObject<T>, Dimensions] {\n const elementRef = useRef<T>(null);\n const [dimensions, setDimensions] = useState<Dimensions>({ height: 0, width: 0 });\n\n const throttledSetDimensions = useMemo(\n () =>\n throttle(\n () =>\n setDimensions({\n height: elementRef.current?.scrollHeight || 0,\n width: elementRef.current?.scrollWidth || 0,\n }),\n throttleDelay,\n ),\n [throttleDelay],\n );\n\n useEffect(() => {\n setDimensions({\n height: elementRef.current?.scrollHeight || 0,\n width: elementRef.current?.scrollWidth || 0,\n });\n\n typeof window !== \"undefined\" && window.addEventListener(\"resize\", throttledSetDimensions);\n\n return () => {\n typeof window !== \"undefined\" && window.removeEventListener(\"resize\", throttledSetDimensions);\n };\n }, [throttledSetDimensions]);\n\n return [elementRef, dimensions];\n}\n"],"names":["throttleDelay","elementRef","useRef","dimensions","setDimensions","useState","height","width","throttledSetDimensions","useMemo","fn","delay","wait","args","result","window","setTimeout","throttle","_a","current","scrollHeight","_b","scrollWidth","useEffect","addEventListener","removeEventListener"],"mappings":"sIAiCgB,SAA4CA,EAAgB,KAClE,MAAAC,EAAaC,SAAU,OACtBC,EAAYC,GAAiBC,EAAAA,SAAqB,CAAEC,OAAQ,EAAGC,MAAO,IAEvEC,EAAyBC,EAAAA,SAC3B,IAlCR,SAAsCC,EAAuBC,GACzD,IAAIC,GAAO,EAEX,MAAO,IAAIC,KACP,GAAID,EAAa,OAEX,MAAAE,EAASJ,KAAMG,GAErB,OAAc,IAAVF,IACOC,GAAA,EACPG,OAAOC,YAAW,KACPJ,GAAA,IACRD,IAGAG,EAEf,CAkBYG,EACI,aACI,OAAAb,EAAc,CACVE,QAAQ,OAAAY,EAAAjB,EAAWkB,cAAX,EAAAD,EAAoBE,eAAgB,EAC5Cb,OAAO,OAAAc,EAAApB,EAAWkB,cAAX,EAAAE,EAAoBC,cAAe,GAC7C,GACLtB,IAER,CAACA,IAGLuB,OAAAA,EAAAA,WAAU,aACQ,OAAAnB,EAAA,CACVE,QAAQ,OAAAY,EAAAjB,EAAWkB,cAAXD,EAAAA,EAAoBE,eAAgB,EAC5Cb,OAAO,OAAAc,EAAApB,EAAWkB,cAAXE,EAAAA,EAAoBC,cAAe,WAGvCP,OAAW,KAAeA,OAAOS,iBAAiB,SAAUhB,GAE5D,YACIO,OAAW,KAAeA,OAAOU,oBAAoB,SAAUjB,EAAsB,CAAA,GAEjG,CAACA,IAEG,CAACP,EAAYE,EACxB"}
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./useFocusOutside.js");exports.useFocusOutside=e.useFocusOutside;
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react");exports.useFocusOutside=function(t,n){function u(e){null!=t&&t.current&&!t.current.contains(e.target)&&n()}e.useEffect((()=>(t&&document&&document.addEventListener("focusin",u),()=>{document&&document.removeEventListener("focusin",u)})))};
2
+ //# sourceMappingURL=useFocusOutside.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useFocusOutside.js","sources":["../../../../src/hooks/useFocusOutside/useFocusOutside.ts"],"sourcesContent":["import { RefObject, useEffect } from \"react\";\n\n/**\n * Hook for å lytte etter fokus utenfor et element. Nyttig dersom flere fokuserbare elementer samspiller i en komponent.\n * @param ref Elementet som skal observeres\n * @param fn Funksjon som kalles når fokus flyttes utenfor elementet\n */\nexport function useFocusOutside(ref: RefObject<HTMLElement> | null, fn: () => void): void {\n function handleFocusOutside(event: FocusEvent) {\n if (ref?.current && !ref.current.contains(event.target as Node)) {\n fn();\n }\n }\n\n useEffect(() => {\n if (ref) {\n document && document.addEventListener(\"focusin\", handleFocusOutside);\n }\n return () => {\n document && document.removeEventListener(\"focusin\", handleFocusOutside);\n };\n });\n}\n"],"names":["ref","fn","handleFocusOutside","event","current","contains","target","useEffect","document","addEventListener","removeEventListener"],"mappings":"iIAOgB,SAAgBA,EAAoCC,GAChE,SAASC,EAAmBC,GACpB,MAAAH,GAAAA,EAAKI,UAAYJ,EAAII,QAAQC,SAASF,EAAMG,SACzCL,GAEX,CAEAM,EAAAA,WAAU,KACFP,GACYQ,UAAAA,SAASC,iBAAiB,UAAWP,GAE9C,KACSM,UAAAA,SAASE,oBAAoB,UAAWR,EAAkB,IAGlF"}
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./useId.js");exports.useId=e.useId;
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react"),t=e.useId,r={generateSuffix:!0},s=(s,u=r)=>{const o=t();let n=s;s&&u.generateSuffix&&(n=`${s}-${o}`);const[a]=e.useState(n||o);return a};exports.useId=s;
2
+ //# sourceMappingURL=useId.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useId.js","sources":["../../../../src/hooks/useId/useId.ts"],"sourcesContent":["import React from \"react\";\n\nexport interface UseIdOptions {\n /** @default true */\n generateSuffix?: boolean;\n}\n\nconst useReactId = React.useId;\n\nconst defaultOptions: UseIdOptions = {\n generateSuffix: true,\n};\n\nconst useModernId = (id?: string, options = defaultOptions): string => {\n const uid = useReactId();\n let elementId: string | undefined = id;\n if (id && options.generateSuffix) {\n elementId = `${id}-${uid}`;\n }\n const [elId] = React.useState(elementId || uid);\n return elId;\n};\n\n/**\n * Hook som genererer en unik ID.\n * @param id En valgfri eksisterende ID som kan brukes som prefix.\n * @param options Objekt med innstillinger, dersom du angir et prefix.\n * @deprecated Bruk useId fra \"react\" pakka i stedet\n */\nexport const useId = useModernId;\n"],"names":["useReactId","React","useId","defaultOptions","generateSuffix","id","options","uid","elementId","elId","useState"],"mappings":"yGAOMA,EAAaC,EAAMC,MAEnBC,EAA+B,CACjCC,gBAAgB,GAmBPF,EAhBO,CAACG,EAAaC,EAAUH,KACxC,MAAMI,EAAMP,IACZ,IAAIQ,EAAgCH,EAChCA,GAAMC,EAAQF,iBACFI,EAAA,GAAGH,KAAME,KAEzB,MAAOE,GAAQR,EAAMS,SAASF,GAAaD,GACpC,OAAAE"}
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./useIntersectionObserver.js");exports.useIntersectionObserver=e.useIntersectionObserver;
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react");function r(e){return void 0!==e.forEach}const t=()=>typeof window<"u"&&typeof IntersectionObserver<"u";exports.useIntersectionObserver=(n,o,c,s)=>{const u=e.useRef(null);e.useEffect((()=>{let e=u.current;return t()?(e&&e.disconnect(),e=new IntersectionObserver(o,s),r(n)?n.forEach((r=>null==e?void 0:e.observe(r))):n.current&&r(n.current)?n.current.forEach((r=>null==e?void 0:e.observe(r))):n.current&&e.observe(n.current)):c&&c(),()=>{t()&&e&&e.disconnect()}}),[n,o,c,s])};
2
+ //# sourceMappingURL=useIntersectionObserver.js.map