@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.
- package/base/Admin.js +25 -35
- package/base/Admin.js.map +1 -1
- package/base/Base/Menus/SupportMenuItems.d.ts +2 -0
- package/base/Base/Menus/SupportMenuItems.js +20 -0
- package/base/Base/Menus/SupportMenuItems.js.map +1 -0
- package/base/Base/Menus/WebinyVersion.d.ts +2 -0
- package/base/Base/Menus/WebinyVersion.js +24 -0
- package/base/Base/Menus/WebinyVersion.js.map +1 -0
- package/base/Base/Menus.d.ts +2 -0
- package/base/Base/Menus.js +129 -0
- package/base/Base/Menus.js.map +1 -0
- package/base/Base/Routes.d.ts +2 -0
- package/base/Base/Routes.js +24 -0
- package/base/Base/Routes.js.map +1 -0
- package/base/Base/Tenant/wby-logo.svg +3 -0
- package/base/Base/Tenant.d.ts +2 -0
- package/base/Base/Tenant.js +19 -0
- package/base/Base/Tenant.js.map +1 -0
- package/base/Base.js +11 -79
- package/base/Base.js.map +1 -1
- package/base/WebinyVersion.d.ts +2 -0
- package/base/WebinyVersion.js +24 -0
- package/base/WebinyVersion.js.map +1 -0
- package/base/plugins/AddGraphQLQuerySelection.js +11 -21
- package/base/plugins/AddGraphQLQuerySelection.js.map +1 -1
- package/base/providers/AdminUiStateProvider.d.ts +1 -0
- package/base/providers/AdminUiStateProvider.js +14 -0
- package/base/providers/AdminUiStateProvider.js.map +1 -0
- package/base/providers/ApolloProvider.js +9 -15
- package/base/providers/ApolloProvider.js.map +1 -1
- package/base/providers/TelemetryProvider.js +12 -18
- package/base/providers/TelemetryProvider.js.map +1 -1
- package/base/providers/UiProviders.d.ts +1 -0
- package/base/providers/UiProviders.js +14 -0
- package/base/providers/UiProviders.js.map +1 -0
- package/base/providers/UiStateProvider.js +9 -15
- package/base/providers/UiStateProvider.js.map +1 -1
- package/base/providers/ViewCompositionProvider.js +33 -44
- package/base/providers/ViewCompositionProvider.js.map +1 -1
- package/base/ui/Brand.js +5 -12
- package/base/ui/Brand.js.map +1 -1
- package/base/ui/CenteredView.js +12 -43
- package/base/ui/CenteredView.js.map +1 -1
- package/base/ui/Dashboard.js +5 -12
- package/base/ui/Dashboard.js.map +1 -1
- package/base/ui/FileManager.js +42 -56
- package/base/ui/FileManager.js.map +1 -1
- package/base/ui/Layout.js +8 -16
- package/base/ui/Layout.js.map +1 -1
- package/base/ui/LocaleSelector.js +5 -12
- package/base/ui/LocaleSelector.js.map +1 -1
- package/base/ui/LoginScreen.js +9 -15
- package/base/ui/LoginScreen.js.map +1 -1
- package/base/ui/Logo.d.ts +0 -5
- package/base/ui/Logo.js +5 -26
- package/base/ui/Logo.js.map +1 -1
- package/base/ui/Navigation.d.ts +0 -57
- package/base/ui/Navigation.js +5 -146
- package/base/ui/Navigation.js.map +1 -1
- package/base/ui/NotFound.js +5 -12
- package/base/ui/NotFound.js.map +1 -1
- package/base/ui/Tags.js +14 -19
- package/base/ui/Tags.js.map +1 -1
- package/base/ui/{Search.d.ts → TenantSelector.d.ts} +2 -18
- package/base/ui/TenantSelector.js +8 -0
- package/base/ui/TenantSelector.js.map +1 -0
- package/base/ui/UserMenu/UserMenu.d.ts +39 -0
- package/base/ui/UserMenu/UserMenu.js +8 -0
- package/base/ui/UserMenu/UserMenu.js.map +1 -0
- package/base/ui/UserMenu/UserMenuHandle.d.ts +39 -0
- package/base/ui/UserMenu/UserMenuHandle.js +8 -0
- package/base/ui/UserMenu/UserMenuHandle.js.map +1 -0
- package/base/ui/UserMenu/UserMenuItem.d.ts +81 -0
- package/base/ui/UserMenu/UserMenuItem.js +19 -0
- package/base/ui/UserMenu/UserMenuItem.js.map +1 -0
- package/base/ui/UserMenu/UserMenuLink.d.ts +81 -0
- package/base/ui/UserMenu/UserMenuLink.js +19 -0
- package/base/ui/UserMenu/UserMenuLink.js.map +1 -0
- package/base/ui/UserMenu/UserMenuSeparator.d.ts +42 -0
- package/base/ui/UserMenu/UserMenuSeparator.js +9 -0
- package/base/ui/UserMenu/UserMenuSeparator.js.map +1 -0
- package/base/ui/UserMenu.d.ts +3 -79
- package/base/ui/UserMenu.js +14 -101
- package/base/ui/UserMenu.js.map +1 -1
- package/components/AdminLayout.js +7 -13
- package/components/AdminLayout.js.map +1 -1
- package/components/AppInstaller/AppInstaller.js +57 -67
- package/components/AppInstaller/AppInstaller.js.map +1 -1
- package/components/AppInstaller/Sidebar.js +49 -69
- package/components/AppInstaller/Sidebar.js.map +1 -1
- package/components/AppInstaller/index.js +10 -16
- package/components/AppInstaller/index.js.map +1 -1
- package/components/AppInstaller/styled.js +8 -15
- package/components/AppInstaller/styled.js.map +1 -1
- package/components/AppInstaller/useInstaller.js +81 -91
- package/components/AppInstaller/useInstaller.js.map +1 -1
- package/components/BulkActions/Worker.js +95 -141
- package/components/BulkActions/Worker.js.map +1 -1
- package/components/BulkActions/index.js +2 -27
- package/components/BulkActions/index.js.map +1 -1
- package/components/BulkActions/useDialogWithReport/DialogMessage.js +20 -33
- package/components/BulkActions/useDialogWithReport/DialogMessage.js.map +1 -1
- package/components/BulkActions/useDialogWithReport/index.js +1 -16
- package/components/BulkActions/useDialogWithReport/index.js.map +1 -1
- package/components/BulkActions/useDialogWithReport/useDialogWithReport.js +45 -52
- package/components/BulkActions/useDialogWithReport/useDialogWithReport.js.map +1 -1
- package/components/Buttons/Buttons.d.ts +7 -6
- package/components/Buttons/Buttons.js +58 -56
- package/components/Buttons/Buttons.js.map +1 -1
- package/components/Buttons/Buttons.styles.js +2 -9
- package/components/Buttons/Buttons.styles.js.map +1 -1
- package/components/Buttons/index.js +2 -25
- package/components/Buttons/index.js.map +1 -1
- package/components/Buttons/useButtons.js +13 -19
- package/components/Buttons/useButtons.js.map +1 -1
- package/components/Dialogs/CustomDialog.js +30 -37
- package/components/Dialogs/CustomDialog.js.map +1 -1
- package/components/Dialogs/Dialog.d.ts +8 -4
- package/components/Dialogs/Dialog.js +56 -41
- package/components/Dialogs/Dialog.js.map +1 -1
- package/components/Dialogs/DialogsContext.d.ts +9 -3
- package/components/Dialogs/DialogsContext.js +96 -107
- package/components/Dialogs/DialogsContext.js.map +1 -1
- package/components/Dialogs/useDialogs.js +5 -17
- package/components/Dialogs/useDialogs.js.map +1 -1
- package/components/EmptyView.d.ts +1 -1
- package/components/EmptyView.js +31 -41
- package/components/EmptyView.js.map +1 -1
- package/components/Filters/Filters.js +12 -20
- package/components/Filters/Filters.js.map +1 -1
- package/components/Filters/FiltersToggle.d.ts +7 -0
- package/components/Filters/FiltersToggle.js +26 -0
- package/components/Filters/FiltersToggle.js.map +1 -0
- package/components/Filters/index.d.ts +1 -0
- package/components/Filters/index.js +2 -16
- package/components/Filters/index.js.map +1 -1
- package/components/FloatingActionButton.js +7 -13
- package/components/FloatingActionButton.js.map +1 -1
- package/components/FloatingPanel.js +44 -68
- package/components/FloatingPanel.js.map +1 -1
- package/components/IconPicker/IconPicker.d.ts +1 -1
- package/components/IconPicker/IconPicker.js +25 -32
- package/components/IconPicker/IconPicker.js.map +1 -1
- package/components/IconPicker/IconPickerComponent.d.ts +5 -5
- package/components/IconPicker/IconPickerComponent.js +67 -87
- package/components/IconPicker/IconPickerComponent.js.map +1 -1
- package/components/IconPicker/IconPickerPresenter.d.ts +5 -4
- package/components/IconPicker/IconPickerPresenter.js +68 -109
- package/components/IconPicker/IconPickerPresenter.js.map +1 -1
- package/components/IconPicker/IconPickerPresenter.test.js +21 -23
- package/components/IconPicker/IconPickerPresenter.test.js.map +1 -1
- package/components/IconPicker/IconPickerPresenterProvider.js +10 -17
- package/components/IconPicker/IconPickerPresenterProvider.js.map +1 -1
- package/components/IconPicker/IconPickerTab.d.ts +2 -1
- package/components/IconPicker/IconPickerTab.js +103 -113
- package/components/IconPicker/IconPickerTab.js.map +1 -1
- package/components/IconPicker/IconRenderer.js +16 -24
- package/components/IconPicker/IconRenderer.js.map +1 -1
- package/components/IconPicker/IconRepository.js +41 -73
- package/components/IconPicker/IconRepository.js.map +1 -1
- package/components/IconPicker/IconRepository.test.js +11 -13
- package/components/IconPicker/IconRepository.test.js.map +1 -1
- package/components/IconPicker/IconRepositoryFactory.js +14 -37
- package/components/IconPicker/IconRepositoryFactory.js.map +1 -1
- package/components/IconPicker/Loading.js +42 -68
- package/components/IconPicker/Loading.js.map +1 -1
- package/components/IconPicker/components/IconPickerCell.d.ts +12 -0
- package/components/IconPicker/components/IconPickerCell.js +27 -0
- package/components/IconPicker/components/IconPickerCell.js.map +1 -0
- package/components/IconPicker/components/IconPickerContent.d.ts +11 -0
- package/components/IconPicker/components/IconPickerContent.js +41 -0
- package/components/IconPicker/components/IconPickerContent.js.map +1 -0
- package/components/IconPicker/components/IconPickerRow.d.ts +4 -0
- package/components/IconPicker/components/IconPickerRow.js +14 -0
- package/components/IconPicker/components/IconPickerRow.js.map +1 -0
- package/components/IconPicker/components/IconPickerTrigger.d.ts +13 -0
- package/components/IconPicker/components/IconPickerTrigger.js +52 -0
- package/components/IconPicker/components/IconPickerTrigger.js.map +1 -0
- package/components/IconPicker/components/index.d.ts +4 -0
- package/components/IconPicker/components/index.js +6 -0
- package/components/IconPicker/components/index.js.map +1 -0
- package/components/IconPicker/config/Emojis.js +9 -16
- package/components/IconPicker/config/Emojis.js.map +1 -1
- package/components/IconPicker/config/FontAwesomeIcons.js +30 -43
- package/components/IconPicker/config/FontAwesomeIcons.js.map +1 -1
- package/components/IconPicker/config/IconPackProvider.js +10 -16
- package/components/IconPicker/config/IconPackProvider.js.map +1 -1
- package/components/IconPicker/config/IconType.js +52 -55
- package/components/IconPicker/config/IconType.js.map +1 -1
- package/components/IconPicker/config/index.js +35 -53
- package/components/IconPicker/config/index.js.map +1 -1
- package/components/IconPicker/defaultIcon.js +1 -7
- package/components/IconPicker/defaultIcon.js.map +1 -1
- package/components/IconPicker/index.js +6 -47
- package/components/IconPicker/index.js.map +1 -1
- package/components/IconPicker/plugins/customPlugin.js +71 -96
- package/components/IconPicker/plugins/customPlugin.js.map +1 -1
- package/components/IconPicker/plugins/emojisPlugin.js +80 -117
- package/components/IconPicker/plugins/emojisPlugin.js.map +1 -1
- package/components/IconPicker/plugins/graphql.js +19 -10
- package/components/IconPicker/plugins/graphql.js.map +1 -1
- package/components/IconPicker/plugins/iconsPlugin.js +62 -93
- package/components/IconPicker/plugins/iconsPlugin.js.map +1 -1
- package/components/IconPicker/types.d.ts +1 -1
- package/components/IconPicker/types.js +3 -8
- package/components/IconPicker/types.js.map +1 -1
- package/components/LexicalEditor/LexicalEditor.js +24 -31
- package/components/LexicalEditor/LexicalEditor.js.map +1 -1
- package/components/LexicalEditor/index.js +1 -12
- package/components/LexicalEditor/index.js.map +1 -1
- package/components/MultiImageUpload.d.ts +1 -1
- package/components/MultiImageUpload.js +8 -31
- package/components/MultiImageUpload.js.map +1 -1
- package/components/OptionsMenu/OptionsMenu.d.ts +1 -0
- package/components/OptionsMenu/OptionsMenu.js +17 -23
- package/components/OptionsMenu/OptionsMenu.js.map +1 -1
- package/components/OptionsMenu/OptionsMenuItem.d.ts +1 -0
- package/components/OptionsMenu/OptionsMenuItem.js +12 -17
- package/components/OptionsMenu/OptionsMenuItem.js.map +1 -1
- package/components/OptionsMenu/OptionsMenuLink.d.ts +1 -0
- package/components/OptionsMenu/OptionsMenuLink.js +13 -36
- package/components/OptionsMenu/OptionsMenuLink.js.map +1 -1
- package/components/OptionsMenu/index.js +4 -51
- package/components/OptionsMenu/index.js.map +1 -1
- package/components/OptionsMenu/useOptionsMenuItem.js +12 -18
- package/components/OptionsMenu/useOptionsMenuItem.js.map +1 -1
- package/components/OverlayLayout/OverlayLayout.d.ts +6 -16
- package/components/OverlayLayout/OverlayLayout.js +42 -147
- package/components/OverlayLayout/OverlayLayout.js.map +1 -1
- package/components/OverlayLayout/components/OverlayBackdrop.d.ts +7 -0
- package/components/OverlayLayout/components/OverlayBackdrop.js +15 -0
- package/components/OverlayLayout/components/OverlayBackdrop.js.map +1 -0
- package/components/OverlayLayout/components/OverlayContent.d.ts +6 -0
- package/components/OverlayLayout/components/OverlayContent.js +21 -0
- package/components/OverlayLayout/components/OverlayContent.js.map +1 -0
- package/components/OverlayLayout/components/OverlayHeader.d.ts +13 -0
- package/components/OverlayLayout/components/OverlayHeader.js +44 -0
- package/components/OverlayLayout/components/OverlayHeader.js.map +1 -0
- package/components/OverlayLayout/components/OverlayRoot.d.ts +9 -0
- package/components/OverlayLayout/components/OverlayRoot.js +19 -0
- package/components/OverlayLayout/components/OverlayRoot.js.map +1 -0
- package/components/OverlayLayout/components/index.d.ts +4 -0
- package/components/OverlayLayout/components/index.js +6 -0
- package/components/OverlayLayout/components/index.js.map +1 -0
- package/components/OverlayLayout/index.js +1 -16
- package/components/OverlayLayout/index.js.map +1 -1
- package/components/Permissions/CannotUseAaclAlert.js +5 -12
- package/components/Permissions/CannotUseAaclAlert.js.map +1 -1
- package/components/Permissions/Permissions.js +37 -48
- package/components/Permissions/Permissions.js.map +1 -1
- package/components/Permissions/PermissionsGroup.d.ts +6 -0
- package/components/Permissions/PermissionsGroup.js +18 -0
- package/components/Permissions/PermissionsGroup.js.map +1 -0
- package/components/Permissions/StyledComponents.d.ts +1 -2
- package/components/Permissions/StyledComponents.js +12 -25
- package/components/Permissions/StyledComponents.js.map +1 -1
- package/components/Permissions/index.d.ts +1 -0
- package/components/Permissions/index.js +4 -35
- package/components/Permissions/index.js.map +1 -1
- package/components/ResizablePanels/index.js +1 -42
- package/components/ResizablePanels/index.js.map +1 -1
- package/components/RichTextEditor/RichTextEditor.js +13 -21
- package/components/RichTextEditor/RichTextEditor.js.map +1 -1
- package/components/RichTextEditor/index.js +2 -19
- package/components/RichTextEditor/index.js.map +1 -1
- package/components/RichTextEditor/tools/header/index.js +455 -521
- package/components/RichTextEditor/tools/header/index.js.map +1 -1
- package/components/RichTextEditor/tools/image/index.js +147 -182
- package/components/RichTextEditor/tools/image/index.js.map +1 -1
- package/components/RichTextEditor/tools/image/svgs.js +4 -10
- package/components/RichTextEditor/tools/image/svgs.js.map +1 -1
- package/components/RichTextEditor/tools/image/tunes.js +75 -96
- package/components/RichTextEditor/tools/image/tunes.js.map +1 -1
- package/components/RichTextEditor/tools/image/types.js +1 -5
- package/components/RichTextEditor/tools/image/ui.js +143 -174
- package/components/RichTextEditor/tools/image/ui.js.map +1 -1
- package/components/RichTextEditor/tools/paragraph/index.js +337 -389
- package/components/RichTextEditor/tools/paragraph/index.js.map +1 -1
- package/components/RichTextEditor/tools/textColor/index.js +164 -202
- package/components/RichTextEditor/tools/textColor/index.js.map +1 -1
- package/components/RichTextEditor/tools/utils.js +3 -9
- package/components/RichTextEditor/tools/utils.js.map +1 -1
- package/components/Routes.js +14 -23
- package/components/Routes.js.map +1 -1
- package/components/SearchUI.d.ts +2 -1
- package/components/SearchUI.js +22 -48
- package/components/SearchUI.js.map +1 -1
- package/components/SimpleForm/SimpleForm.d.ts +14 -7
- package/components/SimpleForm/SimpleForm.js +72 -77
- package/components/SimpleForm/SimpleForm.js.map +1 -1
- package/components/SimpleForm/index.js +1 -30
- package/components/SimpleForm/index.js.map +1 -1
- package/components/SimpleUI/InputField.js +39 -47
- package/components/SimpleUI/InputField.js.map +1 -1
- package/components/SingleImageUpload.d.ts +19 -1
- package/components/SingleImageUpload.js +39 -75
- package/components/SingleImageUpload.js.map +1 -1
- package/components/SplitView/SplitView.d.ts +4 -4
- package/components/SplitView/SplitView.js +41 -88
- package/components/SplitView/SplitView.js.map +1 -1
- package/components/SplitView/index.js +1 -24
- package/components/SplitView/index.js.map +1 -1
- package/components/StateInspector.js +28 -28
- package/components/StateInspector.js.map +1 -1
- package/components/Wcp.js +21 -25
- package/components/Wcp.js.map +1 -1
- package/components/index.js +3 -26
- package/components/index.js.map +1 -1
- package/config/AdminConfig/Menu/MenuGroup.d.ts +62 -0
- package/config/AdminConfig/Menu/MenuGroup.js +14 -0
- package/config/AdminConfig/Menu/MenuGroup.js.map +1 -0
- package/config/AdminConfig/Menu/MenuItem.d.ts +43 -0
- package/config/AdminConfig/Menu/MenuItem.js +14 -0
- package/config/AdminConfig/Menu/MenuItem.js.map +1 -0
- package/config/AdminConfig/Menu/MenuLink.d.ts +43 -0
- package/config/AdminConfig/Menu/MenuLink.js +18 -0
- package/config/AdminConfig/Menu/MenuLink.js.map +1 -0
- package/config/AdminConfig/Menu/SupportMenu/SupportMenuItem.d.ts +43 -0
- package/config/AdminConfig/Menu/SupportMenu/SupportMenuItem.js +13 -0
- package/config/AdminConfig/Menu/SupportMenu/SupportMenuItem.js.map +1 -0
- package/config/AdminConfig/Menu/SupportMenu/SupportMenuLink.d.ts +24 -0
- package/config/AdminConfig/Menu/SupportMenu/SupportMenuLink.js +13 -0
- package/config/AdminConfig/Menu/SupportMenu/SupportMenuLink.js.map +1 -0
- package/config/AdminConfig/Menu/SupportMenu.d.ts +72 -0
- package/config/AdminConfig/Menu/SupportMenu.js +49 -0
- package/config/AdminConfig/Menu/SupportMenu.js.map +1 -0
- package/config/AdminConfig/Menu/UserMenu/UserMenuItem.d.ts +41 -0
- package/config/AdminConfig/Menu/UserMenu/UserMenuItem.js +7 -0
- package/config/AdminConfig/Menu/UserMenu/UserMenuItem.js.map +1 -0
- package/config/AdminConfig/Menu/UserMenu/UserMenuLink.d.ts +41 -0
- package/config/AdminConfig/Menu/UserMenu/UserMenuLink.js +7 -0
- package/config/AdminConfig/Menu/UserMenu/UserMenuLink.js.map +1 -0
- package/config/AdminConfig/Menu/UserMenu/UserMenuSeparator.d.ts +1 -0
- package/config/AdminConfig/Menu/UserMenu/UserMenuSeparator.js +3 -0
- package/config/AdminConfig/Menu/UserMenu/UserMenuSeparator.js.map +1 -0
- package/config/AdminConfig/Menu/UserMenu/types.d.ts +7 -0
- package/config/AdminConfig/Menu/UserMenu/types.js +3 -0
- package/config/AdminConfig/Menu/UserMenu/types.js.map +1 -0
- package/config/AdminConfig/Menu/UserMenu.d.ts +129 -0
- package/config/AdminConfig/Menu/UserMenu.js +61 -0
- package/config/AdminConfig/Menu/UserMenu.js.map +1 -0
- package/config/AdminConfig/Menu/types.d.ts +7 -0
- package/config/AdminConfig/Menu/types.js +3 -0
- package/config/AdminConfig/Menu/types.js.map +1 -0
- package/config/AdminConfig/Menu.d.ts +350 -0
- package/config/AdminConfig/Menu.js +75 -0
- package/config/AdminConfig/Menu.js.map +1 -0
- package/config/AdminConfig/Route.d.ts +3 -0
- package/config/AdminConfig/Route.js +8 -0
- package/config/AdminConfig/Route.js.map +1 -0
- package/config/AdminConfig/Tenant/TenantLogo.d.ts +23 -0
- package/config/AdminConfig/Tenant/TenantLogo.js +16 -0
- package/config/AdminConfig/Tenant/TenantLogo.js.map +1 -0
- package/config/AdminConfig/Tenant/TenantName.d.ts +23 -0
- package/config/AdminConfig/Tenant/TenantName.js +16 -0
- package/config/AdminConfig/Tenant/TenantName.js.map +1 -0
- package/config/AdminConfig/Tenant.d.ts +66 -0
- package/config/AdminConfig/Tenant.js +23 -0
- package/config/AdminConfig/Tenant.js.map +1 -0
- package/config/AdminConfig/Theme/assignColor.d.ts +2 -0
- package/config/AdminConfig/Theme/assignColor.js +22 -0
- package/config/AdminConfig/Theme/assignColor.js.map +1 -0
- package/config/AdminConfig/Theme/consts.d.ts +2 -0
- package/config/AdminConfig/Theme/consts.js +4 -0
- package/config/AdminConfig/Theme/consts.js.map +1 -0
- package/config/AdminConfig/Theme/types.d.ts +3 -0
- package/config/AdminConfig/Theme/types.js +3 -0
- package/config/AdminConfig/Theme/types.js.map +1 -0
- package/config/AdminConfig/Theme.d.ts +16 -0
- package/config/AdminConfig/Theme.js +22 -0
- package/config/AdminConfig/Theme.js.map +1 -0
- package/config/AdminConfig.d.ts +434 -0
- package/config/AdminConfig.js +47 -0
- package/config/AdminConfig.js.map +1 -0
- package/config/createAdminConfig.d.ts +57 -0
- package/config/createAdminConfig.js +94 -0
- package/config/createAdminConfig.js.map +1 -0
- package/hooks/index.js +10 -115
- package/hooks/index.js.map +1 -1
- package/hooks/useConfirmationDialog.js +26 -39
- package/hooks/useConfirmationDialog.js.map +1 -1
- package/hooks/useDialog.js +16 -21
- package/hooks/useDialog.js.map +1 -1
- package/hooks/useIsMounted.js +6 -14
- package/hooks/useIsMounted.js.map +1 -1
- package/hooks/useKeyHandler.js +28 -46
- package/hooks/useKeyHandler.js.map +1 -1
- package/hooks/useModKey.js +9 -20
- package/hooks/useModKey.js.map +1 -1
- package/hooks/useShiftKey.js +13 -26
- package/hooks/useShiftKey.js.map +1 -1
- package/hooks/useSnackbar.js +22 -43
- package/hooks/useSnackbar.js.map +1 -1
- package/hooks/useStateIfMounted.js +8 -18
- package/hooks/useStateIfMounted.js.map +1 -1
- package/hooks/useStateWithCallback.js +7 -20
- package/hooks/useStateWithCallback.js.map +1 -1
- package/index.d.ts +2 -5
- package/index.js +52 -491
- package/index.js.map +1 -1
- package/package.json +25 -23
- package/plugins/MenuPlugin.js +15 -36
- package/plugins/MenuPlugin.js.map +1 -1
- package/plugins/PermissionRendererPlugin.js +15 -36
- package/plugins/PermissionRendererPlugin.js.map +1 -1
- package/plugins/uiLayoutRenderer/index.js +39 -48
- package/plugins/uiLayoutRenderer/index.js.map +1 -1
- package/styles.scss +7 -3
- package/types.d.ts +1 -36
- package/types.js +4 -11
- package/types.js.map +1 -1
- package/ui/UIElement.js +1 -18
- package/ui/UIElement.js.map +1 -1
- package/ui/UILayout.js +1 -18
- package/ui/UILayout.js.map +1 -1
- package/ui/UIRenderer.js +1 -12
- package/ui/UIRenderer.js.map +1 -1
- package/ui/UIView.js +1 -24
- package/ui/UIView.js.map +1 -1
- package/ui/elements/AccordionElement.js +43 -74
- package/ui/elements/AccordionElement.js.map +1 -1
- package/ui/elements/ButtonElement.js +46 -79
- package/ui/elements/ButtonElement.js.map +1 -1
- package/ui/elements/ButtonGroupElement.js +12 -31
- package/ui/elements/ButtonGroupElement.js.map +1 -1
- package/ui/elements/GenericElement.js +1 -16
- package/ui/elements/GenericElement.js.map +1 -1
- package/ui/elements/LabelElement.js +15 -37
- package/ui/elements/LabelElement.js.map +1 -1
- package/ui/elements/NavigationMenuElement.js +67 -119
- package/ui/elements/NavigationMenuElement.js.map +1 -1
- package/ui/elements/PanelElement.js +2 -20
- package/ui/elements/PanelElement.js.map +1 -1
- package/ui/elements/PlaceholderElement.js +8 -29
- package/ui/elements/PlaceholderElement.js.map +1 -1
- package/ui/elements/SmallButtonElement.js +20 -40
- package/ui/elements/SmallButtonElement.js.map +1 -1
- package/ui/elements/TypographyElement.js +20 -43
- package/ui/elements/TypographyElement.js.map +1 -1
- package/ui/elements/ViewElement.js +1 -16
- package/ui/elements/ViewElement.js.map +1 -1
- package/ui/elements/form/DynamicFieldsetElement/DynamicFieldsetRowElement.js +17 -33
- package/ui/elements/form/DynamicFieldsetElement/DynamicFieldsetRowElement.js.map +1 -1
- package/ui/elements/form/DynamicFieldsetElement.js +90 -127
- package/ui/elements/form/DynamicFieldsetElement.js.map +1 -1
- package/ui/elements/form/FileManagerElement/EmptyStateElement.js +7 -23
- package/ui/elements/form/FileManagerElement/EmptyStateElement.js.map +1 -1
- package/ui/elements/form/FileManagerElement/EmptyStateElementRenderer.js +40 -65
- package/ui/elements/form/FileManagerElement/EmptyStateElementRenderer.js.map +1 -1
- package/ui/elements/form/FileManagerElement/FileManagerElementRenderer.js +56 -82
- package/ui/elements/form/FileManagerElement/FileManagerElementRenderer.js.map +1 -1
- package/ui/elements/form/FileManagerElement/styled.js +37 -35
- package/ui/elements/form/FileManagerElement/styled.js.map +1 -1
- package/ui/elements/form/FileManagerElement.js +43 -81
- package/ui/elements/form/FileManagerElement.js.map +1 -1
- package/ui/elements/form/FormElement.js +17 -40
- package/ui/elements/form/FormElement.js.map +1 -1
- package/ui/elements/form/FormFieldElement.js +100 -158
- package/ui/elements/form/FormFieldElement.js.map +1 -1
- package/ui/elements/form/HiddenElement.js +21 -42
- package/ui/elements/form/HiddenElement.js.map +1 -1
- package/ui/elements/form/InputElement.js +28 -49
- package/ui/elements/form/InputElement.js.map +1 -1
- package/ui/elements/form/PasswordElement.js +26 -48
- package/ui/elements/form/PasswordElement.js.map +1 -1
- package/ui/elements/form/SelectElement.js +38 -64
- package/ui/elements/form/SelectElement.js.map +1 -1
- package/ui/elements/form/TextareaElement.js +30 -50
- package/ui/elements/form/TextareaElement.js.map +1 -1
- package/ui/views/AdminView/ContentElement.js +19 -42
- package/ui/views/AdminView/ContentElement.js.map +1 -1
- package/ui/views/AdminView/HeaderElement.js +57 -90
- package/ui/views/AdminView/HeaderElement.js.map +1 -1
- package/ui/views/AdminView/HeaderSectionCenterElement.js +16 -35
- package/ui/views/AdminView/HeaderSectionCenterElement.js.map +1 -1
- package/ui/views/AdminView/HeaderSectionLeftElement.js +16 -35
- package/ui/views/AdminView/HeaderSectionLeftElement.js.map +1 -1
- package/ui/views/AdminView/HeaderSectionRightElement.js +16 -35
- package/ui/views/AdminView/HeaderSectionRightElement.js.map +1 -1
- package/ui/views/AdminView/components/Dialog.js +30 -36
- package/ui/views/AdminView/components/Dialog.js.map +1 -1
- package/ui/views/AdminView/components/Hamburger.js +12 -21
- package/ui/views/AdminView/components/Hamburger.js.map +1 -1
- package/ui/views/FormView/FormContainerElement.js +16 -53
- package/ui/views/FormView/FormContainerElement.js.map +1 -1
- package/ui/views/FormView/FormContentElement.d.ts +3 -1
- package/ui/views/FormView/FormContentElement.js +7 -19
- package/ui/views/FormView/FormContentElement.js.map +1 -1
- package/ui/views/FormView/FormFooterElement.js +11 -45
- package/ui/views/FormView/FormFooterElement.js.map +1 -1
- package/ui/views/FormView/FormHeaderElement.js +26 -75
- package/ui/views/FormView/FormHeaderElement.js.map +1 -1
- package/ui/views/FormView.js +104 -148
- package/ui/views/FormView.js.map +1 -1
- package/ui/views/OverlayView/ContentElement.js +12 -31
- package/ui/views/OverlayView/ContentElement.js.map +1 -1
- package/ui/views/OverlayView/HeaderElement.js +62 -99
- package/ui/views/OverlayView/HeaderElement.js.map +1 -1
- package/ui/views/OverlayView/HeaderTitleElement.js +21 -44
- package/ui/views/OverlayView/HeaderTitleElement.js.map +1 -1
- package/ui/views/OverlayView/useOverlayView.js +16 -27
- package/ui/views/OverlayView/useOverlayView.js.map +1 -1
- package/ui/views/OverlayView.js +72 -123
- package/ui/views/OverlayView.js.map +1 -1
- package/ui/views/SplitView/SplitViewPanelElement.js +28 -64
- package/ui/views/SplitView/SplitViewPanelElement.js.map +1 -1
- package/ui/views/SplitView.js +51 -82
- package/ui/views/SplitView.js.map +1 -1
- package/base/Version.d.ts +0 -3
- package/base/Version.js +0 -56
- package/base/Version.js.map +0 -1
- package/base/ui/Menu.d.ts +0 -51
- package/base/ui/Menu.js +0 -133
- package/base/ui/Menu.js.map +0 -1
- package/base/ui/Search.js +0 -61
- package/base/ui/Search.js.map +0 -1
- package/components/BulkActions/useDialogWithReport/useDialogWithReport.styled.d.ts +0 -20
- package/components/BulkActions/useDialogWithReport/useDialogWithReport.styled.js +0 -48
- package/components/BulkActions/useDialogWithReport/useDialogWithReport.styled.js.map +0 -1
- package/components/Dialogs/styled.d.ts +0 -10
- package/components/Dialogs/styled.js +0 -40
- package/components/Dialogs/styled.js.map +0 -1
- package/components/Filters/Filters.styled.d.ts +0 -13
- package/components/Filters/Filters.styled.js +0 -53
- package/components/Filters/Filters.styled.js.map +0 -1
- package/components/IconPicker/IconPicker.styles.d.ts +0 -63
- package/components/IconPicker/IconPicker.styles.js +0 -187
- package/components/IconPicker/IconPicker.styles.js.map +0 -1
- package/components/OptionsMenu/OptionsMenu.styled.d.ts +0 -3
- package/components/OptionsMenu/OptionsMenu.styled.js +0 -26
- package/components/OptionsMenu/OptionsMenu.styled.js.map +0 -1
- package/components/OverlayLayout/icons/close.svg +0 -13
- package/components/OverlayLayout/icons/navigate_before.svg +0 -16
- package/plugins/globalSearch/SearchBar.d.ts +0 -34
- package/plugins/globalSearch/SearchBar.js +0 -225
- package/plugins/globalSearch/SearchBar.js.map +0 -1
- package/plugins/globalSearch/SearchBarDropdown.d.ts +0 -23
- package/plugins/globalSearch/SearchBarDropdown.js +0 -82
- package/plugins/globalSearch/SearchBarDropdown.js.map +0 -1
- package/plugins/globalSearch/icons/round-search-24px.svg +0 -20
- package/plugins/globalSearch/index.d.ts +0 -6
- package/plugins/globalSearch/index.js +0 -17
- package/plugins/globalSearch/index.js.map +0 -1
- package/plugins/globalSearch/styled.d.ts +0 -18
- package/plugins/globalSearch/styled.js +0 -133
- package/plugins/globalSearch/styled.js.map +0 -1
- package/styles/material-theme-assignments.scss +0 -375
- package/styles/material.scss +0 -42
- package/styles/reset.scss +0 -1
- package/styles/theme.scss +0 -76
- package/ui/views/AdminView/components/Snackbar.d.ts +0 -3
- package/ui/views/AdminView/components/Snackbar.js +0 -33
- package/ui/views/AdminView/components/Snackbar.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","AppContainer","Plugin","Menu","Tenant","Route","Theme","createAdminConfig","base","AdminWithConfig","Object","assign","WithConfig","displayName","AdminConfigProvider","createDecorator","Original","children","createElement","Fragment","ApplyPublicConfig","ApplyProtectedConfig","useAdminConfig","baseConfig","useConfig","menus","userMenus","supportMenus","tenant","Public","PublicConfig","Private","PrivateConfig","AdminConfig"],"sources":["AdminConfig.tsx"],"sourcesContent":["import React from \"react\";\nimport { AppContainer, Plugin } from \"@webiny/app\";\nimport { Menu, type MenuConfig } from \"./AdminConfig/Menu\";\nimport { Tenant, TenantConfig } from \"./AdminConfig/Tenant\";\nimport type { SupportMenuConfig } from \"./AdminConfig/Menu/SupportMenu\";\nimport type { UserMenuConfig } from \"./AdminConfig/Menu/UserMenu\";\nimport { Route } from \"./AdminConfig/Route\";\nimport { Theme } from \"./AdminConfig/Theme\";\nimport { createAdminConfig } from \"./createAdminConfig\";\n\nconst base = createAdminConfig<AdminConfig>();\n\nexport const AdminWithConfig = Object.assign(base.WithConfig, {\n displayName: \"AdminWithConfig\"\n});\n\ninterface AdminConfig {\n menus: MenuConfig[];\n supportMenus: SupportMenuConfig[];\n userMenus: UserMenuConfig[];\n tenant: TenantConfig;\n}\n\nexport const AdminConfigProvider = AppContainer.createDecorator(Original => {\n return function AdminConfigProvider({ children }) {\n return (\n <>\n {/* Wrap the entire app with an AdminConfig provider, and apply all public configs. */}\n <Original>\n <AdminWithConfig>\n <base.ApplyPublicConfig />\n {children}\n </AdminWithConfig>\n </Original>\n {/* Once the app fully renders (after the LoginScreen), apply protected configs. */}\n <Plugin>\n <base.ApplyProtectedConfig />\n </Plugin>\n </>\n );\n };\n});\n\nexport const useAdminConfig = () => {\n const baseConfig = base.useConfig();\n\n return {\n menus: baseConfig.menus ?? [],\n userMenus: baseConfig.userMenus ?? [],\n supportMenus: baseConfig.supportMenus ?? [],\n tenant: baseConfig.tenant || {}\n };\n};\n\nexport interface PublicProps {\n children: React.ReactNode;\n}\n\nexport const Public = ({ children }: PublicProps) => {\n return <base.PublicConfig>{children}</base.PublicConfig>;\n};\n\nexport interface PrivateProps {\n children: React.ReactNode;\n}\n\nexport const Private = ({ children }: PrivateProps) => {\n return <base.PrivateConfig>{children}</base.PrivateConfig>;\n};\n\nexport const AdminConfig = Object.assign(Private, {\n Public,\n Theme,\n Menu,\n Route,\n Tenant,\n useAdminConfig\n});\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,YAAY,EAAEC,MAAM,QAAQ,aAAa;AAClD,SAASC,IAAI;AACb,SAASC,MAAM;AAGf,SAASC,KAAK;AACd,SAASC,KAAK;AACd,SAASC,iBAAiB;AAE1B,MAAMC,IAAI,GAAGD,iBAAiB,CAAc,CAAC;AAE7C,OAAO,MAAME,eAAe,GAAGC,MAAM,CAACC,MAAM,CAACH,IAAI,CAACI,UAAU,EAAE;EAC1DC,WAAW,EAAE;AACjB,CAAC,CAAC;AASF,OAAO,MAAMC,mBAAmB,GAAGb,YAAY,CAACc,eAAe,CAACC,QAAQ,IAAI;EACxE,OAAO,SAASF,mBAAmBA,CAAC;IAAEG;EAAS,CAAC,EAAE;IAC9C,oBACIjB,KAAA,CAAAkB,aAAA,CAAAlB,KAAA,CAAAmB,QAAA,qBAEInB,KAAA,CAAAkB,aAAA,CAACF,QAAQ,qBACLhB,KAAA,CAAAkB,aAAA,CAACT,eAAe,qBACZT,KAAA,CAAAkB,aAAA,CAACV,IAAI,CAACY,iBAAiB,MAAE,CAAC,EACzBH,QACY,CACX,CAAC,eAEXjB,KAAA,CAAAkB,aAAA,CAAChB,MAAM,qBACHF,KAAA,CAAAkB,aAAA,CAACV,IAAI,CAACa,oBAAoB,MAAE,CACxB,CACV,CAAC;EAEX,CAAC;AACL,CAAC,CAAC;AAEF,OAAO,MAAMC,cAAc,GAAGA,CAAA,KAAM;EAChC,MAAMC,UAAU,GAAGf,IAAI,CAACgB,SAAS,CAAC,CAAC;EAEnC,OAAO;IACHC,KAAK,EAAEF,UAAU,CAACE,KAAK,IAAI,EAAE;IAC7BC,SAAS,EAAEH,UAAU,CAACG,SAAS,IAAI,EAAE;IACrCC,YAAY,EAAEJ,UAAU,CAACI,YAAY,IAAI,EAAE;IAC3CC,MAAM,EAAEL,UAAU,CAACK,MAAM,IAAI,CAAC;EAClC,CAAC;AACL,CAAC;AAMD,OAAO,MAAMC,MAAM,GAAGA,CAAC;EAAEZ;AAAsB,CAAC,KAAK;EACjD,oBAAOjB,KAAA,CAAAkB,aAAA,CAACV,IAAI,CAACsB,YAAY,QAAEb,QAA4B,CAAC;AAC5D,CAAC;AAMD,OAAO,MAAMc,OAAO,GAAGA,CAAC;EAAEd;AAAuB,CAAC,KAAK;EACnD,oBAAOjB,KAAA,CAAAkB,aAAA,CAACV,IAAI,CAACwB,aAAa,QAAEf,QAA6B,CAAC;AAC9D,CAAC;AAED,OAAO,MAAMgB,WAAW,GAAGvB,MAAM,CAACC,MAAM,CAACoB,OAAO,EAAE;EAC9CF,MAAM;EACNvB,KAAK;EACLH,IAAI;EACJE,KAAK;EACLD,MAAM;EACNkB;AACJ,CAAC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Property } from "@webiny/react-properties";
|
|
3
|
+
export interface WithConfigProps {
|
|
4
|
+
children: React.ReactNode;
|
|
5
|
+
onProperties?(properties: Property[]): void;
|
|
6
|
+
}
|
|
7
|
+
interface ConfigApplyProps {
|
|
8
|
+
children?: React.ReactNode;
|
|
9
|
+
}
|
|
10
|
+
export interface ConfigProps {
|
|
11
|
+
children: React.ReactNode;
|
|
12
|
+
}
|
|
13
|
+
export declare function createAdminConfig<TConfig>(): {
|
|
14
|
+
WithConfig: ({ onProperties, children }: WithConfigProps) => React.JSX.Element;
|
|
15
|
+
PrivateConfig: ({ children }: ConfigProps) => React.JSX.Element;
|
|
16
|
+
PublicConfig: ({ children }: ConfigProps) => React.JSX.Element;
|
|
17
|
+
ApplyPublicConfig: (({ children }: ConfigApplyProps) => React.JSX.Element) & {
|
|
18
|
+
original: ({ children }: ConfigApplyProps) => React.JSX.Element;
|
|
19
|
+
originalName: string;
|
|
20
|
+
displayName: string;
|
|
21
|
+
} & {
|
|
22
|
+
original: (({ children }: ConfigApplyProps) => React.JSX.Element) & {
|
|
23
|
+
original: ({ children }: ConfigApplyProps) => React.JSX.Element;
|
|
24
|
+
originalName: string;
|
|
25
|
+
displayName: string;
|
|
26
|
+
};
|
|
27
|
+
originalName: string;
|
|
28
|
+
displayName: string;
|
|
29
|
+
} & {
|
|
30
|
+
createDecorator: (decorator: import("@webiny/react-composition").ComponentDecorator<(({ children }: ConfigApplyProps) => React.JSX.Element) & {
|
|
31
|
+
original: ({ children }: ConfigApplyProps) => React.JSX.Element;
|
|
32
|
+
originalName: string;
|
|
33
|
+
displayName: string;
|
|
34
|
+
}>) => (props: unknown) => React.JSX.Element;
|
|
35
|
+
};
|
|
36
|
+
ApplyProtectedConfig: (({ children }: ConfigApplyProps) => React.JSX.Element) & {
|
|
37
|
+
original: ({ children }: ConfigApplyProps) => React.JSX.Element;
|
|
38
|
+
originalName: string;
|
|
39
|
+
displayName: string;
|
|
40
|
+
} & {
|
|
41
|
+
original: (({ children }: ConfigApplyProps) => React.JSX.Element) & {
|
|
42
|
+
original: ({ children }: ConfigApplyProps) => React.JSX.Element;
|
|
43
|
+
originalName: string;
|
|
44
|
+
displayName: string;
|
|
45
|
+
};
|
|
46
|
+
originalName: string;
|
|
47
|
+
displayName: string;
|
|
48
|
+
} & {
|
|
49
|
+
createDecorator: (decorator: import("@webiny/react-composition").ComponentDecorator<(({ children }: ConfigApplyProps) => React.JSX.Element) & {
|
|
50
|
+
original: ({ children }: ConfigApplyProps) => React.JSX.Element;
|
|
51
|
+
originalName: string;
|
|
52
|
+
displayName: string;
|
|
53
|
+
}>) => (props: unknown) => React.JSX.Element;
|
|
54
|
+
};
|
|
55
|
+
useConfig: <TExtra extends object>() => TConfig & TExtra;
|
|
56
|
+
};
|
|
57
|
+
export {};
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import React, { useContext, useEffect, useMemo, useState } from "react";
|
|
2
|
+
import { Compose, makeDecoratable } from "@webiny/react-composition";
|
|
3
|
+
import { Properties, toObject, useDebugConfig } from "@webiny/react-properties";
|
|
4
|
+
const createHOC = newChildren => {
|
|
5
|
+
return BaseComponent => {
|
|
6
|
+
return function ConfigHOC({
|
|
7
|
+
children
|
|
8
|
+
}) {
|
|
9
|
+
return /*#__PURE__*/React.createElement(BaseComponent, null, newChildren, children);
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
const name = "AdminConfig";
|
|
14
|
+
export function createAdminConfig() {
|
|
15
|
+
/**
|
|
16
|
+
* This component is used when we want to mount all composed configs.
|
|
17
|
+
*/
|
|
18
|
+
const ApplyPublicConfig = makeDecoratable(`${name}Apply<Public>`, ({
|
|
19
|
+
children
|
|
20
|
+
}) => {
|
|
21
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, children);
|
|
22
|
+
});
|
|
23
|
+
const ApplyProtectedConfig = makeDecoratable(`${name}Apply<Protected>`, ({
|
|
24
|
+
children
|
|
25
|
+
}) => {
|
|
26
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, children);
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* This component is used to configure the component (it can be mounted many times).
|
|
31
|
+
*/
|
|
32
|
+
const PublicConfig = ({
|
|
33
|
+
children
|
|
34
|
+
}) => {
|
|
35
|
+
return /*#__PURE__*/React.createElement(Compose, {
|
|
36
|
+
component: ApplyPublicConfig,
|
|
37
|
+
with: createHOC(children)
|
|
38
|
+
});
|
|
39
|
+
};
|
|
40
|
+
const ProtectedConfig = ({
|
|
41
|
+
children
|
|
42
|
+
}) => {
|
|
43
|
+
return /*#__PURE__*/React.createElement(Compose, {
|
|
44
|
+
component: ApplyProtectedConfig,
|
|
45
|
+
with: createHOC(children)
|
|
46
|
+
});
|
|
47
|
+
};
|
|
48
|
+
const defaultContext = {
|
|
49
|
+
name,
|
|
50
|
+
properties: []
|
|
51
|
+
};
|
|
52
|
+
const ViewContext = /*#__PURE__*/React.createContext(defaultContext);
|
|
53
|
+
const WithConfig = ({
|
|
54
|
+
onProperties,
|
|
55
|
+
children
|
|
56
|
+
}) => {
|
|
57
|
+
const [properties, setProperties] = useState([]);
|
|
58
|
+
useDebugConfig(name, properties);
|
|
59
|
+
const context = {
|
|
60
|
+
name,
|
|
61
|
+
properties
|
|
62
|
+
};
|
|
63
|
+
useEffect(() => {
|
|
64
|
+
if (typeof onProperties === "function") {
|
|
65
|
+
onProperties(properties);
|
|
66
|
+
}
|
|
67
|
+
}, [properties]);
|
|
68
|
+
const stateUpdater = properties => {
|
|
69
|
+
setProperties(properties);
|
|
70
|
+
};
|
|
71
|
+
return /*#__PURE__*/React.createElement(ViewContext.Provider, {
|
|
72
|
+
value: context
|
|
73
|
+
}, /*#__PURE__*/React.createElement(Properties, {
|
|
74
|
+
onChange: stateUpdater,
|
|
75
|
+
name: name
|
|
76
|
+
}, children));
|
|
77
|
+
};
|
|
78
|
+
function useConfig() {
|
|
79
|
+
const {
|
|
80
|
+
properties
|
|
81
|
+
} = useContext(ViewContext);
|
|
82
|
+
return useMemo(() => toObject(properties), [properties]);
|
|
83
|
+
}
|
|
84
|
+
return {
|
|
85
|
+
WithConfig,
|
|
86
|
+
PrivateConfig: ProtectedConfig,
|
|
87
|
+
PublicConfig,
|
|
88
|
+
ApplyPublicConfig,
|
|
89
|
+
ApplyProtectedConfig,
|
|
90
|
+
useConfig
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
//# sourceMappingURL=createAdminConfig.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","useContext","useEffect","useMemo","useState","Compose","makeDecoratable","Properties","toObject","useDebugConfig","createHOC","newChildren","BaseComponent","ConfigHOC","children","createElement","name","createAdminConfig","ApplyPublicConfig","Fragment","ApplyProtectedConfig","PublicConfig","component","with","ProtectedConfig","defaultContext","properties","ViewContext","createContext","WithConfig","onProperties","setProperties","context","stateUpdater","Provider","value","onChange","useConfig","PrivateConfig"],"sources":["createAdminConfig.tsx"],"sourcesContent":["import React, { useContext, useEffect, useMemo, useState } from \"react\";\nimport { Compose, Decorator, makeDecoratable } from \"@webiny/react-composition\";\nimport type { GenericComponent } from \"@webiny/react-composition/types\";\nimport { Properties, Property, toObject, useDebugConfig } from \"@webiny/react-properties\";\n\nconst createHOC = (\n newChildren: React.ReactNode\n): Decorator<GenericComponent<{ children?: React.ReactNode }>> => {\n return BaseComponent => {\n return function ConfigHOC({ children }) {\n return (\n <BaseComponent>\n {newChildren}\n {children}\n </BaseComponent>\n );\n };\n };\n};\n\nexport interface WithConfigProps {\n children: React.ReactNode;\n onProperties?(properties: Property[]): void;\n}\n\ninterface ConfigApplyProps {\n children?: React.ReactNode;\n}\n\nexport interface ConfigProps {\n children: React.ReactNode;\n}\n\nconst name = \"AdminConfig\";\n\nexport function createAdminConfig<TConfig>() {\n /**\n * This component is used when we want to mount all composed configs.\n */\n const ApplyPublicConfig = makeDecoratable(\n `${name}Apply<Public>`,\n ({ children }: ConfigApplyProps) => {\n return <>{children}</>;\n }\n );\n\n const ApplyProtectedConfig = makeDecoratable(\n `${name}Apply<Protected>`,\n ({ children }: ConfigApplyProps) => {\n return <>{children}</>;\n }\n );\n\n /**\n * This component is used to configure the component (it can be mounted many times).\n */\n const PublicConfig = ({ children }: ConfigProps) => {\n return <Compose component={ApplyPublicConfig} with={createHOC(children)} />;\n };\n\n const ProtectedConfig = ({ children }: ConfigProps) => {\n return <Compose component={ApplyProtectedConfig} with={createHOC(children)} />;\n };\n\n interface ViewContext {\n name: string;\n properties: Property[];\n }\n\n const defaultContext = { name, properties: [] };\n\n const ViewContext = React.createContext<ViewContext>(defaultContext);\n\n const WithConfig = ({ onProperties, children }: WithConfigProps) => {\n const [properties, setProperties] = useState<Property[]>([]);\n useDebugConfig(name, properties);\n const context = { name, properties };\n\n useEffect(() => {\n if (typeof onProperties === \"function\") {\n onProperties(properties);\n }\n }, [properties]);\n\n const stateUpdater = (properties: Property[]) => {\n setProperties(properties);\n };\n\n return (\n <ViewContext.Provider value={context}>\n <Properties onChange={stateUpdater} name={name}>\n {children}\n </Properties>\n </ViewContext.Provider>\n );\n };\n\n function useConfig<TExtra extends object>(): TConfig & TExtra {\n const { properties } = useContext(ViewContext);\n return useMemo(() => toObject<TConfig & TExtra>(properties), [properties]);\n }\n\n return {\n WithConfig,\n PrivateConfig: ProtectedConfig,\n PublicConfig,\n ApplyPublicConfig,\n ApplyProtectedConfig,\n useConfig\n };\n}\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,UAAU,EAAEC,SAAS,EAAEC,OAAO,EAAEC,QAAQ,QAAQ,OAAO;AACvE,SAASC,OAAO,EAAaC,eAAe,QAAQ,2BAA2B;AAE/E,SAASC,UAAU,EAAYC,QAAQ,EAAEC,cAAc,QAAQ,0BAA0B;AAEzF,MAAMC,SAAS,GACXC,WAA4B,IACkC;EAC9D,OAAOC,aAAa,IAAI;IACpB,OAAO,SAASC,SAASA,CAAC;MAAEC;IAAS,CAAC,EAAE;MACpC,oBACId,KAAA,CAAAe,aAAA,CAACH,aAAa,QACTD,WAAW,EACXG,QACU,CAAC;IAExB,CAAC;EACL,CAAC;AACL,CAAC;AAeD,MAAME,IAAI,GAAG,aAAa;AAE1B,OAAO,SAASC,iBAAiBA,CAAA,EAAY;EACzC;AACJ;AACA;EACI,MAAMC,iBAAiB,GAAGZ,eAAe,CACrC,GAAGU,IAAI,eAAe,EACtB,CAAC;IAAEF;EAA2B,CAAC,KAAK;IAChC,oBAAOd,KAAA,CAAAe,aAAA,CAAAf,KAAA,CAAAmB,QAAA,QAAGL,QAAW,CAAC;EAC1B,CACJ,CAAC;EAED,MAAMM,oBAAoB,GAAGd,eAAe,CACxC,GAAGU,IAAI,kBAAkB,EACzB,CAAC;IAAEF;EAA2B,CAAC,KAAK;IAChC,oBAAOd,KAAA,CAAAe,aAAA,CAAAf,KAAA,CAAAmB,QAAA,QAAGL,QAAW,CAAC;EAC1B,CACJ,CAAC;;EAED;AACJ;AACA;EACI,MAAMO,YAAY,GAAGA,CAAC;IAAEP;EAAsB,CAAC,KAAK;IAChD,oBAAOd,KAAA,CAAAe,aAAA,CAACV,OAAO;MAACiB,SAAS,EAAEJ,iBAAkB;MAACK,IAAI,EAAEb,SAAS,CAACI,QAAQ;IAAE,CAAE,CAAC;EAC/E,CAAC;EAED,MAAMU,eAAe,GAAGA,CAAC;IAAEV;EAAsB,CAAC,KAAK;IACnD,oBAAOd,KAAA,CAAAe,aAAA,CAACV,OAAO;MAACiB,SAAS,EAAEF,oBAAqB;MAACG,IAAI,EAAEb,SAAS,CAACI,QAAQ;IAAE,CAAE,CAAC;EAClF,CAAC;EAOD,MAAMW,cAAc,GAAG;IAAET,IAAI;IAAEU,UAAU,EAAE;EAAG,CAAC;EAE/C,MAAMC,WAAW,gBAAG3B,KAAK,CAAC4B,aAAa,CAAcH,cAAc,CAAC;EAEpE,MAAMI,UAAU,GAAGA,CAAC;IAAEC,YAAY;IAAEhB;EAA0B,CAAC,KAAK;IAChE,MAAM,CAACY,UAAU,EAAEK,aAAa,CAAC,GAAG3B,QAAQ,CAAa,EAAE,CAAC;IAC5DK,cAAc,CAACO,IAAI,EAAEU,UAAU,CAAC;IAChC,MAAMM,OAAO,GAAG;MAAEhB,IAAI;MAAEU;IAAW,CAAC;IAEpCxB,SAAS,CAAC,MAAM;MACZ,IAAI,OAAO4B,YAAY,KAAK,UAAU,EAAE;QACpCA,YAAY,CAACJ,UAAU,CAAC;MAC5B;IACJ,CAAC,EAAE,CAACA,UAAU,CAAC,CAAC;IAEhB,MAAMO,YAAY,GAAIP,UAAsB,IAAK;MAC7CK,aAAa,CAACL,UAAU,CAAC;IAC7B,CAAC;IAED,oBACI1B,KAAA,CAAAe,aAAA,CAACY,WAAW,CAACO,QAAQ;MAACC,KAAK,EAAEH;IAAQ,gBACjChC,KAAA,CAAAe,aAAA,CAACR,UAAU;MAAC6B,QAAQ,EAAEH,YAAa;MAACjB,IAAI,EAAEA;IAAK,GAC1CF,QACO,CACM,CAAC;EAE/B,CAAC;EAED,SAASuB,SAASA,CAAA,EAA4C;IAC1D,MAAM;MAAEX;IAAW,CAAC,GAAGzB,UAAU,CAAC0B,WAAW,CAAC;IAC9C,OAAOxB,OAAO,CAAC,MAAMK,QAAQ,CAAmBkB,UAAU,CAAC,EAAE,CAACA,UAAU,CAAC,CAAC;EAC9E;EAEA,OAAO;IACHG,UAAU;IACVS,aAAa,EAAEd,eAAe;IAC9BH,YAAY;IACZH,iBAAiB;IACjBE,oBAAoB;IACpBiB;EACJ,CAAC;AACL","ignoreList":[]}
|
package/hooks/index.js
CHANGED
|
@@ -1,117 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
enumerable: true,
|
|
12
|
-
get: function get() {
|
|
13
|
-
return _useConfirmationDialog[key];
|
|
14
|
-
}
|
|
15
|
-
});
|
|
16
|
-
});
|
|
17
|
-
var _useDialog = require("./useDialog");
|
|
18
|
-
Object.keys(_useDialog).forEach(function (key) {
|
|
19
|
-
if (key === "default" || key === "__esModule") return;
|
|
20
|
-
if (key in exports && exports[key] === _useDialog[key]) return;
|
|
21
|
-
Object.defineProperty(exports, key, {
|
|
22
|
-
enumerable: true,
|
|
23
|
-
get: function get() {
|
|
24
|
-
return _useDialog[key];
|
|
25
|
-
}
|
|
26
|
-
});
|
|
27
|
-
});
|
|
28
|
-
var _useDialogs = require("../components/Dialogs/useDialogs");
|
|
29
|
-
Object.keys(_useDialogs).forEach(function (key) {
|
|
30
|
-
if (key === "default" || key === "__esModule") return;
|
|
31
|
-
if (key in exports && exports[key] === _useDialogs[key]) return;
|
|
32
|
-
Object.defineProperty(exports, key, {
|
|
33
|
-
enumerable: true,
|
|
34
|
-
get: function get() {
|
|
35
|
-
return _useDialogs[key];
|
|
36
|
-
}
|
|
37
|
-
});
|
|
38
|
-
});
|
|
39
|
-
var _useSnackbar = require("./useSnackbar");
|
|
40
|
-
Object.keys(_useSnackbar).forEach(function (key) {
|
|
41
|
-
if (key === "default" || key === "__esModule") return;
|
|
42
|
-
if (key in exports && exports[key] === _useSnackbar[key]) return;
|
|
43
|
-
Object.defineProperty(exports, key, {
|
|
44
|
-
enumerable: true,
|
|
45
|
-
get: function get() {
|
|
46
|
-
return _useSnackbar[key];
|
|
47
|
-
}
|
|
48
|
-
});
|
|
49
|
-
});
|
|
50
|
-
var _useKeyHandler = require("./useKeyHandler");
|
|
51
|
-
Object.keys(_useKeyHandler).forEach(function (key) {
|
|
52
|
-
if (key === "default" || key === "__esModule") return;
|
|
53
|
-
if (key in exports && exports[key] === _useKeyHandler[key]) return;
|
|
54
|
-
Object.defineProperty(exports, key, {
|
|
55
|
-
enumerable: true,
|
|
56
|
-
get: function get() {
|
|
57
|
-
return _useKeyHandler[key];
|
|
58
|
-
}
|
|
59
|
-
});
|
|
60
|
-
});
|
|
61
|
-
var _useShiftKey = require("./useShiftKey");
|
|
62
|
-
Object.keys(_useShiftKey).forEach(function (key) {
|
|
63
|
-
if (key === "default" || key === "__esModule") return;
|
|
64
|
-
if (key in exports && exports[key] === _useShiftKey[key]) return;
|
|
65
|
-
Object.defineProperty(exports, key, {
|
|
66
|
-
enumerable: true,
|
|
67
|
-
get: function get() {
|
|
68
|
-
return _useShiftKey[key];
|
|
69
|
-
}
|
|
70
|
-
});
|
|
71
|
-
});
|
|
72
|
-
var _useStateWithCallback = require("./useStateWithCallback");
|
|
73
|
-
Object.keys(_useStateWithCallback).forEach(function (key) {
|
|
74
|
-
if (key === "default" || key === "__esModule") return;
|
|
75
|
-
if (key in exports && exports[key] === _useStateWithCallback[key]) return;
|
|
76
|
-
Object.defineProperty(exports, key, {
|
|
77
|
-
enumerable: true,
|
|
78
|
-
get: function get() {
|
|
79
|
-
return _useStateWithCallback[key];
|
|
80
|
-
}
|
|
81
|
-
});
|
|
82
|
-
});
|
|
83
|
-
var _useModKey = require("./useModKey");
|
|
84
|
-
Object.keys(_useModKey).forEach(function (key) {
|
|
85
|
-
if (key === "default" || key === "__esModule") return;
|
|
86
|
-
if (key in exports && exports[key] === _useModKey[key]) return;
|
|
87
|
-
Object.defineProperty(exports, key, {
|
|
88
|
-
enumerable: true,
|
|
89
|
-
get: function get() {
|
|
90
|
-
return _useModKey[key];
|
|
91
|
-
}
|
|
92
|
-
});
|
|
93
|
-
});
|
|
94
|
-
var _useIsMounted = require("./useIsMounted");
|
|
95
|
-
Object.keys(_useIsMounted).forEach(function (key) {
|
|
96
|
-
if (key === "default" || key === "__esModule") return;
|
|
97
|
-
if (key in exports && exports[key] === _useIsMounted[key]) return;
|
|
98
|
-
Object.defineProperty(exports, key, {
|
|
99
|
-
enumerable: true,
|
|
100
|
-
get: function get() {
|
|
101
|
-
return _useIsMounted[key];
|
|
102
|
-
}
|
|
103
|
-
});
|
|
104
|
-
});
|
|
105
|
-
var _useStateIfMounted = require("./useStateIfMounted");
|
|
106
|
-
Object.keys(_useStateIfMounted).forEach(function (key) {
|
|
107
|
-
if (key === "default" || key === "__esModule") return;
|
|
108
|
-
if (key in exports && exports[key] === _useStateIfMounted[key]) return;
|
|
109
|
-
Object.defineProperty(exports, key, {
|
|
110
|
-
enumerable: true,
|
|
111
|
-
get: function get() {
|
|
112
|
-
return _useStateIfMounted[key];
|
|
113
|
-
}
|
|
114
|
-
});
|
|
115
|
-
});
|
|
1
|
+
export * from "./useConfirmationDialog";
|
|
2
|
+
export * from "./useDialog";
|
|
3
|
+
export * from "../components/Dialogs/useDialogs";
|
|
4
|
+
export * from "./useSnackbar";
|
|
5
|
+
export * from "./useKeyHandler";
|
|
6
|
+
export * from "./useShiftKey";
|
|
7
|
+
export * from "./useStateWithCallback";
|
|
8
|
+
export * from "./useModKey";
|
|
9
|
+
export * from "./useIsMounted";
|
|
10
|
+
export * from "./useStateIfMounted";
|
|
116
11
|
|
|
117
12
|
//# sourceMappingURL=index.js.map
|
package/hooks/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[
|
|
1
|
+
{"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export * from \"./useConfirmationDialog\";\nexport * from \"./useDialog\";\nexport * from \"../components/Dialogs/useDialogs\";\nexport * from \"./useSnackbar\";\nexport * from \"./useKeyHandler\";\nexport * from \"./useShiftKey\";\nexport * from \"./useStateWithCallback\";\nexport * from \"./useModKey\";\nexport * from \"./useIsMounted\";\nexport * from \"./useStateIfMounted\";\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","ignoreList":[]}
|
|
@@ -1,42 +1,28 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
var _templateObject, _templateObject2, _templateObject3, _templateObject4;
|
|
16
|
-
var _excluded = ["title", "message", "acceptLabel", "cancelLabel", "loading"];
|
|
17
|
-
var t = _i18n.i18n.ns("app-admin/hooks/use-confirmation-dialog");
|
|
18
|
-
var useConfirmationDialog = exports.useConfirmationDialog = function useConfirmationDialog() {
|
|
19
|
-
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
20
|
-
var _ref$title = _ref.title,
|
|
21
|
-
title = _ref$title === void 0 ? t(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["Confirmation"]))) : _ref$title,
|
|
22
|
-
message = _ref.message,
|
|
23
|
-
_ref$acceptLabel = _ref.acceptLabel,
|
|
24
|
-
acceptLabel = _ref$acceptLabel === void 0 ? t(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["Confirm"]))) : _ref$acceptLabel,
|
|
25
|
-
_ref$cancelLabel = _ref.cancelLabel,
|
|
26
|
-
cancelLabel = _ref$cancelLabel === void 0 ? t(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2.default)(["Cancel"]))) : _ref$cancelLabel,
|
|
27
|
-
_ref$loading = _ref.loading,
|
|
28
|
-
loading = _ref$loading === void 0 ? /*#__PURE__*/_react.default.createElement(_Progress.CircularProgress, null) : _ref$loading,
|
|
29
|
-
options = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
30
|
-
var ui = (0, _useUi.useUi)();
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { useUi } from "@webiny/app/hooks/useUi";
|
|
3
|
+
import { i18n } from "@webiny/app/i18n";
|
|
4
|
+
import { CircularProgress } from "@webiny/ui/Progress";
|
|
5
|
+
const t = i18n.ns("app-admin/hooks/use-confirmation-dialog");
|
|
6
|
+
const useConfirmationDialog = ({
|
|
7
|
+
title = t`Confirmation`,
|
|
8
|
+
message,
|
|
9
|
+
acceptLabel = t`Confirm`,
|
|
10
|
+
cancelLabel = t`Cancel`,
|
|
11
|
+
loading = /*#__PURE__*/React.createElement(CircularProgress, null),
|
|
12
|
+
...options
|
|
13
|
+
} = {}) => {
|
|
14
|
+
const ui = useUi();
|
|
31
15
|
return {
|
|
32
|
-
showConfirmation:
|
|
33
|
-
ui.setState(
|
|
34
|
-
return
|
|
16
|
+
showConfirmation: (onAccept, onCancel) => {
|
|
17
|
+
ui.setState(ui => {
|
|
18
|
+
return {
|
|
19
|
+
...ui,
|
|
35
20
|
dialog: {
|
|
36
|
-
message: message || t
|
|
37
|
-
options:
|
|
38
|
-
|
|
39
|
-
|
|
21
|
+
message: message || t`Are you sure you want to continue?`,
|
|
22
|
+
options: {
|
|
23
|
+
...options,
|
|
24
|
+
title,
|
|
25
|
+
loading,
|
|
40
26
|
actions: {
|
|
41
27
|
accept: {
|
|
42
28
|
label: acceptLabel,
|
|
@@ -47,12 +33,13 @@ var useConfirmationDialog = exports.useConfirmationDialog = function useConfirma
|
|
|
47
33
|
onClick: onCancel
|
|
48
34
|
}
|
|
49
35
|
}
|
|
50
|
-
}
|
|
36
|
+
}
|
|
51
37
|
}
|
|
52
|
-
}
|
|
38
|
+
};
|
|
53
39
|
});
|
|
54
40
|
}
|
|
55
41
|
};
|
|
56
42
|
};
|
|
43
|
+
export { useConfirmationDialog };
|
|
57
44
|
|
|
58
45
|
//# sourceMappingURL=useConfirmationDialog.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["React","useUi","i18n","CircularProgress","t","ns","useConfirmationDialog","title","message","acceptLabel","cancelLabel","loading","createElement","options","ui","showConfirmation","onAccept","onCancel","setState","dialog","actions","accept","label","onClick","cancel"],"sources":["useConfirmationDialog.tsx"],"sourcesContent":["import React from \"react\";\nimport { useUi } from \"@webiny/app/hooks/useUi\";\nimport { i18n } from \"@webiny/app/i18n\";\nimport { CircularProgress } from \"@webiny/ui/Progress\";\n\nconst t = i18n.ns(\"app-admin/hooks/use-confirmation-dialog\");\n\ninterface Params {\n title?: React.ReactNode;\n message?: React.ReactNode;\n acceptLabel?: React.ReactNode;\n cancelLabel?: React.ReactNode;\n loading?: React.ReactNode;\n [key: string]: any;\n}\n\nexport type ShowConfirmationOnAccept = (() => void) | (() => Promise<void>);\n\nexport interface UseConfirmationDialogResponse {\n showConfirmation: (onAccept: ShowConfirmationOnAccept, onCancel?: () => void) => void;\n}\n\nconst useConfirmationDialog = ({\n title = t`Confirmation`,\n message,\n acceptLabel = t`Confirm`,\n cancelLabel = t`Cancel`,\n loading = <CircularProgress />,\n ...options\n}: Params = {}): UseConfirmationDialogResponse => {\n const ui = useUi();\n\n return {\n showConfirmation: (onAccept, onCancel) => {\n ui.setState(ui => {\n return {\n ...ui,\n dialog: {\n message: message || t`Are you sure you want to continue?`,\n options: {\n ...options,\n title,\n loading,\n actions: {\n accept: {\n label: acceptLabel,\n onClick: onAccept\n },\n cancel: {\n label: cancelLabel,\n onClick: onCancel\n }\n }\n }\n }\n };\n });\n }\n };\n};\n\nexport { useConfirmationDialog };\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,KAAK,QAAQ,yBAAyB;AAC/C,SAASC,IAAI,QAAQ,kBAAkB;AACvC,SAASC,gBAAgB,QAAQ,qBAAqB;AAEtD,MAAMC,CAAC,GAAGF,IAAI,CAACG,EAAE,CAAC,yCAAyC,CAAC;AAiB5D,MAAMC,qBAAqB,GAAGA,CAAC;EAC3BC,KAAK,GAAGH,CAAC,cAAc;EACvBI,OAAO;EACPC,WAAW,GAAGL,CAAC,SAAS;EACxBM,WAAW,GAAGN,CAAC,QAAQ;EACvBO,OAAO,gBAAGX,KAAA,CAAAY,aAAA,CAACT,gBAAgB,MAAE,CAAC;EAC9B,GAAGU;AACC,CAAC,GAAG,CAAC,CAAC,KAAoC;EAC9C,MAAMC,EAAE,GAAGb,KAAK,CAAC,CAAC;EAElB,OAAO;IACHc,gBAAgB,EAAEA,CAACC,QAAQ,EAAEC,QAAQ,KAAK;MACtCH,EAAE,CAACI,QAAQ,CAACJ,EAAE,IAAI;QACd,OAAO;UACH,GAAGA,EAAE;UACLK,MAAM,EAAE;YACJX,OAAO,EAAEA,OAAO,IAAIJ,CAAC,oCAAoC;YACzDS,OAAO,EAAE;cACL,GAAGA,OAAO;cACVN,KAAK;cACLI,OAAO;cACPS,OAAO,EAAE;gBACLC,MAAM,EAAE;kBACJC,KAAK,EAAEb,WAAW;kBAClBc,OAAO,EAAEP;gBACb,CAAC;gBACDQ,MAAM,EAAE;kBACJF,KAAK,EAAEZ,WAAW;kBAClBa,OAAO,EAAEN;gBACb;cACJ;YACJ;UACJ;QACJ,CAAC;MACL,CAAC,CAAC;IACN;EACJ,CAAC;AACL,CAAC;AAED,SAASX,qBAAqB","ignoreList":[]}
|
package/hooks/useDialog.js
CHANGED
|
@@ -1,33 +1,28 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.useDialog = void 0;
|
|
8
|
-
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
|
9
|
-
var _useUi = require("@webiny/app/hooks/useUi");
|
|
10
|
-
var useDialog = exports.useDialog = function useDialog() {
|
|
11
|
-
var ui = (0, _useUi.useUi)();
|
|
1
|
+
import { useUi } from "@webiny/app/hooks/useUi";
|
|
2
|
+
const useDialog = () => {
|
|
3
|
+
const ui = useUi();
|
|
12
4
|
return {
|
|
13
|
-
showDialog:
|
|
14
|
-
ui.setState(
|
|
15
|
-
return
|
|
5
|
+
showDialog: (message, options) => {
|
|
6
|
+
ui.setState(ui => {
|
|
7
|
+
return {
|
|
8
|
+
...ui,
|
|
16
9
|
dialog: {
|
|
17
|
-
message
|
|
18
|
-
options
|
|
10
|
+
message,
|
|
11
|
+
options
|
|
19
12
|
}
|
|
20
|
-
}
|
|
13
|
+
};
|
|
21
14
|
});
|
|
22
15
|
},
|
|
23
|
-
hideDialog:
|
|
24
|
-
ui.setState(
|
|
25
|
-
return
|
|
16
|
+
hideDialog: () => {
|
|
17
|
+
ui.setState(ui => {
|
|
18
|
+
return {
|
|
19
|
+
...ui,
|
|
26
20
|
dialog: null
|
|
27
|
-
}
|
|
21
|
+
};
|
|
28
22
|
});
|
|
29
23
|
}
|
|
30
24
|
};
|
|
31
25
|
};
|
|
26
|
+
export { useDialog };
|
|
32
27
|
|
|
33
28
|
//# sourceMappingURL=useDialog.js.map
|
package/hooks/useDialog.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["useUi","useDialog","ui","showDialog","message","options","setState","dialog","hideDialog"],"sources":["useDialog.ts"],"sourcesContent":["import React from \"react\";\nimport { useUi } from \"@webiny/app/hooks/useUi\";\n\ninterface AcceptAction {\n label: string;\n onClick?: () => void;\n}\ninterface CancelAction {\n label: string;\n onClick?: () => void;\n}\n\nexport interface UseDialogResponseShowDialogOptions {\n dataTestId?: string;\n title: string;\n loading?: boolean;\n actions?: {\n accept?: AcceptAction;\n cancel?: CancelAction;\n };\n style?: {\n [key: string]: any;\n };\n onClose?: () => void;\n [key: string]: any;\n}\ninterface UseDialogResponse {\n showDialog: (message: React.ReactNode, options?: UseDialogResponseShowDialogOptions) => void;\n hideDialog: () => void;\n}\nconst useDialog = (): UseDialogResponse => {\n const ui = useUi();\n return {\n showDialog: (message, options) => {\n ui.setState(ui => {\n return { ...ui, dialog: { message, options } };\n });\n },\n hideDialog: () => {\n ui.setState(ui => {\n return { ...ui, dialog: null };\n });\n }\n };\n};\n\nexport { useDialog };\n"],"mappings":"AACA,SAASA,KAAK,QAAQ,yBAAyB;AA6B/C,MAAMC,SAAS,GAAGA,CAAA,KAAyB;EACvC,MAAMC,EAAE,GAAGF,KAAK,CAAC,CAAC;EAClB,OAAO;IACHG,UAAU,EAAEA,CAACC,OAAO,EAAEC,OAAO,KAAK;MAC9BH,EAAE,CAACI,QAAQ,CAACJ,EAAE,IAAI;QACd,OAAO;UAAE,GAAGA,EAAE;UAAEK,MAAM,EAAE;YAAEH,OAAO;YAAEC;UAAQ;QAAE,CAAC;MAClD,CAAC,CAAC;IACN,CAAC;IACDG,UAAU,EAAEA,CAAA,KAAM;MACdN,EAAE,CAACI,QAAQ,CAACJ,EAAE,IAAI;QACd,OAAO;UAAE,GAAGA,EAAE;UAAEK,MAAM,EAAE;QAAK,CAAC;MAClC,CAAC,CAAC;IACN;EACJ,CAAC;AACL,CAAC;AAED,SAASN,SAAS","ignoreList":[]}
|
package/hooks/useIsMounted.js
CHANGED
|
@@ -1,22 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
});
|
|
6
|
-
exports.useIsMounted = void 0;
|
|
7
|
-
var _react = require("react");
|
|
8
|
-
var useIsMounted = exports.useIsMounted = function useIsMounted() {
|
|
9
|
-
var isMountedRef = (0, _react.useRef)(false);
|
|
10
|
-
(0, _react.useEffect)(function () {
|
|
1
|
+
import { useRef, useEffect } from "react";
|
|
2
|
+
export const useIsMounted = () => {
|
|
3
|
+
const isMountedRef = useRef(false);
|
|
4
|
+
useEffect(() => {
|
|
11
5
|
isMountedRef.current = true;
|
|
12
|
-
return
|
|
6
|
+
return () => {
|
|
13
7
|
isMountedRef.current = false;
|
|
14
8
|
};
|
|
15
9
|
}, []);
|
|
16
10
|
return {
|
|
17
|
-
isMounted:
|
|
18
|
-
return isMountedRef.current;
|
|
19
|
-
}
|
|
11
|
+
isMounted: () => isMountedRef.current
|
|
20
12
|
};
|
|
21
13
|
};
|
|
22
14
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["useRef","useEffect","useIsMounted","isMountedRef","current","isMounted"],"sources":["useIsMounted.ts"],"sourcesContent":["import { useRef, useEffect } from \"react\";\n\nexport const useIsMounted = () => {\n const isMountedRef = useRef(false);\n\n useEffect(() => {\n isMountedRef.current = true;\n\n return () => {\n isMountedRef.current = false;\n };\n }, []);\n\n return {\n isMounted: () => isMountedRef.current\n };\n};\n"],"mappings":"AAAA,SAASA,MAAM,EAAEC,SAAS,QAAQ,OAAO;AAEzC,OAAO,MAAMC,YAAY,GAAGA,CAAA,KAAM;EAC9B,MAAMC,YAAY,GAAGH,MAAM,CAAC,KAAK,CAAC;EAElCC,SAAS,CAAC,MAAM;IACZE,YAAY,CAACC,OAAO,GAAG,IAAI;IAE3B,OAAO,MAAM;MACTD,YAAY,CAACC,OAAO,GAAG,KAAK;IAChC,CAAC;EACL,CAAC,EAAE,EAAE,CAAC;EAEN,OAAO;IACHC,SAAS,EAAEA,CAAA,KAAMF,YAAY,CAACC;EAClC,CAAC;AACL,CAAC","ignoreList":[]}
|
package/hooks/useKeyHandler.js
CHANGED
|
@@ -1,38 +1,28 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
9
|
-
var _react = _interopRequireDefault(require("react"));
|
|
10
|
-
var _isHotkey = _interopRequireDefault(require("is-hotkey"));
|
|
11
|
-
var _utils = require("@webiny/utils");
|
|
12
|
-
var keyStack = {};
|
|
13
|
-
var listener = false;
|
|
14
|
-
var filter = ["TEXTAREA", "INPUT"];
|
|
15
|
-
var isContentEditable = function isContentEditable(value) {
|
|
1
|
+
import React from "react";
|
|
2
|
+
import isHotkey from "is-hotkey";
|
|
3
|
+
import { generateId } from "@webiny/utils";
|
|
4
|
+
const keyStack = {};
|
|
5
|
+
let listener = false;
|
|
6
|
+
const filter = ["TEXTAREA", "INPUT"];
|
|
7
|
+
const isContentEditable = value => {
|
|
16
8
|
return ["true", true].includes(value);
|
|
17
9
|
};
|
|
18
|
-
|
|
10
|
+
const setupListener = () => {
|
|
19
11
|
if (listener || !document.body) {
|
|
20
12
|
return;
|
|
21
13
|
}
|
|
22
|
-
|
|
14
|
+
const eventListener = ev => {
|
|
23
15
|
if (!ev.target) {
|
|
24
16
|
return;
|
|
25
17
|
}
|
|
26
|
-
|
|
18
|
+
const target = ev.target;
|
|
27
19
|
// We ignore all keyboard events coming from within contentEditable element and inputs.
|
|
28
20
|
if (filter.includes(target.nodeName) || isContentEditable(target.contentEditable)) {
|
|
29
21
|
return;
|
|
30
22
|
}
|
|
31
|
-
|
|
32
|
-
return (0, _isHotkey.default)(key, ev);
|
|
33
|
-
});
|
|
23
|
+
const matchedKey = Object.keys(keyStack).find(key => isHotkey(key, ev));
|
|
34
24
|
if (matchedKey && keyStack[matchedKey].length > 0) {
|
|
35
|
-
|
|
25
|
+
const item = keyStack[matchedKey][0];
|
|
36
26
|
item.handler(ev);
|
|
37
27
|
ev.stopPropagation();
|
|
38
28
|
}
|
|
@@ -40,43 +30,35 @@ var setupListener = function setupListener() {
|
|
|
40
30
|
document.body.addEventListener("keydown", eventListener);
|
|
41
31
|
listener = true;
|
|
42
32
|
};
|
|
43
|
-
|
|
33
|
+
const addKeyHandler = (id, key, handler) => {
|
|
44
34
|
setupListener();
|
|
45
35
|
keyStack[key] = keyStack[key] || [];
|
|
46
|
-
if (!keyStack[key].find(
|
|
47
|
-
return item.id === id;
|
|
48
|
-
})) {
|
|
36
|
+
if (!keyStack[key].find(item => item.id === id)) {
|
|
49
37
|
keyStack[key].unshift({
|
|
50
|
-
id
|
|
51
|
-
handler
|
|
38
|
+
id,
|
|
39
|
+
handler
|
|
52
40
|
});
|
|
53
41
|
}
|
|
54
42
|
};
|
|
55
|
-
|
|
43
|
+
const removeKeyHandler = (id, key) => {
|
|
56
44
|
if (!keyStack[key]) {
|
|
57
45
|
return;
|
|
58
46
|
}
|
|
59
|
-
|
|
60
|
-
return item.id === id;
|
|
61
|
-
});
|
|
47
|
+
const index = keyStack[key].findIndex(item => item.id === id);
|
|
62
48
|
if (index >= 0) {
|
|
63
49
|
keyStack[key].splice(index, 1);
|
|
64
50
|
}
|
|
65
51
|
};
|
|
66
|
-
function useKeyHandler() {
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
_removeKeyHandler(id, key);
|
|
77
|
-
}
|
|
78
|
-
};
|
|
79
|
-
}, []);
|
|
52
|
+
export function useKeyHandler() {
|
|
53
|
+
const [id] = React.useState(generateId());
|
|
54
|
+
return React.useMemo(() => ({
|
|
55
|
+
addKeyHandler(key, handler) {
|
|
56
|
+
addKeyHandler(id, key, handler);
|
|
57
|
+
},
|
|
58
|
+
removeKeyHandler(key) {
|
|
59
|
+
removeKeyHandler(id, key);
|
|
60
|
+
}
|
|
61
|
+
}), []);
|
|
80
62
|
}
|
|
81
63
|
|
|
82
64
|
//# sourceMappingURL=useKeyHandler.js.map
|