@navikt/ds-react 5.5.0 → 5.6.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 (342) hide show
  1. package/_docs.json +507 -106
  2. package/cjs/accordion/Accordion.js +1 -0
  3. package/cjs/accordion/AccordionContext.js +1 -1
  4. package/cjs/accordion/AccordionHeader.js +2 -2
  5. package/cjs/accordion/AccordionItem.js +6 -2
  6. package/cjs/date/datepicker/DatePicker.js +30 -34
  7. package/cjs/date/datepicker/DatePickerStandalone.js +23 -26
  8. package/cjs/date/datepicker/parts/Caption.js +28 -0
  9. package/cjs/date/datepicker/{DayButton.js → parts/DayButton.js} +1 -2
  10. package/cjs/date/datepicker/{caption → parts}/DropdownCaption.js +13 -7
  11. package/cjs/date/datepicker/parts/HeadRow.js +36 -0
  12. package/cjs/date/datepicker/parts/Row.js +23 -0
  13. package/cjs/date/datepicker/{TableHead.js → parts/TableHead.js} +4 -3
  14. package/cjs/date/datepicker/parts/WeekNumber.js +35 -0
  15. package/cjs/date/datepicker/parts/WeekRow.js +34 -0
  16. package/cjs/date/hooks/useDatepicker.js +2 -2
  17. package/cjs/date/hooks/useMonthPicker.js +2 -2
  18. package/cjs/date/hooks/useRangeDatepicker.js +3 -3
  19. package/cjs/date/monthpicker/MonthSelector.js +1 -1
  20. package/cjs/date/utils/get-month-weeks.js +46 -0
  21. package/cjs/date/utils/labels.js +40 -1
  22. package/cjs/dropdown/Toggle.js +2 -2
  23. package/cjs/dropdown/index.js +0 -15
  24. package/cjs/form/Select.js +1 -1
  25. package/cjs/form/checkbox/useCheckbox.js +3 -4
  26. package/cjs/form/combobox/Combobox.js +1 -1
  27. package/cjs/form/combobox/Input/Input.js +1 -1
  28. package/cjs/form/search/Search.js +3 -1
  29. package/cjs/index.js +1 -0
  30. package/cjs/layout/bleed/Bleed.js +69 -0
  31. package/cjs/layout/bleed/index.js +5 -0
  32. package/cjs/layout/bleed/package.json +6 -0
  33. package/cjs/layout/box/Box.js +1 -1
  34. package/cjs/layout/responsive/Responsive.js +8 -6
  35. package/cjs/layout/sidemal-test/AvatarPanel.js +18 -0
  36. package/cjs/layout/sidemal-test/Content.js +66 -0
  37. package/cjs/layout/sidemal-test/Filter.js +48 -0
  38. package/cjs/layout/sidemal-test/Header.js +48 -0
  39. package/cjs/layout/sidemal-test/Intro.js +36 -0
  40. package/cjs/layout/sidemal-test/Sidebar.js +49 -0
  41. package/cjs/layout/sidemal-test/content-box/ContentBox.js +65 -0
  42. package/cjs/layout/sidemal-test/content-box/index.js +8 -0
  43. package/cjs/layout/sidemal-test/content-box/package.json +6 -0
  44. package/cjs/layout/stack/Stack.js +2 -2
  45. package/cjs/layout/stack/index.js +3 -1
  46. package/cjs/layout/utilities/css.js +37 -14
  47. package/cjs/loader/Loader.js +2 -2
  48. package/cjs/modal/dialog-polyfill.js +2 -0
  49. package/cjs/popover/Popover.js +3 -2
  50. package/cjs/tabs/TabList.js +6 -7
  51. package/cjs/timeline/Pin.js +20 -20
  52. package/cjs/timeline/Timeline.js +4 -4
  53. package/cjs/timeline/period/ClickablePeriod.js +19 -19
  54. package/cjs/timeline/period/index.js +1 -1
  55. package/cjs/timeline/utils/timeline.js +3 -3
  56. package/cjs/toggle-group/ToggleGroup.js +1 -1
  57. package/cjs/tooltip/Tooltip.js +1 -1
  58. package/cjs/typography/Heading.js +1 -1
  59. package/cjs/util/RandomIcon.js +1 -0
  60. package/cjs/util/Slot.js +88 -0
  61. package/cjs/util/useId.js +2 -4
  62. package/esm/accordion/Accordion.js +1 -0
  63. package/esm/accordion/Accordion.js.map +1 -1
  64. package/esm/accordion/AccordionContext.d.ts +1 -0
  65. package/esm/accordion/AccordionContext.js +1 -1
  66. package/esm/accordion/AccordionContext.js.map +1 -1
  67. package/esm/accordion/AccordionHeader.js +2 -2
  68. package/esm/accordion/AccordionHeader.js.map +1 -1
  69. package/esm/accordion/AccordionItem.js +6 -2
  70. package/esm/accordion/AccordionItem.js.map +1 -1
  71. package/esm/date/datepicker/DatePicker.d.ts +14 -5
  72. package/esm/date/datepicker/DatePicker.js +29 -33
  73. package/esm/date/datepicker/DatePicker.js.map +1 -1
  74. package/esm/date/datepicker/DatePickerStandalone.d.ts +3 -2
  75. package/esm/date/datepicker/DatePickerStandalone.js +22 -25
  76. package/esm/date/datepicker/DatePickerStandalone.js.map +1 -1
  77. package/esm/date/datepicker/{caption → parts}/Caption.d.ts +3 -0
  78. package/esm/date/datepicker/parts/Caption.js +22 -0
  79. package/esm/date/datepicker/parts/Caption.js.map +1 -0
  80. package/esm/date/datepicker/parts/DayButton.d.ts +4 -0
  81. package/esm/date/datepicker/{DayButton.js → parts/DayButton.js} +2 -1
  82. package/esm/date/datepicker/parts/DayButton.js.map +1 -0
  83. package/esm/date/datepicker/{caption → parts}/DropdownCaption.d.ts +3 -0
  84. package/esm/date/datepicker/parts/DropdownCaption.js +44 -0
  85. package/esm/date/datepicker/parts/DropdownCaption.js.map +1 -0
  86. package/esm/date/datepicker/parts/HeadRow.d.ts +11 -0
  87. package/esm/date/datepicker/parts/HeadRow.js +29 -0
  88. package/esm/date/datepicker/parts/HeadRow.js.map +1 -0
  89. package/esm/date/datepicker/parts/Row.d.ts +17 -0
  90. package/esm/date/datepicker/parts/Row.js +19 -0
  91. package/esm/date/datepicker/parts/Row.js.map +1 -0
  92. package/esm/date/datepicker/parts/TableHead.d.ts +6 -0
  93. package/esm/date/datepicker/{TableHead.js → parts/TableHead.js} +5 -2
  94. package/esm/date/datepicker/parts/TableHead.js.map +1 -0
  95. package/esm/date/datepicker/parts/WeekNumber.d.ts +13 -0
  96. package/esm/date/datepicker/parts/WeekNumber.js +31 -0
  97. package/esm/date/datepicker/parts/WeekNumber.js.map +1 -0
  98. package/esm/date/datepicker/parts/WeekRow.d.ts +5 -0
  99. package/esm/date/datepicker/parts/WeekRow.js +30 -0
  100. package/esm/date/datepicker/parts/WeekRow.js.map +1 -0
  101. package/esm/date/hooks/useDatepicker.js +2 -2
  102. package/esm/date/hooks/useDatepicker.js.map +1 -1
  103. package/esm/date/hooks/useMonthPicker.js +2 -2
  104. package/esm/date/hooks/useMonthPicker.js.map +1 -1
  105. package/esm/date/hooks/useRangeDatepicker.js +3 -3
  106. package/esm/date/hooks/useRangeDatepicker.js.map +1 -1
  107. package/esm/date/monthpicker/MonthButton.d.ts +2 -2
  108. package/esm/date/monthpicker/MonthPicker.d.ts +1 -1
  109. package/esm/date/monthpicker/MonthSelector.js +1 -1
  110. package/esm/date/monthpicker/MonthSelector.js.map +1 -1
  111. package/esm/date/utils/get-month-weeks.d.ts +16 -0
  112. package/esm/date/utils/get-month-weeks.js +42 -0
  113. package/esm/date/utils/get-month-weeks.js.map +1 -0
  114. package/esm/date/utils/labels.d.ts +9 -0
  115. package/esm/date/utils/labels.js +36 -0
  116. package/esm/date/utils/labels.js.map +1 -1
  117. package/esm/date/utils/navigation.d.ts +1 -1
  118. package/esm/date/utils/navigation.js.map +1 -1
  119. package/esm/dropdown/Toggle.js +1 -1
  120. package/esm/dropdown/Toggle.js.map +1 -1
  121. package/esm/dropdown/index.d.ts +1 -2
  122. package/esm/dropdown/index.js +0 -1
  123. package/esm/dropdown/index.js.map +1 -1
  124. package/esm/form/Select.js +1 -1
  125. package/esm/form/Select.js.map +1 -1
  126. package/esm/form/checkbox/useCheckbox.d.ts +1 -1
  127. package/esm/form/checkbox/useCheckbox.js +3 -4
  128. package/esm/form/checkbox/useCheckbox.js.map +1 -1
  129. package/esm/form/combobox/Combobox.d.ts +1 -1
  130. package/esm/form/combobox/Combobox.js +1 -1
  131. package/esm/form/combobox/Combobox.js.map +1 -1
  132. package/esm/form/combobox/Input/Input.d.ts +0 -2
  133. package/esm/form/combobox/Input/Input.js +1 -1
  134. package/esm/form/combobox/Input/Input.js.map +1 -1
  135. package/esm/form/search/Search.js +3 -1
  136. package/esm/form/search/Search.js.map +1 -1
  137. package/esm/index.d.ts +1 -0
  138. package/esm/index.js +1 -0
  139. package/esm/index.js.map +1 -1
  140. package/esm/layout/bleed/Bleed.d.ts +47 -0
  141. package/esm/layout/bleed/Bleed.js +41 -0
  142. package/esm/layout/bleed/Bleed.js.map +1 -0
  143. package/esm/layout/bleed/index.d.ts +1 -0
  144. package/esm/layout/bleed/index.js +2 -0
  145. package/esm/layout/bleed/index.js.map +1 -0
  146. package/esm/layout/box/Box.d.ts +1 -2
  147. package/esm/layout/box/Box.js +1 -1
  148. package/esm/layout/box/Box.js.map +1 -1
  149. package/esm/layout/responsive/Responsive.d.ts +8 -4
  150. package/esm/layout/responsive/Responsive.js +8 -6
  151. package/esm/layout/responsive/Responsive.js.map +1 -1
  152. package/esm/layout/sidemal-test/AvatarPanel.d.ts +4 -0
  153. package/esm/layout/sidemal-test/AvatarPanel.js +12 -0
  154. package/esm/layout/sidemal-test/AvatarPanel.js.map +1 -0
  155. package/esm/layout/sidemal-test/Content.d.ts +2 -0
  156. package/esm/layout/sidemal-test/Content.js +60 -0
  157. package/esm/layout/sidemal-test/Content.js.map +1 -0
  158. package/esm/layout/sidemal-test/Filter.d.ts +2 -0
  159. package/esm/layout/sidemal-test/Filter.js +22 -0
  160. package/esm/layout/sidemal-test/Filter.js.map +1 -0
  161. package/esm/layout/sidemal-test/Header.d.ts +2 -0
  162. package/esm/layout/sidemal-test/Header.js +42 -0
  163. package/esm/layout/sidemal-test/Header.js.map +1 -0
  164. package/esm/layout/sidemal-test/Intro.d.ts +2 -0
  165. package/esm/layout/sidemal-test/Intro.js +30 -0
  166. package/esm/layout/sidemal-test/Intro.js.map +1 -0
  167. package/esm/layout/sidemal-test/Sidebar.d.ts +4 -0
  168. package/esm/layout/sidemal-test/Sidebar.js +41 -0
  169. package/esm/layout/sidemal-test/Sidebar.js.map +1 -0
  170. package/esm/layout/sidemal-test/content-box/ContentBox.d.ts +8 -0
  171. package/esm/layout/sidemal-test/content-box/ContentBox.js +37 -0
  172. package/esm/layout/sidemal-test/content-box/ContentBox.js.map +1 -0
  173. package/esm/layout/sidemal-test/content-box/index.d.ts +1 -0
  174. package/esm/layout/sidemal-test/content-box/index.js +2 -0
  175. package/esm/layout/sidemal-test/content-box/index.js.map +1 -0
  176. package/esm/layout/stack/Stack.d.ts +7 -3
  177. package/esm/layout/stack/Stack.js +3 -3
  178. package/esm/layout/stack/Stack.js.map +1 -1
  179. package/esm/layout/stack/index.d.ts +1 -0
  180. package/esm/layout/stack/index.js +1 -0
  181. package/esm/layout/stack/index.js.map +1 -1
  182. package/esm/layout/utilities/css.d.ts +1 -1
  183. package/esm/layout/utilities/css.js +37 -14
  184. package/esm/layout/utilities/css.js.map +1 -1
  185. package/esm/loader/Loader.js +3 -3
  186. package/esm/loader/Loader.js.map +1 -1
  187. package/esm/modal/dialog-polyfill.js +2 -0
  188. package/esm/modal/dialog-polyfill.js.map +1 -1
  189. package/esm/popover/Popover.js +3 -2
  190. package/esm/popover/Popover.js.map +1 -1
  191. package/esm/tabs/TabList.js +6 -7
  192. package/esm/tabs/TabList.js.map +1 -1
  193. package/esm/timeline/Pin.js +21 -21
  194. package/esm/timeline/Pin.js.map +1 -1
  195. package/esm/timeline/Timeline.js +4 -4
  196. package/esm/timeline/Timeline.js.map +1 -1
  197. package/esm/timeline/TimelineRow.js.map +1 -1
  198. package/esm/timeline/hooks/usePeriodContext.d.ts +1 -1
  199. package/esm/timeline/period/ClickablePeriod.js +20 -20
  200. package/esm/timeline/period/ClickablePeriod.js.map +1 -1
  201. package/esm/timeline/period/index.d.ts +2 -2
  202. package/esm/timeline/period/index.js +1 -1
  203. package/esm/timeline/period/index.js.map +1 -1
  204. package/esm/timeline/utils/timeline.js +3 -3
  205. package/esm/timeline/utils/timeline.js.map +1 -1
  206. package/esm/toggle-group/ToggleGroup.js +1 -1
  207. package/esm/toggle-group/ToggleGroup.js.map +1 -1
  208. package/esm/tooltip/Tooltip.js +1 -1
  209. package/esm/tooltip/Tooltip.js.map +1 -1
  210. package/esm/typography/Heading.js +1 -1
  211. package/esm/typography/Heading.js.map +1 -1
  212. package/esm/util/RandomIcon.js +1 -0
  213. package/esm/util/RandomIcon.js.map +1 -1
  214. package/esm/util/Slot.d.ts +6 -0
  215. package/esm/util/Slot.js +60 -0
  216. package/esm/util/Slot.js.map +1 -0
  217. package/esm/util/mergeRefs.d.ts +1 -1
  218. package/esm/util/useId.js +2 -4
  219. package/esm/util/useId.js.map +1 -1
  220. package/package.json +4 -4
  221. package/src/accordion/Accordion.tsx +1 -0
  222. package/src/accordion/AccordionContext.tsx +2 -1
  223. package/src/accordion/AccordionHeader.tsx +2 -2
  224. package/src/accordion/AccordionItem.tsx +7 -5
  225. package/src/accordion/accordion.stories.tsx +21 -34
  226. package/src/alert/alert.stories.tsx +2 -2
  227. package/src/chips/chips.stories.tsx +29 -32
  228. package/src/date/datepicker/DatePicker.tsx +63 -58
  229. package/src/date/datepicker/DatePickerStandalone.tsx +36 -39
  230. package/src/date/datepicker/datepicker.stories.tsx +67 -2
  231. package/src/date/datepicker/datepicker.test.tsx +5 -4
  232. package/src/date/datepicker/{caption → parts}/Caption.tsx +19 -17
  233. package/src/date/datepicker/{DayButton.tsx → parts/DayButton.tsx} +3 -1
  234. package/src/date/datepicker/parts/DropdownCaption.tsx +113 -0
  235. package/src/date/datepicker/parts/HeadRow.tsx +56 -0
  236. package/src/date/datepicker/parts/Row.tsx +47 -0
  237. package/src/date/datepicker/{TableHead.tsx → parts/TableHead.tsx} +6 -2
  238. package/src/date/datepicker/parts/WeekNumber.tsx +79 -0
  239. package/src/date/datepicker/parts/WeekRow.tsx +60 -0
  240. package/src/date/hooks/useDatepicker.tsx +2 -2
  241. package/src/date/hooks/useMonthPicker.tsx +2 -2
  242. package/src/date/hooks/useRangeDatepicker.test.tsx +11 -11
  243. package/src/date/hooks/useRangeDatepicker.tsx +3 -3
  244. package/src/date/monthpicker/MonthButton.tsx +2 -2
  245. package/src/date/monthpicker/MonthPicker.tsx +1 -1
  246. package/src/date/monthpicker/MonthSelector.tsx +3 -3
  247. package/src/date/monthpicker/monthpicker.stories.tsx +1 -1
  248. package/src/date/utils/__tests__/get-initial-year.test.ts +0 -12
  249. package/src/date/utils/__tests__/get-month-weeks.test.ts +113 -0
  250. package/src/date/utils/__tests__/is-match.test.ts +3 -3
  251. package/src/date/utils/__tests__/parse-dates.test.ts +4 -2
  252. package/src/date/utils/get-month-weeks.ts +93 -0
  253. package/src/date/utils/labels.ts +51 -0
  254. package/src/date/utils/navigation.ts +3 -3
  255. package/src/dropdown/Toggle.tsx +1 -1
  256. package/src/dropdown/dropdown.stories.tsx +25 -28
  257. package/src/dropdown/index.ts +1 -2
  258. package/src/expansion-card/expansion-card.stories.tsx +143 -161
  259. package/src/form/ConfirmationPanel.test.tsx +5 -5
  260. package/src/form/Select.tsx +1 -1
  261. package/src/form/checkbox/Checkbox.test.tsx +14 -26
  262. package/src/form/checkbox/checkbox.stories.tsx +66 -71
  263. package/src/form/checkbox/useCheckbox.ts +3 -4
  264. package/src/form/combobox/Combobox.tsx +2 -3
  265. package/src/form/combobox/Input/Input.tsx +1 -3
  266. package/src/form/combobox/combobox.stories.tsx +20 -23
  267. package/src/form/combobox/combobox.test.tsx +22 -20
  268. package/src/form/radio/radio.stories.tsx +39 -44
  269. package/src/form/search/Search.tsx +1 -0
  270. package/src/form/search/search.stories.tsx +22 -26
  271. package/src/form/stories/fieldset.stories.tsx +1 -1
  272. package/src/index.ts +1 -0
  273. package/src/layout/bleed/Bleed.stories.tsx +381 -0
  274. package/src/layout/bleed/Bleed.tsx +130 -0
  275. package/src/layout/bleed/index.ts +1 -0
  276. package/src/layout/box/Box.stories.tsx +251 -256
  277. package/src/layout/box/Box.tsx +2 -1
  278. package/src/layout/responsive/Responsive.tsx +21 -6
  279. package/src/layout/responsive/hide.stories.tsx +35 -0
  280. package/src/layout/responsive/show.stories.tsx +35 -0
  281. package/src/layout/sidemal-test/AvatarPanel.tsx +27 -0
  282. package/src/layout/sidemal-test/Content.tsx +129 -0
  283. package/src/layout/sidemal-test/Filter.tsx +46 -0
  284. package/src/layout/sidemal-test/Header.tsx +96 -0
  285. package/src/layout/sidemal-test/Intro.tsx +91 -0
  286. package/src/layout/sidemal-test/Sidebar.tsx +77 -0
  287. package/src/layout/sidemal-test/content-box/ContentBox.tsx +46 -0
  288. package/src/layout/sidemal-test/content-box/index.ts +1 -0
  289. package/src/layout/sidemal-test/navno-sidemal.stories.mdx +29 -0
  290. package/src/layout/sidemal-test/navno-sidemal.stories.tsx +65 -0
  291. package/src/layout/sidemal-test/styling.css +43 -0
  292. package/src/layout/stack/Stack.tsx +14 -8
  293. package/src/layout/stack/index.ts +1 -0
  294. package/src/layout/stack/stack.stories.tsx +23 -1
  295. package/src/layout/utilities/css.ts +59 -20
  296. package/src/loader/Loader.tsx +2 -3
  297. package/src/modal/dialog-polyfill.ts +2 -0
  298. package/src/pagination/pagination.stories.tsx +35 -42
  299. package/src/popover/Popover.test.tsx +21 -35
  300. package/src/popover/Popover.tsx +2 -2
  301. package/src/popover/popover.stories.tsx +25 -41
  302. package/src/react-css.d.ts +0 -1
  303. package/src/read-more/readmore.stories.tsx +35 -36
  304. package/src/stepper/stepper.stories.tsx +45 -52
  305. package/src/table/stories/table-expandable.stories.tsx +59 -63
  306. package/src/tabs/TabList.tsx +4 -6
  307. package/src/tabs/Tabs.stories.tsx +3 -3
  308. package/src/tag/tag.stories.tsx +4 -4
  309. package/src/timeline/Pin.tsx +44 -39
  310. package/src/timeline/Timeline.tsx +6 -6
  311. package/src/timeline/TimelineRow.tsx +1 -0
  312. package/src/timeline/hooks/usePeriodContext.tsx +1 -1
  313. package/src/timeline/period/ClickablePeriod.tsx +42 -38
  314. package/src/timeline/period/index.tsx +5 -4
  315. package/src/timeline/timeline.stories.tsx +11 -10
  316. package/src/timeline/utils/timeline.ts +3 -3
  317. package/src/toggle-group/ToggleGroup.stories.tsx +25 -29
  318. package/src/toggle-group/ToggleGroup.tsx +0 -1
  319. package/src/tooltip/Tooltip.test.tsx +40 -54
  320. package/src/tooltip/Tooltip.tsx +1 -1
  321. package/src/typography/Heading.tsx +1 -1
  322. package/src/util/RandomIcon.tsx +1 -0
  323. package/src/util/Slot.tsx +69 -0
  324. package/src/util/__tests__/Slot.test.tsx +98 -0
  325. package/src/util/mergeRefs.tsx +1 -1
  326. package/src/util/useId.ts +1 -3
  327. package/cjs/date/datepicker/caption/Caption.js +0 -23
  328. package/cjs/date/datepicker/caption/index.js +0 -10
  329. package/cjs/date/datepicker/caption/package.json +0 -6
  330. package/esm/date/datepicker/DayButton.d.ts +0 -3
  331. package/esm/date/datepicker/DayButton.js.map +0 -1
  332. package/esm/date/datepicker/TableHead.d.ts +0 -3
  333. package/esm/date/datepicker/TableHead.js.map +0 -1
  334. package/esm/date/datepicker/caption/Caption.js +0 -17
  335. package/esm/date/datepicker/caption/Caption.js.map +0 -1
  336. package/esm/date/datepicker/caption/DropdownCaption.js +0 -38
  337. package/esm/date/datepicker/caption/DropdownCaption.js.map +0 -1
  338. package/esm/date/datepicker/caption/index.d.ts +0 -2
  339. package/esm/date/datepicker/caption/index.js +0 -3
  340. package/esm/date/datepicker/caption/index.js.map +0 -1
  341. package/src/date/datepicker/caption/DropdownCaption.tsx +0 -108
  342. package/src/date/datepicker/caption/index.ts +0 -2
@@ -1,4 +1,3 @@
1
- /* eslint-disable react-hooks/rules-of-hooks */
2
1
  import React, { useState } from "react";
3
2
  import { Popover } from "../index";
4
3
  import { Button } from "../button";
@@ -25,60 +24,45 @@ export default {
25
24
  },
26
25
  argTypes: {
27
26
  open: {
28
- control: {
29
- type: "boolean",
30
- },
27
+ control: { type: "boolean" },
31
28
  },
32
29
  arrow: {
33
- control: {
34
- type: "boolean",
35
- },
30
+ control: { type: "boolean" },
36
31
  },
37
32
  offset: {
38
- control: {
39
- type: "number",
40
- },
33
+ control: { type: "number" },
41
34
  },
42
35
  strategy: {
43
36
  defaultValue: "absolute",
44
- control: {
45
- type: "radio",
46
- options: ["fixed", "absolute"],
47
- },
37
+ options: ["fixed", "absolute"],
38
+ control: { type: "radio" },
48
39
  },
49
40
  placement: {
50
41
  defaultValue: "right",
51
- control: {
52
- type: "radio",
53
- options: placements,
54
- },
42
+ options: placements,
43
+ control: { type: "radio" },
55
44
  },
56
45
  },
57
46
  };
58
47
 
59
- export const Default = {
60
- render: (props: any) => {
61
- const [anchorEl, setAnchorEl] = useState<HTMLButtonElement | null>();
62
- const [open, setOpen] = useState<boolean>(false);
63
- return (
64
- <div>
65
- <Button
66
- ref={(el) => setAnchorEl(el)}
67
- onClick={() => setOpen((x) => !x)}
68
- >
69
- Open
70
- </Button>
71
- <Popover
72
- {...props}
73
- open={props.open ?? open}
74
- anchorEl={anchorEl}
75
- onClose={(e) => setOpen(e)}
76
- >
77
- <Popover.Content>Velit in consequat</Popover.Content>
78
- </Popover>
79
- </div>
80
- );
81
- },
48
+ export const Default = (props: any) => {
49
+ const [anchorEl, setAnchorEl] = useState<HTMLButtonElement | null>();
50
+ const [open, setOpen] = useState<boolean>(false);
51
+ return (
52
+ <div>
53
+ <Button ref={(el) => setAnchorEl(el)} onClick={() => setOpen((x) => !x)}>
54
+ Open
55
+ </Button>
56
+ <Popover
57
+ {...props}
58
+ open={props.open ?? open}
59
+ anchorEl={anchorEl}
60
+ onClose={(e) => setOpen(e)}
61
+ >
62
+ <Popover.Content>Velit in consequat</Popover.Content>
63
+ </Popover>
64
+ </div>
65
+ );
82
66
  };
83
67
 
84
68
  const Template = (props) => {
@@ -1,4 +1,3 @@
1
- // eslint-disable-next-line react/no-typos
2
1
  import "react";
3
2
 
4
3
  declare module "react" {
@@ -1,43 +1,42 @@
1
- /* eslint-disable react-hooks/rules-of-hooks */
1
+ import { Meta, StoryFn } from "@storybook/react";
2
2
  import React, { useState } from "react";
3
3
  import { ReadMore } from ".";
4
4
 
5
- export default {
5
+ const meta: Meta<typeof ReadMore> = {
6
6
  title: "ds-react/ReadMore",
7
7
  component: ReadMore,
8
- argTypes: {
9
- size: {
10
- control: {
11
- type: "radio",
12
- options: ["medium", "small"],
13
- },
14
- },
15
- },
16
8
  };
9
+ export default meta;
17
10
 
18
- export const Default = {
19
- render: (props) => {
20
- const [state, setState] = useState(false);
21
-
22
- return (
23
- <ReadMore
24
- open={props.controlled ? state : undefined}
25
- onClick={() => setState((x) => !x)}
26
- header="Grunnen til at vi spør om dette og i tillegg ber om vedlegg"
27
- size={props.size}
28
- >
29
- <div style={{ maxWidth: 300 }}>
30
- Lorem ipsum dolor sit amet consectetur adipisicing elit. Mollitia,
31
- tempore corporis exercitationem minus dignissimos eius aspernatur
32
- fugiat iusto.
33
- </div>
34
- </ReadMore>
35
- );
36
- },
11
+ export const Default: StoryFn<{
12
+ controlled: boolean;
13
+ size: "medium" | "small";
14
+ }> = (props) => {
15
+ const [state, setState] = useState(false);
37
16
 
38
- args: {
39
- controlled: false,
40
- size: "medium",
17
+ return (
18
+ <ReadMore
19
+ open={props.controlled ? state : undefined}
20
+ onClick={() => setState((x) => !x)}
21
+ header="Grunnen til at vi spør om dette og i tillegg ber om vedlegg"
22
+ size={props.size}
23
+ >
24
+ <div style={{ maxWidth: 300 }}>
25
+ Lorem ipsum dolor sit amet consectetur adipisicing elit. Mollitia,
26
+ tempore corporis exercitationem minus dignissimos eius aspernatur fugiat
27
+ iusto.
28
+ </div>
29
+ </ReadMore>
30
+ );
31
+ };
32
+ Default.args = {
33
+ controlled: false,
34
+ size: "medium",
35
+ };
36
+ Default.argTypes = {
37
+ size: {
38
+ options: ["medium", "small"],
39
+ control: { type: "radio" },
41
40
  },
42
41
  };
43
42
 
@@ -46,8 +45,8 @@ export const Small = () => (
46
45
  header="Grunnen til at vi spør om dette og i tillegg ber om vedlegg"
47
46
  size="small"
48
47
  >
49
- Command station, this is ST 321. Code Clearance Blue. We're starting our
50
- approach. Deactivate the security shield.
48
+ Command station, this is ST 321. Code Clearance Blue. We&apos;re starting
49
+ our approach. Deactivate the security shield.
51
50
  </ReadMore>
52
51
  );
53
52
 
@@ -56,7 +55,7 @@ export const Open = () => (
56
55
  header="Grunnen til at vi spør om dette og i tillegg ber om vedlegg"
57
56
  defaultOpen
58
57
  >
59
- Command station, this is ST 321. Code Clearance Blue. We're starting our
60
- approach. Deactivate the security shield.
58
+ Command station, this is ST 321. Code Clearance Blue. We&apos;re starting
59
+ our approach. Deactivate the security shield.
61
60
  </ReadMore>
62
61
  );
@@ -1,26 +1,22 @@
1
- /* eslint-disable react-hooks/rules-of-hooks */
2
1
  import { Meta } from "@storybook/react";
3
2
  import React, { useState } from "react";
4
3
  import { BodyLong } from "..";
5
4
  import Stepper from "./Stepper";
6
5
 
7
- export default {
6
+ const meta: Meta<typeof Stepper> = {
8
7
  title: "ds-react/Stepper",
9
8
  component: Stepper,
10
9
  argTypes: {
11
10
  orientation: {
12
- control: {
13
- type: "radio",
14
- },
11
+ control: { type: "radio" },
15
12
  options: ["horizontal", "vertical"],
16
13
  },
17
14
  activeStep: {
18
- control: {
19
- type: "number",
20
- },
15
+ control: { type: "number" },
21
16
  },
22
17
  },
23
- } as Meta;
18
+ };
19
+ export default meta;
24
20
 
25
21
  const storyTexts = [
26
22
  "Minimize backwards overflow agile. Horsehead offer commitment to the cause nor copy and paste from stack overflow problem territories, innovation is hot right now for can you slack it to me?. High touch client table the discussion , and get buy-in so manage expectations loop back, please advise soonest. We need a paradigm shift dogpile that, and i need to pee and then go to another meeting for let's prioritize the low-hanging fruit.",
@@ -32,51 +28,48 @@ const storyTexts = [
32
28
  "Move the needle a loss a day will keep you focus yet can you put it into a banner that is not alarming, but eye catching and not too giant or strategic fit, nor it is all exactly as i said, but i don't like it or streamline. We've bootstrapped the model. This proposal is a win-win situation which will cause a stellar paradigm shift, and produce a multi-fold increase in deliverables the horse is out of the barn usabiltiy, for going forward but going forward.",
33
29
  ];
34
30
 
35
- export const Default = {
36
- render: ({ asButton, ...props }) => {
37
- const [activeStep, setActiveStep] = useState(1);
38
-
39
- const newProps = {
40
- onClick: (e) => e.preventDefault(),
41
- ...(asButton ? { as: "button" } : { href: "#" }),
42
- };
31
+ export const Default = ({ asButton, ...props }) => {
32
+ const [activeStep, setActiveStep] = useState(1);
43
33
 
44
- return (
45
- <div style={{ display: "flex", gap: "10rem", flexDirection: "column" }}>
46
- <Stepper
47
- aria-labelledby="stepper-heading"
48
- activeStep={activeStep}
49
- onStepChange={setActiveStep}
50
- orientation="vertical"
51
- {...props}
52
- >
53
- <Stepper.Step {...newProps} completed={props.completed}>
54
- Start søknad
55
- </Stepper.Step>
56
- <Stepper.Step {...newProps}>Personopplysninger</Stepper.Step>
57
- <Stepper.Step {...newProps} completed={props.completed}>
58
- Saksopplysninger
59
- </Stepper.Step>
60
- <Stepper.Step {...newProps} completed={props.completed}>
61
- Søknadstekst for en veldig spesifikk prosess i NAV som må beskrives
62
- og forklares i sitt fulle i denne labelen
63
- </Stepper.Step>
64
- <Stepper.Step {...newProps}>Vedlegg</Stepper.Step>
65
- <Stepper.Step {...newProps}>Oppsummering</Stepper.Step>
66
- <Stepper.Step {...newProps}>Innsending</Stepper.Step>
67
- </Stepper>
68
- <BodyLong style={{ marginTop: "5rem" }}>
69
- {storyTexts[activeStep]}
70
- </BodyLong>
71
- </div>
72
- );
73
- },
34
+ const newProps = {
35
+ onClick: (e) => e.preventDefault(),
36
+ ...(asButton ? { as: "button" } : { href: "#" }),
37
+ };
74
38
 
75
- args: {
76
- asButton: false,
77
- interactive: true,
78
- completed: false,
79
- },
39
+ return (
40
+ <div style={{ display: "flex", gap: "10rem", flexDirection: "column" }}>
41
+ <Stepper
42
+ aria-labelledby="stepper-heading"
43
+ activeStep={activeStep}
44
+ onStepChange={setActiveStep}
45
+ orientation="vertical"
46
+ {...props}
47
+ >
48
+ <Stepper.Step {...newProps} completed={props.completed}>
49
+ Start søknad
50
+ </Stepper.Step>
51
+ <Stepper.Step {...newProps}>Personopplysninger</Stepper.Step>
52
+ <Stepper.Step {...newProps} completed={props.completed}>
53
+ Saksopplysninger
54
+ </Stepper.Step>
55
+ <Stepper.Step {...newProps} completed={props.completed}>
56
+ Søknadstekst for en veldig spesifikk prosess i NAV som må beskrives og
57
+ forklares i sitt fulle i denne labelen
58
+ </Stepper.Step>
59
+ <Stepper.Step {...newProps}>Vedlegg</Stepper.Step>
60
+ <Stepper.Step {...newProps}>Oppsummering</Stepper.Step>
61
+ <Stepper.Step {...newProps}>Innsending</Stepper.Step>
62
+ </Stepper>
63
+ <BodyLong style={{ marginTop: "5rem" }}>
64
+ {storyTexts[activeStep]}
65
+ </BodyLong>
66
+ </div>
67
+ );
68
+ };
69
+ Default.args = {
70
+ asButton: false,
71
+ interactive: true,
72
+ completed: false,
80
73
  };
81
74
 
82
75
  export const Horizontal = () => {
@@ -147,7 +147,7 @@ const data = [
147
147
  status: "Inaktiv",
148
148
  content: (
149
149
  <>
150
- Ola Conny Brakkestad sier "hei". Her er litt innhold med en{" "}
150
+ Ola Conny Brakkestad sier hei. Her er litt innhold med en{" "}
151
151
  <Link href="#">link.</Link>
152
152
  </>
153
153
  ),
@@ -162,7 +162,7 @@ const data = [
162
162
  status: <Link href="http://example.com">Hissig</Link>,
163
163
  content: (
164
164
  <>
165
- Henriette Kristensen sier "hei". Her er litt innhold med en{" "}
165
+ Henriette Kristensen sier hei. Her er litt innhold med en{" "}
166
166
  <Link href="http://example.com">lenke</Link>. I forhold til en betydelig
167
167
  avveining synliggjøres potensialet med sikte på satsingsområdet. Gitt en
168
168
  manglende avveining synliggjøres instrumentet på bakgrunn av forholdene.
@@ -183,7 +183,7 @@ const data = [
183
183
  status: "Deaktivert",
184
184
  content: (
185
185
  <>
186
- Suki Clydesdale sier "hei". Her er litt innhold med en{" "}
186
+ Suki Clydesdale sier hei. Her er litt innhold med en{" "}
187
187
  <Link href="http://example.com">link</Link>.
188
188
  </>
189
189
  ),
@@ -198,7 +198,7 @@ const data = [
198
198
  status: <Link href="#">Starter</Link>,
199
199
  content: (
200
200
  <>
201
- Hans-Hermann Hoppe sier "hei". Her er litt innhold med en{" "}
201
+ Hans-Hermann Hoppe sier hei. Her er litt innhold med en{" "}
202
202
  <Link href="http://example.com">link</Link>.
203
203
  </>
204
204
  ),
@@ -213,7 +213,7 @@ const data = [
213
213
  status: <Link href="#">Eksplodert</Link>,
214
214
  content: (
215
215
  <>
216
- Max Kraft sier "hei". Her er litt innhold med en{" "}
216
+ Max Kraft sier hei. Her er litt innhold med en{" "}
217
217
  <Link href="http://example.com">link</Link>.
218
218
  </>
219
219
  ),
@@ -228,7 +228,7 @@ const data = [
228
228
  status: <Link href="#">Gunstig</Link>,
229
229
  content: (
230
230
  <>
231
- Pat Ole sier "hei". Her er litt innhold med en{" "}
231
+ Pat Ole sier hei. Her er litt innhold med en{" "}
232
232
  <Link href="http://example.com">lenke</Link>.
233
233
  </>
234
234
  ),
@@ -265,62 +265,58 @@ export const ExpandableOpen = () => {
265
265
  );
266
266
  };
267
267
 
268
- export const ClickableRow = {
269
- render: () => {
270
- // eslint-disable-next-line react-hooks/rules-of-hooks
271
- const [isRowOpen1, setIsRowOpen1] = useState(false);
272
- // eslint-disable-next-line react-hooks/rules-of-hooks
273
- const [isRowOpen2, setIsRowOpen2] = useState(false);
268
+ export const ClickableRow = () => {
269
+ const [isRowOpen1, setIsRowOpen1] = useState(false);
270
+ const [isRowOpen2, setIsRowOpen2] = useState(false);
274
271
 
275
- return (
276
- <>
277
- <Table zebraStripes>
278
- <Table.Header>
279
- <Table.Row>
280
- <Table.HeaderCell>Navn</Table.HeaderCell>
281
- <Table.HeaderCell>Info</Table.HeaderCell>
282
- <Table.HeaderCell aria-hidden />
283
- </Table.Row>
284
- </Table.Header>
285
- <Table.Body>
286
- <Table.ExpandableRow
287
- content={<div>placeholder row 1</div>}
288
- togglePlacement="right"
289
- onOpenChange={setIsRowOpen1}
290
- data-testid="row1"
291
- open={isRowOpen1}
292
- expandOnRowClick
293
- >
294
- <Table.DataCell>Ola</Table.DataCell>
295
- <Table.DataCell>
296
- <Button
297
- size="xsmall"
298
- onClick={(e) => {
299
- alert("Mer info");
300
- }}
301
- >
302
- Mer info
303
- </Button>
304
- </Table.DataCell>
305
- </Table.ExpandableRow>
306
- <Table.ExpandableRow
307
- content={<div>placeholder row 2</div>}
308
- togglePlacement="right"
309
- onOpenChange={setIsRowOpen2}
310
- data-testid="row2"
311
- open={isRowOpen2}
312
- expandOnRowClick
313
- >
314
- <Table.DataCell>Hans</Table.DataCell>
315
- <Table.DataCell>
316
- <Checkbox hideLabel size="small">
317
- Sett
318
- </Checkbox>
319
- </Table.DataCell>
320
- </Table.ExpandableRow>
321
- </Table.Body>
322
- </Table>
323
- </>
324
- );
325
- },
272
+ return (
273
+ <>
274
+ <Table zebraStripes>
275
+ <Table.Header>
276
+ <Table.Row>
277
+ <Table.HeaderCell>Navn</Table.HeaderCell>
278
+ <Table.HeaderCell>Info</Table.HeaderCell>
279
+ <Table.HeaderCell aria-hidden />
280
+ </Table.Row>
281
+ </Table.Header>
282
+ <Table.Body>
283
+ <Table.ExpandableRow
284
+ content={<div>placeholder row 1</div>}
285
+ togglePlacement="right"
286
+ onOpenChange={setIsRowOpen1}
287
+ data-testid="row1"
288
+ open={isRowOpen1}
289
+ expandOnRowClick
290
+ >
291
+ <Table.DataCell>Ola</Table.DataCell>
292
+ <Table.DataCell>
293
+ <Button
294
+ size="xsmall"
295
+ onClick={() => {
296
+ alert("Mer info");
297
+ }}
298
+ >
299
+ Mer info
300
+ </Button>
301
+ </Table.DataCell>
302
+ </Table.ExpandableRow>
303
+ <Table.ExpandableRow
304
+ content={<div>placeholder row 2</div>}
305
+ togglePlacement="right"
306
+ onOpenChange={setIsRowOpen2}
307
+ data-testid="row2"
308
+ open={isRowOpen2}
309
+ expandOnRowClick
310
+ >
311
+ <Table.DataCell>Hans</Table.DataCell>
312
+ <Table.DataCell>
313
+ <Checkbox hideLabel size="small">
314
+ Sett
315
+ </Checkbox>
316
+ </Table.DataCell>
317
+ </Table.ExpandableRow>
318
+ </Table.Body>
319
+ </Table>
320
+ </>
321
+ );
326
322
  };
@@ -34,13 +34,10 @@ export const TabList = forwardRef<HTMLDivElement, TabListProps>(
34
34
  debounce(() => {
35
35
  if (!listRef?.current) return;
36
36
  const { scrollWidth, clientWidth } = listRef.current;
37
- let showStartScroll;
38
- let showEndScroll;
39
-
40
- const scrollLeft = listRef?.current?.scrollLeft;
37
+ const scrollLeft = listRef.current.scrollLeft;
41
38
  // use 1 for the potential rounding error with browser zooms.
42
- showStartScroll = scrollLeft > 1;
43
- showEndScroll = scrollLeft < scrollWidth - clientWidth - 1;
39
+ const showStartScroll = scrollLeft > 1;
40
+ const showEndScroll = scrollLeft < scrollWidth - clientWidth - 1;
44
41
 
45
42
  setDisplayScroll((displayScroll) =>
46
43
  showStartScroll === displayScroll.start &&
@@ -89,6 +86,7 @@ export const TabList = forwardRef<HTMLDivElement, TabListProps>(
89
86
  dir: 1 | -1;
90
87
  hidden: boolean;
91
88
  }) => (
89
+ // eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions
92
90
  <div
93
91
  className={cl("navds-tabs__scroll-button", {
94
92
  "navds-tabs__scroll-button--hidden": hidden,
@@ -8,19 +8,19 @@ export default {
8
8
  component: Tabs,
9
9
  argTypes: {
10
10
  size: {
11
+ options: ["medium", "small"],
11
12
  control: {
12
13
  type: "radio",
13
- options: ["medium", "small"],
14
14
  },
15
15
  },
16
16
  iconPosition: {
17
+ options: ["top", "left"],
17
18
  control: {
18
19
  type: "radio",
19
- options: ["top", "left"],
20
20
  },
21
21
  },
22
22
  },
23
- } as Meta;
23
+ } satisfies Meta<typeof Tabs>;
24
24
 
25
25
  const Panel = () => {
26
26
  return (
@@ -66,7 +66,7 @@ export const Default = {
66
66
  export const Small = () => {
67
67
  return (
68
68
  <div className="rowgap rowgap-wrap">
69
- {variants.map((variant, i) => (
69
+ {variants.map((variant) => (
70
70
  <Tag key={variant} variant={variant} size="small">
71
71
  {variant}
72
72
  </Tag>
@@ -75,10 +75,10 @@ export const Small = () => {
75
75
  );
76
76
  };
77
77
 
78
- export const xSmall = () => {
78
+ export const XSmall = () => {
79
79
  return (
80
80
  <div className="rowgap rowgap-wrap">
81
- {variants.map((variant, i) => (
81
+ {variants.map((variant) => (
82
82
  <Tag key={variant} variant={variant} size="xsmall">
83
83
  {variant}
84
84
  </Tag>
@@ -90,7 +90,7 @@ export const xSmall = () => {
90
90
  export const Variants = () => {
91
91
  return (
92
92
  <div className="rowgap rowgap-wrap">
93
- {variants.map((variant, i) => (
93
+ {variants.map((variant) => (
94
94
  <Tag key={variant} variant={variant}>
95
95
  {variant}
96
96
  </Tag>