@pareto-engineering/design-system 2.0.0-alpha.3 → 2.0.0-alpha.7

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 (34) hide show
  1. package/dist/cjs/a/OvalIllustration/OvalIllustration.js +102 -0
  2. package/dist/cjs/a/OvalIllustration/index.js +15 -0
  3. package/dist/cjs/a/OvalIllustration/styles.scss +105 -0
  4. package/dist/cjs/a/Shapes/Shapes.js +31 -9
  5. package/dist/cjs/a/Shapes/styles.scss +40 -17
  6. package/dist/cjs/a/index.js +17 -1
  7. package/dist/cjs/b/Button/styles.scss +38 -19
  8. package/dist/cjs/b/Page/common/Section/Section.js +42 -5
  9. package/dist/cjs/b/Page/styles.scss +8 -2
  10. package/dist/es/a/OvalIllustration/OvalIllustration.js +86 -0
  11. package/dist/es/a/OvalIllustration/index.js +2 -0
  12. package/dist/es/a/OvalIllustration/styles.scss +105 -0
  13. package/dist/es/a/Shapes/Shapes.js +31 -9
  14. package/dist/es/a/Shapes/styles.scss +40 -17
  15. package/dist/es/a/index.js +3 -1
  16. package/dist/es/b/Button/styles.scss +38 -19
  17. package/dist/es/b/Page/common/Section/Section.js +41 -4
  18. package/dist/es/b/Page/styles.scss +8 -2
  19. package/package.json +1 -1
  20. package/src/__snapshots__/Storyshots.test.js.snap +1480 -336
  21. package/src/stories/a/OvalIllustration.stories.jsx +36 -0
  22. package/src/stories/a/Shapes.stories.jsx +125 -0
  23. package/src/stories/b/Button.stories.jsx +57 -82
  24. package/src/stories/b/Page.stories.jsx +27 -1
  25. package/src/ui/a/OvalIllustration/OvalIllustration.jsx +108 -0
  26. package/src/ui/a/OvalIllustration/index.js +2 -0
  27. package/src/ui/a/OvalIllustration/styles.scss +105 -0
  28. package/src/ui/a/Shapes/Shapes.jsx +181 -0
  29. package/src/ui/a/Shapes/index.js +2 -0
  30. package/src/ui/a/Shapes/styles.scss +222 -0
  31. package/src/ui/a/index.js +2 -0
  32. package/src/ui/b/Button/styles.scss +38 -19
  33. package/src/ui/b/Page/common/Section/Section.jsx +51 -2
  34. package/src/ui/b/Page/styles.scss +8 -2
@@ -0,0 +1,181 @@
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 === 'half-ellipses'
58
+ && (
59
+ <div className="half-ellipses">
60
+ <div className="up" />
61
+ <div className="down" />
62
+ </div>
63
+ )}
64
+ { shape === 'ellipse' && <div className="ellipse" />}
65
+ { shape === 'diamonds' && (
66
+ <div className="diamonds">
67
+ <div className="top-right" />
68
+ <div className="bottom-left" />
69
+ <div className="bottom-right" />
70
+ </div>
71
+ )}
72
+ { shape === 'rectangles' && (
73
+ <div className="rectangles">
74
+ <div className="top" />
75
+ <div className="center" />
76
+ <div className="bottom" />
77
+ </div>
78
+ )}
79
+ { shape === 'half-ellipse' && (
80
+ <div className="half-ellipse" />
81
+ )}
82
+ { shape === 'circle' && (
83
+ <div className="circle" />
84
+ )}
85
+ { shape === 'half-circle' && (
86
+ <div className="half-circle" />
87
+ )}
88
+ { shape === 'ellipses' && (
89
+ <div className="ellipses">
90
+ <div className="first" />
91
+ <div className="second" />
92
+ </div>
93
+ )}
94
+ {shape === 'spiral' && (
95
+ <div className="spiral">
96
+ <div className="circle-one" />
97
+ <div className="circle-two" />
98
+ <div className="circle-three" />
99
+ <div className="circle-four" />
100
+ </div>
101
+ )}
102
+ {shape === 'rotated-ellipses' && (
103
+ <div className="rotated-ellipses">
104
+ <div className="ellipse-one" />
105
+ <div className="ellipse-two" />
106
+ </div>
107
+ )}
108
+ </div>
109
+ )
110
+ }
111
+
112
+ Shapes.propTypes = {
113
+ /**
114
+ * The HTML id for this element
115
+ */
116
+ id:PropTypes.string,
117
+
118
+ /**
119
+ * The HTML class names for this element
120
+ */
121
+ className:PropTypes.string,
122
+
123
+ /**
124
+ * The React-written, css properties for this element.
125
+ */
126
+ style:PropTypes.objectOf(PropTypes.string),
127
+
128
+ /**
129
+ * The height of the shape.
130
+ */
131
+ height:PropTypes.string,
132
+
133
+ /**
134
+ * The vertical alignment of the shape.
135
+ */
136
+ verticalAlign:PropTypes.oneOf([
137
+ 'flex-start',
138
+ 'center',
139
+ 'flex-end',
140
+ ]),
141
+
142
+ /**
143
+ * The horizontal alignment of the shape.
144
+ */
145
+ horizontalAlign:PropTypes.oneOf([
146
+ 'flex-start',
147
+ 'center',
148
+ 'flex-end',
149
+ ]),
150
+
151
+ /**
152
+ * The options of a shape to use
153
+ */
154
+ shape:PropTypes.oneOf([
155
+ 'triangle',
156
+ 'ellipse',
157
+ 'half-ellipse',
158
+ 'half-ellipses',
159
+ 'spiral',
160
+ 'diamonds',
161
+ 'circle',
162
+ 'half-circle',
163
+ 'ellipses',
164
+ 'rectangles',
165
+ 'rotated-ellipses',
166
+ ]),
167
+
168
+ /**
169
+ * The overflow of the shape.
170
+ */
171
+ overflow:PropTypes.oneOf(['hidden', 'visible']),
172
+ }
173
+
174
+ Shapes.defaultProps = {
175
+ verticalAlign :'center',
176
+ horizontalAlign:'center',
177
+ shape :'triangle',
178
+ overflow :'hidden',
179
+ }
180
+
181
+ export default Shapes
@@ -0,0 +1,2 @@
1
+ /* @pareto-engineering/generator-front 1.0.12 */
2
+ export { default as Shapes } from './Shapes'
@@ -0,0 +1,222 @@
1
+ /* @pareto-engineering/generator-front 1.0.12 */
2
+
3
+ @use "@pareto-engineering/bem";
4
+
5
+ $default-ellipse-height:50em;
6
+ $default-diamond-height:40em;
7
+ $default-circle-height:50em;
8
+ $default-triangle-height:40em;
9
+ $default-rectangle-height:50em;
10
+ $default-shapes-opacity:.8;
11
+
12
+ .#{bem.$base}.shapes {
13
+ position: absolute;
14
+ top: 0;
15
+ left: 0;
16
+ display: flex;
17
+ flex-direction: column;
18
+ overflow: var(--overflow);
19
+ justify-content: var(--vertical-align);
20
+ align-items: var(--horizontal-align);
21
+ height: 100%;
22
+ width: 100%;
23
+
24
+ .triangle {
25
+ background-image: linear-gradient(transparent, var(--dark-y));
26
+ clip-path: polygon(0 0, 50% 100%, 100% 0);
27
+ height: calc(var(--shape-height, #{$default-triangle-height}) * 0.86);
28
+ opacity: $default-shapes-opacity;
29
+ width: var(--shape-height, #{$default-triangle-height});
30
+ }
31
+
32
+ .half-ellipses {
33
+ height: var(--shape-height, #{$default-ellipse-height});
34
+ opacity: $default-shapes-opacity;
35
+ width: calc(var(--shape-height, #{$default-ellipse-height}) * 2);
36
+
37
+ .up {
38
+ background-image: radial-gradient(ellipse at center bottom, var(--y) 5%, transparent 65%);
39
+ clip-path: ellipse(35% 100% at 50% 0%);
40
+ height: 50%;
41
+ }
42
+
43
+ .down {
44
+ background-image: radial-gradient(ellipse at center top, var(--y) 5%, transparent 65%);
45
+ clip-path: ellipse(35% 100% at 50% 100%);
46
+ height: 50%;
47
+ }
48
+ }
49
+
50
+ .ellipse {
51
+ background-image: linear-gradient(to top left, var(--dark-y), var(--light-y), var(--dark-y));
52
+ clip-path: ellipse(50% 25% at 50% 50%);
53
+ height: var(--shape-height, #{$default-ellipse-height});
54
+ opacity: $default-shapes-opacity;
55
+ transform: rotate3d(0, 0, -1, 10deg);
56
+ width: calc(var(--shape-height, #{$default-ellipse-height}) * 2);
57
+ }
58
+
59
+ .diamonds {
60
+ height: var(--shape-height, #{$default-diamond-height});
61
+ opacity: $default-shapes-opacity;
62
+ position: relative;
63
+ width: var(--shape-height, #{$default-diamond-height});
64
+
65
+ .top-right {
66
+ background-image: linear-gradient(to right, var(--dark-y), var(--y));
67
+ clip-path: polygon(100% 100%, 0 0, 100% 0);
68
+ height: 100%;
69
+ position: absolute;
70
+ width: 100%;
71
+ }
72
+
73
+ .bottom-left {
74
+ background-image: linear-gradient(to left, var(--dark-y), var(--y));
75
+ clip-path: polygon(0 100%, 0 0, 100% 100%);
76
+ height: 100%;
77
+ opacity: .95;
78
+ position: absolute;
79
+ width: 100%;
80
+ z-index: 1;
81
+ }
82
+
83
+ .bottom-right {
84
+ background-image: linear-gradient(to bottom, var(--dark-y), var(--y));
85
+ clip-path: polygon(100% 100%, 100% 0, 0 100%);
86
+ height: 100%;
87
+ position: absolute;
88
+ width: 100%;
89
+ }
90
+ }
91
+
92
+ .rectangles {
93
+ display: grid;
94
+ grid-template-rows: repeat(3, 1fr);
95
+ height: var(--shape-height, #{$default-rectangle-height});
96
+ opacity: $default-shapes-opacity;
97
+ width: var(--shape-height, #{$default-rectangle-height});
98
+
99
+ .top {
100
+ background-image: linear-gradient(to right, var(--dark-y), var(--y));
101
+ }
102
+
103
+ .center {
104
+ background-image: linear-gradient(to left, var(--dark-y), var(--y));
105
+ }
106
+
107
+ .bottom {
108
+ background-image: linear-gradient(to right, var(--dark-y), var(--y));
109
+ }
110
+ }
111
+
112
+ .half-ellipse {
113
+ background-image: radial-gradient(ellipse at center bottom, var(--y) 10%, transparent 65%);
114
+ clip-path: ellipse(60% 100% at 50% 0%);
115
+ height: var(--shape-height, #{$default-ellipse-height});
116
+ opacity: $default-shapes-opacity;
117
+ width: calc(var(--shape-height, #{$default-ellipse-height}) * 2);
118
+ }
119
+
120
+ .circle {
121
+ background-image: linear-gradient(var(--light-y), var(--dark-y));
122
+ clip-path: circle(50% at 50% 50%);
123
+ height: var(--shape-height, #{$default-circle-height});
124
+ opacity: $default-shapes-opacity;
125
+ width: var(--shape-height, #{$default-circle-height});
126
+ }
127
+
128
+ .half-circle {
129
+ background: linear-gradient(var(--light-y) 30%, var(--dark-y) 100%);
130
+ clip-path: circle(50% at 50% 100%);
131
+ height: var(--shape-height, #{$default-circle-height});
132
+ opacity: $default-shapes-opacity;
133
+ width: calc(var(--shape-height, #{$default-circle-height}) * 2);
134
+ }
135
+
136
+ .ellipses {
137
+ height: var(--shape-height, #{$default-ellipse-height});
138
+ opacity: $default-shapes-opacity;
139
+ position: relative;
140
+ width: var(--shape-height, #{$default-ellipse-height});
141
+
142
+ .first {
143
+ background-image: linear-gradient(to top, var(--dark-y), var(--y), var(--light-y) 50%, transparent);
144
+ clip-path: ellipse(50% 20% at 50% 60%);
145
+ height: 100%;
146
+ position: absolute;
147
+ width: 100%;
148
+ z-index: 1;
149
+ }
150
+
151
+ .second {
152
+ background-image: linear-gradient(to bottom,var(--dark-y), var(--y), var(--light-y) 45%, transparent);
153
+ clip-path: ellipse(50% 20% at 50% 40%);
154
+ height: 100%;
155
+ position: absolute;
156
+ width: 100%;
157
+ }
158
+ }
159
+
160
+ .spiral {
161
+ height: var(--shape-height, #{$default-ellipse-height});
162
+ width: var(--shape-height, #{$default-ellipse-height});
163
+ opacity: $default-shapes-opacity;
164
+ position: relative;
165
+ display: flex;
166
+ justify-content: center;
167
+ align-items: center;
168
+
169
+ > * {
170
+ border-radius: 50%;
171
+ background: radial-gradient(ellipse at center bottom ,var(--dark-y) 10%, transparent 60%);
172
+ position: absolute;
173
+ opacity: .5;
174
+ }
175
+
176
+ .circle-one {
177
+ transform: rotate(45deg);
178
+ height:calc(var(--shape-height, #{$default-ellipse-height})* 0.4);
179
+ width: calc(var(--shape-height, #{$default-ellipse-height})* 0.4);
180
+ }
181
+
182
+ .circle-two {
183
+ height: calc(var(--shape-height, #{$default-ellipse-height})* 0.6);
184
+ width: calc(var(--shape-height, #{$default-ellipse-height})* 0.6);
185
+ }
186
+
187
+ .circle-three {
188
+ transform: rotate(-45deg);
189
+ height: calc(var(--shape-height, #{$default-ellipse-height})* 0.8);
190
+ width: calc(var(--shape-height, #{$default-ellipse-height})* 0.8);
191
+ }
192
+
193
+ .circle-four {
194
+ transform: rotate(-90deg);
195
+ height: calc(var(--shape-height, #{$default-ellipse-height})* 1);
196
+ width: calc(var(--shape-height, #{$default-ellipse-height})* 1);
197
+ }
198
+ }
199
+ .rotated-ellipses {
200
+ height: var(--shape-height, #{$default-ellipse-height});
201
+ opacity: $default-shapes-opacity;
202
+ width: var(--shape-height, #{$default-ellipse-height});
203
+ display: flex;
204
+
205
+ > *{
206
+ width: 100%;
207
+ height: 100%;
208
+ }
209
+
210
+ .ellipse-one {
211
+ background-image: radial-gradient(ellipse at bottom left, var(--y) 30%, transparent 65%);
212
+ transform: rotate(-15deg);
213
+ clip-path: ellipse(50% 35% at 50% 50%);
214
+ }
215
+
216
+ .ellipse-two {
217
+ background-image: radial-gradient(ellipse at top right, var(--y) 30%, transparent 65%);
218
+ transform: rotate(-15deg);
219
+ clip-path: ellipse(50% 35% at 50% 50%);
220
+ }
221
+ }
222
+ }
package/src/ui/a/index.js CHANGED
@@ -23,3 +23,5 @@ export { Quote } from './Quote'
23
23
  export { ContentCard } from './ContentCard'
24
24
  export { DotInfo } from './DotInfo'
25
25
  export { Timestamp } from './Timestamp'
26
+ export { Shapes } from './Shapes'
27
+ export { OvalIllustration } from './OvalIllustration'
@@ -4,15 +4,13 @@
4
4
 
5
5
  $default-padding: 1em 1em .84em;
6
6
  $compact-padding: .6em .6em .48em;
7
- $default-border-radius:2em;
8
7
  $default-color:primary;
9
8
  $font-weight:bold;
10
9
 
11
10
  .#{bem.$base}.button {
12
11
  background: var(--x, var(--#{$default-color}));
13
12
  border: transparent;
14
- //border-radius: var(--theme-border-radius);
15
- border-radius: $default-border-radius;
13
+ border-radius: var(--theme-border-radius);
16
14
  color: var(--on-x, var(--on-#{$default-color}));
17
15
  font-weight: 600;
18
16
  padding: $default-padding;
@@ -24,6 +22,9 @@ $font-weight:bold;
24
22
  &:hover {
25
23
  background: var(--light-x, var(--light-#{$default-color}));
26
24
  }
25
+ &:focus {
26
+ background: var(--dark-x, var(--dark-#{$default-color}));
27
+ }
27
28
  }
28
29
 
29
30
 
@@ -36,21 +37,28 @@ $font-weight:bold;
36
37
  border: 1px solid var(--x, var(--#{$default-color}));
37
38
  color: var(--x, var(--#{$default-color}));
38
39
 
39
- &:not(:disabled) {
40
- &:hover,
41
- &:focus {
42
- border: 1px solid transparent;
43
- color: var(--on-x, var(--on-#{$default-color}));
44
- }
40
+ &:hover,
41
+ &:focus,
42
+ &:disabled{
43
+ background: transparent;
44
+ }
45
45
 
46
+ &:not(:disabled) {
46
47
  &:hover {
47
- background: var(--x, var(--#{$default-color}));
48
+ border: 1px solid var(--light-x, var(--light-#{$default-color}));
49
+ color: var(--light-x, var(--light-#{$default-color}));
48
50
  }
49
51
 
50
52
  &:focus {
51
- background: var(--dark-x, var(--#{$default-color}));
53
+ border: 1px solid var(--dark-x, var(--dark-#{$default-color}));
54
+ color: var(--dark-x, var(--dark-#{$default-color}));
52
55
  }
53
56
  }
57
+
58
+ &:disabled{
59
+ border: 1px solid var(--x, var(--#{$default-color}));
60
+ color: var(--x, var(--#{$default-color}));
61
+ }
54
62
  }
55
63
 
56
64
  &.#{bem.$modifier-simple} {
@@ -58,19 +66,30 @@ $font-weight:bold;
58
66
  border: 1px solid transparent;
59
67
  color: var(--x, var(--#{$default-color}));
60
68
 
69
+ &:disabled,
70
+ &:hover,
71
+ &:focus {
72
+ background: transparent;
73
+ }
74
+
61
75
  &:not(:disabled) {
62
- &:hover,
63
- &:focus {
64
- background:transparent;
65
- border: 1px solid transparent;
66
- color: var(--dark-x, var(--on-#{$default-color}));
67
- }
76
+ &:hover {
77
+ color: var(--light-x, var(--light-#{$default-color}));
78
+ }
79
+
80
+ &:focus {
81
+ color: var(--dark-x, var(--dark-#{$default-color}));
82
+ }
83
+ }
84
+
85
+ &:disabled {
86
+ color: var(--x, var(--#{$default-color}));
68
87
  }
69
88
  }
70
89
 
71
90
  &:disabled {
72
- background: var(--light-x);
73
- filter: brightness(120%);
91
+ background: var(--x);
92
+ filter: brightness(125%);
74
93
  }
75
94
  }
76
95
 
@@ -3,9 +3,10 @@ import * as React from 'react'
3
3
  import PropTypes from 'prop-types'
4
4
  import styleNames from '@pareto-engineering/bem'
5
5
 
6
+ // Local Definitions
7
+ import { Shapes } from 'ui/a'
6
8
  import usePage from '../../usePage'
7
9
 
8
- // Local Definitions
9
10
  const baseClassName = styleNames.base
10
11
  const componentClassName = 'section'
11
12
 
@@ -14,6 +15,11 @@ const Section = ({
14
15
  className:userClassName,
15
16
  style,
16
17
  children,
18
+ backgroundShape,
19
+ backgroundVerticalAlign,
20
+ backgroundHorizontalAlign,
21
+ backgroundHeight,
22
+ backgroundOverflow,
17
23
  ...otherProps
18
24
  }) => {
19
25
  const {
@@ -21,7 +27,6 @@ const Section = ({
21
27
  } = usePage()
22
28
 
23
29
  const sectionId = userId && `${pageId}_${userId}`
24
-
25
30
  return (
26
31
  <section
27
32
  id={sectionId}
@@ -36,6 +41,15 @@ const Section = ({
36
41
  {...otherProps}
37
42
  >
38
43
  {children}
44
+ {backgroundShape && (
45
+ <Shapes
46
+ verticalAlign={backgroundVerticalAlign}
47
+ horizontalAlign={backgroundHorizontalAlign}
48
+ backgroundOverflow={backgroundOverflow}
49
+ height={backgroundHeight}
50
+ shape={backgroundShape}
51
+ />
52
+ )}
39
53
  </section>
40
54
  )
41
55
  }
@@ -60,6 +74,41 @@ Section.propTypes = {
60
74
  * The children JSX
61
75
  */
62
76
  children:PropTypes.node,
77
+
78
+ /**
79
+ * The background shape to use for this section.
80
+ */
81
+ backgroundShape:PropTypes.oneOf([
82
+ 'triangle',
83
+ 'ellipse',
84
+ 'half-ellipse',
85
+ 'half-ellipses',
86
+ 'spiral',
87
+ 'diamonds',
88
+ 'circle',
89
+ 'half-circle',
90
+ 'ellipses',
91
+ 'rectangles',
92
+ ]),
93
+
94
+ /**
95
+ * The background vertical alingment to use for if the background shape is set.
96
+ */
97
+ backgroundVerticalAlign :PropTypes.oneOf(['flex-start', 'center', 'flex-end']),
98
+ /**
99
+ * The background horizontal alingment to use for if the background shape is set.
100
+ */
101
+ backgroundHorizontalAlign:PropTypes.oneOf(['flex-start', 'center', 'flex-end']),
102
+
103
+ /**
104
+ * The background height to use for if the background shape is set.
105
+ */
106
+ backgroundHeight:PropTypes.string,
107
+
108
+ /**
109
+ * The background overflow to use for if the background shape is set.
110
+ */
111
+ backgroundOverflow:PropTypes.oneOf(['visible', 'hidden', 'scroll']),
63
112
  }
64
113
 
65
114
  Section.defaultProps = {
@@ -2,9 +2,15 @@
2
2
 
3
3
  @use "@pareto-engineering/bem";
4
4
 
5
- /*
5
+
6
6
  .#{bem.$base}.page{
7
+ .#{bem.$base}.section {
8
+ position: relative;
7
9
 
8
- } */
10
+ > *:not(:last-child) {
11
+ z-index: 1;
12
+ }
13
+ }
14
+ }
9
15
 
10
16