@helsenorge/designsystem-react 2.3.0 → 2.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (383) hide show
  1. package/Button.js +1 -1
  2. package/Button.js.map +1 -1
  3. package/CHANGELOG.md +22 -2
  4. package/FormGroup.js +1 -1
  5. package/FormGroup.js.map +1 -1
  6. package/HelpBubble.js +1 -1
  7. package/HelpBubble.js.map +1 -1
  8. package/Input.js +1 -1
  9. package/Input.js.map +1 -1
  10. package/Modal.js +1 -1
  11. package/Modal.js.map +1 -1
  12. package/Panel.js +1 -1
  13. package/Panel.js.map +1 -1
  14. package/Select.js +2 -0
  15. package/Select.js.map +1 -0
  16. package/Textarea.js +1 -1
  17. package/Textarea.js.map +1 -1
  18. package/Tooltip.js +1 -1
  19. package/Tooltip.js.map +1 -1
  20. package/TooltipWord.js +2 -0
  21. package/TooltipWord.js.map +1 -0
  22. package/__mocks__/uuid.js +1 -1
  23. package/__mocks__/uuid.js.map +1 -1
  24. package/components/AnchorLink/index.js +1 -1
  25. package/components/Avatar/index.js +1 -1
  26. package/components/Avatar/index.js.map +1 -1
  27. package/components/Button/index.js +1 -1
  28. package/components/ButtonWithModal/index.js +1 -1
  29. package/components/ButtonWithModal/index.js.map +1 -1
  30. package/components/Checkbox/index.js +1 -1
  31. package/components/Close/index.js +1 -1
  32. package/components/Dropdown/index.js +1 -1
  33. package/components/Dropdown/index.js.map +1 -1
  34. package/components/Duolist/Duolist.d.ts +6 -4
  35. package/components/Duolist/Duolist.d.ts.map +1 -1
  36. package/components/Duolist/componentdata.json +1 -1
  37. package/components/Duolist/index.js +1 -1
  38. package/components/Duolist/index.js.map +1 -1
  39. package/components/Duolist/styles.module.scss +0 -1
  40. package/components/Expander/index.js +1 -1
  41. package/components/Expander/index.js.map +1 -1
  42. package/components/ExpanderList/index.js +1 -1
  43. package/components/ExpanderList/index.js.map +1 -1
  44. package/components/FormExample/FormExample.d.ts +2 -1
  45. package/components/FormExample/FormExample.d.ts.map +1 -1
  46. package/components/FormExample/componentdata.json +1 -1
  47. package/components/FormExample/index.js +3 -3
  48. package/components/FormExample/index.js.map +1 -1
  49. package/components/FormGroup/FormGroup.d.ts.map +1 -1
  50. package/components/FormGroup/index.js +1 -1
  51. package/components/HelpBubble/HelpBubble.d.ts +8 -5
  52. package/components/HelpBubble/HelpBubble.d.ts.map +1 -1
  53. package/components/HelpBubble/componentdata.json +1 -1
  54. package/components/HelpBubble/index.js +1 -1
  55. package/components/HelpBubble/styles.module.scss +41 -34
  56. package/components/HelpBubble/styles.module.scss.d.ts +9 -10
  57. package/components/HelpBubble/utils.d.ts +27 -0
  58. package/components/HelpBubble/utils.d.ts.map +1 -0
  59. package/components/HelpBubbleExample/componentdata.json +1 -1
  60. package/components/HelpBubbleExample/index.js +1 -1
  61. package/components/HelpBubbleExample/index.js.map +1 -1
  62. package/components/HighlightBox/index.js +1 -1
  63. package/components/HighlightBox/index.js.map +1 -1
  64. package/components/HorizontalScroll/index.js +1 -1
  65. package/components/HorizontalScroll/styles.module.scss +2 -2
  66. package/components/Icons/AcupunctureBack.js +1 -1
  67. package/components/Icons/AcupunctureBack.js.map +1 -1
  68. package/components/Icons/AlarmClock.js +1 -1
  69. package/components/Icons/AlarmClock.js.map +1 -1
  70. package/components/Icons/AlertSignFill.js +1 -1
  71. package/components/Icons/AlertSignFill.js.map +1 -1
  72. package/components/Icons/AlertSignStroke.js +1 -1
  73. package/components/Icons/AlertSignStroke.js.map +1 -1
  74. package/components/Icons/Archive.js +1 -1
  75. package/components/Icons/Archive.js.map +1 -1
  76. package/components/Icons/ArrowDown.js +1 -1
  77. package/components/Icons/ArrowDown.js.map +1 -1
  78. package/components/Icons/ArrowLeft.js +1 -1
  79. package/components/Icons/ArrowLeft.js.map +1 -1
  80. package/components/Icons/ArrowRight.js +1 -1
  81. package/components/Icons/ArrowRight.js.map +1 -1
  82. package/components/Icons/ArrowUp.js +1 -1
  83. package/components/Icons/ArrowUp.js.map +1 -1
  84. package/components/Icons/ArrowUpRight.js +1 -1
  85. package/components/Icons/ArrowUpRight.js.map +1 -1
  86. package/components/Icons/Attachment.js +1 -1
  87. package/components/Icons/Attachment.js.map +1 -1
  88. package/components/Icons/Avatar.js +1 -1
  89. package/components/Icons/Avatar.js.map +1 -1
  90. package/components/Icons/Bus.js +1 -1
  91. package/components/Icons/Bus.js.map +1 -1
  92. package/components/Icons/Calendar.js +1 -1
  93. package/components/Icons/Calendar.js.map +1 -1
  94. package/components/Icons/CalendarChange.js +1 -1
  95. package/components/Icons/CalendarChange.js.map +1 -1
  96. package/components/Icons/CalendarCheck.js +1 -1
  97. package/components/Icons/CalendarCheck.js.map +1 -1
  98. package/components/Icons/CalendarSave.js +1 -1
  99. package/components/Icons/CalendarSave.js.map +1 -1
  100. package/components/Icons/Change.js +1 -1
  101. package/components/Icons/Change.js.map +1 -1
  102. package/components/Icons/Check.js +1 -1
  103. package/components/Icons/Check.js.map +1 -1
  104. package/components/Icons/CheckFill.js +1 -1
  105. package/components/Icons/CheckFill.js.map +1 -1
  106. package/components/Icons/ChevronDown.js +1 -1
  107. package/components/Icons/ChevronDown.js.map +1 -1
  108. package/components/Icons/ChevronLeft.js +1 -1
  109. package/components/Icons/ChevronLeft.js.map +1 -1
  110. package/components/Icons/ChevronRight.js +1 -1
  111. package/components/Icons/ChevronRight.js.map +1 -1
  112. package/components/Icons/ChevronUp.js +1 -1
  113. package/components/Icons/ChevronUp.js.map +1 -1
  114. package/components/Icons/ChevronsDown.js +1 -1
  115. package/components/Icons/ChevronsDown.js.map +1 -1
  116. package/components/Icons/ChevronsUp.js +1 -1
  117. package/components/Icons/ChevronsUp.js.map +1 -1
  118. package/components/Icons/Contacts.js +1 -1
  119. package/components/Icons/Contacts.js.map +1 -1
  120. package/components/Icons/Copy.js +1 -1
  121. package/components/Icons/Copy.js.map +1 -1
  122. package/components/Icons/Download.js +1 -1
  123. package/components/Icons/Download.js.map +1 -1
  124. package/components/Icons/EChat.js +1 -1
  125. package/components/Icons/EChat.js.map +1 -1
  126. package/components/Icons/EnterFullScreen.js +1 -1
  127. package/components/Icons/EnterFullScreen.js.map +1 -1
  128. package/components/Icons/Envelope.js +1 -1
  129. package/components/Icons/Envelope.js.map +1 -1
  130. package/components/Icons/Eraser.js +1 -1
  131. package/components/Icons/Eraser.js.map +1 -1
  132. package/components/Icons/ErrorSignFill.js +1 -1
  133. package/components/Icons/ErrorSignFill.js.map +1 -1
  134. package/components/Icons/ErrorSignStroke.js +1 -1
  135. package/components/Icons/ErrorSignStroke.js.map +1 -1
  136. package/components/Icons/ExitFullScreen.js +1 -1
  137. package/components/Icons/ExitFullScreen.js.map +1 -1
  138. package/components/Icons/Eye.js +1 -1
  139. package/components/Icons/Eye.js.map +1 -1
  140. package/components/Icons/Form.js +1 -1
  141. package/components/Icons/Form.js.map +1 -1
  142. package/components/Icons/Forward.js +1 -1
  143. package/components/Icons/Forward.js.map +1 -1
  144. package/components/Icons/Gallery.js +1 -1
  145. package/components/Icons/Gallery.js.map +1 -1
  146. package/components/Icons/Globe.js +1 -1
  147. package/components/Icons/Globe.js.map +1 -1
  148. package/components/Icons/Group.js +1 -1
  149. package/components/Icons/Group.js.map +1 -1
  150. package/components/Icons/Heart.js +1 -1
  151. package/components/Icons/Heart.js.map +1 -1
  152. package/components/Icons/HelpSign.js +1 -1
  153. package/components/Icons/HelpSign.js.map +1 -1
  154. package/components/Icons/History.js +1 -1
  155. package/components/Icons/History.js.map +1 -1
  156. package/components/Icons/Home.js +1 -1
  157. package/components/Icons/Home.js.map +1 -1
  158. package/components/Icons/Hospital.js +1 -1
  159. package/components/Icons/Hospital.js.map +1 -1
  160. package/components/Icons/Hourglass.js +1 -1
  161. package/components/Icons/Hourglass.js.map +1 -1
  162. package/components/Icons/Icon.js +1 -1
  163. package/components/Icons/Icon.js.map +1 -1
  164. package/components/Icons/InfoSignFill.js +1 -1
  165. package/components/Icons/InfoSignFill.js.map +1 -1
  166. package/components/Icons/InfoSignStroke.js +1 -1
  167. package/components/Icons/InfoSignStroke.js.map +1 -1
  168. package/components/Icons/Journal.js +1 -1
  169. package/components/Icons/Journal.js.map +1 -1
  170. package/components/Icons/List.js +1 -1
  171. package/components/Icons/List.js.map +1 -1
  172. package/components/Icons/Location.js +1 -1
  173. package/components/Icons/Location.js.map +1 -1
  174. package/components/Icons/Lock.js +1 -1
  175. package/components/Icons/Lock.js.map +1 -1
  176. package/components/Icons/Medicine.js +1 -1
  177. package/components/Icons/Medicine.js.map +1 -1
  178. package/components/Icons/Menu.js +1 -1
  179. package/components/Icons/Menu.js.map +1 -1
  180. package/components/Icons/Minus.js +1 -1
  181. package/components/Icons/Minus.js.map +1 -1
  182. package/components/Icons/MobilePhone.js +1 -1
  183. package/components/Icons/MobilePhone.js.map +1 -1
  184. package/components/Icons/NoAccess.js +1 -1
  185. package/components/Icons/NoAccess.js.map +1 -1
  186. package/components/Icons/NoEye.js +1 -1
  187. package/components/Icons/NoEye.js.map +1 -1
  188. package/components/Icons/NoFilter.js +1 -1
  189. package/components/Icons/NoFilter.js.map +1 -1
  190. package/components/Icons/PaperPlane.js +1 -1
  191. package/components/Icons/PaperPlane.js.map +1 -1
  192. package/components/Icons/Pause.js +1 -1
  193. package/components/Icons/Pause.js.map +1 -1
  194. package/components/Icons/Pencil.js +1 -1
  195. package/components/Icons/Pencil.js.map +1 -1
  196. package/components/Icons/PersonalPlan.js +1 -1
  197. package/components/Icons/PersonalPlan.js.map +1 -1
  198. package/components/Icons/Play.js +1 -1
  199. package/components/Icons/Play.js.map +1 -1
  200. package/components/Icons/PlusLarge.js +1 -1
  201. package/components/Icons/PlusLarge.js.map +1 -1
  202. package/components/Icons/PlusSmall.js +1 -1
  203. package/components/Icons/PlusSmall.js.map +1 -1
  204. package/components/Icons/Printer.js +1 -1
  205. package/components/Icons/Printer.js.map +1 -1
  206. package/components/Icons/QrCode.js +1 -1
  207. package/components/Icons/QrCode.js.map +1 -1
  208. package/components/Icons/Receptionist.js +1 -1
  209. package/components/Icons/Receptionist.js.map +1 -1
  210. package/components/Icons/Referral.js +1 -1
  211. package/components/Icons/Referral.js.map +1 -1
  212. package/components/Icons/Refresh.js +1 -1
  213. package/components/Icons/Refresh.js.map +1 -1
  214. package/components/Icons/Reply.js +1 -1
  215. package/components/Icons/Reply.js.map +1 -1
  216. package/components/Icons/Save.js +1 -1
  217. package/components/Icons/Save.js.map +1 -1
  218. package/components/Icons/Search.js +1 -1
  219. package/components/Icons/Search.js.map +1 -1
  220. package/components/Icons/SectionSign.js +1 -1
  221. package/components/Icons/SectionSign.js.map +1 -1
  222. package/components/Icons/Settings.js +1 -1
  223. package/components/Icons/Settings.js.map +1 -1
  224. package/components/Icons/Share.js +1 -1
  225. package/components/Icons/Share.js.map +1 -1
  226. package/components/Icons/SpeechBubble.js +1 -1
  227. package/components/Icons/SpeechBubble.js.map +1 -1
  228. package/components/Icons/Stopwatch.js +1 -1
  229. package/components/Icons/Stopwatch.js.map +1 -1
  230. package/components/Icons/SupportingPerson.js +1 -1
  231. package/components/Icons/SupportingPerson.js.map +1 -1
  232. package/components/Icons/Syringe.js +1 -1
  233. package/components/Icons/Syringe.js.map +1 -1
  234. package/components/Icons/TimePassing.js +1 -1
  235. package/components/Icons/TimePassing.js.map +1 -1
  236. package/components/Icons/Toolbox.js +1 -1
  237. package/components/Icons/Toolbox.js.map +1 -1
  238. package/components/Icons/TrashCan.js +1 -1
  239. package/components/Icons/TrashCan.js.map +1 -1
  240. package/components/Icons/Undo.js +1 -1
  241. package/components/Icons/Undo.js.map +1 -1
  242. package/components/Icons/Upload.js +1 -1
  243. package/components/Icons/Upload.js.map +1 -1
  244. package/components/Icons/Vaccine.js +1 -1
  245. package/components/Icons/Vaccine.js.map +1 -1
  246. package/components/Icons/VerticalDots.js +1 -1
  247. package/components/Icons/VerticalDots.js.map +1 -1
  248. package/components/Icons/VideoCamera.js +1 -1
  249. package/components/Icons/VideoCamera.js.map +1 -1
  250. package/components/Icons/VideoChat.js +1 -1
  251. package/components/Icons/VideoChat.js.map +1 -1
  252. package/components/Icons/Wallet.js +1 -1
  253. package/components/Icons/Wallet.js.map +1 -1
  254. package/components/Icons/Watch.js +1 -1
  255. package/components/Icons/Watch.js.map +1 -1
  256. package/components/Icons/X.js +1 -1
  257. package/components/Icons/X.js.map +1 -1
  258. package/components/Icons/Zoom.js +1 -1
  259. package/components/Icons/Zoom.js.map +1 -1
  260. package/components/Icons/index.js +1 -1
  261. package/components/Input/Input.d.ts +0 -1
  262. package/components/Input/Input.d.ts.map +1 -1
  263. package/components/Input/index.js +1 -1
  264. package/components/LinkList/LinkList.d.ts +4 -0
  265. package/components/LinkList/LinkList.d.ts.map +1 -1
  266. package/components/LinkList/index.js +1 -1
  267. package/components/LinkList/index.js.map +1 -1
  268. package/components/Loader/index.js +1 -1
  269. package/components/Loader/index.js.map +1 -1
  270. package/components/Modal/Modal.d.ts.map +1 -1
  271. package/components/Modal/index.js +1 -1
  272. package/components/NotificationPanel/index.js +1 -1
  273. package/components/NotificationPanel/index.js.map +1 -1
  274. package/components/Panel/index.js +1 -1
  275. package/components/PanelList/index.js +1 -1
  276. package/components/PanelList/index.js.map +1 -1
  277. package/components/Progressbar/index.js +1 -1
  278. package/components/Progressbar/index.js.map +1 -1
  279. package/components/RadioButton/index.js +1 -1
  280. package/components/Select/Select.d.ts +30 -0
  281. package/components/Select/Select.d.ts.map +1 -0
  282. package/components/Select/componentdata.json +1 -0
  283. package/components/Select/index.d.ts +4 -0
  284. package/components/Select/index.d.ts.map +1 -0
  285. package/components/Select/index.js +2 -0
  286. package/components/Select/index.js.map +1 -0
  287. package/components/Select/styles.module.scss +125 -0
  288. package/components/Select/styles.module.scss.d.ts +21 -0
  289. package/components/Slider/index.js +1 -1
  290. package/components/Slider/index.js.map +1 -1
  291. package/components/StatusDot/index.js +1 -1
  292. package/components/StatusDot/index.js.map +1 -1
  293. package/components/Table/TableExpandedRow/index.js +1 -1
  294. package/components/Table/TableExpanderCell/index.js +1 -1
  295. package/components/Table/TableHeadCell/index.js +1 -1
  296. package/components/Table/TableRow/index.js +1 -1
  297. package/components/Table/index.js +1 -1
  298. package/components/Table/index.js.map +1 -1
  299. package/components/Tag/index.js +1 -1
  300. package/components/Tag/index.js.map +1 -1
  301. package/components/Textarea/Textarea.d.ts.map +1 -1
  302. package/components/Textarea/index.js +1 -1
  303. package/components/Tile/index.js +1 -1
  304. package/components/Tile/index.js.map +1 -1
  305. package/components/Tooltip/Tooltip.d.ts +11 -12
  306. package/components/Tooltip/Tooltip.d.ts.map +1 -1
  307. package/components/Tooltip/TooltipWord/TooltipWord.d.ts +20 -0
  308. package/components/Tooltip/TooltipWord/TooltipWord.d.ts.map +1 -0
  309. package/components/Tooltip/TooltipWord/componentdata.json +1 -0
  310. package/components/Tooltip/TooltipWord/index.d.ts +4 -0
  311. package/components/Tooltip/TooltipWord/index.d.ts.map +1 -0
  312. package/components/Tooltip/TooltipWord/index.js +2 -0
  313. package/components/Tooltip/TooltipWord/index.js.map +1 -0
  314. package/components/Tooltip/{styles.module.scss → TooltipWord/styles.module.scss} +3 -6
  315. package/components/Tooltip/{styles.module.scss.d.ts → TooltipWord/styles.module.scss.d.ts} +0 -0
  316. package/components/Tooltip/componentdata.json +1 -1
  317. package/components/Tooltip/index.js +1 -1
  318. package/components/TooltipExample/TooltipExample.d.ts.map +1 -1
  319. package/components/TooltipExample/componentdata.json +1 -1
  320. package/components/TooltipExample/index.js +1 -1
  321. package/components/TooltipExample/index.js.map +1 -1
  322. package/components/Validation/index.js +1 -1
  323. package/constants.d.ts +2 -0
  324. package/constants.d.ts.map +1 -1
  325. package/constants.js +1 -1
  326. package/constants.js.map +1 -1
  327. package/hooks/useDelayedState.d.ts +9 -0
  328. package/hooks/useDelayedState.d.ts.map +1 -0
  329. package/hooks/useDelayedState.js +2 -0
  330. package/hooks/useDelayedState.js.map +1 -0
  331. package/hooks/useFocusTrap.d.ts +2 -1
  332. package/hooks/useFocusTrap.d.ts.map +1 -1
  333. package/hooks/useFocusTrap.js +1 -1
  334. package/hooks/useFocusTrap.js.map +1 -1
  335. package/hooks/useFocusableElements.js +1 -1
  336. package/hooks/useFocusableElements.js.map +1 -1
  337. package/hooks/useIntersectionObserver.d.ts +1 -1
  338. package/hooks/useIntersectionObserver.d.ts.map +1 -1
  339. package/hooks/useIntersectionObserver.js.map +1 -1
  340. package/hooks/useInterval.d.ts +9 -0
  341. package/hooks/useInterval.d.ts.map +1 -0
  342. package/hooks/useInterval.js +2 -0
  343. package/hooks/useInterval.js.map +1 -0
  344. package/hooks/useIsVisible.d.ts +1 -1
  345. package/hooks/useIsVisible.d.ts.map +1 -1
  346. package/hooks/useIsVisible.js +1 -1
  347. package/hooks/useIsVisible.js.map +1 -1
  348. package/hooks/useLayoutEvent.js +1 -1
  349. package/hooks/useLayoutEvent.js.map +1 -1
  350. package/hooks/useSize.d.ts +2 -1
  351. package/hooks/useSize.d.ts.map +1 -1
  352. package/hooks/useSize.js +1 -1
  353. package/hooks/useSize.js.map +1 -1
  354. package/hooks/useSticky.js +1 -1
  355. package/hooks/useSticky.js.map +1 -1
  356. package/hooks/useUuid.js +1 -1
  357. package/hooks/useUuid.js.map +1 -1
  358. package/index.js +1 -1
  359. package/package.json +1 -1
  360. package/utils/accessibility.js +2 -0
  361. package/utils/accessibility.js.map +1 -0
  362. package/utils/debounce.js +2 -0
  363. package/utils/debounce.js.map +1 -0
  364. package/utils/environment.js +2 -0
  365. package/utils/environment.js.map +1 -0
  366. package/utils/loremtext.js +2 -0
  367. package/utils/loremtext.js.map +1 -0
  368. package/utils/refs.js +2 -0
  369. package/utils/refs.js.map +1 -0
  370. package/utils/uuid.js +2 -0
  371. package/utils/uuid.js.map +1 -0
  372. package/utils/viewport.js +2 -0
  373. package/utils/viewport.js.map +1 -0
  374. package/uuid.js +1 -1
  375. package/uuid.js.map +1 -1
  376. package/accessibility.js +0 -2
  377. package/accessibility.js.map +0 -1
  378. package/debounce.js +0 -2
  379. package/debounce.js.map +0 -1
  380. package/hooks/useGetDOMRect.d.ts +0 -11
  381. package/hooks/useGetDOMRect.d.ts.map +0 -1
  382. package/hooks/useGetDOMRect.js +0 -2
  383. package/hooks/useGetDOMRect.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../src/components/Tile/Tile.tsx"],"sourcesContent":["import React from 'react';\nimport classNames from 'classnames';\n\nimport { AnalyticsId, HTMLAnchorProps } from '../../constants';\nimport { TitleTags } from './../Title/Title';\nimport { IconSize } from '../Icons';\n\nimport tileStyles from './styles.module.scss';\nimport { useHover } from '../../hooks/useHover';\n\nexport type TileTags = 'button' | 'a';\n\ninterface TileProps extends HTMLAnchorProps {\n /** Adds custom classes to the element. */\n className?: string;\n /**\tSets the icon to be displayed inside the tile. */\n icon: React.ReactElement;\n /**\tSets the title to be displayed inside the tile. */\n title: React.ReactElement;\n /** Toggles the highlighted style of the tile. */\n highlighted?: boolean;\n /** Sets the description to be displayed inside the tile. */\n description?: string;\n /** Sets a fixed max and min width for the tile. */\n fixed?: boolean;\n /** Called when the tile is clicked on. */\n onClick?: (e?: React.MouseEvent<HTMLElement, MouseEvent>) => void;\n /** HTML markup for tile. Default: a */\n htmlMarkup?: TileTags;\n /** Sets the data-testid attribute. */\n testId?: string;\n}\n\ninterface TileTitleProps {\n children: React.ReactNode;\n className?: string;\n htmlMarkup?: TitleTags;\n highlighted?: boolean;\n compact?: boolean;\n}\n\nexport interface TileCompound extends React.ForwardRefExoticComponent<TileProps & React.RefAttributes<HTMLAnchorElement>> {\n Title: React.ForwardRefExoticComponent<TileTitleProps & React.RefAttributes<HTMLHeadingElement>>;\n}\n\nconst Title = React.forwardRef<HTMLHeadingElement, TileTitleProps>((props, ref) => {\n const { children, className, htmlMarkup = 'span', highlighted, compact } = props;\n const titleClasses = classNames(\n tileStyles['tile__title'],\n {\n [tileStyles['tile__title--highlighted']]: highlighted,\n [tileStyles['tile__title--compact']]: compact,\n },\n className\n );\n const CustomTag = htmlMarkup;\n\n return (\n <CustomTag className={titleClasses} ref={ref}>\n {children}\n </CustomTag>\n );\n});\n\nexport const Tile = React.forwardRef<HTMLAnchorElement | HTMLButtonElement, TileProps>((props, ref) => {\n const { icon, title, className = '', description, fixed = false, highlighted = false, testId, htmlMarkup = 'a', ...restProps } = props;\n const { hoverRef, isHovered } = useHover<HTMLButtonElement | HTMLAnchorElement>(\n ref as React.RefObject<HTMLButtonElement | HTMLAnchorElement>\n );\n const compact = !description;\n const tileClasses = classNames(\n tileStyles.tile,\n {\n [tileStyles['tile--fixed']]: fixed,\n [tileStyles['tile--compact']]: compact,\n [tileStyles['tile--highlighted']]: highlighted,\n [tileStyles['tile--button']]: htmlMarkup === 'button',\n },\n className\n );\n const tileTitleWrapperClasses = classNames(tileStyles['title-wrapper'], {\n [tileStyles['title-wrapper--compact']]: compact,\n });\n\n const renderContent = () => (\n <>\n <div className={tileTitleWrapperClasses}>\n {React.cloneElement(icon, { size: IconSize.Medium, isHovered, color: highlighted ? 'white' : 'black' })}\n {React.cloneElement(title, { highlighted: highlighted, compact: compact })}\n </div>\n {description ? <p className={tileStyles.tile__description}>{description}</p> : null}\n </>\n );\n\n const commonProps = {\n className: tileClasses,\n ['data-testid']: testId,\n ['data-analyticsid']: AnalyticsId.Tile,\n ...restProps,\n };\n\n return (\n <>\n {htmlMarkup === 'a' && (\n <a\n ref={hoverRef as React.RefObject<HTMLAnchorElement>}\n rel={props.target === '_blank' ? 'noopener noreferrer' : props.rel}\n {...commonProps}\n >\n {renderContent()}\n </a>\n )}\n {htmlMarkup === 'button' && (\n <button ref={hoverRef as React.RefObject<HTMLButtonElement>} type=\"button\" {...commonProps}>\n {renderContent()}\n </button>\n )}\n </>\n );\n}) as TileCompound;\n\nTile.Title = Title;\n\nexport default Tile;\n"],"names":["Title","React","props","ref","children","className","htmlMarkup","highlighted","compact","titleClasses","classNames","tileStyles","CustomTag","Tile","icon","title","description","fixed","testId","restProps","hoverRef","isHovered","useHover","tileClasses","tileTitleWrapperClasses","renderContent","IconSize","commonProps","AnalyticsId"],"mappings":"mRA6CA,MAAMA,EAAQC,EAAM,WAA+C,CAACC,EAAOC,IAAQ,CACjF,KAAM,CAAE,SAAAC,EAAU,UAAAC,EAAW,WAAAC,EAAa,OAAQ,YAAAC,EAAa,QAAAC,CAAY,EAAAN,EACrEO,EAAeC,EACnBC,EAAW,YACX,CACE,CAACA,EAAW,6BAA8BJ,EAC1C,CAACI,EAAW,yBAA0BH,CACxC,EACAH,CAAA,EAEIO,EAAYN,EAElB,OACGL,EAAA,cAAAW,EAAA,CAAU,UAAWH,EAAc,IAAAN,CAAA,EACjCC,CACH,CAEJ,CAAC,EAEYS,EAAOZ,EAAM,WAA6D,CAACC,EAAOC,IAAQ,CACrG,KAAM,CAAE,KAAAW,EAAM,MAAAC,EAAO,UAAAV,EAAY,GAAI,YAAAW,EAAa,MAAAC,EAAQ,GAAO,YAAAV,EAAc,GAAO,OAAAW,EAAQ,WAAAZ,EAAa,OAAQa,CAAc,EAAAjB,EAC3H,CAAE,SAAAkB,EAAU,UAAAC,CAAA,EAAcC,EAC9BnB,CAAA,EAEIK,EAAU,CAACQ,EACXO,EAAcb,EAClBC,EAAW,KACX,CACE,CAACA,EAAW,gBAAiBM,EAC7B,CAACN,EAAW,kBAAmBH,EAC/B,CAACG,EAAW,sBAAuBJ,EACnC,CAACI,EAAW,iBAAkBL,IAAe,QAC/C,EACAD,CAAA,EAEImB,EAA0Bd,EAAWC,EAAW,iBAAkB,CACtE,CAACA,EAAW,2BAA4BH,CAAA,CACzC,EAEKiB,EAAgB,IACpBxB,EAAA,cAAAA,EAAA,SAAA,KACGA,EAAA,cAAA,MAAA,CAAI,UAAWuB,CACb,EAAAvB,EAAM,aAAaa,EAAM,CAAE,KAAMY,EAAS,OAAQ,UAAAL,EAAW,MAAOd,EAAc,QAAU,QAAS,EACrGN,EAAM,aAAac,EAAO,CAAE,YAAAR,EAA0B,QAAAC,EAAkB,CAC3E,EACCQ,EAAef,EAAA,cAAA,IAAA,CAAE,UAAWU,EAAW,iBAAA,EAAoBK,CAAY,EAAO,IACjF,EAGIW,EAAc,CAClB,UAAWJ,EACX,CAAC,eAAgBL,EACjB,CAAC,oBAAqBU,EAAY,KAClC,GAAGT,CAAA,EAIH,OAAAlB,EAAA,cAAAA,EAAA,SAAA,KACGK,IAAe,KACbL,EAAA,cAAA,IAAA,CACC,IAAKmB,EACL,IAAKlB,EAAM,SAAW,SAAW,sBAAwBA,EAAM,IAC9D,GAAGyB,CAAA,EAEHF,EACH,CAAA,EAEDnB,IAAe,UACbL,EAAA,cAAA,SAAA,CAAO,IAAKmB,EAAgD,KAAK,SAAU,GAAGO,CAAA,EAC5EF,EACH,CAAA,CAEJ,CAEJ,CAAC,EAEDZ,EAAK,MAAQb"}
1
+ {"version":3,"file":"index.js","sources":["../../../src/components/Tile/Tile.tsx"],"sourcesContent":["import React from 'react';\nimport classNames from 'classnames';\n\nimport { AnalyticsId, HTMLAnchorProps } from '../../constants';\nimport { TitleTags } from './../Title/Title';\nimport { IconSize } from '../Icons';\n\nimport tileStyles from './styles.module.scss';\nimport { useHover } from '../../hooks/useHover';\n\nexport type TileTags = 'button' | 'a';\n\ninterface TileProps extends HTMLAnchorProps {\n /** Adds custom classes to the element. */\n className?: string;\n /**\tSets the icon to be displayed inside the tile. */\n icon: React.ReactElement;\n /**\tSets the title to be displayed inside the tile. */\n title: React.ReactElement;\n /** Toggles the highlighted style of the tile. */\n highlighted?: boolean;\n /** Sets the description to be displayed inside the tile. */\n description?: string;\n /** Sets a fixed max and min width for the tile. */\n fixed?: boolean;\n /** Called when the tile is clicked on. */\n onClick?: (e?: React.MouseEvent<HTMLElement, MouseEvent>) => void;\n /** HTML markup for tile. Default: a */\n htmlMarkup?: TileTags;\n /** Sets the data-testid attribute. */\n testId?: string;\n}\n\ninterface TileTitleProps {\n children: React.ReactNode;\n className?: string;\n htmlMarkup?: TitleTags;\n highlighted?: boolean;\n compact?: boolean;\n}\n\nexport interface TileCompound extends React.ForwardRefExoticComponent<TileProps & React.RefAttributes<HTMLAnchorElement>> {\n Title: React.ForwardRefExoticComponent<TileTitleProps & React.RefAttributes<HTMLHeadingElement>>;\n}\n\nconst Title = React.forwardRef<HTMLHeadingElement, TileTitleProps>((props, ref) => {\n const { children, className, htmlMarkup = 'span', highlighted, compact } = props;\n const titleClasses = classNames(\n tileStyles['tile__title'],\n {\n [tileStyles['tile__title--highlighted']]: highlighted,\n [tileStyles['tile__title--compact']]: compact,\n },\n className\n );\n const CustomTag = htmlMarkup;\n\n return (\n <CustomTag className={titleClasses} ref={ref}>\n {children}\n </CustomTag>\n );\n});\n\nexport const Tile = React.forwardRef<HTMLAnchorElement | HTMLButtonElement, TileProps>((props, ref) => {\n const { icon, title, className = '', description, fixed = false, highlighted = false, testId, htmlMarkup = 'a', ...restProps } = props;\n const { hoverRef, isHovered } = useHover<HTMLButtonElement | HTMLAnchorElement>(\n ref as React.RefObject<HTMLButtonElement | HTMLAnchorElement>\n );\n const compact = !description;\n const tileClasses = classNames(\n tileStyles.tile,\n {\n [tileStyles['tile--fixed']]: fixed,\n [tileStyles['tile--compact']]: compact,\n [tileStyles['tile--highlighted']]: highlighted,\n [tileStyles['tile--button']]: htmlMarkup === 'button',\n },\n className\n );\n const tileTitleWrapperClasses = classNames(tileStyles['title-wrapper'], {\n [tileStyles['title-wrapper--compact']]: compact,\n });\n\n const renderContent = () => (\n <>\n <div className={tileTitleWrapperClasses}>\n {React.cloneElement(icon, { size: IconSize.Medium, isHovered, color: highlighted ? 'white' : 'black' })}\n {React.cloneElement(title, { highlighted: highlighted, compact: compact })}\n </div>\n {description ? <p className={tileStyles.tile__description}>{description}</p> : null}\n </>\n );\n\n const commonProps = {\n className: tileClasses,\n ['data-testid']: testId,\n ['data-analyticsid']: AnalyticsId.Tile,\n ...restProps,\n };\n\n return (\n <>\n {htmlMarkup === 'a' && (\n <a\n ref={hoverRef as React.RefObject<HTMLAnchorElement>}\n rel={props.target === '_blank' ? 'noopener noreferrer' : props.rel}\n {...commonProps}\n >\n {renderContent()}\n </a>\n )}\n {htmlMarkup === 'button' && (\n <button ref={hoverRef as React.RefObject<HTMLButtonElement>} type=\"button\" {...commonProps}>\n {renderContent()}\n </button>\n )}\n </>\n );\n}) as TileCompound;\n\nTile.Title = Title;\n\nexport default Tile;\n"],"names":["Title","React","props","ref","children","className","htmlMarkup","highlighted","compact","titleClasses","classNames","tileStyles","CustomTag","Tile","icon","title","description","fixed","testId","restProps","hoverRef","isHovered","useHover","tileClasses","tileTitleWrapperClasses","renderContent","IconSize","commonProps","AnalyticsId"],"mappings":"sTA6CA,MAAMA,EAAQC,EAAM,WAA+C,CAACC,EAAOC,IAAQ,CACjF,KAAM,CAAE,SAAAC,EAAU,UAAAC,EAAW,WAAAC,EAAa,OAAQ,YAAAC,EAAa,QAAAC,CAAY,EAAAN,EACrEO,EAAeC,EACnBC,EAAW,YACX,CACE,CAACA,EAAW,6BAA8BJ,EAC1C,CAACI,EAAW,yBAA0BH,CACxC,EACAH,CAAA,EAEIO,EAAYN,EAElB,OACGL,EAAA,cAAAW,EAAA,CAAU,UAAWH,EAAc,IAAAN,CAAA,EACjCC,CACH,CAEJ,CAAC,EAEYS,EAAOZ,EAAM,WAA6D,CAACC,EAAOC,IAAQ,CACrG,KAAM,CAAE,KAAAW,EAAM,MAAAC,EAAO,UAAAV,EAAY,GAAI,YAAAW,EAAa,MAAAC,EAAQ,GAAO,YAAAV,EAAc,GAAO,OAAAW,EAAQ,WAAAZ,EAAa,OAAQa,CAAc,EAAAjB,EAC3H,CAAE,SAAAkB,EAAU,UAAAC,CAAA,EAAcC,EAC9BnB,CAAA,EAEIK,EAAU,CAACQ,EACXO,EAAcb,EAClBC,EAAW,KACX,CACE,CAACA,EAAW,gBAAiBM,EAC7B,CAACN,EAAW,kBAAmBH,EAC/B,CAACG,EAAW,sBAAuBJ,EACnC,CAACI,EAAW,iBAAkBL,IAAe,QAC/C,EACAD,CAAA,EAEImB,EAA0Bd,EAAWC,EAAW,iBAAkB,CACtE,CAACA,EAAW,2BAA4BH,CAAA,CACzC,EAEKiB,EAAgB,IACpBxB,EAAA,cAAAA,EAAA,SAAA,KACGA,EAAA,cAAA,MAAA,CAAI,UAAWuB,CACb,EAAAvB,EAAM,aAAaa,EAAM,CAAE,KAAMY,EAAS,OAAQ,UAAAL,EAAW,MAAOd,EAAc,QAAU,QAAS,EACrGN,EAAM,aAAac,EAAO,CAAE,YAAAR,EAA0B,QAAAC,EAAkB,CAC3E,EACCQ,EAAef,EAAA,cAAA,IAAA,CAAE,UAAWU,EAAW,iBAAA,EAAoBK,CAAY,EAAO,IACjF,EAGIW,EAAc,CAClB,UAAWJ,EACX,CAAC,eAAgBL,EACjB,CAAC,oBAAqBU,EAAY,KAClC,GAAGT,CAAA,EAIH,OAAAlB,EAAA,cAAAA,EAAA,SAAA,KACGK,IAAe,KACbL,EAAA,cAAA,IAAA,CACC,IAAKmB,EACL,IAAKlB,EAAM,SAAW,SAAW,sBAAwBA,EAAM,IAC9D,GAAGyB,CAAA,EAEHF,EACH,CAAA,EAEDnB,IAAe,UACbL,EAAA,cAAA,SAAA,CAAO,IAAKmB,EAAgD,KAAK,SAAU,GAAGO,CAAA,EAC5EF,EACH,CAAA,CAEJ,CAEJ,CAAC,EAEDZ,EAAK,MAAQb"}
@@ -1,18 +1,17 @@
1
- import React, { ReactChild, ReactChildren, ReactNode } from 'react';
1
+ import React from 'react';
2
2
  export interface TooltipProps {
3
- /**Ordet som skal ha en tilhørende hjelpeblubb */
4
- children: ReactNode;
5
- /**Teksten som skal vises i hjelpeblubben */
6
- description: ReactNode;
7
- /**Valgfri test-id */
3
+ /** Ordet som skal ha en tilhørende tooltip */
4
+ children: string;
5
+ /** Teksten som skal vises i tooltip */
6
+ description: React.ReactNode;
7
+ /** Valgfri test-id */
8
8
  testId?: string;
9
9
  }
10
10
  export declare const Tooltip: React.FC<TooltipProps>;
11
- interface ContextProps {
12
- children: ReactChild | ReactChildren;
13
- }
14
- export declare const useTooltipOpen: () => boolean;
15
- export declare const useTooltipOpenToggle: () => () => void;
16
- export declare const TooltipOpenProvider: ({ children }: ContextProps) => JSX.Element;
11
+ export declare type TooltipContext = {
12
+ currentTooltip?: string;
13
+ setCurrentTooltip?: (id?: string) => void;
14
+ };
15
+ export declare const TooltipOpenProvider: React.FC;
17
16
  export default Tooltip;
18
17
  //# sourceMappingURL=Tooltip.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Tooltip.d.ts","sourceRoot":"","sources":["../../../src/components/Tooltip/Tooltip.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAA2C,UAAU,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAQ7G,MAAM,WAAW,YAAY;IAC3B,iDAAiD;IACjD,QAAQ,EAAE,SAAS,CAAC;IACpB,4CAA4C;IAC5C,WAAW,EAAE,SAAS,CAAC;IACvB,qBAAqB;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,eAAO,MAAM,OAAO,EAAE,KAAK,CAAC,EAAE,CAAC,YAAY,CAuF1C,CAAC;AAKF,UAAU,YAAY;IACpB,QAAQ,EAAE,UAAU,GAAG,aAAa,CAAC;CACtC;AACD,eAAO,MAAM,cAAc,eAE1B,CAAC;AACF,eAAO,MAAM,oBAAoB,kBAEhC,CAAC;AAEF,eAAO,MAAM,mBAAmB,iBAAkB,YAAY,gBAY7D,CAAC;AAEF,eAAe,OAAO,CAAC"}
1
+ {"version":3,"file":"Tooltip.d.ts","sourceRoot":"","sources":["../../../src/components/Tooltip/Tooltip.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAkD,MAAM,OAAO,CAAC;AAUvE,MAAM,WAAW,YAAY;IAC3B,8CAA8C;IAC9C,QAAQ,EAAE,MAAM,CAAC;IACjB,uCAAuC;IACvC,WAAW,EAAE,KAAK,CAAC,SAAS,CAAC;IAC7B,sBAAsB;IACtB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,eAAO,MAAM,OAAO,EAAE,KAAK,CAAC,EAAE,CAAC,YAAY,CAgF1C,CAAC;AAEF,oBAAY,cAAc,GAAG;IAC3B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,iBAAiB,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;CAC3C,CAAC;AAMF,eAAO,MAAM,mBAAmB,EAAE,KAAK,CAAC,EAIvC,CAAC;AAEF,eAAe,OAAO,CAAC"}
@@ -0,0 +1,20 @@
1
+ import React from 'react';
2
+ export interface TooltipWordProps {
3
+ /** Ordet som skal ha en tilhørende tooltip */
4
+ children: string;
5
+ /** Callback når ordet klikkes på */
6
+ onClick: () => void;
7
+ /** Callback når ordet får fokus eller hovres over */
8
+ onFocus: () => void;
9
+ /** Callback når ordet mister fokus eller hover forsvinner */
10
+ onBlur: () => void;
11
+ /** Callback når det skrives på tastaturet */
12
+ onKeyDown: (e: React.KeyboardEvent<HTMLSpanElement>) => void;
13
+ /** ID til element som beskriver ordet */
14
+ ariaDescribedById: string;
15
+ /** Valgfri test-id */
16
+ testId?: string;
17
+ }
18
+ declare const TooltipWord: React.ForwardRefExoticComponent<TooltipWordProps & React.RefAttributes<HTMLSpanElement>>;
19
+ export default TooltipWord;
20
+ //# sourceMappingURL=TooltipWord.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TooltipWord.d.ts","sourceRoot":"","sources":["../../../../src/components/Tooltip/TooltipWord/TooltipWord.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAM1B,MAAM,WAAW,gBAAgB;IAC/B,8CAA8C;IAC9C,QAAQ,EAAE,MAAM,CAAC;IACjB,oCAAoC;IACpC,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,qDAAqD;IACrD,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,6DAA6D;IAC7D,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB,6CAA6C;IAC7C,SAAS,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC,eAAe,CAAC,KAAK,IAAI,CAAC;IAC7D,yCAAyC;IACzC,iBAAiB,EAAE,MAAM,CAAC;IAC1B,sBAAsB;IACtB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,QAAA,MAAM,WAAW,0FAmBhB,CAAC;AAIF,eAAe,WAAW,CAAC"}
@@ -0,0 +1 @@
1
+ {"props":{"children":{"defaultValue":null,"description":"Ordet som skal ha en tilhørende tooltip","name":"children","parent":{"fileName":"src/components/Tooltip/TooltipWord/TooltipWord.tsx","name":"TooltipWordProps"},"declarations":[{"fileName":"src/components/Tooltip/TooltipWord/TooltipWord.tsx","name":"TooltipWordProps"}],"required":true,"type":{"name":"string"}},"onClick":{"defaultValue":null,"description":"Callback når ordet klikkes på","name":"onClick","parent":{"fileName":"src/components/Tooltip/TooltipWord/TooltipWord.tsx","name":"TooltipWordProps"},"declarations":[{"fileName":"src/components/Tooltip/TooltipWord/TooltipWord.tsx","name":"TooltipWordProps"}],"required":true,"type":{"name":"() => void"}},"onFocus":{"defaultValue":null,"description":"Callback når ordet får fokus eller hovres over","name":"onFocus","parent":{"fileName":"src/components/Tooltip/TooltipWord/TooltipWord.tsx","name":"TooltipWordProps"},"declarations":[{"fileName":"src/components/Tooltip/TooltipWord/TooltipWord.tsx","name":"TooltipWordProps"}],"required":true,"type":{"name":"() => void"}},"onBlur":{"defaultValue":null,"description":"Callback når ordet mister fokus eller hover forsvinner","name":"onBlur","parent":{"fileName":"src/components/Tooltip/TooltipWord/TooltipWord.tsx","name":"TooltipWordProps"},"declarations":[{"fileName":"src/components/Tooltip/TooltipWord/TooltipWord.tsx","name":"TooltipWordProps"}],"required":true,"type":{"name":"() => void"}},"onKeyDown":{"defaultValue":null,"description":"Callback når det skrives på tastaturet","name":"onKeyDown","parent":{"fileName":"src/components/Tooltip/TooltipWord/TooltipWord.tsx","name":"TooltipWordProps"},"declarations":[{"fileName":"src/components/Tooltip/TooltipWord/TooltipWord.tsx","name":"TooltipWordProps"}],"required":true,"type":{"name":"(e: KeyboardEvent<HTMLSpanElement>) => void"}},"ariaDescribedById":{"defaultValue":null,"description":"ID til element som beskriver ordet","name":"ariaDescribedById","parent":{"fileName":"src/components/Tooltip/TooltipWord/TooltipWord.tsx","name":"TooltipWordProps"},"declarations":[{"fileName":"src/components/Tooltip/TooltipWord/TooltipWord.tsx","name":"TooltipWordProps"}],"required":true,"type":{"name":"string"}},"testId":{"defaultValue":null,"description":"Valgfri test-id","name":"testId","parent":{"fileName":"src/components/Tooltip/TooltipWord/TooltipWord.tsx","name":"TooltipWordProps"},"declarations":[{"fileName":"src/components/Tooltip/TooltipWord/TooltipWord.tsx","name":"TooltipWordProps"}],"required":false,"type":{"name":"string"}}}}
@@ -0,0 +1,4 @@
1
+ import TooltipWord from './TooltipWord';
2
+ export * from './TooltipWord';
3
+ export default TooltipWord;
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/Tooltip/TooltipWord/index.ts"],"names":[],"mappings":"AAAA,OAAO,WAAW,MAAM,eAAe,CAAC;AACxC,cAAc,eAAe,CAAC;AAC9B,eAAe,WAAW,CAAC"}
@@ -0,0 +1,2 @@
1
+ import"../../../TooltipWord.js";import{T as f}from"../../../TooltipWord.js";import"react";import"../../../constants.js";import"./styles.module.scss";export{f as default};
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -1,15 +1,12 @@
1
- @import '../../scss/_palette.scss';
2
- @import '../../scss/_spacers.scss';
1
+ @import '../../../scss/_palette.scss';
2
+ @import '../../../scss/_spacers.scss';
3
3
 
4
4
  .word {
5
5
  position: relative;
6
6
  display: inline-block;
7
7
  -webkit-text-decoration: underline dashed $plum400;
8
8
  text-decoration: underline 0.15rem dashed $plum400;
9
-
10
- &:hover {
11
- cursor: help;
12
- }
9
+ cursor: help;
13
10
 
14
11
  &:focus-visible {
15
12
  box-shadow: 0 0 0 getSpacer(4xs) $black;
@@ -1 +1 @@
1
- {"props":{"children":{"defaultValue":null,"description":"Ordet som skal ha en tilhørende hjelpeblubb","name":"children","parent":{"fileName":"src/components/Tooltip/Tooltip.tsx","name":"TooltipProps"},"declarations":[{"fileName":"src/components/Tooltip/Tooltip.tsx","name":"TooltipProps"},{"fileName":"designsystem/node_modules/@types/react/index.d.ts","name":"TypeLiteral"}],"required":false,"type":{"name":"ReactNode"}},"description":{"defaultValue":null,"description":"Teksten som skal vises i hjelpeblubben","name":"description","parent":{"fileName":"src/components/Tooltip/Tooltip.tsx","name":"TooltipProps"},"declarations":[{"fileName":"src/components/Tooltip/Tooltip.tsx","name":"TooltipProps"}],"required":true,"type":{"name":"ReactNode"}},"testId":{"defaultValue":null,"description":"Valgfri test-id","name":"testId","parent":{"fileName":"src/components/Tooltip/Tooltip.tsx","name":"TooltipProps"},"declarations":[{"fileName":"src/components/Tooltip/Tooltip.tsx","name":"TooltipProps"}],"required":false,"type":{"name":"string"}}}}
1
+ {"props":{"children":{"defaultValue":null,"description":"Ordet som skal ha en tilhørende tooltip","name":"children","parent":{"fileName":"src/components/Tooltip/Tooltip.tsx","name":"TooltipProps"},"declarations":[{"fileName":"src/components/Tooltip/Tooltip.tsx","name":"TooltipProps"},{"fileName":"designsystem/node_modules/@types/react/index.d.ts","name":"TypeLiteral"}],"required":false,"type":{"name":"string & ReactNode"}},"description":{"defaultValue":null,"description":"Teksten som skal vises i tooltip","name":"description","parent":{"fileName":"src/components/Tooltip/Tooltip.tsx","name":"TooltipProps"},"declarations":[{"fileName":"src/components/Tooltip/Tooltip.tsx","name":"TooltipProps"}],"required":true,"type":{"name":"ReactNode"}},"testId":{"defaultValue":null,"description":"Valgfri test-id","name":"testId","parent":{"fileName":"src/components/Tooltip/Tooltip.tsx","name":"TooltipProps"},"declarations":[{"fileName":"src/components/Tooltip/Tooltip.tsx","name":"TooltipProps"}],"required":false,"type":{"name":"string"}}}}
@@ -1,2 +1,2 @@
1
- import"../../Tooltip.js";import{T as z,b as A,T as B,u as C,a as D}from"../../Tooltip.js";import"react";import"../../constants.js";import"../../hooks/useUuid.js";import"../../uuid.js";import"../../HelpBubble.js";import"classnames";import"../../hooks/useEventListenerState.js";import"../../hooks/useGetDOMRect.js";import"../../AnchorLink.js";import"../Icons/Icon.js";import"../Icons/ArrowUpRight.js";import"../../theme/currys/color.js";import"../../theme/index.js";import"../../theme/palette.js";import"../../theme/spacers.js";import"../../theme/grid.js";import"../../hooks/useHover.js";import"../AnchorLink/styles.module.scss";import"../../Close.js";import"../Icons/X.js";import"../Close/styles.module.scss";import"../../hooks/useBreakpoint.js";import"../HelpBubble/styles.module.scss";import"./styles.module.scss";export{z as Tooltip,A as TooltipOpenProvider,B as default,C as useTooltipOpen,D as useTooltipOpenToggle};
1
+ import"../../Tooltip.js";import{T as G,a as H,T as I}from"../../Tooltip.js";import"react";import"../../hooks/useDelayedState.js";import"../../hooks/useUuid.js";import"../../uuid.js";import"../../utils/environment.js";import"../../HelpBubble.js";import"classnames";import"../../constants.js";import"../../hooks/useInterval.js";import"../../hooks/useIsVisible.js";import"../../hooks/useIntersectionObserver.js";import"../../hooks/useLayoutEvent.js";import"../../utils/debounce.js";import"../../hooks/useSize.js";import"../../AnchorLink.js";import"../Icons/Icon.js";import"../Icons/ArrowUpRight.js";import"../../theme/currys/color.js";import"../../theme/index.js";import"../../theme/palette.js";import"../../theme/spacers.js";import"../../theme/grid.js";import"../../hooks/useHover.js";import"../AnchorLink/styles.module.scss";import"../../Close.js";import"../Icons/X.js";import"../Close/styles.module.scss";import"../../hooks/useBreakpoint.js";import"../HelpBubble/styles.module.scss";import"../../TooltipWord.js";import"./TooltipWord/styles.module.scss";export{G as Tooltip,H as TooltipOpenProvider,I as default};
2
2
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"TooltipExample.d.ts","sourceRoot":"","sources":["../../../src/components/TooltipExample/TooltipExample.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAgB,EAAE,YAAY,EAAuB,MAAM,YAAY,CAAC;AAGxE,QAAA,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,YAAY,CAc1C,CAAC;AAEF,eAAe,cAAc,CAAC"}
1
+ {"version":3,"file":"TooltipExample.d.ts","sourceRoot":"","sources":["../../../src/components/TooltipExample/TooltipExample.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAgB,EAAE,YAAY,EAAuB,MAAM,YAAY,CAAC;AAGxE,QAAA,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,YAAY,CAe1C,CAAC;AAEF,eAAe,cAAc,CAAC"}
@@ -1 +1 @@
1
- {"props":{"children":{"defaultValue":null,"description":"Ordet som skal ha en tilhørende hjelpeblubb","name":"children","parent":{"fileName":"designsystem/src/components/Tooltip/Tooltip.tsx","name":"TooltipProps"},"declarations":[{"fileName":"designsystem/src/components/Tooltip/Tooltip.tsx","name":"TooltipProps"},{"fileName":"designsystem/node_modules/@types/react/index.d.ts","name":"TypeLiteral"}],"required":false,"type":{"name":"ReactNode"}},"description":{"defaultValue":null,"description":"Teksten som skal vises i hjelpeblubben","name":"description","parent":{"fileName":"designsystem/src/components/Tooltip/Tooltip.tsx","name":"TooltipProps"},"declarations":[{"fileName":"designsystem/src/components/Tooltip/Tooltip.tsx","name":"TooltipProps"}],"required":true,"type":{"name":"ReactNode"}},"testId":{"defaultValue":null,"description":"Valgfri test-id","name":"testId","parent":{"fileName":"designsystem/src/components/Tooltip/Tooltip.tsx","name":"TooltipProps"},"declarations":[{"fileName":"designsystem/src/components/Tooltip/Tooltip.tsx","name":"TooltipProps"}],"required":false,"type":{"name":"string"}}}}
1
+ {"props":{"children":{"defaultValue":null,"description":"Ordet som skal ha en tilhørende tooltip","name":"children","parent":{"fileName":"designsystem/src/components/Tooltip/Tooltip.tsx","name":"TooltipProps"},"declarations":[{"fileName":"designsystem/src/components/Tooltip/Tooltip.tsx","name":"TooltipProps"},{"fileName":"designsystem/node_modules/@types/react/index.d.ts","name":"TypeLiteral"}],"required":false,"type":{"name":"string & ReactNode"}},"description":{"defaultValue":null,"description":"Teksten som skal vises i tooltip","name":"description","parent":{"fileName":"designsystem/src/components/Tooltip/Tooltip.tsx","name":"TooltipProps"},"declarations":[{"fileName":"designsystem/src/components/Tooltip/Tooltip.tsx","name":"TooltipProps"}],"required":true,"type":{"name":"ReactNode"}},"testId":{"defaultValue":null,"description":"Valgfri test-id","name":"testId","parent":{"fileName":"designsystem/src/components/Tooltip/Tooltip.tsx","name":"TooltipProps"},"declarations":[{"fileName":"designsystem/src/components/Tooltip/Tooltip.tsx","name":"TooltipProps"}],"required":false,"type":{"name":"string"}}}}
@@ -1,2 +1,2 @@
1
- import i from"react";import{b as r,T as e}from"../../Tooltip.js";import"../../constants.js";import"../../hooks/useUuid.js";import"../../uuid.js";import"../../HelpBubble.js";import"classnames";import"../../hooks/useEventListenerState.js";import"../../hooks/useGetDOMRect.js";import"../../AnchorLink.js";import"../Icons/Icon.js";import"../Icons/ArrowUpRight.js";import"../../theme/currys/color.js";import"../../theme/index.js";import"../../theme/palette.js";import"../../theme/spacers.js";import"../../theme/grid.js";import"../../hooks/useHover.js";import"../AnchorLink/styles.module.scss";import"../../Close.js";import"../Icons/X.js";import"../Close/styles.module.scss";import"../../hooks/useBreakpoint.js";import"../HelpBubble/styles.module.scss";import"../Tooltip/styles.module.scss";const o="Dolore quis tempor culpa exercitation laboris. Enim enim pariatur veniam nisi ad quis fugiat magna occaecat nisi. Excepteur ad ad duis quis mollit ex. Laboris duis velit eu eiusmod ea in ex aliqua. Est proident proident dolor veniam nostrud aliquip occaecat dolore sunt laboris nisi ipsum Lorem nisi. Magna sunt ex occaecat amet id. Eiusmod magna Lorem proident est occaecat pariatur sunt esse nostrud. Mollit reprehenderit velit veniam amet ipsum veniam et. Dolor sunt adipisicing enim dolore quis qui occaecat esse quis ut fugiat laboris. ",R=t=>i.createElement(r,null,i.createElement(i.Fragment,null,i.createElement(e,{...t},"Et tooltip her.")," "+o,"Dette er ",i.createElement(e,{...t},t.children)," som skal ha n\xE6rmere forklaring.",o,i.createElement(e,{...t},"Enda et tooltip her.")));export{R as default};
1
+ import t from"react";import{a as e,T as o}from"../../Tooltip.js";import{longLoremText as m}from"../../utils/loremtext.js";import"../../hooks/useDelayedState.js";import"../../hooks/useUuid.js";import"../../uuid.js";import"../../utils/environment.js";import"../../HelpBubble.js";import"classnames";import"../../constants.js";import"../../hooks/useInterval.js";import"../../hooks/useIsVisible.js";import"../../hooks/useIntersectionObserver.js";import"../../hooks/useLayoutEvent.js";import"../../utils/debounce.js";import"../../hooks/useSize.js";import"../../AnchorLink.js";import"../Icons/Icon.js";import"../Icons/ArrowUpRight.js";import"../../theme/currys/color.js";import"../../theme/index.js";import"../../theme/palette.js";import"../../theme/spacers.js";import"../../theme/grid.js";import"../../hooks/useHover.js";import"../AnchorLink/styles.module.scss";import"../../Close.js";import"../Icons/X.js";import"../Close/styles.module.scss";import"../../hooks/useBreakpoint.js";import"../HelpBubble/styles.module.scss";import"../../TooltipWord.js";import"../Tooltip/TooltipWord/styles.module.scss";const G=r=>t.createElement(e,null,t.createElement(t.Fragment,null,t.createElement(o,{...r},"Et tooltip her.")," "+m,t.createElement("button",null,"Knapp"),"Dette er ",t.createElement(o,{...r},r.children)," som skal ha n\xE6rmere forklaring.",m,t.createElement(o,{...r},"Enda et tooltip her.")));export{G as default};
2
2
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../src/utils/loremtext.ts","../../../src/components/TooltipExample/TooltipExample.tsx"],"sourcesContent":["export const shortLoremText = 'Officia laboris in sit nisi consectetur eu.';\nexport const mediumLoremText =\n 'Cupidatat culpa dolor id nulla sit commodo elit aliqua cillum. Reprehenderit aute aute enim non adipisicing duis adipisicing id laboris aliquip tempor amet. Non occaecat minim ad duis sunt et.';\nexport const longLoremText =\n 'Dolore quis tempor culpa exercitation laboris. Enim enim pariatur veniam nisi ad quis fugiat magna occaecat nisi. Excepteur ad ad duis quis mollit ex. Laboris duis velit eu eiusmod ea in ex aliqua. Est proident proident dolor veniam nostrud aliquip occaecat dolore sunt laboris nisi ipsum Lorem nisi. Magna sunt ex occaecat amet id. Eiusmod magna Lorem proident est occaecat pariatur sunt esse nostrud. Mollit reprehenderit velit veniam amet ipsum veniam et. Dolor sunt adipisicing enim dolore quis qui occaecat esse quis ut fugiat laboris. ';\n\nexport default longLoremText;\n","import React from 'react';\n\nimport Tooltip, { TooltipProps, TooltipOpenProvider } from '../Tooltip';\nimport longLoremText from '../../utils/loremtext';\n\nconst TooltipExample: React.FC<TooltipProps> = props => {\n return (\n <TooltipOpenProvider>\n <>\n <Tooltip {...props}>{'Et tooltip her.'}</Tooltip>\n {' ' + longLoremText}\n {'Dette er '}\n <Tooltip {...props}>{props.children}</Tooltip>\n {' som skal ha nærmere forklaring.'}\n {longLoremText}\n <Tooltip {...props}>{'Enda et tooltip her.'}</Tooltip>\n </>\n </TooltipOpenProvider>\n );\n};\n\nexport default TooltipExample;\n"],"names":["longLoremText","TooltipExample","props","React","TooltipOpenProvider","Tooltip"],"mappings":"ixBAGO,MAAMA,EACX,giBCCIC,EAAkDC,GAEpDC,EAAA,cAACC,EACC,KAAAD,EAAA,cAAAA,EAAA,SAAA,KACGA,EAAA,cAAAE,EAAA,CAAS,GAAGH,CAAA,EAAQ,iBAAkB,EACtC,IAAMF,EACN,YACAG,EAAA,cAAAE,EAAA,CAAS,GAAGH,CAAA,EAAQA,EAAM,QAAS,EACnC,sCACAF,EACAG,EAAA,cAAAE,EAAA,CAAS,GAAGH,CAAA,EAAQ,sBAAuB,CAC9C,CACF"}
1
+ {"version":3,"file":"index.js","sources":["../../../src/components/TooltipExample/TooltipExample.tsx"],"sourcesContent":["import React from 'react';\n\nimport Tooltip, { TooltipProps, TooltipOpenProvider } from '../Tooltip';\nimport longLoremText from '../../utils/loremtext';\n\nconst TooltipExample: React.FC<TooltipProps> = props => {\n return (\n <TooltipOpenProvider>\n <>\n <Tooltip {...props}>{'Et tooltip her.'}</Tooltip>\n {' ' + longLoremText}\n <button>{'Knapp'}</button>\n {'Dette er '}\n <Tooltip {...props}>{props.children}</Tooltip>\n {' som skal ha nærmere forklaring.'}\n {longLoremText}\n <Tooltip {...props}>{'Enda et tooltip her.'}</Tooltip>\n </>\n </TooltipOpenProvider>\n );\n};\n\nexport default TooltipExample;\n"],"names":["TooltipExample","props","React","TooltipOpenProvider","Tooltip","longLoremText"],"mappings":"skCAKA,MAAMA,EAAkDC,GAEpDC,EAAA,cAACC,EACC,KAAAD,EAAA,cAAAA,EAAA,SAAA,KACGA,EAAA,cAAAE,EAAA,CAAS,GAAGH,CAAQ,EAAA,iBAAkB,EACtC,IAAMI,kBACN,SAAQ,KAAA,OAAQ,EAChB,YACAH,EAAA,cAAAE,EAAA,CAAS,GAAGH,CAAA,EAAQA,EAAM,QAAS,EACnC,sCACAI,EACAH,EAAA,cAAAE,EAAA,CAAS,GAAGH,CAAA,EAAQ,sBAAuB,CAC9C,CACF"}
@@ -1,2 +1,2 @@
1
- import"../../Validation.js";import{V as F,V as G}from"../../Validation.js";import"react";import"classnames";import"../../FormGroup.js";import"../FormGroup/styles.module.scss";import"../../Checkbox.js";import"../../uuid.js";import"../Icons/Check.js";import"../Icons/Icon.js";import"../../constants.js";import"../../hooks/useUuid.js";import"../../theme/currys/color.js";import"../../theme/index.js";import"../../theme/palette.js";import"../../theme/spacers.js";import"../../theme/grid.js";import"../Checkbox/styles.module.scss";import"../../RadioButton.js";import"../RadioButton/styles.module.scss";import"../../Input.js";import"../../hooks/useBreakpoint.js";import"../../ErrorWrapper.js";import"../ErrorWrapper/styles.module.scss";import"../Input/styles.module.scss";import"../../Title.js";import"../Title/styles.module.scss";import"../../FormLayout.js";import"../FormLayout/styles.module.scss";import"./styles.module.scss";export{F as Validation,G as default};
1
+ import"../../Validation.js";import{V as J,V as K}from"../../Validation.js";import"react";import"classnames";import"../../FormGroup.js";import"../FormGroup/styles.module.scss";import"../../Checkbox.js";import"../../uuid.js";import"../../utils/environment.js";import"../Icons/Check.js";import"../Icons/Icon.js";import"../../constants.js";import"../../hooks/useUuid.js";import"../../theme/currys/color.js";import"../../theme/index.js";import"../../theme/palette.js";import"../../theme/spacers.js";import"../../theme/grid.js";import"../Checkbox/styles.module.scss";import"../../RadioButton.js";import"../RadioButton/styles.module.scss";import"../../Input.js";import"../../hooks/useBreakpoint.js";import"../../ErrorWrapper.js";import"../ErrorWrapper/styles.module.scss";import"../Input/styles.module.scss";import"../../Title.js";import"../Title/styles.module.scss";import"../../FormLayout.js";import"../FormLayout/styles.module.scss";import"../../Select.js";import"../Select/styles.module.scss";import"../Icons/ChevronDown.js";import"./styles.module.scss";export{J as Validation,K as default};
2
2
  //# sourceMappingURL=index.js.map
package/constants.d.ts CHANGED
@@ -10,6 +10,7 @@ export declare enum ZIndex {
10
10
  Modal = 1300000,
11
11
  ExpanderTrigger = 10000
12
12
  }
13
+ export declare const AVERAGE_CHARACTER_WIDTH_PX = 12;
13
14
  export interface HTMLButtonProps {
14
15
  autoFocus?: boolean;
15
16
  disabled?: boolean;
@@ -77,6 +78,7 @@ export declare enum AnalyticsId {
77
78
  Portal = "portal",
78
79
  Progressbar = "progressbar",
79
80
  RadioButton = "radio-button",
81
+ Select = "select",
80
82
  Slider = "slider",
81
83
  Spacer = "spacer",
82
84
  StatusDot = "status-dot",
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,oBAAY,QAAQ;IAClB,OAAO,KAAK;IACZ,MAAM,KAAK;IACX,KAAK,KAAK;IACV,MAAM,KAAK;IACX,KAAK,KAAK;IACV,MAAM,MAAM;CACb;AAED,oBAAY,MAAM;IAChB,KAAK,UAAU;IACf,eAAe,QAAQ;CACxB;AAED,MAAM,WAAW,eAAe;IAC9B,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,QAAQ,GAAG,OAAO,GAAG,QAAQ,GAAG,MAAM,CAAC;IAC9C,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,MAAM,CAAC;IACnC,EAAE,CAAC,EAAE,MAAM,CAAC;CACb;AAED,oBAAY,YAAY,GAAG,OAAO,GAAG,QAAQ,GAAG,SAAS,GAAG,MAAM,CAAC;AAEnE,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,GAAG,CAAC,EAAE,YAAY,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,cAAc,CAAC,EACX,EAAE,GACF,aAAa,GACb,aAAa,GACb,4BAA4B,GAC5B,QAAQ,GACR,0BAA0B,GAC1B,eAAe,GACf,iCAAiC,GACjC,YAAY,CAAC;CAClB;AAED,oBAAY,aAAa,GAAG,WAAW,GAAG,UAAU,GAAG,MAAM,GAAG,SAAS,GAAG,IAAI,CAAC;AAEjF,oBAAY,QAAQ;IAClB,OAAO,YAAY;IACnB,MAAM,WAAW;IACjB,WAAW,gBAAgB;IAC3B,MAAM,WAAW;IACjB,SAAS,cAAc;CACxB;AAED,oBAAY,WAAW;IACrB,MAAM,WAAW;IACjB,OAAO,YAAY;CACpB;AAED,oBAAY,WAAW;IACrB,UAAU,gBAAgB;IAC1B,MAAM,WAAW;IACjB,KAAK,UAAU;IACf,MAAM,WAAW;IACjB,QAAQ,aAAa;IACrB,KAAK,UAAU;IACf,QAAQ,aAAa;IACrB,OAAO,YAAY;IACnB,QAAQ,aAAa;IACrB,YAAY,kBAAkB;IAC9B,oBAAoB,2BAA2B;IAC/C,SAAS,eAAe;IACxB,UAAU,gBAAgB;IAC1B,UAAU,gBAAgB;IAC1B,YAAY,kBAAkB;IAC9B,IAAI,SAAS;IACb,KAAK,UAAU;IACf,IAAI,SAAS;IACb,QAAQ,cAAc;IACtB,IAAI,SAAS;IACb,MAAM,WAAW;IACjB,IAAI,SAAS;IACb,KAAK,UAAU;IACf,iBAAiB,uBAAuB;IACxC,KAAK,UAAU;IACf,SAAS,eAAe;IACxB,MAAM,WAAW;IACjB,WAAW,gBAAgB;IAC3B,WAAW,iBAAiB;IAC5B,MAAM,WAAW;IACjB,MAAM,WAAW;IACjB,SAAS,eAAe;IACxB,KAAK,UAAU;IACf,GAAG,QAAQ;IACX,OAAO,aAAa;IACpB,QAAQ,aAAa;IACrB,IAAI,SAAS;IACb,KAAK,UAAU;IACf,OAAO,YAAY;IACnB,UAAU,eAAe;CAC1B;AAED,oBAAY,gBAAgB;IAC1B,KAAK,UAAU;IACf,MAAM,WAAW;IACjB,SAAS,cAAc;IACvB,OAAO,YAAY;IACnB,IAAI,SAAS;IACb,GAAG,QAAQ;CACZ"}
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,oBAAY,QAAQ;IAClB,OAAO,KAAK;IACZ,MAAM,KAAK;IACX,KAAK,KAAK;IACV,MAAM,KAAK;IACX,KAAK,KAAK;IACV,MAAM,MAAM;CACb;AAED,oBAAY,MAAM;IAChB,KAAK,UAAU;IACf,eAAe,QAAQ;CACxB;AAED,eAAO,MAAM,0BAA0B,KAAK,CAAC;AAE7C,MAAM,WAAW,eAAe;IAC9B,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,QAAQ,GAAG,OAAO,GAAG,QAAQ,GAAG,MAAM,CAAC;IAC9C,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,MAAM,CAAC;IACnC,EAAE,CAAC,EAAE,MAAM,CAAC;CACb;AAED,oBAAY,YAAY,GAAG,OAAO,GAAG,QAAQ,GAAG,SAAS,GAAG,MAAM,CAAC;AAEnE,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,GAAG,CAAC,EAAE,YAAY,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,cAAc,CAAC,EACX,EAAE,GACF,aAAa,GACb,aAAa,GACb,4BAA4B,GAC5B,QAAQ,GACR,0BAA0B,GAC1B,eAAe,GACf,iCAAiC,GACjC,YAAY,CAAC;CAClB;AAED,oBAAY,aAAa,GAAG,WAAW,GAAG,UAAU,GAAG,MAAM,GAAG,SAAS,GAAG,IAAI,CAAC;AAEjF,oBAAY,QAAQ;IAClB,OAAO,YAAY;IACnB,MAAM,WAAW;IACjB,WAAW,gBAAgB;IAC3B,MAAM,WAAW;IACjB,SAAS,cAAc;CACxB;AAED,oBAAY,WAAW;IACrB,MAAM,WAAW;IACjB,OAAO,YAAY;CACpB;AAED,oBAAY,WAAW;IACrB,UAAU,gBAAgB;IAC1B,MAAM,WAAW;IACjB,KAAK,UAAU;IACf,MAAM,WAAW;IACjB,QAAQ,aAAa;IACrB,KAAK,UAAU;IACf,QAAQ,aAAa;IACrB,OAAO,YAAY;IACnB,QAAQ,aAAa;IACrB,YAAY,kBAAkB;IAC9B,oBAAoB,2BAA2B;IAC/C,SAAS,eAAe;IACxB,UAAU,gBAAgB;IAC1B,UAAU,gBAAgB;IAC1B,YAAY,kBAAkB;IAC9B,IAAI,SAAS;IACb,KAAK,UAAU;IACf,IAAI,SAAS;IACb,QAAQ,cAAc;IACtB,IAAI,SAAS;IACb,MAAM,WAAW;IACjB,IAAI,SAAS;IACb,KAAK,UAAU;IACf,iBAAiB,uBAAuB;IACxC,KAAK,UAAU;IACf,SAAS,eAAe;IACxB,MAAM,WAAW;IACjB,WAAW,gBAAgB;IAC3B,WAAW,iBAAiB;IAC5B,MAAM,WAAW;IACjB,MAAM,WAAW;IACjB,MAAM,WAAW;IACjB,SAAS,eAAe;IACxB,KAAK,UAAU;IACf,GAAG,QAAQ;IACX,OAAO,aAAa;IACpB,QAAQ,aAAa;IACrB,IAAI,SAAS;IACb,KAAK,UAAU;IACf,OAAO,YAAY;IACnB,UAAU,eAAe;CAC1B;AAED,oBAAY,gBAAgB;IAC1B,KAAK,UAAU;IACf,MAAM,WAAW;IACjB,SAAS,cAAc;IACvB,OAAO,YAAY;IACnB,IAAI,SAAS;IACb,GAAG,QAAQ;CACZ"}
package/constants.js CHANGED
@@ -1,2 +1,2 @@
1
- var o=(r=>(r[r.XXSmall=24]="XXSmall",r[r.XSmall=38]="XSmall",r[r.Small=48]="Small",r[r.Medium=64]="Medium",r[r.Large=80]="Large",r[r.XLarge=130]="XLarge",r))(o||{}),e=(r=>(r[r.Modal=13e5]="Modal",r[r.ExpanderTrigger=1e4]="ExpanderTrigger",r))(e||{}),a=(r=>(r.onwhite="onwhite",r.ongrey="ongrey",r.onblueberry="onblueberry",r.ondark="ondark",r.oninvalid="oninvalid",r))(a||{}),p=(r=>(r.normal="normal",r.bigform="bigform",r))(p||{}),g=(r=>(r.AnchorLink="anchor-link",r.Avatar="avatar",r.Badge="badge",r.Button="button",r.Checkbox="checkbox",r.Close="close",r.Dropdown="dropdown",r.Duolist="duolist",r.Expander="expander",r.ExpanderList="expander-list",r.ExpanderListExpander="expander-list-expander",r.FormGroup="form-group",r.FormLayout="form-layout",r.HelpBubble="help-bubble",r.HighlightBox="highlight-box",r.Icon="icon",r.Input="input",r.Link="link",r.LinkList="link-list",r.List="list",r.Loader="loader",r.Logo="logo",r.Modal="modal",r.NotificationPanel="notification-panel",r.Panel="panel",r.PanelList="panel-list",r.Portal="portal",r.Progressbar="progressbar",r.RadioButton="radio-button",r.Slider="slider",r.Spacer="spacer",r.StatusDot="status-dot",r.Table="table",r.Tag="tag",r.TagList="tag-list",r.Textarea="textarea",r.Tile="tile",r.Title="title",r.Tooltip="tooltip",r.Validation="validation",r))(g||{}),u=(r=>(r.Enter="Enter",r.Escape="Escape",r.ArrowDown="ArrowDown",r.ArrowUp="ArrowUp",r.Home="Home",r.End="End",r))(u||{});export{g as AnalyticsId,a as FormMode,p as FormVariant,o as IconSize,u as KeyboardEventKey,e as ZIndex};
1
+ var o=(r=>(r[r.XXSmall=24]="XXSmall",r[r.XSmall=38]="XSmall",r[r.Small=48]="Small",r[r.Medium=64]="Medium",r[r.Large=80]="Large",r[r.XLarge=130]="XLarge",r))(o||{}),e=(r=>(r[r.Modal=13e5]="Modal",r[r.ExpanderTrigger=1e4]="ExpanderTrigger",r))(e||{});const u=12;var a=(r=>(r.onwhite="onwhite",r.ongrey="ongrey",r.onblueberry="onblueberry",r.ondark="ondark",r.oninvalid="oninvalid",r))(a||{}),p=(r=>(r.normal="normal",r.bigform="bigform",r))(p||{}),g=(r=>(r.AnchorLink="anchor-link",r.Avatar="avatar",r.Badge="badge",r.Button="button",r.Checkbox="checkbox",r.Close="close",r.Dropdown="dropdown",r.Duolist="duolist",r.Expander="expander",r.ExpanderList="expander-list",r.ExpanderListExpander="expander-list-expander",r.FormGroup="form-group",r.FormLayout="form-layout",r.HelpBubble="help-bubble",r.HighlightBox="highlight-box",r.Icon="icon",r.Input="input",r.Link="link",r.LinkList="link-list",r.List="list",r.Loader="loader",r.Logo="logo",r.Modal="modal",r.NotificationPanel="notification-panel",r.Panel="panel",r.PanelList="panel-list",r.Portal="portal",r.Progressbar="progressbar",r.RadioButton="radio-button",r.Select="select",r.Slider="slider",r.Spacer="spacer",r.StatusDot="status-dot",r.Table="table",r.Tag="tag",r.TagList="tag-list",r.Textarea="textarea",r.Tile="tile",r.Title="title",r.Tooltip="tooltip",r.Validation="validation",r))(g||{}),l=(r=>(r.Enter="Enter",r.Escape="Escape",r.ArrowDown="ArrowDown",r.ArrowUp="ArrowUp",r.Home="Home",r.End="End",r))(l||{});export{u as AVERAGE_CHARACTER_WIDTH_PX,g as AnalyticsId,a as FormMode,p as FormVariant,o as IconSize,l as KeyboardEventKey,e as ZIndex};
2
2
  //# sourceMappingURL=constants.js.map
package/constants.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","sources":["../src/constants.ts"],"sourcesContent":["export enum IconSize {\n XXSmall = 24,\n XSmall = 38,\n Small = 48,\n Medium = 64,\n Large = 80,\n XLarge = 130,\n}\n\nexport enum ZIndex {\n Modal = 1300000,\n ExpanderTrigger = 10000,\n}\n\nexport interface HTMLButtonProps {\n autoFocus?: boolean;\n disabled?: boolean;\n form?: string;\n formAction?: string;\n formEncType?: string;\n formMethod?: string;\n formNoValidate?: boolean;\n formTarget?: string;\n name?: string;\n type?: 'submit' | 'reset' | 'button' | string;\n value?: string | string[] | number;\n id?: string;\n}\n\nexport type AnchorTarget = '_self' | '_blank' | '_parent' | '_top';\n\nexport interface HTMLAnchorProps {\n download?: string;\n href?: string;\n hrefLang?: string;\n media?: string;\n ping?: string;\n rel?: AnchorTarget;\n target?: string;\n referrerPolicy?:\n | ''\n | 'same-origin'\n | 'no-referrer'\n | 'no-referrer-when-downgrade'\n | 'origin'\n | 'origin-when-cross-origin'\n | 'strict-origin'\n | 'strict-origin-when-cross-origin'\n | 'unsafe-url';\n}\n\nexport type ButtonVariant = 'secondary' | 'tertiary' | string | undefined | null;\n\nexport enum FormMode {\n onwhite = 'onwhite',\n ongrey = 'ongrey',\n onblueberry = 'onblueberry',\n ondark = 'ondark',\n oninvalid = 'oninvalid',\n}\n\nexport enum FormVariant {\n normal = 'normal',\n bigform = 'bigform',\n}\n\nexport enum AnalyticsId {\n AnchorLink = 'anchor-link',\n Avatar = 'avatar',\n Badge = 'badge',\n Button = 'button',\n Checkbox = 'checkbox',\n Close = 'close',\n Dropdown = 'dropdown',\n Duolist = 'duolist',\n Expander = 'expander',\n ExpanderList = 'expander-list',\n ExpanderListExpander = 'expander-list-expander',\n FormGroup = 'form-group',\n FormLayout = 'form-layout',\n HelpBubble = 'help-bubble',\n HighlightBox = 'highlight-box',\n Icon = 'icon',\n Input = 'input',\n Link = 'link',\n LinkList = 'link-list',\n List = 'list',\n Loader = 'loader',\n Logo = 'logo',\n Modal = 'modal',\n NotificationPanel = 'notification-panel',\n Panel = 'panel',\n PanelList = 'panel-list',\n Portal = 'portal',\n Progressbar = 'progressbar',\n RadioButton = 'radio-button',\n Slider = 'slider',\n Spacer = 'spacer',\n StatusDot = 'status-dot',\n Table = 'table',\n Tag = 'tag',\n TagList = 'tag-list',\n Textarea = 'textarea',\n Tile = 'tile',\n Title = 'title',\n Tooltip = 'tooltip',\n Validation = 'validation',\n}\n\nexport enum KeyboardEventKey {\n Enter = 'Enter',\n Escape = 'Escape',\n ArrowDown = 'ArrowDown',\n ArrowUp = 'ArrowUp',\n Home = 'Home',\n End = 'End',\n}\n"],"names":["IconSize","ZIndex","FormMode","FormVariant","AnalyticsId","KeyboardEventKey"],"mappings":"AAAY,IAAAA,GAAAA,IACVA,EAAAA,EAAA,QAAU,IAAV,UACAA,EAAAA,EAAA,OAAS,IAAT,SACAA,EAAAA,EAAA,MAAQ,IAAR,QACAA,EAAAA,EAAA,OAAS,IAAT,SACAA,EAAAA,EAAA,MAAQ,IAAR,QACAA,EAAAA,EAAA,OAAS,KAAT,SANUA,IAAAA,GAAA,CAAA,CAAA,EASAC,GAAAA,IACVA,EAAAA,EAAA,MAAQ,MAAR,QACAA,EAAAA,EAAA,gBAAkB,KAAlB,kBAFUA,IAAAA,GAAA,CAAA,CAAA,EA4CAC,GAAAA,IACVA,EAAA,QAAU,UACVA,EAAA,OAAS,SACTA,EAAA,YAAc,cACdA,EAAA,OAAS,SACTA,EAAA,UAAY,YALFA,IAAAA,GAAA,CAAA,CAAA,EAQAC,GAAAA,IACVA,EAAA,OAAS,SACTA,EAAA,QAAU,UAFAA,IAAAA,GAAA,CAAA,CAAA,EAKAC,GAAAA,IACVA,EAAA,WAAa,cACbA,EAAA,OAAS,SACTA,EAAA,MAAQ,QACRA,EAAA,OAAS,SACTA,EAAA,SAAW,WACXA,EAAA,MAAQ,QACRA,EAAA,SAAW,WACXA,EAAA,QAAU,UACVA,EAAA,SAAW,WACXA,EAAA,aAAe,gBACfA,EAAA,qBAAuB,yBACvBA,EAAA,UAAY,aACZA,EAAA,WAAa,cACbA,EAAA,WAAa,cACbA,EAAA,aAAe,gBACfA,EAAA,KAAO,OACPA,EAAA,MAAQ,QACRA,EAAA,KAAO,OACPA,EAAA,SAAW,YACXA,EAAA,KAAO,OACPA,EAAA,OAAS,SACTA,EAAA,KAAO,OACPA,EAAA,MAAQ,QACRA,EAAA,kBAAoB,qBACpBA,EAAA,MAAQ,QACRA,EAAA,UAAY,aACZA,EAAA,OAAS,SACTA,EAAA,YAAc,cACdA,EAAA,YAAc,eACdA,EAAA,OAAS,SACTA,EAAA,OAAS,SACTA,EAAA,UAAY,aACZA,EAAA,MAAQ,QACRA,EAAA,IAAM,MACNA,EAAA,QAAU,WACVA,EAAA,SAAW,WACXA,EAAA,KAAO,OACPA,EAAA,MAAQ,QACRA,EAAA,QAAU,UACVA,EAAA,WAAa,aAxCHA,IAAAA,GAAA,CAAA,CAAA,EA2CAC,GAAAA,IACVA,EAAA,MAAQ,QACRA,EAAA,OAAS,SACTA,EAAA,UAAY,YACZA,EAAA,QAAU,UACVA,EAAA,KAAO,OACPA,EAAA,IAAM,MANIA,IAAAA,GAAA,CAAA,CAAA"}
1
+ {"version":3,"file":"constants.js","sources":["../src/constants.ts"],"sourcesContent":["export enum IconSize {\n XXSmall = 24,\n XSmall = 38,\n Small = 48,\n Medium = 64,\n Large = 80,\n XLarge = 130,\n}\n\nexport enum ZIndex {\n Modal = 1300000,\n ExpanderTrigger = 10000,\n}\n\nexport const AVERAGE_CHARACTER_WIDTH_PX = 12;\n\nexport interface HTMLButtonProps {\n autoFocus?: boolean;\n disabled?: boolean;\n form?: string;\n formAction?: string;\n formEncType?: string;\n formMethod?: string;\n formNoValidate?: boolean;\n formTarget?: string;\n name?: string;\n type?: 'submit' | 'reset' | 'button' | string;\n value?: string | string[] | number;\n id?: string;\n}\n\nexport type AnchorTarget = '_self' | '_blank' | '_parent' | '_top';\n\nexport interface HTMLAnchorProps {\n download?: string;\n href?: string;\n hrefLang?: string;\n media?: string;\n ping?: string;\n rel?: AnchorTarget;\n target?: string;\n referrerPolicy?:\n | ''\n | 'same-origin'\n | 'no-referrer'\n | 'no-referrer-when-downgrade'\n | 'origin'\n | 'origin-when-cross-origin'\n | 'strict-origin'\n | 'strict-origin-when-cross-origin'\n | 'unsafe-url';\n}\n\nexport type ButtonVariant = 'secondary' | 'tertiary' | string | undefined | null;\n\nexport enum FormMode {\n onwhite = 'onwhite',\n ongrey = 'ongrey',\n onblueberry = 'onblueberry',\n ondark = 'ondark',\n oninvalid = 'oninvalid',\n}\n\nexport enum FormVariant {\n normal = 'normal',\n bigform = 'bigform',\n}\n\nexport enum AnalyticsId {\n AnchorLink = 'anchor-link',\n Avatar = 'avatar',\n Badge = 'badge',\n Button = 'button',\n Checkbox = 'checkbox',\n Close = 'close',\n Dropdown = 'dropdown',\n Duolist = 'duolist',\n Expander = 'expander',\n ExpanderList = 'expander-list',\n ExpanderListExpander = 'expander-list-expander',\n FormGroup = 'form-group',\n FormLayout = 'form-layout',\n HelpBubble = 'help-bubble',\n HighlightBox = 'highlight-box',\n Icon = 'icon',\n Input = 'input',\n Link = 'link',\n LinkList = 'link-list',\n List = 'list',\n Loader = 'loader',\n Logo = 'logo',\n Modal = 'modal',\n NotificationPanel = 'notification-panel',\n Panel = 'panel',\n PanelList = 'panel-list',\n Portal = 'portal',\n Progressbar = 'progressbar',\n RadioButton = 'radio-button',\n Select = 'select',\n Slider = 'slider',\n Spacer = 'spacer',\n StatusDot = 'status-dot',\n Table = 'table',\n Tag = 'tag',\n TagList = 'tag-list',\n Textarea = 'textarea',\n Tile = 'tile',\n Title = 'title',\n Tooltip = 'tooltip',\n Validation = 'validation',\n}\n\nexport enum KeyboardEventKey {\n Enter = 'Enter',\n Escape = 'Escape',\n ArrowDown = 'ArrowDown',\n ArrowUp = 'ArrowUp',\n Home = 'Home',\n End = 'End',\n}\n"],"names":["IconSize","ZIndex","AVERAGE_CHARACTER_WIDTH_PX","FormMode","FormVariant","AnalyticsId","KeyboardEventKey"],"mappings":"AAAY,IAAAA,GAAAA,IACVA,EAAAA,EAAA,QAAU,IAAV,UACAA,EAAAA,EAAA,OAAS,IAAT,SACAA,EAAAA,EAAA,MAAQ,IAAR,QACAA,EAAAA,EAAA,OAAS,IAAT,SACAA,EAAAA,EAAA,MAAQ,IAAR,QACAA,EAAAA,EAAA,OAAS,KAAT,SANUA,IAAAA,GAAA,CAAA,CAAA,EASAC,GAAAA,IACVA,EAAAA,EAAA,MAAQ,MAAR,QACAA,EAAAA,EAAA,gBAAkB,KAAlB,kBAFUA,IAAAA,GAAA,CAAA,CAAA,EAKL,MAAMC,EAA6B,GAyC9B,IAAAC,GAAAA,IACVA,EAAA,QAAU,UACVA,EAAA,OAAS,SACTA,EAAA,YAAc,cACdA,EAAA,OAAS,SACTA,EAAA,UAAY,YALFA,IAAAA,GAAA,CAAA,CAAA,EAQAC,GAAAA,IACVA,EAAA,OAAS,SACTA,EAAA,QAAU,UAFAA,IAAAA,GAAA,CAAA,CAAA,EAKAC,GAAAA,IACVA,EAAA,WAAa,cACbA,EAAA,OAAS,SACTA,EAAA,MAAQ,QACRA,EAAA,OAAS,SACTA,EAAA,SAAW,WACXA,EAAA,MAAQ,QACRA,EAAA,SAAW,WACXA,EAAA,QAAU,UACVA,EAAA,SAAW,WACXA,EAAA,aAAe,gBACfA,EAAA,qBAAuB,yBACvBA,EAAA,UAAY,aACZA,EAAA,WAAa,cACbA,EAAA,WAAa,cACbA,EAAA,aAAe,gBACfA,EAAA,KAAO,OACPA,EAAA,MAAQ,QACRA,EAAA,KAAO,OACPA,EAAA,SAAW,YACXA,EAAA,KAAO,OACPA,EAAA,OAAS,SACTA,EAAA,KAAO,OACPA,EAAA,MAAQ,QACRA,EAAA,kBAAoB,qBACpBA,EAAA,MAAQ,QACRA,EAAA,UAAY,aACZA,EAAA,OAAS,SACTA,EAAA,YAAc,cACdA,EAAA,YAAc,eACdA,EAAA,OAAS,SACTA,EAAA,OAAS,SACTA,EAAA,OAAS,SACTA,EAAA,UAAY,aACZA,EAAA,MAAQ,QACRA,EAAA,IAAM,MACNA,EAAA,QAAU,WACVA,EAAA,SAAW,WACXA,EAAA,KAAO,OACPA,EAAA,MAAQ,QACRA,EAAA,QAAU,UACVA,EAAA,WAAa,aAzCHA,IAAAA,GAAA,CAAA,CAAA,EA4CAC,GAAAA,IACVA,EAAA,MAAQ,QACRA,EAAA,OAAS,SACTA,EAAA,UAAY,YACZA,EAAA,QAAU,UACVA,EAAA,KAAO,OACPA,EAAA,IAAM,MANIA,IAAAA,GAAA,CAAA,CAAA"}
@@ -0,0 +1,9 @@
1
+ import { Dispatch, SetStateAction } from 'react';
2
+ /**
3
+ * useState, men med mulighet for å oppdatere state etter X millisekunder
4
+ * @param initialState Verdi state skal ha ved første render
5
+ * @param delay Vent X millisekunder før state oppdateres
6
+ * @returns state, callback for å oppdatere state etter delay, og callback for å oppdatere state umiddelbart
7
+ */
8
+ export declare const useDelayedState: <S>(initialState: S, delay: number) => [S, Dispatch<SetStateAction<S>>, Dispatch<SetStateAction<S>>];
9
+ //# sourceMappingURL=useDelayedState.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useDelayedState.d.ts","sourceRoot":"","sources":["../../src/hooks/useDelayedState.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,cAAc,EAA+B,MAAM,OAAO,CAAC;AAE9E;;;;;GAKG;AACH,eAAO,MAAM,eAAe,8BAA+B,MAAM,kEAqBhE,CAAC"}
@@ -0,0 +1,2 @@
1
+ import{useState as n,useRef as l,useEffect as m}from"react";const d=(u,c)=>{const[o,r]=n(u),e=l(),s=t=>{clearTimeout(e.current),e.current=window.setTimeout(()=>r(t),c)},a=t=>{clearTimeout(e.current),r(t)};return m(()=>()=>{clearTimeout(e.current)},[]),[o,s,a]};export{d as useDelayedState};
2
+ //# sourceMappingURL=useDelayedState.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useDelayedState.js","sources":["../../src/hooks/useDelayedState.ts"],"sourcesContent":["import { Dispatch, SetStateAction, useEffect, useRef, useState } from 'react';\n\n/**\n * useState, men med mulighet for å oppdatere state etter X millisekunder\n * @param initialState Verdi state skal ha ved første render\n * @param delay Vent X millisekunder før state oppdateres\n * @returns state, callback for å oppdatere state etter delay, og callback for å oppdatere state umiddelbart\n */\nexport const useDelayedState = <S>(initialState: S, delay: number): [S, Dispatch<SetStateAction<S>>, Dispatch<SetStateAction<S>>] => {\n const [value, setValue] = useState(initialState);\n const timer = useRef<number>();\n\n const setDelayedValue = (newState: SetStateAction<S>): void => {\n clearTimeout(timer.current);\n timer.current = window.setTimeout(() => setValue(newState), delay);\n };\n\n const setImmediateValue = (newState: SetStateAction<S>): void => {\n clearTimeout(timer.current);\n setValue(newState);\n };\n\n useEffect(() => {\n return () => {\n clearTimeout(timer.current);\n };\n }, []);\n\n return [value, setDelayedValue, setImmediateValue];\n};\n"],"names":["useDelayedState","initialState","delay","value","setValue","useState","timer","useRef","setDelayedValue","newState","setImmediateValue","useEffect"],"mappings":"4DAQa,MAAAA,EAAkB,CAAIC,EAAiBC,IAAiF,CACnI,KAAM,CAACC,EAAOC,CAAQ,EAAIC,EAASJ,CAAY,EACzCK,EAAQC,IAERC,EAAmBC,GAAsC,CAC7D,aAAaH,EAAM,OAAO,EAC1BA,EAAM,QAAU,OAAO,WAAW,IAAMF,EAASK,CAAQ,EAAGP,CAAK,CAAA,EAG7DQ,EAAqBD,GAAsC,CAC/D,aAAaH,EAAM,OAAO,EAC1BF,EAASK,CAAQ,CAAA,EAGnB,OAAAE,EAAU,IACD,IAAM,CACX,aAAaL,EAAM,OAAO,CAAA,EAE3B,CAAE,CAAA,EAEE,CAACH,EAAOK,EAAiBE,CAAiB,CACnD"}
@@ -3,7 +3,8 @@ import React from 'react';
3
3
  * Lås fokus til et bestemt element. Bruker vil bare kunne tabbe mellom fokuserbare elementer innenfor elementet.
4
4
  * @param ref Alle barn av dette elementet vil være fokuserbare, elementer utenfor vil ikke det
5
5
  * @param trapFocus Om fokus skal "trappes" innenfor elementet eller ikke. Default=true.
6
+ * @param autofocus Om fokus automatisk skal settes til første fokuserbare element. Default=false.
6
7
  */
7
- export declare const useFocusTrap: (ref: React.RefObject<HTMLElement>, trapFocus?: boolean) => void;
8
+ export declare const useFocusTrap: (ref: React.RefObject<HTMLElement>, trapFocus?: boolean, autofocus?: boolean) => void;
8
9
  export default useFocusTrap;
9
10
  //# sourceMappingURL=useFocusTrap.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useFocusTrap.d.ts","sourceRoot":"","sources":["../../src/hooks/useFocusTrap.ts"],"names":[],"mappings":"AAAA,OAAO,KAAoB,MAAM,OAAO,CAAC;AAIzC;;;;GAIG;AACH,eAAO,MAAM,YAAY,QAAS,MAAM,SAAS,CAAC,WAAW,CAAC,cAAa,OAAO,KAAU,IA4B3F,CAAC;AAEF,eAAe,YAAY,CAAC"}
1
+ {"version":3,"file":"useFocusTrap.d.ts","sourceRoot":"","sources":["../../src/hooks/useFocusTrap.ts"],"names":[],"mappings":"AAAA,OAAO,KAAoB,MAAM,OAAO,CAAC;AAIzC;;;;;GAKG;AACH,eAAO,MAAM,YAAY,QAAS,MAAM,SAAS,CAAC,WAAW,CAAC,cAAa,OAAO,cAAoB,OAAO,KAAW,IAgCvH,CAAC;AAEF,eAAe,YAAY,CAAC"}
@@ -1,2 +1,2 @@
1
- import{useEffect as l}from"react";import{getDocumentActiveElement as i}from"./focus-utils.js";import{useFocusableElements as m}from"./useFocusableElements.js";const v=(t,r=!0)=>{const n=m(t),c=e=>{if(r&&t.current&&n&&e.key==="Tab"){const s=i(t.current),o=n[0],u=n.length===1?o:n[n.length-1];e.shiftKey&&s===o?(u.focus(),e.preventDefault()):!e.shiftKey&&s===u&&(o.focus(),e.preventDefault())}};l(()=>{var e;return(e=t.current)==null||e.addEventListener("keydown",c),()=>{var s;(s=t.current)==null||s.removeEventListener("keydown",c)}},[t,r,n])};export{v as default,v as useFocusTrap};
1
+ import{useEffect as u}from"react";import{getDocumentActiveElement as f}from"./focus-utils.js";import{useFocusableElements as m}from"./useFocusableElements.js";const h=(n,o=!0,c=!1)=>{const e=m(n),i=t=>{if(o&&n.current&&(e==null?void 0:e.length)&&t.key==="Tab"){const r=f(n.current),s=e[0],l=e.length===1?s:e[e.length-1];t.shiftKey&&r===s?(l.focus(),t.preventDefault()):!t.shiftKey&&r===l&&(s.focus(),t.preventDefault())}};u(()=>{var t;return c&&o&&(e==null?void 0:e.length)&&e[0].focus(),(t=n.current)==null||t.addEventListener("keydown",i),()=>{var r;(r=n.current)==null||r.removeEventListener("keydown",i)}},[n,o,c,e])};export{h as default,h as useFocusTrap};
2
2
  //# sourceMappingURL=useFocusTrap.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useFocusTrap.js","sources":["../../src/hooks/useFocusTrap.ts"],"sourcesContent":["import React, { useEffect } from 'react';\nimport { getDocumentActiveElement } from './focus-utils';\nimport { useFocusableElements } from './useFocusableElements';\n\n/**\n * Lås fokus til et bestemt element. Bruker vil bare kunne tabbe mellom fokuserbare elementer innenfor elementet.\n * @param ref Alle barn av dette elementet vil være fokuserbare, elementer utenfor vil ikke det\n * @param trapFocus Om fokus skal \"trappes\" innenfor elementet eller ikke. Default=true.\n */\nexport const useFocusTrap = (ref: React.RefObject<HTMLElement>, trapFocus: boolean = true): void => {\n const focusableElementList = useFocusableElements(ref);\n\n const handleKeyboardEvent = (e: KeyboardEvent): void => {\n if (trapFocus && ref.current && focusableElementList && e.key === 'Tab') {\n const activeElement = getDocumentActiveElement(ref.current);\n const firstElement = focusableElementList[0];\n const lastElement = focusableElementList.length === 1 ? firstElement : focusableElementList[focusableElementList.length - 1];\n\n if (e.shiftKey && activeElement === firstElement) {\n /* shift + tab */\n lastElement.focus();\n e.preventDefault();\n } else if (!e.shiftKey && activeElement === lastElement) {\n /* tab */\n firstElement.focus();\n e.preventDefault();\n }\n }\n };\n\n useEffect(() => {\n ref.current?.addEventListener('keydown', handleKeyboardEvent);\n\n return (): void => {\n ref.current?.removeEventListener('keydown', handleKeyboardEvent);\n };\n }, [ref, trapFocus, focusableElementList]); // focusableElementList må være med som dependency for at handleKeyboardEvent skal få oppdatert state\n};\n\nexport default useFocusTrap;\n"],"names":["useFocusTrap","ref","trapFocus","focusableElementList","useFocusableElements","handleKeyboardEvent","activeElement","getDocumentActiveElement","firstElement","lastElement","useEffect","_a"],"mappings":"+JASO,MAAMA,EAAe,CAACC,EAAmCC,EAAqB,KAAe,CAC5F,MAAAC,EAAuBC,EAAqBH,CAAG,EAE/CI,EAAuB,GAA2B,CACtD,GAAIH,GAAaD,EAAI,SAAWE,GAAwB,EAAE,MAAQ,MAAO,CACjE,MAAAG,EAAgBC,EAAyBN,EAAI,OAAO,EACpDO,EAAeL,EAAqB,GACpCM,EAAcN,EAAqB,SAAW,EAAIK,EAAeL,EAAqBA,EAAqB,OAAS,GAEtH,EAAE,UAAYG,IAAkBE,GAElCC,EAAY,MAAM,EAClB,EAAE,eAAe,GACR,CAAC,EAAE,UAAYH,IAAkBG,IAE1CD,EAAa,MAAM,EACnB,EAAE,eAAe,EAErB,CAAA,EAGFE,EAAU,IAAM,OACV,OAAAC,EAAAV,EAAA,UAAA,MAAAU,EAAS,iBAAiB,UAAWN,GAElC,IAAY,QACbM,EAAAV,EAAA,UAAA,MAAAU,EAAS,oBAAoB,UAAWN,EAAmB,CAEhE,EAAA,CAACJ,EAAKC,EAAWC,CAAoB,CAAC,CAC3C"}
1
+ {"version":3,"file":"useFocusTrap.js","sources":["../../src/hooks/useFocusTrap.ts"],"sourcesContent":["import React, { useEffect } from 'react';\nimport { getDocumentActiveElement } from './focus-utils';\nimport { useFocusableElements } from './useFocusableElements';\n\n/**\n * Lås fokus til et bestemt element. Bruker vil bare kunne tabbe mellom fokuserbare elementer innenfor elementet.\n * @param ref Alle barn av dette elementet vil være fokuserbare, elementer utenfor vil ikke det\n * @param trapFocus Om fokus skal \"trappes\" innenfor elementet eller ikke. Default=true.\n * @param autofocus Om fokus automatisk skal settes til første fokuserbare element. Default=false.\n */\nexport const useFocusTrap = (ref: React.RefObject<HTMLElement>, trapFocus: boolean = true, autofocus: boolean = false): void => {\n const focusableElementList = useFocusableElements(ref);\n\n const handleKeyboardEvent = (e: KeyboardEvent): void => {\n if (trapFocus && ref.current && focusableElementList?.length && e.key === 'Tab') {\n const activeElement = getDocumentActiveElement(ref.current);\n const firstElement = focusableElementList[0];\n const lastElement = focusableElementList.length === 1 ? firstElement : focusableElementList[focusableElementList.length - 1];\n\n if (e.shiftKey && activeElement === firstElement) {\n /* shift + tab */\n lastElement.focus();\n e.preventDefault();\n } else if (!e.shiftKey && activeElement === lastElement) {\n /* tab */\n firstElement.focus();\n e.preventDefault();\n }\n }\n };\n\n useEffect(() => {\n if (autofocus && trapFocus && focusableElementList?.length) {\n focusableElementList[0].focus();\n }\n\n ref.current?.addEventListener('keydown', handleKeyboardEvent);\n\n return (): void => {\n ref.current?.removeEventListener('keydown', handleKeyboardEvent);\n };\n }, [ref, trapFocus, autofocus, focusableElementList]); // focusableElementList må være med som dependency for at handleKeyboardEvent skal få oppdatert state\n};\n\nexport default useFocusTrap;\n"],"names":["useFocusTrap","ref","trapFocus","autofocus","focusableElementList","useFocusableElements","handleKeyboardEvent","e","activeElement","getDocumentActiveElement","firstElement","lastElement","useEffect","_a"],"mappings":"+JAUO,MAAMA,EAAe,CAACC,EAAmCC,EAAqB,GAAMC,EAAqB,KAAgB,CACxH,MAAAC,EAAuBC,EAAqBJ,CAAG,EAE/CK,EAAuBC,GAA2B,CACtD,GAAIL,GAAaD,EAAI,UAAWG,GAAA,YAAAA,EAAsB,SAAUG,EAAE,MAAQ,MAAO,CACzE,MAAAC,EAAgBC,EAAyBR,EAAI,OAAO,EACpDS,EAAeN,EAAqB,GACpCO,EAAcP,EAAqB,SAAW,EAAIM,EAAeN,EAAqBA,EAAqB,OAAS,GAEtHG,EAAE,UAAYC,IAAkBE,GAElCC,EAAY,MAAM,EAClBJ,EAAE,eAAe,GACR,CAACA,EAAE,UAAYC,IAAkBG,IAE1CD,EAAa,MAAM,EACnBH,EAAE,eAAe,EAErB,CAAA,EAGFK,EAAU,IAAM,OACV,OAAAT,GAAaD,IAAaE,GAAA,YAAAA,EAAsB,SAClDA,EAAqB,GAAG,SAGtBS,EAAAZ,EAAA,UAAA,MAAAY,EAAS,iBAAiB,UAAWP,GAElC,IAAY,QACbO,EAAAZ,EAAA,UAAA,MAAAY,EAAS,oBAAoB,UAAWP,EAAmB,GAEhE,CAACL,EAAKC,EAAWC,EAAWC,CAAoB,CAAC,CACtD"}
@@ -1,2 +1,2 @@
1
- import{useState as s,useEffect as b}from"react";const r=['a[href]:not([tabindex^="-"])','area[href]:not([tabindex^="-"])','input:not([type="hidden"]):not([type="radio"]):not([disabled]):not([tabindex^="-"])','input[type="radio"]:not([disabled]):not([tabindex^="-"])','select:not([disabled]):not([tabindex^="-"])','textarea:not([disabled]):not([tabindex^="-"])','button:not([disabled]):not([tabindex^="-"])','iframe:not([tabindex^="-"])','audio[controls]:not([tabindex^="-"])','video[controls]:not([tabindex^="-"])','[contenteditable]:not([tabindex^="-"])','[tabindex]:not([tabindex^="-"])'].join(","),u=t=>{const[i,a]=s();return b(()=>{const e=()=>{var o;const d=(o=t.current)==null?void 0:o.querySelectorAll(r);a(d)},n=new MutationObserver(e);return t!=null&&t.current&&n.observe(t.current,{subtree:!0,childList:!0,attributeFilter:["tabindex","type","disabled","href"]}),e(),()=>{n.disconnect()}},[t]),i};export{r as FOCUSABLE_SELECTORS,u as useFocusableElements};
1
+ import{useState as s,useEffect as b}from"react";const r=['a[href]:not([tabindex^="-"])','area[href]:not([tabindex^="-"])','input:not([type="hidden"]):not([type="radio"]):not([disabled]):not([tabindex^="-"])','input[type="radio"]:not([disabled]):not([tabindex^="-"])','select:not([disabled]):not([tabindex^="-"])','textarea:not([disabled]):not([tabindex^="-"])','button:not([disabled]):not([tabindex^="-"])','iframe:not([tabindex^="-"])','audio[controls]:not([tabindex^="-"])','video[controls]:not([tabindex^="-"])','[contenteditable]:not([tabindex^="-"])','[tabindex]:not([tabindex^="-"])'].join(","),c=t=>{const[i,a]=s();return b(()=>{const e=()=>{var o;const d=(o=t.current)==null?void 0:o.querySelectorAll(r);a(d)},n=new MutationObserver(e);return t!=null&&t.current&&n.observe(t.current,{subtree:!0,childList:!0}),e(),()=>{n.disconnect()}},[t]),i};export{r as FOCUSABLE_SELECTORS,c as useFocusableElements};
2
2
  //# sourceMappingURL=useFocusableElements.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useFocusableElements.js","sources":["../../src/hooks/useFocusableElements.ts"],"sourcesContent":["import { useState, useEffect } from 'react';\n\n// Fra https://github.com/KittyGiraudel/focusable-selectors\nexport const FOCUSABLE_SELECTORS = [\n 'a[href]:not([tabindex^=\"-\"])',\n 'area[href]:not([tabindex^=\"-\"])',\n 'input:not([type=\"hidden\"]):not([type=\"radio\"]):not([disabled]):not([tabindex^=\"-\"])',\n 'input[type=\"radio\"]:not([disabled]):not([tabindex^=\"-\"])',\n 'select:not([disabled]):not([tabindex^=\"-\"])',\n 'textarea:not([disabled]):not([tabindex^=\"-\"])',\n 'button:not([disabled]):not([tabindex^=\"-\"])',\n 'iframe:not([tabindex^=\"-\"])',\n 'audio[controls]:not([tabindex^=\"-\"])',\n 'video[controls]:not([tabindex^=\"-\"])',\n '[contenteditable]:not([tabindex^=\"-\"])',\n '[tabindex]:not([tabindex^=\"-\"])',\n].join(',');\n\n/**\n * Overvåk et element og finn alle fokuserbare elementer inne i elementet. Bruker MutationObserver slik at eventuelle\n * nye elementer som legges til også vil inkluderes i listen.\n * @param ref Element som skal observeres\n * @returns Liste med fokuserbare HTML-elementer\n */\nexport const useFocusableElements = (ref: React.RefObject<HTMLElement>): NodeListOf<HTMLElement> | undefined => {\n const [focusableElementList, setFocusableElementList] = useState<NodeListOf<HTMLElement>>();\n\n useEffect(() => {\n const handleMutationChange = () => {\n const elementList = ref.current?.querySelectorAll<HTMLElement>(FOCUSABLE_SELECTORS);\n setFocusableElementList(elementList);\n };\n\n const mutationObserver = new MutationObserver(handleMutationChange);\n if (ref?.current) {\n mutationObserver.observe(ref.current, { subtree: true, childList: true, attributeFilter: ['tabindex', 'type', 'disabled', 'href'] }); // Observer de samme attributtene som i FOCUSABLE_SELECTORS\n }\n\n handleMutationChange();\n\n return (): void => {\n mutationObserver.disconnect();\n };\n }, [ref]);\n\n return focusableElementList;\n};\n"],"names":["FOCUSABLE_SELECTORS","useFocusableElements","ref","focusableElementList","setFocusableElementList","useState","useEffect","handleMutationChange","elementList","_a","mutationObserver"],"mappings":"gDAGO,MAAMA,EAAsB,CACjC,+BACA,kCACA,sFACA,2DACA,8CACA,gDACA,8CACA,8BACA,uCACA,uCACA,yCACA,iCACF,EAAE,KAAK,GAAG,EAQGC,EAAwBC,GAA2E,CAC9G,KAAM,CAACC,EAAsBC,CAAuB,EAAIC,EAAkC,EAE1F,OAAAC,EAAU,IAAM,CACd,MAAMC,EAAuB,IAAM,OACjC,MAAMC,GAAcC,EAAAP,EAAI,UAAJ,YAAAO,EAAa,iBAA8BT,GAC/DI,EAAwBI,CAAW,CAAA,EAG/BE,EAAmB,IAAI,iBAAiBH,CAAoB,EAClE,OAAIL,GAAA,MAAAA,EAAK,SACPQ,EAAiB,QAAQR,EAAI,QAAS,CAAE,QAAS,GAAM,UAAW,GAAM,gBAAiB,CAAC,WAAY,OAAQ,WAAY,MAAM,EAAG,EAGhHK,IAEd,IAAY,CACjBG,EAAiB,WAAW,CAAA,CAC9B,EACC,CAACR,CAAG,CAAC,EAEDC,CACT"}
1
+ {"version":3,"file":"useFocusableElements.js","sources":["../../src/hooks/useFocusableElements.ts"],"sourcesContent":["import { useState, useEffect } from 'react';\n\n// Fra https://github.com/KittyGiraudel/focusable-selectors\nexport const FOCUSABLE_SELECTORS = [\n 'a[href]:not([tabindex^=\"-\"])',\n 'area[href]:not([tabindex^=\"-\"])',\n 'input:not([type=\"hidden\"]):not([type=\"radio\"]):not([disabled]):not([tabindex^=\"-\"])',\n 'input[type=\"radio\"]:not([disabled]):not([tabindex^=\"-\"])',\n 'select:not([disabled]):not([tabindex^=\"-\"])',\n 'textarea:not([disabled]):not([tabindex^=\"-\"])',\n 'button:not([disabled]):not([tabindex^=\"-\"])',\n 'iframe:not([tabindex^=\"-\"])',\n 'audio[controls]:not([tabindex^=\"-\"])',\n 'video[controls]:not([tabindex^=\"-\"])',\n '[contenteditable]:not([tabindex^=\"-\"])',\n '[tabindex]:not([tabindex^=\"-\"])',\n].join(',');\n\n/**\n * Overvåk et element og finn alle fokuserbare elementer inne i elementet. Bruker MutationObserver slik at eventuelle\n * nye elementer som legges til også vil inkluderes i listen.\n * @param ref Element som skal observeres\n * @returns Liste med fokuserbare HTML-elementer\n */\nexport const useFocusableElements = (ref: React.RefObject<HTMLElement>): NodeListOf<HTMLElement> | undefined => {\n const [focusableElementList, setFocusableElementList] = useState<NodeListOf<HTMLElement>>();\n\n useEffect(() => {\n const handleMutationChange = () => {\n const elementList = ref.current?.querySelectorAll<HTMLElement>(FOCUSABLE_SELECTORS);\n setFocusableElementList(elementList);\n };\n\n const mutationObserver = new MutationObserver(handleMutationChange);\n if (ref?.current) {\n mutationObserver.observe(ref.current, { subtree: true, childList: true });\n }\n\n handleMutationChange();\n\n return (): void => {\n mutationObserver.disconnect();\n };\n }, [ref]);\n\n return focusableElementList;\n};\n"],"names":["FOCUSABLE_SELECTORS","useFocusableElements","ref","focusableElementList","setFocusableElementList","useState","useEffect","handleMutationChange","elementList","_a","mutationObserver"],"mappings":"gDAGO,MAAMA,EAAsB,CACjC,+BACA,kCACA,sFACA,2DACA,8CACA,gDACA,8CACA,8BACA,uCACA,uCACA,yCACA,iCACF,EAAE,KAAK,GAAG,EAQGC,EAAwBC,GAA2E,CAC9G,KAAM,CAACC,EAAsBC,CAAuB,EAAIC,EAAkC,EAE1F,OAAAC,EAAU,IAAM,CACd,MAAMC,EAAuB,IAAM,OACjC,MAAMC,GAAcC,EAAAP,EAAI,UAAJ,YAAAO,EAAa,iBAA8BT,GAC/DI,EAAwBI,CAAW,CAAA,EAG/BE,EAAmB,IAAI,iBAAiBH,CAAoB,EAClE,OAAIL,GAAA,MAAAA,EAAK,SACUQ,EAAA,QAAQR,EAAI,QAAS,CAAE,QAAS,GAAM,UAAW,GAAM,EAGrDK,IAEd,IAAY,CACjBG,EAAiB,WAAW,CAAA,CAC9B,EACC,CAACR,CAAG,CAAC,EAEDC,CACT"}
@@ -6,5 +6,5 @@
6
6
  * @param callback Kalles når en endring i intersection er observert
7
7
  * @param options Objekt med options for IntersectionObserver, f.eks. threshold for å bestemme når callbacken skal fyres
8
8
  */
9
- export declare const useIntersectionObserver: (ref: React.RefObject<HTMLElement>, callback: IntersectionObserverCallback, options?: IntersectionObserverInit) => void;
9
+ export declare const useIntersectionObserver: (ref: React.RefObject<Element>, callback: IntersectionObserverCallback, options?: IntersectionObserverInit) => void;
10
10
  //# sourceMappingURL=useIntersectionObserver.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useIntersectionObserver.d.ts","sourceRoot":"","sources":["../../src/hooks/useIntersectionObserver.ts"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AAEH,eAAO,MAAM,uBAAuB,QAC7B,MAAM,SAAS,CAAC,WAAW,CAAC,YACvB,4BAA4B,YAC5B,wBAAwB,KACjC,IAgBF,CAAC"}
1
+ {"version":3,"file":"useIntersectionObserver.d.ts","sourceRoot":"","sources":["../../src/hooks/useIntersectionObserver.ts"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AAEH,eAAO,MAAM,uBAAuB,QAC7B,MAAM,SAAS,CAAC,OAAO,CAAC,YACnB,4BAA4B,YAC5B,wBAAwB,KACjC,IAgBF,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"useIntersectionObserver.js","sources":["../../src/hooks/useIntersectionObserver.ts"],"sourcesContent":["import { useEffect } from 'react';\n\n/**\n * Lytt på endringer i synligheten (intersection) til et HTML-element. F.eks. kan du bruke denne til å kalle en callback\n * når elementet er i ferd med å forsvinne ut av vinduet.\n *\n * @param ref Element som skal observeres\n * @param callback Kalles når en endring i intersection er observert\n * @param options Objekt med options for IntersectionObserver, f.eks. threshold for å bestemme når callbacken skal fyres\n */\n\nexport const useIntersectionObserver = (\n ref: React.RefObject<HTMLElement>,\n callback: IntersectionObserverCallback,\n options?: IntersectionObserverInit\n): void => {\n useEffect(() => {\n const intersectionObserver = new IntersectionObserver(callback, options);\n\n if (ref?.current) {\n intersectionObserver.observe(ref.current);\n }\n\n return (): void => {\n if (ref?.current) {\n intersectionObserver.unobserve(ref.current);\n } else {\n intersectionObserver.disconnect();\n }\n };\n }, [ref, options]);\n};\n"],"names":["useIntersectionObserver","ref","callback","options","useEffect","intersectionObserver"],"mappings":"kCAWO,MAAMA,EAA0B,CACrCC,EACAC,EACAC,IACS,CACTC,EAAU,IAAM,CACd,MAAMC,EAAuB,IAAI,qBAAqBH,EAAUC,CAAO,EAEvE,OAAIF,GAAA,MAAAA,EAAK,SACcI,EAAA,QAAQJ,EAAI,OAAO,EAGnC,IAAY,CACbA,GAAA,MAAAA,EAAK,QACcI,EAAA,UAAUJ,EAAI,OAAO,EAE1CI,EAAqB,WAAW,CAClC,CACF,EACC,CAACJ,EAAKE,CAAO,CAAC,CACnB"}
1
+ {"version":3,"file":"useIntersectionObserver.js","sources":["../../src/hooks/useIntersectionObserver.ts"],"sourcesContent":["import { useEffect } from 'react';\n\n/**\n * Lytt på endringer i synligheten (intersection) til et HTML-element. F.eks. kan du bruke denne til å kalle en callback\n * når elementet er i ferd med å forsvinne ut av vinduet.\n *\n * @param ref Element som skal observeres\n * @param callback Kalles når en endring i intersection er observert\n * @param options Objekt med options for IntersectionObserver, f.eks. threshold for å bestemme når callbacken skal fyres\n */\n\nexport const useIntersectionObserver = (\n ref: React.RefObject<Element>,\n callback: IntersectionObserverCallback,\n options?: IntersectionObserverInit\n): void => {\n useEffect(() => {\n const intersectionObserver = new IntersectionObserver(callback, options);\n\n if (ref?.current) {\n intersectionObserver.observe(ref.current);\n }\n\n return (): void => {\n if (ref?.current) {\n intersectionObserver.unobserve(ref.current);\n } else {\n intersectionObserver.disconnect();\n }\n };\n }, [ref, options]);\n};\n"],"names":["useIntersectionObserver","ref","callback","options","useEffect","intersectionObserver"],"mappings":"kCAWO,MAAMA,EAA0B,CACrCC,EACAC,EACAC,IACS,CACTC,EAAU,IAAM,CACd,MAAMC,EAAuB,IAAI,qBAAqBH,EAAUC,CAAO,EAEvE,OAAIF,GAAA,MAAAA,EAAK,SACcI,EAAA,QAAQJ,EAAI,OAAO,EAGnC,IAAY,CACbA,GAAA,MAAAA,EAAK,QACcI,EAAA,UAAUJ,EAAI,OAAO,EAE1CI,EAAqB,WAAW,CAClC,CACF,EACC,CAACJ,EAAKE,CAAO,CAAC,CACnB"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Kjør en funksjon ved intervaller basert på ønsket frequency.
3
+ *
4
+ * @param callback Funksjon som skal kjøres
5
+ * @param frequency Hvor ofte vi skal kjøre funksjonen
6
+ * @returns void
7
+ */
8
+ export declare const useInterval: (callback: () => void, frequency?: number) => void;
9
+ //# sourceMappingURL=useInterval.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useInterval.d.ts","sourceRoot":"","sources":["../../src/hooks/useInterval.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,eAAO,MAAM,WAAW,aAAc,MAAM,IAAI,yBAAmB,IAQlE,CAAC"}
@@ -0,0 +1,2 @@
1
+ import{useEffect as n}from"react";const s=(t,e=10)=>{n(()=>{const r=setInterval(t,e);return()=>{clearInterval(r)}},[t,e])};export{s as useInterval};
2
+ //# sourceMappingURL=useInterval.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useInterval.js","sources":["../../src/hooks/useInterval.ts"],"sourcesContent":["import { useEffect } from 'react';\n\n/**\n * Kjør en funksjon ved intervaller basert på ønsket frequency.\n *\n * @param callback Funksjon som skal kjøres\n * @param frequency Hvor ofte vi skal kjøre funksjonen\n * @returns void\n */\nexport const useInterval = (callback: () => void, frequency = 10): void => {\n useEffect(() => {\n const timer = setInterval(callback, frequency);\n\n return () => {\n clearInterval(timer);\n };\n }, [callback, frequency]);\n};\n"],"names":["useInterval","callback","frequency","useEffect","timer"],"mappings":"kCASO,MAAMA,EAAc,CAACC,EAAsBC,EAAY,KAAa,CACzEC,EAAU,IAAM,CACR,MAAAC,EAAQ,YAAYH,EAAUC,CAAS,EAE7C,MAAO,IAAM,CACX,cAAcE,CAAK,CAAA,CACrB,EACC,CAACH,EAAUC,CAAS,CAAC,CAC1B"}
@@ -7,5 +7,5 @@
7
7
  * @param initial Om elementet default skal antas å være synlig eller ikke. Default: ikke synlig
8
8
  * @returns true hvis objektet er synlig lik threshold eller mer, false hvis ikke
9
9
  */
10
- export declare const useIsVisible: (ref: React.RefObject<HTMLElement>, threshold?: number, options?: IntersectionObserverInit, initial?: boolean) => boolean;
10
+ export declare const useIsVisible: (ref: React.RefObject<Element>, threshold?: number, options?: IntersectionObserverInit, initial?: boolean) => boolean;
11
11
  //# sourceMappingURL=useIsVisible.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useIsVisible.d.ts","sourceRoot":"","sources":["../../src/hooks/useIsVisible.ts"],"names":[],"mappings":"AAGA;;;;;;;;GAQG;AACH,eAAO,MAAM,YAAY,QAClB,MAAM,SAAS,CAAC,WAAW,CAAC,gCAEvB,wBAAwB,wBAEjC,OAUF,CAAC"}
1
+ {"version":3,"file":"useIsVisible.d.ts","sourceRoot":"","sources":["../../src/hooks/useIsVisible.ts"],"names":[],"mappings":"AAGA;;;;;;;;GAQG;AACH,eAAO,MAAM,YAAY,QAClB,MAAM,SAAS,CAAC,OAAO,CAAC,gCAEnB,wBAAwB,wBAEjC,OAUF,CAAC"}
@@ -1,2 +1,2 @@
1
- import{useState as a}from"react";import{useIntersectionObserver as c}from"./useIntersectionObserver.js";const m=(s,e=1,t,n=!1)=>{const[i,r]=a(n);return c(s,o=>{r(o[0].intersectionRatio>=e)},{threshold:e,...t}),i};export{m as useIsVisible};
1
+ import{useState as a}from"react";import{useIntersectionObserver as c}from"./useIntersectionObserver.js";const u=(s,e=1,i,n=!1)=>{const[o,r]=a(n);return c(s,t=>{r(e===0?t[0].intersectionRatio!==e:t[0].intersectionRatio>=e)},{threshold:e,...i}),o};export{u as useIsVisible};
2
2
  //# sourceMappingURL=useIsVisible.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useIsVisible.js","sources":["../../src/hooks/useIsVisible.ts"],"sourcesContent":["import { useState } from 'react';\nimport { useIntersectionObserver } from './useIntersectionObserver';\n\n/**\n * Sjekk om et HTML-element er synlig i vinduet, eller ikke.\n *\n * @param ref Element som skal observeres\n * @param threshold Hvor synlig må elementet være? Default = 1 (helt synlig)\n * @param options Objekt med options for IntersectionObserver, f.eks. threshold for å bestemme når callbacken skal fyres\n * @param initial Om elementet default skal antas å være synlig eller ikke. Default: ikke synlig\n * @returns true hvis objektet er synlig lik threshold eller mer, false hvis ikke\n */\nexport const useIsVisible = (\n ref: React.RefObject<HTMLElement>,\n threshold = 1,\n options?: IntersectionObserverInit,\n initial = false\n): boolean => {\n const [isVisible, setIsVisible] = useState(initial);\n\n const handleIntersectChange: IntersectionObserverCallback = entries => {\n setIsVisible(entries[0].intersectionRatio >= threshold);\n };\n\n useIntersectionObserver(ref, handleIntersectChange, { threshold, ...options });\n\n return isVisible;\n};\n"],"names":["useIsVisible","ref","threshold","options","initial","isVisible","setIsVisible","useState","useIntersectionObserver","entries"],"mappings":"wGAYO,MAAMA,EAAe,CAC1BC,EACAC,EAAY,EACZC,EACAC,EAAU,KACE,CACZ,KAAM,CAACC,EAAWC,CAAY,EAAIC,EAASH,CAAO,EAMlD,OAAAI,EAAwBP,EAJ+CQ,GAAA,CACxDH,EAAAG,EAAQ,GAAG,mBAAqBP,CAAS,CAAA,EAGJ,CAAE,UAAAA,EAAW,GAAGC,EAAS,EAEtEE,CACT"}
1
+ {"version":3,"file":"useIsVisible.js","sources":["../../src/hooks/useIsVisible.ts"],"sourcesContent":["import { useState } from 'react';\nimport { useIntersectionObserver } from './useIntersectionObserver';\n\n/**\n * Sjekk om et HTML-element er synlig i vinduet, eller ikke.\n *\n * @param ref Element som skal observeres\n * @param threshold Hvor synlig må elementet være? Default = 1 (helt synlig)\n * @param options Objekt med options for IntersectionObserver, f.eks. threshold for å bestemme når callbacken skal fyres\n * @param initial Om elementet default skal antas å være synlig eller ikke. Default: ikke synlig\n * @returns true hvis objektet er synlig lik threshold eller mer, false hvis ikke\n */\nexport const useIsVisible = (\n ref: React.RefObject<Element>,\n threshold = 1,\n options?: IntersectionObserverInit,\n initial = false\n): boolean => {\n const [isVisible, setIsVisible] = useState(initial);\n\n const handleIntersectChange: IntersectionObserverCallback = entries => {\n setIsVisible(threshold === 0 ? entries[0].intersectionRatio !== threshold : entries[0].intersectionRatio >= threshold);\n };\n\n useIntersectionObserver(ref, handleIntersectChange, { threshold, ...options });\n\n return isVisible;\n};\n"],"names":["useIsVisible","ref","threshold","options","initial","isVisible","setIsVisible","useState","useIntersectionObserver","entries"],"mappings":"wGAYO,MAAMA,EAAe,CAC1BC,EACAC,EAAY,EACZC,EACAC,EAAU,KACE,CACZ,KAAM,CAACC,EAAWC,CAAY,EAAIC,EAASH,CAAO,EAMlD,OAAAI,EAAwBP,EAJ+CQ,GAAA,CACxDH,EAAAJ,IAAc,EAAIO,EAAQ,GAAG,oBAAsBP,EAAYO,EAAQ,GAAG,mBAAqBP,CAAS,CAAA,EAGnE,CAAE,UAAAA,EAAW,GAAGC,EAAS,EAEtEE,CACT"}
@@ -1,2 +1,2 @@
1
- import{useEffect as c}from"react";import{d as i}from"../debounce.js";const u=(n,t=["layoutchange","resize","orientationchange"],r=10)=>{c(()=>{if(typeof window!="object")return;const[e,a]=i(n,r);return t.forEach(o=>window.addEventListener(o,e)),e(),()=>{a(),t.forEach(o=>window.removeEventListener(o,e))}},[])};export{u as useLayoutEvent};
1
+ import{useEffect as c}from"react";import{debounce as i}from"../utils/debounce.js";const u=(n,t=["layoutchange","resize","orientationchange"],r=10)=>{c(()=>{if(typeof window!="object")return;const[e,a]=i(n,r);return t.forEach(o=>window.addEventListener(o,e)),e(),()=>{a(),t.forEach(o=>window.removeEventListener(o,e))}},[])};export{u as useLayoutEvent};
2
2
  //# sourceMappingURL=useLayoutEvent.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useLayoutEvent.js","sources":["../../src/hooks/useLayoutEvent.ts"],"sourcesContent":["import { useEffect } from 'react';\n\nimport { debounce } from '../utils/debounce';\n\n/**\n * Lytt på ulike layout-events som har betydning for rendring og størrelse på elementer.\n *\n * @param callback Kalles for hver event\n * @param events Liste med events som skal lyttes på\n * @param debounceMs Begrens kall til callback til x antall ms\n */\nexport const useLayoutEvent = (callback: () => void, events = ['layoutchange', 'resize', 'orientationchange'], debounceMs = 10) => {\n useEffect(() => {\n if (typeof window !== 'object') return;\n const [debouncedCallback, teardown] = debounce(callback, debounceMs);\n\n events.forEach(eventName => window.addEventListener(eventName, debouncedCallback));\n\n debouncedCallback();\n\n return () => {\n teardown();\n events.forEach(eventName => window.removeEventListener(eventName, debouncedCallback));\n };\n }, []);\n};\n"],"names":["useLayoutEvent","callback","events","debounceMs","useEffect","debouncedCallback","teardown","debounce","eventName"],"mappings":"qEAWa,MAAAA,EAAiB,CAACC,EAAsBC,EAAS,CAAC,eAAgB,SAAU,mBAAmB,EAAGC,EAAa,KAAO,CACjIC,EAAU,IAAM,CACd,GAAI,OAAO,QAAW,SAAU,OAChC,KAAM,CAACC,EAAmBC,CAAQ,EAAIC,EAASN,EAAUE,CAAU,EAEnE,OAAAD,EAAO,QAAqBM,GAAA,OAAO,iBAAiBA,EAAWH,CAAiB,CAAC,EAE/DA,IAEX,IAAM,CACFC,IACTJ,EAAO,QAAqBM,GAAA,OAAO,oBAAoBA,EAAWH,CAAiB,CAAC,CAAA,CAExF,EAAG,CAAE,CAAA,CACP"}
1
+ {"version":3,"file":"useLayoutEvent.js","sources":["../../src/hooks/useLayoutEvent.ts"],"sourcesContent":["import { useEffect } from 'react';\n\nimport { debounce } from '../utils/debounce';\n\n/**\n * Lytt på ulike layout-events som har betydning for rendring og størrelse på elementer.\n *\n * @param callback Kalles for hver event\n * @param events Liste med events som skal lyttes på\n * @param debounceMs Begrens kall til callback til x antall ms\n */\nexport const useLayoutEvent = (callback: () => void, events = ['layoutchange', 'resize', 'orientationchange'], debounceMs = 10) => {\n useEffect(() => {\n if (typeof window !== 'object') return;\n const [debouncedCallback, teardown] = debounce(callback, debounceMs);\n\n events.forEach(eventName => window.addEventListener(eventName, debouncedCallback));\n\n debouncedCallback();\n\n return () => {\n teardown();\n events.forEach(eventName => window.removeEventListener(eventName, debouncedCallback));\n };\n }, []);\n};\n"],"names":["useLayoutEvent","callback","events","debounceMs","useEffect","debouncedCallback","teardown","debounce","eventName"],"mappings":"kFAWa,MAAAA,EAAiB,CAACC,EAAsBC,EAAS,CAAC,eAAgB,SAAU,mBAAmB,EAAGC,EAAa,KAAO,CACjIC,EAAU,IAAM,CACd,GAAI,OAAO,QAAW,SAAU,OAChC,KAAM,CAACC,EAAmBC,CAAQ,EAAIC,EAASN,EAAUE,CAAU,EAEnE,OAAAD,EAAO,QAAqBM,GAAA,OAAO,iBAAiBA,EAAWH,CAAiB,CAAC,EAE/DA,IAEX,IAAM,CACFC,IACTJ,EAAO,QAAqBM,GAAA,OAAO,oBAAoBA,EAAWH,CAAiB,CAAC,CAAA,CAExF,EAAG,CAAE,CAAA,CACP"}
@@ -2,7 +2,8 @@
2
2
  * Lytt på endringer i størrelse på et element
3
3
  *
4
4
  * @param ref Element som skal observeres.
5
- * @returns Object med høyde, bredde, x og y til elementet
5
+ * @returns Object med høyde, bredde, x og y til elementet. Merk at objektet bare oppdates når høyde eller bredde endres, ikke når
6
+ * posisjonen (x og y) endres.
6
7
  */
7
8
  export declare const useSize: (ref?: React.RefObject<HTMLElement>) => DOMRect | undefined;
8
9
  //# sourceMappingURL=useSize.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useSize.d.ts","sourceRoot":"","sources":["../../src/hooks/useSize.ts"],"names":[],"mappings":"AAGA;;;;;GAKG;AACH,eAAO,MAAM,OAAO,SAAU,MAAM,SAAS,CAAC,WAAW,CAAC,wBAwCzD,CAAC"}
1
+ {"version":3,"file":"useSize.d.ts","sourceRoot":"","sources":["../../src/hooks/useSize.ts"],"names":[],"mappings":"AAGA;;;;;;GAMG;AACH,eAAO,MAAM,OAAO,SAAU,MAAM,SAAS,CAAC,WAAW,CAAC,wBAwCzD,CAAC"}
package/hooks/useSize.js CHANGED
@@ -1,2 +1,2 @@
1
- import{useState as r,useEffect as d}from"react";import{d as a}from"../debounce.js";const w=e=>{const[i,c]=r();return d(()=>{if(typeof ResizeObserver<"u"){const n=new ResizeObserver(t=>{c(t[0].target.getBoundingClientRect())});return e!=null&&e.current&&n.observe(e==null?void 0:e.current),()=>{e!=null&&e.current?n.unobserve(e.current):n.disconnect()}}else if(typeof window=="object"){const n=()=>{e!=null&&e.current&&c(e.current.getBoundingClientRect())},t=["layoutchange","resize","orientationchange"],[o,u]=a(n,10);return t.forEach(s=>window.addEventListener(s,o)),o(),()=>{u(),t.forEach(s=>window.removeEventListener(s,o))}}},[e]),i};export{w as useSize};
1
+ import{useState as d,useEffect as r}from"react";import{debounce as a}from"../utils/debounce.js";const w=e=>{const[i,s]=d();return r(()=>{if(typeof ResizeObserver<"u"){const n=new ResizeObserver(t=>{s(t[0].target.getBoundingClientRect())});return e!=null&&e.current&&n.observe(e==null?void 0:e.current),()=>{e!=null&&e.current?n.unobserve(e.current):n.disconnect()}}else if(typeof window=="object"){const n=()=>{e!=null&&e.current&&s(e.current.getBoundingClientRect())},t=["layoutchange","resize","orientationchange"],[o,u]=a(n,10);return t.forEach(c=>window.addEventListener(c,o)),o(),()=>{u(),t.forEach(c=>window.removeEventListener(c,o))}}},[e==null?void 0:e.current]),i};export{w as useSize};
2
2
  //# sourceMappingURL=useSize.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useSize.js","sources":["../../src/hooks/useSize.ts"],"sourcesContent":["import { useEffect, useState } from 'react';\nimport { debounce } from '../utils/debounce';\n\n/**\n * Lytt på endringer i størrelse på et element\n *\n * @param ref Element som skal observeres.\n * @returns Object med høyde, bredde, x og y til elementet\n */\nexport const useSize = (ref?: React.RefObject<HTMLElement>) => {\n const [size, setSize] = useState<DOMRect>();\n useEffect(() => {\n if (typeof ResizeObserver !== 'undefined') {\n const resizeObserver = new ResizeObserver(entries => {\n setSize(entries[0].target.getBoundingClientRect());\n });\n if (ref?.current) {\n resizeObserver.observe(ref?.current);\n }\n return (): void => {\n if (ref?.current) {\n resizeObserver.unobserve(ref.current);\n } else {\n resizeObserver.disconnect();\n }\n };\n } else if (typeof window === 'object') {\n // For nettlesere som ikke støtter ResizeObserver (iOS 13 og lavere)\n const handleLayoutEvent = () => {\n ref?.current && setSize(ref.current.getBoundingClientRect());\n };\n\n const events = ['layoutchange', 'resize', 'orientationchange'];\n const debounceMs = 10;\n\n const [debouncedCallback, teardown] = debounce(handleLayoutEvent, debounceMs);\n\n events.forEach(eventName => window.addEventListener(eventName, debouncedCallback));\n\n debouncedCallback();\n\n return () => {\n teardown();\n events.forEach(eventName => window.removeEventListener(eventName, debouncedCallback));\n };\n }\n }, [ref]);\n\n return size;\n};\n"],"names":["useSize","ref","size","setSize","useState","useEffect","resizeObserver","entries","handleLayoutEvent","events","debouncedCallback","teardown","debounce","eventName"],"mappings":"mFASa,MAAAA,EAAWC,GAAuC,CAC7D,KAAM,CAACC,EAAMC,CAAO,EAAIC,EAAkB,EAC1C,OAAAC,EAAU,IAAM,CACV,GAAA,OAAO,eAAmB,IAAa,CACnC,MAAAC,EAAiB,IAAI,eAA0BC,GAAA,CACnDJ,EAAQI,EAAQ,GAAG,OAAO,sBAAuB,CAAA,CAAA,CAClD,EACD,OAAIN,GAAA,MAAAA,EAAK,SACQK,EAAA,QAAQL,GAAA,YAAAA,EAAK,OAAO,EAE9B,IAAY,CACbA,GAAA,MAAAA,EAAK,QACQK,EAAA,UAAUL,EAAI,OAAO,EAEpCK,EAAe,WAAW,CAC5B,CACF,SACS,OAAO,QAAW,SAAU,CAErC,MAAME,EAAoB,IAAM,CAC9BP,GAAA,MAAAA,EAAK,SAAWE,EAAQF,EAAI,QAAQ,uBAAuB,CAAA,EAGvDQ,EAAS,CAAC,eAAgB,SAAU,mBAAmB,EAGvD,CAACC,EAAmBC,CAAQ,EAAIC,EAASJ,EAAmB,EAAU,EAE5E,OAAAC,EAAO,QAAqBI,GAAA,OAAO,iBAAiBA,EAAWH,CAAiB,CAAC,EAE/DA,IAEX,IAAM,CACFC,IACTF,EAAO,QAAqBI,GAAA,OAAO,oBAAoBA,EAAWH,CAAiB,CAAC,CAAA,CAExF,CAAA,EACC,CAACT,CAAG,CAAC,EAEDC,CACT"}
1
+ {"version":3,"file":"useSize.js","sources":["../../src/hooks/useSize.ts"],"sourcesContent":["import { useEffect, useState } from 'react';\nimport { debounce } from '../utils/debounce';\n\n/**\n * Lytt på endringer i størrelse på et element\n *\n * @param ref Element som skal observeres.\n * @returns Object med høyde, bredde, x og y til elementet. Merk at objektet bare oppdates når høyde eller bredde endres, ikke når\n * posisjonen (x og y) endres.\n */\nexport const useSize = (ref?: React.RefObject<HTMLElement>) => {\n const [size, setSize] = useState<DOMRect>();\n useEffect(() => {\n if (typeof ResizeObserver !== 'undefined') {\n const resizeObserver = new ResizeObserver(entries => {\n setSize(entries[0].target.getBoundingClientRect());\n });\n if (ref?.current) {\n resizeObserver.observe(ref?.current);\n }\n return (): void => {\n if (ref?.current) {\n resizeObserver.unobserve(ref.current);\n } else {\n resizeObserver.disconnect();\n }\n };\n } else if (typeof window === 'object') {\n // For nettlesere som ikke støtter ResizeObserver (iOS 13 og lavere)\n const handleLayoutEvent = () => {\n ref?.current && setSize(ref.current.getBoundingClientRect());\n };\n\n const events = ['layoutchange', 'resize', 'orientationchange'];\n const debounceMs = 10;\n\n const [debouncedCallback, teardown] = debounce(handleLayoutEvent, debounceMs);\n\n events.forEach(eventName => window.addEventListener(eventName, debouncedCallback));\n\n debouncedCallback();\n\n return () => {\n teardown();\n events.forEach(eventName => window.removeEventListener(eventName, debouncedCallback));\n };\n }\n }, [ref?.current]);\n\n return size;\n};\n"],"names":["useSize","ref","size","setSize","useState","useEffect","resizeObserver","entries","handleLayoutEvent","events","debouncedCallback","teardown","debounce","eventName"],"mappings":"gGAUa,MAAAA,EAAWC,GAAuC,CAC7D,KAAM,CAACC,EAAMC,CAAO,EAAIC,EAAkB,EAC1C,OAAAC,EAAU,IAAM,CACV,GAAA,OAAO,eAAmB,IAAa,CACnC,MAAAC,EAAiB,IAAI,eAA0BC,GAAA,CACnDJ,EAAQI,EAAQ,GAAG,OAAO,sBAAuB,CAAA,CAAA,CAClD,EACD,OAAIN,GAAA,MAAAA,EAAK,SACQK,EAAA,QAAQL,GAAA,YAAAA,EAAK,OAAO,EAE9B,IAAY,CACbA,GAAA,MAAAA,EAAK,QACQK,EAAA,UAAUL,EAAI,OAAO,EAEpCK,EAAe,WAAW,CAC5B,CACF,SACS,OAAO,QAAW,SAAU,CAErC,MAAME,EAAoB,IAAM,CAC9BP,GAAA,MAAAA,EAAK,SAAWE,EAAQF,EAAI,QAAQ,uBAAuB,CAAA,EAGvDQ,EAAS,CAAC,eAAgB,SAAU,mBAAmB,EAGvD,CAACC,EAAmBC,CAAQ,EAAIC,EAASJ,EAAmB,EAAU,EAE5E,OAAAC,EAAO,QAAqBI,GAAA,OAAO,iBAAiBA,EAAWH,CAAiB,CAAC,EAE/DA,IAEX,IAAM,CACFC,IACTF,EAAO,QAAqBI,GAAA,OAAO,oBAAoBA,EAAWH,CAAiB,CAAC,CAAA,CAExF,CAAA,EACC,CAACT,GAAA,YAAAA,EAAK,OAAO,CAAC,EAEVC,CACT"}
@@ -1,2 +1,2 @@
1
- import{useState as t}from"react";import{useLayoutEvent as p}from"./useLayoutEvent.js";import"../debounce.js";const L=(s,c)=>{const[d,h]=t(!1),[r,u]=t(!1),[a,f]=t(),[g,l]=t();return p(()=>{var n,o,i;const{top:m=0,width:C=0,bottom:O=0}=((n=s.current)==null?void 0:n.getBoundingClientRect())||{},e=(i=(o=c.current)==null?void 0:o.getBoundingClientRect().height)!=null?i:0;h(m<=0),u(O<=e),l(C),f(e)},["resize","scroll"]),{isOutsideWindow:d,isLeavingWindow:r,offsetHeight:a,contentWidth:g}};export{L as useSticky};
1
+ import{useState as t}from"react";import{useLayoutEvent as p}from"./useLayoutEvent.js";import"../utils/debounce.js";const L=(s,c)=>{const[d,h]=t(!1),[r,u]=t(!1),[a,f]=t(),[g,l]=t();return p(()=>{var n,o,i;const{top:m=0,width:C=0,bottom:O=0}=((n=s.current)==null?void 0:n.getBoundingClientRect())||{},e=(i=(o=c.current)==null?void 0:o.getBoundingClientRect().height)!=null?i:0;h(m<=0),u(O<=e),l(C),f(e)},["resize","scroll"]),{isOutsideWindow:d,isLeavingWindow:r,offsetHeight:a,contentWidth:g}};export{L as useSticky};
2
2
  //# sourceMappingURL=useSticky.js.map