@pega/cosmos-react-demos 2.1.2 → 3.0.0-dev.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/jsx/build/AppHeader/AppHeader.stories.d.ts +2 -1
- package/jsx/build/AppHeader/AppHeader.stories.d.ts.map +1 -1
- package/jsx/build/AppHeader/AppHeader.stories.jsx +46 -13
- package/jsx/build/AppHeader/AppHeader.stories.jsx.map +1 -1
- package/jsx/build/AppShell/AppShell.stories.d.ts +2 -1
- package/jsx/build/AppShell/AppShell.stories.d.ts.map +1 -1
- package/jsx/build/AppShell/AppShell.stories.jsx +46 -13
- package/jsx/build/AppShell/AppShell.stories.jsx.map +1 -1
- package/jsx/build/ItemLibrary/LibraryPicker.mocks.d.ts +7 -0
- package/jsx/build/ItemLibrary/LibraryPicker.mocks.d.ts.map +1 -0
- package/jsx/build/ItemLibrary/LibraryPicker.mocks.js +50 -0
- package/jsx/build/ItemLibrary/LibraryPicker.mocks.js.map +1 -0
- package/jsx/build/ItemLibrary/LibraryPicker.stories.d.ts +9 -0
- package/jsx/build/ItemLibrary/LibraryPicker.stories.d.ts.map +1 -0
- package/jsx/build/ItemLibrary/LibraryPicker.stories.jsx +45 -0
- package/jsx/build/ItemLibrary/LibraryPicker.stories.jsx.map +1 -0
- package/jsx/build/LifeCycle/LifeCycle.mocks.js +1 -1
- package/jsx/build/LifeCycle/LifeCycle.mocks.js.map +1 -1
- package/jsx/build/LifeCycle/LifeCycle.stories.d.ts.map +1 -1
- package/jsx/build/LifeCycle/LifeCycle.stories.jsx +52 -34
- package/jsx/build/LifeCycle/LifeCycle.stories.jsx.map +1 -1
- package/jsx/build/PageTemplates/PageTemplates.stories.d.ts.map +1 -1
- package/jsx/build/PageTemplates/PageTemplates.stories.jsx +2 -6
- 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 +10 -12
- package/jsx/build/Workbench/Workbench.stories.jsx.map +1 -1
- package/jsx/core/AppShell/AppShell.stories.d.ts +5 -0
- package/jsx/core/AppShell/AppShell.stories.d.ts.map +1 -1
- package/jsx/core/AppShell/AppShell.stories.jsx +25 -1
- package/jsx/core/AppShell/AppShell.stories.jsx.map +1 -1
- package/jsx/core/Avatar/Avatar.stories.d.ts +5 -0
- package/jsx/core/Avatar/Avatar.stories.d.ts.map +1 -1
- package/jsx/core/Avatar/Avatar.stories.jsx +32 -5
- package/jsx/core/Avatar/Avatar.stories.jsx.map +1 -1
- package/jsx/core/Badges/Status.stories.d.ts +5 -0
- package/jsx/core/Badges/Status.stories.d.ts.map +1 -1
- package/jsx/core/Badges/Status.stories.jsx +25 -1
- package/jsx/core/Badges/Status.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 +5 -1
- package/jsx/core/Banner/Banner.stories.d.ts.map +1 -1
- package/jsx/core/Banner/Banner.stories.jsx +22 -39
- package/jsx/core/Banner/Banner.stories.jsx.map +1 -1
- package/jsx/core/Button/Button.stories.d.ts +8 -0
- package/jsx/core/Button/Button.stories.d.ts.map +1 -1
- package/jsx/core/Button/Button.stories.jsx +32 -3
- package/jsx/core/Button/Button.stories.jsx.map +1 -1
- package/jsx/core/Card/Card.stories.d.ts +5 -0
- package/jsx/core/Card/Card.stories.d.ts.map +1 -1
- package/jsx/core/Card/Card.stories.jsx +30 -1
- package/jsx/core/Card/Card.stories.jsx.map +1 -1
- package/jsx/core/Checkbox/Checkbox.stories.d.ts +12 -0
- package/jsx/core/Checkbox/Checkbox.stories.d.ts.map +1 -1
- package/jsx/core/Checkbox/Checkbox.stories.jsx +54 -1
- package/jsx/core/Checkbox/Checkbox.stories.jsx.map +1 -1
- package/jsx/core/Configuration/Configuration.stories.d.ts +17 -0
- package/jsx/core/Configuration/Configuration.stories.d.ts.map +1 -1
- package/jsx/core/Configuration/Configuration.stories.jsx +94 -3
- 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 +10 -7
- package/jsx/core/Form/Form.stories.d.ts.map +1 -1
- package/jsx/core/Form/Form.stories.jsx +44 -138
- 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/Input/Input.stories.d.ts +9 -0
- package/jsx/core/Input/Input.stories.d.ts.map +1 -1
- package/jsx/core/Input/Input.stories.jsx +40 -1
- package/jsx/core/Input/Input.stories.jsx.map +1 -1
- package/jsx/core/Label/Label.stories.d.ts +4 -0
- package/jsx/core/Label/Label.stories.d.ts.map +1 -1
- package/jsx/core/Label/Label.stories.jsx +18 -1
- package/jsx/core/Label/Label.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.d.ts.map +1 -1
- package/jsx/core/Number/Number.stories.jsx +1 -4
- 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/Progress/Progress.stories.d.ts +4 -0
- package/jsx/core/Progress/Progress.stories.d.ts.map +1 -1
- package/jsx/core/Progress/Progress.stories.jsx +22 -1
- package/jsx/core/Progress/Progress.stories.jsx.map +1 -1
- package/jsx/core/RadioButton/RadioButton.stories.d.ts +12 -0
- package/jsx/core/RadioButton/RadioButton.stories.d.ts.map +1 -1
- package/jsx/core/RadioButton/RadioButton.stories.jsx +53 -1
- package/jsx/core/RadioButton/RadioButton.stories.jsx.map +1 -1
- package/jsx/core/Rating/Rating.stories.d.ts +8 -1
- package/jsx/core/Rating/Rating.stories.d.ts.map +1 -1
- package/jsx/core/Rating/Rating.stories.jsx +21 -4
- package/jsx/core/Rating/Rating.stories.jsx.map +1 -1
- package/jsx/core/SearchInput/SearchInput.stories.d.ts +4 -0
- package/jsx/core/SearchInput/SearchInput.stories.d.ts.map +1 -1
- package/jsx/core/SearchInput/SearchInput.stories.jsx +18 -1
- package/jsx/core/SearchInput/SearchInput.stories.jsx.map +1 -1
- package/jsx/core/Select/Select.stories.d.ts +8 -0
- package/jsx/core/Select/Select.stories.d.ts.map +1 -1
- package/jsx/core/Select/Select.stories.jsx +35 -1
- package/jsx/core/Select/Select.stories.jsx.map +1 -1
- package/jsx/core/Sentiment/Sentiment.stories.d.ts +6 -0
- package/jsx/core/Sentiment/Sentiment.stories.d.ts.map +1 -1
- package/jsx/core/Sentiment/Sentiment.stories.jsx +37 -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/Switch/Switch.stories.d.ts +7 -0
- package/jsx/core/Switch/Switch.stories.d.ts.map +1 -1
- package/jsx/core/Switch/Switch.stories.jsx +34 -1
- package/jsx/core/Switch/Switch.stories.jsx.map +1 -1
- package/jsx/core/Table/Table.stories.d.ts +25 -0
- package/jsx/core/Table/Table.stories.d.ts.map +1 -1
- package/jsx/core/Table/Table.stories.jsx +120 -1
- package/jsx/core/Table/Table.stories.jsx.map +1 -1
- package/jsx/core/Tabs/Tabs.stories.d.ts +5 -0
- package/jsx/core/Tabs/Tabs.stories.d.ts.map +1 -1
- package/jsx/core/Tabs/Tabs.stories.jsx +39 -1
- package/jsx/core/Tabs/Tabs.stories.jsx.map +1 -1
- package/jsx/core/Text/Text.stories.d.ts +19 -0
- package/jsx/core/Text/Text.stories.d.ts.map +1 -1
- package/jsx/core/Text/Text.stories.jsx +112 -1
- package/jsx/core/Text/Text.stories.jsx.map +1 -1
- package/jsx/core/TextArea/TextArea.stories.d.ts +5 -0
- package/jsx/core/TextArea/TextArea.stories.d.ts.map +1 -1
- package/jsx/core/TextArea/TextArea.stories.jsx +22 -1
- package/jsx/core/TextArea/TextArea.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/core/Tooltip/Tooltip.stories.d.ts +6 -0
- package/jsx/core/Tooltip/Tooltip.stories.d.ts.map +1 -1
- package/jsx/core/Tooltip/Tooltip.stories.jsx +28 -1
- package/jsx/core/Tooltip/Tooltip.stories.jsx.map +1 -1
- package/jsx/cs/CSCaseView/CSAppShell.stories.jsx +1 -1
- package/jsx/cs/CSCaseView/CSAppShell.stories.jsx.map +1 -1
- package/jsx/cs/IntelligentGuidance/IntelligentGuidance.stories.d.ts.map +1 -1
- package/jsx/cs/IntelligentGuidance/IntelligentGuidance.stories.jsx +12 -10
- package/jsx/cs/IntelligentGuidance/IntelligentGuidance.stories.jsx.map +1 -1
- package/jsx/cs/TaskManager/TaskManager.mocks.d.ts +1 -2
- package/jsx/cs/TaskManager/TaskManager.mocks.d.ts.map +1 -1
- package/jsx/cs/TaskManager/TaskManager.mocks.js +5 -10
- package/jsx/cs/TaskManager/TaskManager.mocks.js.map +1 -1
- package/jsx/cs/TaskManager/TaskManager.stories.d.ts +8 -3
- package/jsx/cs/TaskManager/TaskManager.stories.d.ts.map +1 -1
- package/jsx/cs/TaskManager/TaskManager.stories.jsx +164 -132
- package/jsx/cs/TaskManager/TaskManager.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/Email/Email.mocks.d.ts +1 -2
- package/jsx/social/Email/Email.mocks.d.ts.map +1 -1
- package/jsx/social/Email/{Email.mocks.jsx → Email.mocks.js} +2 -3
- package/jsx/social/Email/Email.mocks.js.map +1 -0
- package/jsx/social/Email/Email.stories.d.ts.map +1 -1
- package/jsx/social/Email/Email.stories.jsx +7 -8
- package/jsx/social/Email/Email.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/Details/Details.stories.jsx +3 -3
- package/jsx/work/Details/Details.stories.jsx.map +1 -1
- 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/AppHeader/AppHeader.stories.d.ts +2 -1
- package/lib/build/AppHeader/AppHeader.stories.d.ts.map +1 -1
- package/lib/build/AppHeader/AppHeader.stories.js +46 -13
- package/lib/build/AppHeader/AppHeader.stories.js.map +1 -1
- package/lib/build/AppShell/AppShell.stories.d.ts +2 -1
- package/lib/build/AppShell/AppShell.stories.d.ts.map +1 -1
- package/lib/build/AppShell/AppShell.stories.js +46 -13
- package/lib/build/AppShell/AppShell.stories.js.map +1 -1
- package/lib/build/ItemLibrary/LibraryPicker.mocks.d.ts +7 -0
- package/lib/build/ItemLibrary/LibraryPicker.mocks.d.ts.map +1 -0
- package/lib/build/ItemLibrary/LibraryPicker.mocks.js +50 -0
- package/lib/build/ItemLibrary/LibraryPicker.mocks.js.map +1 -0
- package/lib/build/ItemLibrary/LibraryPicker.stories.d.ts +9 -0
- package/lib/build/ItemLibrary/LibraryPicker.stories.d.ts.map +1 -0
- package/lib/build/ItemLibrary/LibraryPicker.stories.js +40 -0
- package/lib/build/ItemLibrary/LibraryPicker.stories.js.map +1 -0
- package/lib/build/LifeCycle/LifeCycle.mocks.js +1 -1
- package/lib/build/LifeCycle/LifeCycle.mocks.js.map +1 -1
- package/lib/build/LifeCycle/LifeCycle.stories.d.ts.map +1 -1
- package/lib/build/LifeCycle/LifeCycle.stories.js +52 -48
- package/lib/build/LifeCycle/LifeCycle.stories.js.map +1 -1
- package/lib/build/PageTemplates/PageTemplates.stories.d.ts.map +1 -1
- package/lib/build/PageTemplates/PageTemplates.stories.js +2 -2
- 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 +15 -17
- package/lib/build/Workbench/Workbench.stories.js.map +1 -1
- package/lib/core/AppShell/AppShell.stories.d.ts +5 -0
- package/lib/core/AppShell/AppShell.stories.d.ts.map +1 -1
- package/lib/core/AppShell/AppShell.stories.js +23 -1
- package/lib/core/AppShell/AppShell.stories.js.map +1 -1
- package/lib/core/Avatar/Avatar.stories.d.ts +5 -0
- package/lib/core/Avatar/Avatar.stories.d.ts.map +1 -1
- package/lib/core/Avatar/Avatar.stories.js +30 -5
- package/lib/core/Avatar/Avatar.stories.js.map +1 -1
- package/lib/core/Badges/Status.stories.d.ts +5 -0
- package/lib/core/Badges/Status.stories.d.ts.map +1 -1
- package/lib/core/Badges/Status.stories.js +23 -1
- package/lib/core/Badges/Status.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 +5 -1
- package/lib/core/Banner/Banner.stories.d.ts.map +1 -1
- package/lib/core/Banner/Banner.stories.js +21 -33
- package/lib/core/Banner/Banner.stories.js.map +1 -1
- package/lib/core/Button/Button.stories.d.ts +8 -0
- package/lib/core/Button/Button.stories.d.ts.map +1 -1
- package/lib/core/Button/Button.stories.js +29 -2
- package/lib/core/Button/Button.stories.js.map +1 -1
- package/lib/core/Card/Card.stories.d.ts +5 -0
- package/lib/core/Card/Card.stories.d.ts.map +1 -1
- package/lib/core/Card/Card.stories.js +19 -1
- package/lib/core/Card/Card.stories.js.map +1 -1
- package/lib/core/Checkbox/Checkbox.stories.d.ts +12 -0
- package/lib/core/Checkbox/Checkbox.stories.d.ts.map +1 -1
- package/lib/core/Checkbox/Checkbox.stories.js +52 -1
- package/lib/core/Checkbox/Checkbox.stories.js.map +1 -1
- package/lib/core/Configuration/Configuration.stories.d.ts +17 -0
- package/lib/core/Configuration/Configuration.stories.d.ts.map +1 -1
- package/lib/core/Configuration/Configuration.stories.js +62 -3
- 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 +10 -7
- package/lib/core/Form/Form.stories.d.ts.map +1 -1
- package/lib/core/Form/Form.stories.js +42 -96
- 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/Input/Input.stories.d.ts +9 -0
- package/lib/core/Input/Input.stories.d.ts.map +1 -1
- package/lib/core/Input/Input.stories.js +38 -1
- package/lib/core/Input/Input.stories.js.map +1 -1
- package/lib/core/Label/Label.stories.d.ts +4 -0
- package/lib/core/Label/Label.stories.d.ts.map +1 -1
- package/lib/core/Label/Label.stories.js +16 -1
- package/lib/core/Label/Label.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.d.ts.map +1 -1
- package/lib/core/Number/Number.stories.js +1 -4
- 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/Progress/Progress.stories.d.ts +4 -0
- package/lib/core/Progress/Progress.stories.d.ts.map +1 -1
- package/lib/core/Progress/Progress.stories.js +18 -1
- package/lib/core/Progress/Progress.stories.js.map +1 -1
- package/lib/core/RadioButton/RadioButton.stories.d.ts +12 -0
- package/lib/core/RadioButton/RadioButton.stories.d.ts.map +1 -1
- package/lib/core/RadioButton/RadioButton.stories.js +51 -1
- package/lib/core/RadioButton/RadioButton.stories.js.map +1 -1
- package/lib/core/Rating/Rating.stories.d.ts +8 -1
- package/lib/core/Rating/Rating.stories.d.ts.map +1 -1
- package/lib/core/Rating/Rating.stories.js +19 -4
- package/lib/core/Rating/Rating.stories.js.map +1 -1
- package/lib/core/SearchInput/SearchInput.stories.d.ts +4 -0
- package/lib/core/SearchInput/SearchInput.stories.d.ts.map +1 -1
- package/lib/core/SearchInput/SearchInput.stories.js +16 -1
- package/lib/core/SearchInput/SearchInput.stories.js.map +1 -1
- package/lib/core/Select/Select.stories.d.ts +8 -0
- package/lib/core/Select/Select.stories.d.ts.map +1 -1
- package/lib/core/Select/Select.stories.js +28 -1
- package/lib/core/Select/Select.stories.js.map +1 -1
- package/lib/core/Sentiment/Sentiment.stories.d.ts +6 -0
- package/lib/core/Sentiment/Sentiment.stories.d.ts.map +1 -1
- package/lib/core/Sentiment/Sentiment.stories.js +34 -7
- 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/Switch/Switch.stories.d.ts +7 -0
- package/lib/core/Switch/Switch.stories.d.ts.map +1 -1
- package/lib/core/Switch/Switch.stories.js +32 -1
- package/lib/core/Switch/Switch.stories.js.map +1 -1
- package/lib/core/Table/Table.stories.d.ts +25 -0
- package/lib/core/Table/Table.stories.d.ts.map +1 -1
- package/lib/core/Table/Table.stories.js +113 -1
- package/lib/core/Table/Table.stories.js.map +1 -1
- package/lib/core/Tabs/Tabs.stories.d.ts +5 -0
- package/lib/core/Tabs/Tabs.stories.d.ts.map +1 -1
- package/lib/core/Tabs/Tabs.stories.js +30 -1
- package/lib/core/Tabs/Tabs.stories.js.map +1 -1
- package/lib/core/Text/Text.stories.d.ts +19 -0
- package/lib/core/Text/Text.stories.d.ts.map +1 -1
- package/lib/core/Text/Text.stories.js +102 -2
- package/lib/core/Text/Text.stories.js.map +1 -1
- package/lib/core/TextArea/TextArea.stories.d.ts +5 -0
- package/lib/core/TextArea/TextArea.stories.d.ts.map +1 -1
- package/lib/core/TextArea/TextArea.stories.js +20 -1
- package/lib/core/TextArea/TextArea.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/core/Tooltip/Tooltip.stories.d.ts +6 -0
- package/lib/core/Tooltip/Tooltip.stories.d.ts.map +1 -1
- package/lib/core/Tooltip/Tooltip.stories.js +20 -1
- package/lib/core/Tooltip/Tooltip.stories.js.map +1 -1
- package/lib/cs/CSCaseView/CSAppShell.stories.js +1 -1
- package/lib/cs/CSCaseView/CSAppShell.stories.js.map +1 -1
- package/lib/cs/IntelligentGuidance/IntelligentGuidance.stories.d.ts.map +1 -1
- package/lib/cs/IntelligentGuidance/IntelligentGuidance.stories.js +12 -10
- package/lib/cs/IntelligentGuidance/IntelligentGuidance.stories.js.map +1 -1
- package/lib/cs/TaskManager/TaskManager.mocks.d.ts +1 -2
- package/lib/cs/TaskManager/TaskManager.mocks.d.ts.map +1 -1
- package/lib/cs/TaskManager/TaskManager.mocks.js +5 -10
- package/lib/cs/TaskManager/TaskManager.mocks.js.map +1 -1
- package/lib/cs/TaskManager/TaskManager.stories.d.ts +8 -3
- package/lib/cs/TaskManager/TaskManager.stories.d.ts.map +1 -1
- package/lib/cs/TaskManager/TaskManager.stories.js +142 -119
- package/lib/cs/TaskManager/TaskManager.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/Email/Email.mocks.d.ts +1 -2
- package/lib/social/Email/Email.mocks.d.ts.map +1 -1
- package/lib/social/Email/Email.mocks.js +1 -3
- package/lib/social/Email/Email.mocks.js.map +1 -1
- package/lib/social/Email/Email.stories.d.ts.map +1 -1
- package/lib/social/Email/Email.stories.js +7 -8
- package/lib/social/Email/Email.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/Details/Details.stories.js +3 -3
- package/lib/work/Details/Details.stories.js.map +1 -1
- 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 +16 -16
- package/jsx/social/Email/Email.mocks.jsx.map +0 -1
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { useState } from 'react';
|
|
2
2
|
import styled from 'styled-components';
|
|
3
|
-
import { Button, Configuration, MenuButton, resetToInitial } from '@pega/cosmos-react-core';
|
|
4
|
-
import { FormContent } from '@pega/cosmos-react-demos/lib/core/Form/Form.
|
|
3
|
+
import { Button, Configuration, MenuButton, resetToInitial, Flex, Checkbox, RadioButton, DateInput, SearchInput, Text } from '@pega/cosmos-react-core';
|
|
4
|
+
import { FormContent } from '@pega/cosmos-react-demos/lib/core/Form/Form.mocks';
|
|
5
5
|
export default {
|
|
6
6
|
title: 'Core/Configuration',
|
|
7
|
-
component: Configuration
|
|
7
|
+
component: Configuration,
|
|
8
|
+
includeStories: ['ThemedForm', 'ThemingHierarchy', 'OverridableActionMenu']
|
|
8
9
|
};
|
|
9
10
|
export const ThemedForm = (args) => {
|
|
10
11
|
const themes = {
|
|
@@ -122,4 +123,94 @@ export const OverridableActionMenu = () => {
|
|
|
122
123
|
</Configuration>
|
|
123
124
|
</>);
|
|
124
125
|
};
|
|
126
|
+
export const ConfigurableBaseTheme = (args) => {
|
|
127
|
+
return (<Configuration theme={{
|
|
128
|
+
base: {
|
|
129
|
+
palette: {
|
|
130
|
+
interactive: args.interactive
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}}>
|
|
134
|
+
<Flex container={{ gap: 2, justify: 'start' }}>
|
|
135
|
+
<Button variant='primary'>Primary</Button>
|
|
136
|
+
<Flex item={{ shrink: 1, alignSelf: 'center' }}>
|
|
137
|
+
<Checkbox id='checkbox' label='Checkbox Option' defaultChecked/>
|
|
138
|
+
</Flex>
|
|
139
|
+
<RadioButton id='radio-button' label='Radio Option' defaultChecked/>
|
|
140
|
+
</Flex>
|
|
141
|
+
</Configuration>);
|
|
142
|
+
};
|
|
143
|
+
ConfigurableBaseTheme.args = {
|
|
144
|
+
interactive: '#681fc3'
|
|
145
|
+
};
|
|
146
|
+
ConfigurableBaseTheme.argTypes = {
|
|
147
|
+
interactive: { control: { type: 'color' } }
|
|
148
|
+
};
|
|
149
|
+
export const ConfigurableComponentTheme = (args) => {
|
|
150
|
+
return (<Configuration theme={{
|
|
151
|
+
components: {
|
|
152
|
+
button: {
|
|
153
|
+
color: args.buttonColor
|
|
154
|
+
},
|
|
155
|
+
'radio-check': {
|
|
156
|
+
':checked': {
|
|
157
|
+
'background-color': args.checkedBackgroundColor
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
}}>
|
|
162
|
+
<Flex container={{ gap: 2, justify: 'start' }}>
|
|
163
|
+
<Button variant='primary'>Primary</Button>
|
|
164
|
+
<Flex item={{ shrink: 1, alignSelf: 'center' }}>
|
|
165
|
+
<Checkbox id='checkbox' label='Checkbox Option' defaultChecked/>
|
|
166
|
+
</Flex>
|
|
167
|
+
<RadioButton id='radio-button' label='Radio Option' defaultChecked/>
|
|
168
|
+
</Flex>
|
|
169
|
+
</Configuration>);
|
|
170
|
+
};
|
|
171
|
+
ConfigurableComponentTheme.args = {
|
|
172
|
+
buttonColor: '#681fc3',
|
|
173
|
+
checkedBackgroundColor: '#20aa50'
|
|
174
|
+
};
|
|
175
|
+
ConfigurableComponentTheme.argTypes = {
|
|
176
|
+
buttonColor: { control: { type: 'color' } },
|
|
177
|
+
checkedBackgroundColor: { control: { type: 'color' } }
|
|
178
|
+
};
|
|
179
|
+
export const ConfigurableLocale = (args) => {
|
|
180
|
+
return (<Configuration locale={args.locale}>
|
|
181
|
+
<Flex container={{ direction: 'column', gap: 2 }}>
|
|
182
|
+
<DateInput label='Date Input with locale support' value={new Date()}/>
|
|
183
|
+
</Flex>
|
|
184
|
+
</Configuration>);
|
|
185
|
+
};
|
|
186
|
+
ConfigurableLocale.args = {
|
|
187
|
+
locale: 'en-US'
|
|
188
|
+
};
|
|
189
|
+
ConfigurableLocale.argTypes = {
|
|
190
|
+
locale: { options: ['en-US', 'pl', 'fr', 'hu', 'de-DE'], control: { type: 'select' } }
|
|
191
|
+
};
|
|
192
|
+
export const ConfigurableTranslations = (args) => {
|
|
193
|
+
const spanishTranslation = {
|
|
194
|
+
search_placeholder_default: args.placeholderTranslation
|
|
195
|
+
};
|
|
196
|
+
return (<Flex container={{ gap: 4 }}>
|
|
197
|
+
<Flex container={{ direction: 'column' }}>
|
|
198
|
+
<Text variant='h4'>Default</Text>
|
|
199
|
+
<SearchInput />
|
|
200
|
+
</Flex>
|
|
201
|
+
|
|
202
|
+
<Configuration translations={spanishTranslation}>
|
|
203
|
+
<Flex container={{ direction: 'column' }}>
|
|
204
|
+
<Text variant='h4'>Translated</Text>
|
|
205
|
+
<SearchInput />
|
|
206
|
+
</Flex>
|
|
207
|
+
</Configuration>
|
|
208
|
+
</Flex>);
|
|
209
|
+
};
|
|
210
|
+
ConfigurableTranslations.args = {
|
|
211
|
+
placeholderTranslation: 'Buscar...'
|
|
212
|
+
};
|
|
213
|
+
ConfigurableTranslations.argTypes = {
|
|
214
|
+
placeholderTranslation: { control: { type: 'text' } }
|
|
215
|
+
};
|
|
125
216
|
//# sourceMappingURL=Configuration.stories.jsx.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Configuration.stories.jsx","sourceRoot":"","sources":["../../../src/core/Configuration/Configuration.stories.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjC,OAAO,MAAM,MAAM,mBAAmB,CAAC;AAEvC,OAAO,EACL,MAAM,EACN,aAAa,EACb,UAAU,EACV,cAAc,EAEf,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,WAAW,EAAE,MAAM,qDAAqD,CAAC;AAElF,eAAe;IACb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AC,iBAAiB,EAAE,MAAM,CACjC;oBAAA,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,OAAO,EAAE,EAAE,WAAW,EAAE,cAAc,EAAE,EAAE,EAAE,CAAC,CAC3E;sBAAA,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,YAAY,CAAC,CAAC,OAAO,CAAC,SAAS,CAC5C;;sBACF,EAAE,MAAM,CACV;oBAAA,EAAE,aAAa,CACjB;kBAAA,EAAE,cAAc,CAClB;gBAAA,EAAE,aAAa,CACjB;cAAA,EAAE,cAAc,CAClB;YAAA,EAAE,aAAa,CACjB;UAAA,EAAE,cAAc,CAClB;QAAA,EAAE,aAAa,CACjB;MAAA,EAAE,cAAc,CAClB;IAAA,EAAE,cAAc,CAAC,CAClB,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,qBAAqB,GAAG,GAAG,EAAE;IACxC,MAAM,aAAa,GAAG,CAAC,EAAE,EAAE,EAAE,GAAG,EAAE,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,GAAG,EAAE,GAAE,CAAC,EAAE,CAAC,CAAC;IAE5E,OAAO,CACL,EACE;MAAA,CAAC,UAAU,CAAC,IAAI,CAAC,mBAAmB,CAAC,IAAI,CAAC,CAAC,EAAE,KAAK,EAAE,aAAa,EAAE,CAAC,EACpE;MAAA,CAAC,aAAa,CAAC,WAAW,CAAC,CAAC,EAAE,CAAC,CAC7B;QAAA,CAAC,UAAU,CAAC,IAAI,CAAC,sBAAsB,CAAC,IAAI,CAAC,CAAC,EAAE,KAAK,EAAE,aAAa,EAAE,CAAC,EACzE;MAAA,EAAE,aAAa,CACjB;IAAA,GAAG,CACJ,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import { Meta, Story } from '@storybook/react';\nimport { useState } from 'react';\nimport styled from 'styled-components';\n\nimport {\n Button,\n Configuration,\n MenuButton,\n resetToInitial,\n DefaultSettableTheme\n} from '@pega/cosmos-react-core';\nimport { FormContent } from '@pega/cosmos-react-demos/lib/core/Form/Form.stories';\n\nexport default {\n title: 'Core/Configuration',\n component: Configuration\n} as Meta;\n\nexport const ThemedForm: Story<{ theme: 'default' | 'theme1' }> = (args: {\n theme: 'default' | 'theme1';\n}) => {\n const themes: Record<string, DefaultSettableTheme> = {\n default: {},\n theme1: {\n base: {\n palette: {\n interactive: '#AC75F0'\n }\n },\n components: {\n button: {\n 'border-radius': 1\n },\n 'form-control': {\n 'background-color': '#80008033',\n 'border-color': 'purple'\n },\n input: {\n height: '50px'\n }\n }\n }\n };\n\n return (\n <Configuration theme={themes[args.theme]}>\n <FormContent cols={1} showActions={false} />\n </Configuration>\n );\n};\n\nThemedForm.args = {\n theme: 'default'\n};\n\nThemedForm.argTypes = {\n theme: { options: ['default', 'theme1'], control: { type: 'select' } }\n};\n\nconst buttonStyles = {\n width: '100%'\n};\n\nconst StyledFieldset = styled.fieldset`\n padding: 1rem 5%;\n margin: 1rem 0;\n`;\n\nconst BoldSpan = styled.span`\n font-weight: bold;\n`;\n\nconst 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\nexport const ThemingHierarchy = () => {\n const [redOrOrange, setRedOrOrange] = useState(true);\n const [greenOrPurple, setGreenOrPurple] = useState(true);\n\n return (\n <StyledFieldset style={{ margin: 0, textAlign: 'center' }}>\n <legend>Initial Theme</legend>\n <Button style={buttonStyles} variant='primary'>\n Base interactive\n </Button>\n <StyledFieldset>\n <legend>Override Interactive to</legend>\n <Configuration\n theme={{\n base: {\n palette: {\n interactive: redOrOrange ? 'red' : 'darkorange'\n }\n }\n }}\n >\n <Button\n style={buttonStyles}\n variant='primary'\n onClick={() => setRedOrOrange(val => !val)}\n >\n <FlipFlop flipFlop={redOrOrange} first='Red' second='Orange' />\n </Button>\n <StyledFieldset>\n <legend>Override Button Primary BG to</legend>\n <Configuration\n theme={{\n components: {\n button: { color: greenOrPurple ? 'green' : 'purple' }\n }\n }}\n >\n <Button\n style={buttonStyles}\n variant='primary'\n onClick={() => setGreenOrPurple(val => !val)}\n >\n <FlipFlop flipFlop={greenOrPurple} first='Green' second='Purple' />\n </Button>\n <Button style={{ ...buttonStyles, marginTop: '1rem' }} variant='secondary'>\n Secondary still inherits interactive\n </Button>\n <StyledFieldset>\n <legend>Reset Button BG</legend>\n <Configuration\n theme={{\n components: { button: { color: resetToInitial } }\n }}\n >\n <Button style={buttonStyles} variant='primary'>\n Inherited from interactive\n </Button>\n <StyledFieldset>\n <legend>Reset Interactive</legend>\n <Configuration theme={{ base: { palette: { interactive: resetToInitial } } }}>\n <Button style={buttonStyles} variant='primary'>\n Inherited from base\n </Button>\n </Configuration>\n </StyledFieldset>\n </Configuration>\n </StyledFieldset>\n </Configuration>\n </StyledFieldset>\n </Configuration>\n </StyledFieldset>\n </StyledFieldset>\n );\n};\n\nexport const OverridableActionMenu = () => {\n const sharedActions = [{ id: '1', primary: 'Action 1', onClick: () => {} }];\n\n return (\n <>\n <MenuButton text='Cosmos MenuButton' menu={{ items: sharedActions }} />\n <Configuration overrideMap={{}}>\n <MenuButton text='Mock PIMC MenuButton' menu={{ items: sharedActions }} />\n </Configuration>\n </>\n );\n};\n"]}
|
|
1
|
+
{"version":3,"file":"Configuration.stories.jsx","sourceRoot":"","sources":["../../../src/core/Configuration/Configuration.stories.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjC,OAAO,MAAM,MAAM,mBAAmB,CAAC;AAEvC,OAAO,EACL,MAAM,EACN,aAAa,EACb,UAAU,EACV,cAAc,EAEd,IAAI,EACJ,QAAQ,EACR,WAAW,EACX,SAAS,EACT,WAAW,EACX,IAAI,EACL,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,WAAW,EAAE,MA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CAAC,QAAQ,GAAG;IAClC,sBAAsB,EAAE,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE;CACtD,CAAC","sourcesContent":["import { Meta, Story } from '@storybook/react';\nimport { useState } from 'react';\nimport styled from 'styled-components';\n\nimport {\n Button,\n Configuration,\n MenuButton,\n resetToInitial,\n DefaultSettableTheme,\n Flex,\n Checkbox,\n RadioButton,\n DateInput,\n SearchInput,\n Text\n} from '@pega/cosmos-react-core';\nimport { FormContent } from '@pega/cosmos-react-demos/lib/core/Form/Form.mocks';\n\nexport default {\n title: 'Core/Configuration',\n component: Configuration,\n includeStories: ['ThemedForm', 'ThemingHierarchy', 'OverridableActionMenu']\n} as Meta;\n\nexport const ThemedForm: Story<{ theme: 'default' | 'theme1' }> = (args: {\n theme: 'default' | 'theme1';\n}) => {\n const themes: Record<string, DefaultSettableTheme> = {\n default: {},\n theme1: {\n base: {\n palette: {\n interactive: '#AC75F0'\n }\n },\n components: {\n button: {\n 'border-radius': 1\n },\n 'form-control': {\n 'background-color': '#80008033',\n 'border-color': 'purple'\n },\n input: {\n height: '50px'\n }\n }\n }\n };\n\n return (\n <Configuration theme={themes[args.theme]}>\n <FormContent cols={1} showActions={false} />\n </Configuration>\n );\n};\n\nThemedForm.args = {\n theme: 'default'\n};\n\nThemedForm.argTypes = {\n theme: { options: ['default', 'theme1'], control: { type: 'select' } }\n};\n\nconst buttonStyles = {\n width: '100%'\n};\n\nconst StyledFieldset = styled.fieldset`\n padding: 1rem 5%;\n margin: 1rem 0;\n`;\n\nconst BoldSpan = styled.span`\n font-weight: bold;\n`;\n\nconst 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\nexport const ThemingHierarchy = () => {\n const [redOrOrange, setRedOrOrange] = useState(true);\n const [greenOrPurple, setGreenOrPurple] = useState(true);\n\n return (\n <StyledFieldset style={{ margin: 0, textAlign: 'center' }}>\n <legend>Initial Theme</legend>\n <Button style={buttonStyles} variant='primary'>\n Base interactive\n </Button>\n <StyledFieldset>\n <legend>Override Interactive to</legend>\n <Configuration\n theme={{\n base: {\n palette: {\n interactive: redOrOrange ? 'red' : 'darkorange'\n }\n }\n }}\n >\n <Button\n style={buttonStyles}\n variant='primary'\n onClick={() => setRedOrOrange(val => !val)}\n >\n <FlipFlop flipFlop={redOrOrange} first='Red' second='Orange' />\n </Button>\n <StyledFieldset>\n <legend>Override Button Primary BG to</legend>\n <Configuration\n theme={{\n components: {\n button: { color: greenOrPurple ? 'green' : 'purple' }\n }\n }}\n >\n <Button\n style={buttonStyles}\n variant='primary'\n onClick={() => setGreenOrPurple(val => !val)}\n >\n <FlipFlop flipFlop={greenOrPurple} first='Green' second='Purple' />\n </Button>\n <Button style={{ ...buttonStyles, marginTop: '1rem' }} variant='secondary'>\n Secondary still inherits interactive\n </Button>\n <StyledFieldset>\n <legend>Reset Button BG</legend>\n <Configuration\n theme={{\n components: { button: { color: resetToInitial } }\n }}\n >\n <Button style={buttonStyles} variant='primary'>\n Inherited from interactive\n </Button>\n <StyledFieldset>\n <legend>Reset Interactive</legend>\n <Configuration theme={{ base: { palette: { interactive: resetToInitial } } }}>\n <Button style={buttonStyles} variant='primary'>\n Inherited from base\n </Button>\n </Configuration>\n </StyledFieldset>\n </Configuration>\n </StyledFieldset>\n </Configuration>\n </StyledFieldset>\n </Configuration>\n </StyledFieldset>\n </StyledFieldset>\n );\n};\n\nexport const OverridableActionMenu = () => {\n const sharedActions = [{ id: '1', primary: 'Action 1', onClick: () => {} }];\n\n return (\n <>\n <MenuButton text='Cosmos MenuButton' menu={{ items: sharedActions }} />\n <Configuration overrideMap={{}}>\n <MenuButton text='Mock PIMC MenuButton' menu={{ items: sharedActions }} />\n </Configuration>\n </>\n );\n};\n\ninterface ConfigurableBaseThemeProps {\n interactive?: string;\n}\n\nexport const ConfigurableBaseTheme: Story<ConfigurableBaseThemeProps> = (\n args: ConfigurableBaseThemeProps\n) => {\n return (\n <Configuration\n theme={{\n base: {\n palette: {\n interactive: args.interactive\n }\n }\n }}\n >\n <Flex container={{ gap: 2, justify: 'start' }}>\n <Button variant='primary'>Primary</Button>\n <Flex item={{ shrink: 1, alignSelf: 'center' }}>\n <Checkbox id='checkbox' label='Checkbox Option' defaultChecked />\n </Flex>\n <RadioButton id='radio-button' label='Radio Option' defaultChecked />\n </Flex>\n </Configuration>\n );\n};\n\nConfigurableBaseTheme.args = {\n interactive: '#681fc3'\n};\n\nConfigurableBaseTheme.argTypes = {\n interactive: { control: { type: 'color' } }\n};\n\ninterface ConfigurableComponentThemeProps {\n buttonColor?: string;\n checkedBackgroundColor?: string;\n}\n\nexport const ConfigurableComponentTheme: Story<ConfigurableComponentThemeProps> = (\n args: ConfigurableComponentThemeProps\n) => {\n return (\n <Configuration\n theme={{\n components: {\n button: {\n color: args.buttonColor\n },\n 'radio-check': {\n ':checked': {\n 'background-color': args.checkedBackgroundColor\n }\n }\n }\n }}\n >\n <Flex container={{ gap: 2, justify: 'start' }}>\n <Button variant='primary'>Primary</Button>\n <Flex item={{ shrink: 1, alignSelf: 'center' }}>\n <Checkbox id='checkbox' label='Checkbox Option' defaultChecked />\n </Flex>\n <RadioButton id='radio-button' label='Radio Option' defaultChecked />\n </Flex>\n </Configuration>\n );\n};\n\nConfigurableComponentTheme.args = {\n buttonColor: '#681fc3',\n checkedBackgroundColor: '#20aa50'\n};\n\nConfigurableComponentTheme.argTypes = {\n buttonColor: { control: { type: 'color' } },\n checkedBackgroundColor: { control: { type: 'color' } }\n};\n\ninterface ConfigurableLocaleProps {\n locale?: string;\n}\n\nexport const ConfigurableLocale: Story<ConfigurableLocaleProps> = (\n args: ConfigurableLocaleProps\n) => {\n return (\n <Configuration locale={args.locale}>\n <Flex container={{ direction: 'column', gap: 2 }}>\n <DateInput label='Date Input with locale support' value={new Date()} />\n </Flex>\n </Configuration>\n );\n};\n\nConfigurableLocale.args = {\n locale: 'en-US'\n};\n\nConfigurableLocale.argTypes = {\n locale: { options: ['en-US', 'pl', 'fr', 'hu', 'de-DE'], control: { type: 'select' } }\n};\n\ninterface ConfigurableTranslationsProps {\n placeholderTranslation?: string;\n}\n\nexport const ConfigurableTranslations: Story<ConfigurableTranslationsProps> = (\n args: ConfigurableTranslationsProps\n) => {\n const spanishTranslation = {\n search_placeholder_default: args.placeholderTranslation\n };\n\n return (\n <Flex container={{ gap: 4 }}>\n <Flex container={{ direction: 'column' }}>\n <Text variant='h4'>Default</Text>\n <SearchInput />\n </Flex>\n\n <Configuration translations={spanishTranslation}>\n <Flex container={{ direction: 'column' }}>\n <Text variant='h4'>Translated</Text>\n <SearchInput />\n </Flex>\n </Configuration>\n </Flex>\n );\n};\n\nConfigurableTranslations.args = {\n placeholderTranslation: 'Buscar...'\n};\n\nConfigurableTranslations.argTypes = {\n placeholderTranslation: { control: { type: 'text' } }\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DateTimeDisplay.stories.jsx","sourceRoot":"","sources":["../../../src/core/DateTime/DateTimeDisplay.stories.tsx"],"names":[],"mappings":"AAEA,OAAO,EACL,eAAe,EAEf,eAAe,EAEhB,MAAM,yBAAyB,CAAC;AAEjC,eAAe;IACb,KAAK,EAAE,eAAe;CACf,CAAC;AAEV,MAAM,CAAC,MAAM,mBAAmB,GAAgC,CAAC,IAA0B,EAAE,EAAE;IAC7F,OAAO,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,gBAAgB,CAAC,CAAC,IAAI,CAAC,gBAAgB,CAAC,EAAG,CAAC;AACzF,CAAC,CAAC;AAEF,mBAAmB,CAAC,IAAI,GAAG;IACzB,KAAK,EAAE,SAAS;IAChB,gBAAgB,EAAE,CAAC;CACpB,CAAC;AAEF,mBAAmB,CAAC,QAAQ,GAAG;I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'@storybook/react';\n\nimport {\n DateTimeDisplay,\n DateTimeDisplayProps,\n DurationDisplay,\n DurationDisplayProps\n} from '@pega/cosmos-react-core';\n\nexport default {\n title: 'Core/DateTime'\n} as Meta;\n\nexport const DurationDisplayDemo: Story<DurationDisplayProps> = (args: DurationDisplayProps) => {\n return <DurationDisplay value={args.value} significantUnits={args.significantUnits} />;\n};\n\nDurationDisplayDemo.args = {\n value: 462553844,\n significantUnits: 4\n};\n\nDurationDisplayDemo.argTypes = {\n value: { control: { type: 'number' } },\n significantUnits: { options: [1, 2, 3, 4], control: { type: 'select' } }\n};\n\nexport const DateTimeDisplayDemo: Story<DateTimeDisplayProps> = (args: DateTimeDisplayProps) => {\n return (\n <DateTimeDisplay\n value={args.value}\n variant={args.variant}\n format={args.format}\n clockFormat={args.clockFormat}\n />\n );\n};\n\nDateTimeDisplayDemo.args = {\n value: new Date(),\n variant: 'date',\n format: 'short',\n clockFormat: undefined\n};\n\nDateTimeDisplayDemo.argTypes = {\n variant: {\n options: [\n 'date',\n 'datetime',\n 'time',\n 'week',\n 'month',\n 'year',\n 'monthyear',\n 'quarteryear',\n 'relative'\n ],\n control: { type: 'select' }\n },\n format: { options: ['short', 'long', 'numeric'], control: { type: 'select' } },\n clockFormat: {\n options: [undefined, 12, 24],\n control: { type: 'inline-radio' }\n }\n};\n"]}
|
|
1
|
+
{"version":3,"file":"DateTimeDisplay.stories.jsx","sourceRoot":"","sources":["../../../src/core/DateTime/DateTimeDisplay.stories.tsx"],"names":[],"mappings":"AAEA,OAAO,EACL,eAAe,EAEf,eAAe,EAEhB,MAAM,yBAAyB,CAAC;AAEjC,eAAe;IACb,KAAK,EAAE,eAAe;CACf,CAAC;AAEV,MAAM,CAAC,MAAM,mBAAmB,GAAgC,CAAC,IAA0B,EAAE,EAAE;IAC7F,OAAO,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,gBAAgB,CAAC,CAAC,IAAI,CAAC,gBAAgB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EAAE,SAAS,CAAC,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE;IAC9E,WAAW,EAAE;QACX,OAAO,EAAE,CAAC,SAAS,EAAE,EAAE,EAAE,EAAE,CAAC;QAC5B,OAAO,EAAE,EAAE,IAAI,EAAE,cAAc,EAAE;KAClC;CACF,CAAC","sourcesContent":["import { Meta, Story } from '@storybook/react';\n\nimport {\n DateTimeDisplay,\n DateTimeDisplayProps,\n DurationDisplay,\n DurationDisplayProps\n} from '@pega/cosmos-react-core';\n\nexport default {\n title: 'Core/DateTime'\n} as Meta;\n\nexport const DurationDisplayDemo: Story<DurationDisplayProps> = (args: DurationDisplayProps) => {\n return <DurationDisplay value={args.value} significantUnits={args.significantUnits} />;\n};\n\nDurationDisplayDemo.args = {\n value: 462553844,\n significantUnits: 4\n};\n\nDurationDisplayDemo.argTypes = {\n value: { control: { type: 'number' } },\n significantUnits: { options: [1, 2, 3, 4], control: { type: 'select' } }\n};\n\nexport const DateTimeDisplayDemo: Story<DateTimeDisplayProps> = (args: DateTimeDisplayProps) => {\n return (\n <DateTimeDisplay\n value={args.value}\n variant={args.variant}\n format={args.format}\n clockFormat={args.clockFormat}\n />\n );\n};\n\nDateTimeDisplayDemo.args = {\n value: new Date(),\n variant: 'date',\n format: 'short',\n clockFormat: undefined\n};\n\nDateTimeDisplayDemo.argTypes = {\n value: { control: { type: 'date' } },\n variant: {\n options: [\n 'date',\n 'datetime',\n 'time',\n 'week',\n 'month',\n 'year',\n 'monthyear',\n 'quarteryear',\n 'relative'\n ],\n control: { type: 'select' }\n },\n format: { options: ['short', 'long', 'numeric'], control: { type: 'select' } },\n clockFormat: {\n options: [undefined, 12, 24],\n control: { type: 'inline-radio' }\n }\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExpandCollapse.styles.d.ts","sourceRoot":"","sources":["../../../src/core/ExpandCollapse/ExpandCollapse.styles.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,YAAY;;
|
|
1
|
+
{"version":3,"file":"ExpandCollapse.styles.d.ts","sourceRoot":"","sources":["../../../src/core/ExpandCollapse/ExpandCollapse.styles.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,YAAY;;SAcvB,CAAC"}
|
|
@@ -6,6 +6,11 @@ export const StyledRegion = styled.div(({ innerRegion, theme }) => {
|
|
|
6
6
|
padding: calc(4 * ${theme.base.spacing});
|
|
7
7
|
display: flex;
|
|
8
8
|
justify-content: center;
|
|
9
|
+
|
|
10
|
+
button {
|
|
11
|
+
height: max-content;
|
|
12
|
+
align-self: center;
|
|
13
|
+
}
|
|
9
14
|
`;
|
|
10
15
|
});
|
|
11
16
|
StyledRegion.defaultProps = defaultThemeProp;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExpandCollapse.styles.js","sourceRoot":"","sources":["../../../src/core/ExpandCollapse/ExpandCollapse.styles.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAE3D,MAAM,CAAC,MAAM,YAAY,GAAG,MAAM,CAAC,GAAG,CAA4B,CAAC,EAAE,WAAW,EAAE,KAAK,EAAE,EAAE,EAAE;IAC3F,OAAO,GAAG,CAAA;wBACY,KAAK,CAAC,IAAI,CAAC,OAAO,CACpC,WAAW,CAAC,CAAC,CAAC,oBAAoB,CAAC,CAAC,CAAC,sBAAsB,CAC5D;wBACmB,KAAK,CAAC,IAAI,CAAC,OAAO
|
|
1
|
+
{"version":3,"file":"ExpandCollapse.styles.js","sourceRoot":"","sources":["../../../src/core/ExpandCollapse/ExpandCollapse.styles.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAE3D,MAAM,CAAC,MAAM,YAAY,GAAG,MAAM,CAAC,GAAG,CAA4B,CAAC,EAAE,WAAW,EAAE,KAAK,EAAE,EAAE,EAAE;IAC3F,OAAO,GAAG,CAAA;wBACY,KAAK,CAAC,IAAI,CAAC,OAAO,CACpC,WAAW,CAAC,CAAC,CAAC,oBAAoB,CAAC,CAAC,CAAC,sBAAsB,CAC5D;wBACmB,KAAK,CAAC,IAAI,CAAC,OAAO;;;;;;;;GAQvC,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,YAAY,CAAC,YAAY,GAAG,gBAAgB,CAAC","sourcesContent":["import styled, { css } from 'styled-components';\n\nimport { defaultThemeProp } from '@pega/cosmos-react-core';\n\nexport const StyledRegion = styled.div<{ innerRegion?: boolean }>(({ innerRegion, theme }) => {\n return css`\n background-color: ${theme.base.palette[\n innerRegion ? 'primary-background' : 'secondary-background'\n ]};\n padding: calc(4 * ${theme.base.spacing});\n display: flex;\n justify-content: center;\n\n button {\n height: max-content;\n align-self: center;\n }\n `;\n});\n\nStyledRegion.defaultProps = defaultThemeProp;\n"]}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { FieldGroupListItemProps } from '@pega/cosmos-react-core';
|
|
3
|
+
declare type FieldGroupReducerPayload = {
|
|
4
|
+
action: 'add';
|
|
5
|
+
} | {
|
|
6
|
+
action: 'delete';
|
|
7
|
+
id: string;
|
|
8
|
+
};
|
|
9
|
+
export interface FieldMeta {
|
|
10
|
+
label: string;
|
|
11
|
+
type: 'text' | 'date' | 'file' | 'select' | 'textarea';
|
|
12
|
+
}
|
|
13
|
+
export interface GroupMeta {
|
|
14
|
+
label: string;
|
|
15
|
+
fields: FieldMeta[];
|
|
16
|
+
}
|
|
17
|
+
export declare const fieldGroupReducer: (groupMeta: GroupMeta, FieldRenderer: (props: FieldMeta) => JSX.Element | null) => (items: FieldGroupListItemProps[], payload: FieldGroupReducerPayload) => FieldGroupListItemProps[];
|
|
18
|
+
export declare const DemoFieldRenderer: ({ label, type }: FieldMeta) => JSX.Element | null;
|
|
19
|
+
export declare const demoGroupMeta: GroupMeta;
|
|
20
|
+
export {};
|
|
21
|
+
//# sourceMappingURL=FieldGroupList.mocks.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FieldGroupList.mocks.d.ts","sourceRoot":"","sources":["../../../src/core/FieldGroup/FieldGroupList.mocks.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAa,uBAAuB,EAAS,MAAM,yBAAyB,CAAC;AAEpF,aAAK,wBAAwB,GACzB;IACE,MAAM,EAAE,KAAK,CAAC;CACf,GACD;IACE,MAAM,EAAE,QAAQ,CAAC;IACjB,EAAE,EAAE,MAAM,CAAC;CACZ,CAAC;AAEN,MAAM,WAAW,SAAS;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,QAAQ,GAAG,UAAU,CAAC;CACxD;AAED,MAAM,WAAW,SAAS;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,SAAS,EAAE,CAAC;CACrB;AAED,eAAO,MAAM,iBAAiB,cAChB,SAAS,yBAAyB,SAAS,KAAK,WAAW,GAAG,IAAI,aAErE,uBAAuB,EAAE,WACvB,wBAAwB,KAChC,uBAAuB,EAoBzB,CAAC;AAEJ,eAAO,MAAM,iBAAiB,oBAAqB,SAAS,uBAM3D,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,SAQ3B,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { createUID, Input } from '@pega/cosmos-react-core';
|
|
2
|
+
export const fieldGroupReducer = (groupMeta, FieldRenderer) => (items, payload) => {
|
|
3
|
+
switch (payload.action) {
|
|
4
|
+
case 'add':
|
|
5
|
+
return [
|
|
6
|
+
...items,
|
|
7
|
+
{
|
|
8
|
+
name: `${groupMeta.label} ${items.length + 1}`,
|
|
9
|
+
id: createUID(),
|
|
10
|
+
children: groupMeta.fields.map(props => <FieldRenderer {...props} key={props.label}/>)
|
|
11
|
+
}
|
|
12
|
+
];
|
|
13
|
+
case 'delete':
|
|
14
|
+
return items
|
|
15
|
+
.filter(group => group.id !== payload.id)
|
|
16
|
+
.map((group, i) => ({ ...group, name: `${groupMeta.label} ${i + 1}` }));
|
|
17
|
+
default:
|
|
18
|
+
return items;
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
export const DemoFieldRenderer = ({ label, type }) => {
|
|
22
|
+
if (type === 'text') {
|
|
23
|
+
return <Input label={label}/>;
|
|
24
|
+
}
|
|
25
|
+
return null;
|
|
26
|
+
};
|
|
27
|
+
export const demoGroupMeta = {
|
|
28
|
+
label: 'Applicant',
|
|
29
|
+
fields: [
|
|
30
|
+
{
|
|
31
|
+
type: 'text',
|
|
32
|
+
label: 'Applicant name'
|
|
33
|
+
}
|
|
34
|
+
]
|
|
35
|
+
};
|
|
36
|
+
//# sourceMappingURL=FieldGroupList.mocks.jsx.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FieldGroupList.mocks.jsx","sourceRoot":"","sources":["../../../src/core/FieldGroup/FieldGroupList.mocks.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAA2B,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAqBpF,MAAM,CAAC,MAAM,iBAAiB,GAC5B,CAAC,SAAoB,EAAE,aAAuD,EAAE,EAAE,CAClF,CACE,KAAgC,EAChC,OAAiC,EACN,EAAE;IAC7B,QAAQ,OAAO,CAAC,MAAM,EAAE;QACtB,KAAK,KAAK;YACR,OAAO;gBACL,GAAG,KAAK;gBACR;oBACE,IAAI,EAAE,GAAG,SAAS,CAAC,KAAK,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE;oBAC9C,EAAE,EAAE,SAAS,EAAE;oBACf,QAAQ,EAAE,SAAS,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,aAAa,CAAC,IAAI,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,EAAG,CAAC;iBACxF;aACF,CAAC;QAEJ,KAAK,QAAQ;YACX,OAAO,KAAK;iBACT,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,EAAE,KAAK,OAAO,CAAC,EAAE,CAAC;iBACxC,GAAG,CAAC,CAAC,KAAK,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,GAAG,KAAK,EAAE,IAAI,EAAE,GAAG,SAAS,CAAC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;QAE5E;YACE,OAAO,KAAK,CAAC;KAChB;AACH,CAAC,CAAC;AAEJ,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,EAAE,KAAK,EAAE,IAAI,EAAa,EAAE,EAAE;IAC9D,IAAI,IAAI,KAAK,MAAM,EAAE;QACnB,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,EAAG,CAAC;KAChC;IAED,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,aAAa,GAAc;IACtC,KAAK,EAAE,WAAW;IAClB,MAAM,EAAE;QACN;YACE,IAAI,EAAE,MAAM;YACZ,KAAK,EAAE,gBAAgB;SACxB;KACF;CACF,CAAC","sourcesContent":["import { createUID, FieldGroupListItemProps, Input } from '@pega/cosmos-react-core';\n\ntype FieldGroupReducerPayload =\n | {\n action: 'add';\n }\n | {\n action: 'delete';\n id: string;\n };\n\nexport interface FieldMeta {\n label: string;\n type: 'text' | 'date' | 'file' | 'select' | 'textarea';\n}\n\nexport interface GroupMeta {\n label: string;\n fields: FieldMeta[];\n}\n\nexport const fieldGroupReducer =\n (groupMeta: GroupMeta, FieldRenderer: (props: FieldMeta) => JSX.Element | null) =>\n (\n items: FieldGroupListItemProps[],\n payload: FieldGroupReducerPayload\n ): FieldGroupListItemProps[] => {\n switch (payload.action) {\n case 'add':\n return [\n ...items,\n {\n name: `${groupMeta.label} ${items.length + 1}`,\n id: createUID(),\n children: groupMeta.fields.map(props => <FieldRenderer {...props} key={props.label} />)\n }\n ];\n\n case 'delete':\n return items\n .filter(group => group.id !== payload.id)\n .map((group, i) => ({ ...group, name: `${groupMeta.label} ${i + 1}` }));\n\n default:\n return items;\n }\n };\n\nexport const DemoFieldRenderer = ({ label, type }: FieldMeta) => {\n if (type === 'text') {\n return <Input label={label} />;\n }\n\n return null;\n};\n\nexport const demoGroupMeta: GroupMeta = {\n label: 'Applicant',\n fields: [\n {\n type: 'text',\n label: 'Applicant name'\n }\n ]\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FieldGroupList.stories.d.ts","sourceRoot":"","sources":["../../../src/core/FieldGroup/FieldGroupList.stories.tsx"],"names":[],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"FieldGroupList.stories.d.ts","sourceRoot":"","sources":["../../../src/core/FieldGroup/FieldGroupList.stories.tsx"],"names":[],"mappings":";;;;;AAyBA,wBAGE;AAiDF,eAAO,MAAM,YAAY,mBAiDxB,CAAC;AAiCF,eAAO,MAAM,aAAa,mBAkDzB,CAAC;AAEF,eAAO,MAAM,kBAAkB,mBAwB9B,CAAC"}
|
|
@@ -1,29 +1,11 @@
|
|
|
1
1
|
import { useReducer } from 'react';
|
|
2
2
|
import { action } from '@storybook/addon-actions';
|
|
3
3
|
import { Button, createUID, DateInput, FieldGroupList, FileInput, Form, Input, Select, Option, Text, TextArea } from '@pega/cosmos-react-core';
|
|
4
|
+
import { DemoFieldRenderer, demoGroupMeta, fieldGroupReducer } from './FieldGroupList.mocks';
|
|
4
5
|
export default {
|
|
5
6
|
title: 'Core/FieldGroupList',
|
|
6
7
|
component: FieldGroupList
|
|
7
8
|
};
|
|
8
|
-
const fieldGroupReducer = (groupMeta, FieldRenderer) => (items, payload) => {
|
|
9
|
-
switch (payload.action) {
|
|
10
|
-
case 'add':
|
|
11
|
-
return [
|
|
12
|
-
...items,
|
|
13
|
-
{
|
|
14
|
-
name: `${groupMeta.label} ${items.length + 1}`,
|
|
15
|
-
id: createUID(),
|
|
16
|
-
children: groupMeta.fields.map(props => <FieldRenderer {...props} key={props.label}/>)
|
|
17
|
-
}
|
|
18
|
-
];
|
|
19
|
-
case 'delete':
|
|
20
|
-
return items
|
|
21
|
-
.filter(group => group.id !== payload.id)
|
|
22
|
-
.map((group, i) => ({ ...group, name: `${groupMeta.label} ${i + 1}` }));
|
|
23
|
-
default:
|
|
24
|
-
return items;
|
|
25
|
-
}
|
|
26
|
-
};
|
|
27
9
|
const ExpensesFieldRenderer = ({ label, type }) => {
|
|
28
10
|
if (type === 'text') {
|
|
29
11
|
return <Input label={label}/>;
|
|
@@ -151,21 +133,6 @@ export const InsuranceDemo = () => {
|
|
|
151
133
|
}}/>
|
|
152
134
|
</Form>);
|
|
153
135
|
};
|
|
154
|
-
const DemoFieldRenderer = ({ label, type }) => {
|
|
155
|
-
if (type === 'text') {
|
|
156
|
-
return <Input label={label}/>;
|
|
157
|
-
}
|
|
158
|
-
return null;
|
|
159
|
-
};
|
|
160
|
-
const demoGroupMeta = {
|
|
161
|
-
label: 'Applicant',
|
|
162
|
-
fields: [
|
|
163
|
-
{
|
|
164
|
-
type: 'text',
|
|
165
|
-
label: 'Applicant name'
|
|
166
|
-
}
|
|
167
|
-
]
|
|
168
|
-
};
|
|
169
136
|
export const FieldGroupListDemo = () => {
|
|
170
137
|
const [state, dispatch] = useReducer(fieldGroupReducer(demoGroupMeta, DemoFieldRenderer), undefined, () => [
|
|
171
138
|
{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FieldGroupList.stories.jsx","sourceRoot":"","sources":["../../../src/core/FieldGroup/FieldGroupList.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAyB,MAAM,OAAO,CAAC;AAC1D,OAAO,EAAE,MAAM,EAAE,MAA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,IAAI,EAAE,MAAM;YACZ,KAAK,EAAE,gBAAgB;SACxB;KACF;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,kBAAkB,GAAG,GAAG,EAAE;IACrC,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,UAAU,CAClC,iBAAiB,CAAC,aAAa,EAAE,iBAAiB,CAAC,EACnD,SAAS,EACT,GAAG,EAAE,CAAC;QACJ;YACE,IAAI,EAAE,GAAG,aAAa,CAAC,KAAK,IAAI;YAChC,EAAE,EAAE,SAAS,EAAE;YACf,QAAQ,EAAE,aAAa,CAAC,MAAM,CAAC,GAAG,CAAC,iBAAiB,CAAC;SACtD;KACF,CACF,CAAC;IAEF,OAAO,CACL,CAAC,cAAc,CACb,KAAK,CAAC,CAAC,KAAK,CAAC,CACb,KAAK,CAAC,CAAC,GAAG,EAAE;YACV,QAAQ,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC;QAC9B,CAAC,CAAC,CACF,QAAQ,CAAC,CAAC,EAAE,CAAC,EAAE;YACb,QAAQ,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC,CAAC;QACrC,CAAC,CAAC,EACF,CACH,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import { useReducer, MouseEvent, FormEvent } from 'react';\nimport { action } from '@storybook/addon-actions';\n\nimport {\n Button,\n createUID,\n DateInput,\n FieldGroupList,\n FieldGroupListItemProps,\n FileInput,\n Form,\n Input,\n Select,\n Option,\n Text,\n TextArea\n} from '@pega/cosmos-react-core';\n\nexport default {\n title: 'Core/FieldGroupList',\n component: FieldGroupList\n};\n\ntype FieldGroupReducerPayload =\n | {\n action: 'add';\n }\n | {\n action: 'delete';\n id: string;\n };\n\ninterface FieldMeta {\n label: string;\n type: 'text' | 'date' | 'file' | 'select' | 'textarea';\n}\n\ninterface GroupMeta {\n label: string;\n fields: FieldMeta[];\n}\n\nconst fieldGroupReducer =\n (groupMeta: GroupMeta, FieldRenderer: (props: FieldMeta) => JSX.Element | null) =>\n (\n items: FieldGroupListItemProps[],\n payload: FieldGroupReducerPayload\n ): FieldGroupListItemProps[] => {\n switch (payload.action) {\n case 'add':\n return [\n ...items,\n {\n name: `${groupMeta.label} ${items.length + 1}`,\n id: createUID(),\n children: groupMeta.fields.map(props => <FieldRenderer {...props} key={props.label} />)\n }\n ];\n\n case 'delete':\n return items\n .filter(group => group.id !== payload.id)\n .map((group, i) => ({ ...group, name: `${groupMeta.label} ${i + 1}` }));\n\n default:\n return items;\n }\n };\n\nconst ExpensesFieldRenderer = ({ label, type }: FieldMeta) => {\n if (type === 'text') {\n return <Input label={label} />;\n }\n if (type === 'select') {\n return (\n <Select label={label}>\n <Option>Select</Option>\n <Option>Advertising</Option>\n <Option>Car and truck expenses</Option>\n <Option>Commissions and fees</Option>\n <Option>Contract labor</Option>\n <Option>Legal and professional services</Option>\n <Option>Office expense</Option>\n <Option>Rent or lease</Option>\n <Option>Vehicles, machinery, and equipment</Option>\n <Option>Repairs and maintenance</Option>\n <Option>Travel and meals</Option>\n <Option>Deductible meals</Option>\n <Option>Utilities</Option>\n <Option>Other</Option>\n </Select>\n );\n }\n if (type === 'file') {\n return <FileInput label={label} multiple />;\n }\n if (type === 'textarea') {\n return <TextArea label={label} />;\n }\n if (type === 'date') {\n return <DateInput label={label} />;\n }\n\n return null;\n};\n\nconst expensesGroupMeta: GroupMeta = {\n label: 'Expense',\n fields: [\n { type: 'select', label: 'Type of expense' },\n { type: 'date', label: 'Date of expense' },\n { type: 'file', label: 'Receipts' },\n { type: 'textarea', label: 'Notes' }\n ]\n};\n\nexport const ExpensesDemo = () => {\n const [state, dispatch] = useReducer(\n fieldGroupReducer(expensesGroupMeta, ExpensesFieldRenderer),\n undefined,\n () => [\n {\n name: `${expensesGroupMeta.label} 1`,\n id: createUID(),\n children: expensesGroupMeta.fields.map(ExpensesFieldRenderer)\n }\n ]\n );\n\n return (\n <Form\n actions={\n <>\n <Button\n name='Cancel'\n variant='secondary'\n onClick={(e: MouseEvent<HTMLButtonElement>) => {\n action('Click')(`${e.currentTarget.name}:${e.type}`);\n }}\n >\n Cancel\n </Button>\n <Button name='Submit' type='submit' variant='primary'>\n Submit\n </Button>\n </>\n }\n onSubmit={(e: FormEvent) => {\n e.preventDefault();\n action('Submit')(`Form:${e.type}`);\n }}\n style={{ margin: 'auto', maxWidth: '37.5rem' }}\n >\n <Text variant='h2'>Expense report</Text>\n <FieldGroupList\n items={state}\n onAdd={() => {\n dispatch({ action: 'add' });\n }}\n onDelete={id => {\n dispatch({ action: 'delete', id });\n }}\n />\n </Form>\n );\n};\n\nconst InsuranceFieldRenderer = ({ label, type }: FieldMeta) => {\n if (type === 'text') {\n return <Input label={label} />;\n }\n if (type === 'select') {\n return (\n <Select label={label}>\n <Option>Select</Option>\n <Option>Mother</Option>\n <Option>Father</Option>\n <Option>Guardian</Option>\n <Option>Child</Option>\n <Option>Spouse</Option>\n <Option>Sibling</Option>\n <Option>Other</Option>\n </Select>\n );\n }\n\n return null;\n};\n\nconst insuranceGroupMeta: GroupMeta = {\n label: 'Entry',\n fields: [\n { type: 'text', label: 'First name' },\n { type: 'text', label: 'Last name' },\n { type: 'select', label: 'Relationship' }\n ]\n};\n\nexport const InsuranceDemo = () => {\n const [state, dispatch] = useReducer(\n fieldGroupReducer(insuranceGroupMeta, InsuranceFieldRenderer),\n undefined,\n () => [\n {\n name: `${insuranceGroupMeta.label} 1`,\n id: createUID(),\n children: insuranceGroupMeta.fields.map(InsuranceFieldRenderer)\n }\n ]\n );\n\n return (\n <Form\n actions={\n <>\n <Button\n name='Cancel'\n variant='secondary'\n onClick={(e: MouseEvent<HTMLButtonElement>) => {\n action('Click')(`${e.currentTarget.name}:${e.type}`);\n }}\n >\n Cancel\n </Button>\n <Button name='Submit' type='submit' variant='primary'>\n Submit\n </Button>\n </>\n }\n onSubmit={(e: FormEvent) => {\n e.preventDefault();\n action('Submit')(`Form:${e.type}`);\n }}\n style={{ margin: 'auto', maxWidth: '37.5rem' }}\n >\n <Text variant='h1'>Insurance step 1</Text>\n <Text variant='h2'>Dependants</Text>\n <FieldGroupList\n items={state}\n onAdd={() => {\n dispatch({ action: 'add' });\n }}\n onDelete={id => {\n dispatch({ action: 'delete', id });\n }}\n />\n </Form>\n );\n};\n\nconst DemoFieldRenderer = ({ label, type }: FieldMeta) => {\n if (type === 'text') {\n return <Input label={label} />;\n }\n\n return null;\n};\n\nconst demoGroupMeta: GroupMeta = {\n label: 'Applicant',\n fields: [\n {\n type: 'text',\n label: 'Applicant name'\n }\n ]\n};\n\nexport const FieldGroupListDemo = () => {\n const [state, dispatch] = useReducer(\n fieldGroupReducer(demoGroupMeta, DemoFieldRenderer),\n undefined,\n () => [\n {\n name: `${demoGroupMeta.label} 1`,\n id: createUID(),\n children: demoGroupMeta.fields.map(DemoFieldRenderer)\n }\n ]\n );\n\n return (\n <FieldGroupList\n items={state}\n onAdd={() => {\n dispatch({ action: 'add' });\n }}\n onDelete={id => {\n dispatch({ action: 'delete', id });\n }}\n />\n );\n};\n"]}
|
|
1
|
+
{"version":3,"file":"FieldGroupList.stories.jsx","sourceRoot":"","sources":["../../../src/core/FieldGroup/FieldGroupList.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAyB,MAAM,OAAO,CAAC;AAC1D,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAElD,OAAO,EACL,MAAM,EACN,SAAS,EACT,SAAS,EACT,cAAc,EACd,SAAS,EACT,IAAI,EACJ,KAAK,EACL,MAAM,EACN,MAAM,EACN,IAAI,EACJ,QAAQ,EACT,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EACL,iBAAiB,EACjB,aAAa,EACb,iBAAiB,EAGlB,MAAM,wBAAwB,CAAC;AAEhC,eAAe;IACb,KAAK,EAAE,qBAAqB;IAC5B,SAAS,EAAE,cAAc;CAC1B,CAAC;AAEF,MAAM,qBAAqB,GAAG,CAAC,EAAE,KAAK,EAAE,IAAI,EAAa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S,EAAE;YACf,QAAQ,EAAE,aAAa,CAAC,MAAM,CAAC,GAAG,CAAC,iBAAiB,CAAC;SACtD;KACF,CACF,CAAC;IAEF,OAAO,CACL,CAAC,cAAc,CACb,KAAK,CAAC,CAAC,KAAK,CAAC,CACb,KAAK,CAAC,CAAC,GAAG,EAAE;YACV,QAAQ,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC;QAC9B,CAAC,CAAC,CACF,QAAQ,CAAC,CAAC,EAAE,CAAC,EAAE;YACb,QAAQ,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC,CAAC;QACrC,CAAC,CAAC,EACF,CACH,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import { useReducer, MouseEvent, FormEvent } from 'react';\nimport { action } from '@storybook/addon-actions';\n\nimport {\n Button,\n createUID,\n DateInput,\n FieldGroupList,\n FileInput,\n Form,\n Input,\n Select,\n Option,\n Text,\n TextArea\n} from '@pega/cosmos-react-core';\n\nimport {\n DemoFieldRenderer,\n demoGroupMeta,\n fieldGroupReducer,\n FieldMeta,\n GroupMeta\n} from './FieldGroupList.mocks';\n\nexport default {\n title: 'Core/FieldGroupList',\n component: FieldGroupList\n};\n\nconst ExpensesFieldRenderer = ({ label, type }: FieldMeta) => {\n if (type === 'text') {\n return <Input label={label} />;\n }\n if (type === 'select') {\n return (\n <Select label={label}>\n <Option>Select</Option>\n <Option>Advertising</Option>\n <Option>Car and truck expenses</Option>\n <Option>Commissions and fees</Option>\n <Option>Contract labor</Option>\n <Option>Legal and professional services</Option>\n <Option>Office expense</Option>\n <Option>Rent or lease</Option>\n <Option>Vehicles, machinery, and equipment</Option>\n <Option>Repairs and maintenance</Option>\n <Option>Travel and meals</Option>\n <Option>Deductible meals</Option>\n <Option>Utilities</Option>\n <Option>Other</Option>\n </Select>\n );\n }\n if (type === 'file') {\n return <FileInput label={label} multiple />;\n }\n if (type === 'textarea') {\n return <TextArea label={label} />;\n }\n if (type === 'date') {\n return <DateInput label={label} />;\n }\n\n return null;\n};\n\nconst expensesGroupMeta: GroupMeta = {\n label: 'Expense',\n fields: [\n { type: 'select', label: 'Type of expense' },\n { type: 'date', label: 'Date of expense' },\n { type: 'file', label: 'Receipts' },\n { type: 'textarea', label: 'Notes' }\n ]\n};\n\nexport const ExpensesDemo = () => {\n const [state, dispatch] = useReducer(\n fieldGroupReducer(expensesGroupMeta, ExpensesFieldRenderer),\n undefined,\n () => [\n {\n name: `${expensesGroupMeta.label} 1`,\n id: createUID(),\n children: expensesGroupMeta.fields.map(ExpensesFieldRenderer)\n }\n ]\n );\n\n return (\n <Form\n actions={\n <>\n <Button\n name='Cancel'\n variant='secondary'\n onClick={(e: MouseEvent<HTMLButtonElement>) => {\n action('Click')(`${e.currentTarget.name}:${e.type}`);\n }}\n >\n Cancel\n </Button>\n <Button name='Submit' type='submit' variant='primary'>\n Submit\n </Button>\n </>\n }\n onSubmit={(e: FormEvent) => {\n e.preventDefault();\n action('Submit')(`Form:${e.type}`);\n }}\n style={{ margin: 'auto', maxWidth: '37.5rem' }}\n >\n <Text variant='h2'>Expense report</Text>\n <FieldGroupList\n items={state}\n onAdd={() => {\n dispatch({ action: 'add' });\n }}\n onDelete={id => {\n dispatch({ action: 'delete', id });\n }}\n />\n </Form>\n );\n};\n\nconst InsuranceFieldRenderer = ({ label, type }: FieldMeta) => {\n if (type === 'text') {\n return <Input label={label} />;\n }\n if (type === 'select') {\n return (\n <Select label={label}>\n <Option>Select</Option>\n <Option>Mother</Option>\n <Option>Father</Option>\n <Option>Guardian</Option>\n <Option>Child</Option>\n <Option>Spouse</Option>\n <Option>Sibling</Option>\n <Option>Other</Option>\n </Select>\n );\n }\n\n return null;\n};\n\nconst insuranceGroupMeta: GroupMeta = {\n label: 'Entry',\n fields: [\n { type: 'text', label: 'First name' },\n { type: 'text', label: 'Last name' },\n { type: 'select', label: 'Relationship' }\n ]\n};\n\nexport const InsuranceDemo = () => {\n const [state, dispatch] = useReducer(\n fieldGroupReducer(insuranceGroupMeta, InsuranceFieldRenderer),\n undefined,\n () => [\n {\n name: `${insuranceGroupMeta.label} 1`,\n id: createUID(),\n children: insuranceGroupMeta.fields.map(InsuranceFieldRenderer)\n }\n ]\n );\n\n return (\n <Form\n actions={\n <>\n <Button\n name='Cancel'\n variant='secondary'\n onClick={(e: MouseEvent<HTMLButtonElement>) => {\n action('Click')(`${e.currentTarget.name}:${e.type}`);\n }}\n >\n Cancel\n </Button>\n <Button name='Submit' type='submit' variant='primary'>\n Submit\n </Button>\n </>\n }\n onSubmit={(e: FormEvent) => {\n e.preventDefault();\n action('Submit')(`Form:${e.type}`);\n }}\n style={{ margin: 'auto', maxWidth: '37.5rem' }}\n >\n <Text variant='h1'>Insurance step 1</Text>\n <Text variant='h2'>Dependants</Text>\n <FieldGroupList\n items={state}\n onAdd={() => {\n dispatch({ action: 'add' });\n }}\n onDelete={id => {\n dispatch({ action: 'delete', id });\n }}\n />\n </Form>\n );\n};\n\nexport const FieldGroupListDemo = () => {\n const [state, dispatch] = useReducer(\n fieldGroupReducer(demoGroupMeta, DemoFieldRenderer),\n undefined,\n () => [\n {\n name: `${demoGroupMeta.label} 1`,\n id: createUID(),\n children: demoGroupMeta.fields.map(DemoFieldRenderer)\n }\n ]\n );\n\n return (\n <FieldGroupList\n items={state}\n onAdd={() => {\n dispatch({ action: 'add' });\n }}\n onDelete={id => {\n dispatch({ action: 'delete', id });\n }}\n />\n );\n};\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Meta, Story } from '@storybook/react';
|
|
2
|
-
import { FileDisplayProps } from '@pega/cosmos-react-core';
|
|
2
|
+
import { FileDisplayProps, FileUploadItemProps } from '@pega/cosmos-react-core';
|
|
3
3
|
declare const _default: Meta<import("@storybook/react").Args>;
|
|
4
4
|
export default _default;
|
|
5
5
|
interface FileDisplayDemoProps {
|
|
@@ -10,4 +10,11 @@ interface FileDisplayDemoProps {
|
|
|
10
10
|
}
|
|
11
11
|
export declare const FileDisplayTypes: Story<FileDisplayDemoProps>;
|
|
12
12
|
export declare const FileDisplayDemo: Story<FileDisplayProps & FileDisplayDemoProps>;
|
|
13
|
+
interface FileUploadItemDemoProps extends FileDisplayDemoProps {
|
|
14
|
+
name: FileUploadItemProps['name'];
|
|
15
|
+
meta?: FileUploadItemProps['meta'];
|
|
16
|
+
error?: FileUploadItemProps['error'];
|
|
17
|
+
progress?: FileUploadItemProps['progress'];
|
|
18
|
+
}
|
|
19
|
+
export declare const FileUploadItemDemo: Story<FileUploadItemDemoProps>;
|
|
13
20
|
//# sourceMappingURL=FileDisplay.stories.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FileDisplay.stories.d.ts","sourceRoot":"","sources":["../../../src/core/File/FileDisplay.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAG/C,OAAO,EAEL,gBAAgB,
|
|
1
|
+
{"version":3,"file":"FileDisplay.stories.d.ts","sourceRoot":"","sources":["../../../src/core/File/FileDisplay.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAG/C,OAAO,EAEL,gBAAgB,EAQhB,mBAAmB,EAEpB,MAAM,yBAAyB,CAAC;;AAEjC,wBAaU;AAEV,UAAU,oBAAoB;IAC5B,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB;AAED,eAAO,MAAM,gBAAgB,EAAE,KAAK,CAAC,oBAAoB,CAmGxD,CAAC;AAUF,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,gBAAgB,GAAG,oBAAoB,CAsC1E,CAAC;AAYF,UAAU,uBAAwB,SAAQ,oBAAoB;IAC5D,IAAI,EAAE,mBAAmB,CAAC,MAAM,CAAC,CAAC;IAClC,IAAI,CAAC,EAAE,mBAAmB,CAAC,MAAM,CAAC,CAAC;IACnC,KAAK,CAAC,EAAE,mBAAmB,CAAC,OAAO,CAAC,CAAC;IACrC,QAAQ,CAAC,EAAE,mBAAmB,CAAC,UAAU,CAAC,CAAC;CAC5C;AAED,eAAO,MAAM,kBAAkB,EAAE,KAAK,CAAC,uBAAuB,CAwC7D,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useContext, useState } from 'react';
|
|
2
|
-
import { FileDisplay, FieldValueList, Image, Popover, ToasterContext, useElement, useOuterEvent } from '@pega/cosmos-react-core';
|
|
2
|
+
import { FileDisplay, FieldValueList, Image, Popover, ToasterContext, useElement, useOuterEvent, FileUploadItem } from '@pega/cosmos-react-core';
|
|
3
3
|
export default {
|
|
4
4
|
title: 'Core/File/Display',
|
|
5
5
|
component: FileDisplay,
|
|
@@ -84,7 +84,7 @@ export const FileDisplayDemo = (args) => {
|
|
|
84
84
|
: undefined;
|
|
85
85
|
return (<>
|
|
86
86
|
<FileDisplay ref={setButtonEl} variant={args.variant} displayText={args.displayText} value={args.withValue ? imageSrc : undefined} onPreview={handlePreview} onDownload={handleDownload}/>
|
|
87
|
-
<Popover ref={setPopoverEl} show={showPreview} target={buttonEl}
|
|
87
|
+
<Popover ref={setPopoverEl} show={showPreview} target={buttonEl}>
|
|
88
88
|
<Image src={imageSrc} alt={args.displayText || 'Pega World iNspire'}/>
|
|
89
89
|
</Popover>
|
|
90
90
|
</>);
|
|
@@ -97,4 +97,39 @@ FileDisplayDemo.argTypes = {
|
|
|
97
97
|
variant: { options: ['file', 'text', 'link'], control: { type: 'radio' } },
|
|
98
98
|
displayText: { control: { type: 'text' } }
|
|
99
99
|
};
|
|
100
|
+
export const FileUploadItemDemo = (args) => {
|
|
101
|
+
const [fileEl, setFileEl] = useElement();
|
|
102
|
+
const [popoverEl, setPopoverEl] = useElement();
|
|
103
|
+
const [showPreview, setShowPreview] = useState(false);
|
|
104
|
+
useOuterEvent('click', [fileEl, popoverEl], () => setShowPreview(false));
|
|
105
|
+
const imageSrc = 'https://www.pega.com/sites/default/files/styles/480/public/media/images/2021-02/pwi-2021-prevcard.jpg';
|
|
106
|
+
const handlePreview = args.withPreview ? () => setShowPreview(true) : undefined;
|
|
107
|
+
const handleDownload = args.withDownload
|
|
108
|
+
? () => {
|
|
109
|
+
const element = document.createElement('a');
|
|
110
|
+
element.href = imageSrc;
|
|
111
|
+
element.download = 'cosmos_file_display_download.jpg';
|
|
112
|
+
element.click();
|
|
113
|
+
}
|
|
114
|
+
: undefined;
|
|
115
|
+
return (<>
|
|
116
|
+
<FileUploadItem ref={setFileEl} name={args.name} meta={args.meta} error={args.error} progress={args.progress} thumbnail={imageSrc} onPreview={handlePreview} onDownload={handleDownload}/>
|
|
117
|
+
<Popover ref={setPopoverEl} show={showPreview} target={fileEl} strategy='fixed'>
|
|
118
|
+
<Image src={imageSrc} alt={args.name}/>
|
|
119
|
+
</Popover>
|
|
120
|
+
</>);
|
|
121
|
+
};
|
|
122
|
+
FileUploadItemDemo.args = {
|
|
123
|
+
name: 'Pega World iNspire',
|
|
124
|
+
meta: 'Some additional information',
|
|
125
|
+
error: false,
|
|
126
|
+
progress: 100
|
|
127
|
+
};
|
|
128
|
+
FileUploadItemDemo.argTypes = {
|
|
129
|
+
withValue: { table: { disable: true } },
|
|
130
|
+
name: { control: { type: 'text' } },
|
|
131
|
+
meta: { control: { type: 'text' } },
|
|
132
|
+
error: { control: { type: 'boolean' } },
|
|
133
|
+
progress: { control: { type: 'number' } }
|
|
134
|
+
};
|
|
100
135
|
//# sourceMappingURL=FileDisplay.stories.jsx.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FileDisplay.stories.jsx","sourceRoot":"","sources":["../../../src/core/File/FileDisplay.stories.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE7C,OAAO,E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WAAW,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,CAC9B,KAAK,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,CAC7C,SAAS,CAAC,CAAC,aAAa,CAAC,CACzB,UAAU,CAAC,CAAC,cAAc,CAAC,EAE7B;MAAA,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,YAAY,CAAC,CAAC,IAAI,CAAC,CAAC,WAAW,CAAC,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,CAAC,QAAQ,CAAC,OAAO,CAC/E;QAAA,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,WAAW,IAAI,oBAAoB,CAAC,EACtE;MAAA,EAAE,OAAO,CACX;IAAA,GAAG,CACJ,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,CAAC,IAAI,GAAG;IACrB,OAAO,EAAE,MAAM;IACf,WAAW,EAAE,oBAAoB;CAClC,CAAC;AAEF,eAAe,CAAC,QAAQ,GAAG;IACzB,OAAO,EAAE,EAAE,OAAO,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE;IAC1E,WAAW,EAAE,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE;CAC3C,CAAC","sourcesContent":["import { Meta, Story } from '@storybook/react';\nimport { useContext, useState } from 'react';\n\nimport {\n FileDisplay,\n FileDisplayProps,\n FileItemProps,\n FieldValueList,\n Image,\n Popover,\n ToasterContext,\n useElement,\n useOuterEvent\n} from '@pega/cosmos-react-core';\n\nexport default {\n title: 'Core/File/Display',\n component: FileDisplay,\n args: {\n withValue: true,\n withPreview: true,\n withDownload: true\n },\n argTypes: {\n withValue: { control: { type: 'boolean' } },\n withPreview: { control: { type: 'boolean' } },\n withDownload: { control: { type: 'boolean' } }\n }\n} as Meta;\n\ninterface FileDisplayDemoProps {\n withDisplayText?: boolean;\n withValue?: boolean;\n withPreview?: boolean;\n withDownload?: boolean;\n}\n\nexport const FileDisplayTypes: Story<FileDisplayDemoProps> = (args: FileDisplayDemoProps) => {\n const { push } = useContext(ToasterContext);\n\n const handlePreview = args.withPreview\n ? (url: FileItemProps['url']) => push({ content: `Previewed ${url}` })\n : undefined;\n\n const handleDownload = args.withDownload\n ? (url: FileItemProps['url']) => push({ content: `Downloaded ${url}` })\n : undefined;\n\n const fields = [\n {\n id: '1',\n name: 'Image file',\n value: (\n <FileDisplay\n displayText={args.withDisplayText ? 'image.jpg' : undefined}\n value={args.withValue ? 'https://pbs.twimg.com/media/ENNN5PAXkAE-hag.jpg' : undefined}\n onPreview={handlePreview}\n onDownload={handleDownload}\n />\n )\n },\n {\n id: '2',\n name: 'Video file',\n value: (\n <FileDisplay\n displayText={args.withDisplayText ? 'video.avi' : undefined}\n value={args.withValue ? 'https://pega.com/media/some-video.avi' : undefined}\n onPreview={handlePreview}\n onDownload={handleDownload}\n />\n )\n },\n {\n id: '3',\n name: 'Audio file',\n value: (\n <FileDisplay\n displayText={args.withDisplayText ? 'recording.mp3' : undefined}\n value={args.withValue ? 'https://pega.com/media/sprint-review-recording.mp3' : undefined}\n onPreview={handlePreview}\n onDownload={handleDownload}\n />\n )\n },\n {\n id: '4',\n name: 'Document file',\n value: (\n <FileDisplay\n displayText={args.withDisplayText ? 'document.doc' : undefined}\n value={args.withValue ? 'https://pega.com/media/document.doc' : undefined}\n onPreview={handlePreview}\n onDownload={handleDownload}\n />\n )\n },\n {\n id: '5',\n name: 'PDF file',\n value: (\n <FileDisplay\n displayText={args.withDisplayText ? 'invoice.pdf' : undefined}\n value={args.withValue ? 'https://pega.com/media/invoice.pdf' : undefined}\n onPreview={handlePreview}\n onDownload={handleDownload}\n />\n )\n },\n {\n id: '6',\n name: 'Presentation file',\n value: (\n <FileDisplay\n displayText={args.withDisplayText ? 'review.pps' : undefined}\n value={args.withValue ? 'https://pega.com/media/review.pps' : undefined}\n onPreview={handlePreview}\n onDownload={handleDownload}\n />\n )\n },\n {\n id: '7',\n name: 'Spreadsheet file',\n value: (\n <FileDisplay\n displayText={args.withDisplayText ? 'welfare.xlsx' : undefined}\n value={args.withValue ? 'https://pega.com/media/welfare.xlsx' : undefined}\n onPreview={handlePreview}\n onDownload={handleDownload}\n />\n )\n }\n ];\n\n return <FieldValueList fields={fields} />;\n};\n\nFileDisplayTypes.args = {\n withDisplayText: true\n};\n\nFileDisplayTypes.argTypes = {\n withDisplayText: { control: { type: 'boolean' } }\n};\n\nexport const FileDisplayDemo: Story<FileDisplayProps & FileDisplayDemoProps> = (\n args: FileDisplayProps & FileDisplayDemoProps\n) => {\n const [buttonEl, setButtonEl] = useElement();\n const [popoverEl, setPopoverEl] = useElement();\n const [showPreview, setShowPreview] = useState(false);\n\n useOuterEvent('click', [buttonEl, popoverEl], () => setShowPreview(false));\n\n const imageSrc =\n 'https://www.pega.com/sites/default/files/styles/480/public/media/images/2021-02/pwi-2021-prevcard.jpg';\n\n const handlePreview = args.withPreview ? () => setShowPreview(true) : undefined;\n\n const handleDownload = args.withDownload\n ? () => {\n const element = document.createElement('a');\n element.href = imageSrc;\n element.download = 'cosmos_file_display_download.jpg';\n element.click();\n }\n : undefined;\n\n return (\n <>\n <FileDisplay\n ref={setButtonEl}\n variant={args.variant}\n displayText={args.displayText}\n value={args.withValue ? imageSrc : undefined}\n onPreview={handlePreview}\n onDownload={handleDownload}\n />\n <Popover ref={setPopoverEl} show={showPreview} target={buttonEl} strategy='fixed'>\n <Image src={imageSrc} alt={args.displayText || 'Pega World iNspire'} />\n </Popover>\n </>\n );\n};\n\nFileDisplayDemo.args = {\n variant: 'file',\n displayText: 'Pega World iNspire'\n};\n\nFileDisplayDemo.argTypes = {\n variant: { options: ['file', 'text', 'link'], control: { type: 'radio' } },\n displayText: { control: { type: 'text' } }\n};\n"]}
|
|
1
|
+
{"version":3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OAAO,CAC7E;QAAA,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EACvC;MAAA,EAAE,OAAO,CACX;IAAA,GAAG,CACJ,CAAC;AACJ,CAAC,CAAC;AAEF,kBAAkB,CAAC,IAAI,GAAG;IACxB,IAAI,EAAE,oBAAoB;IAC1B,IAAI,EAAE,6BAA6B;IACnC,KAAK,EAAE,KAAK;IACZ,QAAQ,EAAE,GAAG;CACd,CAAC;AAEF,kBAAkB,CAAC,QAAQ,GAAG;IAC5B,SAAS,EAAE,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE;IACvC,IAAI,EAAE,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE;IACnC,IAAI,EAAE,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE;IACnC,KAAK,EAAE,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE;IACvC,QAAQ,EAAE,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE;CAC1C,CAAC","sourcesContent":["import { Meta, Story } from '@storybook/react';\nimport { useContext, useState } from 'react';\n\nimport {\n FileDisplay,\n FileDisplayProps,\n FileItemProps,\n FieldValueList,\n Image,\n Popover,\n ToasterContext,\n useElement,\n useOuterEvent,\n FileUploadItemProps,\n FileUploadItem\n} from '@pega/cosmos-react-core';\n\nexport default {\n title: 'Core/File/Display',\n component: FileDisplay,\n args: {\n withValue: true,\n withPreview: true,\n withDownload: true\n },\n argTypes: {\n withValue: { control: { type: 'boolean' } },\n withPreview: { control: { type: 'boolean' } },\n withDownload: { control: { type: 'boolean' } }\n }\n} as Meta;\n\ninterface FileDisplayDemoProps {\n withDisplayText?: boolean;\n withValue?: boolean;\n withPreview?: boolean;\n withDownload?: boolean;\n}\n\nexport const FileDisplayTypes: Story<FileDisplayDemoProps> = (args: FileDisplayDemoProps) => {\n const { push } = useContext(ToasterContext);\n\n const handlePreview = args.withPreview\n ? (url: FileItemProps['url']) => push({ content: `Previewed ${url}` })\n : undefined;\n\n const handleDownload = args.withDownload\n ? (url: FileItemProps['url']) => push({ content: `Downloaded ${url}` })\n : undefined;\n\n const fields = [\n {\n id: '1',\n name: 'Image file',\n value: (\n <FileDisplay\n displayText={args.withDisplayText ? 'image.jpg' : undefined}\n value={args.withValue ? 'https://pbs.twimg.com/media/ENNN5PAXkAE-hag.jpg' : undefined}\n onPreview={handlePreview}\n onDownload={handleDownload}\n />\n )\n },\n {\n id: '2',\n name: 'Video file',\n value: (\n <FileDisplay\n displayText={args.withDisplayText ? 'video.avi' : undefined}\n value={args.withValue ? 'https://pega.com/media/some-video.avi' : undefined}\n onPreview={handlePreview}\n onDownload={handleDownload}\n />\n )\n },\n {\n id: '3',\n name: 'Audio file',\n value: (\n <FileDisplay\n displayText={args.withDisplayText ? 'recording.mp3' : undefined}\n value={args.withValue ? 'https://pega.com/media/sprint-review-recording.mp3' : undefined}\n onPreview={handlePreview}\n onDownload={handleDownload}\n />\n )\n },\n {\n id: '4',\n name: 'Document file',\n value: (\n <FileDisplay\n displayText={args.withDisplayText ? 'document.doc' : undefined}\n value={args.withValue ? 'https://pega.com/media/document.doc' : undefined}\n onPreview={handlePreview}\n onDownload={handleDownload}\n />\n )\n },\n {\n id: '5',\n name: 'PDF file',\n value: (\n <FileDisplay\n displayText={args.withDisplayText ? 'invoice.pdf' : undefined}\n value={args.withValue ? 'https://pega.com/media/invoice.pdf' : undefined}\n onPreview={handlePreview}\n onDownload={handleDownload}\n />\n )\n },\n {\n id: '6',\n name: 'Presentation file',\n value: (\n <FileDisplay\n displayText={args.withDisplayText ? 'review.pps' : undefined}\n value={args.withValue ? 'https://pega.com/media/review.pps' : undefined}\n onPreview={handlePreview}\n onDownload={handleDownload}\n />\n )\n },\n {\n id: '7',\n name: 'Spreadsheet file',\n value: (\n <FileDisplay\n displayText={args.withDisplayText ? 'welfare.xlsx' : undefined}\n value={args.withValue ? 'https://pega.com/media/welfare.xlsx' : undefined}\n onPreview={handlePreview}\n onDownload={handleDownload}\n />\n )\n }\n ];\n\n return <FieldValueList fields={fields} />;\n};\n\nFileDisplayTypes.args = {\n withDisplayText: true\n};\n\nFileDisplayTypes.argTypes = {\n withDisplayText: { control: { type: 'boolean' } }\n};\n\nexport const FileDisplayDemo: Story<FileDisplayProps & FileDisplayDemoProps> = (\n args: FileDisplayProps & FileDisplayDemoProps\n) => {\n const [buttonEl, setButtonEl] = useElement();\n const [popoverEl, setPopoverEl] = useElement();\n const [showPreview, setShowPreview] = useState(false);\n\n useOuterEvent('click', [buttonEl, popoverEl], () => setShowPreview(false));\n\n const imageSrc =\n 'https://www.pega.com/sites/default/files/styles/480/public/media/images/2021-02/pwi-2021-prevcard.jpg';\n\n const handlePreview = args.withPreview ? () => setShowPreview(true) : undefined;\n\n const handleDownload = args.withDownload\n ? () => {\n const element = document.createElement('a');\n element.href = imageSrc;\n element.download = 'cosmos_file_display_download.jpg';\n element.click();\n }\n : undefined;\n\n return (\n <>\n <FileDisplay\n ref={setButtonEl}\n variant={args.variant}\n displayText={args.displayText}\n value={args.withValue ? imageSrc : undefined}\n onPreview={handlePreview}\n onDownload={handleDownload}\n />\n <Popover ref={setPopoverEl} show={showPreview} target={buttonEl}>\n <Image src={imageSrc} alt={args.displayText || 'Pega World iNspire'} />\n </Popover>\n </>\n );\n};\n\nFileDisplayDemo.args = {\n variant: 'file',\n displayText: 'Pega World iNspire'\n};\n\nFileDisplayDemo.argTypes = {\n variant: { options: ['file', 'text', 'link'], control: { type: 'radio' } },\n displayText: { control: { type: 'text' } }\n};\n\ninterface FileUploadItemDemoProps extends FileDisplayDemoProps {\n name: FileUploadItemProps['name'];\n meta?: FileUploadItemProps['meta'];\n error?: FileUploadItemProps['error'];\n progress?: FileUploadItemProps['progress'];\n}\n\nexport const FileUploadItemDemo: Story<FileUploadItemDemoProps> = (\n args: FileUploadItemDemoProps\n) => {\n const [fileEl, setFileEl] = useElement();\n const [popoverEl, setPopoverEl] = useElement();\n const [showPreview, setShowPreview] = useState(false);\n\n useOuterEvent('click', [fileEl, popoverEl], () => setShowPreview(false));\n\n const imageSrc =\n 'https://www.pega.com/sites/default/files/styles/480/public/media/images/2021-02/pwi-2021-prevcard.jpg';\n\n const handlePreview = args.withPreview ? () => setShowPreview(true) : undefined;\n\n const handleDownload = args.withDownload\n ? () => {\n const element = document.createElement('a');\n element.href = imageSrc;\n element.download = 'cosmos_file_display_download.jpg';\n element.click();\n }\n : undefined;\n\n return (\n <>\n <FileUploadItem\n ref={setFileEl}\n name={args.name}\n meta={args.meta}\n error={args.error}\n progress={args.progress}\n thumbnail={imageSrc}\n onPreview={handlePreview}\n onDownload={handleDownload}\n />\n <Popover ref={setPopoverEl} show={showPreview} target={fileEl} strategy='fixed'>\n <Image src={imageSrc} alt={args.name} />\n </Popover>\n </>\n );\n};\n\nFileUploadItemDemo.args = {\n name: 'Pega World iNspire',\n meta: 'Some additional information',\n error: false,\n progress: 100\n};\n\nFileUploadItemDemo.argTypes = {\n withValue: { table: { disable: true } },\n name: { control: { type: 'text' } },\n meta: { control: { type: 'text' } },\n error: { control: { type: 'boolean' } },\n progress: { control: { type: 'number' } }\n};\n"]}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export declare const
|
|
1
|
+
export declare const StyledFlexContainer: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {
|
|
2
2
|
height?: number | undefined;
|
|
3
3
|
width?: number | undefined;
|
|
4
4
|
}, never>;
|
|
5
|
-
export declare const
|
|
5
|
+
export declare const StyledFlexItem: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {
|
|
6
6
|
inActive?: boolean | undefined;
|
|
7
7
|
noPadding?: boolean | undefined;
|
|
8
8
|
width?: number | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Flex.styles.d.ts","sourceRoot":"","sources":["../../../src/core/Flex/Flex.styles.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,
|
|
1
|
+
{"version":3,"file":"Flex.styles.d.ts","sourceRoot":"","sources":["../../../src/core/Flex/Flex.styles.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,mBAAmB;;;SAiB/B,CAAC;AAIF,eAAO,MAAM,cAAc;;;;SAwBzB,CAAC"}
|