@dnb/eufemia 10.12.0 → 10.13.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 (582) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/cjs/components/accordion/Accordion.js +1 -0
  3. package/cjs/components/accordion/Accordion.js.map +1 -1
  4. package/cjs/components/accordion/AccordionGroup.js +1 -0
  5. package/cjs/components/accordion/AccordionGroup.js.map +1 -1
  6. package/cjs/components/accordion/AccordionHeader.js +5 -15
  7. package/cjs/components/accordion/AccordionHeader.js.map +1 -1
  8. package/cjs/components/accordion/style/dnb-accordion.css +2 -2
  9. package/cjs/components/accordion/style/dnb-accordion.min.css +1 -1
  10. package/cjs/components/accordion/style/dnb-accordion.scss +3 -8
  11. package/cjs/components/accordion/style/themes/dnb-accordion-theme-sbanken.css +1 -1
  12. package/cjs/components/accordion/style/themes/dnb-accordion-theme-sbanken.min.css +1 -1
  13. package/cjs/components/accordion/style/themes/dnb-accordion-theme-sbanken.scss +1 -1
  14. package/cjs/components/anchor/Anchor.js.map +1 -1
  15. package/cjs/components/anchor/style/themes/dnb-anchor-theme-sbanken.css +2 -2
  16. package/cjs/components/anchor/style/themes/dnb-anchor-theme-sbanken.min.css +1 -1
  17. package/cjs/components/anchor/style/themes/dnb-anchor-theme-sbanken.scss +1 -2
  18. package/cjs/components/autocomplete/Autocomplete.d.ts +2 -2
  19. package/cjs/components/autocomplete/Autocomplete.js +41 -16
  20. package/cjs/components/autocomplete/Autocomplete.js.map +1 -1
  21. package/cjs/components/breadcrumb/Breadcrumb.js +1 -0
  22. package/cjs/components/breadcrumb/Breadcrumb.js.map +1 -1
  23. package/cjs/components/button/style/themes/dnb-button-theme-eiendom.scss +1 -1
  24. package/cjs/components/button/style/themes/dnb-button-theme-sbanken.css +2 -2
  25. package/cjs/components/button/style/themes/dnb-button-theme-sbanken.min.css +1 -1
  26. package/cjs/components/button/style/themes/dnb-button-theme-sbanken.scss +2 -2
  27. package/cjs/components/card/Card.js +2 -2
  28. package/cjs/components/card/Card.js.map +1 -1
  29. package/cjs/components/dialog/Dialog.js +1 -0
  30. package/cjs/components/dialog/Dialog.js.map +1 -1
  31. package/cjs/components/dialog/DialogContent.js +1 -0
  32. package/cjs/components/dialog/DialogContent.js.map +1 -1
  33. package/cjs/components/dialog/parts/DialogAction.js +1 -0
  34. package/cjs/components/dialog/parts/DialogAction.js.map +1 -1
  35. package/cjs/components/drawer/Drawer.js +1 -0
  36. package/cjs/components/drawer/Drawer.js.map +1 -1
  37. package/cjs/components/drawer/DrawerContent.js +1 -0
  38. package/cjs/components/drawer/DrawerContent.js.map +1 -1
  39. package/cjs/components/drawer/parts/DrawerContentContext.js +1 -0
  40. package/cjs/components/drawer/parts/DrawerContentContext.js.map +1 -1
  41. package/cjs/components/flex/Container.js +6 -4
  42. package/cjs/components/flex/Container.js.map +1 -1
  43. package/cjs/components/flex/utils.js +2 -2
  44. package/cjs/components/flex/utils.js.map +1 -1
  45. package/cjs/components/form-row/style/dnb-form-row.scss +1 -1
  46. package/cjs/components/icon/style/dnb-icon.scss +1 -1
  47. package/cjs/components/input-masked/InputMasked.d.ts +1 -1
  48. package/cjs/components/input-masked/MultiInputMask.d.ts +3 -3
  49. package/cjs/components/input-masked/MultiInputMask.js +2 -1
  50. package/cjs/components/input-masked/MultiInputMask.js.map +1 -1
  51. package/cjs/components/input-masked/hooks/useHandleCursorPosition.js +1 -0
  52. package/cjs/components/input-masked/hooks/useHandleCursorPosition.js.map +1 -1
  53. package/cjs/components/input-masked/hooks/useMultiInputValues.js +1 -0
  54. package/cjs/components/input-masked/hooks/useMultiInputValues.js.map +1 -1
  55. package/cjs/components/number-format/NumberUtils.js.map +1 -1
  56. package/cjs/components/number-format/useNumberFormat.js +1 -0
  57. package/cjs/components/number-format/useNumberFormat.js.map +1 -1
  58. package/cjs/components/pagination/PaginationBar.js +1 -0
  59. package/cjs/components/pagination/PaginationBar.js.map +1 -1
  60. package/cjs/components/step-indicator/StepIndicatorContext.js +1 -0
  61. package/cjs/components/step-indicator/StepIndicatorContext.js.map +1 -1
  62. package/cjs/components/step-indicator/StepIndicatorItem.js +3 -2
  63. package/cjs/components/step-indicator/StepIndicatorItem.js.map +1 -1
  64. package/cjs/components/step-indicator/StepIndicatorList.js +1 -0
  65. package/cjs/components/step-indicator/StepIndicatorList.js.map +1 -1
  66. package/cjs/components/step-indicator/StepIndicatorModal.js +1 -0
  67. package/cjs/components/step-indicator/StepIndicatorModal.js.map +1 -1
  68. package/cjs/components/step-indicator/StepIndicatorSidebar.js +1 -0
  69. package/cjs/components/step-indicator/StepIndicatorSidebar.js.map +1 -1
  70. package/cjs/components/step-indicator/StepIndicatorTriggerButton.js +1 -0
  71. package/cjs/components/step-indicator/StepIndicatorTriggerButton.js.map +1 -1
  72. package/cjs/components/table/style/themes/dnb-table-theme-sbanken.css +1 -0
  73. package/cjs/components/table/style/themes/dnb-table-theme-sbanken.min.css +1 -1
  74. package/cjs/components/table/style/themes/dnb-table-theme-sbanken.scss +1 -0
  75. package/cjs/components/toggle-button/style/themes/dnb-toggle-button-theme-ui.scss +1 -1
  76. package/cjs/components/tooltip/TooltipWithEvents.js.map +1 -1
  77. package/cjs/components/upload/UploadContext.js +1 -0
  78. package/cjs/components/upload/UploadContext.js.map +1 -1
  79. package/cjs/components/upload/UploadFileInput.js +1 -0
  80. package/cjs/components/upload/UploadFileInput.js.map +1 -1
  81. package/cjs/components/upload/UploadFileListCell.js +1 -0
  82. package/cjs/components/upload/UploadFileListCell.js.map +1 -1
  83. package/cjs/elements/lists/Dl.d.ts +1 -1
  84. package/cjs/elements/lists/Dl.js.map +1 -1
  85. package/cjs/elements/typography/style/dnb-typography.scss +1 -1
  86. package/cjs/elements/typography/style/typography-mixins.scss +2 -2
  87. package/cjs/extensions/forms/DataContext/At/At.js +1 -0
  88. package/cjs/extensions/forms/DataContext/At/At.js.map +1 -1
  89. package/cjs/extensions/forms/DataContext/Provider/Provider.js +5 -3
  90. package/cjs/extensions/forms/DataContext/Provider/Provider.js.map +1 -1
  91. package/cjs/extensions/forms/Field/ArraySelection/ArraySelection.js +12 -9
  92. package/cjs/extensions/forms/Field/ArraySelection/ArraySelection.js.map +1 -1
  93. package/cjs/extensions/forms/Field/BankAccountNumber/BankAccountNumber.js +5 -3
  94. package/cjs/extensions/forms/Field/BankAccountNumber/BankAccountNumber.js.map +1 -1
  95. package/cjs/extensions/forms/Field/Boolean/Boolean.js +3 -2
  96. package/cjs/extensions/forms/Field/Boolean/Boolean.js.map +1 -1
  97. package/cjs/extensions/forms/Field/Currency/Currency.js +3 -2
  98. package/cjs/extensions/forms/Field/Currency/Currency.js.map +1 -1
  99. package/cjs/extensions/forms/Field/Date/Date.js +2 -1
  100. package/cjs/extensions/forms/Field/Date/Date.js.map +1 -1
  101. package/cjs/extensions/forms/Field/Email/Email.js +5 -3
  102. package/cjs/extensions/forms/Field/Email/Email.js.map +1 -1
  103. package/cjs/extensions/forms/Field/NationalIdentityNumber/NationalIdentityNumber.js +5 -3
  104. package/cjs/extensions/forms/Field/NationalIdentityNumber/NationalIdentityNumber.js.map +1 -1
  105. package/cjs/extensions/forms/Field/Number/Number.js +3 -2
  106. package/cjs/extensions/forms/Field/Number/Number.js.map +1 -1
  107. package/cjs/extensions/forms/Field/Option/Option.js +1 -1
  108. package/cjs/extensions/forms/Field/Option/Option.js.map +1 -1
  109. package/cjs/extensions/forms/Field/OrganizationNumber/OrganizationNumber.js +5 -3
  110. package/cjs/extensions/forms/Field/OrganizationNumber/OrganizationNumber.js.map +1 -1
  111. package/cjs/extensions/forms/Field/PhoneNumber/PhoneNumber.d.ts +5 -0
  112. package/cjs/extensions/forms/Field/PhoneNumber/PhoneNumber.js +58 -18
  113. package/cjs/extensions/forms/Field/PhoneNumber/PhoneNumber.js.map +1 -1
  114. package/cjs/extensions/forms/Field/PostalCodeAndCity/PostalCodeAndCity.js +6 -4
  115. package/cjs/extensions/forms/Field/PostalCodeAndCity/PostalCodeAndCity.js.map +1 -1
  116. package/cjs/extensions/forms/Field/SelectCountry/SelectCountry.js +12 -8
  117. package/cjs/extensions/forms/Field/SelectCountry/SelectCountry.js.map +1 -1
  118. package/cjs/extensions/forms/Field/Selection/Selection.js +29 -20
  119. package/cjs/extensions/forms/Field/Selection/Selection.js.map +1 -1
  120. package/cjs/extensions/forms/Field/String/String.js +10 -9
  121. package/cjs/extensions/forms/Field/String/String.js.map +1 -1
  122. package/cjs/extensions/forms/Field/Toggle/Toggle.js +5 -4
  123. package/cjs/extensions/forms/Field/Toggle/Toggle.js.map +1 -1
  124. package/cjs/extensions/forms/FieldBlock/FieldBlock.js +1 -0
  125. package/cjs/extensions/forms/FieldBlock/FieldBlock.js.map +1 -1
  126. package/cjs/extensions/forms/Form/SubmitButton/SubmitButton.js +1 -0
  127. package/cjs/extensions/forms/Form/SubmitButton/SubmitButton.js.map +1 -1
  128. package/cjs/extensions/forms/Iterate/Array/Array.js +2 -2
  129. package/cjs/extensions/forms/Iterate/Array/Array.js.map +1 -1
  130. package/cjs/extensions/forms/Iterate/ArrayPushButton/ArrayPushButton.js +3 -2
  131. package/cjs/extensions/forms/Iterate/ArrayPushButton/ArrayPushButton.js.map +1 -1
  132. package/cjs/extensions/forms/Iterate/ArrayRemoveElementButton/ArrayRemoveElementButton.js +2 -1
  133. package/cjs/extensions/forms/Iterate/ArrayRemoveElementButton/ArrayRemoveElementButton.js.map +1 -1
  134. package/cjs/extensions/forms/StepsLayout/NextButton/NextButton.js +1 -0
  135. package/cjs/extensions/forms/StepsLayout/NextButton/NextButton.js.map +1 -1
  136. package/cjs/extensions/forms/StepsLayout/PreviousButton/PreviousButton.js +1 -0
  137. package/cjs/extensions/forms/StepsLayout/PreviousButton/PreviousButton.js.map +1 -1
  138. package/cjs/extensions/forms/StepsLayout/Step/Step.js +1 -0
  139. package/cjs/extensions/forms/StepsLayout/Step/Step.js.map +1 -1
  140. package/cjs/extensions/forms/StepsLayout/StepsLayout.js +3 -1
  141. package/cjs/extensions/forms/StepsLayout/StepsLayout.js.map +1 -1
  142. package/cjs/extensions/forms/Value/BankAccountNumber/BankAccountNumber.js +3 -1
  143. package/cjs/extensions/forms/Value/BankAccountNumber/BankAccountNumber.js.map +1 -1
  144. package/cjs/extensions/forms/Value/Boolean/Boolean.js +1 -0
  145. package/cjs/extensions/forms/Value/Boolean/Boolean.js.map +1 -1
  146. package/cjs/extensions/forms/Value/Currency/Currency.js +3 -2
  147. package/cjs/extensions/forms/Value/Currency/Currency.js.map +1 -1
  148. package/cjs/extensions/forms/Value/Date/Date.js +3 -1
  149. package/cjs/extensions/forms/Value/Date/Date.js.map +1 -1
  150. package/cjs/extensions/forms/Value/Email/Email.js +3 -1
  151. package/cjs/extensions/forms/Value/Email/Email.js.map +1 -1
  152. package/cjs/extensions/forms/Value/NationalIdentityNumber/NationalIdentityNumber.js +3 -1
  153. package/cjs/extensions/forms/Value/NationalIdentityNumber/NationalIdentityNumber.js.map +1 -1
  154. package/cjs/extensions/forms/Value/PhoneNumber/PhoneNumber.js +3 -1
  155. package/cjs/extensions/forms/Value/PhoneNumber/PhoneNumber.js.map +1 -1
  156. package/cjs/extensions/forms/ValueBlock/ValueBlock.js +1 -1
  157. package/cjs/extensions/forms/ValueBlock/ValueBlock.js.map +1 -1
  158. package/cjs/extensions/forms/Visibility/Visibility.js +1 -0
  159. package/cjs/extensions/forms/Visibility/Visibility.js.map +1 -1
  160. package/cjs/extensions/forms/hooks/useDataValue.js +21 -17
  161. package/cjs/extensions/forms/hooks/useDataValue.js.map +1 -1
  162. package/cjs/extensions/forms/types.js +6 -6
  163. package/cjs/extensions/forms/types.js.map +1 -1
  164. package/cjs/extensions/forms/utils/ajv.js +3 -2
  165. package/cjs/extensions/forms/utils/ajv.js.map +1 -1
  166. package/cjs/extensions/forms/utils/numbers.js +2 -2
  167. package/cjs/extensions/forms/utils/numbers.js.map +1 -1
  168. package/cjs/extensions/forms/utils/useWasChanged.js +8 -6
  169. package/cjs/extensions/forms/utils/useWasChanged.js.map +1 -1
  170. package/cjs/fragments/drawer-list/DrawerListHelpers.js +1 -1
  171. package/cjs/fragments/drawer-list/DrawerListHelpers.js.map +1 -1
  172. package/cjs/fragments/drawer-list/DrawerListProvider.js.map +1 -1
  173. package/cjs/fragments/drawer-list/style/themes/dnb-drawer-list-theme-sbanken.scss +1 -1
  174. package/cjs/fragments/drawer-list/style/themes/dnb-drawer-list-theme-ui.scss +2 -2
  175. package/cjs/shared/Eufemia.d.ts +1 -1
  176. package/cjs/shared/Eufemia.js +2 -2
  177. package/cjs/shared/Eufemia.js.map +1 -1
  178. package/cjs/style/dnb-ui-components.css +2 -2
  179. package/cjs/style/dnb-ui-components.min.css +1 -1
  180. package/cjs/style/themes/theme-eiendom/eiendom-theme-components.css +2 -2
  181. package/cjs/style/themes/theme-eiendom/eiendom-theme-components.min.css +1 -1
  182. package/cjs/style/themes/theme-sbanken/fonts.scss +5 -4
  183. package/cjs/style/themes/theme-sbanken/properties.js +2 -2
  184. package/cjs/style/themes/theme-sbanken/properties.js.map +1 -1
  185. package/cjs/style/themes/theme-sbanken/sbanken-theme-basis.css +3 -2
  186. package/cjs/style/themes/theme-sbanken/sbanken-theme-basis.min.css +1 -1
  187. package/cjs/style/themes/theme-sbanken/sbanken-theme-components.css +8 -7
  188. package/cjs/style/themes/theme-sbanken/sbanken-theme-components.min.css +4 -4
  189. package/cjs/style/themes/theme-sbanken/theme-mapping.scss +2 -1
  190. package/cjs/style/themes/theme-ui/ui-theme-components.css +2 -2
  191. package/cjs/style/themes/theme-ui/ui-theme-components.min.css +1 -1
  192. package/components/accordion/Accordion.js +2 -0
  193. package/components/accordion/Accordion.js.map +1 -1
  194. package/components/accordion/AccordionGroup.js +2 -0
  195. package/components/accordion/AccordionGroup.js.map +1 -1
  196. package/components/accordion/AccordionHeader.js +6 -15
  197. package/components/accordion/AccordionHeader.js.map +1 -1
  198. package/components/accordion/style/dnb-accordion.css +2 -2
  199. package/components/accordion/style/dnb-accordion.min.css +1 -1
  200. package/components/accordion/style/dnb-accordion.scss +3 -8
  201. package/components/accordion/style/themes/dnb-accordion-theme-sbanken.css +1 -1
  202. package/components/accordion/style/themes/dnb-accordion-theme-sbanken.min.css +1 -1
  203. package/components/accordion/style/themes/dnb-accordion-theme-sbanken.scss +1 -1
  204. package/components/anchor/Anchor.js.map +1 -1
  205. package/components/anchor/style/themes/dnb-anchor-theme-sbanken.css +2 -2
  206. package/components/anchor/style/themes/dnb-anchor-theme-sbanken.min.css +1 -1
  207. package/components/anchor/style/themes/dnb-anchor-theme-sbanken.scss +1 -2
  208. package/components/autocomplete/Autocomplete.d.ts +2 -2
  209. package/components/autocomplete/Autocomplete.js +42 -17
  210. package/components/autocomplete/Autocomplete.js.map +1 -1
  211. package/components/breadcrumb/Breadcrumb.js +2 -0
  212. package/components/breadcrumb/Breadcrumb.js.map +1 -1
  213. package/components/button/style/themes/dnb-button-theme-eiendom.scss +1 -1
  214. package/components/button/style/themes/dnb-button-theme-sbanken.css +2 -2
  215. package/components/button/style/themes/dnb-button-theme-sbanken.min.css +1 -1
  216. package/components/button/style/themes/dnb-button-theme-sbanken.scss +2 -2
  217. package/components/card/Card.js +2 -2
  218. package/components/card/Card.js.map +1 -1
  219. package/components/dialog/Dialog.js +2 -0
  220. package/components/dialog/Dialog.js.map +1 -1
  221. package/components/dialog/DialogContent.js +2 -0
  222. package/components/dialog/DialogContent.js.map +1 -1
  223. package/components/dialog/parts/DialogAction.js +2 -0
  224. package/components/dialog/parts/DialogAction.js.map +1 -1
  225. package/components/drawer/Drawer.js +2 -0
  226. package/components/drawer/Drawer.js.map +1 -1
  227. package/components/drawer/DrawerContent.js +2 -0
  228. package/components/drawer/DrawerContent.js.map +1 -1
  229. package/components/drawer/parts/DrawerContentContext.js +2 -0
  230. package/components/drawer/parts/DrawerContentContext.js.map +1 -1
  231. package/components/flex/Container.js +6 -4
  232. package/components/flex/Container.js.map +1 -1
  233. package/components/flex/utils.js +2 -2
  234. package/components/flex/utils.js.map +1 -1
  235. package/components/form-row/style/dnb-form-row.scss +1 -1
  236. package/components/icon/style/dnb-icon.scss +1 -1
  237. package/components/input-masked/InputMasked.d.ts +1 -1
  238. package/components/input-masked/MultiInputMask.d.ts +3 -3
  239. package/components/input-masked/MultiInputMask.js +3 -1
  240. package/components/input-masked/MultiInputMask.js.map +1 -1
  241. package/components/input-masked/hooks/useHandleCursorPosition.js +2 -0
  242. package/components/input-masked/hooks/useHandleCursorPosition.js.map +1 -1
  243. package/components/input-masked/hooks/useMultiInputValues.js +2 -0
  244. package/components/input-masked/hooks/useMultiInputValues.js.map +1 -1
  245. package/components/number-format/NumberUtils.js.map +1 -1
  246. package/components/number-format/useNumberFormat.js +2 -0
  247. package/components/number-format/useNumberFormat.js.map +1 -1
  248. package/components/pagination/PaginationBar.js +2 -0
  249. package/components/pagination/PaginationBar.js.map +1 -1
  250. package/components/step-indicator/StepIndicatorContext.js +2 -0
  251. package/components/step-indicator/StepIndicatorContext.js.map +1 -1
  252. package/components/step-indicator/StepIndicatorItem.js +4 -2
  253. package/components/step-indicator/StepIndicatorItem.js.map +1 -1
  254. package/components/step-indicator/StepIndicatorList.js +2 -0
  255. package/components/step-indicator/StepIndicatorList.js.map +1 -1
  256. package/components/step-indicator/StepIndicatorModal.js +2 -0
  257. package/components/step-indicator/StepIndicatorModal.js.map +1 -1
  258. package/components/step-indicator/StepIndicatorSidebar.js +2 -0
  259. package/components/step-indicator/StepIndicatorSidebar.js.map +1 -1
  260. package/components/step-indicator/StepIndicatorTriggerButton.js +2 -0
  261. package/components/step-indicator/StepIndicatorTriggerButton.js.map +1 -1
  262. package/components/table/style/themes/dnb-table-theme-sbanken.css +1 -0
  263. package/components/table/style/themes/dnb-table-theme-sbanken.min.css +1 -1
  264. package/components/table/style/themes/dnb-table-theme-sbanken.scss +1 -0
  265. package/components/toggle-button/style/themes/dnb-toggle-button-theme-ui.scss +1 -1
  266. package/components/tooltip/TooltipWithEvents.js.map +1 -1
  267. package/components/upload/UploadContext.js +2 -0
  268. package/components/upload/UploadContext.js.map +1 -1
  269. package/components/upload/UploadFileInput.js +2 -0
  270. package/components/upload/UploadFileInput.js.map +1 -1
  271. package/components/upload/UploadFileListCell.js +2 -0
  272. package/components/upload/UploadFileListCell.js.map +1 -1
  273. package/elements/lists/Dl.d.ts +1 -1
  274. package/elements/lists/Dl.js.map +1 -1
  275. package/elements/typography/style/dnb-typography.scss +1 -1
  276. package/elements/typography/style/typography-mixins.scss +2 -2
  277. package/es/components/accordion/Accordion.js +2 -0
  278. package/es/components/accordion/Accordion.js.map +1 -1
  279. package/es/components/accordion/AccordionGroup.js +2 -0
  280. package/es/components/accordion/AccordionGroup.js.map +1 -1
  281. package/es/components/accordion/AccordionHeader.js +6 -15
  282. package/es/components/accordion/AccordionHeader.js.map +1 -1
  283. package/es/components/accordion/style/dnb-accordion.css +2 -2
  284. package/es/components/accordion/style/dnb-accordion.min.css +1 -1
  285. package/es/components/accordion/style/dnb-accordion.scss +3 -8
  286. package/es/components/accordion/style/themes/dnb-accordion-theme-sbanken.css +1 -1
  287. package/es/components/accordion/style/themes/dnb-accordion-theme-sbanken.min.css +1 -1
  288. package/es/components/accordion/style/themes/dnb-accordion-theme-sbanken.scss +1 -1
  289. package/es/components/anchor/Anchor.js.map +1 -1
  290. package/es/components/anchor/style/themes/dnb-anchor-theme-sbanken.css +2 -2
  291. package/es/components/anchor/style/themes/dnb-anchor-theme-sbanken.min.css +1 -1
  292. package/es/components/anchor/style/themes/dnb-anchor-theme-sbanken.scss +1 -2
  293. package/es/components/autocomplete/Autocomplete.d.ts +2 -2
  294. package/es/components/autocomplete/Autocomplete.js +42 -17
  295. package/es/components/autocomplete/Autocomplete.js.map +1 -1
  296. package/es/components/breadcrumb/Breadcrumb.js +2 -0
  297. package/es/components/breadcrumb/Breadcrumb.js.map +1 -1
  298. package/es/components/button/style/themes/dnb-button-theme-eiendom.scss +1 -1
  299. package/es/components/button/style/themes/dnb-button-theme-sbanken.css +2 -2
  300. package/es/components/button/style/themes/dnb-button-theme-sbanken.min.css +1 -1
  301. package/es/components/button/style/themes/dnb-button-theme-sbanken.scss +2 -2
  302. package/es/components/card/Card.js +2 -2
  303. package/es/components/card/Card.js.map +1 -1
  304. package/es/components/dialog/Dialog.js +2 -0
  305. package/es/components/dialog/Dialog.js.map +1 -1
  306. package/es/components/dialog/DialogContent.js +2 -0
  307. package/es/components/dialog/DialogContent.js.map +1 -1
  308. package/es/components/dialog/parts/DialogAction.js +2 -0
  309. package/es/components/dialog/parts/DialogAction.js.map +1 -1
  310. package/es/components/drawer/Drawer.js +2 -0
  311. package/es/components/drawer/Drawer.js.map +1 -1
  312. package/es/components/drawer/DrawerContent.js +2 -0
  313. package/es/components/drawer/DrawerContent.js.map +1 -1
  314. package/es/components/drawer/parts/DrawerContentContext.js +2 -0
  315. package/es/components/drawer/parts/DrawerContentContext.js.map +1 -1
  316. package/es/components/flex/Container.js +6 -4
  317. package/es/components/flex/Container.js.map +1 -1
  318. package/es/components/flex/utils.js +2 -2
  319. package/es/components/flex/utils.js.map +1 -1
  320. package/es/components/form-row/style/dnb-form-row.scss +1 -1
  321. package/es/components/icon/style/dnb-icon.scss +1 -1
  322. package/es/components/input-masked/InputMasked.d.ts +1 -1
  323. package/es/components/input-masked/MultiInputMask.d.ts +3 -3
  324. package/es/components/input-masked/MultiInputMask.js +3 -1
  325. package/es/components/input-masked/MultiInputMask.js.map +1 -1
  326. package/es/components/input-masked/hooks/useHandleCursorPosition.js +2 -0
  327. package/es/components/input-masked/hooks/useHandleCursorPosition.js.map +1 -1
  328. package/es/components/input-masked/hooks/useMultiInputValues.js +2 -0
  329. package/es/components/input-masked/hooks/useMultiInputValues.js.map +1 -1
  330. package/es/components/number-format/NumberUtils.js.map +1 -1
  331. package/es/components/number-format/useNumberFormat.js +2 -0
  332. package/es/components/number-format/useNumberFormat.js.map +1 -1
  333. package/es/components/pagination/PaginationBar.js +2 -0
  334. package/es/components/pagination/PaginationBar.js.map +1 -1
  335. package/es/components/step-indicator/StepIndicatorContext.js +2 -0
  336. package/es/components/step-indicator/StepIndicatorContext.js.map +1 -1
  337. package/es/components/step-indicator/StepIndicatorItem.js +4 -2
  338. package/es/components/step-indicator/StepIndicatorItem.js.map +1 -1
  339. package/es/components/step-indicator/StepIndicatorList.js +2 -0
  340. package/es/components/step-indicator/StepIndicatorList.js.map +1 -1
  341. package/es/components/step-indicator/StepIndicatorModal.js +2 -0
  342. package/es/components/step-indicator/StepIndicatorModal.js.map +1 -1
  343. package/es/components/step-indicator/StepIndicatorSidebar.js +2 -0
  344. package/es/components/step-indicator/StepIndicatorSidebar.js.map +1 -1
  345. package/es/components/step-indicator/StepIndicatorTriggerButton.js +2 -0
  346. package/es/components/step-indicator/StepIndicatorTriggerButton.js.map +1 -1
  347. package/es/components/table/style/themes/dnb-table-theme-sbanken.css +1 -0
  348. package/es/components/table/style/themes/dnb-table-theme-sbanken.min.css +1 -1
  349. package/es/components/table/style/themes/dnb-table-theme-sbanken.scss +1 -0
  350. package/es/components/toggle-button/style/themes/dnb-toggle-button-theme-ui.scss +1 -1
  351. package/es/components/tooltip/TooltipWithEvents.js.map +1 -1
  352. package/es/components/upload/UploadContext.js +2 -0
  353. package/es/components/upload/UploadContext.js.map +1 -1
  354. package/es/components/upload/UploadFileInput.js +2 -0
  355. package/es/components/upload/UploadFileInput.js.map +1 -1
  356. package/es/components/upload/UploadFileListCell.js +2 -0
  357. package/es/components/upload/UploadFileListCell.js.map +1 -1
  358. package/es/elements/lists/Dl.d.ts +1 -1
  359. package/es/elements/lists/Dl.js.map +1 -1
  360. package/es/elements/typography/style/dnb-typography.scss +1 -1
  361. package/es/elements/typography/style/typography-mixins.scss +2 -2
  362. package/es/extensions/forms/DataContext/At/At.js +2 -0
  363. package/es/extensions/forms/DataContext/At/At.js.map +1 -1
  364. package/es/extensions/forms/DataContext/Provider/Provider.js +6 -3
  365. package/es/extensions/forms/DataContext/Provider/Provider.js.map +1 -1
  366. package/es/extensions/forms/Field/ArraySelection/ArraySelection.js +12 -9
  367. package/es/extensions/forms/Field/ArraySelection/ArraySelection.js.map +1 -1
  368. package/es/extensions/forms/Field/BankAccountNumber/BankAccountNumber.js +6 -3
  369. package/es/extensions/forms/Field/BankAccountNumber/BankAccountNumber.js.map +1 -1
  370. package/es/extensions/forms/Field/Boolean/Boolean.js +4 -2
  371. package/es/extensions/forms/Field/Boolean/Boolean.js.map +1 -1
  372. package/es/extensions/forms/Field/Currency/Currency.js +3 -2
  373. package/es/extensions/forms/Field/Currency/Currency.js.map +1 -1
  374. package/es/extensions/forms/Field/Date/Date.js +3 -1
  375. package/es/extensions/forms/Field/Date/Date.js.map +1 -1
  376. package/es/extensions/forms/Field/Email/Email.js +6 -3
  377. package/es/extensions/forms/Field/Email/Email.js.map +1 -1
  378. package/es/extensions/forms/Field/NationalIdentityNumber/NationalIdentityNumber.js +6 -3
  379. package/es/extensions/forms/Field/NationalIdentityNumber/NationalIdentityNumber.js.map +1 -1
  380. package/es/extensions/forms/Field/Number/Number.js +3 -2
  381. package/es/extensions/forms/Field/Number/Number.js.map +1 -1
  382. package/es/extensions/forms/Field/Option/Option.js +1 -1
  383. package/es/extensions/forms/Field/Option/Option.js.map +1 -1
  384. package/es/extensions/forms/Field/OrganizationNumber/OrganizationNumber.js +6 -3
  385. package/es/extensions/forms/Field/OrganizationNumber/OrganizationNumber.js.map +1 -1
  386. package/es/extensions/forms/Field/PhoneNumber/PhoneNumber.d.ts +5 -0
  387. package/es/extensions/forms/Field/PhoneNumber/PhoneNumber.js +48 -16
  388. package/es/extensions/forms/Field/PhoneNumber/PhoneNumber.js.map +1 -1
  389. package/es/extensions/forms/Field/PostalCodeAndCity/PostalCodeAndCity.js +7 -4
  390. package/es/extensions/forms/Field/PostalCodeAndCity/PostalCodeAndCity.js.map +1 -1
  391. package/es/extensions/forms/Field/SelectCountry/SelectCountry.js +13 -8
  392. package/es/extensions/forms/Field/SelectCountry/SelectCountry.js.map +1 -1
  393. package/es/extensions/forms/Field/Selection/Selection.js +30 -20
  394. package/es/extensions/forms/Field/Selection/Selection.js.map +1 -1
  395. package/es/extensions/forms/Field/String/String.js +11 -9
  396. package/es/extensions/forms/Field/String/String.js.map +1 -1
  397. package/es/extensions/forms/Field/Toggle/Toggle.js +6 -4
  398. package/es/extensions/forms/Field/Toggle/Toggle.js.map +1 -1
  399. package/es/extensions/forms/FieldBlock/FieldBlock.js +2 -0
  400. package/es/extensions/forms/FieldBlock/FieldBlock.js.map +1 -1
  401. package/es/extensions/forms/Form/SubmitButton/SubmitButton.js +2 -0
  402. package/es/extensions/forms/Form/SubmitButton/SubmitButton.js.map +1 -1
  403. package/es/extensions/forms/Iterate/Array/Array.js +2 -2
  404. package/es/extensions/forms/Iterate/Array/Array.js.map +1 -1
  405. package/es/extensions/forms/Iterate/ArrayPushButton/ArrayPushButton.js +4 -2
  406. package/es/extensions/forms/Iterate/ArrayPushButton/ArrayPushButton.js.map +1 -1
  407. package/es/extensions/forms/Iterate/ArrayRemoveElementButton/ArrayRemoveElementButton.js +3 -1
  408. package/es/extensions/forms/Iterate/ArrayRemoveElementButton/ArrayRemoveElementButton.js.map +1 -1
  409. package/es/extensions/forms/StepsLayout/NextButton/NextButton.js +2 -0
  410. package/es/extensions/forms/StepsLayout/NextButton/NextButton.js.map +1 -1
  411. package/es/extensions/forms/StepsLayout/PreviousButton/PreviousButton.js +2 -0
  412. package/es/extensions/forms/StepsLayout/PreviousButton/PreviousButton.js.map +1 -1
  413. package/es/extensions/forms/StepsLayout/Step/Step.js +2 -0
  414. package/es/extensions/forms/StepsLayout/Step/Step.js.map +1 -1
  415. package/es/extensions/forms/StepsLayout/StepsLayout.js +4 -1
  416. package/es/extensions/forms/StepsLayout/StepsLayout.js.map +1 -1
  417. package/es/extensions/forms/Value/BankAccountNumber/BankAccountNumber.js +4 -1
  418. package/es/extensions/forms/Value/BankAccountNumber/BankAccountNumber.js.map +1 -1
  419. package/es/extensions/forms/Value/Boolean/Boolean.js +2 -0
  420. package/es/extensions/forms/Value/Boolean/Boolean.js.map +1 -1
  421. package/es/extensions/forms/Value/Currency/Currency.js +3 -2
  422. package/es/extensions/forms/Value/Currency/Currency.js.map +1 -1
  423. package/es/extensions/forms/Value/Date/Date.js +4 -1
  424. package/es/extensions/forms/Value/Date/Date.js.map +1 -1
  425. package/es/extensions/forms/Value/Email/Email.js +4 -1
  426. package/es/extensions/forms/Value/Email/Email.js.map +1 -1
  427. package/es/extensions/forms/Value/NationalIdentityNumber/NationalIdentityNumber.js +4 -1
  428. package/es/extensions/forms/Value/NationalIdentityNumber/NationalIdentityNumber.js.map +1 -1
  429. package/es/extensions/forms/Value/PhoneNumber/PhoneNumber.js +4 -1
  430. package/es/extensions/forms/Value/PhoneNumber/PhoneNumber.js.map +1 -1
  431. package/es/extensions/forms/ValueBlock/ValueBlock.js +1 -1
  432. package/es/extensions/forms/ValueBlock/ValueBlock.js.map +1 -1
  433. package/es/extensions/forms/Visibility/Visibility.js +2 -0
  434. package/es/extensions/forms/Visibility/Visibility.js.map +1 -1
  435. package/es/extensions/forms/hooks/useDataValue.js +22 -17
  436. package/es/extensions/forms/hooks/useDataValue.js.map +1 -1
  437. package/es/extensions/forms/types.js +6 -6
  438. package/es/extensions/forms/types.js.map +1 -1
  439. package/es/extensions/forms/utils/ajv.js +3 -2
  440. package/es/extensions/forms/utils/ajv.js.map +1 -1
  441. package/es/extensions/forms/utils/numbers.js +2 -2
  442. package/es/extensions/forms/utils/numbers.js.map +1 -1
  443. package/es/extensions/forms/utils/useWasChanged.js +9 -6
  444. package/es/extensions/forms/utils/useWasChanged.js.map +1 -1
  445. package/es/fragments/drawer-list/DrawerListHelpers.js +1 -1
  446. package/es/fragments/drawer-list/DrawerListHelpers.js.map +1 -1
  447. package/es/fragments/drawer-list/DrawerListProvider.js.map +1 -1
  448. package/es/fragments/drawer-list/style/themes/dnb-drawer-list-theme-sbanken.scss +1 -1
  449. package/es/fragments/drawer-list/style/themes/dnb-drawer-list-theme-ui.scss +2 -2
  450. package/es/shared/Eufemia.d.ts +1 -1
  451. package/es/shared/Eufemia.js +2 -2
  452. package/es/shared/Eufemia.js.map +1 -1
  453. package/es/style/dnb-ui-components.css +2 -2
  454. package/es/style/dnb-ui-components.min.css +1 -1
  455. package/es/style/themes/theme-eiendom/eiendom-theme-components.css +2 -2
  456. package/es/style/themes/theme-eiendom/eiendom-theme-components.min.css +1 -1
  457. package/es/style/themes/theme-sbanken/fonts.scss +5 -4
  458. package/es/style/themes/theme-sbanken/properties.js +2 -2
  459. package/es/style/themes/theme-sbanken/properties.js.map +1 -1
  460. package/es/style/themes/theme-sbanken/sbanken-theme-basis.css +3 -2
  461. package/es/style/themes/theme-sbanken/sbanken-theme-basis.min.css +1 -1
  462. package/es/style/themes/theme-sbanken/sbanken-theme-components.css +8 -7
  463. package/es/style/themes/theme-sbanken/sbanken-theme-components.min.css +4 -4
  464. package/es/style/themes/theme-sbanken/theme-mapping.scss +2 -1
  465. package/es/style/themes/theme-ui/ui-theme-components.css +2 -2
  466. package/es/style/themes/theme-ui/ui-theme-components.min.css +1 -1
  467. package/esm/dnb-ui-basis.min.mjs +1 -1
  468. package/esm/dnb-ui-components.min.mjs +1 -1
  469. package/esm/dnb-ui-elements.min.mjs +1 -1
  470. package/esm/dnb-ui-extensions.min.mjs +2 -2
  471. package/esm/dnb-ui-lib.min.mjs +1 -1
  472. package/extensions/forms/DataContext/At/At.js +2 -0
  473. package/extensions/forms/DataContext/At/At.js.map +1 -1
  474. package/extensions/forms/DataContext/Provider/Provider.js +6 -3
  475. package/extensions/forms/DataContext/Provider/Provider.js.map +1 -1
  476. package/extensions/forms/Field/ArraySelection/ArraySelection.js +12 -9
  477. package/extensions/forms/Field/ArraySelection/ArraySelection.js.map +1 -1
  478. package/extensions/forms/Field/BankAccountNumber/BankAccountNumber.js +6 -3
  479. package/extensions/forms/Field/BankAccountNumber/BankAccountNumber.js.map +1 -1
  480. package/extensions/forms/Field/Boolean/Boolean.js +4 -2
  481. package/extensions/forms/Field/Boolean/Boolean.js.map +1 -1
  482. package/extensions/forms/Field/Currency/Currency.js +3 -2
  483. package/extensions/forms/Field/Currency/Currency.js.map +1 -1
  484. package/extensions/forms/Field/Date/Date.js +3 -1
  485. package/extensions/forms/Field/Date/Date.js.map +1 -1
  486. package/extensions/forms/Field/Email/Email.js +6 -3
  487. package/extensions/forms/Field/Email/Email.js.map +1 -1
  488. package/extensions/forms/Field/NationalIdentityNumber/NationalIdentityNumber.js +6 -3
  489. package/extensions/forms/Field/NationalIdentityNumber/NationalIdentityNumber.js.map +1 -1
  490. package/extensions/forms/Field/Number/Number.js +3 -2
  491. package/extensions/forms/Field/Number/Number.js.map +1 -1
  492. package/extensions/forms/Field/Option/Option.js +1 -1
  493. package/extensions/forms/Field/Option/Option.js.map +1 -1
  494. package/extensions/forms/Field/OrganizationNumber/OrganizationNumber.js +6 -3
  495. package/extensions/forms/Field/OrganizationNumber/OrganizationNumber.js.map +1 -1
  496. package/extensions/forms/Field/PhoneNumber/PhoneNumber.d.ts +5 -0
  497. package/extensions/forms/Field/PhoneNumber/PhoneNumber.js +59 -18
  498. package/extensions/forms/Field/PhoneNumber/PhoneNumber.js.map +1 -1
  499. package/extensions/forms/Field/PostalCodeAndCity/PostalCodeAndCity.js +7 -4
  500. package/extensions/forms/Field/PostalCodeAndCity/PostalCodeAndCity.js.map +1 -1
  501. package/extensions/forms/Field/SelectCountry/SelectCountry.js +13 -8
  502. package/extensions/forms/Field/SelectCountry/SelectCountry.js.map +1 -1
  503. package/extensions/forms/Field/Selection/Selection.js +30 -20
  504. package/extensions/forms/Field/Selection/Selection.js.map +1 -1
  505. package/extensions/forms/Field/String/String.js +11 -9
  506. package/extensions/forms/Field/String/String.js.map +1 -1
  507. package/extensions/forms/Field/Toggle/Toggle.js +6 -4
  508. package/extensions/forms/Field/Toggle/Toggle.js.map +1 -1
  509. package/extensions/forms/FieldBlock/FieldBlock.js +2 -0
  510. package/extensions/forms/FieldBlock/FieldBlock.js.map +1 -1
  511. package/extensions/forms/Form/SubmitButton/SubmitButton.js +2 -0
  512. package/extensions/forms/Form/SubmitButton/SubmitButton.js.map +1 -1
  513. package/extensions/forms/Iterate/Array/Array.js +2 -2
  514. package/extensions/forms/Iterate/Array/Array.js.map +1 -1
  515. package/extensions/forms/Iterate/ArrayPushButton/ArrayPushButton.js +4 -2
  516. package/extensions/forms/Iterate/ArrayPushButton/ArrayPushButton.js.map +1 -1
  517. package/extensions/forms/Iterate/ArrayRemoveElementButton/ArrayRemoveElementButton.js +3 -1
  518. package/extensions/forms/Iterate/ArrayRemoveElementButton/ArrayRemoveElementButton.js.map +1 -1
  519. package/extensions/forms/StepsLayout/NextButton/NextButton.js +2 -0
  520. package/extensions/forms/StepsLayout/NextButton/NextButton.js.map +1 -1
  521. package/extensions/forms/StepsLayout/PreviousButton/PreviousButton.js +2 -0
  522. package/extensions/forms/StepsLayout/PreviousButton/PreviousButton.js.map +1 -1
  523. package/extensions/forms/StepsLayout/Step/Step.js +2 -0
  524. package/extensions/forms/StepsLayout/Step/Step.js.map +1 -1
  525. package/extensions/forms/StepsLayout/StepsLayout.js +4 -1
  526. package/extensions/forms/StepsLayout/StepsLayout.js.map +1 -1
  527. package/extensions/forms/Value/BankAccountNumber/BankAccountNumber.js +4 -1
  528. package/extensions/forms/Value/BankAccountNumber/BankAccountNumber.js.map +1 -1
  529. package/extensions/forms/Value/Boolean/Boolean.js +2 -0
  530. package/extensions/forms/Value/Boolean/Boolean.js.map +1 -1
  531. package/extensions/forms/Value/Currency/Currency.js +3 -2
  532. package/extensions/forms/Value/Currency/Currency.js.map +1 -1
  533. package/extensions/forms/Value/Date/Date.js +4 -1
  534. package/extensions/forms/Value/Date/Date.js.map +1 -1
  535. package/extensions/forms/Value/Email/Email.js +4 -1
  536. package/extensions/forms/Value/Email/Email.js.map +1 -1
  537. package/extensions/forms/Value/NationalIdentityNumber/NationalIdentityNumber.js +4 -1
  538. package/extensions/forms/Value/NationalIdentityNumber/NationalIdentityNumber.js.map +1 -1
  539. package/extensions/forms/Value/PhoneNumber/PhoneNumber.js +4 -1
  540. package/extensions/forms/Value/PhoneNumber/PhoneNumber.js.map +1 -1
  541. package/extensions/forms/ValueBlock/ValueBlock.js +1 -1
  542. package/extensions/forms/ValueBlock/ValueBlock.js.map +1 -1
  543. package/extensions/forms/Visibility/Visibility.js +2 -0
  544. package/extensions/forms/Visibility/Visibility.js.map +1 -1
  545. package/extensions/forms/hooks/useDataValue.js +22 -17
  546. package/extensions/forms/hooks/useDataValue.js.map +1 -1
  547. package/extensions/forms/types.js +6 -6
  548. package/extensions/forms/types.js.map +1 -1
  549. package/extensions/forms/utils/ajv.js +3 -2
  550. package/extensions/forms/utils/ajv.js.map +1 -1
  551. package/extensions/forms/utils/numbers.js +2 -2
  552. package/extensions/forms/utils/numbers.js.map +1 -1
  553. package/extensions/forms/utils/useWasChanged.js +9 -6
  554. package/extensions/forms/utils/useWasChanged.js.map +1 -1
  555. package/fragments/drawer-list/DrawerListHelpers.js +1 -1
  556. package/fragments/drawer-list/DrawerListHelpers.js.map +1 -1
  557. package/fragments/drawer-list/DrawerListProvider.js.map +1 -1
  558. package/fragments/drawer-list/style/themes/dnb-drawer-list-theme-sbanken.scss +1 -1
  559. package/fragments/drawer-list/style/themes/dnb-drawer-list-theme-ui.scss +2 -2
  560. package/package.json +11 -1
  561. package/shared/Eufemia.d.ts +1 -1
  562. package/shared/Eufemia.js +2 -2
  563. package/shared/Eufemia.js.map +1 -1
  564. package/style/dnb-ui-components.css +2 -2
  565. package/style/dnb-ui-components.min.css +1 -1
  566. package/style/themes/theme-eiendom/eiendom-theme-components.css +2 -2
  567. package/style/themes/theme-eiendom/eiendom-theme-components.min.css +1 -1
  568. package/style/themes/theme-sbanken/fonts.scss +5 -4
  569. package/style/themes/theme-sbanken/properties.js +2 -2
  570. package/style/themes/theme-sbanken/properties.js.map +1 -1
  571. package/style/themes/theme-sbanken/sbanken-theme-basis.css +3 -2
  572. package/style/themes/theme-sbanken/sbanken-theme-basis.min.css +1 -1
  573. package/style/themes/theme-sbanken/sbanken-theme-components.css +8 -7
  574. package/style/themes/theme-sbanken/sbanken-theme-components.min.css +4 -4
  575. package/style/themes/theme-sbanken/theme-mapping.scss +2 -1
  576. package/style/themes/theme-ui/ui-theme-components.css +2 -2
  577. package/style/themes/theme-ui/ui-theme-components.min.css +1 -1
  578. package/umd/dnb-ui-basis.min.js +1 -1
  579. package/umd/dnb-ui-components.min.js +1 -1
  580. package/umd/dnb-ui-elements.min.js +1 -1
  581. package/umd/dnb-ui-extensions.min.js +2 -2
  582. package/umd/dnb-ui-lib.min.js +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"StepsLayout.js","names":["React","useContext","useState","useCallback","classnames","Space","StepIndicator","makeUniqueId","DataContext","Step","StepsContext","NextButton","PreviousButton","Buttons","StepsLayout","props","className","id","mode","scrollTopOnStepChange","initialActiveIndex","onStepChange","children","rest","_objectWithoutProperties","_excluded","dataContext","activeIndex","setActiveIndex","handlePrevious","_window","window","scrollTo","top","behavior","handleNext","hasErrors","_window2","setShowAllErrors","stepIndicatorData","Children","map","child","isValidElement","type","Error","title","handleChange","_ref","current_step","createElement","Provider","value","_extends","Sidebar","sidebar_id","bottom","data","no_animation","on_change","i","cloneElement","index","_supportsSpacingProps"],"sources":["../../../../../src/extensions/forms/StepsLayout/StepsLayout.tsx"],"sourcesContent":["import React, { useContext, useState, useCallback } from 'react'\nimport classnames from 'classnames'\nimport { Space, StepIndicator } from '../../../components'\nimport { makeUniqueId } from '../../../shared/component-helper'\nimport { ComponentProps } from '../types'\nimport DataContext from '../DataContext/Context'\nimport Step, { Props as StepProps } from './Step'\nimport StepsContext from './StepsContext'\nimport NextButton from './NextButton'\nimport PreviousButton from './PreviousButton'\nimport Buttons from './Buttons'\n\nexport type Props = ComponentProps & {\n id?: string\n mode?: 'static' | 'strict' | 'loose'\n scrollTopOnStepChange?: boolean\n initialActiveIndex?: number\n onStepChange?: (index: number) => void\n children: React.ReactNode\n}\n\nfunction StepsLayout(props: Props) {\n const {\n className,\n id = makeUniqueId(),\n mode = 'loose',\n scrollTopOnStepChange,\n initialActiveIndex = 0,\n onStepChange,\n children,\n ...rest\n } = props\n const dataContext = useContext(DataContext)\n const [activeIndex, setActiveIndex] =\n useState<number>(initialActiveIndex)\n\n const handlePrevious = useCallback(() => {\n setActiveIndex((activeIndex) => {\n onStepChange?.(activeIndex - 1)\n return activeIndex - 1\n })\n if (scrollTopOnStepChange) {\n window?.scrollTo({ top: 0, behavior: 'smooth' })\n }\n }, [scrollTopOnStepChange, onStepChange])\n\n const handleNext = useCallback(() => {\n if (!dataContext.hasErrors()) {\n setActiveIndex((activeIndex) => {\n onStepChange?.(activeIndex + 1)\n return activeIndex + 1\n })\n if (scrollTopOnStepChange) {\n window?.scrollTo({ top: 0, behavior: 'smooth' })\n }\n } else {\n dataContext.setShowAllErrors(true)\n }\n }, [dataContext, scrollTopOnStepChange, onStepChange])\n\n const stepIndicatorData = React.Children.map(children, (child) => {\n if (!React.isValidElement(child) || child.type !== Step) {\n throw new Error('Only Step can be children of StepsLayout')\n }\n return child.props.title ?? 'Title missing'\n }) as string[]\n\n const handleChange = useCallback(({ current_step }) => {\n setActiveIndex(current_step)\n }, [])\n\n return (\n <StepsContext.Provider\n value={{\n activeIndex,\n handlePrevious,\n handleNext,\n }}\n >\n <Space\n className={classnames('dnb-forms-steps-layout', className)}\n {...rest}\n >\n <aside className=\"dnb-forms-steps-layout__sidebar\">\n <StepIndicator.Sidebar sidebar_id={id} />\n <StepIndicator\n bottom\n current_step={activeIndex}\n data={stepIndicatorData}\n mode={mode}\n no_animation\n on_change={handleChange}\n sidebar_id={id}\n title=\"\"\n />\n </aside>\n <div className=\"dnb-forms-steps-layout__contents\">\n {React.Children.map(children, (child, i) => {\n if (React.isValidElement(child) && child.type === Step) {\n return React.cloneElement(\n child as React.ReactElement<StepProps>,\n {\n index: i,\n }\n )\n }\n return child\n })}\n </div>\n </Space>\n </StepsContext.Provider>\n )\n}\n\nStepsLayout._supportsSpacingProps = true\n\nStepsLayout.Step = Step\nStepsLayout.NextButton = NextButton\nStepsLayout.PreviousButton = PreviousButton\nStepsLayout.Buttons = Buttons\n\nexport default StepsLayout\n"],"mappings":";;;AAAA,OAAOA,KAAK,IAAIC,UAAU,EAAEC,QAAQ,EAAEC,WAAW,QAAQ,OAAO;AAChE,OAAOC,UAAU,MAAM,YAAY;AACnC,SAASC,KAAK,EAAEC,aAAa,QAAQ,qBAAqB;AAC1D,SAASC,YAAY,QAAQ,kCAAkC;AAE/D,OAAOC,WAAW,MAAM,wBAAwB;AAChD,OAAOC,IAAI,MAA8B,QAAQ;AACjD,OAAOC,YAAY,MAAM,gBAAgB;AACzC,OAAOC,UAAU,MAAM,cAAc;AACrC,OAAOC,cAAc,MAAM,kBAAkB;AAC7C,OAAOC,OAAO,MAAM,WAAW;AAW/B,SAASC,WAAWA,CAACC,KAAY,EAAE;EACjC,MAAM;MACJC,SAAS;MACTC,EAAE,GAAGV,YAAY,CAAC,CAAC;MACnBW,IAAI,GAAG,OAAO;MACdC,qBAAqB;MACrBC,kBAAkB,GAAG,CAAC;MACtBC,YAAY;MACZC;IAEF,CAAC,GAAGP,KAAK;IADJQ,IAAI,GAAAC,wBAAA,CACLT,KAAK,EAAAU,SAAA;EACT,MAAMC,WAAW,GAAGzB,UAAU,CAACO,WAAW,CAAC;EAC3C,MAAM,CAACmB,WAAW,EAAEC,cAAc,CAAC,GACjC1B,QAAQ,CAASkB,kBAAkB,CAAC;EAEtC,MAAMS,cAAc,GAAG1B,WAAW,CAAC,MAAM;IACvCyB,cAAc,CAAED,WAAW,IAAK;MAC9BN,YAAY,aAAZA,YAAY,uBAAZA,YAAY,CAAGM,WAAW,GAAG,CAAC,CAAC;MAC/B,OAAOA,WAAW,GAAG,CAAC;IACxB,CAAC,CAAC;IACF,IAAIR,qBAAqB,EAAE;MAAA,IAAAW,OAAA;MACzB,CAAAA,OAAA,GAAAC,MAAM,cAAAD,OAAA,uBAANA,OAAA,CAAQE,QAAQ,CAAC;QAAEC,GAAG,EAAE,CA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,eAAeC,WAAW"}
1
+ {"version":3,"file":"StepsLayout.js","names":["React","useContext","useState","useCallback","classnames","Space","StepIndicator","makeUniqueId","DataContext","Step","StepsContext","NextButton","PreviousButton","Buttons","StepsLayout","props","className","id","mode","scrollTopOnStepChange","initialActiveIndex","onStepChange","children","rest","_objectWithoutProperties","_excluded","dataContext","activeIndex","setActiveIndex","handlePrevious","_window","window","scrollTo","top","behavior","handleNext","hasErrors","_window2","setShowAllErrors","stepIndicatorData","Children","map","child","_child$props$title","isValidElement","type","Error","title","handleChange","_ref","current_step","createElement","Provider","value","_extends","Sidebar","sidebar_id","bottom","data","no_animation","on_change","i","cloneElement","index","_supportsSpacingProps"],"sources":["../../../../../src/extensions/forms/StepsLayout/StepsLayout.tsx"],"sourcesContent":["import React, { useContext, useState, useCallback } from 'react'\nimport classnames from 'classnames'\nimport { Space, StepIndicator } from '../../../components'\nimport { makeUniqueId } from '../../../shared/component-helper'\nimport { ComponentProps } from '../types'\nimport DataContext from '../DataContext/Context'\nimport Step, { Props as StepProps } from './Step'\nimport StepsContext from './StepsContext'\nimport NextButton from './NextButton'\nimport PreviousButton from './PreviousButton'\nimport Buttons from './Buttons'\n\nexport type Props = ComponentProps & {\n id?: string\n mode?: 'static' | 'strict' | 'loose'\n scrollTopOnStepChange?: boolean\n initialActiveIndex?: number\n onStepChange?: (index: number) => void\n children: React.ReactNode\n}\n\nfunction StepsLayout(props: Props) {\n const {\n className,\n id = makeUniqueId(),\n mode = 'loose',\n scrollTopOnStepChange,\n initialActiveIndex = 0,\n onStepChange,\n children,\n ...rest\n } = props\n const dataContext = useContext(DataContext)\n const [activeIndex, setActiveIndex] =\n useState<number>(initialActiveIndex)\n\n const handlePrevious = useCallback(() => {\n setActiveIndex((activeIndex) => {\n onStepChange?.(activeIndex - 1)\n return activeIndex - 1\n })\n if (scrollTopOnStepChange) {\n window?.scrollTo({ top: 0, behavior: 'smooth' })\n }\n }, [scrollTopOnStepChange, onStepChange])\n\n const handleNext = useCallback(() => {\n if (!dataContext.hasErrors()) {\n setActiveIndex((activeIndex) => {\n onStepChange?.(activeIndex + 1)\n return activeIndex + 1\n })\n if (scrollTopOnStepChange) {\n window?.scrollTo({ top: 0, behavior: 'smooth' })\n }\n } else {\n dataContext.setShowAllErrors(true)\n }\n }, [dataContext, scrollTopOnStepChange, onStepChange])\n\n const stepIndicatorData = React.Children.map(children, (child) => {\n if (!React.isValidElement(child) || child.type !== Step) {\n throw new Error('Only Step can be children of StepsLayout')\n }\n return child.props.title ?? 'Title missing'\n }) as string[]\n\n const handleChange = useCallback(({ current_step }) => {\n setActiveIndex(current_step)\n }, [])\n\n return (\n <StepsContext.Provider\n value={{\n activeIndex,\n handlePrevious,\n handleNext,\n }}\n >\n <Space\n className={classnames('dnb-forms-steps-layout', className)}\n {...rest}\n >\n <aside className=\"dnb-forms-steps-layout__sidebar\">\n <StepIndicator.Sidebar sidebar_id={id} />\n <StepIndicator\n bottom\n current_step={activeIndex}\n data={stepIndicatorData}\n mode={mode}\n no_animation\n on_change={handleChange}\n sidebar_id={id}\n title=\"\"\n />\n </aside>\n <div className=\"dnb-forms-steps-layout__contents\">\n {React.Children.map(children, (child, i) => {\n if (React.isValidElement(child) && child.type === Step) {\n return React.cloneElement(\n child as React.ReactElement<StepProps>,\n {\n index: i,\n }\n )\n }\n return child\n })}\n </div>\n </Space>\n </StepsContext.Provider>\n )\n}\n\nStepsLayout._supportsSpacingProps = true\n\nStepsLayout.Step = Step\nStepsLayout.NextButton = NextButton\nStepsLayout.PreviousButton = PreviousButton\nStepsLayout.Buttons = Buttons\n\nexport default StepsLayout\n"],"mappings":";;;;;AAAA,OAAOA,KAAK,IAAIC,UAAU,EAAEC,QAAQ,EAAEC,WAAW,QAAQ,OAAO;AAChE,OAAOC,UAAU,MAAM,YAAY;AACnC,SAASC,KAAK,EAAEC,aAAa,QAAQ,qBAAqB;AAC1D,SAASC,YAAY,QAAQ,kCAAkC;AAE/D,OAAOC,WAAW,MAAM,wBAAwB;AAChD,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AS,EAAC;EAAiC,GAChDhB,KAAA,CAAAmD,aAAA,CAAC7C,aAAa,CAACiD,OAAO;IAACC,UAAU,EAAEvC;EAAG,CAAE,CAAC,EACzCjB,KAAA,CAAAmD,aAAA,CAAC7C,aAAa;IACZmD,MAAM;IACNP,YAAY,EAAEvB,WAAY;IAC1B+B,IAAI,EAAEnB,iBAAkB;IACxBrB,IAAI,EAAEA,IAAK;IACXyC,YAAY;IACZC,SAAS,EAAEZ,YAAa;IACxBQ,UAAU,EAAEvC,EAAG;IACf8B,KAAK,EAAC;EAAE,CACT,CACI,CAAC,EACR/C,KAAA,CAAAmD,aAAA;IAAKnC,SAAS,EAAC;EAAkC,GAC9ChB,KAAK,CAACwC,QAAQ,CAACC,GAAG,CAACnB,QAAQ,EAAE,CAACoB,KAAK,EAAEmB,CAAC,KAAK;IAC1C,IAAI7D,KAAK,CAAC4C,cAAc,CAACF,KAAK,CAAC,IAAIA,KAAK,CAACG,IAAI,KAAKpC,IAAI,EAAE;MACtD,OAAOT,KAAK,CAAC8D,YAAY,CACvBpB,KAAK,EACL;QACEqB,KAAK,EAAEF;MACT,CACF,CAAC;IACH;IACA,OAAOnB,KAAK;EACd,CAAC,CACE,CACA,CACc,CAAC;AAE5B;AAEA5B,WAAW,CAACkD,qBAAqB,GAAG,IAAI;AAExClD,WAAW,CAACL,IAAI,GAAGA,IAAI;AACvBK,WAAW,CAACH,UAAU,GAAGA,UAAU;AACnCG,WAAW,CAACF,cAAc,GAAGA,cAAc;AAC3CE,WAAW,CAACD,OAAO,GAAGA,OAAO;AAE7B,eAAeC,WAAW"}
@@ -1,3 +1,5 @@
1
+ "use client";
2
+
1
3
  import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
4
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
3
5
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
@@ -6,9 +8,10 @@ import StringComponent from '../String';
6
8
  import { format, cleanNumber } from '../../../../components/number-format/NumberUtils';
7
9
  import SharedContext from '../../../../shared/Context';
8
10
  function BankAccountNumber(props) {
11
+ var _props$label;
9
12
  const sharedContext = useContext(SharedContext);
10
13
  const stringValueProps = _objectSpread(_objectSpread({}, props), {}, {
11
- label: props.label ?? (props.inline ? undefined : sharedContext === null || sharedContext === void 0 ? void 0 : sharedContext.translation.Forms.bankAccountNumberLabel),
14
+ label: (_props$label = props.label) !== null && _props$label !== void 0 ? _props$label : props.inline ? undefined : sharedContext === null || sharedContext === void 0 ? void 0 : sharedContext.translation.Forms.bankAccountNumberLabel,
12
15
  prepare: value => format(cleanNumber(value), {
13
16
  ban: true
14
17
  }).toString()
@@ -1 +1 @@
1
- {"version":3,"file":"BankAccountNumber.js","names":["React","useContext","StringComponent","format","cleanNumber","SharedContext","BankAccountNumber","props","sharedContext","stringValueProps","_objectSpread","label","inline","undefined","translation","Forms","bankAccountNumberLabel","prepare","value","ban","toString","createElement","_supportsSpacingProps"],"sources":["../../../../../../src/extensions/forms/Value/BankAccountNumber/BankAccountNumber.tsx"],"sourcesContent":["import React, { useContext } from 'react'\nimport StringComponent, { Props as StringComponentProps } from '../String'\nimport {\n format,\n cleanNumber,\n} from '../../../../components/number-format/NumberUtils'\nimport SharedContext from '../../../../shared/Context'\n\nexport type Props = StringComponentProps\n\nfunction BankAccountNumber(props: Props) {\n const sharedContext = useContext(SharedContext)\n\n const stringValueProps: Props = {\n ...props,\n label:\n props.label ??\n (props.inline\n ? undefined\n : sharedContext?.translation.Forms.bankAccountNumberLabel),\n prepare: (value) =>\n format(cleanNumber(value), {\n ban: true,\n }).toString(),\n }\n return <StringComponent {...stringValueProps} />\n}\n\nBankAccountNumber._supportsSpacingProps = true\nexport default BankAccountNumber\n"],"mappings":";;;AAAA,OAAOA,KAAK,IAAIC,UAAU,QAAQ,OAAO;AACzC,OAAOC,eAAe,MAAyC,WAAW;AAC1E,SACEC,MAAM,EACNC,WAAW,QACN,kDAAkD;AACzD,OAAOC,aAAa,MAAM,4BAA4B;AAItD,SAASC,iBAAiBA,CAACC,KAAY,EAAE;EACvC,MAAMC,aAAa,GAAGP,UAAU,CAACI,aAAa,CAAC;EAE/C,MAAMI,gBAAuB,GAAAC,aAAA,CAAAA,aAAA,KACxBH,KAAK;IACRI,KAAK,EACHJ,KAAK,CAACI,KAAK,KACVJ,KAAK,CAACK,MAAM,GACTC,SAAS,GACTL,aAAa,aAAbA,aAAa,uBAAbA,aAAa,CAAEM,WAAW,CAACC,KAAK,CAACC,sBAAsB,CAAC;IAC9DC,OAAO,EAAGC,KAAK,IACbf,MAAM,CAACC,WAAW,CAACc,KAAK,CAAC,EAAE;MACzBC,GAAG,EAAE;IACP,CAAC,CAAC,CAACC,QAAQ,CAAC;EAAC,EAChB;EACD,OAAOpB,KAAA,CAAAqB,aAAA,CAACnB,eAAe,EAAKO,gBAAmB,CAAC;AAClD;AAEAH,iBAAiB,CAACgB,qBAAqB,GAAG,IAAI;AAC9C,eAAehB,iBAAiB"}
1
+ {"version":3,"file":"BankAccountNumber.js","names":["React","useContext","StringComponent","format","cleanNumber","SharedContext","BankAccountNumber","props","_props$label","sharedContext","stringValueProps","_objectSpread","label","inline","undefined","translation","Forms","bankAccountNumberLabel","prepare","value","ban","toString","createElement","_supportsSpacingProps"],"sources":["../../../../../../src/extensions/forms/Value/BankAccountNumber/BankAccountNumber.tsx"],"sourcesContent":["import React, { useContext } from 'react'\nimport StringComponent, { Props as StringComponentProps } from '../String'\nimport {\n format,\n cleanNumber,\n} from '../../../../components/number-format/NumberUtils'\nimport SharedContext from '../../../../shared/Context'\n\nexport type Props = StringComponentProps\n\nfunction BankAccountNumber(props: Props) {\n const sharedContext = useContext(SharedContext)\n\n const stringValueProps: Props = {\n ...props,\n label:\n props.label ??\n (props.inline\n ? undefined\n : sharedContext?.translation.Forms.bankAccountNumberLabel),\n prepare: (value) =>\n format(cleanNumber(value), {\n ban: true,\n }).toString(),\n }\n return <StringComponent {...stringValueProps} />\n}\n\nBankAccountNumber._supportsSpacingProps = true\nexport default BankAccountNumber\n"],"mappings":";;;;;AAAA,OAAOA,KAAK,IAAIC,UAAU,QAAQ,OAAO;AACzC,OAAOC,eAAe,MAAyC,WAAW;AAC1E,SACEC,MAAM,EACNC,WAAW,QACN,kDAAkD;AACzD,OAAOC,aAAa,MAAM,4BAA4B;AAItD,SAASC,iBAAiBA,CAACC,KAAY,EAAE;EAAA,IAAAC,YAAA;EACvC,MAAMC,aAAa,GAAGR,UAAU,CAACI,aAAa,CAAC;EAE/C,MAAMK,gBAAuB,GAAAC,aAAA,CAAAA,aAAA,KACxBJ,KAAK;IACRK,KAAK,GAAAJ,YAAA,GACHD,KAAK,CAACK,KAAK,cAAAJ,YAAA,cAAAA,YAAA,GACVD,KAAK,CAACM,MAAM,GACTC,SAAS,GACTL,aAAa,aAAbA,aAAa,uBAAbA,aAAa,CAAEM,WAAW,CAACC,KAAK,CAACC,sBAAuB;IAC9DC,OAAO,EAAGC,KAAK,IACbhB,MAAM,CAACC,WAAW,CAACe,KAAK,CAAC,EAAE;MACzBC,GAAG,EAAE;IACP,CAAC,CAAC,CAACC,QAAQ,CAAC;EAAC,EAChB;EACD,OAAOrB,KAAA,CAAAsB,aAAA,CAACpB,eAAe,EAAKQ,gBAAmB,CAAC;AAClD;AAEAJ,iBAAiB,CAACiB,qBAAqB,GAAG,IAAI;AAC9C,eAAejB,iBAAiB"}
@@ -1,3 +1,5 @@
1
+ "use client";
2
+
1
3
  import _extends from "@babel/runtime/helpers/esm/extends";
2
4
  import React, { useContext } from 'react';
3
5
  import ValueBlock from '../../ValueBlock';
@@ -1 +1 @@
1
- {"version":3,"file":"Boolean.js","names":["React","useContext","ValueBlock","useDataValue","pickSpacingProps","SharedContext","BooleanComponent","props","sharedContext","className","label","placeholder","showEmpty","value","inline","createElement","_extends","translation","Forms","booleanYes","booleanNo","_supportsSpacingProps"],"sources":["../../../../../../src/extensions/forms/Value/Boolean/Boolean.tsx"],"sourcesContent":["import React, { useContext } from 'react'\nimport ValueBlock from '../../ValueBlock'\nimport { useDataValue } from '../../hooks'\nimport { ValueProps } from '../../types'\nimport { pickSpacingProps } from '../../../../components/flex/utils'\nimport SharedContext from '../../../../shared/Context'\n\nexport type Props = ValueProps<boolean>\n\nfunction BooleanComponent(props: Props) {\n const sharedContext = useContext(SharedContext)\n const { className, label, placeholder, showEmpty, value, inline } =\n useDataValue(props)\n\n return (\n <ValueBlock\n className={className}\n label={label}\n showEmpty={showEmpty}\n placeholder={placeholder}\n inline={inline}\n {...pickSpacingProps(props)}\n >\n {value === true || value === false\n ? value === true\n ? sharedContext?.translation.Forms.booleanYes\n : sharedContext?.translation.Forms.booleanNo\n : null}\n </ValueBlock>\n )\n}\n\nBooleanComponent._supportsSpacingProps = true\nexport default BooleanComponent\n"],"mappings":";AAAA,OAAOA,KAAK,IAAIC,UAAU,QAAQ,OAAO;AACzC,OAAOC,UAAU,MAAM,kBAAkB;AACzC,SAASC,YAAY,QAAQ,aAAa;AAE1C,SAASC,gBAAgB,QAAQ,mCAAmC;AACpE,OAAOC,aAAa,MAAM,4BAA4B;AAItD,SAASC,gBAAgBA,CAACC,KAAY,EAAE;EACtC,MAAMC,aAAa,GAAGP,UAAU,CAACI,aAAa,CAAC;EAC/C,MAAM;IAAEI,SAAS;IAAEC,KAAK;IAAEC,WAAW;IAAEC,SAAS;IAAEC,KAAK;IAAEC;EAAO,CAAC,GAC/DX,YAAY,CAACI,KAAK,CAAC;EAErB,OACEP,KAAA,CAAAe,aAAA,CAACb,UAAU,EAAAc,QAAA;IACTP,SAAS,EAAEA,SAAU;IACrBC,KAAK,EAAEA,KAAM;IACbE,SAAS,EAAEA,SAAU;IACrBD,WAAW,EAAEA,WAAY;IACzBG,MAAM,EAAEA;EAAO,GACXV,gBAAgB,CAACG,KAAK,CAAC,GAE1BM,KAAK,KAAK,IAAI,IAAIA,KAAK,KAAK,KAAK,GAC9BA,KAAK,KAAK,IAAI,GACZL,aAAa,aAAbA,aAAa,uBAAbA,aAAa,CAAES,WAAW,CAACC,KAAK,CAACC,UAAU,GAC3CX,aAAa,aAAbA,aAAa,uBAAbA,aAAa,CAAES,WAAW,CAACC,KAAK,CAACE,SAAS,GAC5C,IACM,CAAC;AAEjB;AAEAd,gBAAgB,CAACe,qBAAqB,GAAG,IAAI;AAC7C,eAAef,gBAAgB"}
1
+ {"version":3,"file":"Boolean.js","names":["React","useContext","ValueBlock","useDataValue","pickSpacingProps","SharedContext","BooleanComponent","props","sharedContext","className","label","placeholder","showEmpty","value","inline","createElement","_extends","translation","Forms","booleanYes","booleanNo","_supportsSpacingProps"],"sources":["../../../../../../src/extensions/forms/Value/Boolean/Boolean.tsx"],"sourcesContent":["import React, { useContext } from 'react'\nimport ValueBlock from '../../ValueBlock'\nimport { useDataValue } from '../../hooks'\nimport { ValueProps } from '../../types'\nimport { pickSpacingProps } from '../../../../components/flex/utils'\nimport SharedContext from '../../../../shared/Context'\n\nexport type Props = ValueProps<boolean>\n\nfunction BooleanComponent(props: Props) {\n const sharedContext = useContext(SharedContext)\n const { className, label, placeholder, showEmpty, value, inline } =\n useDataValue(props)\n\n return (\n <ValueBlock\n className={className}\n label={label}\n showEmpty={showEmpty}\n placeholder={placeholder}\n inline={inline}\n {...pickSpacingProps(props)}\n >\n {value === true || value === false\n ? value === true\n ? sharedContext?.translation.Forms.booleanYes\n : sharedContext?.translation.Forms.booleanNo\n : null}\n </ValueBlock>\n )\n}\n\nBooleanComponent._supportsSpacingProps = true\nexport default BooleanComponent\n"],"mappings":";;;AAAA,OAAOA,KAAK,IAAIC,UAAU,QAAQ,OAAO;AACzC,OAAOC,UAAU,MAAM,kBAAkB;AACzC,SAASC,YAAY,QAAQ,aAAa;AAE1C,SAASC,gBAAgB,QAAQ,mCAAmC;AACpE,OAAOC,aAAa,MAAM,4BAA4B;AAItD,SAASC,gBAAgBA,CAACC,KAAY,EAAE;EACtC,MAAMC,aAAa,GAAGP,UAAU,CAACI,aAAa,CAAC;EAC/C,MAAM;IAAEI,SAAS;IAAEC,KAAK;IAAEC,WAAW;IAAEC,SAAS;IAAEC,KAAK;IAAEC;EAAO,CAAC,GAC/DX,YAAY,CAACI,KAAK,CAAC;EAErB,OACEP,KAAA,CAAAe,aAAA,CAACb,UAAU,EAAAc,QAAA;IACTP,SAAS,EAAEA,SAAU;IACrBC,KAAK,EAAEA,KAAM;IACbE,SAAS,EAAEA,SAAU;IACrBD,WAAW,EAAEA,WAAY;IACzBG,MAAM,EAAEA;EAAO,GACXV,gBAAgB,CAACG,KAAK,CAAC,GAE1BM,KAAK,KAAK,IAAI,IAAIA,KAAK,KAAK,KAAK,GAC9BA,KAAK,KAAK,IAAI,GACZL,aAAa,aAAbA,aAAa,uBAAbA,aAAa,CAAES,WAAW,CAACC,KAAK,CAACC,UAAU,GAC3CX,aAAa,aAAbA,aAAa,uBAAbA,aAAa,CAAES,WAAW,CAACC,KAAK,CAACE,SAAS,GAC5C,IACM,CAAC;AAEjB;AAEAd,gBAAgB,CAACe,qBAAqB,GAAG,IAAI;AAC7C,eAAef,gBAAgB"}
@@ -4,10 +4,11 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
4
4
  import React from 'react';
5
5
  import NumberComponent from '../Number';
6
6
  function Currency(props) {
7
+ var _props$thousandSepara, _props$suffix;
7
8
  const numberProps = _objectSpread(_objectSpread({}, props), {}, {
8
9
  label: props.label,
9
- thousandSeparator: props.thousandSeparator ?? ' ',
10
- suffix: props.suffix ?? ' kr'
10
+ thousandSeparator: (_props$thousandSepara = props.thousandSeparator) !== null && _props$thousandSepara !== void 0 ? _props$thousandSepara : ' ',
11
+ suffix: (_props$suffix = props.suffix) !== null && _props$suffix !== void 0 ? _props$suffix : ' kr'
11
12
  });
12
13
  return React.createElement(NumberComponent, numberProps);
13
14
  }
@@ -1 +1 @@
1
- {"version":3,"file":"Currency.js","names":["React","NumberComponent","Currency","props","numberProps","_objectSpread","label","thousandSeparator","suffix","createElement","_supportsSpacingProps"],"sources":["../../../../../../src/extensions/forms/Value/Currency/Currency.tsx"],"sourcesContent":["import React from 'react'\nimport NumberComponent, { Props as NumberComponentProps } from '../Number'\n\nexport type Props = NumberComponentProps\n\nfunction Currency(props: Props) {\n const numberProps: Props = {\n ...props,\n label: props.label,\n thousandSeparator: props.thousandSeparator ?? ' ',\n suffix: props.suffix ?? ' kr',\n }\n return <NumberComponent {...numberProps} />\n}\n\nCurrency._supportsSpacingProps = true\nexport default Currency\n"],"mappings":";;;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,eAAe,MAAyC,WAAW;AAI1E,SAASC,QAAQA,CAACC,KAAY,EAAE;EAC9B,MAAMC,WAAkB,GAAAC,aAAA,CAAAA,aAAA,KACnBF,KAAK;IACRG,KAAK,EAAEH,KAAK,CAACG,KAAK;IAClBC,iBAAiB,EAAEJ,KAAK,CAACI,iBAAiB,IAAI,GAAG;IACjDC,MAAM,EAAEL,KAAK,CAACK,MAAM,IAAI;EAAK,EAC9B;EACD,OAAOR,KAAA,CAAAS,aAAA,CAACR,eAAe,EAAKG,WAAc,CAAC;AAC7C;AAEAF,QAAQ,CAACQ,qBAAqB,GAAG,IAAI;AACrC,eAAeR,QAAQ"}
1
+ {"version":3,"file":"Currency.js","names":["React","NumberComponent","Currency","props","_props$thousandSepara","_props$suffix","numberProps","_objectSpread","label","thousandSeparator","suffix","createElement","_supportsSpacingProps"],"sources":["../../../../../../src/extensions/forms/Value/Currency/Currency.tsx"],"sourcesContent":["import React from 'react'\nimport NumberComponent, { Props as NumberComponentProps } from '../Number'\n\nexport type Props = NumberComponentProps\n\nfunction Currency(props: Props) {\n const numberProps: Props = {\n ...props,\n label: props.label,\n thousandSeparator: props.thousandSeparator ?? ' ',\n suffix: props.suffix ?? ' kr',\n }\n return <NumberComponent {...numberProps} />\n}\n\nCurrency._supportsSpacingProps = true\nexport default Currency\n"],"mappings":";;;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,eAAe,MAAyC,WAAW;AAI1E,SAASC,QAAQA,CAACC,KAAY,EAAE;EAAA,IAAAC,qBAAA,EAAAC,aAAA;EAC9B,MAAMC,WAAkB,GAAAC,aAAA,CAAAA,aAAA,KACnBJ,KAAK;IACRK,KAAK,EAAEL,KAAK,CAACK,KAAK;IAClBC,iBAAiB,GAAAL,qBAAA,GAAED,KAAK,CAACM,iBAAiB,cAAAL,qBAAA,cAAAA,qBAAA,GAAI,GAAG;IACjDM,MAAM,GAAAL,aAAA,GAAEF,KAAK,CAACO,MAAM,cAAAL,aAAA,cAAAA,aAAA,GAAI;EAAK,EAC9B;EACD,OAAOL,KAAA,CAAAW,aAAA,CAACV,eAAe,EAAKK,WAAc,CAAC;AAC7C;AAEAJ,QAAQ,CAACU,qBAAqB,GAAG,IAAI;AACrC,eAAeV,QAAQ"}
@@ -1,3 +1,5 @@
1
+ "use client";
2
+
1
3
  import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
4
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
3
5
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
@@ -5,9 +7,10 @@ import React, { useContext } from 'react';
5
7
  import StringComponent from '../String';
6
8
  import SharedContext from '../../../../shared/Context';
7
9
  function DateComponent(props) {
10
+ var _props$label;
8
11
  const sharedContext = useContext(SharedContext);
9
12
  const stringProps = _objectSpread(_objectSpread({}, props), {}, {
10
- label: props.label ?? (sharedContext === null || sharedContext === void 0 ? void 0 : sharedContext.translation.Forms.dateLabel)
13
+ label: (_props$label = props.label) !== null && _props$label !== void 0 ? _props$label : sharedContext === null || sharedContext === void 0 ? void 0 : sharedContext.translation.Forms.dateLabel
11
14
  });
12
15
  return React.createElement(StringComponent, stringProps);
13
16
  }
@@ -1 +1 @@
1
- {"version":3,"file":"Date.js","names":["React","useContext","StringComponent","SharedContext","DateComponent","props","sharedContext","stringProps","_objectSpread","label","translation","Forms","dateLabel","createElement","_supportsSpacingProps"],"sources":["../../../../../../src/extensions/forms/Value/Date/Date.tsx"],"sourcesContent":["import React, { useContext } from 'react'\nimport StringComponent, { Props as StringComponentProps } from '../String'\nimport SharedContext from '../../../../shared/Context'\n\nexport type Props = StringComponentProps\n\nfunction DateComponent(props: Props) {\n const sharedContext = useContext(SharedContext)\n\n const stringProps: Props = {\n ...props,\n label: props.label ?? sharedContext?.translation.Forms.dateLabel,\n }\n return <StringComponent {...stringProps} />\n}\n\nDateComponent._supportsSpacingProps = true\nexport default DateComponent\n"],"mappings":";;;AAAA,OAAOA,KAAK,IAAIC,UAAU,QAAQ,OAAO;AACzC,OAAOC,eAAe,MAAyC,WAAW;AAC1E,OAAOC,aAAa,MAAM,4BAA4B;AAItD,SAASC,aAAaA,CAACC,KAAY,EAAE;EACnC,MAAMC,aAAa,GAAGL,UAAU,CAACE,aAAa,CAAC;EAE/C,MAAMI,WAAkB,GAAAC,aAAA,CAAAA,aAAA,KACnBH,KAAK;IACRI,KAAK,EAAEJ,KAAK,CAACI,KAAK,KAAIH,aAAa,aAAbA,aAAa,uBAAbA,aAAa,CAAEI,WAAW,CAACC,KAAK,CAACC,SAAS;EAAA,EACjE;EACD,OAAOZ,KAAA,CAAAa,aAAA,CAACX,eAAe,EAAKK,WAAc,CAAC;AAC7C;AAEAH,aAAa,CAACU,qBAAqB,GAAG,IAAI;AAC1C,eAAeV,aAAa"}
1
+ {"version":3,"file":"Date.js","names":["React","useContext","StringComponent","SharedContext","DateComponent","props","_props$label","sharedContext","stringProps","_objectSpread","label","translation","Forms","dateLabel","createElement","_supportsSpacingProps"],"sources":["../../../../../../src/extensions/forms/Value/Date/Date.tsx"],"sourcesContent":["import React, { useContext } from 'react'\nimport StringComponent, { Props as StringComponentProps } from '../String'\nimport SharedContext from '../../../../shared/Context'\n\nexport type Props = StringComponentProps\n\nfunction DateComponent(props: Props) {\n const sharedContext = useContext(SharedContext)\n\n const stringProps: Props = {\n ...props,\n label: props.label ?? sharedContext?.translation.Forms.dateLabel,\n }\n return <StringComponent {...stringProps} />\n}\n\nDateComponent._supportsSpacingProps = true\nexport default DateComponent\n"],"mappings":";;;;;AAAA,OAAOA,KAAK,IAAIC,UAAU,QAAQ,OAAO;AACzC,OAAOC,eAAe,MAAyC,WAAW;AAC1E,OAAOC,aAAa,MAAM,4BAA4B;AAItD,SAASC,aAAaA,CAACC,KAAY,EAAE;EAAA,IAAAC,YAAA;EACnC,MAAMC,aAAa,GAAGN,UAAU,CAACE,aAAa,CAAC;EAE/C,MAAMK,WAAkB,GAAAC,aAAA,CAAAA,aAAA,KACnBJ,KAAK;IACRK,KAAK,GAAAJ,YAAA,GAAED,KAAK,CAACK,KAAK,cAAAJ,YAAA,cAAAA,YAAA,GAAIC,aAAa,aAAbA,aAAa,uBAAbA,aAAa,CAAEI,WAAW,CAACC,KAAK,CAACC;EAAS,EACjE;EACD,OAAOb,KAAA,CAAAc,aAAA,CAACZ,eAAe,EAAKM,WAAc,CAAC;AAC7C;AAEAJ,aAAa,CAACW,qBAAqB,GAAG,IAAI;AAC1C,eAAeX,aAAa"}
@@ -1,3 +1,5 @@
1
+ "use client";
2
+
1
3
  import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
4
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
3
5
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
@@ -5,9 +7,10 @@ import React, { useContext } from 'react';
5
7
  import StringComponent from '../String';
6
8
  import SharedContext from '../../../../shared/Context';
7
9
  function Email(props) {
10
+ var _props$label;
8
11
  const sharedContext = useContext(SharedContext);
9
12
  const stringProps = _objectSpread(_objectSpread({}, props), {}, {
10
- label: props.label ?? (sharedContext === null || sharedContext === void 0 ? void 0 : sharedContext.translation.Forms.emailLabel)
13
+ label: (_props$label = props.label) !== null && _props$label !== void 0 ? _props$label : sharedContext === null || sharedContext === void 0 ? void 0 : sharedContext.translation.Forms.emailLabel
11
14
  });
12
15
  return React.createElement(StringComponent, stringProps);
13
16
  }
@@ -1 +1 @@
1
- {"version":3,"file":"Email.js","names":["React","useContext","StringComponent","SharedContext","Email","props","sharedContext","stringProps","_objectSpread","label","translation","Forms","emailLabel","createElement","_supportsSpacingProps"],"sources":["../../../../../../src/extensions/forms/Value/Email/Email.tsx"],"sourcesContent":["import React, { useContext } from 'react'\nimport StringComponent, { Props as StringComponentProps } from '../String'\nimport SharedContext from '../../../../shared/Context'\n\nexport type Props = StringComponentProps\n\nfunction Email(props: Props) {\n const sharedContext = useContext(SharedContext)\n\n const stringProps: Props = {\n ...props,\n label: props.label ?? sharedContext?.translation.Forms.emailLabel,\n }\n return <StringComponent {...stringProps} />\n}\n\nEmail._supportsSpacingProps = true\nexport default Email\n"],"mappings":";;;AAAA,OAAOA,KAAK,IAAIC,UAAU,QAAQ,OAAO;AACzC,OAAOC,eAAe,MAAyC,WAAW;AAC1E,OAAOC,aAAa,MAAM,4BAA4B;AAItD,SAASC,KAAKA,CAACC,KAAY,EAAE;EAC3B,MAAMC,aAAa,GAAGL,UAAU,CAACE,aAAa,CAAC;EAE/C,MAAMI,WAAkB,GAAAC,aAAA,CAAAA,aAAA,KACnBH,KAAK;IACRI,KAAK,EAAEJ,KAAK,CAACI,KAAK,KAAIH,aAAa,aAAbA,aAAa,uBAAbA,aAAa,CAAEI,WAAW,CAACC,KAAK,CAACC,UAAU;EAAA,EAClE;EACD,OAAOZ,KAAA,CAAAa,aAAA,CAACX,eAAe,EAAKK,WAAc,CAAC;AAC7C;AAEAH,KAAK,CAACU,qBAAqB,GAAG,IAAI;AAClC,eAAeV,KAAK"}
1
+ {"version":3,"file":"Email.js","names":["React","useContext","StringComponent","SharedContext","Email","props","_props$label","sharedContext","stringProps","_objectSpread","label","translation","Forms","emailLabel","createElement","_supportsSpacingProps"],"sources":["../../../../../../src/extensions/forms/Value/Email/Email.tsx"],"sourcesContent":["import React, { useContext } from 'react'\nimport StringComponent, { Props as StringComponentProps } from '../String'\nimport SharedContext from '../../../../shared/Context'\n\nexport type Props = StringComponentProps\n\nfunction Email(props: Props) {\n const sharedContext = useContext(SharedContext)\n\n const stringProps: Props = {\n ...props,\n label: props.label ?? sharedContext?.translation.Forms.emailLabel,\n }\n return <StringComponent {...stringProps} />\n}\n\nEmail._supportsSpacingProps = true\nexport default Email\n"],"mappings":";;;;;AAAA,OAAOA,KAAK,IAAIC,UAAU,QAAQ,OAAO;AACzC,OAAOC,eAAe,MAAyC,WAAW;AAC1E,OAAOC,aAAa,MAAM,4BAA4B;AAItD,SAASC,KAAKA,CAACC,KAAY,EAAE;EAAA,IAAAC,YAAA;EAC3B,MAAMC,aAAa,GAAGN,UAAU,CAACE,aAAa,CAAC;EAE/C,MAAMK,WAAkB,GAAAC,aAAA,CAAAA,aAAA,KACnBJ,KAAK;IACRK,KAAK,GAAAJ,YAAA,GAAED,KAAK,CAACK,KAAK,cAAAJ,YAAA,cAAAA,YAAA,GAAIC,aAAa,aAAbA,aAAa,uBAAbA,aAAa,CAAEI,WAAW,CAACC,KAAK,CAACC;EAAU,EAClE;EACD,OAAOb,KAAA,CAAAc,aAAA,CAACZ,eAAe,EAAKM,WAAc,CAAC;AAC7C;AAEAJ,KAAK,CAACW,qBAAqB,GAAG,IAAI;AAClC,eAAeX,KAAK"}
@@ -1,3 +1,5 @@
1
+ "use client";
2
+
1
3
  import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
4
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
3
5
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
@@ -6,9 +8,10 @@ import StringComponent from '../String';
6
8
  import SharedContext from '../../../../shared/Context';
7
9
  import { format, cleanNumber } from '../../../../components/number-format/NumberUtils';
8
10
  function NationalIdentityNumber(props) {
11
+ var _props$label;
9
12
  const sharedContext = useContext(SharedContext);
10
13
  const stringValueProps = _objectSpread(_objectSpread({}, props), {}, {
11
- label: props.label ?? (props.inline ? undefined : sharedContext === null || sharedContext === void 0 ? void 0 : sharedContext.translation.Forms.nationalIdentityNumberLabel),
14
+ label: (_props$label = props.label) !== null && _props$label !== void 0 ? _props$label : props.inline ? undefined : sharedContext === null || sharedContext === void 0 ? void 0 : sharedContext.translation.Forms.nationalIdentityNumberLabel,
12
15
  prepare: value => format(cleanNumber(value), {
13
16
  nin: true
14
17
  }).toString()
@@ -1 +1 @@
1
- {"version":3,"file":"NationalIdentityNumber.js","names":["React","useContext","StringComponent","SharedContext","format","cleanNumber","NationalIdentityNumber","props","sharedContext","stringValueProps","_objectSpread","label","inline","undefined","translation","Forms","nationalIdentityNumberLabel","prepare","value","nin","toString","createElement","_supportsSpacingProps"],"sources":["../../../../../../src/extensions/forms/Value/NationalIdentityNumber/NationalIdentityNumber.tsx"],"sourcesContent":["import React, { useContext } from 'react'\nimport StringComponent, { Props as StringComponentProps } from '../String'\nimport SharedContext from '../../../../shared/Context'\nimport {\n format,\n cleanNumber,\n} from '../../../../components/number-format/NumberUtils'\n\nexport type Props = StringComponentProps\n\nfunction NationalIdentityNumber(props: Props) {\n const sharedContext = useContext(SharedContext)\n\n const stringValueProps: Props = {\n ...props,\n label:\n props.label ??\n (props.inline\n ? undefined\n : sharedContext?.translation.Forms.nationalIdentityNumberLabel),\n prepare: (value) =>\n format(cleanNumber(value), {\n nin: true,\n }).toString(),\n }\n return <StringComponent {...stringValueProps} />\n}\n\nNationalIdentityNumber._supportsSpacingProps = true\nexport default NationalIdentityNumber\n"],"mappings":";;;AAAA,OAAOA,KAAK,IAAIC,UAAU,QAAQ,OAAO;AACzC,OAAOC,eAAe,MAAyC,WAAW;AAC1E,OAAOC,aAAa,MAAM,4BAA4B;AACtD,SACEC,MAAM,EACNC,WAAW,QACN,kDAAkD;AAIzD,SAASC,sBAAsBA,CAACC,KAAY,EAAE;EAC5C,MAAMC,aAAa,GAAGP,UAAU,CAACE,aAAa,CAAC;EAE/C,MAAMM,gBAAuB,GAAAC,aAAA,CAAAA,aAAA,KACxBH,KAAK;IACRI,KAAK,EACHJ,KAAK,CAACI,KAAK,KACVJ,KAAK,CAACK,MAAM,GACTC,SAAS,GACTL,aAAa,aAAbA,aAAa,uBAAbA,aAAa,CAAEM,WAAW,CAACC,KAAK,CAACC,2BAA2B,CAAC;IACnEC,OAAO,EAAGC,KAAK,IACbd,MAAM,CAACC,WAAW,CAACa,KAAK,CAAC,EAAE;MACzBC,GAAG,EAAE;IACP,CAAC,CAAC,CAACC,QAAQ,CAAC;EAAC,EAChB;EACD,OAAOpB,KAAA,CAAAqB,aAAA,CAACnB,eAAe,EAAKO,gBAAmB,CAAC;AAClD;AAEAH,sBAAsB,CAACgB,qBAAqB,GAAG,IAAI;AACnD,eAAehB,sBAAsB"}
1
+ {"version":3,"file":"NationalIdentityNumber.js","names":["React","useContext","StringComponent","SharedContext","format","cleanNumber","NationalIdentityNumber","props","_props$label","sharedContext","stringValueProps","_objectSpread","label","inline","undefined","translation","Forms","nationalIdentityNumberLabel","prepare","value","nin","toString","createElement","_supportsSpacingProps"],"sources":["../../../../../../src/extensions/forms/Value/NationalIdentityNumber/NationalIdentityNumber.tsx"],"sourcesContent":["import React, { useContext } from 'react'\nimport StringComponent, { Props as StringComponentProps } from '../String'\nimport SharedContext from '../../../../shared/Context'\nimport {\n format,\n cleanNumber,\n} from '../../../../components/number-format/NumberUtils'\n\nexport type Props = StringComponentProps\n\nfunction NationalIdentityNumber(props: Props) {\n const sharedContext = useContext(SharedContext)\n\n const stringValueProps: Props = {\n ...props,\n label:\n props.label ??\n (props.inline\n ? undefined\n : sharedContext?.translation.Forms.nationalIdentityNumberLabel),\n prepare: (value) =>\n format(cleanNumber(value), {\n nin: true,\n }).toString(),\n }\n return <StringComponent {...stringValueProps} />\n}\n\nNationalIdentityNumber._supportsSpacingProps = true\nexport default NationalIdentityNumber\n"],"mappings":";;;;;AAAA,OAAOA,KAAK,IAAIC,UAAU,QAAQ,OAAO;AACzC,OAAOC,eAAe,MAAyC,WAAW;AAC1E,OAAOC,aAAa,MAAM,4BAA4B;AACtD,SACEC,MAAM,EACNC,WAAW,QACN,kDAAkD;AAIzD,SAASC,sBAAsBA,CAACC,KAAY,EAAE;EAAA,IAAAC,YAAA;EAC5C,MAAMC,aAAa,GAAGR,UAAU,CAACE,aAAa,CAAC;EAE/C,MAAMO,gBAAuB,GAAAC,aAAA,CAAAA,aAAA,KACxBJ,KAAK;IACRK,KAAK,GAAAJ,YAAA,GACHD,KAAK,CAACK,KAAK,cAAAJ,YAAA,cAAAA,YAAA,GACVD,KAAK,CAACM,MAAM,GACTC,SAAS,GACTL,aAAa,aAAbA,aAAa,uBAAbA,aAAa,CAAEM,WAAW,CAACC,KAAK,CAACC,2BAA4B;IACnEC,OAAO,EAAGC,KAAK,IACbf,MAAM,CAACC,WAAW,CAACc,KAAK,CAAC,EAAE;MACzBC,GAAG,EAAE;IACP,CAAC,CAAC,CAACC,QAAQ,CAAC;EAAC,EAChB;EACD,OAAOrB,KAAA,CAAAsB,aAAA,CAACpB,eAAe,EAAKQ,gBAAmB,CAAC;AAClD;AAEAJ,sBAAsB,CAACiB,qBAAqB,GAAG,IAAI;AACnD,eAAejB,sBAAsB"}
@@ -1,3 +1,5 @@
1
+ "use client";
2
+
1
3
  import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
4
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
3
5
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
@@ -6,9 +8,10 @@ import StringComponent from '../String';
6
8
  import SharedContext from '../../../../shared/Context';
7
9
  import { format, cleanNumber } from '../../../../components/number-format/NumberUtils';
8
10
  function PhoneNumber(props) {
11
+ var _props$label;
9
12
  const sharedContext = useContext(SharedContext);
10
13
  const stringValueProps = _objectSpread(_objectSpread({}, props), {}, {
11
- label: props.label ?? (props.inline ? undefined : sharedContext === null || sharedContext === void 0 ? void 0 : sharedContext.translation.Forms.phoneNumberLabel),
14
+ label: (_props$label = props.label) !== null && _props$label !== void 0 ? _props$label : props.inline ? undefined : sharedContext === null || sharedContext === void 0 ? void 0 : sharedContext.translation.Forms.phoneNumberLabel,
12
15
  prepare: value => format(cleanNumber(value), {
13
16
  phone: true
14
17
  }).toString()
@@ -1 +1 @@
1
- {"version":3,"file":"PhoneNumber.js","names":["React","useContext","StringComponent","SharedContext","format","cleanNumber","PhoneNumber","props","sharedContext","stringValueProps","_objectSpread","label","inline","undefined","translation","Forms","phoneNumberLabel","prepare","value","phone","toString","createElement","_supportsSpacingProps"],"sources":["../../../../../../src/extensions/forms/Value/PhoneNumber/PhoneNumber.tsx"],"sourcesContent":["import React, { useContext } from 'react'\nimport StringComponent, { Props as StringComponentProps } from '../String'\nimport SharedContext from '../../../../shared/Context'\nimport {\n format,\n cleanNumber,\n} from '../../../../components/number-format/NumberUtils'\n\nexport type Props = StringComponentProps\n\nfunction PhoneNumber(props: Props) {\n const sharedContext = useContext(SharedContext)\n\n const stringValueProps: Props = {\n ...props,\n label:\n props.label ??\n (props.inline\n ? undefined\n : sharedContext?.translation.Forms.phoneNumberLabel),\n prepare: (value) =>\n format(cleanNumber(value), {\n phone: true,\n }).toString(),\n }\n return <StringComponent {...stringValueProps} />\n}\n\nPhoneNumber._supportsSpacingProps = true\nexport default PhoneNumber\n"],"mappings":";;;AAAA,OAAOA,KAAK,IAAIC,UAAU,QAAQ,OAAO;AACzC,OAAOC,eAAe,MAAyC,WAAW;AAC1E,OAAOC,aAAa,MAAM,4BAA4B;AACtD,SACEC,MAAM,EACNC,WAAW,QACN,kDAAkD;AAIzD,SAASC,WAAWA,CAACC,KAAY,EAAE;EACjC,MAAMC,aAAa,GAAGP,UAAU,CAACE,aAAa,CAAC;EAE/C,MAAMM,gBAAuB,GAAAC,aAAA,CAAAA,aAAA,KACxBH,KAAK;IACRI,KAAK,EACHJ,KAAK,CAACI,KAAK,KACVJ,KAAK,CAACK,MAAM,GACTC,SAAS,GACTL,aAAa,aAAbA,aAAa,uBAAbA,aAAa,CAAEM,WAAW,CAACC,KAAK,CAACC,gBAAgB,CAAC;IACxDC,OAAO,EAAGC,KAAK,IACbd,MAAM,CAACC,WAAW,CAACa,KAAK,CAAC,EAAE;MACzBC,KAAK,EAAE;IACT,CAAC,CAAC,CAACC,QAAQ,CAAC;EAAC,EAChB;EACD,OAAOpB,KAAA,CAAAqB,aAAA,CAACnB,eAAe,EAAKO,gBAAmB,CAAC;AAClD;AAEAH,WAAW,CAACgB,qBAAqB,GAAG,IAAI;AACxC,eAAehB,WAAW"}
1
+ {"version":3,"file":"PhoneNumber.js","names":["React","useContext","StringComponent","SharedContext","format","cleanNumber","PhoneNumber","props","_props$label","sharedContext","stringValueProps","_objectSpread","label","inline","undefined","translation","Forms","phoneNumberLabel","prepare","value","phone","toString","createElement","_supportsSpacingProps"],"sources":["../../../../../../src/extensions/forms/Value/PhoneNumber/PhoneNumber.tsx"],"sourcesContent":["import React, { useContext } from 'react'\nimport StringComponent, { Props as StringComponentProps } from '../String'\nimport SharedContext from '../../../../shared/Context'\nimport {\n format,\n cleanNumber,\n} from '../../../../components/number-format/NumberUtils'\n\nexport type Props = StringComponentProps\n\nfunction PhoneNumber(props: Props) {\n const sharedContext = useContext(SharedContext)\n\n const stringValueProps: Props = {\n ...props,\n label:\n props.label ??\n (props.inline\n ? undefined\n : sharedContext?.translation.Forms.phoneNumberLabel),\n prepare: (value) =>\n format(cleanNumber(value), {\n phone: true,\n }).toString(),\n }\n return <StringComponent {...stringValueProps} />\n}\n\nPhoneNumber._supportsSpacingProps = true\nexport default PhoneNumber\n"],"mappings":";;;;;AAAA,OAAOA,KAAK,IAAIC,UAAU,QAAQ,OAAO;AACzC,OAAOC,eAAe,MAAyC,WAAW;AAC1E,OAAOC,aAAa,MAAM,4BAA4B;AACtD,SACEC,MAAM,EACNC,WAAW,QACN,kDAAkD;AAIzD,SAASC,WAAWA,CAACC,KAAY,EAAE;EAAA,IAAAC,YAAA;EACjC,MAAMC,aAAa,GAAGR,UAAU,CAACE,aAAa,CAAC;EAE/C,MAAMO,gBAAuB,GAAAC,aAAA,CAAAA,aAAA,KACxBJ,KAAK;IACRK,KAAK,GAAAJ,YAAA,GACHD,KAAK,CAACK,KAAK,cAAAJ,YAAA,cAAAA,YAAA,GACVD,KAAK,CAACM,MAAM,GACTC,SAAS,GACTL,aAAa,aAAbA,aAAa,uBAAbA,aAAa,CAAEM,WAAW,CAACC,KAAK,CAACC,gBAAiB;IACxDC,OAAO,EAAGC,KAAK,IACbf,MAAM,CAACC,WAAW,CAACc,KAAK,CAAC,EAAE;MACzBC,KAAK,EAAE;IACT,CAAC,CAAC,CAACC,QAAQ,CAAC;EAAC,EAChB;EACD,OAAOrB,KAAA,CAAAsB,aAAA,CAACpB,eAAe,EAAKQ,gBAAmB,CAAC;AAClD;AAEAJ,WAAW,CAACiB,qBAAqB,GAAG,IAAI;AACxC,eAAejB,WAAW"}
@@ -21,7 +21,7 @@ function ValueBlock(props) {
21
21
  }, pickSpacingProps(props)), label && React.createElement(FormLabel, {
22
22
  className: "dnb-forms-value-block__label",
23
23
  label_direction: inline ? 'horizontal' : 'vertical'
24
- }, label), children ?? React.createElement("span", {
24
+ }, label), children !== null && children !== void 0 ? children : React.createElement("span", {
25
25
  className: "dnb-forms-value-block__placeholder"
26
26
  }, placeholder));
27
27
  }
@@ -1 +1 @@
1
- {"version":3,"file":"ValueBlock.js","names":["React","Span","FormLabel","classnames","pickSpacingProps","ValueBlock","props","className","label","inline","placeholder","showEmpty","children","undefined","createElement","_extends","label_direction","_supportsSpacingProps"],"sources":["../../../../../src/extensions/forms/ValueBlock/ValueBlock.tsx"],"sourcesContent":["import React from 'react'\nimport { Span } from '../../../elements'\nimport { FormLabel } from '../../../components'\nimport classnames from 'classnames'\nimport { ValueProps } from '../types'\nimport { pickSpacingProps } from '../../../components/flex/utils'\n\nexport type Props = Omit<ValueProps<unknown>, 'value'> & {\n children?: React.ReactNode\n}\n\nfunction ValueBlock(props: Props) {\n const { className, label, inline, placeholder, showEmpty, children } =\n props\n if (\n (children === undefined || children === null || children === false) &&\n !showEmpty &&\n !placeholder\n ) {\n return null\n }\n\n return (\n <Span\n className={classnames(\n 'dnb-forms-value',\n inline && 'dnb-forms-value-block--inline',\n className\n )}\n {...pickSpacingProps(props)}\n >\n {label && (\n <FormLabel\n className=\"dnb-forms-value-block__label\"\n label_direction={inline ? 'horizontal' : 'vertical'}\n >\n {label}\n </FormLabel>\n )}\n {children ?? (\n <span className=\"dnb-forms-value-block__placeholder\">\n {placeholder}\n </span>\n )}\n </Span>\n )\n}\n\nValueBlock._supportsSpacingProps = true\nexport default ValueBlock\n"],"mappings":";AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,IAAI,QAAQ,mBAAmB;AACxC,SAASC,SAAS,QAAQ,qBAAqB;AAC/C,OAAOC,UAAU,MAAM,YAAY;AAEnC,SAASC,gBAAgB,QAAQ,gCAAgC;AAMjE,SAASC,UAAUA,CAACC,KAAY,EAAE;EAChC,MAAM;IAAEC,SAAS;IAAEC,KAAK;IAAEC,MAAM;IAAEC,WAAW;IAAEC,SAAS;IAAEC;EAAS,CAAC,GAClEN,KAAK;EACP,IACE,CAACM,QAAQ,KAAKC,SAAS,IAAID,QAAQ,KAAK,IAAI,IAAIA,QAAQ,KAAK,KAAK,KAClE,CAACD,SAAS,IACV,CAACD,WAAW,EACZ;IACA,OAAO,IAAI;EACb;EAEA,OACEV,KAAA,CAAAc,aAAA,CAACb,IAAI,EAAAc,QAAA;IACHR,SAAS,EAAEJ,UAAU,CACnB,iBAAiB,EAEjBI,SAAS,EADTE,MAAM,IAAI,+BAEZ;EAAE,GACEL,gBAAgB,CAACE,KAAK,CAAC,GAE1BE,KAAK,IACJR,KAAA,CAAAc,aAAA,CAACZ,SAAS;IACRK,SAAS,EAAC,8BAA8B;IACxCS,eAAe,EAAEP,MAAM,GAAG,YAAY,GAAG;EAAW,GAEnDD,KACQ,CACZ,EACAI,QAAQ,IACPZ,KAAA,CAAAc,aAAA;IAAMP,SAAS,EAAC;EAAoC,GACjDG,WACG,CAEJ,CAAC;AAEX;AAEAL,UAAU,CAACY,qBAAqB,GAAG,IAAI;AACvC,eAAeZ,UAAU"}
1
+ {"version":3,"file":"ValueBlock.js","names":["React","Span","FormLabel","classnames","pickSpacingProps","ValueBlock","props","className","label","inline","placeholder","showEmpty","children","undefined","createElement","_extends","label_direction","_supportsSpacingProps"],"sources":["../../../../../src/extensions/forms/ValueBlock/ValueBlock.tsx"],"sourcesContent":["import React from 'react'\nimport { Span } from '../../../elements'\nimport { FormLabel } from '../../../components'\nimport classnames from 'classnames'\nimport { ValueProps } from '../types'\nimport { pickSpacingProps } from '../../../components/flex/utils'\n\nexport type Props = Omit<ValueProps<unknown>, 'value'> & {\n children?: React.ReactNode\n}\n\nfunction ValueBlock(props: Props) {\n const { className, label, inline, placeholder, showEmpty, children } =\n props\n if (\n (children === undefined || children === null || children === false) &&\n !showEmpty &&\n !placeholder\n ) {\n return null\n }\n\n return (\n <Span\n className={classnames(\n 'dnb-forms-value',\n inline && 'dnb-forms-value-block--inline',\n className\n )}\n {...pickSpacingProps(props)}\n >\n {label && (\n <FormLabel\n className=\"dnb-forms-value-block__label\"\n label_direction={inline ? 'horizontal' : 'vertical'}\n >\n {label}\n </FormLabel>\n )}\n {children ?? (\n <span className=\"dnb-forms-value-block__placeholder\">\n {placeholder}\n </span>\n )}\n </Span>\n )\n}\n\nValueBlock._supportsSpacingProps = true\nexport default ValueBlock\n"],"mappings":";AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,IAAI,QAAQ,mBAAmB;AACxC,SAASC,SAAS,QAAQ,qBAAqB;AAC/C,OAAOC,UAAU,MAAM,YAAY;AAEnC,SAASC,gBAAgB,QAAQ,gCAAgC;AAMjE,SAASC,UAAUA,CAACC,KAAY,EAAE;EAChC,MAAM;IAAEC,SAAS;IAAEC,KAAK;IAAEC,MAAM;IAAEC,WAAW;IAAEC,SAAS;IAAEC;EAAS,CAAC,GAClEN,KAAK;EACP,IACE,CAACM,QAAQ,KAAKC,SAAS,IAAID,QAAQ,KAAK,IAAI,IAAIA,QAAQ,KAAK,KAAK,KAClE,CAACD,SAAS,IACV,CAACD,WAAW,EACZ;IACA,OAAO,IAAI;EACb;EAEA,OACEV,KAAA,CAAAc,aAAA,CAACb,IAAI,EAAAc,QAAA;IACHR,SAAS,EAAEJ,UAAU,CACnB,iBAAiB,EAEjBI,SAAS,EADTE,MAAM,IAAI,+BAEZ;EAAE,GACEL,gBAAgB,CAACE,KAAK,CAAC,GAE1BE,KAAK,IACJR,KAAA,CAAAc,aAAA,CAACZ,SAAS;IACRK,SAAS,EAAC,8BAA8B;IACxCS,eAAe,EAAEP,MAAM,GAAG,YAAY,GAAG;EAAW,GAEnDD,KACQ,CACZ,EACAI,QAAQ,aAARA,QAAQ,cAARA,QAAQ,GACPZ,KAAA,CAAAc,aAAA;IAAMP,SAAS,EAAC;EAAoC,GACjDG,WACG,CAEJ,CAAC;AAEX;AAEAL,UAAU,CAACY,qBAAqB,GAAG,IAAI;AACvC,eAAeZ,UAAU"}
@@ -1,3 +1,5 @@
1
+ "use client";
2
+
1
3
  import React, { useContext } from 'react';
2
4
  import pointer from 'json-pointer';
3
5
  import * as DataContext from '../DataContext';
@@ -1 +1 @@
1
- {"version":3,"file":"Visibility.js","names":["React","useContext","pointer","DataContext","Visibility","_ref","visible","pathDefined","pathUndefined","pathTruthy","pathFalsy","pathTrue","pathFalse","inferData","children","dataContext","Context","has","data","get","Boolean","createElement","Fragment","_supportsSpacingProps"],"sources":["../../../../../src/extensions/forms/Visibility/Visibility.tsx"],"sourcesContent":["import React, { useContext } from 'react'\nimport pointer from 'json-pointer'\nimport * as DataContext from '../DataContext'\n\nexport type Props = {\n visible?: boolean\n /** Given data context path must be defined to show children */\n pathDefined?: string\n /** Given data context path must be undefined to show children */\n pathUndefined?: string\n /** Given data context path must be truthy to show children */\n pathTruthy?: string\n /** Given data context path must be falsy to show children */\n pathFalsy?: string\n /** Given data context path must be true to show children */\n pathTrue?: string\n /** Given data context path must be false to show children */\n pathFalse?: string\n /** Infer visibility calling given derivative function with the whole data set. Should return true/false for visibility. */\n inferData?: (data: unknown) => boolean\n children: React.ReactNode\n}\n\nfunction Visibility({\n visible,\n pathDefined,\n pathUndefined,\n pathTruthy,\n pathFalsy,\n pathTrue,\n pathFalse,\n inferData,\n children,\n}: Props) {\n const dataContext = useContext(DataContext.Context)\n\n if (visible === false) {\n return null\n }\n\n if (pathDefined && !pointer.has(dataContext.data, pathDefined)) {\n return null\n }\n if (pathUndefined && pointer.has(dataContext.data, pathUndefined)) {\n return null\n }\n\n if (\n pathTruthy &&\n (!pointer.has(dataContext.data, pathTruthy) ||\n !pointer.get(dataContext.data, pathTruthy))\n ) {\n return null\n }\n if (\n pathFalsy &&\n pointer.has(dataContext.data, pathFalsy) &&\n Boolean(pointer.get(dataContext.data, pathFalsy))\n ) {\n return null\n }\n\n if (\n pathTrue &&\n (!pointer.has(dataContext.data, pathTrue) ||\n pointer.get(dataContext.data, pathTrue) !== true)\n ) {\n return null\n }\n if (\n pathFalse &&\n (!pointer.has(dataContext.data, pathFalse) ||\n pointer.get(dataContext.data, pathFalse) !== false)\n ) {\n return null\n }\n\n if (inferData && !inferData(dataContext.data)) {\n return null\n }\n\n return <>{children}</>\n}\n\nVisibility._supportsSpacingProps = true\nexport default Visibility\n"],"mappings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AAI,CAAC,EACnD;IACA,OAAO,IAAI;EACb;EACA,IACEC,SAAS,KACR,CAACV,OAAO,CAACe,GAAG,CAACF,WAAW,CAACG,IAAI,EAAEN,SAAS,CAAC,IACxCV,OAAO,CAACiB,GAAG,CAACJ,WAAW,CAACG,IAAI,EAAEN,SAAS,CAAC,KAAK,KAAK,CAAC,EACrD;IACA,OAAO,IAAI;EACb;EAEA,IAAIC,SAAS,IAAI,CAACA,SAAS,CAACE,WAAW,CAACG,IAAI,CAAC,EAAE;IAC7C,OAAO,IAAI;EACb;EAEA,OAAOlB,KAAA,CAAAqB,aAAA,CAAArB,KAAA,CAAAsB,QAAA,QAAGR,QAAW,CAAC;AACxB;AAEAV,UAAU,CAACmB,qBAAqB,GAAG,IAAI;AACvC,eAAenB,UAAU"}
1
+ {"version":3,"file":"Visibility.js","names":["React","useContext","pointer","DataContext","Visibility","_ref","visible","pathDefined","pathUndefined","pathTruthy","pathFalsy","pathTrue","pathFalse","inferData","children","dataContext","Context","has","data","get","Boolean","createElement","Fragment","_supportsSpacingProps"],"sources":["../../../../../src/extensions/forms/Visibility/Visibility.tsx"],"sourcesContent":["import React, { useContext } from 'react'\nimport pointer from 'json-pointer'\nimport * as DataContext from '../DataContext'\n\nexport type Props = {\n visible?: boolean\n /** Given data context path must be defined to show children */\n pathDefined?: string\n /** Given data context path must be undefined to show children */\n pathUndefined?: string\n /** Given data context path must be truthy to show children */\n pathTruthy?: string\n /** Given data context path must be falsy to show children */\n pathFalsy?: string\n /** Given data context path must be true to show children */\n pathTrue?: string\n /** Given data context path must be false to show children */\n pathFalse?: string\n /** Infer visibility calling given derivative function with the whole data set. Should return true/false for visibility. */\n inferData?: (data: unknown) => boolean\n children: React.ReactNode\n}\n\nfunction Visibility({\n visible,\n pathDefined,\n pathUndefined,\n pathTruthy,\n pathFalsy,\n pathTrue,\n pathFalse,\n inferData,\n children,\n}: Props) {\n const dataContext = useContext(DataContext.Context)\n\n if (visible === false) {\n return null\n }\n\n if (pathDefined && !pointer.has(dataContext.data, pathDefined)) {\n return null\n }\n if (pathUndefined && pointer.has(dataContext.data, pathUndefined)) {\n return null\n }\n\n if (\n pathTruthy &&\n (!pointer.has(dataContext.data, pathTruthy) ||\n !pointer.get(dataContext.data, pathTruthy))\n ) {\n return null\n }\n if (\n pathFalsy &&\n pointer.has(dataContext.data, pathFalsy) &&\n Boolean(pointer.get(dataContext.data, pathFalsy))\n ) {\n return null\n }\n\n if (\n pathTrue &&\n (!pointer.has(dataContext.data, pathTrue) ||\n pointer.get(dataContext.data, pathTrue) !== true)\n ) {\n return null\n }\n if (\n pathFalse &&\n (!pointer.has(dataContext.data, pathFalse) ||\n pointer.get(dataContext.data, pathFalse) !== false)\n ) {\n return null\n }\n\n if (inferData && !inferData(dataContext.data)) {\n return null\n }\n\n return <>{children}</>\n}\n\nVisibility._supportsSpacingProps = true\nexport default Visibility\n"],"mappings":";;AAAA,OAAOA,KAAK,IAAIC,UAAU,QAAQ,OAAO;AACzC,OAAOC,OAAO,MAAM,cAAc;AAClC,OAAO,KAAKC,WAAW,MAAM,gBAAgB;AAqB7C,SAASC,UAAUA,CAAAC,IAAA,EAUT;EAAA,IAVU;IAClBC,OAAO;IACPC,WAAW;IACXC,aAAa;IACbC,UAAU;IACVC,SAAS;IACTC,QAAQ;IACRC,SAAS;IACTC,SAAS;IACTC;EACK,CAAC,GAAAT,IAAA;EACN,MAAMU,WAAW,GAAGd,UAAU,CAACE,WAAW,CAACa,OAAO,CAAC;EAEnD,IAAIV,OAAO,KAAK,KAAK,EAAE;IACrB,OAAO,IAAI;EACb;EAEA,IAAIC,WAAW,IAAI,CAACL,OAAO,CAACe,GAAG,CAACF,WAAW,CAACG,IAAI,EAAEX,WAAW,CAAC,EAAE;IAC9D,OAAO,IAAI;EACb;EACA,IAAIC,aAAa,IAAIN,OAAO,CAACe,GAAG,CAACF,WAAW,CAACG,IAAI,EAAEV,aAAa,CAAC,EAAE;IACjE,OAAO,IAAI;EACb;EAEA,IACEC,UAAU,KACT,CAACP,OAAO,CAACe,GAAG,CAACF,WAAW,CAACG,IAAI,EAAET,UAAU,CAAC,IACzC,CAACP,OAAO,CAACiB,GAAG,CAACJ,WAAW,CAACG,IAAI,EAAET,UAAU,CAAC,CAAC,EAC7C;IACA,OAAO,IAAI;EACb;EACA,IACEC,SAAS,IACTR,OAAO,CAACe,GAAG,CAACF,WAAW,CAACG,IAAI,EAAER,SAAS,CAAC,IACxCU,OAAO,CAAClB,OAAO,CAACiB,GAAG,CAACJ,WAAW,CAACG,IAAI,EAAER,SAAS,CAAC,CAAC,EACjD;IACA,OAAO,IAAI;EACb;EAEA,IACEC,QAAQ,KACP,CAACT,OAAO,CAACe,GAAG,CAACF,WAAW,CAACG,IAAI,EAAEP,QAAQ,CAAC,IACvCT,OAAO,CAACiB,GAAG,CAACJ,WAAW,CAACG,IAAI,EAAEP,QAAQ,CAAC,KAAK,IAAI,CAAC,EACnD;IACA,OAAO,IAAI;EACb;EACA,IACEC,SAAS,KACR,CAACV,OAAO,CAACe,GAAG,CAACF,WAAW,CAACG,IAAI,EAAEN,SAAS,CAAC,IACxCV,OAAO,CAACiB,GAAG,CAACJ,WAAW,CAACG,IAAI,EAAEN,SAAS,CAAC,KAAK,KAAK,CAAC,EACrD;IACA,OAAO,IAAI;EACb;EAEA,IAAIC,SAAS,IAAI,CAACA,SAAS,CAACE,WAAW,CAACG,IAAI,CAAC,EAAE;IAC7C,OAAO,IAAI;EACb;EAEA,OAAOlB,KAAA,CAAAqB,aAAA,CAAArB,KAAA,CAAAsB,QAAA,QAAGR,QAAW,CAAC;AACxB;AAEAV,UAAU,CAACmB,qBAAqB,GAAG,IAAI;AACvC,eAAenB,UAAU"}
@@ -1,3 +1,5 @@
1
+ "use client";
2
+
1
3
  import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
4
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
3
5
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
@@ -10,7 +12,7 @@ import FieldBlockContext from '../FieldBlock/FieldBlockContext';
10
12
  import IterateElementContext from '../Iterate/IterateElementContext';
11
13
  import { makeUniqueId } from '../../../shared/component-helper';
12
14
  export default function useDataValue(props) {
13
- var _props$path;
15
+ var _props$path, _props$autoComplete;
14
16
  const {
15
17
  path,
16
18
  elementPath,
@@ -30,7 +32,10 @@ export default function useDataValue(props) {
30
32
  toInput = value => value,
31
33
  fromInput = value => value
32
34
  } = props;
33
- const id = useMemo(() => props.id ?? makeUniqueId(), [props.id]);
35
+ const id = useMemo(() => {
36
+ var _props$id;
37
+ return (_props$id = props.id) !== null && _props$id !== void 0 ? _props$id : makeUniqueId();
38
+ }, [props.id]);
34
39
  const dataContext = useContext(Context);
35
40
  const fieldBlockContext = useContext(FieldBlockContext);
36
41
  const iterateElementContext = useContext(IterateElementContext);
@@ -38,18 +43,18 @@ export default function useDataValue(props) {
38
43
  handlePathChange: dataContextHandlePathChange,
39
44
  setPathWithError: dataContextSetPathWithError,
40
45
  errors: dataContextErrors
41
- } = dataContext ?? {};
46
+ } = dataContext !== null && dataContext !== void 0 ? dataContext : {};
42
47
  const inFieldBlock = Boolean(fieldBlockContext);
43
48
  const {
44
49
  setError: setFieldBlockError,
45
50
  setShowError: setShowFieldBlockError
46
- } = fieldBlockContext ?? {};
51
+ } = fieldBlockContext !== null && fieldBlockContext !== void 0 ? fieldBlockContext : {};
47
52
  const inIterate = Boolean(iterateElementContext);
48
53
  const {
49
54
  index: iterateElementIndex,
50
55
  value: iterateElementValue,
51
56
  handleChange: handleIterateElementChange
52
- } = iterateElementContext ?? {};
57
+ } = iterateElementContext !== null && iterateElementContext !== void 0 ? iterateElementContext : {};
53
58
  if (path && path.substring(0, 1) !== '/') {
54
59
  throw new Error('Invalid path. Data value path JSON Pointers must be from root (starting with a /).');
55
60
  }
@@ -92,7 +97,7 @@ export default function useDataValue(props) {
92
97
  if (path) {
93
98
  dataContextSetPathWithError === null || dataContextSetPathWithError === void 0 ? void 0 : dataContextSetPathWithError(path, Boolean(error));
94
99
  }
95
- setFieldBlockError === null || setFieldBlockError === void 0 ? void 0 : setFieldBlockError(path ?? id, errorWithCorrectMessage);
100
+ setFieldBlockError === null || setFieldBlockError === void 0 ? void 0 : setFieldBlockError(path !== null && path !== void 0 ? path : id, errorWithCorrectMessage);
96
101
  }, [path, id, errorMessages, dataContextSetPathWithError, setFieldBlockError]);
97
102
  const validateValue = useCallback(valueToValidate => {
98
103
  if (typeof validator === 'function') {
@@ -126,24 +131,24 @@ export default function useDataValue(props) {
126
131
  useEffect(() => {
127
132
  if (dataContext.showAllErrors) {
128
133
  setShowError(true);
129
- setShowFieldBlockError === null || setShowFieldBlockError === void 0 ? void 0 : setShowFieldBlockError(path ?? id, true);
134
+ setShowFieldBlockError === null || setShowFieldBlockError === void 0 ? void 0 : setShowFieldBlockError(path !== null && path !== void 0 ? path : id, true);
130
135
  }
131
136
  }, [id, path, dataContext.showAllErrors, setShowFieldBlockError]);
132
137
  const setHasFocus = useCallback((hasFocus, valueOverride) => {
133
138
  if (hasFocus) {
134
139
  hasFocusRef.current = true;
135
- onFocus === null || onFocus === void 0 ? void 0 : onFocus(valueOverride ?? value);
140
+ onFocus === null || onFocus === void 0 ? void 0 : onFocus(valueOverride !== null && valueOverride !== void 0 ? valueOverride : value);
136
141
  } else {
137
142
  hasFocusRef.current = false;
138
- onBlur === null || onBlur === void 0 ? void 0 : onBlur(valueOverride ?? value);
143
+ onBlur === null || onBlur === void 0 ? void 0 : onBlur(valueOverride !== null && valueOverride !== void 0 ? valueOverride : value);
139
144
  if (!changedRef.current && !validateUnchanged) {
140
145
  return;
141
146
  }
142
147
  if (typeof onBlurValidator === 'function') {
143
- Promise.resolve(onBlurValidator(valueOverride ?? value)).then(setErrorAndUpdateDataContext);
148
+ Promise.resolve(onBlurValidator(valueOverride !== null && valueOverride !== void 0 ? valueOverride : value)).then(setErrorAndUpdateDataContext);
144
149
  }
145
150
  setShowError(true);
146
- setShowFieldBlockError === null || setShowFieldBlockError === void 0 ? void 0 : setShowFieldBlockError(path ?? id, true);
151
+ setShowFieldBlockError === null || setShowFieldBlockError === void 0 ? void 0 : setShowFieldBlockError(path !== null && path !== void 0 ? path : id, true);
147
152
  }
148
153
  }, [id, path, value, validateUnchanged, onFocus, onBlur, onBlurValidator, setErrorAndUpdateDataContext, setShowFieldBlockError]);
149
154
  const handleFocus = useCallback(() => setHasFocus(true), [setHasFocus]);
@@ -157,10 +162,10 @@ export default function useDataValue(props) {
157
162
  changedRef.current = true;
158
163
  if (continuousValidation || continuousValidation !== false && !hasFocusRef.current) {
159
164
  setShowError(true);
160
- setShowFieldBlockError === null || setShowFieldBlockError === void 0 ? void 0 : setShowFieldBlockError(path ?? id, true);
165
+ setShowFieldBlockError === null || setShowFieldBlockError === void 0 ? void 0 : setShowFieldBlockError(path !== null && path !== void 0 ? path : id, true);
161
166
  } else {
162
167
  setShowError(false);
163
- setShowFieldBlockError === null || setShowFieldBlockError === void 0 ? void 0 : setShowFieldBlockError(path ?? id, false);
168
+ setShowFieldBlockError === null || setShowFieldBlockError === void 0 ? void 0 : setShowFieldBlockError(path !== null && path !== void 0 ? path : id, false);
164
169
  }
165
170
  validateValue(newValue);
166
171
  onChange === null || onChange === void 0 ? void 0 : onChange(newValue);
@@ -168,11 +173,11 @@ export default function useDataValue(props) {
168
173
  dataContextHandlePathChange === null || dataContextHandlePathChange === void 0 ? void 0 : dataContextHandlePathChange(path, newValue);
169
174
  }
170
175
  if (elementPath) {
171
- const iteratValuePath = `/${iterateElementIndex}${elementPath && elementPath !== '/' ? elementPath : ''}`;
172
- handleIterateElementChange === null || handleIterateElementChange === void 0 ? void 0 : handleIterateElementChange(iteratValuePath, newValue);
176
+ const iterateValuePath = `/${iterateElementIndex}${elementPath && elementPath !== '/' ? elementPath : ''}`;
177
+ handleIterateElementChange === null || handleIterateElementChange === void 0 ? void 0 : handleIterateElementChange(iterateValuePath, newValue);
173
178
  }
174
179
  }, [id, path, elementPath, iterateElementIndex, value, continuousValidation, onChange, validateValue, dataContextHandlePathChange, setShowFieldBlockError, handleIterateElementChange, fromInput]);
175
- const exportError = useMemo(() => errorProp ?? error, [errorProp, error]);
180
+ const exportError = useMemo(() => errorProp !== null && errorProp !== void 0 ? errorProp : error, [errorProp, error]);
176
181
  useEffect(() => {
177
182
  if (path) {
178
183
  dataContext === null || dataContext === void 0 ? void 0 : dataContext.handleMountField(path);
@@ -189,7 +194,7 @@ export default function useDataValue(props) {
189
194
  name: props.name || ((_props$path = props.path) === null || _props$path === void 0 ? void 0 : _props$path.replace('/', '')) || id,
190
195
  value: toInput(value),
191
196
  error: inFieldBlock ? undefined : showError ? exportError : undefined,
192
- autoComplete: props.autoComplete ?? (dataContext.autoComplete === true ? 'on' : 'off'),
197
+ autoComplete: (_props$autoComplete = props.autoComplete) !== null && _props$autoComplete !== void 0 ? _props$autoComplete : dataContext.autoComplete === true ? 'on' : 'off',
193
198
  setHasFocus,
194
199
  handleFocus,
195
200
  handleBlur,
@@ -1 +1 @@
1
- {"version":3,"file":"useDataValue.js","names":["useRef","useEffect","useContext","useCallback","useMemo","useState","pointer","FormError","ajv","ajvErrorsToOneFormError","Context","FieldBlockContext","IterateElementContext","makeUniqueId","useDataValue","props","_props$path","path","elementPath","emptyValue","required","error","errorProp","onFocus","onBlur","onChange","validator","onBlurValidator","schema","errorMessages","validateInitially","validateUnchanged","continuousValidation","toInput","value","fromInput","id","dataContext","fieldBlockContext","iterateElementContext","handlePathChange","dataContextHandlePathChange","setPathWithError","dataContextSetPathWithError","errors","dataContextErrors","inFieldBlock","Boolean","setError","setFieldBlockError","setShowError","setShowFieldBlockError","inIterate","index","iterateElementIndex","iterateElementValue","handleChange","handleIterateElementChange","substring","Error","externalValue","undefined","has","get","data","setValue","changedRef","hasFocusRef","showError","schemaValidator","Object","keys","length","compile","setErrorAndUpdateDataContext","errorWithCorrectMessage","validationRule","validateValue","valueToValidate","Promise","resolve","then","showAllErrors","setHasFocus","hasFocus","valueOverride","current","handleFocus","handleBlur","argFromInput","newValue","iteratValuePath","exportError","handleMountField","handleUnMountField","_objectSpread","name","replace","autoComplete"],"sources":["../../../../../src/extensions/forms/hooks/useDataValue.ts"],"sourcesContent":["import {\n useRef,\n useEffect,\n useContext,\n useCallback,\n useMemo,\n useState,\n} from 'react'\nimport pointer from 'json-pointer'\nimport { FormError, FieldProps } from '../types'\nimport ajv, { ajvErrorsToOneFormError } from '../utils/ajv'\nimport { Context } from '../DataContext'\nimport FieldBlockContext from '../FieldBlock/FieldBlockContext'\nimport IterateElementContext from '../Iterate/IterateElementContext'\nimport { makeUniqueId } from '../../../shared/component-helper'\n\ninterface ReturnAdditional<Value> {\n id: string\n value: Value\n error: Error | FormError | undefined\n setHasFocus: (hasFocus: boolean, valueOverride?: unknown) => void\n handleFocus: () => void\n handleBlur: () => void\n handleChange: FieldProps<unknown>['onChange']\n}\n\nexport default function useDataValue<\n Value = unknown,\n Props extends FieldProps<Value> = FieldProps<Value>,\n>(props: Props): Props & ReturnAdditional<Value> {\n const {\n path,\n elementPath,\n emptyValue,\n required,\n error: errorProp,\n onFocus,\n onBlur,\n onChange,\n validator,\n onBlurValidator,\n schema,\n errorMessages,\n validateInitially,\n validateUnchanged,\n continuousValidation,\n toInput = (value) => value,\n fromInput = (value) => value,\n } = props\n const id = useMemo(() => props.id ?? makeUniqueId(), [props.id])\n const dataContext = useContext(Context)\n const fieldBlockContext = useContext(FieldBlockContext)\n const iterateElementContext = useContext(IterateElementContext)\n\n const {\n handlePathChange: dataContextHandlePathChange,\n setPathWithError: dataContextSetPathWithError,\n errors: dataContextErrors,\n } = dataContext ?? {}\n const inFieldBlock = Boolean(fieldBlockContext)\n const {\n setError: setFieldBlockError,\n setShowError: setShowFieldBlockError,\n } = fieldBlockContext ?? {}\n const inIterate = Boolean(iterateElementContext)\n const {\n index: iterateElementIndex,\n value: iterateElementValue,\n handleChange: handleIterateElementChange,\n } = iterateElementContext ?? {}\n\n if (path && path.substring(0, 1) !== '/') {\n throw new Error(\n 'Invalid path. Data value path JSON Pointers must be from root (starting with a /).'\n )\n }\n if (elementPath && elementPath.substring(0, 1) !== '/') {\n throw new Error(\n 'Invalid elementPath. Element pathJSON Pointers must be from root of iterate element (starting with a /).'\n )\n }\n if (elementPath && !iterateElementContext) {\n throw new Error(\n 'elementPath cannot be used when not inside an iterate element context. Wrap the component in an Iterate.Loop.'\n )\n }\n\n const externalValue = useMemo(() => {\n if (props.value !== undefined) {\n // Value-prop sent directly to the field has highest priority, overriding any surrounding source\n return props.value\n }\n\n if (inIterate && elementPath) {\n // This field is inside an iterate, and has a pointer from the base of the element being iterated\n if (elementPath === '/') {\n return iterateElementValue\n }\n\n return pointer.has(iterateElementValue, elementPath)\n ? pointer.get(iterateElementValue, elementPath)\n : undefined\n }\n\n if (dataContext.data && path) {\n // There is a surrounding data context and a path for where in the source to find the data\n if (path === '/') {\n return dataContext.data\n }\n\n return pointer.has(dataContext.data, path)\n ? pointer.get(dataContext.data, path)\n : undefined\n }\n return undefined\n }, [\n path,\n elementPath,\n inIterate,\n iterateElementValue,\n props.value,\n dataContext.data,\n ])\n\n // Hold an internal copy of the input value in case the input component is used uncontrolled,\n // and to handle errors in Eufemia on components that does not take updated callback functions into account.\n const [value, setValue] = useState(externalValue)\n const changedRef = useRef(false)\n const hasFocusRef = useRef(false)\n\n useEffect(() => {\n // When receiving the initial value, or receiving an updated value by props, update the internal value\n // so the component can be used \"controlled\".\n setValue(externalValue)\n }, [externalValue])\n\n // Error handling\n const [error, setError] = useState<Error | FormError | undefined>()\n const [showError, setShowError] = useState<boolean>(\n Boolean(validateInitially || errorProp)\n )\n const schemaValidator = useMemo(\n () =>\n schema && Object.keys(schema).length > 0\n ? ajv.compile(schema)\n : undefined,\n [schema]\n )\n\n const setErrorAndUpdateDataContext = useCallback(\n (error: FormError | undefined) => {\n const errorWithCorrectMessage =\n error instanceof FormError &&\n typeof error.validationRule === 'string' &&\n errorMessages?.[error.validationRule] !== undefined\n ? new FormError(errorMessages[error.validationRule])\n : error\n\n setError(errorWithCorrectMessage)\n\n if (path) {\n // Tell the data context about the error, so it can stop the user from submitting the form until the error has been fixed\n dataContextSetPathWithError?.(path, Boolean(error))\n }\n\n setFieldBlockError?.(path ?? id, errorWithCorrectMessage)\n },\n [\n path,\n id,\n errorMessages,\n dataContextSetPathWithError,\n setFieldBlockError,\n ]\n )\n\n const validateValue = useCallback(\n (valueToValidate): FormError | undefined => {\n // Prioritize received validator functions first\n // Possible future change: Merge errors if multiple, like one message with each message concatinated.\n if (typeof validator === 'function') {\n // Since the validator can return either a synchronous result or an asynchronous\n Promise.resolve(validator(valueToValidate))\n // This is a validator, so it is expected to resolve with an error when the value is invalid. If it\n // throws an error, it is not caught here as that will cause programmatic errors to show inside the form\n // as if they were operational errors.\n .then(setErrorAndUpdateDataContext)\n }\n\n if (valueToValidate === emptyValue && required) {\n const error = new FormError('The value is required', {\n validationRule: 'required',\n })\n setErrorAndUpdateDataContext(error)\n return error\n } else if (schemaValidator) {\n // This input has a direct schema (through props)\n if (valueToValidate === undefined && emptyValue === undefined) {\n // Avoid validating undefined-values if they are expected (set with emptyValue) as they will\n // usually fail against json-schema type\n setErrorAndUpdateDataContext(undefined)\n return undefined\n }\n schemaValidator(valueToValidate)\n const error = ajvErrorsToOneFormError(schemaValidator.errors)\n setErrorAndUpdateDataContext(error)\n return error\n } else {\n // Removing any previous error from required\n setErrorAndUpdateDataContext(undefined)\n return undefined\n }\n },\n [\n schemaValidator,\n emptyValue,\n required,\n setErrorAndUpdateDataContext,\n validator,\n ]\n )\n\n useEffect(() => {\n // If a surrounding data context has an error for this field (by path) and no error has been set by local component validation, use the data context error\n if (!error && path && dataContextErrors?.[path]) {\n setErrorAndUpdateDataContext(dataContextErrors[path])\n }\n }, [path, dataContextErrors, error, setErrorAndUpdateDataContext])\n\n useEffect(() => {\n if (dataContext.showAllErrors) {\n // If showError on a surrounding data context was changed and set to true, it is because the user clicked next, submit or\n // something else that should lead to showing the user all errors.\n setShowError(true)\n setShowFieldBlockError?.(path ?? id, true)\n }\n }, [id, path, dataContext.showAllErrors, setShowFieldBlockError])\n\n const setHasFocus = useCallback(\n (hasFocus: boolean, valueOverride?: unknown) => {\n if (hasFocus) {\n // Field was put in focus (like when clicking in a text field or opening a dropdown menu)\n hasFocusRef.current = true\n onFocus?.(valueOverride ?? value)\n } else {\n // Field was removed from focus (like when tabbing out of a text field or closing a dropdown menu)\n hasFocusRef.current = false\n onBlur?.(valueOverride ?? value)\n\n if (!changedRef.current && !validateUnchanged) {\n // Avoid showing errors when blurring without havinc hanged the value, so tabbing through several\n // fields does not make errors pop up all over the place\n return\n }\n\n // External blur validators makes it possible to validate values but not on every character change in case of\n // expensive validation calling external services etc.\n if (typeof onBlurValidator === 'function') {\n // Since the validator can return either a synchronous result or an asynchronous\n Promise.resolve(onBlurValidator(valueOverride ?? value))\n // This is a validator, so it is expected to resolve with an error when the value is invalid. If it\n // throws an error, it is not caught here as that will cause programmatic errors to show inside the form\n // as if they were operational errors.\n .then(setErrorAndUpdateDataContext)\n }\n\n // Since the user left the field, show error (if any)\n setShowError(true)\n setShowFieldBlockError?.(path ?? id, true)\n }\n },\n [\n id,\n path,\n value,\n validateUnchanged,\n onFocus,\n onBlur,\n onBlurValidator,\n setErrorAndUpdateDataContext,\n setShowFieldBlockError,\n ]\n )\n\n const handleFocus = useCallback(() => setHasFocus(true), [setHasFocus])\n const handleBlur = useCallback(() => setHasFocus(false), [setHasFocus])\n\n const handleChange = useCallback(\n (argFromInput) => {\n const newValue = fromInput(argFromInput)\n\n if (newValue === value) {\n // Avoid triggering a change if the value was not actually changed. This may be caused by rendering components\n // calling onChange even if the actual value did not change.\n return\n }\n setValue(newValue)\n changedRef.current = true\n\n if (\n continuousValidation ||\n (continuousValidation !== false && !hasFocusRef.current)\n ) {\n // When there is a change to the value without there having been any focus callback beforehand, it is likely\n // to believe that the blur callback will not be called either, which would trigger the display of the error.\n // The error is therefore displayed immediately (unless instructed not to with continuousValidation set to false).\n setShowError(true)\n setShowFieldBlockError?.(path ?? id, true)\n } else {\n // When changing the value, hide errors to avoid annoying the user before they are finished filling in that value\n setShowError(false)\n setShowFieldBlockError?.(path ?? id, false)\n }\n // Always validate the value immediately when it is changed\n validateValue(newValue)\n\n onChange?.(newValue)\n if (path) {\n dataContextHandlePathChange?.(path, newValue)\n }\n if (elementPath) {\n const iteratValuePath = `/${iterateElementIndex}${\n elementPath && elementPath !== '/' ? elementPath : ''\n }`\n handleIterateElementChange?.(iteratValuePath, newValue)\n }\n },\n [\n id,\n path,\n elementPath,\n iterateElementIndex,\n value,\n continuousValidation,\n onChange,\n validateValue,\n dataContextHandlePathChange,\n setShowFieldBlockError,\n handleIterateElementChange,\n fromInput,\n ]\n )\n\n const exportError = useMemo(() => errorProp ?? error, [errorProp, error])\n\n useEffect(() => {\n // Mount procedure\n if (path) {\n dataContext?.handleMountField(path)\n }\n validateValue(externalValue)\n\n return () => {\n // Unmount procedure\n if (path) {\n dataContext?.handleUnMountField(path)\n }\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps -- Only run for mount and unmount\n }, [])\n\n return {\n ...props,\n id,\n name: props.name || props.path?.replace('/', '') || id,\n value: toInput(value),\n error: inFieldBlock ? undefined : showError ? exportError : undefined,\n autoComplete:\n props.autoComplete ??\n (dataContext.autoComplete === true ? 'on' : 'off'),\n setHasFocus,\n handleFocus,\n handleBlur,\n handleChange,\n }\n}\n"],"mappings":";;;AAAA,S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AAID,KAAK,CAACE,IAAI,cAAAD,WAAA,uBAAVA,WAAA,CAAYiF,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC,KAAI7D,EAAE;IACtDF,KAAK,EAAED,OAAO,CAACC,KAAK,CAAC;IACrBb,KAAK,EAAEyB,YAAY,GAAGe,SAAS,GAAGO,SAAS,GAAGwB,WAAW,GAAG/B,SAAS;IACrEqC,YAAY,EACVnF,KAAK,CAACmF,YAAY,KACjB7D,WAAW,CAAC6D,YAAY,KAAK,IAAI,GAAG,IAAI,GAAG,KAAK,CAAC;IACpDf,WAAW;IACXI,WAAW;IACXC,UAAU;IACVhC;EAAY;AAEhB"}
1
+ {"version":3,"file":"useDataValue.js","names":["useRef","useEffect","useContext","useCallback","useMemo","useState","pointer","FormError","ajv","ajvErrorsToOneFormError","Context","FieldBlockContext","IterateElementContext","makeUniqueId","useDataValue","props","_props$path","_props$autoComplete","path","elementPath","emptyValue","required","error","errorProp","onFocus","onBlur","onChange","validator","onBlurValidator","schema","errorMessages","validateInitially","validateUnchanged","continuousValidation","toInput","value","fromInput","id","_props$id","dataContext","fieldBlockContext","iterateElementContext","handlePathChange","dataContextHandlePathChange","setPathWithError","dataContextSetPathWithError","errors","dataContextErrors","inFieldBlock","Boolean","setError","setFieldBlockError","setShowError","setShowFieldBlockError","inIterate","index","iterateElementIndex","iterateElementValue","handleChange","handleIterateElementChange","substring","Error","externalValue","undefined","has","get","data","setValue","changedRef","hasFocusRef","showError","schemaValidator","Object","keys","length","compile","setErrorAndUpdateDataContext","errorWithCorrectMessage","validationRule","validateValue","valueToValidate","Promise","resolve","then","showAllErrors","setHasFocus","hasFocus","valueOverride","current","handleFocus","handleBlur","argFromInput","newValue","iterateValuePath","exportError","handleMountField","handleUnMountField","_objectSpread","name","replace","autoComplete"],"sources":["../../../../../src/extensions/forms/hooks/useDataValue.ts"],"sourcesContent":["import {\n useRef,\n useEffect,\n useContext,\n useCallback,\n useMemo,\n useState,\n} from 'react'\nimport pointer from 'json-pointer'\nimport { FormError, FieldProps } from '../types'\nimport ajv, { ajvErrorsToOneFormError } from '../utils/ajv'\nimport { Context } from '../DataContext'\nimport FieldBlockContext from '../FieldBlock/FieldBlockContext'\nimport IterateElementContext from '../Iterate/IterateElementContext'\nimport { makeUniqueId } from '../../../shared/component-helper'\n\ninterface ReturnAdditional<Value> {\n id: string\n value: Value\n error: Error | FormError | undefined\n setHasFocus: (hasFocus: boolean, valueOverride?: unknown) => void\n handleFocus: () => void\n handleBlur: () => void\n handleChange: FieldProps<unknown>['onChange']\n}\n\nexport default function useDataValue<\n Value = unknown,\n Props extends FieldProps<Value> = FieldProps<Value>,\n>(props: Props): Props & ReturnAdditional<Value> {\n const {\n path,\n elementPath,\n emptyValue,\n required,\n error: errorProp,\n onFocus,\n onBlur,\n onChange,\n validator,\n onBlurValidator,\n schema,\n errorMessages,\n validateInitially,\n validateUnchanged,\n continuousValidation,\n toInput = (value) => value,\n fromInput = (value) => value,\n } = props\n const id = useMemo(() => props.id ?? makeUniqueId(), [props.id])\n const dataContext = useContext(Context)\n const fieldBlockContext = useContext(FieldBlockContext)\n const iterateElementContext = useContext(IterateElementContext)\n\n const {\n handlePathChange: dataContextHandlePathChange,\n setPathWithError: dataContextSetPathWithError,\n errors: dataContextErrors,\n } = dataContext ?? {}\n const inFieldBlock = Boolean(fieldBlockContext)\n const {\n setError: setFieldBlockError,\n setShowError: setShowFieldBlockError,\n } = fieldBlockContext ?? {}\n const inIterate = Boolean(iterateElementContext)\n const {\n index: iterateElementIndex,\n value: iterateElementValue,\n handleChange: handleIterateElementChange,\n } = iterateElementContext ?? {}\n\n if (path && path.substring(0, 1) !== '/') {\n throw new Error(\n 'Invalid path. Data value path JSON Pointers must be from root (starting with a /).'\n )\n }\n if (elementPath && elementPath.substring(0, 1) !== '/') {\n throw new Error(\n 'Invalid elementPath. Element pathJSON Pointers must be from root of iterate element (starting with a /).'\n )\n }\n if (elementPath && !iterateElementContext) {\n throw new Error(\n 'elementPath cannot be used when not inside an iterate element context. Wrap the component in an Iterate.Loop.'\n )\n }\n\n const externalValue = useMemo(() => {\n if (props.value !== undefined) {\n // Value-prop sent directly to the field has highest priority, overriding any surrounding source\n return props.value\n }\n\n if (inIterate && elementPath) {\n // This field is inside an iterate, and has a pointer from the base of the element being iterated\n if (elementPath === '/') {\n return iterateElementValue\n }\n\n return pointer.has(iterateElementValue, elementPath)\n ? pointer.get(iterateElementValue, elementPath)\n : undefined\n }\n\n if (dataContext.data && path) {\n // There is a surrounding data context and a path for where in the source to find the data\n if (path === '/') {\n return dataContext.data\n }\n\n return pointer.has(dataContext.data, path)\n ? pointer.get(dataContext.data, path)\n : undefined\n }\n return undefined\n }, [\n path,\n elementPath,\n inIterate,\n iterateElementValue,\n props.value,\n dataContext.data,\n ])\n\n // Hold an internal copy of the input value in case the input component is used uncontrolled,\n // and to handle errors in Eufemia on components that does not take updated callback functions into account.\n const [value, setValue] = useState(externalValue)\n const changedRef = useRef(false)\n const hasFocusRef = useRef(false)\n\n useEffect(() => {\n // When receiving the initial value, or receiving an updated value by props, update the internal value\n // so the component can be used \"controlled\".\n setValue(externalValue)\n }, [externalValue])\n\n // Error handling\n const [error, setError] = useState<Error | FormError | undefined>()\n const [showError, setShowError] = useState<boolean>(\n Boolean(validateInitially || errorProp)\n )\n const schemaValidator = useMemo(\n () =>\n schema && Object.keys(schema).length > 0\n ? ajv.compile(schema)\n : undefined,\n [schema]\n )\n\n const setErrorAndUpdateDataContext = useCallback(\n (error: FormError | undefined) => {\n const errorWithCorrectMessage =\n error instanceof FormError &&\n typeof error.validationRule === 'string' &&\n errorMessages?.[error.validationRule] !== undefined\n ? new FormError(errorMessages[error.validationRule])\n : error\n\n setError(errorWithCorrectMessage)\n\n if (path) {\n // Tell the data context about the error, so it can stop the user from submitting the form until the error has been fixed\n dataContextSetPathWithError?.(path, Boolean(error))\n }\n\n setFieldBlockError?.(path ?? id, errorWithCorrectMessage)\n },\n [\n path,\n id,\n errorMessages,\n dataContextSetPathWithError,\n setFieldBlockError,\n ]\n )\n\n const validateValue = useCallback(\n (valueToValidate): FormError | undefined => {\n // Prioritize received validator functions first\n // Possible future change: Merge errors if multiple, like one message with each message concatenated.\n if (typeof validator === 'function') {\n // Since the validator can return either a synchronous result or an asynchronous\n Promise.resolve(validator(valueToValidate))\n // This is a validator, so it is expected to resolve with an error when the value is invalid. If it\n // throws an error, it is not caught here as that will cause programmatic errors to show inside the form\n // as if they were operational errors.\n .then(setErrorAndUpdateDataContext)\n }\n\n if (valueToValidate === emptyValue && required) {\n const error = new FormError('The value is required', {\n validationRule: 'required',\n })\n setErrorAndUpdateDataContext(error)\n return error\n } else if (schemaValidator) {\n // This input has a direct schema (through props)\n if (valueToValidate === undefined && emptyValue === undefined) {\n // Avoid validating undefined-values if they are expected (set with emptyValue) as they will\n // usually fail against json-schema type\n setErrorAndUpdateDataContext(undefined)\n return undefined\n }\n schemaValidator(valueToValidate)\n const error = ajvErrorsToOneFormError(schemaValidator.errors)\n setErrorAndUpdateDataContext(error)\n return error\n } else {\n // Removing any previous error from required\n setErrorAndUpdateDataContext(undefined)\n return undefined\n }\n },\n [\n schemaValidator,\n emptyValue,\n required,\n setErrorAndUpdateDataContext,\n validator,\n ]\n )\n\n useEffect(() => {\n // If a surrounding data context has an error for this field (by path) and no error has been set by local component validation, use the data context error\n if (!error && path && dataContextErrors?.[path]) {\n setErrorAndUpdateDataContext(dataContextErrors[path])\n }\n }, [path, dataContextErrors, error, setErrorAndUpdateDataContext])\n\n useEffect(() => {\n if (dataContext.showAllErrors) {\n // If showError on a surrounding data context was changed and set to true, it is because the user clicked next, submit or\n // something else that should lead to showing the user all errors.\n setShowError(true)\n setShowFieldBlockError?.(path ?? id, true)\n }\n }, [id, path, dataContext.showAllErrors, setShowFieldBlockError])\n\n const setHasFocus = useCallback(\n (hasFocus: boolean, valueOverride?: unknown) => {\n if (hasFocus) {\n // Field was put in focus (like when clicking in a text field or opening a dropdown menu)\n hasFocusRef.current = true\n onFocus?.(valueOverride ?? value)\n } else {\n // Field was removed from focus (like when tabbing out of a text field or closing a dropdown menu)\n hasFocusRef.current = false\n onBlur?.(valueOverride ?? value)\n\n if (!changedRef.current && !validateUnchanged) {\n // Avoid showing errors when blurring without having changed the value, so tabbing through several\n // fields does not make errors pop up all over the place\n return\n }\n\n // External blur validators makes it possible to validate values but not on every character change in case of\n // expensive validation calling external services etc.\n if (typeof onBlurValidator === 'function') {\n // Since the validator can return either a synchronous result or an asynchronous\n Promise.resolve(onBlurValidator(valueOverride ?? value))\n // This is a validator, so it is expected to resolve with an error when the value is invalid. If it\n // throws an error, it is not caught here as that will cause programmatic errors to show inside the form\n // as if they were operational errors.\n .then(setErrorAndUpdateDataContext)\n }\n\n // Since the user left the field, show error (if any)\n setShowError(true)\n setShowFieldBlockError?.(path ?? id, true)\n }\n },\n [\n id,\n path,\n value,\n validateUnchanged,\n onFocus,\n onBlur,\n onBlurValidator,\n setErrorAndUpdateDataContext,\n setShowFieldBlockError,\n ]\n )\n\n const handleFocus = useCallback(() => setHasFocus(true), [setHasFocus])\n const handleBlur = useCallback(() => setHasFocus(false), [setHasFocus])\n\n const handleChange = useCallback(\n (argFromInput) => {\n const newValue = fromInput(argFromInput)\n\n if (newValue === value) {\n // Avoid triggering a change if the value was not actually changed. This may be caused by rendering components\n // calling onChange even if the actual value did not change.\n return\n }\n setValue(newValue)\n changedRef.current = true\n\n if (\n continuousValidation ||\n (continuousValidation !== false && !hasFocusRef.current)\n ) {\n // When there is a change to the value without there having been any focus callback beforehand, it is likely\n // to believe that the blur callback will not be called either, which would trigger the display of the error.\n // The error is therefore displayed immediately (unless instructed not to with continuousValidation set to false).\n setShowError(true)\n setShowFieldBlockError?.(path ?? id, true)\n } else {\n // When changing the value, hide errors to avoid annoying the user before they are finished filling in that value\n setShowError(false)\n setShowFieldBlockError?.(path ?? id, false)\n }\n // Always validate the value immediately when it is changed\n validateValue(newValue)\n\n onChange?.(newValue)\n if (path) {\n dataContextHandlePathChange?.(path, newValue)\n }\n if (elementPath) {\n const iterateValuePath = `/${iterateElementIndex}${\n elementPath && elementPath !== '/' ? elementPath : ''\n }`\n handleIterateElementChange?.(iterateValuePath, newValue)\n }\n },\n [\n id,\n path,\n elementPath,\n iterateElementIndex,\n value,\n continuousValidation,\n onChange,\n validateValue,\n dataContextHandlePathChange,\n setShowFieldBlockError,\n handleIterateElementChange,\n fromInput,\n ]\n )\n\n const exportError = useMemo(() => errorProp ?? error, [errorProp, error])\n\n useEffect(() => {\n // Mount procedure\n if (path) {\n dataContext?.handleMountField(path)\n }\n validateValue(externalValue)\n\n return () => {\n // Unmount procedure\n if (path) {\n dataContext?.handleUnMountField(path)\n }\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps -- Only run for mount and unmount\n }, [])\n\n return {\n ...props,\n id,\n name: props.name || props.path?.replace('/', '') || id,\n value: toInput(value),\n error: inFieldBlock ? undefined : showError ? exportError : undefined,\n autoComplete:\n props.autoComplete ??\n (dataContext.autoComplete === true ? 'on' : 'off'),\n setHasFocus,\n handleFocus,\n handleBlur,\n handleChange,\n }\n}\n"],"mappings":";;;;;AAAA,SACEA,MAAM,EACNC,SAAS,EACTC,UAAU,EACVC,WAAW,EACXC,OAAO,EACPC,QAAQ,QACH,OAAO;AACd,OAAOC,OAAO,MAAM,cAAc;AAClC,SAASC,SAAS,QAAoB,UAAU;AAChD,OAAOC,GAAG,IAAIC,uBAAuB,QAAQ,cAAc;AAC3D,SAASC,OAAO,QAAQ,gBAAgB;AACxC,OAAOC,iBAAiB,MAAM,iCAAiC;AAC/D,OAAOC,qBAAqB,MAAM,kCAAkC;AACpE,SAASC,YAAY,QAAQ,kCAAkC;AAY/D,eAAe,SAASC,YAAYA,CAGlCC,KAAY,EAAmC;EAAA,IAAAC,WAAA,EAAAC,mBAAA;EAC/C,MAAM;IACJC,IAAI;IACJC,WAAW;IACXC,UAAU;IACVC,QAAQ;IACRC,KAAK,EAAEC,SAAS;IAChBC,OAAO;IACPC,MAAM;IACNC,QAAQ;IACRC,SA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