@pareto-engineering/design-system 2.0.0-alpha.5 → 2.0.0-alpha.52
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/.env.scripts.example +4 -0
- package/.eslintrc.js +25 -1
- package/babel.config.js +1 -0
- package/dist/cjs/a/BackgroundGradient/BackgroundGradient.js +77 -0
- package/dist/cjs/a/BackgroundGradient/index.js +15 -0
- package/dist/cjs/a/BackgroundGradient/styles.scss +16 -0
- package/dist/cjs/a/ContentTree/ContentTree.js +83 -0
- package/dist/cjs/a/ContentTree/common/Tree/Tree.js +116 -0
- package/dist/cjs/a/ContentTree/common/Tree/index.js +15 -0
- package/dist/cjs/a/ContentTree/common/index.js +31 -0
- package/dist/cjs/a/ContentTree/common/useContentTree.js +82 -0
- package/dist/cjs/a/ContentTree/common/useFirstVisibleNode.js +65 -0
- package/dist/cjs/a/ContentTree/index.js +15 -0
- package/dist/cjs/a/ContentTree/styles.scss +33 -0
- package/dist/cjs/a/Conversation/Conversation.js +14 -8
- package/dist/cjs/a/Conversation/common/Message/Message.js +32 -6
- package/dist/cjs/a/Conversation/styles.scss +132 -33
- package/dist/cjs/a/OvalIllustration/OvalIllustration.js +133 -0
- package/dist/cjs/a/OvalIllustration/index.js +15 -0
- package/dist/cjs/a/OvalIllustration/styles.scss +102 -0
- package/dist/cjs/a/Popover/Popover.js +134 -0
- package/dist/cjs/a/Popover/common/Divider/Divider.js +67 -0
- package/dist/cjs/a/Popover/common/Divider/index.js +15 -0
- package/dist/cjs/a/Popover/common/Item/Item.js +67 -0
- package/dist/cjs/a/Popover/common/Item/index.js +15 -0
- package/dist/cjs/a/Popover/common/index.js +21 -0
- package/dist/cjs/a/Popover/index.js +15 -0
- package/dist/cjs/a/Popover/styles.scss +33 -0
- package/dist/cjs/a/Shapes/Shapes.js +39 -9
- package/dist/cjs/a/Shapes/styles.scss +79 -23
- package/dist/cjs/a/SnapScroller/SnapScroller.js +77 -0
- package/dist/cjs/a/SnapScroller/index.js +15 -0
- package/dist/cjs/a/SnapScroller/styles.scss +38 -0
- package/dist/cjs/a/index.js +41 -1
- package/dist/cjs/b/Button/Button.js +10 -4
- package/dist/cjs/b/Button/styles.scss +55 -10
- package/dist/cjs/b/Logo/Logo.js +41 -41
- package/dist/cjs/b/Logo/styles.scss +0 -138
- package/dist/cjs/b/Page/common/Section/Section.js +35 -7
- package/dist/cjs/c/ContentSlides/common/HorizontalMenu/HorizontalMenu.js +16 -9
- package/dist/cjs/c/ContentSlides/common/Navigator/Navigator.js +4 -3
- package/dist/cjs/c/ContentSlides/styles.scss +10 -4
- package/dist/cjs/c/SocialMediaShareButton/SocialMediaShareButton.js +111 -0
- package/dist/cjs/c/SocialMediaShareButton/index.js +15 -0
- package/dist/cjs/c/SocialMediaShareButton/styles.scss +39 -0
- package/dist/cjs/c/index.js +9 -1
- package/dist/cjs/f/FormInput/FormInput.js +20 -3
- package/dist/cjs/f/FormInput/styles.scss +11 -0
- package/dist/cjs/f/common/Debugger/Debugger.js +1 -1
- package/dist/cjs/f/common/Label/Label.js +1 -1
- package/dist/cjs/f/common/Label/styles.scss +1 -1
- package/dist/cjs/f/fields/ChoicesInput/ChoicesInput.js +1 -1
- package/dist/cjs/f/fields/ChoicesInput/styles.scss +17 -2
- package/dist/cjs/f/fields/QueryCombobox/QueryCombobox.js +236 -0
- package/dist/cjs/f/fields/QueryCombobox/common/Combobox/Combobox.js +205 -0
- package/dist/cjs/f/fields/QueryCombobox/common/Combobox/index.js +15 -0
- package/dist/cjs/f/fields/QueryCombobox/common/Menu/Menu.js +103 -0
- package/dist/cjs/f/fields/QueryCombobox/common/Menu/index.js +15 -0
- package/dist/cjs/f/fields/QueryCombobox/common/MultipleCombobox/MultipleCombobox.js +304 -0
- package/dist/cjs/f/fields/QueryCombobox/common/MultipleCombobox/index.js +15 -0
- package/dist/cjs/f/fields/QueryCombobox/common/index.js +29 -0
- package/dist/cjs/f/fields/QueryCombobox/index.js +15 -0
- package/dist/cjs/f/fields/QueryCombobox/styles.scss +90 -0
- package/dist/cjs/f/fields/QuerySelect/QuerySelect.js +201 -0
- package/dist/cjs/f/fields/QuerySelect/index.js +15 -0
- package/dist/cjs/f/fields/QuerySelect/styles.scss +21 -0
- package/dist/cjs/f/fields/RatingsInput/RatingsInput.js +39 -6
- package/dist/cjs/f/fields/RatingsInput/styles.scss +29 -20
- package/dist/cjs/f/fields/SelectInput/SelectInput.js +50 -13
- package/dist/cjs/f/fields/SelectInput/styles.scss +33 -13
- package/dist/cjs/f/fields/TaskRecommendationInput/TaskRecommendationInput.js +1 -1
- package/dist/cjs/f/fields/TextInput/TextInput.js +35 -7
- package/dist/cjs/f/fields/TextInput/styles.scss +16 -7
- package/dist/cjs/f/fields/TextareaInput/TextareaInput.js +15 -8
- package/dist/cjs/f/fields/TextareaInput/styles.scss +19 -6
- package/dist/cjs/f/fields/index.js +15 -23
- package/dist/cjs/form-reset.scss +1 -1
- package/dist/cjs/index.js +26 -0
- package/dist/cjs/test/QueryLoader/QueryLoader.js +41 -0
- package/dist/cjs/test/QueryLoader/__generated__/QueryLoaderHelloQuery.graphql.js +71 -0
- package/dist/cjs/test/QueryLoader/common/PreloadedTestData/PreloadedTestData.js +49 -0
- package/dist/cjs/test/QueryLoader/common/PreloadedTestData/index.js +15 -0
- package/dist/cjs/test/QueryLoader/common/index.js +13 -0
- package/dist/cjs/test/QueryLoader/index.js +15 -0
- package/dist/cjs/test/QueryLoader/styles.scss +9 -0
- package/dist/cjs/test/index.js +13 -0
- package/dist/cjs/utils/hooks/index.js +23 -0
- package/dist/cjs/utils/hooks/useDynamicPosition.js +107 -0
- package/dist/cjs/utils/hooks/useWindowSize.js +39 -0
- package/dist/cjs/utils/index.js +19 -0
- package/dist/es/a/BackgroundGradient/BackgroundGradient.js +55 -0
- package/dist/es/a/BackgroundGradient/index.js +2 -0
- package/dist/es/a/BackgroundGradient/styles.scss +16 -0
- package/dist/es/a/ContentTree/ContentTree.js +67 -0
- package/dist/es/a/ContentTree/common/Tree/Tree.js +98 -0
- package/dist/es/a/ContentTree/common/Tree/index.js +2 -0
- package/dist/es/a/ContentTree/common/index.js +3 -0
- package/dist/es/a/ContentTree/common/useContentTree.js +74 -0
- package/dist/es/a/ContentTree/common/useFirstVisibleNode.js +54 -0
- package/dist/es/a/ContentTree/index.js +2 -0
- package/dist/es/a/ContentTree/styles.scss +33 -0
- package/dist/es/a/Conversation/Conversation.js +14 -8
- package/dist/es/a/Conversation/common/Message/Message.js +32 -6
- package/dist/es/a/Conversation/styles.scss +132 -33
- package/dist/es/a/OvalIllustration/OvalIllustration.js +111 -0
- package/dist/es/a/OvalIllustration/index.js +2 -0
- package/dist/es/a/OvalIllustration/styles.scss +102 -0
- package/dist/es/a/Popover/Popover.js +118 -0
- package/dist/es/a/Popover/common/Divider/Divider.js +47 -0
- package/dist/es/a/Popover/common/Divider/index.js +2 -0
- package/dist/es/a/Popover/common/Item/Item.js +47 -0
- package/dist/es/a/Popover/common/Item/index.js +2 -0
- package/dist/es/a/Popover/common/index.js +2 -0
- package/dist/es/a/Popover/index.js +2 -0
- package/dist/es/a/Popover/styles.scss +33 -0
- package/dist/es/a/Shapes/Shapes.js +39 -9
- package/dist/es/a/Shapes/styles.scss +79 -23
- package/dist/es/a/SnapScroller/SnapScroller.js +61 -0
- package/dist/es/a/SnapScroller/index.js +2 -0
- package/dist/es/a/SnapScroller/styles.scss +38 -0
- package/dist/es/a/index.js +6 -1
- package/dist/es/b/Button/Button.js +8 -2
- package/dist/es/b/Button/styles.scss +55 -10
- package/dist/es/b/Logo/Logo.js +41 -41
- package/dist/es/b/Logo/styles.scss +0 -138
- package/dist/es/b/Page/common/Section/Section.js +34 -6
- package/dist/es/c/ContentSlides/common/HorizontalMenu/HorizontalMenu.js +16 -9
- package/dist/es/c/ContentSlides/common/Navigator/Navigator.js +4 -3
- package/dist/es/c/ContentSlides/styles.scss +10 -4
- package/dist/es/c/SocialMediaShareButton/SocialMediaShareButton.js +95 -0
- package/dist/es/c/SocialMediaShareButton/index.js +2 -0
- package/dist/es/c/SocialMediaShareButton/styles.scss +39 -0
- package/dist/es/c/index.js +2 -1
- package/dist/es/f/FormInput/FormInput.js +20 -3
- package/dist/es/f/FormInput/styles.scss +11 -0
- package/dist/es/f/common/Debugger/Debugger.js +1 -1
- package/dist/es/f/common/Label/Label.js +1 -1
- package/dist/es/f/common/Label/styles.scss +1 -1
- package/dist/es/f/fields/ChoicesInput/ChoicesInput.js +1 -1
- package/dist/es/f/fields/ChoicesInput/styles.scss +17 -2
- package/dist/es/f/fields/QueryCombobox/QueryCombobox.js +213 -0
- package/dist/es/f/fields/QueryCombobox/common/Combobox/Combobox.js +185 -0
- package/dist/es/f/fields/QueryCombobox/common/Combobox/index.js +2 -0
- package/dist/es/f/fields/QueryCombobox/common/Menu/Menu.js +77 -0
- package/dist/es/f/fields/QueryCombobox/common/Menu/index.js +2 -0
- package/dist/es/f/fields/QueryCombobox/common/MultipleCombobox/MultipleCombobox.js +276 -0
- package/dist/es/f/fields/QueryCombobox/common/MultipleCombobox/index.js +2 -0
- package/dist/es/f/fields/QueryCombobox/common/index.js +3 -0
- package/dist/es/f/fields/QueryCombobox/index.js +2 -0
- package/dist/es/f/fields/QueryCombobox/styles.scss +90 -0
- package/dist/es/f/fields/QuerySelect/QuerySelect.js +179 -0
- package/dist/es/f/fields/QuerySelect/index.js +2 -0
- package/dist/es/f/fields/QuerySelect/styles.scss +21 -0
- package/dist/es/f/fields/RatingsInput/RatingsInput.js +38 -6
- package/dist/es/f/fields/RatingsInput/styles.scss +29 -20
- package/dist/es/f/fields/SelectInput/SelectInput.js +49 -13
- package/dist/es/f/fields/SelectInput/styles.scss +33 -13
- package/dist/es/f/fields/TaskRecommendationInput/TaskRecommendationInput.js +1 -1
- package/dist/es/f/fields/TextInput/TextInput.js +35 -7
- package/dist/es/f/fields/TextInput/styles.scss +16 -7
- package/dist/es/f/fields/TextareaInput/TextareaInput.js +15 -8
- package/dist/es/f/fields/TextareaInput/styles.scss +19 -6
- package/dist/es/f/fields/index.js +3 -4
- package/dist/es/form-reset.scss +1 -1
- package/dist/es/index.js +3 -1
- package/dist/es/test/QueryLoader/QueryLoader.js +29 -0
- package/dist/es/test/QueryLoader/__generated__/QueryLoaderHelloQuery.graphql.js +71 -0
- package/dist/es/test/QueryLoader/common/PreloadedTestData/PreloadedTestData.js +31 -0
- package/dist/es/test/QueryLoader/common/PreloadedTestData/index.js +2 -0
- package/dist/es/test/QueryLoader/common/index.js +1 -0
- package/dist/es/test/QueryLoader/index.js +2 -0
- package/dist/es/test/QueryLoader/styles.scss +9 -0
- package/dist/es/test/index.js +1 -0
- package/dist/es/utils/hooks/index.js +2 -0
- package/dist/es/utils/hooks/useDynamicPosition.js +93 -0
- package/dist/es/utils/hooks/useWindowSize.js +27 -0
- package/dist/es/utils/index.js +1 -0
- package/package.json +18 -4
- package/relay.config.js +12 -0
- package/schema.graphql +4075 -0
- package/scripts/fetchSchema.js +74 -0
- package/src/__snapshots__/Storyshots.test.js.snap +7018 -3507
- package/src/local.scss +4 -2
- package/src/stories/StyleGuide/Sprites.stories.mdx +25 -0
- package/src/stories/StyleGuide/helpers.js +16 -0
- package/src/stories/a/BackgroundGradient.stories.jsx +38 -0
- package/src/stories/a/ContentTree.stories.jsx +662 -0
- package/src/stories/a/Conversation.stories.jsx +78 -1
- package/src/stories/a/OvalIllustration.stories.jsx +59 -0
- package/src/stories/a/Popover.stories.jsx +106 -0
- package/src/stories/a/Shapes.stories.jsx +74 -43
- package/src/stories/a/SnapScroller.stories.jsx +98 -0
- package/src/stories/b/Button.stories.jsx +27 -4
- package/src/stories/b/Logo.stories.jsx +17 -9
- package/src/stories/b/Page.stories.jsx +27 -2
- package/src/stories/c/ContentSlides.stories.jsx +154 -2
- package/src/stories/c/SocialMediaShareButton.stories.jsx +25 -0
- package/src/stories/f/FormInput.stories.jsx +233 -0
- package/src/stories/f/QueryCombobox.stories.jsx +269 -0
- package/src/stories/f/QuerySelect.stories.jsx +134 -0
- package/src/stories/f/RatingsInput.stories.jsx +3 -2
- package/src/stories/f/SelectInput.stories.jsx +36 -5
- package/src/stories/f/TextInput.stories.jsx +15 -4
- package/src/stories/f/TextareaInput.stories.jsx +42 -6
- package/src/stories/f/__generated__/FormInputAllTaskStatusesQuery.graphql.js +122 -0
- package/src/stories/f/__generated__/FormInputAllTeamsQuery.graphql.js +139 -0
- package/src/stories/f/__generated__/QueryComboboxAllTeamsQuery.graphql.js +139 -0
- package/src/stories/f/__generated__/QuerySelectAllTaskStatusesQuery.graphql.js +122 -0
- package/src/stories/test/QueryLoader.stories.jsx +36 -0
- package/src/stories/utils/generateNodeId.js +12 -0
- package/src/stories/utils/lorem.js +15 -0
- package/src/stories/utils/relay/EnvironmentProvider.jsx +14 -0
- package/src/stories/utils/relay/environment.js +5 -0
- package/src/stories/utils/relay/index.js +4 -0
- package/src/stories/utils/relay/mockRelayOperation.js +14 -0
- package/src/stories/utils/relay/mockResolvers.js +299 -0
- package/src/stories/utils/testData.js +63 -0
- package/src/ui/a/BackgroundGradient/BackgroundGradient.jsx +76 -0
- package/src/ui/a/BackgroundGradient/index.js +2 -0
- package/src/ui/a/BackgroundGradient/styles.scss +16 -0
- package/src/ui/a/ContentTree/ContentTree.jsx +88 -0
- package/src/ui/a/ContentTree/common/Tree/Tree.jsx +138 -0
- package/src/ui/a/ContentTree/common/Tree/index.js +2 -0
- package/src/ui/a/ContentTree/common/index.js +3 -0
- package/src/ui/a/ContentTree/common/useContentTree.js +83 -0
- package/src/ui/a/ContentTree/common/useFirstVisibleNode.js +59 -0
- package/src/ui/a/ContentTree/index.js +2 -0
- package/src/ui/a/ContentTree/styles.scss +33 -0
- package/src/ui/a/Conversation/Conversation.jsx +15 -7
- package/src/ui/a/Conversation/common/Message/Message.jsx +38 -6
- package/src/ui/a/Conversation/styles.scss +132 -33
- package/src/ui/a/OvalIllustration/OvalIllustration.jsx +134 -0
- package/src/ui/a/OvalIllustration/index.js +2 -0
- package/src/ui/a/OvalIllustration/styles.scss +102 -0
- package/src/ui/a/Popover/Popover.jsx +157 -0
- package/src/ui/a/Popover/index.js +2 -0
- package/src/ui/a/Popover/styles.scss +33 -0
- package/src/ui/a/Shapes/Shapes.jsx +44 -7
- package/src/ui/a/Shapes/styles.scss +79 -23
- package/src/ui/a/SnapScroller/SnapScroller.jsx +83 -0
- package/src/ui/a/SnapScroller/index.js +2 -0
- package/src/ui/a/SnapScroller/styles.scss +38 -0
- package/src/ui/a/index.js +5 -0
- package/src/ui/b/Button/Button.jsx +9 -1
- package/src/ui/b/Button/styles.scss +55 -10
- package/src/ui/b/Logo/Logo.jsx +41 -41
- package/src/ui/b/Logo/styles.scss +0 -138
- package/src/ui/b/Page/common/Section/Section.jsx +39 -5
- package/src/ui/c/ContentSlides/common/HorizontalMenu/HorizontalMenu.jsx +12 -5
- package/src/ui/c/ContentSlides/common/Navigator/Navigator.jsx +3 -2
- package/src/ui/c/ContentSlides/styles.scss +10 -4
- package/src/ui/c/SocialMediaShareButton/SocialMediaShareButton.jsx +121 -0
- package/src/ui/c/SocialMediaShareButton/index.js +2 -0
- package/src/ui/c/SocialMediaShareButton/styles.scss +39 -0
- package/src/ui/c/index.js +1 -0
- package/src/ui/f/FormInput/FormInput.jsx +26 -1
- package/src/ui/f/FormInput/styles.scss +11 -0
- package/src/ui/f/common/Debugger/Debugger.jsx +1 -1
- package/src/ui/f/common/Label/Label.jsx +1 -1
- package/src/ui/f/common/Label/styles.scss +1 -1
- package/src/ui/f/fields/ChoicesInput/ChoicesInput.jsx +1 -1
- package/src/ui/f/fields/ChoicesInput/styles.scss +17 -2
- package/src/ui/f/fields/QueryCombobox/QueryCombobox.jsx +227 -0
- package/src/ui/f/fields/QueryCombobox/common/Combobox/Combobox.jsx +222 -0
- package/src/ui/f/fields/QueryCombobox/common/Combobox/index.js +2 -0
- package/src/ui/f/fields/QueryCombobox/common/Menu/Menu.jsx +103 -0
- package/src/ui/f/fields/QueryCombobox/common/Menu/index.js +2 -0
- package/src/ui/f/fields/QueryCombobox/common/MultipleCombobox/MultipleCombobox.jsx +318 -0
- package/src/ui/f/fields/QueryCombobox/common/MultipleCombobox/index.js +2 -0
- package/src/ui/f/fields/QueryCombobox/common/index.js +3 -0
- package/src/ui/f/fields/QueryCombobox/index.js +2 -0
- package/src/ui/f/fields/QueryCombobox/styles.scss +90 -0
- package/src/ui/f/fields/QuerySelect/QuerySelect.jsx +200 -0
- package/src/ui/f/fields/QuerySelect/index.js +2 -0
- package/src/ui/f/fields/RatingsInput/RatingsInput.jsx +54 -19
- package/src/ui/f/fields/RatingsInput/styles.scss +29 -20
- package/src/ui/f/fields/SelectInput/SelectInput.jsx +59 -8
- package/src/ui/f/fields/SelectInput/styles.scss +33 -13
- package/src/ui/f/fields/TextInput/TextInput.jsx +31 -3
- package/src/ui/f/fields/TextInput/styles.scss +16 -7
- package/src/ui/f/fields/TextareaInput/TextareaInput.jsx +24 -13
- package/src/ui/f/fields/TextareaInput/styles.scss +19 -6
- package/src/ui/f/fields/index.js +2 -3
- package/src/ui/form-reset.scss +1 -1
- package/src/ui/index.js +2 -0
- package/src/ui/test/QueryLoader/QueryLoader.jsx +41 -0
- package/src/ui/test/QueryLoader/__generated__/QueryLoaderHelloQuery.graphql.js +68 -0
- package/src/ui/test/QueryLoader/common/PreloadedTestData/PreloadedTestData.jsx +51 -0
- package/src/ui/test/QueryLoader/common/PreloadedTestData/index.js +2 -0
- package/src/ui/test/QueryLoader/common/index.js +1 -0
- package/src/ui/test/QueryLoader/index.js +2 -0
- package/src/ui/test/index.js +1 -0
- package/src/ui/utils/hooks/index.js +2 -0
- package/src/ui/utils/hooks/useDynamicPosition.js +104 -0
- package/src/ui/utils/hooks/useWindowSize.js +32 -0
- package/src/ui/utils/index.js +1 -0
- package/stylelint.config.js +13 -13
- package/src/stories/f/CheckboxInput.stories.jsx +0 -37
- package/src/stories/f/RadioInput.stories.jsx +0 -37
- package/src/stories/f/TaskRecommendationInput.stories.jsx +0 -38
- package/src/ui/f/fields/CheckboxInput/CheckboxInput.jsx +0 -107
- package/src/ui/f/fields/CheckboxInput/index.js +0 -2
- package/src/ui/f/fields/CheckboxInput/styles.scss +0 -28
- package/src/ui/f/fields/RadioInput/RadioInput.jsx +0 -112
- package/src/ui/f/fields/RadioInput/index.js +0 -2
- package/src/ui/f/fields/RadioInput/styles.scss +0 -26
- package/src/ui/f/fields/TaskRecommendationInput/TaskRecommendationInput.jsx +0 -130
- package/src/ui/f/fields/TaskRecommendationInput/index.js +0 -2
- package/src/ui/f/fields/TaskRecommendationInput/styles.scss +0 -41
|
@@ -0,0 +1,299 @@
|
|
|
1
|
+
const customMockResolvers = {
|
|
2
|
+
String :() => 'Test string',
|
|
3
|
+
UserNode:() => ({
|
|
4
|
+
id :'VXNlck5vZGU6OTZkZTA3M2MtNTE3Ni00ZjgyLTg4OWMtMzIwYmVmYzU5ODFj',
|
|
5
|
+
firstName :'Collins',
|
|
6
|
+
isSuperuser:false,
|
|
7
|
+
}),
|
|
8
|
+
TaskNode:() => ({
|
|
9
|
+
id :'VGFza05vZGU6MDAwZmQ4N2UtYjNlNS00NWE5LTg5ZjEtNWI0ZDViNWE2NTlj',
|
|
10
|
+
title :'Task1',
|
|
11
|
+
status:{
|
|
12
|
+
id :'VGFza1N0YXR1c05vZGU6OTczYmM4NTgtMzA0NC00NWNiLTg2MDQtYTRhM2JmNjFmZjEx',
|
|
13
|
+
status:'In Review',
|
|
14
|
+
},
|
|
15
|
+
requester:{
|
|
16
|
+
id :'VXNlck5vZGU6OTZkZTA3M2MtNTE3Ni00ZjgyLTg4OWMtMzIwYmVmYzU5ODFj',
|
|
17
|
+
firstName:'Collins',
|
|
18
|
+
},
|
|
19
|
+
userTeam:{
|
|
20
|
+
id :'VGVhbU5vZGU6MDAxZTIyOGEtYzA5My00MGI0LWE1MTUtYTNkMTM1NTE1MDNl',
|
|
21
|
+
name:'Team 1',
|
|
22
|
+
},
|
|
23
|
+
manager:{
|
|
24
|
+
id :'VXNlck5vZGU6OTZkZTA3M2MtNTE3Ni00ZjgyLTg4OWMtMzIwYmVmYzU5ODFj',
|
|
25
|
+
firstName:'manager',
|
|
26
|
+
},
|
|
27
|
+
createdAt :'2021-09-23',
|
|
28
|
+
dueDate :'2021-10-30',
|
|
29
|
+
requestDate:'2020-01-01',
|
|
30
|
+
description:'First task',
|
|
31
|
+
}),
|
|
32
|
+
TeamNode:() => ({
|
|
33
|
+
id :'VGVhbU5vZGU6MDAxZTIyOGEtYzA5My00MGI0LWE1MTUtYTNkMTM1NTE1MDNl',
|
|
34
|
+
name :'Team 1',
|
|
35
|
+
credits :20.12,
|
|
36
|
+
billingEmail:'team1@hellopareto.com',
|
|
37
|
+
hourlyRate :20,
|
|
38
|
+
partner :{
|
|
39
|
+
firstName:'Test1',
|
|
40
|
+
lastName :'assd',
|
|
41
|
+
},
|
|
42
|
+
|
|
43
|
+
}),
|
|
44
|
+
GroupNode:() => ({
|
|
45
|
+
id :'VGFza05vZGU6MDAwZmQ4N2UtYjNlNS00NWE5LTg5ZjEtNWI0ZDViNWE2NTlk',
|
|
46
|
+
name:'admin',
|
|
47
|
+
}),
|
|
48
|
+
TaskNodeConnection:() => ({
|
|
49
|
+
pageInfo:{
|
|
50
|
+
hasNextPage :true,
|
|
51
|
+
hasPreviousPage:true,
|
|
52
|
+
},
|
|
53
|
+
edges:[
|
|
54
|
+
{
|
|
55
|
+
node:{
|
|
56
|
+
id :'VGFza05vZGU6MDAwZmQ4N2UtYjNlNS00NWE5LTg5ZjEtNWI0ZDViNWE2NTlj',
|
|
57
|
+
title :'Task1',
|
|
58
|
+
status:{
|
|
59
|
+
id :'VGFza1N0YXR1c05vZGU6OTczYmM4NTgtMzA0NC00NWNiLTg2MDQtYTRhM2JmNjFmZjEx',
|
|
60
|
+
status:'In Review',
|
|
61
|
+
},
|
|
62
|
+
requester:{
|
|
63
|
+
id :'VXNlck5vZGU6OTZkZTA3M2MtNTE3Ni00ZjgyLTg4OWMtMzIwYmVmYzU5ODFj',
|
|
64
|
+
firstName:'Collins',
|
|
65
|
+
},
|
|
66
|
+
userTeam:{
|
|
67
|
+
id :'VGVhbU5vZGU6MDAxZTIyOGEtYzA5My00MGI0LWE1MTUtYTNkMTM1NTE1MDNl',
|
|
68
|
+
name:'Team 1',
|
|
69
|
+
},
|
|
70
|
+
manager:{
|
|
71
|
+
id :'VXNlck5vZGU6OTZkZTA3M2MtNTE3Ni00ZjgyLTg4OWMtMzIwYmVmYzU5ODFj',
|
|
72
|
+
firstName:'manager',
|
|
73
|
+
},
|
|
74
|
+
createdAt :'2021-09-23',
|
|
75
|
+
dueDate :'2021-10-30',
|
|
76
|
+
requestDate:'2020-01-01',
|
|
77
|
+
description:'First task',
|
|
78
|
+
},
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
node:{
|
|
82
|
+
id :'VGFza05vZGU6MDAwZmQ4N2UtYjNlNS00NWE5LTg5ZjEtNWI0ZDViNWE2NTlj',
|
|
83
|
+
title :'Task2',
|
|
84
|
+
status:{
|
|
85
|
+
id :'VGFza1N0YXR1c05vZGU6OTczYmM4NTgtMzA0NC00NWNiLTg2MDQtYTRhM2JmNjFmZjEx',
|
|
86
|
+
status:'In Review',
|
|
87
|
+
},
|
|
88
|
+
requester:{
|
|
89
|
+
id :'VXNlck5vZGU6OTZkZTA3M2MtNTE3Ni00ZjgyLTg4OWMtMzIwYmVmYzU5ODFj',
|
|
90
|
+
firstName:'Collins',
|
|
91
|
+
},
|
|
92
|
+
userTeam:{
|
|
93
|
+
id :'VGVhbU5vZGU6MDAxZTIyOGEtYzA5My00MGI0LWE1MTUtYTNkMTM1NTE1MDNl',
|
|
94
|
+
name:'Team 2',
|
|
95
|
+
},
|
|
96
|
+
manager:{
|
|
97
|
+
id :'VXNlck5vZGU6OTZkZTA3M2MtNTE3Ni00ZjgyLTg4OWMtMzIwYmVmYzU5ODFj',
|
|
98
|
+
firstName:'manager',
|
|
99
|
+
},
|
|
100
|
+
createdAt :'2021-09-23',
|
|
101
|
+
dueDate :'2021-10-30',
|
|
102
|
+
requestDate:'2020-01-01',
|
|
103
|
+
description:'Second task',
|
|
104
|
+
},
|
|
105
|
+
},
|
|
106
|
+
],
|
|
107
|
+
}),
|
|
108
|
+
UserNodeConnection:(allArgs) => {
|
|
109
|
+
const { args :{ first, offset } } = allArgs
|
|
110
|
+
|
|
111
|
+
const edges = [
|
|
112
|
+
{
|
|
113
|
+
node:{
|
|
114
|
+
id :'VXNlck5vZGU6OTZkZTA3M2MtNTE3Ni00ZjgyLTg4OWMtMzIwYmVmYzU5ODFj',
|
|
115
|
+
firstName:'Collins',
|
|
116
|
+
},
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
node:{
|
|
120
|
+
id :'VXNlck5vZGU6MDEyN2E1NmItYjAxOS00NmQxLTg2NTEtYWEzOGIxZTUwNTA5',
|
|
121
|
+
firstName:'Amritha',
|
|
122
|
+
},
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
node:{
|
|
126
|
+
id :'VXNlck5vZGU6YzcwYWIxMDItZWE2Yy00ZWNhLTk0M2ItOTA2OWQwN2RiMDQ0',
|
|
127
|
+
firstName:'Marsya',
|
|
128
|
+
},
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
node:{
|
|
132
|
+
id :'VXNlck5vZGU6OTUyNjg1NWYtZTg3NC00ZTlkLWFlZTgtZDZjODc3NDNlNTRh',
|
|
133
|
+
firstName:'James',
|
|
134
|
+
},
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
node:{
|
|
138
|
+
id :'VXNlck5vZGU6OTFmOTE4NTYtNjg0Yi00ODhhLWE0YzktZGU5ZDQ5YmJjM2Mz',
|
|
139
|
+
firstName:'Adrian',
|
|
140
|
+
},
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
node:{
|
|
144
|
+
id :'VXNlck5vZGU6OTNkZGU3NGEtYTA2Yi00MDMzLWIwMDAtMTFkZDY0N2Y3OWE4',
|
|
145
|
+
firstName:'Melissa',
|
|
146
|
+
},
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
node:{
|
|
150
|
+
id :'VXNlck5vZGU6MjgyYTk1MjctMDI4OS00MDlhLWFjNTktYWJkNTFkODAyMjFj',
|
|
151
|
+
firstName:'Beto',
|
|
152
|
+
},
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
node:{
|
|
156
|
+
id :'VXNlck5vZGU6YmIxYzI5YmEtYTk0OS00M2I3LWIxMWEtZDQxMjM5ZWI0ZWI2',
|
|
157
|
+
firstName:'Romie',
|
|
158
|
+
},
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
node:{
|
|
162
|
+
id :'VXNlck5vZGU6ZjZhNzBiZTgtY2FkMC00NzNjLWEyODUtNDdkMGVmYjQxYTRl',
|
|
163
|
+
firstName:'Miguel',
|
|
164
|
+
},
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
node:{
|
|
168
|
+
id :'VXNlck5vZGU6Y2JlOGM4ZTYtY2Q2Zi00M2RlLWI4YmQtODU3YWRhZjYyMzVj',
|
|
169
|
+
firstName:'Phoebe',
|
|
170
|
+
},
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
node:{
|
|
174
|
+
id :'VXNlck5vZGU6NDA5MWM1MDUtYjY1MC00M2Y1LTg3NTEtMDc1NTBkMzJhYTcy',
|
|
175
|
+
firstName:'Kim',
|
|
176
|
+
},
|
|
177
|
+
},
|
|
178
|
+
{
|
|
179
|
+
node:{
|
|
180
|
+
id :'VXNlck5vZGU6ZjE0MGUxYTItM2I4My00NmY1LWIzMDQtYmFiOGZjMTc5ZmU4',
|
|
181
|
+
firstName:'Liz',
|
|
182
|
+
},
|
|
183
|
+
},
|
|
184
|
+
{
|
|
185
|
+
node:{
|
|
186
|
+
id :'VXNlck5vZGU6ZGYyOGE5MDYtM2NhMS00NTVmLWIzZmUtNjY5YWFkZTNiZjRk',
|
|
187
|
+
firstName:'Deepanshu',
|
|
188
|
+
},
|
|
189
|
+
},
|
|
190
|
+
{
|
|
191
|
+
node:{
|
|
192
|
+
id :'VXNlck5vZGU6MjBhMDBkYjgtZDExNi00YzAyLWEyOTUtYWM5MzIwMjUwMWU3',
|
|
193
|
+
firstName:'Jennica',
|
|
194
|
+
},
|
|
195
|
+
},
|
|
196
|
+
{
|
|
197
|
+
node:{
|
|
198
|
+
id :'VXNlck5vZGU6MjczNDllYjMtYzNmYi00ZmVkLWE1N2YtNTFjZGJlODI0MWU2',
|
|
199
|
+
firstName:'Michelle',
|
|
200
|
+
},
|
|
201
|
+
},
|
|
202
|
+
]
|
|
203
|
+
|
|
204
|
+
return ({
|
|
205
|
+
pageInfo:{
|
|
206
|
+
hasNextPage :true,
|
|
207
|
+
hasPreviousPage:true,
|
|
208
|
+
},
|
|
209
|
+
edges:edges.slice(offset, offset + first),
|
|
210
|
+
})
|
|
211
|
+
},
|
|
212
|
+
WorkHoursNodeConnection:() => ({
|
|
213
|
+
pageInfo:{
|
|
214
|
+
hasNextPage :true,
|
|
215
|
+
hasPreviousPage:true,
|
|
216
|
+
},
|
|
217
|
+
edges:[
|
|
218
|
+
{
|
|
219
|
+
node:{
|
|
220
|
+
id :'V29ya0hvdXJzTm9kZTplYWJlYmEyNC0wNTlmLTQxMjEtODIzYi0yYmU2YzMxMmZlNzA=',
|
|
221
|
+
associate:{
|
|
222
|
+
firstName:'Des',
|
|
223
|
+
lastName :'assd',
|
|
224
|
+
},
|
|
225
|
+
timeSpent :15,
|
|
226
|
+
log :'asd',
|
|
227
|
+
paidOut :false,
|
|
228
|
+
sentInvoice:true,
|
|
229
|
+
createdAt :'2021-09-05T17:08:49.000-0430',
|
|
230
|
+
startedAt :'2021-09-05T17:08:49.000-0430',
|
|
231
|
+
},
|
|
232
|
+
},
|
|
233
|
+
{
|
|
234
|
+
node:{
|
|
235
|
+
id :'V29ya0hvdXJzTm9kZTplYmZiZTllZS04NWNkLTRhNDktYTZhMi0zNmNhMTU0M2EwMDU=',
|
|
236
|
+
associate:{
|
|
237
|
+
firstName:'Ella',
|
|
238
|
+
lastName :'asdasd',
|
|
239
|
+
},
|
|
240
|
+
timeSpent :25,
|
|
241
|
+
log :'aasdasdsd',
|
|
242
|
+
paidOut :true,
|
|
243
|
+
sentInvoice:false,
|
|
244
|
+
createdAt :'2021-09-15T17:08:49.000-0430',
|
|
245
|
+
startedAt :'2021-09-15T17:08:49.000-0430',
|
|
246
|
+
},
|
|
247
|
+
},
|
|
248
|
+
],
|
|
249
|
+
}),
|
|
250
|
+
TeamNodeConnection:() => ({
|
|
251
|
+
pageInfo:{
|
|
252
|
+
hasNextPage :true,
|
|
253
|
+
hasPreviousPage:true,
|
|
254
|
+
},
|
|
255
|
+
edges:[
|
|
256
|
+
{
|
|
257
|
+
node:{
|
|
258
|
+
id :'VGVhbU5vZGU6MDAxZTIyOGEtYzA5My00MGI0LWE1MTUtYTNkMTM1NTE1MDNl',
|
|
259
|
+
name :'Team 1',
|
|
260
|
+
credits :20.12,
|
|
261
|
+
billingEmail:'team1@hellopareto.com',
|
|
262
|
+
hourlyRate :20,
|
|
263
|
+
partner :{
|
|
264
|
+
firstName:'Test1',
|
|
265
|
+
lastName :'assd',
|
|
266
|
+
},
|
|
267
|
+
},
|
|
268
|
+
},
|
|
269
|
+
{
|
|
270
|
+
node:{
|
|
271
|
+
id :'VGVhbU5vZGU6MDA0N2U4MzktODY0Zi00N2U5LTg3ZjgtZGUwMmM2Yzg1YWJm',
|
|
272
|
+
name :'Team 2',
|
|
273
|
+
credits :20.12,
|
|
274
|
+
billingEmail:'team2@hellopareto.com',
|
|
275
|
+
hourlyRate :20,
|
|
276
|
+
partner :{
|
|
277
|
+
firstName:'Test2',
|
|
278
|
+
lastName :'assd',
|
|
279
|
+
},
|
|
280
|
+
},
|
|
281
|
+
},
|
|
282
|
+
{
|
|
283
|
+
node:{
|
|
284
|
+
id :'VGVhbU5vZGU6MDExMmEyZmEtYzE0YS00MGRhLThiNWQtMDMzNTkyNDQ3ZDI2',
|
|
285
|
+
name :'Team 3',
|
|
286
|
+
credits :20.12,
|
|
287
|
+
billingEmail:'team3@hellopareto.com',
|
|
288
|
+
hourlyRate :20,
|
|
289
|
+
partner :{
|
|
290
|
+
firstName:'Test3',
|
|
291
|
+
lastName :'assd',
|
|
292
|
+
},
|
|
293
|
+
},
|
|
294
|
+
},
|
|
295
|
+
],
|
|
296
|
+
}),
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
export default customMockResolvers
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
export const fruits = [
|
|
2
|
+
'Apple',
|
|
3
|
+
'Apricot',
|
|
4
|
+
'Avocado',
|
|
5
|
+
'Banana',
|
|
6
|
+
'Bilberry',
|
|
7
|
+
'Blackberry',
|
|
8
|
+
'Blackcurrant',
|
|
9
|
+
'Blueberry',
|
|
10
|
+
'Currant',
|
|
11
|
+
'Cherry',
|
|
12
|
+
'Cherimoya',
|
|
13
|
+
'Clementine',
|
|
14
|
+
'Date',
|
|
15
|
+
'Damson',
|
|
16
|
+
'Durian',
|
|
17
|
+
'Eggplant',
|
|
18
|
+
'Elderberry',
|
|
19
|
+
'Feijoa',
|
|
20
|
+
'Gooseberry',
|
|
21
|
+
'Grape',
|
|
22
|
+
'Grapefruit',
|
|
23
|
+
'Guava',
|
|
24
|
+
'Huckleberry',
|
|
25
|
+
'Jackfruit',
|
|
26
|
+
'Jambul',
|
|
27
|
+
'Kiwi fruit',
|
|
28
|
+
'Kumquat',
|
|
29
|
+
'Legume',
|
|
30
|
+
'Lemon',
|
|
31
|
+
'Lime',
|
|
32
|
+
'Lychee',
|
|
33
|
+
'Mango',
|
|
34
|
+
'Mangostine',
|
|
35
|
+
'Melon',
|
|
36
|
+
'Cantaloupe',
|
|
37
|
+
'Honeydew melon',
|
|
38
|
+
'Rock melon',
|
|
39
|
+
'Nectarine',
|
|
40
|
+
'Orange',
|
|
41
|
+
'Peach',
|
|
42
|
+
'Pear',
|
|
43
|
+
'Williams pear or Bartlett pear',
|
|
44
|
+
'Pitaya',
|
|
45
|
+
'Physalis',
|
|
46
|
+
'Plum/prune (dried plum)',
|
|
47
|
+
'Pineapple',
|
|
48
|
+
'Pomegranate',
|
|
49
|
+
'Raisin',
|
|
50
|
+
'Raspberry',
|
|
51
|
+
'Western raspberry (blackcap)',
|
|
52
|
+
'Rambutan',
|
|
53
|
+
'Redcurrant',
|
|
54
|
+
'Salal berry',
|
|
55
|
+
'Satsuma',
|
|
56
|
+
'Star fruit',
|
|
57
|
+
'Strawberry',
|
|
58
|
+
'Tangerine',
|
|
59
|
+
'Tomato',
|
|
60
|
+
'Ugli fruit',
|
|
61
|
+
'Watermelon',
|
|
62
|
+
'Ziziphus mauritiana',
|
|
63
|
+
]
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/* @pareto-engineering/generator-front 1.0.12 */
|
|
2
|
+
import * as React from 'react'
|
|
3
|
+
|
|
4
|
+
import { useLayoutEffect } from 'react'
|
|
5
|
+
|
|
6
|
+
import PropTypes from 'prop-types'
|
|
7
|
+
|
|
8
|
+
import styleNames from '@pareto-engineering/bem'
|
|
9
|
+
|
|
10
|
+
// Local Definitions
|
|
11
|
+
|
|
12
|
+
const baseClassName = styleNames.base
|
|
13
|
+
|
|
14
|
+
const componentClassName = 'background-gradient'
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* This is the component description.
|
|
18
|
+
*/
|
|
19
|
+
const BackgroundGradient = ({
|
|
20
|
+
id,
|
|
21
|
+
className:userClassName,
|
|
22
|
+
style,
|
|
23
|
+
height,
|
|
24
|
+
// ...otherProps
|
|
25
|
+
}) => {
|
|
26
|
+
useLayoutEffect(() => {
|
|
27
|
+
import('./styles.scss')
|
|
28
|
+
}, [])
|
|
29
|
+
|
|
30
|
+
return (
|
|
31
|
+
<div
|
|
32
|
+
id={id}
|
|
33
|
+
className={[
|
|
34
|
+
|
|
35
|
+
baseClassName,
|
|
36
|
+
|
|
37
|
+
componentClassName,
|
|
38
|
+
userClassName,
|
|
39
|
+
]
|
|
40
|
+
.filter((e) => e)
|
|
41
|
+
.join(' ')}
|
|
42
|
+
style={{
|
|
43
|
+
...style,
|
|
44
|
+
'--gradient-height':height,
|
|
45
|
+
}}
|
|
46
|
+
/>
|
|
47
|
+
)
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
BackgroundGradient.propTypes = {
|
|
51
|
+
/**
|
|
52
|
+
* The HTML id for this element
|
|
53
|
+
*/
|
|
54
|
+
id:PropTypes.string,
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* The HTML class names for this element
|
|
58
|
+
*/
|
|
59
|
+
className:PropTypes.string,
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* The React-written, css properties for this element.
|
|
63
|
+
*/
|
|
64
|
+
style:PropTypes.objectOf(PropTypes.string),
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* The height of the shape.
|
|
68
|
+
*/
|
|
69
|
+
height:PropTypes.string,
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
BackgroundGradient.defaultProps = {
|
|
73
|
+
// someProp: false,
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export default BackgroundGradient
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/* @pareto-engineering/generator-front 1.0.12 */
|
|
2
|
+
@use "@pareto-engineering/bem";
|
|
3
|
+
|
|
4
|
+
.#{bem.$base}.background-gradient{
|
|
5
|
+
position: absolute;
|
|
6
|
+
top: 0;
|
|
7
|
+
left: 0;
|
|
8
|
+
width: 100%;
|
|
9
|
+
height: var(--gradient-height);
|
|
10
|
+
background-image: linear-gradient(var(--background1), var(--y) 25%, var(--light-y) 75%, var(--background1));
|
|
11
|
+
opacity: .4;
|
|
12
|
+
z-index: -1;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/* @pareto-engineering/generator-front 1.0.12 */
|
|
2
|
+
import * as React from 'react'
|
|
3
|
+
|
|
4
|
+
import { useLayoutEffect } from 'react'
|
|
5
|
+
|
|
6
|
+
import PropTypes from 'prop-types'
|
|
7
|
+
|
|
8
|
+
import styleNames from '@pareto-engineering/bem'
|
|
9
|
+
|
|
10
|
+
// Local Definitions
|
|
11
|
+
import { Tree, useContentTree } from './common'
|
|
12
|
+
|
|
13
|
+
const baseClassName = styleNames.base
|
|
14
|
+
|
|
15
|
+
const componentClassName = 'content-tree'
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* This is the component description.
|
|
19
|
+
*/
|
|
20
|
+
const ContentTree = ({
|
|
21
|
+
id,
|
|
22
|
+
className:userClassName,
|
|
23
|
+
style,
|
|
24
|
+
target,
|
|
25
|
+
selectors,
|
|
26
|
+
// ...otherProps
|
|
27
|
+
}) => {
|
|
28
|
+
useLayoutEffect(() => {
|
|
29
|
+
import('./styles.scss')
|
|
30
|
+
}, [])
|
|
31
|
+
|
|
32
|
+
const contentTree = useContentTree(target, selectors)
|
|
33
|
+
|
|
34
|
+
return (
|
|
35
|
+
<div
|
|
36
|
+
id={id}
|
|
37
|
+
className={[
|
|
38
|
+
|
|
39
|
+
baseClassName,
|
|
40
|
+
|
|
41
|
+
componentClassName,
|
|
42
|
+
userClassName,
|
|
43
|
+
]
|
|
44
|
+
.filter((e) => e)
|
|
45
|
+
.join(' ')}
|
|
46
|
+
style={style}
|
|
47
|
+
// {...otherProps}
|
|
48
|
+
>
|
|
49
|
+
<Tree tree={contentTree} />
|
|
50
|
+
</div>
|
|
51
|
+
)
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
ContentTree.propTypes = {
|
|
55
|
+
/**
|
|
56
|
+
* The HTML id for this element
|
|
57
|
+
*/
|
|
58
|
+
id:PropTypes.string,
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* The HTML class names for this element
|
|
62
|
+
*/
|
|
63
|
+
className:PropTypes.string,
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* The React-written, css properties for this element.
|
|
67
|
+
*/
|
|
68
|
+
style:PropTypes.objectOf(PropTypes.string),
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* The selectors to use to extract the navigation tree from the content.
|
|
72
|
+
*/
|
|
73
|
+
selectors:PropTypes.arrayOf(PropTypes.string),
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* The reference to the parent element.
|
|
77
|
+
*/
|
|
78
|
+
target:PropTypes.oneOfType([
|
|
79
|
+
PropTypes.func,
|
|
80
|
+
PropTypes.shape({ current: PropTypes.instanceOf(Element) }),
|
|
81
|
+
]),
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
ContentTree.defaultProps = {
|
|
85
|
+
selectors:['h2', 'h3'],
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export default ContentTree
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
/* @pareto-engineering/generator-front 1.0.12 */
|
|
2
|
+
import * as React from 'react'
|
|
3
|
+
|
|
4
|
+
import { useState, useEffect, useMemo } from 'react'
|
|
5
|
+
|
|
6
|
+
import PropTypes from 'prop-types'
|
|
7
|
+
|
|
8
|
+
import styleNames from '@pareto-engineering/bem'
|
|
9
|
+
|
|
10
|
+
// Local Definitions
|
|
11
|
+
|
|
12
|
+
import useFirstVisibleNode from '../useFirstVisibleNode'
|
|
13
|
+
|
|
14
|
+
const baseClassName = styleNames.base
|
|
15
|
+
|
|
16
|
+
const componentClassName = 'tree'
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* This is the component description.
|
|
20
|
+
*/
|
|
21
|
+
const Tree = ({
|
|
22
|
+
id,
|
|
23
|
+
className:userClassName,
|
|
24
|
+
style,
|
|
25
|
+
tree,
|
|
26
|
+
displayDepth,
|
|
27
|
+
// ...otherProps
|
|
28
|
+
}) => {
|
|
29
|
+
// The nodeIds to be used to get the first visible node
|
|
30
|
+
const [nodeIds, setNodeIds] = useState([])
|
|
31
|
+
|
|
32
|
+
// current visible nodeId
|
|
33
|
+
const visibleNodeId = useFirstVisibleNode(nodeIds)
|
|
34
|
+
|
|
35
|
+
useEffect(() => {
|
|
36
|
+
const node = document.getElementsByClassName(visibleNodeId)[0]
|
|
37
|
+
node?.classList.add(styleNames.modifierActive)
|
|
38
|
+
|
|
39
|
+
return () => {
|
|
40
|
+
node?.classList.remove(styleNames.modifierActive)
|
|
41
|
+
}
|
|
42
|
+
}, [visibleNodeId])
|
|
43
|
+
|
|
44
|
+
// Generate the tree structure from the content tree data depending on the display depth
|
|
45
|
+
const getNestedTree = (node, depth) => {
|
|
46
|
+
setNodeIds((prev) => [...prev, node.id])
|
|
47
|
+
if (depth <= 1) {
|
|
48
|
+
return (
|
|
49
|
+
<li key={node.id}>
|
|
50
|
+
<a
|
|
51
|
+
className={node.id}
|
|
52
|
+
href={node.id}
|
|
53
|
+
>
|
|
54
|
+
{node.text}
|
|
55
|
+
</a>
|
|
56
|
+
</li>
|
|
57
|
+
)
|
|
58
|
+
}
|
|
59
|
+
return (
|
|
60
|
+
<li key={node.id}>
|
|
61
|
+
<p>
|
|
62
|
+
<a
|
|
63
|
+
href={node.id}
|
|
64
|
+
className={node.id}
|
|
65
|
+
>
|
|
66
|
+
{node.text}
|
|
67
|
+
</a>
|
|
68
|
+
</p>
|
|
69
|
+
{node.children.length > 0 && (
|
|
70
|
+
<ul>
|
|
71
|
+
{node.children.map((child) => getNestedTree(child, depth - 1))}
|
|
72
|
+
</ul>
|
|
73
|
+
)}
|
|
74
|
+
</li>
|
|
75
|
+
)
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
const ContentTree = useMemo(
|
|
79
|
+
() => tree.map((node) => getNestedTree(node, displayDepth)),
|
|
80
|
+
[tree],
|
|
81
|
+
)
|
|
82
|
+
|
|
83
|
+
return (
|
|
84
|
+
<ul
|
|
85
|
+
id={id}
|
|
86
|
+
className={[
|
|
87
|
+
|
|
88
|
+
baseClassName,
|
|
89
|
+
|
|
90
|
+
componentClassName,
|
|
91
|
+
userClassName,
|
|
92
|
+
]
|
|
93
|
+
.filter((e) => e)
|
|
94
|
+
.join(' ')}
|
|
95
|
+
style={style}
|
|
96
|
+
>
|
|
97
|
+
{ContentTree}
|
|
98
|
+
</ul>
|
|
99
|
+
)
|
|
100
|
+
}
|
|
101
|
+
Tree.propTypes = {
|
|
102
|
+
/**
|
|
103
|
+
* The HTML id for this element
|
|
104
|
+
*/
|
|
105
|
+
id:PropTypes.string,
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* The HTML class names for this element
|
|
109
|
+
*/
|
|
110
|
+
className:PropTypes.string,
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* The React-written, css properties for this element.
|
|
114
|
+
*/
|
|
115
|
+
style:PropTypes.objectOf(PropTypes.string),
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* The tree to render.
|
|
119
|
+
*/
|
|
120
|
+
tree:PropTypes.arrayOf(PropTypes.shape({
|
|
121
|
+
text :PropTypes.string,
|
|
122
|
+
id :PropTypes.string,
|
|
123
|
+
children:PropTypes.arrayOf(PropTypes.shape({
|
|
124
|
+
text:PropTypes.string, id:PropTypes.string,
|
|
125
|
+
})),
|
|
126
|
+
})),
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* The levels of the tree to display.
|
|
130
|
+
*/
|
|
131
|
+
displayDepth:PropTypes.number,
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
Tree.defaultProps = {
|
|
135
|
+
displayDepth:4,
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
export default Tree
|