@pareto-engineering/design-system 2.0.0-alpha.4 → 2.0.0-alpha.42

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.
Files changed (225) hide show
  1. package/dist/cjs/a/BackgroundGradient/BackgroundGradient.js +77 -0
  2. package/dist/cjs/a/BackgroundGradient/index.js +15 -0
  3. package/dist/cjs/a/BackgroundGradient/styles.scss +16 -0
  4. package/dist/cjs/a/ContentTree/ContentTree.js +83 -0
  5. package/dist/cjs/a/ContentTree/common/Tree/Tree.js +116 -0
  6. package/dist/cjs/a/ContentTree/common/Tree/index.js +15 -0
  7. package/dist/cjs/a/ContentTree/common/index.js +31 -0
  8. package/dist/cjs/a/ContentTree/common/useContentTree.js +82 -0
  9. package/dist/cjs/a/ContentTree/common/useFirstVisibleNode.js +65 -0
  10. package/dist/cjs/a/ContentTree/index.js +15 -0
  11. package/dist/cjs/a/ContentTree/styles.scss +33 -0
  12. package/dist/cjs/a/Conversation/Conversation.js +14 -8
  13. package/dist/cjs/a/Conversation/common/Message/Message.js +32 -6
  14. package/dist/cjs/a/Conversation/styles.scss +132 -33
  15. package/dist/cjs/a/OvalIllustration/OvalIllustration.js +133 -0
  16. package/dist/cjs/a/OvalIllustration/index.js +15 -0
  17. package/dist/cjs/a/OvalIllustration/styles.scss +102 -0
  18. package/dist/cjs/a/Popover/Popover.js +134 -0
  19. package/dist/cjs/a/Popover/common/Divider/Divider.js +67 -0
  20. package/dist/cjs/a/Popover/common/Divider/index.js +15 -0
  21. package/dist/cjs/a/Popover/common/Item/Item.js +67 -0
  22. package/dist/cjs/a/Popover/common/Item/index.js +15 -0
  23. package/dist/cjs/a/Popover/common/index.js +21 -0
  24. package/dist/cjs/a/Popover/index.js +15 -0
  25. package/dist/cjs/a/Popover/styles.scss +43 -0
  26. package/dist/cjs/a/Shapes/Shapes.js +39 -9
  27. package/dist/cjs/a/Shapes/styles.scss +78 -22
  28. package/dist/cjs/a/SnapScroller/SnapScroller.js +77 -0
  29. package/dist/cjs/a/SnapScroller/index.js +15 -0
  30. package/dist/cjs/a/SnapScroller/styles.scss +38 -0
  31. package/dist/cjs/a/index.js +49 -1
  32. package/dist/cjs/b/Button/Button.js +10 -4
  33. package/dist/cjs/b/Button/styles.scss +55 -10
  34. package/dist/cjs/b/Logo/Logo.js +41 -41
  35. package/dist/cjs/b/Logo/styles.scss +0 -138
  36. package/dist/cjs/b/Page/common/Section/Section.js +56 -5
  37. package/dist/cjs/b/Page/styles.scss +8 -2
  38. package/dist/cjs/c/ContentSlides/common/HorizontalMenu/HorizontalMenu.js +16 -9
  39. package/dist/cjs/c/ContentSlides/common/Navigator/Navigator.js +4 -3
  40. package/dist/cjs/c/ContentSlides/styles.scss +10 -4
  41. package/dist/cjs/c/SocialMediaShareButton/SocialMediaShareButton.js +105 -0
  42. package/dist/cjs/c/SocialMediaShareButton/index.js +15 -0
  43. package/dist/cjs/c/SocialMediaShareButton/styles.scss +39 -0
  44. package/dist/cjs/c/index.js +9 -1
  45. package/dist/cjs/f/common/Debugger/Debugger.js +1 -1
  46. package/dist/cjs/f/common/Label/Label.js +1 -1
  47. package/dist/cjs/f/common/Label/styles.scss +1 -1
  48. package/dist/cjs/f/fields/ChoicesInput/ChoicesInput.js +1 -1
  49. package/dist/cjs/f/fields/ChoicesInput/styles.scss +17 -2
  50. package/dist/cjs/f/fields/RatingsInput/RatingsInput.js +39 -6
  51. package/dist/cjs/f/fields/RatingsInput/styles.scss +29 -20
  52. package/dist/cjs/f/fields/SelectInput/SelectInput.js +36 -10
  53. package/dist/cjs/f/fields/SelectInput/styles.scss +13 -8
  54. package/dist/cjs/f/fields/TaskRecommendationInput/TaskRecommendationInput.js +1 -1
  55. package/dist/cjs/f/fields/TextInput/TextInput.js +35 -7
  56. package/dist/cjs/f/fields/TextInput/styles.scss +16 -7
  57. package/dist/cjs/f/fields/TextareaInput/TextareaInput.js +15 -8
  58. package/dist/cjs/f/fields/TextareaInput/styles.scss +19 -6
  59. package/dist/cjs/f/fields/index.js +0 -24
  60. package/dist/cjs/form-reset.scss +1 -1
  61. package/dist/cjs/index.js +13 -0
  62. package/dist/cjs/utils/hooks/index.js +23 -0
  63. package/dist/cjs/utils/hooks/useDynamicPosition.js +107 -0
  64. package/dist/cjs/utils/hooks/useWindowSize.js +39 -0
  65. package/dist/cjs/utils/index.js +19 -0
  66. package/dist/es/a/BackgroundGradient/BackgroundGradient.js +55 -0
  67. package/dist/es/a/BackgroundGradient/index.js +2 -0
  68. package/dist/es/a/BackgroundGradient/styles.scss +16 -0
  69. package/dist/es/a/ContentTree/ContentTree.js +67 -0
  70. package/dist/es/a/ContentTree/common/Tree/Tree.js +98 -0
  71. package/dist/es/a/ContentTree/common/Tree/index.js +2 -0
  72. package/dist/es/a/ContentTree/common/index.js +3 -0
  73. package/dist/es/a/ContentTree/common/useContentTree.js +74 -0
  74. package/dist/es/a/ContentTree/common/useFirstVisibleNode.js +54 -0
  75. package/dist/es/a/ContentTree/index.js +2 -0
  76. package/dist/es/a/ContentTree/styles.scss +33 -0
  77. package/dist/es/a/Conversation/Conversation.js +14 -8
  78. package/dist/es/a/Conversation/common/Message/Message.js +32 -6
  79. package/dist/es/a/Conversation/styles.scss +132 -33
  80. package/dist/es/a/OvalIllustration/OvalIllustration.js +111 -0
  81. package/dist/es/a/OvalIllustration/index.js +2 -0
  82. package/dist/es/a/OvalIllustration/styles.scss +102 -0
  83. package/dist/es/a/Popover/Popover.js +118 -0
  84. package/dist/es/a/Popover/common/Divider/Divider.js +47 -0
  85. package/dist/es/a/Popover/common/Divider/index.js +2 -0
  86. package/dist/es/a/Popover/common/Item/Item.js +47 -0
  87. package/dist/es/a/Popover/common/Item/index.js +2 -0
  88. package/dist/es/a/Popover/common/index.js +2 -0
  89. package/dist/es/a/Popover/index.js +2 -0
  90. package/dist/es/a/Popover/styles.scss +43 -0
  91. package/dist/es/a/Shapes/Shapes.js +39 -9
  92. package/dist/es/a/Shapes/styles.scss +78 -22
  93. package/dist/es/a/SnapScroller/SnapScroller.js +61 -0
  94. package/dist/es/a/SnapScroller/index.js +2 -0
  95. package/dist/es/a/SnapScroller/styles.scss +38 -0
  96. package/dist/es/a/index.js +7 -1
  97. package/dist/es/b/Button/Button.js +8 -2
  98. package/dist/es/b/Button/styles.scss +55 -10
  99. package/dist/es/b/Logo/Logo.js +41 -41
  100. package/dist/es/b/Logo/styles.scss +0 -138
  101. package/dist/es/b/Page/common/Section/Section.js +55 -4
  102. package/dist/es/b/Page/styles.scss +8 -2
  103. package/dist/es/c/ContentSlides/common/HorizontalMenu/HorizontalMenu.js +16 -9
  104. package/dist/es/c/ContentSlides/common/Navigator/Navigator.js +4 -3
  105. package/dist/es/c/ContentSlides/styles.scss +10 -4
  106. package/dist/es/c/SocialMediaShareButton/SocialMediaShareButton.js +89 -0
  107. package/dist/es/c/SocialMediaShareButton/index.js +2 -0
  108. package/dist/es/c/SocialMediaShareButton/styles.scss +39 -0
  109. package/dist/es/c/index.js +2 -1
  110. package/dist/es/f/common/Debugger/Debugger.js +1 -1
  111. package/dist/es/f/common/Label/Label.js +1 -1
  112. package/dist/es/f/common/Label/styles.scss +1 -1
  113. package/dist/es/f/fields/ChoicesInput/ChoicesInput.js +1 -1
  114. package/dist/es/f/fields/ChoicesInput/styles.scss +17 -2
  115. package/dist/es/f/fields/RatingsInput/RatingsInput.js +38 -6
  116. package/dist/es/f/fields/RatingsInput/styles.scss +29 -20
  117. package/dist/es/f/fields/SelectInput/SelectInput.js +36 -10
  118. package/dist/es/f/fields/SelectInput/styles.scss +13 -8
  119. package/dist/es/f/fields/TaskRecommendationInput/TaskRecommendationInput.js +1 -1
  120. package/dist/es/f/fields/TextInput/TextInput.js +35 -7
  121. package/dist/es/f/fields/TextInput/styles.scss +16 -7
  122. package/dist/es/f/fields/TextareaInput/TextareaInput.js +15 -8
  123. package/dist/es/f/fields/TextareaInput/styles.scss +19 -6
  124. package/dist/es/f/fields/index.js +0 -3
  125. package/dist/es/form-reset.scss +1 -1
  126. package/dist/es/index.js +2 -1
  127. package/dist/es/utils/hooks/index.js +2 -0
  128. package/dist/es/utils/hooks/useDynamicPosition.js +93 -0
  129. package/dist/es/utils/hooks/useWindowSize.js +27 -0
  130. package/dist/es/utils/index.js +1 -0
  131. package/package.json +4 -3
  132. package/src/__snapshots__/Storyshots.test.js.snap +4755 -1734
  133. package/src/local.scss +2 -0
  134. package/src/stories/StyleGuide/Sprites.stories.mdx +25 -0
  135. package/src/stories/StyleGuide/helpers.js +16 -0
  136. package/src/stories/a/BackgroundGradient.stories.jsx +38 -0
  137. package/src/stories/a/ContentTree.stories.jsx +662 -0
  138. package/src/stories/a/Conversation.stories.jsx +78 -1
  139. package/src/stories/a/OvalIllustration.stories.jsx +59 -0
  140. package/src/stories/a/Popover.stories.jsx +106 -0
  141. package/src/stories/a/Shapes.stories.jsx +143 -0
  142. package/src/stories/a/SnapScroller.stories.jsx +98 -0
  143. package/src/stories/b/Button.stories.jsx +27 -4
  144. package/src/stories/b/Logo.stories.jsx +17 -9
  145. package/src/stories/b/Page.stories.jsx +51 -1
  146. package/src/stories/c/ContentSlides.stories.jsx +154 -2
  147. package/src/stories/c/SocialMediaShareButton.stories.jsx +25 -0
  148. package/src/stories/f/RatingsInput.stories.jsx +3 -2
  149. package/src/stories/f/SelectInput.stories.jsx +36 -5
  150. package/src/stories/f/TextInput.stories.jsx +15 -4
  151. package/src/stories/f/TextareaInput.stories.jsx +42 -6
  152. package/src/stories/utils/lorem.js +15 -0
  153. package/src/ui/a/BackgroundGradient/BackgroundGradient.jsx +76 -0
  154. package/src/ui/a/BackgroundGradient/index.js +2 -0
  155. package/src/ui/a/BackgroundGradient/styles.scss +16 -0
  156. package/src/ui/a/ContentTree/ContentTree.jsx +88 -0
  157. package/src/ui/a/ContentTree/common/Tree/Tree.jsx +138 -0
  158. package/src/ui/a/ContentTree/common/Tree/index.js +2 -0
  159. package/src/ui/a/ContentTree/common/index.js +3 -0
  160. package/src/ui/a/ContentTree/common/useContentTree.js +83 -0
  161. package/src/ui/a/ContentTree/common/useFirstVisibleNode.js +59 -0
  162. package/src/ui/a/ContentTree/index.js +2 -0
  163. package/src/ui/a/ContentTree/styles.scss +33 -0
  164. package/src/ui/a/Conversation/Conversation.jsx +15 -7
  165. package/src/ui/a/Conversation/common/Message/Message.jsx +38 -6
  166. package/src/ui/a/Conversation/styles.scss +132 -33
  167. package/src/ui/a/OvalIllustration/OvalIllustration.jsx +134 -0
  168. package/src/ui/a/OvalIllustration/index.js +2 -0
  169. package/src/ui/a/OvalIllustration/styles.scss +102 -0
  170. package/src/ui/a/Popover/Popover.jsx +157 -0
  171. package/src/ui/a/Popover/index.js +2 -0
  172. package/src/ui/a/Popover/styles.scss +43 -0
  173. package/src/ui/a/Shapes/Shapes.jsx +191 -0
  174. package/src/ui/a/Shapes/index.js +2 -0
  175. package/src/ui/a/Shapes/styles.scss +255 -0
  176. package/src/ui/a/SnapScroller/SnapScroller.jsx +83 -0
  177. package/src/ui/a/SnapScroller/index.js +2 -0
  178. package/src/ui/a/SnapScroller/styles.scss +38 -0
  179. package/src/ui/a/index.js +6 -0
  180. package/src/ui/b/Button/Button.jsx +9 -1
  181. package/src/ui/b/Button/styles.scss +55 -10
  182. package/src/ui/b/Logo/Logo.jsx +41 -41
  183. package/src/ui/b/Logo/styles.scss +0 -138
  184. package/src/ui/b/Page/common/Section/Section.jsx +68 -2
  185. package/src/ui/b/Page/styles.scss +8 -2
  186. package/src/ui/c/ContentSlides/common/HorizontalMenu/HorizontalMenu.jsx +12 -5
  187. package/src/ui/c/ContentSlides/common/Navigator/Navigator.jsx +3 -2
  188. package/src/ui/c/ContentSlides/styles.scss +10 -4
  189. package/src/ui/c/SocialMediaShareButton/SocialMediaShareButton.jsx +113 -0
  190. package/src/ui/c/SocialMediaShareButton/index.js +2 -0
  191. package/src/ui/c/SocialMediaShareButton/styles.scss +39 -0
  192. package/src/ui/c/index.js +1 -0
  193. package/src/ui/f/common/Debugger/Debugger.jsx +1 -1
  194. package/src/ui/f/common/Label/Label.jsx +1 -1
  195. package/src/ui/f/common/Label/styles.scss +1 -1
  196. package/src/ui/f/fields/ChoicesInput/ChoicesInput.jsx +1 -1
  197. package/src/ui/f/fields/ChoicesInput/styles.scss +17 -2
  198. package/src/ui/f/fields/RatingsInput/RatingsInput.jsx +54 -19
  199. package/src/ui/f/fields/RatingsInput/styles.scss +29 -20
  200. package/src/ui/f/fields/SelectInput/SelectInput.jsx +43 -5
  201. package/src/ui/f/fields/SelectInput/styles.scss +13 -8
  202. package/src/ui/f/fields/TextInput/TextInput.jsx +31 -3
  203. package/src/ui/f/fields/TextInput/styles.scss +16 -7
  204. package/src/ui/f/fields/TextareaInput/TextareaInput.jsx +24 -13
  205. package/src/ui/f/fields/TextareaInput/styles.scss +19 -6
  206. package/src/ui/f/fields/index.js +0 -3
  207. package/src/ui/form-reset.scss +1 -1
  208. package/src/ui/index.js +1 -0
  209. package/src/ui/utils/hooks/index.js +2 -0
  210. package/src/ui/utils/hooks/useDynamicPosition.js +104 -0
  211. package/src/ui/utils/hooks/useWindowSize.js +32 -0
  212. package/src/ui/utils/index.js +1 -0
  213. package/stylelint.config.js +13 -13
  214. package/src/stories/f/CheckboxInput.stories.jsx +0 -37
  215. package/src/stories/f/RadioInput.stories.jsx +0 -37
  216. package/src/stories/f/TaskRecommendationInput.stories.jsx +0 -38
  217. package/src/ui/f/fields/CheckboxInput/CheckboxInput.jsx +0 -107
  218. package/src/ui/f/fields/CheckboxInput/index.js +0 -2
  219. package/src/ui/f/fields/CheckboxInput/styles.scss +0 -28
  220. package/src/ui/f/fields/RadioInput/RadioInput.jsx +0 -112
  221. package/src/ui/f/fields/RadioInput/index.js +0 -2
  222. package/src/ui/f/fields/RadioInput/styles.scss +0 -26
  223. package/src/ui/f/fields/TaskRecommendationInput/TaskRecommendationInput.jsx +0 -130
  224. package/src/ui/f/fields/TaskRecommendationInput/index.js +0 -2
  225. package/src/ui/f/fields/TaskRecommendationInput/styles.scss +0 -41
@@ -0,0 +1,134 @@
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 = 'oval-illustration'
15
+
16
+ /**
17
+ * This is the component description.
18
+ */
19
+ const OvalIllustration = ({
20
+ id,
21
+ className:userClassName,
22
+ style,
23
+ layout,
24
+ src,
25
+ alt,
26
+ ovalBackground,
27
+ backgroundColor,
28
+ mobileSize,
29
+ tabletSize,
30
+ desktopSize,
31
+ // ...otherProps
32
+ }) => {
33
+ useLayoutEffect(() => {
34
+ import('./styles.scss')
35
+ }, [])
36
+
37
+ return (
38
+ <div
39
+ id={id}
40
+ className={[
41
+
42
+ baseClassName,
43
+
44
+ componentClassName,
45
+ userClassName,
46
+ layout,
47
+ ]
48
+ .filter((e) => e)
49
+ .join(' ')}
50
+ style={{
51
+ ...style,
52
+ '--mobile-size' :mobileSize,
53
+ '--tablet-size' :tabletSize,
54
+ '--desktop-size':desktopSize,
55
+ }}
56
+ // {...otherProps}
57
+ >
58
+ {ovalBackground
59
+ && <div className={`oval-background y-${backgroundColor}`} />}
60
+ <div className="illustration">
61
+ <img src={src} alt={alt} />
62
+ </div>
63
+ </div>
64
+ )
65
+ }
66
+
67
+ OvalIllustration.propTypes = {
68
+ /**
69
+ * The HTML id for this element
70
+ */
71
+ id:PropTypes.string,
72
+
73
+ /**
74
+ * The HTML class names for this element
75
+ */
76
+ className:PropTypes.string,
77
+
78
+ /**
79
+ * The React-written, css properties for this element.
80
+ */
81
+ style:PropTypes.objectOf(PropTypes.string),
82
+
83
+ /**
84
+ * side definition of the illustration
85
+ */
86
+ layout:PropTypes.oneOf([
87
+ 'left',
88
+ 'right',
89
+ ]),
90
+
91
+ /**
92
+ * image url
93
+ */
94
+ src:PropTypes.string,
95
+
96
+ /**
97
+ * alt tag for the image
98
+ */
99
+ alt:PropTypes.string,
100
+
101
+ /**
102
+ * whether to have a oval shape as background
103
+ */
104
+ ovalBackground:PropTypes.bool,
105
+
106
+ /**
107
+ * background color of the oval behind the image
108
+ */
109
+ backgroundColor:PropTypes.string,
110
+
111
+ /**
112
+ * size of the oval for mobile screen
113
+ */
114
+ mobileSize:PropTypes.string,
115
+
116
+ /**
117
+ * size of the oval for tablet screen
118
+ */
119
+ tabletSize:PropTypes.string,
120
+
121
+ /**
122
+ * size of the oval for desktop screen
123
+ */
124
+ desktopSize:PropTypes.string,
125
+ }
126
+
127
+ OvalIllustration.defaultProps = {
128
+ layout :'left',
129
+ mobileSize :'20em',
130
+ tabletSize :'35em',
131
+ desktopSize:'45em',
132
+ }
133
+
134
+ export default OvalIllustration
@@ -0,0 +1,2 @@
1
+ /* @pareto-engineering/generator-front 1.0.12 */
2
+ export { default as OvalIllustration } from './OvalIllustration'
@@ -0,0 +1,102 @@
1
+ /* @pareto-engineering/generator-front 1.0.12 */
2
+
3
+ @use "@pareto-engineering/bem";
4
+ @use "@aztlan/stylebook/src/mixins";
5
+ @use "@aztlan/stylebook/src/globals" as *;
6
+
7
+ $default-clockwise-degree:60deg;
8
+ $default-counter-clockwise-degree:-60deg;
9
+ $default-ellipse-size:30% 43% at 50% 50%;
10
+
11
+ .#{bem.$base}.oval-illustration {
12
+ display: flex;
13
+ justify-content: center;
14
+ overflow: hidden;
15
+ position: relative;
16
+
17
+ &.left {
18
+ .oval-background {
19
+ transform: rotate($default-clockwise-degree);
20
+ }
21
+
22
+ .illustration {
23
+ transform: rotate($default-counter-clockwise-degree);
24
+
25
+ > img {
26
+ transform: rotate($default-clockwise-degree);
27
+ }
28
+ }
29
+ }
30
+
31
+ &.right {
32
+ .oval-background {
33
+ transform: rotate($default-counter-clockwise-degree);
34
+ }
35
+
36
+ .illustration {
37
+ transform: rotate($default-clockwise-degree);
38
+
39
+ > img {
40
+ transform: rotate($default-counter-clockwise-degree);
41
+ }
42
+ }
43
+ }
44
+
45
+ .oval-background {
46
+ background: var(--y);
47
+ clip-path: ellipse($default-ellipse-size);
48
+ overflow: hidden;
49
+ position: absolute;
50
+ z-index: 0;
51
+ }
52
+
53
+ .illustration {
54
+ clip-path: ellipse($default-ellipse-size);
55
+ overflow: hidden;
56
+
57
+ > img {
58
+ height: 100%;
59
+ object-fit: cover;
60
+ width: 100%;
61
+ }
62
+ }
63
+
64
+ // mobile style
65
+ @include mixins.media($to:$sm-md) {
66
+ .oval-background {
67
+ height: var(--mobile-size);
68
+ width: var(--mobile-size);
69
+ }
70
+
71
+ .illustration {
72
+ height: var(--mobile-size);
73
+ width: var(--mobile-size);
74
+ }
75
+ }
76
+
77
+ // tablet style
78
+ @include mixins.media($from:$xs-sm, $to:$sm-md) {
79
+ .oval-background {
80
+ height: var(--tablet-size);
81
+ width: var(--tablet-size);
82
+ }
83
+
84
+ .illustration {
85
+ height: var(--tablet-size);
86
+ width: var(--tablet-size);
87
+ }
88
+ }
89
+
90
+ // desktop style
91
+ @include mixins.media($from:$sm-md) {
92
+ .oval-background {
93
+ height: var(--desktop-size);
94
+ width: var(--desktop-size);
95
+ }
96
+
97
+ .illustration {
98
+ height: var(--desktop-size);
99
+ width: var(--desktop-size);
100
+ }
101
+ }
102
+ }
@@ -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,2 @@
1
+ /* @pareto-engineering/generator-front 1.0.12 */
2
+ export { default as Popover } from './Popover'
@@ -0,0 +1,43 @@
1
+ /* @pareto-engineering/generator-front 1.0.12 */
2
+ @use "@pareto-engineering/bem";
3
+
4
+ $default-padding: 1em;
5
+ $default-margin: 1em;
6
+ $default-border: var(--theme-border-style) var(--metadata);
7
+
8
+ .#{bem.$base}.popover{
9
+ position: absolute;
10
+ z-index: 1;
11
+ background-color: var(--x);
12
+ padding: $default-padding;
13
+ border: $default-border;
14
+
15
+ &:not(.open) {
16
+ display: none;
17
+ }
18
+
19
+ > *:not(:last-child) {
20
+ margin-bottom: $default-margin / 2;
21
+ }
22
+
23
+ &.bottom {
24
+ top: 100%;
25
+ // bottom: 0;
26
+ }
27
+
28
+ &.left {
29
+ left: 0;
30
+ }
31
+
32
+ &.right {
33
+ right: 0;
34
+ }
35
+
36
+ &.top {
37
+ bottom: 100%;
38
+ top: auto;
39
+ }
40
+ }
41
+
42
+
43
+
@@ -0,0 +1,191 @@
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 = 'shapes'
15
+
16
+ /**
17
+ * This is the component description.
18
+ */
19
+ const Shapes = ({
20
+ id,
21
+ className:userClassName,
22
+ style,
23
+ shape,
24
+ height,
25
+ overflow,
26
+ verticalAlign,
27
+ horizontalAlign,
28
+ // ...otherProps
29
+ }) => {
30
+ useLayoutEffect(() => {
31
+ import('./styles.scss')
32
+ }, [])
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={{
47
+ ...style,
48
+ '--shape-height' :height,
49
+ '--overflow' :overflow,
50
+ '--vertical-align' :verticalAlign,
51
+ '--horizontal-align':horizontalAlign,
52
+ }}
53
+ // {...otherProps}
54
+ >
55
+ { shape === 'triangle'
56
+ && <div className="triangle" />}
57
+ { shape === 'inverted-triangle'
58
+ && <div className="inverted-triangle" />}
59
+ { shape === 'half-ellipses'
60
+ && (
61
+ <div className="half-ellipses">
62
+ <div className="up" />
63
+ <div className="down" />
64
+ </div>
65
+ )}
66
+ { shape === 'ellipse' && <div className="ellipse" />}
67
+ { shape === 'diamonds' && (
68
+ <div className="diamonds">
69
+ <div className="top-right" />
70
+ <div className="bottom-left" />
71
+ <div className="bottom-right" />
72
+ </div>
73
+ )}
74
+ { shape === 'rectangles' && (
75
+ <div className="rectangles">
76
+ <div className="top" />
77
+ <div className="center" />
78
+ <div className="bottom" />
79
+ </div>
80
+ )}
81
+ { shape === 'half-ellipse' && (
82
+ <div className="half-ellipse" />
83
+ )}
84
+ { shape === 'circle' && (
85
+ <div className="circle" />
86
+ )}
87
+ { shape === 'half-circle' && (
88
+ <div className="half-circle" />
89
+ )}
90
+ { shape === 'ellipses' && (
91
+ <div className="ellipses">
92
+ <div className="first" />
93
+ <div className="second" />
94
+ </div>
95
+ )}
96
+ {shape === 'spiral' && (
97
+ <div className="spiral">
98
+ <div className="circle-one" />
99
+ <div className="circle-two" />
100
+ <div className="circle-three" />
101
+ <div className="circle-four" />
102
+ </div>
103
+ )}
104
+ {shape === 'rotated-ellipses' && (
105
+ <div className="rotated-ellipses">
106
+ <div className="ellipse-one" />
107
+ <div className="ellipse-two" />
108
+ </div>
109
+ )}
110
+ {shape === 'intersecting-circles' && (
111
+ <div className="intersecting-circles">
112
+ <div className="left" />
113
+ <div className="right" />
114
+ </div>
115
+ )}
116
+ </div>
117
+ )
118
+ }
119
+
120
+ Shapes.propTypes = {
121
+ /**
122
+ * The HTML id for this element
123
+ */
124
+ id:PropTypes.string,
125
+
126
+ /**
127
+ * The HTML class names for this element
128
+ */
129
+ className:PropTypes.string,
130
+
131
+ /**
132
+ * The React-written, css properties for this element.
133
+ */
134
+ style:PropTypes.objectOf(PropTypes.string),
135
+
136
+ /**
137
+ * The height of the shape.
138
+ */
139
+ height:PropTypes.string,
140
+
141
+ /**
142
+ * The vertical alignment of the shape.
143
+ */
144
+ verticalAlign:PropTypes.oneOf([
145
+ 'flex-start',
146
+ 'center',
147
+ 'flex-end',
148
+ ]),
149
+
150
+ /**
151
+ * The horizontal alignment of the shape.
152
+ */
153
+ horizontalAlign:PropTypes.oneOf([
154
+ 'flex-start',
155
+ 'center',
156
+ 'flex-end',
157
+ ]),
158
+
159
+ /**
160
+ * The options of a shape to use
161
+ */
162
+ shape:PropTypes.oneOf([
163
+ 'triangle',
164
+ 'ellipse',
165
+ 'half-ellipse',
166
+ 'half-ellipses',
167
+ 'spiral',
168
+ 'diamonds',
169
+ 'circle',
170
+ 'half-circle',
171
+ 'ellipses',
172
+ 'rectangles',
173
+ 'rotated-ellipses',
174
+ 'inverted-triangle',
175
+ 'intersecting-circles',
176
+ ]),
177
+
178
+ /**
179
+ * The overflow of the shape.
180
+ */
181
+ overflow:PropTypes.oneOf(['hidden', 'visible']),
182
+ }
183
+
184
+ Shapes.defaultProps = {
185
+ verticalAlign :'center',
186
+ horizontalAlign:'center',
187
+ shape :'triangle',
188
+ overflow :'hidden',
189
+ }
190
+
191
+ export default Shapes
@@ -0,0 +1,2 @@
1
+ /* @pareto-engineering/generator-front 1.0.12 */
2
+ export { default as Shapes } from './Shapes'