@gravity-ui/dynamic-forms 5.18.0 → 5.19.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 (345) hide show
  1. package/build/cjs/lib/unstable/core/Entity/Entity.js +78 -0
  2. package/build/cjs/lib/unstable/core/Entity/index.js +5 -0
  3. package/build/cjs/lib/unstable/core/Entity/types.js +2 -0
  4. package/build/cjs/lib/unstable/core/Entity/utils.js +40 -0
  5. package/build/cjs/lib/unstable/core/SchemaRenderer/SchemaRenderer.js +12 -0
  6. package/build/cjs/lib/unstable/core/SchemaRenderer/index.js +5 -0
  7. package/build/cjs/lib/unstable/core/constants.js +28 -0
  8. package/build/cjs/lib/unstable/core/index.js +15 -0
  9. package/build/cjs/lib/unstable/core/types/components.js +2 -0
  10. package/build/cjs/lib/unstable/core/types/config.js +2 -0
  11. package/build/cjs/lib/unstable/core/types/helpers.js +2 -0
  12. package/build/cjs/lib/unstable/core/types/index.js +8 -0
  13. package/build/cjs/lib/unstable/core/types/schema.js +2 -0
  14. package/build/cjs/lib/unstable/core/types/validation.js +2 -0
  15. package/build/cjs/lib/unstable/core/types/values.js +2 -0
  16. package/build/cjs/lib/unstable/core/useSchemaRenderer/constants.js +4 -0
  17. package/build/cjs/lib/unstable/core/useSchemaRenderer/hooks/index.js +7 -0
  18. package/build/cjs/lib/unstable/core/useSchemaRenderer/hooks/useEntitiesState.js +25 -0
  19. package/build/cjs/lib/unstable/core/useSchemaRenderer/hooks/useSchemaRendererMutators.js +17 -0
  20. package/build/cjs/lib/unstable/core/useSchemaRenderer/index.js +10 -0
  21. package/build/cjs/lib/unstable/core/useSchemaRenderer/mutators/async-validation/async-validation.js +35 -0
  22. package/build/cjs/lib/unstable/core/useSchemaRenderer/mutators/async-validation/index.js +5 -0
  23. package/build/cjs/lib/unstable/core/useSchemaRenderer/mutators/async-validation/types.js +2 -0
  24. package/build/cjs/lib/unstable/core/useSchemaRenderer/mutators/external-errors/external-errors.js +60 -0
  25. package/build/cjs/lib/unstable/core/useSchemaRenderer/mutators/external-errors/index.js +5 -0
  26. package/build/cjs/lib/unstable/core/useSchemaRenderer/mutators/external-errors/types.js +2 -0
  27. package/build/cjs/lib/unstable/core/useSchemaRenderer/mutators/index.js +16 -0
  28. package/build/cjs/lib/unstable/core/useSchemaRenderer/mutators/schema-mutators/index.js +5 -0
  29. package/build/cjs/lib/unstable/core/useSchemaRenderer/mutators/schema-mutators/schema-mutators.js +81 -0
  30. package/build/cjs/lib/unstable/core/useSchemaRenderer/mutators/schema-mutators/types.js +2 -0
  31. package/build/cjs/lib/unstable/core/useSchemaRenderer/mutators/trigger-fields/index.js +5 -0
  32. package/build/cjs/lib/unstable/core/useSchemaRenderer/mutators/trigger-fields/trigger-fields.js +12 -0
  33. package/build/cjs/lib/unstable/core/useSchemaRenderer/mutators/trigger-fields/types.js +2 -0
  34. package/build/cjs/lib/unstable/core/useSchemaRenderer/types.js +2 -0
  35. package/build/cjs/lib/unstable/core/useSchemaRenderer/useSchemaRenderer.js +86 -0
  36. package/build/cjs/lib/unstable/core/useSchemaRenderer/utils/common.js +11 -0
  37. package/build/cjs/lib/unstable/core/useSchemaRenderer/utils/get-ajv-validate.js +39 -0
  38. package/build/cjs/lib/unstable/core/useSchemaRenderer/utils/get-validate.js +67 -0
  39. package/build/cjs/lib/unstable/core/useSchemaRenderer/utils/index.js +7 -0
  40. package/build/cjs/lib/unstable/core/useSchemaRenderer/utils/process-ajv-error.js +51 -0
  41. package/build/cjs/lib/unstable/core/useSchemaRenderer/utils/process-ajv-validate-errors.js +43 -0
  42. package/build/cjs/lib/unstable/core/useSchemaRenderer/utils/process-entity-parameters-error.js +36 -0
  43. package/build/cjs/lib/unstable/core/useSchemaRenderer/utils/process-errors-state.js +17 -0
  44. package/build/cjs/lib/unstable/core/utils/common.js +180 -0
  45. package/build/cjs/lib/unstable/core/utils/index.js +4 -0
  46. package/build/cjs/lib/unstable/kit/Accordeon.js +31 -0
  47. package/build/cjs/lib/unstable/kit/Any.js +21 -0
  48. package/build/cjs/lib/unstable/kit/ArrayBase.css +23 -0
  49. package/build/cjs/lib/unstable/kit/ArrayBase.js +101 -0
  50. package/build/cjs/lib/unstable/kit/MultiSelect.css +6 -0
  51. package/build/cjs/lib/unstable/kit/MultiSelect.js +66 -0
  52. package/build/cjs/lib/unstable/kit/ObjectBase.css +10 -0
  53. package/build/cjs/lib/unstable/kit/ObjectBase.js +71 -0
  54. package/build/cjs/lib/unstable/kit/Row.css +73 -0
  55. package/build/cjs/lib/unstable/kit/Row.js +50 -0
  56. package/build/cjs/lib/unstable/kit/Text.js +259 -0
  57. package/build/cjs/lib/unstable/kit/components/ArrayRemoveButton/ArrayRemoveButton.js +29 -0
  58. package/build/cjs/lib/unstable/kit/components/ArrayRemoveButton/index.js +5 -0
  59. package/build/cjs/lib/unstable/kit/components/ControlError/ControlError.css +33 -0
  60. package/build/cjs/lib/unstable/kit/components/ControlError/ControlError.js +15 -0
  61. package/build/cjs/lib/unstable/kit/components/ControlError/index.js +5 -0
  62. package/build/cjs/lib/unstable/kit/components/HTMLContent/HTMLContent.js +11 -0
  63. package/build/cjs/lib/unstable/kit/components/HTMLContent/index.js +5 -0
  64. package/build/cjs/lib/unstable/kit/components/index.js +9 -0
  65. package/build/cjs/lib/unstable/kit/config.js +68 -0
  66. package/build/cjs/lib/unstable/kit/constants/config.js +62 -0
  67. package/build/cjs/lib/unstable/kit/constants/index.js +6 -0
  68. package/build/cjs/lib/unstable/kit/controls/ArrayBase/ArrayBase.js +46 -0
  69. package/build/cjs/lib/unstable/kit/controls/ArrayBase/index.js +4 -0
  70. package/build/cjs/lib/unstable/kit/controls/Checkbox/Checkbox.css +5 -0
  71. package/build/cjs/lib/unstable/kit/controls/Checkbox/Checkbox.js +16 -0
  72. package/build/cjs/lib/unstable/kit/controls/Checkbox/index.js +5 -0
  73. package/build/cjs/lib/unstable/kit/controls/CheckboxGroup/CheckboxGroup.css +3 -0
  74. package/build/cjs/lib/unstable/kit/controls/CheckboxGroup/CheckboxGroup.js +37 -0
  75. package/build/cjs/lib/unstable/kit/controls/CheckboxGroup/index.js +5 -0
  76. package/build/cjs/lib/unstable/kit/controls/ColorPicker/ColorPicker.js +24 -0
  77. package/build/cjs/lib/unstable/kit/controls/ColorPicker/index.js +5 -0
  78. package/build/cjs/lib/unstable/kit/controls/DateInput/DateInput.css +3 -0
  79. package/build/cjs/lib/unstable/kit/controls/DateInput/DateInput.js +55 -0
  80. package/build/cjs/lib/unstable/kit/controls/DateInput/index.js +5 -0
  81. package/build/cjs/lib/unstable/kit/controls/MultiSelect/MultiSelect.js +35 -0
  82. package/build/cjs/lib/unstable/kit/controls/MultiSelect/index.js +5 -0
  83. package/build/cjs/lib/unstable/kit/controls/NumberBase/Number.js +12 -0
  84. package/build/cjs/lib/unstable/kit/controls/NumberBase/index.js +5 -0
  85. package/build/cjs/lib/unstable/kit/controls/ObjectBase/ObjectBase.js +33 -0
  86. package/build/cjs/lib/unstable/kit/controls/ObjectBase/index.js +5 -0
  87. package/build/cjs/lib/unstable/kit/controls/Password/Password.js +12 -0
  88. package/build/cjs/lib/unstable/kit/controls/Password/index.js +5 -0
  89. package/build/cjs/lib/unstable/kit/controls/RadioGroup/RadioGroup.css +3 -0
  90. package/build/cjs/lib/unstable/kit/controls/RadioGroup/RadioGroup.js +24 -0
  91. package/build/cjs/lib/unstable/kit/controls/RadioGroup/index.js +5 -0
  92. package/build/cjs/lib/unstable/kit/controls/RangeSlider/RangeSlider.css +3 -0
  93. package/build/cjs/lib/unstable/kit/controls/RangeSlider/RangeSlider.js +33 -0
  94. package/build/cjs/lib/unstable/kit/controls/RangeSlider/index.js +5 -0
  95. package/build/cjs/lib/unstable/kit/controls/Select/Select.js +32 -0
  96. package/build/cjs/lib/unstable/kit/controls/Select/index.js +5 -0
  97. package/build/cjs/lib/unstable/kit/controls/Slider/Slider.css +3 -0
  98. package/build/cjs/lib/unstable/kit/controls/Slider/Slider.js +19 -0
  99. package/build/cjs/lib/unstable/kit/controls/Slider/index.js +5 -0
  100. package/build/cjs/lib/unstable/kit/controls/StringBase/StringBase.js +12 -0
  101. package/build/cjs/lib/unstable/kit/controls/StringBase/index.js +5 -0
  102. package/build/cjs/lib/unstable/kit/controls/Switch/Switch.css +5 -0
  103. package/build/cjs/lib/unstable/kit/controls/Switch/Switch.js +16 -0
  104. package/build/cjs/lib/unstable/kit/controls/Switch/index.js +5 -0
  105. package/build/cjs/lib/unstable/kit/controls/TextArea/TextArea.js +12 -0
  106. package/build/cjs/lib/unstable/kit/controls/TextArea/index.js +5 -0
  107. package/build/cjs/lib/unstable/kit/controls/index.js +35 -0
  108. package/build/cjs/lib/unstable/kit/styles/functions.css +0 -0
  109. package/build/cjs/lib/unstable/kit/styles/variables.css +0 -0
  110. package/build/cjs/lib/unstable/kit/utils/cn.js +6 -0
  111. package/build/cjs/lib/unstable/kit/utils/common.js +27 -0
  112. package/build/cjs/lib/unstable/kit/utils/index.js +11 -0
  113. package/build/cjs/lib/unstable/kit/wrappers/Row/Row.css +27 -0
  114. package/build/cjs/lib/unstable/kit/wrappers/Row/Row.js +34 -0
  115. package/build/cjs/lib/unstable/kit/wrappers/Row/index.js +5 -0
  116. package/build/cjs/lib/unstable/kit/wrappers/Transparent/Transparent.css +6 -0
  117. package/build/cjs/lib/unstable/kit/wrappers/Transparent/Transparent.js +15 -0
  118. package/build/cjs/lib/unstable/kit/wrappers/Transparent/index.js +5 -0
  119. package/build/cjs/lib/unstable/kit/wrappers/index.js +7 -0
  120. package/build/cjs/unstable.js +10 -0
  121. package/build/esm/lib/unstable/core/Entity/Entity.d.ts +10 -0
  122. package/build/esm/lib/unstable/core/Entity/Entity.js +74 -0
  123. package/build/esm/lib/unstable/core/Entity/index.d.ts +2 -0
  124. package/build/esm/lib/unstable/core/Entity/index.js +1 -0
  125. package/build/esm/lib/unstable/core/Entity/types.d.ts +27 -0
  126. package/build/esm/lib/unstable/core/Entity/types.js +1 -0
  127. package/build/esm/lib/unstable/core/Entity/utils.d.ts +3 -0
  128. package/build/esm/lib/unstable/core/Entity/utils.js +35 -0
  129. package/build/esm/lib/unstable/core/SchemaRenderer/SchemaRenderer.d.ts +5 -0
  130. package/build/esm/lib/unstable/core/SchemaRenderer/SchemaRenderer.js +8 -0
  131. package/build/esm/lib/unstable/core/SchemaRenderer/index.d.ts +1 -0
  132. package/build/esm/lib/unstable/core/SchemaRenderer/index.js +1 -0
  133. package/build/esm/lib/unstable/core/constants.d.ts +22 -0
  134. package/build/esm/lib/unstable/core/constants.js +25 -0
  135. package/build/esm/lib/unstable/core/index.d.ts +5 -0
  136. package/build/esm/lib/unstable/core/index.js +4 -0
  137. package/build/esm/lib/unstable/core/types/components.d.ts +29 -0
  138. package/build/esm/lib/unstable/core/types/components.js +1 -0
  139. package/build/esm/lib/unstable/core/types/config.d.ts +36 -0
  140. package/build/esm/lib/unstable/core/types/config.js +1 -0
  141. package/build/esm/lib/unstable/core/types/helpers.d.ts +18 -0
  142. package/build/esm/lib/unstable/core/types/helpers.js +1 -0
  143. package/build/esm/lib/unstable/core/types/index.d.ts +5 -0
  144. package/build/esm/lib/unstable/core/types/index.js +5 -0
  145. package/build/esm/lib/unstable/core/types/schema.d.ts +1186 -0
  146. package/build/esm/lib/unstable/core/types/schema.js +1 -0
  147. package/build/esm/lib/unstable/core/types/validation.d.ts +39 -0
  148. package/build/esm/lib/unstable/core/types/validation.js +1 -0
  149. package/build/esm/lib/unstable/core/types/values.d.ts +4 -0
  150. package/build/esm/lib/unstable/core/types/values.js +1 -0
  151. package/build/esm/lib/unstable/core/useSchemaRenderer/constants.d.ts +1 -0
  152. package/build/esm/lib/unstable/core/useSchemaRenderer/constants.js +1 -0
  153. package/build/esm/lib/unstable/core/useSchemaRenderer/hooks/index.d.ts +2 -0
  154. package/build/esm/lib/unstable/core/useSchemaRenderer/hooks/index.js +2 -0
  155. package/build/esm/lib/unstable/core/useSchemaRenderer/hooks/useEntitiesState.d.ts +7 -0
  156. package/build/esm/lib/unstable/core/useSchemaRenderer/hooks/useEntitiesState.js +20 -0
  157. package/build/esm/lib/unstable/core/useSchemaRenderer/hooks/useSchemaRendererMutators.d.ts +10 -0
  158. package/build/esm/lib/unstable/core/useSchemaRenderer/hooks/useSchemaRendererMutators.js +13 -0
  159. package/build/esm/lib/unstable/core/useSchemaRenderer/index.d.ts +3 -0
  160. package/build/esm/lib/unstable/core/useSchemaRenderer/index.js +3 -0
  161. package/build/esm/lib/unstable/core/useSchemaRenderer/mutators/async-validation/async-validation.d.ts +3 -0
  162. package/build/esm/lib/unstable/core/useSchemaRenderer/mutators/async-validation/async-validation.js +29 -0
  163. package/build/esm/lib/unstable/core/useSchemaRenderer/mutators/async-validation/index.d.ts +2 -0
  164. package/build/esm/lib/unstable/core/useSchemaRenderer/mutators/async-validation/index.js +2 -0
  165. package/build/esm/lib/unstable/core/useSchemaRenderer/mutators/async-validation/types.d.ts +34 -0
  166. package/build/esm/lib/unstable/core/useSchemaRenderer/mutators/async-validation/types.js +1 -0
  167. package/build/esm/lib/unstable/core/useSchemaRenderer/mutators/external-errors/external-errors.d.ts +3 -0
  168. package/build/esm/lib/unstable/core/useSchemaRenderer/mutators/external-errors/external-errors.js +54 -0
  169. package/build/esm/lib/unstable/core/useSchemaRenderer/mutators/external-errors/index.d.ts +2 -0
  170. package/build/esm/lib/unstable/core/useSchemaRenderer/mutators/external-errors/index.js +2 -0
  171. package/build/esm/lib/unstable/core/useSchemaRenderer/mutators/external-errors/types.d.ts +25 -0
  172. package/build/esm/lib/unstable/core/useSchemaRenderer/mutators/external-errors/types.js +1 -0
  173. package/build/esm/lib/unstable/core/useSchemaRenderer/mutators/index.d.ts +13 -0
  174. package/build/esm/lib/unstable/core/useSchemaRenderer/mutators/index.js +13 -0
  175. package/build/esm/lib/unstable/core/useSchemaRenderer/mutators/schema-mutators/index.d.ts +2 -0
  176. package/build/esm/lib/unstable/core/useSchemaRenderer/mutators/schema-mutators/index.js +2 -0
  177. package/build/esm/lib/unstable/core/useSchemaRenderer/mutators/schema-mutators/schema-mutators.d.ts +3 -0
  178. package/build/esm/lib/unstable/core/useSchemaRenderer/mutators/schema-mutators/schema-mutators.js +75 -0
  179. package/build/esm/lib/unstable/core/useSchemaRenderer/mutators/schema-mutators/types.d.ts +26 -0
  180. package/build/esm/lib/unstable/core/useSchemaRenderer/mutators/schema-mutators/types.js +1 -0
  181. package/build/esm/lib/unstable/core/useSchemaRenderer/mutators/trigger-fields/index.d.ts +2 -0
  182. package/build/esm/lib/unstable/core/useSchemaRenderer/mutators/trigger-fields/index.js +2 -0
  183. package/build/esm/lib/unstable/core/useSchemaRenderer/mutators/trigger-fields/trigger-fields.d.ts +2 -0
  184. package/build/esm/lib/unstable/core/useSchemaRenderer/mutators/trigger-fields/trigger-fields.js +8 -0
  185. package/build/esm/lib/unstable/core/useSchemaRenderer/mutators/trigger-fields/types.d.ts +6 -0
  186. package/build/esm/lib/unstable/core/useSchemaRenderer/mutators/trigger-fields/types.js +1 -0
  187. package/build/esm/lib/unstable/core/useSchemaRenderer/types.d.ts +22 -0
  188. package/build/esm/lib/unstable/core/useSchemaRenderer/types.js +1 -0
  189. package/build/esm/lib/unstable/core/useSchemaRenderer/useSchemaRenderer.d.ts +37 -0
  190. package/build/esm/lib/unstable/core/useSchemaRenderer/useSchemaRenderer.js +81 -0
  191. package/build/esm/lib/unstable/core/useSchemaRenderer/utils/common.d.ts +1 -0
  192. package/build/esm/lib/unstable/core/useSchemaRenderer/utils/common.js +7 -0
  193. package/build/esm/lib/unstable/core/useSchemaRenderer/utils/get-ajv-validate.d.ts +11 -0
  194. package/build/esm/lib/unstable/core/useSchemaRenderer/utils/get-ajv-validate.js +34 -0
  195. package/build/esm/lib/unstable/core/useSchemaRenderer/utils/get-validate.d.ts +14 -0
  196. package/build/esm/lib/unstable/core/useSchemaRenderer/utils/get-validate.js +62 -0
  197. package/build/esm/lib/unstable/core/useSchemaRenderer/utils/index.d.ts +2 -0
  198. package/build/esm/lib/unstable/core/useSchemaRenderer/utils/index.js +2 -0
  199. package/build/esm/lib/unstable/core/useSchemaRenderer/utils/process-ajv-error.d.ts +10 -0
  200. package/build/esm/lib/unstable/core/useSchemaRenderer/utils/process-ajv-error.js +46 -0
  201. package/build/esm/lib/unstable/core/useSchemaRenderer/utils/process-ajv-validate-errors.d.ts +20 -0
  202. package/build/esm/lib/unstable/core/useSchemaRenderer/utils/process-ajv-validate-errors.js +39 -0
  203. package/build/esm/lib/unstable/core/useSchemaRenderer/utils/process-entity-parameters-error.d.ts +15 -0
  204. package/build/esm/lib/unstable/core/useSchemaRenderer/utils/process-entity-parameters-error.js +31 -0
  205. package/build/esm/lib/unstable/core/useSchemaRenderer/utils/process-errors-state.d.ts +12 -0
  206. package/build/esm/lib/unstable/core/useSchemaRenderer/utils/process-errors-state.js +12 -0
  207. package/build/esm/lib/unstable/core/utils/common.d.ts +49 -0
  208. package/build/esm/lib/unstable/core/utils/common.js +165 -0
  209. package/build/esm/lib/unstable/core/utils/index.d.ts +1 -0
  210. package/build/esm/lib/unstable/core/utils/index.js +1 -0
  211. package/build/esm/lib/unstable/kit/Accordeon.d.ts +3 -0
  212. package/build/esm/lib/unstable/kit/Accordeon.js +26 -0
  213. package/build/esm/lib/unstable/kit/Any.d.ts +2 -0
  214. package/build/esm/lib/unstable/kit/Any.js +16 -0
  215. package/build/esm/lib/unstable/kit/ArrayBase.css +23 -0
  216. package/build/esm/lib/unstable/kit/ArrayBase.d.ts +3 -0
  217. package/build/esm/lib/unstable/kit/ArrayBase.js +97 -0
  218. package/build/esm/lib/unstable/kit/MultiSelect.css +6 -0
  219. package/build/esm/lib/unstable/kit/MultiSelect.d.ts +7 -0
  220. package/build/esm/lib/unstable/kit/MultiSelect.js +62 -0
  221. package/build/esm/lib/unstable/kit/ObjectBase.css +10 -0
  222. package/build/esm/lib/unstable/kit/ObjectBase.d.ts +8 -0
  223. package/build/esm/lib/unstable/kit/ObjectBase.js +66 -0
  224. package/build/esm/lib/unstable/kit/Row.css +73 -0
  225. package/build/esm/lib/unstable/kit/Row.d.ts +11 -0
  226. package/build/esm/lib/unstable/kit/Row.js +47 -0
  227. package/build/esm/lib/unstable/kit/Text.d.ts +6 -0
  228. package/build/esm/lib/unstable/kit/Text.js +255 -0
  229. package/build/esm/lib/unstable/kit/components/ArrayRemoveButton/ArrayRemoveButton.d.ts +5 -0
  230. package/build/esm/lib/unstable/kit/components/ArrayRemoveButton/ArrayRemoveButton.js +24 -0
  231. package/build/esm/lib/unstable/kit/components/ArrayRemoveButton/index.d.ts +1 -0
  232. package/build/esm/lib/unstable/kit/components/ArrayRemoveButton/index.js +1 -0
  233. package/build/esm/lib/unstable/kit/components/ControlError/ControlError.css +33 -0
  234. package/build/esm/lib/unstable/kit/components/ControlError/ControlError.d.ts +9 -0
  235. package/build/esm/lib/unstable/kit/components/ControlError/ControlError.js +11 -0
  236. package/build/esm/lib/unstable/kit/components/ControlError/index.d.ts +1 -0
  237. package/build/esm/lib/unstable/kit/components/ControlError/index.js +1 -0
  238. package/build/esm/lib/unstable/kit/components/HTMLContent/HTMLContent.d.ts +6 -0
  239. package/build/esm/lib/unstable/kit/components/HTMLContent/HTMLContent.js +7 -0
  240. package/build/esm/lib/unstable/kit/components/HTMLContent/index.d.ts +1 -0
  241. package/build/esm/lib/unstable/kit/components/HTMLContent/index.js +1 -0
  242. package/build/esm/lib/unstable/kit/components/index.d.ts +3 -0
  243. package/build/esm/lib/unstable/kit/components/index.js +3 -0
  244. package/build/esm/lib/unstable/kit/config.d.ts +95 -0
  245. package/build/esm/lib/unstable/kit/config.js +65 -0
  246. package/build/esm/lib/unstable/kit/constants/config.d.ts +112 -0
  247. package/build/esm/lib/unstable/kit/constants/config.js +59 -0
  248. package/build/esm/lib/unstable/kit/constants/index.d.ts +1 -0
  249. package/build/esm/lib/unstable/kit/constants/index.js +1 -0
  250. package/build/esm/lib/unstable/kit/controls/ArrayBase/ArrayBase.d.ts +8 -0
  251. package/build/esm/lib/unstable/kit/controls/ArrayBase/ArrayBase.js +42 -0
  252. package/build/esm/lib/unstable/kit/controls/ArrayBase/index.d.ts +1 -0
  253. package/build/esm/lib/unstable/kit/controls/ArrayBase/index.js +1 -0
  254. package/build/esm/lib/unstable/kit/controls/Checkbox/Checkbox.css +5 -0
  255. package/build/esm/lib/unstable/kit/controls/Checkbox/Checkbox.d.ts +7 -0
  256. package/build/esm/lib/unstable/kit/controls/Checkbox/Checkbox.js +13 -0
  257. package/build/esm/lib/unstable/kit/controls/Checkbox/index.d.ts +1 -0
  258. package/build/esm/lib/unstable/kit/controls/Checkbox/index.js +1 -0
  259. package/build/esm/lib/unstable/kit/controls/CheckboxGroup/CheckboxGroup.css +3 -0
  260. package/build/esm/lib/unstable/kit/controls/CheckboxGroup/CheckboxGroup.d.ts +10 -0
  261. package/build/esm/lib/unstable/kit/controls/CheckboxGroup/CheckboxGroup.js +34 -0
  262. package/build/esm/lib/unstable/kit/controls/CheckboxGroup/index.d.ts +1 -0
  263. package/build/esm/lib/unstable/kit/controls/CheckboxGroup/index.js +1 -0
  264. package/build/esm/lib/unstable/kit/controls/ColorPicker/ColorPicker.d.ts +6 -0
  265. package/build/esm/lib/unstable/kit/controls/ColorPicker/ColorPicker.js +21 -0
  266. package/build/esm/lib/unstable/kit/controls/ColorPicker/index.d.ts +1 -0
  267. package/build/esm/lib/unstable/kit/controls/ColorPicker/index.js +1 -0
  268. package/build/esm/lib/unstable/kit/controls/DateInput/DateInput.css +3 -0
  269. package/build/esm/lib/unstable/kit/controls/DateInput/DateInput.d.ts +9 -0
  270. package/build/esm/lib/unstable/kit/controls/DateInput/DateInput.js +53 -0
  271. package/build/esm/lib/unstable/kit/controls/DateInput/index.d.ts +1 -0
  272. package/build/esm/lib/unstable/kit/controls/DateInput/index.js +1 -0
  273. package/build/esm/lib/unstable/kit/controls/MultiSelect/MultiSelect.d.ts +8 -0
  274. package/build/esm/lib/unstable/kit/controls/MultiSelect/MultiSelect.js +32 -0
  275. package/build/esm/lib/unstable/kit/controls/MultiSelect/index.d.ts +1 -0
  276. package/build/esm/lib/unstable/kit/controls/MultiSelect/index.js +1 -0
  277. package/build/esm/lib/unstable/kit/controls/NumberBase/Number.d.ts +6 -0
  278. package/build/esm/lib/unstable/kit/controls/NumberBase/Number.js +8 -0
  279. package/build/esm/lib/unstable/kit/controls/NumberBase/index.d.ts +1 -0
  280. package/build/esm/lib/unstable/kit/controls/NumberBase/index.js +1 -0
  281. package/build/esm/lib/unstable/kit/controls/ObjectBase/ObjectBase.d.ts +8 -0
  282. package/build/esm/lib/unstable/kit/controls/ObjectBase/ObjectBase.js +29 -0
  283. package/build/esm/lib/unstable/kit/controls/ObjectBase/index.d.ts +1 -0
  284. package/build/esm/lib/unstable/kit/controls/ObjectBase/index.js +1 -0
  285. package/build/esm/lib/unstable/kit/controls/Password/Password.d.ts +6 -0
  286. package/build/esm/lib/unstable/kit/controls/Password/Password.js +8 -0
  287. package/build/esm/lib/unstable/kit/controls/Password/index.d.ts +1 -0
  288. package/build/esm/lib/unstable/kit/controls/Password/index.js +1 -0
  289. package/build/esm/lib/unstable/kit/controls/RadioGroup/RadioGroup.css +3 -0
  290. package/build/esm/lib/unstable/kit/controls/RadioGroup/RadioGroup.d.ts +9 -0
  291. package/build/esm/lib/unstable/kit/controls/RadioGroup/RadioGroup.js +22 -0
  292. package/build/esm/lib/unstable/kit/controls/RadioGroup/index.d.ts +1 -0
  293. package/build/esm/lib/unstable/kit/controls/RadioGroup/index.js +1 -0
  294. package/build/esm/lib/unstable/kit/controls/RangeSlider/RangeSlider.css +3 -0
  295. package/build/esm/lib/unstable/kit/controls/RangeSlider/RangeSlider.d.ts +8 -0
  296. package/build/esm/lib/unstable/kit/controls/RangeSlider/RangeSlider.js +31 -0
  297. package/build/esm/lib/unstable/kit/controls/RangeSlider/index.d.ts +1 -0
  298. package/build/esm/lib/unstable/kit/controls/RangeSlider/index.js +1 -0
  299. package/build/esm/lib/unstable/kit/controls/Select/Select.d.ts +9 -0
  300. package/build/esm/lib/unstable/kit/controls/Select/Select.js +29 -0
  301. package/build/esm/lib/unstable/kit/controls/Select/index.d.ts +1 -0
  302. package/build/esm/lib/unstable/kit/controls/Select/index.js +1 -0
  303. package/build/esm/lib/unstable/kit/controls/Slider/Slider.css +3 -0
  304. package/build/esm/lib/unstable/kit/controls/Slider/Slider.d.ts +7 -0
  305. package/build/esm/lib/unstable/kit/controls/Slider/Slider.js +16 -0
  306. package/build/esm/lib/unstable/kit/controls/Slider/index.d.ts +1 -0
  307. package/build/esm/lib/unstable/kit/controls/Slider/index.js +1 -0
  308. package/build/esm/lib/unstable/kit/controls/StringBase/StringBase.d.ts +6 -0
  309. package/build/esm/lib/unstable/kit/controls/StringBase/StringBase.js +8 -0
  310. package/build/esm/lib/unstable/kit/controls/StringBase/index.d.ts +1 -0
  311. package/build/esm/lib/unstable/kit/controls/StringBase/index.js +1 -0
  312. package/build/esm/lib/unstable/kit/controls/Switch/Switch.css +5 -0
  313. package/build/esm/lib/unstable/kit/controls/Switch/Switch.d.ts +7 -0
  314. package/build/esm/lib/unstable/kit/controls/Switch/Switch.js +13 -0
  315. package/build/esm/lib/unstable/kit/controls/Switch/index.d.ts +1 -0
  316. package/build/esm/lib/unstable/kit/controls/Switch/index.js +1 -0
  317. package/build/esm/lib/unstable/kit/controls/TextArea/TextArea.d.ts +6 -0
  318. package/build/esm/lib/unstable/kit/controls/TextArea/TextArea.js +8 -0
  319. package/build/esm/lib/unstable/kit/controls/TextArea/index.d.ts +1 -0
  320. package/build/esm/lib/unstable/kit/controls/TextArea/index.js +1 -0
  321. package/build/esm/lib/unstable/kit/controls/index.d.ts +16 -0
  322. package/build/esm/lib/unstable/kit/controls/index.js +16 -0
  323. package/build/esm/lib/unstable/kit/styles/functions.css +0 -0
  324. package/build/esm/lib/unstable/kit/styles/variables.css +0 -0
  325. package/build/esm/lib/unstable/kit/utils/cn.d.ts +1 -0
  326. package/build/esm/lib/unstable/kit/utils/cn.js +3 -0
  327. package/build/esm/lib/unstable/kit/utils/common.d.ts +7 -0
  328. package/build/esm/lib/unstable/kit/utils/common.js +19 -0
  329. package/build/esm/lib/unstable/kit/utils/index.d.ts +2 -0
  330. package/build/esm/lib/unstable/kit/utils/index.js +2 -0
  331. package/build/esm/lib/unstable/kit/wrappers/Row/Row.css +27 -0
  332. package/build/esm/lib/unstable/kit/wrappers/Row/Row.d.ts +7 -0
  333. package/build/esm/lib/unstable/kit/wrappers/Row/Row.js +31 -0
  334. package/build/esm/lib/unstable/kit/wrappers/Row/index.d.ts +1 -0
  335. package/build/esm/lib/unstable/kit/wrappers/Row/index.js +1 -0
  336. package/build/esm/lib/unstable/kit/wrappers/Transparent/Transparent.css +6 -0
  337. package/build/esm/lib/unstable/kit/wrappers/Transparent/Transparent.d.ts +4 -0
  338. package/build/esm/lib/unstable/kit/wrappers/Transparent/Transparent.js +12 -0
  339. package/build/esm/lib/unstable/kit/wrappers/Transparent/index.d.ts +1 -0
  340. package/build/esm/lib/unstable/kit/wrappers/Transparent/index.js +1 -0
  341. package/build/esm/lib/unstable/kit/wrappers/index.d.ts +2 -0
  342. package/build/esm/lib/unstable/kit/wrappers/index.js +2 -0
  343. package/build/esm/unstable.d.ts +4 -0
  344. package/build/esm/unstable.js +4 -0
  345. package/package.json +24 -2
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,39 @@
1
+ import type { SchemaToValueType } from './helpers';
2
+ import type { JsonSchema } from './schema';
3
+ import type { ObjectValue } from './values';
4
+ type ArrayError = SyncValidateError[];
5
+ interface ObjectError extends Record<string, SyncValidateError> {
6
+ }
7
+ export type SyncValidateError = ArrayError | boolean | string | ObjectError | undefined;
8
+ export type AsyncValidateError = Promise<SyncValidateError>;
9
+ export type SyncValidator<Schema extends JsonSchema> = (value: SchemaToValueType<Schema> | null | undefined, allValues: ObjectValue) => SyncValidateError;
10
+ export type AsyncValidator<Schema extends JsonSchema> = (value: SchemaToValueType<Schema> | null | undefined, allValues: ObjectValue) => AsyncValidateError;
11
+ export type Validator<Schema extends JsonSchema> = SyncValidator<Schema> | AsyncValidator<Schema>;
12
+ export interface ErrorMessages {
13
+ additionalItems?: string;
14
+ additionalProperties?: string;
15
+ anyOf?: string;
16
+ const?: string;
17
+ contains?: string;
18
+ dependencies?: string;
19
+ enum?: string;
20
+ exclusiveMaximum?: string;
21
+ exclusiveMinimum?: string;
22
+ maxItems?: string;
23
+ maxLength?: string;
24
+ maxProperties?: string;
25
+ maximum?: string;
26
+ minItems?: string;
27
+ minLength?: string;
28
+ minProperties?: string;
29
+ minimum?: string;
30
+ multipleOf?: string;
31
+ not?: string;
32
+ oneOf?: string;
33
+ pattern?: string;
34
+ propertyNames?: string;
35
+ required?: string;
36
+ type?: string;
37
+ uniqueItems?: string;
38
+ }
39
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,4 @@
1
+ export type ArrayValue = FieldValue[];
2
+ export interface ObjectValue extends Record<string, FieldValue> {
3
+ }
4
+ export type FieldValue = number | boolean | string | ArrayValue | ObjectValue | null | undefined;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export declare const ENTITY_SERVICE_FIELD = "ENTITY_SERVICE_FIELD";
@@ -0,0 +1 @@
1
+ export const ENTITY_SERVICE_FIELD = 'ENTITY_SERVICE_FIELD';
@@ -0,0 +1,2 @@
1
+ export { useEntitiesState } from './useEntitiesState';
2
+ export { useSchemaRendererMutators } from './useSchemaRendererMutators';
@@ -0,0 +1,2 @@
1
+ export { useEntitiesState } from './useEntitiesState';
2
+ export { useSchemaRendererMutators } from './useSchemaRendererMutators';
@@ -0,0 +1,7 @@
1
+ export declare const useEntitiesState: (name: string) => {
2
+ config: import("../..").SchemaRendererConfig | undefined;
3
+ error: import("../..").SyncValidateError;
4
+ headName: string | undefined;
5
+ mode: import("../..").SchemaRendererMode | undefined;
6
+ rootSchema: import("../..").JsonSchema | undefined;
7
+ };
@@ -0,0 +1,20 @@
1
+ import React from 'react';
2
+ import { useField, useForm } from 'react-final-form';
3
+ import { ENTITY_SERVICE_FIELD } from '../constants';
4
+ import { guessHeadName } from '../utils';
5
+ export const useEntitiesState = (name) => {
6
+ var _a;
7
+ const form = useForm();
8
+ const headName = React.useMemo(() => guessHeadName(form.getRegisteredFields(), name), [form, name]);
9
+ const field = useField(`${ENTITY_SERVICE_FIELD}.${headName}`, { subscription: { data: true } });
10
+ const { config, errorsRef, mode, schema: rootSchema } = (field.meta.data || {});
11
+ const error = (_a = errorsRef === null || errorsRef === void 0 ? void 0 : errorsRef.current) === null || _a === void 0 ? void 0 : _a[name];
12
+ const state = React.useMemo(() => ({
13
+ config,
14
+ error,
15
+ headName,
16
+ mode,
17
+ rootSchema,
18
+ }), [config, error, headName, mode, rootSchema]);
19
+ return state;
20
+ };
@@ -0,0 +1,10 @@
1
+ import type { RemoveExternalErrorsMutator, RemoveSchemaMutatorsMutator, SetAsyncValidationCacheMutator, SetAsyncValidationWaitersMutator, SetExternalErrorsMutator, SetSchemaMutatorsMutator, TriggerFieldsMutator } from '../mutators';
2
+ export declare const useSchemaRendererMutators: () => {
3
+ removeExternalErrors: RemoveExternalErrorsMutator | undefined;
4
+ removeSchemaMutators: RemoveSchemaMutatorsMutator | undefined;
5
+ setAsyncValidationCache: SetAsyncValidationCacheMutator | undefined;
6
+ setAsyncValidationWaiters: SetAsyncValidationWaitersMutator | undefined;
7
+ setExternalErrors: SetExternalErrorsMutator | undefined;
8
+ setSchemaMutators: SetSchemaMutatorsMutator | undefined;
9
+ triggerFields: TriggerFieldsMutator | undefined;
10
+ };
@@ -0,0 +1,13 @@
1
+ import { useForm } from 'react-final-form';
2
+ export const useSchemaRendererMutators = () => {
3
+ const { removeExternalErrors, removeSchemaMutators, setAsyncValidationCache, setAsyncValidationWaiters, setExternalErrors, setSchemaMutators, triggerFields, } = useForm().mutators;
4
+ return {
5
+ removeExternalErrors,
6
+ removeSchemaMutators,
7
+ setAsyncValidationCache,
8
+ setAsyncValidationWaiters,
9
+ setExternalErrors,
10
+ setSchemaMutators,
11
+ triggerFields,
12
+ };
13
+ };
@@ -0,0 +1,3 @@
1
+ export { useEntitiesState, useSchemaRendererMutators } from './hooks';
2
+ export { schemaRendererMutators } from './mutators';
3
+ export { type UseSchemaRendererParams, type UseSchemaRendererReturn, useSchemaRenderer, } from './useSchemaRenderer';
@@ -0,0 +1,3 @@
1
+ export { useEntitiesState, useSchemaRendererMutators } from './hooks';
2
+ export { schemaRendererMutators } from './mutators';
3
+ export { useSchemaRenderer, } from './useSchemaRenderer';
@@ -0,0 +1,3 @@
1
+ import type { SetAsyncValidationCacheFunction, SetAsyncValidationWaitersFunction } from './types';
2
+ export declare const setAsyncValidationWaiters: SetAsyncValidationWaitersFunction;
3
+ export declare const setAsyncValidationCache: SetAsyncValidationCacheFunction;
@@ -0,0 +1,29 @@
1
+ import isEqual from 'lodash/isEqual';
2
+ import omit from 'lodash/omit';
3
+ export const setAsyncValidationWaiters = ([{ headName, waiters }], mutableState) => {
4
+ const field = mutableState.fields[headName];
5
+ if (field && waiters) {
6
+ Object.keys(waiters).forEach((waiterName) => {
7
+ field.data = Object.assign(Object.assign({}, field.data), { waiters: Object.assign(Object.assign({}, field.data.waiters), { [waiterName]: waiters[waiterName] }) });
8
+ const waiterField = mutableState.fields[waiterName];
9
+ if (waiterField) {
10
+ waiterField.validating = true;
11
+ }
12
+ });
13
+ }
14
+ };
15
+ export const setAsyncValidationCache = ([{ headName, cache }], mutableState) => {
16
+ const field = mutableState.fields[headName];
17
+ if (field && cache) {
18
+ Object.keys(cache).forEach((cacheName) => {
19
+ var _a, _b;
20
+ field.data = Object.assign(Object.assign({}, field.data), { cache: Object.assign(Object.assign({}, field.data.cache), { [cacheName]: [...(((_a = field.data.cache) === null || _a === void 0 ? void 0 : _a[cacheName]) || []), cache[cacheName]] }) });
21
+ const cacheField = mutableState.fields[cacheName];
22
+ const waiter = (_b = field.data.waiters) === null || _b === void 0 ? void 0 : _b[cacheName];
23
+ if (cacheField && waiter && isEqual(waiter, omit(cache[cacheName], 'result'))) {
24
+ field.data.waiters = omit(field.data.waiters, cacheName);
25
+ cacheField.validating = false;
26
+ }
27
+ });
28
+ }
29
+ };
@@ -0,0 +1,2 @@
1
+ export * from './async-validation';
2
+ export * from './types';
@@ -0,0 +1,2 @@
1
+ export * from './async-validation';
2
+ export * from './types';
@@ -0,0 +1,34 @@
1
+ import type { MutableState, Tools } from 'final-form';
2
+ import type { FieldValue, JsonSchema, SyncValidateError, Validator } from '../../../types';
3
+ export interface AsyncValidationWaiter {
4
+ schema: JsonSchema;
5
+ validator: Validator<JsonSchema>;
6
+ value: FieldValue;
7
+ }
8
+ export interface AsyncValidationCache extends AsyncValidationWaiter {
9
+ result: SyncValidateError;
10
+ }
11
+ export interface AsyncValidationState {
12
+ cache?: {
13
+ [key: string]: AsyncValidationCache[] | undefined;
14
+ };
15
+ waiters?: {
16
+ [key: string]: AsyncValidationWaiter | undefined;
17
+ };
18
+ }
19
+ export interface SetAsyncValidationWaitersParams {
20
+ headName: string;
21
+ waiters: {
22
+ [key: string]: AsyncValidationWaiter;
23
+ };
24
+ }
25
+ export type SetAsyncValidationWaitersFunction<FormValues = object, InitialFormValues = Partial<FormValues>> = (args: [SetAsyncValidationWaitersParams], state: MutableState<FormValues, InitialFormValues>, tools: Tools<FormValues, InitialFormValues>) => void;
26
+ export type SetAsyncValidationWaitersMutator = (params: SetAsyncValidationWaitersParams) => void;
27
+ export interface SetAsyncValidationCacheParams {
28
+ cache: {
29
+ [key: string]: AsyncValidationCache;
30
+ };
31
+ headName: string;
32
+ }
33
+ export type SetAsyncValidationCacheFunction<FormValues = object, InitialFormValues = Partial<FormValues>> = (args: [SetAsyncValidationCacheParams], state: MutableState<FormValues, InitialFormValues>, tools: Tools<FormValues, InitialFormValues>) => void;
34
+ export type SetAsyncValidationCacheMutator = (params: SetAsyncValidationCacheParams) => void;
@@ -0,0 +1,3 @@
1
+ import type { RemoveExternalErrorsFunction, SetExternalErrorsFunction } from './types';
2
+ export declare const setExternalErrors: SetExternalErrorsFunction;
3
+ export declare const removeExternalErrors: RemoveExternalErrorsFunction;
@@ -0,0 +1,54 @@
1
+ import omit from 'lodash/omit';
2
+ import { ENTITY_SERVICE_FIELD } from '../../constants';
3
+ import { guessHeadName } from '../../utils';
4
+ export const setExternalErrors = ([{ priorityErrors, regularErrors }], mutableState) => {
5
+ const registeredFields = Object.keys(mutableState.fields);
6
+ Object.entries(priorityErrors || {}).forEach(([key, value]) => {
7
+ const headName = guessHeadName(registeredFields, key);
8
+ if (headName) {
9
+ const field = mutableState.fields[headName];
10
+ if (field) {
11
+ field.data = Object.assign(Object.assign({}, field.data), { priorityErrors: Object.assign(Object.assign({}, field.data.priorityErrors), { [key]: value }) });
12
+ }
13
+ }
14
+ });
15
+ Object.entries(regularErrors || {}).forEach(([key, value]) => {
16
+ const headName = guessHeadName(registeredFields, key);
17
+ if (headName) {
18
+ const field = mutableState.fields[headName];
19
+ if (field) {
20
+ field.data = Object.assign(Object.assign({}, field.data), { regularErrors: Object.assign(Object.assign({}, field.data.regularErrors), { [key]: value }) });
21
+ }
22
+ }
23
+ });
24
+ };
25
+ export const removeExternalErrors = ([{ removeFunctionOrNames }], mutableState) => {
26
+ const registeredFields = Object.keys(mutableState.fields);
27
+ if (Array.isArray(removeFunctionOrNames)) {
28
+ removeFunctionOrNames.forEach((name) => {
29
+ const headName = guessHeadName(registeredFields, name);
30
+ if (headName) {
31
+ const field = mutableState.fields[headName];
32
+ if (field) {
33
+ field.data = Object.assign(Object.assign({}, field.data), { priorityErrors: omit(Object.assign({}, field.data.priorityErrors), name), regularErrors: omit(Object.assign({}, field.data.regularErrors), name) });
34
+ }
35
+ }
36
+ });
37
+ }
38
+ else {
39
+ registeredFields.forEach((fieldName) => {
40
+ if (fieldName.startsWith(ENTITY_SERVICE_FIELD)) {
41
+ const headName = fieldName.slice(`${ENTITY_SERVICE_FIELD}.`.length);
42
+ const field = mutableState.fields[headName];
43
+ if (field) {
44
+ const { priorityErrors, regularErrors } = removeFunctionOrNames(headName, {
45
+ priorityErrors: field.data.priorityErrors,
46
+ regularErrors: field.data.regularErrors,
47
+ });
48
+ field.data = Object.assign(Object.assign({}, field.data), { priorityErrors,
49
+ regularErrors });
50
+ }
51
+ }
52
+ });
53
+ }
54
+ };
@@ -0,0 +1,2 @@
1
+ export * from './external-errors';
2
+ export * from './types';
@@ -0,0 +1,2 @@
1
+ export * from './external-errors';
2
+ export * from './types';
@@ -0,0 +1,25 @@
1
+ import type { MutableState, Tools } from 'final-form';
2
+ import type { SyncValidateError } from '../../../types';
3
+ export interface ExternalErrorsState {
4
+ priorityErrors?: {
5
+ [key: string]: SyncValidateError;
6
+ };
7
+ regularErrors?: {
8
+ [key: string]: SyncValidateError;
9
+ };
10
+ }
11
+ export interface SetExternalErrorsParams {
12
+ priorityErrors?: {
13
+ [key: string]: SyncValidateError;
14
+ };
15
+ regularErrors?: {
16
+ [key: string]: SyncValidateError;
17
+ };
18
+ }
19
+ export type SetExternalErrorsFunction<FormValues = object, InitialFormValues = Partial<FormValues>> = (args: [SetExternalErrorsParams], state: MutableState<FormValues, InitialFormValues>, tools: Tools<FormValues, InitialFormValues>) => void;
20
+ export type SetExternalErrorsMutator = (params: SetExternalErrorsParams) => void;
21
+ export interface RemoveExternalErrorsParams {
22
+ removeFunctionOrNames: string[] | ((headName: string, state: ExternalErrorsState) => ExternalErrorsState);
23
+ }
24
+ export type RemoveExternalErrorsFunction<FormValues = object, InitialFormValues = Partial<FormValues>> = (args: [RemoveExternalErrorsParams], state: MutableState<FormValues, InitialFormValues>, tools: Tools<FormValues, InitialFormValues>) => void;
25
+ export type RemoveExternalErrorsMutator = (params: RemoveExternalErrorsParams) => void;
@@ -0,0 +1,13 @@
1
+ export type * from './async-validation';
2
+ export type * from './external-errors';
3
+ export type * from './schema-mutators';
4
+ export type * from './trigger-fields';
5
+ export declare const schemaRendererMutators: {
6
+ removeExternalErrors: import("./external-errors").RemoveExternalErrorsFunction;
7
+ removeSchemaMutators: import("./schema-mutators").RemoveSchemaMutatorsFunction;
8
+ setAsyncValidationCache: import("./async-validation").SetAsyncValidationCacheFunction;
9
+ setAsyncValidationWaiters: import("./async-validation").SetAsyncValidationWaitersFunction;
10
+ setExternalErrors: import("./external-errors").SetExternalErrorsFunction;
11
+ setSchemaMutators: import("./schema-mutators").SetSchemaMutatorsFunction;
12
+ triggerFields: import("./trigger-fields").TriggerFieldsFunction;
13
+ };
@@ -0,0 +1,13 @@
1
+ import { setAsyncValidationCache, setAsyncValidationWaiters } from './async-validation';
2
+ import { removeExternalErrors, setExternalErrors } from './external-errors';
3
+ import { removeSchemaMutators, setSchemaMutators } from './schema-mutators';
4
+ import { triggerFields } from './trigger-fields';
5
+ export const schemaRendererMutators = {
6
+ removeExternalErrors,
7
+ removeSchemaMutators,
8
+ setAsyncValidationCache,
9
+ setAsyncValidationWaiters,
10
+ setExternalErrors,
11
+ setSchemaMutators,
12
+ triggerFields,
13
+ };
@@ -0,0 +1,2 @@
1
+ export * from './schema-mutators';
2
+ export * from './types';
@@ -0,0 +1,2 @@
1
+ export * from './schema-mutators';
2
+ export * from './types';
@@ -0,0 +1,3 @@
1
+ import type { RemoveSchemaMutatorsFunction, SetSchemaMutatorsFunction } from './types';
2
+ export declare const setSchemaMutators: SetSchemaMutatorsFunction;
3
+ export declare const removeSchemaMutators: RemoveSchemaMutatorsFunction;
@@ -0,0 +1,75 @@
1
+ import cloneDeep from 'lodash/cloneDeep';
2
+ import get from 'lodash/get';
3
+ import isEqual from 'lodash/isEqual';
4
+ import { getSchemaPath, getValuePaths, parseSchemaPath, smartSet } from '../../../utils';
5
+ import { guessHeadName } from '../../utils';
6
+ const applyMutators = ({ mutableState, mutators, }) => {
7
+ const registeredFields = Object.keys(mutableState.fields);
8
+ mutators.forEach((m) => {
9
+ const headName = guessHeadName(registeredFields, m.name);
10
+ if (headName) {
11
+ const headField = mutableState.fields[headName];
12
+ const data = headField === null || headField === void 0 ? void 0 : headField.data;
13
+ const mutatedSchema = data === null || data === void 0 ? void 0 : data.schema;
14
+ if (mutatedSchema) {
15
+ const schemaPath = getSchemaPath(m.name, headName, mutatedSchema);
16
+ if (schemaPath) {
17
+ smartSet(mutatedSchema, schemaPath, m.schema);
18
+ const schemaField = mutableState.fields[m.name];
19
+ if (schemaField) {
20
+ schemaField.data = Object.assign(Object.assign({}, schemaField.data), { schema: get(mutatedSchema, schemaPath) });
21
+ }
22
+ headField.data.mutators = [...((data === null || data === void 0 ? void 0 : data.mutators) || []), m];
23
+ headField.data.schema = mutatedSchema;
24
+ const mutatedPaths = getValuePaths(m.schema).map((path) => [
25
+ ...schemaPath,
26
+ ...path,
27
+ ]);
28
+ Object.values(mutableState.fields).forEach((field) => {
29
+ var _a;
30
+ const data = field === null || field === void 0 ? void 0 : field.data;
31
+ if (((_a = data === null || data === void 0 ? void 0 : data.schema) === null || _a === void 0 ? void 0 : _a.$ref) && (data === null || data === void 0 ? void 0 : data.headName) === headName) {
32
+ const refPath = parseSchemaPath(data.schema.$ref);
33
+ const mutationAffectRefSchema = mutatedPaths.some((mutatedPath) => refPath.every((subpath, index) => mutatedPath[index] === subpath));
34
+ const fieldSchemaPath = getSchemaPath(field.name, headName, mutatedSchema);
35
+ if (mutationAffectRefSchema && fieldSchemaPath) {
36
+ field.data = Object.assign(Object.assign({}, field.data), { schema: Object.assign({}, get(mutatedSchema, fieldSchemaPath)) });
37
+ }
38
+ }
39
+ });
40
+ }
41
+ }
42
+ }
43
+ });
44
+ };
45
+ export const setSchemaMutators = ([{ mutators }], mutableState) => {
46
+ applyMutators({ mutableState, mutators });
47
+ };
48
+ export const removeSchemaMutators = ([{ mutatorsToRemove }], mutableState) => {
49
+ const registeredFields = Object.keys(mutableState.fields);
50
+ [...new Set(mutatorsToRemove.map((m) => guessHeadName(registeredFields, m.name)))].forEach((name) => {
51
+ if (name) {
52
+ const headField = mutableState.fields[name];
53
+ const data = headField === null || headField === void 0 ? void 0 : headField.data;
54
+ const originalSchema = data === null || data === void 0 ? void 0 : data.originalSchema;
55
+ const mutators = (data === null || data === void 0 ? void 0 : data.mutators) || [];
56
+ if (headField && originalSchema) {
57
+ applyMutators({
58
+ mutableState,
59
+ mutators: mutators.map((m) => {
60
+ const schemaPath = getSchemaPath(m.name, name, originalSchema);
61
+ return Object.assign(Object.assign({}, m), { schema: schemaPath
62
+ ? cloneDeep(get(originalSchema, schemaPath))
63
+ : {} });
64
+ }),
65
+ });
66
+ headField.data.mutators = [];
67
+ applyMutators({
68
+ mutableState,
69
+ mutators: mutators.filter((m) => !mutatorsToRemove.some(({ name, schema }) => name === m.name &&
70
+ (isEqual(m.schema, schema) || schema === true))),
71
+ });
72
+ }
73
+ }
74
+ });
75
+ };
@@ -0,0 +1,26 @@
1
+ import type { MutableState, Tools } from 'final-form';
2
+ import type { JsonSchema } from '../../../types';
3
+ export interface SchemaMutatorsState {
4
+ mutators?: {
5
+ name: string;
6
+ schema: JsonSchema;
7
+ }[];
8
+ originalSchema?: JsonSchema;
9
+ schema?: JsonSchema;
10
+ }
11
+ export interface SetSchemaMutatorsParams {
12
+ mutators: {
13
+ name: string;
14
+ schema: JsonSchema;
15
+ }[];
16
+ }
17
+ export type SetSchemaMutatorsFunction<FormValues = object, InitialFormValues = Partial<FormValues>> = (args: [SetSchemaMutatorsParams], state: MutableState<FormValues, InitialFormValues>, tools: Tools<FormValues, InitialFormValues>) => void;
18
+ export type SetSchemaMutatorsMutator = (params: SetSchemaMutatorsParams) => void;
19
+ export interface RemoveSchemaMutatorsParams {
20
+ mutatorsToRemove: {
21
+ name: string;
22
+ schema: JsonSchema | true;
23
+ }[];
24
+ }
25
+ export type RemoveSchemaMutatorsFunction<FormValues = object, InitialFormValues = Partial<FormValues>> = (args: [RemoveSchemaMutatorsParams], state: MutableState<FormValues, InitialFormValues>, tools: Tools<FormValues, InitialFormValues>) => void;
26
+ export type RemoveSchemaMutatorsMutator = (params: RemoveSchemaMutatorsParams) => void;
@@ -0,0 +1,2 @@
1
+ export * from './trigger-fields';
2
+ export * from './types';
@@ -0,0 +1,2 @@
1
+ export * from './trigger-fields';
2
+ export * from './types';
@@ -0,0 +1,2 @@
1
+ import type { TriggerFieldsFunction } from './types';
2
+ export declare const triggerFields: TriggerFieldsFunction;
@@ -0,0 +1,8 @@
1
+ export const triggerFields = ([{ fields }], mutableState) => {
2
+ fields.forEach((fieldName) => {
3
+ const field = mutableState.fields[fieldName];
4
+ if (field) {
5
+ field.data = Object.assign(Object.assign({}, field.data), { count: (field.data.count || 0) + 1 });
6
+ }
7
+ });
8
+ };
@@ -0,0 +1,6 @@
1
+ import type { MutableState, Tools } from 'final-form';
2
+ export interface TriggerFieldsParams {
3
+ fields: string[];
4
+ }
5
+ export type TriggerFieldsFunction<FormValues = object, InitialFormValues = Partial<FormValues>> = (args: [TriggerFieldsParams], state: MutableState<FormValues, InitialFormValues>, tools: Tools<FormValues, InitialFormValues>) => void;
6
+ export type TriggerFieldsMutator = (params: TriggerFieldsParams) => void;
@@ -0,0 +1,22 @@
1
+ import type { ErrorObject } from 'ajv';
2
+ import type { SchemaRendererMode } from '../constants';
3
+ import type { FieldValue, JsonSchema, SchemaRendererConfig, SyncValidateError, Validator } from '../types';
4
+ import type { AsyncValidationState, ExternalErrorsState, SchemaMutatorsState } from './mutators';
5
+ export type EntityParametersError = ErrorObject<'entityParameters', {
6
+ schema: JsonSchema;
7
+ validator: Validator<JsonSchema>;
8
+ value: FieldValue;
9
+ }>;
10
+ export interface ValidateErrorItem {
11
+ error: SyncValidateError;
12
+ path: string[];
13
+ }
14
+ export interface EntitiesState {
15
+ config?: SchemaRendererConfig;
16
+ errorsRef?: React.RefObject<Record<string, SyncValidateError>>;
17
+ headName?: string;
18
+ mode?: SchemaRendererMode;
19
+ schema?: SchemaMutatorsState['schema'];
20
+ }
21
+ export interface SchemaRendererState extends AsyncValidationState, ExternalErrorsState, SchemaMutatorsState {
22
+ }
@@ -0,0 +1,37 @@
1
+ import type { FieldValidator } from 'final-form';
2
+ import { type SchemaRendererMode } from '../constants';
3
+ import type { ErrorMessages, FieldValue, JsonSchema, SchemaRendererConfig } from '../types';
4
+ export interface UseSchemaRendererParams {
5
+ config: SchemaRendererConfig;
6
+ connectValidate?: boolean;
7
+ errorMessages?: ErrorMessages;
8
+ mode: SchemaRendererMode;
9
+ /**
10
+ * The `name` prop must be a non-empty string.
11
+ *
12
+ * In `final-form` and `react-final-form`, the `name` is used as a key to register
13
+ * the field within the form. If you pass an empty string (`name=""`), the field will
14
+ * not be registered, its value will not be tracked, and validation will not work.
15
+ *
16
+ * This can lead to:
17
+ * - the field being missing from the form `values`;
18
+ * - the `validate` function not being called;
19
+ * - no error or touched state updates;
20
+ * - inconsistent or broken form behavior.
21
+ *
22
+ * Always provide a unique, non-empty string for the field name.
23
+ */
24
+ name: string;
25
+ schema: JsonSchema;
26
+ }
27
+ export type UseSchemaRendererReturn = {
28
+ schema: JsonSchema | undefined;
29
+ validate: FieldValidator<FieldValue> | undefined;
30
+ };
31
+ export declare const useSchemaRenderer: ({ config, connectValidate, errorMessages, mode, name, schema: originalSchema, }: UseSchemaRendererParams) => {
32
+ schema: JsonSchema | undefined;
33
+ validate?: undefined;
34
+ } | {
35
+ schema: JsonSchema | undefined;
36
+ validate: (value?: FieldValue) => any;
37
+ };