@pega/cosmos-react-build 8.0.0-build.9.0 → 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":"BackgroundPicker.styles.js","sourceRoot":"","sources":["../../../src/components/BackgroundPicker/BackgroundPicker.styles.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,EAAE,EAAE,GAAG,EAAqB,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAGpD,OAAO,EACL,iBAAiB,EACjB,iBAAiB,EACjB,gBAAgB,EAChB,IAAI,EACJ,UAAU,EACV,IAAI,EACJ,UAAU,EACV,QAAQ,EACT,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,iBAAiB,EAAE,MAAM,yDAAyD,CAAC;AAC5F,OAAO,WAAW,MAAM,2DAA2D,CAAC;AACpF,OAAO,EAAE,gBAAgB,EAAE,MAAM,2CAA2C,CAAC;AAI7E,MAAM,CAAC,MAAM,sBAAsB,GAAG,MAAM,CAAC,GAAG,CAG9C,CAAC,EACC,KAAK,EAAE,EACL,IAAI,EAAE,EACJ,OAAO,EACP,MAAM,EAAE,EAAE,MAAM,EAAE,EAClB,MAAM,EAAE,EAAE,KAAK,EAAE,EACjB,aAAa,EAAE,UAAU,EACzB,WAAW,EAAE,QAAQ,EACrB,YAAY,EAAE,SAAS,EACxB,EACD,UAAU,EAAE,EACV,KAAK,EAAE,EAAE,MAAM,EAAE,EACjB,cAAc,EAAE,EAAE,cAAc,EAAE,WAAW,EAAE,cAAc,EAAE,WAAW,EAAE,EAC7E,EACF,EACD,UAAU,EACV,KAAK,EACN,EAAE,EAAE;IACH,MAAM,SAAS,GAAG,iBAAiB,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC;IAEzD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AC,CAAC;AAEH,kBAAkB,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAEnD,MAAM,CAAC,MAAM,UAAU,GAAG,MAAM,CAAC,IAAI,CAAC,CAAA;IAClC,gBAAgB;CACnB,CAAC","sourcesContent":["import styled, { css, type DefaultTheme } from 'styled-components';\nimport { hideVisually, parseToRgb } from 'polished';\nimport type { RgbaColor } from 'polished/lib/types/color';\n\nimport {\n calculateFontSize,\n StyledFormControl,\n defaultThemeProp,\n Flex,\n StyledCard,\n Text,\n StyledIcon,\n tryCatch\n} from '@pega/cosmos-react-core';\nimport { StyledCardContent } from '@pega/cosmos-react-core/lib/components/Card/CardContent';\nimport StyledInput from '@pega/cosmos-react-core/lib/components/Input/Input.styles';\nimport { ellipsisOverflow } from '@pega/cosmos-react-core/lib/styles/mixins';\n\nimport type { BackgroundPickerPropsWithDefaults } from './BackgroundPicker.types';\n\nexport const StyledBackgroundPicker = styled.div<\n Pick<BackgroundPickerPropsWithDefaults, 'swatchOnly' | 'value'>\n>(\n ({\n theme: {\n base: {\n spacing,\n colors: { purple },\n shadow: { focus },\n 'font-family': fontFamily,\n 'font-size': fontSize,\n 'font-scale': fontScale\n },\n components: {\n input: { height },\n 'form-control': { 'border-width': borderWidth, 'border-color': borderColor }\n }\n },\n swatchOnly,\n value\n }) => {\n const fontSizes = calculateFontSize(fontSize, fontScale);\n\n return css`\n ${StyledFormControl} {\n overflow: hidden;\n border-width: ${value === 'auto' ? `calc(1.5 * ${borderWidth})` : borderWidth};\n border-style: ${value === 'auto' ? 'dotted' : 'solid'};\n\n ${value === 'auto' &&\n css`\n border-color: ${purple.medium};\n `}\n\n ${!swatchOnly &&\n css`\n min-width: calc(16 * ${spacing});\n `}\n\n ${!swatchOnly &&\n css`\n padding-inline-end: ${spacing};\n `}\n\n &:focus-within {\n box-shadow: ${focus};\n border: none;\n }\n\n &:hover:not([readonly]):not([disabled]):not(:focus, :focus-within) {\n ${value === 'auto' &&\n css`\n border-color: ${purple.dark};\n `}\n }\n\n & > input {\n ${hideVisually}\n\n & + div {\n height: calc(${height} - (2 * ${borderWidth}));\n\n ${swatchOnly\n ? css`\n width: calc(${height} - (2 * ${borderWidth}));\n `\n : css`\n min-width: calc(${height} - ${borderWidth});\n margin-inline-end: ${spacing};\n border-inline-end: ${borderWidth} solid ${borderColor};\n `}\n }\n\n &:focus + div {\n width: ${height};\n height: ${height};\n }\n }\n\n & input {\n height: 2rem;\n min-height: 2rem;\n color: #000000;\n background-color: #ffffff;\n font-size: ${fontSizes.s};\n font-family: ${fontFamily};\n\n & + label {\n font-weight: 600;\n color: rgba(0, 0, 0, 0.6);\n font-size: ${fontSizes.s};\n font-family: ${fontFamily};\n }\n }\n }\n `;\n }\n);\n\nStyledBackgroundPicker.defaultProps = defaultThemeProp;\n\nexport const ColorSwatchPreview = styled.div(\n ({\n value,\n theme: {\n base: {\n colors: { purple }\n }\n }\n }: {\n value: string;\n theme: DefaultTheme;\n }) => {\n const rgb = tryCatch(() => parseToRgb(value));\n\n let background = value;\n if (value === 'auto') {\n background = 'transparent';\n } else if (value === 'transparent' || (rgb && (rgb as RgbaColor).alpha === 0)) {\n // Red slash to denote transparent or no color\n background =\n 'linear-gradient(137deg,#ffffff 0%,#ffffff 50%,#ff0000 54%,#ffffff 58%,#ffffff 100%)';\n }\n\n return css`\n background: repeating-conic-gradient(#dddddd 0% 25%, transparent 0% 50%) 0 0 / 0.5rem 0.5rem;\n position: relative;\n\n & ${StyledIcon} {\n width: 50%;\n height: 50%;\n z-index: 1;\n fill: ${purple.dark};\n }\n\n &::after {\n content: '';\n position: absolute;\n width: 100%;\n height: 100%;\n background: ${background};\n }\n `;\n }\n);\n\nColorSwatchPreview.defaultProps = defaultThemeProp;\n\nexport const StyledPreviewContainer = styled.div(({ theme }) => {\n return css`\n background: repeating-conic-gradient(#dddddd 0% 25%, transparent 0% 50%) 0 0 / 0.5rem 0.5rem;\n height: ${theme.base['content-width'].xs};\n border: 0.0625rem solid ${theme.base.palette['border-line']};\n position: relative;\n `;\n});\n\nStyledPreviewContainer.defaultProps = defaultThemeProp;\n\nexport const StyledPreview = styled.div<{ background: string }>(({ background }) => {\n return css`\n background: ${background};\n width: 100%;\n height: 100%;\n `;\n});\n\nexport const StyledFlex = styled(Flex)`\n ${StyledCard} {\n width: 100%;\n }\n\n &&& ${StyledCardContent} {\n padding: 0;\n }\n`;\n\nexport const StyledTableWrapper = styled(Flex)(({\n theme: {\n base: { spacing }\n }\n}) => {\n return css`\n ${StyledInput} {\n width: calc(6 * ${spacing});\n }\n `;\n});\n\nStyledTableWrapper.defaultProps = defaultThemeProp;\n\nexport const StyledText = styled(Text)`\n ${ellipsisOverflow}\n`;\n"]}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare const getBackgroundPickerTestIds: (testIdProp?: import("@pega/cosmos-react-core").TestIdProp["testId"]) => import("@pega/cosmos-react-core").TestIdsRecord<readonly ["control", "overlay", "swatch-preview", "style", "label", "info", "additional-info", "suggestion-accept", "suggestion-reject"]>;
|
|
2
|
+
export declare const getSolidColorConfigTestIds: (testIdProp?: import("@pega/cosmos-react-core").TestIdProp["testId"]) => import("@pega/cosmos-react-core").TestIdsRecord<readonly ["color", "opacity", "color-preview"]>;
|
|
3
|
+
export declare const getImageConfigTestIds: (testIdProp?: import("@pega/cosmos-react-core").TestIdProp["testId"]) => import("@pega/cosmos-react-core").TestIdsRecord<readonly ["file-url", "opacity", "size", "position", "repeat", "image-preview"]>;
|
|
4
|
+
export declare const getGradientConfigTestIds: (testIdProp?: import("@pega/cosmos-react-core").TestIdProp["testId"]) => import("@pega/cosmos-react-core").TestIdsRecord<readonly ["direction", "position", "color-stops", "add-steps", "gradient-preview"]>;
|
|
5
|
+
//# sourceMappingURL=BackgroundPicker.test-ids.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BackgroundPicker.test-ids.d.ts","sourceRoot":"","sources":["../../../src/components/BackgroundPicker/BackgroundPicker.test-ids.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,0BAA0B,oQAM5B,CAAC;AAEZ,eAAO,MAAM,0BAA0B,0KAI5B,CAAC;AAEZ,eAAO,MAAM,qBAAqB,2MAOvB,CAAC;AAEZ,eAAO,MAAM,wBAAwB,8MAM1B,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { createTestIds } from '@pega/cosmos-react-core';
|
|
2
|
+
import { elements } from '@pega/cosmos-react-core/lib/components/FormField/FormField.test-ids';
|
|
3
|
+
export const getBackgroundPickerTestIds = createTestIds('background-picker', [
|
|
4
|
+
'control',
|
|
5
|
+
'overlay',
|
|
6
|
+
'swatch-preview',
|
|
7
|
+
'style',
|
|
8
|
+
...elements
|
|
9
|
+
]);
|
|
10
|
+
export const getSolidColorConfigTestIds = createTestIds('solid-color-config', [
|
|
11
|
+
'color',
|
|
12
|
+
'opacity',
|
|
13
|
+
'color-preview'
|
|
14
|
+
]);
|
|
15
|
+
export const getImageConfigTestIds = createTestIds('image-config', [
|
|
16
|
+
'file-url',
|
|
17
|
+
'opacity',
|
|
18
|
+
'size',
|
|
19
|
+
'position',
|
|
20
|
+
'repeat',
|
|
21
|
+
'image-preview'
|
|
22
|
+
]);
|
|
23
|
+
export const getGradientConfigTestIds = createTestIds('gradient-config', [
|
|
24
|
+
'direction',
|
|
25
|
+
'position',
|
|
26
|
+
'color-stops',
|
|
27
|
+
'add-steps',
|
|
28
|
+
'gradient-preview'
|
|
29
|
+
]);
|
|
30
|
+
//# sourceMappingURL=BackgroundPicker.test-ids.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BackgroundPicker.test-ids.js","sourceRoot":"","sources":["../../../src/components/BackgroundPicker/BackgroundPicker.test-ids.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,QAAQ,EAAE,MAAM,qEAAqE,CAAC;AAE/F,MAAM,CAAC,MAAM,0BAA0B,GAAG,aAAa,CAAC,mBAAmB,EAAE;IAC3E,SAAS;IACT,SAAS;IACT,gBAAgB;IAChB,OAAO;IACP,GAAG,QAAQ;CACH,CAAC,CAAC;AAEZ,MAAM,CAAC,MAAM,0BAA0B,GAAG,aAAa,CAAC,oBAAoB,EAAE;IAC5E,OAAO;IACP,SAAS;IACT,eAAe;CACP,CAAC,CAAC;AAEZ,MAAM,CAAC,MAAM,qBAAqB,GAAG,aAAa,CAAC,cAAc,EAAE;IACjE,UAAU;IACV,SAAS;IACT,MAAM;IACN,UAAU;IACV,QAAQ;IACR,eAAe;CACP,CAAC,CAAC;AAEZ,MAAM,CAAC,MAAM,wBAAwB,GAAG,aAAa,CAAC,iBAAiB,EAAE;IACvE,WAAW;IACX,UAAU;IACV,aAAa;IACb,WAAW;IACX,kBAAkB;CACV,CAAC,CAAC","sourcesContent":["import { createTestIds } from '@pega/cosmos-react-core';\nimport { elements } from '@pega/cosmos-react-core/lib/components/FormField/FormField.test-ids';\n\nexport const getBackgroundPickerTestIds = createTestIds('background-picker', [\n 'control',\n 'overlay',\n 'swatch-preview',\n 'style',\n ...elements\n] as const);\n\nexport const getSolidColorConfigTestIds = createTestIds('solid-color-config', [\n 'color',\n 'opacity',\n 'color-preview'\n] as const);\n\nexport const getImageConfigTestIds = createTestIds('image-config', [\n 'file-url',\n 'opacity',\n 'size',\n 'position',\n 'repeat',\n 'image-preview'\n] as const);\n\nexport const getGradientConfigTestIds = createTestIds('gradient-config', [\n 'direction',\n 'position',\n 'color-stops',\n 'add-steps',\n 'gradient-preview'\n] as const);\n"]}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import type { ColorStop } from 'css-gradient-parser';
|
|
2
|
+
import type { WithAttributes, TestIdProp, NoChildrenProp, FormControlProps, FormFieldProps, PropsWithDefaults } from '@pega/cosmos-react-core';
|
|
3
|
+
export type BackgroundPickerProps = WithAttributes<'input', TestIdProp & NoChildrenProp & {
|
|
4
|
+
/** label for the color picker control */
|
|
5
|
+
label: FormControlProps['label'];
|
|
6
|
+
/**
|
|
7
|
+
* Color picker value in hex
|
|
8
|
+
* @default '#000000'
|
|
9
|
+
*/
|
|
10
|
+
value: string;
|
|
11
|
+
/** List of options to render as background type */
|
|
12
|
+
backgroundOptions?: BackgroundType[];
|
|
13
|
+
/**
|
|
14
|
+
* Show color swatch without hex value display.
|
|
15
|
+
* @default false
|
|
16
|
+
*/
|
|
17
|
+
swatchOnly?: boolean;
|
|
18
|
+
/** Visually hides the label region. */
|
|
19
|
+
labelHidden?: FormControlProps['labelHidden'];
|
|
20
|
+
/** It is recommended to pass a simple string to offer guidance. Text will be styled based on status prop. */
|
|
21
|
+
info?: FormControlProps['info'];
|
|
22
|
+
/** Set visual state based on a validation state. */
|
|
23
|
+
status?: FormControlProps['status'];
|
|
24
|
+
/** Layout field elements inline in a row. */
|
|
25
|
+
inline?: FormFieldProps['inline'];
|
|
26
|
+
/** Button when clicked will show additional information on the color picker */
|
|
27
|
+
additionalInfo?: FormFieldProps['additionalInfo'];
|
|
28
|
+
/** event handler that gets called on submit of picker. */
|
|
29
|
+
onSubmit: (background: string) => void;
|
|
30
|
+
/** onBeforeClose of the color picker */
|
|
31
|
+
onBeforeClose?: () => void;
|
|
32
|
+
}>;
|
|
33
|
+
export type BackgroundPickerPropsWithDefaults = PropsWithDefaults<BackgroundPickerProps, 'value' | 'swatchOnly'>;
|
|
34
|
+
export type BackgroundType = 'automatic' | 'transparent' | 'solid-color' | 'image' | 'linear-gradient' | 'radial-gradient' | 'conic-gradient';
|
|
35
|
+
export declare const backgroundTypeTranslationKeyMap: {
|
|
36
|
+
automatic: "automatic";
|
|
37
|
+
transparent: "transparent";
|
|
38
|
+
'solid-color': "solid_color";
|
|
39
|
+
image: "image";
|
|
40
|
+
'linear-gradient': "linear_gradient";
|
|
41
|
+
'radial-gradient': "radial_gradient";
|
|
42
|
+
'conic-gradient': "conic_gradient";
|
|
43
|
+
};
|
|
44
|
+
export interface SolidColorConfigProps extends Pick<BackgroundPickerProps, 'value'>, TestIdProp {
|
|
45
|
+
disableOpacity?: boolean;
|
|
46
|
+
}
|
|
47
|
+
export type Size = 'auto' | 'cover' | 'contain';
|
|
48
|
+
export type Position = 'center' | 'top' | 'right' | 'bottom' | 'left' | 'top left' | 'top right' | 'bottom right' | 'bottom left';
|
|
49
|
+
export declare const positionTranslationKeyMap: {
|
|
50
|
+
center: "center";
|
|
51
|
+
top: "top";
|
|
52
|
+
right: "right";
|
|
53
|
+
bottom: "bottom";
|
|
54
|
+
left: "left";
|
|
55
|
+
'top left': "top_left";
|
|
56
|
+
'top right': "top_right";
|
|
57
|
+
'bottom right': "bottom_right";
|
|
58
|
+
'bottom left': "bottom_left";
|
|
59
|
+
};
|
|
60
|
+
export type Repeat = 'no-repeat' | 'repeat' | 'repeat-x' | 'repeat-y' | 'space' | 'round';
|
|
61
|
+
export declare const repeatTranslationKeyMap: {
|
|
62
|
+
'no-repeat': "no_repeat";
|
|
63
|
+
repeat: "repeat";
|
|
64
|
+
'repeat-x': "repeat_x";
|
|
65
|
+
'repeat-y': "repeat_y";
|
|
66
|
+
space: "space";
|
|
67
|
+
round: "round";
|
|
68
|
+
};
|
|
69
|
+
export interface BackgroundImage {
|
|
70
|
+
url: string;
|
|
71
|
+
backgroundSize: Size;
|
|
72
|
+
backgroundPosition: Position;
|
|
73
|
+
backgroundRepeat: Repeat;
|
|
74
|
+
}
|
|
75
|
+
export interface ImageConfigProps extends Pick<BackgroundPickerProps, 'value'>, TestIdProp {
|
|
76
|
+
}
|
|
77
|
+
export interface ConicGradient {
|
|
78
|
+
angle: string;
|
|
79
|
+
repeating: boolean;
|
|
80
|
+
position: string;
|
|
81
|
+
stops: ColorStop[];
|
|
82
|
+
}
|
|
83
|
+
export interface GradientConfigProps extends Pick<BackgroundPickerProps, 'value'>, TestIdProp {
|
|
84
|
+
type: BackgroundType;
|
|
85
|
+
}
|
|
86
|
+
export type TableData = {
|
|
87
|
+
id: string;
|
|
88
|
+
color: string;
|
|
89
|
+
location: string;
|
|
90
|
+
};
|
|
91
|
+
export interface GradientInputProps {
|
|
92
|
+
data: TableData;
|
|
93
|
+
onChange: (id: string, type: keyof TableData, value: string) => void;
|
|
94
|
+
}
|
|
95
|
+
export interface ComputedBackgroundRef {
|
|
96
|
+
getValue: () => string;
|
|
97
|
+
}
|
|
98
|
+
//# sourceMappingURL=BackgroundPicker.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BackgroundPicker.types.d.ts","sourceRoot":"","sources":["../../../src/components/BackgroundPicker/BackgroundPicker.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAErD,OAAO,KAAK,EACV,cAAc,EACd,UAAU,EACV,cAAc,EACd,gBAAgB,EAChB,cAAc,EACd,iBAAiB,EAElB,MAAM,yBAAyB,CAAC;AAEjC,MAAM,MAAM,qBAAqB,GAAG,cAAc,CAChD,OAAO,EACP,UAAU,GACR,cAAc,GAAG;IACf,yCAAyC;IACzC,KAAK,EAAE,gBAAgB,CAAC,OAAO,CAAC,CAAC;IACjC;;;OAGG;IACH,KAAK,EAAE,MAAM,CAAC;IACd,mDAAmD;IACnD,iBAAiB,CAAC,EAAE,cAAc,EAAE,CAAC;IACrC;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,uCAAuC;IACvC,WAAW,CAAC,EAAE,gBAAgB,CAAC,aAAa,CAAC,CAAC;IAC9C,6GAA6G;IAC7G,IAAI,CAAC,EAAE,gBAAgB,CAAC,MAAM,CAAC,CAAC;IAChC,oDAAoD;IACpD,MAAM,CAAC,EAAE,gBAAgB,CAAC,QAAQ,CAAC,CAAC;IACpC,6CAA6C;IAC7C,MAAM,CAAC,EAAE,cAAc,CAAC,QAAQ,CAAC,CAAC;IAClC,+EAA+E;IAC/E,cAAc,CAAC,EAAE,cAAc,CAAC,gBAAgB,CAAC,CAAC;IAClD,0DAA0D;IAC1D,QAAQ,EA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AO,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,SAAS,EAAE,CAAC;CACpB;AAED,MAAM,WAAW,mBAAoB,SAAQ,IAAI,CAAC,qBAAqB,EAAE,OAAO,CAAC,EAAE,UAAU;IAC3F,IAAI,EAAE,cAAc,CAAC;CACtB;AAED,MAAM,MAAM,SAAS,GAAG;IACtB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,SAAS,CAAC;IAChB,QAAQ,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,SAAS,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACtE;AAED,MAAM,WAAW,qBAAqB;IACpC,QAAQ,EAAE,MAAM,MAAM,CAAC;CACxB"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export const backgroundTypeTranslationKeyMap = {
|
|
2
|
+
automatic: 'automatic',
|
|
3
|
+
transparent: 'transparent',
|
|
4
|
+
'solid-color': 'solid_color',
|
|
5
|
+
image: 'image',
|
|
6
|
+
'linear-gradient': 'linear_gradient',
|
|
7
|
+
'radial-gradient': 'radial_gradient',
|
|
8
|
+
'conic-gradient': 'conic_gradient'
|
|
9
|
+
};
|
|
10
|
+
export const positionTranslationKeyMap = {
|
|
11
|
+
center: 'center',
|
|
12
|
+
top: 'top',
|
|
13
|
+
right: 'right',
|
|
14
|
+
bottom: 'bottom',
|
|
15
|
+
left: 'left',
|
|
16
|
+
'top left': 'top_left',
|
|
17
|
+
'top right': 'top_right',
|
|
18
|
+
'bottom right': 'bottom_right',
|
|
19
|
+
'bottom left': 'bottom_left'
|
|
20
|
+
};
|
|
21
|
+
export const repeatTranslationKeyMap = {
|
|
22
|
+
'no-repeat': 'no_repeat',
|
|
23
|
+
repeat: 'repeat',
|
|
24
|
+
'repeat-x': 'repeat_x',
|
|
25
|
+
'repeat-y': 'repeat_y',
|
|
26
|
+
space: 'space',
|
|
27
|
+
round: 'round'
|
|
28
|
+
};
|
|
29
|
+
//# sourceMappingURL=BackgroundPicker.types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BackgroundPicker.types.js","sourceRoot":"","sources":["../../../src/components/BackgroundPicker/BackgroundPicker.types.ts"],"names":[],"mappings":"AA6DA,MAAM,CAAC,MAAM,+BAA+B,GAAG;IAC7C,SAAS,EAAE,WAAW;IACtB,WAAW,EAAE,aAAa;IAC1B,aAAa,EAAE,aAAa;IAC5B,KAAK,EAAE,OAAO;IACd,iBAAiB,EAAE,iBAAiB;IACpC,iBAAiB,EAAE,iBAAiB;IACpC,gBAAgB,EAAE,gBAAgB;CAC6B,CAAC;AAmBlE,MAAM,CAAC,MAAM,yBAAyB,GAAG;IACvC,MAAM,EAAE,QAAQ;IAChB,GAAG,EAAE,KAAK;IACV,KAAK,EAAE,OAAO;IACd,MAAM,EAAE,QAAQ;IAChB,IAAI,EAAE,MAAM;IACZ,UAAU,EAAE,UAAU;IACtB,WAAW,EAAE,WAAW;IACxB,cAAc,EAAE,cAAc;IAC9B,aAAa,EAAE,aAAa;CAG7B,CAAC;AAIF,MAAM,CAAC,MAAM,uBAAuB,GAAG;IACrC,WAAW,EAAE,WAAW;IACxB,MAAM,EAAE,QAAQ;IAChB,UAAU,EAAE,UAAU;IACtB,UAAU,EAAE,UAAU;IACtB,KAAK,EAAE,OAAO;IACd,KAAK,EAAE,OAAO;CAGf,CAAC","sourcesContent":["import type { ColorStop } from 'css-gradient-parser';\n\nimport type {\n WithAttributes,\n TestIdProp,\n NoChildrenProp,\n FormControlProps,\n FormFieldProps,\n PropsWithDefaults,\n ReplaceString\n} from '@pega/cosmos-react-core';\n\nexport type BackgroundPickerProps = WithAttributes<\n 'input',\n TestIdProp &\n NoChildrenProp & {\n /** label for the color picker control */\n label: FormControlProps['label'];\n /**\n * Color picker value in hex\n * @default '#000000'\n */\n value: string;\n /** List of options to render as background type */\n backgroundOptions?: BackgroundType[];\n /**\n * Show color swatch without hex value display.\n * @default false\n */\n swatchOnly?: boolean;\n /** Visually hides the label region. */\n labelHidden?: FormControlProps['labelHidden'];\n /** It is recommended to pass a simple string to offer guidance. Text will be styled based on status prop. */\n info?: FormControlProps['info'];\n /** Set visual state based on a validation state. */\n status?: FormControlProps['status'];\n /** Layout field elements inline in a row. */\n inline?: FormFieldProps['inline'];\n /** Button when clicked will show additional information on the color picker */\n additionalInfo?: FormFieldProps['additionalInfo'];\n /** event handler that gets called on submit of picker. */\n onSubmit: (background: string) => void;\n /** onBeforeClose of the color picker */\n onBeforeClose?: () => void;\n }\n>;\n\nexport type BackgroundPickerPropsWithDefaults = PropsWithDefaults<\n BackgroundPickerProps,\n 'value' | 'swatchOnly'\n>;\n\nexport type BackgroundType =\n | 'automatic'\n | 'transparent'\n | 'solid-color'\n | 'image'\n | 'linear-gradient'\n | 'radial-gradient'\n | 'conic-gradient';\n\nexport const backgroundTypeTranslationKeyMap = {\n automatic: 'automatic',\n transparent: 'transparent',\n 'solid-color': 'solid_color',\n image: 'image',\n 'linear-gradient': 'linear_gradient',\n 'radial-gradient': 'radial_gradient',\n 'conic-gradient': 'conic_gradient'\n} satisfies { [K in BackgroundType]: ReplaceString<K, '-', '_'> };\n\nexport interface SolidColorConfigProps extends Pick<BackgroundPickerProps, 'value'>, TestIdProp {\n disableOpacity?: boolean;\n}\n\nexport type Size = 'auto' | 'cover' | 'contain';\n\nexport type Position =\n | 'center'\n | 'top'\n | 'right'\n | 'bottom'\n | 'left'\n | 'top left'\n | 'top right'\n | 'bottom right'\n | 'bottom left';\n\nexport const positionTranslationKeyMap = {\n center: 'center',\n top: 'top',\n right: 'right',\n bottom: 'bottom',\n left: 'left',\n 'top left': 'top_left',\n 'top right': 'top_right',\n 'bottom right': 'bottom_right',\n 'bottom left': 'bottom_left'\n} satisfies {\n [K in Position]: ReplaceString<K, ' ', '_'>;\n};\n\nexport type Repeat = 'no-repeat' | 'repeat' | 'repeat-x' | 'repeat-y' | 'space' | 'round';\n\nexport const repeatTranslationKeyMap = {\n 'no-repeat': 'no_repeat',\n repeat: 'repeat',\n 'repeat-x': 'repeat_x',\n 'repeat-y': 'repeat_y',\n space: 'space',\n round: 'round'\n} satisfies {\n [K in Repeat]: ReplaceString<K, '-', '_'>;\n};\n\nexport interface BackgroundImage {\n url: string;\n backgroundSize: Size;\n backgroundPosition: Position;\n backgroundRepeat: Repeat;\n}\n\nexport interface ImageConfigProps extends Pick<BackgroundPickerProps, 'value'>, TestIdProp {}\n\nexport interface ConicGradient {\n angle: string;\n repeating: boolean;\n position: string;\n stops: ColorStop[];\n}\n\nexport interface GradientConfigProps extends Pick<BackgroundPickerProps, 'value'>, TestIdProp {\n type: BackgroundType;\n}\n\nexport type TableData = {\n id: string;\n color: string;\n location: string;\n};\n\nexport interface GradientInputProps {\n data: TableData;\n onChange: (id: string, type: keyof TableData, value: string) => void;\n}\n\nexport interface ComputedBackgroundRef {\n getValue: () => string;\n}\n"]}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { GradientConfigProps, ComputedBackgroundRef } from './BackgroundPicker.types';
|
|
2
|
+
declare const _default: import("react").ForwardRefExoticComponent<GradientConfigProps & import("react").RefAttributes<ComputedBackgroundRef>> & {
|
|
3
|
+
getTestIds: (testIdProp?: import("@pega/cosmos-react-core").TestIdProp["testId"]) => import("@pega/cosmos-react-core").TestIdsRecord<readonly ["direction", "position", "color-stops", "add-steps", "gradient-preview"]>;
|
|
4
|
+
};
|
|
5
|
+
export default _default;
|
|
6
|
+
//# sourceMappingURL=GradientConfig.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GradientConfig.d.ts","sourceRoot":"","sources":["../../../src/components/BackgroundPicker/GradientConfig.tsx"],"names":[],"mappings":"AAiCA,OAAO,KAAK,EAGV,mBAAmB,EAEnB,qBAAqB,EAEtB,MAAM,0BAA0B,CAAC;;;;AAuQlC,wBAAqE"}
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef, useEffect, useImperativeHandle, useMemo, useState } from 'react';
|
|
3
|
+
import { registerIcon, useI18n, usePrevious, NumberInput, ColorPicker, createUID, useTestIds, Button, Icon, Select, Table, Flex, withTestIds, Text, Option } from '@pega/cosmos-react-core';
|
|
4
|
+
import * as trashIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/trash.icon';
|
|
5
|
+
import * as plusIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/plus.icon';
|
|
6
|
+
import { positionTranslationKeyMap } from './BackgroundPicker.types';
|
|
7
|
+
import { getGradientConfigTestIds } from './BackgroundPicker.test-ids';
|
|
8
|
+
import { StyledPreview, StyledTableWrapper, StyledFlex, StyledPreviewContainer } from './BackgroundPicker.styles';
|
|
9
|
+
import { getParsedGradientDetails } from './utils';
|
|
10
|
+
registerIcon(trashIcon, plusIcon);
|
|
11
|
+
const radialGradientPositions = [
|
|
12
|
+
'center',
|
|
13
|
+
'top',
|
|
14
|
+
'right',
|
|
15
|
+
'bottom',
|
|
16
|
+
'left',
|
|
17
|
+
'top left',
|
|
18
|
+
'top right',
|
|
19
|
+
'bottom right',
|
|
20
|
+
'bottom left'
|
|
21
|
+
];
|
|
22
|
+
const GradientLocationInput = ({ data: { id, location }, onChange }) => {
|
|
23
|
+
const [value, setValue] = useState(location);
|
|
24
|
+
const t = useI18n();
|
|
25
|
+
const prev = usePrevious(location);
|
|
26
|
+
useEffect(() => {
|
|
27
|
+
if (prev !== location)
|
|
28
|
+
setValue(location === undefined ? undefined : `${location}`);
|
|
29
|
+
}, [prev, location]);
|
|
30
|
+
return (_jsx(NumberInput, { label: t('location'), labelHidden: true, value: value, onChange: inputValue => {
|
|
31
|
+
setValue(inputValue);
|
|
32
|
+
onChange(id, 'location', inputValue);
|
|
33
|
+
}, unit: '%', maxLength: 4, max: 99 }));
|
|
34
|
+
};
|
|
35
|
+
const GradientColorPicker = ({ data: { id, color }, onChange }) => {
|
|
36
|
+
const [value, setValue] = useState(color);
|
|
37
|
+
return (_jsx(ColorPicker, { value: value, label: '', labelHidden: true, onChange: e => {
|
|
38
|
+
setValue(e.hex);
|
|
39
|
+
onChange(id, 'color', e.hex);
|
|
40
|
+
} }));
|
|
41
|
+
};
|
|
42
|
+
const GradientConfig = forwardRef(function GradientConfig({ testId, type, value }, ref) {
|
|
43
|
+
const gradientObj = getParsedGradientDetails(type, value);
|
|
44
|
+
const [gradients, setGradients] = useState(() => {
|
|
45
|
+
return gradientObj.stops.map((item, index) => {
|
|
46
|
+
return {
|
|
47
|
+
id: index === gradientObj.stops.length - 1 ? 'end' : createUID(),
|
|
48
|
+
color: item.color,
|
|
49
|
+
location: item.offset?.value
|
|
50
|
+
};
|
|
51
|
+
});
|
|
52
|
+
});
|
|
53
|
+
const [gradientDirection, setGradientDirection] = useState(() => {
|
|
54
|
+
if (type === 'linear-gradient') {
|
|
55
|
+
if (gradientObj.orientation.type === 'directional') {
|
|
56
|
+
switch (gradientObj.orientation.value) {
|
|
57
|
+
case 'bottom':
|
|
58
|
+
return '180';
|
|
59
|
+
case 'left':
|
|
60
|
+
return '270';
|
|
61
|
+
case 'top':
|
|
62
|
+
return '0';
|
|
63
|
+
case 'right':
|
|
64
|
+
default:
|
|
65
|
+
return '90';
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
else {
|
|
69
|
+
return gradientObj.orientation.value.value;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
if (type === 'conic-gradient') {
|
|
73
|
+
return gradientObj.angle.split('deg')[0];
|
|
74
|
+
}
|
|
75
|
+
return '90';
|
|
76
|
+
});
|
|
77
|
+
const [radialGradientPosition, setRadialGradientPosition] = useState(() => {
|
|
78
|
+
if (type === 'radial-gradient') {
|
|
79
|
+
if (['left', 'right'].includes(gradientObj.position.y.value)) {
|
|
80
|
+
return `${gradientObj.position.x.value} ${gradientObj.position.y.value}`;
|
|
81
|
+
}
|
|
82
|
+
return `${gradientObj.position.x.value}`;
|
|
83
|
+
}
|
|
84
|
+
return 'center';
|
|
85
|
+
});
|
|
86
|
+
const testIds = useTestIds(testId, getGradientConfigTestIds);
|
|
87
|
+
const t = useI18n();
|
|
88
|
+
const onGradientChange = (id, key, updatedValue) => {
|
|
89
|
+
setGradients((x) => {
|
|
90
|
+
const y = [...x];
|
|
91
|
+
const el = y.find(z => z.id === id);
|
|
92
|
+
el[key] = updatedValue;
|
|
93
|
+
return y;
|
|
94
|
+
});
|
|
95
|
+
};
|
|
96
|
+
const onGradientDirectionChange = (updatedValue) => {
|
|
97
|
+
setGradientDirection(updatedValue);
|
|
98
|
+
};
|
|
99
|
+
const columns = useMemo(() => [
|
|
100
|
+
{
|
|
101
|
+
renderer: data => _jsx(GradientColorPicker, { data: data, onChange: onGradientChange }),
|
|
102
|
+
label: t('color')
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
renderer: data => {
|
|
106
|
+
return data.id !== 'end' ? (_jsx(GradientLocationInput, { data: data, onChange: onGradientChange })) : (_jsxs(Text, { children: [data.location, "%"] }));
|
|
107
|
+
},
|
|
108
|
+
label: t('location')
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
renderer: data => {
|
|
112
|
+
return data.id !== 'end' ? (_jsx(Button, { variant: 'text', label: t('delete_stop'), icon: true, compact: true, onClick: () => setGradients(x => x.filter(y => y.id !== data.id)), children: _jsx(Icon, { name: 'trash' }) })) : null;
|
|
113
|
+
},
|
|
114
|
+
label: '',
|
|
115
|
+
noWrap: true
|
|
116
|
+
}
|
|
117
|
+
], []);
|
|
118
|
+
const addSteps = () => {
|
|
119
|
+
const newStep = {
|
|
120
|
+
id: createUID(),
|
|
121
|
+
color: '#ffffff',
|
|
122
|
+
location: '10'
|
|
123
|
+
};
|
|
124
|
+
setGradients(x => {
|
|
125
|
+
const y = [...x];
|
|
126
|
+
y.splice(y.length - 1, 0, newStep);
|
|
127
|
+
return y;
|
|
128
|
+
});
|
|
129
|
+
};
|
|
130
|
+
const computedGradient = useMemo(() => {
|
|
131
|
+
if (type === 'linear-gradient') {
|
|
132
|
+
return `linear-gradient(${gradientDirection}deg, ${gradients.map(x => `${x.color} ${x.location}%`).join(', ')})`;
|
|
133
|
+
}
|
|
134
|
+
if (type === 'conic-gradient') {
|
|
135
|
+
return `conic-gradient(from ${gradientDirection}deg, ${gradients.map(x => `${x.color} ${x.location}%`).join(', ')})`;
|
|
136
|
+
}
|
|
137
|
+
return `radial-gradient(at ${radialGradientPosition}, ${gradients.map(x => `${x.color} ${x.location}%`).join(', ')})`;
|
|
138
|
+
}, [type, gradientDirection, gradients, radialGradientPosition]);
|
|
139
|
+
useImperativeHandle(ref, () => ({
|
|
140
|
+
getValue: () => computedGradient
|
|
141
|
+
}));
|
|
142
|
+
return (_jsxs(StyledFlex, { container: { direction: 'column', gap: 1 }, children: [type === 'radial-gradient' ? (_jsx(Select, { testId: testIds.position, value: radialGradientPosition, label: t('position'), onChange: e => {
|
|
143
|
+
setRadialGradientPosition(e.target.value);
|
|
144
|
+
}, children: radialGradientPositions.map(position => {
|
|
145
|
+
return (_jsx(Option, { value: position, children: t(positionTranslationKeyMap[position]) }, position));
|
|
146
|
+
}) })) : (_jsx(NumberInput, { testId: testIds.direction, label: t('direction'), variant: 'stepper', value: gradientDirection, unit: 'degree', max: 360, min: 0, step: 1, onChange: onGradientDirectionChange })), _jsxs(StyledTableWrapper, { container: { direction: 'column', gap: 1, alignItems: 'start' }, children: [_jsx(Table, { "data-testid": testIds.colorStops, title: t('color_stops'), columns: columns, data: gradients }), _jsxs(Flex, { "data-testid": testIds.addSteps, container: { gap: 1 }, as: Button, variant: 'simple', onClick: addSteps, children: [_jsx(Icon, { name: 'plus' }), " ", t('add_stops')] })] }), _jsxs(Flex, { "data-testid": testIds.gradientPreview, container: { direction: 'column', gap: 1 }, children: [_jsx(Text, { variant: 'h3', children: t('gradient_preview') }), _jsx(StyledPreviewContainer, { children: _jsx(StyledPreview, { "aria-label": t('gradient_preview'), background: computedGradient }) })] })] }));
|
|
147
|
+
});
|
|
148
|
+
export default withTestIds(GradientConfig, getGradientConfigTestIds);
|
|
149
|
+
//# sourceMappingURL=GradientConfig.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GradientConfig.js","sourceRoot":"","sources":["../../../src/components/BackgroundPicker/GradientConfig.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,UAAU,EACV,SAAS,EACT,mBAAmB,EACnB,OAAO,EACP,QAAQ,EAGT,MAAM,OAAO,CAAC;AAGf,OAAO,EACL,YAAY,EACZ,OAAO,EACP,WAAW,EACX,WAAW,EACX,WAAW,EACX,SAAS,EACT,UAAU,EAEV,MAAM,EACN,IAAI,EACJ,MAAM,EACN,KAAK,EACL,IAAI,EACJ,WAAW,EACX,IAAI,EACJ,MAAM,EACP,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,SAAS,MAAM,8DAA8D,CAAC;AAC1F,OAAO,KAAK,QAAQ,MAAM,6DAA6D,CAAC;AAExF,OAAO,EAAE,yBAAyB,EAAE,MAAM,0BAA0B,CAAC;AASrE,OAAO,EAAE,wBAAwB,EAAE,MAAM,6BAA6B,CAAC;AACvE,OAAO,EACL,aAAa,EACb,kBAAkB,EAClB,UAAU,EACV,sBAAsB,EACvB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,wBAAwB,EAAE,MAAM,SAAS,CAAC;AAEnD,YAAY,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;AAElC,MAAM,uBAAuB,GAAG;IAC9B,QAAQ;IACR,KAAK;IACL,OAAO;IACP,QAAQ;IACR,MAAM;IACN,UAAU;IACV,WAAW;IACX,cAAc;IACd,aAAa;CACgB,CAAC;AAEhC,MAAM,qBAAqB,GAAG,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,EAAE,QAAQ,EAAE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EAAE,SAAS,GACf,EACF,MAAC,IAAI,mBACU,OAAO,CAAC,QAAQ,EAC7B,SAAS,EAAE,EAAE,GAAG,EAAE,CAAC,EAAE,EACrB,EAAE,EAAE,MAAM,EACV,OAAO,EAAC,QAAQ,EAChB,OAAO,EAAE,QAAQ,aAEjB,KAAC,IAAI,IAAC,IAAI,EAAC,MAAM,GAAG,OAAE,CAAC,CAAC,WAAW,CAAC,IAC/B,IACY,EACrB,MAAC,IAAI,mBAAc,OAAO,CAAC,eAAe,EAAE,SAAS,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,EAAE,aACpF,KAAC,IAAI,IAAC,OAAO,EAAC,IAAI,YAAE,CAAC,CAAC,kBAAkB,CAAC,GAAQ,EACjD,KAAC,sBAAsB,cACrB,KAAC,aAAa,kBAAa,CAAC,CAAC,kBAAkB,CAAC,EAAE,UAAU,EAAE,gBAAgB,GAAI,GAC3D,IACpB,IACI,CACd,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,eAAe,WAAW,CAAC,cAAc,EAAE,wBAAwB,CAAC,CAAC","sourcesContent":["import {\n forwardRef,\n useEffect,\n useImperativeHandle,\n useMemo,\n useState,\n type PropsWithoutRef,\n type Ref\n} from 'react';\nimport type { LinearResult, RadialResult } from 'css-gradient-parser';\n\nimport {\n registerIcon,\n useI18n,\n usePrevious,\n NumberInput,\n ColorPicker,\n createUID,\n useTestIds,\n type ColumnProps,\n Button,\n Icon,\n Select,\n Table,\n Flex,\n withTestIds,\n Text,\n Option\n} from '@pega/cosmos-react-core';\nimport * as trashIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/trash.icon';\nimport * as plusIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/plus.icon';\n\nimport { positionTranslationKeyMap } from './BackgroundPicker.types';\nimport type {\n ConicGradient,\n GradientInputProps,\n GradientConfigProps,\n TableData,\n ComputedBackgroundRef,\n Position\n} from './BackgroundPicker.types';\nimport { getGradientConfigTestIds } from './BackgroundPicker.test-ids';\nimport {\n StyledPreview,\n StyledTableWrapper,\n StyledFlex,\n StyledPreviewContainer\n} from './BackgroundPicker.styles';\nimport { getParsedGradientDetails } from './utils';\n\nregisterIcon(trashIcon, plusIcon);\n\nconst radialGradientPositions = [\n 'center',\n 'top',\n 'right',\n 'bottom',\n 'left',\n 'top left',\n 'top right',\n 'bottom right',\n 'bottom left'\n] as const satisfies Position[];\n\nconst GradientLocationInput = ({ data: { id, location }, onChange }: GradientInputProps) => {\n const [value, setValue] = useState<string | undefined>(location);\n const t = useI18n();\n\n const prev = usePrevious(location);\n useEffect(() => {\n if (prev !== location) setValue(location === undefined ? undefined : `${location}`);\n }, [prev, location]);\n\n return (\n <NumberInput\n label={t('location')}\n labelHidden\n value={value}\n onChange={inputValue => {\n setValue(inputValue);\n onChange(id, 'location', inputValue);\n }}\n unit='%'\n maxLength={4}\n max={99}\n />\n );\n};\n\nconst GradientColorPicker = ({ data: { id, color }, onChange }: GradientInputProps) => {\n const [value, setValue] = useState(color);\n\n return (\n <ColorPicker\n value={value}\n label=''\n labelHidden\n onChange={e => {\n setValue(e.hex);\n onChange(id, 'color', e.hex);\n }}\n />\n );\n};\n\nconst GradientConfig = forwardRef(function GradientConfig(\n { testId, type, value }: PropsWithoutRef<GradientConfigProps>,\n ref: Ref<ComputedBackgroundRef>\n) {\n const gradientObj: LinearResult | ConicGradient | RadialResult = getParsedGradientDetails(\n type,\n value\n );\n const [gradients, setGradients] = useState<TableData[]>(() => {\n return gradientObj.stops.map((item, index) => {\n return {\n id: index === gradientObj.stops.length - 1 ? 'end' : createUID(),\n color: item.color,\n location: item.offset?.value\n } as TableData;\n });\n });\n const [gradientDirection, setGradientDirection] = useState(() => {\n if (type === 'linear-gradient') {\n if ((gradientObj as LinearResult).orientation.type === 'directional') {\n switch ((gradientObj as LinearResult).orientation.value) {\n case 'bottom':\n return '180';\n case 'left':\n return '270';\n case 'top':\n return '0';\n case 'right':\n default:\n return '90';\n }\n } else {\n return (\n (gradientObj as LinearResult).orientation.value as {\n unit: string;\n value: string;\n }\n ).value;\n }\n }\n if (type === 'conic-gradient') {\n return (gradientObj as ConicGradient).angle.split('deg')[0];\n }\n return '90';\n });\n\n const [radialGradientPosition, setRadialGradientPosition] = useState<Position>(() => {\n if (type === 'radial-gradient') {\n if (['left', 'right'].includes((gradientObj as RadialResult).position.y.value as string)) {\n return `${(gradientObj as RadialResult).position.x.value as string} ${(gradientObj as RadialResult).position.y.value as string}` as Position;\n }\n return `${(gradientObj as RadialResult).position.x.value as string}` as Position;\n }\n return 'center';\n });\n\n const testIds = useTestIds(testId, getGradientConfigTestIds);\n const t = useI18n();\n\n const onGradientChange = (id: string, key: keyof TableData, updatedValue: string) => {\n setGradients((x: TableData[]) => {\n const y = [...x];\n const el = y.find(z => z.id === id)!;\n el[key] = updatedValue;\n return y;\n });\n };\n\n const onGradientDirectionChange = (updatedValue: string) => {\n setGradientDirection(updatedValue);\n };\n\n const columns: ColumnProps<TableData>[] = useMemo(\n () => [\n {\n renderer: data => <GradientColorPicker data={data} onChange={onGradientChange} />,\n label: t('color')\n },\n {\n renderer: data => {\n return data.id !== 'end' ? (\n <GradientLocationInput data={data} onChange={onGradientChange} />\n ) : (\n <Text>{data.location}%</Text>\n );\n },\n label: t('location')\n },\n {\n renderer: data => {\n return data.id !== 'end' ? (\n <Button\n variant='text'\n label={t('delete_stop')}\n icon\n compact\n onClick={() => setGradients(x => x.filter(y => y.id !== data.id))}\n >\n <Icon name='trash' />\n </Button>\n ) : null;\n },\n label: '',\n noWrap: true\n }\n ],\n []\n );\n\n const addSteps = () => {\n const newStep: TableData = {\n id: createUID(),\n color: '#ffffff',\n location: '10'\n };\n\n setGradients(x => {\n const y = [...x];\n y.splice(y.length - 1, 0, newStep);\n return y;\n });\n };\n\n const computedGradient = useMemo(() => {\n if (type === 'linear-gradient') {\n return `linear-gradient(${gradientDirection}deg, ${gradients.map(x => `${x.color} ${x.location}%`).join(', ')})`;\n }\n if (type === 'conic-gradient') {\n return `conic-gradient(from ${gradientDirection}deg, ${gradients.map(x => `${x.color} ${x.location}%`).join(', ')})`;\n }\n\n return `radial-gradient(at ${radialGradientPosition}, ${gradients.map(x => `${x.color} ${x.location}%`).join(', ')})`;\n }, [type, gradientDirection, gradients, radialGradientPosition]);\n\n useImperativeHandle(ref, () => ({\n getValue: () => computedGradient\n }));\n\n return (\n <StyledFlex container={{ direction: 'column', gap: 1 }}>\n {type === 'radial-gradient' ? (\n <Select\n testId={testIds.position}\n value={radialGradientPosition}\n label={t('position')}\n onChange={e => {\n setRadialGradientPosition(e.target.value as Position);\n }}\n >\n {radialGradientPositions.map(position => {\n return (\n <Option key={position} value={position}>\n {t(positionTranslationKeyMap[position])}\n </Option>\n );\n })}\n </Select>\n ) : (\n <NumberInput\n testId={testIds.direction}\n label={t('direction')}\n variant='stepper'\n value={gradientDirection}\n unit='degree'\n max={360}\n min={0}\n step={1}\n onChange={onGradientDirectionChange}\n />\n )}\n\n <StyledTableWrapper container={{ direction: 'column', gap: 1, alignItems: 'start' }}>\n <Table\n data-testid={testIds.colorStops}\n title={t('color_stops')}\n columns={columns}\n data={gradients}\n />\n <Flex\n data-testid={testIds.addSteps}\n container={{ gap: 1 }}\n as={Button}\n variant='simple'\n onClick={addSteps}\n >\n <Icon name='plus' /> {t('add_stops')}\n </Flex>\n </StyledTableWrapper>\n <Flex data-testid={testIds.gradientPreview} container={{ direction: 'column', gap: 1 }}>\n <Text variant='h3'>{t('gradient_preview')}</Text>\n <StyledPreviewContainer>\n <StyledPreview aria-label={t('gradient_preview')} background={computedGradient} />\n </StyledPreviewContainer>\n </Flex>\n </StyledFlex>\n );\n});\n\nexport default withTestIds(GradientConfig, getGradientConfigTestIds);\n"]}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { ImageConfigProps, ComputedBackgroundRef } from './BackgroundPicker.types';
|
|
2
|
+
declare const _default: import("react").ForwardRefExoticComponent<ImageConfigProps & import("react").RefAttributes<ComputedBackgroundRef>> & {
|
|
3
|
+
getTestIds: (testIdProp?: import("@pega/cosmos-react-core").TestIdProp["testId"]) => import("@pega/cosmos-react-core").TestIdsRecord<readonly ["file-url", "opacity", "size", "position", "repeat", "image-preview"]>;
|
|
4
|
+
};
|
|
5
|
+
export default _default;
|
|
6
|
+
//# sourceMappingURL=ImageConfig.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ImageConfig.d.ts","sourceRoot":"","sources":["../../../src/components/BackgroundPicker/ImageConfig.tsx"],"names":[],"mappings":"AAsBA,OAAO,KAAK,EAKV,gBAAgB,EAChB,qBAAqB,EACtB,MAAM,0BAA0B,CAAC;;;;AAyHlC,wBAA+D"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef, useImperativeHandle, useMemo, useState } from 'react';
|
|
3
|
+
import { useTestIds, useI18n, Flex, Input, Select, Option, withTestIds, Text } from '@pega/cosmos-react-core';
|
|
4
|
+
import { getImageConfigTestIds } from './BackgroundPicker.test-ids';
|
|
5
|
+
import { repeatTranslationKeyMap, positionTranslationKeyMap } from './BackgroundPicker.types';
|
|
6
|
+
import { StyledPreview, StyledPreviewContainer } from './BackgroundPicker.styles';
|
|
7
|
+
import { getBackgroundImageDetails } from './utils';
|
|
8
|
+
const sizeOptions = ['auto', 'cover', 'contain'];
|
|
9
|
+
const positionOptions = [
|
|
10
|
+
'center',
|
|
11
|
+
'top',
|
|
12
|
+
'right',
|
|
13
|
+
'bottom',
|
|
14
|
+
'left',
|
|
15
|
+
'top left',
|
|
16
|
+
'top right',
|
|
17
|
+
'bottom right',
|
|
18
|
+
'bottom left'
|
|
19
|
+
];
|
|
20
|
+
const repeatOptions = [
|
|
21
|
+
'no-repeat',
|
|
22
|
+
'repeat',
|
|
23
|
+
'repeat-x',
|
|
24
|
+
'repeat-y',
|
|
25
|
+
'space',
|
|
26
|
+
'round'
|
|
27
|
+
];
|
|
28
|
+
const ImageConfig = forwardRef(function ImageConfig({ testId, value }, ref) {
|
|
29
|
+
const backgroundObj = getBackgroundImageDetails(value);
|
|
30
|
+
const [imageURL, setImageURL] = useState(backgroundObj.url);
|
|
31
|
+
const [backgroundSize, setBackgroundSize] = useState(backgroundObj.backgroundSize);
|
|
32
|
+
const [backgroundPosition, setBackgroundPosition] = useState(backgroundObj.backgroundPosition);
|
|
33
|
+
const [backgroundRepeat, setBackgroundRepeat] = useState(backgroundObj.backgroundRepeat);
|
|
34
|
+
const [invalidURL, setInvalidURL] = useState(false);
|
|
35
|
+
const [showError, setShowError] = useState(false);
|
|
36
|
+
const testIds = useTestIds(testId, getImageConfigTestIds);
|
|
37
|
+
const t = useI18n();
|
|
38
|
+
const background = useMemo(() => {
|
|
39
|
+
return `url(${invalidURL ? '' : imageURL}) ${backgroundPosition} / ${backgroundSize} ${backgroundRepeat}`;
|
|
40
|
+
}, [imageURL, backgroundPosition, backgroundRepeat, backgroundSize]);
|
|
41
|
+
useImperativeHandle(ref, () => ({
|
|
42
|
+
getValue: () => background
|
|
43
|
+
}));
|
|
44
|
+
return (_jsxs(Flex, { container: { direction: 'column', gap: 0.5 }, children: [_jsx(Input, { testId: testIds.fileUrl, type: 'url', value: imageURL, label: t('file_url'), info: showError ? t('file_url_error') : undefined, status: showError ? 'error' : undefined, onChange: e => {
|
|
45
|
+
setShowError(false);
|
|
46
|
+
setImageURL(e.target.value);
|
|
47
|
+
try {
|
|
48
|
+
const newUrl = new URL(e.target.value);
|
|
49
|
+
if (['http:', 'https:'].includes(newUrl.protocol)) {
|
|
50
|
+
setInvalidURL(false);
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
setInvalidURL(true);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
catch {
|
|
57
|
+
setInvalidURL(true);
|
|
58
|
+
}
|
|
59
|
+
}, onBlur: () => {
|
|
60
|
+
setShowError(invalidURL);
|
|
61
|
+
} }), _jsx(Select, { testId: testIds.size, label: t('size'), value: backgroundSize, onChange: e => setBackgroundSize(e.target.value), children: sizeOptions.map(option => (_jsx(Option, { value: option, children: t(option) }, option))) }), _jsx(Select, { testId: testIds.position, label: t('position'), value: backgroundPosition, onChange: e => setBackgroundPosition(e.target.value), children: positionOptions.map(option => (_jsx(Option, { value: option, children: t(positionTranslationKeyMap[option]) }, option))) }), _jsx(Select, { testId: testIds.repeat, label: t('repeat'), value: backgroundRepeat, onChange: e => setBackgroundRepeat(e.target.value), children: repeatOptions.map(option => (_jsx(Option, { value: option, children: t(repeatTranslationKeyMap[option]) }, option))) }), _jsxs(Flex, { "data-testid": testIds.imagePreview, container: { direction: 'column', gap: 1 }, children: [_jsx(Text, { variant: 'h3', children: t('image_preview') }), _jsx(StyledPreviewContainer, { children: _jsx(StyledPreview, { background: background, "aria-label": t('image_preview') }) })] })] }));
|
|
62
|
+
});
|
|
63
|
+
export default withTestIds(ImageConfig, getImageConfigTestIds);
|
|
64
|
+
//# sourceMappingURL=ImageConfig.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ImageConfig.js","sourceRoot":"","sources":["../../../src/components/BackgroundPicker/ImageConfig.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,UAAU,EACV,mBAAmB,EACnB,OAAO,EACP,QAAQ,EAGT,MAAM,OAAO,CAAC;AAEf,OAAO,EACL,UAAU,EACV,OAAO,EACP,IAAI,EACJ,KAAK,EACL,MAAM,EACN,MAAM,EACN,WAAW,EACX,IAAI,EACL,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AACpE,OAAO,EAAE,uBAAuB,EAAE,yBAAyB,EAAE,MAAM,0BAA0B,CAAC;AAS9F,OAAO,EAAE,aAAa,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AAClF,OAAO,EAAE,yBAAyB,EAAE,MAAM,SAAS,CAAC;AAEpD,MAAM,WAAW,GAAG,CAA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EV,CACV,CAAC,GACK,EACT,MAAC,IAAI,mBAAc,OAAO,CAAC,YAAY,EAAE,SAAS,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,EAAE,aACjF,KAAC,IAAI,IAAC,OAAO,EAAC,IAAI,YAAE,CAAC,CAAC,eAAe,CAAC,GAAQ,EAC9C,KAAC,sBAAsB,cACrB,KAAC,aAAa,IAAC,UAAU,EAAE,UAAU,gBAAc,CAAC,CAAC,eAAe,CAAC,GAAI,GAClD,IACpB,IACF,CACR,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,eAAe,WAAW,CAAC,WAAW,EAAE,qBAAqB,CAAC,CAAC","sourcesContent":["import {\n forwardRef,\n useImperativeHandle,\n useMemo,\n useState,\n type PropsWithoutRef,\n type Ref\n} from 'react';\n\nimport {\n useTestIds,\n useI18n,\n Flex,\n Input,\n Select,\n Option,\n withTestIds,\n Text\n} from '@pega/cosmos-react-core';\n\nimport { getImageConfigTestIds } from './BackgroundPicker.test-ids';\nimport { repeatTranslationKeyMap, positionTranslationKeyMap } from './BackgroundPicker.types';\nimport type {\n BackgroundImage,\n Size,\n Repeat,\n Position,\n ImageConfigProps,\n ComputedBackgroundRef\n} from './BackgroundPicker.types';\nimport { StyledPreview, StyledPreviewContainer } from './BackgroundPicker.styles';\nimport { getBackgroundImageDetails } from './utils';\n\nconst sizeOptions = ['auto', 'cover', 'contain'] as const satisfies Size[];\nconst positionOptions = [\n 'center',\n 'top',\n 'right',\n 'bottom',\n 'left',\n 'top left',\n 'top right',\n 'bottom right',\n 'bottom left'\n] as const satisfies Position[];\nconst repeatOptions = [\n 'no-repeat',\n 'repeat',\n 'repeat-x',\n 'repeat-y',\n 'space',\n 'round'\n] as const satisfies Repeat[];\n\nconst ImageConfig = forwardRef(function ImageConfig(\n { testId, value }: PropsWithoutRef<ImageConfigProps>,\n ref: Ref<ComputedBackgroundRef>\n) {\n const backgroundObj: BackgroundImage = getBackgroundImageDetails(value);\n\n const [imageURL, setImageURL] = useState(backgroundObj.url);\n const [backgroundSize, setBackgroundSize] = useState(backgroundObj.backgroundSize);\n const [backgroundPosition, setBackgroundPosition] = useState(backgroundObj.backgroundPosition);\n const [backgroundRepeat, setBackgroundRepeat] = useState(backgroundObj.backgroundRepeat);\n const [invalidURL, setInvalidURL] = useState(false);\n const [showError, setShowError] = useState(false);\n const testIds = useTestIds(testId, getImageConfigTestIds);\n const t = useI18n();\n\n const background = useMemo(() => {\n return `url(${invalidURL ? '' : imageURL}) ${backgroundPosition} / ${backgroundSize} ${backgroundRepeat}`;\n }, [imageURL, backgroundPosition, backgroundRepeat, backgroundSize]);\n\n useImperativeHandle(ref, () => ({\n getValue: () => background\n }));\n\n return (\n <Flex container={{ direction: 'column', gap: 0.5 }}>\n <Input\n testId={testIds.fileUrl}\n type='url'\n value={imageURL}\n label={t('file_url')}\n info={showError ? t('file_url_error') : undefined}\n status={showError ? 'error' : undefined}\n onChange={e => {\n setShowError(false);\n setImageURL(e.target.value);\n try {\n const newUrl = new URL(e.target.value);\n if (['http:', 'https:'].includes(newUrl.protocol)) {\n setInvalidURL(false);\n } else {\n setInvalidURL(true);\n }\n } catch {\n setInvalidURL(true);\n }\n }}\n onBlur={() => {\n setShowError(invalidURL);\n }}\n />\n <Select\n testId={testIds.size}\n label={t('size')}\n value={backgroundSize}\n onChange={e => setBackgroundSize(e.target.value as Size)}\n >\n {sizeOptions.map(option => (\n <Option key={option} value={option}>\n {t(option)}\n </Option>\n ))}\n </Select>\n <Select\n testId={testIds.position}\n label={t('position')}\n value={backgroundPosition}\n onChange={e => setBackgroundPosition(e.target.value as Position)}\n >\n {positionOptions.map(option => (\n <Option key={option} value={option}>\n {t(positionTranslationKeyMap[option])}\n </Option>\n ))}\n </Select>\n <Select\n testId={testIds.repeat}\n label={t('repeat')}\n value={backgroundRepeat}\n onChange={e => setBackgroundRepeat(e.target.value as Repeat)}\n >\n {repeatOptions.map(option => (\n <Option key={option} value={option}>\n {t(repeatTranslationKeyMap[option])}\n </Option>\n ))}\n </Select>\n <Flex data-testid={testIds.imagePreview} container={{ direction: 'column', gap: 1 }}>\n <Text variant='h3'>{t('image_preview')}</Text>\n <StyledPreviewContainer>\n <StyledPreview background={background} aria-label={t('image_preview')} />\n </StyledPreviewContainer>\n </Flex>\n </Flex>\n );\n});\n\nexport default withTestIds(ImageConfig, getImageConfigTestIds);\n"]}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { ComputedBackgroundRef, SolidColorConfigProps } from './BackgroundPicker.types';
|
|
2
|
+
declare const _default: import("react").ForwardRefExoticComponent<SolidColorConfigProps & import("react").RefAttributes<ComputedBackgroundRef>> & {
|
|
3
|
+
getTestIds: (testIdProp?: import("@pega/cosmos-react-core").TestIdProp["testId"]) => import("@pega/cosmos-react-core").TestIdsRecord<readonly ["color", "opacity", "color-preview"]>;
|
|
4
|
+
};
|
|
5
|
+
export default _default;
|
|
6
|
+
//# sourceMappingURL=SolidColorConfig.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SolidColorConfig.d.ts","sourceRoot":"","sources":["../../../src/components/BackgroundPicker/SolidColorConfig.tsx"],"names":[],"mappings":"AAuBA,OAAO,KAAK,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;;;;AAwD7F,wBAAyE"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef, useImperativeHandle, useMemo, useState } from 'react';
|
|
3
|
+
import { parseToRgb, rgb, transparentize } from 'polished';
|
|
4
|
+
import { tryCatch, useTestIds, useI18n, Flex, ColorPicker, Slider, withTestIds, Text } from '@pega/cosmos-react-core';
|
|
5
|
+
import { getSolidColorConfigTestIds } from './BackgroundPicker.test-ids';
|
|
6
|
+
import { StyledPreviewContainer, StyledPreview } from './BackgroundPicker.styles';
|
|
7
|
+
const SolidColorConfig = forwardRef(function SolidColorConfig({ testId, value, disableOpacity }, ref) {
|
|
8
|
+
const { alpha, ...rgbSpectrum } = tryCatch(() => parseToRgb(value), () => parseToRgb('#fff'));
|
|
9
|
+
const [color, setColor] = useState(rgb(rgbSpectrum));
|
|
10
|
+
const [opacity, setOpacity] = useState((alpha ?? 1) * 100);
|
|
11
|
+
const testIds = useTestIds(testId, getSolidColorConfigTestIds);
|
|
12
|
+
const t = useI18n();
|
|
13
|
+
const background = useMemo(() => {
|
|
14
|
+
return transparentize(1 - opacity / 100, color);
|
|
15
|
+
}, [opacity, color]);
|
|
16
|
+
useImperativeHandle(ref, () => ({
|
|
17
|
+
getValue: () => background
|
|
18
|
+
}));
|
|
19
|
+
return (_jsxs(Flex, { container: { direction: 'column', gap: 1 }, children: [_jsx(ColorPicker, { testId: testIds.color, label: t('color'), value: color, onChange: e => {
|
|
20
|
+
setColor(e.hex);
|
|
21
|
+
} }), !disableOpacity && (_jsxs(_Fragment, { children: [_jsx(Slider, { testId: testIds.opacity, label: t('opacity'), value: opacity, onChange: val => setOpacity(val), showProgress: true }), _jsxs(Flex, { "data-testid": testIds.colorPreview, container: { direction: 'column', gap: 1 }, children: [_jsx(Text, { variant: 'h3', children: t('color_preview') }), _jsx(StyledPreviewContainer, { children: _jsx(StyledPreview, { "aria-label": t('color_preview'), background: background }) })] })] }))] }));
|
|
22
|
+
});
|
|
23
|
+
export default withTestIds(SolidColorConfig, getSolidColorConfigTestIds);
|
|
24
|
+
//# sourceMappingURL=SolidColorConfig.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SolidColorConfig.js","sourceRoot":"","sources":["../../../src/components/BackgroundPicker/SolidColorConfig.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,UAAU,EACV,mBAAmB,EACnB,OAAO,EACP,QAAQ,EAGT,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;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SAAS,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,EAAE,aAC9C,KAAC,WAAW,IACV,MAAM,EAAE,OAAO,CAAC,KAAK,EACrB,KAAK,EAAE,CAAC,CAAC,OAAO,CAAC,EACjB,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,CAAC,CAAC,EAAE;oBACZ,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;gBAClB,CAAC,GACD,EACD,CAAC,cAAc,IAAI,CAClB,8BACE,KAAC,MAAM,IACL,MAAM,EAAE,OAAO,CAAC,OAAO,EACvB,KAAK,EAAE,CAAC,CAAC,SAAS,CAAC,EACnB,KAAK,EAAE,OAAO,EACd,QAAQ,EAAE,GAAG,CAAC,EAAE,CAAC,UAAU,CAAC,GAAG,CAAC,EAChC,YAAY,SACZ,EACF,MAAC,IAAI,mBAAc,OAAO,CAAC,YAAY,EAAE,SAAS,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,EAAE,aACjF,KAAC,IAAI,IAAC,OAAO,EAAC,IAAI,YAAE,CAAC,CAAC,eAAe,CAAC,GAAQ,EAC9C,KAAC,sBAAsB,cACrB,KAAC,aAAa,kBAAa,CAAC,CAAC,eAAe,CAAC,EAAE,UAAU,EAAE,UAAU,GAAI,GAClD,IACpB,IACN,CACJ,IACI,CACR,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,eAAe,WAAW,CAAC,gBAAgB,EAAE,0BAA0B,CAAC,CAAC","sourcesContent":["import {\n forwardRef,\n useImperativeHandle,\n useMemo,\n useState,\n type PropsWithoutRef,\n type Ref\n} from 'react';\nimport { parseToRgb, rgb, transparentize } from 'polished';\nimport type { RgbaColor } from 'polished/lib/types/color';\n\nimport {\n tryCatch,\n useTestIds,\n useI18n,\n Flex,\n ColorPicker,\n Slider,\n withTestIds,\n Text\n} from '@pega/cosmos-react-core';\n\nimport { getSolidColorConfigTestIds } from './BackgroundPicker.test-ids';\nimport type { ComputedBackgroundRef, SolidColorConfigProps } from './BackgroundPicker.types';\nimport { StyledPreviewContainer, StyledPreview } from './BackgroundPicker.styles';\n\nconst SolidColorConfig = forwardRef(function SolidColorConfig(\n { testId, value, disableOpacity }: PropsWithoutRef<SolidColorConfigProps>,\n ref: Ref<ComputedBackgroundRef>\n) {\n const { alpha, ...rgbSpectrum } = tryCatch(\n () => parseToRgb(value) as RgbaColor,\n () => parseToRgb('#fff') as RgbaColor\n );\n\n const [color, setColor] = useState(rgb(rgbSpectrum));\n const [opacity, setOpacity] = useState((alpha ?? 1) * 100);\n const testIds = useTestIds(testId, getSolidColorConfigTestIds);\n const t = useI18n();\n\n const background = useMemo(() => {\n return transparentize(1 - opacity / 100, color);\n }, [opacity, color]);\n\n useImperativeHandle(ref, () => ({\n getValue: () => background\n }));\n\n return (\n <Flex container={{ direction: 'column', gap: 1 }}>\n <ColorPicker\n testId={testIds.color}\n label={t('color')}\n value={color}\n onChange={e => {\n setColor(e.hex);\n }}\n />\n {!disableOpacity && (\n <>\n <Slider\n testId={testIds.opacity}\n label={t('opacity')}\n value={opacity}\n onChange={val => setOpacity(val)}\n showProgress\n />\n <Flex data-testid={testIds.colorPreview} container={{ direction: 'column', gap: 1 }}>\n <Text variant='h3'>{t('color_preview')}</Text>\n <StyledPreviewContainer>\n <StyledPreview aria-label={t('color_preview')} background={background} />\n </StyledPreviewContainer>\n </Flex>\n </>\n )}\n </Flex>\n );\n});\n\nexport default withTestIds(SolidColorConfig, getSolidColorConfigTestIds);\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/BackgroundPicker/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAC7C,YAAY,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/BackgroundPicker/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC","sourcesContent":["export { default } from './BackgroundPicker';\nexport type { BackgroundPickerProps } from './BackgroundPicker.types';\n"]}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { type LinearResult, type RadialResult } from 'css-gradient-parser';
|
|
2
|
+
import type { BackgroundImage, BackgroundType, ConicGradient, GradientConfigProps } from './BackgroundPicker.types';
|
|
3
|
+
/**
|
|
4
|
+
* Returns appropriate background type based on value.
|
|
5
|
+
* @param value - CSS background value string.
|
|
6
|
+
* @param supportedBackgrounds - List of supported backgrounds.
|
|
7
|
+
* @returns Appropriate background type based on value.
|
|
8
|
+
*/
|
|
9
|
+
export declare const getBackgroundType: (value: string, supportedBackgrounds: BackgroundType[]) => BackgroundType | undefined;
|
|
10
|
+
/**
|
|
11
|
+
* Returns appropriate background image data based on value.
|
|
12
|
+
* @param value - CSS background string.
|
|
13
|
+
* @returns Appropriate background image data based on value.
|
|
14
|
+
*/
|
|
15
|
+
export declare const getBackgroundImageDetails: (value?: string) => BackgroundImage;
|
|
16
|
+
/**
|
|
17
|
+
* Returns appropriate gradient data based on gradient type and value.
|
|
18
|
+
* @param type - Gradient type.
|
|
19
|
+
* @param value - CSS background value
|
|
20
|
+
* @returns Appropriate gradient data based on gradient type and value.
|
|
21
|
+
*/
|
|
22
|
+
export declare const getParsedGradientDetails: (type: GradientConfigProps["type"], value: string) => LinearResult | RadialResult | ConicGradient;
|
|
23
|
+
export declare const supportedBackgroundOptions: BackgroundType[];
|
|
24
|
+
//# sourceMappingURL=utils.d.ts.map
|