@k-int/stripes-kint-components 2.8.1 → 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 +16 -1
  2. package/es/index.js +54 -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 +67 -47
  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 +38 -28
  44. package/es/lib/EditableRefdataList/EditableRefdataList.js +44 -32
  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 +48 -4
  70. package/es/lib/utils/parseErrorResponse.js +91 -0
  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 +12 -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 +109 -34
  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 +47 -28
  272. package/src/lib/EditableRefdataList/EditableRefdataList.js +58 -33
  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 +14 -1
  298. package/src/lib/utils/parseErrorResponse.js +18 -0
  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
@@ -5,7 +5,12 @@ import { EditableSettingsList } from '../EditableSettingsList';
5
5
  import { SettingsContext } from '../contexts';
6
6
  import { useSettingSection } from '../hooks';
7
7
 
8
- const SettingPage = ({ sectionName }) => {
8
+ const SettingPage = ({
9
+ intlKey: passedIntlKey,
10
+ intlNS: passedIntlNS,
11
+ labelOverrides = {},
12
+ sectionName
13
+ }) => {
9
14
  const { settingEndpoint } = useContext(SettingsContext);
10
15
 
11
16
  const { handleSubmit, settings } = useSettingSection({
@@ -13,10 +18,12 @@ const SettingPage = ({ sectionName }) => {
13
18
  settingEndpoint
14
19
  });
15
20
 
16
-
17
21
  return (
18
22
  <EditableSettingsList
19
23
  initialValues={{ 'settings': settings }}
24
+ intlKey={passedIntlKey}
25
+ intlNS={passedIntlNS}
26
+ labelOverrides={labelOverrides}
20
27
  onSave={handleSubmit}
21
28
  onSubmit={handleSubmit}
22
29
  settingSection={sectionName}
@@ -25,18 +32,10 @@ const SettingPage = ({ sectionName }) => {
25
32
  };
26
33
 
27
34
  SettingPage.propTypes = {
28
- mutator: PropTypes.shape({
29
- settings: PropTypes.object
30
- }),
35
+ intlKey: PropTypes.string,
36
+ intlNS: PropTypes.string,
37
+ labelOverrides: PropTypes.object,
31
38
  sectionName: PropTypes.string,
32
- resources: PropTypes.shape({
33
- settings: PropTypes.shape({
34
- records: PropTypes.arrayOf(PropTypes.object)
35
- }),
36
- refdatavalues: PropTypes.shape({
37
- records: PropTypes.arrayOf(PropTypes.object)
38
- })
39
- })
40
39
  };
41
40
 
42
41
  export default SettingPage;
@@ -1,19 +1,27 @@
1
- import React, { useContext } from 'react';
2
1
  import PropTypes from 'prop-types';
3
2
 
4
3
  import { Pane } from '@folio/stripes/components';
5
- import { FormattedMessage } from 'react-intl';
6
- import { SettingsContext } from '../contexts';
7
4
  import { toCamelCase } from '../utils';
5
+ import { useKintIntl } from '../hooks';
8
6
 
9
- const SettingPagePane = ({ sectionName, children }) => {
10
- const { intlKey } = useContext(SettingsContext);
7
+ const SettingPagePane = ({
8
+ children,
9
+ intlKey: passedIntlKey,
10
+ intlNS: passedIntlNS,
11
+ sectionName,
12
+ }) => {
13
+ const kintIntl = useKintIntl(passedIntlKey, passedIntlNS);
11
14
 
12
15
  return (
13
16
  <Pane
14
17
  defaultWidth="fill"
15
18
  id={`settings-${sectionName}`}
16
- paneTitle={<FormattedMessage id={`${intlKey}.settings.settingsSection.${toCamelCase(sectionName)}`} />}
19
+ paneTitle={
20
+ kintIntl.formatKintMessage({
21
+ id: `settings.settingsSection.${toCamelCase(sectionName)}`,
22
+ fallbackMessage: sectionName
23
+ })
24
+ }
17
25
  >
18
26
  {children}
19
27
  </Pane>
@@ -22,6 +30,8 @@ const SettingPagePane = ({ sectionName, children }) => {
22
30
 
23
31
  SettingPagePane.propTypes = {
24
32
  sectionName: PropTypes.string,
33
+ intlKey: PropTypes.string,
34
+ intlNS: PropTypes.string,
25
35
  children: PropTypes.oneOfType([
26
36
  PropTypes.func,
27
37
  PropTypes.node
@@ -0,0 +1,17 @@
1
+ import refdata from '../../../../test/jest/refdata';
2
+ import customProperties from '../../../../test/jest/customProperties';
3
+
4
+ import useKintIntl from '../useKintIntl';
5
+
6
+ // We have to do this up here too so that our passed useKintIntl
7
+ // ALSO has a mocked useIntlKeyStore... I think anyway
8
+ jest.mock('../useIntlKeyStore', () => () => () => 'ui-test-implementor');
9
+
10
+ module.exports = {
11
+ useRefdata: () => refdata,
12
+ useTemplates: () => [], // We should set up some templates to test this properly
13
+ useCustomProperties: () => ({ data: customProperties, isLoading: false }),
14
+ useMutateCustomProperties: () => [],
15
+ useIntlKeyStore: () => () => () => 'ui-test-implementor',
16
+ useKintIntl, // Use the "proper" useKintIntl but with a mocked intlKeyStore which returns the ui-test-implementor
17
+ };
@@ -10,6 +10,8 @@ export { useSettings, useSettingSection, useAppSettings } from './settingsHooks'
10
10
  export { default as useKiwtFieldArray } from './useKiwtFieldArray';
11
11
  export { default as useCustomProperties } from './useCustomProperties';
12
12
  export { default as useMutateCustomProperties } from './useMutateCustomProperties';
13
- export { default as useAvailableCustomProperties } from './useAvailableCustomProperties';
14
13
  export { default as useInvalidateRefdata } from './useInvalidateRefdata';
15
14
  export { default as useMutateRefdataCategory } from './useMutateRefdataCategory';
15
+ export { default as useKintIntl } from './useKintIntl';
16
+ export { default as useIntlKeyStore } from './useIntlKeyStore';
17
+ export { default as useIntlKey } from './useIntlKey';
@@ -1,8 +1,7 @@
1
- import React, { useContext } from 'react';
1
+ import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
 
4
4
  import { useQuery } from 'react-query';
5
- import { FormattedMessage, useIntl } from 'react-intl';
6
5
  import { useOkapiKy } from '@folio/stripes/core';
7
6
 
8
7
  import { Settings } from '@folio/stripes/smart-components';
@@ -11,17 +10,22 @@ import { SettingPage, SettingPagePane } from '../../SettingPage';
11
10
  import { SettingsContext } from '../../contexts';
12
11
 
13
12
  import { generateKiwtQueryParams, sortByLabel, toCamelCase } from '../../utils';
13
+ import useKintIntl from '../useKintIntl';
14
+ import useIntlKey from '../useIntlKey';
14
15
 
15
16
  const useSettings = ({
16
17
  dynamicPageExclusions,
17
- intlKey,
18
+ intlKey: passedIntlKey,
19
+ intlNS: passedIntlNS,
20
+ labelOverrides = {},
18
21
  persistentPages,
19
22
  refdataEndpoint,
20
23
  settingEndpoint,
21
24
  templateEndpoint
22
25
  }) => {
23
26
  const ky = useOkapiKy();
24
- const intl = useIntl();
27
+ const kintIntl = useKintIntl(passedIntlKey, passedIntlNS);
28
+
25
29
  const queryParams = generateKiwtQueryParams({
26
30
  filters: dynamicPageExclusions?.map(dpe => ({
27
31
  path: 'section',
@@ -42,13 +46,20 @@ const useSettings = ({
42
46
  return (
43
47
  {
44
48
  route: section,
45
- label: intl.formatMessage({
46
- defaultMessage: section,
47
- id: `${intlKey}.settings.settingsSection.${toCamelCase(section)}`
49
+ label: kintIntl.formatKintMessage({
50
+ id: `settings.settingsSection.${toCamelCase(section)}`,
51
+ fallbackMessage: section
48
52
  }),
49
53
  component: (props) => (
50
- <SettingPagePane sectionName={section}>
54
+ <SettingPagePane
55
+ intlKey={passedIntlKey}
56
+ intlNS={passedIntlNS}
57
+ sectionName={section}
58
+ >
51
59
  <SettingPage
60
+ intlKey={passedIntlKey}
61
+ intlNS={passedIntlNS}
62
+ labelOverrides={labelOverrides}
52
63
  sectionName={section}
53
64
  {...props}
54
65
  />
@@ -60,11 +71,12 @@ const useSettings = ({
60
71
 
61
72
  const pageList = persistentPages.concat(dynamic).sort(sortByLabel);
62
73
 
74
+ const intlKey = useIntlKey(passedIntlKey, passedIntlNS);
63
75
  const SettingsContextProvider = ({ children }) => {
64
76
  return (
65
77
  <SettingsContext.Provider
66
78
  value={{
67
- intlKey,
79
+ intlKey, // This is only here for backwards compatibility... is now grabbed from useIntlKey instead of what's passed in directly
68
80
  refdataEndpoint,
69
81
  settingEndpoint,
70
82
  templateEndpoint
@@ -83,12 +95,13 @@ const useSettings = ({
83
95
  };
84
96
 
85
97
  const SettingsComponent = (props) => {
86
- const settingsData = useContext(SettingsContext);
87
-
88
98
  return (
89
99
  <Settings
90
100
  pages={pageList}
91
- paneTitle={<FormattedMessage id={`${settingsData.intlKey}.meta.title`} />}
101
+ paneTitle={
102
+ kintIntl.formatKintMessage({
103
+ id: 'meta.title'
104
+ })}
92
105
  {...props}
93
106
  />
94
107
  );
@@ -0,0 +1,22 @@
1
+ import useIntlKeyStore from './useIntlKeyStore';
2
+
3
+ const useIntlKey = (passedIntlKey, passedIntlNS) => {
4
+ const getKey = useIntlKeyStore(state => state.getKey);
5
+ let intlKey;
6
+
7
+ if (passedIntlKey) {
8
+ intlKey = passedIntlKey;
9
+ } else if (passedIntlNS) {
10
+ intlKey = getKey(passedIntlNS);
11
+ } else {
12
+ intlKey = getKey();
13
+ }
14
+
15
+ if (!intlKey) {
16
+ throw new Error('Stripes kint components requires an intl key to be either configured via `addKey` from `useIntlKeyStore` or passed directly into components');
17
+ }
18
+
19
+ return intlKey;
20
+ };
21
+
22
+ export default useIntlKey;
@@ -0,0 +1,38 @@
1
+ // We can use hooks within zustand store functions without violating the laws of hooks
2
+ /* eslint-disable react-hooks/rules-of-hooks */
3
+ import { useNamespace } from '@folio/stripes/core';
4
+ import create from 'zustand';
5
+
6
+ const useIntlKeyStore = create((set, get) => ({
7
+ intlKeys: {},
8
+ addKey: (key, namespace) => set((state) => {
9
+ let ns = namespace;
10
+ const folioNS = useNamespace()?.[0];
11
+ if (!ns) {
12
+ ns = folioNS;
13
+ }
14
+
15
+ return { intlKeys: { [ns]: key, ...state } };
16
+ }),
17
+ removeKey: (namespace) => set((state) => {
18
+ let ns = namespace;
19
+ const folioNS = useNamespace()?.[0];
20
+ if (!ns) {
21
+ ns = folioNS;
22
+ }
23
+
24
+ const { [ns]: _valueToRemove, ...newKeys } = state.intlKeys;
25
+ return { intlKeys: newKeys };
26
+ }),
27
+ getKey: (namespace) => {
28
+ let ns = namespace;
29
+ const folioNS = useNamespace()?.[0];
30
+ if (!ns) {
31
+ ns = folioNS;
32
+ }
33
+
34
+ return get().intlKeys?.[ns];
35
+ }
36
+ }));
37
+
38
+ export default useIntlKeyStore;
@@ -0,0 +1,51 @@
1
+ import { useIntl } from 'react-intl';
2
+ import useIntlKey from './useIntlKey';
3
+
4
+ /* A hook to enrich the intl object we get from useIntl */
5
+ const useKintIntl = (passedIntlKey, passedIntlNS) => {
6
+ const intlObj = useIntl();
7
+ const intlKey = useIntlKey(passedIntlKey, passedIntlNS);
8
+
9
+ // FormatKintMessage id misses out the top level key part of the path.
10
+ // This works analogously to FormattedKintMessage component
11
+ const formatKintMessage = ({ id, overrideValue, fallbackMessage, ...formatParams }, formatValues) => {
12
+ if (overrideValue) {
13
+ // Version 3 is a breaking change, where labelOverrides must be strings.
14
+ if (typeof overrideValue !== 'string') {
15
+ throw new Error('Override values must be strings as of stripes-kint-components ^3.0.0');
16
+ }
17
+
18
+ if (intlObj.messages?.[overrideValue]) {
19
+ // We've been passed a key as an override, use it
20
+ return intlObj.formatMessage({ id: overrideValue, ...formatParams }, formatValues);
21
+ }
22
+ // At this stage we have an overrideValue that's not a key, return it.
23
+ return overrideValue;
24
+ }
25
+
26
+ // If key does not exist in intl, and we have a specified "fallbackMessage", use that
27
+
28
+ // (FallbackMessage works like defaultMessage but with no warning)
29
+ if (!intlObj.messages?.[`${intlKey}.${id}`] && fallbackMessage) {
30
+ // Allow fallback message to be an intl key
31
+ if (intlObj.messages?.[fallbackMessage]) {
32
+ return intlObj.formatMessage({ id: fallbackMessage, ...formatParams }, formatValues);
33
+ }
34
+
35
+ return fallbackMessage;
36
+ }
37
+
38
+ // After all that, render the message from key
39
+ return intlObj.formatMessage({ id: `${intlKey}.${id}`, ...formatParams }, formatValues);
40
+ };
41
+
42
+ const messageExists = (key) => !!intlObj.messages?.[`${intlKey}.${key}`];
43
+
44
+ return {
45
+ ...intlObj,
46
+ formatKintMessage,
47
+ messageExists
48
+ };
49
+ };
50
+
51
+ export default useKintIntl;
@@ -12,10 +12,23 @@ export { default as typedownQueryKey } from './typedownQueryKey';
12
12
  export { default as groupCustomPropertiesByCtx } from './groupCustomPropertiesByCtx';
13
13
 
14
14
  // Settings utils
15
- export { default as renderHelpText } from './renderHelpText';
16
15
  export { default as sortByLabel } from './sortByLabel';
17
16
  export { default as toCamelCase } from './toCamelCase'; // I hate that this exists
18
17
 
19
18
 
20
19
  export { default as matchString } from './matchString';
21
20
  export { boldString, highlightString } from './highlightString';
21
+
22
+ // HTTP Utils
23
+ export { default as parseErrorResponse } from './parseErrorResponse';
24
+
25
+ // Validators
26
+ export {
27
+ composeValidators,
28
+ composeValidatorsWithArgs,
29
+ invalidNumber,
30
+ rangeOverflow,
31
+ rangeUnderflow,
32
+ required,
33
+ requiredObject
34
+ } from './validators';
@@ -0,0 +1,18 @@
1
+ const parseErrorResponse = async (responseObj) => {
2
+ let errorResp;
3
+ const contentType = [...responseObj?.headers]?.find(header => header[0] === 'content-type')?.[1];
4
+
5
+ if (contentType.includes('json')) {
6
+ errorResp = await responseObj.json();
7
+ } else {
8
+ try {
9
+ errorResp = { message: await responseObj.text() };
10
+ } catch {
11
+ errorResp = { message: 'something went wrong' };
12
+ }
13
+ }
14
+
15
+ return errorResp;
16
+ };
17
+
18
+ export default parseErrorResponse;
@@ -1,11 +1,5 @@
1
- // This is a copy of stripes-erm-components, to avoid necessitating that as a dependency
2
1
  import { FormattedMessage } from 'react-intl';
3
-
4
- import * as CUSTOM_PROPERTY_TYPES from '../constants/customProperties';
5
-
6
- const invalidNumber = value => (
7
- (value || value === 0) ? undefined : <FormattedMessage id="stripes-kint-components.errors.invalidNumber" />
8
- );
2
+ import FormattedKintMessage from '../FormattedKintMessage';
9
3
 
10
4
  const required = value => {
11
5
  const blankString = /^\s+$/;
@@ -25,55 +19,77 @@ const requiredObject = (formValue = {}) => {
25
19
  return undefined;
26
20
  };
27
21
 
28
- const customPropertyValidator = (fieldValue, allValues, customProperty) => {
29
- const { note, publicNote, value: currentValue } = allValues?.customProperties?.[customProperty?.value]?.[0] ?? {};
22
+ const composeValidators = (...validators) => (
23
+ (value, allValues, meta) => (
24
+ validators.reduce((error, validator) => (
25
+ error || validator(value, allValues, meta)
26
+ ), undefined)
27
+ )
28
+ );
30
29
 
31
- if ((note && !currentValue) || (publicNote && !currentValue)) {
32
- if (
33
- customProperty.type === CUSTOM_PROPERTY_TYPES.DECIMAL_CLASS_NAME ||
34
- customProperty.type === CUSTOM_PROPERTY_TYPES.INTEGER_CLASS_NAME
35
- ) {
36
- return <FormattedMessage id="stripes-kint-components.errors.customPropertyNoteInvalidNumber" />;
37
- } else {
38
- return <FormattedMessage id="stripes-kint-components.errors.customPropertyNoteWithoutValue" />;
39
- }
40
- }
30
+ // Similar to the above, but allow explicit setting of arguments to the validators
31
+ const composeValidatorsWithArgs = (...validators) => (
32
+ (...args) => (
33
+ validators.reduce((error, validator) => (
34
+ error || validator(...args)
35
+ ), undefined)
36
+ )
37
+ );
41
38
 
42
- if (customProperty.type === CUSTOM_PROPERTY_TYPES.DECIMAL_CLASS_NAME) {
43
- const regexp = /^-?[\d]*(\.[\d]{0,2})?$/;
44
- return (fieldValue && !regexp.test(fieldValue)) ?
45
- <FormattedMessage id="stripes-kint-components.errors.customPropertyMaxTwoDecimals" /> : undefined;
39
+ // Make same shape as rangeOverflow/rangeUnderflow so we can combine them
40
+ const invalidNumber = (value, _min, _max, intlKey, intlNS, labelOverrides = {}) => {
41
+ if (!value && value !== 0) {
42
+ return (
43
+ <FormattedKintMessage
44
+ id="errors.invalidNumber"
45
+ intlKey={intlKey}
46
+ intlNS={intlNS}
47
+ overrideValue={labelOverrides?.invalidNumberError}
48
+ />
49
+ );
46
50
  }
47
51
 
48
- if (customProperty.type === CUSTOM_PROPERTY_TYPES.INTEGER_CLASS_NAME) {
49
- const min = Number.MIN_SAFE_INTEGER;
50
- const max = Number.MAX_SAFE_INTEGER;
51
-
52
- return (fieldValue && !Number.isInteger(+fieldValue)) ?
53
- <FormattedMessage id="stripes-kint-components.errors.customPropertyValueNotInRange" values={{ min, max }} /> :
54
- undefined;
55
- }
52
+ return undefined;
53
+ };
56
54
 
57
- if (!customProperty.primary && !currentValue) {
58
- return <FormattedMessage id="stripes-core.label.missingRequiredField" />;
55
+ const rangeOverflow = (value, min, max, intlKey, intlNS, labelOverrides = {}) => {
56
+ if ((value || value === 0) && value > max) {
57
+ return (
58
+ <FormattedKintMessage
59
+ id="errors.decimalValueNotInRange"
60
+ intlKey={intlKey}
61
+ intlNS={intlNS}
62
+ overrideValue={labelOverrides?.decimalValueNotInRangeError}
63
+ values={{ min, max }}
64
+ />
65
+ );
59
66
  }
60
67
 
61
68
  return undefined;
62
69
  };
63
70
 
71
+ const rangeUnderflow = (value, min, max, intlKey, intlNS, labelOverrides = {}) => {
72
+ if ((value || value === 0) && value < min) {
73
+ return (
74
+ <FormattedKintMessage
75
+ id="errors.decimalValueNotInRange"
76
+ intlKey={intlKey}
77
+ intlNS={intlNS}
78
+ overrideValue={labelOverrides?.decimalValueNotInRangeError}
79
+ values={{ min, max }}
80
+ />
81
+ );
82
+ }
64
83
 
65
- const composeValidators = (...validators) => (
66
- (value, allValues, meta) => (
67
- validators.reduce((error, validator) => (
68
- error || validator(value, allValues, meta)
69
- ), undefined)
70
- )
71
- );
84
+ return undefined;
85
+ };
72
86
 
73
87
  export {
74
88
  composeValidators,
75
- customPropertyValidator,
89
+ composeValidatorsWithArgs,
76
90
  invalidNumber,
91
+ rangeOverflow,
92
+ rangeUnderflow,
77
93
  required,
78
94
  requiredObject,
79
95
  };
@@ -1,7 +1,10 @@
1
1
  @import '@folio/stripes-components/lib/variables.css';
2
2
 
3
- .iconButtonText {
4
- font-weight: var(--text-weight-regular);
5
- color: var(--color-icon);
3
+ .triggerButton {
4
+ color: var(--primary);
6
5
  border-radius: 0;
7
- }
6
+
7
+ &::before {
8
+ border-radius: var(--radius);
9
+ }
10
+ }
@@ -0,0 +1,80 @@
1
+ {
2
+ "yes": "Yes",
3
+ "no": "No",
4
+ "all": "All",
5
+ "new": "New",
6
+ "errors.invalidNumber": "Please enter a valid number to continue",
7
+ "errors.hasNonAlphaName": "The name can only contain Latin alphabetical characters (a-z) and non-leading numeric characters.",
8
+ "errors.valueNotInRange": "Please enter a whole number in the range {min} to {max} to continue",
9
+ "errors.decimalValueNotInRange": "Please enter a number in the range {min} to {max} to continue",
10
+ "errors.maxTwoDecimals": "Please enter a number with a maximum of 2 decimals places",
11
+ "customProperties": "Custom properties",
12
+ "customProperties.label": "Label",
13
+ "customProperties.primary": "Primary",
14
+ "customProperties.retired": "Retired",
15
+ "customProperties.ctx": "Context",
16
+ "customProperties.ctx.addContext": "Add context {value}",
17
+ "customProperties.noCtxFound": "No matching context found",
18
+ "customProperties.weight": "Order weight",
19
+ "customProperties.type": "Type",
20
+ "customProperties.internalFalse": "Public",
21
+ "customProperties.internalNote": "Internal note",
22
+ "customProperties.internalTrue": "Internal",
23
+ "customProperties.publicNote": "Public note",
24
+ "customProperties.name": "Name",
25
+ "customProperties.description": "Description",
26
+ "customProperties.category": "Category",
27
+ "customProperties.defaultVisibility": "Default visibility",
28
+ "customProperties.value": "Value(s)",
29
+ "customProperties.visibility": "Visibility",
30
+ "customProperties.type.com.k_int.web.toolkit.custprops.types.CustomPropertyBlob": "Blob",
31
+ "customProperties.type.com.k_int.web.toolkit.custprops.types.CustomPropertyBoolean": "Boolean",
32
+ "customProperties.type.com.k_int.web.toolkit.custprops.types.CustomPropertyContainer": "Container",
33
+ "customProperties.type.com.k_int.web.toolkit.custprops.types.CustomPropertyDecimal": "Decimal",
34
+ "customProperties.type.com.k_int.web.toolkit.custprops.types.CustomPropertyInteger": "Integer",
35
+ "customProperties.type.com.k_int.web.toolkit.custprops.types.CustomPropertyRefdata": "Refdata",
36
+ "customProperties.type.com.k_int.web.toolkit.custprops.types.CustomPropertyRefdataDefinition": "Refdata definition",
37
+ "customProperties.type.com.k_int.web.toolkit.custprops.types.CustomPropertyText": "Text",
38
+ "customProperties.type.com.k_int.web.toolkit.custprops.types.CustomPropertyLocalDate": "Date",
39
+ "customProperties.type.com.k_int.web.toolkit.custprops.types.CustomPropertyMultiRefdata": "Refdata (multi-select)",
40
+ "customProperties.config.all": "All",
41
+ "customProperties.config.delete.errorMessage": "There was an error deleting custom property: <strong>{label}</strong>. {error}",
42
+ "customProperties.config.delete.confirmHeading": "Delete custom property",
43
+ "customProperties.config.delete.confirmMessage": "Custom property <strong>{name}</strong> will be <strong>deleted</strong>.",
44
+ "customProperties.config.newModal": "New custom property",
45
+ "customProperties.config.editModal": "Edit {name}",
46
+ "customProperties.errors.primaryRetired": "A custom property cannot be both primary and deprecated",
47
+ "customProperties.errors.customPropertyNoteInvalidNumber": "A valid number must be entered in order to save a note",
48
+ "customProperties.errors.customPropertyNoteWithoutValue": "A value must be set in order to save a note",
49
+ "customProperties.defaultTitle": "Custom properties ({ctx})",
50
+ "customProperties.optionalProperties": "Optional properties",
51
+ "customProperties.primaryProperties": "Primary properties",
52
+ "customProperties.addProperty": "Add property",
53
+ "customProperty.optionalPropertyHeader": "Custom property {number}",
54
+ "customProperty.remove": "Remove custom property {number}",
55
+ "customProperty": "Custom property",
56
+ "customProperty.addFilter": "Add custom property filter",
57
+ "customProperty.editCustomPropertyFilters": "Edit custom property filters",
58
+ "addRule": "Add rule",
59
+ "value": "Value",
60
+ "comparator": "Comparator",
61
+ "operator.isSet": "Is set",
62
+ "operator.isNotSet": "Is not set",
63
+ "operator.equals": "Equals",
64
+ "operator.doesNotEqual": "Does not equal",
65
+ "operator.isGreaterThanOrEqual": "Is greater than or equal to",
66
+ "operator.isLessThanOrEqual": "Is less than or equal to",
67
+ "operator.isOnOrAfter": "Is on or after",
68
+ "operator.isOnOrBefore": "Is on or before",
69
+ "operator.is": "Is",
70
+ "operator.isNot": "Is not",
71
+ "operator.contains": "Contains",
72
+ "operator.doesNotContain": "Does not contain",
73
+ "settings.valueFor": "Value for setting {name}",
74
+ "settings.noCurrentValue": "No current value",
75
+ "settings.default": "default",
76
+ "edit": "Edit",
77
+ "save": "Save",
78
+ "cancel": "Cancel",
79
+ "apply": "Apply"
80
+ }
@@ -1,11 +1,11 @@
1
1
  import translations from '../../translations/stripes-kint-components/en';
2
+ import testTranslations from './test-implementor-translations';
2
3
 
3
4
  const translationsProperties = [
4
5
  {
5
6
  prefix: 'stripes-kint-components',
6
7
  translations,
7
8
  },
8
- /* Don't think we're using any of the below rn */
9
9
  {
10
10
  prefix: 'stripes-core',
11
11
  translations: {
@@ -34,6 +34,11 @@ const translationsProperties = [
34
34
  'searchResultsCountHeader': '"{count, number} {count, plural, one {record found} other {records found}}"',
35
35
  'new': 'New'
36
36
  },
37
+ },
38
+ {
39
+ // Extra translations to allow us to properly test the translation pattern as if we had an implementing module
40
+ prefix: 'ui-test-implementor',
41
+ translations: testTranslations
37
42
  }
38
43
  ];
39
44