@dnb/eufemia 10.13.0 → 10.14.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 (885) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/cjs/components/accordion/AccordionContent.js +1 -0
  3. package/cjs/components/accordion/AccordionContent.js.map +1 -1
  4. package/cjs/components/anchor/Anchor.js +1 -0
  5. package/cjs/components/anchor/Anchor.js.map +1 -1
  6. package/cjs/components/autocomplete/Autocomplete.js +80 -77
  7. package/cjs/components/autocomplete/Autocomplete.js.map +1 -1
  8. package/cjs/components/avatar/Avatar.js +1 -0
  9. package/cjs/components/avatar/Avatar.js.map +1 -1
  10. package/cjs/components/avatar/AvatarGroup.js +1 -0
  11. package/cjs/components/avatar/AvatarGroup.js.map +1 -1
  12. package/cjs/components/badge/Badge.js +1 -0
  13. package/cjs/components/badge/Badge.js.map +1 -1
  14. package/cjs/components/breadcrumb/BreadcrumbItem.js +1 -0
  15. package/cjs/components/breadcrumb/BreadcrumbItem.js.map +1 -1
  16. package/cjs/components/button/Button.js +2 -0
  17. package/cjs/components/button/Button.js.map +1 -1
  18. package/cjs/components/checkbox/Checkbox.js +2 -0
  19. package/cjs/components/checkbox/Checkbox.js.map +1 -1
  20. package/cjs/components/date-picker/DatePicker.js +2 -0
  21. package/cjs/components/date-picker/DatePicker.js.map +1 -1
  22. package/cjs/components/date-picker/DatePickerProvider.js +1 -0
  23. package/cjs/components/date-picker/DatePickerProvider.js.map +1 -1
  24. package/cjs/components/dropdown/Dropdown.js +1 -0
  25. package/cjs/components/dropdown/Dropdown.js.map +1 -1
  26. package/cjs/components/flex/Container.js +1 -0
  27. package/cjs/components/flex/Container.js.map +1 -1
  28. package/cjs/components/flex/Flex.d.ts +1 -1
  29. package/cjs/components/flex/Flex.js +1 -1
  30. package/cjs/components/flex/Flex.js.map +1 -1
  31. package/cjs/components/flex/export.d.ts +5 -0
  32. package/cjs/components/flex/export.js +42 -0
  33. package/cjs/components/flex/export.js.map +1 -0
  34. package/cjs/components/flex/index.d.ts +2 -5
  35. package/cjs/components/flex/index.js +5 -36
  36. package/cjs/components/flex/index.js.map +1 -1
  37. package/cjs/components/form-label/FormLabel.d.ts +1 -0
  38. package/cjs/components/form-label/FormLabel.js +2 -0
  39. package/cjs/components/form-label/FormLabel.js.map +1 -1
  40. package/cjs/components/form-row/FormRow.js +1 -0
  41. package/cjs/components/form-row/FormRow.js.map +1 -1
  42. package/cjs/components/form-set/FormSet.js +1 -0
  43. package/cjs/components/form-set/FormSet.js.map +1 -1
  44. package/cjs/components/form-status/FormStatus.js +1 -0
  45. package/cjs/components/form-status/FormStatus.js.map +1 -1
  46. package/cjs/components/global-error/GlobalError.js +1 -0
  47. package/cjs/components/global-error/GlobalError.js.map +1 -1
  48. package/cjs/components/global-status/GlobalStatus.js +1 -0
  49. package/cjs/components/global-status/GlobalStatus.js.map +1 -1
  50. package/cjs/components/grid/Grid.d.ts +1 -1
  51. package/cjs/components/grid/Grid.js +1 -1
  52. package/cjs/components/grid/Grid.js.map +1 -1
  53. package/cjs/components/grid/export.d.ts +2 -0
  54. package/cjs/components/grid/export.js +21 -0
  55. package/cjs/components/grid/export.js.map +1 -0
  56. package/cjs/components/grid/index.d.ts +2 -2
  57. package/cjs/components/grid/index.js +5 -15
  58. package/cjs/components/grid/index.js.map +1 -1
  59. package/cjs/components/heading/Heading.js +1 -0
  60. package/cjs/components/heading/Heading.js.map +1 -1
  61. package/cjs/components/help-button/HelpButton.js +1 -0
  62. package/cjs/components/help-button/HelpButton.js.map +1 -1
  63. package/cjs/components/help-button/HelpButtonInstance.js +1 -0
  64. package/cjs/components/help-button/HelpButtonInstance.js.map +1 -1
  65. package/cjs/components/icon/Icon.js +1 -0
  66. package/cjs/components/icon/Icon.js.map +1 -1
  67. package/cjs/components/icon-primary/IconPrimary.js +1 -0
  68. package/cjs/components/icon-primary/IconPrimary.js.map +1 -1
  69. package/cjs/components/info-card/InfoCard.js +1 -0
  70. package/cjs/components/info-card/InfoCard.js.map +1 -1
  71. package/cjs/components/input/Input.d.ts +4 -0
  72. package/cjs/components/input/Input.js +12 -2
  73. package/cjs/components/input/Input.js.map +1 -1
  74. package/cjs/components/input/InputPassword.js +2 -0
  75. package/cjs/components/input/InputPassword.js.map +1 -1
  76. package/cjs/components/input-masked/InputMasked.js +2 -0
  77. package/cjs/components/input-masked/InputMasked.js.map +1 -1
  78. package/cjs/components/input-masked/MultiInputMask.d.ts +9 -1
  79. package/cjs/components/input-masked/MultiInputMask.js +14 -7
  80. package/cjs/components/input-masked/MultiInputMask.js.map +1 -1
  81. package/cjs/components/input-masked/TextMask.d.ts +1 -1
  82. package/cjs/components/input-masked/hooks/useHandleCursorPosition.js +1 -1
  83. package/cjs/components/input-masked/hooks/useHandleCursorPosition.js.map +1 -1
  84. package/cjs/components/lib.d.ts +2 -0
  85. package/cjs/components/logo/Logo.js +1 -0
  86. package/cjs/components/logo/Logo.js.map +1 -1
  87. package/cjs/components/modal/Modal.js +1 -0
  88. package/cjs/components/modal/Modal.js.map +1 -1
  89. package/cjs/components/modal/ModalContent.js +1 -0
  90. package/cjs/components/modal/ModalContent.js.map +1 -1
  91. package/cjs/components/modal/parts/CloseButton.js +1 -0
  92. package/cjs/components/modal/parts/CloseButton.js.map +1 -1
  93. package/cjs/components/number-format/NumberFormat.js +1 -0
  94. package/cjs/components/number-format/NumberFormat.js.map +1 -1
  95. package/cjs/components/number-format/NumberUtils.js +1 -0
  96. package/cjs/components/number-format/NumberUtils.js.map +1 -1
  97. package/cjs/components/pagination/PaginationHelpers.js +1 -0
  98. package/cjs/components/pagination/PaginationHelpers.js.map +1 -1
  99. package/cjs/components/pagination/PaginationInfinity.js +1 -0
  100. package/cjs/components/pagination/PaginationInfinity.js.map +1 -1
  101. package/cjs/components/pagination/PaginationProvider.js +1 -0
  102. package/cjs/components/pagination/PaginationProvider.js.map +1 -1
  103. package/cjs/components/progress-indicator/ProgressIndicator.js +1 -0
  104. package/cjs/components/progress-indicator/ProgressIndicator.js.map +1 -1
  105. package/cjs/components/radio/Radio.js +4 -2
  106. package/cjs/components/radio/Radio.js.map +1 -1
  107. package/cjs/components/radio/RadioGroup.js +5 -4
  108. package/cjs/components/radio/RadioGroup.js.map +1 -1
  109. package/cjs/components/radio/style/dnb-radio.css +106 -0
  110. package/cjs/components/radio/style/dnb-radio.min.css +1 -1
  111. package/cjs/components/radio/style/dnb-radio.scss +202 -0
  112. package/cjs/components/radio/style/themes/dnb-radio-theme-sbanken.css +26 -0
  113. package/cjs/components/radio/style/themes/dnb-radio-theme-sbanken.min.css +1 -0
  114. package/cjs/components/radio/style/themes/dnb-radio-theme-sbanken.scss +33 -0
  115. package/cjs/components/radio/style/themes/dnb-radio-theme-ui.css +20 -86
  116. package/cjs/components/radio/style/themes/dnb-radio-theme-ui.min.css +1 -1
  117. package/cjs/components/radio/style/themes/dnb-radio-theme-ui.scss +26 -143
  118. package/cjs/components/section/Section.js +1 -0
  119. package/cjs/components/section/Section.js.map +1 -1
  120. package/cjs/components/skeleton/Skeleton.js +1 -0
  121. package/cjs/components/skeleton/Skeleton.js.map +1 -1
  122. package/cjs/components/skeleton/figures/Article.js +1 -0
  123. package/cjs/components/skeleton/figures/Article.js.map +1 -1
  124. package/cjs/components/skeleton/figures/Circle.js +1 -0
  125. package/cjs/components/skeleton/figures/Circle.js.map +1 -1
  126. package/cjs/components/skeleton/figures/Product.js +1 -0
  127. package/cjs/components/skeleton/figures/Product.js.map +1 -1
  128. package/cjs/components/skeleton/figures/Table.js +1 -0
  129. package/cjs/components/skeleton/figures/Table.js.map +1 -1
  130. package/cjs/components/slider/Slider.d.ts +1 -0
  131. package/cjs/components/slider/Slider.js +1 -0
  132. package/cjs/components/slider/Slider.js.map +1 -1
  133. package/cjs/components/slider/SliderInstance.js +1 -0
  134. package/cjs/components/slider/SliderInstance.js.map +1 -1
  135. package/cjs/components/slider/SliderProvider.js +1 -0
  136. package/cjs/components/slider/SliderProvider.js.map +1 -1
  137. package/cjs/components/space/Space.js +1 -0
  138. package/cjs/components/space/Space.js.map +1 -1
  139. package/cjs/components/switch/Switch.js +2 -0
  140. package/cjs/components/switch/Switch.js.map +1 -1
  141. package/cjs/components/table/Table.js +1 -0
  142. package/cjs/components/table/Table.js.map +1 -1
  143. package/cjs/components/tabs/Tabs.js +1 -0
  144. package/cjs/components/tabs/Tabs.js.map +1 -1
  145. package/cjs/components/tag/Tag.d.ts +1 -0
  146. package/cjs/components/tag/Tag.js +2 -0
  147. package/cjs/components/tag/Tag.js.map +1 -1
  148. package/cjs/components/tag/TagGroup.js +1 -0
  149. package/cjs/components/tag/TagGroup.js.map +1 -1
  150. package/cjs/components/textarea/Textarea.js +2 -0
  151. package/cjs/components/textarea/Textarea.js.map +1 -1
  152. package/cjs/components/timeline/Timeline.js +1 -0
  153. package/cjs/components/timeline/Timeline.js.map +1 -1
  154. package/cjs/components/timeline/TimelineItem.js +1 -0
  155. package/cjs/components/timeline/TimelineItem.js.map +1 -1
  156. package/cjs/components/toggle-button/ToggleButton.js +2 -0
  157. package/cjs/components/toggle-button/ToggleButton.js.map +1 -1
  158. package/cjs/components/toggle-button/ToggleButtonGroup.js +5 -4
  159. package/cjs/components/toggle-button/ToggleButtonGroup.js.map +1 -1
  160. package/cjs/components/tooltip/Tooltip.js +1 -0
  161. package/cjs/components/tooltip/Tooltip.js.map +1 -1
  162. package/cjs/components/tooltip/TooltipPortal.js +1 -0
  163. package/cjs/components/tooltip/TooltipPortal.js.map +1 -1
  164. package/cjs/components/upload/Upload.d.ts +1 -0
  165. package/cjs/components/upload/Upload.js +2 -0
  166. package/cjs/components/upload/Upload.js.map +1 -1
  167. package/cjs/components/upload/useUpload.js +1 -0
  168. package/cjs/components/upload/useUpload.js.map +1 -1
  169. package/cjs/components/visually-hidden/VisuallyHidden.js +1 -0
  170. package/cjs/components/visually-hidden/VisuallyHidden.js.map +1 -1
  171. package/cjs/elements/Element.js +1 -0
  172. package/cjs/elements/Element.js.map +1 -1
  173. package/cjs/elements/typography/H.js +1 -0
  174. package/cjs/elements/typography/H.js.map +1 -1
  175. package/cjs/extensions/forms/DataContext/Provider/Provider.js +52 -42
  176. package/cjs/extensions/forms/DataContext/Provider/Provider.js.map +1 -1
  177. package/cjs/extensions/forms/Field/BankAccountNumber/BankAccountNumber.js +8 -5
  178. package/cjs/extensions/forms/Field/BankAccountNumber/BankAccountNumber.js.map +1 -1
  179. package/cjs/extensions/forms/Field/Email/Email.js +6 -4
  180. package/cjs/extensions/forms/Field/Email/Email.js.map +1 -1
  181. package/cjs/extensions/forms/Field/Expiry/Expiry.d.ts +7 -0
  182. package/cjs/extensions/forms/Field/Expiry/Expiry.js +99 -0
  183. package/cjs/extensions/forms/Field/Expiry/Expiry.js.map +1 -0
  184. package/cjs/extensions/forms/Field/Expiry/index.d.ts +2 -0
  185. package/cjs/extensions/forms/Field/Expiry/index.js +27 -0
  186. package/cjs/extensions/forms/Field/Expiry/index.js.map +1 -0
  187. package/cjs/extensions/forms/Field/Expiry/style/dnb-expiry.css +12 -0
  188. package/cjs/extensions/forms/Field/Expiry/style/dnb-expiry.min.css +1 -0
  189. package/cjs/extensions/forms/Field/Expiry/style/dnb-expiry.scss +9 -0
  190. package/cjs/extensions/forms/Field/NationalIdentityNumber/NationalIdentityNumber.js +8 -5
  191. package/cjs/extensions/forms/Field/NationalIdentityNumber/NationalIdentityNumber.js.map +1 -1
  192. package/cjs/extensions/forms/Field/Number/Number.js +47 -25
  193. package/cjs/extensions/forms/Field/Number/Number.js.map +1 -1
  194. package/cjs/extensions/forms/Field/OrganizationNumber/OrganizationNumber.js +8 -5
  195. package/cjs/extensions/forms/Field/OrganizationNumber/OrganizationNumber.js.map +1 -1
  196. package/cjs/extensions/forms/Field/PhoneNumber/PhoneNumber.js +46 -33
  197. package/cjs/extensions/forms/Field/PhoneNumber/PhoneNumber.js.map +1 -1
  198. package/cjs/extensions/forms/Field/SelectCountry/SelectCountry.js +6 -4
  199. package/cjs/extensions/forms/Field/SelectCountry/SelectCountry.js.map +1 -1
  200. package/cjs/extensions/forms/Field/String/String.js +30 -20
  201. package/cjs/extensions/forms/Field/String/String.js.map +1 -1
  202. package/cjs/extensions/forms/Field/index.d.ts +1 -0
  203. package/cjs/extensions/forms/Field/index.js +7 -0
  204. package/cjs/extensions/forms/Field/index.js.map +1 -1
  205. package/cjs/extensions/forms/Field/style/dnb-forms-field.css +13 -0
  206. package/cjs/extensions/forms/Field/style/dnb-forms-field.min.css +1 -1
  207. package/cjs/extensions/forms/Field/style/dnb-forms-field.scss +1 -0
  208. package/cjs/extensions/forms/FieldBlock/FieldBlock.js +36 -2
  209. package/cjs/extensions/forms/FieldBlock/FieldBlock.js.map +1 -1
  210. package/cjs/extensions/forms/Form/Element/Element.js +1 -0
  211. package/cjs/extensions/forms/Form/Element/Element.js.map +1 -1
  212. package/cjs/extensions/forms/Form/Handler/Handler.js +1 -0
  213. package/cjs/extensions/forms/Form/Handler/Handler.js.map +1 -1
  214. package/cjs/extensions/forms/hooks/index.d.ts +3 -0
  215. package/cjs/extensions/forms/hooks/index.js +21 -0
  216. package/cjs/extensions/forms/hooks/index.js.map +1 -1
  217. package/cjs/extensions/forms/hooks/useDataValue.js +127 -61
  218. package/cjs/extensions/forms/hooks/useDataValue.js.map +1 -1
  219. package/cjs/extensions/forms/hooks/useMountEffect.d.ts +5 -0
  220. package/cjs/extensions/forms/hooks/useMountEffect.js +14 -0
  221. package/cjs/extensions/forms/hooks/useMountEffect.js.map +1 -0
  222. package/cjs/extensions/forms/hooks/useProcessManager.d.ts +6 -0
  223. package/cjs/extensions/forms/hooks/useProcessManager.js +21 -0
  224. package/cjs/extensions/forms/hooks/useProcessManager.js.map +1 -0
  225. package/cjs/extensions/forms/hooks/useUpdateEffect.d.ts +5 -0
  226. package/cjs/extensions/forms/hooks/useUpdateEffect.js +19 -0
  227. package/cjs/extensions/forms/hooks/useUpdateEffect.js.map +1 -0
  228. package/cjs/extensions/forms/style/dnb-forms.css +13 -0
  229. package/cjs/extensions/forms/style/dnb-forms.min.css +1 -1
  230. package/cjs/extensions/forms/types.d.ts +10 -2
  231. package/cjs/extensions/forms/types.js +2 -0
  232. package/cjs/extensions/forms/types.js.map +1 -1
  233. package/cjs/extensions/forms/utils/ajv.js +25 -1
  234. package/cjs/extensions/forms/utils/ajv.js.map +1 -1
  235. package/cjs/extensions/forms/utils/errors.d.ts +2 -0
  236. package/cjs/extensions/forms/utils/errors.js +16 -0
  237. package/cjs/extensions/forms/utils/errors.js.map +1 -0
  238. package/cjs/extensions/forms/utils/index.d.ts +1 -0
  239. package/cjs/extensions/forms/utils/index.js +12 -0
  240. package/cjs/extensions/forms/utils/index.js.map +1 -1
  241. package/cjs/extensions/payment-card/PaymentCard.js +1 -0
  242. package/cjs/extensions/payment-card/PaymentCard.js.map +1 -1
  243. package/cjs/fragments/drawer-list/DrawerListProvider.js +1 -0
  244. package/cjs/fragments/drawer-list/DrawerListProvider.js.map +1 -1
  245. package/cjs/fragments/scroll-view/ScrollView.js +1 -0
  246. package/cjs/fragments/scroll-view/ScrollView.js.map +1 -1
  247. package/cjs/shared/Eufemia.d.ts +1 -1
  248. package/cjs/shared/Eufemia.js +2 -2
  249. package/cjs/shared/Eufemia.js.map +1 -1
  250. package/cjs/shared/MediaQuery.js +1 -0
  251. package/cjs/shared/MediaQuery.js.map +1 -1
  252. package/cjs/shared/Provider.js +1 -0
  253. package/cjs/shared/Provider.js.map +1 -1
  254. package/cjs/shared/Theme.js +1 -0
  255. package/cjs/shared/Theme.js.map +1 -1
  256. package/cjs/shared/VisibilityByTheme.js +1 -0
  257. package/cjs/shared/VisibilityByTheme.js.map +1 -1
  258. package/cjs/shared/index.js +1 -0
  259. package/cjs/shared/index.js.map +1 -1
  260. package/cjs/shared/locales/en-GB.d.ts +11 -0
  261. package/cjs/shared/locales/en-GB.js +12 -1
  262. package/cjs/shared/locales/en-GB.js.map +1 -1
  263. package/cjs/shared/locales/en-US.d.ts +11 -0
  264. package/cjs/shared/locales/index.d.ts +22 -0
  265. package/cjs/shared/locales/nb-NO.d.ts +11 -0
  266. package/cjs/shared/locales/nb-NO.js +12 -1
  267. package/cjs/shared/locales/nb-NO.js.map +1 -1
  268. package/cjs/shared/useMedia.js +1 -0
  269. package/cjs/shared/useMedia.js.map +1 -1
  270. package/cjs/shared/useMediaQuery.js +1 -0
  271. package/cjs/shared/useMediaQuery.js.map +1 -1
  272. package/cjs/shared/useTheme.js +1 -0
  273. package/cjs/shared/useTheme.js.map +1 -1
  274. package/cjs/shared/useTranslation.js +1 -0
  275. package/cjs/shared/useTranslation.js.map +1 -1
  276. package/cjs/style/dnb-ui-components.css +106 -0
  277. package/cjs/style/dnb-ui-components.min.css +1 -1
  278. package/cjs/style/dnb-ui-extensions.css +13 -0
  279. package/cjs/style/dnb-ui-extensions.min.css +1 -1
  280. package/cjs/style/themes/theme-eiendom/eiendom-theme-components.css +126 -86
  281. package/cjs/style/themes/theme-eiendom/eiendom-theme-components.min.css +2 -2
  282. package/cjs/style/themes/theme-eiendom/eiendom-theme-extensions.css +13 -0
  283. package/cjs/style/themes/theme-eiendom/eiendom-theme-extensions.min.css +1 -1
  284. package/cjs/style/themes/theme-sbanken/sbanken-theme-components.css +133 -93
  285. package/cjs/style/themes/theme-sbanken/sbanken-theme-components.min.css +3 -3
  286. package/cjs/style/themes/theme-sbanken/sbanken-theme-components.scss +1 -1
  287. package/cjs/style/themes/theme-sbanken/sbanken-theme-extensions.css +13 -0
  288. package/cjs/style/themes/theme-sbanken/sbanken-theme-extensions.min.css +1 -1
  289. package/cjs/style/themes/theme-ui/ui-theme-components.css +126 -86
  290. package/cjs/style/themes/theme-ui/ui-theme-components.min.css +2 -2
  291. package/cjs/style/themes/theme-ui/ui-theme-extensions.css +13 -0
  292. package/cjs/style/themes/theme-ui/ui-theme-extensions.min.css +1 -1
  293. package/components/accordion/AccordionContent.js +2 -0
  294. package/components/accordion/AccordionContent.js.map +1 -1
  295. package/components/anchor/Anchor.js +2 -0
  296. package/components/anchor/Anchor.js.map +1 -1
  297. package/components/autocomplete/Autocomplete.js +80 -77
  298. package/components/autocomplete/Autocomplete.js.map +1 -1
  299. package/components/avatar/Avatar.js +2 -0
  300. package/components/avatar/Avatar.js.map +1 -1
  301. package/components/avatar/AvatarGroup.js +2 -0
  302. package/components/avatar/AvatarGroup.js.map +1 -1
  303. package/components/badge/Badge.js +2 -0
  304. package/components/badge/Badge.js.map +1 -1
  305. package/components/breadcrumb/BreadcrumbItem.js +2 -0
  306. package/components/breadcrumb/BreadcrumbItem.js.map +1 -1
  307. package/components/button/Button.js +3 -0
  308. package/components/button/Button.js.map +1 -1
  309. package/components/checkbox/Checkbox.js +3 -0
  310. package/components/checkbox/Checkbox.js.map +1 -1
  311. package/components/date-picker/DatePicker.js +3 -0
  312. package/components/date-picker/DatePicker.js.map +1 -1
  313. package/components/date-picker/DatePickerProvider.js +2 -0
  314. package/components/date-picker/DatePickerProvider.js.map +1 -1
  315. package/components/dropdown/Dropdown.js +1 -0
  316. package/components/dropdown/Dropdown.js.map +1 -1
  317. package/components/flex/Container.js +2 -0
  318. package/components/flex/Container.js.map +1 -1
  319. package/components/flex/Flex.d.ts +1 -1
  320. package/components/flex/Flex.js +1 -1
  321. package/components/flex/Flex.js.map +1 -1
  322. package/components/flex/export.d.ts +5 -0
  323. package/components/flex/export.js +6 -0
  324. package/components/flex/export.js.map +1 -0
  325. package/components/flex/index.d.ts +2 -5
  326. package/components/flex/index.js +2 -5
  327. package/components/flex/index.js.map +1 -1
  328. package/components/form-label/FormLabel.d.ts +1 -0
  329. package/components/form-label/FormLabel.js +3 -0
  330. package/components/form-label/FormLabel.js.map +1 -1
  331. package/components/form-row/FormRow.js +2 -0
  332. package/components/form-row/FormRow.js.map +1 -1
  333. package/components/form-set/FormSet.js +2 -0
  334. package/components/form-set/FormSet.js.map +1 -1
  335. package/components/form-status/FormStatus.js +2 -0
  336. package/components/form-status/FormStatus.js.map +1 -1
  337. package/components/global-error/GlobalError.js +2 -0
  338. package/components/global-error/GlobalError.js.map +1 -1
  339. package/components/global-status/GlobalStatus.js +2 -0
  340. package/components/global-status/GlobalStatus.js.map +1 -1
  341. package/components/grid/Grid.d.ts +1 -1
  342. package/components/grid/Grid.js +1 -1
  343. package/components/grid/Grid.js.map +1 -1
  344. package/components/grid/export.d.ts +2 -0
  345. package/components/grid/export.js +3 -0
  346. package/components/grid/export.js.map +1 -0
  347. package/components/grid/index.d.ts +2 -2
  348. package/components/grid/index.js +2 -2
  349. package/components/grid/index.js.map +1 -1
  350. package/components/heading/Heading.js +2 -0
  351. package/components/heading/Heading.js.map +1 -1
  352. package/components/help-button/HelpButton.js +2 -0
  353. package/components/help-button/HelpButton.js.map +1 -1
  354. package/components/help-button/HelpButtonInstance.js +2 -0
  355. package/components/help-button/HelpButtonInstance.js.map +1 -1
  356. package/components/icon/Icon.js +2 -0
  357. package/components/icon/Icon.js.map +1 -1
  358. package/components/icon-primary/IconPrimary.js +2 -0
  359. package/components/icon-primary/IconPrimary.js.map +1 -1
  360. package/components/info-card/InfoCard.js +2 -0
  361. package/components/info-card/InfoCard.js.map +1 -1
  362. package/components/input/Input.d.ts +4 -0
  363. package/components/input/Input.js +13 -2
  364. package/components/input/Input.js.map +1 -1
  365. package/components/input/InputPassword.js +3 -0
  366. package/components/input/InputPassword.js.map +1 -1
  367. package/components/input-masked/InputMasked.js +3 -0
  368. package/components/input-masked/InputMasked.js.map +1 -1
  369. package/components/input-masked/MultiInputMask.d.ts +9 -1
  370. package/components/input-masked/MultiInputMask.js +14 -7
  371. package/components/input-masked/MultiInputMask.js.map +1 -1
  372. package/components/input-masked/TextMask.d.ts +1 -1
  373. package/components/input-masked/hooks/useHandleCursorPosition.js +1 -1
  374. package/components/input-masked/hooks/useHandleCursorPosition.js.map +1 -1
  375. package/components/lib.d.ts +2 -0
  376. package/components/logo/Logo.js +2 -0
  377. package/components/logo/Logo.js.map +1 -1
  378. package/components/modal/Modal.js +2 -0
  379. package/components/modal/Modal.js.map +1 -1
  380. package/components/modal/ModalContent.js +2 -0
  381. package/components/modal/ModalContent.js.map +1 -1
  382. package/components/modal/parts/CloseButton.js +2 -0
  383. package/components/modal/parts/CloseButton.js.map +1 -1
  384. package/components/number-format/NumberFormat.js +2 -0
  385. package/components/number-format/NumberFormat.js.map +1 -1
  386. package/components/number-format/NumberUtils.js +2 -0
  387. package/components/number-format/NumberUtils.js.map +1 -1
  388. package/components/pagination/PaginationHelpers.js +2 -0
  389. package/components/pagination/PaginationHelpers.js.map +1 -1
  390. package/components/pagination/PaginationInfinity.js +2 -0
  391. package/components/pagination/PaginationInfinity.js.map +1 -1
  392. package/components/pagination/PaginationProvider.js +2 -0
  393. package/components/pagination/PaginationProvider.js.map +1 -1
  394. package/components/progress-indicator/ProgressIndicator.js +2 -0
  395. package/components/progress-indicator/ProgressIndicator.js.map +1 -1
  396. package/components/radio/Radio.js +5 -2
  397. package/components/radio/Radio.js.map +1 -1
  398. package/components/radio/RadioGroup.js +6 -4
  399. package/components/radio/RadioGroup.js.map +1 -1
  400. package/components/radio/style/dnb-radio.css +106 -0
  401. package/components/radio/style/dnb-radio.min.css +1 -1
  402. package/components/radio/style/dnb-radio.scss +202 -0
  403. package/components/radio/style/themes/dnb-radio-theme-sbanken.css +26 -0
  404. package/components/radio/style/themes/dnb-radio-theme-sbanken.min.css +1 -0
  405. package/components/radio/style/themes/dnb-radio-theme-sbanken.scss +33 -0
  406. package/components/radio/style/themes/dnb-radio-theme-ui.css +20 -86
  407. package/components/radio/style/themes/dnb-radio-theme-ui.min.css +1 -1
  408. package/components/radio/style/themes/dnb-radio-theme-ui.scss +26 -143
  409. package/components/section/Section.js +2 -0
  410. package/components/section/Section.js.map +1 -1
  411. package/components/skeleton/Skeleton.js +2 -0
  412. package/components/skeleton/Skeleton.js.map +1 -1
  413. package/components/skeleton/figures/Article.js +2 -0
  414. package/components/skeleton/figures/Article.js.map +1 -1
  415. package/components/skeleton/figures/Circle.js +2 -0
  416. package/components/skeleton/figures/Circle.js.map +1 -1
  417. package/components/skeleton/figures/Product.js +2 -0
  418. package/components/skeleton/figures/Product.js.map +1 -1
  419. package/components/skeleton/figures/Table.js +2 -0
  420. package/components/skeleton/figures/Table.js.map +1 -1
  421. package/components/slider/Slider.d.ts +1 -0
  422. package/components/slider/Slider.js +1 -0
  423. package/components/slider/Slider.js.map +1 -1
  424. package/components/slider/SliderInstance.js +2 -0
  425. package/components/slider/SliderInstance.js.map +1 -1
  426. package/components/slider/SliderProvider.js +2 -0
  427. package/components/slider/SliderProvider.js.map +1 -1
  428. package/components/space/Space.js +2 -0
  429. package/components/space/Space.js.map +1 -1
  430. package/components/switch/Switch.js +3 -0
  431. package/components/switch/Switch.js.map +1 -1
  432. package/components/table/Table.js +2 -0
  433. package/components/table/Table.js.map +1 -1
  434. package/components/tabs/Tabs.js +2 -0
  435. package/components/tabs/Tabs.js.map +1 -1
  436. package/components/tag/Tag.d.ts +1 -0
  437. package/components/tag/Tag.js +3 -0
  438. package/components/tag/Tag.js.map +1 -1
  439. package/components/tag/TagGroup.js +2 -0
  440. package/components/tag/TagGroup.js.map +1 -1
  441. package/components/textarea/Textarea.js +3 -0
  442. package/components/textarea/Textarea.js.map +1 -1
  443. package/components/timeline/Timeline.js +2 -0
  444. package/components/timeline/Timeline.js.map +1 -1
  445. package/components/timeline/TimelineItem.js +2 -0
  446. package/components/timeline/TimelineItem.js.map +1 -1
  447. package/components/toggle-button/ToggleButton.js +3 -0
  448. package/components/toggle-button/ToggleButton.js.map +1 -1
  449. package/components/toggle-button/ToggleButtonGroup.js +6 -4
  450. package/components/toggle-button/ToggleButtonGroup.js.map +1 -1
  451. package/components/tooltip/Tooltip.js +2 -0
  452. package/components/tooltip/Tooltip.js.map +1 -1
  453. package/components/tooltip/TooltipPortal.js +2 -0
  454. package/components/tooltip/TooltipPortal.js.map +1 -1
  455. package/components/upload/Upload.d.ts +1 -0
  456. package/components/upload/Upload.js +3 -0
  457. package/components/upload/Upload.js.map +1 -1
  458. package/components/upload/useUpload.js +2 -0
  459. package/components/upload/useUpload.js.map +1 -1
  460. package/components/visually-hidden/VisuallyHidden.js +2 -0
  461. package/components/visually-hidden/VisuallyHidden.js.map +1 -1
  462. package/elements/Element.js +2 -0
  463. package/elements/Element.js.map +1 -1
  464. package/elements/typography/H.js +2 -0
  465. package/elements/typography/H.js.map +1 -1
  466. package/es/components/accordion/AccordionContent.js +2 -0
  467. package/es/components/accordion/AccordionContent.js.map +1 -1
  468. package/es/components/anchor/Anchor.js +2 -0
  469. package/es/components/anchor/Anchor.js.map +1 -1
  470. package/es/components/autocomplete/Autocomplete.js +79 -77
  471. package/es/components/autocomplete/Autocomplete.js.map +1 -1
  472. package/es/components/avatar/Avatar.js +2 -0
  473. package/es/components/avatar/Avatar.js.map +1 -1
  474. package/es/components/avatar/AvatarGroup.js +2 -0
  475. package/es/components/avatar/AvatarGroup.js.map +1 -1
  476. package/es/components/badge/Badge.js +2 -0
  477. package/es/components/badge/Badge.js.map +1 -1
  478. package/es/components/breadcrumb/BreadcrumbItem.js +2 -0
  479. package/es/components/breadcrumb/BreadcrumbItem.js.map +1 -1
  480. package/es/components/button/Button.js +3 -0
  481. package/es/components/button/Button.js.map +1 -1
  482. package/es/components/checkbox/Checkbox.js +3 -0
  483. package/es/components/checkbox/Checkbox.js.map +1 -1
  484. package/es/components/date-picker/DatePicker.js +3 -0
  485. package/es/components/date-picker/DatePicker.js.map +1 -1
  486. package/es/components/date-picker/DatePickerProvider.js +2 -0
  487. package/es/components/date-picker/DatePickerProvider.js.map +1 -1
  488. package/es/components/dropdown/Dropdown.js +1 -0
  489. package/es/components/dropdown/Dropdown.js.map +1 -1
  490. package/es/components/flex/Container.js +2 -0
  491. package/es/components/flex/Container.js.map +1 -1
  492. package/es/components/flex/Flex.d.ts +1 -1
  493. package/es/components/flex/Flex.js +1 -1
  494. package/es/components/flex/Flex.js.map +1 -1
  495. package/es/components/flex/export.d.ts +5 -0
  496. package/es/components/flex/export.js +6 -0
  497. package/es/components/flex/export.js.map +1 -0
  498. package/es/components/flex/index.d.ts +2 -5
  499. package/es/components/flex/index.js +2 -5
  500. package/es/components/flex/index.js.map +1 -1
  501. package/es/components/form-label/FormLabel.d.ts +1 -0
  502. package/es/components/form-label/FormLabel.js +3 -0
  503. package/es/components/form-label/FormLabel.js.map +1 -1
  504. package/es/components/form-row/FormRow.js +2 -0
  505. package/es/components/form-row/FormRow.js.map +1 -1
  506. package/es/components/form-set/FormSet.js +2 -0
  507. package/es/components/form-set/FormSet.js.map +1 -1
  508. package/es/components/form-status/FormStatus.js +2 -0
  509. package/es/components/form-status/FormStatus.js.map +1 -1
  510. package/es/components/global-error/GlobalError.js +2 -0
  511. package/es/components/global-error/GlobalError.js.map +1 -1
  512. package/es/components/global-status/GlobalStatus.js +2 -0
  513. package/es/components/global-status/GlobalStatus.js.map +1 -1
  514. package/es/components/grid/Grid.d.ts +1 -1
  515. package/es/components/grid/Grid.js +1 -1
  516. package/es/components/grid/Grid.js.map +1 -1
  517. package/es/components/grid/export.d.ts +2 -0
  518. package/es/components/grid/export.js +3 -0
  519. package/es/components/grid/export.js.map +1 -0
  520. package/es/components/grid/index.d.ts +2 -2
  521. package/es/components/grid/index.js +2 -2
  522. package/es/components/grid/index.js.map +1 -1
  523. package/es/components/heading/Heading.js +2 -0
  524. package/es/components/heading/Heading.js.map +1 -1
  525. package/es/components/help-button/HelpButton.js +2 -0
  526. package/es/components/help-button/HelpButton.js.map +1 -1
  527. package/es/components/help-button/HelpButtonInstance.js +2 -0
  528. package/es/components/help-button/HelpButtonInstance.js.map +1 -1
  529. package/es/components/icon/Icon.js +2 -0
  530. package/es/components/icon/Icon.js.map +1 -1
  531. package/es/components/icon-primary/IconPrimary.js +2 -0
  532. package/es/components/icon-primary/IconPrimary.js.map +1 -1
  533. package/es/components/info-card/InfoCard.js +2 -0
  534. package/es/components/info-card/InfoCard.js.map +1 -1
  535. package/es/components/input/Input.d.ts +4 -0
  536. package/es/components/input/Input.js +13 -2
  537. package/es/components/input/Input.js.map +1 -1
  538. package/es/components/input/InputPassword.js +3 -0
  539. package/es/components/input/InputPassword.js.map +1 -1
  540. package/es/components/input-masked/InputMasked.js +3 -0
  541. package/es/components/input-masked/InputMasked.js.map +1 -1
  542. package/es/components/input-masked/MultiInputMask.d.ts +9 -1
  543. package/es/components/input-masked/MultiInputMask.js +14 -7
  544. package/es/components/input-masked/MultiInputMask.js.map +1 -1
  545. package/es/components/input-masked/TextMask.d.ts +1 -1
  546. package/es/components/input-masked/hooks/useHandleCursorPosition.js +1 -1
  547. package/es/components/input-masked/hooks/useHandleCursorPosition.js.map +1 -1
  548. package/es/components/lib.d.ts +2 -0
  549. package/es/components/logo/Logo.js +2 -0
  550. package/es/components/logo/Logo.js.map +1 -1
  551. package/es/components/modal/Modal.js +2 -0
  552. package/es/components/modal/Modal.js.map +1 -1
  553. package/es/components/modal/ModalContent.js +2 -0
  554. package/es/components/modal/ModalContent.js.map +1 -1
  555. package/es/components/modal/parts/CloseButton.js +2 -0
  556. package/es/components/modal/parts/CloseButton.js.map +1 -1
  557. package/es/components/number-format/NumberFormat.js +2 -0
  558. package/es/components/number-format/NumberFormat.js.map +1 -1
  559. package/es/components/number-format/NumberUtils.js +2 -0
  560. package/es/components/number-format/NumberUtils.js.map +1 -1
  561. package/es/components/pagination/PaginationHelpers.js +2 -0
  562. package/es/components/pagination/PaginationHelpers.js.map +1 -1
  563. package/es/components/pagination/PaginationInfinity.js +2 -0
  564. package/es/components/pagination/PaginationInfinity.js.map +1 -1
  565. package/es/components/pagination/PaginationProvider.js +2 -0
  566. package/es/components/pagination/PaginationProvider.js.map +1 -1
  567. package/es/components/progress-indicator/ProgressIndicator.js +2 -0
  568. package/es/components/progress-indicator/ProgressIndicator.js.map +1 -1
  569. package/es/components/radio/Radio.js +5 -2
  570. package/es/components/radio/Radio.js.map +1 -1
  571. package/es/components/radio/RadioGroup.js +6 -4
  572. package/es/components/radio/RadioGroup.js.map +1 -1
  573. package/es/components/radio/style/dnb-radio.css +106 -0
  574. package/es/components/radio/style/dnb-radio.min.css +1 -1
  575. package/es/components/radio/style/dnb-radio.scss +202 -0
  576. package/es/components/radio/style/themes/dnb-radio-theme-sbanken.css +26 -0
  577. package/es/components/radio/style/themes/dnb-radio-theme-sbanken.min.css +1 -0
  578. package/es/components/radio/style/themes/dnb-radio-theme-sbanken.scss +33 -0
  579. package/es/components/radio/style/themes/dnb-radio-theme-ui.css +20 -86
  580. package/es/components/radio/style/themes/dnb-radio-theme-ui.min.css +1 -1
  581. package/es/components/radio/style/themes/dnb-radio-theme-ui.scss +26 -143
  582. package/es/components/section/Section.js +2 -0
  583. package/es/components/section/Section.js.map +1 -1
  584. package/es/components/skeleton/Skeleton.js +2 -0
  585. package/es/components/skeleton/Skeleton.js.map +1 -1
  586. package/es/components/skeleton/figures/Article.js +2 -0
  587. package/es/components/skeleton/figures/Article.js.map +1 -1
  588. package/es/components/skeleton/figures/Circle.js +2 -0
  589. package/es/components/skeleton/figures/Circle.js.map +1 -1
  590. package/es/components/skeleton/figures/Product.js +2 -0
  591. package/es/components/skeleton/figures/Product.js.map +1 -1
  592. package/es/components/skeleton/figures/Table.js +2 -0
  593. package/es/components/skeleton/figures/Table.js.map +1 -1
  594. package/es/components/slider/Slider.d.ts +1 -0
  595. package/es/components/slider/Slider.js +1 -0
  596. package/es/components/slider/Slider.js.map +1 -1
  597. package/es/components/slider/SliderInstance.js +2 -0
  598. package/es/components/slider/SliderInstance.js.map +1 -1
  599. package/es/components/slider/SliderProvider.js +2 -0
  600. package/es/components/slider/SliderProvider.js.map +1 -1
  601. package/es/components/space/Space.js +2 -0
  602. package/es/components/space/Space.js.map +1 -1
  603. package/es/components/switch/Switch.js +3 -0
  604. package/es/components/switch/Switch.js.map +1 -1
  605. package/es/components/table/Table.js +2 -0
  606. package/es/components/table/Table.js.map +1 -1
  607. package/es/components/tabs/Tabs.js +2 -0
  608. package/es/components/tabs/Tabs.js.map +1 -1
  609. package/es/components/tag/Tag.d.ts +1 -0
  610. package/es/components/tag/Tag.js +3 -0
  611. package/es/components/tag/Tag.js.map +1 -1
  612. package/es/components/tag/TagGroup.js +2 -0
  613. package/es/components/tag/TagGroup.js.map +1 -1
  614. package/es/components/textarea/Textarea.js +3 -0
  615. package/es/components/textarea/Textarea.js.map +1 -1
  616. package/es/components/timeline/Timeline.js +2 -0
  617. package/es/components/timeline/Timeline.js.map +1 -1
  618. package/es/components/timeline/TimelineItem.js +2 -0
  619. package/es/components/timeline/TimelineItem.js.map +1 -1
  620. package/es/components/toggle-button/ToggleButton.js +3 -0
  621. package/es/components/toggle-button/ToggleButton.js.map +1 -1
  622. package/es/components/toggle-button/ToggleButtonGroup.js +6 -4
  623. package/es/components/toggle-button/ToggleButtonGroup.js.map +1 -1
  624. package/es/components/tooltip/Tooltip.js +2 -0
  625. package/es/components/tooltip/Tooltip.js.map +1 -1
  626. package/es/components/tooltip/TooltipPortal.js +2 -0
  627. package/es/components/tooltip/TooltipPortal.js.map +1 -1
  628. package/es/components/upload/Upload.d.ts +1 -0
  629. package/es/components/upload/Upload.js +3 -0
  630. package/es/components/upload/Upload.js.map +1 -1
  631. package/es/components/upload/useUpload.js +2 -0
  632. package/es/components/upload/useUpload.js.map +1 -1
  633. package/es/components/visually-hidden/VisuallyHidden.js +2 -0
  634. package/es/components/visually-hidden/VisuallyHidden.js.map +1 -1
  635. package/es/elements/Element.js +2 -0
  636. package/es/elements/Element.js.map +1 -1
  637. package/es/elements/typography/H.js +2 -0
  638. package/es/elements/typography/H.js.map +1 -1
  639. package/es/extensions/forms/DataContext/Provider/Provider.js +53 -43
  640. package/es/extensions/forms/DataContext/Provider/Provider.js.map +1 -1
  641. package/es/extensions/forms/Field/BankAccountNumber/BankAccountNumber.js +9 -6
  642. package/es/extensions/forms/Field/BankAccountNumber/BankAccountNumber.js.map +1 -1
  643. package/es/extensions/forms/Field/Email/Email.js +7 -5
  644. package/es/extensions/forms/Field/Email/Email.js.map +1 -1
  645. package/es/extensions/forms/Field/Expiry/Expiry.d.ts +7 -0
  646. package/es/extensions/forms/Field/Expiry/Expiry.js +88 -0
  647. package/es/extensions/forms/Field/Expiry/Expiry.js.map +1 -0
  648. package/es/extensions/forms/Field/Expiry/index.d.ts +2 -0
  649. package/es/extensions/forms/Field/Expiry/index.js +3 -0
  650. package/es/extensions/forms/Field/Expiry/index.js.map +1 -0
  651. package/es/extensions/forms/Field/Expiry/style/dnb-expiry.css +12 -0
  652. package/es/extensions/forms/Field/Expiry/style/dnb-expiry.min.css +1 -0
  653. package/es/extensions/forms/Field/Expiry/style/dnb-expiry.scss +9 -0
  654. package/es/extensions/forms/Field/NationalIdentityNumber/NationalIdentityNumber.js +9 -6
  655. package/es/extensions/forms/Field/NationalIdentityNumber/NationalIdentityNumber.js.map +1 -1
  656. package/es/extensions/forms/Field/Number/Number.js +48 -25
  657. package/es/extensions/forms/Field/Number/Number.js.map +1 -1
  658. package/es/extensions/forms/Field/OrganizationNumber/OrganizationNumber.js +9 -6
  659. package/es/extensions/forms/Field/OrganizationNumber/OrganizationNumber.js.map +1 -1
  660. package/es/extensions/forms/Field/PhoneNumber/PhoneNumber.js +34 -21
  661. package/es/extensions/forms/Field/PhoneNumber/PhoneNumber.js.map +1 -1
  662. package/es/extensions/forms/Field/SelectCountry/SelectCountry.js +6 -4
  663. package/es/extensions/forms/Field/SelectCountry/SelectCountry.js.map +1 -1
  664. package/es/extensions/forms/Field/String/String.js +30 -20
  665. package/es/extensions/forms/Field/String/String.js.map +1 -1
  666. package/es/extensions/forms/Field/index.d.ts +1 -0
  667. package/es/extensions/forms/Field/index.js +1 -0
  668. package/es/extensions/forms/Field/index.js.map +1 -1
  669. package/es/extensions/forms/Field/style/dnb-forms-field.css +13 -0
  670. package/es/extensions/forms/Field/style/dnb-forms-field.min.css +1 -1
  671. package/es/extensions/forms/Field/style/dnb-forms-field.scss +1 -0
  672. package/es/extensions/forms/FieldBlock/FieldBlock.js +36 -3
  673. package/es/extensions/forms/FieldBlock/FieldBlock.js.map +1 -1
  674. package/es/extensions/forms/Form/Element/Element.js +2 -0
  675. package/es/extensions/forms/Form/Element/Element.js.map +1 -1
  676. package/es/extensions/forms/Form/Handler/Handler.js +2 -0
  677. package/es/extensions/forms/Form/Handler/Handler.js.map +1 -1
  678. package/es/extensions/forms/hooks/index.d.ts +3 -0
  679. package/es/extensions/forms/hooks/index.js +5 -1
  680. package/es/extensions/forms/hooks/index.js.map +1 -1
  681. package/es/extensions/forms/hooks/useDataValue.js +127 -62
  682. package/es/extensions/forms/hooks/useDataValue.js.map +1 -1
  683. package/es/extensions/forms/hooks/useMountEffect.d.ts +5 -0
  684. package/es/extensions/forms/hooks/useMountEffect.js +9 -0
  685. package/es/extensions/forms/hooks/useMountEffect.js.map +1 -0
  686. package/es/extensions/forms/hooks/useProcessManager.d.ts +6 -0
  687. package/es/extensions/forms/hooks/useProcessManager.js +16 -0
  688. package/es/extensions/forms/hooks/useProcessManager.js.map +1 -0
  689. package/es/extensions/forms/hooks/useUpdateEffect.d.ts +5 -0
  690. package/es/extensions/forms/hooks/useUpdateEffect.js +14 -0
  691. package/es/extensions/forms/hooks/useUpdateEffect.js.map +1 -0
  692. package/es/extensions/forms/style/dnb-forms.css +13 -0
  693. package/es/extensions/forms/style/dnb-forms.min.css +1 -1
  694. package/es/extensions/forms/types.d.ts +10 -2
  695. package/es/extensions/forms/types.js +2 -0
  696. package/es/extensions/forms/types.js.map +1 -1
  697. package/es/extensions/forms/utils/ajv.js +25 -1
  698. package/es/extensions/forms/utils/ajv.js.map +1 -1
  699. package/es/extensions/forms/utils/errors.d.ts +2 -0
  700. package/es/extensions/forms/utils/errors.js +10 -0
  701. package/es/extensions/forms/utils/errors.js.map +1 -0
  702. package/es/extensions/forms/utils/index.d.ts +1 -0
  703. package/es/extensions/forms/utils/index.js +1 -0
  704. package/es/extensions/forms/utils/index.js.map +1 -1
  705. package/es/extensions/payment-card/PaymentCard.js +2 -0
  706. package/es/extensions/payment-card/PaymentCard.js.map +1 -1
  707. package/es/fragments/drawer-list/DrawerListProvider.js +2 -0
  708. package/es/fragments/drawer-list/DrawerListProvider.js.map +1 -1
  709. package/es/fragments/scroll-view/ScrollView.js +2 -0
  710. package/es/fragments/scroll-view/ScrollView.js.map +1 -1
  711. package/es/shared/Eufemia.d.ts +1 -1
  712. package/es/shared/Eufemia.js +2 -2
  713. package/es/shared/Eufemia.js.map +1 -1
  714. package/es/shared/MediaQuery.js +2 -0
  715. package/es/shared/MediaQuery.js.map +1 -1
  716. package/es/shared/Provider.js +2 -0
  717. package/es/shared/Provider.js.map +1 -1
  718. package/es/shared/Theme.js +2 -0
  719. package/es/shared/Theme.js.map +1 -1
  720. package/es/shared/VisibilityByTheme.js +2 -0
  721. package/es/shared/VisibilityByTheme.js.map +1 -1
  722. package/es/shared/index.js +2 -0
  723. package/es/shared/index.js.map +1 -1
  724. package/es/shared/locales/en-GB.d.ts +11 -0
  725. package/es/shared/locales/en-GB.js +12 -1
  726. package/es/shared/locales/en-GB.js.map +1 -1
  727. package/es/shared/locales/en-US.d.ts +11 -0
  728. package/es/shared/locales/index.d.ts +22 -0
  729. package/es/shared/locales/nb-NO.d.ts +11 -0
  730. package/es/shared/locales/nb-NO.js +12 -1
  731. package/es/shared/locales/nb-NO.js.map +1 -1
  732. package/es/shared/useMedia.js +2 -0
  733. package/es/shared/useMedia.js.map +1 -1
  734. package/es/shared/useMediaQuery.js +2 -0
  735. package/es/shared/useMediaQuery.js.map +1 -1
  736. package/es/shared/useTheme.js +2 -0
  737. package/es/shared/useTheme.js.map +1 -1
  738. package/es/shared/useTranslation.js +2 -0
  739. package/es/shared/useTranslation.js.map +1 -1
  740. package/es/style/dnb-ui-components.css +106 -0
  741. package/es/style/dnb-ui-components.min.css +1 -1
  742. package/es/style/dnb-ui-extensions.css +13 -0
  743. package/es/style/dnb-ui-extensions.min.css +1 -1
  744. package/es/style/themes/theme-eiendom/eiendom-theme-components.css +126 -86
  745. package/es/style/themes/theme-eiendom/eiendom-theme-components.min.css +2 -2
  746. package/es/style/themes/theme-eiendom/eiendom-theme-extensions.css +13 -0
  747. package/es/style/themes/theme-eiendom/eiendom-theme-extensions.min.css +1 -1
  748. package/es/style/themes/theme-sbanken/sbanken-theme-components.css +133 -93
  749. package/es/style/themes/theme-sbanken/sbanken-theme-components.min.css +3 -3
  750. package/es/style/themes/theme-sbanken/sbanken-theme-components.scss +1 -1
  751. package/es/style/themes/theme-sbanken/sbanken-theme-extensions.css +13 -0
  752. package/es/style/themes/theme-sbanken/sbanken-theme-extensions.min.css +1 -1
  753. package/es/style/themes/theme-ui/ui-theme-components.css +126 -86
  754. package/es/style/themes/theme-ui/ui-theme-components.min.css +2 -2
  755. package/es/style/themes/theme-ui/ui-theme-extensions.css +13 -0
  756. package/es/style/themes/theme-ui/ui-theme-extensions.min.css +1 -1
  757. package/esm/dnb-ui-basis.min.mjs +1 -1
  758. package/esm/dnb-ui-components.min.mjs +1 -1
  759. package/esm/dnb-ui-elements.min.mjs +1 -1
  760. package/esm/dnb-ui-extensions.min.mjs +3 -3
  761. package/esm/dnb-ui-lib.min.mjs +1 -1
  762. package/extensions/forms/DataContext/Provider/Provider.js +53 -43
  763. package/extensions/forms/DataContext/Provider/Provider.js.map +1 -1
  764. package/extensions/forms/Field/BankAccountNumber/BankAccountNumber.js +9 -6
  765. package/extensions/forms/Field/BankAccountNumber/BankAccountNumber.js.map +1 -1
  766. package/extensions/forms/Field/Email/Email.js +7 -5
  767. package/extensions/forms/Field/Email/Email.js.map +1 -1
  768. package/extensions/forms/Field/Expiry/Expiry.d.ts +7 -0
  769. package/extensions/forms/Field/Expiry/Expiry.js +88 -0
  770. package/extensions/forms/Field/Expiry/Expiry.js.map +1 -0
  771. package/extensions/forms/Field/Expiry/index.d.ts +2 -0
  772. package/extensions/forms/Field/Expiry/index.js +3 -0
  773. package/extensions/forms/Field/Expiry/index.js.map +1 -0
  774. package/extensions/forms/Field/Expiry/style/dnb-expiry.css +12 -0
  775. package/extensions/forms/Field/Expiry/style/dnb-expiry.min.css +1 -0
  776. package/extensions/forms/Field/Expiry/style/dnb-expiry.scss +9 -0
  777. package/extensions/forms/Field/NationalIdentityNumber/NationalIdentityNumber.js +9 -6
  778. package/extensions/forms/Field/NationalIdentityNumber/NationalIdentityNumber.js.map +1 -1
  779. package/extensions/forms/Field/Number/Number.js +49 -26
  780. package/extensions/forms/Field/Number/Number.js.map +1 -1
  781. package/extensions/forms/Field/OrganizationNumber/OrganizationNumber.js +9 -6
  782. package/extensions/forms/Field/OrganizationNumber/OrganizationNumber.js.map +1 -1
  783. package/extensions/forms/Field/PhoneNumber/PhoneNumber.js +46 -33
  784. package/extensions/forms/Field/PhoneNumber/PhoneNumber.js.map +1 -1
  785. package/extensions/forms/Field/SelectCountry/SelectCountry.js +6 -4
  786. package/extensions/forms/Field/SelectCountry/SelectCountry.js.map +1 -1
  787. package/extensions/forms/Field/String/String.js +31 -21
  788. package/extensions/forms/Field/String/String.js.map +1 -1
  789. package/extensions/forms/Field/index.d.ts +1 -0
  790. package/extensions/forms/Field/index.js +1 -0
  791. package/extensions/forms/Field/index.js.map +1 -1
  792. package/extensions/forms/Field/style/dnb-forms-field.css +13 -0
  793. package/extensions/forms/Field/style/dnb-forms-field.min.css +1 -1
  794. package/extensions/forms/Field/style/dnb-forms-field.scss +1 -0
  795. package/extensions/forms/FieldBlock/FieldBlock.js +37 -3
  796. package/extensions/forms/FieldBlock/FieldBlock.js.map +1 -1
  797. package/extensions/forms/Form/Element/Element.js +2 -0
  798. package/extensions/forms/Form/Element/Element.js.map +1 -1
  799. package/extensions/forms/Form/Handler/Handler.js +2 -0
  800. package/extensions/forms/Form/Handler/Handler.js.map +1 -1
  801. package/extensions/forms/hooks/index.d.ts +3 -0
  802. package/extensions/forms/hooks/index.js +5 -1
  803. package/extensions/forms/hooks/index.js.map +1 -1
  804. package/extensions/forms/hooks/useDataValue.js +128 -62
  805. package/extensions/forms/hooks/useDataValue.js.map +1 -1
  806. package/extensions/forms/hooks/useMountEffect.d.ts +5 -0
  807. package/extensions/forms/hooks/useMountEffect.js +9 -0
  808. package/extensions/forms/hooks/useMountEffect.js.map +1 -0
  809. package/extensions/forms/hooks/useProcessManager.d.ts +6 -0
  810. package/extensions/forms/hooks/useProcessManager.js +16 -0
  811. package/extensions/forms/hooks/useProcessManager.js.map +1 -0
  812. package/extensions/forms/hooks/useUpdateEffect.d.ts +5 -0
  813. package/extensions/forms/hooks/useUpdateEffect.js +14 -0
  814. package/extensions/forms/hooks/useUpdateEffect.js.map +1 -0
  815. package/extensions/forms/style/dnb-forms.css +13 -0
  816. package/extensions/forms/style/dnb-forms.min.css +1 -1
  817. package/extensions/forms/types.d.ts +10 -2
  818. package/extensions/forms/types.js +2 -0
  819. package/extensions/forms/types.js.map +1 -1
  820. package/extensions/forms/utils/ajv.js +25 -1
  821. package/extensions/forms/utils/ajv.js.map +1 -1
  822. package/extensions/forms/utils/errors.d.ts +2 -0
  823. package/extensions/forms/utils/errors.js +10 -0
  824. package/extensions/forms/utils/errors.js.map +1 -0
  825. package/extensions/forms/utils/index.d.ts +1 -0
  826. package/extensions/forms/utils/index.js +1 -0
  827. package/extensions/forms/utils/index.js.map +1 -1
  828. package/extensions/payment-card/PaymentCard.js +2 -0
  829. package/extensions/payment-card/PaymentCard.js.map +1 -1
  830. package/fragments/drawer-list/DrawerListProvider.js +2 -0
  831. package/fragments/drawer-list/DrawerListProvider.js.map +1 -1
  832. package/fragments/scroll-view/ScrollView.js +2 -0
  833. package/fragments/scroll-view/ScrollView.js.map +1 -1
  834. package/package.json +1 -1
  835. package/shared/Eufemia.d.ts +1 -1
  836. package/shared/Eufemia.js +2 -2
  837. package/shared/Eufemia.js.map +1 -1
  838. package/shared/MediaQuery.js +2 -0
  839. package/shared/MediaQuery.js.map +1 -1
  840. package/shared/Provider.js +2 -0
  841. package/shared/Provider.js.map +1 -1
  842. package/shared/Theme.js +2 -0
  843. package/shared/Theme.js.map +1 -1
  844. package/shared/VisibilityByTheme.js +2 -0
  845. package/shared/VisibilityByTheme.js.map +1 -1
  846. package/shared/index.js +2 -0
  847. package/shared/index.js.map +1 -1
  848. package/shared/locales/en-GB.d.ts +11 -0
  849. package/shared/locales/en-GB.js +12 -1
  850. package/shared/locales/en-GB.js.map +1 -1
  851. package/shared/locales/en-US.d.ts +11 -0
  852. package/shared/locales/index.d.ts +22 -0
  853. package/shared/locales/nb-NO.d.ts +11 -0
  854. package/shared/locales/nb-NO.js +12 -1
  855. package/shared/locales/nb-NO.js.map +1 -1
  856. package/shared/useMedia.js +2 -0
  857. package/shared/useMedia.js.map +1 -1
  858. package/shared/useMediaQuery.js +2 -0
  859. package/shared/useMediaQuery.js.map +1 -1
  860. package/shared/useTheme.js +2 -0
  861. package/shared/useTheme.js.map +1 -1
  862. package/shared/useTranslation.js +2 -0
  863. package/shared/useTranslation.js.map +1 -1
  864. package/style/dnb-ui-components.css +106 -0
  865. package/style/dnb-ui-components.min.css +1 -1
  866. package/style/dnb-ui-extensions.css +13 -0
  867. package/style/dnb-ui-extensions.min.css +1 -1
  868. package/style/themes/theme-eiendom/eiendom-theme-components.css +126 -86
  869. package/style/themes/theme-eiendom/eiendom-theme-components.min.css +2 -2
  870. package/style/themes/theme-eiendom/eiendom-theme-extensions.css +13 -0
  871. package/style/themes/theme-eiendom/eiendom-theme-extensions.min.css +1 -1
  872. package/style/themes/theme-sbanken/sbanken-theme-components.css +133 -93
  873. package/style/themes/theme-sbanken/sbanken-theme-components.min.css +3 -3
  874. package/style/themes/theme-sbanken/sbanken-theme-components.scss +1 -1
  875. package/style/themes/theme-sbanken/sbanken-theme-extensions.css +13 -0
  876. package/style/themes/theme-sbanken/sbanken-theme-extensions.min.css +1 -1
  877. package/style/themes/theme-ui/ui-theme-components.css +126 -86
  878. package/style/themes/theme-ui/ui-theme-components.min.css +2 -2
  879. package/style/themes/theme-ui/ui-theme-extensions.css +13 -0
  880. package/style/themes/theme-ui/ui-theme-extensions.min.css +1 -1
  881. package/umd/dnb-ui-basis.min.js +1 -1
  882. package/umd/dnb-ui-components.min.js +1 -1
  883. package/umd/dnb-ui-elements.min.js +1 -1
  884. package/umd/dnb-ui-extensions.min.js +2 -2
  885. package/umd/dnb-ui-lib.min.js +1 -1
@@ -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","_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,SAAS;IACTC,eAAe;IACfC,MAAM;IACNC,aAAa;IACbC,iBAAiB;IACjBC,iBAAiB;IACjBC,oBAAoB;IACpBC,OAAO,GAAIC,KAAK,IAAKA,KAAK;IAC1BC,SAAS,GAAID,KAAK,IAAKA;EACzB,CAAC,GAAGpB,KAAK;EACT,MAAMsB,EAAE,GAAGjC,OAAO,CAAC;IAAA,IAAAkC,SAAA;IAAA,QAAAA,SAAA,GAAMvB,KAAK,CAACsB,EAAE,cAAAC,SAAA,cAAAA,SAAA,GAA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"}
1
+ {"version":3,"file":"useDataValue.js","names":["useRef","useEffect","useContext","useCallback","useMemo","useReducer","pointer","errorChanged","ajv","ajvErrorsToOneFormError","FormError","Context","FieldBlockContext","IterateElementContext","makeUniqueId","useMountEffect","useUpdateEffect","useProcessManager","useDataValue","props","_props$path","_ref2","_props$autoComplete","path","elementPath","emptyValue","required","error","errorProp","onFocus","onBlur","onChange","validator","onBlurValidator","schema","errorMessages","validateInitially","validateUnchanged","continuousValidation","toInput","value","fromInput","forceUpdate","startProcess","id","_props$id","dataContext","fieldBlockContext","iterateElementContext","handlePathChange","dataContextHandlePathChange","setPathWithError","dataContextSetPathWithError","errors","dataContextErrors","dataContextError","undefined","inFieldBlock","Boolean","setError","setFieldBlockError","setShowError","setShowFieldBlockError","inIterate","index","iterateElementIndex","iterateElementValue","handleChange","handleIterateElementChange","substring","Error","externalValue","has","get","data","valueRef","changedRef","hasFocusRef","showErrorInitially","localErrorRef","contextErrorRef","showErrorRef","errorMessagesRef","current","schemaRef","validatorRef","schemaValidatorRef","compile","showError","hideError","prepareError","_errorMessagesRef$cur","_error$messageValues","message","validationRule","messageWithValues","Object","entries","messageValues","reduce","_ref","key","replace","persistErrorState","errorArg","clearErrorState","validateValue","isProcessActive","_validatorRef$current","res","call","showAllErrors","setHasFocus","hasFocus","valueOverride","Promise","resolve","then","handleFocus","handleBlur","argFromInput","newValue","iterateValuePath","handleMountField","handleUnMountField","_objectSpread","name","autoComplete"],"sources":["../../../../../src/extensions/forms/hooks/useDataValue.ts"],"sourcesContent":["import {\n useRef,\n useEffect,\n useContext,\n useCallback,\n useMemo,\n useReducer,\n} from 'react'\nimport pointer from 'json-pointer'\nimport { ValidateFunction } from 'ajv'\nimport { errorChanged } from '../utils'\nimport ajv, { ajvErrorsToOneFormError } from '../utils/ajv'\nimport { FormError, FieldProps } from '../types'\nimport { Context } from '../DataContext'\nimport FieldBlockContext from '../FieldBlock/FieldBlockContext'\nimport IterateElementContext from '../Iterate/IterateElementContext'\nimport { makeUniqueId } from '../../../shared/component-helper'\nimport useMountEffect from './useMountEffect'\nimport useUpdateEffect from './useUpdateEffect'\nimport useProcessManager from './useProcessManager'\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 [, forceUpdate] = useReducer(() => ({}), {})\n const { startProcess } = useProcessManager()\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 dataContextError = path ? dataContextErrors?.[path] : undefined\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 // Many variables are kept in refs to avoid triggering unnecessary update loops because updates using\n // useEffect depend on them (like the external `value`)\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 valueRef = useRef<Value>(externalValue)\n const changedRef = useRef<boolean>(false)\n const hasFocusRef = useRef<boolean>(false)\n\n // Error handling\n // - Should errors received through validation be shown initially. Assume that providing a direct prop to\n // the component means it is supposed to be shown initially.\n const showErrorInitially = validateInitially || errorProp\n // - Local errors are errors based on validation instructions received by\n const localErrorRef = useRef<Error | FormError | undefined>()\n // - Context errors are from outer contexts, like validation for this field as part of the whole data set\n const contextErrorRef = useRef<Error | FormError | undefined>(\n dataContextError\n )\n\n const showErrorRef = useRef<boolean>(Boolean(showErrorInitially))\n const errorMessagesRef = useRef(errorMessages)\n useEffect(() => {\n errorMessagesRef.current = errorMessages\n }, [errorMessages])\n const schemaRef = useRef(schema)\n useEffect(() => {\n schemaRef.current = schema\n }, [schema])\n const validatorRef = useRef(validator)\n useEffect(() => {\n validatorRef.current = validator\n }, [validator])\n\n const schemaValidatorRef = useRef<ValidateFunction>(\n schema ? ajv.compile(schema) : undefined\n )\n\n const showError = useCallback(() => {\n showErrorRef.current = true\n setShowFieldBlockError?.(path ?? id, true)\n }, [path, id, setShowFieldBlockError])\n\n const hideError = useCallback(() => {\n showErrorRef.current = false\n setShowFieldBlockError?.(path ?? id, false)\n }, [path, id, setShowFieldBlockError])\n\n /**\n * Prepare error from validation logic with correct error messages based on props\n */\n const prepareError = useCallback(\n (error: Error | FormError | undefined): FormError | undefined => {\n if (error === undefined) {\n return\n }\n\n if (error instanceof FormError) {\n const message =\n (typeof error.validationRule === 'string' &&\n errorMessagesRef.current?.[error.validationRule]) ||\n error.message\n\n const messageWithValues = Object.entries(\n error.messageValues ?? {}\n ).reduce((message, [key, value]) => {\n return message.replace(`{${key}}`, value)\n }, message)\n\n return new FormError(messageWithValues)\n }\n\n return error\n },\n // eslint-disable-next-line react-hooks/exhaustive-deps\n []\n )\n\n /**\n * Based on validation, update error state, locally and relevant surrounding contexts\n */\n const persistErrorState = useCallback(\n (errorArg: FormError | undefined) => {\n const error = prepareError(errorArg)\n\n if (!errorChanged(error, localErrorRef.current)) {\n // In case different triggers lead to validation with no changes in the result (like still no error, or the same error),\n // avoid unnecessary re-renders by letting the old error object stay in the state and skip re-rendering.\n return\n }\n\n localErrorRef.current = error\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, error)\n forceUpdate()\n },\n [\n path,\n id,\n prepareError,\n dataContextSetPathWithError,\n setFieldBlockError,\n forceUpdate,\n ]\n )\n\n const clearErrorState = useCallback(\n () => persistErrorState(undefined),\n [persistErrorState]\n )\n\n /**\n * Validate the current state value by provided validator instructions\n */\n const validateValue = useCallback(async () => {\n const isProcessActive = startProcess()\n\n try {\n // Validate required\n if (valueRef.current === emptyValue && required) {\n throw new FormError('The value is required', {\n validationRule: 'required',\n })\n }\n\n // Validate by provided JSON Schema for this value\n if (\n schemaValidatorRef.current &&\n valueRef.current !== undefined &&\n !schemaValidatorRef.current(valueRef.current)\n ) {\n const error = ajvErrorsToOneFormError(\n schemaValidatorRef.current.errors\n )\n throw error\n }\n // Validate by provided derivative validator\n if (validatorRef.current) {\n const res = await validatorRef.current?.(valueRef.current)\n if (res instanceof Error) {\n throw res\n }\n }\n\n if (isProcessActive()) {\n clearErrorState()\n }\n } catch (error: unknown) {\n if (isProcessActive()) {\n persistErrorState(error as Error)\n }\n }\n }, [\n emptyValue,\n required,\n startProcess,\n persistErrorState,\n clearErrorState,\n ])\n\n useUpdateEffect(() => {\n if (!schema) {\n return\n }\n schemaValidatorRef.current = ajv.compile(schema)\n validateValue()\n }, [schema, validateValue])\n\n useUpdateEffect(() => {\n // Error or removed error for this field from the surrounding data context (by path)\n valueRef.current = externalValue\n validateValue()\n forceUpdate()\n }, [externalValue, validateValue])\n\n useEffect(() => {\n const error = prepareError(dataContextError)\n if (errorChanged(error, contextErrorRef.current)) {\n contextErrorRef.current = error\n forceUpdate()\n }\n }, [dataContextError, prepareError])\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 showError()\n }\n }, [dataContext.showAllErrors, showError])\n\n const setHasFocus = useCallback(\n (hasFocus: boolean, valueOverride?: Value) => {\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 ?? valueRef.current)\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 ?? valueRef.current)\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(\n onBlurValidator(valueOverride ?? valueRef.current)\n ).then(persistErrorState)\n }\n\n // Since the user left the field, show error (if any)\n showError()\n forceUpdate()\n }\n },\n [\n validateUnchanged,\n onFocus,\n onBlur,\n onBlurValidator,\n persistErrorState,\n showError,\n forceUpdate,\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 === valueRef.current) {\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 valueRef.current = 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 showError()\n } else {\n // When changing the value, hide errors to avoid annoying the user before they are finished filling in that value\n hideError()\n }\n // Always validate the value immediately when it is changed\n validateValue()\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 forceUpdate()\n },\n [\n path,\n elementPath,\n iterateElementIndex,\n continuousValidation,\n onChange,\n validateValue,\n dataContextHandlePathChange,\n showError,\n hideError,\n handleIterateElementChange,\n fromInput,\n forceUpdate,\n ]\n )\n\n useMountEffect(() => {\n if (path) {\n dataContext?.handleMountField(path)\n }\n validateValue()\n\n if (showErrorInitially) {\n showError()\n }\n\n return () => {\n // Unmount procedure\n if (path) {\n dataContext?.handleUnMountField(path)\n }\n }\n })\n\n return {\n ...props,\n id,\n name: props.name || props.path?.replace('/', '') || id,\n value: toInput(valueRef.current),\n error:\n !inFieldBlock && showErrorRef.current\n ? errorProp ?? localErrorRef.current ?? contextErrorRef.current\n : undefined,\n autoComplete:\n props.autoComplete ??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IACb;IAEA,OAAO,MAAM;MAEX,IAAIjE,IAAI,EAAE;QACRuB,WAAW,aAAXA,WAAW,uBAAXA,WAAW,CAAE8E,kBAAkB,CAACrG,IAAI,CAAC;MACvC;IACF,CAAC;EACH,CAAC,CAAC;EAEF,OAAAsG,aAAA,CAAAA,aAAA,KACK1G,KAAK;IACRyB,EAAE;IACFkF,IAAI,EAAE3G,KAAK,CAAC2G,IAAI,MAAA1G,WAAA,GAAID,KAAK,CAACI,IAAI,cAAAH,WAAA,uBAAVA,WAAA,CAAYkF,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC,KAAI1D,EAAE;IACtDJ,KAAK,EAAED,OAAO,CAACoC,QAAQ,CAACQ,OAAO,CAAC;IAChCxD,KAAK,EACH,CAAC8B,YAAY,IAAIwB,YAAY,CAACE,OAAO,IAAA9D,KAAA,GACjCO,SAAS,aAATA,SAAS,cAATA,SAAS,GAAImD,aAAa,CAACI,OAAO,cAAA9D,KAAA,cAAAA,KAAA,GAAI2D,eAAe,CAACG,OAAO,GAC7D3B,SAAS;IACfuE,YAAY,GAAAzG,mBAAA,GACVH,KAAK,CAAC4G,YAAY,cAAAzG,mBAAA,cAAAA,mBAAA,GACjBwB,WAAW,CAACiF,YAAY,KAAK,IAAI,GAAG,IAAI,GAAG,KAAM;IACpDf,WAAW;IACXM,WAAW;IACXC,UAAU;IACVpD;EAAY;AAEhB"}
@@ -0,0 +1,5 @@
1
+ import { EffectCallback } from 'react';
2
+ /**
3
+ * UseEffect that only run on the initial mount
4
+ */
5
+ export default function useMountEffect(callback: EffectCallback): void;
@@ -0,0 +1,9 @@
1
+ "use client";
2
+
3
+ import { useEffect } from 'react';
4
+ export default function useMountEffect(callback) {
5
+ useEffect(function () {
6
+ callback(...arguments);
7
+ }, []);
8
+ }
9
+ //# sourceMappingURL=useMountEffect.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useMountEffect.js","names":["useEffect","useMountEffect","callback","arguments"],"sources":["../../../../../src/extensions/forms/hooks/useMountEffect.ts"],"sourcesContent":["import { useEffect, EffectCallback } from 'react'\n\n/**\n * UseEffect that only run on the initial mount\n */\nexport default function useMountEffect(callback: EffectCallback) {\n useEffect((...args) => {\n callback(...args)\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [])\n}\n"],"mappings":";;AAAA,SAASA,SAAS,QAAwB,OAAO;AAKjD,eAAe,SAASC,cAAcA,CAACC,QAAwB,EAAE;EAC/DF,SAAS,CAAC,YAAa;IACrBE,QAAQ,CAAC,GAAAC,SAAO,CAAC;EAEnB,CAAC,EAAE,EAAE,CAAC;AACR"}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Keep track of possible parallel processes to avoid issues
3
+ */
4
+ export default function useProcessManager(): {
5
+ startProcess: () => () => boolean;
6
+ };
@@ -0,0 +1,16 @@
1
+ "use client";
2
+
3
+ import { useRef, useCallback } from 'react';
4
+ export default function useProcessManager() {
5
+ const tokenRef = useRef();
6
+ const startProcess = useCallback(() => {
7
+ const processToken = Math.round(Math.random() * 1000000000);
8
+ tokenRef.current = processToken;
9
+ const isProcessActive = () => tokenRef.current === processToken;
10
+ return isProcessActive;
11
+ }, []);
12
+ return {
13
+ startProcess
14
+ };
15
+ }
16
+ //# sourceMappingURL=useProcessManager.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useProcessManager.js","names":["useRef","useCallback","useProcessManager","tokenRef","startProcess","processToken","Math","round","random","current","isProcessActive"],"sources":["../../../../../src/extensions/forms/hooks/useProcessManager.ts"],"sourcesContent":["import { useRef, useCallback } from 'react'\n\n/**\n * Keep track of possible parallel processes to avoid issues\n */\nexport default function useProcessManager() {\n const tokenRef = useRef<number>()\n\n const startProcess = useCallback(() => {\n const processToken = Math.round(Math.random() * 1000000000)\n tokenRef.current = processToken\n\n // If another process was started after this one code can skip further steps to avoid race conditions\n // that could lead to overwriting state in the wrong order.\n const isProcessActive = () => tokenRef.current === processToken\n\n return isProcessActive\n }, [])\n\n return {\n startProcess,\n }\n}\n"],"mappings":";;AAAA,SAASA,MAAM,EAAEC,WAAW,QAAQ,OAAO;AAK3C,eAAe,SAASC,iBAAiBA,CAAA,EAAG;EAC1C,MAAMC,QAAQ,GAAGH,MAAM,CAAS,CAAC;EAEjC,MAAMI,YAAY,GAAGH,WAAW,CAAC,MAAM;IACrC,MAAMI,YAAY,GAAGC,IAAI,CAACC,KAAK,CAACD,IAAI,CAACE,MAAM,CAAC,CAAC,GAAG,UAAU,CAAC;IAC3DL,QAAQ,CAACM,OAAO,GAAGJ,YAAY;IAI/B,MAAMK,eAAe,GAAGA,CAAA,KAAMP,QAAQ,CAACM,OAAO,KAAKJ,YAAY;IAE/D,OAAOK,eAAe;EACxB,CAAC,EAAE,EAAE,CAAC;EAEN,OAAO;IACLN;EACF,CAAC;AACH"}
@@ -0,0 +1,5 @@
1
+ import { EffectCallback, DependencyList } from 'react';
2
+ /**
3
+ * UseEffect that does not run on the initial mount
4
+ */
5
+ export default function useUpdateEffect(callback: EffectCallback, deps?: DependencyList): void;
@@ -0,0 +1,14 @@
1
+ "use client";
2
+
3
+ import { useEffect, useRef } from 'react';
4
+ export default function useUpdateEffect(callback, deps) {
5
+ const wasMounted = useRef(false);
6
+ useEffect(function () {
7
+ if (!wasMounted.current) {
8
+ wasMounted.current = true;
9
+ return;
10
+ }
11
+ callback(...arguments);
12
+ }, deps);
13
+ }
14
+ //# sourceMappingURL=useUpdateEffect.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useUpdateEffect.js","names":["useEffect","useRef","useUpdateEffect","callback","deps","wasMounted","current","arguments"],"sources":["../../../../../src/extensions/forms/hooks/useUpdateEffect.ts"],"sourcesContent":["import { useEffect, useRef, EffectCallback, DependencyList } from 'react'\n\n/**\n * UseEffect that does not run on the initial mount\n */\nexport default function useUpdateEffect(\n callback: EffectCallback,\n deps?: DependencyList\n) {\n const wasMounted = useRef(false)\n\n useEffect((...args) => {\n if (!wasMounted.current) {\n wasMounted.current = true\n return\n }\n callback(...args)\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, deps)\n}\n"],"mappings":";;AAAA,SAASA,SAAS,EAAEC,MAAM,QAAwC,OAAO;AAKzE,eAAe,SAASC,eAAeA,CACrCC,QAAwB,EACxBC,IAAqB,EACrB;EACA,MAAMC,UAAU,GAAGJ,MAAM,CAAC,KAAK,CAAC;EAEhCD,SAAS,CAAC,YAAa;IACrB,IAAI,CAACK,UAAU,CAACC,OAAO,EAAE;MACvBD,UAAU,CAACC,OAAO,GAAG,IAAI;MACzB;IACF;IACAH,QAAQ,CAAC,GAAAI,SAAO,CAAC;EAEnB,CAAC,EAAEH,IAAI,CAAC;AACV"}
@@ -113,6 +113,19 @@
113
113
  column-gap: var(--spacing-small);
114
114
  }
115
115
 
116
+ :root {
117
+ --forms-field-width--small: 5rem;
118
+ --forms-field-width--medium: 11rem;
119
+ --forms-field-width--large: 21rem;
120
+ }
121
+
122
+ .dnb-forms-field-expiry {
123
+ width: var(--forms-field-width--small);
124
+ }
125
+ .dnb-forms-field-expiry .dnb-input__shell {
126
+ justify-content: center;
127
+ }
128
+
116
129
  /*
117
130
  * Utilities
118
131
  */
@@ -1 +1 @@
1
- .dnb-forms-button-row{grid-column-gap:var(--spacing-small);-moz-column-gap:var(--spacing-small);column-gap:var(--spacing-small);display:flex;flex-flow:row}.dnb-spacing .dnb-form-main-heading.dnb-h--large:not([class*=space__]){margin:0}.dnb-form-main-heading[\:has\(\%2B\%20\.dnb-flex-stack\%20\%3E\%20\.dnb-card\,\%20\%2B\%20\.dnb-card\)]:not([class*=space__left]){margin-left:var(--spacing-medium)}.dnb-form-main-heading:has(+.dnb-flex-stack>.dnb-card,+.dnb-card):not([class*=space__left]){margin-left:var(--spacing-medium)}.dnb-form-main-heading[\:has\(\%2B\%20\.dnb-flex-stack\%20\%3E\%20\.dnb-card\,\%20\%2B\%20\.dnb-card\)]:not([class*=space__bottom]){margin-bottom:var(--spacing-small)}.dnb-form-main-heading:has(+.dnb-flex-stack>.dnb-card,+.dnb-card):not([class*=space__bottom]){margin-bottom:var(--spacing-small)}.dnb-spacing .dnb-form-sub-heading.dnb-h--medium:not([class*=space__]){margin:0}.dnb-form-sub-heading[\:has\(\%2B\%20\.dnb-flex-stack\%20\%3E\%20\.dnb-card\,\%20\%2B\%20\.dnb-card\)]:not([class*=space__bottom]){margin-bottom:var(--spacing-small)}.dnb-form-sub-heading:has(+.dnb-flex-stack>.dnb-card,+.dnb-card):not([class*=space__bottom]){margin-bottom:var(--spacing-small)}.dnb-forms-field-phone-number__country-code,.dnb-forms-field-phone-number__country-code .dnb-autocomplete__shell{width:9rem}.dnb-forms-field-phone-number__number{flex:1}.dnb-forms-field-postal-code-and-city__fields{grid-column-gap:var(--spacing-small);-moz-column-gap:var(--spacing-small);column-gap:var(--spacing-small);display:flex;flex-flow:row}.dnb-forms-field-postal-code-and-city--width-small{width:var(--forms-field-width--small)}.dnb-forms-field-postal-code-and-city--width-medium{width:var(--forms-field-width--medium)}.dnb-forms-field-postal-code-and-city--width-large{width:var(--forms-field-width--large)}.dnb-forms-field-postal-code-and-city__postal-code{flex:0 5rem}.dnb-forms-field-postal-code-and-city__city{flex:1}.dnb-forms-field-selection--width-large .dnb-dropdown__shell{width:var(--forms-field-width--large)}.dnb-forms-field-selection--width-medium .dnb-dropdown__shell{width:var(--forms-field-width--medium)}.dnb-forms-field-selection--width-small .dnb-dropdown__shell{width:var(--forms-field-width--small)}.dnb-forms-field-array-selection--options-layout-vertical .dnb-forms-field-array-selection__options{grid-row-gap:var(--spacing-x-small);display:flex;flex-flow:column;row-gap:var(--spacing-x-small)}.dnb-forms-field-array-selection--options-layout-horizontal .dnb-forms-field-array-selection__options{grid-column-gap:var(--spacing-small);-moz-column-gap:var(--spacing-small);column-gap:var(--spacing-small);display:flex;flex-flow:row wrap}.dnb-forms-steps-layout{grid-column-gap:var(--spacing-medium);-moz-column-gap:var(--spacing-medium);column-gap:var(--spacing-medium);display:flex;flex-flow:row wrap}@media (max-width:60em){.dnb-forms-steps-layout{align-items:stretch;flex-direction:column;justify-content:stretch}}.dnb-forms-steps-layout__sidebar{flex:0;min-width:21rem}.dnb-forms-steps-layout__sidebar .dnb-step-indicator__sidebar{max-width:21rem}.dnb-forms-steps-layout__sidebar .dnb-step-indicator__sidebar .dnb-step-indicator__item{min-width:336px}.dnb-forms-steps-layout__contents{flex:1;min-width:25rem}.dnb-forms-steps-layout__contents .dnb-card{--border-color:var(--color-pistachio)}.dnb-forms-test-element{border:1px dashed grey;border-radius:.5rem;color:#909090;padding:.5rem 1rem}:root{--forms-field-width--small:5rem;--forms-field-width--medium:11rem;--forms-field-width--large:21rem}fieldset.dnb-forms-field-block{border:none;padding:0}fieldset.dnb-forms-field-block:not([class*=space__top]){margin-top:0}fieldset.dnb-forms-field-block:not([class*=space__right]){margin-right:0}fieldset.dnb-forms-field-block:not([class*=space__bottom]){margin-bottom:0}fieldset.dnb-forms-field-block:not([class*=space__left]){margin-left:0}.dnb-forms-field-block__grid{display:grid}.dnb-forms-field-block--layout-vertical{grid-template-areas:"label" "contents" "status";grid-template-columns:auto}.dnb-forms-field-block--layout-horizontal{grid-template-areas:"label contents" "status status";grid-template-columns:var(--forms-field-width--medium) auto}@media screen and (min-width:30em){.dnb-forms-field-block--width-small{width:var(--forms-field-width--small)}.dnb-forms-field-block--width-medium{width:var(--forms-field-width--medium)}.dnb-forms-field-block--width-large{width:var(--forms-field-width--large)}}.dnb-forms-field-block__label{align-items:center;display:flex;flex-flow:row;grid-area:label;justify-content:space-between}.dnb-forms-field-block__label-description{margin-left:.3em}.dnb-forms-field-block__label-description,.dnb-forms-field-block__label-secondary{color:var(--color-black-55);font-size:var(--font-size-small)}.dnb-forms-field-block__status{grid-area:status}.dnb-forms-field-block__contents{grid-area:contents}.dnb-forms-field-block__contents--width-stretch{width:100%}@media screen and (min-width:30em){.dnb-forms-field-block__contents--width-small{width:var(--forms-field-width--small)}.dnb-forms-field-block__contents--width-medium{width:var(--forms-field-width--medium)}.dnb-forms-field-block__contents--width-large{width:var(--forms-field-width--large)}}.dnb-forms-value-block{display:block;font-size:var(--font-size-basis)}.dnb-forms-value-block--inline{display:inline-block;font-size:inherit;margin-left:var(--spacing-xx-small);margin-right:var(--spacing-xx-small)}.dnb-forms-value-block__label{font-weight:var(--font-weight-medium)}.dnb-forms-value-block__placeholder{color:rgba(0,0,0,.5)}
1
+ .dnb-forms-button-row{grid-column-gap:var(--spacing-small);-moz-column-gap:var(--spacing-small);column-gap:var(--spacing-small);display:flex;flex-flow:row}.dnb-spacing .dnb-form-main-heading.dnb-h--large:not([class*=space__]){margin:0}.dnb-form-main-heading[\:has\(\%2B\%20\.dnb-flex-stack\%20\%3E\%20\.dnb-card\,\%20\%2B\%20\.dnb-card\)]:not([class*=space__left]){margin-left:var(--spacing-medium)}.dnb-form-main-heading:has(+.dnb-flex-stack>.dnb-card,+.dnb-card):not([class*=space__left]){margin-left:var(--spacing-medium)}.dnb-form-main-heading[\:has\(\%2B\%20\.dnb-flex-stack\%20\%3E\%20\.dnb-card\,\%20\%2B\%20\.dnb-card\)]:not([class*=space__bottom]){margin-bottom:var(--spacing-small)}.dnb-form-main-heading:has(+.dnb-flex-stack>.dnb-card,+.dnb-card):not([class*=space__bottom]){margin-bottom:var(--spacing-small)}.dnb-spacing .dnb-form-sub-heading.dnb-h--medium:not([class*=space__]){margin:0}.dnb-form-sub-heading[\:has\(\%2B\%20\.dnb-flex-stack\%20\%3E\%20\.dnb-card\,\%20\%2B\%20\.dnb-card\)]:not([class*=space__bottom]){margin-bottom:var(--spacing-small)}.dnb-form-sub-heading:has(+.dnb-flex-stack>.dnb-card,+.dnb-card):not([class*=space__bottom]){margin-bottom:var(--spacing-small)}.dnb-forms-field-phone-number__country-code,.dnb-forms-field-phone-number__country-code .dnb-autocomplete__shell{width:9rem}.dnb-forms-field-phone-number__number{flex:1}.dnb-forms-field-postal-code-and-city__fields{grid-column-gap:var(--spacing-small);-moz-column-gap:var(--spacing-small);column-gap:var(--spacing-small);display:flex;flex-flow:row}.dnb-forms-field-postal-code-and-city--width-small{width:var(--forms-field-width--small)}.dnb-forms-field-postal-code-and-city--width-medium{width:var(--forms-field-width--medium)}.dnb-forms-field-postal-code-and-city--width-large{width:var(--forms-field-width--large)}.dnb-forms-field-postal-code-and-city__postal-code{flex:0 5rem}.dnb-forms-field-postal-code-and-city__city{flex:1}.dnb-forms-field-selection--width-large .dnb-dropdown__shell{width:var(--forms-field-width--large)}.dnb-forms-field-selection--width-medium .dnb-dropdown__shell{width:var(--forms-field-width--medium)}.dnb-forms-field-selection--width-small .dnb-dropdown__shell{width:var(--forms-field-width--small)}.dnb-forms-field-array-selection--options-layout-vertical .dnb-forms-field-array-selection__options{grid-row-gap:var(--spacing-x-small);display:flex;flex-flow:column;row-gap:var(--spacing-x-small)}.dnb-forms-field-array-selection--options-layout-horizontal .dnb-forms-field-array-selection__options{grid-column-gap:var(--spacing-small);-moz-column-gap:var(--spacing-small);column-gap:var(--spacing-small);display:flex;flex-flow:row wrap}.dnb-forms-field-expiry{width:var(--forms-field-width--small)}.dnb-forms-field-expiry .dnb-input__shell{justify-content:center}.dnb-forms-steps-layout{grid-column-gap:var(--spacing-medium);-moz-column-gap:var(--spacing-medium);column-gap:var(--spacing-medium);display:flex;flex-flow:row wrap}@media (max-width:60em){.dnb-forms-steps-layout{align-items:stretch;flex-direction:column;justify-content:stretch}}.dnb-forms-steps-layout__sidebar{flex:0;min-width:21rem}.dnb-forms-steps-layout__sidebar .dnb-step-indicator__sidebar{max-width:21rem}.dnb-forms-steps-layout__sidebar .dnb-step-indicator__sidebar .dnb-step-indicator__item{min-width:336px}.dnb-forms-steps-layout__contents{flex:1;min-width:25rem}.dnb-forms-steps-layout__contents .dnb-card{--border-color:var(--color-pistachio)}.dnb-forms-test-element{border:1px dashed grey;border-radius:.5rem;color:#909090;padding:.5rem 1rem}:root{--forms-field-width--small:5rem;--forms-field-width--medium:11rem;--forms-field-width--large:21rem}fieldset.dnb-forms-field-block{border:none;padding:0}fieldset.dnb-forms-field-block:not([class*=space__top]){margin-top:0}fieldset.dnb-forms-field-block:not([class*=space__right]){margin-right:0}fieldset.dnb-forms-field-block:not([class*=space__bottom]){margin-bottom:0}fieldset.dnb-forms-field-block:not([class*=space__left]){margin-left:0}.dnb-forms-field-block__grid{display:grid}.dnb-forms-field-block--layout-vertical{grid-template-areas:"label" "contents" "status";grid-template-columns:auto}.dnb-forms-field-block--layout-horizontal{grid-template-areas:"label contents" "status status";grid-template-columns:var(--forms-field-width--medium) auto}@media screen and (min-width:30em){.dnb-forms-field-block--width-small{width:var(--forms-field-width--small)}.dnb-forms-field-block--width-medium{width:var(--forms-field-width--medium)}.dnb-forms-field-block--width-large{width:var(--forms-field-width--large)}}.dnb-forms-field-block__label{align-items:center;display:flex;flex-flow:row;grid-area:label;justify-content:space-between}.dnb-forms-field-block__label-description{margin-left:.3em}.dnb-forms-field-block__label-description,.dnb-forms-field-block__label-secondary{color:var(--color-black-55);font-size:var(--font-size-small)}.dnb-forms-field-block__status{grid-area:status}.dnb-forms-field-block__contents{grid-area:contents}.dnb-forms-field-block__contents--width-stretch{width:100%}@media screen and (min-width:30em){.dnb-forms-field-block__contents--width-small{width:var(--forms-field-width--small)}.dnb-forms-field-block__contents--width-medium{width:var(--forms-field-width--medium)}.dnb-forms-field-block__contents--width-large{width:var(--forms-field-width--large)}}.dnb-forms-value-block{display:block;font-size:var(--font-size-basis)}.dnb-forms-value-block--inline{display:inline-block;font-size:inherit;margin-left:var(--spacing-xx-small);margin-right:var(--spacing-xx-small)}.dnb-forms-value-block__label{font-weight:var(--font-weight-medium)}.dnb-forms-value-block__placeholder{color:rgba(0,0,0,.5)}
@@ -1,8 +1,11 @@
1
1
  /// <reference types="react" />
2
2
  import { JSONSchema7 } from 'json-schema';
3
3
  import { SpacingProps } from '../../components/space/types';
4
+ type ValidationRule = string | string[];
5
+ type MessageValues = Record<string, string>;
4
6
  interface IFormErrorOptions {
5
- validationRule?: string | string[];
7
+ validationRule?: ValidationRule;
8
+ messageValues?: MessageValues;
6
9
  }
7
10
  /**
8
11
  * Standard error object for Eufemia Forms, extending the built-in error with additional information for data handling
@@ -11,7 +14,12 @@ export declare class FormError extends Error {
11
14
  /**
12
15
  * What validation rule did the error occur based on? (i.e: minLength, required or maximum)
13
16
  */
14
- validationRule?: string | string[];
17
+ validationRule?: ValidationRule;
18
+ /**
19
+ * Replacement values relevant for this error.
20
+ * @example { minLength: 3 } to be able to replace values in a message like "Minimum {minLength} charactes"
21
+ */
22
+ messageValues?: MessageValues;
15
23
  constructor(message: string, options?: IFormErrorOptions);
16
24
  }
17
25
  interface DefaultErrorMessages {
@@ -3,8 +3,10 @@ export class FormError extends Error {
3
3
  constructor(message, options) {
4
4
  super(message);
5
5
  _defineProperty(this, "validationRule", void 0);
6
+ _defineProperty(this, "messageValues", void 0);
6
7
  if (options) {
7
8
  this.validationRule = options.validationRule;
9
+ this.messageValues = options.messageValues;
8
10
  }
9
11
  }
10
12
  }
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","names":["FormError","Error","constructor","message","options","_defineProperty","validationRule","dataValueReadProps","pickDataValueReadProps","props","Object","fromEntries","entries","filter","_ref","key","includes","omitDataValueReadProps","_ref2","dataValueWriteProps","pickDataValueWriteProps","_ref3","omitDataValueWriteProps","_ref4","pickDataValueReadWriteProps","_ref5","omitDataValueReadWriteProps","_ref6"],"sources":["../../../../src/extensions/forms/types.ts"],"sourcesContent":["import { JSONSchema7 } from 'json-schema'\nimport { SpacingProps } from '../../components/space/types'\n\ninterface IFormErrorOptions {\n validationRule?: string | string[]\n}\n\n/**\n * Standard error object for Eufemia Forms, extending the built-in error with additional information for data handling\n */\nexport class FormError extends Error {\n /**\n * What validation rule did the error occur based on? (i.e: minLength, required or maximum)\n */\n validationRule?: string | string[]\n\n constructor(message: string, options?: IFormErrorOptions) {\n super(message)\n\n if (options) {\n this.validationRule = options.validationRule\n }\n }\n}\n\n// Data value\n\ninterface DefaultErrorMessages {\n required?: string\n}\n\nexport interface DataValueReadProps<Value = unknown> {\n /** JSON Pointer for where the data for this field is located in the source dataset */\n path?: string\n /** JSON Pointer for where the data for this field is located in the source iterate loop element */\n elementPath?: string\n value?: Value\n}\n\nconst dataValueReadProps = ['path', 'elementPath', 'value']\n\nexport function pickDataValueReadProps<Props extends DataValueReadProps>(\n props: Props\n): DataValueReadProps {\n return Object.fromEntries(\n Object.entries(props ?? {}).filter(([key]) =>\n dataValueReadProps.includes(key)\n )\n )\n}\n\nexport function omitDataValueReadProps<Props extends DataValueReadProps>(\n props: Props\n): Omit<DataValueReadProps, keyof DataValueReadProps> {\n return Object.fromEntries(\n Object.entries(props ?? {}).filter(\n ([key]) => !dataValueReadProps.includes(key)\n )\n )\n}\n\nexport interface DataValueWriteProps<\n Value = unknown,\n EmptyValue = undefined | string | number,\n> {\n emptyValue?: EmptyValue\n onFocus?: (value: Value | EmptyValue) => void\n onBlur?: (value: Value | EmptyValue) => void\n onChange?: (value: Value | EmptyValue) => void\n}\n\nconst dataValueWriteProps = ['emptyValue', 'onFocus', 'onBlur', 'onChange']\n\nexport function pickDataValueWriteProps<Props extends DataValueWriteProps>(\n props: Props\n): DataValueWriteProps {\n return Object.fromEntries(\n Object.entries(props ?? {}).filter(([key]) =>\n dataValueWriteProps.includes(key)\n )\n )\n}\n\nexport function omitDataValueWriteProps<Props extends DataValueWriteProps>(\n props: Props\n): Omit<DataValueWriteProps, keyof DataValueWriteProps> {\n return Object.fromEntries(\n Object.entries(props ?? {}).filter(\n ([key]) => !dataValueWriteProps.includes(key)\n )\n )\n}\n\nexport type DataValueReadWriteProps<\n Value = unknown,\n EmptyValue = undefined | string | number,\n> = DataValueReadProps<Value> & DataValueWriteProps<Value, EmptyValue>\n\nexport function pickDataValueReadWriteProps<\n Props extends DataValueReadWriteProps,\n>(props: Props): DataValueReadWriteProps {\n return Object.fromEntries(\n Object.entries(props ?? {}).filter(\n ([key]) =>\n dataValueReadProps.includes(key) ||\n dataValueWriteProps.includes(key)\n )\n )\n}\n\nexport function omitDataValueReadWriteProps<\n Props extends DataValueReadWriteProps,\n>(\n props: Props\n): Omit<DataValueReadWriteProps, keyof DataValueReadWriteProps> {\n return Object.fromEntries(\n Object.entries(props ?? {}).filter(\n ([key]) =>\n !dataValueReadProps.includes(key) &&\n !dataValueWriteProps.includes(key)\n )\n )\n}\n\nexport type ComponentProps = SpacingProps & {\n className?: string\n}\n\nexport type DataValueReadComponentProps<Value = unknown> = ComponentProps &\n DataValueReadProps<Value>\n\nexport type DataValueReadWriteComponentProps<\n Value = unknown,\n EmptyValue = undefined | string | number,\n> = ComponentProps &\n DataValueReadProps<Value> &\n DataValueWriteProps<Value, EmptyValue>\n\nexport interface FieldProps<\n Value = unknown,\n EmptyValue = undefined | string | number,\n ErrorMessages extends { required?: string } = DefaultErrorMessages,\n> extends DataValueReadWriteComponentProps<Value, EmptyValue> {\n /** ID added to the actual field component, and linked to the label via for-attribute */\n id?: string\n name?: string\n layout?: 'horizontal' | 'vertical'\n /** Main label text */\n label?: React.ReactNode\n /** A more discreet text displayed beside the label (i.e for \"(optional)\") */\n labelDescription?: React.ReactNode\n /** Secondary information displayed at the end of the label line (i.e character counter) */\n labelSecondary?: React.ReactNode\n /** Text showing in place of the value if no value is given */\n placeholder?: string\n autoComplete?:\n | HTMLInputElement['autocomplete']\n | HTMLTextAreaElement['autocomplete']\n info?: Error | FormError | string\n warning?: Error | FormError | string\n error?: Error | FormError\n disabled?: boolean\n // Validation\n required?: boolean\n schema?: JSONSchema7\n validator?: (\n value: Value | EmptyValue\n ) => Error | undefined | Promise<Error | undefined>\n onBlurValidator?: (\n value: Value | EmptyValue\n ) => Error | undefined | Promise<Error | undefined>\n /**\n * Should error messages based on validation be shown initially (from given value-prop or source data)\n * before the user interacts with the field?\n * @default false\n * */\n validateInitially?: boolean\n /**\n * Should error messages be shown when touching (like focusing a field and blurring) without having changed\n * the value? So the user did not introduce a new error, but it was invalid based on validation initially.\n */\n validateUnchanged?: boolean\n /** Should validation be done while writing, not just when blurring the field? */\n continuousValidation?: boolean\n errorMessages?: ErrorMessages\n // Derivatives\n toInput?: (external: Value | undefined) => any\n fromInput?: (...args: any[]) => Value | undefined\n}\n\nexport interface FieldHelpProps {\n help?: {\n title?: string\n contents?: string\n }\n}\n\nexport interface ValueProps<Value>\n extends DataValueReadComponentProps<Value> {\n label?: string\n /** Should the component render if the value is empty? */\n showEmpty?: boolean\n /** Text showing in place of the value if no value is given. */\n placeholder?: string\n /** JSON Pointer for where the data for this field is located in the source iterate loop element */\n elementPath?: string\n /** For showing the value inline (not as a block element) */\n inline?: boolean\n // Derivatives\n /** Prepare value for display (regardless of source like props or data context) */\n prepare?: (external: Value | undefined) => string\n}\n"],"mappings":";AAUA,OAAO,MAAMA,SAAS,SAASC,KAAK,CAAC;EAMnCC,WAAWA,CAACC,OAAe,EAAEC,OAA2B,EAAE;IACxD,KAAK,CAACD,OAAO,CAAC;IAAAE,eAAA;IAEd,IAAID,OAAO,EAAE;MACX,IAAI,CAACE,cAAc,GAAGF,OAAO,CAACE,cAAc;IAC9C;EACF;AACF;AAgBA,MAAMC,kBAAkB,GAAG,CAAC,MAAM,EAAE,aAAa,EAAE,OAAO,CAAC;AAE3D,OAAO,SAASC,sBAAsBA,CACpCC,KAAY,EACQ;EACpB,OAAOC,MAAM,CAACC,WAAW,CACvBD,MAAM,CAACE,OAAO,CAACH,KAAK,aAALA,KAAK,cAALA,KAAK,GAAI,CAAC,CAAC,CAAC,CAACI,MAAM,CAACC,IAAA;IAAA,IAAC,CAACC,GAAG,CAAC,GAAAD,IAAA;IAAA,OACvCP,kBAAkB,CAACS,QAAQ,CAACD,GAAG,CAAC;EAAA,CAClC,CACF,CAAC;AACH;AAEA,OAAO,SAASE,sBAAsBA,CACpCR,KAAY,EACwC;EACpD,OAAOC,MAAM,CAACC,WAAW,CACvBD,MAAM,CAACE,OAAO,CAACH,KAAK,aAALA,KAAK,cAALA,KAAK,GAAI,CAAC,CAAC,CAAC,CAACI,MAAM,CAChCK,KAAA;IAAA,IAAC,CAACH,GA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,EACkD;EAC9D,OAAOC,MAAM,CAACC,WAAW,CACvBD,MAAM,CAACE,OAAO,CAACH,KAAK,aAALA,KAAK,cAALA,KAAK,GAAI,CAAC,CAAC,CAAC,CAACI,MAAM,CAChCc,KAAA;IAAA,IAAC,CAACZ,GAAG,CAAC,GAAAY,KAAA;IAAA,OACJ,CAACpB,kBAAkB,CAACS,QAAQ,CAACD,GAAG,CAAC,IACjC,CAACI,mBAAmB,CAACH,QAAQ,CAACD,GAAG,CAAC;EAAA,CACtC,CACF,CAAC;AACH"}
1
+ {"version":3,"file":"types.js","names":["FormError","Error","constructor","message","options","_defineProperty","validationRule","messageValues","dataValueReadProps","pickDataValueReadProps","props","Object","fromEntries","entries","filter","_ref","key","includes","omitDataValueReadProps","_ref2","dataValueWriteProps","pickDataValueWriteProps","_ref3","omitDataValueWriteProps","_ref4","pickDataValueReadWriteProps","_ref5","omitDataValueReadWriteProps","_ref6"],"sources":["../../../../src/extensions/forms/types.ts"],"sourcesContent":["import { JSONSchema7 } from 'json-schema'\nimport { SpacingProps } from '../../components/space/types'\n\ntype ValidationRule = string | string[]\ntype MessageValues = Record<string, string>\n\ninterface IFormErrorOptions {\n validationRule?: ValidationRule\n messageValues?: MessageValues\n}\n\n/**\n * Standard error object for Eufemia Forms, extending the built-in error with additional information for data handling\n */\nexport class FormError extends Error {\n /**\n * What validation rule did the error occur based on? (i.e: minLength, required or maximum)\n */\n validationRule?: ValidationRule\n\n /**\n * Replacement values relevant for this error.\n * @example { minLength: 3 } to be able to replace values in a message like \"Minimum {minLength} charactes\"\n */\n messageValues?: MessageValues\n\n constructor(message: string, options?: IFormErrorOptions) {\n super(message)\n\n if (options) {\n this.validationRule = options.validationRule\n this.messageValues = options.messageValues\n }\n }\n}\n\n// Data value\n\ninterface DefaultErrorMessages {\n required?: string\n}\n\nexport interface DataValueReadProps<Value = unknown> {\n /** JSON Pointer for where the data for this field is located in the source dataset */\n path?: string\n /** JSON Pointer for where the data for this field is located in the source iterate loop element */\n elementPath?: string\n value?: Value\n}\n\nconst dataValueReadProps = ['path', 'elementPath', 'value']\n\nexport function pickDataValueReadProps<Props extends DataValueReadProps>(\n props: Props\n): DataValueReadProps {\n return Object.fromEntries(\n Object.entries(props ?? {}).filter(([key]) =>\n dataValueReadProps.includes(key)\n )\n )\n}\n\nexport function omitDataValueReadProps<Props extends DataValueReadProps>(\n props: Props\n): Omit<DataValueReadProps, keyof DataValueReadProps> {\n return Object.fromEntries(\n Object.entries(props ?? {}).filter(\n ([key]) => !dataValueReadProps.includes(key)\n )\n )\n}\n\nexport interface DataValueWriteProps<\n Value = unknown,\n EmptyValue = undefined | string | number,\n> {\n emptyValue?: EmptyValue\n onFocus?: (value: Value | EmptyValue) => void\n onBlur?: (value: Value | EmptyValue) => void\n onChange?: (value: Value | EmptyValue) => void\n}\n\nconst dataValueWriteProps = ['emptyValue', 'onFocus', 'onBlur', 'onChange']\n\nexport function pickDataValueWriteProps<Props extends DataValueWriteProps>(\n props: Props\n): DataValueWriteProps {\n return Object.fromEntries(\n Object.entries(props ?? {}).filter(([key]) =>\n dataValueWriteProps.includes(key)\n )\n )\n}\n\nexport function omitDataValueWriteProps<Props extends DataValueWriteProps>(\n props: Props\n): Omit<DataValueWriteProps, keyof DataValueWriteProps> {\n return Object.fromEntries(\n Object.entries(props ?? {}).filter(\n ([key]) => !dataValueWriteProps.includes(key)\n )\n )\n}\n\nexport type DataValueReadWriteProps<\n Value = unknown,\n EmptyValue = undefined | string | number,\n> = DataValueReadProps<Value> & DataValueWriteProps<Value, EmptyValue>\n\nexport function pickDataValueReadWriteProps<\n Props extends DataValueReadWriteProps,\n>(props: Props): DataValueReadWriteProps {\n return Object.fromEntries(\n Object.entries(props ?? {}).filter(\n ([key]) =>\n dataValueReadProps.includes(key) ||\n dataValueWriteProps.includes(key)\n )\n )\n}\n\nexport function omitDataValueReadWriteProps<\n Props extends DataValueReadWriteProps,\n>(\n props: Props\n): Omit<DataValueReadWriteProps, keyof DataValueReadWriteProps> {\n return Object.fromEntries(\n Object.entries(props ?? {}).filter(\n ([key]) =>\n !dataValueReadProps.includes(key) &&\n !dataValueWriteProps.includes(key)\n )\n )\n}\n\nexport type ComponentProps = SpacingProps & {\n className?: string\n}\n\nexport type DataValueReadComponentProps<Value = unknown> = ComponentProps &\n DataValueReadProps<Value>\n\nexport type DataValueReadWriteComponentProps<\n Value = unknown,\n EmptyValue = undefined | string | number,\n> = ComponentProps &\n DataValueReadProps<Value> &\n DataValueWriteProps<Value, EmptyValue>\n\nexport interface FieldProps<\n Value = unknown,\n EmptyValue = undefined | string | number,\n ErrorMessages extends { required?: string } = DefaultErrorMessages,\n> extends DataValueReadWriteComponentProps<Value, EmptyValue> {\n /** ID added to the actual field component, and linked to the label via for-attribute */\n id?: string\n name?: string\n layout?: 'horizontal' | 'vertical'\n /** Main label text */\n label?: React.ReactNode\n /** A more discreet text displayed beside the label (i.e for \"(optional)\") */\n labelDescription?: React.ReactNode\n /** Secondary information displayed at the end of the label line (i.e character counter) */\n labelSecondary?: React.ReactNode\n /** Text showing in place of the value if no value is given */\n placeholder?: string\n autoComplete?:\n | HTMLInputElement['autocomplete']\n | HTMLTextAreaElement['autocomplete']\n info?: Error | FormError | string\n warning?: Error | FormError | string\n error?: Error | FormError\n disabled?: boolean\n // Validation\n required?: boolean\n schema?: JSONSchema7\n validator?: (\n value: Value | EmptyValue\n ) => Error | undefined | Promise<Error | undefined>\n onBlurValidator?: (\n value: Value | EmptyValue\n ) => Error | undefined | Promise<Error | undefined>\n /**\n * Should error messages based on validation be shown initially (from given value-prop or source data)\n * before the user interacts with the field?\n * @default false\n * */\n validateInitially?: boolean\n /**\n * Should error messages be shown when touching (like focusing a field and blurring) without having changed\n * the value? So the user did not introduce a new error, but it was invalid based on validation initially.\n */\n validateUnchanged?: boolean\n /** Should validation be done while writing, not just when blurring the field? */\n continuousValidation?: boolean\n errorMessages?: ErrorMessages\n // Derivatives\n toInput?: (external: Value | undefined) => any\n fromInput?: (...args: any[]) => Value | undefined\n}\n\nexport interface FieldHelpProps {\n help?: {\n title?: string\n contents?: string\n }\n}\n\nexport interface ValueProps<Value>\n extends DataValueReadComponentProps<Value> {\n label?: string\n /** Should the component render if the value is empty? */\n showEmpty?: boolean\n /** Text showing in place of the value if no value is given. */\n placeholder?: string\n /** JSON Pointer for where the data for this field is located in the source iterate loop element */\n elementPath?: string\n /** For showing the value inline (not as a block element) */\n inline?: boolean\n // Derivatives\n /** Prepare value for display (regardless of source like props or data context) */\n prepare?: (external: Value | undefined) => string\n}\n"],"mappings":";AAcA,OAAO,MAAMA,SAAS,SAASC,KAAK,CAAC;EAYnCC,WAAWA,CAACC,OAAe,EAAEC,OAA2B,EAAE;IACxD,KAAK,CAACD,OAAO,CAAC;IAAAE,eAAA;IAAAA,eAAA;IAEd,IAAID,OAAO,EAAE;MACX,IAAI,CAACE,cAAc,GAAGF,OAAO,CAACE,cAAc;MAC5C,IAAI,CAACC,aAAa,GAAGH,OAAO,CAACG,aAAa;IAC5C;EACF;AACF;AAgBA,MAAMC,kBAAkB,GAAG,CAAC,MAAM,EAAE,aAAa,EAAE,OAAO,CAAC;AAE3D,OAAO,SAASC,sBAAsBA,CACpCC,KAAY,EACQ;EACpB,OAAOC,MAAM,CAACC,WAAW,CACvBD,MAAM,CAACE,OAAO,CAACH,KAAK,aAALA,KAAK,cAALA,KAAK,GAAI,CAAC,CAAC,CAAC,CAACI,MAAM,CAACC,IAAA;IAAA,IAAC,CAACC,GAAG,CAAC,GAAAD,IAAA;IAAA,OACvCP,kBAAkB,CAACS,QAAQ,CAACD,GAAG,CAAC;EAAA,CAClC,CACF,CAAC;AACH;AAEA,OAAO,SAASE,sBAAsBA,CACpCR,KAAY,EACwC;EACpD,OAAOC,MAAM,CAACC,WAAW,CACvBD,MAAM,CAACE,OAAO,CAACH,KAAK,aAALA,KAAK,cAALA,KAAK,GAAI,CAAC,CAAC,CAAC,CAACI,MAAM,CAChCK,KAAA;IAAA,IAAC,CAACH,GAAG,CAAC,GAAAG,K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OC,MAAM,CAACC,WAAW,CACvBD,MAAM,CAACE,OAAO,CAACH,KAAK,aAALA,KAAK,cAALA,KAAK,GAAI,CAAC,CAAC,CAAC,CAACI,MAAM,CAChCc,KAAA;IAAA,IAAC,CAACZ,GAAG,CAAC,GAAAY,KAAA;IAAA,OACJ,CAACpB,kBAAkB,CAACS,QAAQ,CAACD,GAAG,CAAC,IACjC,CAACI,mBAAmB,CAACH,QAAQ,CAACD,GAAG,CAAC;EAAA,CACtC,CACF,CAAC;AACH"}
@@ -29,10 +29,34 @@ function getValidationRule(ajvError) {
29
29
  }
30
30
  return ajvError.keyword;
31
31
  }
32
+ function getMessageValues(ajvError) {
33
+ var _ajvError$params, _ajvError$params2, _ajvError$params3;
34
+ const validationRule = getValidationRule(ajvError);
35
+ switch (validationRule) {
36
+ case 'minLength':
37
+ case 'maxLength':
38
+ case 'minimum':
39
+ case 'maximum':
40
+ case 'exclusiveMinimum':
41
+ case 'exclusiveMaximum':
42
+ return {
43
+ [validationRule]: (_ajvError$params = ajvError.params) === null || _ajvError$params === void 0 ? void 0 : _ajvError$params.limit
44
+ };
45
+ case 'multipleOf':
46
+ return {
47
+ [validationRule]: (_ajvError$params2 = ajvError.params) === null || _ajvError$params2 === void 0 ? void 0 : _ajvError$params2.multipleOf
48
+ };
49
+ case 'pattern':
50
+ return {
51
+ [validationRule]: (_ajvError$params3 = ajvError.params) === null || _ajvError$params3 === void 0 ? void 0 : _ajvError$params3.pattern
52
+ };
53
+ }
54
+ }
32
55
  function ajvErrorToFormError(ajvError) {
33
56
  var _ajvError$message;
34
57
  const error = new FormError((_ajvError$message = ajvError.message) !== null && _ajvError$message !== void 0 ? _ajvError$message : 'Unknown error', {
35
- validationRule: getValidationRule(ajvError)
58
+ validationRule: getValidationRule(ajvError),
59
+ messageValues: getMessageValues(ajvError)
36
60
  });
37
61
  return error;
38
62
  }
@@ -1 +1 @@
1
- {"version":3,"file":"ajv.js","names":["Ajv","ajvErrors","FormError","ajv","allErrors","getInstancePath","ajvError","keyword","instancePath","params","missingProperty","errors","getValidationRule","ajvErrorToFormError","_ajvError$message","error","message","validationRule","ajvErrorsToOneFormError","length","errorMessages","map","join","ajvErrorsToFormErrors","reduce","_objectSpread"],"sources":["../../../../../src/extensions/forms/utils/ajv.ts"],"sourcesContent":["import Ajv, { ErrorObject } from 'ajv'\nimport ajvErrors from 'ajv-errors'\nimport { FormError } from '../types'\n\nconst ajv = new Ajv({\n // If allErrors is off, ajv only give you the first error it finds\n allErrors: true,\n})\n\najvErrors(ajv)\n\nfunction getInstancePath(ajvError: ErrorObject): string {\n switch (ajvError.keyword) {\n case 'required': {\n // Required-errors are considered object errors by ajv, so they don't have instancePaths. We want to\n // show them under the relevant field\n return `${ajvError.instancePath}/${ajvError.params.missingProperty}`\n }\n case 'errorMessage': {\n // errorMessage structures (from ajv-errors) wrap the original error. Find instance path from original\n // to avoid issues like required-errors pointing at parent object.\n if (ajvError.params.errors[0]) {\n return getInstancePath(ajvError.params.errors[0])\n }\n }\n }\n return ajvError.instancePath\n}\n\nfunction getValidationRule(ajvError: ErrorObject): string {\n if (ajvError.keyword === 'errorMessage' && ajvError.params.errors[0]) {\n // errorMessage structures (from ajv-errors) wrap the original error. Find keyword from original\n // to avoid issues like required-errors pointing at parent object.\n return getValidationRule(ajvError.params.errors[0])\n }\n return ajvError.keyword\n}\n\nfunction ajvErrorToFormError(ajvError: ErrorObject): FormError {\n const error = new FormError(ajvError.message ?? 'Unknown error', {\n validationRule: getValidationRule(ajvError),\n })\n return error\n}\n\n/**\n * Transform errors from ajv-validation into one error object (i.e for validating a flat value)\n */\nexport function ajvErrorsToOneFormError(\n errors?: ErrorObject[] | null\n): FormError | undefined {\n if (!errors || errors.length === 0) {\n return\n }\n if (errors.length === 1) {\n return ajvErrorToFormError(errors[0])\n }\n\n const errorMessages = errors?.map((error) => error.message)\n return new FormError(errorMessages.join(' | '), {\n validationRule: errors.map(getValidationRule),\n })\n}\n\n/**\n *\n * @param errors Transform errors from ajv-validation into a record of errors (path as key, error as value)\n * @returns\n */\nexport const ajvErrorsToFormErrors = (\n errors?: ErrorObject[] | null\n): Record<string, FormError> =>\n (errors ?? []).reduce((errors, ajvError) => {\n return {\n ...errors,\n [getInstancePath(ajvError)]: ajvErrorToFormError(ajvError),\n }\n }, {})\n\nexport default ajv\n"],"mappings":";;;AAAA,OAAOA,GAAG,MAAuB,KAAK;AACtC,OAAOC,SAAS,MAAM,YAAY;AAClC,SAASC,SAAS,QAAQ,UAAU;AAEpC,MAAMC,GAAG,GAAG,IAAIH,GAAG,CAAC;EAElBI,SAAS,EAAE;AACb,CAAC,CAAC;AAEFH,SAAS,CAACE,GAAG,CAAC;AAEd,SAASE,eAAeA,CAACC,QAAqB,EAAU;EACtD,QAAQA,QAAQ,CAACC,OAAO;IACtB,KAAK,UAAU;MAAE;QAGf,OAAQ,GAAED,QAAQ,CAACE,YAAa,IAAGF,QAAQ,CAACG,MAAM,CAACC,eAAgB,EAAC;MACtE;IACA,KAAK,cAAc;MAAE;QAGnB,IAAIJ,QAAQ,CAACG,MAAM,CAACE,MAAM,CAAC,CAAC,CAAC,EAAE;UAC7B,OAAON,eAAe,CAACC,QAAQ,CAACG,MAAM,CAACE,MAAM,CAAC,CAAC,CAAC,CAAC;QACnD;MACF;EACF;EACA,OAAOL,QAAQ,CAACE,YAAY;AAC9B;AAEA,SAASI,iBAAiBA,CAACN,QAAqB,EAAU;EACxD,IAAIA,QAAQ,CAACC,OAAO,KAAK,cAAc,IAAID,QAAQ,CAACG,MAAM,CAACE,MAAM,CAAC,CAAC,CAAC,EAAE;IAGpE,OAAOC,iBAAiB,CAACN,QAAQ,CAACG,MAAM,CAACE,MAAM,CAAC,CAAC,CAAC,CAAC;EACrD;EACA,OAAOL,QAAQ,CAACC,OAAO;AACzB;AAEA,SAASM,mBAAmBA,CAACP,QAAqB,EAAa;EAAA,IAAAQ,iBAAA;EAC7D,MAAMC,KAAK,GAAG,IAAIb,SAAS,EAAAY,iBAAA,GAACR,QAAQ,CAACU,OAAO,cAAAF,iBAAA,cAAAA,iBAAA,GAAI,eAAe,EAAE;IAC/DG,cAAc,EAAEL,iBAAiB,CAACN,QAAQ;EAC5C,CAAC,CAAC;EACF,OAAOS,KAAK;AACd;AAKA,OAAO,SAASG,uBAAuBA,CACrCP,MAA6B,EACN;EACvB,IAAI,CAACA,MAAM,IAAIA,MAAM,CAACQ,MAAM,KAAK,CAAC,EAAE;IAClC;EACF;EACA,IAAIR,MAAM,CAACQ,MAAM,KAAK,CAAC,EAAE;IACvB,OAAON,mBAAmB,CAACF,MAAM,CAAC,CAAC,CAAC,CAAC;EACvC;EAEA,MAAMS,aAAa,GAAGT,MAAM,aAANA,MAAM,uBAANA,MAAM,CAAEU,GAAG,CAAEN,KAAK,IAAKA,KAAK,CAACC,OAAO,CAAC;EAC3D,OAAO,IAAId,SAAS,CAACkB,aAAa,CAACE,IAAI,CAAC,KAAK,CAAC,EAAE;IAC9CL,cAAc,EAAEN,MAAM,CAACU,GAAG,CAACT,iBAAiB;EAC9C,CAAC,CAAC;AACJ;AAOA,OAAO,MAAMW,qBAAqB,GAChCZ,MAA6B,IAE7B,CAACA,MAAM,aAANA,MAAM,cAANA,MAAM,GAAI,EAAE,EAAEa,MAAM,CAAC,CAACb,MAAM,EAAEL,QAAQ,KAAK;EAC1C,OAAAmB,aAAA,CAAAA,aAAA,KACKd,MAAM;IACT,CAACN,eAAe,CAACC,QAAQ,CAAC,GAAGO,mBAAmB,CAACP,QAAQ;EAAC;AAE9D,CAAC,EAAE,CAAC,CAAC,CAAC;AAER,eAAeH,GAAG"}
1
+ {"version":3,"file":"ajv.js","names":["Ajv","ajvErrors","FormError","ajv","allErrors","getInstancePath","ajvError","keyword","instancePath","params","missingProperty","errors","getValidationRule","getMessageValues","_ajvError$params","_ajvError$params2","_ajvError$params3","validationRule","limit","multipleOf","pattern","ajvErrorToFormError","_ajvError$message","error","message","messageValues","ajvErrorsToOneFormError","length","errorMessages","map","join","ajvErrorsToFormErrors","reduce","_objectSpread"],"sources":["../../../../../src/extensions/forms/utils/ajv.ts"],"sourcesContent":["import Ajv, { ErrorObject } from 'ajv'\nimport ajvErrors from 'ajv-errors'\nimport { FormError } from '../types'\n\nconst ajv = new Ajv({\n // If allErrors is off, ajv only give you the first error it finds\n allErrors: true,\n})\n\najvErrors(ajv)\n\nfunction getInstancePath(ajvError: ErrorObject): string {\n switch (ajvError.keyword) {\n case 'required': {\n // Required-errors are considered object errors by ajv, so they don't have instancePaths. We want to\n // show them under the relevant field\n return `${ajvError.instancePath}/${ajvError.params.missingProperty}`\n }\n case 'errorMessage': {\n // errorMessage structures (from ajv-errors) wrap the original error. Find instance path from original\n // to avoid issues like required-errors pointing at parent object.\n if (ajvError.params.errors[0]) {\n return getInstancePath(ajvError.params.errors[0])\n }\n }\n }\n return ajvError.instancePath\n}\n\nfunction getValidationRule(ajvError: ErrorObject): string {\n if (ajvError.keyword === 'errorMessage' && ajvError.params.errors[0]) {\n // errorMessage structures (from ajv-errors) wrap the original error. Find keyword from original\n // to avoid issues like required-errors pointing at parent object.\n return getValidationRule(ajvError.params.errors[0])\n }\n return ajvError.keyword\n}\n\nfunction getMessageValues(\n ajvError: ErrorObject\n): FormError['messageValues'] {\n const validationRule = getValidationRule(ajvError)\n\n switch (validationRule) {\n case 'minLength':\n case 'maxLength':\n case 'minimum':\n case 'maximum':\n case 'exclusiveMinimum':\n case 'exclusiveMaximum':\n return {\n [validationRule]: ajvError.params?.limit,\n }\n case 'multipleOf':\n return {\n [validationRule]: ajvError.params?.multipleOf,\n }\n case 'pattern':\n return {\n [validationRule]: ajvError.params?.pattern,\n }\n }\n}\n\nfunction ajvErrorToFormError(ajvError: ErrorObject): FormError {\n const error = new FormError(ajvError.message ?? 'Unknown error', {\n validationRule: getValidationRule(ajvError),\n // Keep the message values in the error object instead of injecting them into the message\n // at once, since an error might be validated one place, and then get a new message before it is displayed.\n messageValues: getMessageValues(ajvError),\n })\n return error\n}\n\n/**\n * Transform errors from ajv-validation into one error object (i.e for validating a flat value)\n */\nexport function ajvErrorsToOneFormError(\n errors?: ErrorObject[] | null\n): FormError | undefined {\n if (!errors || errors.length === 0) {\n return\n }\n if (errors.length === 1) {\n return ajvErrorToFormError(errors[0])\n }\n\n const errorMessages = errors?.map((error) => error.message)\n return new FormError(errorMessages.join(' | '), {\n validationRule: errors.map(getValidationRule),\n })\n}\n\n/**\n *\n * @param errors Transform errors from ajv-validation into a record of errors (path as key, error as value)\n * @returns\n */\nexport const ajvErrorsToFormErrors = (\n errors?: ErrorObject[] | null\n): Record<string, FormError> =>\n (errors ?? []).reduce((errors, ajvError) => {\n return {\n ...errors,\n [getInstancePath(ajvError)]: ajvErrorToFormError(ajvError),\n }\n }, {})\n\nexport default ajv\n"],"mappings":";;;AAAA,OAAOA,GAAG,MAAuB,KAAK;AACtC,OAAOC,SAAS,MAAM,YAAY;AAClC,SAASC,SAAS,QAAQ,UAAU;AAEpC,MAAMC,GAAG,GAAG,IAAIH,GAAG,CAAC;EAElBI,SAAS,EAAE;AACb,CAAC,CAAC;AAEFH,SAAS,CAACE,GAAG,CAAC;AAEd,SAASE,eAAeA,CAACC,QAAqB,EAAU;EACtD,QAAQA,QAAQ,CAACC,OAAO;IACtB,KAAK,UAAU;MAAE;QAGf,OAAQ,GAAED,QAAQ,CAACE,YAAa,IAAGF,QAAQ,CAACG,MAAM,CAACC,eAAgB,EAAC;MACtE;IACA,KAAK,cAAc;MAAE;QAGnB,IAAIJ,QAAQ,CAACG,MAAM,CAACE,MAAM,CAAC,CAAC,CAAC,EAAE;UAC7B,OAAON,eAAe,CAACC,QAAQ,CAACG,MAAM,CAACE,MAAM,CAAC,CAAC,CAAC,CAAC;QACnD;MACF;EACF;EACA,OAAOL,QAAQ,CAACE,YAAY;AAC9B;AAEA,SAASI,iBAAiBA,CAACN,QAAqB,EAAU;EACxD,IAAIA,QAAQ,CAACC,OAAO,KAAK,cAAc,IAAID,QAAQ,CAACG,MAAM,CAACE,MAAM,CAAC,CAAC,CAAC,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ACgB,MAAM,KAAK,CAAC,EAAE;IAClC;EACF;EACA,IAAIhB,MAAM,CAACgB,MAAM,KAAK,CAAC,EAAE;IACvB,OAAON,mBAAmB,CAACV,MAAM,CAAC,CAAC,CAAC,CAAC;EACvC;EAEA,MAAMiB,aAAa,GAAGjB,MAAM,aAANA,MAAM,uBAANA,MAAM,CAAEkB,GAAG,CAAEN,KAAK,IAAKA,KAAK,CAACC,OAAO,CAAC;EAC3D,OAAO,IAAItB,SAAS,CAAC0B,aAAa,CAACE,IAAI,CAAC,KAAK,CAAC,EAAE;IAC9Cb,cAAc,EAAEN,MAAM,CAACkB,GAAG,CAACjB,iBAAiB;EAC9C,CAAC,CAAC;AACJ;AAOA,OAAO,MAAMmB,qBAAqB,GAChCpB,MAA6B,IAE7B,CAACA,MAAM,aAANA,MAAM,cAANA,MAAM,GAAI,EAAE,EAAEqB,MAAM,CAAC,CAACrB,MAAM,EAAEL,QAAQ,KAAK;EAC1C,OAAA2B,aAAA,CAAAA,aAAA,KACKtB,MAAM;IACT,CAACN,eAAe,CAACC,QAAQ,CAAC,GAAGe,mBAAmB,CAACf,QAAQ;EAAC;AAE9D,CAAC,EAAE,CAAC,CAAC,CAAC;AAER,eAAeH,GAAG"}
@@ -0,0 +1,2 @@
1
+ import { FormError } from '../types';
2
+ export declare function errorChanged(error1?: FormError, error2?: FormError): boolean;
@@ -0,0 +1,10 @@
1
+ export function errorChanged(error1, error2) {
2
+ if (error1 === undefined && error2 instanceof Error || error1 instanceof Error && error2 === undefined) {
3
+ return true;
4
+ }
5
+ if (error1 && error2 && error1.message !== error2.message) {
6
+ return true;
7
+ }
8
+ return false;
9
+ }
10
+ //# sourceMappingURL=errors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.js","names":["errorChanged","error1","error2","undefined","Error","message"],"sources":["../../../../../src/extensions/forms/utils/errors.ts"],"sourcesContent":["import { FormError } from '../types'\n\nexport function errorChanged(\n error1?: FormError,\n error2?: FormError\n): boolean {\n if (\n (error1 === undefined && error2 instanceof Error) ||\n (error1 instanceof Error && error2 === undefined)\n ) {\n return true\n }\n if (error1 && error2 && error1.message !== error2.message) {\n return true\n }\n return false\n}\n"],"mappings":"AAEA,OAAO,SAASA,YAAYA,CAC1BC,MAAkB,EAClBC,MAAkB,EACT;EACT,IACGD,MAAM,KAAKE,SAAS,IAAID,MAAM,YAAYE,KAAK,IAC/CH,MAAM,YAAYG,KAAK,IAAIF,MAAM,KAAKC,SAAU,EACjD;IACA,OAAO,IAAI;EACb;EACA,IAAIF,MAAM,IAAIC,MAAM,IAAID,MAAM,CAACI,OAAO,KAAKH,MAAM,CAACG,OAAO,EAAE;IACzD,OAAO,IAAI;EACb;EACA,OAAO,KAAK;AACd"}
@@ -1,2 +1,3 @@
1
+ export * from './errors';
1
2
  export * from './numbers';
2
3
  export { default as TestElement } from './TestElement/TestElement';
@@ -1,3 +1,4 @@
1
+ export * from './errors';
1
2
  export * from './numbers';
2
3
  export { default as TestElement } from './TestElement/TestElement';
3
4
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["default","TestElement"],"sources":["../../../../../src/extensions/forms/utils/index.ts"],"sourcesContent":["export * from './numbers'\nexport { default as TestElement } from './TestElement/TestElement'\n"],"mappings":"AAAA,cAAc,WAAW;AACzB,SAASA,OAAO,IAAIC,WAAW,QAAQ,2BAA2B"}
1
+ {"version":3,"file":"index.js","names":["default","TestElement"],"sources":["../../../../../src/extensions/forms/utils/index.ts"],"sourcesContent":["export * from './errors'\nexport * from './numbers'\nexport { default as TestElement } from './TestElement/TestElement'\n"],"mappings":"AAAA,cAAc,UAAU;AACxB,cAAc,WAAW;AACzB,SAASA,OAAO,IAAIC,WAAW,QAAQ,2BAA2B"}
@@ -1,3 +1,5 @@
1
+ "use client";
2
+
1
3
  import _extends from "@babel/runtime/helpers/esm/extends";
2
4
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
3
5
  import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
@@ -1 +1 @@
1
- {"version":3,"file":"PaymentCard.js","names":["React","PropTypes","classnames","Context","Provider","isTrue","validateDOMAttributes","extendPropsWithContextInClassComponent","spacingPropTypes","createSpacingClasses","skeletonDOMAttributes","createSkeletonClass","P","ProductType","CardType","BankAxeptType","Designs","defaultDesign","cardProducts","ProductLogo","TypeLogo","BankLogo","StatusIcon","BankAxeptLogo","cardDataPropTypes","process","env","NODE_ENV","shape","productCode","string","isRequired","productName","displayName","cardDesign","object","cardType","productType","bankAxept","translationDefaultPropsProps","text_card_number","text_expired","text_blocked","text_not_active","text_order_in_process","text_renewed","text_replaced","PaymentCard","PureComponent","render","_this$context","props","defaultProps","locale","context","skeleton","product_code","card_number","card_status","variant","digits","id","raw_data","className","class","_className","children","attributes","_objectWithoutProperties","_excluded","cardData","getCardData","params","_objectSpread","createElement","Consumer","_ref","translation","translations","NormalCard","data","cardStatus","cardNumber","formatCardNumber","parseFloat","_defineProperty","propTypes","oneOf","oneOfType","number","bool","node","func","formatCardNumberRegex","arguments","length","undefined","slice","replace","trim","card","find","item","defaultCard","None","StatusOverlay","BlockingOverlay","_ref2","text","status","top","_ref3","CardText","_ref4","modifier","_ref5","_data$cardDesign","_extends","cardStyle","backgroundImage","style","logoType","bankLogo"],"sources":["../../../../src/extensions/payment-card/PaymentCard.js"],"sourcesContent":["/**\n * Web PaymentCard Component\n *\n */\nimport React from 'react'\nimport PropTypes from 'prop-types'\nimport classnames from 'classnames'\nimport Context from '../../shared/Context'\nimport Provider from '../../shared/Provider'\nimport {\n isTrue,\n validateDOMAttributes,\n extendPropsWithContextInClassComponent,\n} from '../../shared/component-helper'\nimport {\n spacingPropTypes,\n createSpacingClasses,\n} from '../../components/space/SpacingHelper'\nimport {\n skeletonDOMAttributes,\n createSkeletonClass,\n} from '../../components/skeleton/SkeletonHelper'\nimport P from '../../elements/P'\n\nimport { ProductType, CardType, BankAxeptType } from './utils/Types'\nimport Designs, { defaultDesign } from './utils/CardDesigns'\nimport cardProducts from './utils/cardProducts'\nimport {\n ProductLogo,\n TypeLogo,\n BankLogo,\n StatusIcon,\n BankAxeptLogo,\n} from './icons'\n\nexport { Designs, ProductType, CardType, BankAxeptType }\n\nconst cardDataPropTypes = PropTypes.shape({\n productCode: PropTypes.string.isRequired,\n productName: PropTypes.string.isRequired,\n displayName: PropTypes.string.isRequired,\n cardDesign: PropTypes.object.isRequired,\n cardType: PropTypes.object.isRequired,\n productType: PropTypes.object.isRequired,\n bankAxept: PropTypes.object.isRequired,\n})\n\nconst translationDefaultPropsProps = {\n text_card_number: null,\n text_expired: null,\n text_blocked: null,\n text_not_active: null,\n text_order_in_process: null,\n text_renewed: null,\n text_replaced: null,\n}\n\nexport default class PaymentCard extends React.PureComponent {\n static contextType = Context\n\n static propTypes = {\n product_code: PropTypes.string.isRequired,\n card_number: PropTypes.string.isRequired,\n card_status: PropTypes.oneOf([\n 'active',\n 'blocked',\n 'expired',\n 'not_active',\n 'order_in_process',\n 'renewed',\n 'replaced',\n ]),\n variant: PropTypes.oneOf(['normal', 'compact']),\n digits: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),\n raw_data: cardDataPropTypes,\n id: PropTypes.string,\n locale: PropTypes.string,\n\n skeleton: PropTypes.oneOfType([PropTypes.string, PropTypes.bool]),\n\n ...spacingPropTypes,\n\n class: PropTypes.string,\n className: PropTypes.string,\n children: PropTypes.oneOfType([\n PropTypes.string,\n PropTypes.node,\n PropTypes.func,\n ]),\n }\n\n static defaultProps = {\n digits: 8,\n locale: null,\n card_status: 'active',\n variant: 'normal',\n\n id: null,\n raw_data: null,\n\n skeleton: false,\n class: null,\n className: null,\n children: null,\n\n ...translationDefaultPropsProps,\n }\n\n render() {\n // use only the props from context, who are available here anyway\n const props = extendPropsWithContextInClassComponent(\n this.props,\n PaymentCard.defaultProps,\n { locale: this.context.locale },\n { skeleton: this.context?.skeleton }\n )\n\n const {\n product_code,\n card_number,\n card_status,\n variant,\n digits,\n id,\n raw_data,\n locale,\n skeleton,\n className,\n class: _className,\n children, //eslint-disable-line\n ...attributes\n } = props\n\n const cardData = raw_data || getCardData(product_code)\n\n const params = {\n className: classnames(\n 'dnb-payment-card',\n `dnb-payment-card--${variant}`,\n createSkeletonClass(null, skeleton, this.context),\n createSpacingClasses(props),\n className,\n _className\n ),\n ...attributes,\n }\n\n skeletonDOMAttributes(params, skeleton, this.context)\n\n // also used for code markup simulation\n validateDOMAttributes(this.props, params)\n\n return (\n <Provider locale={locale}>\n <Context.Consumer>\n {({ translation }) => {\n const translations = extendPropsWithContextInClassComponent(\n this.props,\n translationDefaultPropsProps,\n translation.PaymentCard\n )\n return (\n <figure {...params}>\n <figcaption className=\"dnb-sr-only dnb-payment-card__figcaption\">\n {cardData.productName}\n </figcaption>\n <NormalCard\n id={id}\n skeleton={isTrue(skeleton)}\n data={cardData}\n cardStatus={card_status}\n cardNumber={formatCardNumber(\n card_number,\n parseFloat(digits)\n )}\n translations={translations}\n />\n </figure>\n )\n }}\n </Context.Consumer>\n </Provider>\n )\n }\n}\n\nconst formatCardNumberRegex = /(?=(?:....)*$)/g\n\nexport const formatCardNumber = (cardNumber, digits = 8) => {\n if (!cardNumber) {\n return cardNumber\n }\n if (digits && digits <= cardNumber.length) {\n return cardNumber\n .slice(cardNumber.length - digits, cardNumber.length)\n .replace(formatCardNumberRegex, ' ')\n .trim()\n }\n return cardNumber.replace(formatCardNumberRegex, ' ').trim()\n}\n\nexport const getCardData = (productCode) => {\n const card = cardProducts.find(\n (item) => item.productCode === productCode\n )\n return card || defaultCard(productCode)\n}\n\nconst defaultCard = (productCode) => ({\n productCode,\n productName: '',\n displayName: '',\n cardDesign: defaultDesign,\n cardType: CardType.None,\n productType: ProductType.None,\n bankAxept: BankAxeptType.None,\n})\n\nStatusOverlay.propTypes = {\n cardStatus: PropTypes.string.isRequired,\n translations: PropTypes.object.isRequired,\n skeleton: PropTypes.bool,\n}\nStatusOverlay.defaultProps = {\n skeleton: false,\n}\n\nconst BlockingOverlay = ({ cardStatus, text }, skeleton) => {\n return (\n <div\n className={classnames(\n 'dnb-payment-card__blocking__overlay',\n createSkeletonClass('font', skeleton)\n )}\n >\n <div className=\"dnb-payment-card__blocking__center\">\n <StatusIcon status={cardStatus} />\n <P top=\"xx-small\">{text}</P>\n </div>\n </div>\n )\n}\n\nfunction StatusOverlay({ cardStatus, translations }) {\n switch (cardStatus) {\n case 'not_active':\n return (\n <BlockingOverlay\n cardStatus={cardStatus}\n text={translations.text_not_active}\n />\n )\n\n case 'order_in_process':\n return (\n <BlockingOverlay\n cardStatus={cardStatus}\n text={translations.text_order_in_process}\n />\n )\n\n case 'renewed':\n return (\n <BlockingOverlay\n cardStatus={cardStatus}\n text={translations.text_renewed}\n />\n )\n\n case 'replaced':\n return (\n <BlockingOverlay\n cardStatus={cardStatus}\n text={translations.text_replaced}\n />\n )\n\n case 'blocked':\n return (\n <BlockingOverlay\n cardStatus={cardStatus}\n text={translations.text_blocked}\n />\n )\n\n case 'expired':\n return (\n <BlockingOverlay\n cardStatus={cardStatus}\n text={translations.text_expired}\n />\n )\n\n case 'active':\n default:\n return null\n }\n}\n\nCardText.propTypes = {\n cardNumber: PropTypes.string.isRequired,\n translations: PropTypes.object.isRequired,\n skeleton: PropTypes.bool.isRequired,\n}\n\nfunction CardText({ cardNumber, translations, skeleton }) {\n return (\n <span\n className={classnames(\n 'dnb-payment-card__card__wrapper',\n createSkeletonClass('font', skeleton)\n )}\n >\n <P\n className=\"dnb-payment-card__card__holder\"\n modifier=\"x-small medium\"\n >\n {translations.text_card_number}\n </P>\n <P className=\"dnb-payment-card__card__numbers\">{cardNumber}</P>\n </span>\n )\n}\n\nNormalCard.propTypes = {\n id: PropTypes.string,\n skeleton: PropTypes.bool,\n data: cardDataPropTypes.isRequired,\n cardStatus: PropTypes.string.isRequired,\n cardNumber: PropTypes.string.isRequired,\n translations: PropTypes.object.isRequired,\n}\nNormalCard.defaultProps = {\n id: null,\n skeleton: null,\n}\n\nfunction NormalCard({\n data,\n cardStatus,\n cardNumber,\n id,\n skeleton,\n translations,\n}) {\n return (\n <div\n id={id}\n className={classnames(\n 'dnb-payment-card__card',\n `dnb-payment-card__${data.cardDesign.cardStyle}`\n )}\n {...(data.cardDesign?.backgroundImage\n ? {\n style: {\n backgroundImage: `url(${data.cardDesign.backgroundImage})`,\n },\n }\n : {})}\n >\n <div className=\"dnb-payment-card__card__content\">\n <div className=\"dnb-payment-card__card__top\">\n <BankLogo logoType={data.cardDesign.bankLogo} />\n <ProductLogo\n productType={data.productType}\n cardDesign={data.cardDesign}\n />\n <BankAxeptLogo\n bankAxept={data.bankAxept}\n cardDesign={data.cardDesign}\n />\n </div>\n <div className=\"dnb-payment-card__card__bottom\">\n <CardText\n cardNumber={cardNumber}\n displayName={data.displayName}\n translations={translations}\n skeleton={skeleton}\n />\n <TypeLogo\n cardType={data.cardType}\n cardDesign={data.cardDesign}\n />\n </div>\n </div>\n <StatusOverlay\n skeleton={skeleton}\n cardStatus={cardStatus}\n translations={translations}\n />\n </div>\n )\n}\n"],"mappings":";;;;;;AAIA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,SAAS,MAAM,YAAY;AAClC,OAAOC,UAAU,MAAM,YAAY;AACnC,OAAOC,OAAO,MAAM,sBAAsB;AAC1C,OAAOC,QAAQ,MAAM,uBAAuB;AAC5C,SACEC,MAAM,EACNC,qBAAqB,EACrBC,sCAAsC,QACjC,+BAA+B;AACtC,SACEC,gBAAgB,EAChBC,oBAAoB,QACf,sCAAsC;AAC7C,SACEC,qBAAqB,EACrBC,mBAAmB,QACd,0CAA0C;AACjD,OAAOC,CAAC,MAAM,kBAAkB;AAEhC,SAASC,WAAW,EAAEC,QAAQ,EAAEC,aAAa,QAAQ,eAAe;AACpE,OAAOC,OAAO,IAAIC,aAAa,QAAQ,qBAAqB;AAC5D,OAAOC,YAAY,MAAM,sBAAsB;AAC/C,SACEC,WAAW,EACXC,QAAQ,EACRC,QAAQ,EACRC,UAAU,EACVC,aAAa,QACR,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,eAAgB;IAC1D;EACF,CAAC,GACD,CAAC,CAAC,GAENvH,KAAA,CAAA0E,aAAA;IAAKX,SAAS,EAAC;EAAiC,GAC9C/D,KAAA,CAAA0E,aAAA;IAAKX,SAAS,EAAC;EAA6B,GAC1C/D,KAAA,CAAA0E,aAAA,CAACrD,QAAQ;IAACoG,QAAQ,EAAEzC,IAAI,CAAC9C,UAAU,CAACwF;EAAS,CAAE,CAAC,EAChD1H,KAAA,CAAA0E,aAAA,CAACvD,WAAW;IACVkB,WAAW,EAAE2C,IAAI,CAAC3C,WAAY;IAC9BH,UAAU,EAAE8C,IAAI,CAAC9C;EAAW,CAC7B,CAAC,EACFlC,KAAA,CAAA0E,aAAA,CAACnD,aAAa;IACZe,SAAS,EAAE0C,IAAI,CAAC1C,SAAU;IAC1BJ,UAAU,EAAE8C,IAAI,CAAC9C;EAAW,CAC7B,CACE,CAAC,EACNlC,KAAA,CAAA0E,aAAA;IAAKX,SAAS,EAAC;EAAgC,GAC7C/D,KAAA,CAAA0E,aAAA,CAACsC,QAAQ;IACP9B,UAAU,EAAEA,UAAW;IACvBjD,WAAW,EAAE+C,IAAI,CAAC/C,WAAY;IAC9B6C,YAAY,EAAEA,YAAa;IAC3BvB,QAAQ,EAAEA;EAAS,CACpB,CAAC,EACFvD,KAAA,CAAA0E,aAAA,CAACtD,QAAQ;IACPgB,QAAQ,EAAE4C,IAAI,CAAC5C,QAAS;IACxBF,UAAU,EAAE8C,IAAI,CAAC9C;EAAW,CAC7B,CACE,CACF,CAAC,EACNlC,KAAA,CAAA0E,aAAA,CAAC+B,aAAa;IACZlD,QAAQ,EAAEA,QAAS;IACnB0B,UAAU,EAAEA,UAAW;IACvBH,YAAY,EAAEA;EAAa,CAC5B,CACE,CAAC;AAEV"}
1
+ {"version":3,"file":"PaymentCard.js","names":["React","PropTypes","classnames","Context","Provider","isTrue","validateDOMAttributes","extendPropsWithContextInClassComponent","spacingPropTypes","createSpacingClasses","skeletonDOMAttributes","createSkeletonClass","P","ProductType","CardType","BankAxeptType","Designs","defaultDesign","cardProducts","ProductLogo","TypeLogo","BankLogo","StatusIcon","BankAxeptLogo","cardDataPropTypes","process","env","NODE_ENV","shape","productCode","string","isRequired","productName","displayName","cardDesign","object","cardType","productType","bankAxept","translationDefaultPropsProps","text_card_number","text_expired","text_blocked","text_not_active","text_order_in_process","text_renewed","text_replaced","PaymentCard","PureComponent","render","_this$context","props","defaultProps","locale","context","skeleton","product_code","card_number","card_status","variant","digits","id","raw_data","className","class","_className","children","attributes","_objectWithoutProperties","_excluded","cardData","getCardData","params","_objectSpread","createElement","Consumer","_ref","translation","translations","NormalCard","data","cardStatus","cardNumber","formatCardNumber","parseFloat","_defineProperty","propTypes","oneOf","oneOfType","number","bool","node","func","formatCardNumberRegex","arguments","length","undefined","slice","replace","trim","card","find","item","defaultCard","None","StatusOverlay","BlockingOverlay","_ref2","text","status","top","_ref3","CardText","_ref4","modifier","_ref5","_data$cardDesign","_extends","cardStyle","backgroundImage","style","logoType","bankLogo"],"sources":["../../../../src/extensions/payment-card/PaymentCard.js"],"sourcesContent":["/**\n * Web PaymentCard Component\n *\n */\nimport React from 'react'\nimport PropTypes from 'prop-types'\nimport classnames from 'classnames'\nimport Context from '../../shared/Context'\nimport Provider from '../../shared/Provider'\nimport {\n isTrue,\n validateDOMAttributes,\n extendPropsWithContextInClassComponent,\n} from '../../shared/component-helper'\nimport {\n spacingPropTypes,\n createSpacingClasses,\n} from '../../components/space/SpacingHelper'\nimport {\n skeletonDOMAttributes,\n createSkeletonClass,\n} from '../../components/skeleton/SkeletonHelper'\nimport P from '../../elements/P'\n\nimport { ProductType, CardType, BankAxeptType } from './utils/Types'\nimport Designs, { defaultDesign } from './utils/CardDesigns'\nimport cardProducts from './utils/cardProducts'\nimport {\n ProductLogo,\n TypeLogo,\n BankLogo,\n StatusIcon,\n BankAxeptLogo,\n} from './icons'\n\nexport { Designs, ProductType, CardType, BankAxeptType }\n\nconst cardDataPropTypes = PropTypes.shape({\n productCode: PropTypes.string.isRequired,\n productName: PropTypes.string.isRequired,\n displayName: PropTypes.string.isRequired,\n cardDesign: PropTypes.object.isRequired,\n cardType: PropTypes.object.isRequired,\n productType: PropTypes.object.isRequired,\n bankAxept: PropTypes.object.isRequired,\n})\n\nconst translationDefaultPropsProps = {\n text_card_number: null,\n text_expired: null,\n text_blocked: null,\n text_not_active: null,\n text_order_in_process: null,\n text_renewed: null,\n text_replaced: null,\n}\n\nexport default class PaymentCard extends React.PureComponent {\n static contextType = Context\n\n static propTypes = {\n product_code: PropTypes.string.isRequired,\n card_number: PropTypes.string.isRequired,\n card_status: PropTypes.oneOf([\n 'active',\n 'blocked',\n 'expired',\n 'not_active',\n 'order_in_process',\n 'renewed',\n 'replaced',\n ]),\n variant: PropTypes.oneOf(['normal', 'compact']),\n digits: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),\n raw_data: cardDataPropTypes,\n id: PropTypes.string,\n locale: PropTypes.string,\n\n skeleton: PropTypes.oneOfType([PropTypes.string, PropTypes.bool]),\n\n ...spacingPropTypes,\n\n class: PropTypes.string,\n className: PropTypes.string,\n children: PropTypes.oneOfType([\n PropTypes.string,\n PropTypes.node,\n PropTypes.func,\n ]),\n }\n\n static defaultProps = {\n digits: 8,\n locale: null,\n card_status: 'active',\n variant: 'normal',\n\n id: null,\n raw_data: null,\n\n skeleton: false,\n class: null,\n className: null,\n children: null,\n\n ...translationDefaultPropsProps,\n }\n\n render() {\n // use only the props from context, who are available here anyway\n const props = extendPropsWithContextInClassComponent(\n this.props,\n PaymentCard.defaultProps,\n { locale: this.context.locale },\n { skeleton: this.context?.skeleton }\n )\n\n const {\n product_code,\n card_number,\n card_status,\n variant,\n digits,\n id,\n raw_data,\n locale,\n skeleton,\n className,\n class: _className,\n children, //eslint-disable-line\n ...attributes\n } = props\n\n const cardData = raw_data || getCardData(product_code)\n\n const params = {\n className: classnames(\n 'dnb-payment-card',\n `dnb-payment-card--${variant}`,\n createSkeletonClass(null, skeleton, this.context),\n createSpacingClasses(props),\n className,\n _className\n ),\n ...attributes,\n }\n\n skeletonDOMAttributes(params, skeleton, this.context)\n\n // also used for code markup simulation\n validateDOMAttributes(this.props, params)\n\n return (\n <Provider locale={locale}>\n <Context.Consumer>\n {({ translation }) => {\n const translations = extendPropsWithContextInClassComponent(\n this.props,\n translationDefaultPropsProps,\n translation.PaymentCard\n )\n return (\n <figure {...params}>\n <figcaption className=\"dnb-sr-only dnb-payment-card__figcaption\">\n {cardData.productName}\n </figcaption>\n <NormalCard\n id={id}\n skeleton={isTrue(skeleton)}\n data={cardData}\n cardStatus={card_status}\n cardNumber={formatCardNumber(\n card_number,\n parseFloat(digits)\n )}\n translations={translations}\n />\n </figure>\n )\n }}\n </Context.Consumer>\n </Provider>\n )\n }\n}\n\nconst formatCardNumberRegex = /(?=(?:....)*$)/g\n\nexport const formatCardNumber = (cardNumber, digits = 8) => {\n if (!cardNumber) {\n return cardNumber\n }\n if (digits && digits <= cardNumber.length) {\n return cardNumber\n .slice(cardNumber.length - digits, cardNumber.length)\n .replace(formatCardNumberRegex, ' ')\n .trim()\n }\n return cardNumber.replace(formatCardNumberRegex, ' ').trim()\n}\n\nexport const getCardData = (productCode) => {\n const card = cardProducts.find(\n (item) => item.productCode === productCode\n )\n return card || defaultCard(productCode)\n}\n\nconst defaultCard = (productCode) => ({\n productCode,\n productName: '',\n displayName: '',\n cardDesign: defaultDesign,\n cardType: CardType.None,\n productType: ProductType.None,\n bankAxept: BankAxeptType.None,\n})\n\nStatusOverlay.propTypes = {\n cardStatus: PropTypes.string.isRequired,\n translations: PropTypes.object.isRequired,\n skeleton: PropTypes.bool,\n}\nStatusOverlay.defaultProps = {\n skeleton: false,\n}\n\nconst BlockingOverlay = ({ cardStatus, text }, skeleton) => {\n return (\n <div\n className={classnames(\n 'dnb-payment-card__blocking__overlay',\n createSkeletonClass('font', skeleton)\n )}\n >\n <div className=\"dnb-payment-card__blocking__center\">\n <StatusIcon status={cardStatus} />\n <P top=\"xx-small\">{text}</P>\n </div>\n </div>\n )\n}\n\nfunction StatusOverlay({ cardStatus, translations }) {\n switch (cardStatus) {\n case 'not_active':\n return (\n <BlockingOverlay\n cardStatus={cardStatus}\n text={translations.text_not_active}\n />\n )\n\n case 'order_in_process':\n return (\n <BlockingOverlay\n cardStatus={cardStatus}\n text={translations.text_order_in_process}\n />\n )\n\n case 'renewed':\n return (\n <BlockingOverlay\n cardStatus={cardStatus}\n text={translations.text_renewed}\n />\n )\n\n case 'replaced':\n return (\n <BlockingOverlay\n cardStatus={cardStatus}\n text={translations.text_replaced}\n />\n )\n\n case 'blocked':\n return (\n <BlockingOverlay\n cardStatus={cardStatus}\n text={translations.text_blocked}\n />\n )\n\n case 'expired':\n return (\n <BlockingOverlay\n cardStatus={cardStatus}\n text={translations.text_expired}\n />\n )\n\n case 'active':\n default:\n return null\n }\n}\n\nCardText.propTypes = {\n cardNumber: PropTypes.string.isRequired,\n translations: PropTypes.object.isRequired,\n skeleton: PropTypes.bool.isRequired,\n}\n\nfunction CardText({ cardNumber, translations, skeleton }) {\n return (\n <span\n className={classnames(\n 'dnb-payment-card__card__wrapper',\n createSkeletonClass('font', skeleton)\n )}\n >\n <P\n className=\"dnb-payment-card__card__holder\"\n modifier=\"x-small medium\"\n >\n {translations.text_card_number}\n </P>\n <P className=\"dnb-payment-card__card__numbers\">{cardNumber}</P>\n </span>\n )\n}\n\nNormalCard.propTypes = {\n id: PropTypes.string,\n skeleton: PropTypes.bool,\n data: cardDataPropTypes.isRequired,\n cardStatus: PropTypes.string.isRequired,\n cardNumber: PropTypes.string.isRequired,\n translations: PropTypes.object.isRequired,\n}\nNormalCard.defaultProps = {\n id: null,\n skeleton: null,\n}\n\nfunction NormalCard({\n data,\n cardStatus,\n cardNumber,\n id,\n skeleton,\n translations,\n}) {\n return (\n <div\n id={id}\n className={classnames(\n 'dnb-payment-card__card',\n `dnb-payment-card__${data.cardDesign.cardStyle}`\n )}\n {...(data.cardDesign?.backgroundImage\n ? {\n style: {\n backgroundImage: `url(${data.cardDesign.backgroundImage})`,\n },\n }\n : {})}\n >\n <div className=\"dnb-payment-card__card__content\">\n <div className=\"dnb-payment-card__card__top\">\n <BankLogo logoType={data.cardDesign.bankLogo} />\n <ProductLogo\n productType={data.productType}\n cardDesign={data.cardDesign}\n />\n <BankAxeptLogo\n bankAxept={data.bankAxept}\n cardDesign={data.cardDesign}\n />\n </div>\n <div className=\"dnb-payment-card__card__bottom\">\n <CardText\n cardNumber={cardNumber}\n displayName={data.displayName}\n translations={translations}\n skeleton={skeleton}\n />\n <TypeLogo\n cardType={data.cardType}\n cardDesign={data.cardDesign}\n />\n </div>\n </div>\n <StatusOverlay\n skeleton={skeleton}\n cardStatus={cardStatus}\n translations={translations}\n />\n </div>\n )\n}\n"],"mappings":";;;;;;;;AAIA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,SAAS,MAAM,YAAY;AAClC,OAAOC,UAAU,MAAM,YAAY;AACnC,OAAOC,OAAO,MAAM,sBAAsB;AAC1C,OAAOC,QAAQ,MAAM,uBAAuB;AAC5C,SACEC,MAAM,EACNC,qBAAqB,EACrBC,sCAAsC,QACjC,+BAA+B;AACtC,SACEC,gBAAgB,EAChBC,oBAAoB,QACf,sCAAsC;AAC7C,SACEC,qBAAqB,EACrBC,mBAAmB,QACd,0CAA0C;AACjD,OAAOC,CAAC,MAAM,kBAAkB;AAEhC,SAASC,WAAW,EAAEC,QAAQ,EAAEC,aAAa,QAAQ,eAAe;AACpE,OAAOC,OAAO,IAAIC,aAAa,QAAQ,qBAAqB;AAC5D,OAAOC,YAAY,MAAM,sBAAsB;AAC/C,SACEC,WAAW,EACXC,QAAQ,EACRC,QAAQ,EACRC,UAAU,EACVC,aAAa,QACR,SAAS;AAEhB,SAASP,OAAO,EAAEH,WAAW,EAAEC,QAAQ,EAAEC,aAAa;AAEtD,MAAMS,iBAAiB,GAAAC,OAAA,CAAAC,GAAA,CAAAC,QAAA,oBAAG1B,SAAS,CAAC2B,KAAK,CAAC;EACxC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CAAA0E,aAAA,CAACrD,QAAQ;IAACoG,QAAQ,EAAEzC,IAAI,CAAC9C,UAAU,CAACwF;EAAS,CAAE,CAAC,EAChD1H,KAAA,CAAA0E,aAAA,CAACvD,WAAW;IACVkB,WAAW,EAAE2C,IAAI,CAAC3C,WAAY;IAC9BH,UAAU,EAAE8C,IAAI,CAAC9C;EAAW,CAC7B,CAAC,EACFlC,KAAA,CAAA0E,aAAA,CAACnD,aAAa;IACZe,SAAS,EAAE0C,IAAI,CAAC1C,SAAU;IAC1BJ,UAAU,EAAE8C,IAAI,CAAC9C;EAAW,CAC7B,CACE,CAAC,EACNlC,KAAA,CAAA0E,aAAA;IAAKX,SAAS,EAAC;EAAgC,GAC7C/D,KAAA,CAAA0E,aAAA,CAACsC,QAAQ;IACP9B,UAAU,EAAEA,UAAW;IACvBjD,WAAW,EAAE+C,IAAI,CAAC/C,WAAY;IAC9B6C,YAAY,EAAEA,YAAa;IAC3BvB,QAAQ,EAAEA;EAAS,CACpB,CAAC,EACFvD,KAAA,CAAA0E,aAAA,CAACtD,QAAQ;IACPgB,QAAQ,EAAE4C,IAAI,CAAC5C,QAAS;IACxBF,UAAU,EAAE8C,IAAI,CAAC9C;EAAW,CAC7B,CACE,CACF,CAAC,EACNlC,KAAA,CAAA0E,aAAA,CAAC+B,aAAa;IACZlD,QAAQ,EAAEA,QAAS;IACnB0B,UAAU,EAAEA,UAAW;IACvBH,YAAY,EAAEA;EAAa,CAC5B,CACE,CAAC;AAEV"}
@@ -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; }