@k-int/stripes-kint-components 2.8.2 → 3.0.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 (328) hide show
  1. package/CHANGELOG.md +15 -3
  2. package/es/index.js +48 -12
  3. package/es/lib/ActionList/ActionList.js +11 -5
  4. package/es/lib/ActionList/ActionListFieldArray.js +147 -77
  5. package/es/lib/CustomProperties/Config/CustomPropertiesLookup.js +43 -31
  6. package/es/lib/CustomProperties/Config/CustomPropertiesLookup.test.js +17 -14
  7. package/es/lib/CustomProperties/Config/CustomPropertiesSettings.js +64 -46
  8. package/es/lib/CustomProperties/Config/CustomPropertiesSettings.test.js +17 -24
  9. package/es/lib/CustomProperties/Config/CustomPropertyForm.js +91 -70
  10. package/es/lib/CustomProperties/Config/CustomPropertyForm.test.js +53 -36
  11. package/es/lib/CustomProperties/Config/CustomPropertyView.js +50 -31
  12. package/es/lib/CustomProperties/Config/CustomPropertyView.test.js +13 -14
  13. package/es/lib/CustomProperties/Edit/CustomPropertiesEdit.js +6 -0
  14. package/es/lib/CustomProperties/Edit/CustomPropertiesEdit.test.js +8 -12
  15. package/es/lib/CustomProperties/Edit/CustomPropertiesEditCtx.js +22 -24
  16. package/es/lib/CustomProperties/Edit/CustomPropertiesEditCtx.test.js +9 -12
  17. package/es/lib/CustomProperties/Edit/CustomPropertiesListField.js +62 -13
  18. package/es/lib/CustomProperties/Edit/CustomPropertiesListField.test.js +12 -13
  19. package/es/lib/CustomProperties/Edit/CustomPropertyField.js +91 -44
  20. package/es/lib/CustomProperties/Edit/CustomPropertyField.test.js +80 -73
  21. package/es/lib/CustomProperties/Edit/CustomPropertyFormCard.js +31 -32
  22. package/es/lib/CustomProperties/Edit/CustomPropertyFormCard.test.js +26 -24
  23. package/es/lib/CustomProperties/Edit/testResources.js +73 -908
  24. package/es/lib/CustomProperties/Filter/CustomPropertiesFilter.js +21 -29
  25. package/es/lib/CustomProperties/Filter/CustomPropertiesFilter.test.js +12 -10
  26. package/es/lib/CustomProperties/Filter/CustomPropertiesFilterField.js +38 -39
  27. package/es/lib/CustomProperties/Filter/CustomPropertiesFilterField.test.js +28 -13
  28. package/es/lib/CustomProperties/Filter/CustomPropertiesFilterFieldArray.js +29 -44
  29. package/es/lib/CustomProperties/Filter/CustomPropertiesFilterFieldArray.test.js +6 -6
  30. package/es/lib/CustomProperties/Filter/CustomPropertiesFilterForm.js +16 -10
  31. package/es/lib/CustomProperties/Filter/CustomPropertiesFilterForm.test.js +12 -12
  32. package/es/lib/CustomProperties/Filter/CustomPropertiesRule.js +20 -11
  33. package/es/lib/CustomProperties/Filter/CustomPropertiesRule.test.js +4 -3
  34. package/es/lib/CustomProperties/Filter/testResources.js +37 -233
  35. package/es/lib/CustomProperties/Filter/useOperators.js +69 -27
  36. package/es/lib/CustomProperties/Filter/useParseActiveFilterStrings.js +3 -2
  37. package/es/lib/CustomProperties/Filter/useValueProps.js +7 -2
  38. package/es/lib/CustomProperties/View/CustomPropertiesView.js +6 -0
  39. package/es/lib/CustomProperties/View/CustomPropertiesView.test.js +4 -3
  40. package/es/lib/CustomProperties/View/CustomPropertiesViewCtx.js +13 -19
  41. package/es/lib/CustomProperties/View/CustomPropertiesViewCtx.test.js +4 -10
  42. package/es/lib/CustomProperties/View/CustomPropertyCard.js +34 -51
  43. package/es/lib/EditableRefdataCategoryList/EditableRefdataCategoryList.js +35 -27
  44. package/es/lib/EditableRefdataList/EditableRefdataList.js +41 -31
  45. package/es/lib/EditableSettingsList/EditableSettingsList.js +11 -1
  46. package/es/lib/EditableSettingsList/EditableSettingsListFieldArray.js +10 -0
  47. package/es/lib/EditableSettingsList/SettingField/EditSettingValue.js +19 -11
  48. package/es/lib/EditableSettingsList/SettingField/EditSettingValue.test.js +9 -8
  49. package/es/lib/EditableSettingsList/SettingField/RenderSettingValue.js +21 -9
  50. package/es/lib/EditableSettingsList/SettingField/RenderSettingValue.test.js +1 -0
  51. package/es/lib/EditableSettingsList/SettingField/SettingField.js +83 -16
  52. package/es/lib/EditableSettingsList/SettingField/SettingField.test.js +138 -65
  53. package/es/lib/FormModal/FormModal.js +14 -9
  54. package/es/lib/FormattedKintMessage/FormattedKintMessage.js +91 -0
  55. package/es/lib/FormattedKintMessage/index.js +15 -0
  56. package/es/lib/IconSelect/IconSelect.js +18 -12
  57. package/es/lib/NoResultsMessage/NoResultsMessage.js +13 -2
  58. package/es/lib/RichSelect/RichSelect.js +13 -34
  59. package/es/lib/SASQLookupComponent/SASQLookupComponent.js +16 -5
  60. package/es/lib/SASQLookupComponent/TableBody/TableBody.js +11 -1
  61. package/es/lib/SettingPage/SettingPage.js +12 -13
  62. package/es/lib/SettingPage/SettingPagePane.js +12 -20
  63. package/es/lib/hooks/__mocks__/index.js +46 -0
  64. package/es/lib/hooks/index.js +24 -8
  65. package/es/lib/hooks/settingsHooks/useSettings.js +22 -17
  66. package/es/lib/hooks/useIntlKey.js +34 -0
  67. package/es/lib/hooks/useIntlKeyStore.js +84 -0
  68. package/es/lib/hooks/useKintIntl.js +93 -0
  69. package/es/lib/utils/index.js +40 -4
  70. package/es/lib/utils/parseErrorResponse.js +1 -1
  71. package/es/lib/utils/validators.js +76 -59
  72. package/jest.config.js +4 -1
  73. package/junit.xml +157 -656
  74. package/package.json +54 -33
  75. package/src/artifacts/coverage-jest/lcov-report/ActionList/ActionList.js.html +56 -8
  76. package/src/artifacts/coverage-jest/lcov-report/ActionList/ActionListFieldArray.js.html +394 -64
  77. package/src/artifacts/coverage-jest/lcov-report/ActionList/index.html +10 -10
  78. package/src/artifacts/coverage-jest/lcov-report/ActionList/index.js.html +1 -1
  79. package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Config/CustomPropertiesLookup.js.html +187 -52
  80. package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Config/CustomPropertiesSettings.js.html +372 -87
  81. package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Config/CustomPropertyForm.js.html +293 -74
  82. package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Config/CustomPropertyView.js.html +126 -54
  83. package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Config/index.html +45 -60
  84. package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Config/index.js.html +1 -1
  85. package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Edit/CustomPropertiesEdit.js.html +23 -5
  86. package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Edit/CustomPropertiesEditCtx.js.html +59 -47
  87. package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Edit/CustomPropertiesListField.js.html +259 -97
  88. package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Edit/CustomPropertyField.js.html +399 -105
  89. package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Edit/CustomPropertyFormCard.js.html +41 -68
  90. package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Edit/index.html +57 -57
  91. package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Edit/index.js.html +1 -1
  92. package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Edit/testResources.js.html +67 -688
  93. package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Filter/CustomPropertiesFilter.js.html +92 -53
  94. package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Filter/CustomPropertiesFilterField.js.html +103 -64
  95. package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Filter/CustomPropertiesFilterFieldArray.js.html +54 -63
  96. package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Filter/CustomPropertiesFilterForm.js.html +49 -16
  97. package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Filter/CustomPropertiesRule.js.html +69 -18
  98. package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Filter/index.html +89 -89
  99. package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Filter/index.js.html +1 -1
  100. package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Filter/testResources.js.html +33 -786
  101. package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Filter/useOperators.js.html +46 -46
  102. package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Filter/useParseActiveFilterStrings.js.html +45 -36
  103. package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Filter/useValueProps.js.html +43 -28
  104. package/src/artifacts/coverage-jest/lcov-report/CustomProperties/View/CustomPropertiesView.js.html +20 -2
  105. package/src/artifacts/coverage-jest/lcov-report/CustomProperties/View/CustomPropertiesViewCtx.js.html +50 -41
  106. package/src/artifacts/coverage-jest/lcov-report/CustomProperties/View/CustomPropertyCard.js.html +54 -75
  107. package/src/artifacts/coverage-jest/lcov-report/CustomProperties/View/index.html +24 -24
  108. package/src/artifacts/coverage-jest/lcov-report/CustomProperties/View/index.js.html +1 -1
  109. package/src/artifacts/coverage-jest/lcov-report/CustomProperties/View/testResources.js.html +1 -1
  110. package/src/artifacts/coverage-jest/lcov-report/CustomProperties/index.html +1 -1
  111. package/src/artifacts/coverage-jest/lcov-report/CustomProperties/index.js.html +1 -1
  112. package/src/artifacts/coverage-jest/lcov-report/{hooks/useAvailableCustomProperties.js.html → CycleButton/CycleButton.js.html} +62 -50
  113. package/src/artifacts/coverage-jest/lcov-report/CycleButton/index.html +131 -0
  114. package/src/artifacts/coverage-jest/lcov-report/CycleButton/index.js.html +88 -0
  115. package/src/artifacts/coverage-jest/lcov-report/EditableRefdataCategoryList/EditableRefdataCategoryList.js.html +664 -0
  116. package/src/artifacts/coverage-jest/lcov-report/EditableRefdataCategoryList/index.html +131 -0
  117. package/src/artifacts/coverage-jest/lcov-report/EditableRefdataCategoryList/index.js.html +88 -0
  118. package/src/artifacts/coverage-jest/lcov-report/EditableRefdataList/EditableRefdataList.js.html +264 -39
  119. package/src/artifacts/coverage-jest/lcov-report/EditableRefdataList/index.html +9 -9
  120. package/src/artifacts/coverage-jest/lcov-report/EditableRefdataList/index.js.html +1 -1
  121. package/src/artifacts/coverage-jest/lcov-report/EditableSettingsList/EditableSettingsList.js.html +41 -14
  122. package/src/artifacts/coverage-jest/lcov-report/EditableSettingsList/EditableSettingsListFieldArray.js.html +45 -6
  123. package/src/artifacts/coverage-jest/lcov-report/EditableSettingsList/SettingField/EditSettingValue.js.html +47 -11
  124. package/src/artifacts/coverage-jest/lcov-report/EditableSettingsList/SettingField/RenderSettingValue.js.html +65 -14
  125. package/src/artifacts/coverage-jest/lcov-report/EditableSettingsList/SettingField/SettingField.js.html +154 -31
  126. package/src/artifacts/coverage-jest/lcov-report/EditableSettingsList/SettingField/index.html +26 -26
  127. package/src/artifacts/coverage-jest/lcov-report/EditableSettingsList/SettingField/index.js.html +1 -1
  128. package/src/artifacts/coverage-jest/lcov-report/EditableSettingsList/index.html +18 -18
  129. package/src/artifacts/coverage-jest/lcov-report/EditableSettingsList/index.js.html +1 -1
  130. package/src/artifacts/coverage-jest/lcov-report/FormModal/FormModal.js.html +35 -17
  131. package/src/artifacts/coverage-jest/lcov-report/FormModal/index.html +15 -15
  132. package/src/artifacts/coverage-jest/lcov-report/FormModal/index.js.html +1 -1
  133. package/src/artifacts/coverage-jest/lcov-report/FormattedKintMessage/FormattedKintMessage.js.html +247 -0
  134. package/src/artifacts/coverage-jest/lcov-report/FormattedKintMessage/index.html +131 -0
  135. package/src/artifacts/coverage-jest/lcov-report/FormattedKintMessage/index.js.html +88 -0
  136. package/src/artifacts/coverage-jest/lcov-report/{CustomProperties/Config/CustomPropertiesView.js.html → IconSelect/IconSelect.js.html} +158 -257
  137. package/src/artifacts/coverage-jest/lcov-report/IconSelect/index.html +131 -0
  138. package/src/artifacts/coverage-jest/lcov-report/IconSelect/index.js.html +88 -0
  139. package/src/artifacts/coverage-jest/lcov-report/NoResultsMessage/NoResultsMessage.js.html +48 -6
  140. package/src/artifacts/coverage-jest/lcov-report/NoResultsMessage/index.html +7 -7
  141. package/src/artifacts/coverage-jest/lcov-report/NoResultsMessage/index.js.html +1 -1
  142. package/src/artifacts/coverage-jest/lcov-report/QueryTypedown/QueryTypedown.js.html +1 -1
  143. package/src/artifacts/coverage-jest/lcov-report/QueryTypedown/index.html +1 -1
  144. package/src/artifacts/coverage-jest/lcov-report/QueryTypedown/index.js.html +1 -1
  145. package/src/artifacts/coverage-jest/lcov-report/RefdataButtons/RefdataButtons.js.html +3 -3
  146. package/src/artifacts/coverage-jest/lcov-report/RefdataButtons/index.html +1 -1
  147. package/src/artifacts/coverage-jest/lcov-report/RefdataButtons/index.js.html +1 -1
  148. package/src/artifacts/coverage-jest/lcov-report/{CustomProperties/Config/testResources.js.html → RichSelect/RichSelect.js.html} +256 -334
  149. package/src/artifacts/coverage-jest/lcov-report/RichSelect/index.html +146 -0
  150. package/src/artifacts/coverage-jest/lcov-report/RichSelect/index.js.html +91 -0
  151. package/src/artifacts/coverage-jest/lcov-report/RichSelect/useSelectedOption.js.html +127 -0
  152. package/src/artifacts/coverage-jest/lcov-report/SASQLookupComponent/SASQLookupComponent.js.html +52 -7
  153. package/src/artifacts/coverage-jest/lcov-report/SASQLookupComponent/TableBody/TableBody.js.html +31 -4
  154. package/src/artifacts/coverage-jest/lcov-report/SASQLookupComponent/TableBody/index.html +3 -3
  155. package/src/artifacts/coverage-jest/lcov-report/SASQLookupComponent/TableBody/index.js.html +1 -1
  156. package/src/artifacts/coverage-jest/lcov-report/SASQLookupComponent/index.html +7 -7
  157. package/src/artifacts/coverage-jest/lcov-report/SASQLookupComponent/index.js.html +1 -1
  158. package/src/artifacts/coverage-jest/lcov-report/SASQRoute/SASQRoute.js.html +1 -1
  159. package/src/artifacts/coverage-jest/lcov-report/SASQRoute/index.html +1 -1
  160. package/src/artifacts/coverage-jest/lcov-report/SASQRoute/index.js.html +1 -1
  161. package/src/artifacts/coverage-jest/lcov-report/SASQViewComponent/SASQViewComponent.js.html +1 -1
  162. package/src/artifacts/coverage-jest/lcov-report/SASQViewComponent/index.html +1 -1
  163. package/src/artifacts/coverage-jest/lcov-report/SASQViewComponent/index.js.html +1 -1
  164. package/src/artifacts/coverage-jest/lcov-report/SearchField/SearchField.js.html +1 -1
  165. package/src/artifacts/coverage-jest/lcov-report/SearchField/index.html +1 -1
  166. package/src/artifacts/coverage-jest/lcov-report/SearchField/index.js.html +1 -1
  167. package/src/artifacts/coverage-jest/lcov-report/SettingPage/SettingPage.js.html +24 -27
  168. package/src/artifacts/coverage-jest/lcov-report/SettingPage/SettingPagePane.js.html +47 -17
  169. package/src/artifacts/coverage-jest/lcov-report/SettingPage/index.html +22 -22
  170. package/src/artifacts/coverage-jest/lcov-report/SettingPage/index.js.html +1 -1
  171. package/src/artifacts/coverage-jest/lcov-report/Typedown/Typedown.js.html +1 -1
  172. package/src/artifacts/coverage-jest/lcov-report/Typedown/index.html +1 -1
  173. package/src/artifacts/coverage-jest/lcov-report/Typedown/index.js.html +1 -1
  174. package/src/artifacts/coverage-jest/lcov-report/constants/customProperties.js.html +1 -1
  175. package/src/artifacts/coverage-jest/lcov-report/constants/eventCodes.js.html +1 -1
  176. package/src/artifacts/coverage-jest/lcov-report/constants/index.html +1 -1
  177. package/src/artifacts/coverage-jest/lcov-report/contexts/SettingsContext.js.html +2 -2
  178. package/src/artifacts/coverage-jest/lcov-report/contexts/index.html +1 -1
  179. package/src/artifacts/coverage-jest/lcov-report/contexts/index.js.html +1 -1
  180. package/src/artifacts/coverage-jest/lcov-report/favicon.png +0 -0
  181. package/src/artifacts/coverage-jest/lcov-report/hooks/index.html +142 -97
  182. package/src/artifacts/coverage-jest/lcov-report/hooks/index.js.html +13 -4
  183. package/src/artifacts/coverage-jest/lcov-report/hooks/settingsHooks/index.html +35 -20
  184. package/src/artifacts/coverage-jest/lcov-report/hooks/settingsHooks/index.js.html +5 -2
  185. package/src/artifacts/coverage-jest/lcov-report/hooks/settingsHooks/useAppSettings.js.html +7 -7
  186. package/src/artifacts/coverage-jest/lcov-report/hooks/settingsHooks/useSettingSection.js.html +7 -7
  187. package/src/artifacts/coverage-jest/lcov-report/hooks/settingsHooks/useSettings.js.html +61 -22
  188. package/src/artifacts/coverage-jest/lcov-report/hooks/typedownHooks/index.html +1 -1
  189. package/src/artifacts/coverage-jest/lcov-report/hooks/typedownHooks/index.js.html +1 -1
  190. package/src/artifacts/coverage-jest/lcov-report/hooks/typedownHooks/useTypedown.js.html +1 -1
  191. package/src/artifacts/coverage-jest/lcov-report/hooks/typedownHooks/useTypedownData.js.html +1 -1
  192. package/src/artifacts/coverage-jest/lcov-report/hooks/typedownHooks/useTypedownToggle.js.html +1 -1
  193. package/src/artifacts/coverage-jest/lcov-report/hooks/useActiveElement.js.html +7 -7
  194. package/src/artifacts/coverage-jest/lcov-report/hooks/useCustomProperties.js.html +19 -22
  195. package/src/artifacts/coverage-jest/lcov-report/hooks/useHelperApp.js.html +7 -7
  196. package/src/artifacts/coverage-jest/lcov-report/hooks/useIntlKey.js.html +151 -0
  197. package/src/artifacts/coverage-jest/lcov-report/{utils/renderHelpText.js.html → hooks/useIntlKeyStore.js.html} +71 -38
  198. package/src/artifacts/coverage-jest/lcov-report/hooks/useInvalidateRefdata.js.html +7 -7
  199. package/src/artifacts/coverage-jest/lcov-report/hooks/useKintIntl.js.html +238 -0
  200. package/src/artifacts/coverage-jest/lcov-report/hooks/useKiwtFieldArray.js.html +7 -7
  201. package/src/artifacts/coverage-jest/lcov-report/hooks/useKiwtSASQuery.js.html +9 -9
  202. package/src/artifacts/coverage-jest/lcov-report/hooks/useLocalStorageState.js.html +7 -7
  203. package/src/artifacts/coverage-jest/lcov-report/hooks/useMutateCustomProperties.js.html +23 -11
  204. package/src/artifacts/coverage-jest/lcov-report/hooks/useMutateRefdataCategory.js.html +274 -0
  205. package/src/artifacts/coverage-jest/lcov-report/hooks/useMutateRefdataValue.js.html +19 -10
  206. package/src/artifacts/coverage-jest/lcov-report/hooks/useQIndex.js.html +7 -7
  207. package/src/artifacts/coverage-jest/lcov-report/hooks/useRefdata.js.html +9 -9
  208. package/src/artifacts/coverage-jest/lcov-report/hooks/useTemplates.js.html +7 -7
  209. package/src/artifacts/coverage-jest/lcov-report/index.html +205 -130
  210. package/src/artifacts/coverage-jest/lcov-report/sort-arrow-sprite.png +0 -0
  211. package/src/artifacts/coverage-jest/lcov-report/utils/buildUrl.js.html +1 -1
  212. package/src/artifacts/coverage-jest/lcov-report/utils/generateKiwtQuery.js.html +2 -2
  213. package/src/artifacts/coverage-jest/lcov-report/utils/generateKiwtQueryParams.js.html +2 -2
  214. package/src/artifacts/coverage-jest/lcov-report/utils/groupCustomPropertiesByCtx.js.html +7 -7
  215. package/src/artifacts/coverage-jest/lcov-report/utils/highlightString.js.html +3 -3
  216. package/src/artifacts/coverage-jest/lcov-report/utils/index.html +34 -34
  217. package/src/artifacts/coverage-jest/lcov-report/utils/index.js.html +42 -3
  218. package/src/artifacts/coverage-jest/lcov-report/utils/matchString.js.html +2 -2
  219. package/src/artifacts/coverage-jest/lcov-report/utils/parseErrorResponse.js.html +139 -0
  220. package/src/artifacts/coverage-jest/lcov-report/utils/refdataOptions.js.html +5 -2
  221. package/src/artifacts/coverage-jest/lcov-report/utils/refdataQueryKey.js.html +2 -2
  222. package/src/artifacts/coverage-jest/lcov-report/utils/selectorSafe.js.html +2 -2
  223. package/src/artifacts/coverage-jest/lcov-report/utils/sortByLabel.js.html +2 -2
  224. package/src/artifacts/coverage-jest/lcov-report/utils/toCamelCase.js.html +2 -2
  225. package/src/artifacts/coverage-jest/lcov-report/utils/typedownQueryKey.js.html +2 -2
  226. package/src/artifacts/coverage-jest/lcov-report/utils/validators.js.html +128 -80
  227. package/src/artifacts/coverage-jest/lcov.info +2603 -2086
  228. package/src/index.js +11 -4
  229. package/src/lib/ActionList/ActionList.js +9 -3
  230. package/src/lib/ActionList/ActionListFieldArray.js +115 -37
  231. package/src/lib/ActionList/README.md +2 -1
  232. package/src/lib/CustomProperties/Config/CustomPropertiesLookup.js +60 -16
  233. package/src/lib/CustomProperties/Config/CustomPropertiesLookup.test.js +14 -4
  234. package/src/lib/CustomProperties/Config/CustomPropertiesSettings.js +106 -33
  235. package/src/lib/CustomProperties/Config/CustomPropertiesSettings.test.js +16 -9
  236. package/src/lib/CustomProperties/Config/CustomPropertyForm.js +131 -58
  237. package/src/lib/CustomProperties/Config/CustomPropertyForm.test.js +52 -33
  238. package/src/lib/CustomProperties/Config/CustomPropertyView.js +71 -47
  239. package/src/lib/CustomProperties/Config/CustomPropertyView.test.js +8 -6
  240. package/src/lib/CustomProperties/Config/README.md +33 -28
  241. package/src/lib/CustomProperties/Edit/CustomPropertiesEdit.js +6 -0
  242. package/src/lib/CustomProperties/Edit/CustomPropertiesEdit.test.js +7 -3
  243. package/src/lib/CustomProperties/Edit/CustomPropertiesEditCtx.js +23 -19
  244. package/src/lib/CustomProperties/Edit/CustomPropertiesEditCtx.test.js +5 -3
  245. package/src/lib/CustomProperties/Edit/CustomPropertiesListField.js +65 -11
  246. package/src/lib/CustomProperties/Edit/CustomPropertiesListField.test.js +10 -8
  247. package/src/lib/CustomProperties/Edit/CustomPropertyField.js +115 -21
  248. package/src/lib/CustomProperties/Edit/CustomPropertyField.test.js +59 -60
  249. package/src/lib/CustomProperties/Edit/CustomPropertyFormCard.js +24 -33
  250. package/src/lib/CustomProperties/Edit/CustomPropertyFormCard.test.js +20 -27
  251. package/src/lib/CustomProperties/Edit/testResources.js +46 -1047
  252. package/src/lib/CustomProperties/Filter/CustomPropertiesFilter.js +22 -22
  253. package/src/lib/CustomProperties/Filter/CustomPropertiesFilter.test.js +12 -8
  254. package/src/lib/CustomProperties/Filter/CustomPropertiesFilterField.js +44 -31
  255. package/src/lib/CustomProperties/Filter/CustomPropertiesFilterField.test.js +26 -13
  256. package/src/lib/CustomProperties/Filter/CustomPropertiesFilterFieldArray.js +33 -36
  257. package/src/lib/CustomProperties/Filter/CustomPropertiesFilterFieldArray.test.js +3 -3
  258. package/src/lib/CustomProperties/Filter/CustomPropertiesFilterForm.js +19 -8
  259. package/src/lib/CustomProperties/Filter/CustomPropertiesFilterForm.test.js +9 -12
  260. package/src/lib/CustomProperties/Filter/CustomPropertiesRule.js +22 -5
  261. package/src/lib/CustomProperties/Filter/CustomPropertiesRule.test.js +3 -1
  262. package/src/lib/CustomProperties/Filter/testResources.js +14 -265
  263. package/src/lib/CustomProperties/Filter/useOperators.js +20 -20
  264. package/src/lib/CustomProperties/Filter/useParseActiveFilterStrings.js +2 -2
  265. package/src/lib/CustomProperties/Filter/useValueProps.js +8 -3
  266. package/src/lib/CustomProperties/View/CustomPropertiesView.js +6 -0
  267. package/src/lib/CustomProperties/View/CustomPropertiesView.test.js +2 -1
  268. package/src/lib/CustomProperties/View/CustomPropertiesViewCtx.js +15 -13
  269. package/src/lib/CustomProperties/View/CustomPropertiesViewCtx.test.js +2 -5
  270. package/src/lib/CustomProperties/View/CustomPropertyCard.js +36 -43
  271. package/src/lib/EditableRefdataCategoryList/EditableRefdataCategoryList.js +45 -27
  272. package/src/lib/EditableRefdataList/EditableRefdataList.js +56 -32
  273. package/src/lib/EditableSettingsList/EditableSettingsList.js +10 -1
  274. package/src/lib/EditableSettingsList/EditableSettingsListFieldArray.js +14 -1
  275. package/src/lib/EditableSettingsList/SettingField/EditSettingValue.js +17 -5
  276. package/src/lib/EditableSettingsList/SettingField/EditSettingValue.test.js +9 -8
  277. package/src/lib/EditableSettingsList/SettingField/RenderSettingValue.js +24 -7
  278. package/src/lib/EditableSettingsList/SettingField/RenderSettingValue.test.js +1 -0
  279. package/src/lib/EditableSettingsList/SettingField/SettingField.js +57 -16
  280. package/src/lib/EditableSettingsList/SettingField/SettingField.test.js +14 -19
  281. package/src/lib/FormModal/FormModal.js +15 -9
  282. package/src/lib/FormattedKintMessage/FormattedKintMessage.js +54 -0
  283. package/src/lib/FormattedKintMessage/index.js +1 -0
  284. package/src/lib/IconSelect/IconSelect.js +17 -8
  285. package/src/lib/NoResultsMessage/NoResultsMessage.js +15 -1
  286. package/src/lib/RichSelect/RichSelect.js +16 -36
  287. package/src/lib/SASQLookupComponent/SASQLookupComponent.js +17 -2
  288. package/src/lib/SASQLookupComponent/TableBody/TableBody.js +10 -1
  289. package/src/lib/SettingPage/SettingPage.js +12 -13
  290. package/src/lib/SettingPage/SettingPagePane.js +16 -6
  291. package/src/lib/hooks/__mocks__/index.js +17 -0
  292. package/src/lib/hooks/index.js +3 -1
  293. package/src/lib/hooks/settingsHooks/useSettings.js +25 -12
  294. package/src/lib/hooks/useIntlKey.js +22 -0
  295. package/src/lib/hooks/useIntlKeyStore.js +38 -0
  296. package/src/lib/hooks/useKintIntl.js +51 -0
  297. package/src/lib/utils/index.js +11 -1
  298. package/src/lib/utils/parseErrorResponse.js +1 -1
  299. package/src/lib/utils/validators.js +57 -41
  300. package/styles/RichSelect.css +7 -4
  301. package/test/helpers/test-implementor-translations.json +80 -0
  302. package/test/helpers/translationsProperties.js +6 -1
  303. package/test/jest/customProperties.js +166 -0
  304. package/test/jest/helpers/KintHarness.js +1 -1
  305. package/test/jest/helpers/renderWithKintHarness.js +2 -1
  306. package/test/jest/index.js +8 -0
  307. package/test/jest/refdata.js +471 -0
  308. package/test/jest/resolver.js +29 -0
  309. package/translations/stripes-kint-components/ar.json +1 -122
  310. package/translations/stripes-kint-components/cs_CZ.json +1 -122
  311. package/translations/stripes-kint-components/de.json +1 -122
  312. package/translations/stripes-kint-components/en.json +1 -148
  313. package/translations/stripes-kint-components/es.json +1 -122
  314. package/translations/stripes-kint-components/hi_IN.json +1 -122
  315. package/translations/stripes-kint-components/hu.json +1 -122
  316. package/translations/stripes-kint-components/it_IT.json +1 -122
  317. package/translations/stripes-kint-components/ja.json +1 -122
  318. package/translations/stripes-kint-components/ko.json +1 -122
  319. package/translations/stripes-kint-components/pt_PT.json +1 -122
  320. package/translations/stripes-kint-components/ru.json +1 -122
  321. package/translations/stripes-kint-components/sv.json +1 -122
  322. package/translations/stripes-kint-components/zh_CN.json +1 -122
  323. package/es/lib/CustomProperties/Config/testResources.js +0 -198
  324. package/es/lib/hooks/useAvailableCustomProperties.js +0 -73
  325. package/es/lib/utils/renderHelpText.js +0 -80
  326. package/src/lib/CustomProperties/Config/testResources.js +0 -236
  327. package/src/lib/hooks/useAvailableCustomProperties.js +0 -40
  328. package/src/lib/utils/renderHelpText.js +0 -27
@@ -7,10 +7,10 @@ Object.defineProperty(exports, "__esModule", {
7
7
  });
8
8
  exports.default = void 0;
9
9
 
10
- var _reactIntl = require("react-intl");
11
-
12
10
  var CUSTPROP_TYPES = _interopRequireWildcard(require("../../constants/customProperties"));
13
11
 
12
+ var _hooks = require("../../hooks");
13
+
14
14
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
15
15
 
16
16
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
@@ -22,38 +22,53 @@ var REFDATA = CUSTPROP_TYPES.REFDATA_CLASS_NAME,
22
22
  DATE = CUSTPROP_TYPES.DATE_CLASS_NAME,
23
23
  TEXT = CUSTPROP_TYPES.TEXT_CLASS_NAME;
24
24
 
25
- var useOperators = function useOperators(type) {
26
- var intl = (0, _reactIntl.useIntl)();
27
-
28
- var getLabel = function getLabel(id) {
29
- return intl.formatMessage({
30
- id: id
31
- });
32
- };
33
-
25
+ var useOperators = function useOperators() {
26
+ var type = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
27
+ var passedIntlKey = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
28
+ var passedIntlNS = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
29
+ var labelOverrides = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
30
+ var kintIntl = (0, _hooks.useKintIntl)(passedIntlKey, passedIntlNS);
34
31
  var operators = [{
35
32
  value: ' isSet',
36
- label: getLabel('stripes-kint-components.operator.isSet'),
33
+ label: kintIntl.formatKintMessage({
34
+ id: 'operator.isSet',
35
+ overrideValue: labelOverrides.operatorIsSet
36
+ }),
37
37
  noValueAllowed: true
38
38
  }, {
39
39
  value: ' isNotSet',
40
- label: getLabel('stripes-kint-components.operator.isNotSet'),
40
+ label: kintIntl.formatKintMessage({
41
+ id: 'operator.isNotSet',
42
+ overrideValue: labelOverrides.operatorIsNotSet
43
+ }),
41
44
  noValueAllowed: true
42
45
  }];
43
46
 
44
47
  if (!type || type === INTEGER || type === DECIMAL) {
45
48
  operators.push({
46
49
  value: '==',
47
- label: getLabel('stripes-kint-components.operator.equals')
50
+ label: kintIntl.formatKintMessage({
51
+ id: 'operator.equals',
52
+ overrideValue: labelOverrides.operatorEquals
53
+ })
48
54
  }, {
49
55
  value: '!=',
50
- label: getLabel('stripes-kint-components.operator.doesNotEqual')
56
+ label: kintIntl.formatKintMessage({
57
+ id: 'operator.doesNotEqual',
58
+ overrideValue: labelOverrides.operatorDoesNotEqual
59
+ })
51
60
  }, {
52
61
  value: '>=',
53
- label: getLabel('stripes-kint-components.operator.isGreaterThanOrEqual')
62
+ label: kintIntl.formatKintMessage({
63
+ id: 'operator.isGreaterThanOrEqual',
64
+ overrideValue: labelOverrides.operatorIsGreaterThanOrEqual
65
+ })
54
66
  }, {
55
67
  value: '<=',
56
- label: getLabel('stripes-kint-components.operator.isLessThanOrEqual')
68
+ label: kintIntl.formatKintMessage({
69
+ id: 'operator.isLessThanOrEqual',
70
+ overrideValue: labelOverrides.operatorIsLessThanOrEqual
71
+ })
57
72
  });
58
73
  }
59
74
 
@@ -61,43 +76,70 @@ var useOperators = function useOperators(type) {
61
76
  // Basically the same as the "number" types above, so no need to reassign if there is no type
62
77
  operators.push({
63
78
  value: '==',
64
- label: getLabel('stripes-kint-components.operator.equals')
79
+ label: kintIntl.formatKintMessage({
80
+ id: 'operator.equals',
81
+ overrideValue: labelOverrides.operatorEquals
82
+ })
65
83
  }, {
66
84
  value: '!=',
67
- label: getLabel('stripes-kint-components.operator.doesNotEqual')
85
+ label: kintIntl.formatKintMessage({
86
+ id: 'operator.doesNotEqual',
87
+ overrideValue: labelOverrides.operatorDoesNotEqual
88
+ })
68
89
  }, {
69
90
  value: '>=',
70
- label: getLabel('stripes-kint-components.operator.isOnOrAfter')
91
+ label: kintIntl.formatKintMessage({
92
+ id: 'operator.isOnOrAfter',
93
+ overrideValue: labelOverrides.operatorIsOnOrAfter
94
+ })
71
95
  }, {
72
96
  value: '<=',
73
- label: getLabel('stripes-kint-components.operator.isOnOrBefore')
97
+ label: kintIntl.formatKintMessage({
98
+ id: 'operator.isOnOrBefore',
99
+ overrideValue: labelOverrides.operatorIsOnOrBefore
100
+ })
74
101
  });
75
102
  }
76
103
 
77
104
  if (!type || type === REFDATA) {
78
105
  operators.push({
79
106
  value: '==',
80
- label: getLabel('stripes-kint-components.operator.is')
107
+ label: kintIntl.formatKintMessage({
108
+ id: 'operator.is',
109
+ overrideValue: labelOverrides.operatorIs
110
+ })
81
111
  }, {
82
112
  value: '!=',
83
- label: getLabel('stripes-kint-components.operator.isNot')
113
+ label: kintIntl.formatKintMessage({
114
+ id: 'operator.isNot',
115
+ overrideValue: labelOverrides.operatorIsNot
116
+ })
84
117
  });
85
118
  }
86
119
 
87
- if (!type || type === MULTIREFDATA) {
120
+ if (type === MULTIREFDATA) {
88
121
  operators.push({
89
122
  value: '==',
90
- label: getLabel('stripes-kint-components.operator.contains')
123
+ label: kintIntl.formatKintMessage({
124
+ id: 'operator.contains',
125
+ overrideValue: labelOverrides.operatorContains
126
+ })
91
127
  });
92
128
  }
93
129
 
94
130
  if (!type || type === TEXT) {
95
131
  operators.push({
96
132
  value: '=~',
97
- label: getLabel('stripes-kint-components.operator.contains')
133
+ label: kintIntl.formatKintMessage({
134
+ id: 'operator.contains',
135
+ overrideValue: labelOverrides.operatorContains
136
+ })
98
137
  }, {
99
138
  value: '!~',
100
- label: getLabel('stripes-kint-components.operator.doesNotContain')
139
+ label: kintIntl.formatKintMessage({
140
+ id: 'operator.doesNotContain',
141
+ overrideValue: labelOverrides.operatorDoesNotContain
142
+ })
101
143
  });
102
144
  }
103
145
 
@@ -21,8 +21,9 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
21
21
 
22
22
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
23
23
 
24
- var useParseActiveFilterStrings = function useParseActiveFilterStrings(filterStrings) {
25
- var operators = (0, _useOperators.default)().map(function (o) {
24
+ var useParseActiveFilterStrings = function useParseActiveFilterStrings(filterStrings, passedIntlKey, passedIntlNS) {
25
+ var labelOverrides = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
26
+ var operators = (0, _useOperators.default)(null, passedIntlKey, passedIntlNS, labelOverrides).map(function (o) {
26
27
  return o.value;
27
28
  });
28
29
  var numberOfFilters = 0;
@@ -24,7 +24,8 @@ var REFDATA = CUSTPROP_TYPES.REFDATA_CLASS_NAME,
24
24
  DATE = CUSTPROP_TYPES.DATE_CLASS_NAME,
25
25
  TEXT = CUSTPROP_TYPES.TEXT_CLASS_NAME;
26
26
 
27
- var useValueProps = function useValueProps(custPropDefinition) {
27
+ var useValueProps = function useValueProps(custPropDefinition, intlKey, intlNS) {
28
+ var labelOverrides = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
28
29
  var props = {
29
30
  validate: _validators.required
30
31
  };
@@ -34,7 +35,11 @@ var useValueProps = function useValueProps(custPropDefinition) {
34
35
  case DECIMAL:
35
36
  props.component = _components.TextField;
36
37
  props.type = 'number';
37
- props.validate = _validators.invalidNumber;
38
+
39
+ props.validate = function (value) {
40
+ return (0, _validators.invalidNumber)(value, intlKey, intlNS, labelOverrides);
41
+ };
42
+
38
43
  break;
39
44
 
40
45
  case REFDATA:
@@ -19,6 +19,8 @@ var CustomPropertiesView = function CustomPropertiesView(_ref) {
19
19
  customProperties = _ref.customProperties,
20
20
  customPropertiesEndpoint = _ref.customPropertiesEndpoint,
21
21
  id = _ref.id,
22
+ passedIntlKey = _ref.intlKey,
23
+ passedIntlNS = _ref.intlNS,
22
24
  _ref$labelOverrides = _ref.labelOverrides,
23
25
  labelOverrides = _ref$labelOverrides === void 0 ? {} : _ref$labelOverrides;
24
26
  return contexts.map(function (ctx) {
@@ -27,6 +29,8 @@ var CustomPropertiesView = function CustomPropertiesView(_ref) {
27
29
  customProperties: customProperties,
28
30
  customPropertiesEndpoint: customPropertiesEndpoint,
29
31
  id: id,
32
+ intlKey: passedIntlKey,
33
+ intlNS: passedIntlNS,
30
34
  labelOverrides: labelOverrides
31
35
  }, "customPropertiesView-".concat(ctx));
32
36
  });
@@ -37,6 +41,8 @@ CustomPropertiesView.propTypes = {
37
41
  customProperties: _propTypes.default.object,
38
42
  customPropertiesEndpoint: _propTypes.default.string,
39
43
  id: _propTypes.default.string,
44
+ intlKey: _propTypes.default.string,
45
+ intlNS: _propTypes.default.string,
40
46
  labelOverrides: _propTypes.default.object,
41
47
  nameOverride: _propTypes.default.string
42
48
  };
@@ -8,16 +8,17 @@ var _react2 = require("@testing-library/react");
8
8
 
9
9
  var _reactRouterDom = require("react-router-dom");
10
10
 
11
- var _helpers = require("../../../../test/jest/helpers");
12
-
13
11
  var _testResources = require("./testResources");
14
12
 
15
13
  var _CustomPropertiesView = _interopRequireDefault(require("./CustomPropertiesView"));
16
14
 
15
+ var _jest = require("../../../../test/jest");
16
+
17
17
  var _jsxRuntime = require("react/jsx-runtime");
18
18
 
19
19
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
20
20
 
21
+ jest.mock('../../hooks');
21
22
  jest.mock('./CustomPropertiesViewCtx', function () {
22
23
  return function () {
23
24
  return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
@@ -28,7 +29,7 @@ jest.mock('./CustomPropertiesViewCtx', function () {
28
29
  describe('CustomPropertiesView', function () {
29
30
  var renderComponent;
30
31
  beforeEach(function () {
31
- renderComponent = (0, _helpers.renderWithKintHarness)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactRouterDom.MemoryRouter, {
32
+ renderComponent = (0, _jest.renderWithKintHarness)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactRouterDom.MemoryRouter, {
32
33
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_CustomPropertiesView.default, {
33
34
  contexts: _testResources.contexts,
34
35
  customProperties: _testResources.customProperties,
@@ -7,8 +7,6 @@ exports.default = void 0;
7
7
 
8
8
  var _propTypes = _interopRequireDefault(require("prop-types"));
9
9
 
10
- var _reactIntl = require("react-intl");
11
-
12
10
  var _components = require("@folio/stripes/components");
13
11
 
14
12
  var _hooks = require("../../hooks");
@@ -39,38 +37,32 @@ var CustomPropertiesViewCtx = function CustomPropertiesViewCtx(_ref) {
39
37
  customProperties = _ref$customProperties === void 0 ? [] : _ref$customProperties,
40
38
  customPropertiesEndpoint = _ref.customPropertiesEndpoint,
41
39
  id = _ref.id,
40
+ passedIntlKey = _ref.intlKey,
41
+ passedIntlNS = _ref.intlNS,
42
42
  _ref$labelOverrides = _ref.labelOverrides,
43
43
  labelOverrides = _ref$labelOverrides === void 0 ? {} : _ref$labelOverrides;
44
+ var kintIntl = (0, _hooks.useKintIntl)(passedIntlKey, passedIntlNS); // Deal with all the possible label override options
44
45
 
45
- // Deal with all the possible label override options
46
46
  var getAccordionLabel = function getAccordionLabel() {
47
- var _labelOverrides$defau;
48
-
49
47
  // Special case for null context
50
48
  if (ctx === 'isNull') {
51
- var _labelOverrides$noCon;
52
-
53
- return (_labelOverrides$noCon = labelOverrides.noContext) !== null && _labelOverrides$noCon !== void 0 ? _labelOverrides$noCon : /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactIntl.FormattedMessage, {
54
- id: "stripes-kint-components.customProperties"
49
+ return kintIntl.formatKintMessage({
50
+ id: 'customProperties',
51
+ overrideValue: labelOverrides.noContext
55
52
  });
56
53
  } // Label overrides for specific contexts
57
54
 
58
55
 
59
56
  if (labelOverrides[ctx]) {
60
57
  return labelOverrides[ctx];
61
- } // Label override for default title, taking ctx into account
62
-
63
-
64
- if (labelOverrides.defaultTitle && typeof labelOverrides.defaultTitle === 'function') {
65
- return labelOverrides.defaultTitle(ctx);
66
58
  } // Label override for default title or finally built in default
67
59
 
68
60
 
69
- return (_labelOverrides$defau = labelOverrides.defaultTitle) !== null && _labelOverrides$defau !== void 0 ? _labelOverrides$defau : /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactIntl.FormattedMessage, {
70
- id: "stripes-kint-components.customProperties.ctx.title",
71
- values: {
72
- ctx: ctx
73
- }
61
+ return kintIntl.formatKintMessage({
62
+ id: 'customProperties.defaultTitle',
63
+ overrideValue: labelOverrides.defaultTitle
64
+ }, {
65
+ ctx: ctx
74
66
  });
75
67
  };
76
68
 
@@ -160,6 +152,8 @@ CustomPropertiesViewCtx.propTypes = {
160
152
  customProperties: _propTypes.default.object,
161
153
  customPropertiesEndpoint: _propTypes.default.string,
162
154
  id: _propTypes.default.string,
155
+ intlKey: _propTypes.default.string,
156
+ intlNS: _propTypes.default.string,
163
157
  labelOverrides: _propTypes.default.object
164
158
  };
165
159
  var _default = CustomPropertiesViewCtx;
@@ -8,12 +8,12 @@ var _reactRouterDom = require("react-router-dom");
8
8
 
9
9
  var _react2 = require("@testing-library/react");
10
10
 
11
- var _helpers = require("../../../../test/jest/helpers");
12
-
13
11
  var _testResources = require("./testResources");
14
12
 
15
13
  var _CustomPropertiesViewCtx = _interopRequireDefault(require("./CustomPropertiesViewCtx"));
16
14
 
15
+ var _jest = require("../../../../test/jest");
16
+
17
17
  var _jsxRuntime = require("react/jsx-runtime");
18
18
 
19
19
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
@@ -24,13 +24,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
24
24
 
25
25
  function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
26
26
 
27
- jest.mock('../../hooks', function () {
28
- return {
29
- useCustomProperties: function useCustomProperties() {
30
- return [];
31
- }
32
- };
33
- });
27
+ jest.mock('../../hooks');
34
28
  jest.mock('./CustomPropertyCard', function () {
35
29
  return function () {
36
30
  return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
@@ -41,7 +35,7 @@ jest.mock('./CustomPropertyCard', function () {
41
35
  describe('CustomPropertiesViewCtx', function () {
42
36
  var renderComponent;
43
37
  beforeEach(function () {
44
- renderComponent = (0, _helpers.renderWithKintHarness)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactRouterDom.MemoryRouter, {
38
+ renderComponent = (0, _jest.renderWithKintHarness)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactRouterDom.MemoryRouter, {
45
39
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_CustomPropertiesViewCtx.default, _objectSpread({}, _testResources.data))
46
40
  }));
47
41
  });
@@ -15,6 +15,8 @@ var _components = require("@folio/stripes/components");
15
15
 
16
16
  var CUSTPROP_TYPES = _interopRequireWildcard(require("../../constants/customProperties"));
17
17
 
18
+ var _hooks = require("../../hooks");
19
+
18
20
  var _jsxRuntime = require("react/jsx-runtime");
19
21
 
20
22
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
@@ -24,65 +26,32 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
24
26
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
25
27
 
26
28
  var CustomPropertyCard = function CustomPropertyCard(_ref) {
27
- var _labelOverrides$value, _labelOverrides$inter3, _labelOverrides$visib, _labelOverrides$publi;
28
-
29
29
  var ctx = _ref.ctx,
30
30
  customProperty = _ref.customProperty,
31
31
  _ref$customPropertyDe = _ref.customPropertyDefinition,
32
32
  customPropertyDefinition = _ref$customPropertyDe === void 0 ? {} : _ref$customPropertyDe,
33
33
  index = _ref.index,
34
+ passedIntlKey = _ref.intlKey,
35
+ passedIntlNS = _ref.intlNS,
34
36
  _ref$labelOverrides = _ref.labelOverrides,
35
37
  labelOverrides = _ref$labelOverrides === void 0 ? {} : _ref$labelOverrides;
36
- // We only need to display primary and set properties
38
+ var kintIntl = (0, _hooks.useKintIntl)(passedIntlKey, passedIntlNS); // We only need to display primary and set properties
39
+
37
40
  var toDisplay = !!(customPropertyDefinition.primary || customProperty);
38
41
 
39
42
  if (!toDisplay) {
40
43
  return null;
41
44
  }
42
45
 
43
- var internalFalse = (customProperty === null || customProperty === void 0 ? void 0 : customProperty.internal) === false || (customProperty === null || customProperty === void 0 ? void 0 : customProperty.internal) === undefined && customPropertyDefinition.defaultInternal === false; // Deal with all the possible label override options
44
-
45
- var getRetiredCardTitle = function getRetiredCardTitle() {
46
- var _labelOverrides$retir;
47
-
48
- // Label override for default card title,
49
- if (labelOverrides.retiredName && typeof labelOverrides.retiredName === 'function') {
50
- return labelOverrides.retiredName(customPropertyDefinition.name);
51
- } // Label override for default title or finally built in default
52
-
53
-
54
- return (_labelOverrides$retir = labelOverrides.retiredName) !== null && _labelOverrides$retir !== void 0 ? _labelOverrides$retir : /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactIntl.FormattedMessage, {
55
- id: "stripes-kint-components.customProperty.retiredName",
56
- values: {
57
- name: customPropertyDefinition.label
58
- }
59
- });
60
- };
61
-
62
- var getInternalLabel = function getInternalLabel() {
63
- var _labelOverrides$inter2;
64
-
65
- if (internalFalse) {
66
- var _labelOverrides$inter;
67
-
68
- return (_labelOverrides$inter = labelOverrides.internalFalse) !== null && _labelOverrides$inter !== void 0 ? _labelOverrides$inter : /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactIntl.FormattedMessage, {
69
- id: "stripes-kint-components.customProperty.internalFalse"
70
- });
71
- }
72
-
73
- return (_labelOverrides$inter2 = labelOverrides.internalTrue) !== null && _labelOverrides$inter2 !== void 0 ? _labelOverrides$inter2 : /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactIntl.FormattedMessage, {
74
- id: "stripes-kint-components.customProperty.internalTrue"
75
- });
76
- };
46
+ var internalFalse = (customProperty === null || customProperty === void 0 ? void 0 : customProperty.internal) === false || (customProperty === null || customProperty === void 0 ? void 0 : customProperty.internal) === undefined && customPropertyDefinition.defaultInternal === false;
77
47
 
78
48
  var renderValue = function renderValue() {
79
49
  var _customProperty$value, _customProperty$value2, _customProperty$value3, _customProperty$value4;
80
50
 
81
51
  if (!customProperty) {
82
- var _labelOverrides$notSe;
83
-
84
- return (_labelOverrides$notSe = labelOverrides.notSet) !== null && _labelOverrides$notSe !== void 0 ? _labelOverrides$notSe : /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactIntl.FormattedMessage, {
85
- id: "stripes-kint-components.customProperty.notSet"
52
+ return kintIntl.formatKintMessage({
53
+ id: 'notSet',
54
+ overrideValue: labelOverrides.notSet
86
55
  });
87
56
  }
88
57
 
@@ -120,7 +89,12 @@ var CustomPropertyCard = function CustomPropertyCard(_ref) {
120
89
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_components.Card, {
121
90
  headerStart: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
122
91
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("strong", {
123
- children: customPropertyDefinition.retired ? getRetiredCardTitle() : customPropertyDefinition.label
92
+ children: customPropertyDefinition.retired ? kintIntl.formatKintMessage({
93
+ id: 'customProperty.retiredName',
94
+ overrideValue: labelOverrides.retiredName
95
+ }, {
96
+ name: customPropertyDefinition.label
97
+ }) : customPropertyDefinition.label
124
98
  }), customPropertyDefinition.description ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.InfoPopover, {
125
99
  content: customPropertyDefinition.description
126
100
  }) : null]
@@ -130,16 +104,18 @@ var CustomPropertyCard = function CustomPropertyCard(_ref) {
130
104
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Col, {
131
105
  xs: 6,
132
106
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.KeyValue, {
133
- label: (_labelOverrides$value = labelOverrides.value) !== null && _labelOverrides$value !== void 0 ? _labelOverrides$value : /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactIntl.FormattedMessage, {
134
- id: "stripes-kint-components.customProperty.value"
107
+ label: kintIntl.formatKintMessage({
108
+ id: 'valueOrValues',
109
+ overrideValue: labelOverrides.valueOrValues
135
110
  }),
136
111
  children: renderValue()
137
112
  })
138
113
  }), customProperty !== null && customProperty !== void 0 && customProperty.note ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Col, {
139
114
  xs: 6,
140
115
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.KeyValue, {
141
- label: (_labelOverrides$inter3 = labelOverrides.internalNote) !== null && _labelOverrides$inter3 !== void 0 ? _labelOverrides$inter3 : /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactIntl.FormattedMessage, {
142
- id: "stripes-kint-components.customProperty.internalNote"
116
+ label: kintIntl.formatKintMessage({
117
+ id: 'customProperties.internalNote',
118
+ overrideValue: labelOverrides.internalNote
143
119
  }),
144
120
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
145
121
  style: {
@@ -153,16 +129,21 @@ var CustomPropertyCard = function CustomPropertyCard(_ref) {
153
129
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Col, {
154
130
  xs: 6,
155
131
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.KeyValue, {
156
- label: (_labelOverrides$visib = labelOverrides.visibility) !== null && _labelOverrides$visib !== void 0 ? _labelOverrides$visib : /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactIntl.FormattedMessage, {
157
- id: "stripes-kint-components.customProperty.visibility"
132
+ label: kintIntl.formatKintMessage({
133
+ id: 'customProperties.visibility',
134
+ overrideValue: labelOverrides.visibility
158
135
  }),
159
- children: getInternalLabel()
136
+ children: kintIntl.formatKintMessage({
137
+ id: 'customProperties.internalFalse',
138
+ overrideValue: labelOverrides.internalFalse
139
+ })
160
140
  })
161
141
  }), internalFalse && /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Col, {
162
142
  xs: 6,
163
143
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.KeyValue, {
164
- label: (_labelOverrides$publi = labelOverrides.publicNote) !== null && _labelOverrides$publi !== void 0 ? _labelOverrides$publi : /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactIntl.FormattedMessage, {
165
- id: "stripes-kint-components.customProperty.publicNote"
144
+ label: kintIntl.formatKintMessage({
145
+ id: 'customProperties.publicNote',
146
+ overrideValue: labelOverrides.publicNote
166
147
  }),
167
148
  children: customProperty !== null && customProperty !== void 0 && customProperty.publicNote ? /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
168
149
  style: {
@@ -181,6 +162,8 @@ CustomPropertyCard.propTypes = {
181
162
  customProperty: _propTypes.default.object,
182
163
  customPropertyDefinition: _propTypes.default.object,
183
164
  index: _propTypes.default.number,
165
+ intlKey: _propTypes.default.string,
166
+ intlNS: _propTypes.default.string,
184
167
  labelOverrides: _propTypes.default.object
185
168
  };
186
169
  var _default = CustomPropertyCard;
@@ -11,8 +11,6 @@ var _react = _interopRequireWildcard(require("react"));
11
11
 
12
12
  var _propTypes = _interopRequireDefault(require("prop-types"));
13
13
 
14
- var _reactIntl = require("react-intl");
15
-
16
14
  var _components = require("@folio/stripes/components");
17
15
 
18
16
  var _core = require("@folio/stripes/core");
@@ -60,16 +58,20 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
60
58
  var propTypes = {
61
59
  afterQueryCalls: _propTypes.default.object,
62
60
  catchQueryCalls: _propTypes.default.object,
61
+ intlKey: _propTypes.default.string,
62
+ intlNS: _propTypes.default.string,
63
63
  label: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.node]),
64
64
  labelOverrides: _propTypes.default.object,
65
65
  refdataEndpoint: _propTypes.default.string
66
66
  };
67
67
 
68
68
  var EditableRefdataCategoryList = function EditableRefdataCategoryList(_ref) {
69
- var _labelOverrides$delet, _deleteModal$refdata2;
69
+ var _deleteModal$refdata2;
70
70
 
71
71
  var afterQueryCalls = _ref.afterQueryCalls,
72
72
  catchQueryCalls = _ref.catchQueryCalls,
73
+ passedIntlKey = _ref.intlKey,
74
+ passedIntlNS = _ref.intlNS,
73
75
  label = _ref.label,
74
76
  _ref$labelOverrides = _ref.labelOverrides,
75
77
  labelOverrides = _ref$labelOverrides === void 0 ? {} : _ref$labelOverrides,
@@ -77,7 +79,7 @@ var EditableRefdataCategoryList = function EditableRefdataCategoryList(_ref) {
77
79
 
78
80
  /* A component that allows for editing of refdata categories */
79
81
  var callout = (0, _react.useContext)(_core.CalloutContext);
80
- var intl = (0, _reactIntl.useIntl)(); // fetch refdata values
82
+ var kintIntl = (0, _hooks.useKintIntl)(passedIntlKey, passedIntlNS); // fetch refdata values
81
83
 
82
84
  var _useRefdata = (0, _hooks.useRefdata)({
83
85
  endpoint: refdataEndpoint,
@@ -143,12 +145,12 @@ var EditableRefdataCategoryList = function EditableRefdataCategoryList(_ref) {
143
145
  case 2:
144
146
  errorResp = _context.sent;
145
147
  callout.sendCallout({
146
- message: labelOverrides !== null && labelOverrides !== void 0 && labelOverrides.deleteError ? labelOverrides.deleteError(errorResp === null || errorResp === void 0 ? void 0 : errorResp.message, deleteModal === null || deleteModal === void 0 ? void 0 : deleteModal.refdata) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactIntl.FormattedMessage, {
147
- id: "stripes-kint-components.editableRefdataCategoryList.deleteRefdataCategory.errorMessage",
148
- values: {
149
- label: deleteModal === null || deleteModal === void 0 ? void 0 : (_deleteModal$refdata = deleteModal.refdata) === null || _deleteModal$refdata === void 0 ? void 0 : _deleteModal$refdata.label,
150
- error: errorResp === null || errorResp === void 0 ? void 0 : errorResp.message
151
- }
148
+ message: kintIntl.formatKintMessage({
149
+ id: 'refdataCategory.deleteRefdataCategory.errorMessage',
150
+ overrideValue: labelOverrides === null || labelOverrides === void 0 ? void 0 : labelOverrides.deleteError
151
+ }, {
152
+ label: deleteModal === null || deleteModal === void 0 ? void 0 : (_deleteModal$refdata = deleteModal.refdata) === null || _deleteModal$refdata === void 0 ? void 0 : _deleteModal$refdata.label,
153
+ error: errorResp === null || errorResp === void 0 ? void 0 : errorResp.message
152
154
  }),
153
155
  type: 'error'
154
156
  });
@@ -195,8 +197,9 @@ var EditableRefdataCategoryList = function EditableRefdataCategoryList(_ref) {
195
197
  if (!(rowData !== null && rowData !== void 0 && (_rowData$values = rowData.values) !== null && _rowData$values !== void 0 && _rowData$values.length)) {
196
198
  actionArray.push({
197
199
  name: 'delete',
198
- label: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactIntl.FormattedMessage, {
199
- id: "stripes-kint-components.delete"
200
+ label: kintIntl.formatKintMessage({
201
+ id: 'delete',
202
+ overrideValue: labelOverrides === null || labelOverrides === void 0 ? void 0 : labelOverrides.delete
200
203
  }),
201
204
  icon: 'trash',
202
205
  callback: function callback(data) {
@@ -206,8 +209,9 @@ var EditableRefdataCategoryList = function EditableRefdataCategoryList(_ref) {
206
209
  });
207
210
  },
208
211
  ariaLabel: function ariaLabel(data) {
209
- return intl.formatMessage({
210
- id: 'stripes-kint-components.editableRefdataCategoryList.deleteAriaLabel'
212
+ return kintIntl.formatKintMessage({
213
+ id: 'refdataCategory.deleteAriaLabel',
214
+ overrideValue: labelOverrides === null || labelOverrides === void 0 ? void 0 : labelOverrides.deleteAriaLabel
211
215
  }, {
212
216
  label: data === null || data === void 0 ? void 0 : data.label
213
217
  });
@@ -222,11 +226,13 @@ var EditableRefdataCategoryList = function EditableRefdataCategoryList(_ref) {
222
226
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_ActionList.default, {
223
227
  actionAssigner: actionAssigner,
224
228
  columnMapping: {
225
- desc: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactIntl.FormattedMessage, {
226
- id: "stripes-kint-components.editableRefdataCategoryList.refdataCategory"
229
+ desc: kintIntl.formatKintMessage({
230
+ id: 'refdataCategory.refdataCategory',
231
+ overrideValue: labelOverrides === null || labelOverrides === void 0 ? void 0 : labelOverrides.refdataCategory
227
232
  }),
228
- values: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactIntl.FormattedMessage, {
229
- id: "stripes-kint-components.editableRefdataCategoryList.noOfValues"
233
+ values: kintIntl.formatKintMessage({
234
+ id: 'refdataCategory.noOfValues',
235
+ overrideValue: labelOverrides === null || labelOverrides === void 0 ? void 0 : labelOverrides.noOfValues
230
236
  })
231
237
  },
232
238
  contentData: contentData,
@@ -253,17 +259,19 @@ var EditableRefdataCategoryList = function EditableRefdataCategoryList(_ref) {
253
259
  },
254
260
  visibleFields: ['desc', 'values']
255
261
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.ConfirmationModal, {
256
- confirmLabel: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactIntl.FormattedMessage, {
257
- id: "stripes-kint-components.delete"
262
+ confirmLabel: kintIntl.formatKintMessage({
263
+ id: 'delete',
264
+ overrideValue: labelOverrides === null || labelOverrides === void 0 ? void 0 : labelOverrides.delete
258
265
  }),
259
- heading: (_labelOverrides$delet = labelOverrides === null || labelOverrides === void 0 ? void 0 : labelOverrides.deleteRefdataCategory) !== null && _labelOverrides$delet !== void 0 ? _labelOverrides$delet : /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactIntl.FormattedMessage, {
260
- id: "stripes-kint-components.editableRefdataCategoryList.deleteRefdataCategory"
266
+ heading: kintIntl.formatKintMessage({
267
+ id: 'refdataCategory.deleteRefdataCategory',
268
+ overrideValue: labelOverrides === null || labelOverrides === void 0 ? void 0 : labelOverrides.deleteRefdataCategory
261
269
  }),
262
- message: labelOverrides !== null && labelOverrides !== void 0 && labelOverrides.deleteRefdataCategoryMessage ? labelOverrides.deleteRefdataCategoryMessage(deleteModal === null || deleteModal === void 0 ? void 0 : deleteModal.refdata) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactIntl.FormattedMessage, {
263
- id: "stripes-kint-components.editableRefdataCategoryList.deleteRefdataCategory.confirmMessage",
264
- values: {
265
- name: deleteModal === null || deleteModal === void 0 ? void 0 : (_deleteModal$refdata2 = deleteModal.refdata) === null || _deleteModal$refdata2 === void 0 ? void 0 : _deleteModal$refdata2.desc
266
- }
270
+ message: kintIntl.formatKintMessage({
271
+ id: 'refdataCategory.deleteRefdataCategory.confirmMessage',
272
+ overrideValue: labelOverrides === null || labelOverrides === void 0 ? void 0 : labelOverrides.deleteRefdataCategoryMessage
273
+ }, {
274
+ name: deleteModal === null || deleteModal === void 0 ? void 0 : (_deleteModal$refdata2 = deleteModal.refdata) === null || _deleteModal$refdata2 === void 0 ? void 0 : _deleteModal$refdata2.desc
267
275
  }),
268
276
  onCancel: function onCancel() {
269
277
  return setDeleteModal({