@pega/cosmos-react-demos 2.1.0 → 2.1.4
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.stories.d.ts.map +1 -1
- package/jsx/build/AppShell/AppShell.stories.jsx +4 -4
- package/jsx/build/AppShell/AppShell.stories.jsx.map +1 -1
- package/jsx/core/Avatar/Avatar.stories.d.ts.map +1 -1
- package/jsx/core/Avatar/Avatar.stories.jsx +2 -2
- package/jsx/core/Avatar/Avatar.stories.jsx.map +1 -1
- package/jsx/core/Banner/Banner.mocks.d.ts +18 -0
- package/jsx/core/Banner/Banner.mocks.d.ts.map +1 -0
- package/jsx/core/Banner/Banner.mocks.jsx +41 -0
- package/jsx/core/Banner/Banner.mocks.jsx.map +1 -0
- package/jsx/core/Banner/Banner.stories.d.ts.map +1 -1
- package/jsx/core/Banner/Banner.stories.jsx +1 -39
- package/jsx/core/Banner/Banner.stories.jsx.map +1 -1
- package/jsx/core/Button/Button.stories.d.ts.map +1 -1
- package/jsx/core/Button/Button.stories.jsx +3 -3
- package/jsx/core/Button/Button.stories.jsx.map +1 -1
- package/jsx/core/Configuration/Configuration.stories.jsx +1 -1
- package/jsx/core/Configuration/Configuration.stories.jsx.map +1 -1
- package/jsx/core/DateTime/DateTimeDisplay.stories.jsx +1 -0
- package/jsx/core/DateTime/DateTimeDisplay.stories.jsx.map +1 -1
- package/jsx/core/ExpandCollapse/ExpandCollapse.styles.d.ts.map +1 -1
- package/jsx/core/ExpandCollapse/ExpandCollapse.styles.js +5 -0
- package/jsx/core/ExpandCollapse/ExpandCollapse.styles.js.map +1 -1
- package/jsx/core/FieldGroup/FieldGroupList.mocks.d.ts +21 -0
- package/jsx/core/FieldGroup/FieldGroupList.mocks.d.ts.map +1 -0
- package/jsx/core/FieldGroup/FieldGroupList.mocks.jsx +36 -0
- package/jsx/core/FieldGroup/FieldGroupList.mocks.jsx.map +1 -0
- package/jsx/core/FieldGroup/FieldGroupList.stories.d.ts.map +1 -1
- package/jsx/core/FieldGroup/FieldGroupList.stories.jsx +1 -34
- package/jsx/core/FieldGroup/FieldGroupList.stories.jsx.map +1 -1
- package/jsx/core/File/FileDisplay.stories.d.ts +8 -1
- package/jsx/core/File/FileDisplay.stories.d.ts.map +1 -1
- package/jsx/core/File/FileDisplay.stories.jsx +37 -2
- package/jsx/core/File/FileDisplay.stories.jsx.map +1 -1
- package/jsx/core/Flex/Flex.styles.d.ts +2 -2
- package/jsx/core/Flex/Flex.styles.d.ts.map +1 -1
- package/jsx/core/Flex/Flex.styles.js +17 -17
- package/jsx/core/Flex/Flex.styles.js.map +1 -1
- package/jsx/core/Flex/FlexContainer.stories.d.ts +2 -0
- package/jsx/core/Flex/FlexContainer.stories.d.ts.map +1 -1
- package/jsx/core/Flex/FlexContainer.stories.jsx +45 -32
- package/jsx/core/Flex/FlexContainer.stories.jsx.map +1 -1
- package/jsx/core/Flex/FlexItem.stories.jsx +13 -13
- package/jsx/core/Flex/FlexItem.stories.jsx.map +1 -1
- package/jsx/core/Form/Form.mocks.d.ts +8 -0
- package/jsx/core/Form/Form.mocks.d.ts.map +1 -0
- package/jsx/core/Form/Form.mocks.jsx +138 -0
- package/jsx/core/Form/Form.mocks.jsx.map +1 -0
- package/jsx/core/Form/Form.stories.d.ts +0 -7
- package/jsx/core/Form/Form.stories.d.ts.map +1 -1
- package/jsx/core/Form/Form.stories.jsx +3 -137
- package/jsx/core/Form/Form.stories.jsx.map +1 -1
- package/jsx/core/Grid/Grid.styles.d.ts +2 -2
- package/jsx/core/Grid/Grid.styles.d.ts.map +1 -1
- package/jsx/core/Grid/Grid.styles.js +4 -4
- package/jsx/core/Grid/Grid.styles.js.map +1 -1
- package/jsx/core/Grid/GridContainer.stories.d.ts +6 -5
- package/jsx/core/Grid/GridContainer.stories.d.ts.map +1 -1
- package/jsx/core/Grid/GridContainer.stories.jsx +51 -44
- package/jsx/core/Grid/GridContainer.stories.jsx.map +1 -1
- package/jsx/core/Grid/GridItem.stories.d.ts +2 -2
- package/jsx/core/Grid/GridItem.stories.d.ts.map +1 -1
- package/jsx/core/Grid/GridItem.stories.jsx +28 -28
- package/jsx/core/Grid/GridItem.stories.jsx.map +1 -1
- package/jsx/core/Icon/Icon.mocks.d.ts +3 -0
- package/jsx/core/Icon/Icon.mocks.d.ts.map +1 -0
- package/jsx/core/Icon/Icon.mocks.jsx +9 -0
- package/jsx/core/Icon/Icon.mocks.jsx.map +1 -0
- package/jsx/core/Icon/Icon.stories.d.ts +1 -0
- package/jsx/core/Icon/Icon.stories.d.ts.map +1 -1
- package/jsx/core/Icon/Icon.stories.jsx +7 -1
- package/jsx/core/Icon/Icon.stories.jsx.map +1 -1
- package/jsx/core/IconPicker/IconPicker.stories.d.ts.map +1 -1
- package/jsx/core/IconPicker/IconPicker.stories.jsx +0 -1
- package/jsx/core/IconPicker/IconPicker.stories.jsx.map +1 -1
- package/jsx/core/Lightbox/Lightbox.mocks.d.ts +15 -0
- package/jsx/core/Lightbox/Lightbox.mocks.d.ts.map +1 -0
- package/jsx/core/Lightbox/Lightbox.mocks.js +59 -0
- package/jsx/core/Lightbox/Lightbox.mocks.js.map +1 -0
- package/jsx/core/Lightbox/Lightbox.stories.d.ts +7 -6
- package/jsx/core/Lightbox/Lightbox.stories.d.ts.map +1 -1
- package/jsx/core/Lightbox/Lightbox.stories.jsx +14 -65
- package/jsx/core/Lightbox/Lightbox.stories.jsx.map +1 -1
- package/jsx/core/Link/Link.stories.d.ts +11 -1
- package/jsx/core/Link/Link.stories.d.ts.map +1 -1
- package/jsx/core/Link/Link.stories.jsx +22 -5
- package/jsx/core/Link/Link.stories.jsx.map +1 -1
- package/jsx/core/List/CommaSeparatedList.stories.d.ts.map +1 -1
- package/jsx/core/List/CommaSeparatedList.stories.jsx +17 -19
- package/jsx/core/List/CommaSeparatedList.stories.jsx.map +1 -1
- package/jsx/core/List/OrderedList.stories.d.ts.map +1 -1
- package/jsx/core/List/OrderedList.stories.jsx +10 -10
- package/jsx/core/List/OrderedList.stories.jsx.map +1 -1
- package/jsx/core/List/UnorderedList.stories.d.ts.map +1 -1
- package/jsx/core/List/UnorderedList.stories.jsx +10 -10
- package/jsx/core/List/UnorderedList.stories.jsx.map +1 -1
- package/jsx/core/Menu/Menu.stories.d.ts +3 -3
- package/jsx/core/Menu/Menu.stories.d.ts.map +1 -1
- package/jsx/core/Menu/Menu.stories.jsx +8 -12
- package/jsx/core/Menu/Menu.stories.jsx.map +1 -1
- package/jsx/core/Modal/Modal.mocks.jsx +1 -1
- package/jsx/core/Modal/Modal.mocks.jsx.map +1 -1
- package/jsx/core/Number/Number.stories.jsx +1 -1
- package/jsx/core/Number/Number.stories.jsx.map +1 -1
- package/jsx/core/PageTemplates/PageTemplates.stories.d.ts +5 -2
- package/jsx/core/PageTemplates/PageTemplates.stories.d.ts.map +1 -1
- package/jsx/core/PageTemplates/PageTemplates.stories.jsx +3 -3
- package/jsx/core/PageTemplates/PageTemplates.stories.jsx.map +1 -1
- package/jsx/core/Paragraph/ParagraphDisplay.stories.jsx +3 -0
- package/jsx/core/Paragraph/ParagraphDisplay.stories.jsx.map +1 -1
- package/jsx/core/Popover/Popover.stories.d.ts +1 -2
- package/jsx/core/Popover/Popover.stories.d.ts.map +1 -1
- package/jsx/core/Popover/Popover.stories.jsx +35 -37
- package/jsx/core/Popover/Popover.stories.jsx.map +1 -1
- package/jsx/core/Rating/Rating.stories.d.ts +4 -1
- package/jsx/core/Rating/Rating.stories.d.ts.map +1 -1
- package/jsx/core/Rating/Rating.stories.jsx +3 -3
- package/jsx/core/Rating/Rating.stories.jsx.map +1 -1
- package/jsx/core/Sentiment/Sentiment.stories.d.ts.map +1 -1
- package/jsx/core/Sentiment/Sentiment.stories.jsx +6 -6
- package/jsx/core/Sentiment/Sentiment.stories.jsx.map +1 -1
- package/jsx/core/SummaryList/SummaryList.stories.jsx +1 -1
- package/jsx/core/SummaryList/SummaryList.stories.jsx.map +1 -1
- package/jsx/core/Toaster/Toaster.stories.d.ts.map +1 -1
- package/jsx/core/Toaster/Toaster.stories.jsx +8 -3
- package/jsx/core/Toaster/Toaster.stories.jsx.map +1 -1
- package/jsx/rte/Editor/Editor.stories.d.ts +3 -3
- package/jsx/rte/Editor/Editor.stories.d.ts.map +1 -1
- package/jsx/rte/Editor/Editor.stories.jsx +21 -23
- package/jsx/rte/Editor/Editor.stories.jsx.map +1 -1
- package/jsx/rte/RichTextEditor/RichTextEditor.stories.jsx +1 -1
- package/jsx/rte/RichTextEditor/RichTextEditor.stories.jsx.map +1 -1
- package/jsx/rte/RichTextEditor/RichTextViewer.stories.d.ts +1 -0
- package/jsx/rte/RichTextEditor/RichTextViewer.stories.d.ts.map +1 -1
- package/jsx/rte/RichTextEditor/RichTextViewer.stories.jsx +19 -2
- package/jsx/rte/RichTextEditor/RichTextViewer.stories.jsx.map +1 -1
- package/jsx/social/Chat/Chat.stories.d.ts +31 -22
- package/jsx/social/Chat/Chat.stories.d.ts.map +1 -1
- package/jsx/social/Chat/Chat.stories.jsx +106 -153
- package/jsx/social/Chat/Chat.stories.jsx.map +1 -1
- package/jsx/social/Feed/FeedNewPost.stories.jsx +1 -1
- package/jsx/social/Feed/FeedNewPost.stories.jsx.map +1 -1
- package/jsx/social/Feed/FeedPost.stories.jsx +1 -1
- package/jsx/social/Feed/FeedPost.stories.jsx.map +1 -1
- package/jsx/work/AppAnnouncement/AppAnnouncement.stories.d.ts.map +1 -1
- package/jsx/work/AppAnnouncement/AppAnnouncement.stories.jsx +6 -7
- package/jsx/work/AppAnnouncement/AppAnnouncement.stories.jsx.map +1 -1
- package/jsx/work/CaseView/FileService.mock.d.ts.map +1 -1
- package/jsx/work/CaseView/FileService.mock.jsx +6 -2
- package/jsx/work/CaseView/FileService.mock.jsx.map +1 -1
- package/jsx/work/Confirmation/Confirmation.stories.d.ts +1 -1
- package/jsx/work/Confirmation/Confirmation.stories.d.ts.map +1 -1
- package/jsx/work/Confirmation/Confirmation.stories.jsx +14 -3
- package/jsx/work/Confirmation/Confirmation.stories.jsx.map +1 -1
- package/jsx/work/Confirmation/Confirmation.styles.d.ts +2 -0
- package/jsx/work/Confirmation/Confirmation.styles.d.ts.map +1 -0
- package/jsx/work/Confirmation/Confirmation.styles.js +7 -0
- package/jsx/work/Confirmation/Confirmation.styles.js.map +1 -0
- package/jsx/work/SearchResults/SearchResults.stories.d.ts.map +1 -1
- package/jsx/work/SearchResults/SearchResults.stories.jsx +3 -9
- package/jsx/work/SearchResults/SearchResults.stories.jsx.map +1 -1
- package/jsx/work/SearchResults/SearchResults.styles.d.ts +5 -0
- package/jsx/work/SearchResults/SearchResults.styles.d.ts.map +1 -0
- package/jsx/work/SearchResults/SearchResults.styles.js +12 -0
- package/jsx/work/SearchResults/SearchResults.styles.js.map +1 -0
- package/jsx/work/Stakeholders/Stakeholders.mocks.d.ts +17 -0
- package/jsx/work/Stakeholders/Stakeholders.mocks.d.ts.map +1 -0
- package/jsx/work/Stakeholders/Stakeholders.mocks.jsx +32 -0
- package/jsx/work/Stakeholders/Stakeholders.mocks.jsx.map +1 -0
- package/jsx/work/Stakeholders/Stakeholders.stories.d.ts +2 -5
- package/jsx/work/Stakeholders/Stakeholders.stories.d.ts.map +1 -1
- package/jsx/work/Stakeholders/Stakeholders.stories.jsx +2 -30
- package/jsx/work/Stakeholders/Stakeholders.stories.jsx.map +1 -1
- package/jsx/work/Timeline/Timeline.stories.d.ts.map +1 -1
- package/jsx/work/Timeline/Timeline.stories.jsx +2 -2
- package/jsx/work/Timeline/Timeline.stories.jsx.map +1 -1
- package/lib/build/AppShell/AppShell.stories.d.ts.map +1 -1
- package/lib/build/AppShell/AppShell.stories.js +4 -4
- package/lib/build/AppShell/AppShell.stories.js.map +1 -1
- package/lib/core/Avatar/Avatar.stories.d.ts.map +1 -1
- package/lib/core/Avatar/Avatar.stories.js +2 -2
- package/lib/core/Avatar/Avatar.stories.js.map +1 -1
- package/lib/core/Banner/Banner.mocks.d.ts +18 -0
- package/lib/core/Banner/Banner.mocks.d.ts.map +1 -0
- package/lib/core/Banner/Banner.mocks.js +36 -0
- package/lib/core/Banner/Banner.mocks.js.map +1 -0
- package/lib/core/Banner/Banner.stories.d.ts.map +1 -1
- package/lib/core/Banner/Banner.stories.js +4 -33
- package/lib/core/Banner/Banner.stories.js.map +1 -1
- package/lib/core/Button/Button.stories.d.ts.map +1 -1
- package/lib/core/Button/Button.stories.js +2 -2
- package/lib/core/Button/Button.stories.js.map +1 -1
- package/lib/core/Configuration/Configuration.stories.js +1 -1
- package/lib/core/Configuration/Configuration.stories.js.map +1 -1
- package/lib/core/DateTime/DateTimeDisplay.stories.js +1 -0
- package/lib/core/DateTime/DateTimeDisplay.stories.js.map +1 -1
- package/lib/core/ExpandCollapse/ExpandCollapse.styles.d.ts.map +1 -1
- package/lib/core/ExpandCollapse/ExpandCollapse.styles.js +5 -0
- package/lib/core/ExpandCollapse/ExpandCollapse.styles.js.map +1 -1
- package/lib/core/FieldGroup/FieldGroupList.mocks.d.ts +21 -0
- package/lib/core/FieldGroup/FieldGroupList.mocks.d.ts.map +1 -0
- package/lib/core/FieldGroup/FieldGroupList.mocks.js +38 -0
- package/lib/core/FieldGroup/FieldGroupList.mocks.js.map +1 -0
- package/lib/core/FieldGroup/FieldGroupList.stories.d.ts.map +1 -1
- package/lib/core/FieldGroup/FieldGroupList.stories.js +1 -35
- package/lib/core/FieldGroup/FieldGroupList.stories.js.map +1 -1
- package/lib/core/File/FileDisplay.stories.d.ts +8 -1
- package/lib/core/File/FileDisplay.stories.d.ts.map +1 -1
- package/lib/core/File/FileDisplay.stories.js +32 -2
- package/lib/core/File/FileDisplay.stories.js.map +1 -1
- package/lib/core/Flex/Flex.styles.d.ts +2 -2
- package/lib/core/Flex/Flex.styles.d.ts.map +1 -1
- package/lib/core/Flex/Flex.styles.js +17 -17
- package/lib/core/Flex/Flex.styles.js.map +1 -1
- package/lib/core/Flex/FlexContainer.stories.d.ts +2 -0
- package/lib/core/Flex/FlexContainer.stories.d.ts.map +1 -1
- package/lib/core/Flex/FlexContainer.stories.js +10 -7
- package/lib/core/Flex/FlexContainer.stories.js.map +1 -1
- package/lib/core/Flex/FlexItem.stories.js +4 -4
- package/lib/core/Flex/FlexItem.stories.js.map +1 -1
- package/lib/core/Form/Form.mocks.d.ts +8 -0
- package/lib/core/Form/Form.mocks.d.ts.map +1 -0
- package/lib/core/Form/Form.mocks.js +97 -0
- package/lib/core/Form/Form.mocks.js.map +1 -0
- package/lib/core/Form/Form.stories.d.ts +0 -7
- package/lib/core/Form/Form.stories.d.ts.map +1 -1
- package/lib/core/Form/Form.stories.js +3 -95
- package/lib/core/Form/Form.stories.js.map +1 -1
- package/lib/core/Grid/Grid.styles.d.ts +2 -2
- package/lib/core/Grid/Grid.styles.d.ts.map +1 -1
- package/lib/core/Grid/Grid.styles.js +4 -4
- package/lib/core/Grid/Grid.styles.js.map +1 -1
- package/lib/core/Grid/GridContainer.stories.d.ts +6 -5
- package/lib/core/Grid/GridContainer.stories.d.ts.map +1 -1
- package/lib/core/Grid/GridContainer.stories.js +27 -24
- package/lib/core/Grid/GridContainer.stories.js.map +1 -1
- package/lib/core/Grid/GridItem.stories.d.ts +2 -2
- package/lib/core/Grid/GridItem.stories.d.ts.map +1 -1
- package/lib/core/Grid/GridItem.stories.js +10 -10
- package/lib/core/Grid/GridItem.stories.js.map +1 -1
- package/lib/core/Icon/Icon.mocks.d.ts +3 -0
- package/lib/core/Icon/Icon.mocks.d.ts.map +1 -0
- package/lib/core/Icon/Icon.mocks.js +10 -0
- package/lib/core/Icon/Icon.mocks.js.map +1 -0
- package/lib/core/Icon/Icon.stories.d.ts +1 -0
- package/lib/core/Icon/Icon.stories.d.ts.map +1 -1
- package/lib/core/Icon/Icon.stories.js +7 -1
- package/lib/core/Icon/Icon.stories.js.map +1 -1
- package/lib/core/IconPicker/IconPicker.stories.d.ts.map +1 -1
- package/lib/core/IconPicker/IconPicker.stories.js +0 -1
- package/lib/core/IconPicker/IconPicker.stories.js.map +1 -1
- package/lib/core/Lightbox/Lightbox.mocks.d.ts +15 -0
- package/lib/core/Lightbox/Lightbox.mocks.d.ts.map +1 -0
- package/lib/core/Lightbox/Lightbox.mocks.js +67 -0
- package/lib/core/Lightbox/Lightbox.mocks.js.map +1 -0
- package/lib/core/Lightbox/Lightbox.stories.d.ts +7 -6
- package/lib/core/Lightbox/Lightbox.stories.d.ts.map +1 -1
- package/lib/core/Lightbox/Lightbox.stories.js +14 -73
- package/lib/core/Lightbox/Lightbox.stories.js.map +1 -1
- package/lib/core/Link/Link.stories.d.ts +11 -1
- package/lib/core/Link/Link.stories.d.ts.map +1 -1
- package/lib/core/Link/Link.stories.js +7 -4
- package/lib/core/Link/Link.stories.js.map +1 -1
- package/lib/core/List/CommaSeparatedList.stories.d.ts.map +1 -1
- package/lib/core/List/CommaSeparatedList.stories.js +17 -17
- package/lib/core/List/CommaSeparatedList.stories.js.map +1 -1
- package/lib/core/List/OrderedList.stories.d.ts.map +1 -1
- package/lib/core/List/OrderedList.stories.js +10 -10
- package/lib/core/List/OrderedList.stories.js.map +1 -1
- package/lib/core/List/UnorderedList.stories.d.ts.map +1 -1
- package/lib/core/List/UnorderedList.stories.js +10 -10
- package/lib/core/List/UnorderedList.stories.js.map +1 -1
- package/lib/core/Menu/Menu.stories.d.ts +3 -3
- package/lib/core/Menu/Menu.stories.d.ts.map +1 -1
- package/lib/core/Menu/Menu.stories.js +8 -12
- package/lib/core/Menu/Menu.stories.js.map +1 -1
- package/lib/core/Modal/Modal.mocks.js +1 -1
- package/lib/core/Modal/Modal.mocks.js.map +1 -1
- package/lib/core/Number/Number.stories.js +1 -1
- package/lib/core/Number/Number.stories.js.map +1 -1
- package/lib/core/PageTemplates/PageTemplates.stories.d.ts +5 -2
- package/lib/core/PageTemplates/PageTemplates.stories.d.ts.map +1 -1
- package/lib/core/PageTemplates/PageTemplates.stories.js +3 -3
- package/lib/core/PageTemplates/PageTemplates.stories.js.map +1 -1
- package/lib/core/Paragraph/ParagraphDisplay.stories.js +3 -0
- package/lib/core/Paragraph/ParagraphDisplay.stories.js.map +1 -1
- package/lib/core/Popover/Popover.stories.d.ts +1 -2
- package/lib/core/Popover/Popover.stories.d.ts.map +1 -1
- package/lib/core/Popover/Popover.stories.js +24 -25
- package/lib/core/Popover/Popover.stories.js.map +1 -1
- package/lib/core/Rating/Rating.stories.d.ts +4 -1
- package/lib/core/Rating/Rating.stories.d.ts.map +1 -1
- package/lib/core/Rating/Rating.stories.js +3 -3
- package/lib/core/Rating/Rating.stories.js.map +1 -1
- package/lib/core/Sentiment/Sentiment.stories.d.ts.map +1 -1
- package/lib/core/Sentiment/Sentiment.stories.js +6 -6
- package/lib/core/Sentiment/Sentiment.stories.js.map +1 -1
- package/lib/core/SummaryList/SummaryList.stories.js +1 -1
- package/lib/core/SummaryList/SummaryList.stories.js.map +1 -1
- package/lib/core/Toaster/Toaster.stories.d.ts.map +1 -1
- package/lib/core/Toaster/Toaster.stories.js +8 -3
- package/lib/core/Toaster/Toaster.stories.js.map +1 -1
- package/lib/rte/Editor/Editor.stories.d.ts +3 -3
- package/lib/rte/Editor/Editor.stories.d.ts.map +1 -1
- package/lib/rte/Editor/Editor.stories.js +21 -23
- package/lib/rte/Editor/Editor.stories.js.map +1 -1
- package/lib/rte/RichTextEditor/RichTextEditor.stories.js +1 -1
- package/lib/rte/RichTextEditor/RichTextEditor.stories.js.map +1 -1
- package/lib/rte/RichTextEditor/RichTextViewer.stories.d.ts +1 -0
- package/lib/rte/RichTextEditor/RichTextViewer.stories.d.ts.map +1 -1
- package/lib/rte/RichTextEditor/RichTextViewer.stories.js +15 -2
- package/lib/rte/RichTextEditor/RichTextViewer.stories.js.map +1 -1
- package/lib/social/Chat/Chat.stories.d.ts +33 -22
- package/lib/social/Chat/Chat.stories.d.ts.map +1 -1
- package/lib/social/Chat/Chat.stories.js +102 -158
- package/lib/social/Chat/Chat.stories.js.map +1 -1
- package/lib/social/Feed/FeedNewPost.stories.js +1 -1
- package/lib/social/Feed/FeedNewPost.stories.js.map +1 -1
- package/lib/social/Feed/FeedPost.stories.js +1 -1
- package/lib/social/Feed/FeedPost.stories.js.map +1 -1
- package/lib/work/AppAnnouncement/AppAnnouncement.stories.d.ts.map +1 -1
- package/lib/work/AppAnnouncement/AppAnnouncement.stories.js +6 -7
- package/lib/work/AppAnnouncement/AppAnnouncement.stories.js.map +1 -1
- package/lib/work/CaseView/FileService.mock.d.ts.map +1 -1
- package/lib/work/CaseView/FileService.mock.js +6 -2
- package/lib/work/CaseView/FileService.mock.js.map +1 -1
- package/lib/work/Confirmation/Confirmation.stories.d.ts +1 -1
- package/lib/work/Confirmation/Confirmation.stories.d.ts.map +1 -1
- package/lib/work/Confirmation/Confirmation.stories.js +12 -4
- package/lib/work/Confirmation/Confirmation.stories.js.map +1 -1
- package/lib/work/Confirmation/Confirmation.styles.d.ts +2 -0
- package/lib/work/Confirmation/Confirmation.styles.d.ts.map +1 -0
- package/lib/work/Confirmation/Confirmation.styles.js +7 -0
- package/lib/work/Confirmation/Confirmation.styles.js.map +1 -0
- package/lib/work/SearchResults/SearchResults.stories.d.ts.map +1 -1
- package/lib/work/SearchResults/SearchResults.stories.js +3 -9
- package/lib/work/SearchResults/SearchResults.stories.js.map +1 -1
- package/lib/work/SearchResults/SearchResults.styles.d.ts +5 -0
- package/lib/work/SearchResults/SearchResults.styles.d.ts.map +1 -0
- package/lib/work/SearchResults/SearchResults.styles.js +12 -0
- package/lib/work/SearchResults/SearchResults.styles.js.map +1 -0
- package/lib/work/Stakeholders/Stakeholders.mocks.d.ts +22 -0
- package/lib/work/Stakeholders/Stakeholders.mocks.d.ts.map +1 -0
- package/lib/work/Stakeholders/Stakeholders.mocks.js +36 -0
- package/lib/work/Stakeholders/Stakeholders.mocks.js.map +1 -0
- package/lib/work/Stakeholders/Stakeholders.stories.d.ts +2 -5
- package/lib/work/Stakeholders/Stakeholders.stories.d.ts.map +1 -1
- package/lib/work/Stakeholders/Stakeholders.stories.js +3 -34
- package/lib/work/Stakeholders/Stakeholders.stories.js.map +1 -1
- package/lib/work/Timeline/Timeline.stories.d.ts.map +1 -1
- package/lib/work/Timeline/Timeline.stories.js +2 -2
- package/lib/work/Timeline/Timeline.stories.js.map +1 -1
- package/package.json +9 -9
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { Meta } from '@storybook/react';
|
|
3
3
|
declare const _default: Meta<import("@storybook/react").Args>;
|
|
4
4
|
export default _default;
|
|
5
|
+
export declare const RichTextViewerDemo: () => JSX.Element;
|
|
5
6
|
export declare const RichTextViewerHTMLDemo: () => JSX.Element;
|
|
6
7
|
export declare const RichTextViewerMDDemo: () => JSX.Element;
|
|
7
8
|
//# sourceMappingURL=RichTextViewer.stories.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RichTextViewer.stories.d.ts","sourceRoot":"","sources":["../../../src/rte/RichTextEditor/RichTextViewer.stories.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;;AAcxC,wBAGU;AAEV,eAAO,MAAM,sBAAsB,mBAuBlC,CAAC;AAEF,eAAO,MAAM,oBAAoB,mBA4DhC,CAAC"}
|
|
1
|
+
{"version":3,"file":"RichTextViewer.stories.d.ts","sourceRoot":"","sources":["../../../src/rte/RichTextEditor/RichTextViewer.stories.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;;AAcxC,wBAGU;AAEV,eAAO,MAAM,kBAAkB,mBAuB9B,CAAC;AAEF,eAAO,MAAM,sBAAsB,mBAuBlC,CAAC;AAEF,eAAO,MAAM,oBAAoB,mBA4DhC,CAAC"}
|
|
@@ -7,6 +7,23 @@ export default {
|
|
|
7
7
|
title: 'RTE/RichTextViewer',
|
|
8
8
|
component: RichTextViewer
|
|
9
9
|
};
|
|
10
|
+
export const RichTextViewerDemo = () => {
|
|
11
|
+
const editorRef = useRef(null);
|
|
12
|
+
const [content, setContent] = useState('[]');
|
|
13
|
+
return (<Flex container={{ direction: 'column', gap: 2 }}>
|
|
14
|
+
<RichTextEditor ref={editorRef} toolbar={[
|
|
15
|
+
'inline-styling',
|
|
16
|
+
'headers',
|
|
17
|
+
'tables',
|
|
18
|
+
'links',
|
|
19
|
+
'lists',
|
|
20
|
+
'cut-copy-paste',
|
|
21
|
+
'indentation'
|
|
22
|
+
]} onChange={() => setContent(editorRef.current?.getRichText() || '')}/>
|
|
23
|
+
|
|
24
|
+
<RichTextViewer content={content} type='richtext'/>
|
|
25
|
+
</Flex>);
|
|
26
|
+
};
|
|
10
27
|
export const RichTextViewerHTMLDemo = () => {
|
|
11
28
|
const editorRef = useRef(null);
|
|
12
29
|
const [content, setContent] = useState('');
|
|
@@ -41,7 +58,7 @@ export const RichTextViewerMDDemo = () => {
|
|
|
41
58
|
}
|
|
42
59
|
};
|
|
43
60
|
return (<Flex container={{ direction: 'column', gap: 2 }}>
|
|
44
|
-
<RichTextEditor ref={editorRef} searchTriggers={[{ trigger: '@', regex:
|
|
61
|
+
<RichTextEditor ref={editorRef} searchTriggers={[{ trigger: '@', regex: '[a-zA-Z]*(?: [a-zA-Z]*)?' }]} onSearch={searchUsers} getSearchItemReplacement={(id) => {
|
|
45
62
|
const item = demoUsers.find(({ id: itemId }) => itemId === id);
|
|
46
63
|
if (!item)
|
|
47
64
|
return undefined;
|
|
@@ -49,7 +66,7 @@ export const RichTextViewerMDDemo = () => {
|
|
|
49
66
|
markdown: `@${item.id}:${item.primary}:user:`,
|
|
50
67
|
text: item.primary
|
|
51
68
|
};
|
|
52
|
-
}} menu={users.length ? { items: users } : undefined} autoFocus markdownOnly defaultValue={'# Try writing some of your own markdown and see how it renders!\n\nYou can interact with mentions such as @deans:Seth DeAngelo:user:\n\nThere is built in support for #tags as well!\n\nComponent renderings can also be conditionally overwritten: [Link](https://www.google.com) -- [Link with preview](https://www.pega.com)'} onChange={() => setContent(editorRef.current?.getPlainText() || '')}/>
|
|
69
|
+
}} menu={users.length ? { items: users } : undefined} autoFocus markdownOnly defaultValue={'# Try writing some of your own markdown and see how it renders!\n\nYou can interact with mentions such as @deans:Seth DeAngelo:user:\n\nThere is built in support for #tags: as well!\n\nComponent renderings can also be conditionally overwritten: [Link](https://www.google.com) -- [Link with preview](https://www.pega.com)'} onChange={() => setContent(editorRef.current?.getPlainText() || '')}/>
|
|
53
70
|
|
|
54
71
|
<RichTextViewer content={content} type='markdown' interactionRenderers={[MentionButtonConfig, HashtagButtonConfig]} markdownMap={{
|
|
55
72
|
link: (linkToken) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RichTextViewer.stories.jsx","sourceRoot":"","sources":["../../../src/rte/RichTextEditor/RichTextViewer.stories.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEzC,OAAO,EAAE,IAAI,EAAE,IAAI,EAAiB,MAAM,yBAAyB,CAAC;AACpE,OAAO,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AACrF,OAAO,EACL,cAAc,EACd,cAAc,EAGf,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAEnD,eAAe;IACb,KAAK,EAAE,oBAAoB;IAC3B,SAAS,EAAE,cAAc;CAClB,CAAC;AAEV,MAAM,CAAC,MAAM,sBAAsB,GAAG,GAAG,EAAE;IACzC,MAAM,SAAS,GAAG,MAAM,CAAsB,IAAI,CAAC,CAAC;IACpD,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,CAAC,EAAE,CAAC,CAAC;IAE3C,OAAO,CACL,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC,CAC/C;MAAA,CAAC,cAAc,CACb,GAAG,CAAC,CAAC,SAAS,CAAC,CACf,OAAO,CAAC,CAAC;YACP,gBAAgB;YAChB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AC,CACF,IAAI,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,CAClD,SAAS,CACT,YAAY,CACZ,YAAY,CAAC,CACX,kUAAkU,CACnU,CACD,QAAQ,CAAC,CAAC,GAAG,EAAE,CAAC,UAAU,CAAC,SAAS,CAAC,OAAO,EAAE,YAAY,EAAE,IAAI,EAAE,CAAC,CAAC,EAGtE;;MAAA,CAAC,cAAc,CACb,OAAO,CAAC,CAAC,OAAO,CAAC,CACjB,IAAI,CAAC,UAAU,CACf,oBAAoB,CAAC,CAAC,CAAC,mBAAmB,EAAE,mBAAmB,CAAC,CAAC,CACjE,WAAW,CAAC,CAAC;YACX,IAAI,EAAE,CAAC,SAA2B,EAAE,EAAE;gBACpC,IAAI,SAAS,CAAC,IAAI,EAAE,QAAQ,CAAC,cAAc,CAAC;oBAAE,OAAO,aAAa,CAAC;YACrE,CAAC;SACF,CAAC,EAEN;IAAA,EAAE,IAAI,CAAC,CACR,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import { Meta } from '@storybook/react';\nimport { useRef, useState } from 'react';\n\nimport { Flex, Link, MenuItemProps } from '@pega/cosmos-react-core';\nimport { HashtagButtonConfig, MentionButtonConfig } from '@pega/cosmos-react-social';\nimport {\n RichTextEditor,\n RichTextViewer,\n RichTextEditorState,\n TokenMap\n} from '@pega/cosmos-react-rte';\n\nimport { demoUsers } from './RichTextEditor.mocks';\n\nexport default {\n title: 'RTE/RichTextViewer',\n component: RichTextViewer\n} as Meta;\n\nexport const RichTextViewerDemo = () => {\n const editorRef = useRef<RichTextEditorState>(null);\n const [content, setContent] = useState('[]');\n\n return (\n <Flex container={{ direction: 'column', gap: 2 }}>\n <RichTextEditor\n ref={editorRef}\n toolbar={[\n 'inline-styling',\n 'headers',\n 'tables',\n 'links',\n 'lists',\n 'cut-copy-paste',\n 'indentation'\n ]}\n onChange={() => setContent(editorRef.current?.getRichText() || '')}\n />\n\n <RichTextViewer content={content} type='richtext' />\n </Flex>\n );\n};\n\nexport const RichTextViewerHTMLDemo = () => {\n const editorRef = useRef<RichTextEditorState>(null);\n const [content, setContent] = useState('');\n\n return (\n <Flex container={{ direction: 'column', gap: 2 }}>\n <RichTextEditor\n ref={editorRef}\n toolbar={[\n 'inline-styling',\n 'headers',\n 'tables',\n 'links',\n 'lists',\n 'cut-copy-paste',\n 'indentation'\n ]}\n onChange={() => setContent(editorRef.current?.getHtml() || '')}\n />\n\n <RichTextViewer content={content} type='html' />\n </Flex>\n );\n};\n\nexport const RichTextViewerMDDemo = () => {\n const LinkComponent = ({ token }: { token: TokenMap['link'] }) => {\n return (\n <Link href={token.href} previewable>\n {token.text}\n </Link>\n );\n };\n\n const editorRef = useRef<RichTextEditorState>(null);\n const [content, setContent] = useState('');\n const [users, setUsers] = useState<MenuItemProps[]>(demoUsers);\n\n const searchUsers = (event: { search: string; trigger: string }) => {\n if (event.trigger === '@') {\n setUsers(\n demoUsers.filter(user => {\n return user.primary.toLowerCase().includes(event.search.toLowerCase());\n })\n );\n }\n };\n\n return (\n <Flex container={{ direction: 'column', gap: 2 }}>\n <RichTextEditor\n ref={editorRef}\n searchTriggers={[{ trigger: '@', regex: '[a-zA-Z]*(?: [a-zA-Z]*)?' }]}\n onSearch={searchUsers}\n getSearchItemReplacement={(id: string) => {\n const item = demoUsers.find(({ id: itemId }) => itemId === id);\n\n if (!item) return undefined;\n\n return {\n markdown: `@${item.id}:${item.primary}:user:`,\n text: item.primary\n };\n }}\n menu={users.length ? { items: users } : undefined}\n autoFocus\n markdownOnly\n defaultValue={\n '# Try writing some of your own markdown and see how it renders!\\n\\nYou can interact with mentions such as @deans:Seth DeAngelo:user:\\n\\nThere is built in support for #tags: as well!\\n\\nComponent renderings can also be conditionally overwritten: [Link](https://www.google.com) -- [Link with preview](https://www.pega.com)'\n }\n onChange={() => setContent(editorRef.current?.getPlainText() || '')}\n />\n\n <RichTextViewer\n content={content}\n type='markdown'\n interactionRenderers={[MentionButtonConfig, HashtagButtonConfig]}\n markdownMap={{\n link: (linkToken: TokenMap['link']) => {\n if (linkToken.href?.includes('www.pega.com')) return LinkComponent;\n }\n }}\n />\n </Flex>\n );\n};\n"]}
|
|
@@ -1,25 +1,34 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
component: import("react").FunctionComponent<ChatProps & import("@pega/cosmos-react-core").ForwardProps>;
|
|
6
|
-
};
|
|
2
|
+
import { Meta, Story } from '@storybook/react';
|
|
3
|
+
import { MessageProps } from '@pega/cosmos-react-social';
|
|
4
|
+
declare const _default: Meta<import("@storybook/react").Args>;
|
|
7
5
|
export default _default;
|
|
8
|
-
export declare const
|
|
9
|
-
export declare const
|
|
10
|
-
export declare const
|
|
11
|
-
export declare const
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
export declare const
|
|
16
|
-
export declare const
|
|
17
|
-
export declare const
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
6
|
+
export declare const ChatHeaderDemo: () => JSX.Element;
|
|
7
|
+
export declare const MessageListDemo: () => JSX.Element;
|
|
8
|
+
export declare const MessageDemo: Story<MessageProps>;
|
|
9
|
+
export declare const SystemMessageDemo: () => JSX.Element;
|
|
10
|
+
interface TypeIndicatorDemoProps {
|
|
11
|
+
message?: string;
|
|
12
|
+
}
|
|
13
|
+
export declare const TypeIndicatorDemo: Story<TypeIndicatorDemoProps>;
|
|
14
|
+
export declare const ChatTranscriptsDemo: () => JSX.Element[];
|
|
15
|
+
export declare const TranscriptMessageDemo: () => JSX.Element;
|
|
16
|
+
export declare const SuggestedReplyPickerDemo: () => JSX.Element;
|
|
17
|
+
interface ChatComposerDemoProps {
|
|
18
|
+
maxAttachments?: number;
|
|
19
|
+
}
|
|
20
|
+
export declare const ChatComposerDemo: Story<ChatComposerDemoProps>;
|
|
21
|
+
interface StandardChatProps {
|
|
22
|
+
maxAttachments?: number;
|
|
23
|
+
chatWidth?: string;
|
|
24
|
+
selectedChannel?: string;
|
|
25
|
+
showChatBanner?: boolean;
|
|
26
|
+
disableChat?: boolean;
|
|
27
|
+
simulateConversation?: boolean;
|
|
28
|
+
message?: string;
|
|
29
|
+
placeholder?: string;
|
|
30
|
+
defaultMessage?: string;
|
|
31
|
+
maxLength?: number;
|
|
32
|
+
}
|
|
33
|
+
export declare const StandardChat: Story<StandardChatProps>;
|
|
25
34
|
//# sourceMappingURL=Chat.stories.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Chat.stories.d.ts","sourceRoot":"","sources":["../../../src/social/Chat/Chat.stories.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"Chat.stories.d.ts","sourceRoot":"","sources":["../../../src/social/Chat/Chat.stories.tsx"],"names":[],"mappings":";AAUA,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AA2B/C,OAAO,EASL,YAAY,EAWb,MAAM,2BAA2B,CAAC;;AAMnC,wBAGU;AAGV,eAAO,MAAM,cAAc,mBA4B1B,CAAC;AAIF,eAAO,MAAM,eAAe,mBAiB3B,CAAC;AAIF,eAAO,MAAM,WAAW,EAAE,KAAK,CAAC,YAAY,CA2D3C,CAAC;AAcF,eAAO,MAAM,iBAAiB,mBAE7B,CAAC;AAIF,UAAU,sBAAsB;IAC9B,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AACD,eAAO,MAAM,iBAAiB,EAAE,KAAK,CAAC,sBAAsB,CAE3D,CAAC;AAYF,eAAO,MAAM,mBAAmB,qBAW/B,CAAC;AAIF,eAAO,MAAM,qBAAqB,mBAMjC,CAAC;AAKF,eAAO,MAAM,wBAAwB,mBAuBpC,CAAC;AAKF,UAAU,qBAAqB;IAC7B,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,eAAO,MAAM,gBAAgB,EAAE,KAAK,CAAC,qBAAqB,CAWzD,CAAC;AAYF,UAAU,iBAAiB;IACzB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,iBAAiB,CAwgBjD,CAAC"}
|
|
@@ -1,36 +1,18 @@
|
|
|
1
1
|
import { useState, useRef, useEffect, useCallback, useMemo } from 'react';
|
|
2
2
|
import { action } from '@storybook/addon-actions';
|
|
3
|
-
import { radios, array, boolean, text, number, optionsKnob, button } from '@storybook/addon-knobs';
|
|
4
3
|
import { Button, Icon, registerIcon, Text, MenuButton, Flex, Popover, Link, Status, EmojiContext, createUID, useOuterEvent, TextArea, Select, Option, Menu, useElement, FieldValueList } from '@pega/cosmos-react-core';
|
|
5
4
|
import * as arrowMicroDownIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/arrow-micro-down.icon';
|
|
6
5
|
import * as replyIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/reply.icon';
|
|
7
6
|
import * as replyAllIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/reply-all.icon';
|
|
8
7
|
import * as forwardIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/forward.icon';
|
|
9
|
-
import { Chat, ChatHeader, ChatBody, ChatComposer, ChatTranscript, Message, MessageList
|
|
8
|
+
import { Chat, ChatHeader, ChatBody, ChatComposer, ChatTranscript, Message, MessageList, NewMessageSeparatorId, SuggestedReplyPicker, SystemMessage, TranscriptMessage, TypeIndicator } from '@pega/cosmos-react-social';
|
|
10
9
|
import { ChatMockData } from './Chat.mocks';
|
|
11
10
|
registerIcon(forwardIcon, replyIcon, replyAllIcon, arrowMicroDownIcon);
|
|
12
11
|
export default {
|
|
13
12
|
title: 'Social/Chat',
|
|
14
13
|
component: Chat
|
|
15
14
|
};
|
|
16
|
-
const
|
|
17
|
-
label: 'Channel',
|
|
18
|
-
options: {
|
|
19
|
-
LiveChat: {
|
|
20
|
-
title: 'Live chat',
|
|
21
|
-
icon: 'chat-solid'
|
|
22
|
-
},
|
|
23
|
-
Twitter: {
|
|
24
|
-
title: 'Twitter chat',
|
|
25
|
-
icon: 'twitter'
|
|
26
|
-
},
|
|
27
|
-
Facebook: {
|
|
28
|
-
title: 'Facebook messenger',
|
|
29
|
-
icon: 'facebook'
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
};
|
|
33
|
-
export const chatHeader = () => {
|
|
15
|
+
export const ChatHeaderDemo = () => {
|
|
34
16
|
const actionsConfig = (<Flex>
|
|
35
17
|
<Button variant='simple' aria-label='Show transcripts'>
|
|
36
18
|
<Flex container={{
|
|
@@ -47,27 +29,16 @@ export const chatHeader = () => {
|
|
|
47
29
|
</Flex>);
|
|
48
30
|
return (<ChatHeader title='Live Chat' icon='chat-solid' aria-label='Chat header' actions={actionsConfig}/>);
|
|
49
31
|
};
|
|
50
|
-
export const
|
|
32
|
+
export const MessageListDemo = () => {
|
|
51
33
|
const messages = ChatMockData.chatMessages;
|
|
52
34
|
const [unReadMessageCount, setUnReadMessagesCount] = useState(1);
|
|
53
35
|
return (<Flex container style={{ height: '80vh' }}>
|
|
54
|
-
<
|
|
36
|
+
<MessageList tabIndex={0} messages={messages} unReadMessageCount={unReadMessageCount} onScrollToButtonClick={() => {
|
|
55
37
|
setUnReadMessagesCount(0);
|
|
56
38
|
}}/>
|
|
57
39
|
</Flex>);
|
|
58
40
|
};
|
|
59
|
-
export const
|
|
60
|
-
const MessageVariantPropValues = {
|
|
61
|
-
sender: 'sender',
|
|
62
|
-
receiver: 'receiver',
|
|
63
|
-
other: 'other'
|
|
64
|
-
};
|
|
65
|
-
const MessageDirectionPropValues = {
|
|
66
|
-
in: 'in',
|
|
67
|
-
out: 'out'
|
|
68
|
-
};
|
|
69
|
-
const variantProp = radios('Variant', MessageVariantPropValues, 'receiver');
|
|
70
|
-
const directionProp = radios('Direction', MessageDirectionPropValues, 'in');
|
|
41
|
+
export const MessageDemo = (args) => {
|
|
71
42
|
const attachments = [
|
|
72
43
|
{
|
|
73
44
|
id: '2499167340',
|
|
@@ -93,27 +64,40 @@ export const messageComponent = () => {
|
|
|
93
64
|
];
|
|
94
65
|
return (<>
|
|
95
66
|
|
|
96
|
-
<Message type='message' attachments={attachments} avatarInfo={{ name: 'John Brown' }} status='Opened' timeStamp='1:44 PM' message='Hi, Welcome to u-plus. How can I help you ?' variant={
|
|
67
|
+
<Message type='message' attachments={attachments} avatarInfo={{ name: 'John Brown' }} status='Opened' timeStamp='1:44 PM' message='Hi, Welcome to u-plus. How can I help you ?' variant={args.variant} direction={args.direction}/>
|
|
97
68
|
<br />
|
|
98
69
|
|
|
99
|
-
<Message type='message' message='Hi, Welcome to u-plus. How can I help you ?' avatarInfo={{ name: 'John Brown' }} pagePushLinks={pagePushLinks} variant={
|
|
70
|
+
<Message type='message' message='Hi, Welcome to u-plus. How can I help you ?' avatarInfo={{ name: 'John Brown' }} pagePushLinks={pagePushLinks} variant={args.variant} direction={args.direction}/>
|
|
100
71
|
<br />
|
|
101
72
|
|
|
102
|
-
<Message type='message' message='Hi, Welcome to u-plus. How can I help you ?' avatarInfo={{ name: 'John Brown' }} variant={
|
|
73
|
+
<Message type='message' message='Hi, Welcome to u-plus. How can I help you ?' avatarInfo={{ name: 'John Brown' }} variant={args.variant} direction={args.direction}/>
|
|
103
74
|
</>);
|
|
104
75
|
};
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
return <TypeIndicator avatarInfo={{ name: 'John Brown' }} message={TypeIndicatorMessageProp}/>;
|
|
76
|
+
MessageDemo.args = {
|
|
77
|
+
variant: 'receiver',
|
|
78
|
+
direction: 'in'
|
|
109
79
|
};
|
|
110
|
-
|
|
80
|
+
MessageDemo.argTypes = {
|
|
81
|
+
variant: { options: ['receiver', 'sender', 'other'], control: { type: 'select' } },
|
|
82
|
+
direction: { options: ['in', 'out'], control: { type: 'select' } }
|
|
83
|
+
};
|
|
84
|
+
export const SystemMessageDemo = () => (<SystemMessage message='John Brown has joined' timeStamp='10:00 AM'/>);
|
|
85
|
+
export const TypeIndicatorDemo = (args) => {
|
|
86
|
+
return <TypeIndicator avatarInfo={{ name: 'John Brown' }} message={args.message}/>;
|
|
87
|
+
};
|
|
88
|
+
TypeIndicatorDemo.args = {
|
|
89
|
+
message: ''
|
|
90
|
+
};
|
|
91
|
+
TypeIndicatorDemo.argTypes = {
|
|
92
|
+
message: { control: { type: 'text' } }
|
|
93
|
+
};
|
|
94
|
+
export const ChatTranscriptsDemo = () => {
|
|
111
95
|
return ChatMockData.transcripts.map((transcript) => {
|
|
112
96
|
return (<ChatTranscript tabIndex={0} title={transcript.title} key={transcript.id} transcript={transcript.data}/>);
|
|
113
97
|
});
|
|
114
98
|
};
|
|
115
|
-
export const
|
|
116
|
-
export const
|
|
99
|
+
export const TranscriptMessageDemo = () => (<TranscriptMessage timeStamp='01:20 PM' variant='bot' message='Hello… This is bot. How can I help you? Please select your category.'/>);
|
|
100
|
+
export const SuggestedReplyPickerDemo = () => {
|
|
117
101
|
const suggestedReplies = [
|
|
118
102
|
{
|
|
119
103
|
id: createUID(),
|
|
@@ -130,27 +114,37 @@ export const suggestedReplyPickerComponent = () => {
|
|
|
130
114
|
action(`Suggested reply picked ${suggestedReply.message}`)();
|
|
131
115
|
}} onDismiss={action('Suggested reply dismissed')}/>);
|
|
132
116
|
};
|
|
133
|
-
export const
|
|
117
|
+
export const ChatComposerDemo = (args) => (<ChatComposer maxAttachments={args.maxAttachments} attachments={ChatMockData.defaultAttachments} maxLength={256} placeholder='Type here to send message' onSend={() => { }}>
|
|
134
118
|
<MenuButton text='Phrases' menu={{ items: [] }}/>
|
|
135
119
|
<MenuButton text='Page Push' menu={{ items: [] }}/>
|
|
136
120
|
</ChatComposer>);
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
return obj;
|
|
145
|
-
}, {});
|
|
146
|
-
const channelOptions = Object.keys(Channels.options).reduce((obj, key) => {
|
|
147
|
-
obj[key] = key;
|
|
148
|
-
return obj;
|
|
149
|
-
}, {});
|
|
150
|
-
export const StandardChat = ({ chatWidth = '30rem' }) => {
|
|
121
|
+
ChatComposerDemo.args = {
|
|
122
|
+
maxAttachments: 2
|
|
123
|
+
};
|
|
124
|
+
ChatComposerDemo.argTypes = {
|
|
125
|
+
maxAttachments: { control: { type: 'number' } }
|
|
126
|
+
};
|
|
127
|
+
export const StandardChat = (args) => {
|
|
151
128
|
const ChatMockDataClone = useMemo(() => {
|
|
152
129
|
return JSON.parse(JSON.stringify(ChatMockData));
|
|
153
130
|
}, [ChatMockData]);
|
|
131
|
+
const Channels = {
|
|
132
|
+
label: 'Channel',
|
|
133
|
+
options: {
|
|
134
|
+
LiveChat: {
|
|
135
|
+
title: 'Live chat',
|
|
136
|
+
icon: 'chat-solid'
|
|
137
|
+
},
|
|
138
|
+
Twitter: {
|
|
139
|
+
title: 'Twitter chat',
|
|
140
|
+
icon: 'twitter'
|
|
141
|
+
},
|
|
142
|
+
Facebook: {
|
|
143
|
+
title: 'Facebook messenger',
|
|
144
|
+
icon: 'facebook'
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
};
|
|
154
148
|
const { participants, chatMessages: mockChatMessagesJson, transcripts, defaultAttachments, suggestedReplies } = ChatMockDataClone;
|
|
155
149
|
const conversationRatingMessage = {
|
|
156
150
|
id: createUID(),
|
|
@@ -195,25 +189,11 @@ export const StandardChat = ({ chatWidth = '30rem' }) => {
|
|
|
195
189
|
timers.current.forEach(clearTimeout);
|
|
196
190
|
};
|
|
197
191
|
}, []);
|
|
198
|
-
const selectedChannel = radios(Channels.label, channelOptions, Object.keys(channelOptions)[0]);
|
|
199
|
-
const actions = array('Actions', ['Transfer', 'End chat']).map(name => ({
|
|
200
|
-
primary: name,
|
|
201
|
-
id: name,
|
|
202
|
-
onClick: action(`Clicked ${name}`)
|
|
203
|
-
}));
|
|
204
192
|
const [showSuggestedReplies, setShowSuggestedReplies] = useState(true);
|
|
205
|
-
const disableChat = boolean('Disable chat', false);
|
|
206
|
-
const simulateConversation = boolean('Simulate conversation', false);
|
|
207
|
-
const placeHolder = text('Placeholder', 'Enter message');
|
|
208
|
-
const defaultMessage = text('Default message', 'Greetings! Hope you are having a great time, Please reach out to us for any help, Thanks!');
|
|
209
|
-
const maxLength = number('Max characters', 280);
|
|
210
|
-
const typers = optionsKnob('Participants typing', chatParticipants, '', {
|
|
211
|
-
display: 'multi-select'
|
|
212
|
-
});
|
|
213
193
|
const [showTranscripts, setShowTranscripts] = useState(false);
|
|
214
194
|
const [attachments, setAttachments] = useState(defaultAttachments);
|
|
215
195
|
const [unreadMessagesCount, setUnreadMessagesCount] = useState(0);
|
|
216
|
-
const [chatMessages, setChatMessages] = useState(simulateConversation ? mockChatMessages.slice(0, 0) : mockChatMessages);
|
|
196
|
+
const [chatMessages, setChatMessages] = useState(args.simulateConversation ? mockChatMessages.slice(0, 0) : mockChatMessages);
|
|
217
197
|
const onDeleteAttachment = useCallback((name) => {
|
|
218
198
|
setAttachments(prevAttachments => prevAttachments.filter(item => item.name !== name));
|
|
219
199
|
}, [setAttachments]);
|
|
@@ -252,7 +232,7 @@ export const StandardChat = ({ chatWidth = '30rem' }) => {
|
|
|
252
232
|
}
|
|
253
233
|
};
|
|
254
234
|
useEffect(() => {
|
|
255
|
-
if (simulateConversation) {
|
|
235
|
+
if (args.simulateConversation) {
|
|
256
236
|
const timeOutId = setTimeout(() => {
|
|
257
237
|
if (mockChatMessages.length) {
|
|
258
238
|
appendMessage(mockChatMessages.shift());
|
|
@@ -262,49 +242,7 @@ export const StandardChat = ({ chatWidth = '30rem' }) => {
|
|
|
262
242
|
clearTimeout(timeOutId);
|
|
263
243
|
};
|
|
264
244
|
}
|
|
265
|
-
}, [chatMessages, simulateConversation]);
|
|
266
|
-
const customerMessage = text('Customer message', '');
|
|
267
|
-
button('Send customer message', () => {
|
|
268
|
-
appendMessage({
|
|
269
|
-
type: 'message',
|
|
270
|
-
...participants.receiver,
|
|
271
|
-
message: customerMessage,
|
|
272
|
-
timeStamp: '1:45 PM'
|
|
273
|
-
});
|
|
274
|
-
return false;
|
|
275
|
-
});
|
|
276
|
-
const managerMessage = text('Manager message', '');
|
|
277
|
-
button('Send manager message', () => {
|
|
278
|
-
appendMessage({
|
|
279
|
-
type: 'message',
|
|
280
|
-
...participants.other,
|
|
281
|
-
message: managerMessage,
|
|
282
|
-
timeStamp: '1:45 PM'
|
|
283
|
-
});
|
|
284
|
-
return false;
|
|
285
|
-
});
|
|
286
|
-
const typingIndicators = typers
|
|
287
|
-
.toString()
|
|
288
|
-
.split(',')
|
|
289
|
-
.filter(person => person !== '')
|
|
290
|
-
.map(name => {
|
|
291
|
-
let message = '';
|
|
292
|
-
if (name === participants.receiver.avatarInfo.name) {
|
|
293
|
-
message = customerMessage;
|
|
294
|
-
}
|
|
295
|
-
else if (name === participants.other.avatarInfo.name) {
|
|
296
|
-
message = managerMessage;
|
|
297
|
-
}
|
|
298
|
-
return {
|
|
299
|
-
id: name,
|
|
300
|
-
type: 'typing',
|
|
301
|
-
avatarInfo: {
|
|
302
|
-
name
|
|
303
|
-
},
|
|
304
|
-
message,
|
|
305
|
-
ariaLabel: `${name} is typing`
|
|
306
|
-
};
|
|
307
|
-
});
|
|
245
|
+
}, [chatMessages, args.simulateConversation]);
|
|
308
246
|
const [openPopover, setOpenPopover] = useState(false);
|
|
309
247
|
const [popoverRef, setPopoverRef] = useElement();
|
|
310
248
|
const [buttonRef, setButtonRef] = useElement();
|
|
@@ -358,7 +296,7 @@ export const StandardChat = ({ chatWidth = '30rem' }) => {
|
|
|
358
296
|
if (openPopover)
|
|
359
297
|
setOpenPopover(false);
|
|
360
298
|
});
|
|
361
|
-
const header = (<ChatHeader title={Channels.options[selectedChannel].title} icon={Channels.options[selectedChannel].icon} aria-label='Chat header' actions={<Flex>
|
|
299
|
+
const header = (<ChatHeader title={Channels.options[args.selectedChannel || 'LiveChat'].title} icon={Channels.options[args.selectedChannel || 'LiveChat'].icon} aria-label='Chat header' actions={<Flex>
|
|
362
300
|
<Button variant='simple' onClick={() => setShowTranscripts(!showTranscripts)} aria-label='Show transcripts'>
|
|
363
301
|
<Flex container={{
|
|
364
302
|
gap: 1,
|
|
@@ -374,10 +312,15 @@ export const StandardChat = ({ chatWidth = '30rem' }) => {
|
|
|
374
312
|
<Popover show={openPopover} target={buttonRef} ref={setPopoverRef} arrow placement='bottom-end'>
|
|
375
313
|
<Flex container={{ direction: 'column', gap: 1, pad: 2 }}>
|
|
376
314
|
<Text variant='h4'>{additionalInfo.title}</Text>
|
|
377
|
-
<FieldValueList variant='inline' fields={additionalInfo.options[selectedChannel]}/>
|
|
315
|
+
<FieldValueList variant='inline' fields={additionalInfo.options[args.selectedChannel || 'LiveChat']}/>
|
|
378
316
|
</Flex>
|
|
379
317
|
</Popover>
|
|
380
|
-
<MenuButton text='More actions' icon='more' iconOnly variant='simple' portal menu={{
|
|
318
|
+
<MenuButton text='More actions' icon='more' iconOnly variant='simple' portal menu={{
|
|
319
|
+
items: [
|
|
320
|
+
{ primary: 'Transfer', id: 'transcript', onClick: action('Clicked Transfer') },
|
|
321
|
+
{ primary: 'End chat', id: 'endChat', onClick: action('Clicked End chat') }
|
|
322
|
+
]
|
|
323
|
+
}}/>
|
|
381
324
|
</Flex>}/>);
|
|
382
325
|
const [showEarlierTranscripts, setShowEarlierTranscripts] = useState(false);
|
|
383
326
|
const transcriptsContainerRef = useRef(null);
|
|
@@ -414,7 +357,6 @@ export const StandardChat = ({ chatWidth = '30rem' }) => {
|
|
|
414
357
|
})}
|
|
415
358
|
</div>) : undefined;
|
|
416
359
|
}, [showTranscripts, setShowTranscripts, showEarlierTranscripts, setShowEarlierTranscripts]);
|
|
417
|
-
const showChatBanner = boolean('Show banner', true);
|
|
418
360
|
const chatBanner = {
|
|
419
361
|
id: 'warning',
|
|
420
362
|
messages: ['This is a public interaction and any responses will be public and visible'],
|
|
@@ -422,7 +364,7 @@ export const StandardChat = ({ chatWidth = '30rem' }) => {
|
|
|
422
364
|
variant: 'warning'
|
|
423
365
|
};
|
|
424
366
|
const body = (<ChatBody>
|
|
425
|
-
<
|
|
367
|
+
<MessageList unReadMessageCount={unreadMessagesCount} onScrollToButtonClick={() => {
|
|
426
368
|
const newRandomMessageId = Math.random().toString(36).substr(2, 9);
|
|
427
369
|
setChatMessages(prevChatMessages => prevChatMessages.map(message => {
|
|
428
370
|
if (message.id === NewMessageSeparatorId) {
|
|
@@ -436,28 +378,21 @@ export const StandardChat = ({ chatWidth = '30rem' }) => {
|
|
|
436
378
|
}, 5000);
|
|
437
379
|
timers.current.push(timeOutId);
|
|
438
380
|
setUnreadMessagesCount(0);
|
|
439
|
-
}} tabIndex={0} ref={conversationRef} messages={[
|
|
381
|
+
}} tabIndex={0} ref={conversationRef} messages={[
|
|
382
|
+
...chatMessages,
|
|
383
|
+
{
|
|
384
|
+
id: 'Pegasystems',
|
|
385
|
+
type: 'typing',
|
|
386
|
+
avatarInfo: {
|
|
387
|
+
name: 'Pegasystems',
|
|
388
|
+
imageSrc: 'https://www.pega.com/sites/default/files/media/images/2018-12/Pega.com-og.png'
|
|
389
|
+
},
|
|
390
|
+
message: args.message,
|
|
391
|
+
ariaLabel: 'Pegasystems is typing'
|
|
392
|
+
}
|
|
393
|
+
]}/>
|
|
440
394
|
</ChatBody>);
|
|
441
395
|
const chatComposerImperativeHandleRef = useRef(null);
|
|
442
|
-
const phrase = text('Phrase', 'How can I help you?');
|
|
443
|
-
button('Push prase at start', () => {
|
|
444
|
-
if (chatComposerImperativeHandleRef.current) {
|
|
445
|
-
chatComposerImperativeHandleRef.current.appendToMessage(phrase, 'start');
|
|
446
|
-
}
|
|
447
|
-
return false;
|
|
448
|
-
});
|
|
449
|
-
button('Push prase at end', () => {
|
|
450
|
-
if (chatComposerImperativeHandleRef.current) {
|
|
451
|
-
chatComposerImperativeHandleRef.current.appendToMessage(phrase, 'end');
|
|
452
|
-
}
|
|
453
|
-
return false;
|
|
454
|
-
});
|
|
455
|
-
button('Push prase at cursor', () => {
|
|
456
|
-
if (chatComposerImperativeHandleRef.current) {
|
|
457
|
-
chatComposerImperativeHandleRef.current.appendToMessage(phrase, 'cursor');
|
|
458
|
-
}
|
|
459
|
-
return false;
|
|
460
|
-
});
|
|
461
396
|
const [mountPopover, setMountPopover] = useState(false);
|
|
462
397
|
const specialKeysConfig = {
|
|
463
398
|
keys: ['//'],
|
|
@@ -478,7 +413,7 @@ export const StandardChat = ({ chatWidth = '30rem' }) => {
|
|
|
478
413
|
useOuterEvent('mousedown', [chatComposerImperativeHandleRef?.current?.chatComposerRef?.current], () => {
|
|
479
414
|
setMountPopover(false);
|
|
480
415
|
});
|
|
481
|
-
const footer = (<ChatComposer ref={chatComposerImperativeHandleRef} maxAttachments={
|
|
416
|
+
const footer = (<ChatComposer ref={chatComposerImperativeHandleRef} maxAttachments={args.maxAttachments} attachments={attachments} specialKeysConfig={specialKeysConfig} showEmoji disabled={args.disableChat} onAddAttachment={() => {
|
|
482
417
|
setAttachments([
|
|
483
418
|
...attachments,
|
|
484
419
|
{
|
|
@@ -487,7 +422,7 @@ export const StandardChat = ({ chatWidth = '30rem' }) => {
|
|
|
487
422
|
onDelete: onDeleteAttachment
|
|
488
423
|
}
|
|
489
424
|
]);
|
|
490
|
-
}} maxLength={maxLength} placeholder={
|
|
425
|
+
}} maxLength={args.maxLength} placeholder={args.placeholder} defaultMessage={args.defaultMessage} onSend={message => {
|
|
491
426
|
action(`onAppendMessage: ${message}`)();
|
|
492
427
|
appendMessage({
|
|
493
428
|
...participants.sender,
|
|
@@ -496,8 +431,8 @@ export const StandardChat = ({ chatWidth = '30rem' }) => {
|
|
|
496
431
|
timeStamp: '1:45 PM'
|
|
497
432
|
});
|
|
498
433
|
}}>
|
|
499
|
-
<MenuButton text='Phrases' actions={[]} disabled={disableChat}/>
|
|
500
|
-
<MenuButton text='Page push' actions={[]} disabled={disableChat}/>
|
|
434
|
+
<MenuButton text='Phrases' actions={[]} disabled={args.disableChat}/>
|
|
435
|
+
<MenuButton text='Page push' actions={[]} disabled={args.disableChat}/>
|
|
501
436
|
<Popover show={mountPopover} target={chatComposerImperativeHandleRef?.current?.textAreaRef?.current} placement='top-start'>
|
|
502
437
|
<Menu scrollAt={20} items={ChatMockData.phrasesDisplayNames.map((name, idx) => ({
|
|
503
438
|
primary: name,
|
|
@@ -506,10 +441,6 @@ export const StandardChat = ({ chatWidth = '30rem' }) => {
|
|
|
506
441
|
}))}/>
|
|
507
442
|
</Popover>
|
|
508
443
|
</ChatComposer>);
|
|
509
|
-
button('Toggle suggested replies', () => {
|
|
510
|
-
setShowSuggestedReplies(show => !show);
|
|
511
|
-
return false;
|
|
512
|
-
});
|
|
513
444
|
const suggestedReplyPicker = suggestedReplies.length > 0 && showSuggestedReplies ? (<SuggestedReplyPicker replies={suggestedReplies} onSelect={(suggestedReply) => {
|
|
514
445
|
chatComposerImperativeHandleRef.current?.appendToMessage(suggestedReply.message, 'cursor');
|
|
515
446
|
setShowSuggestedReplies(false);
|
|
@@ -524,13 +455,35 @@ export const StandardChat = ({ chatWidth = '30rem' }) => {
|
|
|
524
455
|
justify: 'center'
|
|
525
456
|
}} style={{
|
|
526
457
|
height: 'calc(100vh)',
|
|
527
|
-
width: chatWidth,
|
|
458
|
+
width: args.chatWidth || '30rem',
|
|
528
459
|
margin: 'auto'
|
|
529
460
|
}}>
|
|
530
|
-
<Chat utility={utilityComp} header={header} banner={showChatBanner ? chatBanner : undefined} body={body} footer={footer} suggestedReplyPicker={suggestedReplyPicker}/>
|
|
461
|
+
<Chat utility={utilityComp} header={header} banner={args.showChatBanner ? chatBanner : undefined} body={body} footer={footer} suggestedReplyPicker={suggestedReplyPicker}/>
|
|
531
462
|
</Flex>
|
|
532
463
|
</EmojiContext.Provider>);
|
|
533
464
|
};
|
|
465
|
+
StandardChat.args = {
|
|
466
|
+
maxAttachments: 2,
|
|
467
|
+
selectedChannel: 'LiveChat',
|
|
468
|
+
showChatBanner: true,
|
|
469
|
+
disableChat: false,
|
|
470
|
+
simulateConversation: false,
|
|
471
|
+
message: '',
|
|
472
|
+
placeholder: 'Enter message',
|
|
473
|
+
defaultMessage: 'Greetings! Hope you are having a great time, Please reach out to us for any help, Thanks!',
|
|
474
|
+
maxLength: 280
|
|
475
|
+
};
|
|
476
|
+
StandardChat.argTypes = {
|
|
477
|
+
maxAttachments: { control: { type: 'number' } },
|
|
478
|
+
selectedChannel: { options: ['LiveChat', 'Twitter', 'Facebook'], control: { type: 'select' } },
|
|
479
|
+
showChatBanner: { control: { type: 'boolean' } },
|
|
480
|
+
disableChat: { control: { type: 'boolean' } },
|
|
481
|
+
simulateConversation: { control: { type: 'boolean' } },
|
|
482
|
+
message: { control: { type: 'text' } },
|
|
483
|
+
placeholder: { control: { type: 'text' } },
|
|
484
|
+
defaultMessage: { control: { type: 'text' } },
|
|
485
|
+
maxLength: { control: { type: 'number' } }
|
|
486
|
+
};
|
|
534
487
|
StandardChat.parameters = {
|
|
535
488
|
layout: 'fullscreen'
|
|
536
489
|
};
|