@webiny/app-admin 5.43.2 → 6.0.0-alpha.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 (553) hide show
  1. package/base/Admin.js +25 -35
  2. package/base/Admin.js.map +1 -1
  3. package/base/Base/Menus/SupportMenuItems.d.ts +2 -0
  4. package/base/Base/Menus/SupportMenuItems.js +20 -0
  5. package/base/Base/Menus/SupportMenuItems.js.map +1 -0
  6. package/base/Base/Menus/WebinyVersion.d.ts +2 -0
  7. package/base/Base/Menus/WebinyVersion.js +24 -0
  8. package/base/Base/Menus/WebinyVersion.js.map +1 -0
  9. package/base/Base/Menus.d.ts +2 -0
  10. package/base/Base/Menus.js +129 -0
  11. package/base/Base/Menus.js.map +1 -0
  12. package/base/Base/Routes.d.ts +2 -0
  13. package/base/Base/Routes.js +24 -0
  14. package/base/Base/Routes.js.map +1 -0
  15. package/base/Base/Tenant/wby-logo.svg +3 -0
  16. package/base/Base/Tenant.d.ts +2 -0
  17. package/base/Base/Tenant.js +19 -0
  18. package/base/Base/Tenant.js.map +1 -0
  19. package/base/Base.js +11 -79
  20. package/base/Base.js.map +1 -1
  21. package/base/WebinyVersion.d.ts +2 -0
  22. package/base/WebinyVersion.js +24 -0
  23. package/base/WebinyVersion.js.map +1 -0
  24. package/base/plugins/AddGraphQLQuerySelection.js +11 -21
  25. package/base/plugins/AddGraphQLQuerySelection.js.map +1 -1
  26. package/base/providers/AdminUiStateProvider.d.ts +1 -0
  27. package/base/providers/AdminUiStateProvider.js +14 -0
  28. package/base/providers/AdminUiStateProvider.js.map +1 -0
  29. package/base/providers/ApolloProvider.js +9 -15
  30. package/base/providers/ApolloProvider.js.map +1 -1
  31. package/base/providers/TelemetryProvider.js +12 -18
  32. package/base/providers/TelemetryProvider.js.map +1 -1
  33. package/base/providers/UiProviders.d.ts +1 -0
  34. package/base/providers/UiProviders.js +14 -0
  35. package/base/providers/UiProviders.js.map +1 -0
  36. package/base/providers/UiStateProvider.js +9 -15
  37. package/base/providers/UiStateProvider.js.map +1 -1
  38. package/base/providers/ViewCompositionProvider.js +33 -44
  39. package/base/providers/ViewCompositionProvider.js.map +1 -1
  40. package/base/ui/Brand.js +5 -12
  41. package/base/ui/Brand.js.map +1 -1
  42. package/base/ui/CenteredView.js +12 -43
  43. package/base/ui/CenteredView.js.map +1 -1
  44. package/base/ui/Dashboard.js +5 -12
  45. package/base/ui/Dashboard.js.map +1 -1
  46. package/base/ui/FileManager.js +42 -56
  47. package/base/ui/FileManager.js.map +1 -1
  48. package/base/ui/Layout.js +8 -16
  49. package/base/ui/Layout.js.map +1 -1
  50. package/base/ui/LocaleSelector.js +5 -12
  51. package/base/ui/LocaleSelector.js.map +1 -1
  52. package/base/ui/LoginScreen.js +9 -15
  53. package/base/ui/LoginScreen.js.map +1 -1
  54. package/base/ui/Logo.d.ts +0 -5
  55. package/base/ui/Logo.js +5 -26
  56. package/base/ui/Logo.js.map +1 -1
  57. package/base/ui/Navigation.d.ts +0 -57
  58. package/base/ui/Navigation.js +5 -146
  59. package/base/ui/Navigation.js.map +1 -1
  60. package/base/ui/NotFound.js +5 -12
  61. package/base/ui/NotFound.js.map +1 -1
  62. package/base/ui/Tags.js +14 -19
  63. package/base/ui/Tags.js.map +1 -1
  64. package/base/ui/{Search.d.ts → TenantSelector.d.ts} +2 -18
  65. package/base/ui/TenantSelector.js +8 -0
  66. package/base/ui/TenantSelector.js.map +1 -0
  67. package/base/ui/UserMenu/UserMenu.d.ts +39 -0
  68. package/base/ui/UserMenu/UserMenu.js +8 -0
  69. package/base/ui/UserMenu/UserMenu.js.map +1 -0
  70. package/base/ui/UserMenu/UserMenuHandle.d.ts +39 -0
  71. package/base/ui/UserMenu/UserMenuHandle.js +8 -0
  72. package/base/ui/UserMenu/UserMenuHandle.js.map +1 -0
  73. package/base/ui/UserMenu/UserMenuItem.d.ts +81 -0
  74. package/base/ui/UserMenu/UserMenuItem.js +19 -0
  75. package/base/ui/UserMenu/UserMenuItem.js.map +1 -0
  76. package/base/ui/UserMenu/UserMenuLink.d.ts +81 -0
  77. package/base/ui/UserMenu/UserMenuLink.js +19 -0
  78. package/base/ui/UserMenu/UserMenuLink.js.map +1 -0
  79. package/base/ui/UserMenu/UserMenuSeparator.d.ts +42 -0
  80. package/base/ui/UserMenu/UserMenuSeparator.js +9 -0
  81. package/base/ui/UserMenu/UserMenuSeparator.js.map +1 -0
  82. package/base/ui/UserMenu.d.ts +3 -79
  83. package/base/ui/UserMenu.js +14 -101
  84. package/base/ui/UserMenu.js.map +1 -1
  85. package/components/AdminLayout.js +7 -13
  86. package/components/AdminLayout.js.map +1 -1
  87. package/components/AppInstaller/AppInstaller.js +57 -67
  88. package/components/AppInstaller/AppInstaller.js.map +1 -1
  89. package/components/AppInstaller/Sidebar.js +49 -69
  90. package/components/AppInstaller/Sidebar.js.map +1 -1
  91. package/components/AppInstaller/index.js +10 -16
  92. package/components/AppInstaller/index.js.map +1 -1
  93. package/components/AppInstaller/styled.js +8 -15
  94. package/components/AppInstaller/styled.js.map +1 -1
  95. package/components/AppInstaller/useInstaller.js +81 -91
  96. package/components/AppInstaller/useInstaller.js.map +1 -1
  97. package/components/BulkActions/Worker.js +95 -141
  98. package/components/BulkActions/Worker.js.map +1 -1
  99. package/components/BulkActions/index.js +2 -27
  100. package/components/BulkActions/index.js.map +1 -1
  101. package/components/BulkActions/useDialogWithReport/DialogMessage.js +20 -33
  102. package/components/BulkActions/useDialogWithReport/DialogMessage.js.map +1 -1
  103. package/components/BulkActions/useDialogWithReport/index.js +1 -16
  104. package/components/BulkActions/useDialogWithReport/index.js.map +1 -1
  105. package/components/BulkActions/useDialogWithReport/useDialogWithReport.js +45 -52
  106. package/components/BulkActions/useDialogWithReport/useDialogWithReport.js.map +1 -1
  107. package/components/Buttons/Buttons.d.ts +7 -6
  108. package/components/Buttons/Buttons.js +58 -56
  109. package/components/Buttons/Buttons.js.map +1 -1
  110. package/components/Buttons/Buttons.styles.js +2 -9
  111. package/components/Buttons/Buttons.styles.js.map +1 -1
  112. package/components/Buttons/index.js +2 -25
  113. package/components/Buttons/index.js.map +1 -1
  114. package/components/Buttons/useButtons.js +13 -19
  115. package/components/Buttons/useButtons.js.map +1 -1
  116. package/components/Dialogs/CustomDialog.js +30 -37
  117. package/components/Dialogs/CustomDialog.js.map +1 -1
  118. package/components/Dialogs/Dialog.d.ts +8 -4
  119. package/components/Dialogs/Dialog.js +56 -41
  120. package/components/Dialogs/Dialog.js.map +1 -1
  121. package/components/Dialogs/DialogsContext.d.ts +9 -3
  122. package/components/Dialogs/DialogsContext.js +96 -107
  123. package/components/Dialogs/DialogsContext.js.map +1 -1
  124. package/components/Dialogs/useDialogs.js +5 -17
  125. package/components/Dialogs/useDialogs.js.map +1 -1
  126. package/components/EmptyView.d.ts +1 -1
  127. package/components/EmptyView.js +31 -41
  128. package/components/EmptyView.js.map +1 -1
  129. package/components/Filters/Filters.js +12 -20
  130. package/components/Filters/Filters.js.map +1 -1
  131. package/components/Filters/FiltersToggle.d.ts +7 -0
  132. package/components/Filters/FiltersToggle.js +26 -0
  133. package/components/Filters/FiltersToggle.js.map +1 -0
  134. package/components/Filters/index.d.ts +1 -0
  135. package/components/Filters/index.js +2 -16
  136. package/components/Filters/index.js.map +1 -1
  137. package/components/FloatingActionButton.js +7 -13
  138. package/components/FloatingActionButton.js.map +1 -1
  139. package/components/FloatingPanel.js +44 -68
  140. package/components/FloatingPanel.js.map +1 -1
  141. package/components/IconPicker/IconPicker.d.ts +1 -1
  142. package/components/IconPicker/IconPicker.js +25 -32
  143. package/components/IconPicker/IconPicker.js.map +1 -1
  144. package/components/IconPicker/IconPickerComponent.d.ts +5 -5
  145. package/components/IconPicker/IconPickerComponent.js +67 -87
  146. package/components/IconPicker/IconPickerComponent.js.map +1 -1
  147. package/components/IconPicker/IconPickerPresenter.d.ts +5 -4
  148. package/components/IconPicker/IconPickerPresenter.js +68 -109
  149. package/components/IconPicker/IconPickerPresenter.js.map +1 -1
  150. package/components/IconPicker/IconPickerPresenter.test.js +21 -23
  151. package/components/IconPicker/IconPickerPresenter.test.js.map +1 -1
  152. package/components/IconPicker/IconPickerPresenterProvider.js +10 -17
  153. package/components/IconPicker/IconPickerPresenterProvider.js.map +1 -1
  154. package/components/IconPicker/IconPickerTab.d.ts +2 -1
  155. package/components/IconPicker/IconPickerTab.js +103 -113
  156. package/components/IconPicker/IconPickerTab.js.map +1 -1
  157. package/components/IconPicker/IconRenderer.js +16 -24
  158. package/components/IconPicker/IconRenderer.js.map +1 -1
  159. package/components/IconPicker/IconRepository.js +41 -73
  160. package/components/IconPicker/IconRepository.js.map +1 -1
  161. package/components/IconPicker/IconRepository.test.js +11 -13
  162. package/components/IconPicker/IconRepository.test.js.map +1 -1
  163. package/components/IconPicker/IconRepositoryFactory.js +14 -37
  164. package/components/IconPicker/IconRepositoryFactory.js.map +1 -1
  165. package/components/IconPicker/Loading.js +42 -68
  166. package/components/IconPicker/Loading.js.map +1 -1
  167. package/components/IconPicker/components/IconPickerCell.d.ts +12 -0
  168. package/components/IconPicker/components/IconPickerCell.js +27 -0
  169. package/components/IconPicker/components/IconPickerCell.js.map +1 -0
  170. package/components/IconPicker/components/IconPickerContent.d.ts +11 -0
  171. package/components/IconPicker/components/IconPickerContent.js +41 -0
  172. package/components/IconPicker/components/IconPickerContent.js.map +1 -0
  173. package/components/IconPicker/components/IconPickerRow.d.ts +4 -0
  174. package/components/IconPicker/components/IconPickerRow.js +14 -0
  175. package/components/IconPicker/components/IconPickerRow.js.map +1 -0
  176. package/components/IconPicker/components/IconPickerTrigger.d.ts +13 -0
  177. package/components/IconPicker/components/IconPickerTrigger.js +52 -0
  178. package/components/IconPicker/components/IconPickerTrigger.js.map +1 -0
  179. package/components/IconPicker/components/index.d.ts +4 -0
  180. package/components/IconPicker/components/index.js +6 -0
  181. package/components/IconPicker/components/index.js.map +1 -0
  182. package/components/IconPicker/config/Emojis.js +9 -16
  183. package/components/IconPicker/config/Emojis.js.map +1 -1
  184. package/components/IconPicker/config/FontAwesomeIcons.js +30 -43
  185. package/components/IconPicker/config/FontAwesomeIcons.js.map +1 -1
  186. package/components/IconPicker/config/IconPackProvider.js +10 -16
  187. package/components/IconPicker/config/IconPackProvider.js.map +1 -1
  188. package/components/IconPicker/config/IconType.js +52 -55
  189. package/components/IconPicker/config/IconType.js.map +1 -1
  190. package/components/IconPicker/config/index.js +35 -53
  191. package/components/IconPicker/config/index.js.map +1 -1
  192. package/components/IconPicker/defaultIcon.js +1 -7
  193. package/components/IconPicker/defaultIcon.js.map +1 -1
  194. package/components/IconPicker/index.js +6 -47
  195. package/components/IconPicker/index.js.map +1 -1
  196. package/components/IconPicker/plugins/customPlugin.js +71 -96
  197. package/components/IconPicker/plugins/customPlugin.js.map +1 -1
  198. package/components/IconPicker/plugins/emojisPlugin.js +80 -117
  199. package/components/IconPicker/plugins/emojisPlugin.js.map +1 -1
  200. package/components/IconPicker/plugins/graphql.js +19 -10
  201. package/components/IconPicker/plugins/graphql.js.map +1 -1
  202. package/components/IconPicker/plugins/iconsPlugin.js +62 -93
  203. package/components/IconPicker/plugins/iconsPlugin.js.map +1 -1
  204. package/components/IconPicker/types.d.ts +1 -1
  205. package/components/IconPicker/types.js +3 -8
  206. package/components/IconPicker/types.js.map +1 -1
  207. package/components/LexicalEditor/LexicalEditor.js +24 -31
  208. package/components/LexicalEditor/LexicalEditor.js.map +1 -1
  209. package/components/LexicalEditor/index.js +1 -12
  210. package/components/LexicalEditor/index.js.map +1 -1
  211. package/components/MultiImageUpload.d.ts +1 -1
  212. package/components/MultiImageUpload.js +8 -31
  213. package/components/MultiImageUpload.js.map +1 -1
  214. package/components/OptionsMenu/OptionsMenu.d.ts +1 -0
  215. package/components/OptionsMenu/OptionsMenu.js +17 -23
  216. package/components/OptionsMenu/OptionsMenu.js.map +1 -1
  217. package/components/OptionsMenu/OptionsMenuItem.d.ts +1 -0
  218. package/components/OptionsMenu/OptionsMenuItem.js +12 -17
  219. package/components/OptionsMenu/OptionsMenuItem.js.map +1 -1
  220. package/components/OptionsMenu/OptionsMenuLink.d.ts +1 -0
  221. package/components/OptionsMenu/OptionsMenuLink.js +13 -36
  222. package/components/OptionsMenu/OptionsMenuLink.js.map +1 -1
  223. package/components/OptionsMenu/index.js +4 -51
  224. package/components/OptionsMenu/index.js.map +1 -1
  225. package/components/OptionsMenu/useOptionsMenuItem.js +12 -18
  226. package/components/OptionsMenu/useOptionsMenuItem.js.map +1 -1
  227. package/components/OverlayLayout/OverlayLayout.d.ts +6 -16
  228. package/components/OverlayLayout/OverlayLayout.js +42 -147
  229. package/components/OverlayLayout/OverlayLayout.js.map +1 -1
  230. package/components/OverlayLayout/components/OverlayBackdrop.d.ts +7 -0
  231. package/components/OverlayLayout/components/OverlayBackdrop.js +15 -0
  232. package/components/OverlayLayout/components/OverlayBackdrop.js.map +1 -0
  233. package/components/OverlayLayout/components/OverlayContent.d.ts +6 -0
  234. package/components/OverlayLayout/components/OverlayContent.js +21 -0
  235. package/components/OverlayLayout/components/OverlayContent.js.map +1 -0
  236. package/components/OverlayLayout/components/OverlayHeader.d.ts +13 -0
  237. package/components/OverlayLayout/components/OverlayHeader.js +44 -0
  238. package/components/OverlayLayout/components/OverlayHeader.js.map +1 -0
  239. package/components/OverlayLayout/components/OverlayRoot.d.ts +9 -0
  240. package/components/OverlayLayout/components/OverlayRoot.js +19 -0
  241. package/components/OverlayLayout/components/OverlayRoot.js.map +1 -0
  242. package/components/OverlayLayout/components/index.d.ts +4 -0
  243. package/components/OverlayLayout/components/index.js +6 -0
  244. package/components/OverlayLayout/components/index.js.map +1 -0
  245. package/components/OverlayLayout/index.js +1 -16
  246. package/components/OverlayLayout/index.js.map +1 -1
  247. package/components/Permissions/CannotUseAaclAlert.js +5 -12
  248. package/components/Permissions/CannotUseAaclAlert.js.map +1 -1
  249. package/components/Permissions/Permissions.js +37 -48
  250. package/components/Permissions/Permissions.js.map +1 -1
  251. package/components/Permissions/PermissionsGroup.d.ts +6 -0
  252. package/components/Permissions/PermissionsGroup.js +18 -0
  253. package/components/Permissions/PermissionsGroup.js.map +1 -0
  254. package/components/Permissions/StyledComponents.d.ts +1 -2
  255. package/components/Permissions/StyledComponents.js +12 -25
  256. package/components/Permissions/StyledComponents.js.map +1 -1
  257. package/components/Permissions/index.d.ts +1 -0
  258. package/components/Permissions/index.js +4 -35
  259. package/components/Permissions/index.js.map +1 -1
  260. package/components/ResizablePanels/index.js +1 -42
  261. package/components/ResizablePanels/index.js.map +1 -1
  262. package/components/RichTextEditor/RichTextEditor.js +13 -21
  263. package/components/RichTextEditor/RichTextEditor.js.map +1 -1
  264. package/components/RichTextEditor/index.js +2 -19
  265. package/components/RichTextEditor/index.js.map +1 -1
  266. package/components/RichTextEditor/tools/header/index.js +455 -521
  267. package/components/RichTextEditor/tools/header/index.js.map +1 -1
  268. package/components/RichTextEditor/tools/image/index.js +147 -182
  269. package/components/RichTextEditor/tools/image/index.js.map +1 -1
  270. package/components/RichTextEditor/tools/image/svgs.js +4 -10
  271. package/components/RichTextEditor/tools/image/svgs.js.map +1 -1
  272. package/components/RichTextEditor/tools/image/tunes.js +75 -96
  273. package/components/RichTextEditor/tools/image/tunes.js.map +1 -1
  274. package/components/RichTextEditor/tools/image/types.js +1 -5
  275. package/components/RichTextEditor/tools/image/ui.js +143 -174
  276. package/components/RichTextEditor/tools/image/ui.js.map +1 -1
  277. package/components/RichTextEditor/tools/paragraph/index.js +337 -389
  278. package/components/RichTextEditor/tools/paragraph/index.js.map +1 -1
  279. package/components/RichTextEditor/tools/textColor/index.js +164 -202
  280. package/components/RichTextEditor/tools/textColor/index.js.map +1 -1
  281. package/components/RichTextEditor/tools/utils.js +3 -9
  282. package/components/RichTextEditor/tools/utils.js.map +1 -1
  283. package/components/Routes.js +14 -23
  284. package/components/Routes.js.map +1 -1
  285. package/components/SearchUI.d.ts +2 -1
  286. package/components/SearchUI.js +22 -48
  287. package/components/SearchUI.js.map +1 -1
  288. package/components/SimpleForm/SimpleForm.d.ts +14 -7
  289. package/components/SimpleForm/SimpleForm.js +72 -77
  290. package/components/SimpleForm/SimpleForm.js.map +1 -1
  291. package/components/SimpleForm/index.js +1 -30
  292. package/components/SimpleForm/index.js.map +1 -1
  293. package/components/SimpleUI/InputField.js +39 -47
  294. package/components/SimpleUI/InputField.js.map +1 -1
  295. package/components/SingleImageUpload.d.ts +19 -1
  296. package/components/SingleImageUpload.js +39 -75
  297. package/components/SingleImageUpload.js.map +1 -1
  298. package/components/SplitView/SplitView.d.ts +4 -4
  299. package/components/SplitView/SplitView.js +41 -88
  300. package/components/SplitView/SplitView.js.map +1 -1
  301. package/components/SplitView/index.js +1 -24
  302. package/components/SplitView/index.js.map +1 -1
  303. package/components/StateInspector.js +28 -28
  304. package/components/StateInspector.js.map +1 -1
  305. package/components/Wcp.js +21 -25
  306. package/components/Wcp.js.map +1 -1
  307. package/components/index.js +3 -26
  308. package/components/index.js.map +1 -1
  309. package/config/AdminConfig/Menu/MenuGroup.d.ts +62 -0
  310. package/config/AdminConfig/Menu/MenuGroup.js +14 -0
  311. package/config/AdminConfig/Menu/MenuGroup.js.map +1 -0
  312. package/config/AdminConfig/Menu/MenuItem.d.ts +43 -0
  313. package/config/AdminConfig/Menu/MenuItem.js +14 -0
  314. package/config/AdminConfig/Menu/MenuItem.js.map +1 -0
  315. package/config/AdminConfig/Menu/MenuLink.d.ts +43 -0
  316. package/config/AdminConfig/Menu/MenuLink.js +18 -0
  317. package/config/AdminConfig/Menu/MenuLink.js.map +1 -0
  318. package/config/AdminConfig/Menu/SupportMenu/SupportMenuItem.d.ts +43 -0
  319. package/config/AdminConfig/Menu/SupportMenu/SupportMenuItem.js +13 -0
  320. package/config/AdminConfig/Menu/SupportMenu/SupportMenuItem.js.map +1 -0
  321. package/config/AdminConfig/Menu/SupportMenu/SupportMenuLink.d.ts +24 -0
  322. package/config/AdminConfig/Menu/SupportMenu/SupportMenuLink.js +13 -0
  323. package/config/AdminConfig/Menu/SupportMenu/SupportMenuLink.js.map +1 -0
  324. package/config/AdminConfig/Menu/SupportMenu.d.ts +72 -0
  325. package/config/AdminConfig/Menu/SupportMenu.js +49 -0
  326. package/config/AdminConfig/Menu/SupportMenu.js.map +1 -0
  327. package/config/AdminConfig/Menu/UserMenu/UserMenuItem.d.ts +41 -0
  328. package/config/AdminConfig/Menu/UserMenu/UserMenuItem.js +7 -0
  329. package/config/AdminConfig/Menu/UserMenu/UserMenuItem.js.map +1 -0
  330. package/config/AdminConfig/Menu/UserMenu/UserMenuLink.d.ts +41 -0
  331. package/config/AdminConfig/Menu/UserMenu/UserMenuLink.js +7 -0
  332. package/config/AdminConfig/Menu/UserMenu/UserMenuLink.js.map +1 -0
  333. package/config/AdminConfig/Menu/UserMenu/UserMenuSeparator.d.ts +1 -0
  334. package/config/AdminConfig/Menu/UserMenu/UserMenuSeparator.js +3 -0
  335. package/config/AdminConfig/Menu/UserMenu/UserMenuSeparator.js.map +1 -0
  336. package/config/AdminConfig/Menu/UserMenu/types.d.ts +7 -0
  337. package/config/AdminConfig/Menu/UserMenu/types.js +3 -0
  338. package/config/AdminConfig/Menu/UserMenu/types.js.map +1 -0
  339. package/config/AdminConfig/Menu/UserMenu.d.ts +129 -0
  340. package/config/AdminConfig/Menu/UserMenu.js +61 -0
  341. package/config/AdminConfig/Menu/UserMenu.js.map +1 -0
  342. package/config/AdminConfig/Menu/types.d.ts +7 -0
  343. package/config/AdminConfig/Menu/types.js +3 -0
  344. package/config/AdminConfig/Menu/types.js.map +1 -0
  345. package/config/AdminConfig/Menu.d.ts +350 -0
  346. package/config/AdminConfig/Menu.js +75 -0
  347. package/config/AdminConfig/Menu.js.map +1 -0
  348. package/config/AdminConfig/Route.d.ts +3 -0
  349. package/config/AdminConfig/Route.js +8 -0
  350. package/config/AdminConfig/Route.js.map +1 -0
  351. package/config/AdminConfig/Tenant/TenantLogo.d.ts +23 -0
  352. package/config/AdminConfig/Tenant/TenantLogo.js +16 -0
  353. package/config/AdminConfig/Tenant/TenantLogo.js.map +1 -0
  354. package/config/AdminConfig/Tenant/TenantName.d.ts +23 -0
  355. package/config/AdminConfig/Tenant/TenantName.js +16 -0
  356. package/config/AdminConfig/Tenant/TenantName.js.map +1 -0
  357. package/config/AdminConfig/Tenant.d.ts +66 -0
  358. package/config/AdminConfig/Tenant.js +23 -0
  359. package/config/AdminConfig/Tenant.js.map +1 -0
  360. package/config/AdminConfig/Theme/assignColor.d.ts +2 -0
  361. package/config/AdminConfig/Theme/assignColor.js +22 -0
  362. package/config/AdminConfig/Theme/assignColor.js.map +1 -0
  363. package/config/AdminConfig/Theme/consts.d.ts +2 -0
  364. package/config/AdminConfig/Theme/consts.js +4 -0
  365. package/config/AdminConfig/Theme/consts.js.map +1 -0
  366. package/config/AdminConfig/Theme/types.d.ts +3 -0
  367. package/config/AdminConfig/Theme/types.js +3 -0
  368. package/config/AdminConfig/Theme/types.js.map +1 -0
  369. package/config/AdminConfig/Theme.d.ts +16 -0
  370. package/config/AdminConfig/Theme.js +22 -0
  371. package/config/AdminConfig/Theme.js.map +1 -0
  372. package/config/AdminConfig.d.ts +434 -0
  373. package/config/AdminConfig.js +47 -0
  374. package/config/AdminConfig.js.map +1 -0
  375. package/config/createAdminConfig.d.ts +57 -0
  376. package/config/createAdminConfig.js +94 -0
  377. package/config/createAdminConfig.js.map +1 -0
  378. package/hooks/index.js +10 -115
  379. package/hooks/index.js.map +1 -1
  380. package/hooks/useConfirmationDialog.js +26 -39
  381. package/hooks/useConfirmationDialog.js.map +1 -1
  382. package/hooks/useDialog.js +16 -21
  383. package/hooks/useDialog.js.map +1 -1
  384. package/hooks/useIsMounted.js +6 -14
  385. package/hooks/useIsMounted.js.map +1 -1
  386. package/hooks/useKeyHandler.js +28 -46
  387. package/hooks/useKeyHandler.js.map +1 -1
  388. package/hooks/useModKey.js +9 -20
  389. package/hooks/useModKey.js.map +1 -1
  390. package/hooks/useShiftKey.js +13 -26
  391. package/hooks/useShiftKey.js.map +1 -1
  392. package/hooks/useSnackbar.js +22 -43
  393. package/hooks/useSnackbar.js.map +1 -1
  394. package/hooks/useStateIfMounted.js +8 -18
  395. package/hooks/useStateIfMounted.js.map +1 -1
  396. package/hooks/useStateWithCallback.js +7 -20
  397. package/hooks/useStateWithCallback.js.map +1 -1
  398. package/index.d.ts +2 -5
  399. package/index.js +52 -491
  400. package/index.js.map +1 -1
  401. package/package.json +25 -23
  402. package/plugins/MenuPlugin.js +15 -36
  403. package/plugins/MenuPlugin.js.map +1 -1
  404. package/plugins/PermissionRendererPlugin.js +15 -36
  405. package/plugins/PermissionRendererPlugin.js.map +1 -1
  406. package/plugins/uiLayoutRenderer/index.js +39 -48
  407. package/plugins/uiLayoutRenderer/index.js.map +1 -1
  408. package/styles.scss +7 -3
  409. package/types.d.ts +1 -36
  410. package/types.js +4 -11
  411. package/types.js.map +1 -1
  412. package/ui/UIElement.js +1 -18
  413. package/ui/UIElement.js.map +1 -1
  414. package/ui/UILayout.js +1 -18
  415. package/ui/UILayout.js.map +1 -1
  416. package/ui/UIRenderer.js +1 -12
  417. package/ui/UIRenderer.js.map +1 -1
  418. package/ui/UIView.js +1 -24
  419. package/ui/UIView.js.map +1 -1
  420. package/ui/elements/AccordionElement.js +43 -74
  421. package/ui/elements/AccordionElement.js.map +1 -1
  422. package/ui/elements/ButtonElement.js +46 -79
  423. package/ui/elements/ButtonElement.js.map +1 -1
  424. package/ui/elements/ButtonGroupElement.js +12 -31
  425. package/ui/elements/ButtonGroupElement.js.map +1 -1
  426. package/ui/elements/GenericElement.js +1 -16
  427. package/ui/elements/GenericElement.js.map +1 -1
  428. package/ui/elements/LabelElement.js +15 -37
  429. package/ui/elements/LabelElement.js.map +1 -1
  430. package/ui/elements/NavigationMenuElement.js +67 -119
  431. package/ui/elements/NavigationMenuElement.js.map +1 -1
  432. package/ui/elements/PanelElement.js +2 -20
  433. package/ui/elements/PanelElement.js.map +1 -1
  434. package/ui/elements/PlaceholderElement.js +8 -29
  435. package/ui/elements/PlaceholderElement.js.map +1 -1
  436. package/ui/elements/SmallButtonElement.js +20 -40
  437. package/ui/elements/SmallButtonElement.js.map +1 -1
  438. package/ui/elements/TypographyElement.js +20 -43
  439. package/ui/elements/TypographyElement.js.map +1 -1
  440. package/ui/elements/ViewElement.js +1 -16
  441. package/ui/elements/ViewElement.js.map +1 -1
  442. package/ui/elements/form/DynamicFieldsetElement/DynamicFieldsetRowElement.js +17 -33
  443. package/ui/elements/form/DynamicFieldsetElement/DynamicFieldsetRowElement.js.map +1 -1
  444. package/ui/elements/form/DynamicFieldsetElement.js +90 -127
  445. package/ui/elements/form/DynamicFieldsetElement.js.map +1 -1
  446. package/ui/elements/form/FileManagerElement/EmptyStateElement.js +7 -23
  447. package/ui/elements/form/FileManagerElement/EmptyStateElement.js.map +1 -1
  448. package/ui/elements/form/FileManagerElement/EmptyStateElementRenderer.js +40 -65
  449. package/ui/elements/form/FileManagerElement/EmptyStateElementRenderer.js.map +1 -1
  450. package/ui/elements/form/FileManagerElement/FileManagerElementRenderer.js +56 -82
  451. package/ui/elements/form/FileManagerElement/FileManagerElementRenderer.js.map +1 -1
  452. package/ui/elements/form/FileManagerElement/styled.js +37 -35
  453. package/ui/elements/form/FileManagerElement/styled.js.map +1 -1
  454. package/ui/elements/form/FileManagerElement.js +43 -81
  455. package/ui/elements/form/FileManagerElement.js.map +1 -1
  456. package/ui/elements/form/FormElement.js +17 -40
  457. package/ui/elements/form/FormElement.js.map +1 -1
  458. package/ui/elements/form/FormFieldElement.js +100 -158
  459. package/ui/elements/form/FormFieldElement.js.map +1 -1
  460. package/ui/elements/form/HiddenElement.js +21 -42
  461. package/ui/elements/form/HiddenElement.js.map +1 -1
  462. package/ui/elements/form/InputElement.js +28 -49
  463. package/ui/elements/form/InputElement.js.map +1 -1
  464. package/ui/elements/form/PasswordElement.js +26 -48
  465. package/ui/elements/form/PasswordElement.js.map +1 -1
  466. package/ui/elements/form/SelectElement.js +38 -64
  467. package/ui/elements/form/SelectElement.js.map +1 -1
  468. package/ui/elements/form/TextareaElement.js +30 -50
  469. package/ui/elements/form/TextareaElement.js.map +1 -1
  470. package/ui/views/AdminView/ContentElement.js +19 -42
  471. package/ui/views/AdminView/ContentElement.js.map +1 -1
  472. package/ui/views/AdminView/HeaderElement.js +57 -90
  473. package/ui/views/AdminView/HeaderElement.js.map +1 -1
  474. package/ui/views/AdminView/HeaderSectionCenterElement.js +16 -35
  475. package/ui/views/AdminView/HeaderSectionCenterElement.js.map +1 -1
  476. package/ui/views/AdminView/HeaderSectionLeftElement.js +16 -35
  477. package/ui/views/AdminView/HeaderSectionLeftElement.js.map +1 -1
  478. package/ui/views/AdminView/HeaderSectionRightElement.js +16 -35
  479. package/ui/views/AdminView/HeaderSectionRightElement.js.map +1 -1
  480. package/ui/views/AdminView/components/Dialog.js +30 -36
  481. package/ui/views/AdminView/components/Dialog.js.map +1 -1
  482. package/ui/views/AdminView/components/Hamburger.js +12 -21
  483. package/ui/views/AdminView/components/Hamburger.js.map +1 -1
  484. package/ui/views/FormView/FormContainerElement.js +16 -53
  485. package/ui/views/FormView/FormContainerElement.js.map +1 -1
  486. package/ui/views/FormView/FormContentElement.d.ts +3 -1
  487. package/ui/views/FormView/FormContentElement.js +7 -19
  488. package/ui/views/FormView/FormContentElement.js.map +1 -1
  489. package/ui/views/FormView/FormFooterElement.js +11 -45
  490. package/ui/views/FormView/FormFooterElement.js.map +1 -1
  491. package/ui/views/FormView/FormHeaderElement.js +26 -75
  492. package/ui/views/FormView/FormHeaderElement.js.map +1 -1
  493. package/ui/views/FormView.js +104 -148
  494. package/ui/views/FormView.js.map +1 -1
  495. package/ui/views/OverlayView/ContentElement.js +12 -31
  496. package/ui/views/OverlayView/ContentElement.js.map +1 -1
  497. package/ui/views/OverlayView/HeaderElement.js +62 -99
  498. package/ui/views/OverlayView/HeaderElement.js.map +1 -1
  499. package/ui/views/OverlayView/HeaderTitleElement.js +21 -44
  500. package/ui/views/OverlayView/HeaderTitleElement.js.map +1 -1
  501. package/ui/views/OverlayView/useOverlayView.js +16 -27
  502. package/ui/views/OverlayView/useOverlayView.js.map +1 -1
  503. package/ui/views/OverlayView.js +72 -123
  504. package/ui/views/OverlayView.js.map +1 -1
  505. package/ui/views/SplitView/SplitViewPanelElement.js +28 -64
  506. package/ui/views/SplitView/SplitViewPanelElement.js.map +1 -1
  507. package/ui/views/SplitView.js +51 -82
  508. package/ui/views/SplitView.js.map +1 -1
  509. package/base/Version.d.ts +0 -3
  510. package/base/Version.js +0 -56
  511. package/base/Version.js.map +0 -1
  512. package/base/ui/Menu.d.ts +0 -51
  513. package/base/ui/Menu.js +0 -133
  514. package/base/ui/Menu.js.map +0 -1
  515. package/base/ui/Search.js +0 -61
  516. package/base/ui/Search.js.map +0 -1
  517. package/components/BulkActions/useDialogWithReport/useDialogWithReport.styled.d.ts +0 -20
  518. package/components/BulkActions/useDialogWithReport/useDialogWithReport.styled.js +0 -48
  519. package/components/BulkActions/useDialogWithReport/useDialogWithReport.styled.js.map +0 -1
  520. package/components/Dialogs/styled.d.ts +0 -10
  521. package/components/Dialogs/styled.js +0 -40
  522. package/components/Dialogs/styled.js.map +0 -1
  523. package/components/Filters/Filters.styled.d.ts +0 -13
  524. package/components/Filters/Filters.styled.js +0 -53
  525. package/components/Filters/Filters.styled.js.map +0 -1
  526. package/components/IconPicker/IconPicker.styles.d.ts +0 -63
  527. package/components/IconPicker/IconPicker.styles.js +0 -187
  528. package/components/IconPicker/IconPicker.styles.js.map +0 -1
  529. package/components/OptionsMenu/OptionsMenu.styled.d.ts +0 -3
  530. package/components/OptionsMenu/OptionsMenu.styled.js +0 -26
  531. package/components/OptionsMenu/OptionsMenu.styled.js.map +0 -1
  532. package/components/OverlayLayout/icons/close.svg +0 -13
  533. package/components/OverlayLayout/icons/navigate_before.svg +0 -16
  534. package/plugins/globalSearch/SearchBar.d.ts +0 -34
  535. package/plugins/globalSearch/SearchBar.js +0 -225
  536. package/plugins/globalSearch/SearchBar.js.map +0 -1
  537. package/plugins/globalSearch/SearchBarDropdown.d.ts +0 -23
  538. package/plugins/globalSearch/SearchBarDropdown.js +0 -82
  539. package/plugins/globalSearch/SearchBarDropdown.js.map +0 -1
  540. package/plugins/globalSearch/icons/round-search-24px.svg +0 -20
  541. package/plugins/globalSearch/index.d.ts +0 -6
  542. package/plugins/globalSearch/index.js +0 -17
  543. package/plugins/globalSearch/index.js.map +0 -1
  544. package/plugins/globalSearch/styled.d.ts +0 -18
  545. package/plugins/globalSearch/styled.js +0 -133
  546. package/plugins/globalSearch/styled.js.map +0 -1
  547. package/styles/material-theme-assignments.scss +0 -375
  548. package/styles/material.scss +0 -42
  549. package/styles/reset.scss +0 -1
  550. package/styles/theme.scss +0 -76
  551. package/ui/views/AdminView/components/Snackbar.d.ts +0 -3
  552. package/ui/views/AdminView/components/Snackbar.js +0 -33
  553. package/ui/views/AdminView/components/Snackbar.js.map +0 -1
@@ -1,43 +1,20 @@
1
- "use strict";
2
-
3
- var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
4
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
7
- });
8
- exports.FormElement = void 0;
9
- var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
10
- var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
11
- var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
12
- var _callSuper2 = _interopRequireDefault(require("@babel/runtime/helpers/callSuper"));
13
- var _superPropGet2 = _interopRequireDefault(require("@babel/runtime/helpers/superPropGet"));
14
- var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
15
- var _react = _interopRequireWildcard(require("react"));
16
- var _form = require("@webiny/form");
17
- var _UIElement2 = require("../../UIElement");
18
- var FormElement = exports.FormElement = /*#__PURE__*/function (_UIElement) {
19
- function FormElement(id, config) {
20
- var _this;
21
- (0, _classCallCheck2.default)(this, FormElement);
22
- _this = (0, _callSuper2.default)(this, FormElement, [id, config]);
23
- _this.useGrid(false);
24
- return _this;
1
+ import React, { Fragment } from "react";
2
+ import { Form } from "@webiny/form";
3
+ import { UIElement } from "../../UIElement";
4
+ export class FormElement extends UIElement {
5
+ constructor(id, config) {
6
+ super(id, config);
7
+ this.useGrid(false);
8
+ }
9
+ render(props) {
10
+ return /*#__PURE__*/React.createElement(Form, {
11
+ onSubmit: this.config.onSubmit,
12
+ data: this.config.getData()
13
+ }, formProps => /*#__PURE__*/React.createElement(Fragment, null, super.render({
14
+ ...props,
15
+ formProps
16
+ })));
25
17
  }
26
- (0, _inherits2.default)(FormElement, _UIElement);
27
- return (0, _createClass2.default)(FormElement, [{
28
- key: "render",
29
- value: function render(props) {
30
- var _this2 = this;
31
- return /*#__PURE__*/_react.default.createElement(_form.Form, {
32
- onSubmit: this.config.onSubmit,
33
- data: this.config.getData()
34
- }, function (formProps) {
35
- return /*#__PURE__*/_react.default.createElement(_react.Fragment, null, (0, _superPropGet2.default)(FormElement, "render", _this2, 3)([(0, _objectSpread2.default)((0, _objectSpread2.default)({}, props), {}, {
36
- formProps: formProps
37
- })]));
38
- });
39
- }
40
- }]);
41
- }(_UIElement2.UIElement);
18
+ }
42
19
 
43
20
  //# sourceMappingURL=FormElement.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_react","_interopRequireWildcard","require","_form","_UIElement2","FormElement","exports","_UIElement","id","config","_this","_classCallCheck2","default","_callSuper2","useGrid","_inherits2","_createClass2","key","value","render","props","_this2","createElement","Form","onSubmit","data","getData","formProps","Fragment","_superPropGet2","_objectSpread2","UIElement"],"sources":["FormElement.tsx"],"sourcesContent":["import React, { Fragment } from \"react\";\nimport { Form, FormOnSubmit, FormRenderPropParams } from \"@webiny/form\";\nimport { UIElement, UIElementConfig, UiElementRenderProps } from \"~/ui/UIElement\";\n\ninterface FormElementConfig extends UIElementConfig {\n onSubmit: FormOnSubmit;\n getData(): Record<string, any>;\n getInvalidFields?(): Record<string, any>;\n isDisabled?(): boolean;\n onChange?: FormOnSubmit;\n onInvalid?: () => void;\n submitOnEnter?: boolean;\n validateOnFirstSubmit?: boolean;\n}\n\nexport interface FormElementRenderProps extends UiElementRenderProps {\n formProps: FormRenderPropParams;\n}\n\nexport class FormElement extends UIElement<FormElementConfig> {\n public constructor(id: string, config: FormElementConfig) {\n super(id, config);\n\n this.useGrid(false);\n }\n\n public override render(props: FormElementRenderProps): React.ReactNode {\n return (\n <Form onSubmit={this.config.onSubmit} data={this.config.getData()}>\n {formProps => <Fragment>{super.render({ ...props, formProps })}</Fragment>}\n </Form>\n );\n }\n}\n"],"mappings":";;;;;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AAAkF,IAiBrEG,WAAW,GAAAC,OAAA,CAAAD,WAAA,0BAAAE,UAAA;EACpB,SAAAF,YAAmBG,EAAU,EAAEC,MAAyB,EAAE;IAAA,IAAAC,KAAA;IAAA,IAAAC,gBAAA,CAAAC,OAAA,QAAAP,WAAA;IACtDK,KAAA,OAAAG,WAAA,CAAAD,OAAA,QAAAP,WAAA,GAAMG,EAAE,EAAEC,MAAM;IAEhBC,KAAA,CAAKI,OAAO,CAAC,KAAK,CAAC;IAAC,OAAAJ,KAAA;EACxB;EAAC,IAAAK,UAAA,CAAAH,OAAA,EAAAP,WAAA,EAAAE,UAAA;EAAA,WAAAS,aAAA,CAAAJ,OAAA,EAAAP,WAAA;IAAAY,GAAA;IAAAC,KAAA,EAED,SAAgBC,MAAMA,CAACC,KAA6B,EAAmB;MAAA,IAAAC,MAAA;MACnE,oBACIrB,MAAA,CAAAY,OAAA,CAAAU,aAAA,CAACnB,KAAA,CAAAoB,IAAI;QAACC,QAAQ,EAAE,IAAI,CAACf,MAAM,CAACe,QAAS;QAACC,IAAI,EAAE,IAAI,CAAChB,MAAM,CAACiB,OAAO,CAAC;MAAE,GAC7D,UAAAC,SAAS;QAAA,oBAAI3B,MAAA,CAAAY,OAAA,CAAAU,aAAA,CAACtB,MAAA,CAAA4B,QAAQ,YAAAC,cAAA,CAAAjB,OAAA,EAAAP,WAAA,YAAAgB,MAAA,UAAAS,cAAA,CAAAlB,OAAA,MAAAkB,cAAA,CAAAlB,OAAA,MAAoBQ,KAAK;UAAEO,SAAS,EAATA;QAAS,IAAc,CAAC;MAAA,CACxE,CAAC;IAEf;EAAC;AAAA,EAb4BI,qBAAS","ignoreList":[]}
1
+ {"version":3,"names":["React","Fragment","Form","UIElement","FormElement","constructor","id","config","useGrid","render","props","createElement","onSubmit","data","getData","formProps"],"sources":["FormElement.tsx"],"sourcesContent":["import React, { Fragment } from \"react\";\nimport { Form, FormOnSubmit, FormRenderPropParams } from \"@webiny/form\";\nimport { UIElement, UIElementConfig, UiElementRenderProps } from \"~/ui/UIElement\";\n\ninterface FormElementConfig extends UIElementConfig {\n onSubmit: FormOnSubmit;\n getData(): Record<string, any>;\n getInvalidFields?(): Record<string, any>;\n isDisabled?(): boolean;\n onChange?: FormOnSubmit;\n onInvalid?: () => void;\n submitOnEnter?: boolean;\n validateOnFirstSubmit?: boolean;\n}\n\nexport interface FormElementRenderProps extends UiElementRenderProps {\n formProps: FormRenderPropParams;\n}\n\nexport class FormElement extends UIElement<FormElementConfig> {\n public constructor(id: string, config: FormElementConfig) {\n super(id, config);\n\n this.useGrid(false);\n }\n\n public override render(props: FormElementRenderProps): React.ReactNode {\n return (\n <Form onSubmit={this.config.onSubmit} data={this.config.getData()}>\n {formProps => <Fragment>{super.render({ ...props, formProps })}</Fragment>}\n </Form>\n );\n }\n}\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,QAAQ,QAAQ,OAAO;AACvC,SAASC,IAAI,QAA4C,cAAc;AACvE,SAASC,SAAS;AAiBlB,OAAO,MAAMC,WAAW,SAASD,SAAS,CAAoB;EACnDE,WAAWA,CAACC,EAAU,EAAEC,MAAyB,EAAE;IACtD,KAAK,CAACD,EAAE,EAAEC,MAAM,CAAC;IAEjB,IAAI,CAACC,OAAO,CAAC,KAAK,CAAC;EACvB;EAEgBC,MAAMA,CAACC,KAA6B,EAAmB;IACnE,oBACIV,KAAA,CAAAW,aAAA,CAACT,IAAI;MAACU,QAAQ,EAAE,IAAI,CAACL,MAAM,CAACK,QAAS;MAACC,IAAI,EAAE,IAAI,CAACN,MAAM,CAACO,OAAO,CAAC;IAAE,GAC7DC,SAAS,iBAAIf,KAAA,CAAAW,aAAA,CAACV,QAAQ,QAAE,KAAK,CAACQ,MAAM,CAAC;MAAE,GAAGC,KAAK;MAAEK;IAAU,CAAC,CAAY,CACvE,CAAC;EAEf;AACJ","ignoreList":[]}
@@ -1,171 +1,113 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.FormFieldElement = void 0;
8
- var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
9
- var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
10
- var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
11
- var _callSuper2 = _interopRequireDefault(require("@babel/runtime/helpers/callSuper"));
12
- var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
13
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
14
- var _UIElement2 = require("../../UIElement");
15
- var FormFieldElement = exports.FormFieldElement = /*#__PURE__*/function (_UIElement) {
16
- function FormFieldElement(id, config) {
17
- var _this;
18
- (0, _classCallCheck2.default)(this, FormFieldElement);
19
- _this = (0, _callSuper2.default)(this, FormFieldElement, [id, config]);
20
- (0, _defineProperty2.default)(_this, "_beforeChange", []);
21
- (0, _defineProperty2.default)(_this, "_afterChange", []);
1
+ import { UIElement } from "../../UIElement";
2
+ export class FormFieldElement extends UIElement {
3
+ _beforeChange = [];
4
+ _afterChange = [];
5
+ constructor(id, config) {
6
+ super(id, config);
22
7
  if (config.beforeChange) {
23
- _this._beforeChange.push(config.beforeChange);
8
+ this._beforeChange.push(config.beforeChange);
24
9
  }
25
10
  if (config.afterChange) {
26
- _this._afterChange.push(config.afterChange);
27
- }
28
- _this.applyPlugins(FormFieldElement);
29
- return _this;
30
- }
31
- (0, _inherits2.default)(FormFieldElement, _UIElement);
32
- return (0, _createClass2.default)(FormFieldElement, [{
33
- key: "getName",
34
- value: function getName() {
35
- return this.config.name;
36
- }
37
- }, {
38
- key: "getValidators",
39
- value: function getValidators(props) {
40
- if (!this.config.validators || typeof this.config.validators !== "function") {
41
- return function () {
42
- return true;
43
- };
44
- }
45
- return this.config.validators(props);
46
- }
47
- }, {
48
- key: "getDefaultValue",
49
- value: function getDefaultValue(props) {
50
- if (typeof this.config.defaultValue === "function") {
51
- return this.config.defaultValue(props);
52
- }
53
- return this.config.defaultValue;
54
- }
55
- }, {
56
- key: "getLabel",
57
- value: function getLabel(props) {
58
- if (typeof this.config.label === "function") {
59
- return this.config.label(props);
60
- }
61
- return this.config.label;
11
+ this._afterChange.push(config.afterChange);
62
12
  }
63
- }, {
64
- key: "getDescription",
65
- value: function getDescription(props) {
66
- if (typeof this.config.description === "function") {
67
- return this.config.description(props);
68
- }
69
- return this.config.description;
13
+ this.applyPlugins(FormFieldElement);
14
+ }
15
+ getName() {
16
+ return this.config.name;
17
+ }
18
+ getValidators(props) {
19
+ if (!this.config.validators || typeof this.config.validators !== "function") {
20
+ return () => true;
70
21
  }
71
- }, {
72
- key: "getPlaceholder",
73
- value: function getPlaceholder(props) {
74
- if (typeof this.config.placeholder === "function") {
75
- return this.config.placeholder(props);
76
- }
77
- return this.config.placeholder;
22
+ return this.config.validators(props);
23
+ }
24
+ getDefaultValue(props) {
25
+ if (typeof this.config.defaultValue === "function") {
26
+ return this.config.defaultValue(props);
78
27
  }
79
- }, {
80
- key: "setLabel",
81
- value: function setLabel(label) {
82
- this.config.label = label;
28
+ return this.config.defaultValue;
29
+ }
30
+ getLabel(props) {
31
+ if (typeof this.config.label === "function") {
32
+ return this.config.label(props);
83
33
  }
84
- }, {
85
- key: "setDescription",
86
- value: function setDescription(description) {
87
- this.config.description = description;
34
+ return this.config.label;
35
+ }
36
+ getDescription(props) {
37
+ if (typeof this.config.description === "function") {
38
+ return this.config.description(props);
88
39
  }
89
- }, {
90
- key: "setPlaceholder",
91
- value: function setPlaceholder(placeholder) {
92
- this.config.placeholder = placeholder;
40
+ return this.config.description;
41
+ }
42
+ getPlaceholder(props) {
43
+ if (typeof this.config.placeholder === "function") {
44
+ return this.config.placeholder(props);
93
45
  }
94
- }, {
95
- key: "setDefaultValue",
96
- value: function setDefaultValue(value) {
97
- this.config.defaultValue = value;
46
+ return this.config.placeholder;
47
+ }
48
+ setLabel(label) {
49
+ this.config.label = label;
50
+ }
51
+ setDescription(description) {
52
+ this.config.description = description;
53
+ }
54
+ setPlaceholder(placeholder) {
55
+ this.config.placeholder = placeholder;
56
+ }
57
+ setDefaultValue(value) {
58
+ this.config.defaultValue = value;
59
+ }
60
+ getIsDisabled(props) {
61
+ if (typeof this.config.isDisabled === "function") {
62
+ return this.config.isDisabled(props);
98
63
  }
99
- }, {
100
- key: "getIsDisabled",
101
- value: function getIsDisabled(props) {
102
- if (typeof this.config.isDisabled === "function") {
103
- return this.config.isDisabled(props);
64
+ return this.config.isDisabled;
65
+ }
66
+ setIsDisabled(isDisabled) {
67
+ this.config.isDisabled = isDisabled;
68
+ }
69
+ setValidators(validators) {
70
+ this.config.validators = validators;
71
+ }
72
+ onBeforeChange(value, cb) {
73
+ const callbacks = [...this._beforeChange];
74
+ const next = val => {
75
+ const callbackCallable = callbacks.pop();
76
+ if (!callbackCallable) {
77
+ cb(val);
78
+ return;
104
79
  }
105
- return this.config.isDisabled;
106
- }
107
- }, {
108
- key: "setIsDisabled",
109
- value: function setIsDisabled(isDisabled) {
110
- this.config.isDisabled = isDisabled;
111
- }
112
- }, {
113
- key: "setValidators",
114
- value: function setValidators(validators) {
115
- this.config.validators = validators;
116
- }
117
- }, {
118
- key: "onBeforeChange",
119
- value: function onBeforeChange(value, cb) {
120
- var callbacks = (0, _toConsumableArray2.default)(this._beforeChange);
121
- var _next = function next(val) {
122
- var callbackCallable = callbacks.pop();
123
- if (!callbackCallable) {
124
- cb(val);
125
- return;
126
- }
127
- callbackCallable(val, _next);
128
- };
129
- _next(value);
130
- }
131
- }, {
132
- key: "onAfterChange",
133
- value: function onAfterChange(value, form) {
134
- var callbacks = (0, _toConsumableArray2.default)(this._afterChange);
135
- var next = function next(val) {
136
- var callbackCallable = callbacks.pop();
137
- if (!callbackCallable) {
138
- return;
139
- }
140
- callbackCallable(val, form);
141
- };
142
- next(value);
143
- }
144
- }, {
145
- key: "addBeforeChange",
146
- value: function addBeforeChange(cb) {
147
- this._beforeChange.push(cb);
148
- }
149
- }, {
150
- key: "addAfterChange",
151
- value: function addAfterChange(cb) {
152
- /**
153
- * TODO @ts-refactor possibly different subtype. Or so TS complains.
154
- */
155
- // @ts-expect-error
156
- this._afterChange.push(cb);
157
- }
158
- }, {
159
- key: "setBeforeChange",
160
- value: function setBeforeChange(cb) {
161
- this._beforeChange = [cb];
162
- }
163
- }, {
164
- key: "setAfterChange",
165
- value: function setAfterChange(cb) {
166
- this._afterChange = [cb];
167
- }
168
- }]);
169
- }(_UIElement2.UIElement);
80
+ callbackCallable(val, next);
81
+ };
82
+ next(value);
83
+ }
84
+ onAfterChange(value, form) {
85
+ const callbacks = [...this._afterChange];
86
+ const next = val => {
87
+ const callbackCallable = callbacks.pop();
88
+ if (!callbackCallable) {
89
+ return;
90
+ }
91
+ callbackCallable(val, form);
92
+ };
93
+ next(value);
94
+ }
95
+ addBeforeChange(cb) {
96
+ this._beforeChange.push(cb);
97
+ }
98
+ addAfterChange(cb) {
99
+ /**
100
+ * TODO @ts-refactor possibly different subtype. Or so TS complains.
101
+ */
102
+ // @ts-expect-error
103
+ this._afterChange.push(cb);
104
+ }
105
+ setBeforeChange(cb) {
106
+ this._beforeChange = [cb];
107
+ }
108
+ setAfterChange(cb) {
109
+ this._afterChange = [cb];
110
+ }
111
+ }
170
112
 
171
113
  //# sourceMappingURL=FormFieldElement.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_UIElement2","require","FormFieldElement","exports","_UIElement","id","config","_this","_classCallCheck2","default","_callSuper2","_defineProperty2","beforeChange","_beforeChange","push","afterChange","_afterChange","applyPlugins","_inherits2","_createClass2","key","value","getName","name","getValidators","props","validators","getDefaultValue","defaultValue","getLabel","label","getDescription","description","getPlaceholder","placeholder","setLabel","setDescription","setPlaceholder","setDefaultValue","getIsDisabled","isDisabled","setIsDisabled","setValidators","onBeforeChange","cb","callbacks","_toConsumableArray2","next","val","callbackCallable","pop","onAfterChange","form","addBeforeChange","addAfterChange","setBeforeChange","setAfterChange","UIElement"],"sources":["FormFieldElement.tsx"],"sourcesContent":["import React from \"react\";\nimport { FormRenderPropParams, FormAPI } from \"@webiny/form\";\nimport { UIElement, UIElementConfig } from \"~/ui/UIElement\";\nimport { FormElementRenderProps } from \"~/ui/elements/form/FormElement\";\nimport { Validator } from \"@webiny/validation/types\";\n\nexport interface FormFieldElementConfig<TRenderProps = FormRenderPropParams>\n extends UIElementConfig<TRenderProps> {\n name: string;\n validators?: GetterWithProps<Validator | Validator[]>;\n beforeChange?: BeforeChange;\n afterChange?: AfterChange;\n defaultValue?: any | GetterWithProps<any>;\n isDisabled?: boolean | GetterWithProps<boolean>;\n label?: string | GetterWithProps<string>;\n description?: string | React.ReactElement | GetterWithProps<string | React.ReactElement>;\n placeholder?: string | GetterWithProps<string>;\n}\n\nexport interface FormFieldElementRenderProps {\n formProps: FormRenderPropParams;\n}\n\ninterface BeforeChange {\n (value: any, callback: BeforeChangeCallback): void;\n}\n\ninterface BeforeChangeCallback {\n (value: any): void;\n}\n\ninterface AfterChange<T = any, D extends Record<string, any> = Record<string, any>> {\n (value: T, form: FormAPI<D>): void;\n}\n\ninterface GetterWithProps<T> {\n (props: FormElementRenderProps): T;\n}\n\nexport class FormFieldElement<\n TConfig extends FormFieldElementConfig = FormFieldElementConfig\n> extends UIElement<TConfig> {\n private _beforeChange: BeforeChange[] = [];\n private _afterChange: AfterChange[] = [];\n\n public constructor(id: string, config: TConfig) {\n super(id, config);\n\n if (config.beforeChange) {\n this._beforeChange.push(config.beforeChange);\n }\n\n if (config.afterChange) {\n this._afterChange.push(config.afterChange);\n }\n\n this.applyPlugins(FormFieldElement);\n }\n\n public getName(): string {\n return this.config.name;\n }\n\n public getValidators(props?: FormFieldElementRenderProps): Validator | Validator[] {\n if (!this.config.validators || typeof this.config.validators !== \"function\") {\n return () => true;\n }\n\n return this.config.validators(props as FormFieldElementRenderProps);\n }\n\n public getDefaultValue(props?: FormFieldElementRenderProps): any {\n if (typeof this.config.defaultValue === \"function\") {\n return this.config.defaultValue(props);\n }\n\n return this.config.defaultValue;\n }\n\n public getLabel(props?: FormFieldElementRenderProps): string {\n if (typeof this.config.label === \"function\") {\n return this.config.label(props as FormFieldElementRenderProps);\n }\n\n return this.config.label as string;\n }\n\n public getDescription(props?: FormFieldElementRenderProps): string | React.ReactElement {\n if (typeof this.config.description === \"function\") {\n return this.config.description(props as FormFieldElementRenderProps);\n }\n\n return this.config.description as string;\n }\n\n public getPlaceholder(props?: FormFieldElementRenderProps): string {\n if (typeof this.config.placeholder === \"function\") {\n return this.config.placeholder(props as FormFieldElementRenderProps);\n }\n\n return this.config.placeholder as string;\n }\n\n public setLabel(label: string | GetterWithProps<string>): void {\n this.config.label = label;\n }\n\n public setDescription(\n description: string | React.ReactElement | GetterWithProps<string | React.ReactElement>\n ): void {\n this.config.description = description;\n }\n\n public setPlaceholder(placeholder: string | GetterWithProps<string>): void {\n this.config.placeholder = placeholder;\n }\n\n public setDefaultValue(value: any | GetterWithProps<any>): void {\n this.config.defaultValue = value;\n }\n\n public getIsDisabled(props?: FormFieldElementRenderProps): boolean {\n if (typeof this.config.isDisabled === \"function\") {\n return this.config.isDisabled(props as FormFieldElementRenderProps);\n }\n return this.config.isDisabled as boolean;\n }\n\n public setIsDisabled(isDisabled: boolean | GetterWithProps<boolean>): void {\n this.config.isDisabled = isDisabled;\n }\n\n public setValidators(validators: GetterWithProps<Validator>): void {\n this.config.validators = validators;\n }\n\n public onBeforeChange(value: string, cb: (value: string) => void): void {\n const callbacks = [...this._beforeChange];\n const next = (val: string) => {\n const callbackCallable = callbacks.pop();\n if (!callbackCallable) {\n cb(val);\n return;\n }\n callbackCallable(val, next);\n };\n\n next(value);\n }\n\n public onAfterChange(value: string, form: FormAPI): void {\n const callbacks = [...this._afterChange];\n const next = (val: string) => {\n const callbackCallable = callbacks.pop();\n if (!callbackCallable) {\n return;\n }\n callbackCallable(val, form);\n };\n\n next(value);\n }\n\n public addBeforeChange(cb: BeforeChange): void {\n this._beforeChange.push(cb);\n }\n\n public addAfterChange<T = any, D extends Record<string, any> = Record<string, any>>(\n cb: AfterChange<T, D>\n ): void {\n /**\n * TODO @ts-refactor possibly different subtype. Or so TS complains.\n */\n // @ts-expect-error\n this._afterChange.push(cb);\n }\n\n public setBeforeChange(cb: BeforeChange): void {\n this._beforeChange = [cb];\n }\n\n public setAfterChange(cb: AfterChange): void {\n this._afterChange = [cb];\n }\n}\n"],"mappings":";;;;;;;;;;;;;AAEA,IAAAA,WAAA,GAAAC,OAAA;AAA4D,IAqC/CC,gBAAgB,GAAAC,OAAA,CAAAD,gBAAA,0BAAAE,UAAA;EAMzB,SAAAF,iBAAmBG,EAAU,EAAEC,MAAe,EAAE;IAAA,IAAAC,KAAA;IAAA,IAAAC,gBAAA,CAAAC,OAAA,QAAAP,gBAAA;IAC5CK,KAAA,OAAAG,WAAA,CAAAD,OAAA,QAAAP,gBAAA,GAAMG,EAAE,EAAEC,MAAM;IAAE,IAAAK,gBAAA,CAAAF,OAAA,EAAAF,KAAA,mBAJkB,EAAE;IAAA,IAAAI,gBAAA,CAAAF,OAAA,EAAAF,KAAA,kBACJ,EAAE;IAKpC,IAAID,MAAM,CAACM,YAAY,EAAE;MACrBL,KAA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GAAG,EAAEI,IAAI,CAAC;MAC/B,CAAC;MAEDL,IAAI,CAAC1B,KAAK,CAAC;IACf;EAAC;IAAAD,GAAA;IAAAC,KAAA,EAED,SAAOgC,eAAeA,CAACT,EAAgB,EAAQ;MAC3C,IAAI,CAAC/B,aAAa,CAACC,IAAI,CAAC8B,EAAE,CAAC;IAC/B;EAAC;IAAAxB,GAAA;IAAAC,KAAA,EAED,SAAOiC,cAAcA,CACjBV,EAAqB,EACjB;MACJ;AACR;AACA;MACQ;MACA,IAAI,CAAC5B,YAAY,CAACF,IAAI,CAAC8B,EAAE,CAAC;IAC9B;EAAC;IAAAxB,GAAA;IAAAC,KAAA,EAED,SAAOkC,eAAeA,CAACX,EAAgB,EAAQ;MAC3C,IAAI,CAAC/B,aAAa,GAAG,CAAC+B,EAAE,CAAC;IAC7B;EAAC;IAAAxB,GAAA;IAAAC,KAAA,EAED,SAAOmC,cAAcA,CAACZ,EAAe,EAAQ;MACzC,IAAI,CAAC5B,YAAY,GAAG,CAAC4B,EAAE,CAAC;IAC5B;EAAC;AAAA,EA9IKa,qBAAS","ignoreList":[]}
1
+ {"version":3,"names":["UIElement","FormFieldElement","_beforeChange","_afterChange","constructor","id","config","beforeChange","push","afterChange","applyPlugins","getName","name","getValidators","props","validators","getDefaultValue","defaultValue","getLabel","label","getDescription","description","getPlaceholder","placeholder","setLabel","setDescription","setPlaceholder","setDefaultValue","value","getIsDisabled","isDisabled","setIsDisabled","setValidators","onBeforeChange","cb","callbacks","next","val","callbackCallable","pop","onAfterChange","form","addBeforeChange","addAfterChange","setBeforeChange","setAfterChange"],"sources":["FormFieldElement.tsx"],"sourcesContent":["import React from \"react\";\nimport { FormRenderPropParams, FormAPI } from \"@webiny/form\";\nimport { UIElement, UIElementConfig } from \"~/ui/UIElement\";\nimport { FormElementRenderProps } from \"~/ui/elements/form/FormElement\";\nimport { Validator } from \"@webiny/validation/types\";\n\nexport interface FormFieldElementConfig<TRenderProps = FormRenderPropParams>\n extends UIElementConfig<TRenderProps> {\n name: string;\n validators?: GetterWithProps<Validator | Validator[]>;\n beforeChange?: BeforeChange;\n afterChange?: AfterChange;\n defaultValue?: any | GetterWithProps<any>;\n isDisabled?: boolean | GetterWithProps<boolean>;\n label?: string | GetterWithProps<string>;\n description?: string | React.ReactElement | GetterWithProps<string | React.ReactElement>;\n placeholder?: string | GetterWithProps<string>;\n}\n\nexport interface FormFieldElementRenderProps {\n formProps: FormRenderPropParams;\n}\n\ninterface BeforeChange {\n (value: any, callback: BeforeChangeCallback): void;\n}\n\ninterface BeforeChangeCallback {\n (value: any): void;\n}\n\ninterface AfterChange<T = any, D extends Record<string, any> = Record<string, any>> {\n (value: T, form: FormAPI<D>): void;\n}\n\ninterface GetterWithProps<T> {\n (props: FormElementRenderProps): T;\n}\n\nexport class FormFieldElement<\n TConfig extends FormFieldElementConfig = FormFieldElementConfig\n> extends UIElement<TConfig> {\n private _beforeChange: BeforeChange[] = [];\n private _afterChange: AfterChange[] = [];\n\n public constructor(id: string, config: TConfig) {\n super(id, config);\n\n if (config.beforeChange) {\n this._beforeChange.push(config.beforeChange);\n }\n\n if (config.afterChange) {\n this._afterChange.push(config.afterChange);\n }\n\n this.applyPlugins(FormFieldElement);\n }\n\n public getName(): string {\n return this.config.name;\n }\n\n public getValidators(props?: FormFieldElementRenderProps): Validator | Validator[] {\n if (!this.config.validators || typeof this.config.validators !== \"function\") {\n return () => true;\n }\n\n return this.config.validators(props as FormFieldElementRenderProps);\n }\n\n public getDefaultValue(props?: FormFieldElementRenderProps): any {\n if (typeof this.config.defaultValue === \"function\") {\n return this.config.defaultValue(props);\n }\n\n return this.config.defaultValue;\n }\n\n public getLabel(props?: FormFieldElementRenderProps): string {\n if (typeof this.config.label === \"function\") {\n return this.config.label(props as FormFieldElementRenderProps);\n }\n\n return this.config.label as string;\n }\n\n public getDescription(props?: FormFieldElementRenderProps): string | React.ReactElement {\n if (typeof this.config.description === \"function\") {\n return this.config.description(props as FormFieldElementRenderProps);\n }\n\n return this.config.description as string;\n }\n\n public getPlaceholder(props?: FormFieldElementRenderProps): string {\n if (typeof this.config.placeholder === \"function\") {\n return this.config.placeholder(props as FormFieldElementRenderProps);\n }\n\n return this.config.placeholder as string;\n }\n\n public setLabel(label: string | GetterWithProps<string>): void {\n this.config.label = label;\n }\n\n public setDescription(\n description: string | React.ReactElement | GetterWithProps<string | React.ReactElement>\n ): void {\n this.config.description = description;\n }\n\n public setPlaceholder(placeholder: string | GetterWithProps<string>): void {\n this.config.placeholder = placeholder;\n }\n\n public setDefaultValue(value: any | GetterWithProps<any>): void {\n this.config.defaultValue = value;\n }\n\n public getIsDisabled(props?: FormFieldElementRenderProps): boolean {\n if (typeof this.config.isDisabled === \"function\") {\n return this.config.isDisabled(props as FormFieldElementRenderProps);\n }\n return this.config.isDisabled as boolean;\n }\n\n public setIsDisabled(isDisabled: boolean | GetterWithProps<boolean>): void {\n this.config.isDisabled = isDisabled;\n }\n\n public setValidators(validators: GetterWithProps<Validator>): void {\n this.config.validators = validators;\n }\n\n public onBeforeChange(value: string, cb: (value: string) => void): void {\n const callbacks = [...this._beforeChange];\n const next = (val: string) => {\n const callbackCallable = callbacks.pop();\n if (!callbackCallable) {\n cb(val);\n return;\n }\n callbackCallable(val, next);\n };\n\n next(value);\n }\n\n public onAfterChange(value: string, form: FormAPI): void {\n const callbacks = [...this._afterChange];\n const next = (val: string) => {\n const callbackCallable = callbacks.pop();\n if (!callbackCallable) {\n return;\n }\n callbackCallable(val, form);\n };\n\n next(value);\n }\n\n public addBeforeChange(cb: BeforeChange): void {\n this._beforeChange.push(cb);\n }\n\n public addAfterChange<T = any, D extends Record<string, any> = Record<string, any>>(\n cb: AfterChange<T, D>\n ): void {\n /**\n * TODO @ts-refactor possibly different subtype. Or so TS complains.\n */\n // @ts-expect-error\n this._afterChange.push(cb);\n }\n\n public setBeforeChange(cb: BeforeChange): void {\n this._beforeChange = [cb];\n }\n\n public setAfterChange(cb: AfterChange): void {\n this._afterChange = [cb];\n }\n}\n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Default").default;
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.HiddenElement = void 0;
8
- var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
9
- var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
10
- var _callSuper2 = _interopRequireDefault(require("@babel/runtime/helpers/callSuper"));
11
- var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
12
- var _react = _interopRequireDefault(require("react"));
13
- var _FormFieldElement2 = require("./FormFieldElement");
14
- var HiddenElement = exports.HiddenElement = /*#__PURE__*/function (_FormFieldElement) {
15
- function HiddenElement(id, config) {
16
- var _this;
17
- (0, _classCallCheck2.default)(this, HiddenElement);
18
- _this = (0, _callSuper2.default)(this, HiddenElement, [id, config]);
19
- _this.applyPlugins(HiddenElement);
20
- return _this;
1
+ import React from "react";
2
+ import { FormFieldElement } from "./FormFieldElement";
3
+ export class HiddenElement extends FormFieldElement {
4
+ constructor(id, config) {
5
+ super(id, config);
6
+ this.applyPlugins(HiddenElement);
21
7
  }
22
- (0, _inherits2.default)(HiddenElement, _FormFieldElement);
23
- return (0, _createClass2.default)(HiddenElement, [{
24
- key: "render",
25
- value: function render(props) {
26
- var _this2 = this;
27
- if (!props.formProps) {
28
- throw Error("HiddenElement must be placed inside of a FormElement.");
29
- }
30
- var Bind = props.formProps.Bind;
31
- return /*#__PURE__*/_react.default.createElement(Bind, {
32
- name: this.getName(),
33
- validators: this.getValidators(props),
34
- defaultValue: this.getDefaultValue(props),
35
- beforeChange: function beforeChange(value, cb) {
36
- return _this2.onBeforeChange(value, cb);
37
- },
38
- afterChange: function afterChange(value, form) {
39
- return _this2.onAfterChange(value, form);
40
- }
41
- });
8
+ render(props) {
9
+ if (!props.formProps) {
10
+ throw Error(`HiddenElement must be placed inside of a FormElement.`);
42
11
  }
43
- }]);
44
- }(_FormFieldElement2.FormFieldElement);
12
+ const {
13
+ Bind
14
+ } = props.formProps;
15
+ return /*#__PURE__*/React.createElement(Bind, {
16
+ name: this.getName(),
17
+ validators: this.getValidators(props),
18
+ defaultValue: this.getDefaultValue(props),
19
+ beforeChange: (value, cb) => this.onBeforeChange(value, cb),
20
+ afterChange: (value, form) => this.onAfterChange(value, form)
21
+ });
22
+ }
23
+ }
45
24
 
46
25
  //# sourceMappingURL=HiddenElement.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_react","_interopRequireDefault","require","_FormFieldElement2","HiddenElement","exports","_FormFieldElement","id","config","_this","_classCallCheck2","default","_callSuper2","applyPlugins","_inherits2","_createClass2","key","value","render","props","_this2","formProps","Error","Bind","createElement","name","getName","validators","getValidators","defaultValue","getDefaultValue","beforeChange","cb","onBeforeChange","afterChange","form","onAfterChange","FormFieldElement"],"sources":["HiddenElement.tsx"],"sourcesContent":["import React from \"react\";\nimport {\n FormFieldElement,\n FormFieldElementConfig,\n FormFieldElementRenderProps\n} from \"~/ui/elements/form/FormFieldElement\";\n\nexport class HiddenElement extends FormFieldElement {\n public constructor(id: string, config: FormFieldElementConfig) {\n super(id, config);\n\n this.applyPlugins(HiddenElement);\n }\n\n public override render(props: FormFieldElementRenderProps): React.ReactNode {\n if (!props.formProps) {\n throw Error(`HiddenElement must be placed inside of a FormElement.`);\n }\n\n const { Bind } = props.formProps;\n\n return (\n <Bind\n name={this.getName()}\n validators={this.getValidators(props)}\n defaultValue={this.getDefaultValue(props)}\n beforeChange={(value: string, cb) => this.onBeforeChange(value, cb)}\n afterChange={(value: string, form) => this.onAfterChange(value, form)}\n />\n );\n }\n}\n"],"mappings":";;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,kBAAA,GAAAD,OAAA;AAI6C,IAEhCE,aAAa,GAAAC,OAAA,CAAAD,aAAA,0BAAAE,iBAAA;EACtB,SAAAF,cAAmBG,EAAU,EAAEC,MAA8B,EAAE;IAAA,IAAAC,KAAA;IAAA,IAAAC,gBAAA,CAAAC,OAAA,QAAAP,aAAA;IAC3DK,KAAA,OAAAG,WAAA,CAAAD,OAAA,QAAAP,aAAA,GAAMG,EAAE,EAAEC,MAAM;IAEhBC,KAAA,CAAKI,YAAY,CAACT,aAAa,CAAC;IAAC,OAAAK,KAAA;EACrC;EAAC,IAAAK,UAAA,CAAAH,OAAA,EAAAP,aAAA,EAAAE,iBAAA;EAAA,WAAAS,aAAA,CAAAJ,OAAA,EAAAP,aAAA;IAAAY,GAAA;IAAAC,KAAA,EAED,SAAgBC,MAAMA,CAACC,KAAkC,EAAmB;MAAA,IAAAC,MAAA;MACxE,IAAI,CAACD,KAAK,CAACE,SAAS,EAAE;QAClB,MAAMC,KAAK,wDAAwD,CAAC;MACxE;MAEA,IAAQC,IAAI,GAAKJ,KAAK,CAACE,SAAS,CAAxBE,IAAI;MAEZ,oBACIvB,MAAA,CAAAW,OAAA,CAAAa,aAAA,CAACD,IAAI;QACDE,IAAI,EAAE,IAAI,CAACC,OAAO,CAAC,CAAE;QACrBC,UAAU,EAAE,IAAI,CAACC,aAAa,CAACT,KAAK,CAAE;QACtCU,YAAY,EAAE,IAAI,CAACC,eAAe,CAACX,KAAK,CAAE;QAC1CY,YAAY,EAAE,SAAdA,YAAYA,CAAGd,KAAa,EAAEe,EAAE;UAAA,OAAKZ,MAAI,CAACa,cAAc,CAAChB,KAAK,EAAEe,EAAE,CAAC;QAAA,CAAC;QACpEE,WAAW,EAAE,SAAbA,WAAWA,CAAGjB,KAAa,EAAEkB,IAAI;UAAA,OAAKf,MAAI,CAACgB,aAAa,CAACnB,KAAK,EAAEkB,IAAI,CAAC;QAAA;MAAC,CACzE,CAAC;IAEV;EAAC;AAAA,EAvB8BE,mCAAgB","ignoreList":[]}
1
+ {"version":3,"names":["React","FormFieldElement","HiddenElement","constructor","id","config","applyPlugins","render","props","formProps","Error","Bind","createElement","name","getName","validators","getValidators","defaultValue","getDefaultValue","beforeChange","value","cb","onBeforeChange","afterChange","form","onAfterChange"],"sources":["HiddenElement.tsx"],"sourcesContent":["import React from \"react\";\nimport {\n FormFieldElement,\n FormFieldElementConfig,\n FormFieldElementRenderProps\n} from \"~/ui/elements/form/FormFieldElement\";\n\nexport class HiddenElement extends FormFieldElement {\n public constructor(id: string, config: FormFieldElementConfig) {\n super(id, config);\n\n this.applyPlugins(HiddenElement);\n }\n\n public override render(props: FormFieldElementRenderProps): React.ReactNode {\n if (!props.formProps) {\n throw Error(`HiddenElement must be placed inside of a FormElement.`);\n }\n\n const { Bind } = props.formProps;\n\n return (\n <Bind\n name={this.getName()}\n validators={this.getValidators(props)}\n defaultValue={this.getDefaultValue(props)}\n beforeChange={(value: string, cb) => this.onBeforeChange(value, cb)}\n afterChange={(value: string, form) => this.onAfterChange(value, form)}\n />\n );\n }\n}\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SACIC,gBAAgB;AAKpB,OAAO,MAAMC,aAAa,SAASD,gBAAgB,CAAC;EACzCE,WAAWA,CAACC,EAAU,EAAEC,MAA8B,EAAE;IAC3D,KAAK,CAACD,EAAE,EAAEC,MAAM,CAAC;IAEjB,IAAI,CAACC,YAAY,CAACJ,aAAa,CAAC;EACpC;EAEgBK,MAAMA,CAACC,KAAkC,EAAmB;IACxE,IAAI,CAACA,KAAK,CAACC,SAAS,EAAE;MAClB,MAAMC,KAAK,CAAC,uDAAuD,CAAC;IACxE;IAEA,MAAM;MAAEC;IAAK,CAAC,GAAGH,KAAK,CAACC,SAAS;IAEhC,oBACIT,KAAA,CAAAY,aAAA,CAACD,IAAI;MACDE,IAAI,EAAE,IAAI,CAACC,OAAO,CAAC,CAAE;MACrBC,UAAU,EAAE,IAAI,CAACC,aAAa,CAACR,KAAK,CAAE;MACtCS,YAAY,EAAE,IAAI,CAACC,eAAe,CAACV,KAAK,CAAE;MAC1CW,YAAY,EAAEA,CAACC,KAAa,EAAEC,EAAE,KAAK,IAAI,CAACC,cAAc,CAACF,KAAK,EAAEC,EAAE,CAAE;MACpEE,WAAW,EAAEA,CAACH,KAAa,EAAEI,IAAI,KAAK,IAAI,CAACC,aAAa,CAACL,KAAK,EAAEI,IAAI;IAAE,CACzE,CAAC;EAEV;AACJ","ignoreList":[]}
@@ -1,53 +1,32 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.InputElement = void 0;
8
- var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
9
- var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
10
- var _callSuper2 = _interopRequireDefault(require("@babel/runtime/helpers/callSuper"));
11
- var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
12
- var _react = _interopRequireDefault(require("react"));
13
- var _Input = require("@webiny/ui/Input");
14
- var _FormFieldElement2 = require("./FormFieldElement");
15
- var InputElement = exports.InputElement = /*#__PURE__*/function (_FormFieldElement) {
16
- function InputElement(id, config) {
17
- var _this;
18
- (0, _classCallCheck2.default)(this, InputElement);
19
- _this = (0, _callSuper2.default)(this, InputElement, [id, config]);
20
- _this.applyPlugins(InputElement);
21
- return _this;
1
+ import React from "react";
2
+ import { Input } from "@webiny/ui/Input";
3
+ import { FormFieldElement } from "./FormFieldElement";
4
+ export class InputElement extends FormFieldElement {
5
+ constructor(id, config) {
6
+ super(id, config);
7
+ this.applyPlugins(InputElement);
22
8
  }
23
- (0, _inherits2.default)(InputElement, _FormFieldElement);
24
- return (0, _createClass2.default)(InputElement, [{
25
- key: "render",
26
- value: function render(props) {
27
- var _this2 = this;
28
- if (!props.formProps) {
29
- throw Error("InputElement must be placed inside of a FormElement.");
30
- }
31
- var Bind = props.formProps.Bind;
32
- return /*#__PURE__*/_react.default.createElement(Bind, {
33
- name: this.getName(),
34
- validators: this.getValidators(props),
35
- defaultValue: this.getDefaultValue(props),
36
- beforeChange: function beforeChange(value, cb) {
37
- return _this2.onBeforeChange(value, cb);
38
- },
39
- afterChange: function afterChange(value, form) {
40
- return _this2.onAfterChange(value, form);
41
- }
42
- }, /*#__PURE__*/_react.default.createElement(_Input.Input, {
43
- "data-testid": "input-element-".concat(this.getLabel(props)),
44
- label: this.getLabel(props),
45
- placeholder: this.getPlaceholder(props),
46
- disabled: this.getIsDisabled(props),
47
- description: this.getDescription(props)
48
- }));
9
+ render(props) {
10
+ if (!props.formProps) {
11
+ throw Error(`InputElement must be placed inside of a FormElement.`);
49
12
  }
50
- }]);
51
- }(_FormFieldElement2.FormFieldElement);
13
+ const {
14
+ Bind
15
+ } = props.formProps;
16
+ return /*#__PURE__*/React.createElement(Bind, {
17
+ name: this.getName(),
18
+ validators: this.getValidators(props),
19
+ defaultValue: this.getDefaultValue(props),
20
+ beforeChange: (value, cb) => this.onBeforeChange(value, cb),
21
+ afterChange: (value, form) => this.onAfterChange(value, form)
22
+ }, /*#__PURE__*/React.createElement(Input, {
23
+ "data-testid": `input-element-${this.getLabel(props)}`,
24
+ label: this.getLabel(props),
25
+ placeholder: this.getPlaceholder(props),
26
+ disabled: this.getIsDisabled(props),
27
+ description: this.getDescription(props)
28
+ }));
29
+ }
30
+ }
52
31
 
53
32
  //# sourceMappingURL=InputElement.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_react","_interopRequireDefault","require","_Input","_FormFieldElement2","InputElement","exports","_FormFieldElement","id","config","_this","_classCallCheck2","default","_callSuper2","applyPlugins","_inherits2","_createClass2","key","value","render","props","_this2","formProps","Error","Bind","createElement","name","getName","validators","getValidators","defaultValue","getDefaultValue","beforeChange","cb","onBeforeChange","afterChange","form","onAfterChange","Input","concat","getLabel","label","placeholder","getPlaceholder","disabled","getIsDisabled","description","getDescription","FormFieldElement"],"sources":["InputElement.tsx"],"sourcesContent":["import React from \"react\";\nimport { Input } from \"@webiny/ui/Input\";\nimport {\n FormFieldElement,\n FormFieldElementConfig,\n FormFieldElementRenderProps\n} from \"~/ui/elements/form/FormFieldElement\";\n\nexport type InputElementRenderProps = FormFieldElementRenderProps;\nexport class InputElement extends FormFieldElement {\n public constructor(id: string, config: FormFieldElementConfig) {\n super(id, config);\n\n this.applyPlugins(InputElement);\n }\n\n public override render(props: FormFieldElementRenderProps): React.ReactNode {\n if (!props.formProps) {\n throw Error(`InputElement must be placed inside of a FormElement.`);\n }\n\n const { Bind } = props.formProps;\n\n return (\n <Bind\n name={this.getName()}\n validators={this.getValidators(props)}\n defaultValue={this.getDefaultValue(props)}\n beforeChange={(value: string, cb) => this.onBeforeChange(value, cb)}\n afterChange={(value: string, form) => this.onAfterChange(value, form)}\n >\n <Input\n data-testid={`input-element-${this.getLabel(props)}`}\n label={this.getLabel(props)}\n placeholder={this.getPlaceholder(props)}\n disabled={this.getIsDisabled(props)}\n description={this.getDescription(props)}\n />\n </Bind>\n );\n }\n}\n"],"mappings":";;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,kBAAA,GAAAF,OAAA;AAI6C,IAGhCG,YAAY,GAAAC,OAAA,CAAAD,YAAA,0BAAAE,iBAAA;EACrB,SAAAF,aAAmBG,EAAU,EAAEC,MAA8B,EAAE;IAAA,IAAAC,KAAA;IAAA,IAAAC,gBAAA,CAAAC,OAAA,QAAAP,YAAA;IAC3DK,KAAA,OAAAG,WAAA,CAAAD,OAAA,QAAAP,YAAA,GAAMG,EAAE,EAAEC,MAAM;IAEhBC,KAAA,CAAKI,YAAY,CAACT,YAAY,CAAC;IAAC,OAAAK,KAAA;EACpC;EAAC,IAAAK,UAAA,CAAAH,OAAA,EAAAP,YAAA,EAAAE,iBAAA;EAAA,WAAAS,aAAA,CAAAJ,OAAA,EAAAP,YAAA;IAAAY,GAAA;IAAAC,KAAA,EAED,SAAgBC,MAAMA,CAACC,KAAkC,EAAmB;MAAA,IAAAC,MAAA;MACxE,IAAI,CAACD,KAAK,CAACE,SAAS,EAAE;QAClB,MAAMC,KAAK,uDAAuD,CAAC;MACvE;MAEA,IAAQC,IAAI,GAAKJ,KAAK,CAACE,SAAS,CAAxBE,IAAI;MAEZ,oBACIxB,MAAA,CAAAY,OAAA,CAAAa,aAAA,CAACD,IAAI;QACDE,IAAI,EAAE,IAAI,CAACC,OAAO,CAAC,CAAE;QACrBC,UAAU,EAAE,IAAI,CAACC,aAAa,CAACT,KAAK,CAAE;QACtCU,YAAY,EAAE,IAAI,CAACC,eAAe,CAACX,KAAK,CAAE;QAC1CY,YAAY,EAAE,SAAdA,YAAYA,CAAGd,KAAa,EAAEe,EAAE;UAAA,OAAKZ,MAAI,CAACa,cAAc,CAAChB,KAAK,EAAEe,EAAE,CAAC;QAAA,CAAC;QACpEE,WAAW,EAAE,SAAbA,WAAWA,CAAGjB,KAAa,EAAEkB,IAAI;UAAA,OAAKf,MAAI,CAACgB,aAAa,CAACnB,KAAK,EAAEkB,IAAI,CAAC;QAAA;MAAC,gBAEtEpC,MAAA,CAAAY,OAAA,CAAAa,aAAA,CAACtB,MAAA,CAAAmC,KAAK;QACF,gCAAAC,MAAA,CAA8B,IAAI,CAACC,QAAQ,CAACpB,KAAK,CAAC,CAAG;QACrDqB,KAAK,EAAE,IAAI,CAACD,QAAQ,CAACpB,KAAK,CAAE;QAC5BsB,WAAW,EAAE,IAAI,CAACC,cAAc,CAACvB,KAAK,CAAE;QACxCwB,QAAQ,EAAE,IAAI,CAACC,aAAa,CAACzB,KAAK,CAAE;QACpC0B,WAAW,EAAE,IAAI,CAACC,cAAc,CAAC3B,KAAK;MAAE,CAC3C,CACC,CAAC;IAEf;EAAC;AAAA,EA/B6B4B,mCAAgB","ignoreList":[]}
1
+ {"version":3,"names":["React","Input","FormFieldElement","InputElement","constructor","id","config","applyPlugins","render","props","formProps","Error","Bind","createElement","name","getName","validators","getValidators","defaultValue","getDefaultValue","beforeChange","value","cb","onBeforeChange","afterChange","form","onAfterChange","getLabel","label","placeholder","getPlaceholder","disabled","getIsDisabled","description","getDescription"],"sources":["InputElement.tsx"],"sourcesContent":["import React from \"react\";\nimport { Input } from \"@webiny/ui/Input\";\nimport {\n FormFieldElement,\n FormFieldElementConfig,\n FormFieldElementRenderProps\n} from \"~/ui/elements/form/FormFieldElement\";\n\nexport type InputElementRenderProps = FormFieldElementRenderProps;\nexport class InputElement extends FormFieldElement {\n public constructor(id: string, config: FormFieldElementConfig) {\n super(id, config);\n\n this.applyPlugins(InputElement);\n }\n\n public override render(props: FormFieldElementRenderProps): React.ReactNode {\n if (!props.formProps) {\n throw Error(`InputElement must be placed inside of a FormElement.`);\n }\n\n const { Bind } = props.formProps;\n\n return (\n <Bind\n name={this.getName()}\n validators={this.getValidators(props)}\n defaultValue={this.getDefaultValue(props)}\n beforeChange={(value: string, cb) => this.onBeforeChange(value, cb)}\n afterChange={(value: string, form) => this.onAfterChange(value, form)}\n >\n <Input\n data-testid={`input-element-${this.getLabel(props)}`}\n label={this.getLabel(props)}\n placeholder={this.getPlaceholder(props)}\n disabled={this.getIsDisabled(props)}\n description={this.getDescription(props)}\n />\n </Bind>\n );\n }\n}\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,KAAK,QAAQ,kBAAkB;AACxC,SACIC,gBAAgB;AAMpB,OAAO,MAAMC,YAAY,SAASD,gBAAgB,CAAC;EACxCE,WAAWA,CAACC,EAAU,EAAEC,MAA8B,EAAE;IAC3D,KAAK,CAACD,EAAE,EAAEC,MAAM,CAAC;IAEjB,IAAI,CAACC,YAAY,CAACJ,YAAY,CAAC;EACnC;EAEgBK,MAAMA,CAACC,KAAkC,EAAmB;IACxE,IAAI,CAACA,KAAK,CAACC,SAAS,EAAE;MAClB,MAAMC,KAAK,CAAC,sDAAsD,CAAC;IACvE;IAEA,MAAM;MAAEC;IAAK,CAAC,GAAGH,KAAK,CAACC,SAAS;IAEhC,oBACIV,KAAA,CAAAa,aAAA,CAACD,IAAI;MACDE,IAAI,EAAE,IAAI,CAACC,OAAO,CAAC,CAAE;MACrBC,UAAU,EAAE,IAAI,CAACC,aAAa,CAACR,K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