@pega/cosmos-react-build 8.8.0 → 9.0.0-build.10.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/AuthoringPanel/AuthoringPanel.d.ts +7 -0
- package/lib/components/AuthoringPanel/AuthoringPanel.d.ts.map +1 -0
- package/lib/components/AuthoringPanel/AuthoringPanel.js +49 -0
- package/lib/components/AuthoringPanel/AuthoringPanel.js.map +1 -0
- package/lib/components/AuthoringPanel/AuthoringPanel.styles.d.ts +18 -0
- package/lib/components/AuthoringPanel/AuthoringPanel.styles.d.ts.map +1 -0
- package/lib/components/AuthoringPanel/AuthoringPanel.styles.js +133 -0
- package/lib/components/AuthoringPanel/AuthoringPanel.styles.js.map +1 -0
- package/lib/components/AuthoringPanel/AuthoringPanel.test-ids.d.ts +2 -0
- package/lib/components/AuthoringPanel/AuthoringPanel.test-ids.d.ts.map +1 -0
- package/lib/components/AuthoringPanel/AuthoringPanel.test-ids.js +16 -0
- package/lib/components/AuthoringPanel/AuthoringPanel.test-ids.js.map +1 -0
- package/lib/components/AuthoringPanel/AuthoringPanel.types.d.ts +81 -0
- package/lib/components/AuthoringPanel/AuthoringPanel.types.d.ts.map +1 -0
- package/lib/components/AuthoringPanel/AuthoringPanel.types.js +2 -0
- package/lib/components/AuthoringPanel/AuthoringPanel.types.js.map +1 -0
- package/lib/components/AuthoringPanel/AuthoringPanelHeader.d.ts +6 -0
- package/lib/components/AuthoringPanel/AuthoringPanelHeader.d.ts.map +1 -0
- package/lib/components/AuthoringPanel/AuthoringPanelHeader.js +41 -0
- package/lib/components/AuthoringPanel/AuthoringPanelHeader.js.map +1 -0
- package/lib/components/AuthoringPanel/index.d.ts +4 -0
- package/lib/components/AuthoringPanel/index.d.ts.map +1 -0
- package/lib/components/AuthoringPanel/index.js +3 -0
- package/lib/components/AuthoringPanel/index.js.map +1 -0
- package/lib/components/Automation/Automation.d.ts +7 -0
- package/lib/components/Automation/Automation.d.ts.map +1 -0
- package/lib/components/Automation/Automation.js +113 -0
- package/lib/components/Automation/Automation.js.map +1 -0
- package/lib/components/Automation/Automation.styles.d.ts +12 -0
- package/lib/components/Automation/Automation.styles.d.ts.map +1 -0
- package/lib/components/Automation/Automation.styles.js +68 -0
- package/lib/components/Automation/Automation.styles.js.map +1 -0
- package/lib/components/Automation/Automation.test-ids.d.ts +3 -0
- package/lib/components/Automation/Automation.test-ids.d.ts.map +1 -0
- package/lib/components/Automation/Automation.test-ids.js +21 -0
- package/lib/components/Automation/Automation.test-ids.js.map +1 -0
- package/lib/components/Automation/Automation.types.d.ts +95 -0
- package/lib/components/Automation/Automation.types.d.ts.map +1 -0
- package/lib/components/Automation/Automation.types.js +18 -0
- package/lib/components/Automation/Automation.types.js.map +1 -0
- package/lib/components/Automation/Automation.utils.d.ts +109 -0
- package/lib/components/Automation/Automation.utils.d.ts.map +1 -0
- package/lib/components/Automation/Automation.utils.js +208 -0
- package/lib/components/Automation/Automation.utils.js.map +1 -0
- package/lib/components/Automation/AutomationContext.d.ts +4 -0
- package/lib/components/Automation/AutomationContext.d.ts.map +1 -0
- package/lib/components/Automation/AutomationContext.js +9 -0
- package/lib/components/Automation/AutomationContext.js.map +1 -0
- package/lib/components/Automation/RuleStep.d.ts +7 -0
- package/lib/components/Automation/RuleStep.d.ts.map +1 -0
- package/lib/components/Automation/RuleStep.js +151 -0
- package/lib/components/Automation/RuleStep.js.map +1 -0
- package/lib/components/Automation/index.d.ts +5 -0
- package/lib/components/Automation/index.d.ts.map +1 -0
- package/lib/components/Automation/index.js +4 -0
- package/lib/components/Automation/index.js.map +1 -0
- package/lib/components/DynamicInput/BooleanControl.d.ts +2 -2
- package/lib/components/DynamicInput/BooleanControl.d.ts.map +1 -1
- package/lib/components/DynamicInput/BooleanControl.js.map +1 -1
- package/lib/components/DynamicInput/ConstantControl.d.ts +61 -0
- package/lib/components/DynamicInput/ConstantControl.d.ts.map +1 -0
- package/lib/components/DynamicInput/ConstantControl.js +58 -0
- package/lib/components/DynamicInput/ConstantControl.js.map +1 -0
- package/lib/components/DynamicInput/DynamicInput.d.ts +2 -2
- package/lib/components/DynamicInput/DynamicInput.d.ts.map +1 -1
- package/lib/components/DynamicInput/DynamicInput.js +13 -63
- package/lib/components/DynamicInput/DynamicInput.js.map +1 -1
- package/lib/components/DynamicInput/DynamicInput.styles.d.ts +0 -1
- package/lib/components/DynamicInput/DynamicInput.styles.d.ts.map +1 -1
- package/lib/components/DynamicInput/DynamicInput.styles.js +48 -41
- package/lib/components/DynamicInput/DynamicInput.styles.js.map +1 -1
- package/lib/components/DynamicInput/DynamicInput.types.d.ts +26 -81
- package/lib/components/DynamicInput/DynamicInput.types.d.ts.map +1 -1
- package/lib/components/DynamicInput/DynamicInput.types.js.map +1 -1
- package/lib/components/DynamicInput/index.d.ts +2 -0
- package/lib/components/DynamicInput/index.d.ts.map +1 -1
- package/lib/components/DynamicInput/index.js +1 -0
- package/lib/components/DynamicInput/index.js.map +1 -1
- package/lib/components/DynamicInput/utils.d.ts.map +1 -1
- package/lib/components/DynamicInput/utils.js +3 -2
- package/lib/components/DynamicInput/utils.js.map +1 -1
- package/lib/components/EmptyRuleTemplate/EmptyRuleTemplate.d.ts +34 -0
- package/lib/components/EmptyRuleTemplate/EmptyRuleTemplate.d.ts.map +1 -0
- package/lib/components/EmptyRuleTemplate/EmptyRuleTemplate.js +55 -0
- package/lib/components/EmptyRuleTemplate/EmptyRuleTemplate.js.map +1 -0
- package/lib/components/EmptyRuleTemplate/EmptyRuleTemplate.test-ids.d.ts +2 -0
- package/lib/components/EmptyRuleTemplate/EmptyRuleTemplate.test-ids.d.ts.map +1 -0
- package/lib/components/EmptyRuleTemplate/EmptyRuleTemplate.test-ids.js +10 -0
- package/lib/components/EmptyRuleTemplate/EmptyRuleTemplate.test-ids.js.map +1 -0
- package/lib/components/EmptyRuleTemplate/index.d.ts +3 -0
- package/lib/components/EmptyRuleTemplate/index.d.ts.map +1 -0
- package/lib/components/EmptyRuleTemplate/index.js +2 -0
- package/lib/components/EmptyRuleTemplate/index.js.map +1 -0
- package/lib/components/Expression/Expression.d.ts.map +1 -1
- package/lib/components/Expression/Expression.js +8 -7
- package/lib/components/Expression/Expression.js.map +1 -1
- package/lib/components/Expression/Expression.styles.d.ts +5 -1
- package/lib/components/Expression/Expression.styles.d.ts.map +1 -1
- package/lib/components/Expression/Expression.styles.js +15 -3
- package/lib/components/Expression/Expression.styles.js.map +1 -1
- package/lib/components/Expression/Expression.test-ids.d.ts +1 -0
- package/lib/components/Expression/Expression.test-ids.d.ts.map +1 -1
- package/lib/components/Expression/Expression.test-ids.js +6 -0
- package/lib/components/Expression/Expression.test-ids.js.map +1 -1
- package/lib/components/Expression/ExpressionBuilderModal.d.ts +6 -0
- package/lib/components/Expression/ExpressionBuilderModal.d.ts.map +1 -0
- package/lib/components/Expression/ExpressionBuilderModal.js +53 -0
- package/lib/components/Expression/ExpressionBuilderModal.js.map +1 -0
- package/lib/components/ExpressionBuilder/CodeEditor/CodeEditor.d.ts.map +1 -1
- package/lib/components/ExpressionBuilder/CodeEditor/CodeEditor.js +1 -0
- package/lib/components/ExpressionBuilder/CodeEditor/CodeEditor.js.map +1 -1
- package/lib/components/ExpressionBuilder/CodeEditor/CodeEditor.styles.d.ts.map +1 -1
- package/lib/components/ExpressionBuilder/CodeEditor/CodeEditor.styles.js +3 -2
- package/lib/components/ExpressionBuilder/CodeEditor/CodeEditor.styles.js.map +1 -1
- package/lib/components/ExpressionBuilder/ExpressionBuilder.d.ts +4 -2
- package/lib/components/ExpressionBuilder/ExpressionBuilder.d.ts.map +1 -1
- package/lib/components/ExpressionBuilder/ExpressionBuilder.js +66 -25
- package/lib/components/ExpressionBuilder/ExpressionBuilder.js.map +1 -1
- package/lib/components/ExpressionBuilder/ExpressionBuilder.styles.d.ts +18 -2
- package/lib/components/ExpressionBuilder/ExpressionBuilder.styles.d.ts.map +1 -1
- package/lib/components/ExpressionBuilder/ExpressionBuilder.styles.js +80 -13
- package/lib/components/ExpressionBuilder/ExpressionBuilder.styles.js.map +1 -1
- package/lib/components/ExpressionBuilder/ExpressionBuilder.test-ids.d.ts +5 -0
- package/lib/components/ExpressionBuilder/ExpressionBuilder.test-ids.d.ts.map +1 -0
- package/lib/components/ExpressionBuilder/ExpressionBuilder.test-ids.js +22 -0
- package/lib/components/ExpressionBuilder/ExpressionBuilder.test-ids.js.map +1 -0
- package/lib/components/ExpressionBuilder/ExpressionBuilder.types.d.ts +33 -5
- 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 +4 -2
- package/lib/components/ExpressionBuilder/ExpressionDetails.d.ts.map +1 -1
- package/lib/components/ExpressionBuilder/ExpressionDetails.js +6 -4
- package/lib/components/ExpressionBuilder/ExpressionDetails.js.map +1 -1
- package/lib/components/ExpressionBuilder/ExpressionItem.d.ts +4 -2
- package/lib/components/ExpressionBuilder/ExpressionItem.d.ts.map +1 -1
- package/lib/components/ExpressionBuilder/ExpressionItem.js +8 -6
- package/lib/components/ExpressionBuilder/ExpressionItem.js.map +1 -1
- package/lib/components/ExpressionBuilder/ExpressionList.d.ts +4 -2
- package/lib/components/ExpressionBuilder/ExpressionList.d.ts.map +1 -1
- package/lib/components/ExpressionBuilder/ExpressionList.js +17 -5
- package/lib/components/ExpressionBuilder/ExpressionList.js.map +1 -1
- package/lib/components/ExpressionBuilder/index.d.ts +1 -0
- package/lib/components/ExpressionBuilder/index.d.ts.map +1 -1
- package/lib/components/ExpressionBuilder/index.js +1 -0
- package/lib/components/ExpressionBuilder/index.js.map +1 -1
- package/lib/components/FieldReference/FieldReference.types.d.ts +16 -2
- 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/FieldReferenceInput.d.ts.map +1 -1
- package/lib/components/FieldReference/FieldReferenceInput.js +5 -5
- package/lib/components/FieldReference/FieldReferenceInput.js.map +1 -1
- package/lib/components/FieldReference/helpers.d.ts +7 -1
- package/lib/components/FieldReference/helpers.d.ts.map +1 -1
- package/lib/components/FieldReference/helpers.js +31 -1
- package/lib/components/FieldReference/helpers.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/iconUtils.d.ts +2 -1
- package/lib/components/IconTile/iconUtils.d.ts.map +1 -1
- package/lib/components/IconTile/iconUtils.js +94 -1
- package/lib/components/IconTile/iconUtils.js.map +1 -1
- 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 +1 -0
- package/lib/components/IconTile/index.js.map +1 -1
- package/lib/components/LifeCycle/Category.d.ts +0 -1
- package/lib/components/LifeCycle/Category.d.ts.map +1 -1
- package/lib/components/LifeCycle/Category.js +16 -56
- package/lib/components/LifeCycle/Category.js.map +1 -1
- package/lib/components/LifeCycle/LifeCycle.js +2 -2
- package/lib/components/LifeCycle/LifeCycle.js.map +1 -1
- package/lib/components/LifeCycle/LifeCycle.types.d.ts +37 -2
- package/lib/components/LifeCycle/LifeCycle.types.d.ts.map +1 -1
- package/lib/components/LifeCycle/LifeCycle.types.js +9 -9
- package/lib/components/LifeCycle/LifeCycle.types.js.map +1 -1
- package/lib/components/LifeCycle/LifeCycleDragDropList.d.ts.map +1 -1
- package/lib/components/LifeCycle/LifeCycleDragDropList.js +25 -3
- package/lib/components/LifeCycle/LifeCycleDragDropList.js.map +1 -1
- package/lib/components/LifeCycle/Stage.d.ts.map +1 -1
- package/lib/components/LifeCycle/Stage.js +20 -11
- package/lib/components/LifeCycle/Stage.js.map +1 -1
- package/lib/components/LifeCycle/Step.d.ts.map +1 -1
- package/lib/components/LifeCycle/Step.js +1 -0
- package/lib/components/LifeCycle/Step.js.map +1 -1
- package/lib/components/LifeCycle/Task.d.ts +7 -1
- package/lib/components/LifeCycle/Task.d.ts.map +1 -1
- package/lib/components/LifeCycle/Task.js +19 -10
- package/lib/components/LifeCycle/Task.js.map +1 -1
- package/lib/components/LifeCycle/TaskGroup.d.ts +23 -0
- package/lib/components/LifeCycle/TaskGroup.d.ts.map +1 -0
- package/lib/components/LifeCycle/TaskGroup.js +92 -0
- package/lib/components/LifeCycle/TaskGroup.js.map +1 -0
- package/lib/components/LifeCycle/index.d.ts +1 -1
- package/lib/components/LifeCycle/index.d.ts.map +1 -1
- package/lib/components/LifeCycle/index.js +1 -1
- package/lib/components/LifeCycle/index.js.map +1 -1
- package/lib/components/LifeCycle/utils.d.ts +6 -1
- package/lib/components/LifeCycle/utils.d.ts.map +1 -1
- package/lib/components/LifeCycle/utils.js +129 -0
- package/lib/components/LifeCycle/utils.js.map +1 -1
- package/lib/components/ObjectSelect/InputTree/InputTree.d.ts +21 -0
- package/lib/components/ObjectSelect/InputTree/InputTree.d.ts.map +1 -0
- package/lib/components/ObjectSelect/InputTree/InputTree.js +20 -0
- package/lib/components/ObjectSelect/InputTree/InputTree.js.map +1 -0
- package/lib/components/ObjectSelect/InputTree/InputTree.styles.d.ts +10 -0
- package/lib/components/ObjectSelect/InputTree/InputTree.styles.d.ts.map +1 -0
- package/lib/components/ObjectSelect/InputTree/InputTree.styles.js +82 -0
- package/lib/components/ObjectSelect/InputTree/InputTree.styles.js.map +1 -0
- package/lib/components/ObjectSelect/InputTree/index.d.ts +3 -0
- package/lib/components/ObjectSelect/InputTree/index.d.ts.map +1 -0
- package/lib/components/ObjectSelect/InputTree/index.js +2 -0
- package/lib/components/ObjectSelect/InputTree/index.js.map +1 -0
- package/lib/components/ObjectSelect/ObjectPicker.d.ts +11 -5
- package/lib/components/ObjectSelect/ObjectPicker.d.ts.map +1 -1
- package/lib/components/ObjectSelect/ObjectPicker.js +24 -15
- package/lib/components/ObjectSelect/ObjectPicker.js.map +1 -1
- package/lib/components/ObjectSelect/ObjectSelect.d.ts +2 -29
- package/lib/components/ObjectSelect/ObjectSelect.d.ts.map +1 -1
- package/lib/components/ObjectSelect/ObjectSelect.js +80 -23
- package/lib/components/ObjectSelect/ObjectSelect.js.map +1 -1
- package/lib/components/ObjectSelect/ObjectSelect.types.d.ts +53 -0
- package/lib/components/ObjectSelect/ObjectSelect.types.d.ts.map +1 -0
- package/lib/components/ObjectSelect/ObjectSelect.types.js +2 -0
- package/lib/components/ObjectSelect/ObjectSelect.types.js.map +1 -0
- package/lib/components/ObjectSelect/index.d.ts +1 -1
- package/lib/components/ObjectSelect/index.d.ts.map +1 -1
- package/lib/components/ObjectSelect/index.js.map +1 -1
- package/lib/components/ObjectSelect/useCreateModal.d.ts +6 -2
- package/lib/components/ObjectSelect/useCreateModal.d.ts.map +1 -1
- package/lib/components/ObjectSelect/useCreateModal.js +7 -4
- package/lib/components/ObjectSelect/useCreateModal.js.map +1 -1
- package/lib/components/PageBanner/PageBanner.d.ts +6 -4
- package/lib/components/PageBanner/PageBanner.d.ts.map +1 -1
- package/lib/components/PageBanner/PageBanner.js +10 -9
- package/lib/components/PageBanner/PageBanner.js.map +1 -1
- package/lib/components/PageBanner/PageBanner.test-ids.d.ts +2 -0
- package/lib/components/PageBanner/PageBanner.test-ids.d.ts.map +1 -0
- package/lib/components/PageBanner/PageBanner.test-ids.js +9 -0
- package/lib/components/PageBanner/PageBanner.test-ids.js.map +1 -0
- package/lib/components/PageTemplates/ConstructPageTemplate/ConstructPageHeader.d.ts +12 -0
- package/lib/components/PageTemplates/ConstructPageTemplate/ConstructPageHeader.d.ts.map +1 -0
- package/lib/components/PageTemplates/ConstructPageTemplate/ConstructPageHeader.js +158 -0
- package/lib/components/PageTemplates/ConstructPageTemplate/ConstructPageHeader.js.map +1 -0
- package/lib/components/PageTemplates/ConstructPageTemplate/ConstructPageTemplate.d.ts +5 -0
- package/lib/components/PageTemplates/ConstructPageTemplate/ConstructPageTemplate.d.ts.map +1 -0
- package/lib/components/PageTemplates/ConstructPageTemplate/ConstructPageTemplate.js +17 -0
- package/lib/components/PageTemplates/ConstructPageTemplate/ConstructPageTemplate.js.map +1 -0
- package/lib/components/PageTemplates/GalleryPage.d.ts +14 -4
- package/lib/components/PageTemplates/GalleryPage.d.ts.map +1 -1
- package/lib/components/PageTemplates/GalleryPage.js +57 -12
- package/lib/components/PageTemplates/GalleryPage.js.map +1 -1
- package/lib/components/PageTemplates/HeaderActionButtons.d.ts +5 -0
- package/lib/components/PageTemplates/HeaderActionButtons.d.ts.map +1 -0
- package/lib/components/PageTemplates/HeaderActionButtons.js +14 -0
- package/lib/components/PageTemplates/HeaderActionButtons.js.map +1 -0
- package/lib/components/PageTemplates/InventoryPageTemplate/InventoryPageHeader.d.ts +8 -0
- package/lib/components/PageTemplates/InventoryPageTemplate/InventoryPageHeader.d.ts.map +1 -0
- package/lib/components/PageTemplates/InventoryPageTemplate/InventoryPageHeader.js +23 -0
- package/lib/components/PageTemplates/InventoryPageTemplate/InventoryPageHeader.js.map +1 -0
- package/lib/components/PageTemplates/InventoryPageTemplate/InventoryPageTemplate.d.ts +5 -0
- package/lib/components/PageTemplates/InventoryPageTemplate/InventoryPageTemplate.d.ts.map +1 -0
- package/lib/components/PageTemplates/InventoryPageTemplate/InventoryPageTemplate.js +10 -0
- package/lib/components/PageTemplates/InventoryPageTemplate/InventoryPageTemplate.js.map +1 -0
- package/lib/components/PageTemplates/OverviewPageTemplate/OverviewPageTemplate.d.ts +5 -0
- package/lib/components/PageTemplates/OverviewPageTemplate/OverviewPageTemplate.d.ts.map +1 -0
- package/lib/components/PageTemplates/OverviewPageTemplate/OverviewPageTemplate.js +10 -0
- package/lib/components/PageTemplates/OverviewPageTemplate/OverviewPageTemplate.js.map +1 -0
- package/lib/components/PageTemplates/OverviewPageTemplate/PageBanner.d.ts +21 -0
- package/lib/components/PageTemplates/OverviewPageTemplate/PageBanner.d.ts.map +1 -0
- package/lib/components/PageTemplates/OverviewPageTemplate/PageBanner.js +22 -0
- package/lib/components/PageTemplates/OverviewPageTemplate/PageBanner.js.map +1 -0
- package/lib/components/PageTemplates/PageTemplate.styles.d.ts +16 -0
- package/lib/components/PageTemplates/PageTemplate.styles.d.ts.map +1 -0
- package/lib/components/PageTemplates/PageTemplate.styles.js +167 -0
- package/lib/components/PageTemplates/PageTemplate.styles.js.map +1 -0
- package/lib/components/PageTemplates/PageTemplate.types.d.ts +114 -0
- package/lib/components/PageTemplates/PageTemplate.types.d.ts.map +1 -0
- package/lib/components/PageTemplates/PageTemplate.types.js +2 -0
- package/lib/components/PageTemplates/PageTemplate.types.js.map +1 -0
- package/lib/components/PageTemplates/PageTemplates.d.ts +16 -12
- package/lib/components/PageTemplates/PageTemplates.d.ts.map +1 -1
- package/lib/components/PageTemplates/PageTemplates.js +12 -12
- package/lib/components/PageTemplates/PageTemplates.js.map +1 -1
- package/lib/components/PageTemplates/PageTemplates.test-ids.d.ts +4 -0
- package/lib/components/PageTemplates/PageTemplates.test-ids.d.ts.map +1 -0
- package/lib/components/PageTemplates/PageTemplates.test-ids.js +25 -0
- package/lib/components/PageTemplates/PageTemplates.test-ids.js.map +1 -0
- 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 +5 -6
- package/lib/components/PageTemplates/ShowcasePage.js.map +1 -1
- package/lib/components/PageTemplates/index.d.ts +6 -1
- package/lib/components/PageTemplates/index.d.ts.map +1 -1
- package/lib/components/PageTemplates/index.js +5 -1
- package/lib/components/PageTemplates/index.js.map +1 -1
- package/lib/components/RulePicker/RulePicker.d.ts +4 -0
- package/lib/components/RulePicker/RulePicker.d.ts.map +1 -0
- package/lib/components/RulePicker/RulePicker.js +81 -0
- package/lib/components/RulePicker/RulePicker.js.map +1 -0
- package/lib/index.d.ts +5 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +5 -1
- package/lib/index.js.map +1 -1
- package/lib/utils/typeIconMapping.js +1 -1
- package/lib/utils/typeIconMapping.js.map +1 -1
- package/package.json +4 -4
- package/lib/utils/index.d.ts +0 -2
- package/lib/utils/index.d.ts.map +0 -1
- package/lib/utils/index.js +0 -2
- package/lib/utils/index.js.map +0 -1
- package/lib/utils/utils.d.ts +0 -14
- package/lib/utils/utils.d.ts.map +0 -1
- package/lib/utils/utils.js +0 -13
- package/lib/utils/utils.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LifeCycle.types.js","sourceRoot":"","sources":["../../../src/components/LifeCycle/LifeCycle.types.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,WAAW,EAAE,SAAS,IAAI,KAAK,EAAE,MAAM,yBAAyB,CAAC;AA2N1E,sFAAsF;AACtF,oFAAoF;AACpF,MAAM,CAAC,MAAM,YAAY,GAAG,CAC1B,WAAsB,EACtB,cAAgD,EAChD,aAA6B,EAC7B,UAAU,GAAG,KAAK,EAClB,KAAK,GAAG,KAAK,EACb,EAAE;IACF,MAAM,iBAAiB,GAAiC;QACtD,KAAK,EAAE;YACL,EAAE,EAAE,OAAO;YACX,MAAM,EAAE;gBACN,OAAO,EAAE,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI;gBACpC,OAAO,EAAE,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM;gBACtC,WAAW,EAAE,KAAK;gBAClB,WAAW,EAAE,IAAI;aAClB;SACF;QACD,OAAO,EAAE;YACP,EAAE,EAAE,SAAS;YACb,MAAM,EAAE;gBACN,OAAO,EAAE,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM;gBACtC,OAAO,EAAE,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK;gBACrC,WAAW,EAAE,IAAI;gBACjB,WAAW,EAAE,IAAI;aAClB;SACF;QACD,SAAS,EAAE;YACT,EAAE,EAAE,WA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AK,CAAC,IAAI,CAAC,SAAS,CAAC,iBAAiB,CAAC,CAAC,CAAC;QAClE,MAAM,aAAa,GAAG,WAAW,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,WAAW,CAAC,KAAK,CAAC;QAC3E,IAAI,aAAa,CAAC,IAAI,KAAK,WAAW,EAAE,CAAC;YACvC,IAAI,aAAa,CAAC,cAAc,KAAK,YAAY,EAAE,CAAC;gBAClD,MAAM,CAAC,MAAM,GAAG;oBACd,GAAG,MAAM,CAAC,MAAM;oBAChB,WAAW,EAAE,KAAK;iBACnB,CAAC;YACJ,CAAC;YACD,IAAI,aAAa,CAAC,cAAc,KAAK,MAAM,EAAE,CAAC;gBAC5C,MAAM,CAAC,MAAM,GAAG;oBACd,GAAG,MAAM,CAAC,MAAM;oBAChB,GAAG,EAAE,WAAW,EAAE,KAAK,EAAE;iBAC1B,CAAC;YACJ,CAAC;QACH,CAAC;aAAM,CAAC;YACN,MAAM,CAAC,MAAM,CAAC,WAAW;gBACvB,gBAAgB,CAAC,MAAM,CAAC,WAAW,IAAI,aAAa,CAAC,MAAM,CAAC,WAAW,CAAC;QAC5E,CAAC;IACH,CAAC;IACD,IAAI,UAAU,EAAE,CAAC;QACf,MAAM,CAAC,MAAM,CAAC,WAAW,GAAG,KAAK,CAAC;IACpC,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC","sourcesContent":["import type { MouseEvent, Ref } from 'react';\n\nimport type {\n Action,\n StatusProps,\n NoChildrenProp,\n BaseProps,\n FormControlProps\n} from '@pega/cosmos-react-core';\nimport { readableHue, WorkTheme as Theme } from '@pega/cosmos-react-core';\n\nimport type { LibraryItem } from '../ItemLibrary';\n\nimport type { VisualStepItemProps } from './Step';\n\nexport type StageType = 'start' | 'default' | 'alternate';\n\ninterface ItemIdentifiers {\n /** The index of the item within its list */\n index?: number;\n /** If true, this item belongs to an alternate lifecycle list */\n alternate?: boolean;\n}\n\nexport interface StepItemProps extends ItemIdentifiers {\n id: string;\n label: string;\n visual: VisualStepItemProps;\n status: { type?: StatusProps['variant'] | ''; label: string };\n error?: string;\n}\n\nexport interface TaskItemProps extends ItemIdentifiers {\n id: string;\n label: string;\n visual: {\n imgSrc: string;\n };\n error?: string;\n steps: StepItemProps[];\n subIndex?: number;\n}\n\nexport interface CategoryItemProps extends ItemIdentifiers {\n /** Data model should have id of the stage item */\n id: string;\n /** id to map with category items */\n categoryId: string;\n /** Data model should have the categoryData array */\n tasks: TaskItemProps[] | TaskItemProps[][];\n}\n\nexport interface StageItemProps extends ItemIdentifiers {\n /** Data model should have id of the stage item */\n id: string;\n /** Data model should have the stage label */\n label: string;\n /** Data model should have the categoryData array */\n categories: CategoryItemProps[];\n /** Data model should have the stageType as below */\n type: StageType;\n error?: string;\n /* Sets stage transition to wait or resolution */\n transitionType?: 'wait' | 'resolution' | undefined;\n}\n\nexport interface LifeCycleActionParam {\n value?: string;\n stage?: StageItemProps;\n task?: TaskItemProps;\n category?: CategoryItemProps;\n step?: StepItemProps;\n type?: 'Stage' | 'Step' | 'Task' | 'Alternate Stage';\n routeTo?: string;\n}\n\nexport interface LifeCycleAction extends Omit<Action, 'onClick'> {\n onClick: (\n param: LifeCycleActionParam,\n e: MouseEvent<HTMLButtonElement | HTMLAnchorElement | HTMLInputElement>,\n menuButtonEl?: HTMLButtonElement\n ) => void;\n}\n\nexport interface CategoriesItemProps {\n label: string;\n id: string;\n}\n\nexport interface StageProps extends Omit<FormControlProps, 'status' | 'id'> {\n /** Label for the region. */\n label?: string;\n /** Pass an array of Action objects to append button(s) inline with the Input. */\n actions?: Record<StageType, LifeCycleAction[]> | LifeCycleAction[];\n /** Callback for Add stage */\n onAddStage?: () => void;\n /** Callback for Adding alternate stage */\n onAddAlternateStage?: () => void;\n /** callback for Click of stage */\n onClick?: (param: LifeCycleActionParam, e: MouseEvent) => void;\n}\n\nexport interface CategoriesProps extends CategoriesItemProps {\n /** height property used to manipulate height of catergory dom */\n height?: number;\n elementId?: string;\n}\n\nexport interface TaskProps extends Omit<FormControlProps, 'status' | 'id'> {\n /** Pass an array of Action objects to append button(s) inline with the Input. */\n actions?: LifeCycleAction[];\n /** Tooltip for adding items to the task component */\n addStepTitle?: string;\n /** Region for adding the task component */\n addTask?: {\n title: string;\n showOnce: boolean;\n onAddTask?: LifeCycleAction['onClick'];\n };\n /** Callback for adding a step when nodeLibrary is provided. */\n onAddStep?: (param: LifeCycleActionParam, selectedItem: LibraryItem) => void;\n /** Callback for adding a step when nodeLibrary is not provided. */\n onAddCustomStep?: (param: LifeCycleActionParam) => void;\n /** callback for Click of a task */\n onClick?: (param: LifeCycleActionParam, e: MouseEvent) => void;\n /** Types of Nodes */\n nodeLibrary?: LibraryItem[];\n}\n\nexport interface CategoryProps extends BaseProps, NoChildrenProp {\n ref?: Ref<HTMLOListElement | HTMLDivElement>;\n /** Pass the category items */\n item: CategoryItemProps;\n /** Enable the title for categories */\n showTitle?: boolean;\n /** Props of the categoryColumn */\n category?: CategoriesProps;\n /** Task component prop */\n task?: TaskProps;\n /** Stage data - to be passed in callbacks */\n stageItem: StageItemProps;\n /** Id for the component */\n id: string;\n}\n\nexport interface StepProps extends Omit<FormControlProps, 'status' | 'id'> {\n /** Pass an array of Action objects to append button(s) inline with the Input. */\n actions?: LifeCycleAction[];\n /** If true, step names will wrap rather than truncate. */\n wrap?: boolean;\n /** callback for Click of a step */\n onClick?: (param: LifeCycleActionParam, e: MouseEvent) => void;\n}\n\nexport interface IndexData {\n /** Determines if the item part of an alternate stage. */\n alternate: boolean;\n /** The index of the parent stage to the item, or the item itself. */\n stage?: number;\n /** The index of the parent category to the item. */\n category?: number;\n /** The index of the parent task to the item, or the item itself. */\n task?: number;\n /** The index of the parent stage to the item, or the item itself, if the task is nested within another task. */\n subTask?: number;\n /** The index of the step item. */\n step?: number;\n}\n\nexport type LifeCycleDragItemType = 'stage' | 'step' | 'alternate-stage' | 'alternate-step';\n\nexport interface LifeCycleDragDropEvent {\n /** The type of item that was moved. */\n type: 'stage' | 'step';\n /** The indices of the source item. */\n sourceData: IndexData;\n /** The indices of the target location. */\n targetData: IndexData;\n}\n\nexport interface DragDropConfig\n extends Record<LifeCycleDragItemType, { enabled: boolean; accept: LifeCycleDragItemType[] }> {\n loading?: boolean;\n}\n\nexport interface LifeCycleProps extends BaseProps, NoChildrenProp {\n /** Pass reference to the LifeCycleComponent */\n ref?: Ref<HTMLDivElement>;\n /** Array of stages and its contents */\n items: StageItemProps[];\n /** Array of alternate stages and its contents */\n alternateItems?: StageItemProps[];\n /** Props for the task component */\n task?: TaskProps[];\n /** Props for the Stage component */\n stage?: StageProps;\n /** Props for the AlternatStage component */\n alternateStage?: StageProps;\n /** Props for the Cluster component */\n categories?: CategoriesProps[];\n /** Props for the Step component */\n step?: StepProps[];\n /** Call back function for on AddState */\n onAddStage?: () => void;\n /** Call back function to add alternate stages */\n onAddAlternateStage?: () => void;\n /** Selected stage or task or step */\n selectedItemId?: string;\n /** Callback function for updating the items following a drag drop event. */\n onDragDrop?: (event: LifeCycleDragDropEvent) => void;\n /**\n * Configuration to control which item types each lifecycle region can accept, and which types are draggable.\n * */\n dragDropConfig?: DragDropConfig;\n /** makes component read-only */\n readOnly?: boolean;\n}\n\nexport interface StageInfo {\n id: StageType;\n visual: {\n bgColor: string;\n bgHover: string;\n tailPointed?: boolean;\n headPointed?: boolean;\n };\n}\n\n// calculates the final stage info based on prev type and returns the final stage info\n// second param is mandatory for accurate results, optional only for the first stage\nexport const getStageInfo = (\n currentType: StageType,\n transitionType: StageItemProps['transitionType'],\n prevStageItem: StageItemProps,\n isLastItem = false,\n theme = Theme\n) => {\n const stageTypeDefaults: Record<StageType, StageInfo> = {\n start: {\n id: 'start',\n visual: {\n bgColor: theme.base.colors.blue.dark,\n bgHover: theme.base.colors.blue.medium,\n tailPointed: false,\n headPointed: true\n }\n },\n default: {\n id: 'default',\n visual: {\n bgColor: theme.base.colors.blue.medium,\n bgHover: theme.base.colors.blue.light,\n tailPointed: true,\n headPointed: true\n }\n },\n alternate: {\n id: 'alternate',\n visual: {\n bgColor: theme.base.colors.slate.dark,\n bgHover: theme.base.colors.slate.medium,\n tailPointed: false,\n headPointed: false\n }\n }\n };\n\n const resolutionStyle = {\n bgColor: readableHue(theme.base.colors.green.medium, theme.base.palette.light),\n bgHover: theme.base.colors.green.light\n };\n const clonedStageCopy = structuredClone(stageTypeDefaults);\n const currentStageInfo = clonedStageCopy[currentType] || clonedStageCopy.default;\n if (currentType !== 'alternate') {\n if (transitionType === 'resolution') {\n currentStageInfo.visual = {\n ...resolutionStyle,\n tailPointed: currentType !== 'start'\n };\n }\n if (transitionType === 'wait') {\n currentStageInfo.visual = {\n ...currentStageInfo.visual,\n tailPointed: currentType !== 'start',\n headPointed: false\n };\n }\n }\n\n // cloning, to avoid getting modified\n const result: StageInfo = {\n ...currentStageInfo,\n visual: {\n ...currentStageInfo.visual\n }\n };\n if (prevStageItem?.type) {\n const clonedStage = JSON.parse(JSON.stringify(stageTypeDefaults));\n const prevStageInfo = clonedStage[prevStageItem.type] || clonedStage.start;\n if (prevStageItem.type !== 'alternate') {\n if (prevStageItem.transitionType === 'resolution') {\n result.visual = {\n ...result.visual,\n tailPointed: false\n };\n }\n if (prevStageItem.transitionType === 'wait') {\n result.visual = {\n ...result.visual,\n ...{ tailPointed: false }\n };\n }\n } else {\n result.visual.tailPointed =\n currentStageInfo.visual.tailPointed && prevStageInfo.visual.headPointed;\n }\n }\n if (isLastItem) {\n result.visual.headPointed = false;\n }\n return result;\n};\n"]}
|
|
1
|
+
{"version":3,"file":"LifeCycle.types.js","sourceRoot":"","sources":["../../../src/components/LifeCycle/LifeCycle.types.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,SAAS,IAAI,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAmO7D,sFAAsF;AACtF,oFAAoF;AACpF,MAAM,CAAC,MAAM,YAAY,GAAG,CAC1B,WAAsB,EACtB,cAAgD,EAChD,aAA6B,EAC7B,UAAU,GAAG,KAAK,EAClB,KAAK,GAA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AAC;aAAM,CAAC;YACN,MAAM,CAAC,MAAM,CAAC,WAAW;gBACvB,gBAAgB,CAAC,MAAM,CAAC,WAAW,IAAI,aAAa,CAAC,MAAM,CAAC,WAAW,CAAC;QAC5E,CAAC;IACH,CAAC;IACD,IAAI,UAAU,EAAE,CAAC;QACf,MAAM,CAAC,MAAM,CAAC,WAAW,GAAG,KAAK,CAAC;IACpC,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC","sourcesContent":["import type { MouseEvent, Ref } from 'react';\n\nimport type {\n Action,\n StatusProps,\n NoChildrenProp,\n BaseProps,\n FormControlProps\n} from '@pega/cosmos-react-core';\nimport { WorkTheme as Theme } from '@pega/cosmos-react-core';\n\nimport type { LibraryItem } from '../ItemLibrary';\n\nimport type { VisualStepItemProps } from './Step';\n\nexport type StageType = 'start' | 'default' | 'alternate';\n\ninterface ItemIdentifiers {\n /** The index of the item within its list */\n index?: number;\n /** If true, this item belongs to an alternate lifecycle list */\n alternate?: boolean;\n}\n\nexport interface StepItemProps extends ItemIdentifiers {\n id: string;\n label: string;\n visual: VisualStepItemProps;\n status: { type?: StatusProps['variant'] | ''; label: string };\n error?: string;\n}\n\nexport interface TaskItemProps extends ItemIdentifiers {\n id: string;\n label: string;\n visual: {\n imgSrc: string;\n };\n error?: string;\n steps: StepItemProps[];\n subIndex?: number;\n}\n\nexport interface CategoryItemProps extends ItemIdentifiers {\n /** Data model should have id of the stage item */\n id: string;\n /** id to map with category items */\n categoryId: string;\n /** Data model should have the categoryData array */\n tasks: TaskItemProps[] | TaskItemProps[][];\n}\n\nexport interface StageItemProps extends ItemIdentifiers {\n /** Data model should have id of the stage item */\n id: string;\n /** Data model should have the stage label */\n label: string;\n /** Data model should have the categoryData array */\n categories: CategoryItemProps[];\n /** Data model should have the stageType as below */\n type: StageType;\n error?: string;\n /* Sets stage transition to wait or resolution */\n transitionType?: 'wait' | 'resolution' | undefined;\n}\n\nexport interface LifeCycleActionParam {\n value?: string;\n stage?: StageItemProps;\n task?: TaskItemProps;\n category?: CategoryItemProps;\n step?: StepItemProps;\n type?: 'Stage' | 'Step' | 'Task' | 'Alternate Stage';\n routeTo?: string;\n}\n\nexport interface LifeCycleAction extends Omit<Action, 'onClick'> {\n onClick: (\n param: LifeCycleActionParam,\n e: MouseEvent<HTMLButtonElement | HTMLAnchorElement | HTMLInputElement>,\n menuButtonEl?: HTMLButtonElement\n ) => void;\n}\n\nexport interface CategoriesItemProps {\n label: string;\n id: string;\n}\n\nexport interface StageProps extends Omit<FormControlProps, 'status' | 'id'> {\n /** Label for the region. */\n label?: string;\n /** Pass an array of Action objects to append button(s) inline with the Input. */\n actions?: Record<StageType, LifeCycleAction[]> | LifeCycleAction[];\n /** Callback for Add stage */\n onAddStage?: () => void;\n /** Callback for Adding alternate stage */\n onAddAlternateStage?: () => void;\n /** callback for Click of stage */\n onClick?: (param: LifeCycleActionParam, e: MouseEvent) => void;\n}\n\nexport interface CategoriesProps extends CategoriesItemProps {\n /** height property used to manipulate height of catergory dom */\n height?: number;\n elementId?: string;\n}\n\nexport interface TaskProps extends Omit<FormControlProps, 'status' | 'id'> {\n /** Pass an array of Action objects to append button(s) inline with the Input. */\n actions?: LifeCycleAction[];\n /** Tooltip for adding items to the task component */\n addStepTitle?: string;\n /** Region for adding the task component */\n addTask?: {\n title: string;\n showOnce: boolean;\n onAddTask?: LifeCycleAction['onClick'];\n };\n /** Callback for adding a step when nodeLibrary is provided. */\n onAddStep?: (param: LifeCycleActionParam, selectedItem: LibraryItem) => void;\n /** Callback for adding a step when nodeLibrary is not provided. */\n onAddCustomStep?: (param: LifeCycleActionParam) => void;\n /** callback for Click of a task */\n onClick?: (param: LifeCycleActionParam, e: MouseEvent) => void;\n /** Types of Nodes */\n nodeLibrary?: LibraryItem[];\n}\n\nexport interface CategoryProps extends BaseProps, NoChildrenProp {\n ref?: Ref<HTMLOListElement | HTMLDivElement>;\n /** Pass the category items */\n item: CategoryItemProps;\n /** Enable the title for categories */\n showTitle?: boolean;\n /** Props of the categoryColumn */\n category?: CategoriesProps;\n /** Task component prop */\n task?: TaskProps;\n /** Stage data - to be passed in callbacks */\n stageItem: StageItemProps;\n /** Id for the component */\n id: string;\n}\n\nexport interface StepProps extends Omit<FormControlProps, 'status' | 'id'> {\n /** Pass an array of Action objects to append button(s) inline with the Input. */\n actions?: LifeCycleAction[];\n /** If true, step names will wrap rather than truncate. */\n wrap?: boolean;\n /** callback for Click of a step */\n onClick?: (param: LifeCycleActionParam, e: MouseEvent) => void;\n}\n\nexport interface IndexData {\n /** Determines if the item part of an alternate stage. */\n alternate: boolean;\n /** The index of the parent stage to the item, or the item itself. */\n stage?: number;\n /** The index of the parent category to the item. */\n category?: number;\n /** The index of the parent task to the item, or the item itself. */\n task?: number;\n /** The index of the parent stage to the item, or the item itself, if the task is nested within another task. */\n subTask?: number;\n /** The index of the step item. */\n step?: number;\n}\n\nexport type LifeCycleDragItemType =\n | 'stage'\n | 'step'\n | 'task'\n | 'alternate-stage'\n | 'alternate-step'\n | 'alternate-task';\n\nexport type LifeCycleDragDropDirection = 'next' | 'prev';\n\nexport interface LifeCycleDragDropEvent {\n /** The type of item that was moved. */\n type: 'stage' | 'step' | 'task';\n /** The indices of the source item. */\n sourceData: IndexData;\n /** The indices of the target location. */\n targetData: IndexData;\n}\n\nexport interface DragDropConfig\n extends Record<LifeCycleDragItemType, { enabled: boolean; accept: LifeCycleDragItemType[] }> {\n loading?: boolean;\n}\n\nexport interface LifeCycleProps extends BaseProps, NoChildrenProp {\n /** Pass reference to the LifeCycleComponent */\n ref?: Ref<HTMLDivElement>;\n /** Array of stages and its contents */\n items: StageItemProps[];\n /** Array of alternate stages and its contents */\n alternateItems?: StageItemProps[];\n /** Props for the task component */\n task?: TaskProps[];\n /** Props for the Stage component */\n stage?: StageProps;\n /** Props for the AlternatStage component */\n alternateStage?: StageProps;\n /** Props for the Cluster component */\n categories?: CategoriesProps[];\n /** Props for the Step component */\n step?: StepProps[];\n /** Call back function for on AddState */\n onAddStage?: () => void;\n /** Call back function to add alternate stages */\n onAddAlternateStage?: () => void;\n /** Selected stage or task or step */\n selectedItemId?: string;\n /** Callback function for updating the items following a drag drop event. */\n onDragDrop?: (event: LifeCycleDragDropEvent) => void;\n /**\n * Configuration to control which item types each lifecycle region can accept, and which types are draggable.\n * */\n dragDropConfig?: DragDropConfig;\n /** makes component read-only */\n readOnly?: boolean;\n}\n\nexport interface StageInfo {\n id: StageType;\n visual: {\n bgColor: string;\n bgHover: string;\n tailPointed?: boolean;\n headPointed?: boolean;\n };\n}\n\n// calculates the final stage info based on prev type and returns the final stage info\n// second param is mandatory for accurate results, optional only for the first stage\nexport const getStageInfo = (\n currentType: StageType,\n transitionType: StageItemProps['transitionType'],\n prevStageItem: StageItemProps,\n isLastItem = false,\n theme = Theme\n) => {\n const stageTypeDefaults: Record<StageType, StageInfo> = {\n start: {\n id: 'start',\n visual: {\n bgColor: theme.components.lifecycle.stage.start.background,\n bgHover: theme.components.lifecycle.stage.start['hover-color'],\n tailPointed: false,\n headPointed: true\n }\n },\n default: {\n id: 'default',\n visual: {\n bgColor: theme.components.lifecycle.stage.default.background,\n bgHover: theme.components.lifecycle.stage.default['hover-color'],\n tailPointed: true,\n headPointed: true\n }\n },\n alternate: {\n id: 'alternate',\n visual: {\n bgColor: theme.components.lifecycle.stage.alternate.background,\n bgHover: theme.components.lifecycle.stage.alternate['hover-color'],\n tailPointed: false,\n headPointed: false\n }\n }\n };\n\n const resolutionStyle = {\n bgColor: theme.components.lifecycle.stage.resolution.background,\n bgHover: theme.components.lifecycle.stage.resolution['hover-color']\n };\n const clonedStageCopy = structuredClone(stageTypeDefaults);\n const currentStageInfo = clonedStageCopy[currentType] || clonedStageCopy.default;\n if (currentType !== 'alternate') {\n if (transitionType === 'resolution') {\n currentStageInfo.visual = {\n ...resolutionStyle,\n tailPointed: currentType !== 'start'\n };\n }\n if (transitionType === 'wait') {\n currentStageInfo.visual = {\n ...currentStageInfo.visual,\n tailPointed: currentType !== 'start',\n headPointed: false\n };\n }\n }\n\n // cloning, to avoid getting modified\n const result: StageInfo = {\n ...currentStageInfo,\n visual: {\n ...currentStageInfo.visual\n }\n };\n if (prevStageItem?.type) {\n const clonedStage = JSON.parse(JSON.stringify(stageTypeDefaults));\n const prevStageInfo = clonedStage[prevStageItem.type] || clonedStage.start;\n if (prevStageItem.type !== 'alternate') {\n if (prevStageItem.transitionType === 'resolution') {\n result.visual = {\n ...result.visual,\n tailPointed: false\n };\n }\n if (prevStageItem.transitionType === 'wait') {\n result.visual = {\n ...result.visual,\n ...{ tailPointed: false }\n };\n }\n } else {\n result.visual.tailPointed =\n currentStageInfo.visual.tailPointed && prevStageInfo.visual.headPointed;\n }\n }\n if (isLastItem) {\n result.visual.headPointed = false;\n }\n return result;\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LifeCycleDragDropList.d.ts","sourceRoot":"","sources":["../../../src/components/LifeCycle/LifeCycleDragDropList.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAa,MAAM,OAAO,CAAC;AAIjE,OAAO,KAAK,EACV,MAAM,EACN,SAAS,EACT,YAAY,EACZ,cAAc,EAEd,UAAU,EACX,MAAM,yBAAyB,CAAC;AAEjC,OAAO,KAAK,EAAE,aAAa,EAA4B,MAAM,wBAAwB,CAAC;AAEtF,OAAO,KAAK,EACV,SAAS,EAET,qBAAqB,EACrB,cAAc,EACf,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"LifeCycleDragDropList.d.ts","sourceRoot":"","sources":["../../../src/components/LifeCycle/LifeCycleDragDropList.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAa,MAAM,OAAO,CAAC;AAIjE,OAAO,KAAK,EACV,MAAM,EACN,SAAS,EACT,YAAY,EACZ,cAAc,EAEd,UAAU,EACX,MAAM,yBAAyB,CAAC;AAEjC,OAAO,KAAK,EAAE,aAAa,EAA4B,MAAM,wBAAwB,CAAC;AAEtF,OAAO,KAAK,EACV,SAAS,EAET,qBAAqB,EACrB,cAAc,EACf,MAAM,mBAAmB,CAAC;AAO3B,UAAU,0BAA0B,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,CAC5D,SAAQ,MAAM,EACZ,SAAS,EACT,cAAc,EACd,UAAU,EACV,IAAI,CAAC,cAAc,EAAE,YAAY,CAAC;IACpC,qCAAqC;IACrC,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,wCAAwC;IACxC,IAAI,EAAE,qBAAqB,CAAC;IAC5B,+EAA+E;IAC/E,YAAY,EAAE,SAAS,CAAC;IACxB,+CAA+C;IAC/C,KAAK,EAAE,aAAa,CAAC,CAAC,CAAC,EAAE,CAAC;IAC1B,kFAAkF;IAClF,YAAY,EAAE,aAAa,CAAC,CAAC,CAAC,CAAC;IAC/B,kFAAkF;IAClF,kBAAkB,CAAC,EAAE,SAAS,CAAC;CAChC;AAqBD,QAAA,MAAM,qBAAqB,GAAI,CAAC,SAAS,MAAM,GAAG,MAAM,EAAE,4IAWvD,0BAA0B,CAAC,CAAC,CAAC,GAAG,YAAY,4CAoZ9C,CAAC;AAEF,eAAe,qBAAqB,CAAC"}
|
|
@@ -31,6 +31,16 @@ const LifeCycleDragDropList = ({ testId, id: idProp, type, listLocation, items,
|
|
|
31
31
|
step: newIndex ?? data.item.index
|
|
32
32
|
};
|
|
33
33
|
}
|
|
34
|
+
if (item.type === 'task' || item.type === 'alternate-task') {
|
|
35
|
+
const data = item.data;
|
|
36
|
+
return {
|
|
37
|
+
alternate: !!data.stageItem.alternate,
|
|
38
|
+
stage: data.stageItem.index,
|
|
39
|
+
category: data.categoryItem.index,
|
|
40
|
+
task: newIndex ?? data.item.index,
|
|
41
|
+
subTask: data.item.subIndex
|
|
42
|
+
};
|
|
43
|
+
}
|
|
34
44
|
return { alternate: false, stage: -1 };
|
|
35
45
|
};
|
|
36
46
|
const getItemRects = () => {
|
|
@@ -114,7 +124,13 @@ const LifeCycleDragDropList = ({ testId, id: idProp, type, listLocation, items,
|
|
|
114
124
|
const prevIndex = clonedItems.findIndex(({ id }) => id === item.id);
|
|
115
125
|
const insertIndex = getInsertIndex(item, monitor);
|
|
116
126
|
const targetData = { ...listLocation };
|
|
117
|
-
|
|
127
|
+
if (normalizedType === 'task' && listLocation.subTask === undefined) {
|
|
128
|
+
targetData.task = listLocation.task;
|
|
129
|
+
targetData.subTask = insertIndex;
|
|
130
|
+
}
|
|
131
|
+
else {
|
|
132
|
+
targetData[normalizedType] = insertIndex;
|
|
133
|
+
}
|
|
118
134
|
item.targetData = targetData;
|
|
119
135
|
item.targetListId = listId;
|
|
120
136
|
item.changeTarget = i => triggerOnChange(i.sourceData, i.targetData);
|
|
@@ -244,7 +260,10 @@ const LifeCycleDragDropList = ({ testId, id: idProp, type, listLocation, items,
|
|
|
244
260
|
const item = newItems.splice(index, 1)[0];
|
|
245
261
|
newItems.splice(index - 1, 0, {
|
|
246
262
|
...item,
|
|
247
|
-
targetData: {
|
|
263
|
+
targetData: {
|
|
264
|
+
...itemData,
|
|
265
|
+
[normalizedType === 'task' ? 'subTask' : normalizedType]: index - 1
|
|
266
|
+
}
|
|
248
267
|
});
|
|
249
268
|
setClonedItems(newItems);
|
|
250
269
|
}
|
|
@@ -252,7 +271,10 @@ const LifeCycleDragDropList = ({ testId, id: idProp, type, listLocation, items,
|
|
|
252
271
|
const item = newItems.splice(index, 1)[0];
|
|
253
272
|
newItems.splice(index + 1, 0, {
|
|
254
273
|
...item,
|
|
255
|
-
targetData: {
|
|
274
|
+
targetData: {
|
|
275
|
+
...itemData,
|
|
276
|
+
[normalizedType === 'task' ? 'subTask' : normalizedType]: index + 1
|
|
277
|
+
}
|
|
256
278
|
});
|
|
257
279
|
setClonedItems(newItems);
|
|
258
280
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LifeCycleDragDropList.js","sourceRoot":"","sources":["../../../src/components/LifeCycle/LifeCycleDragD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,IAAI,EAAE,IAAI,CAAC,IAAI,KACX,IAAI,CAAC,IAAI,EACb,OAAO,EAAE,OAAO,EAChB,UAAU,EAAE,UAAU,KAClB,SAAS,EACb,UAAU,EAAE,CAAC,CAAC,IAAI,CAAC,YAAY,GAC/B,CACH,CAAC;gCACJ,CAAC,IApBI,IAAI,CAAC,EAAE,CAqBF,CACb,CAAC;wBACJ,CAAC,CAAC,EAED,kBAAkB,IACT,CACb,CAAC;YACJ,CAAC,GACS,GACiB,CAChC,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,qBAAqB,CAAC","sourcesContent":["import { useState, useRef, useMemo, useContext, useLayoutEffect, useEffect } from 'react';\nimport type { ComponentType, ReactNode, RefObject } from 'react';\nimport type { DragSourceMonitor, DropTargetMonitor } from 'react-dnd';\n\nimport { useElement, useUID } from '@pega/cosmos-react-core';\nimport type {\n AsProp,\n BaseProps,\n ForwardProps,\n NoChildrenProp,\n OmitStrict,\n TestIdProp\n} from '@pega/cosmos-react-core';\nimport { Draggable, DragDropListContext, Droppable } from '@pega/cosmos-react-dnd';\nimport type { DraggableItem, DragDropListContextValue } from '@pega/cosmos-react-dnd';\n\nimport type {\n IndexData,\n LifeCycleDragDropEvent,\n LifeCycleDragItemType,\n LifeCycleProps\n} from './LifeCycle.types';\nimport type { StageComponentProps } from './Stage';\nimport type { StepComponentProps } from './Step';\nimport LifeCycleContext from './LifeCycleContext';\nimport { getListLocation } from './utils';\n\ninterface LifeCycleDragDropListProps<T extends object = object>\n extends AsProp,\n BaseProps,\n NoChildrenProp,\n TestIdProp,\n Pick<LifeCycleProps, 'onDragDrop'> {\n /** Unique identifier for the list */\n id?: string;\n /** The type of item within the list. */\n type: LifeCycleDragItemType;\n /** A set of indices that identify the list's location within the LifeCycle. */\n listLocation: IndexData;\n /** Array of data objects used for the list. */\n items: DraggableItem<T>[];\n /** User defined function that should return content for the draggable element. */\n itemRenderer: ComponentType<T>;\n /** A region for non-list item elements to be included in the droppable region. */\n additionalDropZone?: ReactNode;\n}\n\ninterface LifeCycleDragDropListItem<T extends object = object> extends DraggableItem<T> {\n /** Returns the dragged item to its original position. */\n returnToSource?: (item: DraggableItem<T>) => void;\n /** Removes the dragged item from its original position. */\n removeFromSource?: () => void;\n /** Triggers onDragDrop with data related to the new item position. */\n changeTarget?: (item: LifeCycleDragDropListItem<T>) => void;\n /** Data related to the item being dragged. */\n sourceData?: LifeCycleDragDropEvent['sourceData'];\n /** Data related to the target position of the dragged item. */\n targetData?: LifeCycleDragDropEvent['targetData'];\n /** The id of the list that the dragged item originated from. */\n sourceListId?: string;\n /** The id of the list that the item was dropped into. */\n targetListId?: string;\n /** Ref for the items in the droppable list. */\n targetItemsRef?: RefObject<LifeCycleDragDropListItem<T>[]>;\n}\n\nconst LifeCycleDragDropList = <T extends object = object>({\n testId,\n id: idProp,\n type,\n listLocation,\n items,\n itemRenderer: ItemRenderer,\n additionalDropZone,\n onDragDrop,\n as: Component = 'ul',\n ...restProps\n}: LifeCycleDragDropListProps<T> & ForwardProps) => {\n const { lifeCycleData, dragDropConfig, draggedItem, setDraggedItem } =\n useContext(LifeCycleContext);\n const [clonedItems, setClonedItems] = useState<LifeCycleDragDropListItem<T>[]>(items);\n const draggedItemRef = useRef<LifeCycleDragDropListItem<T> | null>(null);\n const draggedItemElRef = useRef<HTMLElement | null>(null);\n const itemHoveringRef = useRef(false);\n const itemRectsRef = useRef<DOMRect[] | null>(null);\n const [listEl, setListEl] = useElement<HTMLElement>();\n const uniqueId = useUID();\n const listId = idProp ?? uniqueId;\n\n const normalizedType = type.replace('alternate-', '') as LifeCycleDragDropEvent['type'];\n\n const getItemData = (\n item: LifeCycleDragDropListItem<T>,\n newIndex?: number\n ): LifeCycleDragDropEvent['sourceData'] => {\n if (item.type === 'stage' || item.type === 'alternate-stage') {\n const data = item.data as StageComponentProps;\n return { alternate: !!data.item.alternate, stage: newIndex ?? data.item.index };\n }\n if (item.type === 'step' || item.type === 'alternate-step') {\n const data = item.data as StepComponentProps;\n return {\n alternate: !!data.item.alternate,\n stage: data.stageItem.index,\n category: data.categoryItem.index,\n task: data.taskItem.index,\n subTask: data.taskItem.subIndex,\n step: newIndex ?? data.item.index\n };\n }\n return { alternate: false, stage: -1 };\n };\n\n const getItemRects = (): DOMRect[] | null => {\n if (!listEl || listEl.children.length === 0) return null;\n return [...listEl.children].map(itemEl => {\n return itemEl.getBoundingClientRect();\n });\n };\n\n useLayoutEffect(() => {\n if (\n !dragDropConfig.loading &&\n (!draggedItem?.navigatingWithKeyboard ||\n (draggedItem?.navigatingWithKeyboard && !draggedItemRef.current))\n ) {\n setClonedItems(items);\n }\n }, [items]);\n\n const internalItemsRef = useRef(clonedItems);\n internalItemsRef.current = clonedItems;\n\n const triggerOnChange = (\n sourceData?: LifeCycleDragDropEvent['sourceData'],\n targetData?: LifeCycleDragDropEvent['targetData']\n ) => {\n if (\n !onDragDrop ||\n !sourceData ||\n !targetData ||\n JSON.stringify(sourceData) === JSON.stringify(targetData)\n )\n return;\n onDragDrop({\n type: normalizedType,\n sourceData,\n targetData\n });\n };\n\n const getInsertIndex = (\n item: DraggableItem<T>,\n monitor: DropTargetMonitor | DragSourceMonitor\n ): number => {\n itemRectsRef.current = getItemRects();\n const { current: itemRects } = itemRectsRef;\n let insertIndex = -1;\n const prevIndex = clonedItems.findIndex(({ id }) => id === item.id);\n\n const clientXY = monitor.getClientOffset();\n if (!itemRects || !clientXY) return insertIndex;\n\n // If dragging stages, position must be calculated on the x-axis rather than the y-axis\n const dragPreviewRectAnchor = normalizedType === 'stage' ? clientXY.x : clientXY.y;\n const orientation = normalizedType === 'stage' ? 'horizontal' : 'vertical';\n\n const calculateMiddle = ({ left, right, top, bottom }: DOMRect): number => {\n if (orientation === 'horizontal') {\n return left + (right - left) / 2;\n }\n return top + (bottom - top) / 2;\n };\n\n const atHead = dragPreviewRectAnchor < calculateMiddle(itemRects[0]);\n const atTail = dragPreviewRectAnchor >= calculateMiddle(itemRects[itemRects.length - 1]);\n\n if (atHead) {\n insertIndex = 0;\n } else if (atTail) {\n insertIndex = prevIndex === itemRects.length - 1 ? prevIndex : itemRects.length;\n } else {\n itemRects.some((rect, i, rects) => {\n if (i === rects.length - 1) {\n if (prevIndex === i) insertIndex = i;\n return true;\n }\n const afterCurrent = dragPreviewRectAnchor >= calculateMiddle(rect);\n const beforeNext = dragPreviewRectAnchor < calculateMiddle(rects[i + 1]);\n\n if (afterCurrent && beforeNext) {\n if (prevIndex !== -1 && i >= prevIndex) insertIndex = i;\n else insertIndex = i + 1;\n return true;\n }\n return false;\n });\n }\n\n return insertIndex;\n };\n\n // Re-arrange items within the applicable lists in relation to the position of the item being dragged\n const positionItems = (item: LifeCycleDragDropListItem<T>, monitor: DropTargetMonitor): void => {\n if (!monitor.canDrop() || !monitor.isOver({ shallow: true })) return;\n\n const prevIndex = clonedItems.findIndex(({ id }) => id === item.id);\n\n const insertIndex = getInsertIndex(item, monitor);\n const targetData = { ...listLocation };\n targetData[normalizedType] = insertIndex;\n item.targetData = targetData;\n item.targetListId = listId;\n\n item.changeTarget = i => triggerOnChange(i.sourceData, i.targetData);\n item.targetItemsRef = internalItemsRef;\n\n let newItems: DraggableItem<T>[];\n\n if (prevIndex !== -1) {\n if (insertIndex === prevIndex) return;\n\n newItems = clonedItems.filter(({ id }) => id !== item.id);\n newItems.splice(insertIndex, 0, item);\n\n setClonedItems(newItems);\n } else {\n newItems = [...clonedItems];\n newItems.splice(insertIndex, 0, item);\n\n setClonedItems(newItems);\n }\n };\n\n // Setup data to manage the item being dragged\n const onBegin =\n (itemId: DraggableItem<T>['id']) =>\n (): OmitStrict<LifeCycleDragDropListItem<T>, keyof DraggableItem<T>> => {\n setDraggedItem({ type: normalizedType, id: itemId, navigatingWithKeyboard: false });\n\n const initialIndex = clonedItems.findIndex(({ id }) => id === itemId);\n const itemToDrag = clonedItems[initialIndex];\n draggedItemRef.current = { ...itemToDrag, sourceListId: listId };\n if (listEl) {\n draggedItemElRef.current = listEl.querySelector(`[id=\"${itemToDrag.id}\"]`);\n if (draggedItemElRef.current) {\n draggedItemElRef.current.setAttribute('style', 'opacity: 0.5');\n }\n }\n const itemData = getItemData(itemToDrag);\n\n return {\n returnToSource: (item: DraggableItem<T>) => {\n setClonedItems(currentItems => {\n const newItems = currentItems.filter(({ id }) => id !== itemId);\n newItems.splice(initialIndex, 0, item);\n return newItems;\n });\n },\n removeFromSource: () => {\n setClonedItems(currentItems => currentItems.filter(({ id }) => id !== itemId));\n },\n changeTarget: i => triggerOnChange(i.sourceData, i.targetData),\n targetItemsRef: internalItemsRef,\n sourceData: itemData,\n targetData: itemData,\n sourceListId: listId,\n targetListId: listId\n };\n };\n\n // Execute necessary actions for when the item is dropped\n const onEnd = (item: LifeCycleDragDropListItem<T> | undefined, monitor: DragSourceMonitor) => {\n if (!item) return;\n\n if (monitor.didDrop()) {\n if (JSON.stringify(item.sourceData) === JSON.stringify(item.targetData)) {\n setDraggedItem(undefined);\n } else {\n item.changeTarget?.(item);\n if (item.sourceListId !== item.targetListId) {\n item.removeFromSource?.();\n }\n }\n } else {\n setDraggedItem(undefined);\n item.returnToSource?.(item);\n }\n draggedItemRef.current = null;\n if (draggedItemElRef.current) {\n draggedItemElRef.current.setAttribute('style', 'opacity: unset');\n draggedItemElRef.current = null;\n }\n };\n\n const contextValue: DragDropListContextValue = useMemo(\n () => ({\n orientation: normalizedType === 'stage' ? 'horizontal' : 'vertical',\n keyboardDragStart: itemId => {\n const index = clonedItems.findIndex(({ id }) => id === itemId);\n if (index === -1) return;\n\n const itemToDrag = clonedItems[index];\n\n if (itemToDrag) {\n setDraggedItem({ type: normalizedType, id: itemId, navigatingWithKeyboard: true });\n const itemData = getItemData(itemToDrag);\n\n itemToDrag.returnToSource = (item: DraggableItem<T>) => {\n setClonedItems(currentItems => {\n const newItems = currentItems.filter(({ id }) => id !== itemId);\n newItems.splice(index, 0, item);\n return newItems;\n });\n };\n itemToDrag.sourceData = itemData;\n itemToDrag.targetData = itemData;\n itemToDrag.sourceListId = listId;\n itemToDrag.targetListId = listId;\n\n draggedItemRef.current = itemToDrag;\n setClonedItems(currentItems => {\n const newItems = currentItems.filter(({ id }) => id !== itemId);\n newItems.splice(index, 0, itemToDrag);\n return newItems;\n });\n }\n },\n keyboardDragEnd: itemId => {\n const item = clonedItems.find(({ id }) => id === itemId);\n if (!item) return;\n\n draggedItemRef.current = null;\n triggerOnChange(item.sourceData, item.targetData);\n },\n keyboardDragCancel: itemId => {\n const index = clonedItems.findIndex(({ id }) => id === itemId);\n if (index === -1) return;\n\n setDraggedItem(undefined);\n draggedItemRef.current = null;\n clonedItems[index].returnToSource?.(clonedItems[index]);\n },\n keyboardReorderItem: (itemId, direction) => {\n const index = clonedItems.findIndex(({ id }) => id === itemId);\n if (index === -1) return;\n\n const itemData = getItemData(clonedItems[index]);\n\n const newItems = [...clonedItems];\n\n if (direction === 'prev' && index !== 0) {\n const item = newItems.splice(index, 1)[0];\n newItems.splice(index - 1, 0, {\n ...item,\n targetData: { ...itemData, [normalizedType]: index - 1 }\n });\n setClonedItems(newItems);\n } else if (direction === 'next' && index !== clonedItems.length - 1) {\n const item = newItems.splice(index, 1)[0];\n newItems.splice(index + 1, 0, {\n ...item,\n targetData: { ...itemData, [normalizedType]: index + 1 }\n });\n setClonedItems(newItems);\n }\n },\n keyboardMoveLists: (itemId, direction) => {\n const item = clonedItems.find(({ id }) => id === itemId);\n if (!item) return;\n\n draggedItemRef.current = null;\n setDraggedItem({ type: normalizedType, id: itemId, navigatingWithKeyboard: false });\n const itemData = getItemData(item);\n\n const targetListLocation = getListLocation(\n listLocation,\n normalizedType,\n lifeCycleData,\n direction\n );\n\n if (targetListLocation) {\n triggerOnChange(itemData, targetListLocation);\n }\n }\n }),\n [clonedItems, triggerOnChange, normalizedType, listLocation, lifeCycleData]\n );\n\n return (\n <DragDropListContext.Provider value={contextValue}>\n <Droppable\n accept={dragDropConfig[type].accept}\n onHover={positionItems}\n onDrop={positionItems}\n >\n {({ dropRef, collected: { isOver } }) => {\n // Reset list items to original state if the item is no longer hovering over the list\n // The useEffect is necessary for setting state within a render function\n // eslint-disable-next-line react-hooks/rules-of-hooks\n useEffect(() => {\n if (!isOver && itemHoveringRef.current) {\n const sourceItem = clonedItems.find(i => i.id === draggedItemRef.current?.id);\n if (!sourceItem && !dragDropConfig.loading) {\n // If item dragged away from target list, reset the items in that list to their original state\n setClonedItems(items);\n }\n }\n itemHoveringRef.current = isOver;\n }, [isOver]);\n\n return (\n <Component\n ref={(el: HTMLElement) => {\n dropRef(el);\n setListEl(el);\n }}\n {...restProps}\n >\n {clonedItems.map(item => {\n return (\n <Draggable\n key={item.id}\n id={item.id}\n type={item.type}\n data={item.data}\n onBegin={onBegin(item.id)}\n onEnd={onEnd}\n >\n {({ dragRef, previewRef, collected }) => {\n return (\n <ItemRenderer\n testId={testId}\n id={item.id}\n type={item.type}\n {...item.data}\n dragRef={dragRef}\n previewRef={previewRef}\n {...collected}\n isDragging={!!item.sourceListId}\n />\n );\n }}\n </Draggable>\n );\n })}\n\n {additionalDropZone}\n </Component>\n );\n }}\n </Droppable>\n </DragDropListContext.Provider>\n );\n};\n\nexport default LifeCycleDragDropList;\n"]}
|
|
1
|
+
{"version":3,"file":"LifeCycleDragDropList.js","sourceRoot":"","sources":["../../../src/components/LifeCycle/LifeCycleDragDropList.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAI1F,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAS7D,OAAO,EAAE,SAAS,EAAE,mBAAmB,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAYnF,OAAO,gBAAgB,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAyC1C,MAAM,qBAAqB,GAAG,CAA4B,EACxD,MAAM,EACN,EAAE,EAAE,MAAM,EAC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C,SAAS,IAER,EAAE,EAAE,IAAI,CAAC,EAAE,EACX,IAAI,EAAE,IAAI,CAAC,IAAI,EACf,IAAI,EAAE,IAAI,CAAC,IAAI,EACf,OAAO,EAAE,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,EACzB,KAAK,EAAE,KAAK,YAEX,CAAC,EAAE,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,EAAE,EAAE;oCACtC,OAAO,CACL,KAAC,YAAY,IACX,MAAM,EAAE,MAAM,EACd,EAAE,EAAE,IAAI,CAAC,EAAE,EACX,IAAI,EAAE,IAAI,CAAC,IAAI,KACX,IAAI,CAAC,IAAI,EACb,OAAO,EAAE,OAAO,EAChB,UAAU,EAAE,UAAU,KAClB,SAAS,EACb,UAAU,EAAE,CAAC,CAAC,IAAI,CAAC,YAAY,GAC/B,CACH,CAAC;gCACJ,CAAC,IApBI,IAAI,CAAC,EAAE,CAqBF,CACb,CAAC;wBACJ,CAAC,CAAC,EAED,kBAAkB,IACT,CACb,CAAC;YACJ,CAAC,GACS,GACiB,CAChC,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,qBAAqB,CAAC","sourcesContent":["import { useState, useRef, useMemo, useContext, useLayoutEffect, useEffect } from 'react';\nimport type { ComponentType, ReactNode, RefObject } from 'react';\nimport type { DragSourceMonitor, DropTargetMonitor } from 'react-dnd';\n\nimport { useElement, useUID } from '@pega/cosmos-react-core';\nimport type {\n AsProp,\n BaseProps,\n ForwardProps,\n NoChildrenProp,\n OmitStrict,\n TestIdProp\n} from '@pega/cosmos-react-core';\nimport { Draggable, DragDropListContext, Droppable } from '@pega/cosmos-react-dnd';\nimport type { DraggableItem, DragDropListContextValue } from '@pega/cosmos-react-dnd';\n\nimport type {\n IndexData,\n LifeCycleDragDropEvent,\n LifeCycleDragItemType,\n LifeCycleProps\n} from './LifeCycle.types';\nimport type { StageComponentProps } from './Stage';\nimport type { StepComponentProps } from './Step';\nimport type { TaskComponentProps } from './Task';\nimport LifeCycleContext from './LifeCycleContext';\nimport { getListLocation } from './utils';\n\ninterface LifeCycleDragDropListProps<T extends object = object>\n extends AsProp,\n BaseProps,\n NoChildrenProp,\n TestIdProp,\n Pick<LifeCycleProps, 'onDragDrop'> {\n /** Unique identifier for the list */\n id?: string;\n /** The type of item within the list. */\n type: LifeCycleDragItemType;\n /** A set of indices that identify the list's location within the LifeCycle. */\n listLocation: IndexData;\n /** Array of data objects used for the list. */\n items: DraggableItem<T>[];\n /** User defined function that should return content for the draggable element. */\n itemRenderer: ComponentType<T>;\n /** A region for non-list item elements to be included in the droppable region. */\n additionalDropZone?: ReactNode;\n}\n\ninterface LifeCycleDragDropListItem<T extends object = object> extends DraggableItem<T> {\n /** Returns the dragged item to its original position. */\n returnToSource?: (item: DraggableItem<T>) => void;\n /** Removes the dragged item from its original position. */\n removeFromSource?: () => void;\n /** Triggers onDragDrop with data related to the new item position. */\n changeTarget?: (item: LifeCycleDragDropListItem<T>) => void;\n /** Data related to the item being dragged. */\n sourceData?: LifeCycleDragDropEvent['sourceData'];\n /** Data related to the target position of the dragged item. */\n targetData?: LifeCycleDragDropEvent['targetData'];\n /** The id of the list that the dragged item originated from. */\n sourceListId?: string;\n /** The id of the list that the item was dropped into. */\n targetListId?: string;\n /** Ref for the items in the droppable list. */\n targetItemsRef?: RefObject<LifeCycleDragDropListItem<T>[]>;\n}\n\nconst LifeCycleDragDropList = <T extends object = object>({\n testId,\n id: idProp,\n type,\n listLocation,\n items,\n itemRenderer: ItemRenderer,\n additionalDropZone,\n onDragDrop,\n as: Component = 'ul',\n ...restProps\n}: LifeCycleDragDropListProps<T> & ForwardProps) => {\n const { lifeCycleData, dragDropConfig, draggedItem, setDraggedItem } =\n useContext(LifeCycleContext);\n const [clonedItems, setClonedItems] = useState<LifeCycleDragDropListItem<T>[]>(items);\n const draggedItemRef = useRef<LifeCycleDragDropListItem<T> | null>(null);\n const draggedItemElRef = useRef<HTMLElement | null>(null);\n const itemHoveringRef = useRef(false);\n const itemRectsRef = useRef<DOMRect[] | null>(null);\n const [listEl, setListEl] = useElement<HTMLElement>();\n const uniqueId = useUID();\n const listId = idProp ?? uniqueId;\n\n const normalizedType = type.replace('alternate-', '') as LifeCycleDragDropEvent['type'];\n\n const getItemData = (\n item: LifeCycleDragDropListItem<T>,\n newIndex?: number\n ): LifeCycleDragDropEvent['sourceData'] => {\n if (item.type === 'stage' || item.type === 'alternate-stage') {\n const data = item.data as StageComponentProps;\n return { alternate: !!data.item.alternate, stage: newIndex ?? data.item.index };\n }\n if (item.type === 'step' || item.type === 'alternate-step') {\n const data = item.data as StepComponentProps;\n return {\n alternate: !!data.item.alternate,\n stage: data.stageItem.index,\n category: data.categoryItem.index,\n task: data.taskItem.index,\n subTask: data.taskItem.subIndex,\n step: newIndex ?? data.item.index\n };\n }\n\n if (item.type === 'task' || item.type === 'alternate-task') {\n const data = item.data as TaskComponentProps;\n\n return {\n alternate: !!data.stageItem.alternate,\n stage: data.stageItem.index,\n category: data.categoryItem.index,\n task: newIndex ?? data.item.index,\n subTask: data.item.subIndex\n };\n }\n\n return { alternate: false, stage: -1 };\n };\n\n const getItemRects = (): DOMRect[] | null => {\n if (!listEl || listEl.children.length === 0) return null;\n return [...listEl.children].map(itemEl => {\n return itemEl.getBoundingClientRect();\n });\n };\n\n useLayoutEffect(() => {\n if (\n !dragDropConfig.loading &&\n (!draggedItem?.navigatingWithKeyboard ||\n (draggedItem?.navigatingWithKeyboard && !draggedItemRef.current))\n ) {\n setClonedItems(items);\n }\n }, [items]);\n\n const internalItemsRef = useRef(clonedItems);\n internalItemsRef.current = clonedItems;\n\n const triggerOnChange = (\n sourceData?: LifeCycleDragDropEvent['sourceData'],\n targetData?: LifeCycleDragDropEvent['targetData']\n ) => {\n if (\n !onDragDrop ||\n !sourceData ||\n !targetData ||\n JSON.stringify(sourceData) === JSON.stringify(targetData)\n )\n return;\n onDragDrop({\n type: normalizedType,\n sourceData,\n targetData\n });\n };\n\n const getInsertIndex = (\n item: DraggableItem<T>,\n monitor: DropTargetMonitor | DragSourceMonitor\n ): number => {\n itemRectsRef.current = getItemRects();\n const { current: itemRects } = itemRectsRef;\n let insertIndex = -1;\n const prevIndex = clonedItems.findIndex(({ id }) => id === item.id);\n\n const clientXY = monitor.getClientOffset();\n if (!itemRects || !clientXY) return insertIndex;\n\n // If dragging stages, position must be calculated on the x-axis rather than the y-axis\n const dragPreviewRectAnchor = normalizedType === 'stage' ? clientXY.x : clientXY.y;\n const orientation = normalizedType === 'stage' ? 'horizontal' : 'vertical';\n\n const calculateMiddle = ({ left, right, top, bottom }: DOMRect): number => {\n if (orientation === 'horizontal') {\n return left + (right - left) / 2;\n }\n return top + (bottom - top) / 2;\n };\n\n const atHead = dragPreviewRectAnchor < calculateMiddle(itemRects[0]);\n const atTail = dragPreviewRectAnchor >= calculateMiddle(itemRects[itemRects.length - 1]);\n\n if (atHead) {\n insertIndex = 0;\n } else if (atTail) {\n insertIndex = prevIndex === itemRects.length - 1 ? prevIndex : itemRects.length;\n } else {\n itemRects.some((rect, i, rects) => {\n if (i === rects.length - 1) {\n if (prevIndex === i) insertIndex = i;\n return true;\n }\n const afterCurrent = dragPreviewRectAnchor >= calculateMiddle(rect);\n const beforeNext = dragPreviewRectAnchor < calculateMiddle(rects[i + 1]);\n\n if (afterCurrent && beforeNext) {\n if (prevIndex !== -1 && i >= prevIndex) insertIndex = i;\n else insertIndex = i + 1;\n return true;\n }\n return false;\n });\n }\n\n return insertIndex;\n };\n\n // Re-arrange items within the applicable lists in relation to the position of the item being dragged\n const positionItems = (item: LifeCycleDragDropListItem<T>, monitor: DropTargetMonitor): void => {\n if (!monitor.canDrop() || !monitor.isOver({ shallow: true })) return;\n\n const prevIndex = clonedItems.findIndex(({ id }) => id === item.id);\n\n const insertIndex = getInsertIndex(item, monitor);\n const targetData = { ...listLocation };\n\n if (normalizedType === 'task' && listLocation.subTask === undefined) {\n targetData.task = listLocation.task;\n targetData.subTask = insertIndex;\n } else {\n targetData[normalizedType] = insertIndex;\n }\n\n item.targetData = targetData;\n item.targetListId = listId;\n\n item.changeTarget = i => triggerOnChange(i.sourceData, i.targetData);\n item.targetItemsRef = internalItemsRef;\n\n let newItems: DraggableItem<T>[];\n\n if (prevIndex !== -1) {\n if (insertIndex === prevIndex) return;\n\n newItems = clonedItems.filter(({ id }) => id !== item.id);\n newItems.splice(insertIndex, 0, item);\n\n setClonedItems(newItems);\n } else {\n newItems = [...clonedItems];\n newItems.splice(insertIndex, 0, item);\n\n setClonedItems(newItems);\n }\n };\n\n // Setup data to manage the item being dragged\n const onBegin =\n (itemId: DraggableItem<T>['id']) =>\n (): OmitStrict<LifeCycleDragDropListItem<T>, keyof DraggableItem<T>> => {\n setDraggedItem({ type: normalizedType, id: itemId, navigatingWithKeyboard: false });\n\n const initialIndex = clonedItems.findIndex(({ id }) => id === itemId);\n const itemToDrag = clonedItems[initialIndex];\n draggedItemRef.current = { ...itemToDrag, sourceListId: listId };\n if (listEl) {\n draggedItemElRef.current = listEl.querySelector(`[id=\"${itemToDrag.id}\"]`);\n if (draggedItemElRef.current) {\n draggedItemElRef.current.setAttribute('style', 'opacity: 0.5');\n }\n }\n const itemData = getItemData(itemToDrag);\n\n return {\n returnToSource: (item: DraggableItem<T>) => {\n setClonedItems(currentItems => {\n const newItems = currentItems.filter(({ id }) => id !== itemId);\n newItems.splice(initialIndex, 0, item);\n return newItems;\n });\n },\n removeFromSource: () => {\n setClonedItems(currentItems => currentItems.filter(({ id }) => id !== itemId));\n },\n changeTarget: i => triggerOnChange(i.sourceData, i.targetData),\n targetItemsRef: internalItemsRef,\n sourceData: itemData,\n targetData: itemData,\n sourceListId: listId,\n targetListId: listId\n };\n };\n\n // Execute necessary actions for when the item is dropped\n const onEnd = (item: LifeCycleDragDropListItem<T> | undefined, monitor: DragSourceMonitor) => {\n if (!item) return;\n\n if (monitor.didDrop()) {\n if (JSON.stringify(item.sourceData) === JSON.stringify(item.targetData)) {\n setDraggedItem(undefined);\n } else {\n item.changeTarget?.(item);\n if (item.sourceListId !== item.targetListId) {\n item.removeFromSource?.();\n }\n }\n } else {\n setDraggedItem(undefined);\n item.returnToSource?.(item);\n }\n draggedItemRef.current = null;\n if (draggedItemElRef.current) {\n draggedItemElRef.current.setAttribute('style', 'opacity: unset');\n draggedItemElRef.current = null;\n }\n };\n\n const contextValue: DragDropListContextValue = useMemo(\n () => ({\n orientation: normalizedType === 'stage' ? 'horizontal' : 'vertical',\n keyboardDragStart: itemId => {\n const index = clonedItems.findIndex(({ id }) => id === itemId);\n if (index === -1) return;\n\n const itemToDrag = clonedItems[index];\n\n if (itemToDrag) {\n setDraggedItem({ type: normalizedType, id: itemId, navigatingWithKeyboard: true });\n const itemData = getItemData(itemToDrag);\n\n itemToDrag.returnToSource = (item: DraggableItem<T>) => {\n setClonedItems(currentItems => {\n const newItems = currentItems.filter(({ id }) => id !== itemId);\n newItems.splice(index, 0, item);\n return newItems;\n });\n };\n itemToDrag.sourceData = itemData;\n itemToDrag.targetData = itemData;\n itemToDrag.sourceListId = listId;\n itemToDrag.targetListId = listId;\n\n draggedItemRef.current = itemToDrag;\n setClonedItems(currentItems => {\n const newItems = currentItems.filter(({ id }) => id !== itemId);\n newItems.splice(index, 0, itemToDrag);\n return newItems;\n });\n }\n },\n keyboardDragEnd: itemId => {\n const item = clonedItems.find(({ id }) => id === itemId);\n if (!item) return;\n\n draggedItemRef.current = null;\n triggerOnChange(item.sourceData, item.targetData);\n },\n keyboardDragCancel: itemId => {\n const index = clonedItems.findIndex(({ id }) => id === itemId);\n if (index === -1) return;\n\n setDraggedItem(undefined);\n draggedItemRef.current = null;\n clonedItems[index].returnToSource?.(clonedItems[index]);\n },\n keyboardReorderItem: (itemId, direction) => {\n const index = clonedItems.findIndex(({ id }) => id === itemId);\n if (index === -1) return;\n\n const itemData = getItemData(clonedItems[index]);\n\n const newItems = [...clonedItems];\n\n if (direction === 'prev' && index !== 0) {\n const item = newItems.splice(index, 1)[0];\n newItems.splice(index - 1, 0, {\n ...item,\n targetData: {\n ...itemData,\n [normalizedType === 'task' ? 'subTask' : normalizedType]: index - 1\n }\n });\n setClonedItems(newItems);\n } else if (direction === 'next' && index !== clonedItems.length - 1) {\n const item = newItems.splice(index, 1)[0];\n newItems.splice(index + 1, 0, {\n ...item,\n targetData: {\n ...itemData,\n [normalizedType === 'task' ? 'subTask' : normalizedType]: index + 1\n }\n });\n setClonedItems(newItems);\n }\n },\n keyboardMoveLists: (itemId, direction) => {\n const item = clonedItems.find(({ id }) => id === itemId);\n if (!item) return;\n\n draggedItemRef.current = null;\n setDraggedItem({ type: normalizedType, id: itemId, navigatingWithKeyboard: false });\n const itemData = getItemData(item);\n\n const targetListLocation = getListLocation(\n listLocation,\n normalizedType,\n lifeCycleData,\n direction\n );\n\n if (targetListLocation) {\n triggerOnChange(itemData, targetListLocation);\n }\n }\n }),\n [clonedItems, triggerOnChange, normalizedType, listLocation, lifeCycleData]\n );\n\n return (\n <DragDropListContext.Provider value={contextValue}>\n <Droppable\n accept={dragDropConfig[type].accept}\n onHover={positionItems}\n onDrop={positionItems}\n >\n {({ dropRef, collected: { isOver } }) => {\n // Reset list items to original state if the item is no longer hovering over the list\n // The useEffect is necessary for setting state within a render function\n // eslint-disable-next-line react-hooks/rules-of-hooks\n useEffect(() => {\n if (!isOver && itemHoveringRef.current) {\n const sourceItem = clonedItems.find(i => i.id === draggedItemRef.current?.id);\n if (!sourceItem && !dragDropConfig.loading) {\n // If item dragged away from target list, reset the items in that list to their original state\n setClonedItems(items);\n }\n }\n itemHoveringRef.current = isOver;\n }, [isOver]);\n\n return (\n <Component\n ref={(el: HTMLElement) => {\n dropRef(el);\n setListEl(el);\n }}\n {...restProps}\n >\n {clonedItems.map(item => {\n return (\n <Draggable\n key={item.id}\n id={item.id}\n type={item.type}\n data={item.data}\n onBegin={onBegin(item.id)}\n onEnd={onEnd}\n >\n {({ dragRef, previewRef, collected }) => {\n return (\n <ItemRenderer\n testId={testId}\n id={item.id}\n type={item.type}\n {...item.data}\n dragRef={dragRef}\n previewRef={previewRef}\n {...collected}\n isDragging={!!item.sourceListId}\n />\n );\n }}\n </Draggable>\n );\n })}\n\n {additionalDropZone}\n </Component>\n );\n }}\n </Droppable>\n </DragDropListContext.Provider>\n );\n};\n\nexport default LifeCycleDragDropList;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Stage.d.ts","sourceRoot":"","sources":["../../../src/components/LifeCycle/Stage.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAqB,GAAG,EAAc,WAAW,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"Stage.d.ts","sourceRoot":"","sources":["../../../src/components/LifeCycle/Stage.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAqB,GAAG,EAAc,WAAW,EAAE,MAAM,OAAO,CAAC;AAiB7E,OAAO,KAAK,EAAE,SAAS,EAAU,+BAA+B,EAAE,MAAM,yBAAyB,CAAC;AAIlG,OAAO,KAAK,EAGV,SAAS,EACT,cAAc,EACd,UAAU,EACX,MAAM,mBAAmB,CAAC;AAE3B,OAAyB,EAAE,KAAK,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAElF,MAAM,WAAW,mBAAoB,SAAQ,SAAS,EAAE,UAAU;IAChE,GAAG,CAAC,EAAE,GAAG,CAAC,cAAc,CAAC,CAAC;IAC1B,8BAA8B;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,iCAAiC;IACjC,EAAE,EAAE,MAAM,CAAC;IACX,yCAAyC;IACzC,SAAS,EAAE,SAAS,CAAC;IACrB,2DAA2D;IAC3D,IAAI,EAAE,cAAc,CAAC;IACrB,iGAAiG;IACjG,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,WAAW,CAAC,WAAW,CAAC,CAAC;CACpC;AAED,eAAO,MAAM,iBAAiB;WACrB,MAAM,GAAG,SAAS;kBACX,qBAAqB,CAAC,aAAa,CAAC;SAkClD,CAAC;AAIH,eAAO,MAAM,kBAAkB,yGAK7B,CAAC;AAIH,eAAO,MAAM,cAAc,0LAQzB,CAAC;AAIH,eAAO,MAAM,WAAW;WAEb,MAAM;kBACC,qBAAqB,CAAC,aAAa,CAAC;eACvC,OAAO;kDAoIpB,CAAC;;;;AAmJH,wBAAmD"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef, useContext } from 'react';
|
|
3
3
|
import styled, { css } from 'styled-components';
|
|
4
|
-
import { Flex, Actions, defaultThemeProp, useDirection, StyledButton, Icon, useI18n,
|
|
4
|
+
import { Flex, Actions, defaultThemeProp, useDirection, StyledButton, Icon, useI18n, useTestIds, withTestIds, useElement, Tooltip, readableHue } from '@pega/cosmos-react-core';
|
|
5
5
|
import { DragHandle, StyledDragHandle } from '@pega/cosmos-react-dnd';
|
|
6
6
|
import { generateDynamicTestId } from './utils';
|
|
7
7
|
import { getStageTestIds } from './LifeCycle.test-ids';
|
|
@@ -15,7 +15,7 @@ export const StyledStageButton = styled.button(({ error, dragEnabled, theme }) =
|
|
|
15
15
|
overflow: hidden;
|
|
16
16
|
text-overflow: ellipsis;
|
|
17
17
|
white-space: nowrap;
|
|
18
|
-
text-align:
|
|
18
|
+
text-align: center;
|
|
19
19
|
margin-inline-start: calc(${dragEnabled ? 0.25 : 0.5} * ${theme.base.spacing});
|
|
20
20
|
padding-inline: calc(${dragEnabled ? 0.25 : 0.5} * ${theme.base.spacing});
|
|
21
21
|
background: transparent;
|
|
@@ -60,8 +60,8 @@ export const StyledWarnIcon = styled(Icon)(({ theme }) => {
|
|
|
60
60
|
StyledWarnIcon.defaultProps = defaultThemeProp;
|
|
61
61
|
export const StyledStage = styled.div(({ stageInfo, theme, error, dragEnabled, dragging, transitionType }) => {
|
|
62
62
|
const { visual: { bgColor, tailPointed, headPointed } } = stageInfo;
|
|
63
|
+
const readableBgColor = readableHue(bgColor, theme.components.lifecycle.stage['foreground-color']);
|
|
63
64
|
const { rtl } = useDirection();
|
|
64
|
-
const contrastColor = readableColor(bgColor);
|
|
65
65
|
const borderRadius = 'border-radius';
|
|
66
66
|
const roundedEndsStyles = css `
|
|
67
67
|
content: '';
|
|
@@ -77,10 +77,13 @@ export const StyledStage = styled.div(({ stageInfo, theme, error, dragEnabled, d
|
|
|
77
77
|
return css `
|
|
78
78
|
position: relative;
|
|
79
79
|
padding: ${spacing};
|
|
80
|
-
background: ${
|
|
80
|
+
background: ${readableBgColor};
|
|
81
81
|
border: 0.0625rem solid transparent;
|
|
82
82
|
width: 100%;
|
|
83
83
|
height: '${theme.base.spacing}';
|
|
84
|
+
font-family: ${theme.components.text.h1['font-family']};
|
|
85
|
+
font-size: 1rem;
|
|
86
|
+
border-radius: calc(0.5 * ${theme.base[borderRadius]});
|
|
84
87
|
&:hover {
|
|
85
88
|
cursor: pointer;
|
|
86
89
|
}
|
|
@@ -88,7 +91,7 @@ export const StyledStage = styled.div(({ stageInfo, theme, error, dragEnabled, d
|
|
|
88
91
|
stageInfo.id === 'alternate' &&
|
|
89
92
|
css `
|
|
90
93
|
border: none;
|
|
91
|
-
box-shadow: inset 0 -0.
|
|
94
|
+
box-shadow: inset 0 -0.4rem 0 0 ${readableHue(theme.components.lifecycle.stage.alternate['resolution-highlight'], theme.components.lifecycle.stage['foreground-color'])};
|
|
92
95
|
|
|
93
96
|
/* adding 0.0625rem to padding since 0.0625rem border is removed. */
|
|
94
97
|
padding: calc(${spacing} + 0.0625rem);
|
|
@@ -97,6 +100,9 @@ export const StyledStage = styled.div(({ stageInfo, theme, error, dragEnabled, d
|
|
|
97
100
|
${headPointed &&
|
|
98
101
|
!dragging &&
|
|
99
102
|
css `
|
|
103
|
+
border-start-end-radius: 0;
|
|
104
|
+
border-end-end-radius: 0;
|
|
105
|
+
|
|
100
106
|
&::after {
|
|
101
107
|
${roundedEndsStyles}
|
|
102
108
|
z-index: 1;
|
|
@@ -116,6 +122,9 @@ export const StyledStage = styled.div(({ stageInfo, theme, error, dragEnabled, d
|
|
|
116
122
|
|
|
117
123
|
${tailPointed &&
|
|
118
124
|
css `
|
|
125
|
+
border-start-start-radius: 0;
|
|
126
|
+
border-end-start-radius: 0;
|
|
127
|
+
|
|
119
128
|
${!error &&
|
|
120
129
|
!dragEnabled &&
|
|
121
130
|
css `
|
|
@@ -135,7 +144,7 @@ export const StyledStage = styled.div(({ stageInfo, theme, error, dragEnabled, d
|
|
|
135
144
|
css `
|
|
136
145
|
&::before {
|
|
137
146
|
${roundedEndsStyles}
|
|
138
|
-
background: ${theme.
|
|
147
|
+
background: ${theme.components.lifecycle.stage.background};
|
|
139
148
|
transform: rotateZ(45deg) skew(15deg, 15deg);
|
|
140
149
|
inset-inline-start: calc(-1.6 * ${theme.base.spacing});
|
|
141
150
|
${rtl
|
|
@@ -152,23 +161,23 @@ export const StyledStage = styled.div(({ stageInfo, theme, error, dragEnabled, d
|
|
|
152
161
|
`}
|
|
153
162
|
|
|
154
163
|
${StyledWarnIcon} {
|
|
155
|
-
color: ${
|
|
164
|
+
color: ${theme.components.lifecycle.stage['foreground-color']};
|
|
156
165
|
margin-inline-start: calc(${dragEnabled ? 0.5 : 1.25} * ${theme.base.spacing});
|
|
157
166
|
margin-inline-end: ${theme.base.spacing};
|
|
158
167
|
}
|
|
159
168
|
|
|
160
169
|
${StyledStageActions} {
|
|
161
170
|
& > ${StyledButton} {
|
|
162
|
-
color: ${
|
|
171
|
+
color: ${theme.components.lifecycle.stage['foreground-color']};
|
|
163
172
|
}
|
|
164
173
|
}
|
|
165
174
|
|
|
166
175
|
${StyledStageButton} {
|
|
167
|
-
color: ${
|
|
176
|
+
color: ${theme.components.lifecycle.stage['foreground-color']};
|
|
168
177
|
}
|
|
169
178
|
|
|
170
179
|
${StyledDragHandle} {
|
|
171
|
-
color: ${
|
|
180
|
+
color: ${theme.components.lifecycle.stage['foreground-color']};
|
|
172
181
|
margin-inline-start: ${theme.base.spacing};
|
|
173
182
|
}
|
|
174
183
|
`;
|
|
@@ -240,7 +249,7 @@ const Stage = forwardRef(({ value, actions, stageInfo, onClick, id, item, error,
|
|
|
240
249
|
accessibilityLabel = t('stage_name', [value]);
|
|
241
250
|
}
|
|
242
251
|
const stageDragEnabled = dragEnabled && dragDropConfig[item.alternate ? 'alternate-stage' : 'stage'].enabled;
|
|
243
|
-
return (_jsxs(Flex, { "data-testid": testIds.root, ...restProps, container: { inline: true, alignItems: 'center' }, as: StyledStage, ref: ref, error: error, dragEnabled: stageDragEnabled, dragging: draggedItem?.type === 'stage', stageInfo: stageInfo, "aria-label": error ? t('stage_name_error', [value]) : undefined, transitionType: item.transitionType, children: [stageDragEnabled && (_jsx(DragHandle, { itemId: id, ref: dragRef, onClick: e => e.stopPropagation() })), error && _jsx(StyledWarnIcon, { name: 'warn-solid' }), _jsxs(Flex, { container: { inline: true }, item: { grow: 1 }, onClick: onStageClick, children: [_jsx(StyledStageButton, { error: error, dragEnabled: stageDragEnabled, "aria-label": error ? undefined : accessibilityLabel, ref: setStageButtonEl, children: value }), stageButtonEl && (_jsx(Tooltip, { target: stageButtonEl, smart: true, children: value }))] }), _jsx(StyledStageActions, { children: actionsClone && (_jsx(Actions, { items: actionsClone, menuAt: 2, iconOnly: true, contextualLabel: t('stage_name', [value]) })) })] }));
|
|
252
|
+
return (_jsxs(Flex, { "data-testid": testIds.root, ...restProps, container: { inline: true, alignItems: 'center' }, as: StyledStage, ref: ref, error: error, dragEnabled: stageDragEnabled, dragging: draggedItem?.type === 'stage', stageInfo: stageInfo, "aria-label": error ? t('stage_name_error', [value]) : undefined, transitionType: item.transitionType, children: [stageDragEnabled && (_jsx(DragHandle, { itemId: id, ref: dragRef, onClick: e => e.stopPropagation() })), error && _jsx(StyledWarnIcon, { name: 'warn-solid' }), _jsxs(Flex, { container: { inline: true, justify: 'center' }, item: { grow: 1 }, onClick: onStageClick, children: [_jsx(StyledStageButton, { error: error, dragEnabled: stageDragEnabled, "aria-label": error ? undefined : accessibilityLabel, ref: setStageButtonEl, children: value }), stageButtonEl && (_jsx(Tooltip, { target: stageButtonEl, smart: true, children: value }))] }), _jsx(StyledStageActions, { children: actionsClone && (_jsx(Actions, { items: actionsClone, menuAt: 2, iconOnly: true, contextualLabel: t('stage_name', [value]) })) })] }));
|
|
244
253
|
});
|
|
245
254
|
export default withTestIds(Stage, getStageTestIds);
|
|
246
255
|
//# sourceMappingURL=Stage.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Stage.js","sourceRoot":"","sources":["../../../src/components/LifeCycle/Stage.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAE/C,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EACL,IAAI,EACJ,OAAO,EACP,gBAAgB,EAChB,YAAY,EACZ,YAAY,EACZ,IAAI,EACJ,OAAO,EACP,aAAa,EACb,UAAU,EACV,WAAW,EACX,UAAU,EACV,OAAO,EACP,WAAW,EACZ,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAEtE,OAAO,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAQhD,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,gBAAgB,EAAE,EAA8B,MAAM,oBAAoB,CAAC;AAiBlF,MAAM,CAAC,MAAM,iBAAiB,GAAG,MAAM,CAAC,MAAM,CAG3C,CAAC,EAAE,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,EAAE,EAAE;IACnC,OAAO,GAAG,CAAA;cACE,KAAK,CAAC,UAAU,CAAC,MAAM,CAAC,MAAM;;;gCAGZ,KAAK,CAAC,IAAI,CAAC,eAAe,CAAC;;;;;gCAK3B,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,MAAM,KAAK,CAAC,IAAI,CAAC,OAAO;2BACrD,W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AC,SAAS,EAC9D,cAAc,EAAE,IAAI,CAAC,cAAc,aAElC,gBAAgB,IAAI,CACnB,KAAC,UAAU,IAAC,MAAM,EAAE,EAAE,EAAE,GAAG,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,eAAe,EAAE,GAAI,CAC5E,EACA,KAAK,IAAI,KAAC,cAAc,IAAC,IAAI,EAAC,YAAY,GAAG,EAC9C,MAAC,IAAI,IAAC,SAAS,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE,EAAE,OAAO,EAAE,YAAY,aACzE,KAAC,iBAAiB,IAChB,KAAK,EAAE,KAAK,EACZ,WAAW,EAAE,gBAAgB,gBACjB,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,kBAAkB,EAClD,GAAG,EAAE,gBAAgB,YAEpB,KAAK,GACY,EACnB,aAAa,IAAI,CAChB,KAAC,OAAO,IAAC,MAAM,EAAE,aAAa,EAAE,KAAK,kBAClC,KAAK,GACE,CACX,IACI,EACP,KAAC,kBAAkB,cAChB,YAAY,IAAI,CACf,KAAC,OAAO,IACN,KAAK,EAAE,YAAY,EACnB,MAAM,EAAE,CAAC,EACT,QAAQ,QACR,eAAe,EAAE,CAAC,CAAC,YAAY,EAAE,CAAC,KAAK,CAAC,CAAC,GACzC,CACH,GACkB,IAChB,CACR,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,WAAW,CAAC,KAAK,EAAE,eAAe,CAAC,CAAC","sourcesContent":["import { forwardRef, useContext } from 'react';\nimport type { PropsWithChildren, Ref, MouseEvent, RefCallback } from 'react';\nimport styled, { css } from 'styled-components';\n\nimport {\n Flex,\n Actions,\n defaultThemeProp,\n useDirection,\n StyledButton,\n Icon,\n useI18n,\n readableColor,\n useTestIds,\n withTestIds,\n useElement,\n Tooltip,\n readableHue\n} from '@pega/cosmos-react-core';\nimport type { BaseProps, Action, ForwardRefForwardPropsComponent } from '@pega/cosmos-react-core';\nimport { DragHandle, StyledDragHandle } from '@pega/cosmos-react-dnd';\n\nimport { generateDynamicTestId } from './utils';\nimport type {\n LifeCycleAction,\n LifeCycleActionParam,\n StageInfo,\n StageItemProps,\n StageProps\n} from './LifeCycle.types';\nimport { getStageTestIds } from './LifeCycle.test-ids';\nimport LifeCycleContext, { type LifeCycleContextValue } from './LifeCycleContext';\n\nexport interface StageComponentProps extends BaseProps, StageProps {\n ref?: Ref<HTMLDivElement>;\n /** Pass text for the task. */\n value: string;\n /** unique id of the component */\n id: string;\n /** Controls the styling of the stage. */\n stageInfo: StageInfo;\n /** Full data object which can be passed to the callback */\n item: StageItemProps;\n /** The status is used to show the input error status and the info on tooltip in case of error */\n error?: string;\n dragRef?: RefCallback<HTMLElement>;\n}\n\nexport const StyledStageButton = styled.button<{\n error: string | undefined;\n dragEnabled?: LifeCycleContextValue['dragEnabled'];\n}>(({ error, dragEnabled, theme }) => {\n return css`\n height: ${theme.components.button.height};\n outline: none;\n border: none;\n border-radius: calc(0.5 * ${theme.base['border-radius']});\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n text-align: start;\n margin-inline-start: calc(${dragEnabled ? 0.25 : 0.5} * ${theme.base.spacing});\n padding-inline: calc(${dragEnabled ? 0.25 : 0.5} * ${theme.base.spacing});\n background: transparent;\n z-index: 2;\n\n ${error &&\n css`\n margin-inline-start: 0;\n `}\n\n &:hover {\n cursor: pointer;\n }\n\n &:focus {\n outline: none;\n box-shadow: ${theme.base.shadow.focus};\n }\n\n &:disabled {\n cursor: not-allowed;\n }\n `;\n});\n\nStyledStageButton.defaultProps = defaultThemeProp;\n\nexport const StyledStageActions = styled.div(({ theme }) => {\n return css`\n z-index: 2;\n margin-inline-end: calc(0.875 * ${theme.base.spacing});\n `;\n});\n\nStyledStageActions.defaultProps = defaultThemeProp;\n\nexport const StyledWarnIcon = styled(Icon)(({ theme }) => {\n return css`\n margin-inline: calc(0.5 * ${theme.base.spacing});\n\n &:hover {\n cursor: pointer;\n }\n `;\n});\n\nStyledWarnIcon.defaultProps = defaultThemeProp;\n\nexport const StyledStage = styled.div<\n Pick<StageComponentProps, 'stageInfo'> & {\n error: string;\n dragEnabled?: LifeCycleContextValue['dragEnabled'];\n dragging?: boolean;\n } & Pick<StageItemProps, 'transitionType'>\n>(({ stageInfo, theme, error, dragEnabled, dragging, transitionType }) => {\n const {\n visual: { bgColor, tailPointed, headPointed }\n } = stageInfo;\n\n const { rtl } = useDirection();\n const contrastColor = readableColor(bgColor);\n const borderRadius = 'border-radius';\n const roundedEndsStyles = css`\n content: '';\n position: absolute;\n display: block;\n width: calc(3 * ${theme.base.spacing});\n height: calc(3 * ${theme.base.spacing});\n top: calc(1 * ${theme.base.spacing});\n border: 0;\n border-inline-end: 0.0625rem solid transparent;\n `;\n const spacing = `calc(0.5 * ${theme.base.spacing})`;\n\n return css`\n position: relative;\n padding: ${spacing};\n background: ${bgColor};\n border: 0.0625rem solid transparent;\n width: 100%;\n height: '${theme.base.spacing}';\n &:hover {\n cursor: pointer;\n }\n ${transitionType === 'resolution' &&\n stageInfo.id === 'alternate' &&\n css`\n border: none;\n box-shadow: inset 0 -0.5rem 0 0 ${readableHue(theme.base.colors.green.medium, theme.base.palette.light)};\n\n /* adding 0.0625rem to padding since 0.0625rem border is removed. */\n padding: calc(${spacing} + 0.0625rem);\n `}\n\n ${headPointed &&\n !dragging &&\n css`\n &::after {\n ${roundedEndsStyles}\n z-index: 1;\n background: inherit;\n transform: rotateZ(-45deg) skew(-15deg, -15deg);\n inset-inline-end: calc(1.6 * ${theme.base.spacing} * -1);\n border-block-end: 0.0625rem solid transparent;\n ${rtl\n ? css`\n border-radius: calc(0.75 * ${theme.base[borderRadius]}) 0.1rem 0.1rem 0.1rem;\n `\n : css`\n border-radius: 0.0625rem 0.075rem calc(0.75 * ${theme.base[borderRadius]}) 0.0625rem;\n `}\n }\n `}\n\n ${tailPointed &&\n css`\n ${!error &&\n !dragEnabled &&\n css`\n ${StyledStageButton} {\n margin-inline-start: calc(1.5 * ${theme.base.spacing});\n }\n `}\n\n ${error &&\n css`\n ${StyledWarnIcon} {\n margin-inline-start: ${theme.base.spacing};\n }\n `}\n\n ${!dragging &&\n css`\n &::before {\n ${roundedEndsStyles}\n background: ${theme.base.palette['app-background']};\n transform: rotateZ(45deg) skew(15deg, 15deg);\n inset-inline-start: calc(-1.6 * ${theme.base.spacing});\n ${rtl\n ? css`\n border-block-end: 0.0625rem solid transparent;\n border-radius: 0.0625rem 1rem 0.0625rem calc(0.75 * ${theme.base[borderRadius]});\n `\n : css`\n border-block-start: 0.0625rem solid transparent;\n border-radius: 0.0625rem calc(0.75 * ${theme.base[borderRadius]}) 0.0625rem 1rem;\n `}\n }\n `}\n `}\n\n ${StyledWarnIcon} {\n color: ${contrastColor};\n margin-inline-start: calc(${dragEnabled ? 0.5 : 1.25} * ${theme.base.spacing});\n margin-inline-end: ${theme.base.spacing};\n }\n\n ${StyledStageActions} {\n & > ${StyledButton} {\n color: ${contrastColor};\n }\n }\n\n ${StyledStageButton} {\n color: ${contrastColor};\n }\n\n ${StyledDragHandle} {\n color: ${contrastColor};\n margin-inline-start: ${theme.base.spacing};\n }\n `;\n});\n\nStyledStage.defaultProps = defaultThemeProp;\n\nconst Stage: ForwardRefForwardPropsComponent<StageComponentProps> = forwardRef(\n (\n {\n value,\n actions,\n stageInfo,\n onClick,\n id,\n item,\n error,\n dragRef,\n ...restProps\n }: PropsWithChildren<StageComponentProps>,\n ref: StageComponentProps['ref']\n ) => {\n const { dragDropConfig, dragEnabled, draggedItem } = useContext(LifeCycleContext);\n const [stageButtonEl, setStageButtonEl] = useElement();\n const t = useI18n();\n let accessibilityLabel: string;\n const stageTestID = generateDynamicTestId([value]);\n const testIds = useTestIds(stageTestID, getStageTestIds);\n\n const onStageClick = (e: MouseEvent) => {\n const actionParam: LifeCycleActionParam = {\n value,\n stage: item,\n type: 'Stage'\n };\n onClick?.(actionParam, e);\n };\n\n const onActionItemClick = (\n actionId: string,\n e: MouseEvent<HTMLInputElement | HTMLAnchorElement | HTMLButtonElement>,\n menuButtonEl?: HTMLButtonElement\n ) => {\n const param: LifeCycleActionParam = {\n stage: item\n };\n\n if (actions) {\n let actionsList: LifeCycleAction[] = [];\n\n if (Array.isArray(actions)) {\n actionsList = actions;\n } else {\n actionsList = actions[item.type];\n }\n\n actionsList?.forEach((actionItem: LifeCycleAction) => {\n if (actionItem.id === actionId) {\n actionItem.onClick?.(param, e, menuButtonEl);\n }\n });\n }\n };\n\n // Deep copy of actions object is required to provide consistent callback objects on actions\n const actionsClone: Action[] = [];\n\n if (actions) {\n let actionsList: LifeCycleAction[] = [];\n if (Array.isArray(actions)) {\n actionsList = actions;\n } else {\n actionsList = actions[item.type];\n }\n\n actionsList.forEach(actionItem => {\n const actionCloneItem = {} as Action;\n Object.keys(actionItem).forEach((key: string) => {\n actionCloneItem[key] = actionItem[key];\n });\n actionCloneItem.onClick = onActionItemClick;\n actionsClone.push({\n ...actionCloneItem\n });\n return actionItem;\n });\n }\n if (item.transitionType === 'resolution') {\n accessibilityLabel = `${t('wait_for_user_action', [t('stage_name', [value])])}`;\n } else if (item.transitionType === 'wait') {\n accessibilityLabel = `${t('resolve_case', [t('stage_name', [value])])}`;\n } else {\n accessibilityLabel = t('stage_name', [value]);\n }\n\n const stageDragEnabled =\n dragEnabled && dragDropConfig[item.alternate ? 'alternate-stage' : 'stage'].enabled;\n\n return (\n <Flex\n data-testid={testIds.root}\n {...restProps}\n container={{ inline: true, alignItems: 'center' }}\n as={StyledStage}\n ref={ref}\n error={error}\n dragEnabled={stageDragEnabled}\n dragging={draggedItem?.type === 'stage'}\n stageInfo={stageInfo}\n aria-label={error ? t('stage_name_error', [value]) : undefined}\n transitionType={item.transitionType}\n >\n {stageDragEnabled && (\n <DragHandle itemId={id} ref={dragRef} onClick={e => e.stopPropagation()} />\n )}\n {error && <StyledWarnIcon name='warn-solid' />}\n <Flex container={{ inline: true }} item={{ grow: 1 }} onClick={onStageClick}>\n <StyledStageButton\n error={error}\n dragEnabled={stageDragEnabled}\n aria-label={error ? undefined : accessibilityLabel}\n ref={setStageButtonEl}\n >\n {value}\n </StyledStageButton>\n {stageButtonEl && (\n <Tooltip target={stageButtonEl} smart>\n {value}\n </Tooltip>\n )}\n </Flex>\n <StyledStageActions>\n {actionsClone && (\n <Actions\n items={actionsClone}\n menuAt={2}\n iconOnly\n contextualLabel={t('stage_name', [value])}\n />\n )}\n </StyledStageActions>\n </Flex>\n );\n }\n);\n\nexport default withTestIds(Stage, getStageTestIds);\n"]}
|
|
1
|
+
{"version":3,"file":"Stage.js","sourceRoot":"","sources":["../../../src/components/LifeCycle/Stage.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAE/C,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EACL,IAAI,EACJ,OAAO,EACP,gBAAgB,EAChB,YAAY,EACZ,YAAY,EACZ,IAAI,EACJ,OAAO,EACP,UAAU,EACV,WAAW,EACX,UAAU,EACV,OAAO,EACP,WAAW,EACZ,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAEtE,OAAO,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAQhD,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,gBAAgB,EAAE,EAA8B,MAAM,oBAAoB,CAAC;AAiBlF,MAAM,CAAC,MAAM,iBAAiB,GAAG,MAAM,CAAC,MAAM,CAG3C,CAAC,EAAE,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,EAAE,EAAE;IACnC,OAAO,GAAG,CAAA;cACE,KAAK,CAAC,UAAU,CAAC,MAAM,CAAC,MAAM;;;gCAGZ,KAAK,CAAC,IAAI,CAAC,eAAe,CAAC;;;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M,EAAE,aAAa,EAAE,KAAK,kBAClC,KAAK,GACE,CACX,IACI,EACP,KAAC,kBAAkB,cAChB,YAAY,IAAI,CACf,KAAC,OAAO,IACN,KAAK,EAAE,YAAY,EACnB,MAAM,EAAE,CAAC,EACT,QAAQ,QACR,eAAe,EAAE,CAAC,CAAC,YAAY,EAAE,CAAC,KAAK,CAAC,CAAC,GACzC,CACH,GACkB,IAChB,CACR,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,WAAW,CAAC,KAAK,EAAE,eAAe,CAAC,CAAC","sourcesContent":["import { forwardRef, useContext } from 'react';\nimport type { PropsWithChildren, Ref, MouseEvent, RefCallback } from 'react';\nimport styled, { css } from 'styled-components';\n\nimport {\n Flex,\n Actions,\n defaultThemeProp,\n useDirection,\n StyledButton,\n Icon,\n useI18n,\n useTestIds,\n withTestIds,\n useElement,\n Tooltip,\n readableHue\n} from '@pega/cosmos-react-core';\nimport type { BaseProps, Action, ForwardRefForwardPropsComponent } from '@pega/cosmos-react-core';\nimport { DragHandle, StyledDragHandle } from '@pega/cosmos-react-dnd';\n\nimport { generateDynamicTestId } from './utils';\nimport type {\n LifeCycleAction,\n LifeCycleActionParam,\n StageInfo,\n StageItemProps,\n StageProps\n} from './LifeCycle.types';\nimport { getStageTestIds } from './LifeCycle.test-ids';\nimport LifeCycleContext, { type LifeCycleContextValue } from './LifeCycleContext';\n\nexport interface StageComponentProps extends BaseProps, StageProps {\n ref?: Ref<HTMLDivElement>;\n /** Pass text for the task. */\n value: string;\n /** unique id of the component */\n id: string;\n /** Controls the styling of the stage. */\n stageInfo: StageInfo;\n /** Full data object which can be passed to the callback */\n item: StageItemProps;\n /** The status is used to show the input error status and the info on tooltip in case of error */\n error?: string;\n dragRef?: RefCallback<HTMLElement>;\n}\n\nexport const StyledStageButton = styled.button<{\n error: string | undefined;\n dragEnabled?: LifeCycleContextValue['dragEnabled'];\n}>(({ error, dragEnabled, theme }) => {\n return css`\n height: ${theme.components.button.height};\n outline: none;\n border: none;\n border-radius: calc(0.5 * ${theme.base['border-radius']});\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n text-align: center;\n margin-inline-start: calc(${dragEnabled ? 0.25 : 0.5} * ${theme.base.spacing});\n padding-inline: calc(${dragEnabled ? 0.25 : 0.5} * ${theme.base.spacing});\n background: transparent;\n z-index: 2;\n\n ${error &&\n css`\n margin-inline-start: 0;\n `}\n\n &:hover {\n cursor: pointer;\n }\n\n &:focus {\n outline: none;\n box-shadow: ${theme.base.shadow.focus};\n }\n\n &:disabled {\n cursor: not-allowed;\n }\n `;\n});\n\nStyledStageButton.defaultProps = defaultThemeProp;\n\nexport const StyledStageActions = styled.div(({ theme }) => {\n return css`\n z-index: 2;\n margin-inline-end: calc(0.875 * ${theme.base.spacing});\n `;\n});\n\nStyledStageActions.defaultProps = defaultThemeProp;\n\nexport const StyledWarnIcon = styled(Icon)(({ theme }) => {\n return css`\n margin-inline: calc(0.5 * ${theme.base.spacing});\n\n &:hover {\n cursor: pointer;\n }\n `;\n});\n\nStyledWarnIcon.defaultProps = defaultThemeProp;\n\nexport const StyledStage = styled.div<\n Pick<StageComponentProps, 'stageInfo'> & {\n error: string;\n dragEnabled?: LifeCycleContextValue['dragEnabled'];\n dragging?: boolean;\n } & Pick<StageItemProps, 'transitionType'>\n>(({ stageInfo, theme, error, dragEnabled, dragging, transitionType }) => {\n const {\n visual: { bgColor, tailPointed, headPointed }\n } = stageInfo;\n const readableBgColor = readableHue(\n bgColor,\n theme.components.lifecycle.stage['foreground-color']\n );\n\n const { rtl } = useDirection();\n const borderRadius = 'border-radius';\n const roundedEndsStyles = css`\n content: '';\n position: absolute;\n display: block;\n width: calc(3 * ${theme.base.spacing});\n height: calc(3 * ${theme.base.spacing});\n top: calc(1 * ${theme.base.spacing});\n border: 0;\n border-inline-end: 0.0625rem solid transparent;\n `;\n const spacing = `calc(0.5 * ${theme.base.spacing})`;\n\n return css`\n position: relative;\n padding: ${spacing};\n background: ${readableBgColor};\n border: 0.0625rem solid transparent;\n width: 100%;\n height: '${theme.base.spacing}';\n font-family: ${theme.components.text.h1['font-family']};\n font-size: 1rem;\n border-radius: calc(0.5 * ${theme.base[borderRadius]});\n &:hover {\n cursor: pointer;\n }\n ${transitionType === 'resolution' &&\n stageInfo.id === 'alternate' &&\n css`\n border: none;\n box-shadow: inset 0 -0.4rem 0 0 ${readableHue(theme.components.lifecycle.stage.alternate['resolution-highlight'], theme.components.lifecycle.stage['foreground-color'])};\n\n /* adding 0.0625rem to padding since 0.0625rem border is removed. */\n padding: calc(${spacing} + 0.0625rem);\n `}\n\n ${headPointed &&\n !dragging &&\n css`\n border-start-end-radius: 0;\n border-end-end-radius: 0;\n\n &::after {\n ${roundedEndsStyles}\n z-index: 1;\n background: inherit;\n transform: rotateZ(-45deg) skew(-15deg, -15deg);\n inset-inline-end: calc(1.6 * ${theme.base.spacing} * -1);\n border-block-end: 0.0625rem solid transparent;\n ${rtl\n ? css`\n border-radius: calc(0.75 * ${theme.base[borderRadius]}) 0.1rem 0.1rem 0.1rem;\n `\n : css`\n border-radius: 0.0625rem 0.075rem calc(0.75 * ${theme.base[borderRadius]}) 0.0625rem;\n `}\n }\n `}\n\n ${tailPointed &&\n css`\n border-start-start-radius: 0;\n border-end-start-radius: 0;\n\n ${!error &&\n !dragEnabled &&\n css`\n ${StyledStageButton} {\n margin-inline-start: calc(1.5 * ${theme.base.spacing});\n }\n `}\n\n ${error &&\n css`\n ${StyledWarnIcon} {\n margin-inline-start: ${theme.base.spacing};\n }\n `}\n\n ${!dragging &&\n css`\n &::before {\n ${roundedEndsStyles}\n background: ${theme.components.lifecycle.stage.background};\n transform: rotateZ(45deg) skew(15deg, 15deg);\n inset-inline-start: calc(-1.6 * ${theme.base.spacing});\n ${rtl\n ? css`\n border-block-end: 0.0625rem solid transparent;\n border-radius: 0.0625rem 1rem 0.0625rem calc(0.75 * ${theme.base[borderRadius]});\n `\n : css`\n border-block-start: 0.0625rem solid transparent;\n border-radius: 0.0625rem calc(0.75 * ${theme.base[borderRadius]}) 0.0625rem 1rem;\n `}\n }\n `}\n `}\n\n ${StyledWarnIcon} {\n color: ${theme.components.lifecycle.stage['foreground-color']};\n margin-inline-start: calc(${dragEnabled ? 0.5 : 1.25} * ${theme.base.spacing});\n margin-inline-end: ${theme.base.spacing};\n }\n\n ${StyledStageActions} {\n & > ${StyledButton} {\n color: ${theme.components.lifecycle.stage['foreground-color']};\n }\n }\n\n ${StyledStageButton} {\n color: ${theme.components.lifecycle.stage['foreground-color']};\n }\n\n ${StyledDragHandle} {\n color: ${theme.components.lifecycle.stage['foreground-color']};\n margin-inline-start: ${theme.base.spacing};\n }\n `;\n});\n\nStyledStage.defaultProps = defaultThemeProp;\n\nconst Stage: ForwardRefForwardPropsComponent<StageComponentProps> = forwardRef(\n (\n {\n value,\n actions,\n stageInfo,\n onClick,\n id,\n item,\n error,\n dragRef,\n ...restProps\n }: PropsWithChildren<StageComponentProps>,\n ref: StageComponentProps['ref']\n ) => {\n const { dragDropConfig, dragEnabled, draggedItem } = useContext(LifeCycleContext);\n const [stageButtonEl, setStageButtonEl] = useElement();\n const t = useI18n();\n let accessibilityLabel: string;\n const stageTestID = generateDynamicTestId([value]);\n const testIds = useTestIds(stageTestID, getStageTestIds);\n\n const onStageClick = (e: MouseEvent) => {\n const actionParam: LifeCycleActionParam = {\n value,\n stage: item,\n type: 'Stage'\n };\n onClick?.(actionParam, e);\n };\n\n const onActionItemClick = (\n actionId: string,\n e: MouseEvent<HTMLInputElement | HTMLAnchorElement | HTMLButtonElement>,\n menuButtonEl?: HTMLButtonElement\n ) => {\n const param: LifeCycleActionParam = {\n stage: item\n };\n\n if (actions) {\n let actionsList: LifeCycleAction[] = [];\n\n if (Array.isArray(actions)) {\n actionsList = actions;\n } else {\n actionsList = actions[item.type];\n }\n\n actionsList?.forEach((actionItem: LifeCycleAction) => {\n if (actionItem.id === actionId) {\n actionItem.onClick?.(param, e, menuButtonEl);\n }\n });\n }\n };\n\n // Deep copy of actions object is required to provide consistent callback objects on actions\n const actionsClone: Action[] = [];\n\n if (actions) {\n let actionsList: LifeCycleAction[] = [];\n if (Array.isArray(actions)) {\n actionsList = actions;\n } else {\n actionsList = actions[item.type];\n }\n\n actionsList.forEach(actionItem => {\n const actionCloneItem = {} as Action;\n Object.keys(actionItem).forEach((key: string) => {\n actionCloneItem[key] = actionItem[key];\n });\n actionCloneItem.onClick = onActionItemClick;\n actionsClone.push({\n ...actionCloneItem\n });\n return actionItem;\n });\n }\n if (item.transitionType === 'resolution') {\n accessibilityLabel = `${t('wait_for_user_action', [t('stage_name', [value])])}`;\n } else if (item.transitionType === 'wait') {\n accessibilityLabel = `${t('resolve_case', [t('stage_name', [value])])}`;\n } else {\n accessibilityLabel = t('stage_name', [value]);\n }\n\n const stageDragEnabled =\n dragEnabled && dragDropConfig[item.alternate ? 'alternate-stage' : 'stage'].enabled;\n\n return (\n <Flex\n data-testid={testIds.root}\n {...restProps}\n container={{ inline: true, alignItems: 'center' }}\n as={StyledStage}\n ref={ref}\n error={error}\n dragEnabled={stageDragEnabled}\n dragging={draggedItem?.type === 'stage'}\n stageInfo={stageInfo}\n aria-label={error ? t('stage_name_error', [value]) : undefined}\n transitionType={item.transitionType}\n >\n {stageDragEnabled && (\n <DragHandle itemId={id} ref={dragRef} onClick={e => e.stopPropagation()} />\n )}\n {error && <StyledWarnIcon name='warn-solid' />}\n <Flex\n container={{ inline: true, justify: 'center' }}\n item={{ grow: 1 }}\n onClick={onStageClick}\n >\n <StyledStageButton\n error={error}\n dragEnabled={stageDragEnabled}\n aria-label={error ? undefined : accessibilityLabel}\n ref={setStageButtonEl}\n >\n {value}\n </StyledStageButton>\n {stageButtonEl && (\n <Tooltip target={stageButtonEl} smart>\n {value}\n </Tooltip>\n )}\n </Flex>\n <StyledStageActions>\n {actionsClone && (\n <Actions\n items={actionsClone}\n menuAt={2}\n iconOnly\n contextualLabel={t('stage_name', [value])}\n />\n )}\n </StyledStageActions>\n </Flex>\n );\n }\n);\n\nexport default withTestIds(Stage, getStageTestIds);\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Step.d.ts","sourceRoot":"","sources":["../../../src/components/LifeCycle/Step.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAA+B,WAAW,EAAE,MAAM,OAAO,CAAC;AAkBzF,OAAO,KAAK,EAAE,SAAS,EAAE,YAAY,EAAU,MAAM,yBAAyB,CAAC;AAI/E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAGhE,OAAO,KAAK,EACV,aAAa,EACb,aAAa,EACb,cAAc,EACd,iBAAiB,EAEjB,SAAS,EACV,MAAM,mBAAmB,CAAC;AAK3B,UAAU,iBAAiB;IACzB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AACD,MAAM,WAAW,mBAAoB,SAAQ,IAAI,CAAC,aAAa,EAAE,MAAM,CAAC;IACtE,MAAM,EAAE,MAAM,CAAC;CAChB;AACD,MAAM,WAAW,kBAAmB,SAAQ,SAAS,EAAE,SAAS;IAC9D,8BAA8B;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,wBAAwB;IACxB,EAAE,EAAE,MAAM,CAAC;IACX;;oDAEgD;IAChD,MAAM,EAAE,mBAAmB,CAAC;IAC5B,sDAAsD;IACtD,KAAK,CAAC,EAAE,aAAa,CAAC,QAAQ,CAAC,CAAC;IAChC,iGAAiG;IACjG,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,qEAAqE;IACrE,IAAI,EAAE,aAAa,CAAC;IACpB,SAAS,EAAE,cAAc,CAAC;IAC1B,QAAQ,EAAE,aAAa,CAAC;IACxB,YAAY,EAAE,iBAAiB,GAAG,iBAAiB,CAAC;IACpD,OAAO,CAAC,EAAE,WAAW,CAAC,WAAW,CAAC,CAAC;IACnC,UAAU,CAAC,EAAE,WAAW,CAAC,WAAW,CAAC,CAAC;CACvC;AAED,eAAO,MAAM,cAAc,yIAY1B,CAAC;AA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CAAC,CAAC,GACxC,CACH,IACI,GACF,CACR,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,WAAW,CAAC,IAAI,EAAE,cAAc,CAAC,CAAC","sourcesContent":["import { useState, useContext } from 'react';\nimport type { FunctionComponent, PropsWithoutRef, MouseEvent, RefCallback } from 'react';\nimport styled, { css } from 'styled-components';\n\nimport {\n Flex,\n defaultThemeProp,\n Icon,\n Status,\n Actions,\n useI18n,\n Avatar,\n useUID,\n useTestIds,\n VisuallyHiddenText,\n withTestIds,\n Tooltip,\n useElement\n} from '@pega/cosmos-react-core';\nimport type { BaseProps, ForwardProps, Action } from '@pega/cosmos-react-core';\nimport { DragHandle, StyledDragHandle } from '@pega/cosmos-react-dnd';\n\nimport IconTile from '../IconTile';\nimport type { IconTileProps } from '../IconTile/IconTile.types';\n\nimport { generateDynamicTestId } from './utils';\nimport type {\n TaskItemProps,\n StepItemProps,\n StageItemProps,\n CategoryItemProps,\n LifeCycleActionParam,\n StepProps\n} from './LifeCycle.types';\nimport LifeCycleContext from './LifeCycleContext';\nimport { getStepTestIds } from './LifeCycle.test-ids';\n\nconst borderRadius = 'border-radius';\ninterface CategoryLabelProp {\n categoryLabel?: string;\n}\nexport interface VisualStepItemProps extends Omit<IconTileProps, 'size'> {\n imgSrc: string;\n}\nexport interface StepComponentProps extends BaseProps, StepProps {\n /** Pass text for the step. */\n value: string;\n /** unique id of step */\n id: string;\n /** Determines the visual for icon, color and label to render.\n * This color is passed as a variant and accessible colors are used to display.\n * Icon and label are passed as normal string */\n visual: VisualStepItemProps;\n /** Determines the variant and label for the badges */\n badge?: StepItemProps['status'];\n /** The status is used to show the input error status and the info on tooltip in case of error */\n error?: string;\n /** Data of the steps which can be used to send the full info back */\n item: StepItemProps;\n stageItem: StageItemProps;\n taskItem: TaskItemProps;\n categoryItem: CategoryItemProps & CategoryLabelProp;\n dragRef?: RefCallback<HTMLElement>;\n previewRef?: RefCallback<HTMLElement>;\n}\n\nexport const StyledStepType = styled.div<Pick<StepComponentProps, 'visual'>>(\n ({ visual, theme }) => {\n return visual?.imgSrc\n ? css`\n height: 2rem;\n padding-inline-end: calc(0.25 * ${theme.base.spacing});\n `\n : css`\n margin: calc(0.5 * ${theme.base.spacing});\n border-radius: calc(0.25 * ${theme.base[borderRadius]});\n `;\n }\n);\n\nStyledStepType.defaultProps = defaultThemeProp;\n\nexport const StyledStepBadge = styled.div(({ theme }) => {\n return css`\n padding: 0 calc(0.5 * ${theme.base.spacing});\n justify-content: flex-end;\n width: auto;\n max-width: calc(50% - ${theme.base.spacing});\n\n > span {\n white-space: nowrap;\n text-overflow: ellipsis;\n overflow: hidden;\n }\n `;\n});\n\nStyledStepBadge.defaultProps = defaultThemeProp;\n\nexport const StyledStepWrapper = styled.li<{\n hasFocus: boolean;\n selected: boolean;\n}>(({ hasFocus, theme, selected }) => {\n return css`\n width: 100%;\n border: 0.125rem solid transparent;\n border-radius: calc(0.5 * ${theme.base[borderRadius]});\n\n &:not(:last-of-type) {\n margin: 0 0 calc(0.5 * ${theme.base.spacing});\n }\n\n ${hasFocus &&\n css`\n box-shadow: ${theme.base.shadow.focus};\n `}\n\n &:hover {\n cursor: pointer;\n }\n ${selected &&\n css`\n &[aria-current='step'] {\n border-color: ${theme.base.palette.interactive};\n }\n `}\n `;\n});\n\nStyledStepWrapper.defaultProps = defaultThemeProp;\n\nexport const StyledStep = styled.div(({ theme }) => {\n return css`\n background: ${theme.base.palette['secondary-background']};\n border: 0.125rem solid transparent;\n border-radius: calc(0.5 * ${theme.base[borderRadius]});\n\n &:hover {\n cursor: pointer;\n }\n\n ${StyledDragHandle} {\n margin-block: calc(0.5 * ${theme.base.spacing});\n }\n `;\n});\n\nStyledStep.defaultProps = defaultThemeProp;\n\nconst StyledStepButtonWrapper = styled.div<{ error: string }>(({ theme }) => {\n return css`\n border-radius: calc(0.5 * ${theme.base[borderRadius]});\n margin-inline: calc(0.5 * ${theme.base.spacing});\n `;\n});\n\nStyledStepButtonWrapper.defaultProps = defaultThemeProp;\n\nexport const StyledStepButton = styled.button<{ $wrap?: StepComponentProps['wrap'] }>(\n ({ theme, $wrap }) => {\n return css`\n border: none;\n height: ${theme.components.button.height};\n overflow: hidden;\n text-align: start;\n background: ${theme.base.palette['secondary-background']};\n\n ${$wrap\n ? css`\n height: fit-content;\n line-height: 1.2;\n min-height: ${theme.components.button.height};\n word-break: break-word;\n padding-block: calc(0.5 * ${theme.base.spacing});\n padding-inline-end: calc(0.5 * ${theme.base.spacing});\n `\n : css`\n white-space: nowrap;\n text-overflow: ellipsis;\n `}\n\n &:hover {\n cursor: pointer;\n }\n\n &:focus {\n outline: none;\n }\n `;\n }\n);\n\nStyledStepButton.defaultProps = defaultThemeProp;\n\nexport const StyledWarnIcon = styled(Icon)(({ theme }) => {\n return css`\n color: ${theme.base.palette.urgent};\n margin: calc(0.5 * ${theme.base.spacing});\n height: 1.5rem;\n flex-shrink: 0;\n &:hover {\n cursor: pointer;\n }\n `;\n});\n\nStyledWarnIcon.defaultProps = defaultThemeProp;\n\nconst Step: FunctionComponent<StepComponentProps & ForwardProps> = ({\n value,\n id,\n visual,\n actions,\n badge,\n error,\n wrap,\n categoryItem,\n item,\n stageItem,\n taskItem,\n onClick,\n dragRef,\n previewRef,\n ...restProps\n}: PropsWithoutRef<StepComponentProps>) => {\n const t = useI18n();\n const { selectedItemId, dragDropConfig, dragEnabled } = useContext(LifeCycleContext);\n const [stepHasFocus, setStepHasFocus] = useState(false);\n const [stepButtonEl, setStepButtonEl] = useElement();\n const stepButtonDescriptionId: string = useUID();\n const errorId: string = useUID();\n // Deep copy of actions is required to provide consistent callback objects on actions\n const actionsClone: Action[] = [];\n\n const stepTestID = generateDynamicTestId([\n stageItem.label,\n categoryItem.categoryLabel,\n taskItem.label,\n value\n ]);\n const testIds = useTestIds(stepTestID, getStepTestIds);\n\n // Need to check the value with statusProps\n const onActionItemClick = (\n actionId: string,\n e: MouseEvent<HTMLInputElement | HTMLAnchorElement | HTMLButtonElement>,\n menuButtonEl?: HTMLButtonElement\n ) => {\n e.stopPropagation();\n const param: LifeCycleActionParam = {\n task: taskItem,\n stage: stageItem,\n step: item,\n category: categoryItem\n };\n actions?.forEach(actionItem => {\n if (actionItem.id === actionId) {\n actionItem.onClick(param, e, menuButtonEl);\n }\n });\n };\n\n if (actions) {\n actions.forEach(actionItem => {\n const actionCloneItem = {} as Action;\n Object.keys(actionItem).forEach((key: string) => {\n actionCloneItem[key] = actionItem[key];\n });\n actionCloneItem.onClick = onActionItemClick;\n actionsClone.push(actionCloneItem);\n return actionItem;\n });\n }\n\n const onStepClick = (e: MouseEvent) => {\n e.stopPropagation();\n const actionParam: LifeCycleActionParam = {\n value,\n step: item,\n task: taskItem,\n category: categoryItem,\n stage: stageItem,\n type: 'Step'\n };\n onClick?.(actionParam, e);\n };\n\n return (\n <Flex\n id={id}\n ref={previewRef}\n data-testid={testIds.root}\n as={StyledStepWrapper}\n container={{ inline: true, alignItems: 'center' }}\n aria-current={selectedItemId === id ? 'step' : undefined}\n hasFocus={stepHasFocus && selectedItemId !== id}\n selected={selectedItemId === id}\n >\n <Flex\n as={StyledStep}\n container={{ inline: true, alignItems: 'start' }}\n item={{ grow: 1 }}\n onClick={onStepClick}\n >\n {dragEnabled && dragDropConfig[item.alternate ? 'alternate-step' : 'step'].enabled && (\n <DragHandle itemId={id} ref={dragRef} onClick={e => e.stopPropagation()} />\n )}\n {error && (\n <>\n <VisuallyHiddenText id={errorId}>{error}</VisuallyHiddenText>\n <StyledWarnIcon name='warn-solid' />\n </>\n )}\n <Flex\n as={StyledStepType}\n visual={visual}\n container={{ inline: true, alignItems: 'center', justify: 'center' }}\n >\n {visual?.label && visual?.imgSrc ? (\n <Avatar name={visual.label} imageSrc={visual.imgSrc} shape='squircle' size='m' />\n ) : (\n <IconTile\n name={visual?.name}\n category={visual?.category}\n label={visual?.label}\n inverted={visual?.inverted}\n />\n )}\n </Flex>\n\n <Flex\n as={StyledStepButtonWrapper}\n item={{ grow: 1 }}\n container={{ inline: true, alignItems: 'center', justify: 'between' }}\n id={stepButtonDescriptionId}\n >\n <StyledStepButton\n {...restProps}\n $wrap={wrap}\n onFocus={() => {\n setStepHasFocus(true);\n }}\n onBlur={() => {\n setStepHasFocus(false);\n }}\n aria-label={t('step_name', [value])}\n aria-describedby={error ? errorId : ''}\n ref={setStepButtonEl}\n >\n {value}\n </StyledStepButton>\n {stepButtonEl && (\n <Tooltip target={stepButtonEl} smart>\n {value}\n </Tooltip>\n )}\n {badge?.type && (\n <Flex as={StyledStepBadge} container={{ inline: true, alignItems: 'center' }}>\n <Status variant={badge?.type || 'success'}>{badge?.label}</Status>\n </Flex>\n )}\n </Flex>\n {actionsClone && (\n <Actions\n items={actionsClone}\n menuAt={2}\n iconOnly\n menuButtonProps={{ onClick: e => e.stopPropagation() }}\n contextualLabel={t('step_name', [value])}\n />\n )}\n </Flex>\n </Flex>\n );\n};\n\nexport default withTestIds(Step, getStepTestIds);\n"]}
|
|
1
|
+
{"version":3,"file":"Step.js","sourceRoot":"","sources":["../../../src/components/LifeCycle/Step.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAE7C,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EACL,IAAI,EACJ,gBAAgB,EAChB,IAAI,EACJ,MAAM,EACN,OAAO,EACP,OAAO,EACP,MAAM,EACN,MAAM,EACN,UAAU,EACV,kBAAkB,EAClB,WAAW,EACX,OAAO,EACP,UAAU,EACX,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAEtE,OAAO,QAAQ,MAAM,aAAa,CAAC;AAGnC,OAAO,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAShD,OAAO,gBAAgB,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAE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IACN,KAAK,EAAE,YAAY,EACnB,MAAM,EAAE,CAAC,EACT,QAAQ,QACR,eAAe,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,eAAe,EAAE,EAAE,EACtD,eAAe,EAAE,CAAC,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC,CAAC,GACxC,CACH,IACI,GACF,CACR,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,WAAW,CAAC,IAAI,EAAE,cAAc,CAAC,CAAC","sourcesContent":["import { useState, useContext } from 'react';\nimport type { FunctionComponent, PropsWithoutRef, MouseEvent, RefCallback } from 'react';\nimport styled, { css } from 'styled-components';\n\nimport {\n Flex,\n defaultThemeProp,\n Icon,\n Status,\n Actions,\n useI18n,\n Avatar,\n useUID,\n useTestIds,\n VisuallyHiddenText,\n withTestIds,\n Tooltip,\n useElement\n} from '@pega/cosmos-react-core';\nimport type { BaseProps, ForwardProps, Action } from '@pega/cosmos-react-core';\nimport { DragHandle, StyledDragHandle } from '@pega/cosmos-react-dnd';\n\nimport IconTile from '../IconTile';\nimport type { IconTileProps } from '../IconTile/IconTile.types';\n\nimport { generateDynamicTestId } from './utils';\nimport type {\n TaskItemProps,\n StepItemProps,\n StageItemProps,\n CategoryItemProps,\n LifeCycleActionParam,\n StepProps\n} from './LifeCycle.types';\nimport LifeCycleContext from './LifeCycleContext';\nimport { getStepTestIds } from './LifeCycle.test-ids';\n\nconst borderRadius = 'border-radius';\ninterface CategoryLabelProp {\n categoryLabel?: string;\n}\nexport interface VisualStepItemProps extends Omit<IconTileProps, 'size'> {\n imgSrc: string;\n}\nexport interface StepComponentProps extends BaseProps, StepProps {\n /** Pass text for the step. */\n value: string;\n /** unique id of step */\n id: string;\n /** Determines the visual for icon, color and label to render.\n * This color is passed as a variant and accessible colors are used to display.\n * Icon and label are passed as normal string */\n visual: VisualStepItemProps;\n /** Determines the variant and label for the badges */\n badge?: StepItemProps['status'];\n /** The status is used to show the input error status and the info on tooltip in case of error */\n error?: string;\n /** Data of the steps which can be used to send the full info back */\n item: StepItemProps;\n stageItem: StageItemProps;\n taskItem: TaskItemProps;\n categoryItem: CategoryItemProps & CategoryLabelProp;\n dragRef?: RefCallback<HTMLElement>;\n previewRef?: RefCallback<HTMLElement>;\n}\n\nexport const StyledStepType = styled.div<Pick<StepComponentProps, 'visual'>>(\n ({ visual, theme }) => {\n return visual?.imgSrc\n ? css`\n height: 2rem;\n padding-inline-end: calc(0.25 * ${theme.base.spacing});\n `\n : css`\n margin: calc(0.5 * ${theme.base.spacing});\n border-radius: calc(0.25 * ${theme.base[borderRadius]});\n `;\n }\n);\n\nStyledStepType.defaultProps = defaultThemeProp;\n\nexport const StyledStepBadge = styled.div(({ theme }) => {\n return css`\n padding: 0 calc(0.5 * ${theme.base.spacing});\n justify-content: flex-end;\n width: auto;\n max-width: calc(50% - ${theme.base.spacing});\n\n > span {\n white-space: nowrap;\n text-overflow: ellipsis;\n overflow: hidden;\n }\n `;\n});\n\nStyledStepBadge.defaultProps = defaultThemeProp;\n\nexport const StyledStepWrapper = styled.li<{\n hasFocus: boolean;\n selected: boolean;\n}>(({ hasFocus, theme, selected }) => {\n return css`\n width: 100%;\n border: 0.125rem solid transparent;\n border-radius: calc(0.5 * ${theme.base[borderRadius]});\n\n &:not(:last-of-type) {\n margin: 0 0 calc(0.5 * ${theme.base.spacing});\n }\n\n ${hasFocus &&\n css`\n box-shadow: ${theme.base.shadow.focus};\n `}\n\n &:hover {\n cursor: pointer;\n }\n ${selected &&\n css`\n &[aria-current='step'] {\n border-color: ${theme.base.palette.interactive};\n }\n `}\n `;\n});\n\nStyledStepWrapper.defaultProps = defaultThemeProp;\n\nexport const StyledStep = styled.div(({ theme }) => {\n return css`\n background: ${theme.base.palette['secondary-background']};\n border: 0.125rem solid transparent;\n border-radius: calc(0.5 * ${theme.base[borderRadius]});\n\n &:hover {\n cursor: pointer;\n }\n\n ${StyledDragHandle} {\n margin-block: calc(0.5 * ${theme.base.spacing});\n }\n `;\n});\n\nStyledStep.defaultProps = defaultThemeProp;\n\nconst StyledStepButtonWrapper = styled.div<{ error: string }>(({ theme }) => {\n return css`\n border-radius: calc(0.5 * ${theme.base[borderRadius]});\n margin-inline: calc(0.5 * ${theme.base.spacing});\n `;\n});\n\nStyledStepButtonWrapper.defaultProps = defaultThemeProp;\n\nexport const StyledStepButton = styled.button<{ $wrap?: StepComponentProps['wrap'] }>(\n ({ theme, $wrap }) => {\n return css`\n border: none;\n height: ${theme.components.button.height};\n overflow: hidden;\n text-align: start;\n background: ${theme.base.palette['secondary-background']};\n color: ${theme.base.palette['foreground-color']};\n\n ${$wrap\n ? css`\n height: fit-content;\n line-height: 1.2;\n min-height: ${theme.components.button.height};\n word-break: break-word;\n padding-block: calc(0.5 * ${theme.base.spacing});\n padding-inline-end: calc(0.5 * ${theme.base.spacing});\n `\n : css`\n white-space: nowrap;\n text-overflow: ellipsis;\n `}\n\n &:hover {\n cursor: pointer;\n }\n\n &:focus {\n outline: none;\n }\n `;\n }\n);\n\nStyledStepButton.defaultProps = defaultThemeProp;\n\nexport const StyledWarnIcon = styled(Icon)(({ theme }) => {\n return css`\n color: ${theme.base.palette.urgent};\n margin: calc(0.5 * ${theme.base.spacing});\n height: 1.5rem;\n flex-shrink: 0;\n &:hover {\n cursor: pointer;\n }\n `;\n});\n\nStyledWarnIcon.defaultProps = defaultThemeProp;\n\nconst Step: FunctionComponent<StepComponentProps & ForwardProps> = ({\n value,\n id,\n visual,\n actions,\n badge,\n error,\n wrap,\n categoryItem,\n item,\n stageItem,\n taskItem,\n onClick,\n dragRef,\n previewRef,\n ...restProps\n}: PropsWithoutRef<StepComponentProps>) => {\n const t = useI18n();\n const { selectedItemId, dragDropConfig, dragEnabled } = useContext(LifeCycleContext);\n const [stepHasFocus, setStepHasFocus] = useState(false);\n const [stepButtonEl, setStepButtonEl] = useElement();\n const stepButtonDescriptionId: string = useUID();\n const errorId: string = useUID();\n // Deep copy of actions is required to provide consistent callback objects on actions\n const actionsClone: Action[] = [];\n\n const stepTestID = generateDynamicTestId([\n stageItem.label,\n categoryItem.categoryLabel,\n taskItem.label,\n value\n ]);\n const testIds = useTestIds(stepTestID, getStepTestIds);\n\n // Need to check the value with statusProps\n const onActionItemClick = (\n actionId: string,\n e: MouseEvent<HTMLInputElement | HTMLAnchorElement | HTMLButtonElement>,\n menuButtonEl?: HTMLButtonElement\n ) => {\n e.stopPropagation();\n const param: LifeCycleActionParam = {\n task: taskItem,\n stage: stageItem,\n step: item,\n category: categoryItem\n };\n actions?.forEach(actionItem => {\n if (actionItem.id === actionId) {\n actionItem.onClick(param, e, menuButtonEl);\n }\n });\n };\n\n if (actions) {\n actions.forEach(actionItem => {\n const actionCloneItem = {} as Action;\n Object.keys(actionItem).forEach((key: string) => {\n actionCloneItem[key] = actionItem[key];\n });\n actionCloneItem.onClick = onActionItemClick;\n actionsClone.push(actionCloneItem);\n return actionItem;\n });\n }\n\n const onStepClick = (e: MouseEvent) => {\n e.stopPropagation();\n const actionParam: LifeCycleActionParam = {\n value,\n step: item,\n task: taskItem,\n category: categoryItem,\n stage: stageItem,\n type: 'Step'\n };\n onClick?.(actionParam, e);\n };\n\n return (\n <Flex\n id={id}\n ref={previewRef}\n data-testid={testIds.root}\n as={StyledStepWrapper}\n container={{ inline: true, alignItems: 'center' }}\n aria-current={selectedItemId === id ? 'step' : undefined}\n hasFocus={stepHasFocus && selectedItemId !== id}\n selected={selectedItemId === id}\n >\n <Flex\n as={StyledStep}\n container={{ inline: true, alignItems: 'start' }}\n item={{ grow: 1 }}\n onClick={onStepClick}\n >\n {dragEnabled && dragDropConfig[item.alternate ? 'alternate-step' : 'step'].enabled && (\n <DragHandle itemId={id} ref={dragRef} onClick={e => e.stopPropagation()} />\n )}\n {error && (\n <>\n <VisuallyHiddenText id={errorId}>{error}</VisuallyHiddenText>\n <StyledWarnIcon name='warn-solid' />\n </>\n )}\n <Flex\n as={StyledStepType}\n visual={visual}\n container={{ inline: true, alignItems: 'center', justify: 'center' }}\n >\n {visual?.label && visual?.imgSrc ? (\n <Avatar name={visual.label} imageSrc={visual.imgSrc} shape='squircle' size='m' />\n ) : (\n <IconTile\n name={visual?.name}\n category={visual?.category}\n label={visual?.label}\n inverted={visual?.inverted}\n />\n )}\n </Flex>\n\n <Flex\n as={StyledStepButtonWrapper}\n item={{ grow: 1 }}\n container={{ inline: true, alignItems: 'center', justify: 'between' }}\n id={stepButtonDescriptionId}\n >\n <StyledStepButton\n {...restProps}\n $wrap={wrap}\n onFocus={() => {\n setStepHasFocus(true);\n }}\n onBlur={() => {\n setStepHasFocus(false);\n }}\n aria-label={t('step_name', [value])}\n aria-describedby={error ? errorId : ''}\n ref={setStepButtonEl}\n >\n {value}\n </StyledStepButton>\n {stepButtonEl && (\n <Tooltip target={stepButtonEl} smart>\n {value}\n </Tooltip>\n )}\n {badge?.type && (\n <Flex as={StyledStepBadge} container={{ inline: true, alignItems: 'center' }}>\n <Status variant={badge?.type || 'success'}>{badge?.label}</Status>\n </Flex>\n )}\n </Flex>\n {actionsClone && (\n <Actions\n items={actionsClone}\n menuAt={2}\n iconOnly\n menuButtonProps={{ onClick: e => e.stopPropagation() }}\n contextualLabel={t('step_name', [value])}\n />\n )}\n </Flex>\n </Flex>\n );\n};\n\nexport default withTestIds(Step, getStepTestIds);\n"]}
|