@pega/cosmos-react-build 8.0.0-build.9.1 → 8.0.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/lib/components/AppShell/AppShell.styles.d.ts +1 -1
- package/lib/components/AppShell/AppShell.styles.d.ts.map +1 -1
- package/lib/components/AppShell/AppShell.styles.js +1 -46
- package/lib/components/AppShell/AppShell.styles.js.map +1 -1
- package/lib/components/AppShell/Header/AppHeader.d.ts +2 -3
- package/lib/components/AppShell/Header/AppHeader.d.ts.map +1 -1
- package/lib/components/AppShell/Header/AppHeader.js +4 -4
- package/lib/components/AppShell/Header/AppHeader.js.map +1 -1
- package/lib/components/AppShell/Header/AppHeader.styles.d.ts +2 -2
- package/lib/components/AppShell/Header/AppHeader.styles.d.ts.map +1 -1
- package/lib/components/BackgroundPicker/BackgroundPicker.d.ts +6 -0
- package/lib/components/BackgroundPicker/BackgroundPicker.d.ts.map +1 -0
- package/lib/components/BackgroundPicker/BackgroundPicker.js +82 -0
- package/lib/components/BackgroundPicker/BackgroundPicker.js.map +1 -0
- package/lib/components/BackgroundPicker/BackgroundPicker.styles.d.ts +15 -0
- package/lib/components/BackgroundPicker/BackgroundPicker.styles.d.ts.map +1 -0
- package/lib/components/BackgroundPicker/BackgroundPicker.styles.js +152 -0
- package/lib/components/BackgroundPicker/BackgroundPicker.styles.js.map +1 -0
- package/lib/components/BackgroundPicker/BackgroundPicker.test-ids.d.ts +5 -0
- package/lib/components/BackgroundPicker/BackgroundPicker.test-ids.d.ts.map +1 -0
- package/lib/components/BackgroundPicker/BackgroundPicker.test-ids.js +30 -0
- package/lib/components/BackgroundPicker/BackgroundPicker.test-ids.js.map +1 -0
- package/lib/components/BackgroundPicker/BackgroundPicker.types.d.ts +98 -0
- package/lib/components/BackgroundPicker/BackgroundPicker.types.d.ts.map +1 -0
- package/lib/components/BackgroundPicker/BackgroundPicker.types.js +29 -0
- package/lib/components/BackgroundPicker/BackgroundPicker.types.js.map +1 -0
- package/lib/components/BackgroundPicker/GradientConfig.d.ts +6 -0
- package/lib/components/BackgroundPicker/GradientConfig.d.ts.map +1 -0
- package/lib/components/BackgroundPicker/GradientConfig.js +149 -0
- package/lib/components/BackgroundPicker/GradientConfig.js.map +1 -0
- package/lib/components/BackgroundPicker/ImageConfig.d.ts +6 -0
- package/lib/components/BackgroundPicker/ImageConfig.d.ts.map +1 -0
- package/lib/components/BackgroundPicker/ImageConfig.js +64 -0
- package/lib/components/BackgroundPicker/ImageConfig.js.map +1 -0
- package/lib/components/BackgroundPicker/SolidColorConfig.d.ts +6 -0
- package/lib/components/BackgroundPicker/SolidColorConfig.d.ts.map +1 -0
- package/lib/components/BackgroundPicker/SolidColorConfig.js +24 -0
- package/lib/components/BackgroundPicker/SolidColorConfig.js.map +1 -0
- package/lib/components/BackgroundPicker/index.d.ts +3 -0
- package/lib/components/BackgroundPicker/index.d.ts.map +1 -0
- package/lib/components/BackgroundPicker/index.js +2 -0
- package/lib/components/BackgroundPicker/index.js.map +1 -0
- package/lib/components/BackgroundPicker/utils.d.ts +24 -0
- package/lib/components/BackgroundPicker/utils.d.ts.map +1 -0
- package/lib/components/BackgroundPicker/utils.js +186 -0
- package/lib/components/BackgroundPicker/utils.js.map +1 -0
- package/lib/components/DynamicContentEditor/DynamicContentEditor.d.ts +2 -3
- package/lib/components/DynamicContentEditor/DynamicContentEditor.d.ts.map +1 -1
- package/lib/components/DynamicContentEditor/DynamicContentEditor.js.map +1 -1
- package/lib/components/DynamicInput/BooleanControl.d.ts +3 -5
- package/lib/components/DynamicInput/BooleanControl.d.ts.map +1 -1
- package/lib/components/DynamicInput/BooleanControl.js.map +1 -1
- package/lib/components/DynamicInput/DynamicInput.d.ts +1 -2
- package/lib/components/DynamicInput/DynamicInput.d.ts.map +1 -1
- package/lib/components/DynamicInput/DynamicInput.js +33 -33
- package/lib/components/DynamicInput/DynamicInput.js.map +1 -1
- package/lib/components/DynamicInput/DynamicInput.styles.d.ts +2 -2
- package/lib/components/DynamicInput/DynamicInput.styles.d.ts.map +1 -1
- package/lib/components/DynamicInput/DynamicInput.styles.js +1 -0
- package/lib/components/DynamicInput/DynamicInput.styles.js.map +1 -1
- package/lib/components/DynamicInput/DynamicInput.types.d.ts +61 -11
- package/lib/components/DynamicInput/DynamicInput.types.d.ts.map +1 -1
- package/lib/components/DynamicInput/DynamicInput.types.js.map +1 -1
- package/lib/components/Expression/Expression.d.ts +6 -0
- package/lib/components/Expression/Expression.d.ts.map +1 -0
- package/lib/components/Expression/Expression.js +36 -0
- package/lib/components/Expression/Expression.js.map +1 -0
- package/lib/components/Expression/Expression.styles.d.ts +7 -0
- package/lib/components/Expression/Expression.styles.d.ts.map +1 -0
- package/lib/components/Expression/Expression.styles.js +47 -0
- package/lib/components/Expression/Expression.styles.js.map +1 -0
- package/lib/components/Expression/Expression.test-ids.d.ts +2 -0
- package/lib/components/Expression/Expression.test-ids.d.ts.map +1 -0
- package/lib/components/Expression/Expression.test-ids.js +8 -0
- package/lib/components/Expression/Expression.test-ids.js.map +1 -0
- package/lib/components/Expression/Expression.types.d.ts +53 -0
- package/lib/components/Expression/Expression.types.d.ts.map +1 -0
- package/lib/components/Expression/Expression.types.js +2 -0
- package/lib/components/Expression/Expression.types.js.map +1 -0
- package/lib/components/Expression/index.d.ts +3 -0
- package/lib/components/Expression/index.d.ts.map +1 -0
- package/lib/components/Expression/index.js +2 -0
- package/lib/components/Expression/index.js.map +1 -0
- package/lib/components/ExpressionBuilder/CodeEditor/CodeEditor.d.ts +7 -5
- package/lib/components/ExpressionBuilder/CodeEditor/CodeEditor.d.ts.map +1 -1
- package/lib/components/ExpressionBuilder/CodeEditor/CodeEditor.js +393 -76
- package/lib/components/ExpressionBuilder/CodeEditor/CodeEditor.js.map +1 -1
- package/lib/components/ExpressionBuilder/CodeEditor/CodeEditor.styles.d.ts +9 -2
- package/lib/components/ExpressionBuilder/CodeEditor/CodeEditor.styles.d.ts.map +1 -1
- package/lib/components/ExpressionBuilder/CodeEditor/CodeEditor.styles.js +100 -26
- package/lib/components/ExpressionBuilder/CodeEditor/CodeEditor.styles.js.map +1 -1
- package/lib/components/ExpressionBuilder/CodeEditor/CodeEditor.test-ids.d.ts +2 -0
- package/lib/components/ExpressionBuilder/CodeEditor/CodeEditor.test-ids.d.ts.map +1 -0
- package/lib/components/ExpressionBuilder/CodeEditor/CodeEditor.test-ids.js +6 -0
- package/lib/components/ExpressionBuilder/CodeEditor/CodeEditor.test-ids.js.map +1 -0
- package/lib/components/ExpressionBuilder/CodeEditor/CodeEditor.types.d.ts +32 -6
- package/lib/components/ExpressionBuilder/CodeEditor/CodeEditor.types.d.ts.map +1 -1
- package/lib/components/ExpressionBuilder/CodeEditor/CodeEditor.types.js.map +1 -1
- package/lib/components/ExpressionBuilder/CodeEditor/getCodeSuggestions.d.ts.map +1 -1
- package/lib/components/ExpressionBuilder/CodeEditor/getCodeSuggestions.js +1 -0
- package/lib/components/ExpressionBuilder/CodeEditor/getCodeSuggestions.js.map +1 -1
- package/lib/components/ExpressionBuilder/CodeEditor/mode/jsonLinter.d.ts +3 -0
- package/lib/components/ExpressionBuilder/CodeEditor/mode/jsonLinter.d.ts.map +1 -0
- package/lib/components/ExpressionBuilder/CodeEditor/mode/jsonLinter.js +34 -0
- package/lib/components/ExpressionBuilder/CodeEditor/mode/jsonLinter.js.map +1 -0
- package/lib/components/ExpressionBuilder/ExpressionBuilder.d.ts +2 -3
- package/lib/components/ExpressionBuilder/ExpressionBuilder.d.ts.map +1 -1
- package/lib/components/ExpressionBuilder/ExpressionBuilder.js.map +1 -1
- package/lib/components/ExpressionBuilder/ExpressionBuilder.styles.d.ts +1 -1
- package/lib/components/ExpressionBuilder/ExpressionBuilder.styles.d.ts.map +1 -1
- package/lib/components/ExpressionBuilder/ExpressionBuilder.types.d.ts +3 -1
- package/lib/components/ExpressionBuilder/ExpressionBuilder.types.d.ts.map +1 -1
- package/lib/components/ExpressionBuilder/ExpressionBuilder.types.js.map +1 -1
- package/lib/components/ExpressionBuilder/ExpressionDetails.d.ts +2 -3
- package/lib/components/ExpressionBuilder/ExpressionDetails.d.ts.map +1 -1
- package/lib/components/ExpressionBuilder/ExpressionDetails.js.map +1 -1
- package/lib/components/ExpressionBuilder/ExpressionList.d.ts +2 -3
- package/lib/components/ExpressionBuilder/ExpressionList.d.ts.map +1 -1
- package/lib/components/ExpressionBuilder/ExpressionList.js.map +1 -1
- package/lib/components/ExpressionBuilder/index.d.ts +1 -1
- package/lib/components/ExpressionBuilder/index.d.ts.map +1 -1
- package/lib/components/ExpressionBuilder/index.js.map +1 -1
- package/lib/components/FieldReference/FieldReference.styles.d.ts +1 -0
- package/lib/components/FieldReference/FieldReference.styles.d.ts.map +1 -1
- package/lib/components/FieldReference/FieldReference.styles.js +45 -37
- package/lib/components/FieldReference/FieldReference.styles.js.map +1 -1
- package/lib/components/FieldReference/FieldReference.test-ids.d.ts +1 -0
- package/lib/components/FieldReference/FieldReference.test-ids.d.ts.map +1 -1
- package/lib/components/FieldReference/FieldReference.test-ids.js +3 -0
- package/lib/components/FieldReference/FieldReference.test-ids.js.map +1 -1
- package/lib/components/FieldReference/FieldReference.types.d.ts +6 -1
- package/lib/components/FieldReference/FieldReference.types.d.ts.map +1 -1
- package/lib/components/FieldReference/FieldReference.types.js.map +1 -1
- package/lib/components/FieldReference/FieldReferenceDisplay.d.ts.map +1 -1
- package/lib/components/FieldReference/FieldReferenceDisplay.js +11 -7
- package/lib/components/FieldReference/FieldReferenceDisplay.js.map +1 -1
- package/lib/components/FieldReference/FieldReferenceInput.d.ts.map +1 -1
- package/lib/components/FieldReference/FieldReferenceInput.js +17 -11
- package/lib/components/FieldReference/FieldReferenceInput.js.map +1 -1
- package/lib/components/FieldReference/FieldReferenceMenuList.d.ts +5 -4
- package/lib/components/FieldReference/FieldReferenceMenuList.d.ts.map +1 -1
- package/lib/components/FieldReference/FieldReferenceMenuList.js +7 -5
- package/lib/components/FieldReference/FieldReferenceMenuList.js.map +1 -1
- package/lib/components/FieldReference/index.d.ts +2 -2
- package/lib/components/FieldReference/index.d.ts.map +1 -1
- package/lib/components/FieldReference/index.js +1 -1
- package/lib/components/FieldReference/index.js.map +1 -1
- package/lib/components/IconTile/IconTile.d.ts +7 -3
- package/lib/components/IconTile/IconTile.d.ts.map +1 -1
- package/lib/components/IconTile/IconTile.js +40 -4
- package/lib/components/IconTile/IconTile.js.map +1 -1
- package/lib/components/IconTile/IconTile.types.d.ts +17 -15
- package/lib/components/IconTile/IconTile.types.d.ts.map +1 -1
- package/lib/components/IconTile/IconTile.types.js.map +1 -1
- package/lib/components/IconTile/Tiles/Ai.d.ts +1 -1
- package/lib/components/IconTile/Tiles/Ai.d.ts.map +1 -1
- package/lib/components/IconTile/Tiles/Ai.js.map +1 -1
- package/lib/components/IconTile/Tiles/Automation.d.ts +1 -1
- package/lib/components/IconTile/Tiles/Automation.d.ts.map +1 -1
- package/lib/components/IconTile/Tiles/Automation.js.map +1 -1
- package/lib/components/IconTile/Tiles/AutomationAppend.d.ts +1 -1
- package/lib/components/IconTile/Tiles/AutomationAppend.d.ts.map +1 -1
- package/lib/components/IconTile/Tiles/AutomationAppend.js.map +1 -1
- package/lib/components/IconTile/Tiles/AutomationCall.d.ts +1 -1
- package/lib/components/IconTile/Tiles/AutomationCall.d.ts.map +1 -1
- package/lib/components/IconTile/Tiles/AutomationCall.js.map +1 -1
- package/lib/components/IconTile/Tiles/AutomationForEach.d.ts +1 -1
- package/lib/components/IconTile/Tiles/AutomationForEach.d.ts.map +1 -1
- package/lib/components/IconTile/Tiles/AutomationForEach.js.map +1 -1
- package/lib/components/IconTile/Tiles/AutomationReturn.d.ts +1 -1
- package/lib/components/IconTile/Tiles/AutomationReturn.d.ts.map +1 -1
- package/lib/components/IconTile/Tiles/AutomationReturn.js.map +1 -1
- package/lib/components/IconTile/Tiles/AutomationSet.d.ts +1 -1
- package/lib/components/IconTile/Tiles/AutomationSet.d.ts.map +1 -1
- package/lib/components/IconTile/Tiles/AutomationSet.js.map +1 -1
- package/lib/components/IconTile/Tiles/Case.d.ts +1 -1
- package/lib/components/IconTile/Tiles/Case.d.ts.map +1 -1
- package/lib/components/IconTile/Tiles/Case.js.map +1 -1
- package/lib/components/IconTile/Tiles/CaseGoTo.d.ts +1 -1
- package/lib/components/IconTile/Tiles/CaseGoTo.d.ts.map +1 -1
- package/lib/components/IconTile/Tiles/CaseGoTo.js.map +1 -1
- package/lib/components/IconTile/Tiles/CaseProcess.d.ts +1 -1
- package/lib/components/IconTile/Tiles/CaseProcess.d.ts.map +1 -1
- package/lib/components/IconTile/Tiles/CaseProcess.js.map +1 -1
- package/lib/components/IconTile/Tiles/CaseSla.d.ts +1 -1
- package/lib/components/IconTile/Tiles/CaseSla.d.ts.map +1 -1
- package/lib/components/IconTile/Tiles/CaseSla.js.map +1 -1
- package/lib/components/IconTile/Tiles/CaseStage.d.ts +1 -1
- package/lib/components/IconTile/Tiles/CaseStage.d.ts.map +1 -1
- package/lib/components/IconTile/Tiles/CaseStage.js.map +1 -1
- package/lib/components/IconTile/Tiles/CaseWait.d.ts +1 -1
- package/lib/components/IconTile/Tiles/CaseWait.d.ts.map +1 -1
- package/lib/components/IconTile/Tiles/CaseWait.js.map +1 -1
- package/lib/components/IconTile/Tiles/LogicDecisionStep.d.ts +1 -1
- package/lib/components/IconTile/Tiles/LogicDecisionStep.d.ts.map +1 -1
- package/lib/components/IconTile/Tiles/LogicDecisionStep.js.map +1 -1
- package/lib/components/IconTile/Tiles/LogicFunction.d.ts +1 -1
- package/lib/components/IconTile/Tiles/LogicFunction.d.ts.map +1 -1
- package/lib/components/IconTile/Tiles/LogicFunction.js.map +1 -1
- package/lib/components/IconTile/Tiles/LogicValidation.d.ts +1 -1
- package/lib/components/IconTile/Tiles/LogicValidation.d.ts.map +1 -1
- package/lib/components/IconTile/Tiles/LogicValidation.js.map +1 -1
- package/lib/components/IconTile/Tiles/LogicWhen.d.ts +1 -1
- package/lib/components/IconTile/Tiles/LogicWhen.d.ts.map +1 -1
- package/lib/components/IconTile/Tiles/LogicWhen.js.map +1 -1
- package/lib/components/IconTile/Tiles/RuleAuthenticate.d.ts +1 -1
- package/lib/components/IconTile/Tiles/RuleAuthenticate.d.ts.map +1 -1
- package/lib/components/IconTile/Tiles/RuleAuthenticate.js.map +1 -1
- package/lib/components/IconTile/Tiles/RuleConfiguration.d.ts +1 -1
- package/lib/components/IconTile/Tiles/RuleConfiguration.d.ts.map +1 -1
- package/lib/components/IconTile/Tiles/RuleConfiguration.js.map +1 -1
- package/lib/components/IconTile/Tiles/RuleConnector.d.ts +1 -1
- package/lib/components/IconTile/Tiles/RuleConnector.d.ts.map +1 -1
- package/lib/components/IconTile/Tiles/RuleConnector.js.map +1 -1
- package/lib/components/IconTile/Tiles/RuleDataPage.d.ts +1 -1
- package/lib/components/IconTile/Tiles/RuleDataPage.d.ts.map +1 -1
- package/lib/components/IconTile/Tiles/RuleDataPage.js.map +1 -1
- package/lib/components/IconTile/Tiles/RuleField.d.ts +1 -1
- package/lib/components/IconTile/Tiles/RuleField.d.ts.map +1 -1
- package/lib/components/IconTile/Tiles/RuleField.js.map +1 -1
- package/lib/components/IconTile/Tiles/RuleInsight.d.ts +1 -1
- package/lib/components/IconTile/Tiles/RuleInsight.d.ts.map +1 -1
- package/lib/components/IconTile/Tiles/RuleInsight.js.map +1 -1
- package/lib/components/IconTile/Tiles/RuleIntegrationSystem.d.ts +1 -1
- package/lib/components/IconTile/Tiles/RuleIntegrationSystem.d.ts.map +1 -1
- package/lib/components/IconTile/Tiles/RuleIntegrationSystem.js.map +1 -1
- package/lib/components/IconTile/Tiles/RuleLiveData.d.ts +1 -1
- package/lib/components/IconTile/Tiles/RuleLiveData.d.ts.map +1 -1
- package/lib/components/IconTile/Tiles/RuleLiveData.js.map +1 -1
- package/lib/components/IconTile/Tiles/RuleParagraph.d.ts +1 -1
- package/lib/components/IconTile/Tiles/RuleParagraph.d.ts.map +1 -1
- package/lib/components/IconTile/Tiles/RuleParagraph.js.map +1 -1
- package/lib/components/IconTile/Tiles/RulePermission.d.ts +1 -1
- package/lib/components/IconTile/Tiles/RulePermission.d.ts.map +1 -1
- package/lib/components/IconTile/Tiles/RulePermission.js.map +1 -1
- package/lib/components/IconTile/Tiles/RulePersona.d.ts +1 -1
- package/lib/components/IconTile/Tiles/RulePersona.d.ts.map +1 -1
- package/lib/components/IconTile/Tiles/RulePersona.js.map +1 -1
- package/lib/components/IconTile/Tiles/RulePortal.d.ts +1 -1
- package/lib/components/IconTile/Tiles/RulePortal.d.ts.map +1 -1
- package/lib/components/IconTile/Tiles/RulePortal.js.map +1 -1
- package/lib/components/IconTile/Tiles/RuleRecord.d.ts +1 -1
- package/lib/components/IconTile/Tiles/RuleRecord.d.ts.map +1 -1
- package/lib/components/IconTile/Tiles/RuleRecord.js.map +1 -1
- package/lib/components/IconTile/Tiles/RuleSystem.d.ts +1 -1
- package/lib/components/IconTile/Tiles/RuleSystem.d.ts.map +1 -1
- package/lib/components/IconTile/Tiles/RuleSystem.js.map +1 -1
- package/lib/components/IconTile/Tiles/RuleView.d.ts +1 -1
- package/lib/components/IconTile/Tiles/RuleView.d.ts.map +1 -1
- package/lib/components/IconTile/Tiles/RuleView.js.map +1 -1
- package/lib/components/IconTile/Tiles/Task.d.ts +1 -1
- package/lib/components/IconTile/Tiles/Task.d.ts.map +1 -1
- package/lib/components/IconTile/Tiles/Task.js.map +1 -1
- package/lib/components/IconTile/Tiles/TaskAction.d.ts +1 -1
- package/lib/components/IconTile/Tiles/TaskAction.d.ts.map +1 -1
- package/lib/components/IconTile/Tiles/TaskAction.js.map +1 -1
- package/lib/components/IconTile/iconUtils.d.ts +11 -0
- package/lib/components/IconTile/iconUtils.d.ts.map +1 -0
- package/lib/components/IconTile/iconUtils.js +41 -0
- package/lib/components/IconTile/iconUtils.js.map +1 -0
- package/lib/components/IconTile/index.d.ts +1 -0
- package/lib/components/IconTile/index.d.ts.map +1 -1
- package/lib/components/IconTile/index.js.map +1 -1
- package/lib/components/ItemLibrary/ItemLibrary.d.ts +10 -10
- package/lib/components/ItemLibrary/ItemLibrary.d.ts.map +1 -1
- package/lib/components/ItemLibrary/ItemLibrary.js +26 -18
- package/lib/components/ItemLibrary/ItemLibrary.js.map +1 -1
- package/lib/components/LifeCycle/Category.d.ts +8 -6
- package/lib/components/LifeCycle/Category.d.ts.map +1 -1
- package/lib/components/LifeCycle/Category.js +53 -36
- package/lib/components/LifeCycle/Category.js.map +1 -1
- package/lib/components/LifeCycle/LifeCycle.d.ts +8 -4
- package/lib/components/LifeCycle/LifeCycle.d.ts.map +1 -1
- package/lib/components/LifeCycle/LifeCycle.js +113 -19
- package/lib/components/LifeCycle/LifeCycle.js.map +1 -1
- package/lib/components/LifeCycle/LifeCycle.test-ids.d.ts +6 -0
- package/lib/components/LifeCycle/LifeCycle.test-ids.d.ts.map +1 -0
- package/lib/components/LifeCycle/LifeCycle.test-ids.js +10 -0
- package/lib/components/LifeCycle/LifeCycle.test-ids.js.map +1 -0
- package/lib/components/LifeCycle/LifeCycle.types.d.ts +713 -58
- package/lib/components/LifeCycle/LifeCycle.types.d.ts.map +1 -1
- package/lib/components/LifeCycle/LifeCycle.types.js +71 -61
- package/lib/components/LifeCycle/LifeCycle.types.js.map +1 -1
- package/lib/components/LifeCycle/LifeCycleContext.d.ts +16 -4
- package/lib/components/LifeCycle/LifeCycleContext.d.ts.map +1 -1
- package/lib/components/LifeCycle/LifeCycleContext.js +7 -1
- package/lib/components/LifeCycle/LifeCycleContext.js.map +1 -1
- package/lib/components/LifeCycle/LifeCycleDragDropList.d.ts +21 -0
- package/lib/components/LifeCycle/LifeCycleDragDropList.d.ts.map +1 -0
- package/lib/components/LifeCycle/LifeCycleDragDropList.js +298 -0
- package/lib/components/LifeCycle/LifeCycleDragDropList.js.map +1 -0
- package/lib/components/LifeCycle/LifeCycleList.d.ts +8 -6
- package/lib/components/LifeCycle/LifeCycleList.d.ts.map +1 -1
- package/lib/components/LifeCycle/LifeCycleList.js +20 -30
- package/lib/components/LifeCycle/LifeCycleList.js.map +1 -1
- package/lib/components/LifeCycle/Stage.d.ts +12 -7
- package/lib/components/LifeCycle/Stage.d.ts.map +1 -1
- package/lib/components/LifeCycle/Stage.js +87 -72
- package/lib/components/LifeCycle/Stage.js.map +1 -1
- package/lib/components/LifeCycle/Step.d.ts +21 -14
- package/lib/components/LifeCycle/Step.d.ts.map +1 -1
- package/lib/components/LifeCycle/Step.js +75 -51
- package/lib/components/LifeCycle/Step.js.map +1 -1
- package/lib/components/LifeCycle/Task.d.ts +18 -7
- package/lib/components/LifeCycle/Task.d.ts.map +1 -1
- package/lib/components/LifeCycle/Task.js +119 -55
- package/lib/components/LifeCycle/Task.js.map +1 -1
- package/lib/components/LifeCycle/index.d.ts +2 -1
- package/lib/components/LifeCycle/index.d.ts.map +1 -1
- package/lib/components/LifeCycle/index.js +1 -0
- package/lib/components/LifeCycle/index.js.map +1 -1
- package/lib/components/LifeCycle/utils.d.ts +14 -0
- package/lib/components/LifeCycle/utils.d.ts.map +1 -0
- package/lib/components/LifeCycle/utils.js +250 -0
- package/lib/components/LifeCycle/utils.js.map +1 -0
- package/lib/components/MobileBuildSummary/MobileBuildSummary.d.ts +2 -3
- package/lib/components/MobileBuildSummary/MobileBuildSummary.d.ts.map +1 -1
- package/lib/components/MobileBuildSummary/MobileBuildSummary.js.map +1 -1
- package/lib/components/ObjectSelect/ObjectPicker.d.ts +2 -2
- package/lib/components/ObjectSelect/ObjectPicker.d.ts.map +1 -1
- package/lib/components/ObjectSelect/ObjectPicker.js.map +1 -1
- package/lib/components/PageTemplates/GalleryPage.d.ts +2 -2
- package/lib/components/PageTemplates/GalleryPage.d.ts.map +1 -1
- package/lib/components/PageTemplates/GalleryPage.js.map +1 -1
- package/lib/components/PageTemplates/PageTemplates.d.ts +5 -5
- package/lib/components/PageTemplates/PageTemplates.d.ts.map +1 -1
- package/lib/components/PageTemplates/PageTemplates.js.map +1 -1
- package/lib/components/PageTemplates/ShowcasePage.d.ts +2 -2
- package/lib/components/PageTemplates/ShowcasePage.d.ts.map +1 -1
- package/lib/components/PageTemplates/ShowcasePage.js.map +1 -1
- package/lib/components/RuleSelect/RuleSelect.js +3 -3
- package/lib/components/RuleSelect/RuleSelect.js.map +1 -1
- package/lib/components/Workbench/Workbench.d.ts +2 -3
- package/lib/components/Workbench/Workbench.d.ts.map +1 -1
- package/lib/components/Workbench/Workbench.js.map +1 -1
- package/lib/components/Workbench/Workbench.styles.d.ts +2 -2
- package/lib/components/Workbench/Workbench.styles.d.ts.map +1 -1
- package/lib/index.d.ts +4 -2
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +4 -2
- package/lib/index.js.map +1 -1
- package/lib/{components/FieldReference → utils}/typeIconMapping.d.ts +8 -0
- package/lib/utils/typeIconMapping.d.ts.map +1 -0
- package/lib/{components/FieldReference → utils}/typeIconMapping.js +15 -3
- package/lib/utils/typeIconMapping.js.map +1 -0
- package/package.json +16 -14
- package/lib/components/FieldReference/typeIconMapping.d.ts.map +0 -1
- package/lib/components/FieldReference/typeIconMapping.js.map +0 -1
- package/lib/components/FlowModeller/AddNode.d.ts +0 -18
- package/lib/components/FlowModeller/AddNode.d.ts.map +0 -1
- package/lib/components/FlowModeller/AddNode.js +0 -86
- package/lib/components/FlowModeller/AddNode.js.map +0 -1
- package/lib/components/FlowModeller/Connector.d.ts +0 -6
- package/lib/components/FlowModeller/Connector.d.ts.map +0 -1
- package/lib/components/FlowModeller/Connector.js +0 -69
- package/lib/components/FlowModeller/Connector.js.map +0 -1
- package/lib/components/FlowModeller/DeletePopover.d.ts +0 -19
- package/lib/components/FlowModeller/DeletePopover.d.ts.map +0 -1
- package/lib/components/FlowModeller/DeletePopover.js +0 -136
- package/lib/components/FlowModeller/DeletePopover.js.map +0 -1
- package/lib/components/FlowModeller/FlowModeller.d.ts +0 -5
- package/lib/components/FlowModeller/FlowModeller.d.ts.map +0 -1
- package/lib/components/FlowModeller/FlowModeller.js +0 -317
- package/lib/components/FlowModeller/FlowModeller.js.map +0 -1
- package/lib/components/FlowModeller/FlowModeller.types.d.ts +0 -27
- package/lib/components/FlowModeller/FlowModeller.types.d.ts.map +0 -1
- package/lib/components/FlowModeller/FlowModeller.types.js +0 -2
- package/lib/components/FlowModeller/FlowModeller.types.js.map +0 -1
- package/lib/components/FlowModeller/FlowModellerContext.d.ts +0 -10
- package/lib/components/FlowModeller/FlowModellerContext.d.ts.map +0 -1
- package/lib/components/FlowModeller/FlowModellerContext.js +0 -8
- package/lib/components/FlowModeller/FlowModellerContext.js.map +0 -1
- package/lib/components/FlowModeller/Node/Node.types.d.ts +0 -75
- package/lib/components/FlowModeller/Node/Node.types.d.ts.map +0 -1
- package/lib/components/FlowModeller/Node/Node.types.js +0 -27
- package/lib/components/FlowModeller/Node/Node.types.js.map +0 -1
- package/lib/components/FlowModeller/Node/NodeTemplate.styles.d.ts +0 -20
- package/lib/components/FlowModeller/Node/NodeTemplate.styles.d.ts.map +0 -1
- package/lib/components/FlowModeller/Node/NodeTemplate.styles.js +0 -151
- package/lib/components/FlowModeller/Node/NodeTemplate.styles.js.map +0 -1
- package/lib/components/FlowModeller/Node/NodeTemplates.d.ts +0 -6
- package/lib/components/FlowModeller/Node/NodeTemplates.d.ts.map +0 -1
- package/lib/components/FlowModeller/Node/NodeTemplates.js +0 -69
- package/lib/components/FlowModeller/Node/NodeTemplates.js.map +0 -1
- package/lib/components/FlowModeller/Node.d.ts +0 -5
- package/lib/components/FlowModeller/Node.d.ts.map +0 -1
- package/lib/components/FlowModeller/Node.js +0 -22
- package/lib/components/FlowModeller/Node.js.map +0 -1
- package/lib/components/FlowModeller/Renderer/Renderer.d.ts +0 -5
- package/lib/components/FlowModeller/Renderer/Renderer.d.ts.map +0 -1
- package/lib/components/FlowModeller/Renderer/Renderer.js +0 -48
- package/lib/components/FlowModeller/Renderer/Renderer.js.map +0 -1
- package/lib/components/FlowModeller/Renderer/Renderer.types.d.ts +0 -18
- package/lib/components/FlowModeller/Renderer/Renderer.types.d.ts.map +0 -1
- package/lib/components/FlowModeller/Renderer/Renderer.types.js +0 -2
- package/lib/components/FlowModeller/Renderer/Renderer.types.js.map +0 -1
- package/lib/components/FlowModeller/Renderer/Utils/Graph.d.ts +0 -59
- package/lib/components/FlowModeller/Renderer/Utils/Graph.d.ts.map +0 -1
- package/lib/components/FlowModeller/Renderer/Utils/Graph.js +0 -258
- package/lib/components/FlowModeller/Renderer/Utils/Graph.js.map +0 -1
- package/lib/components/FlowModeller/Renderer/Utils/GraphLayout.d.ts +0 -36
- package/lib/components/FlowModeller/Renderer/Utils/GraphLayout.d.ts.map +0 -1
- package/lib/components/FlowModeller/Renderer/Utils/GraphLayout.js +0 -120
- package/lib/components/FlowModeller/Renderer/Utils/GraphLayout.js.map +0 -1
- package/lib/components/FlowModeller/Renderer/Utils/GraphTraversal.d.ts +0 -28
- package/lib/components/FlowModeller/Renderer/Utils/GraphTraversal.d.ts.map +0 -1
- package/lib/components/FlowModeller/Renderer/Utils/GraphTraversal.js +0 -172
- package/lib/components/FlowModeller/Renderer/Utils/GraphTraversal.js.map +0 -1
- package/lib/components/FlowModeller/Utils/addNodeUtils.d.ts +0 -18
- package/lib/components/FlowModeller/Utils/addNodeUtils.d.ts.map +0 -1
- package/lib/components/FlowModeller/Utils/addNodeUtils.js +0 -141
- package/lib/components/FlowModeller/Utils/addNodeUtils.js.map +0 -1
- package/lib/components/FlowModeller/Utils/deleteNodeUtils.d.ts +0 -30
- package/lib/components/FlowModeller/Utils/deleteNodeUtils.d.ts.map +0 -1
- package/lib/components/FlowModeller/Utils/deleteNodeUtils.js +0 -81
- package/lib/components/FlowModeller/Utils/deleteNodeUtils.js.map +0 -1
- package/lib/components/FlowModeller/helper.d.ts +0 -39
- package/lib/components/FlowModeller/helper.d.ts.map +0 -1
- package/lib/components/FlowModeller/helper.js +0 -198
- package/lib/components/FlowModeller/helper.js.map +0 -1
- package/lib/components/FlowModeller/index.d.ts +0 -20
- package/lib/components/FlowModeller/index.d.ts.map +0 -1
- package/lib/components/FlowModeller/index.js +0 -12
- package/lib/components/FlowModeller/index.js.map +0 -1
- package/lib/components/IconTile/IconTile.styles.d.ts +0 -7
- package/lib/components/IconTile/IconTile.styles.d.ts.map +0 -1
- package/lib/components/IconTile/IconTile.styles.js +0 -68
- package/lib/components/IconTile/IconTile.styles.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/components/BackgroundPicker/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,YAAY,EACjB,KAAK,YAAY,EAClB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,KAAK,EACV,eAAe,EACf,cAAc,EACd,aAAa,EACb,mBAAmB,EAIpB,MAAM,0BAA0B,CAAC;AAElC;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,UACrB,MAAM,wBACS,cAAc,EAAE,KACrC,cAAc,GAAG,SAoBnB,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,yBAAyB,WAAW,MAAM,KAAQ,eAc9D,CAAC;AAiHF;;;;;GAKG;AACH,eAAO,MAAM,wBAAwB,SAAU,mBAAmB,CAAC,MAAM,CAAC,SAAS,MAAM,gDASxF,CAAC;AAEF,eAAO,MAAM,0BAA0B,EAAE,cAAc,EAQtD,CAAC"}
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
import { parseConicGradient, parseLinearGradient, parseRadialGradient } from 'css-gradient-parser';
|
|
2
|
+
/**
|
|
3
|
+
* Returns appropriate background type based on value.
|
|
4
|
+
* @param value - CSS background value string.
|
|
5
|
+
* @param supportedBackgrounds - List of supported backgrounds.
|
|
6
|
+
* @returns Appropriate background type based on value.
|
|
7
|
+
*/
|
|
8
|
+
export const getBackgroundType = (value, supportedBackgrounds) => {
|
|
9
|
+
let bgType;
|
|
10
|
+
if (value.includes('url')) {
|
|
11
|
+
bgType = 'image';
|
|
12
|
+
}
|
|
13
|
+
else if (value.includes('linear-gradient')) {
|
|
14
|
+
bgType = 'linear-gradient';
|
|
15
|
+
}
|
|
16
|
+
else if (value.includes('radial-gradient')) {
|
|
17
|
+
bgType = 'radial-gradient';
|
|
18
|
+
}
|
|
19
|
+
else if (value.includes('conic-gradient')) {
|
|
20
|
+
bgType = 'conic-gradient';
|
|
21
|
+
}
|
|
22
|
+
else if (value.includes('transparent')) {
|
|
23
|
+
bgType = 'transparent';
|
|
24
|
+
}
|
|
25
|
+
else if (value === 'auto') {
|
|
26
|
+
bgType = 'automatic';
|
|
27
|
+
}
|
|
28
|
+
else {
|
|
29
|
+
bgType = 'solid-color';
|
|
30
|
+
}
|
|
31
|
+
return supportedBackgrounds.includes(bgType) ? bgType : undefined;
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* Returns appropriate background image data based on value.
|
|
35
|
+
* @param value - CSS background string.
|
|
36
|
+
* @returns Appropriate background image data based on value.
|
|
37
|
+
*/
|
|
38
|
+
export const getBackgroundImageDetails = (value = '') => {
|
|
39
|
+
const urlMatch = value.match(/url\((['"]?)(.*?)\1\)/);
|
|
40
|
+
const positionMatch = value.match(/\b(center|top left|top right|bottom right|bottom left|top|right|bottom|left|\d+%|\d+px)\b/);
|
|
41
|
+
const sizeMatch = value.match(/\/\s*(auto|cover|contain|\d+px|\d+%)\b/);
|
|
42
|
+
const repeatMatch = value.match(/\b(no-repeat|repeat-x|repeat-y|repeat|space|round)\b/);
|
|
43
|
+
return {
|
|
44
|
+
url: urlMatch ? urlMatch[2] : '',
|
|
45
|
+
backgroundPosition: (positionMatch ? positionMatch[0] : 'center'),
|
|
46
|
+
backgroundSize: (sizeMatch ? sizeMatch[1] : 'auto'),
|
|
47
|
+
backgroundRepeat: (repeatMatch ? repeatMatch[0] : 'repeat')
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
/**
|
|
51
|
+
* Returns parsed linear gradient data based on value.
|
|
52
|
+
* @param value - CSS background value.
|
|
53
|
+
* @returns Parsed linear gradient data.
|
|
54
|
+
*/
|
|
55
|
+
const getParsedLinearGradient = (value) => {
|
|
56
|
+
const defaultResult = {
|
|
57
|
+
orientation: {
|
|
58
|
+
type: 'angular',
|
|
59
|
+
value: {
|
|
60
|
+
value: '90',
|
|
61
|
+
unit: 'deg'
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
repeating: false,
|
|
65
|
+
stops: [
|
|
66
|
+
{
|
|
67
|
+
color: '#A2BAE4',
|
|
68
|
+
offset: {
|
|
69
|
+
value: '0',
|
|
70
|
+
unit: '%'
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
color: '#FFFEFF',
|
|
75
|
+
offset: {
|
|
76
|
+
value: '100',
|
|
77
|
+
unit: '%'
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
]
|
|
81
|
+
};
|
|
82
|
+
try {
|
|
83
|
+
return parseLinearGradient(value);
|
|
84
|
+
}
|
|
85
|
+
catch {
|
|
86
|
+
return defaultResult;
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
/**
|
|
90
|
+
* Returns parsed conic gradient data based on value.
|
|
91
|
+
* @param value - CSS background value.
|
|
92
|
+
* @returns Parsed conic gradient data.
|
|
93
|
+
*/
|
|
94
|
+
const getParsedConicGradient = (value) => {
|
|
95
|
+
const defaultResult = {
|
|
96
|
+
angle: '90deg',
|
|
97
|
+
position: 'center',
|
|
98
|
+
repeating: false,
|
|
99
|
+
stops: [
|
|
100
|
+
{
|
|
101
|
+
color: '#A2BAE4',
|
|
102
|
+
offset: {
|
|
103
|
+
value: '0',
|
|
104
|
+
unit: '%'
|
|
105
|
+
}
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
color: '#FFFEFF',
|
|
109
|
+
offset: {
|
|
110
|
+
value: '100',
|
|
111
|
+
unit: '%'
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
]
|
|
115
|
+
};
|
|
116
|
+
try {
|
|
117
|
+
return parseConicGradient(value);
|
|
118
|
+
}
|
|
119
|
+
catch {
|
|
120
|
+
return defaultResult;
|
|
121
|
+
}
|
|
122
|
+
};
|
|
123
|
+
/**
|
|
124
|
+
* Returns radial gradient data based on value.
|
|
125
|
+
* @param value - CSS background value.
|
|
126
|
+
* @returns Parsed radial gradient data.
|
|
127
|
+
*/
|
|
128
|
+
const getParsedRadialGradient = (value) => {
|
|
129
|
+
const defaultResult = {
|
|
130
|
+
position: {
|
|
131
|
+
x: { type: 'keyword', value: 'center' },
|
|
132
|
+
y: { type: 'keyword', value: 'center' }
|
|
133
|
+
},
|
|
134
|
+
repeating: false,
|
|
135
|
+
shape: 'ellipse',
|
|
136
|
+
size: [{ type: 'keyword', value: 'farthest-corner' }],
|
|
137
|
+
stops: [
|
|
138
|
+
{
|
|
139
|
+
color: '#A2BAE4',
|
|
140
|
+
offset: {
|
|
141
|
+
value: '0',
|
|
142
|
+
unit: '%'
|
|
143
|
+
}
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
color: '#FFFEFF',
|
|
147
|
+
offset: {
|
|
148
|
+
value: '100',
|
|
149
|
+
unit: '%'
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
]
|
|
153
|
+
};
|
|
154
|
+
try {
|
|
155
|
+
return parseRadialGradient(value);
|
|
156
|
+
}
|
|
157
|
+
catch {
|
|
158
|
+
return defaultResult;
|
|
159
|
+
}
|
|
160
|
+
};
|
|
161
|
+
/**
|
|
162
|
+
* Returns appropriate gradient data based on gradient type and value.
|
|
163
|
+
* @param type - Gradient type.
|
|
164
|
+
* @param value - CSS background value
|
|
165
|
+
* @returns Appropriate gradient data based on gradient type and value.
|
|
166
|
+
*/
|
|
167
|
+
export const getParsedGradientDetails = (type, value) => {
|
|
168
|
+
switch (type) {
|
|
169
|
+
case 'radial-gradient':
|
|
170
|
+
return getParsedRadialGradient(value);
|
|
171
|
+
case 'conic-gradient':
|
|
172
|
+
return getParsedConicGradient(value);
|
|
173
|
+
default:
|
|
174
|
+
return getParsedLinearGradient(value);
|
|
175
|
+
}
|
|
176
|
+
};
|
|
177
|
+
export const supportedBackgroundOptions = [
|
|
178
|
+
'automatic',
|
|
179
|
+
'transparent',
|
|
180
|
+
'solid-color',
|
|
181
|
+
'image',
|
|
182
|
+
'linear-gradient',
|
|
183
|
+
'radial-gradient',
|
|
184
|
+
'conic-gradient'
|
|
185
|
+
];
|
|
186
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/components/BackgroundPicker/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAClB,mBAAmB,EACnB,mBAAmB,EAGpB,MAAM,qBAAqB,CAAC;AAY7B;;;;;GAKG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAC/B,KAAa,EACb,oBAAsC,EACV,EAAE;IAC9B,IAAI,MAAsB,CAAC;IAE3B,IAAI,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;QAC1B,MAAM,GAAG,OAAO,CAAC;IACnB,CAAC;SAAM,IAAI,KAAK,CAAC,QAAQ,CAAC,iBAAiB,CAAC,EAAE,CAAC;QAC7C,MAAM,GAAG,iBAAiB,CAAC;IAC7B,CAAC;SAAM,IAAI,KAAK,CAAC,QAAQ,CAAC,iBAAiB,CAAC,EAAE,CAAC;QAC7C,MAAM,GAAG,iBAAiB,CAAC;IAC7B,CAAC;SAAM,IAAI,KAAK,CAAC,QAAQ,CAAC,gBAAgB,CAAC,EAAE,CAAC;QAC5C,MAAM,GAAG,gBAAgB,CAAC;IAC5B,CAAC;SAAM,IAAI,KAAK,CAAC,QAAQ,CAAC,aAAa,CAAC,EAAE,CAAC;QACzC,MAAM,GAAG,aAAa,CAAC;IACzB,CAAC;SAAM,IAAI,KAAK,KAAK,MAAM,EAAE,CAAC;QAC5B,MAAM,GAAG,WAAW,CAAC;IACvB,CAAC;SAAM,CAAC;QACN,MAAM,GAAG,aAAa,CAAC;IACzB,CAAC;IAED,OAAO,oB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AK,EAAE,iBAAiB,EAAE,CAAC;QACrD,KAAK,EAAE;YACL;gBACE,KAAK,EAAE,SAAS;gBAChB,MAAM,EAAE;oBACN,KAAK,EAAE,GAAG;oBACV,IAAI,EAAE,GAAG;iBACV;aACF;YACD;gBACE,KAAK,EAAE,SAAS;gBAChB,MAAM,EAAE;oBACN,KAAK,EAAE,KAAK;oBACZ,IAAI,EAAE,GAAG;iBACV;aACF;SACF;KACF,CAAC;IACF,IAAI,CAAC;QACH,OAAO,mBAAmB,CAAC,KAAK,CAAC,CAAC;IACpC,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,aAAa,CAAC;IACvB,CAAC;AACH,CAAC,CAAC;AAEF;;;;;GAKG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,IAAiC,EAAE,KAAa,EAAE,EAAE;IAC3F,QAAQ,IAAI,EAAE,CAAC;QACb,KAAK,iBAAiB;YACpB,OAAO,uBAAuB,CAAC,KAAK,CAAC,CAAC;QACxC,KAAK,gBAAgB;YACnB,OAAO,sBAAsB,CAAC,KAAK,CAAC,CAAC;QACvC;YACE,OAAO,uBAAuB,CAAC,KAAK,CAAC,CAAC;IAC1C,CAAC;AACH,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,0BAA0B,GAAqB;IAC1D,WAAW;IACX,aAAa;IACb,aAAa;IACb,OAAO;IACP,iBAAiB;IACjB,iBAAiB;IACjB,gBAAgB;CACjB,CAAC","sourcesContent":["import {\n parseConicGradient,\n parseLinearGradient,\n parseRadialGradient,\n type LinearResult,\n type RadialResult\n} from 'css-gradient-parser';\n\nimport type {\n BackgroundImage,\n BackgroundType,\n ConicGradient,\n GradientConfigProps,\n Position,\n Repeat,\n Size\n} from './BackgroundPicker.types';\n\n/**\n * Returns appropriate background type based on value.\n * @param value - CSS background value string.\n * @param supportedBackgrounds - List of supported backgrounds.\n * @returns Appropriate background type based on value.\n */\nexport const getBackgroundType = (\n value: string,\n supportedBackgrounds: BackgroundType[]\n): BackgroundType | undefined => {\n let bgType: BackgroundType;\n\n if (value.includes('url')) {\n bgType = 'image';\n } else if (value.includes('linear-gradient')) {\n bgType = 'linear-gradient';\n } else if (value.includes('radial-gradient')) {\n bgType = 'radial-gradient';\n } else if (value.includes('conic-gradient')) {\n bgType = 'conic-gradient';\n } else if (value.includes('transparent')) {\n bgType = 'transparent';\n } else if (value === 'auto') {\n bgType = 'automatic';\n } else {\n bgType = 'solid-color';\n }\n\n return supportedBackgrounds.includes(bgType) ? bgType : undefined;\n};\n\n/**\n * Returns appropriate background image data based on value.\n * @param value - CSS background string.\n * @returns Appropriate background image data based on value.\n */\nexport const getBackgroundImageDetails = (value: string = ''): BackgroundImage => {\n const urlMatch = value.match(/url\\((['\"]?)(.*?)\\1\\)/);\n const positionMatch = value.match(\n /\\b(center|top left|top right|bottom right|bottom left|top|right|bottom|left|\\d+%|\\d+px)\\b/\n );\n const sizeMatch = value.match(/\\/\\s*(auto|cover|contain|\\d+px|\\d+%)\\b/);\n const repeatMatch = value.match(/\\b(no-repeat|repeat-x|repeat-y|repeat|space|round)\\b/);\n\n return {\n url: urlMatch ? urlMatch[2] : '',\n backgroundPosition: (positionMatch ? positionMatch[0] : 'center') as Position,\n backgroundSize: (sizeMatch ? sizeMatch[1] : 'auto') as Size,\n backgroundRepeat: (repeatMatch ? repeatMatch[0] : 'repeat') as Repeat\n };\n};\n\n/**\n * Returns parsed linear gradient data based on value.\n * @param value - CSS background value.\n * @returns Parsed linear gradient data.\n */\nconst getParsedLinearGradient = (value: string) => {\n const defaultResult: LinearResult = {\n orientation: {\n type: 'angular',\n value: {\n value: '90',\n unit: 'deg'\n }\n },\n repeating: false,\n stops: [\n {\n color: '#A2BAE4',\n offset: {\n value: '0',\n unit: '%'\n }\n },\n {\n color: '#FFFEFF',\n offset: {\n value: '100',\n unit: '%'\n }\n }\n ]\n };\n try {\n return parseLinearGradient(value);\n } catch {\n return defaultResult;\n }\n};\n\n/**\n * Returns parsed conic gradient data based on value.\n * @param value - CSS background value.\n * @returns Parsed conic gradient data.\n */\nconst getParsedConicGradient = (value: string) => {\n const defaultResult: ConicGradient = {\n angle: '90deg',\n position: 'center',\n repeating: false,\n stops: [\n {\n color: '#A2BAE4',\n offset: {\n value: '0',\n unit: '%'\n }\n },\n {\n color: '#FFFEFF',\n offset: {\n value: '100',\n unit: '%'\n }\n }\n ]\n };\n try {\n return parseConicGradient(value);\n } catch {\n return defaultResult;\n }\n};\n\n/**\n * Returns radial gradient data based on value.\n * @param value - CSS background value.\n * @returns Parsed radial gradient data.\n */\nconst getParsedRadialGradient = (value: string) => {\n const defaultResult: RadialResult = {\n position: {\n x: { type: 'keyword', value: 'center' },\n y: { type: 'keyword', value: 'center' }\n },\n repeating: false,\n shape: 'ellipse',\n size: [{ type: 'keyword', value: 'farthest-corner' }],\n stops: [\n {\n color: '#A2BAE4',\n offset: {\n value: '0',\n unit: '%'\n }\n },\n {\n color: '#FFFEFF',\n offset: {\n value: '100',\n unit: '%'\n }\n }\n ]\n };\n try {\n return parseRadialGradient(value);\n } catch {\n return defaultResult;\n }\n};\n\n/**\n * Returns appropriate gradient data based on gradient type and value.\n * @param type - Gradient type.\n * @param value - CSS background value\n * @returns Appropriate gradient data based on gradient type and value.\n */\nexport const getParsedGradientDetails = (type: GradientConfigProps['type'], value: string) => {\n switch (type) {\n case 'radial-gradient':\n return getParsedRadialGradient(value);\n case 'conic-gradient':\n return getParsedConicGradient(value);\n default:\n return getParsedLinearGradient(value);\n }\n};\n\nexport const supportedBackgroundOptions: BackgroundType[] = [\n 'automatic',\n 'transparent',\n 'solid-color',\n 'image',\n 'linear-gradient',\n 'radial-gradient',\n 'conic-gradient'\n];\n"]}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { ForwardProps } from '@pega/cosmos-react-core';
|
|
1
|
+
import type { ForwardRefForwardPropsComponent } from '@pega/cosmos-react-core';
|
|
3
2
|
import type { DynamicContentEditorProps } from './DynamicContentEditor.types';
|
|
4
3
|
export declare const StyledSearchPopover: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {
|
|
5
4
|
offset?: number;
|
|
6
5
|
portal?: boolean;
|
|
7
6
|
}, never>;
|
|
8
|
-
declare const DynamicContentEditor:
|
|
7
|
+
declare const DynamicContentEditor: ForwardRefForwardPropsComponent<DynamicContentEditorProps>;
|
|
9
8
|
export default DynamicContentEditor;
|
|
10
9
|
//# sourceMappingURL=DynamicContentEditor.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DynamicContentEditor.d.ts","sourceRoot":"","sources":["../../../src/components/DynamicContentEditor/DynamicContentEditor.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"DynamicContentEditor.d.ts","sourceRoot":"","sources":["../../../src/components/DynamicContentEditor/DynamicContentEditor.tsx"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EACV,+BAA+B,EAIhC,MAAM,yBAAyB,CAAC;AAGjC,OAAO,KAAK,EAAE,yBAAyB,EAAY,MAAM,8BAA8B,CAAC;AAOxF,eAAO,MAAM,mBAAmB;;;SAE/B,CAAC;AAIF,QAAA,MAAM,oBAAoB,EAAE,+BAA+B,CAAC,yBAAyB,CA0TpF,CAAC;AAEF,eAAe,oBAAoB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DynamicContentEditor.js","sourceRoot":"","sources":["../../../src/components/DynamicContentEditor/DynamicContentEditor.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEhE,OAAO,MAAM,MAAM,mBAAmB,CAAC;AAGvC,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAEhD,OAAO,EACL,MAAM,EACN,gBAAgB,EAChB,IAAI,EACJ,WAAW,EACX,KAAK,EACL,OAAO,EACP,aAAa,EACb,eAAe,EACf,kBAAkB,EAClB,OAAO,EACP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EF,OAAO,CACL,KAAC,MAAM,IACL,GAAG,EAAE,SAAS,KACV,SAAS,EACb,KAAK,EAAE,KAAK,EACZ,OAAO,EAAE,OAAO,EAChB,gBAAgB,EAAE;YAChB;gBACE,mBAAmB,EAAE,0BAA0B;gBAC/C,IAAI,EAAE,gBAAgB;gBACtB,mBAAmB,EAAE,CAAC,iBAAiB,CAAC;gBACxC,KAAK,EAAE,yBAAyB;aACjC;SACF,EACD,aAAa,EAAE;YACb;gBACE,IAAI,EAAE,MAAM;gBACZ,IAAI,EAAE,OAAO;gBACb,WAAW,EAAE,GAAG,EAAE;oBAChB,YAAY,CAAC,OAAO,GAAG,MAAM,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC;gBACnD,CAAC;gBACD,MAAM,EAAE,eAAe;gBACvB,QAAQ,EAAE;oBACR,OAAO,EAAE,UAAU;oBACnB,WAAW,EAAE,OAAO;oBACpB,OAAO,EAAE,aAAa;iBACvB;aACF;SACF,EACD,MAAM,EAAE,SAAS,EACjB,QAAQ,EAAE,cAAc,EACxB,MAAM,EAAE,GAAG,EAAE;YACX,MAAM,EAAE,EAAE,CAAC;YACX,WAAW,EAAE,CAAC;QAChB,CAAC,EACD,SAAS,EAAE,SAAS,EACpB,YAAY,EAAE,YAAY,YAEzB,qBAAqB,GACf,CACV,CAAC;AACJ,CAAC,CAAC,CAAC;AAEL,eAAe,oBAAoB,CAAC","sourcesContent":["import { forwardRef, useRef, useEffect, useState } from 'react';\nimport type { FunctionComponent, PropsWithoutRef } from 'react';\nimport styled from 'styled-components';\nimport type { Bookmark, Editor as TinyMCEEditor, EditorSelection } from 'tinymce';\n\nimport { Editor } from '@pega/cosmos-react-rte';\nimport type { EditorProps } from '@pega/cosmos-react-rte';\nimport {\n Button,\n defaultThemeProp,\n Menu,\n menuHelpers,\n Modal,\n Popover,\n StyledPopover,\n useModalManager,\n useConsolidatedRef,\n useI18n,\n useUID\n} from '@pega/cosmos-react-core';\nimport type {\n ForwardProps,\n MenuProps,\n ModalMethods,\n PropsWithDefaults\n} from '@pega/cosmos-react-core';\nimport { getKeyCommand } from '@pega/cosmos-react-rte/lib/components/RichTextEditor/Toolbar/utils';\n\nimport type { DynamicContentEditorProps, ItemType } from './DynamicContentEditor.types';\nimport { pegaReferenceElementStyle, createPegaReferenceElement } from './PegaCustomElement';\n\ntype DynamicContentEditorPropsWithDefaults = PropsWithDefaults<DynamicContentEditorProps>;\n\nconst StyledDynamicContentEditor = styled.div<DynamicContentEditorPropsWithDefaults>``;\n\nexport const StyledSearchPopover = styled(StyledPopover)`\n min-width: 20rem;\n`;\n\nStyledDynamicContentEditor.defaultProps = defaultThemeProp;\n\nconst DynamicContentEditor: FunctionComponent<DynamicContentEditorProps & ForwardProps> =\n forwardRef(function DynamicContentEditor(\n {\n form: { dynamicContentPicker, onSubmit },\n onActiveFieldChange,\n label,\n toolbar,\n fieldItems,\n defaultValue,\n onBlur,\n ...restProps\n }: PropsWithoutRef<DynamicContentEditorProps>,\n ref: DynamicContentEditorProps['ref']\n ) {\n const menuID = useUID();\n const { create } = useModalManager();\n const t = useI18n();\n\n const modalMethods = useRef<ModalMethods>();\n const [editor, setEditor] = useState<TinyMCEEditor | undefined>();\n const [bookmark, setBookmark] = useState<Bookmark | undefined>();\n const [fieldMenuItems, setFieldMenuItems] = useState<MenuProps['items']>(fieldItems || []);\n const [currentElementId, setCurrentElementId] = useState('');\n const [currentElementContent, setCurrentElementContent] = useState('');\n const [currentCursorPosition, setCurrentCursorPosition] = useState({\n bottom: 0,\n height: 0,\n left: 0,\n right: 0,\n top: 0,\n width: 0,\n x: 0,\n y: 0,\n toJSON: () => {}\n });\n const [showFieldsPopover, setShowFieldsPopover] = useState<boolean>(false);\n\n const fieldPopoverRef = useRef<HTMLDivElement>(null);\n const editorRef = useConsolidatedRef(ref);\n\n const tooltip = getKeyCommand(\n navigator.appVersion.includes('Mac'),\n ({ ctrl }) => `${t('rte_insert_field')} (${ctrl}/)`\n );\n\n const insertField = (field: ItemType) => {\n if (!editor) return;\n\n const fieldContent = `<pega-reference role=\"button\" contenteditable=\"false\" data-rule-type='field' data-rule-id=${field.id}>${field.text}</pega-reference>`;\n if (bookmark) {\n editor.selection.moveToBookmark(bookmark);\n editor.selection.setContent(fieldContent);\n } else {\n editor.insertContent(fieldContent);\n }\n\n modalMethods.current?.dismiss();\n };\n\n const modalProps = {\n children: dynamicContentPicker,\n heading: t('rte_insert_field'),\n actions: (\n <>\n <Button variant='secondary' onClick={() => modalMethods.current?.dismiss()}>\n {t('cancel')}\n </Button>\n <Button variant='primary' onClick={() => onSubmit(insertField)}>\n {t('submit')}\n </Button>\n </>\n ),\n center: true,\n onAfterClose: () => {\n setBookmark(undefined);\n setCurrentElementId('');\n setCurrentElementContent('');\n onActiveFieldChange({ id: '', text: '' });\n },\n onBeforeOpen: () => {\n if (currentElementId) {\n onActiveFieldChange({ id: currentElementId, text: currentElementContent });\n }\n }\n };\n\n const findAndRenameField = (fieldId: string) => {\n if (!editor || !fieldMenuItems) return;\n\n const selectedRange = editor.selection.getRng();\n const endOffset = selectedRange.endOffset;\n const stringToSearch = selectedRange.commonAncestorContainer.nodeValue?.slice(0, endOffset);\n if (stringToSearch === undefined) return;\n\n const splitSearch = stringToSearch.split(' ');\n const fieldString = splitSearch[splitSearch.length - 1];\n const range = editor.getDoc().createRange();\n\n const startPos = stringToSearch.lastIndexOf(fieldString);\n const endPos = startPos + fieldString.length;\n range.setStart(selectedRange.commonAncestorContainer, startPos);\n range.setEnd(selectedRange.commonAncestorContainer, endPos);\n editor.getDoc().getSelection()?.removeAllRanges();\n editor.getDoc().getSelection()?.addRange(range);\n\n const selectedField = menuHelpers.getItem(fieldMenuItems, fieldId);\n if (selectedField) {\n editor.selection.setContent(\n `<pega-reference role=\"button\" contenteditable=\"false\" data-rule-type=\"field\" data-rule-id=\".${selectedField.id}\">${selectedField.primary}</pega-reference>`\n );\n setShowFieldsPopover(false);\n }\n };\n\n const hidePopover = () => {\n if (fieldPopoverRef) setShowFieldsPopover(false);\n };\n\n const filterFieldMenu = (searchString: string) => {\n setShowFieldsPopover(true);\n setFieldMenuItems(fieldItems || []);\n if (/\\s/.test(searchString)) {\n setShowFieldsPopover(false);\n return;\n }\n if (searchString && fieldMenuItems) {\n const newFieldMenuItems: MenuProps['items'] = menuHelpers\n .flatten(fieldMenuItems)\n .filter(({ primary }) =>\n primary.toLowerCase().startsWith(searchString.toLocaleLowerCase())\n );\n if (newFieldMenuItems) {\n setShowFieldsPopover(true);\n setFieldMenuItems(newFieldMenuItems);\n } else setShowFieldsPopover(false);\n }\n };\n\n const updateBookmarkAndCurrentElement = (editorSelection: EditorSelection) => {\n const targetEl = editorSelection.getNode() as HTMLElement;\n const fieldId = targetEl.getAttribute('data-rule-id');\n const fieldValue = targetEl.innerText;\n setBookmark(editorSelection.getBookmark());\n setCurrentElementId(fieldId || '');\n setCurrentElementContent(fieldValue);\n };\n\n const handleElementClick = ({ target }: MouseEvent) => {\n if (editor && target && (target as HTMLElement).tagName === 'PEGA-REFERENCE') {\n updateBookmarkAndCurrentElement(editor.selection);\n }\n hidePopover();\n };\n\n const onInsertField = (incEditor: TinyMCEEditor) => {\n const targetEl = incEditor.selection.getNode();\n if (targetEl.tagName === 'PEGA-REFERENCE') {\n updateBookmarkAndCurrentElement(incEditor.selection);\n } else {\n modalMethods.current = create(Modal, modalProps);\n }\n };\n\n const isPegaRefActive = (incEditor: TinyMCEEditor) => {\n const targetEl = incEditor.selection.getNode();\n return targetEl.tagName === 'PEGA-REFERENCE';\n };\n\n const fieldSelectionPopover = (\n <Popover\n show={showFieldsPopover}\n strategy='fixed'\n ref={fieldPopoverRef}\n target={{\n getBoundingClientRect() {\n return currentCursorPosition;\n }\n }}\n modifiers={[\n {\n name: 'offset',\n options: {\n offset: () => {\n const iframe = editorRef.current?.element?.querySelector('iframe');\n const iframeRect = iframe?.getBoundingClientRect();\n const x = iframeRect?.x ?? 0;\n const y = iframeRect?.y ?? 0;\n return [x, y] satisfies [number, number];\n }\n }\n }\n ]}\n placement='bottom-start'\n >\n {fieldMenuItems && (\n <Menu\n id={menuID}\n items={fieldMenuItems}\n as={StyledSearchPopover}\n focusControlEl={editor?.getBody() || undefined}\n mode='action'\n onItemClick={findAndRenameField}\n variant='drill-down'\n />\n )}\n </Popover>\n );\n\n useEffect(() => {\n if (currentElementId && currentElementContent)\n modalMethods.current = create(Modal, modalProps);\n }, [currentElementId, currentElementContent]);\n\n useEffect(() => {\n editor?.getDoc().addEventListener('click', handleElementClick);\n return () => {\n editor?.getDoc().removeEventListener('click', handleElementClick);\n };\n }, [editor, editorRef.current]);\n\n useEffect(() => {\n if (modalMethods.current) {\n modalMethods.current.update(modalProps);\n }\n }, [modalProps]);\n\n const onEditorChange: EditorProps['onChange'] = (formEditor?: TinyMCEEditor) => {\n if (formEditor) {\n const targetEl = formEditor.selection.getBoundingClientRect();\n const { left = 0, top = 0 } = targetEl ?? {};\n setCurrentCursorPosition({\n ...formEditor.selection.getBoundingClientRect(),\n x: left,\n y: top,\n toJSON: () => {}\n });\n\n if (formEditor.selection.isCollapsed()) {\n // get the full line string\n const selectedRange = formEditor.selection.getRng();\n const endOffset = selectedRange.endOffset;\n const stringToSearch = selectedRange.commonAncestorContainer.nodeValue?.slice(\n 0,\n endOffset\n );\n const fieldString = stringToSearch?.split(' ')[stringToSearch.split(' ').length - 1];\n if (\n fieldString?.startsWith('@') &&\n fieldString.indexOf('@') === fieldString.lastIndexOf('@')\n ) {\n filterFieldMenu(fieldString.slice(1));\n } else setShowFieldsPopover(false);\n }\n }\n };\n\n const onKeyDown: EditorProps['onKeyDown'] = event => {\n if (\n (event?.key === 'Enter' ||\n event?.key === 'ArrowLeft' ||\n event?.key === 'ArrowRight' ||\n event?.key === 'ArrowDown' ||\n event?.key === 'ArrowUp') &&\n !!fieldPopoverRef.current\n ) {\n event?.preventDefault();\n }\n if (event?.key === 'Escape' && !!fieldPopoverRef.current) {\n hidePopover();\n }\n };\n\n return (\n <Editor\n ref={editorRef}\n {...restProps}\n label={label}\n toolbar={toolbar}\n customComponents={[\n {\n createCustomElement: createPegaReferenceElement,\n name: 'pega-reference',\n extensionAttributes: ['contenteditable'],\n style: pegaReferenceElementStyle\n }\n ]}\n customActions={[\n {\n icon: 'code',\n text: tooltip,\n onMouseDown: () => {\n modalMethods.current = create(Modal, modalProps);\n },\n active: isPegaRefActive,\n shortcut: {\n pattern: 'meta+191',\n description: tooltip,\n command: onInsertField\n }\n }\n ]}\n onInit={setEditor}\n onChange={onEditorChange}\n onBlur={() => {\n onBlur?.();\n hidePopover();\n }}\n onKeyDown={onKeyDown}\n defaultValue={defaultValue}\n >\n {fieldSelectionPopover}\n </Editor>\n );\n });\n\nexport default DynamicContentEditor;\n"]}
|
|
1
|
+
{"version":3,"file":"DynamicContentEditor.js","sourceRoot":"","sources":["../../../src/components/DynamicContentEditor/DynamicContentEditor.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEhE,OAAO,MAAM,MAAM,mBAAmB,CAAC;AAGvC,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAEhD,OAAO,EACL,MAAM,EACN,gBAAgB,EAChB,IAAI,EACJ,WAAW,EACX,KAAK,EACL,OAAO,EACP,aAAa,EACb,eAAe,EACf,kBAAkB,EAClB,OAAO,EACP,MAAM,EACP,MAAM,yBAAyB,CAAC;AAOjC,OAAO,EAAE,aAAa,EAAE,MAAM,oEAAoE,CAAC;AAGnG,OAAO,EAAE,yBAAyB,EAAE,0BAA0B,EAAE,MAAM,qBAAqB,CAAC;AAI5F,MAAM,0BAA0B,GAAG,MAAM,CAAC,GAAG,CAAuC,EAAE,CAAC;AAEvF,MAAM,CAAC,MAAM,mBAAmB,GAAG,MAAM,CAAC,aAAa,CAAC,CAAA;;CAEvD,CAAC;AAEF,0BAA0B,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAE3D,MAAM,oBAAoB,GAA+D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BAChB,YAAY,CAAC,OAAO,GAAG,MAAM,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC;gBACnD,CAAC;gBACD,MAAM,EAAE,eAAe;gBACvB,QAAQ,EAAE;oBACR,OAAO,EAAE,UAAU;oBACnB,WAAW,EAAE,OAAO;oBACpB,OAAO,EAAE,aAAa;iBACvB;aACF;SACF,EACD,MAAM,EAAE,SAAS,EACjB,QAAQ,EAAE,cAAc,EACxB,MAAM,EAAE,GAAG,EAAE;YACX,MAAM,EAAE,EAAE,CAAC;YACX,WAAW,EAAE,CAAC;QAChB,CAAC,EACD,SAAS,EAAE,SAAS,EACpB,YAAY,EAAE,YAAY,YAEzB,qBAAqB,GACf,CACV,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,oBAAoB,CAAC","sourcesContent":["import { forwardRef, useRef, useEffect, useState } from 'react';\nimport type { PropsWithoutRef } from 'react';\nimport styled from 'styled-components';\nimport type { Bookmark, Editor as TinyMCEEditor, EditorSelection } from 'tinymce';\n\nimport { Editor } from '@pega/cosmos-react-rte';\nimport type { EditorProps } from '@pega/cosmos-react-rte';\nimport {\n Button,\n defaultThemeProp,\n Menu,\n menuHelpers,\n Modal,\n Popover,\n StyledPopover,\n useModalManager,\n useConsolidatedRef,\n useI18n,\n useUID\n} from '@pega/cosmos-react-core';\nimport type {\n ForwardRefForwardPropsComponent,\n MenuProps,\n ModalMethods,\n PropsWithDefaults\n} from '@pega/cosmos-react-core';\nimport { getKeyCommand } from '@pega/cosmos-react-rte/lib/components/RichTextEditor/Toolbar/utils';\n\nimport type { DynamicContentEditorProps, ItemType } from './DynamicContentEditor.types';\nimport { pegaReferenceElementStyle, createPegaReferenceElement } from './PegaCustomElement';\n\ntype DynamicContentEditorPropsWithDefaults = PropsWithDefaults<DynamicContentEditorProps>;\n\nconst StyledDynamicContentEditor = styled.div<DynamicContentEditorPropsWithDefaults>``;\n\nexport const StyledSearchPopover = styled(StyledPopover)`\n min-width: 20rem;\n`;\n\nStyledDynamicContentEditor.defaultProps = defaultThemeProp;\n\nconst DynamicContentEditor: ForwardRefForwardPropsComponent<DynamicContentEditorProps> = forwardRef(\n function DynamicContentEditor(\n {\n form: { dynamicContentPicker, onSubmit },\n onActiveFieldChange,\n label,\n toolbar,\n fieldItems,\n defaultValue,\n onBlur,\n ...restProps\n }: PropsWithoutRef<DynamicContentEditorProps>,\n ref: DynamicContentEditorProps['ref']\n ) {\n const menuID = useUID();\n const { create } = useModalManager();\n const t = useI18n();\n\n const modalMethods = useRef<ModalMethods>();\n const [editor, setEditor] = useState<TinyMCEEditor | undefined>();\n const [bookmark, setBookmark] = useState<Bookmark | undefined>();\n const [fieldMenuItems, setFieldMenuItems] = useState<MenuProps['items']>(fieldItems || []);\n const [currentElementId, setCurrentElementId] = useState('');\n const [currentElementContent, setCurrentElementContent] = useState('');\n const [currentCursorPosition, setCurrentCursorPosition] = useState({\n bottom: 0,\n height: 0,\n left: 0,\n right: 0,\n top: 0,\n width: 0,\n x: 0,\n y: 0,\n toJSON: () => {}\n });\n const [showFieldsPopover, setShowFieldsPopover] = useState<boolean>(false);\n\n const fieldPopoverRef = useRef<HTMLDivElement>(null);\n const editorRef = useConsolidatedRef(ref);\n\n const tooltip = getKeyCommand(\n navigator.appVersion.includes('Mac'),\n ({ ctrl }) => `${t('rte_insert_field')} (${ctrl}/)`\n );\n\n const insertField = (field: ItemType) => {\n if (!editor) return;\n\n const fieldContent = `<pega-reference role=\"button\" contenteditable=\"false\" data-rule-type='field' data-rule-id=${field.id}>${field.text}</pega-reference>`;\n if (bookmark) {\n editor.selection.moveToBookmark(bookmark);\n editor.selection.setContent(fieldContent);\n } else {\n editor.insertContent(fieldContent);\n }\n\n modalMethods.current?.dismiss();\n };\n\n const modalProps = {\n children: dynamicContentPicker,\n heading: t('rte_insert_field'),\n actions: (\n <>\n <Button variant='secondary' onClick={() => modalMethods.current?.dismiss()}>\n {t('cancel')}\n </Button>\n <Button variant='primary' onClick={() => onSubmit(insertField)}>\n {t('submit')}\n </Button>\n </>\n ),\n center: true,\n onAfterClose: () => {\n setBookmark(undefined);\n setCurrentElementId('');\n setCurrentElementContent('');\n onActiveFieldChange({ id: '', text: '' });\n },\n onBeforeOpen: () => {\n if (currentElementId) {\n onActiveFieldChange({ id: currentElementId, text: currentElementContent });\n }\n }\n };\n\n const findAndRenameField = (fieldId: string) => {\n if (!editor || !fieldMenuItems) return;\n\n const selectedRange = editor.selection.getRng();\n const endOffset = selectedRange.endOffset;\n const stringToSearch = selectedRange.commonAncestorContainer.nodeValue?.slice(0, endOffset);\n if (stringToSearch === undefined) return;\n\n const splitSearch = stringToSearch.split(' ');\n const fieldString = splitSearch[splitSearch.length - 1];\n const range = editor.getDoc().createRange();\n\n const startPos = stringToSearch.lastIndexOf(fieldString);\n const endPos = startPos + fieldString.length;\n range.setStart(selectedRange.commonAncestorContainer, startPos);\n range.setEnd(selectedRange.commonAncestorContainer, endPos);\n editor.getDoc().getSelection()?.removeAllRanges();\n editor.getDoc().getSelection()?.addRange(range);\n\n const selectedField = menuHelpers.getItem(fieldMenuItems, fieldId);\n if (selectedField) {\n editor.selection.setContent(\n `<pega-reference role=\"button\" contenteditable=\"false\" data-rule-type=\"field\" data-rule-id=\".${selectedField.id}\">${selectedField.primary}</pega-reference>`\n );\n setShowFieldsPopover(false);\n }\n };\n\n const hidePopover = () => {\n if (fieldPopoverRef) setShowFieldsPopover(false);\n };\n\n const filterFieldMenu = (searchString: string) => {\n setShowFieldsPopover(true);\n setFieldMenuItems(fieldItems || []);\n if (/\\s/.test(searchString)) {\n setShowFieldsPopover(false);\n return;\n }\n if (searchString && fieldMenuItems) {\n const newFieldMenuItems: MenuProps['items'] = menuHelpers\n .flatten(fieldMenuItems)\n .filter(({ primary }) =>\n primary.toLowerCase().startsWith(searchString.toLocaleLowerCase())\n );\n if (newFieldMenuItems) {\n setShowFieldsPopover(true);\n setFieldMenuItems(newFieldMenuItems);\n } else setShowFieldsPopover(false);\n }\n };\n\n const updateBookmarkAndCurrentElement = (editorSelection: EditorSelection) => {\n const targetEl = editorSelection.getNode() as HTMLElement;\n const fieldId = targetEl.getAttribute('data-rule-id');\n const fieldValue = targetEl.innerText;\n setBookmark(editorSelection.getBookmark());\n setCurrentElementId(fieldId || '');\n setCurrentElementContent(fieldValue);\n };\n\n const handleElementClick = ({ target }: MouseEvent) => {\n if (editor && target && (target as HTMLElement).tagName === 'PEGA-REFERENCE') {\n updateBookmarkAndCurrentElement(editor.selection);\n }\n hidePopover();\n };\n\n const onInsertField = (incEditor: TinyMCEEditor) => {\n const targetEl = incEditor.selection.getNode();\n if (targetEl.tagName === 'PEGA-REFERENCE') {\n updateBookmarkAndCurrentElement(incEditor.selection);\n } else {\n modalMethods.current = create(Modal, modalProps);\n }\n };\n\n const isPegaRefActive = (incEditor: TinyMCEEditor) => {\n const targetEl = incEditor.selection.getNode();\n return targetEl.tagName === 'PEGA-REFERENCE';\n };\n\n const fieldSelectionPopover = (\n <Popover\n show={showFieldsPopover}\n strategy='fixed'\n ref={fieldPopoverRef}\n target={{\n getBoundingClientRect() {\n return currentCursorPosition;\n }\n }}\n modifiers={[\n {\n name: 'offset',\n options: {\n offset: () => {\n const iframe = editorRef.current?.element?.querySelector('iframe');\n const iframeRect = iframe?.getBoundingClientRect();\n const x = iframeRect?.x ?? 0;\n const y = iframeRect?.y ?? 0;\n return [x, y] satisfies [number, number];\n }\n }\n }\n ]}\n placement='bottom-start'\n >\n {fieldMenuItems && (\n <Menu\n id={menuID}\n items={fieldMenuItems}\n as={StyledSearchPopover}\n focusControlEl={editor?.getBody() || undefined}\n mode='action'\n onItemClick={findAndRenameField}\n variant='drill-down'\n />\n )}\n </Popover>\n );\n\n useEffect(() => {\n if (currentElementId && currentElementContent)\n modalMethods.current = create(Modal, modalProps);\n }, [currentElementId, currentElementContent]);\n\n useEffect(() => {\n editor?.getDoc().addEventListener('click', handleElementClick);\n return () => {\n editor?.getDoc().removeEventListener('click', handleElementClick);\n };\n }, [editor, editorRef.current]);\n\n useEffect(() => {\n if (modalMethods.current) {\n modalMethods.current.update(modalProps);\n }\n }, [modalProps]);\n\n const onEditorChange: EditorProps['onChange'] = (formEditor?: TinyMCEEditor) => {\n if (formEditor) {\n const targetEl = formEditor.selection.getBoundingClientRect();\n const { left = 0, top = 0 } = targetEl ?? {};\n setCurrentCursorPosition({\n ...formEditor.selection.getBoundingClientRect(),\n x: left,\n y: top,\n toJSON: () => {}\n });\n\n if (formEditor.selection.isCollapsed()) {\n // get the full line string\n const selectedRange = formEditor.selection.getRng();\n const endOffset = selectedRange.endOffset;\n const stringToSearch = selectedRange.commonAncestorContainer.nodeValue?.slice(\n 0,\n endOffset\n );\n const fieldString = stringToSearch?.split(' ')[stringToSearch.split(' ').length - 1];\n if (\n fieldString?.startsWith('@') &&\n fieldString.indexOf('@') === fieldString.lastIndexOf('@')\n ) {\n filterFieldMenu(fieldString.slice(1));\n } else setShowFieldsPopover(false);\n }\n }\n };\n\n const onKeyDown: EditorProps['onKeyDown'] = event => {\n if (\n (event?.key === 'Enter' ||\n event?.key === 'ArrowLeft' ||\n event?.key === 'ArrowRight' ||\n event?.key === 'ArrowDown' ||\n event?.key === 'ArrowUp') &&\n !!fieldPopoverRef.current\n ) {\n event?.preventDefault();\n }\n if (event?.key === 'Escape' && !!fieldPopoverRef.current) {\n hidePopover();\n }\n };\n\n return (\n <Editor\n ref={editorRef}\n {...restProps}\n label={label}\n toolbar={toolbar}\n customComponents={[\n {\n createCustomElement: createPegaReferenceElement,\n name: 'pega-reference',\n extensionAttributes: ['contenteditable'],\n style: pegaReferenceElementStyle\n }\n ]}\n customActions={[\n {\n icon: 'code',\n text: tooltip,\n onMouseDown: () => {\n modalMethods.current = create(Modal, modalProps);\n },\n active: isPegaRefActive,\n shortcut: {\n pattern: 'meta+191',\n description: tooltip,\n command: onInsertField\n }\n }\n ]}\n onInit={setEditor}\n onChange={onEditorChange}\n onBlur={() => {\n onBlur?.();\n hidePopover();\n }}\n onKeyDown={onKeyDown}\n defaultValue={defaultValue}\n >\n {fieldSelectionPopover}\n </Editor>\n );\n }\n);\n\nexport default DynamicContentEditor;\n"]}
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import type { FC } from 'react';
|
|
2
|
-
import type {
|
|
3
|
-
type
|
|
4
|
-
|
|
5
|
-
required?: boolean;
|
|
6
|
-
};
|
|
2
|
+
import type { ComboBoxProps } from '@pega/cosmos-react-core';
|
|
3
|
+
import type { ConstantBooleanConfig } from './DynamicInput.types';
|
|
4
|
+
type BooleanControlProps = ConstantBooleanConfig['props'] & Pick<ComboBoxProps, 'required'>;
|
|
7
5
|
declare const BooleanControl: FC<BooleanControlProps>;
|
|
8
6
|
export default BooleanControl;
|
|
9
7
|
//# sourceMappingURL=BooleanControl.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BooleanControl.d.ts","sourceRoot":"","sources":["../../../src/components/DynamicInput/BooleanControl.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"BooleanControl.d.ts","sourceRoot":"","sources":["../../../src/components/DynamicInput/BooleanControl.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAEhC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAG7D,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAElE,KAAK,mBAAmB,GAAG,qBAAqB,CAAC,OAAO,CAAC,GAAG,IAAI,CAAC,aAAa,EAAE,UAAU,CAAC,CAAC;AAE5F,QAAA,MAAM,cAAc,EAAE,EAAE,CAAC,mBAAmB,CAqC3C,CAAC;AAEF,eAAe,cAAc,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BooleanControl.js","sourceRoot":"","sources":["../../../src/components/DynamicInput/BooleanControl.tsx"],"names":[],"mappings":";
|
|
1
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YACL,WAAW,EAAE,MAAM,CAAC,EAAE;gBACpB,QAAQ,CAAC,MAAM,KAAK,MAAM,CAAC,CAAC;YAC9B,CAAC;SACF,EACD,EAAE,EAAE,EAAE,EACN,QAAQ,EAAE,QAAQ,GAClB,CACH,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,cAAc,CAAC","sourcesContent":["import type { FC } from 'react';\n\nimport type { ComboBoxProps } from '@pega/cosmos-react-core';\nimport { ComboBox, useI18n } from '@pega/cosmos-react-core';\n\nimport type { ConstantBooleanConfig } from './DynamicInput.types';\n\ntype BooleanControlProps = ConstantBooleanConfig['props'] & Pick<ComboBoxProps, 'required'>;\n\nconst BooleanControl: FC<BooleanControlProps> = ({\n booleanLabels,\n value,\n onChange,\n id,\n required,\n ...restProps\n}: BooleanControlProps) => {\n const t = useI18n();\n const primaries =\n booleanLabels === 'always|never' ? [t('always'), t('never')] : [t('true'), t('false')];\n\n const items = [\n { id: 'true', primary: primaries[0], selected: value === true },\n { id: 'false', primary: primaries[1], selected: !value }\n ];\n\n return (\n <ComboBox\n {...restProps}\n selected={{\n items: {\n id: value === true ? items[0].id : items[1].id,\n text: value === true ? items[0].primary : items[1].primary\n }\n }}\n menu={{\n mode: 'single-select',\n items,\n onItemClick: itemId => {\n onChange(itemId === 'true');\n }\n }}\n id={id}\n required={required}\n />\n );\n};\n\nexport default BooleanControl;\n"]}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import type { FC } from 'react';
|
|
2
1
|
import type { DynamicInputProps } from './DynamicInput.types';
|
|
3
|
-
declare const _default:
|
|
2
|
+
declare const _default: import("react").ForwardRefExoticComponent<Omit<DynamicInputProps, "ref"> & import("react").RefAttributes<HTMLDivElement>> & {
|
|
4
3
|
getTestIds: (testIdProp?: import("@pega/cosmos-react-core").TestIdProp["testId"]) => import("@pega/cosmos-react-core").TestIdsRecord<readonly ["field", "menu", "control", "label", "info", "additional-info", "suggestion-accept", "suggestion-reject"]>;
|
|
5
4
|
};
|
|
6
5
|
export default _default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DynamicInput.d.ts","sourceRoot":"","sources":["../../../src/components/DynamicInput/DynamicInput.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"DynamicInput.d.ts","sourceRoot":"","sources":["../../../src/components/DynamicInput/DynamicInput.tsx"],"names":[],"mappings":"AAyBA,OAAO,KAAK,EAAE,iBAAiB,EAAU,MAAM,sBAAsB,CAAC;;;;AAsRtE,wBAAiE"}
|
|
@@ -8,7 +8,7 @@ import BooleanControl from './BooleanControl';
|
|
|
8
8
|
import SourceButton from './SourceButton';
|
|
9
9
|
import { getCurrentSource, getSourceIcon } from './utils';
|
|
10
10
|
import { getDynamicInputTestIds } from './DynamicInput.test-ids';
|
|
11
|
-
const DynamicInput = forwardRef(({ testId, label: labelProp, sources, onSourceChange, controls, required, ...restProps }, ref) => {
|
|
11
|
+
const DynamicInput = forwardRef(({ testId, label: labelProp, sources, onSourceChange, controls, required, hideSourceButton, ...restProps }, ref) => {
|
|
12
12
|
const testIds = useTestIds(testId, getDynamicInputTestIds);
|
|
13
13
|
const inputUid = useUID();
|
|
14
14
|
const t = useI18n();
|
|
@@ -32,39 +32,39 @@ const DynamicInput = forwardRef(({ testId, label: labelProp, sources, onSourceCh
|
|
|
32
32
|
let control = _jsx(_Fragment, { children: null });
|
|
33
33
|
if (currentSource === 'Constant' && controls.constant) {
|
|
34
34
|
const { format, props } = controls.constant;
|
|
35
|
-
const { value
|
|
35
|
+
const { value } = props;
|
|
36
36
|
// Note: This is just a typeguard for the value prop.
|
|
37
37
|
if (typeof value === 'string' || value === undefined) {
|
|
38
38
|
if (format === 'Text') {
|
|
39
|
-
control = (_jsx(Input, { "data-testid": testIds.control, id: inputUid,
|
|
40
|
-
onChange(e.target.value);
|
|
39
|
+
control = (_jsx(Input, { ...props, "data-testid": testIds.control, id: inputUid, onChange: (e) => {
|
|
40
|
+
props.onChange(e.target.value);
|
|
41
41
|
}, required: required }));
|
|
42
42
|
}
|
|
43
43
|
if (format === 'Text (paragraph)') {
|
|
44
|
-
control = (_jsx(TextArea, { "data-testid": testIds.control, id: inputUid,
|
|
45
|
-
onChange(e.target.value);
|
|
44
|
+
control = (_jsx(TextArea, { ...props, "data-testid": testIds.control, id: inputUid, onChange: (e) => {
|
|
45
|
+
props.onChange(e.target.value);
|
|
46
46
|
}, required: required }));
|
|
47
47
|
}
|
|
48
48
|
if (format === 'Currency') {
|
|
49
|
-
control = (_jsx(CurrencyInput, { "data-testid": testIds.control, id: inputUid,
|
|
49
|
+
control = (_jsx(CurrencyInput, { ...props, "data-testid": testIds.control, id: inputUid, required: required }));
|
|
50
50
|
}
|
|
51
51
|
if (format === 'Percentage') {
|
|
52
|
-
control = (_jsx(NumberInput, { "data-testid": testIds.control, id: inputUid,
|
|
52
|
+
control = (_jsx(NumberInput, { ...props, "data-testid": testIds.control, id: inputUid, showGroupSeparators: false, numberOfDecimals: undefined, unit: 'percent', required: required }));
|
|
53
53
|
}
|
|
54
54
|
if (format === 'Integer') {
|
|
55
|
-
control = (_jsx(NumberInput, { "data-testid": testIds.control, id: inputUid,
|
|
55
|
+
control = (_jsx(NumberInput, { ...props, "data-testid": testIds.control, id: inputUid, showGroupSeparators: false,
|
|
56
56
|
// Note: Getting single occurrence of callback when '.' is entered w/o showDecimal = false.
|
|
57
57
|
showDecimal: false, required: required }));
|
|
58
58
|
}
|
|
59
59
|
if (format === 'Decimal') {
|
|
60
|
-
control = (_jsx(NumberInput, { "data-testid": testIds.control, id: inputUid,
|
|
60
|
+
control = (_jsx(NumberInput, { ...props, "data-testid": testIds.control, id: inputUid, required: required }));
|
|
61
61
|
}
|
|
62
62
|
if (format === 'Phone') {
|
|
63
|
-
control = (_jsx(PhoneInput, { "data-testid": testIds.control, id: inputUid,
|
|
63
|
+
control = (_jsx(PhoneInput, { ...props, "data-testid": testIds.control, id: inputUid, required: required, showCountryCode: true }));
|
|
64
64
|
}
|
|
65
65
|
}
|
|
66
66
|
if (format === 'Boolean') {
|
|
67
|
-
control = (_jsx(BooleanControl, { "data-testid": testIds.control, id: inputUid,
|
|
67
|
+
control = (_jsx(BooleanControl, { ...props, "data-testid": testIds.control, id: inputUid, required: required }));
|
|
68
68
|
}
|
|
69
69
|
// Note: This is just a typeguard for the value prop.
|
|
70
70
|
if (typeof value === 'string' ||
|
|
@@ -72,13 +72,13 @@ const DynamicInput = forwardRef(({ testId, label: labelProp, sources, onSourceCh
|
|
|
72
72
|
value instanceof Date ||
|
|
73
73
|
value === undefined) {
|
|
74
74
|
if (format === 'DateTime') {
|
|
75
|
-
control = (_jsx(DateTimeInput, { "data-testid": testIds.control, id: inputUid,
|
|
75
|
+
control = (_jsx(DateTimeInput, { ...props, "data-testid": testIds.control, id: inputUid, required: required }));
|
|
76
76
|
}
|
|
77
77
|
if (format === 'Date') {
|
|
78
|
-
control = _jsx(DateInput, { "data-testid": testIds.control, id: inputUid, required: required });
|
|
78
|
+
control = (_jsx(DateInput, { ...props, "data-testid": testIds.control, id: inputUid, required: required }));
|
|
79
79
|
}
|
|
80
80
|
if (format === 'Time') {
|
|
81
|
-
control = _jsx(TimeInput, { "data-testid": testIds.control, id: inputUid, required: required });
|
|
81
|
+
control = (_jsx(TimeInput, { ...props, "data-testid": testIds.control, id: inputUid, required: required }));
|
|
82
82
|
}
|
|
83
83
|
}
|
|
84
84
|
}
|
|
@@ -93,24 +93,24 @@ const DynamicInput = forwardRef(({ testId, label: labelProp, sources, onSourceCh
|
|
|
93
93
|
else if (currentSource === 'FieldReference' && controls.fieldReference) {
|
|
94
94
|
control = (_jsx(FieldReferenceInput, { ...controls.fieldReference.props, "data-testid": testIds.control, id: inputUid, required: required }));
|
|
95
95
|
}
|
|
96
|
-
return (_jsxs(ThemeOverride, { theme: { base: { 'icon-set': 'streamline' } }, children: [_jsx(FormField, { label: label, labelFor: inputUid, required: required, ...restProps, ref: ref, testId: testIds.field, children: _jsxs(StyledDynamicInput, { children: [_jsx(SourceButton, { testId: testIds.menu, sources: sources, constantFormat: controls.constant?.format, icon: currentSource
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
96
|
+
return (_jsxs(ThemeOverride, { theme: { base: { 'icon-set': 'streamline' } }, children: [_jsx(FormField, { label: label, labelFor: inputUid, required: required, ...restProps, ref: ref, testId: testIds.field, children: _jsxs(StyledDynamicInput, { children: [_jsx(_Fragment, { children: hideSourceButton ? null : (_jsx(SourceButton, { testId: testIds.menu, sources: sources, constantFormat: controls.constant?.format, icon: currentSource
|
|
97
|
+
? getSourceIcon({
|
|
98
|
+
source: currentSource,
|
|
99
|
+
format: currentSource === 'Constant' ? controls.constant?.format : undefined
|
|
100
|
+
})
|
|
101
|
+
: undefined, menuItems: sources.map(config => {
|
|
102
|
+
const type = config.type;
|
|
103
|
+
return {
|
|
104
|
+
id: type,
|
|
105
|
+
primary: sourceLabels[config.type],
|
|
106
|
+
secondary: [sourceDescriptions[type]],
|
|
107
|
+
visual: (_jsx(Icon, { name: getSourceIcon({
|
|
108
|
+
source: type,
|
|
109
|
+
format: type === 'Constant' ? constantFormat : undefined
|
|
110
|
+
}), set: 'streamline' })),
|
|
111
|
+
selected: config.selected
|
|
112
|
+
};
|
|
113
|
+
}), onSourceChange: onSourceChange, "aria-describedby": `${inputUid}-selected-source` })) }), control] }) }), _jsx(VisuallyHiddenText, { id: `${inputUid}-selected-source`, children: currentSource ? t('selected_noun', [sourceLabels[currentSource]]) : '' })] }));
|
|
114
114
|
});
|
|
115
115
|
export default withTestIds(DynamicInput, getDynamicInputTestIds);
|
|
116
116
|
//# sourceMappingURL=DynamicInput.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DynamicInput.js","sourceRoot":"","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GACpD,IACP,CACjB,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,WAAW,CAAC,YAAY,EAAE,sBAAsB,CAAC,CAAC","sourcesContent":["import { forwardRef } from 'react';\nimport type { ChangeEvent, FC, PropsWithoutRef } from 'react';\n\nimport {\n ThemeOverride,\n CurrencyInput,\n DateInput,\n DateTimeInput,\n FormField,\n Input,\n NumberInput,\n PhoneInput,\n TextArea,\n TimeInput,\n useI18n,\n useTestIds,\n useUID,\n withTestIds,\n Icon,\n VisuallyHiddenText\n} from '@pega/cosmos-react-core';\n\nimport { RuleSelect } from '../RuleSelect';\nimport { FieldReferenceInput } from '../FieldReference';\n\nimport type { DynamicInputProps, Source } from './DynamicInput.types';\nimport { StyledExpressionControl, StyledDynamicInput } from './DynamicInput.styles';\nimport BooleanControl from './BooleanControl';\nimport SourceButton from './SourceButton';\nimport { getCurrentSource, getSourceIcon } from './utils';\nimport { getDynamicInputTestIds } from './DynamicInput.test-ids';\n\nconst DynamicInput: FC<DynamicInputProps> = forwardRef(\n (\n {\n testId,\n label: labelProp,\n sources,\n onSourceChange,\n controls,\n required,\n ...restProps\n }: PropsWithoutRef<DynamicInputProps>,\n ref: DynamicInputProps['ref']\n ) => {\n const testIds = useTestIds(testId, getDynamicInputTestIds);\n const inputUid = useUID();\n const t = useI18n();\n\n const label = labelProp ?? t('value');\n const currentSource = getCurrentSource(sources);\n const constantFormat = controls.constant?.format;\n const sourceLabels: { [key in Source]: string } = {\n Constant: t('constant_label', [\n constantFormat ? t(`dynamicInput_format_${constantFormat}`) : ''\n ]),\n Expression: t('expression_label'),\n FieldReference: t('field_reference_label'),\n Rule: t('rule_label')\n };\n const sourceDescriptions: { [key in Source]: string } = {\n Constant: t('constant_description'),\n Expression: t('expression_description'),\n FieldReference: t('field_reference_description'),\n Rule: t('rule_description')\n };\n\n let control: JSX.Element = <>{null}</>;\n\n if (currentSource === 'Constant' && controls.constant) {\n const { format, props } = controls.constant;\n const { value, onChange, booleanLabels } = props;\n // Note: This is just a typeguard for the value prop.\n if (typeof value === 'string' || value === undefined) {\n if (format === 'Text') {\n control = (\n <Input\n data-testid={testIds.control}\n id={inputUid}\n value={value}\n onChange={(e: ChangeEvent<HTMLInputElement>) => {\n onChange(e.target.value);\n }}\n required={required}\n />\n );\n }\n\n if (format === 'Text (paragraph)') {\n control = (\n <TextArea\n data-testid={testIds.control}\n id={inputUid}\n value={value}\n onChange={(e: ChangeEvent<HTMLTextAreaElement>) => {\n onChange(e.target.value);\n }}\n required={required}\n />\n );\n }\n\n if (format === 'Currency') {\n control = (\n <CurrencyInput\n data-testid={testIds.control}\n id={inputUid}\n value={value}\n onChange={onChange}\n required={required}\n />\n );\n }\n\n if (format === 'Percentage') {\n control = (\n <NumberInput\n data-testid={testIds.control}\n id={inputUid}\n value={value}\n onChange={onChange}\n showGroupSeparators={false}\n numberOfDecimals={undefined}\n required={required}\n />\n );\n }\n\n if (format === 'Integer') {\n control = (\n <NumberInput\n data-testid={testIds.control}\n id={inputUid}\n value={value}\n onChange={onChange}\n showGroupSeparators={false}\n // Note: Getting single occurrence of callback when '.' is entered w/o showDecimal = false.\n showDecimal={false}\n required={required}\n />\n );\n }\n\n if (format === 'Decimal') {\n control = (\n <NumberInput\n data-testid={testIds.control}\n id={inputUid}\n value={value}\n onChange={onChange}\n required={required}\n />\n );\n }\n\n if (format === 'Phone') {\n control = (\n <PhoneInput\n data-testid={testIds.control}\n id={inputUid}\n value={value}\n onChange={onChange}\n required={required}\n showCountryCode\n />\n );\n }\n }\n\n if (format === 'Boolean') {\n control = (\n <BooleanControl\n data-testid={testIds.control}\n id={inputUid}\n booleanLabels={booleanLabels}\n value={value}\n onChange={onChange}\n required={required}\n />\n );\n }\n\n // Note: This is just a typeguard for the value prop.\n if (\n typeof value === 'string' ||\n typeof value === 'number' ||\n value instanceof Date ||\n value === undefined\n ) {\n if (format === 'DateTime') {\n control = (\n <DateTimeInput\n data-testid={testIds.control}\n id={inputUid}\n value={value}\n required={required}\n />\n );\n }\n\n if (format === 'Date') {\n control = <DateInput data-testid={testIds.control} id={inputUid} required={required} />;\n }\n\n if (format === 'Time') {\n control = <TimeInput data-testid={testIds.control} id={inputUid} required={required} />;\n }\n }\n } else if (currentSource === 'Rule' && controls.rule) {\n control = (\n <RuleSelect\n {...controls.rule.props}\n data-testid={testIds.control}\n id={inputUid}\n required={required}\n />\n );\n } else if (currentSource === 'Expression' && controls.expression) {\n const ExpressionControl = controls.expression.component;\n const controlProps = controls.expression.props;\n\n control = (\n <StyledExpressionControl container>\n <ExpressionControl\n {...controlProps}\n data-testid={testIds.control}\n id={inputUid}\n required={required}\n />\n </StyledExpressionControl>\n );\n } else if (currentSource === 'FieldReference' && controls.fieldReference) {\n control = (\n <FieldReferenceInput\n {...controls.fieldReference.props}\n data-testid={testIds.control}\n id={inputUid}\n required={required}\n />\n );\n }\n\n return (\n <ThemeOverride theme={{ base: { 'icon-set': 'streamline' } }}>\n <FormField\n label={label}\n labelFor={inputUid}\n required={required}\n {...restProps}\n ref={ref}\n testId={testIds.field}\n >\n <StyledDynamicInput>\n <SourceButton\n testId={testIds.menu}\n sources={sources}\n constantFormat={controls.constant?.format}\n icon={\n currentSource\n ? getSourceIcon({\n source: currentSource,\n format: currentSource === 'Constant' ? controls.constant?.format : undefined\n })\n : undefined\n }\n menuItems={sources.map(config => {\n const type = config.type;\n\n return {\n id: type,\n primary: sourceLabels[config.type],\n secondary: [sourceDescriptions[type]],\n visual: (\n <Icon\n name={getSourceIcon({\n source: type,\n format: type === 'Constant' ? constantFormat : undefined\n })}\n set='streamline'\n />\n ),\n selected: config.selected\n };\n })}\n onSourceChange={onSourceChange}\n aria-describedby={`${inputUid}-selected-source`}\n />\n {control}\n </StyledDynamicInput>\n </FormField>\n\n <VisuallyHiddenText id={`${inputUid}-selected-source`}>\n {currentSource ? t('selected_noun', [sourceLabels[currentSource]]) : ''}\n </VisuallyHiddenText>\n </ThemeOverride>\n );\n }\n);\n\nexport default withTestIds(DynamicInput, getDynamicInputTestIds);\n"]}
|
|
1
|
+
{"version":3,"file":"DynamicInput.js","sourceRoot":"","sources":["../../../src/components/DynamicInput/DynamicInput.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAGnC,OAAO,EACL,aAAa,EACb,aAAa,EACb,SAAS,EACT,aAAa,EACb,SAAS,EACT,KAAK,EACL,WAAW,EACX,UAAU,EACV,QAAQ,EACR,SAAS,EACT,OAAO,EACP,UAAU,EACV,MAAM,EACN,WAAW,EACX,IAAI,EACJ,kBAAkB,EACnB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAGxD,OAAO,EAAE,uBAAuB,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AACpF,OAAO,cAAc,MAAM,kBAAkB,CAAC;AAC9C,OAAO,YAAY,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC1D,OAAO,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AAEjE,MAAM,YAAY,GAAG,UAAU,CAC7B,CACE,EACE,MAAM,EACN,KAAK,EAAE,SAAS,EAChB,OAAO,EACP,cAAc,EACd,QAAQ,EACR,QAAQ,EACR,gBAAgB,EAChB,GAAG,SAAS,EACuB,EACrC,GAA6B,EAC7B,EAAE;IACF,MAAM,OAAO,GAAG,UAAU,CAAC,MAAM,EAAE,sBAAsB,CAAC,CAAC;IAC3D,MAAM,QAAQ,GAAG,MAAM,EAAE,CAAC;IAC1B,MAAM,CAAC,GAAG,OAAO,EAAE,CAAC;IAEpB,MAAM,KAAK,GAAG,SAAS,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC;IACtC,MAAM,aAAa,GAAG,gBAAgB,CAAC,OAAO,CAAC,CAAC;IAChD,MAAM,cAAc,GAAG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CAAC","sourcesContent":["import { forwardRef } from 'react';\nimport type { ChangeEvent, PropsWithoutRef } from 'react';\n\nimport {\n ThemeOverride,\n CurrencyInput,\n DateInput,\n DateTimeInput,\n FormField,\n Input,\n NumberInput,\n PhoneInput,\n TextArea,\n TimeInput,\n useI18n,\n useTestIds,\n useUID,\n withTestIds,\n Icon,\n VisuallyHiddenText\n} from '@pega/cosmos-react-core';\n\nimport { RuleSelect } from '../RuleSelect';\nimport { FieldReferenceInput } from '../FieldReference';\n\nimport type { DynamicInputProps, Source } from './DynamicInput.types';\nimport { StyledExpressionControl, StyledDynamicInput } from './DynamicInput.styles';\nimport BooleanControl from './BooleanControl';\nimport SourceButton from './SourceButton';\nimport { getCurrentSource, getSourceIcon } from './utils';\nimport { getDynamicInputTestIds } from './DynamicInput.test-ids';\n\nconst DynamicInput = forwardRef(\n (\n {\n testId,\n label: labelProp,\n sources,\n onSourceChange,\n controls,\n required,\n hideSourceButton,\n ...restProps\n }: PropsWithoutRef<DynamicInputProps>,\n ref: DynamicInputProps['ref']\n ) => {\n const testIds = useTestIds(testId, getDynamicInputTestIds);\n const inputUid = useUID();\n const t = useI18n();\n\n const label = labelProp ?? t('value');\n const currentSource = getCurrentSource(sources);\n const constantFormat = controls.constant?.format;\n const sourceLabels: { [key in Source]: string } = {\n Constant: t('constant_label', [\n constantFormat ? t(`dynamicInput_format_${constantFormat}`) : ''\n ]),\n Expression: t('expression_label'),\n FieldReference: t('field_reference_label'),\n Rule: t('rule_label')\n };\n const sourceDescriptions: { [key in Source]: string } = {\n Constant: t('constant_description'),\n Expression: t('expression_description'),\n FieldReference: t('field_reference_description'),\n Rule: t('rule_description')\n };\n\n let control: JSX.Element = <>{null}</>;\n\n if (currentSource === 'Constant' && controls.constant) {\n const { format, props } = controls.constant;\n const { value } = props;\n // Note: This is just a typeguard for the value prop.\n if (typeof value === 'string' || value === undefined) {\n if (format === 'Text') {\n control = (\n <Input\n {...props}\n data-testid={testIds.control}\n id={inputUid}\n onChange={(e: ChangeEvent<HTMLInputElement>) => {\n props.onChange(e.target.value);\n }}\n required={required}\n />\n );\n }\n\n if (format === 'Text (paragraph)') {\n control = (\n <TextArea\n {...props}\n data-testid={testIds.control}\n id={inputUid}\n onChange={(e: ChangeEvent<HTMLTextAreaElement>) => {\n props.onChange(e.target.value);\n }}\n required={required}\n />\n );\n }\n\n if (format === 'Currency') {\n control = (\n <CurrencyInput\n {...props}\n data-testid={testIds.control}\n id={inputUid}\n required={required}\n />\n );\n }\n\n if (format === 'Percentage') {\n control = (\n <NumberInput\n {...props}\n data-testid={testIds.control}\n id={inputUid}\n showGroupSeparators={false}\n numberOfDecimals={undefined}\n unit='percent'\n required={required}\n />\n );\n }\n\n if (format === 'Integer') {\n control = (\n <NumberInput\n {...props}\n data-testid={testIds.control}\n id={inputUid}\n showGroupSeparators={false}\n // Note: Getting single occurrence of callback when '.' is entered w/o showDecimal = false.\n showDecimal={false}\n required={required}\n />\n );\n }\n\n if (format === 'Decimal') {\n control = (\n <NumberInput\n {...props}\n data-testid={testIds.control}\n id={inputUid}\n required={required}\n />\n );\n }\n\n if (format === 'Phone') {\n control = (\n <PhoneInput\n {...props}\n data-testid={testIds.control}\n id={inputUid}\n required={required}\n showCountryCode\n />\n );\n }\n }\n\n if (format === 'Boolean') {\n control = (\n <BooleanControl\n {...props}\n data-testid={testIds.control}\n id={inputUid}\n required={required}\n />\n );\n }\n\n // Note: This is just a typeguard for the value prop.\n if (\n typeof value === 'string' ||\n typeof value === 'number' ||\n value instanceof Date ||\n value === undefined\n ) {\n if (format === 'DateTime') {\n control = (\n <DateTimeInput\n {...props}\n data-testid={testIds.control}\n id={inputUid}\n required={required}\n />\n );\n }\n\n if (format === 'Date') {\n control = (\n <DateInput {...props} data-testid={testIds.control} id={inputUid} required={required} />\n );\n }\n\n if (format === 'Time') {\n control = (\n <TimeInput {...props} data-testid={testIds.control} id={inputUid} required={required} />\n );\n }\n }\n } else if (currentSource === 'Rule' && controls.rule) {\n control = (\n <RuleSelect\n {...controls.rule.props}\n data-testid={testIds.control}\n id={inputUid}\n required={required}\n />\n );\n } else if (currentSource === 'Expression' && controls.expression) {\n const ExpressionControl = controls.expression.component;\n const controlProps = controls.expression.props;\n\n control = (\n <StyledExpressionControl container>\n <ExpressionControl\n {...controlProps}\n data-testid={testIds.control}\n id={inputUid}\n required={required}\n />\n </StyledExpressionControl>\n );\n } else if (currentSource === 'FieldReference' && controls.fieldReference) {\n control = (\n <FieldReferenceInput\n {...controls.fieldReference.props}\n data-testid={testIds.control}\n id={inputUid}\n required={required}\n />\n );\n }\n\n return (\n <ThemeOverride theme={{ base: { 'icon-set': 'streamline' } }}>\n <FormField\n label={label}\n labelFor={inputUid}\n required={required}\n {...restProps}\n ref={ref}\n testId={testIds.field}\n >\n <StyledDynamicInput>\n <>\n {hideSourceButton ? null : (\n <SourceButton\n testId={testIds.menu}\n sources={sources}\n constantFormat={controls.constant?.format}\n icon={\n currentSource\n ? getSourceIcon({\n source: currentSource,\n format:\n currentSource === 'Constant' ? controls.constant?.format : undefined\n })\n : undefined\n }\n menuItems={sources.map(config => {\n const type = config.type;\n\n return {\n id: type,\n primary: sourceLabels[config.type],\n secondary: [sourceDescriptions[type]],\n visual: (\n <Icon\n name={getSourceIcon({\n source: type,\n format: type === 'Constant' ? constantFormat : undefined\n })}\n set='streamline'\n />\n ),\n selected: config.selected\n };\n })}\n onSourceChange={onSourceChange}\n aria-describedby={`${inputUid}-selected-source`}\n />\n )}\n </>\n {control}\n </StyledDynamicInput>\n </FormField>\n\n <VisuallyHiddenText id={`${inputUid}-selected-source`}>\n {currentSource ? t('selected_noun', [sourceLabels[currentSource]]) : ''}\n </VisuallyHiddenText>\n </ThemeOverride>\n );\n }\n);\n\nexport default withTestIds(DynamicInput, getDynamicInputTestIds);\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const StyledExpressionBuilderButton: import("styled-components").StyledComponent<import("
|
|
2
|
-
export declare const StyledExpressionControl: import("styled-components").StyledComponent<import("
|
|
1
|
+
export declare const StyledExpressionBuilderButton: import("styled-components").StyledComponent<import("@pega/cosmos-react-core").ForwardRefForwardPropsComponent<import("@pega/cosmos-react-core").ButtonProps>, import("styled-components").DefaultTheme, {}, never>;
|
|
2
|
+
export declare const StyledExpressionControl: import("styled-components").StyledComponent<import("@pega/cosmos-react-core").ForwardRefForwardPropsComponent<import("@pega/cosmos-react-core").FlexProps>, import("styled-components").DefaultTheme, {}, never>;
|
|
3
3
|
export declare const StyledDynamicInput: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
|
4
4
|
//# sourceMappingURL=DynamicInput.styles.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DynamicInput.styles.d.ts","sourceRoot":"","sources":["../../../src/components/DynamicInput/DynamicInput.styles.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,6BAA6B,
|
|
1
|
+
{"version":3,"file":"DynamicInput.styles.d.ts","sourceRoot":"","sources":["../../../src/components/DynamicInput/DynamicInput.styles.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,6BAA6B,oNAAmB,CAAC;AAC9D,eAAO,MAAM,uBAAuB,kNAAiB,CAAC;AAEtD,eAAO,MAAM,kBAAkB,yGAoD7B,CAAC"}
|