@k-int/stripes-kint-components 2.8.2 → 3.0.1

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 +18 -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 +87 -43
  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 +101 -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
@@ -1,17 +1,25 @@
1
- import React from 'react';
2
- import { FormattedMessage, useIntl } from 'react-intl';
1
+ import PropTypes from 'prop-types';
2
+
3
+ import { useKintIntl } from '../../hooks';
3
4
 
4
5
  const RenderSettingValue = (props) => {
5
6
  const {
6
7
  currentSetting: setting,
7
- refdata,
8
- templates
8
+ intlKey: passedIntlKey,
9
+ intlNS: passedIntlNS,
10
+ labelOverrides = {},
11
+ refdata, // TODO ... can we get away without passing these in now, using useRefdata?
12
+ templates // TODO ... can we get away without passing these in now, using useTemplates?
9
13
  } = props;
10
14
 
11
- const intl = useIntl();
15
+ const kintIntl = useKintIntl(passedIntlKey, passedIntlNS);
16
+
17
+ const NoCurrentValue = kintIntl.formatKintMessage({
18
+ id: 'settings.noCurrentValue',
19
+ overrideValue: labelOverrides?.noCurrentValue
20
+ });
12
21
 
13
- const NoCurrentValue = <FormattedMessage id="stripes-kint-components.settings.noCurrentValue" />;
14
- const defaultText = `[${intl.formatMessage({ id: 'stripes-kint-components.settings.default' })}]`;
22
+ const defaultText = `[${kintIntl.formatKintMessage({ id: 'settings.default', overrideValue: labelOverrides?.default })}]`;
15
23
  switch (setting.settingType) {
16
24
  case 'Refdata': {
17
25
  if (setting.value) {
@@ -56,4 +64,13 @@ const RenderSettingValue = (props) => {
56
64
  }
57
65
  };
58
66
 
67
+ RenderSettingValue.propTypes = {
68
+ currentSetting: PropTypes.object,
69
+ intlKey: PropTypes.string,
70
+ intlNS: PropTypes.string,
71
+ labelOverrides: PropTypes.object,
72
+ refdata: PropTypes.arrayOf(PropTypes.object),
73
+ templates: PropTypes.arrayOf(PropTypes.object),
74
+ };
75
+
59
76
  export default RenderSettingValue;
@@ -4,6 +4,7 @@ import RenderSettingValue from './RenderSettingValue';
4
4
 
5
5
  import { renderWithKintHarness } from '../../../../test/jest/helpers';
6
6
 
7
+ jest.mock('../../hooks');
7
8
 
8
9
  const stringSetting = {
9
10
  id: '12345',
@@ -1,6 +1,6 @@
1
1
  import React, { useContext, useState } from 'react';
2
2
  import PropTypes from 'prop-types';
3
- import { FormattedMessage, useIntl } from 'react-intl';
3
+
4
4
  import {
5
5
  Button,
6
6
  Card,
@@ -10,12 +10,16 @@ import {
10
10
  import EditSettingValue from './EditSettingValue';
11
11
  import RenderSettingValue from './RenderSettingValue';
12
12
  import { SettingsContext } from '../../contexts';
13
- import { useRefdata, useTemplates } from '../../hooks';
14
- import { renderHelpText, toCamelCase } from '../../utils';
13
+ import { useKintIntl, useRefdata, useTemplates } from '../../hooks';
14
+ import { toCamelCase } from '../../utils';
15
15
 
16
+ import renderHelpTextCSS from '../../../../styles/renderHelpText.css';
16
17
 
17
18
  const SettingField = (settingFieldProps) => {
18
19
  const {
20
+ intlKey: passedIntlKey,
21
+ intlNS: passedIntlNS,
22
+ labelOverrides = {},
19
23
  onSave,
20
24
  settingData: {
21
25
  currentSetting
@@ -23,8 +27,8 @@ const SettingField = (settingFieldProps) => {
23
27
  } = settingFieldProps;
24
28
 
25
29
  const [editing, setEditing] = useState(false);
26
- const intl = useIntl();
27
- const { intlKey, refdataEndpoint, templateEndpoint } = useContext(SettingsContext);
30
+ const kintIntl = useKintIntl(passedIntlKey, passedIntlNS);
31
+ const { refdataEndpoint, templateEndpoint } = useContext(SettingsContext);
28
32
 
29
33
  const {
30
34
  0: {
@@ -46,12 +50,40 @@ const SettingField = (settingFieldProps) => {
46
50
  }
47
51
  });
48
52
 
53
+ const renderHelpText = (helpTextId) => {
54
+ return (
55
+ <div className={renderHelpTextCSS.help}>
56
+ {
57
+ kintIntl.formatKintMessage({
58
+ id: helpTextId
59
+ }, {
60
+ b: (chunks) => <b>{chunks}</b>,
61
+ i: (chunks) => <i>{chunks}</i>,
62
+ em: (chunks) => <em>{chunks}</em>,
63
+ strong: (chunks) => <strong>{chunks}</strong>,
64
+ span: (chunks) => <span>{chunks}</span>,
65
+ div: (chunks) => <div>{chunks}</div>,
66
+ p: (chunks) => <p>{chunks}</p>,
67
+ ul: (chunks) => <ul>{chunks}</ul>,
68
+ ol: (chunks) => <ol>{chunks}</ol>,
69
+ li: (chunks) => <li>{chunks}</li>,
70
+ })
71
+ }
72
+ </div>
73
+ );
74
+ };
75
+
49
76
  const renderEditButton = () => {
50
77
  const EditText = editing ?
51
- <FormattedMessage id="stripes-kint-components.settings.finishEditing" /> :
52
- <FormattedMessage id="stripes-kint-components.settings.edit" />;
78
+ kintIntl.formatKintMessage({
79
+ id: 'save'
80
+ }) :
81
+ kintIntl.formatKintMessage({
82
+ id: 'edit'
83
+ });
53
84
  return (
54
85
  <Button
86
+ marginBottom0
55
87
  onClick={(e) => {
56
88
  e.preventDefault();
57
89
  return (
@@ -73,19 +105,25 @@ const SettingField = (settingFieldProps) => {
73
105
  RenderFunction = EditSettingValue;
74
106
  }
75
107
 
76
- const id = `${intlKey}.settings.${toCamelCase(currentSetting.section)}.${toCamelCase(currentSetting.key)}.help`;
108
+ const id = `settings.${toCamelCase(currentSetting.section)}.${toCamelCase(currentSetting.key)}.help`;
77
109
 
78
110
 
79
111
  const renderHeaderStart = () => {
80
112
  const settingName = Object.keys(currentSetting).length > 0 ?
81
- <FormattedMessage id={`${intlKey}.settings.${toCamelCase(currentSetting.section)}.${toCamelCase(currentSetting.key)}`} /> :
82
- <FormattedMessage id="stripes-kint-components.settings.settingLoading" />;
83
- return (
84
- <>
85
- {intl.messages[id] && <InfoPopover content={renderHelpText(id)} />}
86
- {settingName}
87
- </>
88
- );
113
+ kintIntl.formatKintMessage({
114
+ id: `settings.${toCamelCase(currentSetting.section)}.${toCamelCase(currentSetting.key)}`
115
+ }) :
116
+ kintIntl.formatKintMessage({
117
+ id: 'loading'
118
+ });
119
+
120
+ return (
121
+ <>
122
+ {
123
+ kintIntl.messageExists(id) && <InfoPopover content={renderHelpText(id)} />}
124
+ {settingName}
125
+ </>
126
+ );
89
127
  };
90
128
 
91
129
  return (
@@ -96,6 +134,9 @@ const SettingField = (settingFieldProps) => {
96
134
  >
97
135
  <RenderFunction
98
136
  currentSetting={currentSetting}
137
+ intlKey={passedIntlKey}
138
+ intlNS={passedIntlNS}
139
+ labelOverrides={labelOverrides}
99
140
  refdata={refdata}
100
141
  templates={templates}
101
142
  {...settingFieldProps}
@@ -1,6 +1,8 @@
1
1
  import React from 'react';
2
- import userEvent from '@testing-library/user-event';
3
2
  import '@folio/stripes-erm-components/test/jest/__mock__';
3
+
4
+ import { waitFor } from '@testing-library/react';
5
+
4
6
  import { TestForm } from '@folio/stripes-erm-components/test/jest/helpers';
5
7
  import { Button } from '@folio/stripes-testing';
6
8
  import { Field } from 'react-final-form';
@@ -14,10 +16,7 @@ const onSave = jest.fn().mockResolvedValue();
14
16
  jest.mock('./EditSettingValue', () => () => <div>EditSettingValue</div>);
15
17
  jest.mock('./RenderSettingValue', () => () => <div>RenderSettingValue</div>);
16
18
 
17
- jest.mock('../../hooks', () => ({
18
- useRefdata: () => [],
19
- useTemplates: () => [],
20
- }));
19
+ jest.mock('../../hooks');
21
20
 
22
21
 
23
22
  const setting = {
@@ -48,9 +47,9 @@ describe('SettingField', () => {
48
47
  );
49
48
  });
50
49
 
51
- it('renders RenderSettingValue', () => {
50
+ it('renders RenderSettingValue', async () => {
52
51
  const { getByText } = renderComponent;
53
- expect(getByText('RenderSettingValue')).toBeInTheDocument();
52
+ await waitFor(async () => expect(await getByText('RenderSettingValue')).toBeInTheDocument());
54
53
  });
55
54
 
56
55
  test('renders the edit button', () => {
@@ -58,23 +57,19 @@ describe('SettingField', () => {
58
57
  });
59
58
 
60
59
  it('clicking edit/save works as expected', async () => {
61
- const { getByRole, findByText } = renderComponent;
62
-
60
+ const { findByText } = renderComponent;
63
61
  // before clicking on edit button, we should be rendering setting value
64
- expect(await findByText('RenderSettingValue')).toBeInTheDocument();
62
+ await waitFor(async () => expect(await findByText('RenderSettingValue')).toBeInTheDocument());
65
63
 
66
64
  // Clicking edit button
67
- const editButton = getByRole('button', { name: /Edit/i });
68
- expect(editButton).toBeInTheDocument();
69
- userEvent.click(editButton);
65
+ await Button('Edit').click();
70
66
  // Should be rendering the "edit" for a setting value
71
- expect(await findByText('EditSettingValue')).toBeInTheDocument();
67
+ await waitFor(async () => expect(await findByText('EditSettingValue')).toBeInTheDocument());
68
+
69
+ // Clicking save button
70
+ await waitFor(async () => { await Button('Save').click(); });
72
71
 
73
- // Clicking finish editing button
74
- const finishEditing = getByRole('button', { name: /Finish editing/i });
75
- expect(finishEditing).toBeInTheDocument();
76
- userEvent.click(finishEditing);
77
72
  // Should be rendering the setting value again
78
- expect(await findByText('RenderSettingValue')).toBeInTheDocument();
73
+ await waitFor(async () => expect(await findByText('RenderSettingValue')).toBeInTheDocument());
79
74
  });
80
75
  });
@@ -1,16 +1,20 @@
1
1
  import PropTypes from 'prop-types';
2
2
 
3
3
  import { Form } from 'react-final-form';
4
- import { FormattedMessage } from 'react-intl';
5
4
  import { Button, Modal, ModalFooter } from '@folio/stripes/components';
5
+ import { useKintIntl } from '../hooks';
6
6
 
7
7
  const FormModal = ({
8
8
  children,
9
+ intlKey: passedIntlKey,
10
+ intlNS: passedIntlNS,
9
11
  labelOverrides = {},
10
12
  modalProps: { footer, onClose, ...modalProps },
11
13
  onSubmit,
12
14
  ...formProps
13
15
  }) => {
16
+ const kintIntl = useKintIntl(passedIntlKey, passedIntlNS);
17
+
14
18
  return (
15
19
  <Form
16
20
  onSubmit={onSubmit}
@@ -38,19 +42,19 @@ const FormModal = ({
38
42
  onClick={handleSubmit}
39
43
  type="submit"
40
44
  >
41
- {
42
- labelOverrides.save ??
43
- <FormattedMessage id="stripes-kint-components.saveAndClose" />
44
- }
45
+ {kintIntl.formatKintMessage({
46
+ id: 'saveAndClose',
47
+ overrideValue: labelOverrides.saveAndClose
48
+ })}
45
49
  </Button>
46
50
  <Button
47
51
  marginBottom0
48
52
  onClick={handleClose}
49
53
  >
50
- {
51
- labelOverrides.cancel ??
52
- <FormattedMessage id="stripes-kint-components.cancel" />
53
- }
54
+ {kintIntl.formatKintMessage({
55
+ id: 'cancel',
56
+ overrideValue: labelOverrides.cancel
57
+ })}
54
58
  </Button>
55
59
  </ModalFooter>
56
60
  );
@@ -81,6 +85,8 @@ FormModal.propTypes = {
81
85
  PropTypes.node,
82
86
  PropTypes.func,
83
87
  ]),
88
+ intlKey: PropTypes.string,
89
+ intlNS: PropTypes.string,
84
90
  labelOverrides: PropTypes.object,
85
91
  modalProps: PropTypes.shape({
86
92
  footer: PropTypes.func,
@@ -0,0 +1,54 @@
1
+ import PropTypes from 'prop-types';
2
+ import { FormattedMessage, useIntl } from 'react-intl';
3
+ import { useIntlKey } from '../hooks';
4
+
5
+ // This works analogously to useKintIntl's "formatKintMessage"
6
+ const FormattedKintMessage = ({
7
+ fallbackMessage,
8
+ id,
9
+ intlKey: passedIntlKey,
10
+ intlNS: passedIntlNS,
11
+ overrideValue,
12
+ ...formattedMessageProps
13
+ }) => {
14
+ const intlKey = useIntlKey(passedIntlKey, passedIntlNS);
15
+ const intlObj = useIntl();
16
+
17
+ if (overrideValue) {
18
+ // Version 3 is a breaking change, where labelOverrides must be strings.
19
+ if (typeof overrideValue !== 'string') {
20
+ throw new Error('Override values must be strings as of stripes-kint-components ^3.0.0');
21
+ }
22
+
23
+ if (intlObj.messages?.[overrideValue]) {
24
+ // We've been passed a key as an override, return formattedMessage with it
25
+ return <FormattedMessage id={overrideValue} {...formattedMessageProps} />;
26
+ }
27
+ // At this stage we have an overrideValue that's not a key, return it.
28
+ return overrideValue;
29
+ }
30
+
31
+ // If key does not exist in intl, and we have a specified "fallbackMessage", use that
32
+
33
+ // (FallbackMessage works like defaultMessage but with no warning)
34
+ if (!intlObj.messages?.[`${intlKey}.${id}`] && fallbackMessage) {
35
+ // Allow fallback message to be an intl key
36
+ if (intlObj.messages?.[fallbackMessage]) {
37
+ return <FormattedMessage id={fallbackMessage} {...formattedMessageProps} />;
38
+ }
39
+
40
+ return fallbackMessage;
41
+ }
42
+
43
+ return (<FormattedMessage id={`${intlKey}.${id}`} {...formattedMessageProps} />);
44
+ };
45
+
46
+ FormattedKintMessage.propTypes = {
47
+ fallbackMessage: PropTypes.string,
48
+ id: PropTypes.string.isRequired,
49
+ intlKey: PropTypes.string,
50
+ intlNS: PropTypes.string,
51
+ overrideValue: PropTypes.string
52
+ };
53
+
54
+ export default FormattedKintMessage;
@@ -0,0 +1 @@
1
+ export { default } from './FormattedKintMessage';
@@ -3,8 +3,6 @@ import PropTypes from 'prop-types';
3
3
 
4
4
  import classnames from 'classnames';
5
5
 
6
- import { FormattedMessage } from 'react-intl';
7
-
8
6
  import {
9
7
  IconButton,
10
8
  Icon,
@@ -13,6 +11,7 @@ import {
13
11
  import css from '../../../styles/IconSelect.css';
14
12
 
15
13
  import RichSelect, { useSelectedOption } from '../RichSelect';
14
+ import FormattedKintMessage from '../FormattedKintMessage';
16
15
 
17
16
  // A form component which acts as a "Select for states with corresponding icons"
18
17
  const IconSelect = forwardRef(({
@@ -20,21 +19,29 @@ const IconSelect = forwardRef(({
20
19
  disabled = false,
21
20
  id,
22
21
  input,
22
+ intlKey: passedIntlKey,
23
+ intlNS: passedIntlNS,
23
24
  label,
24
25
  meta,
25
- notSet = {
26
- icon: 'ellipsis',
27
- value: '',
28
- label: <FormattedMessage id="stripes-kint-components.iconSelect.notSet" />
29
- },
26
+ notSet,
30
27
  onChange,
31
28
  options: userOptions = [],
32
29
  required = false,
33
30
  value
34
31
  }, ref) => {
32
+ const defaultNotSet = {
33
+ icon: 'ellipsis',
34
+ value: '',
35
+ label: <FormattedKintMessage
36
+ id="notSet"
37
+ intlKey={passedIntlKey}
38
+ intlNS={passedIntlNS}
39
+ />
40
+ };
41
+
35
42
  // Options with notSet
36
43
  const options = [
37
- notSet,
44
+ notSet ?? defaultNotSet,
38
45
  ...userOptions
39
46
  ];
40
47
 
@@ -100,6 +107,8 @@ IconSelect.propTypes = {
100
107
  disabled: PropTypes.bool,
101
108
  id: PropTypes.string,
102
109
  input: PropTypes.object,
110
+ intlKey: PropTypes.string,
111
+ intlNS: PropTypes.string,
103
112
  label: PropTypes.oneOfType([
104
113
  PropTypes.string,
105
114
  PropTypes.func,
@@ -3,17 +3,23 @@ import PropTypes from 'prop-types';
3
3
  import { FormattedMessage } from 'react-intl';
4
4
  import { Button, Icon } from '@folio/stripes/components';
5
5
  import css from '../../../styles/NoResultsMessage.css';
6
+ import { useKintIntl } from '../hooks';
6
7
 
7
8
  const NoResultsMessage = ({
8
9
  icon: userIcon,
10
+ intlKey: passedIntlKey,
11
+ intlNS: passedIntlNS,
9
12
  isLoading,
10
13
  isError,
11
14
  error,
12
15
  filterPaneIsVisible,
13
16
  label: userLabel,
17
+ labelOverrides = {},
14
18
  searchTerm,
15
19
  toggleFilterPane,
16
20
  }) => {
21
+ const kintIntl = useKintIntl(passedIntlKey, passedIntlNS);
22
+
17
23
  let icon = 'search';
18
24
  let label = <FormattedMessage id="stripes-smart-components.sas.noResults.default" values={{ searchTerm }} />;
19
25
 
@@ -53,7 +59,12 @@ const NoResultsMessage = ({
53
59
  marginBottom0
54
60
  onClick={toggleFilterPane}
55
61
  >
56
- <FormattedMessage id="stripes-kint-components.noResultsMessage.showFilters" />
62
+ {
63
+ kintIntl.formatKintMessage({
64
+ id: 'showFilters',
65
+ overrideValue: labelOverrides?.showFilters
66
+ })
67
+ }
57
68
  </Button>
58
69
  )}
59
70
  </div>
@@ -64,6 +75,8 @@ NoResultsMessage.propTypes = {
64
75
  error: PropTypes.object,
65
76
  filterPaneIsVisible: PropTypes.bool.isRequired,
66
77
  icon: PropTypes.string,
78
+ intlKey: PropTypes.string,
79
+ intlNS: PropTypes.string,
67
80
  isLoading: PropTypes.bool,
68
81
  isError: PropTypes.bool,
69
82
  label: PropTypes.oneOfType([
@@ -71,6 +84,7 @@ NoResultsMessage.propTypes = {
71
84
  PropTypes.node,
72
85
  PropTypes.func
73
86
  ]),
87
+ labelOverrides: PropTypes.object,
74
88
  searchTerm: PropTypes.string.isRequired,
75
89
  toggleFilterPane: PropTypes.func.isRequired,
76
90
  };
@@ -1,19 +1,17 @@
1
1
  import { forwardRef, useCallback, useEffect, useImperativeHandle, useRef, useState } from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
 
4
- import { FormattedMessage } from 'react-intl';
5
-
6
4
  import {
7
5
  Button,
8
6
  Dropdown,
7
+ DropdownButton,
9
8
  DropdownMenu,
10
- Icon,
11
- // IconButton,
12
9
  nativeChangeFieldValue as nativeChangeField,
13
10
  Label,
14
11
  } from '@folio/stripes/components';
15
12
 
16
13
  import css from '../../../styles/RichSelect.css';
14
+ import FormattedKintMessage from '../FormattedKintMessage';
17
15
 
18
16
  const RichSelect = forwardRef(({
19
17
  ariaLabel,
@@ -21,6 +19,8 @@ const RichSelect = forwardRef(({
21
19
  dropdownProps = {},
22
20
  id,
23
21
  input: formInput = {},
22
+ intlKey: passedIntlKey,
23
+ intlNS: passedIntlNS,
24
24
  label,
25
25
  meta,
26
26
  onChange,
@@ -58,11 +58,11 @@ const RichSelect = forwardRef(({
58
58
  selectedOption
59
59
  }));
60
60
 
61
- const defaultRenderTrigger = ({ onToggle, triggerRef, keyHandler, open, ariaProps, getTriggerProps }) => {
61
+ const defaultRenderTrigger = ({ onToggle, triggerRef, keyHandler, ariaProps, getTriggerProps }) => {
62
62
  return (
63
- <Button
63
+ <DropdownButton
64
64
  ref={triggerRef}
65
- buttonClass={css.iconButtonText}
65
+ buttonClass={css.triggerButton}
66
66
  buttonStyle="none"
67
67
  disabled={disabled}
68
68
  marginBottom0
@@ -72,41 +72,19 @@ const RichSelect = forwardRef(({
72
72
  type="button"
73
73
  {...getTriggerProps()}
74
74
  {...ariaProps}
75
- >
76
- <Icon
77
- icon={open ? 'caret-up' : 'caret-down'}
78
- iconPosition="end"
79
- >
80
- {
81
- selectedOption?.label ??
82
- selectedOption?.value ??
83
- (internalValue || null) ??
84
- placeholder ??
85
- <FormattedMessage id="stripes-kint-components.richSelect.placeholder" />
86
- }
87
- </Icon>
88
- </Button>
89
- // Awaiting result of conversation about whether we want to allow labels on IconButtons
90
- /* <IconButton
91
- ref={triggerRef}
92
- disabled={disabled}
93
- icon={open ? 'caret-up' : 'caret-down'}
94
- iconPosition="end"
95
- marginBottom0
96
- onClick={onToggle}
97
- onKeyDown={keyHandler}
98
- type="button"
99
- {...getTriggerProps()}
100
- {...ariaProps}
101
75
  >
102
76
  {
103
77
  selectedOption?.label ??
104
78
  selectedOption?.value ??
105
- (internalValue ? internalValue : null) ??
79
+ (internalValue || null) ??
106
80
  placeholder ??
107
- <FormattedMessage id="stripes-kint-components.richSelect.placeholder" />
81
+ <FormattedKintMessage
82
+ id="pleaseSelectOption"
83
+ intlKey={passedIntlKey}
84
+ intlNS={passedIntlNS}
85
+ />
108
86
  }
109
- </IconButton> */
87
+ </DropdownButton>
110
88
  );
111
89
  };
112
90
 
@@ -202,6 +180,8 @@ RichSelect.propTypes = {
202
180
  dropdownProps: PropTypes.object,
203
181
  id: PropTypes.string,
204
182
  input: PropTypes.object,
183
+ intlKey: PropTypes.string,
184
+ intlNS: PropTypes.string,
205
185
  label: PropTypes.oneOfType([
206
186
  PropTypes.string,
207
187
  PropTypes.func,
@@ -22,7 +22,7 @@ import {
22
22
  } from '@folio/stripes/components';
23
23
 
24
24
  import { generateKiwtQuery } from '../utils';
25
- import { useKiwtSASQuery, useLocalStorageState } from '../hooks';
25
+ import { useKintIntl, useKiwtSASQuery, useLocalStorageState } from '../hooks';
26
26
 
27
27
  import TableBody from './TableBody';
28
28
 
@@ -34,11 +34,15 @@ const SASQLookupComponent = (props) => {
34
34
  FilterPaneHeaderComponent = () => null,
35
35
  filterPaneProps,
36
36
  id,
37
+ intlKey: passedIntlKey,
38
+ intlNS: passedIntlNS,
39
+ labelOverrides = {},
37
40
  mainPaneProps,
38
41
  noSearchField,
39
42
  RenderBody,
40
43
  sasqProps,
41
44
  } = props;
45
+ const kintIntl = useKintIntl(passedIntlKey, passedIntlNS);
42
46
 
43
47
  const { query, queryGetter, querySetter } = useKiwtSASQuery();
44
48
  const { 0: namespace } = useNamespace();
@@ -195,12 +199,20 @@ const SASQLookupComponent = (props) => {
195
199
  null}
196
200
  noOverflow
197
201
  padContent={false}
198
- paneSub={<FormattedMessage id="stripes-kint-components.sasqLookupComponent.mainPane.found" values={{ total: data?.total }} />}
202
+ paneSub={
203
+ kintIntl.formatKintMessage({
204
+ id: 'found#Values',
205
+ overrideValue: labelOverrides?.foundValues
206
+ }, { total: data?.total })
207
+ }
199
208
  {...mainPaneProps}
200
209
  >
201
210
  <Body
202
211
  data={data}
203
212
  filterPaneVisible={filterPaneVisible}
213
+ intlKey={passedIntlKey}
214
+ intlNS={passedIntlNS}
215
+ labelOverrides={labelOverrides}
204
216
  query={query}
205
217
  toggleFilterPane={toggleFilterPane}
206
218
  {...restOfInfiniteQueryProps}
@@ -240,6 +252,9 @@ SASQLookupComponent.propTypes = {
240
252
  ]),
241
253
  history: PropTypes.object,
242
254
  id: PropTypes.string.isRequired,
255
+ intlKey: PropTypes.string,
256
+ intlNS: PropTypes.string,
257
+ labelOverrides: PropTypes.object,
243
258
  location: PropTypes.object,
244
259
  mainPaneProps: PropTypes.object,
245
260
  match: PropTypes.object,
@@ -12,8 +12,11 @@ const TableBody = ({
12
12
  error,
13
13
  fetchNextPage,
14
14
  filterPaneVisible,
15
+ intlKey: passedIntlKey,
16
+ intlNS: passedIntlNS,
15
17
  isError,
16
18
  isLoading,
19
+ labelOverrides = {},
17
20
  match,
18
21
  mclProps,
19
22
  onSort,
@@ -48,9 +51,12 @@ const TableBody = ({
48
51
  <NoResultsMessage
49
52
  {...{
50
53
  error,
54
+ filterPaneIsVisible: filterPaneVisible,
55
+ intlKey: passedIntlKey,
56
+ intlNS: passedIntlNS,
51
57
  isError,
52
58
  isLoading,
53
- filterPaneIsVisible: filterPaneVisible,
59
+ labelOverrides,
54
60
  searchTerm: query.query,
55
61
  toggleFilterPane
56
62
  }}
@@ -81,8 +87,11 @@ TableBody.propTypes = {
81
87
  fetchNextPage: PropTypes.func,
82
88
  filterPaneVisible: PropTypes.bool,
83
89
  history: PropTypes.object,
90
+ intlKey: PropTypes.string,
91
+ intlNS: PropTypes.string,
84
92
  isError: PropTypes.bool,
85
93
  isLoading: PropTypes.bool,
94
+ labelOverrides: PropTypes.object,
86
95
  location: PropTypes.object,
87
96
  match: PropTypes.object,
88
97
  mclProps: PropTypes.object,