@gravity-ui/page-constructor 8.5.0-alpha.2 → 8.5.0-alpha.5

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 (305) hide show
  1. package/build/cjs/blocks/ContentLayout/index_deprecated.d.ts +1 -1
  2. package/build/cjs/blocks/ExtendedFeatures/index_deprecated.d.ts +1 -1
  3. package/build/cjs/blocks/FilterBlock/index.d.ts +1 -1
  4. package/build/cjs/blocks/FilterBlock/index_deprecated.d.ts +1 -1
  5. package/build/cjs/blocks/Form/index.d.ts +1 -1
  6. package/build/cjs/blocks/Form/index_deprecated.d.ts +1 -1
  7. package/build/cjs/blocks/HeaderSlider/index.d.ts +1 -1
  8. package/build/cjs/blocks/HeaderSlider/index_deprecated.d.ts +1 -1
  9. package/build/cjs/blocks/Icons/index.d.ts +1 -1
  10. package/build/cjs/blocks/Icons/index_deprecated.d.ts +1 -1
  11. package/build/cjs/blocks/Info/index.d.ts +1 -1
  12. package/build/cjs/blocks/Info/index_deprecated.d.ts +1 -1
  13. package/build/cjs/blocks/Map/index.d.ts +1 -1
  14. package/build/cjs/blocks/Map/index_deprecated.d.ts +1 -1
  15. package/build/cjs/blocks/Media/index_deprecated.d.ts +1 -1
  16. package/build/cjs/blocks/PromoFeaturesBlock/index_deprecated.d.ts +1 -1
  17. package/build/cjs/blocks/Questions/index_deprecated.d.ts +1 -1
  18. package/build/cjs/blocks/Share/index.d.ts +1 -1
  19. package/build/cjs/blocks/Share/index_deprecated.d.ts +1 -1
  20. package/build/cjs/blocks/Slider/index.d.ts +1 -1
  21. package/build/cjs/blocks/Slider/index_deprecated.d.ts +1 -1
  22. package/build/cjs/blocks/Table/index.d.ts +1 -1
  23. package/build/cjs/blocks/Table/index_deprecated.d.ts +1 -1
  24. package/build/cjs/blocks/Tabs/index.d.ts +1 -1
  25. package/build/cjs/blocks/Tabs/index_deprecated.d.ts +1 -1
  26. package/build/cjs/form-builder-v2/CanvasContentContext.d.ts +18 -0
  27. package/build/cjs/form-builder-v2/CanvasContentContext.js +21 -0
  28. package/build/cjs/form-builder-v2/CanvasContentContext.js.map +1 -0
  29. package/build/cjs/form-builder-v2/FormBuilderV2.css +93 -0
  30. package/build/cjs/form-builder-v2/FormBuilderV2.d.ts +10 -0
  31. package/build/cjs/form-builder-v2/FormBuilderV2.js +123 -0
  32. package/build/cjs/form-builder-v2/FormBuilderV2.js.map +1 -0
  33. package/build/cjs/form-builder-v2/components/Canvas/Canvas.css +15 -0
  34. package/build/cjs/form-builder-v2/components/Canvas/Canvas.d.ts +8 -0
  35. package/build/cjs/form-builder-v2/components/Canvas/Canvas.js +17 -0
  36. package/build/cjs/form-builder-v2/components/Canvas/Canvas.js.map +1 -0
  37. package/build/cjs/form-builder-v2/components/CanvasCard/CanvasCard.css +133 -0
  38. package/build/cjs/form-builder-v2/components/CanvasCard/CanvasCard.d.ts +9 -0
  39. package/build/cjs/form-builder-v2/components/CanvasCard/CanvasCard.js +72 -0
  40. package/build/cjs/form-builder-v2/components/CanvasCard/CanvasCard.js.map +1 -0
  41. package/build/cjs/form-builder-v2/components/CanvasCard/components/FieldPreview.d.ts +6 -0
  42. package/build/cjs/form-builder-v2/components/CanvasCard/components/FieldPreview.js +44 -0
  43. package/build/cjs/form-builder-v2/components/CanvasCard/components/FieldPreview.js.map +1 -0
  44. package/build/cjs/form-builder-v2/components/CanvasCard/components/SectionChildrenDropZone.d.ts +9 -0
  45. package/build/cjs/form-builder-v2/components/CanvasCard/components/SectionChildrenDropZone.js +20 -0
  46. package/build/cjs/form-builder-v2/components/CanvasCard/components/SectionChildrenDropZone.js.map +1 -0
  47. package/build/cjs/form-builder-v2/components/ContentTab/ContentTab.css +22 -0
  48. package/build/cjs/form-builder-v2/components/ContentTab/ContentTab.d.ts +1 -0
  49. package/build/cjs/form-builder-v2/components/ContentTab/ContentTab.js +21 -0
  50. package/build/cjs/form-builder-v2/components/ContentTab/ContentTab.js.map +1 -0
  51. package/build/cjs/form-builder-v2/components/DragOverlayPreview/DragOverlayPreview.css +13 -0
  52. package/build/cjs/form-builder-v2/components/DragOverlayPreview/DragOverlayPreview.d.ts +7 -0
  53. package/build/cjs/form-builder-v2/components/DragOverlayPreview/DragOverlayPreview.js +24 -0
  54. package/build/cjs/form-builder-v2/components/DragOverlayPreview/DragOverlayPreview.js.map +1 -0
  55. package/build/cjs/form-builder-v2/components/FieldSettings/FieldSettings.css +30 -0
  56. package/build/cjs/form-builder-v2/components/FieldSettings/FieldSettings.d.ts +6 -0
  57. package/build/cjs/form-builder-v2/components/FieldSettings/FieldSettings.js +49 -0
  58. package/build/cjs/form-builder-v2/components/FieldSettings/FieldSettings.js.map +1 -0
  59. package/build/cjs/form-builder-v2/components/FieldSettings/fields/ColorInputSettings.d.ts +12 -0
  60. package/build/cjs/form-builder-v2/components/FieldSettings/fields/ColorInputSettings.js +11 -0
  61. package/build/cjs/form-builder-v2/components/FieldSettings/fields/ColorInputSettings.js.map +1 -0
  62. package/build/cjs/form-builder-v2/components/FieldSettings/fields/OptionsSettings.d.ts +12 -0
  63. package/build/cjs/form-builder-v2/components/FieldSettings/fields/OptionsSettings.js +38 -0
  64. package/build/cjs/form-builder-v2/components/FieldSettings/fields/OptionsSettings.js.map +1 -0
  65. package/build/cjs/form-builder-v2/components/FieldSettings/fields/Row.d.ts +7 -0
  66. package/build/cjs/form-builder-v2/components/FieldSettings/fields/Row.js +9 -0
  67. package/build/cjs/form-builder-v2/components/FieldSettings/fields/Row.js.map +1 -0
  68. package/build/cjs/form-builder-v2/components/FieldSettings/fields/SectionSettings.d.ts +9 -0
  69. package/build/cjs/form-builder-v2/components/FieldSettings/fields/SectionSettings.js +40 -0
  70. package/build/cjs/form-builder-v2/components/FieldSettings/fields/SectionSettings.js.map +1 -0
  71. package/build/cjs/form-builder-v2/components/FieldSettings/fields/SwitchSettings.d.ts +12 -0
  72. package/build/cjs/form-builder-v2/components/FieldSettings/fields/SwitchSettings.js +11 -0
  73. package/build/cjs/form-builder-v2/components/FieldSettings/fields/SwitchSettings.js.map +1 -0
  74. package/build/cjs/form-builder-v2/components/FieldSettings/fields/TextFieldSettings.d.ts +12 -0
  75. package/build/cjs/form-builder-v2/components/FieldSettings/fields/TextFieldSettings.js +11 -0
  76. package/build/cjs/form-builder-v2/components/FieldSettings/fields/TextFieldSettings.js.map +1 -0
  77. package/build/cjs/form-builder-v2/components/FieldSettings/fields/TextSettings.d.ts +11 -0
  78. package/build/cjs/form-builder-v2/components/FieldSettings/fields/TextSettings.js +53 -0
  79. package/build/cjs/form-builder-v2/components/FieldSettings/fields/TextSettings.js.map +1 -0
  80. package/build/cjs/form-builder-v2/components/Inspector/Inspector.css +20 -0
  81. package/build/cjs/form-builder-v2/components/Inspector/Inspector.d.ts +1 -0
  82. package/build/cjs/form-builder-v2/components/Inspector/Inspector.js +20 -0
  83. package/build/cjs/form-builder-v2/components/Inspector/Inspector.js.map +1 -0
  84. package/build/cjs/form-builder-v2/components/Palette/Palette.css +56 -0
  85. package/build/cjs/form-builder-v2/components/Palette/Palette.d.ts +4 -0
  86. package/build/cjs/form-builder-v2/components/Palette/Palette.js +62 -0
  87. package/build/cjs/form-builder-v2/components/Palette/Palette.js.map +1 -0
  88. package/build/cjs/form-builder-v2/components/ResizeHandle/ResizeHandle.css +29 -0
  89. package/build/cjs/form-builder-v2/components/ResizeHandle/ResizeHandle.d.ts +9 -0
  90. package/build/cjs/form-builder-v2/components/ResizeHandle/ResizeHandle.js +98 -0
  91. package/build/cjs/form-builder-v2/components/ResizeHandle/ResizeHandle.js.map +1 -0
  92. package/build/cjs/form-builder-v2/components/SchemaPopup/SchemaPopup.css +49 -0
  93. package/build/cjs/form-builder-v2/components/SchemaPopup/SchemaPopup.d.ts +11 -0
  94. package/build/cjs/form-builder-v2/components/SchemaPopup/SchemaPopup.js +82 -0
  95. package/build/cjs/form-builder-v2/components/SchemaPopup/SchemaPopup.js.map +1 -0
  96. package/build/cjs/form-builder-v2/components/WhenEditor/WhenEditor.css +24 -0
  97. package/build/cjs/form-builder-v2/components/WhenEditor/WhenEditor.d.ts +8 -0
  98. package/build/cjs/form-builder-v2/components/WhenEditor/WhenEditor.js +50 -0
  99. package/build/cjs/form-builder-v2/components/WhenEditor/WhenEditor.js.map +1 -0
  100. package/build/cjs/form-builder-v2/components/WhenEditor/utils.d.ts +24 -0
  101. package/build/cjs/form-builder-v2/components/WhenEditor/utils.js +83 -0
  102. package/build/cjs/form-builder-v2/components/WhenEditor/utils.js.map +1 -0
  103. package/build/cjs/form-builder-v2/hooks/FormContext.d.ts +11 -0
  104. package/build/cjs/form-builder-v2/hooks/FormContext.js +22 -0
  105. package/build/cjs/form-builder-v2/hooks/FormContext.js.map +1 -0
  106. package/build/cjs/form-builder-v2/hooks/useFormFields.d.ts +23 -0
  107. package/build/cjs/form-builder-v2/hooks/useFormFields.js +144 -0
  108. package/build/cjs/form-builder-v2/hooks/useFormFields.js.map +1 -0
  109. package/build/cjs/form-builder-v2/index.d.ts +2 -0
  110. package/build/cjs/form-builder-v2/index.js +6 -0
  111. package/build/cjs/form-builder-v2/index.js.map +1 -0
  112. package/build/cjs/form-builder-v2/styles/variables.css +0 -0
  113. package/build/cjs/form-builder-v2/types.d.ts +32 -0
  114. package/build/cjs/form-builder-v2/types.js +3 -0
  115. package/build/cjs/form-builder-v2/types.js.map +1 -0
  116. package/build/cjs/form-builder-v2/utils/cn.d.ts +2 -0
  117. package/build/cjs/form-builder-v2/utils/cn.js +7 -0
  118. package/build/cjs/form-builder-v2/utils/cn.js.map +1 -0
  119. package/build/cjs/form-builder-v2/utils/dragData.d.ts +18 -0
  120. package/build/cjs/form-builder-v2/utils/dragData.js +18 -0
  121. package/build/cjs/form-builder-v2/utils/dragData.js.map +1 -0
  122. package/build/cjs/form-builder-v2/utils/fieldDefaults.d.ts +2 -0
  123. package/build/cjs/form-builder-v2/utils/fieldDefaults.js +51 -0
  124. package/build/cjs/form-builder-v2/utils/fieldDefaults.js.map +1 -0
  125. package/build/cjs/form-builder-v2/utils/fieldGroups.d.ts +3 -0
  126. package/build/cjs/form-builder-v2/utils/fieldGroups.js +26 -0
  127. package/build/cjs/form-builder-v2/utils/fieldGroups.js.map +1 -0
  128. package/build/cjs/form-builder-v2/utils/fieldMeta.d.ts +6 -0
  129. package/build/cjs/form-builder-v2/utils/fieldMeta.js +45 -0
  130. package/build/cjs/form-builder-v2/utils/fieldMeta.js.map +1 -0
  131. package/build/cjs/form-builder-v2/utils/fieldNames.d.ts +8 -0
  132. package/build/cjs/form-builder-v2/utils/fieldNames.js +75 -0
  133. package/build/cjs/form-builder-v2/utils/fieldNames.js.map +1 -0
  134. package/build/cjs/form-builder-v2/utils/fieldTree.d.ts +2 -0
  135. package/build/cjs/form-builder-v2/utils/fieldTree.js +7 -0
  136. package/build/cjs/form-builder-v2/utils/fieldTree.js.map +1 -0
  137. package/build/cjs/form-builder-v2/utils/fieldTreeOps.d.ts +13 -0
  138. package/build/cjs/form-builder-v2/utils/fieldTreeOps.js +80 -0
  139. package/build/cjs/form-builder-v2/utils/fieldTreeOps.js.map +1 -0
  140. package/build/cjs/form-builder-v2/utils/parseSchema.d.ts +9 -0
  141. package/build/cjs/form-builder-v2/utils/parseSchema.js +102 -0
  142. package/build/cjs/form-builder-v2/utils/parseSchema.js.map +1 -0
  143. package/build/cjs/form-builder-v2/utils/stripIds.d.ts +3 -0
  144. package/build/cjs/form-builder-v2/utils/stripIds.js +12 -0
  145. package/build/cjs/form-builder-v2/utils/stripIds.js.map +1 -0
  146. package/build/cjs/form-builder-v2/utils/treeWalk.d.ts +4 -0
  147. package/build/cjs/form-builder-v2/utils/treeWalk.js +45 -0
  148. package/build/cjs/form-builder-v2/utils/treeWalk.js.map +1 -0
  149. package/build/cjs/form-generator-v2/components/constants.d.ts +11 -11
  150. package/build/cjs/form-generator-v2/index.d.ts +2 -0
  151. package/build/cjs/form-generator-v2/index.js +8 -0
  152. package/build/cjs/form-generator-v2/index.js.map +1 -0
  153. package/build/esm/blocks/ContentLayout/index_deprecated.d.ts +1 -1
  154. package/build/esm/blocks/ExtendedFeatures/index_deprecated.d.ts +1 -1
  155. package/build/esm/blocks/FilterBlock/index.d.ts +1 -1
  156. package/build/esm/blocks/FilterBlock/index_deprecated.d.ts +1 -1
  157. package/build/esm/blocks/Form/index.d.ts +1 -1
  158. package/build/esm/blocks/Form/index_deprecated.d.ts +1 -1
  159. package/build/esm/blocks/HeaderSlider/index.d.ts +1 -1
  160. package/build/esm/blocks/HeaderSlider/index_deprecated.d.ts +1 -1
  161. package/build/esm/blocks/Icons/index.d.ts +1 -1
  162. package/build/esm/blocks/Icons/index_deprecated.d.ts +1 -1
  163. package/build/esm/blocks/Info/index.d.ts +1 -1
  164. package/build/esm/blocks/Info/index_deprecated.d.ts +1 -1
  165. package/build/esm/blocks/Map/index.d.ts +1 -1
  166. package/build/esm/blocks/Map/index_deprecated.d.ts +1 -1
  167. package/build/esm/blocks/Media/index_deprecated.d.ts +1 -1
  168. package/build/esm/blocks/PromoFeaturesBlock/index_deprecated.d.ts +1 -1
  169. package/build/esm/blocks/Questions/index_deprecated.d.ts +1 -1
  170. package/build/esm/blocks/Share/index.d.ts +1 -1
  171. package/build/esm/blocks/Share/index_deprecated.d.ts +1 -1
  172. package/build/esm/blocks/Slider/index.d.ts +1 -1
  173. package/build/esm/blocks/Slider/index_deprecated.d.ts +1 -1
  174. package/build/esm/blocks/Table/index.d.ts +1 -1
  175. package/build/esm/blocks/Table/index_deprecated.d.ts +1 -1
  176. package/build/esm/blocks/Tabs/index.d.ts +1 -1
  177. package/build/esm/blocks/Tabs/index_deprecated.d.ts +1 -1
  178. package/build/esm/form-builder-v2/CanvasContentContext.d.ts +18 -0
  179. package/build/esm/form-builder-v2/CanvasContentContext.js +15 -0
  180. package/build/esm/form-builder-v2/CanvasContentContext.js.map +1 -0
  181. package/build/esm/form-builder-v2/FormBuilderV2.css +93 -0
  182. package/build/esm/form-builder-v2/FormBuilderV2.d.ts +11 -0
  183. package/build/esm/form-builder-v2/FormBuilderV2.js +119 -0
  184. package/build/esm/form-builder-v2/FormBuilderV2.js.map +1 -0
  185. package/build/esm/form-builder-v2/components/Canvas/Canvas.css +15 -0
  186. package/build/esm/form-builder-v2/components/Canvas/Canvas.d.ts +9 -0
  187. package/build/esm/form-builder-v2/components/Canvas/Canvas.js +14 -0
  188. package/build/esm/form-builder-v2/components/Canvas/Canvas.js.map +1 -0
  189. package/build/esm/form-builder-v2/components/CanvasCard/CanvasCard.css +133 -0
  190. package/build/esm/form-builder-v2/components/CanvasCard/CanvasCard.d.ts +10 -0
  191. package/build/esm/form-builder-v2/components/CanvasCard/CanvasCard.js +68 -0
  192. package/build/esm/form-builder-v2/components/CanvasCard/CanvasCard.js.map +1 -0
  193. package/build/esm/form-builder-v2/components/CanvasCard/components/FieldPreview.d.ts +6 -0
  194. package/build/esm/form-builder-v2/components/CanvasCard/components/FieldPreview.js +39 -0
  195. package/build/esm/form-builder-v2/components/CanvasCard/components/FieldPreview.js.map +1 -0
  196. package/build/esm/form-builder-v2/components/CanvasCard/components/SectionChildrenDropZone.d.ts +9 -0
  197. package/build/esm/form-builder-v2/components/CanvasCard/components/SectionChildrenDropZone.js +16 -0
  198. package/build/esm/form-builder-v2/components/CanvasCard/components/SectionChildrenDropZone.js.map +1 -0
  199. package/build/esm/form-builder-v2/components/ContentTab/ContentTab.css +22 -0
  200. package/build/esm/form-builder-v2/components/ContentTab/ContentTab.d.ts +2 -0
  201. package/build/esm/form-builder-v2/components/ContentTab/ContentTab.js +17 -0
  202. package/build/esm/form-builder-v2/components/ContentTab/ContentTab.js.map +1 -0
  203. package/build/esm/form-builder-v2/components/DragOverlayPreview/DragOverlayPreview.css +13 -0
  204. package/build/esm/form-builder-v2/components/DragOverlayPreview/DragOverlayPreview.d.ts +8 -0
  205. package/build/esm/form-builder-v2/components/DragOverlayPreview/DragOverlayPreview.js +21 -0
  206. package/build/esm/form-builder-v2/components/DragOverlayPreview/DragOverlayPreview.js.map +1 -0
  207. package/build/esm/form-builder-v2/components/FieldSettings/FieldSettings.css +30 -0
  208. package/build/esm/form-builder-v2/components/FieldSettings/FieldSettings.d.ts +7 -0
  209. package/build/esm/form-builder-v2/components/FieldSettings/FieldSettings.js +45 -0
  210. package/build/esm/form-builder-v2/components/FieldSettings/FieldSettings.js.map +1 -0
  211. package/build/esm/form-builder-v2/components/FieldSettings/fields/ColorInputSettings.d.ts +12 -0
  212. package/build/esm/form-builder-v2/components/FieldSettings/fields/ColorInputSettings.js +6 -0
  213. package/build/esm/form-builder-v2/components/FieldSettings/fields/ColorInputSettings.js.map +1 -0
  214. package/build/esm/form-builder-v2/components/FieldSettings/fields/OptionsSettings.d.ts +12 -0
  215. package/build/esm/form-builder-v2/components/FieldSettings/fields/OptionsSettings.js +33 -0
  216. package/build/esm/form-builder-v2/components/FieldSettings/fields/OptionsSettings.js.map +1 -0
  217. package/build/esm/form-builder-v2/components/FieldSettings/fields/Row.d.ts +7 -0
  218. package/build/esm/form-builder-v2/components/FieldSettings/fields/Row.js +5 -0
  219. package/build/esm/form-builder-v2/components/FieldSettings/fields/Row.js.map +1 -0
  220. package/build/esm/form-builder-v2/components/FieldSettings/fields/SectionSettings.d.ts +9 -0
  221. package/build/esm/form-builder-v2/components/FieldSettings/fields/SectionSettings.js +35 -0
  222. package/build/esm/form-builder-v2/components/FieldSettings/fields/SectionSettings.js.map +1 -0
  223. package/build/esm/form-builder-v2/components/FieldSettings/fields/SwitchSettings.d.ts +12 -0
  224. package/build/esm/form-builder-v2/components/FieldSettings/fields/SwitchSettings.js +6 -0
  225. package/build/esm/form-builder-v2/components/FieldSettings/fields/SwitchSettings.js.map +1 -0
  226. package/build/esm/form-builder-v2/components/FieldSettings/fields/TextFieldSettings.d.ts +12 -0
  227. package/build/esm/form-builder-v2/components/FieldSettings/fields/TextFieldSettings.js +6 -0
  228. package/build/esm/form-builder-v2/components/FieldSettings/fields/TextFieldSettings.js.map +1 -0
  229. package/build/esm/form-builder-v2/components/FieldSettings/fields/TextSettings.d.ts +11 -0
  230. package/build/esm/form-builder-v2/components/FieldSettings/fields/TextSettings.js +48 -0
  231. package/build/esm/form-builder-v2/components/FieldSettings/fields/TextSettings.js.map +1 -0
  232. package/build/esm/form-builder-v2/components/Inspector/Inspector.css +20 -0
  233. package/build/esm/form-builder-v2/components/Inspector/Inspector.d.ts +2 -0
  234. package/build/esm/form-builder-v2/components/Inspector/Inspector.js +16 -0
  235. package/build/esm/form-builder-v2/components/Inspector/Inspector.js.map +1 -0
  236. package/build/esm/form-builder-v2/components/Palette/Palette.css +56 -0
  237. package/build/esm/form-builder-v2/components/Palette/Palette.d.ts +5 -0
  238. package/build/esm/form-builder-v2/components/Palette/Palette.js +58 -0
  239. package/build/esm/form-builder-v2/components/Palette/Palette.js.map +1 -0
  240. package/build/esm/form-builder-v2/components/ResizeHandle/ResizeHandle.css +29 -0
  241. package/build/esm/form-builder-v2/components/ResizeHandle/ResizeHandle.d.ts +10 -0
  242. package/build/esm/form-builder-v2/components/ResizeHandle/ResizeHandle.js +94 -0
  243. package/build/esm/form-builder-v2/components/ResizeHandle/ResizeHandle.js.map +1 -0
  244. package/build/esm/form-builder-v2/components/SchemaPopup/SchemaPopup.css +49 -0
  245. package/build/esm/form-builder-v2/components/SchemaPopup/SchemaPopup.d.ts +12 -0
  246. package/build/esm/form-builder-v2/components/SchemaPopup/SchemaPopup.js +78 -0
  247. package/build/esm/form-builder-v2/components/SchemaPopup/SchemaPopup.js.map +1 -0
  248. package/build/esm/form-builder-v2/components/WhenEditor/WhenEditor.css +24 -0
  249. package/build/esm/form-builder-v2/components/WhenEditor/WhenEditor.d.ts +9 -0
  250. package/build/esm/form-builder-v2/components/WhenEditor/WhenEditor.js +46 -0
  251. package/build/esm/form-builder-v2/components/WhenEditor/WhenEditor.js.map +1 -0
  252. package/build/esm/form-builder-v2/components/WhenEditor/utils.d.ts +24 -0
  253. package/build/esm/form-builder-v2/components/WhenEditor/utils.js +76 -0
  254. package/build/esm/form-builder-v2/components/WhenEditor/utils.js.map +1 -0
  255. package/build/esm/form-builder-v2/hooks/FormContext.d.ts +11 -0
  256. package/build/esm/form-builder-v2/hooks/FormContext.js +16 -0
  257. package/build/esm/form-builder-v2/hooks/FormContext.js.map +1 -0
  258. package/build/esm/form-builder-v2/hooks/useFormFields.d.ts +23 -0
  259. package/build/esm/form-builder-v2/hooks/useFormFields.js +139 -0
  260. package/build/esm/form-builder-v2/hooks/useFormFields.js.map +1 -0
  261. package/build/esm/form-builder-v2/index.d.ts +2 -0
  262. package/build/esm/form-builder-v2/index.js +3 -0
  263. package/build/esm/form-builder-v2/index.js.map +1 -0
  264. package/build/esm/form-builder-v2/styles/variables.css +0 -0
  265. package/build/esm/form-builder-v2/types.d.ts +32 -0
  266. package/build/esm/form-builder-v2/types.js +2 -0
  267. package/build/esm/form-builder-v2/types.js.map +1 -0
  268. package/build/esm/form-builder-v2/utils/cn.d.ts +2 -0
  269. package/build/esm/form-builder-v2/utils/cn.js +4 -0
  270. package/build/esm/form-builder-v2/utils/cn.js.map +1 -0
  271. package/build/esm/form-builder-v2/utils/dragData.d.ts +18 -0
  272. package/build/esm/form-builder-v2/utils/dragData.js +11 -0
  273. package/build/esm/form-builder-v2/utils/dragData.js.map +1 -0
  274. package/build/esm/form-builder-v2/utils/fieldDefaults.d.ts +2 -0
  275. package/build/esm/form-builder-v2/utils/fieldDefaults.js +47 -0
  276. package/build/esm/form-builder-v2/utils/fieldDefaults.js.map +1 -0
  277. package/build/esm/form-builder-v2/utils/fieldGroups.d.ts +3 -0
  278. package/build/esm/form-builder-v2/utils/fieldGroups.js +21 -0
  279. package/build/esm/form-builder-v2/utils/fieldGroups.js.map +1 -0
  280. package/build/esm/form-builder-v2/utils/fieldMeta.d.ts +6 -0
  281. package/build/esm/form-builder-v2/utils/fieldMeta.js +42 -0
  282. package/build/esm/form-builder-v2/utils/fieldMeta.js.map +1 -0
  283. package/build/esm/form-builder-v2/utils/fieldNames.d.ts +8 -0
  284. package/build/esm/form-builder-v2/utils/fieldNames.js +66 -0
  285. package/build/esm/form-builder-v2/utils/fieldNames.js.map +1 -0
  286. package/build/esm/form-builder-v2/utils/fieldTree.d.ts +2 -0
  287. package/build/esm/form-builder-v2/utils/fieldTree.js +3 -0
  288. package/build/esm/form-builder-v2/utils/fieldTree.js.map +1 -0
  289. package/build/esm/form-builder-v2/utils/fieldTreeOps.d.ts +13 -0
  290. package/build/esm/form-builder-v2/utils/fieldTreeOps.js +69 -0
  291. package/build/esm/form-builder-v2/utils/fieldTreeOps.js.map +1 -0
  292. package/build/esm/form-builder-v2/utils/parseSchema.d.ts +9 -0
  293. package/build/esm/form-builder-v2/utils/parseSchema.js +98 -0
  294. package/build/esm/form-builder-v2/utils/parseSchema.js.map +1 -0
  295. package/build/esm/form-builder-v2/utils/stripIds.d.ts +3 -0
  296. package/build/esm/form-builder-v2/utils/stripIds.js +8 -0
  297. package/build/esm/form-builder-v2/utils/stripIds.js.map +1 -0
  298. package/build/esm/form-builder-v2/utils/treeWalk.d.ts +4 -0
  299. package/build/esm/form-builder-v2/utils/treeWalk.js +39 -0
  300. package/build/esm/form-builder-v2/utils/treeWalk.js.map +1 -0
  301. package/build/esm/form-generator-v2/components/constants.d.ts +11 -11
  302. package/build/esm/form-generator-v2/index.d.ts +2 -0
  303. package/build/esm/form-generator-v2/index.js +3 -0
  304. package/build/esm/form-generator-v2/index.js.map +1 -0
  305. package/package.json +21 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FieldPreview.js","sourceRoot":"../../../../../../src","sources":["form-builder-v2/components/CanvasCard/components/FieldPreview.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAC,KAAK,EAAE,IAAI,EAAC,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAC,SAAS,EAAE,GAAG,EAAE,KAAK,EAAC,MAAM,QAAQ,CAAC;AAE7C,OAAO,EAAC,YAAY,EAAC,8DAA2D;AAEhF,OAAO,EAAC,gBAAgB,EAAC,yCAAsC;AAE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AAS,EAAE,CAAC,CAAC,gBAAgB,CAAC,aAC/B,KAAC,IAAI,IAAC,OAAO,EAAC,aAAa,YAAE,KAAK,CAAC,KAAK,IAAI,SAAS,GAAQ,EAC5D,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CACX,MAAC,KAAK,IAAC,KAAK,EAAC,MAAM,EAAC,IAAI,EAAC,GAAG,8BACf,KAAK,CAAC,SAAS,IAAI,gBAAgB,IACxC,CACX,CAAC,CAAC,CAAC,CACA,KAAC,KAAK,IAAC,KAAK,EAAC,SAAS,EAAC,IAAI,EAAC,GAAG,sBAEvB,CACX,IACC,CACT,CAAC;IACN,CAAC;IAED,MAAM,SAAS,GAAG,YAAY,CAAC,KAAK,CAAC,IAAI,CAE1B,CAAC;IAChB,IAAI,CAAC,SAAS,EAAE,CAAC;QACb,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,MAAM,EAAC,IAAI,EAAE,KAAK,EAAE,EAAE,EAAE,GAAG,EAAE,GAAG,UAAU,EAAC,GAAG,KAAK,CAAC;IAEpD,MAAM,WAAW,GAAG,eAAe,CAAC,KAAK,CAAC,CAAC;IAC3C,MAAM,aAAa,GAAG,WAAW,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,OAAO,CAAC;IAC9D,MAAM,QAAQ,GAAG,WAAW,CAAC,CAAC,CAAC,mBAAmB,CAAC,CAAC,CAAC,kBAAkB,CAAC;IAExE,OAAO,CACH,KAAC,SAAS,OACD,UAAsC,EAC3C,OAAO,EAAE,aAAa,EACtB,QAAQ,EAAE,QAAQ,GACpB,CACL,CAAC;AACN,CAAC,CAAC","sourcesContent":["import * as React from 'react';\n\nimport {Label, Text} from '@gravity-ui/uikit';\nimport {cloneDeep, set, unset} from 'lodash';\n\nimport {componentMap} from '../../../../form-generator-v2/components/constants';\nimport type {Content, OnUpdate} from '../../../../form-generator-v2/types';\nimport {useCanvasContent} from '../../../CanvasContentContext';\nimport {FormField} from '../../../types';\nimport {formBuilderV2Cn} from '../../../utils/cn';\n\nconst b = formBuilderV2Cn('canvas-card');\n\nconst isTemplateField = (field: FormField): boolean =>\n 'name' in field && typeof field.name === 'string' && field.name.includes('{{index}}');\n\nconst makeOnUpdate =\n (setContent: React.Dispatch<React.SetStateAction<Content>>): OnUpdate =>\n (key, value, options) => {\n setContent((prev) => {\n const next = cloneDeep(prev);\n if (options?.unset) {\n unset(next, key);\n } else {\n set(next, key, value);\n }\n return next;\n });\n };\n\ninterface FieldPreviewProps {\n field: FormField;\n}\n\nexport const FieldPreview = ({field}: FieldPreviewProps) => {\n const {content, setContent, templateContent, setTemplateContent} = useCanvasContent();\n\n const onUpdateForContent = React.useMemo<OnUpdate>(\n () => makeOnUpdate(setContent),\n [setContent],\n );\n const onUpdateForTemplate = React.useMemo<OnUpdate>(\n () => makeOnUpdate(setTemplateContent),\n [setTemplateContent],\n );\n\n if (field.type === 'section') {\n return (\n <div className={b('section-header')}>\n <Text variant=\"subheader-2\">{field.title || 'Section'}</Text>\n {field.index ? (\n <Label theme=\"info\" size=\"s\">\n Array · {field.itemTitle ?? 'Item {{index}}'}\n </Label>\n ) : (\n <Label theme=\"unknown\" size=\"s\">\n Group\n </Label>\n )}\n </div>\n );\n }\n\n const Component = componentMap[field.type] as\n | React.ComponentType<Record<string, unknown>>\n | undefined;\n if (!Component) {\n return null;\n }\n\n const {when: _when, id: _id, ...fieldProps} = field;\n\n const useTemplate = isTemplateField(field);\n const widgetContent = useTemplate ? templateContent : content;\n const onUpdate = useTemplate ? onUpdateForTemplate : onUpdateForContent;\n\n return (\n <Component\n {...(fieldProps as Record<string, unknown>)}\n content={widgetContent}\n onUpdate={onUpdate}\n />\n );\n};\n"]}
@@ -0,0 +1,9 @@
1
+ import { FormField } from "../../../types.js";
2
+ import type { SectionDropData } from "../../../utils/dragData.js";
3
+ export declare const SECTION_DROP_PREFIX = "section-drop:";
4
+ export type { SectionDropData };
5
+ interface SectionChildrenDropZoneProps {
6
+ sectionId: string;
7
+ fields: FormField[];
8
+ }
9
+ export declare const SectionChildrenDropZone: ({ sectionId, fields }: SectionChildrenDropZoneProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,16 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useDroppable } from '@dnd-kit/react';
3
+ import { Text } from '@gravity-ui/uikit';
4
+ import { formBuilderV2Cn } from "../../../utils/cn.js";
5
+ import { CanvasList } from "../../Canvas/Canvas.js";
6
+ const b = formBuilderV2Cn('canvas-card');
7
+ export const SECTION_DROP_PREFIX = 'section-drop:';
8
+ export const SectionChildrenDropZone = ({ sectionId, fields }) => {
9
+ const { ref, isDropTarget } = useDroppable({
10
+ id: `${SECTION_DROP_PREFIX}${sectionId}`,
11
+ data: { kind: 'section-drop', sectionId },
12
+ });
13
+ const className = b('children');
14
+ return (_jsxs("div", { ref: ref, className: `${className}${isDropTarget ? ` ${className}_drop-target` : ''}`, children: [_jsx(CanvasList, { fields: fields, parentGroup: `section:${sectionId}` }), fields.length === 0 && (_jsx(Text, { variant: "body-2", color: "hint", children: "Empty section. Drag a tile from the palette into this box, or select the section first and click a tile to add it inside." }))] }));
15
+ };
16
+ //# sourceMappingURL=SectionChildrenDropZone.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SectionChildrenDropZone.js","sourceRoot":"../../../../../../src","sources":["form-builder-v2/components/CanvasCard/components/SectionChildrenDropZone.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAC,IAAI,EAAC,MAAM,mBAAmB,CAAC;AAGvC,OAAO,EAAC,eAAe,EAAC,6BAA0B;AAElD,OAAO,EAAC,UAAU,EAAC,+BAA4B;AAE/C,MAAM,CAAC,GAAG,eAAe,CAAC,aAAa,CAAC,CAAC;AAEzC,MAAM,CAAC,MAAM,mBAAmB,GAAG,eAAe,CAAC;AASnD,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,EAAC,SAAS,EAAE,MAAM,EAA+B,EAAE,EAAE;IACzF,MAAM,EAAC,GAAG,EAAE,YAAY,EAAC,GAAG,YAAY,CAAC;QACrC,EAAE,EAAE,GAAG,mBAAmB,GAAG,SAAS,EAAE;QACxC,IAAI,EAAE,EAAC,IAAI,EAAE,cAAc,EAAE,SAAS,EAAC;KAC1C,CAAC,CAAC;IAEH,MAAM,SAAS,GAAG,CAAC,CAAC,UAAU,CAAC,CAAC;IAEhC,OAAO,CACH,eAAK,GAAG,EAAE,GAAG,EAAE,SAAS,EAAE,GAAG,SAAS,GAAG,YAAY,CAAC,CAAC,CAAC,IAAI,SAAS,cAAc,CAAC,CAAC,CAAC,EAAE,EAAE,aACtF,KAAC,UAAU,IAAC,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,WAAW,SAAS,EAAE,GAAI,EAClE,MAAM,CAAC,MAAM,KAAK,CAAC,IAAI,CACpB,KAAC,IAAI,IAAC,OAAO,EAAC,QAAQ,EAAC,KAAK,EAAC,MAAM,0IAG5B,CACV,IACC,CACT,CAAC;AACN,CAAC,CAAC","sourcesContent":["import {useDroppable} from '@dnd-kit/react';\nimport {Text} from '@gravity-ui/uikit';\n\nimport {FormField} from '../../../types';\nimport {formBuilderV2Cn} from '../../../utils/cn';\nimport type {SectionDropData} from '../../../utils/dragData';\nimport {CanvasList} from '../../Canvas/Canvas';\n\nconst b = formBuilderV2Cn('canvas-card');\n\nexport const SECTION_DROP_PREFIX = 'section-drop:';\n\nexport type {SectionDropData};\n\ninterface SectionChildrenDropZoneProps {\n sectionId: string;\n fields: FormField[];\n}\n\nexport const SectionChildrenDropZone = ({sectionId, fields}: SectionChildrenDropZoneProps) => {\n const {ref, isDropTarget} = useDroppable({\n id: `${SECTION_DROP_PREFIX}${sectionId}`,\n data: {kind: 'section-drop', sectionId},\n });\n\n const className = b('children');\n\n return (\n <div ref={ref} className={`${className}${isDropTarget ? ` ${className}_drop-target` : ''}`}>\n <CanvasList fields={fields} parentGroup={`section:${sectionId}`} />\n {fields.length === 0 && (\n <Text variant=\"body-2\" color=\"hint\">\n Empty section. Drag a tile from the palette into this box, or select the section\n first and click a tile to add it inside.\n </Text>\n )}\n </div>\n );\n};\n"]}
@@ -0,0 +1,22 @@
1
+ .pcformbuilderv2-content-tab {
2
+ display: grid;
3
+ grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
4
+ gap: var(--g-spacing-4);
5
+ margin-top: var(--g-spacing-4);
6
+ }
7
+ .pcformbuilderv2-content-tab__column {
8
+ padding: var(--g-spacing-4);
9
+ }
10
+ .pcformbuilderv2-content-tab__title {
11
+ display: block;
12
+ margin-bottom: var(--g-spacing-3);
13
+ }
14
+ .pcformbuilderv2-content-tab__json {
15
+ margin: 0;
16
+ padding: var(--g-spacing-3);
17
+ background: var(--g-color-base-generic);
18
+ border-radius: var(--g-border-radius-m);
19
+ font-size: 12px;
20
+ overflow: auto;
21
+ max-height: 70vh;
22
+ }
@@ -0,0 +1,2 @@
1
+ import './ContentTab.css';
2
+ export declare const ContentTab: () => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,17 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import * as React from 'react';
3
+ import { Card, Text } from '@gravity-ui/uikit';
4
+ import FormGenerator from "../../../form-generator-v2/FormGenerator.js";
5
+ import { useCanvasContent } from "../../CanvasContentContext.js";
6
+ import { useFormContext } from "../../hooks/FormContext.js";
7
+ import { formBuilderV2Cn } from "../../utils/cn.js";
8
+ import { stripIds } from "../../utils/stripIds.js";
9
+ import './ContentTab.css';
10
+ const b = formBuilderV2Cn('content-tab');
11
+ export const ContentTab = () => {
12
+ const { formFields } = useFormContext();
13
+ const { content, setContent } = useCanvasContent();
14
+ const schema = React.useMemo(() => stripIds(formFields), [formFields]);
15
+ return (_jsxs("div", { className: b(), children: [_jsxs(Card, { className: b('column'), view: "outlined", children: [_jsx(Text, { variant: "subheader-2", className: b('title'), children: "Live form" }), schema.length > 0 ? (_jsx(FormGenerator, { blockConfig: schema, contentConfig: content, onUpdate: setContent })) : (_jsx(Text, { variant: "body-2", color: "hint", children: "Add fields on the Visual tab to see the form here." }))] }), _jsxs(Card, { className: b('column'), view: "outlined", children: [_jsx(Text, { variant: "subheader-2", className: b('title'), children: "Content JSON" }), _jsx("pre", { className: b('json'), children: JSON.stringify(content, null, 2) })] })] }));
16
+ };
17
+ //# sourceMappingURL=ContentTab.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ContentTab.js","sourceRoot":"../../../../../src","sources":["form-builder-v2/components/ContentTab/ContentTab.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAC,IAAI,EAAE,IAAI,EAAC,MAAM,mBAAmB,CAAC;AAE7C,OAAO,aAAa,oDAAiD;AACrE,OAAO,EAAC,gBAAgB,EAAC,sCAAmC;AAC5D,OAAO,EAAC,cAAc,EAAC,mCAAgC;AACvD,OAAO,EAAC,eAAe,EAAC,0BAAuB;AAC/C,OAAO,EAAC,QAAQ,EAAC,gCAA6B;AAE9C,OAAO,kBAAkB,CAAC;AAE1B,MAAM,CAAC,GAAG,eAAe,CAAC,aAAa,CAAC,CAAC;AAEzC,MAAM,CAAC,MAAM,UAAU,GAAG,GAAG,EAAE;IAC3B,MAAM,EAAC,UAAU,EAAC,GAAG,cAAc,EAAE,CAAC;IACtC,MAAM,EAAC,OAAO,EAAE,UAAU,EAAC,GAAG,gBAAgB,EAAE,CAAC;IAEjD,MAAM,MAAM,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,UAAU,CAAC,EAAE,CAAC,UAAU,CAAC,CAAC,CAAC;IAEvE,OAAO,CACH,eAAK,SAAS,EAAE,CAAC,EAAE,aACf,MAAC,IAAI,IAAC,SAAS,EAAE,CAAC,CAAC,QAAQ,CAAC,EAAE,IAAI,EAAC,UAAU,aACzC,KAAC,IAAI,IAAC,OAAO,EAAC,aAAa,EAAC,SAAS,EAAE,CAAC,CAAC,OAAO,CAAC,0BAE1C,EACN,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CACjB,KAAC,aAAa,IACV,WAAW,EAAE,MAAM,EACnB,aAAa,EAAE,OAAO,EACtB,QAAQ,EAAE,UAAU,GACtB,CACL,CAAC,CAAC,CAAC,CACA,KAAC,IAAI,IAAC,OAAO,EAAC,QAAQ,EAAC,KAAK,EAAC,MAAM,mEAE5B,CACV,IACE,EACP,MAAC,IAAI,IAAC,SAAS,EAAE,CAAC,CAAC,QAAQ,CAAC,EAAE,IAAI,EAAC,UAAU,aACzC,KAAC,IAAI,IAAC,OAAO,EAAC,aAAa,EAAC,SAAS,EAAE,CAAC,CAAC,OAAO,CAAC,6BAE1C,EACP,cAAK,SAAS,EAAE,CAAC,CAAC,MAAM,CAAC,YAAG,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,GAAO,IAChE,IACL,CACT,CAAC;AACN,CAAC,CAAC","sourcesContent":["import * as React from 'react';\n\nimport {Card, Text} from '@gravity-ui/uikit';\n\nimport FormGenerator from '../../../form-generator-v2/FormGenerator';\nimport {useCanvasContent} from '../../CanvasContentContext';\nimport {useFormContext} from '../../hooks/FormContext';\nimport {formBuilderV2Cn} from '../../utils/cn';\nimport {stripIds} from '../../utils/stripIds';\n\nimport './ContentTab.scss';\n\nconst b = formBuilderV2Cn('content-tab');\n\nexport const ContentTab = () => {\n const {formFields} = useFormContext();\n const {content, setContent} = useCanvasContent();\n\n const schema = React.useMemo(() => stripIds(formFields), [formFields]);\n\n return (\n <div className={b()}>\n <Card className={b('column')} view=\"outlined\">\n <Text variant=\"subheader-2\" className={b('title')}>\n Live form\n </Text>\n {schema.length > 0 ? (\n <FormGenerator\n blockConfig={schema}\n contentConfig={content}\n onUpdate={setContent}\n />\n ) : (\n <Text variant=\"body-2\" color=\"hint\">\n Add fields on the Visual tab to see the form here.\n </Text>\n )}\n </Card>\n <Card className={b('column')} view=\"outlined\">\n <Text variant=\"subheader-2\" className={b('title')}>\n Content JSON\n </Text>\n <pre className={b('json')}>{JSON.stringify(content, null, 2)}</pre>\n </Card>\n </div>\n );\n};\n"]}
@@ -0,0 +1,13 @@
1
+ .pcformbuilderv2-drag-overlay {
2
+ display: inline-flex;
3
+ align-items: center;
4
+ gap: var(--g-spacing-2);
5
+ padding: var(--g-spacing-2) var(--g-spacing-3);
6
+ color: var(--g-color-text-primary);
7
+ cursor: grabbing;
8
+ }
9
+ .pcformbuilderv2-drag-overlay__text {
10
+ display: flex;
11
+ align-items: center;
12
+ gap: 6px;
13
+ }
@@ -0,0 +1,8 @@
1
+ import type { BuilderFieldType, FormField } from "../../types.js";
2
+ import './DragOverlayPreview.css';
3
+ interface DragOverlayPreviewProps {
4
+ type: BuilderFieldType;
5
+ field?: FormField;
6
+ }
7
+ export declare const DragOverlayPreview: ({ type, field }: DragOverlayPreviewProps) => import("react/jsx-runtime").JSX.Element;
8
+ export {};
@@ -0,0 +1,21 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Card, Icon, Label, Text } from '@gravity-ui/uikit';
3
+ import { formBuilderV2Cn } from "../../utils/cn.js";
4
+ import { TYPE_ICONS, TYPE_LABELS } from "../../utils/fieldMeta.js";
5
+ import './DragOverlayPreview.css';
6
+ const b = formBuilderV2Cn('drag-overlay');
7
+ const getFieldTitle = (f) => {
8
+ if (!f)
9
+ return '';
10
+ if ('title' in f)
11
+ return f.title ?? '';
12
+ if ('text' in f)
13
+ return f.text ?? '';
14
+ return '';
15
+ };
16
+ export const DragOverlayPreview = ({ type, field }) => {
17
+ const name = field && 'name' in field ? field.name : '';
18
+ const title = getFieldTitle(field);
19
+ return (_jsxs(Card, { className: b(), view: "raised", children: [_jsx(Icon, { data: TYPE_ICONS[type], size: 14 }), _jsxs("div", { className: b('text'), children: [_jsx(Text, { variant: "body-2", children: TYPE_LABELS[type] }), (name || title) && (_jsx(Label, { theme: "unknown", size: "s", children: name || title }))] })] }));
20
+ };
21
+ //# sourceMappingURL=DragOverlayPreview.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DragOverlayPreview.js","sourceRoot":"../../../../../src","sources":["form-builder-v2/components/DragOverlayPreview/DragOverlayPreview.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAC,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAC,MAAM,mBAAmB,CAAC;AAG1D,OAAO,EAAC,eAAe,EAAC,0BAAuB;AAC/C,OAAO,EAAC,UAAU,EAAE,WAAW,EAAC,iCAA8B;AAE9D,OAAO,0BAA0B,CAAC;AAElC,MAAM,CAAC,GAAG,eAAe,CAAC,cAAc,CAAC,CAAC;AAO1C,MAAM,aAAa,GAAG,CAAC,CAAwB,EAAU,EAAE;IACvD,IAAI,CAAC,CAAC;QAAE,OAAO,EAAE,CAAC;IAClB,IAAI,OAAO,IAAI,CAAC;QAAE,OAAO,CAAC,CAAC,KAAK,IAAI,EAAE,CAAC;IACvC,IAAI,MAAM,IAAI,CAAC;QAAE,OAAO,CAAC,CAAC,IAAI,IAAI,EAAE,CAAC;IACrC,OAAO,EAAE,CAAC;AACd,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,EAAC,IAAI,EAAE,KAAK,EAA0B,EAAE,EAAE;IACzE,MAAM,IAAI,GAAG,KAAK,IAAI,MAAM,IAAI,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC;IACxD,MAAM,KAAK,GAAG,aAAa,CAAC,KAAK,CAAC,CAAC;IAEnC,OAAO,CACH,MAAC,IAAI,IAAC,SAAS,EAAE,CAAC,EAAE,EAAE,IAAI,EAAC,QAAQ,aAC/B,KAAC,IAAI,IAAC,IAAI,EAAE,UAAU,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,EAAE,GAAI,EAC1C,eAAK,SAAS,EAAE,CAAC,CAAC,MAAM,CAAC,aACrB,KAAC,IAAI,IAAC,OAAO,EAAC,QAAQ,YAAE,WAAW,CAAC,IAAI,CAAC,GAAQ,EAChD,CAAC,IAAI,IAAI,KAAK,CAAC,IAAI,CAChB,KAAC,KAAK,IAAC,KAAK,EAAC,SAAS,EAAC,IAAI,EAAC,GAAG,YAC1B,IAAI,IAAI,KAAK,GACV,CACX,IACC,IACH,CACV,CAAC;AACN,CAAC,CAAC","sourcesContent":["import {Card, Icon, Label, Text} from '@gravity-ui/uikit';\n\nimport type {BuilderFieldType, FormField} from '../../types';\nimport {formBuilderV2Cn} from '../../utils/cn';\nimport {TYPE_ICONS, TYPE_LABELS} from '../../utils/fieldMeta';\n\nimport './DragOverlayPreview.scss';\n\nconst b = formBuilderV2Cn('drag-overlay');\n\ninterface DragOverlayPreviewProps {\n type: BuilderFieldType;\n field?: FormField;\n}\n\nconst getFieldTitle = (f: FormField | undefined): string => {\n if (!f) return '';\n if ('title' in f) return f.title ?? '';\n if ('text' in f) return f.text ?? '';\n return '';\n};\n\nexport const DragOverlayPreview = ({type, field}: DragOverlayPreviewProps) => {\n const name = field && 'name' in field ? field.name : '';\n const title = getFieldTitle(field);\n\n return (\n <Card className={b()} view=\"raised\">\n <Icon data={TYPE_ICONS[type]} size={14} />\n <div className={b('text')}>\n <Text variant=\"body-2\">{TYPE_LABELS[type]}</Text>\n {(name || title) && (\n <Label theme=\"unknown\" size=\"s\">\n {name || title}\n </Label>\n )}\n </div>\n </Card>\n );\n};\n"]}
@@ -0,0 +1,30 @@
1
+ .pcformbuilderv2-field-settings__row {
2
+ display: grid;
3
+ grid-template-columns: 100px 1fr;
4
+ align-items: start;
5
+ gap: var(--g-spacing-2);
6
+ }
7
+ .pcformbuilderv2-field-settings__row-label {
8
+ padding-top: 6px;
9
+ font-size: var(--g-text-body-1-font-size);
10
+ line-height: 1.4;
11
+ color: var(--g-color-text-secondary);
12
+ }
13
+ .pcformbuilderv2-field-settings__options {
14
+ display: flex;
15
+ flex-direction: column;
16
+ gap: 6px;
17
+ padding: var(--g-spacing-2);
18
+ border: 1px solid var(--g-color-line-generic);
19
+ border-radius: var(--g-border-radius-m);
20
+ }
21
+ .pcformbuilderv2-field-settings__option-row {
22
+ display: grid;
23
+ grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
24
+ gap: 6px;
25
+ align-items: center;
26
+ }
27
+ .pcformbuilderv2-field-settings__add-option {
28
+ align-self: flex-start;
29
+ margin-top: var(--g-spacing-1);
30
+ }
@@ -0,0 +1,7 @@
1
+ import { FormField } from "../../types.js";
2
+ import './FieldSettings.css';
3
+ interface FieldSettingsProps {
4
+ field: FormField;
5
+ }
6
+ export declare const FieldSettings: ({ field }: FieldSettingsProps) => import("react/jsx-runtime").JSX.Element | null;
7
+ export {};
@@ -0,0 +1,45 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import * as React from 'react';
3
+ import { TextInput } from '@gravity-ui/uikit';
4
+ import { useFormContext } from "../../hooks/FormContext.js";
5
+ import { collectNames } from "../../utils/fieldNames.js";
6
+ import { WhenEditor } from "../WhenEditor/WhenEditor.js";
7
+ import { ColorInputSettings } from "./fields/ColorInputSettings.js";
8
+ import { OptionsSettings } from "./fields/OptionsSettings.js";
9
+ import { Row } from "./fields/Row.js";
10
+ import { SectionSettings } from "./fields/SectionSettings.js";
11
+ import { SwitchSettings } from "./fields/SwitchSettings.js";
12
+ import { TextFieldSettings } from "./fields/TextFieldSettings.js";
13
+ import { TextSettings } from "./fields/TextSettings.js";
14
+ import './FieldSettings.css';
15
+ export const FieldSettings = ({ field }) => {
16
+ const { updateField, formFields } = useFormContext();
17
+ const availableFields = React.useMemo(() => {
18
+ const all = Array.from(collectNames(formFields));
19
+ if (field.type === 'section' || field.type === 'text')
20
+ return all;
21
+ return all.filter((n) => n !== field.name);
22
+ }, [formFields, field]);
23
+ const whenEditorSection = (_jsx(Row, { label: "Visible when", children: _jsx(WhenEditor, { when: field.when, availableFields: availableFields, onChange: (next) => updateField(field.id, { when: next }) }) }));
24
+ const commonRows = (_jsxs(React.Fragment, { children: [_jsx(Row, { label: "Title", children: _jsx(TextInput, { value: 'title' in field ? (field.title ?? '') : '', onUpdate: (value) => updateField(field.id, { title: value }), placeholder: "Label shown above the field" }) }), _jsx(Row, { label: "Name", children: _jsx(TextInput, { value: 'name' in field ? (field.name ?? '') : '', onUpdate: (value) => updateField(field.id, { name: value }), placeholder: "Path in content object" }) })] }));
25
+ if (field.type === 'section') {
26
+ return (_jsx(SectionSettings, { field: field, updateField: updateField, whenEditorSection: whenEditorSection }));
27
+ }
28
+ if (field.type === 'text') {
29
+ return (_jsx(TextSettings, { field: field, updateField: updateField, whenEditorSection: whenEditorSection }));
30
+ }
31
+ if (field.type === 'textInput' || field.type === 'textArea') {
32
+ return (_jsx(TextFieldSettings, { field: field, updateField: updateField, commonRows: commonRows, whenEditorSection: whenEditorSection }));
33
+ }
34
+ if (field.type === 'switch') {
35
+ return (_jsx(SwitchSettings, { field: field, updateField: updateField, commonRows: commonRows, whenEditorSection: whenEditorSection }));
36
+ }
37
+ if (field.type === 'colorInput') {
38
+ return (_jsx(ColorInputSettings, { field: field, updateField: updateField, commonRows: commonRows, whenEditorSection: whenEditorSection }));
39
+ }
40
+ if (field.type === 'select' || field.type === 'segmentedRadioGroup') {
41
+ return (_jsx(OptionsSettings, { field: field, updateField: updateField, commonRows: commonRows, whenEditorSection: whenEditorSection }));
42
+ }
43
+ return null;
44
+ };
45
+ //# sourceMappingURL=FieldSettings.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FieldSettings.js","sourceRoot":"../../../../../src","sources":["form-builder-v2/components/FieldSettings/FieldSettings.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAC,SAAS,EAAC,MAAM,mBAAmB,CAAC;AAG5C,OAAO,EAAC,cAAc,EAAC,mCAAgC;AAEvD,OAAO,EAAC,YAAY,EAAC,kCAA+B;AACp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,EAAE,WAAW,EACxB,UAAU,EAAE,UAAU,EACtB,iBAAiB,EAAE,iBAAiB,GACtC,CACL,CAAC;IACN,CAAC;IAED,IAAI,KAAK,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;QAC1B,OAAO,CACH,KAAC,cAAc,IACX,KAAK,EAAE,KAAK,EACZ,WAAW,EAAE,WAAW,EACxB,UAAU,EAAE,UAAU,EACtB,iBAAiB,EAAE,iBAAiB,GACtC,CACL,CAAC;IACN,CAAC;IAED,IAAI,KAAK,CAAC,IAAI,KAAK,YAAY,EAAE,CAAC;QAC9B,OAAO,CACH,KAAC,kBAAkB,IACf,KAAK,EAAE,KAAK,EACZ,WAAW,EAAE,WAAW,EACxB,UAAU,EAAE,UAAU,EACtB,iBAAiB,EAAE,iBAAiB,GACtC,CACL,CAAC;IACN,CAAC;IAED,IAAI,KAAK,CAAC,IAAI,KAAK,QAAQ,IAAI,KAAK,CAAC,IAAI,KAAK,qBAAqB,EAAE,CAAC;QAClE,OAAO,CACH,KAAC,eAAe,IACZ,KAAK,EAAE,KAAK,EACZ,WAAW,EAAE,WAAW,EACxB,UAAU,EAAE,UAAU,EACtB,iBAAiB,EAAE,iBAAiB,GACtC,CACL,CAAC;IACN,CAAC;IAED,OAAO,IAAI,CAAC;AAChB,CAAC,CAAC","sourcesContent":["import * as React from 'react';\n\nimport {TextInput} from '@gravity-ui/uikit';\n\nimport type {When} from '../../../form-generator-v2/types';\nimport {useFormContext} from '../../hooks/FormContext';\nimport {FormField} from '../../types';\nimport {collectNames} from '../../utils/fieldNames';\nimport {WhenEditor} from '../WhenEditor/WhenEditor';\n\nimport {ColorInputSettings} from './fields/ColorInputSettings';\nimport {OptionsSettings} from './fields/OptionsSettings';\nimport {Row} from './fields/Row';\nimport {SectionSettings} from './fields/SectionSettings';\nimport {SwitchSettings} from './fields/SwitchSettings';\nimport {TextFieldSettings} from './fields/TextFieldSettings';\nimport {TextSettings} from './fields/TextSettings';\n\nimport './FieldSettings.scss';\n\ninterface FieldSettingsProps {\n field: FormField;\n}\n\nexport const FieldSettings = ({field}: FieldSettingsProps) => {\n const {updateField, formFields} = useFormContext();\n\n const availableFields = React.useMemo(() => {\n const all = Array.from(collectNames(formFields));\n if (field.type === 'section' || field.type === 'text') return all;\n return all.filter((n) => n !== field.name);\n }, [formFields, field]);\n\n const whenEditorSection = (\n <Row label=\"Visible when\">\n <WhenEditor\n when={field.when}\n availableFields={availableFields}\n onChange={(next: When | undefined) => updateField(field.id, {when: next})}\n />\n </Row>\n );\n\n const commonRows = (\n <React.Fragment>\n <Row label=\"Title\">\n <TextInput\n value={'title' in field ? (field.title ?? '') : ''}\n onUpdate={(value) => updateField(field.id, {title: value})}\n placeholder=\"Label shown above the field\"\n />\n </Row>\n <Row label=\"Name\">\n <TextInput\n value={'name' in field ? (field.name ?? '') : ''}\n onUpdate={(value) => updateField(field.id, {name: value})}\n placeholder=\"Path in content object\"\n />\n </Row>\n </React.Fragment>\n );\n\n if (field.type === 'section') {\n return (\n <SectionSettings\n field={field}\n updateField={updateField}\n whenEditorSection={whenEditorSection}\n />\n );\n }\n\n if (field.type === 'text') {\n return (\n <TextSettings\n field={field}\n updateField={updateField}\n whenEditorSection={whenEditorSection}\n />\n );\n }\n\n if (field.type === 'textInput' || field.type === 'textArea') {\n return (\n <TextFieldSettings\n field={field}\n updateField={updateField}\n commonRows={commonRows}\n whenEditorSection={whenEditorSection}\n />\n );\n }\n\n if (field.type === 'switch') {\n return (\n <SwitchSettings\n field={field}\n updateField={updateField}\n commonRows={commonRows}\n whenEditorSection={whenEditorSection}\n />\n );\n }\n\n if (field.type === 'colorInput') {\n return (\n <ColorInputSettings\n field={field}\n updateField={updateField}\n commonRows={commonRows}\n whenEditorSection={whenEditorSection}\n />\n );\n }\n\n if (field.type === 'select' || field.type === 'segmentedRadioGroup') {\n return (\n <OptionsSettings\n field={field}\n updateField={updateField}\n commonRows={commonRows}\n whenEditorSection={whenEditorSection}\n />\n );\n }\n\n return null;\n};\n"]}
@@ -0,0 +1,12 @@
1
+ import * as React from 'react';
2
+ import type { BuilderLeafField, FieldUpdate } from "../../../types.js";
3
+ interface ColorInputSettingsProps {
4
+ field: BuilderLeafField & {
5
+ type: 'colorInput';
6
+ };
7
+ updateField: (id: string, updates: FieldUpdate) => void;
8
+ commonRows: React.ReactNode;
9
+ whenEditorSection: React.ReactNode;
10
+ }
11
+ export declare const ColorInputSettings: ({ field, updateField, commonRows, whenEditorSection, }: ColorInputSettingsProps) => import("react/jsx-runtime").JSX.Element;
12
+ export {};
@@ -0,0 +1,6 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import * as React from 'react';
3
+ import { TextInput } from '@gravity-ui/uikit';
4
+ import { Row } from "./Row.js";
5
+ export const ColorInputSettings = ({ field, updateField, commonRows, whenEditorSection, }) => (_jsxs(React.Fragment, { children: [commonRows, _jsx(Row, { label: "Default", children: _jsx(TextInput, { value: field.defaultValue ?? '', onUpdate: (value) => updateField(field.id, { defaultValue: value || undefined }), placeholder: "#000000" }) }), whenEditorSection] }));
6
+ //# sourceMappingURL=ColorInputSettings.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ColorInputSettings.js","sourceRoot":"../../../../../../src","sources":["form-builder-v2/components/FieldSettings/fields/ColorInputSettings.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAC,SAAS,EAAC,MAAM,mBAAmB,CAAC;AAI5C,OAAO,EAAC,GAAG,EAAC,iBAAc;AAS1B,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,EAC/B,KAAK,EACL,WAAW,EACX,UAAU,EACV,iBAAiB,GACK,EAAE,EAAE,CAAC,CAC3B,MAAC,KAAK,CAAC,QAAQ,eACV,UAAU,EACX,KAAC,GAAG,IAAC,KAAK,EAAC,SAAS,YAChB,KAAC,SAAS,IACN,KAAK,EAAE,KAAK,CAAC,YAAY,IAAI,EAAE,EAC/B,QAAQ,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,WAAW,CAAC,KAAK,CAAC,EAAE,EAAE,EAAC,YAAY,EAAE,KAAK,IAAI,SAAS,EAAC,CAAC,EAC9E,WAAW,EAAC,SAAS,GACvB,GACA,EACL,iBAAiB,IACL,CACpB,CAAC","sourcesContent":["import * as React from 'react';\n\nimport {TextInput} from '@gravity-ui/uikit';\n\nimport type {BuilderLeafField, FieldUpdate} from '../../../types';\n\nimport {Row} from './Row';\n\ninterface ColorInputSettingsProps {\n field: BuilderLeafField & {type: 'colorInput'};\n updateField: (id: string, updates: FieldUpdate) => void;\n commonRows: React.ReactNode;\n whenEditorSection: React.ReactNode;\n}\n\nexport const ColorInputSettings = ({\n field,\n updateField,\n commonRows,\n whenEditorSection,\n}: ColorInputSettingsProps) => (\n <React.Fragment>\n {commonRows}\n <Row label=\"Default\">\n <TextInput\n value={field.defaultValue ?? ''}\n onUpdate={(value) => updateField(field.id, {defaultValue: value || undefined})}\n placeholder=\"#000000\"\n />\n </Row>\n {whenEditorSection}\n </React.Fragment>\n);\n"]}
@@ -0,0 +1,12 @@
1
+ import * as React from 'react';
2
+ import type { BuilderLeafField, FieldUpdate } from "../../../types.js";
3
+ interface OptionsSettingsProps {
4
+ field: BuilderLeafField & {
5
+ type: 'select' | 'segmentedRadioGroup';
6
+ };
7
+ updateField: (id: string, updates: FieldUpdate) => void;
8
+ commonRows: React.ReactNode;
9
+ whenEditorSection: React.ReactNode;
10
+ }
11
+ export declare const OptionsSettings: ({ field, updateField, commonRows, whenEditorSection, }: OptionsSettingsProps) => import("react/jsx-runtime").JSX.Element;
12
+ export {};
@@ -0,0 +1,33 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import * as React from 'react';
3
+ import { TrashBin } from '@gravity-ui/icons';
4
+ import { Button, Checkbox, Icon, Select, TextInput } from '@gravity-ui/uikit';
5
+ import { formBuilderV2Cn } from "../../../utils/cn.js";
6
+ import { Row } from "./Row.js";
7
+ const b = formBuilderV2Cn('field-settings');
8
+ export const OptionsSettings = ({ field, updateField, commonRows, whenEditorSection, }) => {
9
+ const options = field.options ?? [];
10
+ const updateOption = (index, key, value) => {
11
+ const next = options.map((opt, i) => (i === index ? { ...opt, [key]: value } : opt));
12
+ updateField(field.id, { options: next });
13
+ };
14
+ const removeOption = (index) => {
15
+ const next = options.filter((_, i) => i !== index);
16
+ updateField(field.id, { options: next });
17
+ };
18
+ const addOption = () => {
19
+ const nextIndex = options.length + 1;
20
+ updateField(field.id, {
21
+ options: [...options, { value: `option${nextIndex}`, content: `Option ${nextIndex}` }],
22
+ });
23
+ };
24
+ const defaultValueOptions = [
25
+ { value: '', content: '— none —' },
26
+ ...options.map((o) => ({ value: o.value, content: o.content ?? o.value })),
27
+ ];
28
+ return (_jsxs(React.Fragment, { children: [commonRows, _jsx(Row, { label: "Default", children: _jsx(Select, { size: "m", value: [field.defaultValue ?? ''], options: defaultValueOptions, onUpdate: (next) => {
29
+ const value = next[0];
30
+ updateField(field.id, { defaultValue: value || undefined });
31
+ } }) }), field.type === 'select' && (_jsx(Row, { label: "Has clear", children: _jsx(Checkbox, { checked: Boolean(field.hasClear), onUpdate: (value) => updateField(field.id, { hasClear: value }), children: "Allow clearing the selection" }) })), _jsx(Row, { label: "Options", children: _jsxs("div", { className: b('options'), children: [options.map((opt, index) => (_jsxs("div", { className: b('option-row'), children: [_jsx(TextInput, { size: "s", value: opt.value, onUpdate: (value) => updateOption(index, 'value', value), placeholder: "value" }), _jsx(TextInput, { size: "s", value: opt.content ?? '', onUpdate: (value) => updateOption(index, 'content', value), placeholder: "label" }), _jsx(Button, { size: "s", view: "flat-danger", disabled: options.length <= 1, onClick: () => removeOption(index), title: "Remove option", children: _jsx(Icon, { data: TrashBin, size: 12 }) })] }, index))), _jsx(Button, { className: b('add-option'), size: "s", view: "normal", onClick: addOption, children: "+ Add option" })] }) }), whenEditorSection] }));
32
+ };
33
+ //# sourceMappingURL=OptionsSettings.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"OptionsSettings.js","sourceRoot":"../../../../../../src","sources":["form-builder-v2/components/FieldSettings/fields/OptionsSettings.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAC,QAAQ,EAAC,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAC,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAC,MAAM,mBAAmB,CAAC;AAG5E,OAAO,EAAC,eAAe,EAAC,6BAA0B;AAElD,OAAO,EAAC,GAAG,EAAC,iBAAc;AAE1B,MAAM,CAAC,GAAG,eAAe,CAAC,gBAAgB,CAAC,CAAC;AAS5C,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,EAC5B,KAAK,EACL,WAAW,EACX,UAAU,EACV,iBAAiB,GACE,EAAE,EAAE;IACvB,MAAM,OAAO,GAAG,KAAK,CAAC,OAAO,IAAI,EAAE,CAAC;IAEpC,MAAM,YAAY,GAAG,CAAC,KAAa,EAAE,GAAwB,EAAE,KAAa,EAAE,EAAE;QAC5E,MAAM,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,KAAK,CAAC,CAAC,CAAC,EAAC,GAAG,GAAG,EAAE,CAAC,GAAG,CAAC,EAAE,KAAK,EAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;QACnF,WAAW,CAAC,KAAK,CAAC,EAAE,EAAE,EAAC,OAAO,EAAE,IAAI,EAAC,CAAC,CAAC;IAC3C,CAAC,CAAC;IAEF,MAAM,YAAY,GAAG,CAAC,KAAa,EAAE,EAAE;QACnC,MAAM,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,KAAK,CAAC,CAAC;QACnD,WAAW,CAAC,KAAK,CAAC,EAA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6BAEpE,IACP,GACJ,EACL,iBAAiB,IACL,CACpB,CAAC;AACN,CAAC,CAAC","sourcesContent":["import * as React from 'react';\n\nimport {TrashBin} from '@gravity-ui/icons';\nimport {Button, Checkbox, Icon, Select, TextInput} from '@gravity-ui/uikit';\n\nimport type {BuilderLeafField, FieldUpdate} from '../../../types';\nimport {formBuilderV2Cn} from '../../../utils/cn';\n\nimport {Row} from './Row';\n\nconst b = formBuilderV2Cn('field-settings');\n\ninterface OptionsSettingsProps {\n field: BuilderLeafField & {type: 'select' | 'segmentedRadioGroup'};\n updateField: (id: string, updates: FieldUpdate) => void;\n commonRows: React.ReactNode;\n whenEditorSection: React.ReactNode;\n}\n\nexport const OptionsSettings = ({\n field,\n updateField,\n commonRows,\n whenEditorSection,\n}: OptionsSettingsProps) => {\n const options = field.options ?? [];\n\n const updateOption = (index: number, key: 'value' | 'content', value: string) => {\n const next = options.map((opt, i) => (i === index ? {...opt, [key]: value} : opt));\n updateField(field.id, {options: next});\n };\n\n const removeOption = (index: number) => {\n const next = options.filter((_, i) => i !== index);\n updateField(field.id, {options: next});\n };\n\n const addOption = () => {\n const nextIndex = options.length + 1;\n updateField(field.id, {\n options: [...options, {value: `option${nextIndex}`, content: `Option ${nextIndex}`}],\n });\n };\n\n const defaultValueOptions = [\n {value: '', content: '— none —'},\n ...options.map((o) => ({value: o.value, content: o.content ?? o.value})),\n ];\n\n return (\n <React.Fragment>\n {commonRows}\n <Row label=\"Default\">\n <Select\n size=\"m\"\n value={[field.defaultValue ?? '']}\n options={defaultValueOptions}\n onUpdate={(next) => {\n const value = next[0];\n updateField(field.id, {defaultValue: value || undefined});\n }}\n />\n </Row>\n {field.type === 'select' && (\n <Row label=\"Has clear\">\n <Checkbox\n checked={Boolean(field.hasClear)}\n onUpdate={(value) => updateField(field.id, {hasClear: value})}\n >\n Allow clearing the selection\n </Checkbox>\n </Row>\n )}\n <Row label=\"Options\">\n <div className={b('options')}>\n {options.map((opt, index) => (\n <div key={index} className={b('option-row')}>\n <TextInput\n size=\"s\"\n value={opt.value}\n onUpdate={(value) => updateOption(index, 'value', value)}\n placeholder=\"value\"\n />\n <TextInput\n size=\"s\"\n value={opt.content ?? ''}\n onUpdate={(value) => updateOption(index, 'content', value)}\n placeholder=\"label\"\n />\n <Button\n size=\"s\"\n view=\"flat-danger\"\n disabled={options.length <= 1}\n onClick={() => removeOption(index)}\n title=\"Remove option\"\n >\n <Icon data={TrashBin} size={12} />\n </Button>\n </div>\n ))}\n <Button className={b('add-option')} size=\"s\" view=\"normal\" onClick={addOption}>\n + Add option\n </Button>\n </div>\n </Row>\n {whenEditorSection}\n </React.Fragment>\n );\n};\n"]}
@@ -0,0 +1,7 @@
1
+ import * as React from 'react';
2
+ interface RowProps {
3
+ label: string;
4
+ children: React.ReactNode;
5
+ }
6
+ export declare const Row: ({ label, children }: RowProps) => import("react/jsx-runtime").JSX.Element;
7
+ export {};
@@ -0,0 +1,5 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { formBuilderV2Cn } from "../../../utils/cn.js";
3
+ const b = formBuilderV2Cn('field-settings');
4
+ export const Row = ({ label, children }) => (_jsxs("div", { className: b('row'), children: [_jsx("span", { className: b('row-label'), children: label }), _jsx("div", { children: children })] }));
5
+ //# sourceMappingURL=Row.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Row.js","sourceRoot":"../../../../../../src","sources":["form-builder-v2/components/FieldSettings/fields/Row.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAC,eAAe,EAAC,6BAA0B;AAElD,MAAM,CAAC,GAAG,eAAe,CAAC,gBAAgB,CAAC,CAAC;AAO5C,MAAM,CAAC,MAAM,GAAG,GAAG,CAAC,EAAC,KAAK,EAAE,QAAQ,EAAW,EAAE,EAAE,CAAC,CAChD,eAAK,SAAS,EAAE,CAAC,CAAC,KAAK,CAAC,aACpB,eAAM,SAAS,EAAE,CAAC,CAAC,WAAW,CAAC,YAAG,KAAK,GAAQ,EAC/C,wBAAM,QAAQ,GAAO,IACnB,CACT,CAAC","sourcesContent":["import * as React from 'react';\n\nimport {formBuilderV2Cn} from '../../../utils/cn';\n\nconst b = formBuilderV2Cn('field-settings');\n\ninterface RowProps {\n label: string;\n children: React.ReactNode;\n}\n\nexport const Row = ({label, children}: RowProps) => (\n <div className={b('row')}>\n <span className={b('row-label')}>{label}</span>\n <div>{children}</div>\n </div>\n);\n"]}
@@ -0,0 +1,9 @@
1
+ import * as React from 'react';
2
+ import type { BuilderSectionField, FieldUpdate } from "../../../types.js";
3
+ interface SectionSettingsProps {
4
+ field: BuilderSectionField;
5
+ updateField: (id: string, updates: FieldUpdate) => void;
6
+ whenEditorSection: React.ReactNode;
7
+ }
8
+ export declare const SectionSettings: ({ field, updateField, whenEditorSection }: SectionSettingsProps) => import("react/jsx-runtime").JSX.Element;
9
+ export {};
@@ -0,0 +1,35 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import * as React from 'react';
3
+ import { Checkbox, Select, Switch, Text, TextInput } from '@gravity-ui/uikit';
4
+ import { prefixNameForArrayMode, stripArrayModePrefix, transformChildNames, } from "../../../utils/fieldNames.js";
5
+ import { Row } from "./Row.js";
6
+ export const SectionSettings = ({ field, updateField, whenEditorSection }) => {
7
+ const isArray = Boolean(field.index);
8
+ const handleArrayModeToggle = (value) => {
9
+ if (value) {
10
+ updateField(field.id, {
11
+ index: 'index',
12
+ withAddButton: true,
13
+ itemTitle: 'Item {{index}}',
14
+ itemView: 'card',
15
+ fields: transformChildNames(field.fields, prefixNameForArrayMode),
16
+ });
17
+ }
18
+ else {
19
+ updateField(field.id, {
20
+ index: undefined,
21
+ withAddButton: undefined,
22
+ itemTitle: undefined,
23
+ itemView: undefined,
24
+ fields: transformChildNames(field.fields, stripArrayModePrefix),
25
+ });
26
+ }
27
+ };
28
+ return (_jsxs(React.Fragment, { children: [_jsx(Row, { label: "Title", children: _jsx(TextInput, { value: field.title ?? '', onUpdate: (value) => updateField(field.id, { title: value }), placeholder: "Section heading" }) }), _jsx(Row, { label: "Opened", children: _jsx(Switch, { checked: Boolean(field.opened), onUpdate: (value) => updateField(field.id, { opened: value }), children: "Expanded by default" }) }), _jsx(Row, { label: "Array mode", children: _jsx(Switch, { checked: isArray, onUpdate: handleArrayModeToggle, children: "Repeating group (array of items)" }) }), isArray && (_jsxs(React.Fragment, { children: [_jsx(Row, { label: "Hint", children: _jsxs(Text, { variant: "caption-2", color: "hint", children: ["Child field names must include ", _jsx("code", { children: '{{index}}' }), " so each row gets its own value. New fields get an ", _jsx("code", { children: 'items[{{index}}].' }), ' ', "prefix automatically."] }) }), _jsx(Row, { label: "Index name", children: _jsx(TextInput, { value: field.index ?? '', onUpdate: (value) => updateField(field.id, { index: value || 'index' }), placeholder: "index" }) }), _jsx(Row, { label: "Item title", children: _jsx(TextInput, { value: field.itemTitle ?? '', onUpdate: (value) => updateField(field.id, { itemTitle: value || undefined }), placeholder: "Item {{index}}" }) }), _jsx(Row, { label: "Item view", children: _jsx(Select, { size: "m", value: [field.itemView ?? 'clear'], options: [
29
+ { value: 'clear', content: 'Clear (flat)' },
30
+ { value: 'card', content: 'Card (bordered)' },
31
+ ], onUpdate: (next) => updateField(field.id, {
32
+ itemView: next[0],
33
+ }) }) }), _jsx(Row, { label: "Add button", children: _jsx(Checkbox, { checked: Boolean(field.withAddButton), onUpdate: (value) => updateField(field.id, { withAddButton: value }), children: "Show \u201CAdd item\u201D button" }) })] })), whenEditorSection] }));
34
+ };
35
+ //# sourceMappingURL=SectionSettings.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SectionSettings.js","sourceRoot":"../../../../../../src","sources":["form-builder-v2/components/FieldSettings/fields/SectionSettings.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,EAAC,MAAM,mBAAmB,CAAC;AAG5E,OAAO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AI,OAAO,CAAC,EAClC,OAAO,EAAE;gCACL,EAAC,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,cAAc,EAAC;gCACzC,EAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,iBAAiB,EAAC;6BAC9C,EACD,QAAQ,EAAE,CAAC,IAAI,EAAE,EAAE,CACf,WAAW,CAAC,KAAK,CAAC,EAAE,EAAE;gCAClB,QAAQ,EAAE,IAAI,CAAC,CAAC,CAAqB;6BACxC,CAAC,GAER,GACA,EACN,KAAC,GAAG,IAAC,KAAK,EAAC,YAAY,YACnB,KAAC,QAAQ,IACL,OAAO,EAAE,OAAO,CAAC,KAAK,CAAC,aAAa,CAAC,EACrC,QAAQ,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,WAAW,CAAC,KAAK,CAAC,EAAE,EAAE,EAAC,aAAa,EAAE,KAAK,EAAC,CAAC,iDAG3D,GACT,IACO,CACpB,EACA,iBAAiB,IACL,CACpB,CAAC;AACN,CAAC,CAAC","sourcesContent":["import * as React from 'react';\n\nimport {Checkbox, Select, Switch, Text, TextInput} from '@gravity-ui/uikit';\n\nimport type {BuilderSectionField, FieldUpdate} from '../../../types';\nimport {\n prefixNameForArrayMode,\n stripArrayModePrefix,\n transformChildNames,\n} from '../../../utils/fieldNames';\n\nimport {Row} from './Row';\n\ninterface SectionSettingsProps {\n field: BuilderSectionField;\n updateField: (id: string, updates: FieldUpdate) => void;\n whenEditorSection: React.ReactNode;\n}\n\nexport const SectionSettings = ({field, updateField, whenEditorSection}: SectionSettingsProps) => {\n const isArray = Boolean(field.index);\n\n const handleArrayModeToggle = (value: boolean) => {\n if (value) {\n updateField(field.id, {\n index: 'index',\n withAddButton: true,\n itemTitle: 'Item {{index}}',\n itemView: 'card',\n fields: transformChildNames(field.fields, prefixNameForArrayMode),\n });\n } else {\n updateField(field.id, {\n index: undefined,\n withAddButton: undefined,\n itemTitle: undefined,\n itemView: undefined,\n fields: transformChildNames(field.fields, stripArrayModePrefix),\n });\n }\n };\n\n return (\n <React.Fragment>\n <Row label=\"Title\">\n <TextInput\n value={field.title ?? ''}\n onUpdate={(value) => updateField(field.id, {title: value})}\n placeholder=\"Section heading\"\n />\n </Row>\n <Row label=\"Opened\">\n <Switch\n checked={Boolean(field.opened)}\n onUpdate={(value) => updateField(field.id, {opened: value})}\n >\n Expanded by default\n </Switch>\n </Row>\n <Row label=\"Array mode\">\n <Switch checked={isArray} onUpdate={handleArrayModeToggle}>\n Repeating group (array of items)\n </Switch>\n </Row>\n {isArray && (\n <React.Fragment>\n <Row label=\"Hint\">\n <Text variant=\"caption-2\" color=\"hint\">\n Child field names must include <code>{'{{index}}'}</code> so each row\n gets its own value. New fields get an <code>{'items[{{index}}].'}</code>{' '}\n prefix automatically.\n </Text>\n </Row>\n <Row label=\"Index name\">\n <TextInput\n value={field.index ?? ''}\n onUpdate={(value) => updateField(field.id, {index: value || 'index'})}\n placeholder=\"index\"\n />\n </Row>\n <Row label=\"Item title\">\n <TextInput\n value={field.itemTitle ?? ''}\n onUpdate={(value) =>\n updateField(field.id, {itemTitle: value || undefined})\n }\n placeholder=\"Item {{index}}\"\n />\n </Row>\n <Row label=\"Item view\">\n <Select\n size=\"m\"\n value={[field.itemView ?? 'clear']}\n options={[\n {value: 'clear', content: 'Clear (flat)'},\n {value: 'card', content: 'Card (bordered)'},\n ]}\n onUpdate={(next) =>\n updateField(field.id, {\n itemView: next[0] as 'card' | 'clear',\n })\n }\n />\n </Row>\n <Row label=\"Add button\">\n <Checkbox\n checked={Boolean(field.withAddButton)}\n onUpdate={(value) => updateField(field.id, {withAddButton: value})}\n >\n Show &ldquo;Add item&rdquo; button\n </Checkbox>\n </Row>\n </React.Fragment>\n )}\n {whenEditorSection}\n </React.Fragment>\n );\n};\n"]}
@@ -0,0 +1,12 @@
1
+ import * as React from 'react';
2
+ import type { BuilderLeafField, FieldUpdate } from "../../../types.js";
3
+ interface SwitchSettingsProps {
4
+ field: BuilderLeafField & {
5
+ type: 'switch';
6
+ };
7
+ updateField: (id: string, updates: FieldUpdate) => void;
8
+ commonRows: React.ReactNode;
9
+ whenEditorSection: React.ReactNode;
10
+ }
11
+ export declare const SwitchSettings: ({ field, updateField, commonRows, whenEditorSection, }: SwitchSettingsProps) => import("react/jsx-runtime").JSX.Element;
12
+ export {};
@@ -0,0 +1,6 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import * as React from 'react';
3
+ import { Switch } from '@gravity-ui/uikit';
4
+ import { Row } from "./Row.js";
5
+ export const SwitchSettings = ({ field, updateField, commonRows, whenEditorSection, }) => (_jsxs(React.Fragment, { children: [commonRows, _jsx(Row, { label: "Default", children: _jsx(Switch, { checked: Boolean(field.defaultValue), onUpdate: (value) => updateField(field.id, { defaultValue: value }) }) }), whenEditorSection] }));
6
+ //# sourceMappingURL=SwitchSettings.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SwitchSettings.js","sourceRoot":"../../../../../../src","sources":["form-builder-v2/components/FieldSettings/fields/SwitchSettings.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAC,MAAM,EAAC,MAAM,mBAAmB,CAAC;AAIzC,OAAO,EAAC,GAAG,EAAC,iBAAc;AAS1B,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,EAC3B,KAAK,EACL,WAAW,EACX,UAAU,EACV,iBAAiB,GACC,EAAE,EAAE,CAAC,CACvB,MAAC,KAAK,CAAC,QAAQ,eACV,UAAU,EACX,KAAC,GAAG,IAAC,KAAK,EAAC,SAAS,YAChB,KAAC,MAAM,IACH,OAAO,EAAE,OAAO,CAAC,KAAK,CAAC,YAAY,CAAC,EACpC,QAAQ,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,WAAW,CAAC,KAAK,CAAC,EAAE,EAAE,EAAC,YAAY,EAAE,KAAK,EAAC,CAAC,GACnE,GACA,EACL,iBAAiB,IACL,CACpB,CAAC","sourcesContent":["import * as React from 'react';\n\nimport {Switch} from '@gravity-ui/uikit';\n\nimport type {BuilderLeafField, FieldUpdate} from '../../../types';\n\nimport {Row} from './Row';\n\ninterface SwitchSettingsProps {\n field: BuilderLeafField & {type: 'switch'};\n updateField: (id: string, updates: FieldUpdate) => void;\n commonRows: React.ReactNode;\n whenEditorSection: React.ReactNode;\n}\n\nexport const SwitchSettings = ({\n field,\n updateField,\n commonRows,\n whenEditorSection,\n}: SwitchSettingsProps) => (\n <React.Fragment>\n {commonRows}\n <Row label=\"Default\">\n <Switch\n checked={Boolean(field.defaultValue)}\n onUpdate={(value) => updateField(field.id, {defaultValue: value})}\n />\n </Row>\n {whenEditorSection}\n </React.Fragment>\n);\n"]}
@@ -0,0 +1,12 @@
1
+ import * as React from 'react';
2
+ import type { BuilderLeafField, FieldUpdate } from "../../../types.js";
3
+ interface TextFieldSettingsProps {
4
+ field: BuilderLeafField & {
5
+ type: 'textInput' | 'textArea';
6
+ };
7
+ updateField: (id: string, updates: FieldUpdate) => void;
8
+ commonRows: React.ReactNode;
9
+ whenEditorSection: React.ReactNode;
10
+ }
11
+ export declare const TextFieldSettings: ({ field, updateField, commonRows, whenEditorSection, }: TextFieldSettingsProps) => import("react/jsx-runtime").JSX.Element;
12
+ export {};
@@ -0,0 +1,6 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import * as React from 'react';
3
+ import { TextInput } from '@gravity-ui/uikit';
4
+ import { Row } from "./Row.js";
5
+ export const TextFieldSettings = ({ field, updateField, commonRows, whenEditorSection, }) => (_jsxs(React.Fragment, { children: [commonRows, _jsx(Row, { label: "Default", children: _jsx(TextInput, { value: field.defaultValue ?? '', onUpdate: (value) => updateField(field.id, { defaultValue: value || undefined }), placeholder: "Default value" }) }), whenEditorSection] }));
6
+ //# sourceMappingURL=TextFieldSettings.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TextFieldSettings.js","sourceRoot":"../../../../../../src","sources":["form-builder-v2/components/FieldSettings/fields/TextFieldSettings.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAC,SAAS,EAAC,MAAM,mBAAmB,CAAC;AAI5C,OAAO,EAAC,GAAG,EAAC,iBAAc;AAS1B,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,EAC9B,KAAK,EACL,WAAW,EACX,UAAU,EACV,iBAAiB,GACI,EAAE,EAAE,CAAC,CAC1B,MAAC,KAAK,CAAC,QAAQ,eACV,UAAU,EACX,KAAC,GAAG,IAAC,KAAK,EAAC,SAAS,YAChB,KAAC,SAAS,IACN,KAAK,EAAE,KAAK,CAAC,YAAY,IAAI,EAAE,EAC/B,QAAQ,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,WAAW,CAAC,KAAK,CAAC,EAAE,EAAE,EAAC,YAAY,EAAE,KAAK,IAAI,SAAS,EAAC,CAAC,EAC9E,WAAW,EAAC,eAAe,GAC7B,GACA,EACL,iBAAiB,IACL,CACpB,CAAC","sourcesContent":["import * as React from 'react';\n\nimport {TextInput} from '@gravity-ui/uikit';\n\nimport type {BuilderLeafField, FieldUpdate} from '../../../types';\n\nimport {Row} from './Row';\n\ninterface TextFieldSettingsProps {\n field: BuilderLeafField & {type: 'textInput' | 'textArea'};\n updateField: (id: string, updates: FieldUpdate) => void;\n commonRows: React.ReactNode;\n whenEditorSection: React.ReactNode;\n}\n\nexport const TextFieldSettings = ({\n field,\n updateField,\n commonRows,\n whenEditorSection,\n}: TextFieldSettingsProps) => (\n <React.Fragment>\n {commonRows}\n <Row label=\"Default\">\n <TextInput\n value={field.defaultValue ?? ''}\n onUpdate={(value) => updateField(field.id, {defaultValue: value || undefined})}\n placeholder=\"Default value\"\n />\n </Row>\n {whenEditorSection}\n </React.Fragment>\n);\n"]}
@@ -0,0 +1,11 @@
1
+ import * as React from 'react';
2
+ import type { BuilderLeafField, FieldUpdate } from "../../../types.js";
3
+ interface TextSettingsProps {
4
+ field: BuilderLeafField & {
5
+ type: 'text';
6
+ };
7
+ updateField: (id: string, updates: FieldUpdate) => void;
8
+ whenEditorSection: React.ReactNode;
9
+ }
10
+ export declare const TextSettings: ({ field, updateField, whenEditorSection }: TextSettingsProps) => import("react/jsx-runtime").JSX.Element;
11
+ export {};
@@ -0,0 +1,48 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import * as React from 'react';
3
+ import { Select, TextArea } from '@gravity-ui/uikit';
4
+ import { Row } from "./Row.js";
5
+ const TEXT_COLOR_OPTIONS = [
6
+ { value: '', content: 'Default' },
7
+ { value: 'primary', content: 'Primary' },
8
+ { value: 'secondary', content: 'Secondary' },
9
+ { value: 'hint', content: 'Hint' },
10
+ { value: 'info', content: 'Info' },
11
+ { value: 'positive', content: 'Positive' },
12
+ { value: 'warning', content: 'Warning' },
13
+ { value: 'danger', content: 'Danger' },
14
+ { value: 'utility', content: 'Utility' },
15
+ { value: 'misc', content: 'Misc' },
16
+ ];
17
+ const TEXT_LEVEL_OPTIONS = [
18
+ { value: '', content: 'None' },
19
+ { value: 'info', content: 'Info banner' },
20
+ { value: 'danger', content: 'Danger banner' },
21
+ ];
22
+ const TEXT_COLORS = [
23
+ 'primary',
24
+ 'secondary',
25
+ 'hint',
26
+ 'info',
27
+ 'positive',
28
+ 'warning',
29
+ 'danger',
30
+ 'utility',
31
+ 'misc',
32
+ ];
33
+ const isTextColor = (value) => TEXT_COLORS.includes(value);
34
+ const isTextLevel = (value) => value === 'info' || value === 'danger';
35
+ export const TextSettings = ({ field, updateField, whenEditorSection }) => {
36
+ const handleLevelUpdate = ([value]) => {
37
+ updateField(field.id, {
38
+ level: isTextLevel(value) ? value : undefined,
39
+ });
40
+ };
41
+ const handleColorUpdate = ([value]) => {
42
+ updateField(field.id, {
43
+ color: isTextColor(value) ? value : undefined,
44
+ });
45
+ };
46
+ return (_jsxs(React.Fragment, { children: [_jsx(Row, { label: "Text", children: _jsx(TextArea, { value: field.text ?? '', onUpdate: (value) => updateField(field.id, { text: value }), minRows: 2, placeholder: "Static hint text" }) }), _jsx(Row, { label: "Banner", children: _jsx(Select, { size: "m", value: [field.level ?? ''], options: TEXT_LEVEL_OPTIONS, onUpdate: handleLevelUpdate }) }), _jsx(Row, { label: "Color", children: _jsx(Select, { size: "m", value: [field.color ?? ''], options: TEXT_COLOR_OPTIONS, onUpdate: handleColorUpdate }) }), whenEditorSection] }));
47
+ };
48
+ //# sourceMappingURL=TextSettings.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TextSettings.js","sourceRoot":"../../../../../../src","sources":["form-builder-v2/components/FieldSettings/fields/TextSettings.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAC,MAAM,EAAE,QAAQ,EAAC,MAAM,mBAAmB,CAAC;AAKnD,OAAO,EAAC,GAAG,EAAC,iBAAc;AAI1B,MAAM,kBAAkB,GAAG;IACvB,EAAC,KAAK,EAAE,EAAE,EAAE,OAAO,EAAE,SAAS,EAAC;IAC/B,EAAC,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,SAAS,EAAC;IACtC,EAAC,KAAK,EAAE,WAAW,EAAE,OAAO,EAAE,WAAW,EAAC;IAC1C,EAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAC;IAChC,EAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAC;IAChC,EAAC,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,UAAU,EAAC;IACxC,EAAC,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,SAAS,EAAC;IACtC,EAAC,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAC;IACpC,EAAC,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,SAAS,EAAC;IACtC,EAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAC;CACnC,CAAC;AAEF,MAAM,kBAAkB,G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AC,IAAI,IAAI,EAAE,EACvB,QAAQ,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,WAAW,CAAC,KAAK,CAAC,EAAE,EAAE,EAAC,IAAI,EAAE,KAAK,EAAC,CAAC,EACzD,OAAO,EAAE,CAAC,EACV,WAAW,EAAC,kBAAkB,GAChC,GACA,EACN,KAAC,GAAG,IAAC,KAAK,EAAC,QAAQ,YACf,KAAC,MAAM,IACH,IAAI,EAAC,GAAG,EACR,KAAK,EAAE,CAAC,KAAK,CAAC,KAAK,IAAI,EAAE,CAAC,EAC1B,OAAO,EAAE,kBAAkB,EAC3B,QAAQ,EAAE,iBAAiB,GAC7B,GACA,EACN,KAAC,GAAG,IAAC,KAAK,EAAC,OAAO,YACd,KAAC,MAAM,IACH,IAAI,EAAC,GAAG,EACR,KAAK,EAAE,CAAC,KAAK,CAAC,KAAK,IAAI,EAAE,CAAC,EAC1B,OAAO,EAAE,kBAAkB,EAC3B,QAAQ,EAAE,iBAAiB,GAC7B,GACA,EACL,iBAAiB,IACL,CACpB,CAAC;AACN,CAAC,CAAC","sourcesContent":["import * as React from 'react';\n\nimport {Select, TextArea} from '@gravity-ui/uikit';\n\nimport type {TextColor} from '../../../../form-generator-v2/types';\nimport type {BuilderLeafField, FieldUpdate} from '../../../types';\n\nimport {Row} from './Row';\n\ntype TextLevel = 'info' | 'danger';\n\nconst TEXT_COLOR_OPTIONS = [\n {value: '', content: 'Default'},\n {value: 'primary', content: 'Primary'},\n {value: 'secondary', content: 'Secondary'},\n {value: 'hint', content: 'Hint'},\n {value: 'info', content: 'Info'},\n {value: 'positive', content: 'Positive'},\n {value: 'warning', content: 'Warning'},\n {value: 'danger', content: 'Danger'},\n {value: 'utility', content: 'Utility'},\n {value: 'misc', content: 'Misc'},\n];\n\nconst TEXT_LEVEL_OPTIONS = [\n {value: '', content: 'None'},\n {value: 'info', content: 'Info banner'},\n {value: 'danger', content: 'Danger banner'},\n];\n\nconst TEXT_COLORS: readonly TextColor[] = [\n 'primary',\n 'secondary',\n 'hint',\n 'info',\n 'positive',\n 'warning',\n 'danger',\n 'utility',\n 'misc',\n];\n\nconst isTextColor = (value: string): value is TextColor =>\n (TEXT_COLORS as readonly string[]).includes(value);\n\nconst isTextLevel = (value: string): value is TextLevel => value === 'info' || value === 'danger';\n\ninterface TextSettingsProps {\n field: BuilderLeafField & {type: 'text'};\n updateField: (id: string, updates: FieldUpdate) => void;\n whenEditorSection: React.ReactNode;\n}\n\nexport const TextSettings = ({field, updateField, whenEditorSection}: TextSettingsProps) => {\n const handleLevelUpdate = ([value]: string[]) => {\n updateField(field.id, {\n level: isTextLevel(value) ? value : undefined,\n });\n };\n\n const handleColorUpdate = ([value]: string[]) => {\n updateField(field.id, {\n color: isTextColor(value) ? value : undefined,\n });\n };\n\n return (\n <React.Fragment>\n <Row label=\"Text\">\n <TextArea\n value={field.text ?? ''}\n onUpdate={(value) => updateField(field.id, {text: value})}\n minRows={2}\n placeholder=\"Static hint text\"\n />\n </Row>\n <Row label=\"Banner\">\n <Select\n size=\"m\"\n value={[field.level ?? '']}\n options={TEXT_LEVEL_OPTIONS}\n onUpdate={handleLevelUpdate}\n />\n </Row>\n <Row label=\"Color\">\n <Select\n size=\"m\"\n value={[field.color ?? '']}\n options={TEXT_COLOR_OPTIONS}\n onUpdate={handleColorUpdate}\n />\n </Row>\n {whenEditorSection}\n </React.Fragment>\n );\n};\n"]}