@pareto-engineering/design-system 2.0.0-alpha.41 → 2.0.0-alpha.44
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/GradientBackground/GradientBackground.js +140 -0
- package/dist/cjs/a/GradientBackground/index.js +15 -0
- package/dist/cjs/a/GradientBackground/styles.scss +191 -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/index.js +9 -1
- package/dist/cjs/c/AcceptCookies/AcceptCookies.js +134 -0
- package/dist/cjs/c/AcceptCookies/index.js +15 -0
- package/dist/cjs/c/AcceptCookies/styles.scss +49 -0
- package/dist/cjs/c/BlogCategoryButton/BlogCategoryButton.js +95 -0
- package/dist/cjs/c/BlogCategoryButton/index.js +15 -0
- package/dist/cjs/c/BlogContext/BlogContextProvider.js +63 -0
- package/dist/cjs/c/BlogContext/Context.js +16 -0
- package/dist/cjs/c/BlogContext/ContextProvider.js +63 -0
- package/dist/cjs/c/BlogContext/index.js +31 -0
- package/dist/cjs/c/BlogContext/useBlog.js +16 -0
- package/dist/cjs/c/BlogPost/BlogPost.js +147 -0
- package/dist/cjs/c/BlogPost/index.js +15 -0
- package/dist/cjs/c/BlogPost/styles.scss +33 -0
- package/dist/cjs/c/BlogPostsList/BlogPostsList.js +73 -0
- package/dist/cjs/c/BlogPostsList/common/Card/Card.js +170 -0
- package/dist/cjs/c/BlogPostsList/common/Card/index.js +15 -0
- package/dist/cjs/c/BlogPostsList/common/index.js +13 -0
- package/dist/cjs/c/BlogPostsList/index.js +15 -0
- package/dist/cjs/c/BlogPostsList/styles.scss +72 -0
- package/dist/cjs/c/SiteFooter/SiteFooter.js +73 -0
- package/dist/cjs/c/SiteFooter/common/Section/Section.js +95 -0
- package/dist/cjs/c/SiteFooter/common/Section/index.js +15 -0
- package/dist/cjs/c/SiteFooter/common/index.js +13 -0
- package/dist/cjs/c/SiteFooter/index.js +15 -0
- package/dist/cjs/c/SiteFooter/styles.scss +34 -0
- package/dist/cjs/c/SiteHeaderCTA/SiteHeaderCTA.js +108 -0
- package/dist/cjs/c/SiteHeaderCTA/index.js +15 -0
- package/dist/cjs/c/SiteHeaderCTA/styles.scss +44 -0
- package/dist/cjs/c/SiteMission/SiteMission.js +113 -0
- package/dist/cjs/c/SiteMission/index.js +15 -0
- package/dist/cjs/c/SiteMission/styles.scss +30 -0
- package/dist/cjs/c/SiteNavigation/SiteNavigation.js +130 -0
- package/dist/cjs/c/SiteNavigation/index.js +15 -0
- package/dist/cjs/c/SiteNavigation/styles.scss +118 -0
- package/dist/cjs/c/SiteOnboardingStep/SiteOnboardingStep.js +98 -0
- package/dist/cjs/c/SiteOnboardingStep/index.js +15 -0
- package/dist/cjs/c/SiteOnboardingStep/styles.scss +51 -0
- package/dist/cjs/c/SitePricing/SitePricing.js +108 -0
- package/dist/cjs/c/SitePricing/index.js +15 -0
- package/dist/cjs/c/SitePricing/styles.scss +73 -0
- package/dist/cjs/c/SiteServices/SiteServices.js +211 -0
- package/dist/cjs/c/SiteServices/index.js +15 -0
- package/dist/cjs/c/SiteServices/styles.scss +138 -0
- package/dist/cjs/c/TeamGallery/TeamGallery.js +80 -0
- package/dist/cjs/c/TeamGallery/common/PersonCard/PersonCard.js +84 -0
- package/dist/cjs/c/TeamGallery/common/PersonCard/index.js +15 -0
- package/dist/cjs/c/TeamGallery/common/index.js +13 -0
- package/dist/cjs/c/TeamGallery/index.js +15 -0
- package/dist/cjs/c/TeamGallery/styles.scss +100 -0
- package/dist/cjs/c/Testimonials/Testimonials.js +119 -0
- package/dist/cjs/c/Testimonials/index.js +15 -0
- package/dist/cjs/c/Testimonials/styles.scss +112 -0
- package/dist/cjs/experimental/GradientBackground/GradientBackground.js +98 -0
- package/dist/cjs/experimental/GradientBackground/index.js +15 -0
- package/dist/cjs/experimental/GradientBackground/styles.scss +64 -0
- package/dist/cjs/experimental/index.js +13 -0
- package/dist/cjs/f/FormInput/FormInput.js +5 -2
- package/dist/cjs/f/FormInput/styles.scss +11 -0
- package/dist/cjs/f/fields/CheckboxInput/CheckboxInput.js +105 -0
- package/dist/cjs/f/fields/CheckboxInput/index.js +15 -0
- package/dist/cjs/f/fields/CheckboxInput/styles.scss +28 -0
- package/dist/cjs/f/fields/QueryCombobox/QueryCombobox.js +222 -0
- package/dist/cjs/f/fields/QueryCombobox/common/Combobox/Combobox.js +148 -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 +229 -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 +65 -0
- package/dist/cjs/f/fields/RadioInput/RadioInput.js +110 -0
- package/dist/cjs/f/fields/RadioInput/index.js +15 -0
- package/dist/cjs/f/fields/RadioInput/styles.scss +26 -0
- package/dist/cjs/f/fields/SelectInput/SelectInput.js +0 -1
- package/dist/cjs/f/fields/SelectInput/styles.scss +8 -6
- package/dist/cjs/f/fields/TaskRecommendation/TaskRecommendation.js +129 -0
- package/dist/cjs/f/fields/TaskRecommendation/index.js +15 -0
- package/dist/cjs/f/fields/TaskRecommendation/styles.scss +37 -0
- package/dist/cjs/f/fields/TaskRecommendationInput/TaskRecommendationInput.js +131 -0
- package/dist/cjs/f/fields/TaskRecommendationInput/index.js +15 -0
- package/dist/cjs/f/fields/TaskRecommendationInput/styles.scss +41 -0
- package/dist/cjs/f/fields/TextArea/TextArea.js +141 -0
- package/dist/cjs/f/fields/TextArea/index.js +15 -0
- package/dist/cjs/f/fields/TextArea/styles.scss +19 -0
- 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/GradientBackground/GradientBackground.js +118 -0
- package/dist/es/a/GradientBackground/index.js +2 -0
- package/dist/es/a/GradientBackground/styles.scss +191 -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/index.js +2 -1
- package/dist/es/c/AcceptCookies/AcceptCookies.js +117 -0
- package/dist/es/c/AcceptCookies/index.js +2 -0
- package/dist/es/c/AcceptCookies/styles.scss +49 -0
- package/dist/es/c/BlogCategoryButton/BlogCategoryButton.js +68 -0
- package/dist/es/c/BlogCategoryButton/index.js +2 -0
- package/dist/es/c/BlogContext/BlogContextProvider.js +45 -0
- package/dist/es/c/BlogContext/Context.js +2 -0
- package/dist/es/c/BlogContext/ContextProvider.js +45 -0
- package/dist/es/c/BlogContext/index.js +4 -0
- package/dist/es/c/BlogContext/useBlog.js +3 -0
- package/dist/es/c/BlogPost/BlogPost.js +128 -0
- package/dist/es/c/BlogPost/index.js +2 -0
- package/dist/es/c/BlogPost/styles.scss +33 -0
- package/dist/es/c/BlogPostsList/BlogPostsList.js +56 -0
- package/dist/es/c/BlogPostsList/common/Card/Card.js +143 -0
- package/dist/es/c/BlogPostsList/common/Card/index.js +2 -0
- package/dist/es/c/BlogPostsList/common/index.js +1 -0
- package/dist/es/c/BlogPostsList/index.js +2 -0
- package/dist/es/c/BlogPostsList/styles.scss +72 -0
- package/dist/es/c/SiteFooter/SiteFooter.js +56 -0
- package/dist/es/c/SiteFooter/common/Section/Section.js +73 -0
- package/dist/es/c/SiteFooter/common/Section/index.js +2 -0
- package/dist/es/c/SiteFooter/common/index.js +1 -0
- package/dist/es/c/SiteFooter/index.js +2 -0
- package/dist/es/c/SiteFooter/styles.scss +34 -0
- package/dist/es/c/SiteHeaderCTA/SiteHeaderCTA.js +92 -0
- package/dist/es/c/SiteHeaderCTA/index.js +2 -0
- package/dist/es/c/SiteHeaderCTA/styles.scss +44 -0
- package/dist/es/c/SiteMission/SiteMission.js +96 -0
- package/dist/es/c/SiteMission/index.js +2 -0
- package/dist/es/c/SiteMission/styles.scss +30 -0
- package/dist/es/c/SiteNavigation/SiteNavigation.js +111 -0
- package/dist/es/c/SiteNavigation/index.js +2 -0
- package/dist/es/c/SiteNavigation/styles.scss +118 -0
- package/dist/es/c/SiteOnboardingStep/SiteOnboardingStep.js +81 -0
- package/dist/es/c/SiteOnboardingStep/index.js +2 -0
- package/dist/es/c/SiteOnboardingStep/styles.scss +51 -0
- package/dist/es/c/SitePricing/SitePricing.js +91 -0
- package/dist/es/c/SitePricing/index.js +2 -0
- package/dist/es/c/SitePricing/styles.scss +73 -0
- package/dist/es/c/SiteServices/SiteServices.js +195 -0
- package/dist/es/c/SiteServices/index.js +2 -0
- package/dist/es/c/SiteServices/styles.scss +138 -0
- package/dist/es/c/TeamGallery/TeamGallery.js +64 -0
- package/dist/es/c/TeamGallery/common/PersonCard/PersonCard.js +64 -0
- package/dist/es/c/TeamGallery/common/PersonCard/index.js +2 -0
- package/dist/es/c/TeamGallery/common/index.js +1 -0
- package/dist/es/c/TeamGallery/index.js +2 -0
- package/dist/es/c/TeamGallery/styles.scss +100 -0
- package/dist/es/c/Testimonials/Testimonials.js +99 -0
- package/dist/es/c/Testimonials/index.js +2 -0
- package/dist/es/c/Testimonials/styles.scss +112 -0
- package/dist/es/experimental/GradientBackground/GradientBackground.js +76 -0
- package/dist/es/experimental/GradientBackground/index.js +2 -0
- package/dist/es/experimental/GradientBackground/styles.scss +64 -0
- package/dist/es/experimental/index.js +1 -0
- package/dist/es/f/FormInput/FormInput.js +4 -1
- package/dist/es/f/FormInput/styles.scss +11 -0
- package/dist/es/f/fields/CheckboxInput/CheckboxInput.js +85 -0
- package/dist/es/f/fields/CheckboxInput/index.js +2 -0
- package/dist/es/f/fields/CheckboxInput/styles.scss +28 -0
- package/dist/es/f/fields/QueryCombobox/QueryCombobox.js +197 -0
- package/dist/es/f/fields/QueryCombobox/common/Combobox/Combobox.js +129 -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 +202 -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 +65 -0
- package/dist/es/f/fields/RadioInput/RadioInput.js +90 -0
- package/dist/es/f/fields/RadioInput/index.js +2 -0
- package/dist/es/f/fields/RadioInput/styles.scss +26 -0
- package/dist/es/f/fields/SelectInput/SelectInput.js +0 -1
- package/dist/es/f/fields/SelectInput/styles.scss +8 -6
- package/dist/es/f/fields/TaskRecommendation/TaskRecommendation.js +111 -0
- package/dist/es/f/fields/TaskRecommendation/index.js +2 -0
- package/dist/es/f/fields/TaskRecommendation/styles.scss +37 -0
- package/dist/es/f/fields/TaskRecommendationInput/TaskRecommendationInput.js +111 -0
- package/dist/es/f/fields/TaskRecommendationInput/index.js +2 -0
- package/dist/es/f/fields/TaskRecommendationInput/styles.scss +41 -0
- package/dist/es/f/fields/TextArea/TextArea.js +124 -0
- package/dist/es/f/fields/TextArea/index.js +2 -0
- package/dist/es/f/fields/TextArea/styles.scss +19 -0
- 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 +14 -2
- package/relay.config.js +12 -0
- package/schema.graphql +4075 -0
- package/scripts/fetchSchema.js +74 -0
- package/src/__snapshots__/Storyshots.test.js.snap +422 -8
- package/src/stories/a/Popover.stories.jsx +106 -0
- package/src/stories/test/QueryLoader.stories.jsx +36 -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/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/index.js +1 -0
- package/src/ui/f/FormInput/FormInput.jsx +5 -1
- package/src/ui/f/FormInput/styles.scss +11 -0
- package/src/ui/f/fields/SelectInput/SelectInput.jsx +1 -1
- package/src/ui/f/fields/SelectInput/styles.scss +8 -6
- 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
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
/* @pareto-engineering/generator-front 1.0.12 */
|
|
2
|
+
import * as React from 'react'
|
|
3
|
+
|
|
4
|
+
import { useState, useRef } from 'react'
|
|
5
|
+
|
|
6
|
+
import { Popover } from 'ui'
|
|
7
|
+
|
|
8
|
+
import lorem from '../utils/lorem'
|
|
9
|
+
|
|
10
|
+
export default {
|
|
11
|
+
title :'a/Popover',
|
|
12
|
+
component :Popover,
|
|
13
|
+
// subcomponents:{
|
|
14
|
+
// Item :Popover.Item,
|
|
15
|
+
// },
|
|
16
|
+
decorators:[
|
|
17
|
+
// storyfn => <div className="">{ storyfn() }</div>,
|
|
18
|
+
],
|
|
19
|
+
argTypes:{
|
|
20
|
+
preferredPrimaryOrder:{
|
|
21
|
+
options:['bottom', 'top', 'left', 'right'],
|
|
22
|
+
control:{ type: 'object' },
|
|
23
|
+
},
|
|
24
|
+
preferredSecondaryOrder:{
|
|
25
|
+
options:['left', 'right'],
|
|
26
|
+
control:{ type: 'object' },
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const Template = ({ ...props }) => {
|
|
32
|
+
const parentRef = useRef(null)
|
|
33
|
+
const [isOpen, setIsOpen] = useState(false)
|
|
34
|
+
|
|
35
|
+
const handleClick = () => {
|
|
36
|
+
setIsOpen(!isOpen)
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
return (
|
|
40
|
+
<main
|
|
41
|
+
className="u1 ph-u"
|
|
42
|
+
>
|
|
43
|
+
<div>
|
|
44
|
+
{lorem}
|
|
45
|
+
{lorem}
|
|
46
|
+
</div>
|
|
47
|
+
|
|
48
|
+
<div
|
|
49
|
+
style={{
|
|
50
|
+
position :'relative',
|
|
51
|
+
textAlign:'center',
|
|
52
|
+
width :'min-content',
|
|
53
|
+
margin :'0 auto',
|
|
54
|
+
}}
|
|
55
|
+
ref={parentRef}
|
|
56
|
+
>
|
|
57
|
+
<button
|
|
58
|
+
type="button"
|
|
59
|
+
onClick={handleClick}
|
|
60
|
+
>
|
|
61
|
+
{ isOpen ? 'Close Popover' : 'Open Popover'}
|
|
62
|
+
</button>
|
|
63
|
+
<Popover
|
|
64
|
+
isOpen={isOpen}
|
|
65
|
+
parentRef={parentRef}
|
|
66
|
+
{...props}
|
|
67
|
+
>
|
|
68
|
+
<ul>
|
|
69
|
+
<li>Company</li>
|
|
70
|
+
<li>Pareto Engineers</li>
|
|
71
|
+
<li>Pareto Core Team</li>
|
|
72
|
+
</ul>
|
|
73
|
+
</Popover>
|
|
74
|
+
</div>
|
|
75
|
+
|
|
76
|
+
<div>
|
|
77
|
+
{lorem}
|
|
78
|
+
{lorem}
|
|
79
|
+
</div>
|
|
80
|
+
</main>
|
|
81
|
+
)
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export const BottomLeft = Template.bind({})
|
|
85
|
+
BottomLeft.args = {
|
|
86
|
+
preferredPrimaryOrder :['bottom', 'top', 'left', 'right'],
|
|
87
|
+
preferredSecondaryOrder:['left', 'right', 'bottom', 'top'],
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export const BottomRight = Template.bind({})
|
|
91
|
+
BottomRight.args = {
|
|
92
|
+
preferredPrimaryOrder :['bottom', 'top', 'left', 'right'],
|
|
93
|
+
preferredSecondaryOrder:['right', 'left', 'bottom', 'top'],
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
export const TopLeft = Template.bind({})
|
|
97
|
+
TopLeft.args = {
|
|
98
|
+
preferredPrimaryOrder :['top', 'bottom', 'left', 'right'],
|
|
99
|
+
preferredSecondaryOrder:['left', 'right', 'top', 'bottom'],
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
export const TopRight = Template.bind({})
|
|
103
|
+
TopRight.args = {
|
|
104
|
+
preferredPrimaryOrder :['top', 'bottom', 'left', 'right'],
|
|
105
|
+
preferredSecondaryOrder:['right', 'left', 'top', 'bottom'],
|
|
106
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/* @pareto-engineering/generator-front 1.0.12 */
|
|
2
|
+
import * as React from 'react'
|
|
3
|
+
|
|
4
|
+
import { QueryLoader } from 'ui'
|
|
5
|
+
|
|
6
|
+
import {
|
|
7
|
+
RelayEnvironmentProvider,
|
|
8
|
+
mockRelayOperation,
|
|
9
|
+
} from '../utils/relay'
|
|
10
|
+
|
|
11
|
+
export default {
|
|
12
|
+
title :'test/QueryLoader',
|
|
13
|
+
component :QueryLoader,
|
|
14
|
+
subcomponents:{
|
|
15
|
+
// Item:QueryLoader.Item
|
|
16
|
+
},
|
|
17
|
+
decorators:[
|
|
18
|
+
// storyfn => <div className="">{ storyfn() }</div>,
|
|
19
|
+
(storyfn) => (
|
|
20
|
+
<RelayEnvironmentProvider>
|
|
21
|
+
{ storyfn() }
|
|
22
|
+
</RelayEnvironmentProvider>
|
|
23
|
+
),
|
|
24
|
+
],
|
|
25
|
+
argTypes:{
|
|
26
|
+
backgroundColor:{ control: 'color' },
|
|
27
|
+
},
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export const Base = () => {
|
|
31
|
+
mockRelayOperation()
|
|
32
|
+
|
|
33
|
+
return (
|
|
34
|
+
<QueryLoader />
|
|
35
|
+
)
|
|
36
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export default `Lorem ipsum dolor sit amet consectetur adipisicing elit. Est cupiditate temporibus quos officia, incidunt nesciunt dolorum eligendi, aspernatur voluptates sequi natus tempora autem molestias, illo reprehenderit mollitia. Voluptas, quaerat sequi?
|
|
2
|
+
Magnam excepturi impedit odit consectetur quaerat, provident, quod facere, ipsa distinctio quae expedita! Doloribus adipisci harum dicta nulla commodi cum incidunt dignissimos? Id accusantium quos ullam placeat necessitatibus. Mollitia, debitis?
|
|
3
|
+
Repudiandae odio alias odit vel voluptatibus officiis, quod praesentium adipisci, in optio voluptate magnam? Ab saepe maxime, corrupti dolore natus quis accusantium hic iste ullam harum repellat sint commodi cum?
|
|
4
|
+
Vero et accusamus voluptatibus exercitationem, perspiciatis nisi tempora, autem consectetur deserunt ex fugiat cum iure sed dolore, perferendis eos quia voluptate. Ratione autem minus quas iure dicta doloribus ad nulla!
|
|
5
|
+
Saepe, ipsum nisi impedit similique vel eligendi ex quidem ea rem officiis praesentium dolores ipsa sit cumque eaque distinctio soluta qui dolore veniam accusamus facilis voluptas minus. Animi, sequi necessitatibus?
|
|
6
|
+
Explicabo in nisi, id rerum omnis doloribus error! Delectus quasi consequuntur, adipisci tempore eaque, ad ipsa porro consectetur natus architecto iure aut aliquid tenetur totam unde illum saepe, ipsum deserunt!
|
|
7
|
+
Dicta assumenda odit eius tempora illo veniam ea ab enim? Maxime suscipit quae quas sunt eveniet tempora nesciunt, itaque aliquam deserunt culpa eius enim asperiores eum beatae dolore modi sit.
|
|
8
|
+
Exercitationem aliquid dicta dolorum sequi odit beatae vitae velit architecto, atque ratione quaerat distinctio eaque voluptatibus voluptate nihil, quibusdam porro, eveniet nostrum voluptas. Sed ex facere, illum dolorum soluta blanditiis.
|
|
9
|
+
Est possimus reprehenderit fugit asperiores dolores deserunt officia quo, sed dignissimos at inventore nulla officiis quaerat? Quia quam consequuntur aliquid! Laborum suscipit voluptate quod et officia dicta voluptatum odio impedit.
|
|
10
|
+
Voluptate blanditiis nobis cum non sunt nisi, magni dignissimos qui repellat facilis labore, commodi eveniet totam velit voluptatibus ipsa omnis delectus quod incidunt veniam. Quibusdam amet voluptatum eos reiciendis ullam!
|
|
11
|
+
Eaque quas laudantium repudiandae quidem similique totam delectus fugit, iusto a vero molestias placeat nisi aspernatur corporis blanditiis excepturi. Illo inventore consectetur ullam magnam labore minus a ex laboriosam iusto.
|
|
12
|
+
Mollitia deserunt modi neque asperiores temporibus cum quae numquam quidem! Quisquam sequi nisi sed accusamus velit consectetur omnis iusto. Laudantium omnis sunt eius laborum quia iusto minima excepturi officiis veniam.
|
|
13
|
+
Laboriosam laborum praesentium sunt molestias. Consectetur, fugit laudantium. Facilis odit illum deserunt beatae at alias. Quaerat, quam facere quis, iure autem veniam maiores impedit ea rerum, totam officiis eveniet eum.
|
|
14
|
+
Maxime, nostrum? Adipisci provident eius cupiditate necessitatibus similique debitis sed amet, suscipit doloribus dicta? Numquam optio mollitia facere eligendi, culpa quibusdam accusamus rerum minus iure, sequi, necessitatibus sunt quas ratione?
|
|
15
|
+
Delectus, sit architecto ab labore temporibus sunt reiciendis nihil. Ea quaerat numquam molestiae, nostrum, similique adipisci molestias esse beatae incidunt vero ex tempora! Recusandae temporibus, vero saepe fugiat voluptatem asperior`
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { RelayEnvironmentProvider } from 'react-relay/hooks'
|
|
3
|
+
|
|
4
|
+
import environment from './environment'
|
|
5
|
+
|
|
6
|
+
const RelayEnvProvider = (props) => (
|
|
7
|
+
<RelayEnvironmentProvider
|
|
8
|
+
environment={environment}
|
|
9
|
+
// history={history}
|
|
10
|
+
{...props}
|
|
11
|
+
/>
|
|
12
|
+
)
|
|
13
|
+
|
|
14
|
+
export default RelayEnvProvider
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { MockPayloadGenerator } from 'relay-test-utils'
|
|
2
|
+
import relayEnvironment from './environment'
|
|
3
|
+
import mockResolvers from './mockResolvers'
|
|
4
|
+
|
|
5
|
+
function mockRelayOperation(overrideMockResolvers = null) {
|
|
6
|
+
relayEnvironment.mock.queueOperationResolver(
|
|
7
|
+
(operation) => MockPayloadGenerator.generate(
|
|
8
|
+
operation,
|
|
9
|
+
overrideMockResolvers || mockResolvers,
|
|
10
|
+
),
|
|
11
|
+
)
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export default mockRelayOperation
|
|
@@ -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,157 @@
|
|
|
1
|
+
/* @pareto-engineering/generator-front 1.0.12 */
|
|
2
|
+
import * as React from 'react'
|
|
3
|
+
|
|
4
|
+
import { useRef, useLayoutEffect } from 'react'
|
|
5
|
+
|
|
6
|
+
import PropTypes from 'prop-types'
|
|
7
|
+
|
|
8
|
+
import styleNames from '@pareto-engineering/bem'
|
|
9
|
+
|
|
10
|
+
// Local Definitions
|
|
11
|
+
import { useDynamicPosition } from 'ui/utils'
|
|
12
|
+
|
|
13
|
+
const baseClassName = styleNames.base
|
|
14
|
+
|
|
15
|
+
const componentClassName = 'popover'
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* This is the component description.
|
|
19
|
+
*/
|
|
20
|
+
const Popover = ({
|
|
21
|
+
id,
|
|
22
|
+
className:userClassName,
|
|
23
|
+
style,
|
|
24
|
+
color,
|
|
25
|
+
children,
|
|
26
|
+
isOpen,
|
|
27
|
+
parentRef,
|
|
28
|
+
preferredPrimaryOrder,
|
|
29
|
+
preferredSecondaryOrder,
|
|
30
|
+
offsetXPx,
|
|
31
|
+
offsetYPx,
|
|
32
|
+
// ...otherProps
|
|
33
|
+
}) => {
|
|
34
|
+
useLayoutEffect(() => {
|
|
35
|
+
import('./styles.scss')
|
|
36
|
+
}, [])
|
|
37
|
+
|
|
38
|
+
const popoverRef = useRef(null)
|
|
39
|
+
const {
|
|
40
|
+
primaryPosition,
|
|
41
|
+
secondaryPosition,
|
|
42
|
+
} = useDynamicPosition({
|
|
43
|
+
preferredPrimaryOrder,
|
|
44
|
+
preferredSecondaryOrder,
|
|
45
|
+
elementRef:popoverRef,
|
|
46
|
+
parentRef,
|
|
47
|
+
offsetXPx,
|
|
48
|
+
offsetYPx,
|
|
49
|
+
})
|
|
50
|
+
|
|
51
|
+
return (
|
|
52
|
+
<div
|
|
53
|
+
id={id}
|
|
54
|
+
className={[
|
|
55
|
+
baseClassName,
|
|
56
|
+
componentClassName,
|
|
57
|
+
userClassName,
|
|
58
|
+
isOpen && 'open',
|
|
59
|
+
`x-${color}`,
|
|
60
|
+
primaryPosition,
|
|
61
|
+
secondaryPosition,
|
|
62
|
+
]
|
|
63
|
+
.filter((e) => e)
|
|
64
|
+
.join(' ')}
|
|
65
|
+
style={style}
|
|
66
|
+
ref={popoverRef}
|
|
67
|
+
// {...otherProps}
|
|
68
|
+
>
|
|
69
|
+
{children}
|
|
70
|
+
</div>
|
|
71
|
+
)
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
Popover.propTypes = {
|
|
75
|
+
/**
|
|
76
|
+
* The HTML id for this element
|
|
77
|
+
*/
|
|
78
|
+
id:PropTypes.string,
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* The HTML class names for this element
|
|
82
|
+
*/
|
|
83
|
+
className:PropTypes.string,
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* The React-written, css properties for this element.
|
|
87
|
+
*/
|
|
88
|
+
style:PropTypes.objectOf(PropTypes.string),
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* The children JSX
|
|
92
|
+
*/
|
|
93
|
+
children:PropTypes.node,
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* The base color of the popover
|
|
97
|
+
*/
|
|
98
|
+
color:PropTypes.string,
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Whether the popover should be visible or not
|
|
102
|
+
*/
|
|
103
|
+
isOpen:PropTypes.bool,
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* The preferred primary position order of the popover
|
|
107
|
+
*/
|
|
108
|
+
preferredPrimaryOrder:PropTypes.arrayOf(
|
|
109
|
+
PropTypes.oneOf([
|
|
110
|
+
'bottom',
|
|
111
|
+
'top',
|
|
112
|
+
'right',
|
|
113
|
+
'left',
|
|
114
|
+
]),
|
|
115
|
+
),
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* The preferred secondary position order of the popover
|
|
119
|
+
*/
|
|
120
|
+
preferredSecondaryOrder:PropTypes.arrayOf(
|
|
121
|
+
PropTypes.oneOf([
|
|
122
|
+
'left',
|
|
123
|
+
'right',
|
|
124
|
+
'bottom',
|
|
125
|
+
'top',
|
|
126
|
+
]),
|
|
127
|
+
),
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* The horizonal offset in pixels from the anchor point to the popover
|
|
131
|
+
*/
|
|
132
|
+
offsetXPx:PropTypes.number,
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* The vertical offset in pixels from the anchor point to the popover
|
|
136
|
+
*/
|
|
137
|
+
offsetYPx:PropTypes.number,
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* The reference to the parent element
|
|
141
|
+
*/
|
|
142
|
+
parentRef:PropTypes.oneOfType([
|
|
143
|
+
PropTypes.func,
|
|
144
|
+
PropTypes.shape({ current: PropTypes.instanceOf(Element) }),
|
|
145
|
+
]),
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
Popover.defaultProps = {
|
|
149
|
+
color :'background1',
|
|
150
|
+
isOpen :false,
|
|
151
|
+
preferredPrimaryOrder :['bottom', 'top', 'right', 'left'],
|
|
152
|
+
preferredSecondaryOrder:['left', 'right', 'bottom', 'top'],
|
|
153
|
+
offsetXPx :16,
|
|
154
|
+
offsetYPx :0,
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
export default Popover
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/* @pareto-engineering/generator-front 1.0.12 */
|
|
2
|
+
@use "@pareto-engineering/bem";
|
|
3
|
+
|
|
4
|
+
$default-border: var(--theme-border-style) var(--metadata);
|
|
5
|
+
|
|
6
|
+
.#{bem.$base}.popover {
|
|
7
|
+
position: absolute;
|
|
8
|
+
z-index: 1;
|
|
9
|
+
background-color: var(--x);
|
|
10
|
+
border: $default-border;
|
|
11
|
+
|
|
12
|
+
&:not(.open) {
|
|
13
|
+
display: none;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
&.bottom {
|
|
17
|
+
top: 100%;
|
|
18
|
+
// bottom: 0;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
&.left {
|
|
22
|
+
left: 0;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
&.right {
|
|
26
|
+
right: 0;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
&.top {
|
|
30
|
+
bottom: 100%;
|
|
31
|
+
top: auto;
|
|
32
|
+
}
|
|
33
|
+
}
|
package/src/ui/a/index.js
CHANGED