@pega/cosmos-react-demos 3.0.0-dev.4.1 → 3.0.0-dev.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/jsx/build/AppShell/AppShell.mocks.d.ts +17 -0
- package/jsx/build/AppShell/AppShell.mocks.d.ts.map +1 -1
- package/jsx/build/AppShell/AppShell.mocks.js +15 -0
- package/jsx/build/AppShell/AppShell.mocks.js.map +1 -1
- package/jsx/build/AppShell/AppShell.stories.d.ts +2 -0
- package/jsx/build/AppShell/AppShell.stories.d.ts.map +1 -1
- package/jsx/build/AppShell/AppShell.stories.jsx +2 -17
- package/jsx/build/AppShell/AppShell.stories.jsx.map +1 -1
- package/jsx/build/DynamicContentEditor/DynamicContentEditor.stories.d.ts.map +1 -1
- package/jsx/build/DynamicContentEditor/DynamicContentEditor.stories.jsx +2 -1
- package/jsx/build/DynamicContentEditor/DynamicContentEditor.stories.jsx.map +1 -1
- package/jsx/build/FlowModeller/FlowModeller.mocks.d.ts +19 -2
- package/jsx/build/FlowModeller/FlowModeller.mocks.d.ts.map +1 -1
- package/jsx/build/FlowModeller/{FlowModeller.mocks.js → FlowModeller.mocks.jsx} +71 -7
- package/jsx/build/FlowModeller/FlowModeller.mocks.jsx.map +1 -0
- package/jsx/build/FlowModeller/FlowModeller.stories.d.ts +2 -7
- package/jsx/build/FlowModeller/FlowModeller.stories.d.ts.map +1 -1
- package/jsx/build/FlowModeller/FlowModeller.stories.jsx +14 -100
- package/jsx/build/FlowModeller/FlowModeller.stories.jsx.map +1 -1
- package/jsx/build/FlowModeller/FlowModeller.styles.d.ts +2 -0
- package/jsx/build/FlowModeller/FlowModeller.styles.d.ts.map +1 -0
- package/jsx/build/FlowModeller/FlowModeller.styles.js +8 -0
- package/jsx/build/FlowModeller/FlowModeller.styles.js.map +1 -0
- package/jsx/build/ItemLibrary/LibraryPicker.stories.d.ts +2 -5
- package/jsx/build/ItemLibrary/LibraryPicker.stories.d.ts.map +1 -1
- package/jsx/build/ItemLibrary/LibraryPicker.stories.jsx.map +1 -1
- package/jsx/build/LifeCycle/LifeCycle.stories.d.ts +2 -4
- package/jsx/build/LifeCycle/LifeCycle.stories.d.ts.map +1 -1
- package/jsx/build/LifeCycle/LifeCycle.stories.jsx.map +1 -1
- package/jsx/build/ObjectSelect/ObjectSelect.mocks.d.ts +24 -0
- package/jsx/build/ObjectSelect/ObjectSelect.mocks.d.ts.map +1 -1
- package/jsx/build/ObjectSelect/ObjectSelect.mocks.jsx +315 -0
- package/jsx/build/ObjectSelect/ObjectSelect.mocks.jsx.map +1 -0
- package/jsx/build/ObjectSelect/ObjectSelect.stories.d.ts +2 -7
- package/jsx/build/ObjectSelect/ObjectSelect.stories.d.ts.map +1 -1
- package/jsx/build/ObjectSelect/ObjectSelect.stories.jsx +5 -180
- package/jsx/build/ObjectSelect/ObjectSelect.stories.jsx.map +1 -1
- package/jsx/build/PageTemplates/GalleryPage.mocks.d.ts +45 -0
- package/jsx/build/PageTemplates/GalleryPage.mocks.d.ts.map +1 -0
- package/jsx/build/PageTemplates/GalleryPage.mocks.jsx +78 -0
- package/jsx/build/PageTemplates/GalleryPage.mocks.jsx.map +1 -0
- package/jsx/build/PageTemplates/GalleryPage.stories.d.ts +1 -0
- package/jsx/build/PageTemplates/GalleryPage.stories.d.ts.map +1 -1
- package/jsx/build/PageTemplates/GalleryPage.stories.jsx +3 -79
- package/jsx/build/PageTemplates/GalleryPage.stories.jsx.map +1 -1
- package/jsx/build/PageTemplates/PageTemplates.mocks.d.ts +11 -0
- package/jsx/build/PageTemplates/PageTemplates.mocks.d.ts.map +1 -0
- package/jsx/build/PageTemplates/PageTemplates.mocks.jsx +129 -0
- package/jsx/build/PageTemplates/PageTemplates.mocks.jsx.map +1 -0
- package/jsx/build/PageTemplates/PageTemplates.stories.d.ts +1 -0
- package/jsx/build/PageTemplates/PageTemplates.stories.d.ts.map +1 -1
- package/jsx/build/PageTemplates/PageTemplates.stories.jsx +4 -129
- package/jsx/build/PageTemplates/PageTemplates.stories.jsx.map +1 -1
- package/jsx/build/Workbench/Workbench.stories.d.ts.map +1 -1
- package/jsx/build/Workbench/Workbench.stories.jsx +1 -9
- package/jsx/build/Workbench/Workbench.stories.jsx.map +1 -1
- package/jsx/condition-builder/ConditionBuilder/ConditionBuilder.mocks.d.ts +3 -0
- package/jsx/condition-builder/ConditionBuilder/ConditionBuilder.mocks.d.ts.map +1 -0
- package/jsx/condition-builder/ConditionBuilder/ConditionBuilder.mocks.js +13 -0
- package/jsx/condition-builder/ConditionBuilder/ConditionBuilder.mocks.js.map +1 -0
- package/jsx/condition-builder/ConditionBuilder/ConditionBuilder.stories.d.ts +16 -8
- package/jsx/condition-builder/ConditionBuilder/ConditionBuilder.stories.d.ts.map +1 -1
- package/jsx/condition-builder/ConditionBuilder/ConditionBuilder.stories.jsx +59 -56
- package/jsx/condition-builder/ConditionBuilder/ConditionBuilder.stories.jsx.map +1 -1
- package/jsx/condition-builder/ConditionBuilder/ConditionBuilder.styles.d.ts +5 -0
- package/jsx/condition-builder/ConditionBuilder/ConditionBuilder.styles.d.ts.map +1 -0
- package/jsx/condition-builder/ConditionBuilder/ConditionBuilder.styles.js +15 -0
- package/jsx/condition-builder/ConditionBuilder/ConditionBuilder.styles.js.map +1 -0
- package/jsx/core/Button/Button.stories.jsx +6 -6
- package/jsx/core/Button/Button.stories.jsx.map +1 -1
- package/jsx/core/ColorPicker/ColorPicker.stories.d.ts.map +1 -1
- package/jsx/core/ColorPicker/ColorPicker.stories.jsx +2 -10
- package/jsx/core/ColorPicker/ColorPicker.stories.jsx.map +1 -1
- package/jsx/core/ColorPicker/ColorPicker.styles.d.ts +4 -0
- package/jsx/core/ColorPicker/ColorPicker.styles.d.ts.map +1 -0
- package/jsx/core/ColorPicker/ColorPicker.styles.js +11 -0
- package/jsx/core/ColorPicker/ColorPicker.styles.js.map +1 -0
- package/jsx/core/Configuration/Configuration.mocks.d.ts +7 -0
- package/jsx/core/Configuration/Configuration.mocks.d.ts.map +1 -0
- package/jsx/core/Configuration/Configuration.mocks.jsx +9 -0
- package/jsx/core/Configuration/Configuration.mocks.jsx.map +1 -0
- package/jsx/core/Configuration/Configuration.stories.d.ts.map +1 -1
- package/jsx/core/Configuration/Configuration.stories.jsx +2 -18
- package/jsx/core/Configuration/Configuration.stories.jsx.map +1 -1
- package/jsx/core/Configuration/Configuration.styles.d.ts +6 -0
- package/jsx/core/Configuration/Configuration.styles.d.ts.map +1 -0
- package/jsx/core/Configuration/Configuration.styles.js +12 -0
- package/jsx/core/Configuration/Configuration.styles.js.map +1 -0
- package/jsx/core/DateTime/DateTime.stories.d.ts.map +1 -1
- package/jsx/core/DateTime/DateTime.stories.jsx +1 -0
- package/jsx/core/DateTime/DateTime.stories.jsx.map +1 -1
- package/jsx/core/FieldGroup/FieldGroupList.mocks.d.ts +4 -0
- package/jsx/core/FieldGroup/FieldGroupList.mocks.d.ts.map +1 -1
- package/jsx/core/FieldGroup/FieldGroupList.mocks.jsx +69 -1
- package/jsx/core/FieldGroup/FieldGroupList.mocks.jsx.map +1 -1
- package/jsx/core/FieldGroup/FieldGroupList.stories.d.ts.map +1 -1
- package/jsx/core/FieldGroup/FieldGroupList.stories.jsx +2 -70
- package/jsx/core/FieldGroup/FieldGroupList.stories.jsx.map +1 -1
- package/jsx/core/HTML/HTML.stories.d.ts.map +1 -1
- package/jsx/core/HTML/HTML.stories.jsx +1 -1
- package/jsx/core/HTML/HTML.stories.jsx.map +1 -1
- package/jsx/core/Icon/Icon.stories.d.ts.map +1 -1
- package/jsx/core/Icon/Icon.stories.jsx +5 -27
- package/jsx/core/Icon/Icon.stories.jsx.map +1 -1
- package/jsx/core/Icon/Icon.styles.d.ts +4 -0
- package/jsx/core/Icon/Icon.styles.d.ts.map +1 -0
- package/jsx/core/Icon/Icon.styles.js +25 -0
- package/jsx/core/Icon/Icon.styles.js.map +1 -0
- package/jsx/core/IconPicker/IconPicker.stories.jsx +1 -1
- package/jsx/core/IconPicker/IconPicker.stories.jsx.map +1 -1
- package/jsx/core/Link/Link.stories.d.ts +1 -11
- package/jsx/core/Link/Link.stories.d.ts.map +1 -1
- package/jsx/core/Link/Link.stories.jsx.map +1 -1
- package/jsx/core/Number/Number.stories.d.ts.map +1 -1
- package/jsx/core/Number/Number.stories.jsx +2 -0
- package/jsx/core/Number/Number.stories.jsx.map +1 -1
- package/jsx/core/PageTemplates/PageTemplates.stories.d.ts.map +1 -1
- package/jsx/core/PageTemplates/PageTemplates.stories.jsx +1 -11
- package/jsx/core/PageTemplates/PageTemplates.stories.jsx.map +1 -1
- package/jsx/core/PageTemplates/PageTemplates.styles.d.ts +1 -0
- package/jsx/core/PageTemplates/PageTemplates.styles.d.ts.map +1 -1
- package/jsx/core/PageTemplates/PageTemplates.styles.js +9 -0
- package/jsx/core/PageTemplates/PageTemplates.styles.js.map +1 -1
- package/jsx/core/Tooltip/Tooltip.stories.d.ts +2 -5
- package/jsx/core/Tooltip/Tooltip.stories.d.ts.map +1 -1
- package/jsx/core/Tooltip/Tooltip.stories.jsx.map +1 -1
- package/jsx/core/Tree/Tree.stories.d.ts.map +1 -1
- package/jsx/core/Tree/Tree.stories.jsx +2 -2
- package/jsx/core/Tree/Tree.stories.jsx.map +1 -1
- package/jsx/cs/Article/Article.stories.d.ts +2 -10
- package/jsx/cs/Article/Article.stories.d.ts.map +1 -1
- package/jsx/cs/Article/Article.stories.jsx.map +1 -1
- package/jsx/cs/ArticleList/ArticleList.stories.d.ts +2 -11
- package/jsx/cs/ArticleList/ArticleList.stories.d.ts.map +1 -1
- package/jsx/cs/ArticleList/ArticleList.stories.jsx.map +1 -1
- package/jsx/cs/CSCaseView/CSAppShell.stories.d.ts +2 -36
- package/jsx/cs/CSCaseView/CSAppShell.stories.d.ts.map +1 -1
- package/jsx/cs/CSCaseView/CSAppShell.stories.jsx +6 -33
- package/jsx/cs/CSCaseView/CSAppShell.stories.jsx.map +1 -1
- package/jsx/cs/CSCaseView/CSCaseView.mocks.d.ts +9 -0
- package/jsx/cs/CSCaseView/CSCaseView.mocks.d.ts.map +1 -1
- package/jsx/cs/CSCaseView/{CSCaseView.mocks.js → CSCaseView.mocks.jsx} +30 -1
- package/jsx/cs/CSCaseView/CSCaseView.mocks.jsx.map +1 -0
- package/jsx/cs/CallControlPanel/CallControlPanel.stories.d.ts +2 -2
- package/jsx/cs/CallControlPanel/CallControlPanel.stories.d.ts.map +1 -1
- package/jsx/cs/CallControlPanel/CallControlPanel.stories.jsx +4 -4
- package/jsx/cs/CallControlPanel/CallControlPanel.stories.jsx.map +1 -1
- package/jsx/cs/IntelligentGuidance/IntelligentGuidance.stories.d.ts +2 -8
- package/jsx/cs/IntelligentGuidance/IntelligentGuidance.stories.d.ts.map +1 -1
- package/jsx/cs/IntelligentGuidance/IntelligentGuidance.stories.jsx +3 -3
- package/jsx/cs/IntelligentGuidance/IntelligentGuidance.stories.jsx.map +1 -1
- package/jsx/cs/InteractionNotification/InteractionNotification.stories.d.ts +7 -6
- package/jsx/cs/InteractionNotification/InteractionNotification.stories.d.ts.map +1 -1
- package/jsx/cs/InteractionNotification/InteractionNotification.stories.jsx +13 -5
- package/jsx/cs/InteractionNotification/InteractionNotification.stories.jsx.map +1 -1
- package/jsx/cs/InteractionTimer/InteractionTimer.mocks.d.ts +11 -0
- package/jsx/cs/InteractionTimer/InteractionTimer.mocks.d.ts.map +1 -0
- package/jsx/cs/InteractionTimer/InteractionTimer.mocks.js +29 -0
- package/jsx/cs/InteractionTimer/InteractionTimer.mocks.js.map +1 -0
- package/jsx/cs/InteractionTimer/InteractionTimer.stories.d.ts +2 -7
- package/jsx/cs/InteractionTimer/InteractionTimer.stories.d.ts.map +1 -1
- package/jsx/cs/InteractionTimer/InteractionTimer.stories.jsx +6 -30
- package/jsx/cs/InteractionTimer/InteractionTimer.stories.jsx.map +1 -1
- package/jsx/cs/TaskManager/TaskManager.mocks.d.ts +6 -0
- package/jsx/cs/TaskManager/TaskManager.mocks.d.ts.map +1 -1
- package/jsx/cs/TaskManager/TaskManager.mocks.js +7 -0
- package/jsx/cs/TaskManager/TaskManager.mocks.js.map +1 -1
- package/jsx/cs/TaskManager/TaskManager.stories.d.ts +6 -5
- package/jsx/cs/TaskManager/TaskManager.stories.d.ts.map +1 -1
- package/jsx/cs/TaskManager/TaskManager.stories.jsx +25 -29
- package/jsx/cs/TaskManager/TaskManager.stories.jsx.map +1 -1
- package/jsx/cs/TaskManager/TaskManager.styles.d.ts +3 -0
- package/jsx/cs/TaskManager/TaskManager.styles.d.ts.map +1 -0
- package/jsx/cs/TaskManager/TaskManager.styles.js +8 -0
- package/jsx/cs/TaskManager/TaskManager.styles.js.map +1 -0
- package/jsx/dnd/DragDropList/DragDropList.mocks.d.ts +15 -0
- package/jsx/dnd/DragDropList/DragDropList.mocks.d.ts.map +1 -0
- package/jsx/dnd/DragDropList/DragDropList.mocks.jsx +33 -0
- package/jsx/dnd/DragDropList/DragDropList.mocks.jsx.map +1 -0
- package/jsx/dnd/DragDropList/DragDropList.stories.d.ts +8 -9
- package/jsx/dnd/DragDropList/DragDropList.stories.d.ts.map +1 -1
- package/jsx/dnd/DragDropList/DragDropList.stories.jsx +14 -78
- package/jsx/dnd/DragDropList/DragDropList.stories.jsx.map +1 -1
- package/jsx/dnd/DragDropList/DragDropList.styles.d.ts +6 -0
- package/jsx/dnd/DragDropList/DragDropList.styles.d.ts.map +1 -0
- package/jsx/dnd/DragDropList/DragDropList.styles.js +32 -0
- package/jsx/dnd/DragDropList/DragDropList.styles.js.map +1 -0
- package/jsx/rte/Editor/Editor.mocks.d.ts +6 -0
- package/jsx/rte/Editor/Editor.mocks.d.ts.map +1 -0
- package/jsx/rte/Editor/Editor.mocks.jsx +20 -0
- package/jsx/rte/Editor/Editor.mocks.jsx.map +1 -0
- package/jsx/rte/Editor/Editor.stories.d.ts.map +1 -1
- package/jsx/rte/Editor/Editor.stories.jsx +1 -19
- package/jsx/rte/Editor/Editor.stories.jsx.map +1 -1
- package/jsx/rte/RichTextEditor/RichTextEditor.stories.d.ts +2 -3
- package/jsx/rte/RichTextEditor/RichTextEditor.stories.d.ts.map +1 -1
- package/jsx/rte/RichTextEditor/RichTextEditor.stories.jsx.map +1 -1
- package/jsx/social/Chat/RepeatingView.mocks.d.ts +14 -0
- package/jsx/social/Chat/RepeatingView.mocks.d.ts.map +1 -0
- package/jsx/social/Chat/RepeatingView.mocks.js +11 -0
- package/jsx/social/Chat/RepeatingView.mocks.js.map +1 -0
- package/jsx/social/Chat/RepeatingView.stories.d.ts +6 -17
- package/jsx/social/Chat/RepeatingView.stories.d.ts.map +1 -1
- package/jsx/social/Chat/RepeatingView.stories.jsx +16 -46
- package/jsx/social/Chat/RepeatingView.stories.jsx.map +1 -1
- package/jsx/social/Chat/RepeatingView.styles.d.ts +2 -0
- package/jsx/social/Chat/RepeatingView.styles.d.ts.map +1 -0
- package/jsx/social/Chat/RepeatingView.styles.js +22 -0
- package/jsx/social/Chat/RepeatingView.styles.js.map +1 -0
- package/jsx/social/Email/Email.mocks.d.ts +155 -2
- package/jsx/social/Email/Email.mocks.d.ts.map +1 -1
- package/jsx/social/Email/Email.mocks.jsx +756 -0
- package/jsx/social/Email/Email.mocks.jsx.map +1 -0
- package/jsx/social/Email/Email.stories.d.ts +14 -14
- package/jsx/social/Email/Email.stories.d.ts.map +1 -1
- package/jsx/social/Email/Email.stories.jsx +97 -411
- package/jsx/social/Email/Email.stories.jsx.map +1 -1
- package/jsx/social/Email/Email.styles.d.ts +4 -0
- package/jsx/social/Email/Email.styles.d.ts.map +1 -0
- package/jsx/social/Email/Email.styles.js +14 -0
- package/jsx/social/Email/Email.styles.js.map +1 -0
- package/jsx/social/Feed/Feed.stories.d.ts.map +1 -1
- package/jsx/social/Feed/Feed.stories.jsx +23 -18
- package/jsx/social/Feed/Feed.stories.jsx.map +1 -1
- package/jsx/social/Feed/FeedPost.stories.d.ts.map +1 -1
- package/jsx/social/Feed/FeedPost.stories.jsx +30 -20
- package/jsx/social/Feed/FeedPost.stories.jsx.map +1 -1
- package/jsx/social/Feed/FeedReply.stories.d.ts.map +1 -1
- package/jsx/social/Feed/FeedReply.stories.jsx +21 -16
- package/jsx/social/Feed/FeedReply.stories.jsx.map +1 -1
- package/jsx/work/CaseView/MobileCaseView.stories.d.ts +2 -7
- package/jsx/work/CaseView/MobileCaseView.stories.d.ts.map +1 -1
- package/jsx/work/CaseView/MobileCaseView.stories.jsx.map +1 -1
- package/jsx/work/ConfigurableLayout/ConfigurableLayout.mocks.d.ts +45 -0
- package/jsx/work/ConfigurableLayout/ConfigurableLayout.mocks.d.ts.map +1 -0
- package/jsx/work/ConfigurableLayout/ConfigurableLayout.mocks.jsx +166 -0
- package/jsx/work/ConfigurableLayout/ConfigurableLayout.mocks.jsx.map +1 -0
- package/jsx/work/ConfigurableLayout/ConfigurableLayout.stories.d.ts +2 -6
- package/jsx/work/ConfigurableLayout/ConfigurableLayout.stories.d.ts.map +1 -1
- package/jsx/work/ConfigurableLayout/ConfigurableLayout.stories.jsx +2 -174
- package/jsx/work/ConfigurableLayout/ConfigurableLayout.stories.jsx.map +1 -1
- package/jsx/work/ConfigurableLayout/ConfigurableLayout.styles.d.ts +4 -0
- package/jsx/work/ConfigurableLayout/ConfigurableLayout.styles.d.ts.map +1 -0
- package/jsx/work/ConfigurableLayout/ConfigurableLayout.styles.js +11 -0
- package/jsx/work/ConfigurableLayout/ConfigurableLayout.styles.js.map +1 -0
- package/lib/build/AppShell/AppShell.mocks.d.ts +17 -0
- package/lib/build/AppShell/AppShell.mocks.d.ts.map +1 -1
- package/lib/build/AppShell/AppShell.mocks.js +16 -0
- package/lib/build/AppShell/AppShell.mocks.js.map +1 -1
- package/lib/build/AppShell/AppShell.stories.d.ts +2 -0
- package/lib/build/AppShell/AppShell.stories.d.ts.map +1 -1
- package/lib/build/AppShell/AppShell.stories.js +3 -18
- package/lib/build/AppShell/AppShell.stories.js.map +1 -1
- package/lib/build/DynamicContentEditor/DynamicContentEditor.stories.d.ts.map +1 -1
- package/lib/build/DynamicContentEditor/DynamicContentEditor.stories.js +2 -1
- package/lib/build/DynamicContentEditor/DynamicContentEditor.stories.js.map +1 -1
- package/lib/build/FlowModeller/FlowModeller.mocks.d.ts +19 -2
- package/lib/build/FlowModeller/FlowModeller.mocks.d.ts.map +1 -1
- package/lib/build/FlowModeller/FlowModeller.mocks.js +58 -6
- package/lib/build/FlowModeller/FlowModeller.mocks.js.map +1 -1
- package/lib/build/FlowModeller/FlowModeller.stories.d.ts +2 -7
- package/lib/build/FlowModeller/FlowModeller.stories.d.ts.map +1 -1
- package/lib/build/FlowModeller/FlowModeller.stories.js +15 -90
- package/lib/build/FlowModeller/FlowModeller.stories.js.map +1 -1
- package/lib/build/FlowModeller/FlowModeller.styles.d.ts +2 -0
- package/lib/build/FlowModeller/FlowModeller.styles.d.ts.map +1 -0
- package/lib/build/FlowModeller/FlowModeller.styles.js +8 -0
- package/lib/build/FlowModeller/FlowModeller.styles.js.map +1 -0
- package/lib/build/ItemLibrary/LibraryPicker.stories.d.ts +2 -5
- package/lib/build/ItemLibrary/LibraryPicker.stories.d.ts.map +1 -1
- package/lib/build/ItemLibrary/LibraryPicker.stories.js.map +1 -1
- package/lib/build/LifeCycle/LifeCycle.stories.d.ts +2 -4
- package/lib/build/LifeCycle/LifeCycle.stories.d.ts.map +1 -1
- package/lib/build/LifeCycle/LifeCycle.stories.js.map +1 -1
- package/lib/build/ObjectSelect/ObjectSelect.mocks.d.ts +24 -0
- package/lib/build/ObjectSelect/ObjectSelect.mocks.d.ts.map +1 -1
- package/lib/build/ObjectSelect/ObjectSelect.mocks.js +136 -0
- package/lib/build/ObjectSelect/ObjectSelect.mocks.js.map +1 -1
- package/lib/build/ObjectSelect/ObjectSelect.stories.d.ts +2 -7
- package/lib/build/ObjectSelect/ObjectSelect.stories.d.ts.map +1 -1
- package/lib/build/ObjectSelect/ObjectSelect.stories.js +12 -136
- package/lib/build/ObjectSelect/ObjectSelect.stories.js.map +1 -1
- package/lib/build/PageTemplates/GalleryPage.mocks.d.ts +45 -0
- package/lib/build/PageTemplates/GalleryPage.mocks.d.ts.map +1 -0
- package/lib/build/PageTemplates/GalleryPage.mocks.js +79 -0
- package/lib/build/PageTemplates/GalleryPage.mocks.js.map +1 -0
- package/lib/build/PageTemplates/GalleryPage.stories.d.ts +1 -0
- package/lib/build/PageTemplates/GalleryPage.stories.d.ts.map +1 -1
- package/lib/build/PageTemplates/GalleryPage.stories.js +3 -79
- package/lib/build/PageTemplates/GalleryPage.stories.js.map +1 -1
- package/lib/build/PageTemplates/PageTemplates.mocks.d.ts +11 -0
- package/lib/build/PageTemplates/PageTemplates.mocks.d.ts.map +1 -0
- package/lib/build/PageTemplates/PageTemplates.mocks.js +96 -0
- package/lib/build/PageTemplates/PageTemplates.mocks.js.map +1 -0
- package/lib/build/PageTemplates/PageTemplates.stories.d.ts +1 -0
- package/lib/build/PageTemplates/PageTemplates.stories.d.ts.map +1 -1
- package/lib/build/PageTemplates/PageTemplates.stories.js +5 -95
- package/lib/build/PageTemplates/PageTemplates.stories.js.map +1 -1
- package/lib/build/Workbench/Workbench.stories.d.ts.map +1 -1
- package/lib/build/Workbench/Workbench.stories.js +1 -9
- package/lib/build/Workbench/Workbench.stories.js.map +1 -1
- package/lib/condition-builder/ConditionBuilder/ConditionBuilder.mocks.d.ts +3 -0
- package/lib/condition-builder/ConditionBuilder/ConditionBuilder.mocks.d.ts.map +1 -0
- package/lib/condition-builder/ConditionBuilder/ConditionBuilder.mocks.js +13 -0
- package/lib/condition-builder/ConditionBuilder/ConditionBuilder.mocks.js.map +1 -0
- package/lib/condition-builder/ConditionBuilder/ConditionBuilder.stories.d.ts +16 -8
- package/lib/condition-builder/ConditionBuilder/ConditionBuilder.stories.d.ts.map +1 -1
- package/lib/condition-builder/ConditionBuilder/ConditionBuilder.stories.js +56 -54
- package/lib/condition-builder/ConditionBuilder/ConditionBuilder.stories.js.map +1 -1
- package/lib/condition-builder/ConditionBuilder/ConditionBuilder.styles.d.ts +5 -0
- package/lib/condition-builder/ConditionBuilder/ConditionBuilder.styles.d.ts.map +1 -0
- package/lib/condition-builder/ConditionBuilder/ConditionBuilder.styles.js +15 -0
- package/lib/condition-builder/ConditionBuilder/ConditionBuilder.styles.js.map +1 -0
- package/lib/core/Button/Button.stories.js +2 -2
- package/lib/core/Button/Button.stories.js.map +1 -1
- package/lib/core/ColorPicker/ColorPicker.stories.d.ts.map +1 -1
- package/lib/core/ColorPicker/ColorPicker.stories.js +2 -10
- package/lib/core/ColorPicker/ColorPicker.stories.js.map +1 -1
- package/lib/core/ColorPicker/ColorPicker.styles.d.ts +4 -0
- package/lib/core/ColorPicker/ColorPicker.styles.d.ts.map +1 -0
- package/lib/core/ColorPicker/ColorPicker.styles.js +11 -0
- package/lib/core/ColorPicker/ColorPicker.styles.js.map +1 -0
- package/lib/core/Configuration/Configuration.mocks.d.ts +7 -0
- package/lib/core/Configuration/Configuration.mocks.d.ts.map +1 -0
- package/lib/core/Configuration/Configuration.mocks.js +6 -0
- package/lib/core/Configuration/Configuration.mocks.js.map +1 -0
- package/lib/core/Configuration/Configuration.stories.d.ts.map +1 -1
- package/lib/core/Configuration/Configuration.stories.js +3 -15
- package/lib/core/Configuration/Configuration.stories.js.map +1 -1
- package/lib/core/Configuration/Configuration.styles.d.ts +6 -0
- package/lib/core/Configuration/Configuration.styles.d.ts.map +1 -0
- package/lib/core/Configuration/Configuration.styles.js +12 -0
- package/lib/core/Configuration/Configuration.styles.js.map +1 -0
- package/lib/core/DateTime/DateTime.stories.d.ts.map +1 -1
- package/lib/core/DateTime/DateTime.stories.js +2 -0
- package/lib/core/DateTime/DateTime.stories.js.map +1 -1
- package/lib/core/FieldGroup/FieldGroupList.mocks.d.ts +4 -0
- package/lib/core/FieldGroup/FieldGroupList.mocks.d.ts.map +1 -1
- package/lib/core/FieldGroup/FieldGroupList.mocks.js +46 -2
- package/lib/core/FieldGroup/FieldGroupList.mocks.js.map +1 -1
- package/lib/core/FieldGroup/FieldGroupList.stories.d.ts.map +1 -1
- package/lib/core/FieldGroup/FieldGroupList.stories.js +3 -47
- package/lib/core/FieldGroup/FieldGroupList.stories.js.map +1 -1
- package/lib/core/HTML/HTML.stories.d.ts.map +1 -1
- package/lib/core/HTML/HTML.stories.js +1 -1
- package/lib/core/HTML/HTML.stories.js.map +1 -1
- package/lib/core/Icon/Icon.stories.d.ts.map +1 -1
- package/lib/core/Icon/Icon.stories.js +6 -29
- package/lib/core/Icon/Icon.stories.js.map +1 -1
- package/lib/core/Icon/Icon.styles.d.ts +4 -0
- package/lib/core/Icon/Icon.styles.d.ts.map +1 -0
- package/lib/core/Icon/Icon.styles.js +25 -0
- package/lib/core/Icon/Icon.styles.js.map +1 -0
- package/lib/core/IconPicker/IconPicker.stories.js +1 -1
- package/lib/core/IconPicker/IconPicker.stories.js.map +1 -1
- package/lib/core/Link/Link.stories.d.ts +1 -11
- package/lib/core/Link/Link.stories.d.ts.map +1 -1
- package/lib/core/Link/Link.stories.js.map +1 -1
- package/lib/core/Number/Number.stories.d.ts.map +1 -1
- package/lib/core/Number/Number.stories.js +2 -0
- package/lib/core/Number/Number.stories.js.map +1 -1
- package/lib/core/PageTemplates/PageTemplates.stories.d.ts.map +1 -1
- package/lib/core/PageTemplates/PageTemplates.stories.js +1 -11
- package/lib/core/PageTemplates/PageTemplates.stories.js.map +1 -1
- package/lib/core/PageTemplates/PageTemplates.styles.d.ts +1 -0
- package/lib/core/PageTemplates/PageTemplates.styles.d.ts.map +1 -1
- package/lib/core/PageTemplates/PageTemplates.styles.js +9 -0
- package/lib/core/PageTemplates/PageTemplates.styles.js.map +1 -1
- package/lib/core/Tooltip/Tooltip.stories.d.ts +2 -5
- package/lib/core/Tooltip/Tooltip.stories.d.ts.map +1 -1
- package/lib/core/Tooltip/Tooltip.stories.js.map +1 -1
- package/lib/core/Tree/Tree.stories.d.ts.map +1 -1
- package/lib/core/Tree/Tree.stories.js +2 -2
- package/lib/core/Tree/Tree.stories.js.map +1 -1
- package/lib/cs/Article/Article.stories.d.ts +2 -10
- package/lib/cs/Article/Article.stories.d.ts.map +1 -1
- package/lib/cs/Article/Article.stories.js.map +1 -1
- package/lib/cs/ArticleList/ArticleList.stories.d.ts +2 -11
- package/lib/cs/ArticleList/ArticleList.stories.d.ts.map +1 -1
- package/lib/cs/ArticleList/ArticleList.stories.js.map +1 -1
- package/lib/cs/CSCaseView/CSAppShell.stories.d.ts +2 -36
- package/lib/cs/CSCaseView/CSAppShell.stories.d.ts.map +1 -1
- package/lib/cs/CSCaseView/CSAppShell.stories.js +6 -19
- package/lib/cs/CSCaseView/CSAppShell.stories.js.map +1 -1
- package/lib/cs/CSCaseView/CSCaseView.mocks.d.ts +9 -0
- package/lib/cs/CSCaseView/CSCaseView.mocks.d.ts.map +1 -1
- package/lib/cs/CSCaseView/CSCaseView.mocks.js +16 -0
- package/lib/cs/CSCaseView/CSCaseView.mocks.js.map +1 -1
- package/lib/cs/CallControlPanel/CallControlPanel.stories.d.ts +2 -2
- package/lib/cs/CallControlPanel/CallControlPanel.stories.d.ts.map +1 -1
- package/lib/cs/CallControlPanel/CallControlPanel.stories.js +4 -4
- package/lib/cs/CallControlPanel/CallControlPanel.stories.js.map +1 -1
- package/lib/cs/IntelligentGuidance/IntelligentGuidance.stories.d.ts +2 -8
- package/lib/cs/IntelligentGuidance/IntelligentGuidance.stories.d.ts.map +1 -1
- package/lib/cs/IntelligentGuidance/IntelligentGuidance.stories.js +3 -3
- package/lib/cs/IntelligentGuidance/IntelligentGuidance.stories.js.map +1 -1
- package/lib/cs/InteractionNotification/InteractionNotification.stories.d.ts +7 -6
- package/lib/cs/InteractionNotification/InteractionNotification.stories.d.ts.map +1 -1
- package/lib/cs/InteractionNotification/InteractionNotification.stories.js +13 -5
- package/lib/cs/InteractionNotification/InteractionNotification.stories.js.map +1 -1
- package/lib/cs/InteractionTimer/InteractionTimer.mocks.d.ts +11 -0
- package/lib/cs/InteractionTimer/InteractionTimer.mocks.d.ts.map +1 -0
- package/lib/cs/InteractionTimer/InteractionTimer.mocks.js +29 -0
- package/lib/cs/InteractionTimer/InteractionTimer.mocks.js.map +1 -0
- package/lib/cs/InteractionTimer/InteractionTimer.stories.d.ts +2 -7
- package/lib/cs/InteractionTimer/InteractionTimer.stories.d.ts.map +1 -1
- package/lib/cs/InteractionTimer/InteractionTimer.stories.js +6 -30
- package/lib/cs/InteractionTimer/InteractionTimer.stories.js.map +1 -1
- package/lib/cs/TaskManager/TaskManager.mocks.d.ts +6 -0
- package/lib/cs/TaskManager/TaskManager.mocks.d.ts.map +1 -1
- package/lib/cs/TaskManager/TaskManager.mocks.js +7 -0
- package/lib/cs/TaskManager/TaskManager.mocks.js.map +1 -1
- package/lib/cs/TaskManager/TaskManager.stories.d.ts +6 -5
- package/lib/cs/TaskManager/TaskManager.stories.d.ts.map +1 -1
- package/lib/cs/TaskManager/TaskManager.stories.js +25 -29
- package/lib/cs/TaskManager/TaskManager.stories.js.map +1 -1
- package/lib/cs/TaskManager/TaskManager.styles.d.ts +3 -0
- package/lib/cs/TaskManager/TaskManager.styles.d.ts.map +1 -0
- package/lib/cs/TaskManager/TaskManager.styles.js +8 -0
- package/lib/cs/TaskManager/TaskManager.styles.js.map +1 -0
- package/lib/dnd/DragDropList/DragDropList.mocks.d.ts +15 -0
- package/lib/dnd/DragDropList/DragDropList.mocks.d.ts.map +1 -0
- package/lib/dnd/DragDropList/DragDropList.mocks.js +32 -0
- package/lib/dnd/DragDropList/DragDropList.mocks.js.map +1 -0
- package/lib/dnd/DragDropList/DragDropList.stories.d.ts +8 -9
- package/lib/dnd/DragDropList/DragDropList.stories.d.ts.map +1 -1
- package/lib/dnd/DragDropList/DragDropList.stories.js +14 -85
- package/lib/dnd/DragDropList/DragDropList.stories.js.map +1 -1
- package/lib/dnd/DragDropList/DragDropList.styles.d.ts +6 -0
- package/lib/dnd/DragDropList/DragDropList.styles.d.ts.map +1 -0
- package/lib/dnd/DragDropList/DragDropList.styles.js +32 -0
- package/lib/dnd/DragDropList/DragDropList.styles.js.map +1 -0
- package/lib/rte/Editor/Editor.mocks.d.ts +6 -0
- package/lib/rte/Editor/Editor.mocks.d.ts.map +1 -0
- package/lib/rte/Editor/Editor.mocks.js +23 -0
- package/lib/rte/Editor/Editor.mocks.js.map +1 -0
- package/lib/rte/Editor/Editor.stories.d.ts.map +1 -1
- package/lib/rte/Editor/Editor.stories.js +1 -21
- package/lib/rte/Editor/Editor.stories.js.map +1 -1
- package/lib/rte/RichTextEditor/RichTextEditor.stories.d.ts +2 -3
- package/lib/rte/RichTextEditor/RichTextEditor.stories.d.ts.map +1 -1
- package/lib/rte/RichTextEditor/RichTextEditor.stories.js.map +1 -1
- package/lib/social/Chat/RepeatingView.mocks.d.ts +14 -0
- package/lib/social/Chat/RepeatingView.mocks.d.ts.map +1 -0
- package/lib/social/Chat/RepeatingView.mocks.js +11 -0
- package/lib/social/Chat/RepeatingView.mocks.js.map +1 -0
- package/lib/social/Chat/RepeatingView.stories.d.ts +6 -17
- package/lib/social/Chat/RepeatingView.stories.d.ts.map +1 -1
- package/lib/social/Chat/RepeatingView.stories.js +16 -46
- package/lib/social/Chat/RepeatingView.stories.js.map +1 -1
- package/lib/social/Chat/RepeatingView.styles.d.ts +2 -0
- package/lib/social/Chat/RepeatingView.styles.d.ts.map +1 -0
- package/lib/social/Chat/RepeatingView.styles.js +22 -0
- package/lib/social/Chat/RepeatingView.styles.js.map +1 -0
- package/lib/social/Email/Email.mocks.d.ts +155 -2
- package/lib/social/Email/Email.mocks.d.ts.map +1 -1
- package/lib/social/Email/Email.mocks.js +361 -0
- package/lib/social/Email/Email.mocks.js.map +1 -1
- package/lib/social/Email/Email.stories.d.ts +14 -14
- package/lib/social/Email/Email.stories.d.ts.map +1 -1
- package/lib/social/Email/Email.stories.js +99 -427
- package/lib/social/Email/Email.stories.js.map +1 -1
- package/lib/social/Email/Email.styles.d.ts +4 -0
- package/lib/social/Email/Email.styles.d.ts.map +1 -0
- package/lib/social/Email/Email.styles.js +14 -0
- package/lib/social/Email/Email.styles.js.map +1 -0
- package/lib/social/Feed/Feed.stories.d.ts.map +1 -1
- package/lib/social/Feed/Feed.stories.js +23 -18
- package/lib/social/Feed/Feed.stories.js.map +1 -1
- package/lib/social/Feed/FeedPost.stories.d.ts.map +1 -1
- package/lib/social/Feed/FeedPost.stories.js +30 -20
- package/lib/social/Feed/FeedPost.stories.js.map +1 -1
- package/lib/social/Feed/FeedReply.stories.d.ts.map +1 -1
- package/lib/social/Feed/FeedReply.stories.js +21 -16
- package/lib/social/Feed/FeedReply.stories.js.map +1 -1
- package/lib/work/CaseView/MobileCaseView.stories.d.ts +2 -7
- package/lib/work/CaseView/MobileCaseView.stories.d.ts.map +1 -1
- package/lib/work/CaseView/MobileCaseView.stories.js.map +1 -1
- package/lib/work/ConfigurableLayout/ConfigurableLayout.mocks.d.ts +45 -0
- package/lib/work/ConfigurableLayout/ConfigurableLayout.mocks.d.ts.map +1 -0
- package/lib/work/ConfigurableLayout/ConfigurableLayout.mocks.js +165 -0
- package/lib/work/ConfigurableLayout/ConfigurableLayout.mocks.js.map +1 -0
- package/lib/work/ConfigurableLayout/ConfigurableLayout.stories.d.ts +2 -6
- package/lib/work/ConfigurableLayout/ConfigurableLayout.stories.d.ts.map +1 -1
- package/lib/work/ConfigurableLayout/ConfigurableLayout.stories.js +2 -172
- package/lib/work/ConfigurableLayout/ConfigurableLayout.stories.js.map +1 -1
- package/lib/work/ConfigurableLayout/ConfigurableLayout.styles.d.ts +4 -0
- package/lib/work/ConfigurableLayout/ConfigurableLayout.styles.d.ts.map +1 -0
- package/lib/work/ConfigurableLayout/ConfigurableLayout.styles.js +11 -0
- package/lib/work/ConfigurableLayout/ConfigurableLayout.styles.js.map +1 -0
- package/package.json +9 -10
- package/jsx/build/FlowModeller/FlowModeller.mocks.js.map +0 -1
- package/jsx/build/ObjectSelect/ObjectSelect.mocks.js +0 -136
- package/jsx/build/ObjectSelect/ObjectSelect.mocks.js.map +0 -1
- package/jsx/cs/CSCaseView/CSCaseView.mocks.js.map +0 -1
- package/jsx/social/Email/Email.mocks.js +0 -395
- package/jsx/social/Email/Email.mocks.js.map +0 -1
|
@@ -1,28 +1,16 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
/* eslint-disable react/no-unescaped-entities */
|
|
3
3
|
import { useRef, useState } from 'react';
|
|
4
|
-
import
|
|
5
|
-
import { boolean, select } from '@storybook/addon-knobs';
|
|
6
|
-
import { Card, CardContent, Text, Grid, Button, defaultThemeProp, Popover, useElement, useOuterEvent, Flex, useI18n } from '@pega/cosmos-react-core';
|
|
4
|
+
import { Card, CardContent, Text, Button, Popover, useElement, useOuterEvent, Flex, useI18n } from '@pega/cosmos-react-core';
|
|
7
5
|
import { ConditionBuilder, FieldCondition, AtomicCondition, getInitConditionForLhs, isValidCondition, formatCondition } from '@pega/cosmos-react-condition-builder';
|
|
8
6
|
import { demoFields, demoCondition, demoComparators, demoDateFunctions } from './props.mock';
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
`;
|
|
12
|
-
const StyledCodeBlock = styled.pre `
|
|
13
|
-
padding: ${props => props.theme.base.spacing};
|
|
14
|
-
margin-bottom: ${props => props.theme.base.spacing};
|
|
15
|
-
`;
|
|
16
|
-
StyledCodeBlock.defaultProps = defaultThemeProp;
|
|
17
|
-
const StyledList = styled.ul `
|
|
18
|
-
padding-left: calc(4 * ${props => props.theme.base.spacing});
|
|
19
|
-
`;
|
|
20
|
-
StyledList.defaultProps = defaultThemeProp;
|
|
7
|
+
import { StyledCodeBlock, StyledGrid, StyledList } from './ConditionBuilder.styles';
|
|
8
|
+
import { convertRhsTypes } from './ConditionBuilder.mocks';
|
|
21
9
|
export default {
|
|
22
10
|
title: 'Condition Builder/ConditionBuilder',
|
|
23
11
|
component: ConditionBuilder
|
|
24
12
|
};
|
|
25
|
-
export const DefaultBuilder = () => {
|
|
13
|
+
export const DefaultBuilder = (args) => {
|
|
26
14
|
const translate = useI18n();
|
|
27
15
|
const [condition, setCondition] = useState(() => {
|
|
28
16
|
// If a previous condition exists on the session, use it
|
|
@@ -36,10 +24,6 @@ export const DefaultBuilder = () => {
|
|
|
36
24
|
}
|
|
37
25
|
return demoCondition;
|
|
38
26
|
});
|
|
39
|
-
const validComparators = boolean('Limit Comparators', false) ? demoComparators : undefined;
|
|
40
|
-
const disallowNOT = boolean('Disallow NOT operator', false);
|
|
41
|
-
const renderInPopover = boolean('Render inside Popover', false);
|
|
42
|
-
const dateFunctions = boolean('Enable Date functions', true) ? demoDateFunctions : undefined;
|
|
43
27
|
// Set up content for rendering inside a Popover
|
|
44
28
|
const buttonRef = useRef(null); // Ref for the opener button
|
|
45
29
|
const [isOpen, setIsOpen] = useState(false);
|
|
@@ -54,7 +38,7 @@ export const DefaultBuilder = () => {
|
|
|
54
38
|
if (e.key === 'Escape')
|
|
55
39
|
hidePopover(); // Call the method when Escape key is pressed
|
|
56
40
|
};
|
|
57
|
-
const builderJsx = (_jsx(ConditionBuilder, { fields: demoFields, condition: condition, validComparators: validComparators, validRhsTypes: new Set(['LITERAL', 'FIELD', 'DATE_FUNCTION', 'RELATIVE_DATE']), dateFunctions: dateFunctions, disallowNOT: disallowNOT, onConditionSubmit: (c) => {
|
|
41
|
+
const builderJsx = (_jsx(ConditionBuilder, { fields: demoFields, condition: condition, validComparators: args.validComparators ? demoComparators : undefined, validRhsTypes: new Set(['LITERAL', 'FIELD', 'DATE_FUNCTION', 'RELATIVE_DATE']), dateFunctions: args.dateFunctions ? demoDateFunctions : undefined, disallowNOT: args.disallowNOT, onConditionSubmit: (c) => {
|
|
58
42
|
setCondition(c);
|
|
59
43
|
hidePopover();
|
|
60
44
|
sessionStorage.setItem('CBDemoCondition', JSON.stringify(c)); // Persist on sessionStorage for the next time
|
|
@@ -62,14 +46,23 @@ export const DefaultBuilder = () => {
|
|
|
62
46
|
return (_jsxs(StyledGrid, { container: {
|
|
63
47
|
cols: '1fr',
|
|
64
48
|
rowGap: 3
|
|
65
|
-
}, children: [!renderInPopover && builderJsx, renderInPopover && (_jsxs(_Fragment, { children: [_jsx(Button, { ref: buttonRef, "aria-haspopup": true, "aria-expanded": isOpen, onClick: () => setIsOpen(!isOpen), onKeyDown: hideOnEscape, children: "Open Condition builder" }, void 0), _jsx(Popover, { show: isOpen, ref: setPopoverEl, target: buttonRef.current, placement: 'bottom-start', children: _jsx(Flex, { container: { pad: 1 }, children: builderJsx }, void 0) }, void 0)] }, void 0)), _jsxs("div", { children: [_jsx(Text, { variant: 'h4', children: "Output:" }, void 0), _jsx(StyledCodeBlock, { children: condition ? JSON.stringify(condition, null, 2) : '(No condition)' }, void 0)] }, void 0), _jsxs("div", { children: [_jsx(Text, { variant: 'h4', children: "Formatted Output:" }, void 0), _jsx(StyledCodeBlock, { children: condition ? formatCondition(condition, demoFields, translate) : '(No condition)' }, void 0)] }, void 0)] }, void 0));
|
|
49
|
+
}, children: [!args.renderInPopover && builderJsx, args.renderInPopover && (_jsxs(_Fragment, { children: [_jsx(Button, { ref: buttonRef, "aria-haspopup": true, "aria-expanded": isOpen, onClick: () => setIsOpen(!isOpen), onKeyDown: hideOnEscape, children: "Open Condition builder" }, void 0), _jsx(Popover, { show: isOpen, ref: setPopoverEl, target: buttonRef.current, placement: 'bottom-start', children: _jsx(Flex, { container: { pad: 1 }, children: builderJsx }, void 0) }, void 0)] }, void 0)), _jsxs("div", { children: [_jsx(Text, { variant: 'h4', children: "Output:" }, void 0), _jsx(StyledCodeBlock, { children: condition ? JSON.stringify(condition, null, 2) : '(No condition)' }, void 0)] }, void 0), _jsxs("div", { children: [_jsx(Text, { variant: 'h4', children: "Formatted Output:" }, void 0), _jsx(StyledCodeBlock, { children: condition ? formatCondition(condition, demoFields, translate) : '(No condition)' }, void 0)] }, void 0)] }, void 0));
|
|
66
50
|
};
|
|
67
|
-
|
|
51
|
+
DefaultBuilder.args = {
|
|
52
|
+
validComparators: false,
|
|
53
|
+
disallowNOT: false,
|
|
54
|
+
renderInPopover: false,
|
|
55
|
+
dateFunctions: true
|
|
56
|
+
};
|
|
57
|
+
DefaultBuilder.argTypes = {
|
|
58
|
+
validComparators: { control: { type: 'boolean' } },
|
|
59
|
+
disallowNOT: { control: { type: 'boolean' } },
|
|
60
|
+
renderInPopover: { control: { type: 'boolean' } },
|
|
61
|
+
dateFunctions: { control: { type: 'boolean' } }
|
|
62
|
+
};
|
|
63
|
+
export const FieldConditionDemo = (args) => {
|
|
68
64
|
const translate = useI18n();
|
|
69
65
|
const [condition, setCondition] = useState(undefined);
|
|
70
|
-
const validComparators = boolean('Limit Comparators', false) ? demoComparators : undefined;
|
|
71
|
-
const renderInPopover = boolean('Render inside Popover', false);
|
|
72
|
-
const dateFunctions = boolean('Enable Date functions', true) ? demoDateFunctions : undefined;
|
|
73
66
|
// Set up content for rendering inside a Popover
|
|
74
67
|
const buttonRef = useRef(null); // Ref for the opener button
|
|
75
68
|
const [isOpen, setIsOpen] = useState(false);
|
|
@@ -84,7 +77,7 @@ export const FieldConditionDemo = () => {
|
|
|
84
77
|
if (e.key === 'Escape')
|
|
85
78
|
hidePopover(); // Call the method when Escape key is pressed
|
|
86
79
|
};
|
|
87
|
-
const builderJsx = (_jsx(FieldCondition, { targetField: 'lastActivityAt', fields: demoFields, condition: condition, validComparators: validComparators, validRhsTypes: new Set(['LITERAL', 'FIELD', 'DATE_FUNCTION', 'RELATIVE_DATE']), dateFunctions: dateFunctions, onSubmit: c => {
|
|
80
|
+
const builderJsx = (_jsx(FieldCondition, { targetField: 'lastActivityAt', fields: demoFields, condition: condition, validComparators: args.validComparators ? demoComparators : undefined, validRhsTypes: new Set(['LITERAL', 'FIELD', 'DATE_FUNCTION', 'RELATIVE_DATE']), dateFunctions: args.dateFunctions ? demoDateFunctions : undefined, onSubmit: c => {
|
|
88
81
|
hidePopover();
|
|
89
82
|
setCondition(c);
|
|
90
83
|
} }, void 0));
|
|
@@ -93,32 +86,21 @@ export const FieldConditionDemo = () => {
|
|
|
93
86
|
justifyItems: 'stretch',
|
|
94
87
|
alignItems: 'start',
|
|
95
88
|
colGap: 4
|
|
96
|
-
}, children: [!renderInPopover && builderJsx, renderInPopover && (_jsxs(_Fragment, { children: [_jsx(Button, { ref: buttonRef, "aria-haspopup": true, "aria-expanded": isOpen, onClick: () => setIsOpen(!isOpen), onKeyDown: hideOnEscape, children: "Open Condition builder" }, void 0), _jsx(Popover, { show: isOpen, ref: setPopoverEl, target: buttonRef.current, placement: 'bottom-start', children: _jsx(Flex, { container: { pad: 1 }, children: builderJsx }, void 0) }, void 0)] }, void 0)), _jsxs("div", { children: [_jsx(Text, { variant: 'h4', children: "Output:" }, void 0), _jsx(StyledCodeBlock, { children: condition ? JSON.stringify(condition, null, 2) : '(No condition)' }, void 0), _jsx(Text, { variant: 'h4', children: "Formatted Output:" }, void 0), _jsx(StyledCodeBlock, { children: condition ? formatCondition({ condition }, demoFields, translate) : '(No condition)' }, void 0)] }, void 0)] }, void 0));
|
|
89
|
+
}, children: [!args.renderInPopover && builderJsx, args.renderInPopover && (_jsxs(_Fragment, { children: [_jsx(Button, { ref: buttonRef, "aria-haspopup": true, "aria-expanded": isOpen, onClick: () => setIsOpen(!isOpen), onKeyDown: hideOnEscape, children: "Open Condition builder" }, void 0), _jsx(Popover, { show: isOpen, ref: setPopoverEl, target: buttonRef.current, placement: 'bottom-start', children: _jsx(Flex, { container: { pad: 1 }, children: builderJsx }, void 0) }, void 0)] }, void 0)), _jsxs("div", { children: [_jsx(Text, { variant: 'h4', children: "Output:" }, void 0), _jsx(StyledCodeBlock, { children: condition ? JSON.stringify(condition, null, 2) : '(No condition)' }, void 0), _jsx(Text, { variant: 'h4', children: "Formatted Output:" }, void 0), _jsx(StyledCodeBlock, { children: condition ? formatCondition({ condition }, demoFields, translate) : '(No condition)' }, void 0)] }, void 0)] }, void 0));
|
|
90
|
+
};
|
|
91
|
+
FieldConditionDemo.args = {
|
|
92
|
+
validComparators: false,
|
|
93
|
+
renderInPopover: false,
|
|
94
|
+
dateFunctions: true
|
|
97
95
|
};
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
if (useFieldRHSType)
|
|
103
|
-
setRhsTypes.add('FIELD');
|
|
104
|
-
if (dateFunctions)
|
|
105
|
-
setRhsTypes.add('DATE_FUNCTION');
|
|
106
|
-
if (useRelativeDatesType)
|
|
107
|
-
setRhsTypes.add('RELATIVE_DATE');
|
|
108
|
-
return setRhsTypes;
|
|
96
|
+
FieldConditionDemo.argTypes = {
|
|
97
|
+
validComparators: { control: { type: 'boolean' } },
|
|
98
|
+
renderInPopover: { control: { type: 'boolean' } },
|
|
99
|
+
dateFunctions: { control: { type: 'boolean' } }
|
|
109
100
|
};
|
|
110
|
-
export const AtomicConditionDemo = () => {
|
|
101
|
+
export const AtomicConditionDemo = (args) => {
|
|
111
102
|
const translate = useI18n();
|
|
112
|
-
|
|
113
|
-
const renderInPopover = boolean('Render inside Popover', false);
|
|
114
|
-
const itemDirection = select('Item Direction', { Column: 'column', Row: 'row' }, 'column');
|
|
115
|
-
const validComparators = boolean('Limit Comparators', false) ? demoComparators : undefined;
|
|
116
|
-
const useLiteralRHSType = boolean('Enable Literal RHS Type', true);
|
|
117
|
-
const useFieldRHSType = boolean('Enable Field RHS Type', true);
|
|
118
|
-
const useRelativeDatesRHSType = boolean('Enable Relative Dates RHS Type', true);
|
|
119
|
-
const dateFunctions = boolean('Enable Date functions', true) ? demoDateFunctions : undefined;
|
|
120
|
-
const validRHSTypes = convertRhsTypes(useLiteralRHSType, useFieldRHSType, useRelativeDatesRHSType, dateFunctions);
|
|
121
|
-
const showLhsAsLabel = boolean('Show LHS as Label', false);
|
|
103
|
+
const validRHSTypes = convertRhsTypes(!!args.useLiteralRHSType, !!args.useFieldRHSType, !!args.useRelativeDatesRHSType, args.dateFunctions ? demoDateFunctions : undefined);
|
|
122
104
|
// Story State object to simulate "submitting"
|
|
123
105
|
const [submitCondition, setSubmitCondition] = useState(undefined);
|
|
124
106
|
// State needed to use Popover in Story
|
|
@@ -140,12 +122,12 @@ export const AtomicConditionDemo = () => {
|
|
|
140
122
|
const [condition, setCondition] = useState(
|
|
141
123
|
// If editing use the seedCondition, otherwise, determine an initial condition based on the targetField
|
|
142
124
|
() => submitCondition ||
|
|
143
|
-
getInitConditionForLhs({ field: 'age' }, demoFields, validRHSTypes, validComparators, dateFunctions));
|
|
125
|
+
getInitConditionForLhs({ field: 'age' }, demoFields, validRHSTypes, args.validComparators ? demoComparators : undefined, args.dateFunctions ? demoDateFunctions : undefined));
|
|
144
126
|
const handleSubmission = () => {
|
|
145
127
|
setShowErrorIndicators(false);
|
|
146
128
|
if (isValidCondition(condition, demoFields, true)) {
|
|
147
129
|
// Insert all "submit" logic to use the valid condition that you've created.
|
|
148
|
-
if (renderInPopover)
|
|
130
|
+
if (args.renderInPopover)
|
|
149
131
|
setIsOpen(false);
|
|
150
132
|
setSubmitCondition(condition);
|
|
151
133
|
}
|
|
@@ -153,14 +135,34 @@ export const AtomicConditionDemo = () => {
|
|
|
153
135
|
setShowErrorIndicators(true);
|
|
154
136
|
}
|
|
155
137
|
};
|
|
156
|
-
const atomicConditionJSX = (_jsxs(Flex, { container: { direction: 'column', gap: 2 }, children: [_jsx(AtomicCondition, { condition: condition, fields: demoFields, indicateErrors: showErrorIndicators, validComparators: validComparators, dateFunctions: dateFunctions, onChange: c => setCondition(c), itemDirection: itemDirection, showLhsAsLabel: showLhsAsLabel, validRhsTypes: validRHSTypes }, void 0), _jsx(Button, { variant: 'primary', onClick: handleSubmission, children: "Submit Condition" }, void 0)] }, void 0));
|
|
138
|
+
const atomicConditionJSX = (_jsxs(Flex, { container: { direction: 'column', gap: 2 }, children: [_jsx(AtomicCondition, { condition: condition, fields: demoFields, indicateErrors: showErrorIndicators, validComparators: args.validComparators ? demoComparators : undefined, dateFunctions: args.dateFunctions ? demoDateFunctions : undefined, onChange: c => setCondition(c), itemDirection: args.itemDirection, showLhsAsLabel: args.showLhsAsLabel, validRhsTypes: validRHSTypes }, void 0), _jsx(Button, { variant: 'primary', onClick: handleSubmission, children: "Submit Condition" }, void 0)] }, void 0));
|
|
157
139
|
return (_jsxs(StyledGrid, { container: {
|
|
158
140
|
cols: 'repeat(2, minmax(0, 1fr))',
|
|
159
141
|
justifyItems: 'stretch',
|
|
160
142
|
alignItems: 'start',
|
|
161
143
|
colGap: 4
|
|
162
|
-
}, children: [!renderInPopover && atomicConditionJSX, renderInPopover && (_jsxs(_Fragment, { children: [_jsx(Button, { ref: buttonRef, "aria-haspopup": true, "aria-expanded": isOpen, onClick: () => setIsOpen(!isOpen), onKeyDown: hideOnEscape, children: `${isOpen ? 'Close' : 'Open'} Atomic Condition` }, void 0), _jsx(Popover, { show: isOpen, ref: setPopoverEl, target: buttonRef.current, placement: 'bottom-start', children: _jsx(Flex, { container: { pad: 1 }, children: atomicConditionJSX }, void 0) }, void 0)] }, void 0)), _jsx(Card, { children: _jsxs(CardContent, { children: [_jsx(Text, { variant: 'h4', children: "Output:" }, void 0), _jsx(StyledCodeBlock, { children: submitCondition ? JSON.stringify(submitCondition, null, 2) : '(No condition)' }, void 0), _jsx(Text, { variant: 'h4', children: "Formatted Output:" }, void 0), _jsx(StyledCodeBlock, { children: submitCondition
|
|
144
|
+
}, children: [!args.renderInPopover && atomicConditionJSX, args.renderInPopover && (_jsxs(_Fragment, { children: [_jsx(Button, { ref: buttonRef, "aria-haspopup": true, "aria-expanded": isOpen, onClick: () => setIsOpen(!isOpen), onKeyDown: hideOnEscape, children: `${isOpen ? 'Close' : 'Open'} Atomic Condition` }, void 0), _jsx(Popover, { show: isOpen, ref: setPopoverEl, target: buttonRef.current, placement: 'bottom-start', children: _jsx(Flex, { container: { pad: 1 }, children: atomicConditionJSX }, void 0) }, void 0)] }, void 0)), _jsx(Card, { children: _jsxs(CardContent, { children: [_jsx(Text, { variant: 'h4', children: "Output:" }, void 0), _jsx(StyledCodeBlock, { children: submitCondition ? JSON.stringify(submitCondition, null, 2) : '(No condition)' }, void 0), _jsx(Text, { variant: 'h4', children: "Formatted Output:" }, void 0), _jsx(StyledCodeBlock, { children: submitCondition
|
|
163
145
|
? formatCondition({ condition: submitCondition }, demoFields, translate)
|
|
164
146
|
: '(No condition)' }, void 0), _jsxs(Flex, { container: { gap: 1, direction: 'column' }, children: [_jsxs(Flex, { container: { gap: 1, direction: 'column' }, children: [_jsx(Text, { variant: 'h2', status: 'error', children: "validRhsTypes Prop Warning" }, void 0), _jsxs(Text, { children: ["There are LHS(Left Hand Side Field)/Comparator pairings that ", _jsx("u", { children: "require" }, void 0), " specific RHS(Right Hand Side Value) types. Please be mindful of these incompatibilities when limiting RHS value types using this prop. We ", _jsx("b", { children: "do not" }, void 0), " support limiting RHS field types to incompatible types and it will result in a validation error if you do so. The pairings referred to here are as follows:"] }, void 0)] }, void 0), _jsxs(StyledList, { children: [_jsxs("li", { children: ["BOOLEAN LHS Fields coupled with \"EQ\" or \"NEQ\" comparators, will ", _jsx("u", { children: "always yield" }, void 0), ' ', "a Field RHS"] }, void 0), _jsxs("li", { children: ["Any LHS Fields coupled with \"IN\" or \"NOT_IN\" comparators, will ", _jsx("u", { children: "always yield" }, void 0), " a Literal RHS (Comma separated list)"] }, void 0)] }, void 0), _jsx(Flex, { container: { direction: 'column' }, children: _jsxs(Text, { children: ["If you would like to limit RHS value types and avoid these incompatibilities, you will need to exclude these comparators using the ", _jsx("b", { children: "validComparators" }, void 0), " prop."] }, void 0) }, void 0)] }, void 0)] }, void 0) }, void 0)] }, void 0));
|
|
165
147
|
};
|
|
148
|
+
AtomicConditionDemo.args = {
|
|
149
|
+
validComparators: false,
|
|
150
|
+
renderInPopover: false,
|
|
151
|
+
dateFunctions: true,
|
|
152
|
+
itemDirection: 'column',
|
|
153
|
+
useLiteralRHSType: true,
|
|
154
|
+
useFieldRHSType: true,
|
|
155
|
+
useRelativeDatesRHSType: true,
|
|
156
|
+
showLhsAsLabel: false
|
|
157
|
+
};
|
|
158
|
+
AtomicConditionDemo.argTypes = {
|
|
159
|
+
validComparators: { control: { type: 'boolean' } },
|
|
160
|
+
renderInPopover: { control: { type: 'boolean' } },
|
|
161
|
+
dateFunctions: { control: { type: 'boolean' } },
|
|
162
|
+
itemDirection: { options: ['column', 'row'], control: { type: 'select' } },
|
|
163
|
+
useLiteralRHSType: { control: { type: 'boolean' } },
|
|
164
|
+
useFieldRHSType: { control: { type: 'boolean' } },
|
|
165
|
+
useRelativeDatesRHSType: { control: { type: 'boolean' } },
|
|
166
|
+
showLhsAsLabel: { control: { type: 'boolean' } }
|
|
167
|
+
};
|
|
166
168
|
//# sourceMappingURL=ConditionBuilder.stories.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConditionBuilder.stories.js","sourceRoot":"","sources":["../../../src/condition-builder/ConditionBuilder/ConditionBuilder.stories.tsx"],"names":[],"mappings":";AAAA,gDAAgD;AAChD,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACzC,OAAO,MAAM,MAAM,mBAAmB,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAEzD,OAAO,EACL,IAAI,EACJ,WAAW,EACX,IAAI,EACJ,IAAI,EACJ,MAAM,EACN,gBAAgB,EAChB,OAAO,EACP,UAAU,EACV,aAAa,EACb,IAAI,EACJ,OAAO,EACR,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,gBAAgB,EAChB,cAAc,EACd,eAAe,EACf,sBAAsB,EACtB,gBAAgB,EAIhB,eAAe,EAEhB,MAAM,sCAAsC,CAAC;AAE9C,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAE7F,MAAM,UAAU,GAAG,MAAM,CAAC,IAAI,CAAC,CAAA;;CAE9B,CAAC;AAEF,MAAM,eAAe,GAAG,MAAM,CAAC,GAAG,CAAA;aACrB,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO;mBAC3B,KAAK,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AAI,CAAC,SAAS,CAAC,eAAe,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,gBAAgB,WAC9D,EAElB,KAAC,IAAI,IAAC,OAAO,EAAC,IAAI,0CAAyB,EAC3C,KAAC,eAAe,cACb,eAAe;gCACd,CAAC,CAAC,eAAe,CAAC,EAAE,SAAS,EAAE,eAAe,EAAE,EAAE,UAAU,EAAE,SAAS,CAAC;gCACxE,CAAC,CAAC,gBAAgB,WACJ,EAClB,MAAC,IAAI,IAAC,SAAS,EAAE,EAAE,GAAG,EAAE,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,aAC9C,MAAC,IAAI,IAAC,SAAS,EAAE,EAAE,GAAG,EAAE,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,aAC9C,KAAC,IAAI,IAAC,OAAO,EAAC,IAAI,EAAC,MAAM,EAAC,OAAO,mDAE1B,EACP,MAAC,IAAI,gFAC0D,0CAAc,iJAE9B,yCAAa,4KAGrD,YACF,EACP,MAAC,UAAU,eACT,iGACkE,+CAAmB,EAAC,GAAG,2BAEpF,EACL,gGACiE,+CAAmB,qDAE/E,YACM,EACb,KAAC,IAAI,IAAC,SAAS,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE,YACtC,MAAC,IAAI,sJAE8C,mDAAuB,sBACnE,WACF,YACF,YACK,WACT,YACI,CACd,CAAC;AACJ,CAAC,CAAC","sourcesContent":["/* eslint-disable react/no-unescaped-entities */\nimport { useRef, useState } from 'react';\nimport styled from 'styled-components';\nimport { boolean, select } from '@storybook/addon-knobs';\n\nimport {\n Card,\n CardContent,\n Text,\n Grid,\n Button,\n defaultThemeProp,\n Popover,\n useElement,\n useOuterEvent,\n Flex,\n useI18n\n} from '@pega/cosmos-react-core';\nimport {\n ConditionBuilder,\n FieldCondition,\n AtomicCondition,\n getInitConditionForLhs,\n isValidCondition,\n Condition,\n DateFunctionsByType,\n LeafCondition,\n formatCondition,\n RHSType\n} from '@pega/cosmos-react-condition-builder';\n\nimport { demoFields, demoCondition, demoComparators, demoDateFunctions } from './props.mock';\n\nconst StyledGrid = styled(Grid)`\n max-width: 60rem;\n`;\n\nconst StyledCodeBlock = styled.pre`\n padding: ${props => props.theme.base.spacing};\n margin-bottom: ${props => props.theme.base.spacing};\n`;\nStyledCodeBlock.defaultProps = defaultThemeProp;\n\nconst StyledList = styled.ul`\n padding-left: calc(4 * ${props => props.theme.base.spacing});\n`;\nStyledList.defaultProps = defaultThemeProp;\n\nexport default {\n title: 'Condition Builder/ConditionBuilder',\n component: ConditionBuilder\n};\n\nexport const DefaultBuilder = () => {\n const translate = useI18n();\n const [condition, setCondition] = useState<Condition | undefined>(() => {\n // If a previous condition exists on the session, use it\n const prevCondition = sessionStorage.getItem('CBDemoCondition');\n if (prevCondition !== null) {\n // If an empty condition was submitted previously, start with an empty one\n if (prevCondition === 'undefined') {\n return undefined;\n }\n return JSON.parse(prevCondition);\n }\n return demoCondition;\n });\n\n const validComparators = boolean('Limit Comparators', false) ? demoComparators : undefined;\n const disallowNOT = boolean('Disallow NOT operator', false);\n const renderInPopover = boolean('Render inside Popover', false);\n const dateFunctions = boolean('Enable Date functions', true) ? demoDateFunctions : undefined;\n\n // Set up content for rendering inside a Popover\n const buttonRef = useRef(null); // Ref for the opener button\n const [isOpen, setIsOpen] = useState(false);\n const [popoverEl, setPopoverEl] = useElement<HTMLElement>(null);\n const hidePopover = () => {\n if (isOpen) {\n setIsOpen(false);\n }\n };\n useOuterEvent('mousedown', [popoverEl, buttonRef.current], hidePopover); // Call the method on clicking outside these elements\n const hideOnEscape = (e: KeyboardEvent) => {\n if (e.key === 'Escape') hidePopover(); // Call the method when Escape key is pressed\n };\n\n const builderJsx = (\n <ConditionBuilder\n fields={demoFields}\n condition={condition}\n validComparators={validComparators}\n validRhsTypes={new Set(['LITERAL', 'FIELD', 'DATE_FUNCTION', 'RELATIVE_DATE'])}\n dateFunctions={dateFunctions}\n disallowNOT={disallowNOT}\n onConditionSubmit={(c: Condition | undefined) => {\n setCondition(c);\n hidePopover();\n sessionStorage.setItem('CBDemoCondition', JSON.stringify(c)); // Persist on sessionStorage for the next time\n }}\n />\n );\n\n return (\n <StyledGrid\n container={{\n cols: '1fr',\n rowGap: 3\n }}\n >\n {!renderInPopover && builderJsx}\n\n {renderInPopover && (\n <>\n <Button\n ref={buttonRef}\n aria-haspopup\n aria-expanded={isOpen}\n onClick={() => setIsOpen(!isOpen)}\n onKeyDown={hideOnEscape}\n >\n Open Condition builder\n </Button>\n\n <Popover\n show={isOpen}\n ref={setPopoverEl}\n target={buttonRef.current}\n placement='bottom-start'\n >\n <Flex container={{ pad: 1 }}>{builderJsx}</Flex>\n </Popover>\n </>\n )}\n\n <div>\n <Text variant='h4'>Output:</Text>\n <StyledCodeBlock>\n {condition ? JSON.stringify(condition, null, 2) : '(No condition)'}\n </StyledCodeBlock>\n </div>\n\n <div>\n <Text variant='h4'>Formatted Output:</Text>\n <StyledCodeBlock>\n {condition ? formatCondition(condition, demoFields, translate) : '(No condition)'}\n </StyledCodeBlock>\n </div>\n </StyledGrid>\n );\n};\n\nexport const FieldConditionDemo = () => {\n const translate = useI18n();\n const [condition, setCondition] = useState<LeafCondition | undefined>(undefined);\n\n const validComparators = boolean('Limit Comparators', false) ? demoComparators : undefined;\n const renderInPopover = boolean('Render inside Popover', false);\n const dateFunctions = boolean('Enable Date functions', true) ? demoDateFunctions : undefined;\n\n // Set up content for rendering inside a Popover\n const buttonRef = useRef(null); // Ref for the opener button\n const [isOpen, setIsOpen] = useState(false);\n const [popoverEl, setPopoverEl] = useElement<HTMLElement>(null);\n const hidePopover = () => {\n if (isOpen) {\n setIsOpen(false);\n }\n };\n useOuterEvent('mousedown', [popoverEl, buttonRef.current], hidePopover); // Call the method on clicking outside these elements\n const hideOnEscape = (e: KeyboardEvent) => {\n if (e.key === 'Escape') hidePopover(); // Call the method when Escape key is pressed\n };\n\n const builderJsx = (\n <FieldCondition\n targetField='lastActivityAt'\n fields={demoFields}\n condition={condition}\n validComparators={validComparators}\n validRhsTypes={new Set(['LITERAL', 'FIELD', 'DATE_FUNCTION', 'RELATIVE_DATE'])}\n dateFunctions={dateFunctions}\n onSubmit={c => {\n hidePopover();\n setCondition(c);\n }}\n />\n );\n\n return (\n <StyledGrid\n container={{\n cols: 'repeat(2, minmax(0, 1fr))',\n justifyItems: 'stretch',\n alignItems: 'start',\n colGap: 4\n }}\n >\n {!renderInPopover && builderJsx}\n\n {renderInPopover && (\n <>\n <Button\n ref={buttonRef}\n aria-haspopup\n aria-expanded={isOpen}\n onClick={() => setIsOpen(!isOpen)}\n onKeyDown={hideOnEscape}\n >\n Open Condition builder\n </Button>\n\n <Popover\n show={isOpen}\n ref={setPopoverEl}\n target={buttonRef.current}\n placement='bottom-start'\n >\n <Flex container={{ pad: 1 }}>{builderJsx}</Flex>\n </Popover>\n </>\n )}\n\n <div>\n <Text variant='h4'>Output:</Text>\n <StyledCodeBlock>\n {condition ? JSON.stringify(condition, null, 2) : '(No condition)'}\n </StyledCodeBlock>\n\n <Text variant='h4'>Formatted Output:</Text>\n <StyledCodeBlock>\n {condition ? formatCondition({ condition }, demoFields, translate) : '(No condition)'}\n </StyledCodeBlock>\n </div>\n </StyledGrid>\n );\n};\n\nconst convertRhsTypes = (\n useLiteralRHSType: boolean,\n useFieldRHSType: boolean,\n useRelativeDatesType: boolean,\n dateFunctions?: DateFunctionsByType\n) => {\n const setRhsTypes: Set<RHSType> = new Set<RHSType>();\n if (useLiteralRHSType) setRhsTypes.add('LITERAL');\n if (useFieldRHSType) setRhsTypes.add('FIELD');\n if (dateFunctions) setRhsTypes.add('DATE_FUNCTION');\n if (useRelativeDatesType) setRhsTypes.add('RELATIVE_DATE');\n return setRhsTypes;\n};\n\nexport const AtomicConditionDemo = () => {\n const translate = useI18n();\n // Storybook knobs for configuration\n const renderInPopover = boolean('Render inside Popover', false);\n const itemDirection = select('Item Direction', { Column: 'column', Row: 'row' }, 'column');\n const validComparators = boolean('Limit Comparators', false) ? demoComparators : undefined;\n const useLiteralRHSType = boolean('Enable Literal RHS Type', true);\n const useFieldRHSType = boolean('Enable Field RHS Type', true);\n const useRelativeDatesRHSType = boolean('Enable Relative Dates RHS Type', true);\n const dateFunctions = boolean('Enable Date functions', true) ? demoDateFunctions : undefined;\n const validRHSTypes: Set<RHSType> = convertRhsTypes(\n useLiteralRHSType,\n useFieldRHSType,\n useRelativeDatesRHSType,\n dateFunctions\n );\n const showLhsAsLabel = boolean('Show LHS as Label', false);\n\n // Story State object to simulate \"submitting\"\n const [submitCondition, setSubmitCondition] = useState<LeafCondition | undefined>(undefined);\n // State needed to use Popover in Story\n const buttonRef = useRef(null); // Ref for the opener button\n const [isOpen, setIsOpen] = useState(false);\n const [popoverEl, setPopoverEl] = useElement<HTMLElement>(null);\n const hidePopover = () => {\n if (isOpen) {\n setIsOpen(false);\n }\n };\n useOuterEvent('mousedown', [popoverEl, buttonRef.current], hidePopover); // Call the method on clicking outside these elements\n const hideOnEscape = (e: KeyboardEvent) => {\n if (e.key === 'Escape') hidePopover(); // Call the method when Escape key is pressed\n };\n\n // State handling needed to manage/use the AtomicCondition component\n const [showErrorIndicators, setShowErrorIndicators] = useState(false);\n const [condition, setCondition] = useState(\n // If editing use the seedCondition, otherwise, determine an initial condition based on the targetField\n () =>\n submitCondition ||\n getInitConditionForLhs(\n { field: 'age' },\n demoFields,\n validRHSTypes,\n validComparators,\n dateFunctions\n )\n );\n\n const handleSubmission = () => {\n setShowErrorIndicators(false);\n if (isValidCondition(condition, demoFields, true)) {\n // Insert all \"submit\" logic to use the valid condition that you've created.\n if (renderInPopover) setIsOpen(false);\n setSubmitCondition(condition);\n } else {\n setShowErrorIndicators(true);\n }\n };\n\n const atomicConditionJSX = (\n <Flex container={{ direction: 'column', gap: 2 }}>\n <AtomicCondition\n condition={condition}\n fields={demoFields}\n indicateErrors={showErrorIndicators}\n validComparators={validComparators}\n dateFunctions={dateFunctions}\n onChange={c => setCondition(c)}\n itemDirection={itemDirection}\n showLhsAsLabel={showLhsAsLabel}\n validRhsTypes={validRHSTypes}\n />\n <Button variant='primary' onClick={handleSubmission}>\n Submit Condition\n </Button>\n </Flex>\n );\n\n return (\n <StyledGrid\n container={{\n cols: 'repeat(2, minmax(0, 1fr))',\n justifyItems: 'stretch',\n alignItems: 'start',\n colGap: 4\n }}\n >\n {!renderInPopover && atomicConditionJSX}\n\n {renderInPopover && (\n <>\n <Button\n ref={buttonRef}\n aria-haspopup\n aria-expanded={isOpen}\n onClick={() => setIsOpen(!isOpen)}\n onKeyDown={hideOnEscape}\n >\n {`${isOpen ? 'Close' : 'Open'} Atomic Condition`}\n </Button>\n\n <Popover\n show={isOpen}\n ref={setPopoverEl}\n target={buttonRef.current}\n placement='bottom-start'\n >\n <Flex container={{ pad: 1 }}>{atomicConditionJSX}</Flex>\n </Popover>\n </>\n )}\n <Card>\n <CardContent>\n <Text variant='h4'>Output:</Text>\n <StyledCodeBlock>\n {submitCondition ? JSON.stringify(submitCondition, null, 2) : '(No condition)'}\n </StyledCodeBlock>\n\n <Text variant='h4'>Formatted Output:</Text>\n <StyledCodeBlock>\n {submitCondition\n ? formatCondition({ condition: submitCondition }, demoFields, translate)\n : '(No condition)'}\n </StyledCodeBlock>\n <Flex container={{ gap: 1, direction: 'column' }}>\n <Flex container={{ gap: 1, direction: 'column' }}>\n <Text variant='h2' status='error'>\n validRhsTypes Prop Warning\n </Text>\n <Text>\n There are LHS(Left Hand Side Field)/Comparator pairings that <u>require</u> specific\n RHS(Right Hand Side Value) types. Please be mindful of these incompatibilities when\n limiting RHS value types using this prop. We <b>do not</b> support limiting RHS\n field types to incompatible types and it will result in a validation error if you do\n so. The pairings referred to here are as follows:\n </Text>\n </Flex>\n <StyledList>\n <li>\n BOOLEAN LHS Fields coupled with \"EQ\" or \"NEQ\" comparators, will <u>always yield</u>{' '}\n a Field RHS\n </li>\n <li>\n Any LHS Fields coupled with \"IN\" or \"NOT_IN\" comparators, will <u>always yield</u> a\n Literal RHS (Comma separated list)\n </li>\n </StyledList>\n <Flex container={{ direction: 'column' }}>\n <Text>\n If you would like to limit RHS value types and avoid these incompatibilities, you\n will need to exclude these comparators using the <b>validComparators</b> prop.\n </Text>\n </Flex>\n </Flex>\n </CardContent>\n </Card>\n </StyledGrid>\n );\n};\n"]}
|
|
1
|
+
{"version":3,"file":"ConditionBuilder.stories.js","sourceRoot":"","sources":["../../../src/condition-builder/ConditionBuilder/ConditionBuilder.stories.tsx"],"names":[],"mappings":";AAAA,gDAAgD;AAChD,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAGzC,OAAO,EACL,IAAI,EACJ,WAAW,EACX,IAAI,EACJ,MAAM,EACN,OAAO,EACP,UAAU,EACV,aAAa,EACb,IAAI,EACJ,OAAO,EACR,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,gBAAgB,EAChB,cAAc,EACd,eAAe,EACf,sBAAsB,EACtB,gBAAgB,EAGhB,eAAe,EAEhB,MAAM,sCAAsC,CAAC;AAE9C,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAC7F,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AACpF,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAE3D,eAAe;IACb,KAAK,EAAE,oCAAoC;IAC3C,SAAS,EAAE,gBAAgB;CACpB,CAAC;AAcV,MAAM,CAAC,MAAM,cAAc,GAAsC,CAC/D,IAAgC,EAChC,EAAE;IACF,MAAM,SAAS,GAAG,OAAO,EAAE,CAAC;IAC5B,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,QAAQ,CAAwB,GAAG,EAAE;QACrE,wDAAwD;QACxD,MAAM,aAAa,GAAG,cAAc,CAAC,OAAO,CAAC,iBAAiB,CAAC,CAAC;QAChE,IAAI,aAAa,KAAK,IAAI,EAAE;YAC1B,0EAA0E;YAC1E,IAA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IACvB,eAAe,EAAE,KAAK;IACtB,aAAa,EAAE,IAAI;IACnB,aAAa,EAAE,QAAQ;IACvB,iBAAiB,EAAE,IAAI;IACvB,eAAe,EAAE,IAAI;IACrB,uBAAuB,EAAE,IAAI;IAC7B,cAAc,EAAE,KAAK;CACtB,CAAC;AAEF,mBAAmB,CAAC,QAAQ,GAAG;IAC7B,gBAAgB,EAAE,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE;IAClD,eAAe,EAAE,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE;IACjD,aAAa,EAAE,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE;IAC/C,aAAa,EAAE,EAAE,OAAO,EAAE,CAAC,QAAQ,EAAE,KAAK,CAAC,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE;IAC1E,iBAAiB,EAAE,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE;IACnD,eAAe,EAAE,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE;IACjD,uBAAuB,EAAE,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE;IACzD,cAAc,EAAE,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE;CACjD,CAAC","sourcesContent":["/* eslint-disable react/no-unescaped-entities */\nimport { useRef, useState } from 'react';\nimport { Meta, Story } from '@storybook/react';\n\nimport {\n Card,\n CardContent,\n Text,\n Button,\n Popover,\n useElement,\n useOuterEvent,\n Flex,\n useI18n\n} from '@pega/cosmos-react-core';\nimport {\n ConditionBuilder,\n FieldCondition,\n AtomicCondition,\n getInitConditionForLhs,\n isValidCondition,\n Condition,\n LeafCondition,\n formatCondition,\n RHSType\n} from '@pega/cosmos-react-condition-builder';\n\nimport { demoFields, demoCondition, demoComparators, demoDateFunctions } from './props.mock';\nimport { StyledCodeBlock, StyledGrid, StyledList } from './ConditionBuilder.styles';\nimport { convertRhsTypes } from './ConditionBuilder.mocks';\n\nexport default {\n title: 'Condition Builder/ConditionBuilder',\n component: ConditionBuilder\n} as Meta;\n\ninterface ConditionBuilderStoryProps {\n validComparators?: boolean;\n disallowNOT?: boolean;\n renderInPopover?: boolean;\n dateFunctions?: boolean;\n itemDirection?: 'column' | 'row';\n useLiteralRHSType?: boolean;\n useFieldRHSType?: boolean;\n useRelativeDatesRHSType?: boolean;\n showLhsAsLabel?: boolean;\n}\n\nexport const DefaultBuilder: Story<ConditionBuilderStoryProps> = (\n args: ConditionBuilderStoryProps\n) => {\n const translate = useI18n();\n const [condition, setCondition] = useState<Condition | undefined>(() => {\n // If a previous condition exists on the session, use it\n const prevCondition = sessionStorage.getItem('CBDemoCondition');\n if (prevCondition !== null) {\n // If an empty condition was submitted previously, start with an empty one\n if (prevCondition === 'undefined') {\n return undefined;\n }\n return JSON.parse(prevCondition);\n }\n return demoCondition;\n });\n\n // Set up content for rendering inside a Popover\n const buttonRef = useRef(null); // Ref for the opener button\n const [isOpen, setIsOpen] = useState(false);\n const [popoverEl, setPopoverEl] = useElement<HTMLElement>(null);\n const hidePopover = () => {\n if (isOpen) {\n setIsOpen(false);\n }\n };\n useOuterEvent('mousedown', [popoverEl, buttonRef.current], hidePopover); // Call the method on clicking outside these elements\n const hideOnEscape = (e: KeyboardEvent) => {\n if (e.key === 'Escape') hidePopover(); // Call the method when Escape key is pressed\n };\n\n const builderJsx = (\n <ConditionBuilder\n fields={demoFields}\n condition={condition}\n validComparators={args.validComparators ? demoComparators : undefined}\n validRhsTypes={new Set(['LITERAL', 'FIELD', 'DATE_FUNCTION', 'RELATIVE_DATE'])}\n dateFunctions={args.dateFunctions ? demoDateFunctions : undefined}\n disallowNOT={args.disallowNOT}\n onConditionSubmit={(c: Condition | undefined) => {\n setCondition(c);\n hidePopover();\n sessionStorage.setItem('CBDemoCondition', JSON.stringify(c)); // Persist on sessionStorage for the next time\n }}\n />\n );\n\n return (\n <StyledGrid\n container={{\n cols: '1fr',\n rowGap: 3\n }}\n >\n {!args.renderInPopover && builderJsx}\n\n {args.renderInPopover && (\n <>\n <Button\n ref={buttonRef}\n aria-haspopup\n aria-expanded={isOpen}\n onClick={() => setIsOpen(!isOpen)}\n onKeyDown={hideOnEscape}\n >\n Open Condition builder\n </Button>\n\n <Popover\n show={isOpen}\n ref={setPopoverEl}\n target={buttonRef.current}\n placement='bottom-start'\n >\n <Flex container={{ pad: 1 }}>{builderJsx}</Flex>\n </Popover>\n </>\n )}\n\n <div>\n <Text variant='h4'>Output:</Text>\n <StyledCodeBlock>\n {condition ? JSON.stringify(condition, null, 2) : '(No condition)'}\n </StyledCodeBlock>\n </div>\n\n <div>\n <Text variant='h4'>Formatted Output:</Text>\n <StyledCodeBlock>\n {condition ? formatCondition(condition, demoFields, translate) : '(No condition)'}\n </StyledCodeBlock>\n </div>\n </StyledGrid>\n );\n};\n\nDefaultBuilder.args = {\n validComparators: false,\n disallowNOT: false,\n renderInPopover: false,\n dateFunctions: true\n};\n\nDefaultBuilder.argTypes = {\n validComparators: { control: { type: 'boolean' } },\n disallowNOT: { control: { type: 'boolean' } },\n renderInPopover: { control: { type: 'boolean' } },\n dateFunctions: { control: { type: 'boolean' } }\n};\n\nexport const FieldConditionDemo: Story<ConditionBuilderStoryProps> = (\n args: ConditionBuilderStoryProps\n) => {\n const translate = useI18n();\n const [condition, setCondition] = useState<LeafCondition | undefined>(undefined);\n\n // Set up content for rendering inside a Popover\n const buttonRef = useRef(null); // Ref for the opener button\n const [isOpen, setIsOpen] = useState(false);\n const [popoverEl, setPopoverEl] = useElement<HTMLElement>(null);\n const hidePopover = () => {\n if (isOpen) {\n setIsOpen(false);\n }\n };\n useOuterEvent('mousedown', [popoverEl, buttonRef.current], hidePopover); // Call the method on clicking outside these elements\n const hideOnEscape = (e: KeyboardEvent) => {\n if (e.key === 'Escape') hidePopover(); // Call the method when Escape key is pressed\n };\n\n const builderJsx = (\n <FieldCondition\n targetField='lastActivityAt'\n fields={demoFields}\n condition={condition}\n validComparators={args.validComparators ? demoComparators : undefined}\n validRhsTypes={new Set(['LITERAL', 'FIELD', 'DATE_FUNCTION', 'RELATIVE_DATE'])}\n dateFunctions={args.dateFunctions ? demoDateFunctions : undefined}\n onSubmit={c => {\n hidePopover();\n setCondition(c);\n }}\n />\n );\n\n return (\n <StyledGrid\n container={{\n cols: 'repeat(2, minmax(0, 1fr))',\n justifyItems: 'stretch',\n alignItems: 'start',\n colGap: 4\n }}\n >\n {!args.renderInPopover && builderJsx}\n\n {args.renderInPopover && (\n <>\n <Button\n ref={buttonRef}\n aria-haspopup\n aria-expanded={isOpen}\n onClick={() => setIsOpen(!isOpen)}\n onKeyDown={hideOnEscape}\n >\n Open Condition builder\n </Button>\n\n <Popover\n show={isOpen}\n ref={setPopoverEl}\n target={buttonRef.current}\n placement='bottom-start'\n >\n <Flex container={{ pad: 1 }}>{builderJsx}</Flex>\n </Popover>\n </>\n )}\n\n <div>\n <Text variant='h4'>Output:</Text>\n <StyledCodeBlock>\n {condition ? JSON.stringify(condition, null, 2) : '(No condition)'}\n </StyledCodeBlock>\n\n <Text variant='h4'>Formatted Output:</Text>\n <StyledCodeBlock>\n {condition ? formatCondition({ condition }, demoFields, translate) : '(No condition)'}\n </StyledCodeBlock>\n </div>\n </StyledGrid>\n );\n};\n\nFieldConditionDemo.args = {\n validComparators: false,\n renderInPopover: false,\n dateFunctions: true\n};\n\nFieldConditionDemo.argTypes = {\n validComparators: { control: { type: 'boolean' } },\n renderInPopover: { control: { type: 'boolean' } },\n dateFunctions: { control: { type: 'boolean' } }\n};\n\nexport const AtomicConditionDemo: Story<ConditionBuilderStoryProps> = (\n args: ConditionBuilderStoryProps\n) => {\n const translate = useI18n();\n\n const validRHSTypes: Set<RHSType> = convertRhsTypes(\n !!args.useLiteralRHSType,\n !!args.useFieldRHSType,\n !!args.useRelativeDatesRHSType,\n args.dateFunctions ? demoDateFunctions : undefined\n );\n\n // Story State object to simulate \"submitting\"\n const [submitCondition, setSubmitCondition] = useState<LeafCondition | undefined>(undefined);\n // State needed to use Popover in Story\n const buttonRef = useRef(null); // Ref for the opener button\n const [isOpen, setIsOpen] = useState(false);\n const [popoverEl, setPopoverEl] = useElement<HTMLElement>(null);\n const hidePopover = () => {\n if (isOpen) {\n setIsOpen(false);\n }\n };\n useOuterEvent('mousedown', [popoverEl, buttonRef.current], hidePopover); // Call the method on clicking outside these elements\n const hideOnEscape = (e: KeyboardEvent) => {\n if (e.key === 'Escape') hidePopover(); // Call the method when Escape key is pressed\n };\n\n // State handling needed to manage/use the AtomicCondition component\n const [showErrorIndicators, setShowErrorIndicators] = useState(false);\n const [condition, setCondition] = useState(\n // If editing use the seedCondition, otherwise, determine an initial condition based on the targetField\n () =>\n submitCondition ||\n getInitConditionForLhs(\n { field: 'age' },\n demoFields,\n validRHSTypes,\n args.validComparators ? demoComparators : undefined,\n args.dateFunctions ? demoDateFunctions : undefined\n )\n );\n\n const handleSubmission = () => {\n setShowErrorIndicators(false);\n if (isValidCondition(condition, demoFields, true)) {\n // Insert all \"submit\" logic to use the valid condition that you've created.\n if (args.renderInPopover) setIsOpen(false);\n setSubmitCondition(condition);\n } else {\n setShowErrorIndicators(true);\n }\n };\n\n const atomicConditionJSX = (\n <Flex container={{ direction: 'column', gap: 2 }}>\n <AtomicCondition\n condition={condition}\n fields={demoFields}\n indicateErrors={showErrorIndicators}\n validComparators={args.validComparators ? demoComparators : undefined}\n dateFunctions={args.dateFunctions ? demoDateFunctions : undefined}\n onChange={c => setCondition(c)}\n itemDirection={args.itemDirection}\n showLhsAsLabel={args.showLhsAsLabel}\n validRhsTypes={validRHSTypes}\n />\n <Button variant='primary' onClick={handleSubmission}>\n Submit Condition\n </Button>\n </Flex>\n );\n\n return (\n <StyledGrid\n container={{\n cols: 'repeat(2, minmax(0, 1fr))',\n justifyItems: 'stretch',\n alignItems: 'start',\n colGap: 4\n }}\n >\n {!args.renderInPopover && atomicConditionJSX}\n\n {args.renderInPopover && (\n <>\n <Button\n ref={buttonRef}\n aria-haspopup\n aria-expanded={isOpen}\n onClick={() => setIsOpen(!isOpen)}\n onKeyDown={hideOnEscape}\n >\n {`${isOpen ? 'Close' : 'Open'} Atomic Condition`}\n </Button>\n\n <Popover\n show={isOpen}\n ref={setPopoverEl}\n target={buttonRef.current}\n placement='bottom-start'\n >\n <Flex container={{ pad: 1 }}>{atomicConditionJSX}</Flex>\n </Popover>\n </>\n )}\n <Card>\n <CardContent>\n <Text variant='h4'>Output:</Text>\n <StyledCodeBlock>\n {submitCondition ? JSON.stringify(submitCondition, null, 2) : '(No condition)'}\n </StyledCodeBlock>\n\n <Text variant='h4'>Formatted Output:</Text>\n <StyledCodeBlock>\n {submitCondition\n ? formatCondition({ condition: submitCondition }, demoFields, translate)\n : '(No condition)'}\n </StyledCodeBlock>\n <Flex container={{ gap: 1, direction: 'column' }}>\n <Flex container={{ gap: 1, direction: 'column' }}>\n <Text variant='h2' status='error'>\n validRhsTypes Prop Warning\n </Text>\n <Text>\n There are LHS(Left Hand Side Field)/Comparator pairings that <u>require</u> specific\n RHS(Right Hand Side Value) types. Please be mindful of these incompatibilities when\n limiting RHS value types using this prop. We <b>do not</b> support limiting RHS\n field types to incompatible types and it will result in a validation error if you do\n so. The pairings referred to here are as follows:\n </Text>\n </Flex>\n <StyledList>\n <li>\n BOOLEAN LHS Fields coupled with \"EQ\" or \"NEQ\" comparators, will <u>always yield</u>{' '}\n a Field RHS\n </li>\n <li>\n Any LHS Fields coupled with \"IN\" or \"NOT_IN\" comparators, will <u>always yield</u> a\n Literal RHS (Comma separated list)\n </li>\n </StyledList>\n <Flex container={{ direction: 'column' }}>\n <Text>\n If you would like to limit RHS value types and avoid these incompatibilities, you\n will need to exclude these comparators using the <b>validComparators</b> prop.\n </Text>\n </Flex>\n </Flex>\n </CardContent>\n </Card>\n </StyledGrid>\n );\n};\n\nAtomicConditionDemo.args = {\n validComparators: false,\n renderInPopover: false,\n dateFunctions: true,\n itemDirection: 'column',\n useLiteralRHSType: true,\n useFieldRHSType: true,\n useRelativeDatesRHSType: true,\n showLhsAsLabel: false\n};\n\nAtomicConditionDemo.argTypes = {\n validComparators: { control: { type: 'boolean' } },\n renderInPopover: { control: { type: 'boolean' } },\n dateFunctions: { control: { type: 'boolean' } },\n itemDirection: { options: ['column', 'row'], control: { type: 'select' } },\n useLiteralRHSType: { control: { type: 'boolean' } },\n useFieldRHSType: { control: { type: 'boolean' } },\n useRelativeDatesRHSType: { control: { type: 'boolean' } },\n showLhsAsLabel: { control: { type: 'boolean' } }\n};\n"]}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare const StyledGrid: import("styled-components").StyledComponent<import("react").FunctionComponent<import("@pega/cosmos-react-core").GridProps & import("@pega/cosmos-react-core").ForwardProps>, import("styled-components").DefaultTheme, {}, never>;
|
|
3
|
+
export declare const StyledCodeBlock: import("styled-components").StyledComponent<"pre", import("styled-components").DefaultTheme, {}, never>;
|
|
4
|
+
export declare const StyledList: import("styled-components").StyledComponent<"ul", import("styled-components").DefaultTheme, {}, never>;
|
|
5
|
+
//# sourceMappingURL=ConditionBuilder.styles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ConditionBuilder.styles.d.ts","sourceRoot":"","sources":["../../../src/condition-builder/ConditionBuilder/ConditionBuilder.styles.ts"],"names":[],"mappings":";AAIA,eAAO,MAAM,UAAU,mOAEtB,CAAC;AAEF,eAAO,MAAM,eAAe,yGAG3B,CAAC;AAGF,eAAO,MAAM,UAAU,wGAEtB,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import styled from 'styled-components';
|
|
2
|
+
import { Grid, defaultThemeProp } from '@pega/cosmos-react-core';
|
|
3
|
+
export const StyledGrid = styled(Grid) `
|
|
4
|
+
max-width: 60rem;
|
|
5
|
+
`;
|
|
6
|
+
export const StyledCodeBlock = styled.pre `
|
|
7
|
+
padding: ${props => props.theme.base.spacing};
|
|
8
|
+
margin-bottom: ${props => props.theme.base.spacing};
|
|
9
|
+
`;
|
|
10
|
+
StyledCodeBlock.defaultProps = defaultThemeProp;
|
|
11
|
+
export const StyledList = styled.ul `
|
|
12
|
+
padding-left: calc(4 * ${props => props.theme.base.spacing});
|
|
13
|
+
`;
|
|
14
|
+
StyledList.defaultProps = defaultThemeProp;
|
|
15
|
+
//# sourceMappingURL=ConditionBuilder.styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ConditionBuilder.styles.js","sourceRoot":"","sources":["../../../src/condition-builder/ConditionBuilder/ConditionBuilder.styles.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,mBAAmB,CAAC;AAEvC,OAAO,EAAE,IAAI,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAEjE,MAAM,CAAC,MAAM,UAAU,GAAG,MAAM,CAAC,IAAI,CAAC,CAAA;;CAErC,CAAC;AAEF,MAAM,CAAC,MAAM,eAAe,GAAG,MAAM,CAAC,GAAG,CAAA;aAC5B,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO;mBAC3B,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO;CACnD,CAAC;AACF,eAAe,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAEhD,MAAM,CAAC,MAAM,UAAU,GAAG,MAAM,CAAC,EAAE,CAAA;2BACR,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO;CAC3D,CAAC;AACF,UAAU,CAAC,YAAY,GAAG,gBAAgB,CAAC","sourcesContent":["import styled from 'styled-components';\n\nimport { Grid, defaultThemeProp } from '@pega/cosmos-react-core';\n\nexport const StyledGrid = styled(Grid)`\n max-width: 60rem;\n`;\n\nexport const StyledCodeBlock = styled.pre`\n padding: ${props => props.theme.base.spacing};\n margin-bottom: ${props => props.theme.base.spacing};\n`;\nStyledCodeBlock.defaultProps = defaultThemeProp;\n\nexport const StyledList = styled.ul`\n padding-left: calc(4 * ${props => props.theme.base.spacing});\n`;\nStyledList.defaultProps = defaultThemeProp;\n"]}
|
|
@@ -27,8 +27,8 @@ ButtonVariants.argTypes = {
|
|
|
27
27
|
export const DisabledButtons = () => {
|
|
28
28
|
return (_jsxs(_Fragment, { children: [_jsx(Button, { variant: 'primary', disabled: true, children: "Primary disabled" }, void 0), _jsx(Button, { variant: 'secondary', disabled: true, children: "Secondary disabled" }, void 0), _jsx(Button, { variant: 'simple', disabled: true, children: "Simple disabled" }, void 0), _jsx(Button, { variant: 'link', disabled: true, children: "Link disabled" }, void 0), _jsx(Button, { variant: 'text', disabled: true, children: "Text disabled" }, void 0)] }, void 0));
|
|
29
29
|
};
|
|
30
|
-
export const IconButtons = (
|
|
31
|
-
return (_jsxs(Flex, { container: { alignItems: 'center' }, children: [_jsx(Button, { variant: 'primary', label: 'Icon button primary', icon: true, compact: compact, children: _jsx(Icon, { name: 'plus' }, void 0) }, void 0), _jsx(Button, { variant: 'secondary', label: 'Icon button secondary', icon: true, compact: compact, children: _jsx(Icon, { name: 'plus' }, void 0) }, void 0), _jsx(Button, { variant: 'simple', label: 'Icon button simple', icon: true, compact: compact, children: _jsx(Icon, { name: 'plus' }, void 0) }, void 0), _jsx(Button, { variant: 'link', label: 'Icon button link', icon: true, compact: compact, children: _jsx(Icon, { name: 'plus' }, void 0) }, void 0), _jsx(Button, { variant: 'text', label: 'Icon button text', icon: true, compact: compact, children: _jsx(Icon, { name: 'plus' }, void 0) }, void 0)] }, void 0));
|
|
30
|
+
export const IconButtons = (args) => {
|
|
31
|
+
return (_jsxs(Flex, { container: { alignItems: 'center' }, children: [_jsx(Button, { variant: 'primary', label: 'Icon button primary', icon: true, compact: args.compact, children: _jsx(Icon, { name: 'plus' }, void 0) }, void 0), _jsx(Button, { variant: 'secondary', label: 'Icon button secondary', icon: true, compact: args.compact, children: _jsx(Icon, { name: 'plus' }, void 0) }, void 0), _jsx(Button, { variant: 'simple', label: 'Icon button simple', icon: true, compact: args.compact, children: _jsx(Icon, { name: 'plus' }, void 0) }, void 0), _jsx(Button, { variant: 'link', label: 'Icon button link', icon: true, compact: args.compact, children: _jsx(Icon, { name: 'plus' }, void 0) }, void 0), _jsx(Button, { variant: 'text', label: 'Icon button text', icon: true, compact: args.compact, children: _jsx(Icon, { name: 'plus' }, void 0) }, void 0)] }, void 0));
|
|
32
32
|
};
|
|
33
33
|
IconButtons.args = {
|
|
34
34
|
compact: false
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.stories.js","sourceRoot":"","sources":["../../../src/core/Button/Button.stories.tsx"],"names":[],"mappings":";AAEA,OAAO,EACL,MAAM,EAEN,aAAa,EACb,IAAI,EACJ,IAAI,EACJ,YAAY,EACb,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,QAAQ,MAAM,6DAA6D,CAAC;AACxF,OAAO,UAAU,MAAM,0DAA0D,CAAC;AAElF,YAAY,CAAC,QAAQ,CAAC,CAAC;AAEvB,eAAe;IACb,KAAK,EAAE,aAAa;IACpB,SAAS,EAAE,MAAM;IACjB,UAAU,EAAE;QACV,MAAM,EAAE,UAAU;KACnB;CACM,CAAC;AAEV,MAAM,CAAC,MAAM,cAAc,GAAuB,CAAC,IAAiB,EAAE,EAAE;IACtE,OAAO,CACL,KAAC,MAAM,IAAC,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,iCAE3C,CACV,CAAC;AACJ,CAAC,CAAC;AAEF,cAAc,CAAC,IAAI,GAAG;IACpB,OAAO,EAAE,SAAS;IAClB,OAAO,EAAE,KAAK;CACf,CAAC;AAEF,cAAc,CAAC,QAAQ,GAAG;IACxB,OAAO,EAAE;QACP,OAAO,EAAE,CAAC,SAAS,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,EAAE,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YAED,KAAC,MAAM,8CAA6B,WACtB,CACjB,CAAC;AACJ,CAAC,CAAC;AAEF,kBAAkB,CAAC,IAAI,GAAG;IACxB,WAAW,EAAE,WAAW;IACxB,YAAY,EAAE,IAAI;IAClB,KAAK,EAAE,SAAS;IAChB,cAAc,EAAE,SAAS;IACzB,OAAO,EAAE,WAAW;CACrB,CAAC;AAEF,kBAAkB,CAAC,QAAQ,GAAG;IAC5B,WAAW,EAAE,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE;IAC1C,YAAY,EAAE,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE;IAC7C,KAAK,EAAE,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE;IACrC,cAAc,EAAE,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE;IAC9C,OAAO,EAAE,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE;CACvC,CAAC","sourcesContent":["import { Meta, Story } from '@storybook/react';\n\nimport {\n Button,\n ButtonProps,\n Configuration,\n Flex,\n Icon,\n registerIcon\n} from '@pega/cosmos-react-core';\nimport * as plusIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/plus.icon';\nimport BareButton from '@pega/cosmos-react-core/lib/components/Button/BareButton';\n\nregisterIcon(plusIcon);\n\nexport default {\n title: 'Core/Button',\n component: Button,\n parameters: {\n layout: 'centered'\n }\n} as Meta;\n\nexport const ButtonVariants: Story<ButtonProps> = (args: ButtonProps) => {\n return (\n <Button variant={args.variant} compact={args.compact}>\n Click me\n </Button>\n );\n};\n\nButtonVariants.args = {\n variant: 'primary',\n compact: false\n};\n\nButtonVariants.argTypes = {\n variant: {\n options: ['primary', 'secondary', 'simple', 'link', 'text'],\n control: { type: 'select' }\n },\n compact: { control: { type: 'boolean' } }\n};\n\nexport const DisabledButtons = () => {\n return (\n <>\n <Button variant='primary' disabled>\n Primary disabled\n </Button>\n <Button variant='secondary' disabled>\n Secondary disabled\n </Button>\n <Button variant='simple' disabled>\n Simple disabled\n </Button>\n <Button variant='link' disabled>\n Link disabled\n </Button>\n <Button variant='text' disabled>\n Text disabled\n </Button>\n </>\n );\n};\n\nexport const IconButtons: Story<ButtonProps> = (args: ButtonProps) => {\n return (\n <Flex container={{ alignItems: 'center' }}>\n <Button variant='primary' label='Icon button primary' icon compact={args.compact}>\n <Icon name='plus' />\n </Button>\n <Button variant='secondary' label='Icon button secondary' icon compact={args.compact}>\n <Icon name='plus' />\n </Button>\n <Button variant='simple' label='Icon button simple' icon compact={args.compact}>\n <Icon name='plus' />\n </Button>\n <Button variant='link' label='Icon button link' icon compact={args.compact}>\n <Icon name='plus' />\n </Button>\n <Button variant='text' label='Icon button text' icon compact={args.compact}>\n <Icon name='plus' />\n </Button>\n </Flex>\n );\n};\n\nIconButtons.args = {\n compact: false\n};\n\nIconButtons.argTypes = {\n compact: { control: { type: 'boolean' } }\n};\n\nexport const LoadingButtons: Story<ButtonProps> = (args: ButtonProps) => {\n return (\n <Button variant={args.variant} icon={args.icon} label='Loading' loading>\n {args.icon ? <Icon name='plus' /> : 'Loading'}\n </Button>\n );\n};\n\nLoadingButtons.args = {\n variant: 'primary',\n icon: false\n};\n\nLoadingButtons.argTypes = {\n variant: { options: ['primary', 'secondary'], control: { type: 'select' } },\n icon: { control: { type: 'boolean' } }\n};\n\nexport const ButtonAsLink = () => {\n return (\n <Button variant='primary' href='https://www.pega.com' target='_blank'>\n Go to pega.com\n </Button>\n );\n};\n\nexport const BareButtonDemo: Story<ButtonProps> = (args: ButtonProps) => {\n return (\n <BareButton disabled={args.disabled} href={args.href || undefined}>\n Click me\n </BareButton>\n );\n};\n\nBareButtonDemo.args = {\n disabled: false,\n href: ''\n};\n\nBareButtonDemo.argTypes = {\n disabled: { control: { type: 'boolean' } },\n href: { control: { type: 'text' } }\n};\n\ninterface ConfigurableButtonProps {\n borderWidth?: string;\n borderRadius?: number;\n color?: string;\n secondaryColor?: string;\n padding?: string;\n}\n\nexport const ConfigurableButton: Story<ConfigurableButtonProps> = (\n args: ConfigurableButtonProps\n) => {\n return (\n <Configuration\n theme={{\n components: {\n button: {\n 'border-width': args.borderWidth,\n 'border-radius': args.borderRadius,\n color: args.color,\n 'secondary-color': args.secondaryColor,\n padding: args.padding\n }\n }\n }}\n >\n <Button>Configurable Button</Button>\n </Configuration>\n );\n};\n\nConfigurableButton.args = {\n borderWidth: '0.0625rem',\n borderRadius: 9999,\n color: '#076bc9',\n secondaryColor: '#ffffff',\n padding: '0rem 1rem'\n};\n\nConfigurableButton.argTypes = {\n borderWidth: { control: { type: 'text' } },\n borderRadius: { control: { type: 'number' } },\n color: { control: { type: 'color' } },\n secondaryColor: { control: { type: 'color' } },\n padding: { control: { type: 'text' } }\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ColorPicker.stories.d.ts","sourceRoot":"","sources":["../../../src/core/ColorPicker/ColorPicker.stories.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"ColorPicker.stories.d.ts","sourceRoot":"","sources":["../../../src/core/ColorPicker/ColorPicker.stories.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAG/C,OAAO,EAAe,gBAAgB,EAA8B,MAAM,yBAAyB,CAAC;;AAIpG,wBAGU;AAEV,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,gBAAgB,CAoBnD,CAAC;AA0BF,eAAO,MAAM,UAAU,mBA2EtB,CAAC"}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useMemo, useState } from 'react';
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import { ColorPicker, Flex, Grid, Text, tryCatch, useTheme } from '@pega/cosmos-react-core';
|
|
3
|
+
import { ColorPicker, Flex, Grid, Text, useTheme } from '@pega/cosmos-react-core';
|
|
4
|
+
import { StyledColorPane } from './ColorPicker.styles';
|
|
6
5
|
export default {
|
|
7
6
|
title: 'Core/ColorPicker',
|
|
8
7
|
component: ColorPicker
|
|
@@ -36,13 +35,6 @@ ColorPickerDemo.argTypes = {
|
|
|
36
35
|
readOnly: { control: { type: 'boolean' } }
|
|
37
36
|
};
|
|
38
37
|
export const MultiColor = () => {
|
|
39
|
-
const StyledColorPane = styled.div(({ color }) => {
|
|
40
|
-
const c = tryCatch(() => readableColor(color));
|
|
41
|
-
return css `
|
|
42
|
-
color: ${c};
|
|
43
|
-
background: ${color};
|
|
44
|
-
`;
|
|
45
|
-
});
|
|
46
38
|
const { base: { palette } } = useTheme();
|
|
47
39
|
const opaqueColors = useMemo(() => Object.entries(palette).filter(([, color]) => {
|
|
48
40
|
return /^#[0-9A-F]{6}$/i.test(color);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ColorPicker.stories.js","sourceRoot":"","sources":["../../../src/core/ColorPicker/ColorPicker.stories.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"ColorPicker.stories.js","sourceRoot":"","sources":["../../../src/core/ColorPicker/ColorPicker.stories.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE1C,OAAO,EAAE,WAAW,EAAoB,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAEpG,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAEvD,eAAe;IACb,KAAK,EAAE,kBAAkB;IACzB,SAAS,EAAE,WAAW;CACf,CAAC;AAEV,MAAM,CAAC,MAAM,eAAe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C,CAAC,WACG,YACF,CACR,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import { Meta, Story } from '@storybook/react';\nimport { useMemo, useState } from 'react';\n\nimport { ColorPicker, ColorPickerProps, Flex, Grid, Text, useTheme } from '@pega/cosmos-react-core';\n\nimport { StyledColorPane } from './ColorPicker.styles';\n\nexport default {\n title: 'Core/ColorPicker',\n component: ColorPicker\n} as Meta;\n\nexport const ColorPickerDemo: Story<ColorPickerProps> = (args: ColorPickerProps) => {\n const [value, setValue] = useState('#10a5ac');\n\n return (\n <ColorPicker\n label={args.label}\n labelHidden={args.labelHidden}\n info={args.info}\n status={args.status}\n swatchOnly={args.swatchOnly}\n inline={args.inline}\n required={args.required}\n disabled={args.disabled}\n readOnly={args.readOnly}\n value={value}\n onChange={e => {\n setValue(e.hex);\n }}\n />\n );\n};\n\nColorPickerDemo.args = {\n label: 'ColorPicker label',\n labelHidden: false,\n info: 'Pick a color',\n status: undefined,\n swatchOnly: false,\n inline: false,\n required: false,\n disabled: false,\n readOnly: false\n};\n\nColorPickerDemo.argTypes = {\n label: { control: { type: 'text' } },\n labelHidden: { control: { type: 'boolean' } },\n info: { control: { type: 'text' } },\n status: { options: [undefined, 'success', 'warning', 'error'], control: { type: 'select' } },\n swatchOnly: { control: { type: 'boolean' } },\n inline: { control: { type: 'boolean' } },\n required: { control: { type: 'boolean' } },\n disabled: { control: { type: 'boolean' } },\n readOnly: { control: { type: 'boolean' } }\n};\n\nexport const MultiColor = () => {\n const {\n base: { palette }\n } = useTheme();\n\n const opaqueColors = useMemo(\n () =>\n Object.entries(palette).filter(([, color]) => {\n return /^#[0-9A-F]{6}$/i.test(color);\n }),\n [palette]\n );\n\n const [values, setValues] = useState(() => opaqueColors.map(([, color]) => color));\n\n return (\n <Grid container={{ rows: '1fr 2fr' }} style={{ height: '100vh' }}>\n <Grid\n container={{\n cols: '1fr 1fr 1fr 1fr',\n alignItems: 'center',\n colGap: 4,\n rowGap: 1\n }}\n style={{ padding: '1rem' }}\n >\n <>\n {values.map((color, i) => {\n const key = `color-${i}`;\n return (\n <div key={key}>\n <ColorPicker\n inline\n label={opaqueColors[i][0]}\n value={color}\n onChange={e => {\n const newColor = e.hex;\n setValues(cur => {\n return cur.map((c, j) => {\n if (i === j) return newColor;\n return c;\n });\n });\n }}\n />\n </div>\n );\n })}\n </>\n </Grid>\n\n <Grid\n container={{\n cols: '1fr 1fr 1fr 1fr',\n gap: 0.125\n }}\n >\n {values.map((color, i) => {\n const key = `color-${i}`;\n return (\n <Flex\n container={{ justify: 'center', alignItems: 'center' }}\n as={StyledColorPane}\n color={color}\n key={key}\n >\n <Text variant='h1' as='span'>\n {color}\n </Text>\n </Flex>\n );\n })}\n </Grid>\n </Grid>\n );\n};\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ColorPicker.styles.d.ts","sourceRoot":"","sources":["../../../src/core/ColorPicker/ColorPicker.styles.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,eAAe;WAAuB,MAAM;SAMvD,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import styled, { css } from 'styled-components';
|
|
2
|
+
import { readableColor } from 'polished';
|
|
3
|
+
import { tryCatch } from '@pega/cosmos-react-core';
|
|
4
|
+
export const StyledColorPane = styled.div(({ color }) => {
|
|
5
|
+
const c = tryCatch(() => readableColor(color));
|
|
6
|
+
return css `
|
|
7
|
+
color: ${c};
|
|
8
|
+
background: ${color};
|
|
9
|
+
`;
|
|
10
|
+
});
|
|
11
|
+
//# sourceMappingURL=ColorPicker.styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ColorPicker.styles.js","sourceRoot":"","sources":["../../../src/core/ColorPicker/ColorPicker.styles.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAEnD,MAAM,CAAC,MAAM,eAAe,GAAG,MAAM,CAAC,GAAG,CAAoB,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE;IACzE,MAAM,CAAC,GAAG,QAAQ,CAAC,GAAG,EAAE,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC,CAAC;IAC/C,OAAO,GAAG,CAAA;aACC,CAAC;kBACI,KAAK;GACpB,CAAC;AACJ,CAAC,CAAC,CAAC","sourcesContent":["import styled, { css } from 'styled-components';\nimport { readableColor } from 'polished';\n\nimport { tryCatch } from '@pega/cosmos-react-core';\n\nexport const StyledColorPane = styled.div<{ color: string }>(({ color }) => {\n const c = tryCatch(() => readableColor(color));\n return css`\n color: ${c};\n background: ${color};\n `;\n});\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Configuration.mocks.d.ts","sourceRoot":"","sources":["../../../src/core/Configuration/Configuration.mocks.tsx"],"names":[],"mappings":";AAEA,eAAO,MAAM,QAAQ;cAKT,OAAO;WACV,MAAM;YACL,MAAM;iBAWf,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { BoldSpan } from './Configuration.styles';
|
|
3
|
+
export const FlipFlop = ({ flipFlop, first, second }) => {
|
|
4
|
+
return flipFlop ? (_jsxs(_Fragment, { children: [_jsx(BoldSpan, { children: first }, void 0), "\u00A0\u2192 ", second] }, void 0)) : (_jsxs(_Fragment, { children: [first, " \u2190\u00A0", _jsx(BoldSpan, { children: second }, void 0)] }, void 0));
|
|
5
|
+
};
|
|
6
|
+
//# sourceMappingURL=Configuration.mocks.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Configuration.mocks.js","sourceRoot":"","sources":["../../../src/core/Configuration/Configuration.mocks.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAElD,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,EACvB,QAAQ,EACR,KAAK,EACL,MAAM,EAKP,EAAE,EAAE;IACH,OAAO,QAAQ,CAAC,CAAC,CAAC,CAChB,8BACE,KAAC,QAAQ,cAAE,KAAK,WAAY,mBAAS,MAAM,YAC1C,CACJ,CAAC,CAAC,CAAC,CACF,8BACG,KAAK,mBAAS,KAAC,QAAQ,cAAE,MAAM,WAAY,YAC3C,CACJ,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import { BoldSpan } from './Configuration.styles';\n\nexport const FlipFlop = ({\n flipFlop,\n first,\n second\n}: {\n flipFlop: boolean;\n first: string;\n second: string;\n}) => {\n return flipFlop ? (\n <>\n <BoldSpan>{first}</BoldSpan> → {second}\n </>\n ) : (\n <>\n {first} ← <BoldSpan>{second}</BoldSpan>\n </>\n );\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Configuration.stories.d.ts","sourceRoot":"","sources":["../../../src/core/Configuration/Configuration.stories.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;;
|
|
1
|
+
{"version":3,"file":"Configuration.stories.d.ts","sourceRoot":"","sources":["../../../src/core/Configuration/Configuration.stories.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;;AAsB/C,wBAIU;AAEV,eAAO,MAAM,UAAU,EAAE,KAAK,CAAC;IAAE,KAAK,EAAE,SAAS,GAAG,QAAQ,CAAA;CAAE,CA+B7D,CAAC;AAUF,eAAO,MAAM,gBAAgB,mBAyE5B,CAAC;AAEF,eAAO,MAAM,qBAAqB,mBAWjC,CAAC;AAEF,UAAU,0BAA0B;IAClC,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,eAAO,MAAM,qBAAqB,EAAE,KAAK,CAAC,0BAA0B,CAsBnE,CAAC;AAUF,UAAU,+BAA+B;IACvC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,sBAAsB,CAAC,EAAE,MAAM,CAAC;CACjC;AAED,eAAO,MAAM,0BAA0B,EAAE,KAAK,CAAC,+BAA+B,CA2B7E,CAAC;AAYF,UAAU,uBAAuB;IAC/B,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,eAAO,MAAM,kBAAkB,EAAE,KAAK,CAAC,uBAAuB,CAU7D,CAAC;AAUF,UAAU,6BAA6B;IACrC,sBAAsB,CAAC,EAAE,MAAM,CAAC;CACjC;AAED,eAAO,MAAM,wBAAwB,EAAE,KAAK,CAAC,6BAA6B,CAsBzE,CAAC"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { jsx as _jsx,
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { useState } from 'react';
|
|
3
|
-
import styled from 'styled-components';
|
|
4
3
|
import { Button, Configuration, MenuButton, resetToInitial, Flex, Checkbox, RadioButton, DateInput, SearchInput, Text } from '@pega/cosmos-react-core';
|
|
5
4
|
import { FormContent } from '../Form/Form.mocks';
|
|
5
|
+
import { buttonStyles, StyledFieldset } from './Configuration.styles';
|
|
6
|
+
import { FlipFlop } from './Configuration.mocks';
|
|
6
7
|
export default {
|
|
7
8
|
title: 'Core/Configuration',
|
|
8
9
|
component: Configuration,
|
|
@@ -39,19 +40,6 @@ ThemedForm.args = {
|
|
|
39
40
|
ThemedForm.argTypes = {
|
|
40
41
|
theme: { options: ['default', 'theme1'], control: { type: 'select' } }
|
|
41
42
|
};
|
|
42
|
-
const buttonStyles = {
|
|
43
|
-
width: '100%'
|
|
44
|
-
};
|
|
45
|
-
const StyledFieldset = styled.fieldset `
|
|
46
|
-
padding: 1rem 5%;
|
|
47
|
-
margin: 1rem 0;
|
|
48
|
-
`;
|
|
49
|
-
const BoldSpan = styled.span `
|
|
50
|
-
font-weight: bold;
|
|
51
|
-
`;
|
|
52
|
-
const FlipFlop = ({ flipFlop, first, second }) => {
|
|
53
|
-
return flipFlop ? (_jsxs(_Fragment, { children: [_jsx(BoldSpan, { children: first }, void 0), "\u00A0\u2192 ", second] }, void 0)) : (_jsxs(_Fragment, { children: [first, " \u2190\u00A0", _jsx(BoldSpan, { children: second }, void 0)] }, void 0));
|
|
54
|
-
};
|
|
55
43
|
export const ThemingHierarchy = () => {
|
|
56
44
|
const [redOrOrange, setRedOrOrange] = useState(true);
|
|
57
45
|
const [greenOrPurple, setGreenOrPurple] = useState(true);
|