@elyx-code/editor-ui 0.0.2
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/README.md +2 -0
- package/package.json +109 -0
- package/src/App.tsx +31 -0
- package/src/Router.tsx +115 -0
- package/src/__mocks__/defaultModuleMock.ts +1 -0
- package/src/__mocks__/fileMock.ts +1 -0
- package/src/__mocks__/styleMock.ts +1 -0
- package/src/assets/Clock-11.1s-18px.svg +16 -0
- package/src/assets/Clock-11.1s-28px.svg +16 -0
- package/src/assets/authentication.svg +1 -0
- package/src/assets/canvas-backdrop-0.png +0 -0
- package/src/assets/canvas-backdrop-1.png +0 -0
- package/src/assets/canvas-backdrop-2.png +0 -0
- package/src/assets/canvas-backdrop-3.png +0 -0
- package/src/assets/canvas-backdrop-4.png +0 -0
- package/src/assets/canvas-backdrop-5.png +0 -0
- package/src/assets/canvas-backdrop.png +0 -0
- package/src/assets/checkmark-animation.gif +0 -0
- package/src/assets/checkmark-animation.mp4 +0 -0
- package/src/assets/code-formatting/format-black.svg +6 -0
- package/src/assets/code-formatting/format-dark-grey.svg +6 -0
- package/src/assets/code-formatting/format-light-grey.svg +6 -0
- package/src/assets/code-formatting/format-white.svg +6 -0
- package/src/assets/code-formatting/inline-black.svg +5 -0
- package/src/assets/code-formatting/inline-dark-grey.svg +5 -0
- package/src/assets/code-formatting/inline-light-grey.svg +5 -0
- package/src/assets/code-formatting/inline-white.svg +5 -0
- package/src/assets/contained-logo-full-word.png +0 -0
- package/src/assets/cron-job-color.png +0 -0
- package/src/assets/cron-job.png +0 -0
- package/src/assets/database-table-color.png +0 -0
- package/src/assets/database-table.png +0 -0
- package/src/assets/datatype-icons/black/any.svg +1 -0
- package/src/assets/datatype-icons/black/binary.svg +1 -0
- package/src/assets/datatype-icons/black/boolean.svg +3 -0
- package/src/assets/datatype-icons/black/date-time.svg +3 -0
- package/src/assets/datatype-icons/black/definition-entity.svg +6 -0
- package/src/assets/datatype-icons/black/key-file.svg +1 -0
- package/src/assets/datatype-icons/black/list.svg +3 -0
- package/src/assets/datatype-icons/black/null.svg +3 -0
- package/src/assets/datatype-icons/black/number.svg +13 -0
- package/src/assets/datatype-icons/black/project.svg +12 -0
- package/src/assets/datatype-icons/black/sql-program.svg +2 -0
- package/src/assets/datatype-icons/black/text.svg +3 -0
- package/src/assets/datatype-icons/black/unknown.svg +3 -0
- package/src/assets/datatype-icons/black/uuid.svg +4 -0
- package/src/assets/datatype-icons/black/void.svg +1 -0
- package/src/assets/datatype-icons/dark-grey/any.svg +1 -0
- package/src/assets/datatype-icons/dark-grey/boolean.svg +3 -0
- package/src/assets/datatype-icons/dark-grey/date-time.svg +3 -0
- package/src/assets/datatype-icons/dark-grey/definition-entity.svg +6 -0
- package/src/assets/datatype-icons/dark-grey/list.svg +3 -0
- package/src/assets/datatype-icons/dark-grey/null.svg +3 -0
- package/src/assets/datatype-icons/dark-grey/number.svg +13 -0
- package/src/assets/datatype-icons/dark-grey/project.svg +12 -0
- package/src/assets/datatype-icons/dark-grey/sql-program.svg +2 -0
- package/src/assets/datatype-icons/dark-grey/text.svg +3 -0
- package/src/assets/datatype-icons/dark-grey/unknown.svg +3 -0
- package/src/assets/datatype-icons/dark-grey/uuid.svg +4 -0
- package/src/assets/datatype-icons/dark-grey/void.svg +1 -0
- package/src/assets/datatype-icons/light-grey/any.svg +1 -0
- package/src/assets/datatype-icons/light-grey/boolean.svg +3 -0
- package/src/assets/datatype-icons/light-grey/date-time.svg +3 -0
- package/src/assets/datatype-icons/light-grey/definition-entity.svg +6 -0
- package/src/assets/datatype-icons/light-grey/list.svg +3 -0
- package/src/assets/datatype-icons/light-grey/null.svg +3 -0
- package/src/assets/datatype-icons/light-grey/number.svg +13 -0
- package/src/assets/datatype-icons/light-grey/project.svg +12 -0
- package/src/assets/datatype-icons/light-grey/sql-program.svg +2 -0
- package/src/assets/datatype-icons/light-grey/text.svg +3 -0
- package/src/assets/datatype-icons/light-grey/unknown.svg +3 -0
- package/src/assets/datatype-icons/light-grey/uuid.svg +4 -0
- package/src/assets/datatype-icons/light-grey/void.svg +1 -0
- package/src/assets/edit.png +0 -0
- package/src/assets/execution.svg +13 -0
- package/src/assets/favicon.svg +14 -0
- package/src/assets/file-search.svg +1 -0
- package/src/assets/http-endpoint.png +0 -0
- package/src/assets/image-input-placeholder.png +0 -0
- package/src/assets/logo-full-word-white.png +0 -0
- package/src/assets/logo-full-word.png +0 -0
- package/src/assets/password.svg +85 -0
- package/src/assets/pencil.png +0 -0
- package/src/assets/publish-project-rich-icon-2.svg +1 -0
- package/src/assets/publish-project-rich-icon.svg +1 -0
- package/src/assets/relational-database.png +0 -0
- package/src/assets/resources.svg +3 -0
- package/src/assets/resume-icon-14px.png +0 -0
- package/src/assets/server.png +0 -0
- package/src/assets/small-status/checkmark.svg +4 -0
- package/src/assets/small-status/error.svg +4 -0
- package/src/assets/small-status/loading.svg +4 -0
- package/src/assets/small-status/skipped.svg +11 -0
- package/src/assets/sql-connection-config.svg +1 -0
- package/src/assets/sql-row-transformer.svg +1 -0
- package/src/assets/ssl-certificate-config.svg +1 -0
- package/src/assets/sync.svg +1 -0
- package/src/assets/testing-logic-icon.svg +1 -0
- package/src/assets/versions.svg +25 -0
- package/src/assets/visual-programming-icon.svg +1 -0
- package/src/assets/warning-sign-24px.png +0 -0
- package/src/auth/index.ts +318 -0
- package/src/components/DialogLoader.tsx +94 -0
- package/src/components/EntityDialogHeader.tsx +110 -0
- package/src/components/EntityDialogSectionHeader.tsx +214 -0
- package/src/components/GalleryAddExternalIntegrationInfoDialog.tsx +87 -0
- package/src/components/GenerateProjectStartingLogicPromptDialog.tsx +281 -0
- package/src/components/LegacyRouteRedirector.tsx +55 -0
- package/src/components/ProPlanChip.tsx +23 -0
- package/src/components/ReportBugDialog.tsx +412 -0
- package/src/components/RequestIntegrationAccessDialog.tsx +261 -0
- package/src/components/UseTemplateProjectDialog.tsx +193 -0
- package/src/components/WorkspaceLayout.tsx +152 -0
- package/src/components/animated-svg/AnimatedCheckmark.tsx +41 -0
- package/src/components/animated-svg/AnimatedCrossmark.tsx +51 -0
- package/src/components/animated-svg/AnimatedEmailSending.tsx +38 -0
- package/src/components/animated-svg/AnimatedLoading.tsx +72 -0
- package/src/components/animated-svg/animated-svg.css +239 -0
- package/src/components/canvas/Canvas.tsx +16 -0
- package/src/components/canvas/CreateEntityMenu.tsx +2020 -0
- package/src/components/canvas/canvas.css +10 -0
- package/src/components/canvas/create-entity-menu.css +579 -0
- package/src/components/canvas-search/CanvasSearch.tsx +501 -0
- package/src/components/canvas-search/canvas-search.css +126 -0
- package/src/components/canvas-settings-menu/CanvasSettingsMenuButton.tsx +515 -0
- package/src/components/canvas-settings-menu/canvas-settings-menu.css +96 -0
- package/src/components/circular-image-upload/CircularImageUpload.tsx +113 -0
- package/src/components/circular-image-upload/circular-image-upload.css +69 -0
- package/src/components/costs/CostsDialog.tsx +459 -0
- package/src/components/data-type/DataTypeBuilder.tsx +3127 -0
- package/src/components/data-type/data-type-builder.css +45 -0
- package/src/components/dialogs/BetaAcknowledgeDialog.tsx +43 -0
- package/src/components/dialogs/ComplexDataDialog.tsx +458 -0
- package/src/components/dialogs/CronBuilderDialog.tsx +2145 -0
- package/src/components/dialogs/ExternalIntegrationConnections.tsx +565 -0
- package/src/components/dialogs/JsonEditorDialog.tsx +1392 -0
- package/src/components/dialogs/StringEditorDialog.tsx +268 -0
- package/src/components/dialogs/argument-declaration/ArgumentDeclaration.tsx +1167 -0
- package/src/components/dialogs/argument-declaration/ArgumentDeclarationDialogContent.tsx +128 -0
- package/src/components/dialogs/beta-dialog.css +165 -0
- package/src/components/dialogs/condition/Condition.tsx +431 -0
- package/src/components/dialogs/condition/ConditionDialogContent.tsx +126 -0
- package/src/components/dialogs/definition-entity/DefinitionEntityDialogContent.tsx +973 -0
- package/src/components/dialogs/function-call/FunctionCall.tsx +442 -0
- package/src/components/dialogs/function-call/FunctionCallDialogContent.tsx +126 -0
- package/src/components/dialogs/function-declaration/FunctionDeclaration.tsx +926 -0
- package/src/components/dialogs/function-declaration/FunctionDeclarationDialogContent.tsx +124 -0
- package/src/components/dialogs/generating-project-starting-logic-overlay/GeneratingProjectStartingLogicOverlay.tsx +176 -0
- package/src/components/dialogs/generating-project-starting-logic-overlay/generating-project-starting-logic-overlay.css +13 -0
- package/src/components/dialogs/global-event/GlobalEvent.tsx +475 -0
- package/src/components/dialogs/global-event/GlobalEventDialogContent.tsx +126 -0
- package/src/components/dialogs/help/HelpDialog.tsx +217 -0
- package/src/components/dialogs/help/HelpDilalogHomeContent.tsx +178 -0
- package/src/components/dialogs/help/help-dialog.css +116 -0
- package/src/components/dialogs/help/help-icon/HelpIconButton.tsx +41 -0
- package/src/components/dialogs/help/help-icon/help-icon.css +9 -0
- package/src/components/dialogs/input-map/InputMap.tsx +635 -0
- package/src/components/dialogs/input-map/InputMapDialogContent.tsx +126 -0
- package/src/components/dialogs/json-editor-dialog.css +4 -0
- package/src/components/dialogs/loop/Loop.tsx +650 -0
- package/src/components/dialogs/loop/LoopDialogContent.tsx +122 -0
- package/src/components/dialogs/operation/Operation.tsx +440 -0
- package/src/components/dialogs/operation/OperationDialogContent.tsx +126 -0
- package/src/components/dialogs/output-map/OutputMap.tsx +536 -0
- package/src/components/dialogs/output-map/OutputMapDialogContent.tsx +126 -0
- package/src/components/dialogs/property/Property.tsx +1490 -0
- package/src/components/dialogs/property/PropertyDialogContent.tsx +106 -0
- package/src/components/dialogs/search-statement/ColumnSelector.tsx +334 -0
- package/src/components/dialogs/search-statement/ConditionBuilder.tsx +750 -0
- package/src/components/dialogs/search-statement/DataAggregationSection.tsx +621 -0
- package/src/components/dialogs/search-statement/DataSourceSelection.tsx +734 -0
- package/src/components/dialogs/search-statement/EntityMetadataSection.tsx +135 -0
- package/src/components/dialogs/search-statement/FilterConditionsSection.tsx +151 -0
- package/src/components/dialogs/search-statement/InlineInputMap.tsx +153 -0
- package/src/components/dialogs/search-statement/LiteralValue.tsx +616 -0
- package/src/components/dialogs/search-statement/MainSourceAndInputsSection.tsx +271 -0
- package/src/components/dialogs/search-statement/NestedSearchStatementBuilder.tsx +170 -0
- package/src/components/dialogs/search-statement/OutputFormatSection.tsx +1779 -0
- package/src/components/dialogs/search-statement/ResultsSection.tsx +344 -0
- package/src/components/dialogs/search-statement/SearchStatementBuilder.tsx +251 -0
- package/src/components/dialogs/search-statement/SearchStatementDialogContent.tsx +398 -0
- package/src/components/dialogs/search-statement/ValueSelector.tsx +766 -0
- package/src/components/dialogs/search-statement/search-statement-context.tsx +1630 -0
- package/src/components/dialogs/search-statement/search-statement-dialog.css +56 -0
- package/src/components/dialogs/search-statement/test.sql +111 -0
- package/src/components/dialogs/value-descriptor/ValueDescriptor.tsx +824 -0
- package/src/components/dialogs/value-descriptor/ValueDescriptorDialogContent.tsx +124 -0
- package/src/components/dialogs/variable-declaration/VariableDeclaration.tsx +836 -0
- package/src/components/dialogs/variable-declaration/VariableDeclarationDialogContent.tsx +106 -0
- package/src/components/dialogs/variable-instance/VariableInstance.tsx +443 -0
- package/src/components/dialogs/variable-instance/VariableInstanceDialogContent.tsx +124 -0
- package/src/components/draggable-entity-card/ArgumentDeclaration.tsx +736 -0
- package/src/components/draggable-entity-card/CollapseEntityButton.tsx +170 -0
- package/src/components/draggable-entity-card/ConditionCard.tsx +1062 -0
- package/src/components/draggable-entity-card/ConnectionDeleteButton.tsx +309 -0
- package/src/components/draggable-entity-card/DataTypeIcon.tsx +624 -0
- package/src/components/draggable-entity-card/DraggableEntityCard.tsx +617 -0
- package/src/components/draggable-entity-card/ErrorMapProperty.tsx +464 -0
- package/src/components/draggable-entity-card/EventCard.tsx +700 -0
- package/src/components/draggable-entity-card/ExecutionInProgressValue.tsx +327 -0
- package/src/components/draggable-entity-card/FunctionDeclarationCard.tsx +819 -0
- package/src/components/draggable-entity-card/InputMapProperty.tsx +1067 -0
- package/src/components/draggable-entity-card/InternalCall.tsx +978 -0
- package/src/components/draggable-entity-card/InternalCallExecutionNode.tsx +643 -0
- package/src/components/draggable-entity-card/LogicScopeCallerNode.tsx +262 -0
- package/src/components/draggable-entity-card/LoopCard.tsx +791 -0
- package/src/components/draggable-entity-card/MainValueInput.tsx +523 -0
- package/src/components/draggable-entity-card/MainValueOutput.tsx +458 -0
- package/src/components/draggable-entity-card/MethodDeclaration.tsx +1088 -0
- package/src/components/draggable-entity-card/NestedCondition.tsx +1025 -0
- package/src/components/draggable-entity-card/OutputMapProperty.tsx +843 -0
- package/src/components/draggable-entity-card/PassthroughEntityCard.tsx +1247 -0
- package/src/components/draggable-entity-card/ReturnedError.tsx +549 -0
- package/src/components/draggable-entity-card/SmallSuccessFailureNodes.tsx +523 -0
- package/src/components/draggable-entity-card/SuccessFailureNodes.tsx +509 -0
- package/src/components/draggable-entity-card/TestEntityButton.tsx +946 -0
- package/src/components/draggable-entity-card/TestMenu.tsx +523 -0
- package/src/components/draggable-entity-card/TestMenuValidationDropdown.tsx +84 -0
- package/src/components/draggable-entity-card/UnreachableMarker.tsx +114 -0
- package/src/components/draggable-entity-card/VariableCard.tsx +1577 -0
- package/src/components/draggable-entity-card/VariableScopeMarker.tsx +117 -0
- package/src/components/draggable-entity-card/collapse-entity-button.css +44 -0
- package/src/components/draggable-entity-card/definition-entity/DefinitionEntityCard.tsx +1181 -0
- package/src/components/draggable-entity-card/definition-entity/DefinitionEntityIcon.tsx +36 -0
- package/src/components/draggable-entity-card/definition-entity/DefinitionEntityProperty.tsx +478 -0
- package/src/components/draggable-entity-card/definition-entity/DynamicFooterActions.tsx +112 -0
- package/src/components/draggable-entity-card/definition-entity/actions/external-integration-connection/ExportCredentialsFooterAction.tsx +461 -0
- package/src/components/draggable-entity-card/definition-entity/actions/external-integration-connection/RestablishConnectionFooterAction.tsx +199 -0
- package/src/components/draggable-entity-card/definition-entity/actions/external-integration-connection/restablish-connection-footer-action.css +85 -0
- package/src/components/draggable-entity-card/definition-entity/actions/google-drive/GoogleDriveFilePickerAPIFooterAction.tsx +277 -0
- package/src/components/draggable-entity-card/definition-entity/actions/google-drive/google-drive-file-picker-api-footer-action.css +107 -0
- package/src/components/draggable-entity-card/definition-entity/actions/persisted-entity/DatabaseFooterAction.tsx +452 -0
- package/src/components/draggable-entity-card/definition-entity/actions/persisted-entity/database-footer-action.css +86 -0
- package/src/components/draggable-entity-card/definition-entity/definition-entity-card.css +17 -0
- package/src/components/draggable-entity-card/draggable-entity-card.css +1140 -0
- package/src/components/draggable-entity-card/entity-locked-icon/EntityLockedIcon.tsx +133 -0
- package/src/components/draggable-entity-card/entity-locked-icon/entity-locked.css +8 -0
- package/src/components/draggable-entity-card/expand-properties-icon-button/ExpandPropertiesIconButton.tsx +84 -0
- package/src/components/draggable-entity-card/expand-properties-icon-button/expand-properties-icon-button.css +21 -0
- package/src/components/draggable-entity-card/implement-entity-icon/ImplementEntityIcon.tsx +74 -0
- package/src/components/draggable-entity-card/implement-entity-icon/implement-entity-icon.css +13 -0
- package/src/components/draggable-entity-card/logic-error/LogicErrorIconMenu.tsx +424 -0
- package/src/components/draggable-entity-card/logic-error/logic-error.css +23 -0
- package/src/components/draggable-entity-card/new-card-input-button/NewCardInputButton.tsx +193 -0
- package/src/components/draggable-entity-card/new-card-input-button/NewDynamicInputButton.tsx +214 -0
- package/src/components/draggable-entity-card/new-card-input-button/new-card-input-button.css +71 -0
- package/src/components/draggable-entity-card/new-card-output-button/NewCardOutputButton.tsx +192 -0
- package/src/components/draggable-entity-card/new-card-output-button/new-card-output-button.css +71 -0
- package/src/components/draggable-entity-card/termination-statement/TerminationStatementCard.tsx +1543 -0
- package/src/components/draggable-entity-card/termination-statement/termination-statement-card.css +17 -0
- package/src/components/draggable-entity-card/test-entity-button.css +55 -0
- package/src/components/draggable-entity-card/test-menu.css +181 -0
- package/src/components/draggable-entity-card/unreachable-marker.css +43 -0
- package/src/components/draggable-entity-card/variable-scope-marker.css +22 -0
- package/src/components/dynamic-value/DynamicValue.tsx +2395 -0
- package/src/components/dynamic-value/DynamicValueEntry.tsx +1957 -0
- package/src/components/dynamic-value/dynamic-value.css +230 -0
- package/src/components/editor/ElyxMonacoEditor.tsx +38 -0
- package/src/components/entity-error/EntityErrorListItem.tsx +47 -0
- package/src/components/entity-error/entity-error.css +198 -0
- package/src/components/entity-icon/EntityIcon.tsx +292 -0
- package/src/components/entity-icon/entity-icon.css +39 -0
- package/src/components/gallery-card/CreateNewProject.tsx +222 -0
- package/src/components/gallery-card/GalleryCard.tsx +171 -0
- package/src/components/gallery-card/MarketplaceCard.tsx +87 -0
- package/src/components/gallery-card/ProjectDuplicationCard.tsx +575 -0
- package/src/components/gallery-card/gallery-card.css +25 -0
- package/src/components/notifications/NotificationsIconButton.tsx +124 -0
- package/src/components/notifications/NotificationsPanel.tsx +385 -0
- package/src/components/notifications/notifications.css +189 -0
- package/src/components/online-users/LocalOnlineUsers.tsx +175 -0
- package/src/components/online-users/PageOnlineUsers.tsx +297 -0
- package/src/components/online-users/online-users.css +72 -0
- package/src/components/page-backdrop/PageBackdrop.tsx +8 -0
- package/src/components/page-backdrop/page-backdrop.css +7 -0
- package/src/components/project-configuration/DeleteProjectConfirmationDialog.tsx +134 -0
- package/src/components/project-configuration/ProjectConfigurationDialog.tsx +972 -0
- package/src/components/project-configuration/ProjectDataForm.tsx +121 -0
- package/src/components/project-configuration/UnpublishProjectConfirmationDialog.tsx +162 -0
- package/src/components/project-configuration/project-configuration-content.css +209 -0
- package/src/components/project-name/ProjectName.tsx +2025 -0
- package/src/components/project-name/project-name.css +599 -0
- package/src/components/publishing/Publication.tsx +133 -0
- package/src/components/publishing/history/PublicationHistoryContent.tsx +414 -0
- package/src/components/publishing/history/PublicationHistoryDialog.tsx +234 -0
- package/src/components/publishing/preview/PublicationPreviewDialog.tsx +1158 -0
- package/src/components/publishing/preview/PublishingPriceForecast.tsx +160 -0
- package/src/components/publishing/preview/PublishingResourcesDetails.tsx +91 -0
- package/src/components/publishing/publication-sequence/PublishingSequenceContent.tsx +375 -0
- package/src/components/publishing/publication-sequence/PublishingSequenceDialog.tsx +344 -0
- package/src/components/publishing/publishing-dialog.css +142 -0
- package/src/components/publishing/utils.ts +227 -0
- package/src/components/resources/ResourcesDialog.tsx +591 -0
- package/src/components/resources/UpgradeBanner.tsx +102 -0
- package/src/components/resources/codebase/CodebaseDetails.tsx +156 -0
- package/src/components/resources/cron-job/CronJobsList.tsx +532 -0
- package/src/components/resources/functions/FunctionsList.tsx +454 -0
- package/src/components/resources/http-api/HttpAPI.tsx +566 -0
- package/src/components/resources/http-api/HttpAPIClientModule.tsx +37 -0
- package/src/components/resources/logs/LogsViewer.tsx +768 -0
- package/src/components/resources/query.ts +74 -0
- package/src/components/resources/relational-database/DatabaseTable.tsx +905 -0
- package/src/components/resources/relational-database/RelationalDatabase.tsx +83 -0
- package/src/components/resources/relational-database/RelationalDatabaseSecrets.tsx +361 -0
- package/src/components/resources/resources-dialog.css +74 -0
- package/src/components/test-relational-database/DatabaseTable.tsx +913 -0
- package/src/components/test-relational-database/TestDatabaseDialogContent.tsx +670 -0
- package/src/components/test-relational-database/query.ts +74 -0
- package/src/components/toolbar/ToolBar.tsx +236 -0
- package/src/components/toolbar/toolbar.css +78 -0
- package/src/components/transaction-history/TransactionHistoryDialog.tsx +268 -0
- package/src/components/user/CurrentUserAvatar.tsx +65 -0
- package/src/components/user/UserChip.tsx +62 -0
- package/src/components/user/user.css +39 -0
- package/src/components/user-profile/ChangePasswordForm.tsx +67 -0
- package/src/components/user-profile/OwnUserProfileContent.tsx +665 -0
- package/src/components/user-profile/PublicUserProfileContent.tsx +99 -0
- package/src/components/user-profile/UserDataForm.tsx +75 -0
- package/src/components/user-profile/UserProfileDialog.tsx +110 -0
- package/src/components/user-profile/user-profile-content.css +25 -0
- package/src/config.ts +130 -0
- package/src/globals.d.ts +13 -0
- package/src/index.html +27 -0
- package/src/index.tsx +23 -0
- package/src/lib/badge/Badge.tsx +35 -0
- package/src/lib/badge/badge.css +32 -0
- package/src/lib/button/Button.tsx +129 -0
- package/src/lib/button/button.css +145 -0
- package/src/lib/canvas/canvas-undo-redo.ts +263 -0
- package/src/lib/canvas/defs.ts +170 -0
- package/src/lib/canvas/index.test.ts +189 -0
- package/src/lib/canvas/index.ts +6999 -0
- package/src/lib/canvas/utils.ts +59 -0
- package/src/lib/card/Card.tsx +62 -0
- package/src/lib/card/LoadingCard.tsx +82 -0
- package/src/lib/card/card.css +259 -0
- package/src/lib/chip/Chip.tsx +79 -0
- package/src/lib/chip/chip.css +0 -0
- package/src/lib/dialog/Dialog.tsx +122 -0
- package/src/lib/dialog/SmallDialog.tsx +61 -0
- package/src/lib/dialog/dialog.css +40 -0
- package/src/lib/display-data-structure/index.tsx +21 -0
- package/src/lib/dropdown/CanvasDropdownMenuCard.tsx +68 -0
- package/src/lib/dropdown/CanvasDropdownMenuCardOption.tsx +136 -0
- package/src/lib/dropdown/DropdownButton.tsx +104 -0
- package/src/lib/dropdown/DropdownMenuCard.tsx +324 -0
- package/src/lib/dropdown/DropdownMenuPopup.tsx +27 -0
- package/src/lib/dropdown/dropdown-button.css +76 -0
- package/src/lib/dropdown/dropdown-menu.css +151 -0
- package/src/lib/json-editor/RawJsonEditor.tsx +137 -0
- package/src/lib/json-editor/json-editor.css +35 -0
- package/src/lib/loader/Loader.tsx +120 -0
- package/src/lib/loader/loader.css +38 -0
- package/src/lib/pagination/Pagination.tsx +64 -0
- package/src/lib/popup/CanvasPopupBaseComponent.tsx +103 -0
- package/src/lib/popup/Popup.tsx +243 -0
- package/src/lib/popup/popup.css +16 -0
- package/src/lib/table/RowForm.tsx +301 -0
- package/src/lib/table/Table.tsx +1069 -0
- package/src/lib/table/table.css +249 -0
- package/src/lib/table/types.ts +108 -0
- package/src/lib/text-area/TextArea.tsx +183 -0
- package/src/lib/text-area/text-area.css +156 -0
- package/src/lib/text-field/TextField.tsx +218 -0
- package/src/lib/text-field/index.ts +8 -0
- package/src/lib/text-field/text-field.css +201 -0
- package/src/lib/tooltip/Tooltip.tsx +24 -0
- package/src/lib/tooltip/tooltip.css +17 -0
- package/src/localization/index.ts +47 -0
- package/src/main.css +343 -0
- package/src/pages/Auth.tsx +848 -0
- package/src/pages/Editor.tsx +883 -0
- package/src/pages/ErrorPage.tsx +179 -0
- package/src/pages/Gallery.tsx +1693 -0
- package/src/pages/NewPaymentMethodCallback.tsx +53 -0
- package/src/pages/NotFoundPage.tsx +126 -0
- package/src/pages/PricingPlans.tsx +155 -0
- package/src/pages/auth.css +304 -0
- package/src/pages/gallery.css +421 -0
- package/src/payments/index.ts +187 -0
- package/src/popup-notification/index.ts +90 -0
- package/src/services/database/index.ts +1 -0
- package/src/services/database/utils.ts +1301 -0
- package/src/services/editor/CanvasElement.tsx +2934 -0
- package/src/services/editor/CanvasElementConnectionDeleteButton.ts +204 -0
- package/src/services/editor/CanvasPopup.tsx +749 -0
- package/src/services/editor/EditorService.ts +8157 -0
- package/src/services/editor/area.ts +1312 -0
- package/src/services/editor/connections.ts +1019 -0
- package/src/services/editor/create/condition.ts +25 -0
- package/src/services/editor/create/definition-entity.ts +29 -0
- package/src/services/editor/create/function-call.ts +25 -0
- package/src/services/editor/create/global-event.ts +33 -0
- package/src/services/editor/create/loop.ts +25 -0
- package/src/services/editor/create/operation.ts +30 -0
- package/src/services/editor/create/utils.ts +140 -0
- package/src/services/editor/create/variable-declaration.ts +135 -0
- package/src/services/editor/create/variable-instance.ts +100 -0
- package/src/services/editor/editor-ui-extensions-context.ts +43 -0
- package/src/services/editor/entities-metadata.json +9310 -0
- package/src/services/editor/icons.ts +1093 -0
- package/src/services/editor/index.ts +1 -0
- package/src/services/editor/layout.ts +102 -0
- package/src/services/editor/modules/built-in-function-implementations/base.ts +14 -0
- package/src/services/editor/modules/built-in-function-implementations/create-persisted-entity/index.ts +56 -0
- package/src/services/editor/modules/built-in-function-implementations/delete-persisted-entity/index.ts +55 -0
- package/src/services/editor/modules/built-in-function-implementations/index.ts +4 -0
- package/src/services/editor/modules/built-in-function-implementations/update-persisted-entity/index.ts +56 -0
- package/src/services/editor/modules/operations-implementations/external-integrations/google-drive/get-files.ts +183 -0
- package/src/services/editor/modules/operations-implementations/external-integrations/google-drive/list-drives.ts +124 -0
- package/src/services/editor/modules/operations-implementations/external-integrations/google-drive/list-root-folders.ts +125 -0
- package/src/services/editor/modules/operations-implementations/external-integrations/google-drive/smart-fetch-document.ts +702 -0
- package/src/services/editor/modules/operations-implementations/external-integrations/google-drive/upload-document.ts +535 -0
- package/src/services/editor/modules/operations-implementations/external-integrations/google-gemini/generate-content.ts +193 -0
- package/src/services/editor/modules/operations-implementations/external-integrations/google-mail/get-emails.ts +586 -0
- package/src/services/editor/modules/operations-implementations/external-integrations/google-mail/send-email.ts +386 -0
- package/src/services/editor/modules/operations-implementations/external-integrations/index.ts +12 -0
- package/src/services/editor/modules/operations-implementations/external-integrations/slack/channels.ts +240 -0
- package/src/services/editor/modules/operations-implementations/external-integrations/slack/messages.ts +210 -0
- package/src/services/editor/modules/operations-implementations/external-integrations/slack/replies.ts +200 -0
- package/src/services/editor/modules/operations-implementations/external-integrations/slack/send-message.ts +177 -0
- package/src/services/editor/modules/operations-implementations/index.ts +1 -0
- package/src/services/editor/modules/search-node-implementation/index.ts +42 -0
- package/src/services/editor/modules/sql-migrations-generation.tsx +1054 -0
- package/src/services/editor/publication/publication.ts +578 -0
- package/src/services/editor/ui.ts +1348 -0
- package/src/services/editor/utils.ts +5868 -0
- package/src/services/editor/value-store.ts +619 -0
- package/src/services/execution/built-in-function-implementations.ts +422 -0
- package/src/services/execution/index.ts +4747 -0
- package/src/services/execution/logic.ts +121 -0
- package/src/services/execution/test-instance.tsx +2296 -0
- package/src/services/execution/utils.ts +33 -0
- package/src/services/execution/value-resolution.test.ts +424 -0
- package/src/services/execution/value-resolution.ts +4087 -0
- package/src/services/integrations/ExternalIntegrationsService.ts +439 -0
- package/src/services/integrations/api.ts +175 -0
- package/src/services/local-relational-database/idb_helper.ts +66 -0
- package/src/services/local-relational-database/index.ts +3308 -0
- package/src/services/local-relational-database/utils.ts +403 -0
- package/src/services/notifications/index.ts +525 -0
- package/src/services/user/index.ts +144 -0
- package/src/setupTests.ts +1 -0
- package/src/socket/socket.ts +248 -0
- package/src/socket/utils.ts +10 -0
- package/src/store/workspace.ts +12 -0
- package/src/theme.ts +19 -0
- package/src/utils/DOM.ts +39 -0
- package/src/utils/date.ts +169 -0
- package/src/utils/index.ts +158 -0
- package/src/utils/react.tsx +679 -0
- package/src/utils/testing.ts +103 -0
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
.jsoneditor-react-container {
|
|
2
|
+
width: 100%;
|
|
3
|
+
height: 100%;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
/*
|
|
7
|
+
All children of the jsoneditor container should override the previously set styles in the application
|
|
8
|
+
for the editor to work properly.
|
|
9
|
+
*/
|
|
10
|
+
.jsoneditor-react-container * {
|
|
11
|
+
font-family: unset !important;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.jsoneditor {
|
|
15
|
+
border: none;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.jsoneditor-react-container .ace_editor {
|
|
19
|
+
font-family: consolas, menlo, monaco, "Ubuntu Mono", source-code-pro, monospace !important;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
div.jsoneditor-outer.has-main-menu-bar {
|
|
23
|
+
margin-top: unset;
|
|
24
|
+
padding-top: unset;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.ace-jsoneditor .ace_gutter {
|
|
28
|
+
background-color: transparent;
|
|
29
|
+
color: rgba(0, 0, 0, 0.54);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.jsoneditor-statusbar {
|
|
33
|
+
background-color: transparent;
|
|
34
|
+
border-top: none;
|
|
35
|
+
}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import './loader.css';
|
|
3
|
+
|
|
4
|
+
interface Props {
|
|
5
|
+
color?: 'primary' | 'secondary' | 'error' | 'warning' | 'success' | 'grey';
|
|
6
|
+
variant?: 'solid' | 'text' | 'outlined';
|
|
7
|
+
thickness?: 'thin' | 'medium' | 'thick';
|
|
8
|
+
size?: number;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
function resolveRgbColorValueFromProp(color: string = 'primary'): {
|
|
12
|
+
text: string;
|
|
13
|
+
background: string;
|
|
14
|
+
contrast: string;
|
|
15
|
+
main: string;
|
|
16
|
+
} {
|
|
17
|
+
switch (color) {
|
|
18
|
+
case 'error':
|
|
19
|
+
return {
|
|
20
|
+
text: '238,2,2',
|
|
21
|
+
main: '238,2,2',
|
|
22
|
+
background: '238,2,2',
|
|
23
|
+
contrast: '255,255,255',
|
|
24
|
+
};
|
|
25
|
+
case 'warning':
|
|
26
|
+
return {
|
|
27
|
+
text: '221,172,0',
|
|
28
|
+
main: '255,211,0',
|
|
29
|
+
background: '255,211,53',
|
|
30
|
+
contrast: '255,255,255',
|
|
31
|
+
};
|
|
32
|
+
case 'success':
|
|
33
|
+
return {
|
|
34
|
+
text: '95,216,85',
|
|
35
|
+
main: '95,216,85',
|
|
36
|
+
background: '95,216,85',
|
|
37
|
+
contrast: '255,255,255',
|
|
38
|
+
};
|
|
39
|
+
case 'grey':
|
|
40
|
+
return {
|
|
41
|
+
text: '63,63,64',
|
|
42
|
+
main: '63,63,64',
|
|
43
|
+
background: '63,63,64',
|
|
44
|
+
contrast: '255,255,255',
|
|
45
|
+
};
|
|
46
|
+
case 'primary':
|
|
47
|
+
default:
|
|
48
|
+
return {
|
|
49
|
+
text: '98,2,238',
|
|
50
|
+
main: '98,2,238',
|
|
51
|
+
background: '98,2,238',
|
|
52
|
+
contrast: '255,255,255',
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
const Loader: React.FC<Props> = ({
|
|
58
|
+
color = 'primary',
|
|
59
|
+
variant,
|
|
60
|
+
thickness = 'medium',
|
|
61
|
+
size = 80,
|
|
62
|
+
}) => {
|
|
63
|
+
const thicknessMultiplier =
|
|
64
|
+
thickness === 'thin' ? 0.05 : thickness === 'medium' ? 0.1 : 0.2;
|
|
65
|
+
const smallSize = size * 0.8;
|
|
66
|
+
const lineWidth = size * thicknessMultiplier;
|
|
67
|
+
const positionCenterOffset = (size - smallSize) / 2;
|
|
68
|
+
const colorOptions = resolveRgbColorValueFromProp(color);
|
|
69
|
+
const borderColor =
|
|
70
|
+
variant === 'outlined' || variant === 'text'
|
|
71
|
+
? colorOptions.main
|
|
72
|
+
: colorOptions.contrast;
|
|
73
|
+
|
|
74
|
+
return (
|
|
75
|
+
<div className='lds-ring' style={{ width: size, height: size }}>
|
|
76
|
+
<div
|
|
77
|
+
style={{
|
|
78
|
+
width: smallSize,
|
|
79
|
+
height: smallSize,
|
|
80
|
+
borderWidth: lineWidth,
|
|
81
|
+
top: positionCenterOffset,
|
|
82
|
+
left: positionCenterOffset,
|
|
83
|
+
borderColor: `rgb(${borderColor}) transparent transparent transparent`,
|
|
84
|
+
}}
|
|
85
|
+
/>
|
|
86
|
+
<div
|
|
87
|
+
style={{
|
|
88
|
+
width: smallSize,
|
|
89
|
+
height: smallSize,
|
|
90
|
+
borderWidth: lineWidth,
|
|
91
|
+
top: positionCenterOffset,
|
|
92
|
+
left: positionCenterOffset,
|
|
93
|
+
borderColor: `rgb(${borderColor}) transparent transparent transparent`,
|
|
94
|
+
}}
|
|
95
|
+
/>
|
|
96
|
+
<div
|
|
97
|
+
style={{
|
|
98
|
+
width: smallSize,
|
|
99
|
+
height: smallSize,
|
|
100
|
+
borderWidth: lineWidth,
|
|
101
|
+
top: positionCenterOffset,
|
|
102
|
+
left: positionCenterOffset,
|
|
103
|
+
borderColor: `rgb(${borderColor}) transparent transparent transparent`,
|
|
104
|
+
}}
|
|
105
|
+
/>
|
|
106
|
+
<div
|
|
107
|
+
style={{
|
|
108
|
+
width: smallSize,
|
|
109
|
+
height: smallSize,
|
|
110
|
+
borderWidth: lineWidth,
|
|
111
|
+
top: positionCenterOffset,
|
|
112
|
+
left: positionCenterOffset,
|
|
113
|
+
borderColor: `rgb(${borderColor}) transparent transparent transparent`,
|
|
114
|
+
}}
|
|
115
|
+
/>
|
|
116
|
+
</div>
|
|
117
|
+
);
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
export default Loader;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
.lds-ring {
|
|
2
|
+
display: inline-block;
|
|
3
|
+
position: relative;
|
|
4
|
+
/* width: 80px;
|
|
5
|
+
height: 80px; */
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.lds-ring div {
|
|
9
|
+
box-sizing: border-box;
|
|
10
|
+
display: block;
|
|
11
|
+
position: absolute;
|
|
12
|
+
border-style: solid;
|
|
13
|
+
border-radius: 50%;
|
|
14
|
+
animation: lds-ring 1.2s cubic-bezier(0.5, 0, 0.5, 1) infinite;
|
|
15
|
+
/* border-color: #fff transparent transparent transparent; */
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.lds-ring div:nth-child(1) {
|
|
19
|
+
animation-delay: -0.45s;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.lds-ring div:nth-child(2) {
|
|
23
|
+
animation-delay: -0.3s;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.lds-ring div:nth-child(3) {
|
|
27
|
+
animation-delay: -0.15s;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
@keyframes lds-ring {
|
|
31
|
+
0% {
|
|
32
|
+
transform: rotate(0deg);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
100% {
|
|
36
|
+
transform: rotate(360deg);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
export interface IPaginationProps {
|
|
4
|
+
page: number;
|
|
5
|
+
onChange: (page: number) => any;
|
|
6
|
+
total: number;
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
const Pagination: React.FC<IPaginationProps> = ({ page, onChange, total, disabled }) => {
|
|
11
|
+
return (
|
|
12
|
+
<div style={{ display: 'flex', gap: '12px', alignItems: 'center' }}>
|
|
13
|
+
<button
|
|
14
|
+
className='icon-button'
|
|
15
|
+
disabled={page === 1 || total === 1 || disabled}
|
|
16
|
+
onClick={() => onChange(1)}
|
|
17
|
+
>
|
|
18
|
+
<i className='fa-regular fa-backward-step'></i>
|
|
19
|
+
</button>
|
|
20
|
+
<div style={{ display: 'flex', gap: '8px', alignItems: 'center' }}>
|
|
21
|
+
{page === 1 ? (
|
|
22
|
+
<div style={{ width: '24px', height: '24px' }}></div>
|
|
23
|
+
) : (
|
|
24
|
+
<button
|
|
25
|
+
className='icon-button'
|
|
26
|
+
disabled={total === 1 || disabled}
|
|
27
|
+
onClick={() => onChange(page - 1)}
|
|
28
|
+
>
|
|
29
|
+
{page - 1}
|
|
30
|
+
</button>
|
|
31
|
+
)}
|
|
32
|
+
<button
|
|
33
|
+
className={['icon-button', ...(total === 1 ? [] : ['selected'])].join(
|
|
34
|
+
' '
|
|
35
|
+
)}
|
|
36
|
+
disabled={total === 1 || disabled}
|
|
37
|
+
style={{ width: '32px', height: '32px', borderRadius: '50%' }}
|
|
38
|
+
>
|
|
39
|
+
{page}
|
|
40
|
+
</button>
|
|
41
|
+
{page === total ? (
|
|
42
|
+
<div style={{ width: '24px', height: '24px' }}></div>
|
|
43
|
+
) : (
|
|
44
|
+
<button
|
|
45
|
+
className='icon-button'
|
|
46
|
+
disabled={total === 1 || disabled}
|
|
47
|
+
onClick={() => onChange(page + 1)}
|
|
48
|
+
>
|
|
49
|
+
{page + 1}
|
|
50
|
+
</button>
|
|
51
|
+
)}
|
|
52
|
+
</div>
|
|
53
|
+
<button
|
|
54
|
+
className='icon-button'
|
|
55
|
+
disabled={page === total || total === 1 || disabled}
|
|
56
|
+
onClick={() => onChange(total)}
|
|
57
|
+
>
|
|
58
|
+
<i className='fa-regular fa-forward-step'></i>
|
|
59
|
+
</button>
|
|
60
|
+
</div>
|
|
61
|
+
);
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
export default Pagination;
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import React, { Component, useEffect, useLayoutEffect, useRef } from 'react';
|
|
2
|
+
import cx from 'classnames';
|
|
3
|
+
import { Logger } from '@elyx-code/common-ts-utils';
|
|
4
|
+
import './popup.css';
|
|
5
|
+
import { ICanvasElementComponentProps } from '../../services/editor/CanvasElement';
|
|
6
|
+
|
|
7
|
+
export interface ICanvasPopupBaseComponentProps
|
|
8
|
+
extends Partial<ICanvasElementComponentProps> {
|
|
9
|
+
containerClasses?: string[];
|
|
10
|
+
arrowClasses?: string[];
|
|
11
|
+
onClick?: (event: any) => any;
|
|
12
|
+
id?: string;
|
|
13
|
+
children: React.ReactNode;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
// Define an error boundary class that will catch errors in the child component.
|
|
17
|
+
class ErrorBoundary extends Component<
|
|
18
|
+
{ children: React.ReactNode },
|
|
19
|
+
{ hasError: boolean }
|
|
20
|
+
> {
|
|
21
|
+
constructor(props: { children: React.ReactNode }) {
|
|
22
|
+
super(props);
|
|
23
|
+
this.state = { hasError: false };
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
static getDerivedStateFromError(error: any) {
|
|
27
|
+
return { hasError: true };
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
componentDidCatch(error: any, errorInfo: any) {
|
|
31
|
+
Logger.error('ErrorBoundary caught an error:', error, errorInfo);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
render() {
|
|
35
|
+
if (this.state.hasError) {
|
|
36
|
+
// Optionally, you can render a fallback UI.
|
|
37
|
+
return null;
|
|
38
|
+
}
|
|
39
|
+
return this.props.children;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// The original functional component, renamed for clarity.
|
|
44
|
+
function CanvasPopupBaseComponentFunctional(
|
|
45
|
+
props: ICanvasPopupBaseComponentProps
|
|
46
|
+
) {
|
|
47
|
+
const rootElementRef = useRef<HTMLDivElement>(null);
|
|
48
|
+
|
|
49
|
+
useEffect(() => {
|
|
50
|
+
const element = rootElementRef.current;
|
|
51
|
+
if (element && document.contains(element)) {
|
|
52
|
+
props.onMount?.(element);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// When the component is unmounted.
|
|
56
|
+
return () => {
|
|
57
|
+
props.onUnmount?.();
|
|
58
|
+
};
|
|
59
|
+
}, []);
|
|
60
|
+
|
|
61
|
+
useEffect(() => {
|
|
62
|
+
const element = rootElementRef.current;
|
|
63
|
+
props.onUpdate?.(element);
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
useLayoutEffect(() => {
|
|
67
|
+
props.onBeforeUpdate?.();
|
|
68
|
+
}, []);
|
|
69
|
+
|
|
70
|
+
const {
|
|
71
|
+
containerClasses,
|
|
72
|
+
id,
|
|
73
|
+
onMount,
|
|
74
|
+
onUnmount,
|
|
75
|
+
onUpdate,
|
|
76
|
+
onBeforeUpdate,
|
|
77
|
+
...otherProps
|
|
78
|
+
} = props;
|
|
79
|
+
|
|
80
|
+
return (
|
|
81
|
+
<div
|
|
82
|
+
ref={rootElementRef}
|
|
83
|
+
id={id}
|
|
84
|
+
{...otherProps}
|
|
85
|
+
className={cx(['popup', ...(containerClasses || [])])}
|
|
86
|
+
style={{ display: 'revert', position: 'relative' }}
|
|
87
|
+
onClick={props?.onClick}
|
|
88
|
+
>
|
|
89
|
+
{props.children}
|
|
90
|
+
</div>
|
|
91
|
+
);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
// Export the wrapped component so the API remains the same.
|
|
95
|
+
export default function CanvasPopupBaseComponent(
|
|
96
|
+
props: ICanvasPopupBaseComponentProps
|
|
97
|
+
) {
|
|
98
|
+
return (
|
|
99
|
+
<ErrorBoundary>
|
|
100
|
+
<CanvasPopupBaseComponentFunctional {...props} />
|
|
101
|
+
</ErrorBoundary>
|
|
102
|
+
);
|
|
103
|
+
}
|
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
import React, { forwardRef, useEffect, useState } from 'react';
|
|
2
|
+
import {
|
|
3
|
+
computePosition,
|
|
4
|
+
Placement,
|
|
5
|
+
flip,
|
|
6
|
+
shift,
|
|
7
|
+
offset,
|
|
8
|
+
arrow,
|
|
9
|
+
} from '@floating-ui/dom';
|
|
10
|
+
import './popup.css';
|
|
11
|
+
import { onClickAway } from '../../utils/DOM';
|
|
12
|
+
|
|
13
|
+
export interface IPopupProps {
|
|
14
|
+
anchorQuerySelector: string;
|
|
15
|
+
placement: Placement;
|
|
16
|
+
containerClasses?: string[];
|
|
17
|
+
arrowClasses?: string[];
|
|
18
|
+
openDelay?: number;
|
|
19
|
+
closeDelay?: number;
|
|
20
|
+
noArrow?: boolean;
|
|
21
|
+
open?: boolean;
|
|
22
|
+
onClick?: (event: React.MouseEvent<HTMLDivElement, MouseEvent>) => void;
|
|
23
|
+
onClickAway?: (event: Event) => void;
|
|
24
|
+
id?: string;
|
|
25
|
+
autoPosition?: boolean;
|
|
26
|
+
children?: React.ReactNode;
|
|
27
|
+
offset?: number;
|
|
28
|
+
clickAwayTargets?: Element[];
|
|
29
|
+
style?: React.CSSProperties;
|
|
30
|
+
arrowStyle?: React.CSSProperties;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const Popup = forwardRef(
|
|
34
|
+
(props: IPopupProps, ref: React.Ref<HTMLDivElement>) => {
|
|
35
|
+
// This now runs only once per component instance, not on every render.
|
|
36
|
+
const [stableId] = useState(
|
|
37
|
+
() =>
|
|
38
|
+
props.id || 'popup-id--' + Math.random().toString(36).substring(2, 9),
|
|
39
|
+
);
|
|
40
|
+
|
|
41
|
+
const {
|
|
42
|
+
containerClasses = [],
|
|
43
|
+
arrowClasses = [],
|
|
44
|
+
noArrow,
|
|
45
|
+
onClick,
|
|
46
|
+
placement,
|
|
47
|
+
autoPosition,
|
|
48
|
+
offset: offsetValue = 10,
|
|
49
|
+
openDelay = 0,
|
|
50
|
+
closeDelay = 0,
|
|
51
|
+
open,
|
|
52
|
+
anchorQuerySelector,
|
|
53
|
+
arrowStyle,
|
|
54
|
+
} = props;
|
|
55
|
+
|
|
56
|
+
useEffect(() => {
|
|
57
|
+
// --- Setup DOM Node Queries ---
|
|
58
|
+
const anchor = document.querySelector(
|
|
59
|
+
anchorQuerySelector,
|
|
60
|
+
) as HTMLDivElement;
|
|
61
|
+
|
|
62
|
+
// Use the stableId to query for the tooltip and arrow
|
|
63
|
+
const tooltip = document.querySelector('#' + stableId) as HTMLDivElement;
|
|
64
|
+
const arrowElement = document.querySelector(
|
|
65
|
+
'#popup-arrow--' + stableId,
|
|
66
|
+
) as HTMLDivElement;
|
|
67
|
+
|
|
68
|
+
// If nodes don't exist yet, do nothing.
|
|
69
|
+
if (!anchor || !tooltip) {
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
// --- Setup Floating UI ---
|
|
74
|
+
const middleware = [offset(offsetValue), shift({ padding: 5 })];
|
|
75
|
+
|
|
76
|
+
if (autoPosition === undefined || autoPosition) {
|
|
77
|
+
middleware.push(flip());
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
if (!noArrow && arrowElement) {
|
|
81
|
+
middleware.push(arrow({ element: arrowElement }));
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
const update = () => {
|
|
85
|
+
computePosition(anchor, tooltip, { placement, middleware }).then(
|
|
86
|
+
({ x, y, placement, middlewareData }: any) => {
|
|
87
|
+
tooltip.style.left = `${x}px`;
|
|
88
|
+
tooltip.style.top = `${y}px`;
|
|
89
|
+
|
|
90
|
+
if (!noArrow && arrowElement && middlewareData.arrow) {
|
|
91
|
+
const { x: arrowX, y: arrowY } = middlewareData.arrow;
|
|
92
|
+
const staticSide = (
|
|
93
|
+
{
|
|
94
|
+
top: 'bottom',
|
|
95
|
+
right: 'left',
|
|
96
|
+
bottom: 'top',
|
|
97
|
+
left: 'right',
|
|
98
|
+
} as any
|
|
99
|
+
)[(placement as string).split('-')[0]] as string;
|
|
100
|
+
|
|
101
|
+
arrowElement.style.left = arrowX != null ? `${arrowX}px` : '';
|
|
102
|
+
arrowElement.style.top = arrowY != null ? `${arrowY}px` : '';
|
|
103
|
+
(arrowElement.style as any)[staticSide] = '-4px';
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
);
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
// --- Handler and Timeout Setup ---
|
|
110
|
+
let openTimeout: ReturnType<typeof setTimeout> | null = null;
|
|
111
|
+
let closeTimeout: ReturnType<typeof setTimeout> | null = null;
|
|
112
|
+
|
|
113
|
+
const showTooltip = () => {
|
|
114
|
+
if (closeTimeout) clearTimeout(closeTimeout);
|
|
115
|
+
closeTimeout = null;
|
|
116
|
+
openTimeout = setTimeout(() => {
|
|
117
|
+
tooltip.style.display = 'block';
|
|
118
|
+
update();
|
|
119
|
+
}, openDelay);
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
const hideTooltip = () => {
|
|
123
|
+
if (openTimeout) clearTimeout(openTimeout);
|
|
124
|
+
openTimeout = null;
|
|
125
|
+
closeTimeout = setTimeout(() => {
|
|
126
|
+
tooltip.style.display = '';
|
|
127
|
+
}, closeDelay);
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
const clearClose = () => {
|
|
131
|
+
if (closeTimeout) clearTimeout(closeTimeout);
|
|
132
|
+
closeTimeout = null;
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
// --- Logic Branching & Listener Attachment ---
|
|
136
|
+
// Store all added listeners to remove them in the cleanup function
|
|
137
|
+
const activeListeners: {
|
|
138
|
+
target: HTMLElement | Document;
|
|
139
|
+
event: string;
|
|
140
|
+
handler: EventListener;
|
|
141
|
+
}[] = [];
|
|
142
|
+
|
|
143
|
+
if (open === true) {
|
|
144
|
+
showTooltip();
|
|
145
|
+
} else if (open === false) {
|
|
146
|
+
hideTooltip();
|
|
147
|
+
} else {
|
|
148
|
+
// Only add hover/focus listeners if `open` is not controlled
|
|
149
|
+
const tooltipListeners = [
|
|
150
|
+
['mouseenter', clearClose as EventListener],
|
|
151
|
+
['mouseleave', hideTooltip as EventListener],
|
|
152
|
+
];
|
|
153
|
+
|
|
154
|
+
const anchorListeners = [
|
|
155
|
+
['mouseenter', showTooltip as EventListener],
|
|
156
|
+
['mouseleave', hideTooltip as EventListener],
|
|
157
|
+
['focus', showTooltip as EventListener],
|
|
158
|
+
['blur', hideTooltip as EventListener],
|
|
159
|
+
];
|
|
160
|
+
|
|
161
|
+
tooltipListeners.forEach(([event, handler]) => {
|
|
162
|
+
tooltip.addEventListener(
|
|
163
|
+
event as keyof HTMLElementEventMap,
|
|
164
|
+
handler as EventListener,
|
|
165
|
+
);
|
|
166
|
+
activeListeners.push({
|
|
167
|
+
target: tooltip,
|
|
168
|
+
event: event as keyof HTMLElementEventMap,
|
|
169
|
+
handler: handler as EventListener,
|
|
170
|
+
});
|
|
171
|
+
});
|
|
172
|
+
|
|
173
|
+
anchorListeners.forEach(([event, handler]) => {
|
|
174
|
+
anchor.addEventListener(
|
|
175
|
+
event as keyof HTMLElementEventMap,
|
|
176
|
+
handler as EventListener,
|
|
177
|
+
);
|
|
178
|
+
activeListeners.push({
|
|
179
|
+
target: anchor,
|
|
180
|
+
event: event as keyof HTMLElementEventMap,
|
|
181
|
+
handler: handler as EventListener,
|
|
182
|
+
});
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
let cleanup: () => void = () => {};
|
|
187
|
+
|
|
188
|
+
// Click-away listener
|
|
189
|
+
if (!!props.onClickAway) {
|
|
190
|
+
cleanup = onClickAway(
|
|
191
|
+
tooltip,
|
|
192
|
+
props.onClickAway,
|
|
193
|
+
...(props.clickAwayTargets || []),
|
|
194
|
+
);
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
return () => {
|
|
198
|
+
// Clear any pending timeouts
|
|
199
|
+
if (openTimeout) clearTimeout(openTimeout);
|
|
200
|
+
if (closeTimeout) clearTimeout(closeTimeout);
|
|
201
|
+
|
|
202
|
+
// Run click-away cleanup if it was set
|
|
203
|
+
cleanup();
|
|
204
|
+
|
|
205
|
+
// Remove all event listeners this effect added
|
|
206
|
+
activeListeners.forEach(({ target, event, handler }) => {
|
|
207
|
+
target.removeEventListener(event, handler);
|
|
208
|
+
});
|
|
209
|
+
};
|
|
210
|
+
}, [
|
|
211
|
+
anchorQuerySelector,
|
|
212
|
+
placement,
|
|
213
|
+
autoPosition,
|
|
214
|
+
offsetValue,
|
|
215
|
+
noArrow,
|
|
216
|
+
openDelay,
|
|
217
|
+
closeDelay,
|
|
218
|
+
open,
|
|
219
|
+
stableId, // Re-run if our stableId changes (it won't, but it's a dep)
|
|
220
|
+
]);
|
|
221
|
+
|
|
222
|
+
return (
|
|
223
|
+
<div
|
|
224
|
+
ref={ref} // Pass the forwardedRef to the DOM element
|
|
225
|
+
className={['popup', ...containerClasses].join(' ')}
|
|
226
|
+
onClick={onClick}
|
|
227
|
+
id={stableId} // Use the stable ID
|
|
228
|
+
style={props.style}
|
|
229
|
+
>
|
|
230
|
+
{props.children}
|
|
231
|
+
{!noArrow && (
|
|
232
|
+
<div
|
|
233
|
+
id={`popup-arrow--${stableId}`} // Use the stable ID
|
|
234
|
+
className={['popup-arrow', ...arrowClasses].join(' ')}
|
|
235
|
+
style={arrowStyle}
|
|
236
|
+
/>
|
|
237
|
+
)}
|
|
238
|
+
</div>
|
|
239
|
+
);
|
|
240
|
+
},
|
|
241
|
+
);
|
|
242
|
+
|
|
243
|
+
export default Popup;
|