@pareto-engineering/design-system 2.0.0-alpha.2 → 2.0.0-alpha.23

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 (187) hide show
  1. package/dist/cjs/a/AnimatedCounter/AnimatedCounter.js +16 -29
  2. package/dist/cjs/a/AnimatedCounter/styles.scss +3 -11
  3. package/dist/cjs/a/BackgroundGradient/BackgroundGradient.js +77 -0
  4. package/dist/cjs/a/BackgroundGradient/index.js +15 -0
  5. package/dist/cjs/a/BackgroundGradient/styles.scss +16 -0
  6. package/dist/cjs/a/Conversation/Conversation.js +15 -8
  7. package/dist/cjs/a/Conversation/common/Message/Message.js +33 -6
  8. package/dist/cjs/a/Conversation/styles.scss +129 -32
  9. package/dist/cjs/a/OvalIllustration/OvalIllustration.js +133 -0
  10. package/dist/cjs/a/OvalIllustration/index.js +15 -0
  11. package/dist/cjs/a/OvalIllustration/styles.scss +102 -0
  12. package/dist/cjs/a/People/People.js +15 -7
  13. package/dist/cjs/a/People/common/Person/Person.js +11 -4
  14. package/dist/cjs/a/People/styles.scss +13 -15
  15. package/dist/cjs/a/Shapes/Shapes.js +171 -0
  16. package/dist/cjs/a/Shapes/index.js +15 -0
  17. package/dist/cjs/a/Shapes/styles.scss +255 -0
  18. package/dist/cjs/a/SnapScroller/SnapScroller.js +77 -0
  19. package/dist/cjs/a/SnapScroller/index.js +15 -0
  20. package/dist/cjs/a/SnapScroller/styles.scss +38 -0
  21. package/dist/cjs/a/TeamInfo/styles.scss +2 -2
  22. package/dist/cjs/a/index.js +33 -1
  23. package/dist/cjs/b/Button/Button.js +10 -4
  24. package/dist/cjs/b/Button/styles.scss +83 -19
  25. package/dist/cjs/b/Metrics/Metrics.js +89 -0
  26. package/dist/cjs/b/Metrics/index.js +15 -0
  27. package/dist/cjs/b/Metrics/styles.scss +91 -0
  28. package/dist/cjs/b/Page/common/Section/Section.js +56 -5
  29. package/dist/cjs/b/Page/styles.scss +8 -2
  30. package/dist/cjs/b/QuestionDropdown/styles.scss +1 -1
  31. package/dist/cjs/b/index.js +9 -1
  32. package/dist/cjs/c/ContentSlides/common/HorizontalMenu/HorizontalMenu.js +4 -4
  33. package/dist/cjs/c/ContentSlides/common/Navigator/Navigator.js +4 -3
  34. package/dist/cjs/c/ContentSlides/styles.scss +10 -4
  35. package/dist/cjs/f/common/Debugger/Debugger.js +1 -1
  36. package/dist/cjs/f/common/Label/Label.js +1 -1
  37. package/dist/cjs/f/common/Label/styles.scss +1 -1
  38. package/dist/cjs/f/fields/ChoicesInput/ChoicesInput.js +2 -2
  39. package/dist/cjs/f/fields/ChoicesInput/styles.scss +17 -2
  40. package/dist/cjs/f/fields/RatingsInput/common/Rating/Rating.js +2 -2
  41. package/dist/cjs/f/fields/SelectInput/SelectInput.js +37 -10
  42. package/dist/cjs/f/fields/SelectInput/styles.scss +13 -8
  43. package/dist/cjs/f/fields/TaskRecommendationInput/TaskRecommendationInput.js +1 -1
  44. package/dist/cjs/f/fields/TaskRecommendationInput/styles.scss +4 -0
  45. package/dist/cjs/f/fields/TextInput/TextInput.js +28 -7
  46. package/dist/cjs/f/fields/TextInput/styles.scss +16 -7
  47. package/dist/cjs/f/fields/TextareaInput/TextareaInput.js +15 -8
  48. package/dist/cjs/f/fields/TextareaInput/styles.scss +19 -6
  49. package/dist/cjs/f/fields/index.js +0 -24
  50. package/dist/cjs/form-reset.scss +1 -1
  51. package/dist/cjs/form.scss +1 -1
  52. package/dist/es/a/AnimatedCounter/AnimatedCounter.js +17 -30
  53. package/dist/es/a/AnimatedCounter/styles.scss +3 -11
  54. package/dist/es/a/BackgroundGradient/BackgroundGradient.js +55 -0
  55. package/dist/es/a/BackgroundGradient/index.js +2 -0
  56. package/dist/es/a/BackgroundGradient/styles.scss +16 -0
  57. package/dist/es/a/Conversation/Conversation.js +15 -8
  58. package/dist/es/a/Conversation/common/Message/Message.js +33 -6
  59. package/dist/es/a/Conversation/styles.scss +129 -32
  60. package/dist/es/a/OvalIllustration/OvalIllustration.js +111 -0
  61. package/dist/es/a/OvalIllustration/index.js +2 -0
  62. package/dist/es/a/OvalIllustration/styles.scss +102 -0
  63. package/dist/es/a/People/People.js +14 -7
  64. package/dist/es/a/People/common/Person/Person.js +11 -4
  65. package/dist/es/a/People/styles.scss +13 -15
  66. package/dist/es/a/Shapes/Shapes.js +149 -0
  67. package/dist/es/a/Shapes/index.js +2 -0
  68. package/dist/es/a/Shapes/styles.scss +255 -0
  69. package/dist/es/a/SnapScroller/SnapScroller.js +61 -0
  70. package/dist/es/a/SnapScroller/index.js +2 -0
  71. package/dist/es/a/SnapScroller/styles.scss +38 -0
  72. package/dist/es/a/TeamInfo/styles.scss +2 -2
  73. package/dist/es/a/index.js +5 -1
  74. package/dist/es/b/Button/Button.js +8 -2
  75. package/dist/es/b/Button/styles.scss +83 -19
  76. package/dist/es/b/Metrics/Metrics.js +72 -0
  77. package/dist/es/b/Metrics/index.js +2 -0
  78. package/dist/es/b/Metrics/styles.scss +91 -0
  79. package/dist/es/b/Page/common/Section/Section.js +55 -4
  80. package/dist/es/b/Page/styles.scss +8 -2
  81. package/dist/es/b/QuestionDropdown/styles.scss +1 -1
  82. package/dist/es/b/index.js +2 -1
  83. package/dist/es/c/ContentSlides/common/HorizontalMenu/HorizontalMenu.js +4 -4
  84. package/dist/es/c/ContentSlides/common/Navigator/Navigator.js +4 -3
  85. package/dist/es/c/ContentSlides/styles.scss +10 -4
  86. package/dist/es/f/common/Debugger/Debugger.js +1 -1
  87. package/dist/es/f/common/Label/Label.js +1 -1
  88. package/dist/es/f/common/Label/styles.scss +1 -1
  89. package/dist/es/f/fields/ChoicesInput/ChoicesInput.js +2 -2
  90. package/dist/es/f/fields/ChoicesInput/styles.scss +17 -2
  91. package/dist/es/f/fields/RatingsInput/common/Rating/Rating.js +2 -2
  92. package/dist/es/f/fields/SelectInput/SelectInput.js +37 -10
  93. package/dist/es/f/fields/SelectInput/styles.scss +13 -8
  94. package/dist/es/f/fields/TaskRecommendationInput/TaskRecommendationInput.js +1 -1
  95. package/dist/es/f/fields/TaskRecommendationInput/styles.scss +4 -0
  96. package/dist/es/f/fields/TextInput/TextInput.js +28 -7
  97. package/dist/es/f/fields/TextInput/styles.scss +16 -7
  98. package/dist/es/f/fields/TextareaInput/TextareaInput.js +15 -8
  99. package/dist/es/f/fields/TextareaInput/styles.scss +19 -6
  100. package/dist/es/f/fields/index.js +0 -3
  101. package/dist/es/form-reset.scss +1 -1
  102. package/dist/es/form.scss +1 -1
  103. package/package.json +3 -3
  104. package/src/__snapshots__/Storyshots.test.js.snap +6050 -812
  105. package/src/local.scss +4 -0
  106. package/src/stories/a/AnimatedCounter.stories.jsx +9 -5
  107. package/src/stories/a/BackgroundGradient.stories.jsx +38 -0
  108. package/src/stories/a/ContentCard.stories.jsx +1 -1
  109. package/src/stories/a/Conversation.stories.jsx +78 -1
  110. package/src/stories/a/OvalIllustration.stories.jsx +59 -0
  111. package/src/stories/a/People.stories.jsx +25 -1
  112. package/src/stories/a/ProgressBar.stories.jsx +1 -1
  113. package/src/stories/a/Quote.stories.jsx +1 -1
  114. package/src/stories/a/Shapes.stories.jsx +143 -0
  115. package/src/stories/a/SnapScroller.stories.jsx +98 -0
  116. package/src/stories/a/Spinner.stories.jsx +1 -1
  117. package/src/stories/b/Button.stories.jsx +83 -54
  118. package/src/stories/b/Metrics.stories.jsx +62 -0
  119. package/src/stories/b/Page.stories.jsx +51 -1
  120. package/src/stories/b/ThemeSelector.stories.jsx +1 -1
  121. package/src/stories/b/Title.stories.jsx +1 -1
  122. package/src/stories/c/ContentSlides.stories.jsx +154 -2
  123. package/src/stories/colors.js +5 -3
  124. package/src/stories/f/SelectInput.stories.jsx +36 -5
  125. package/src/stories/f/TextInput.stories.jsx +16 -5
  126. package/src/stories/f/TextareaInput.stories.jsx +42 -6
  127. package/src/ui/a/AnimatedCounter/AnimatedCounter.jsx +21 -27
  128. package/src/ui/a/AnimatedCounter/styles.scss +3 -11
  129. package/src/ui/a/BackgroundGradient/BackgroundGradient.jsx +76 -0
  130. package/src/ui/a/BackgroundGradient/index.js +2 -0
  131. package/src/ui/a/BackgroundGradient/styles.scss +16 -0
  132. package/src/ui/a/Conversation/Conversation.jsx +15 -7
  133. package/src/ui/a/Conversation/common/Message/Message.jsx +40 -7
  134. package/src/ui/a/Conversation/styles.scss +129 -32
  135. package/src/ui/a/OvalIllustration/OvalIllustration.jsx +134 -0
  136. package/src/ui/a/OvalIllustration/index.js +2 -0
  137. package/src/ui/a/OvalIllustration/styles.scss +102 -0
  138. package/src/ui/a/People/People.jsx +12 -4
  139. package/src/ui/a/People/common/Person/Person.jsx +7 -1
  140. package/src/ui/a/People/styles.scss +13 -15
  141. package/src/ui/a/Shapes/Shapes.jsx +191 -0
  142. package/src/ui/a/Shapes/index.js +2 -0
  143. package/src/ui/a/Shapes/styles.scss +255 -0
  144. package/src/ui/a/SnapScroller/SnapScroller.jsx +83 -0
  145. package/src/ui/a/SnapScroller/index.js +2 -0
  146. package/src/ui/a/SnapScroller/styles.scss +38 -0
  147. package/src/ui/a/TeamInfo/styles.scss +2 -2
  148. package/src/ui/a/index.js +4 -0
  149. package/src/ui/b/Button/Button.jsx +9 -1
  150. package/src/ui/b/Button/styles.scss +83 -19
  151. package/src/ui/b/Metrics/Metrics.jsx +93 -0
  152. package/src/ui/b/Metrics/index.js +2 -0
  153. package/src/ui/b/Metrics/styles.scss +91 -0
  154. package/src/ui/b/Page/common/Section/Section.jsx +68 -2
  155. package/src/ui/b/Page/styles.scss +8 -2
  156. package/src/ui/b/QuestionDropdown/styles.scss +1 -1
  157. package/src/ui/b/index.js +1 -0
  158. package/src/ui/c/ContentSlides/common/HorizontalMenu/HorizontalMenu.jsx +4 -4
  159. package/src/ui/c/ContentSlides/common/Navigator/Navigator.jsx +3 -2
  160. package/src/ui/c/ContentSlides/styles.scss +10 -4
  161. package/src/ui/f/common/Debugger/Debugger.jsx +1 -1
  162. package/src/ui/f/common/Label/Label.jsx +1 -1
  163. package/src/ui/f/common/Label/styles.scss +1 -1
  164. package/src/ui/f/fields/ChoicesInput/ChoicesInput.jsx +2 -2
  165. package/src/ui/f/fields/ChoicesInput/styles.scss +17 -2
  166. package/src/ui/f/fields/RatingsInput/common/Rating/Rating.jsx +2 -2
  167. package/src/ui/f/fields/SelectInput/SelectInput.jsx +44 -5
  168. package/src/ui/f/fields/SelectInput/styles.scss +13 -8
  169. package/src/ui/f/fields/TextInput/TextInput.jsx +24 -3
  170. package/src/ui/f/fields/TextInput/styles.scss +16 -7
  171. package/src/ui/f/fields/TextareaInput/TextareaInput.jsx +24 -13
  172. package/src/ui/f/fields/TextareaInput/styles.scss +19 -6
  173. package/src/ui/f/fields/index.js +0 -3
  174. package/src/ui/form-reset.scss +1 -1
  175. package/src/ui/form.scss +1 -1
  176. package/src/stories/f/CheckboxInput.stories.jsx +0 -37
  177. package/src/stories/f/RadioInput.stories.jsx +0 -37
  178. package/src/stories/f/TaskRecommendationInput.stories.jsx +0 -38
  179. package/src/ui/f/fields/CheckboxInput/CheckboxInput.jsx +0 -107
  180. package/src/ui/f/fields/CheckboxInput/index.js +0 -2
  181. package/src/ui/f/fields/CheckboxInput/styles.scss +0 -28
  182. package/src/ui/f/fields/RadioInput/RadioInput.jsx +0 -112
  183. package/src/ui/f/fields/RadioInput/index.js +0 -2
  184. package/src/ui/f/fields/RadioInput/styles.scss +0 -26
  185. package/src/ui/f/fields/TaskRecommendationInput/TaskRecommendationInput.jsx +0 -130
  186. package/src/ui/f/fields/TaskRecommendationInput/index.js +0 -2
  187. package/src/ui/f/fields/TaskRecommendationInput/styles.scss +0 -37
@@ -1,7 +1,7 @@
1
1
  /* @pareto-engineering/generator-front 1.0.12 */
2
2
  import * as React from 'react'
3
3
 
4
- import { useLayoutEffect } from 'react'
4
+ import { useLayoutEffect, useCallback } from 'react'
5
5
 
6
6
  import CountUp from 'react-countup'
7
7
 
@@ -26,10 +26,8 @@ const AnimatedCounter = ({
26
26
  style,
27
27
  color,
28
28
  number,
29
- unit,
30
- description,
31
- descriptionPosition,
32
- unitPosition,
29
+ before,
30
+ after,
33
31
  delay,
34
32
  // ...otherProps
35
33
  }) => {
@@ -37,6 +35,11 @@ const AnimatedCounter = ({
37
35
  import('./styles.scss')
38
36
  }, [])
39
37
 
38
+ const countDecimals = useCallback((value) => {
39
+ if ((value % 1) !== 0) return value.toString().split('.')[1].length
40
+ return 0
41
+ }, [])
42
+
40
43
  return (
41
44
  <div
42
45
  id={id}
@@ -51,19 +54,17 @@ const AnimatedCounter = ({
51
54
  style={style}
52
55
  // {...otherProps}
53
56
  >
54
- {descriptionPosition === 'top' && <p className="info top-description uc s-1 md-s0">{description}</p>}
55
57
  <div className="count s3">
56
- {unitPosition === 'before' && <span>{unit}</span>}
57
- <CountUp end={number} delay={delay} redraw>
58
+ {before && <span>{before}</span>}
59
+ <CountUp end={number} delay={delay} decimals={countDecimals(number)} redraw>
58
60
  {({ countUpRef, start }) => (
59
61
  <VisibilitySensor onChange={start} delayedCall>
60
62
  <span ref={countUpRef} />
61
63
  </VisibilitySensor>
62
64
  )}
63
65
  </CountUp>
64
- {unitPosition === 'after' && <span>{unit}</span>}
66
+ {after && <span>{after}</span>}
65
67
  </div>
66
- {descriptionPosition === 'bottom' && <p className="info uc s-1 md-s0 v50 mt-v">{description}</p>}
67
68
  </div>
68
69
  )
69
70
  }
@@ -92,33 +93,26 @@ AnimatedCounter.propTypes = {
92
93
  /**
93
94
  * The review count value
94
95
  */
95
- number :PropTypes.number,
96
+ number:PropTypes.number,
97
+
96
98
  /**
97
- * The review count unit
99
+ * The unit before the number
98
100
  */
99
- unit :PropTypes.string,
101
+ before:PropTypes.string,
102
+
100
103
  /**
101
- * The review description
104
+ * The unit after the number
102
105
  */
103
- description :PropTypes.string,
106
+ after:PropTypes.string,
107
+
104
108
  /**
105
109
  * react counter delay
106
110
  */
107
- delay :PropTypes.number,
108
- /**
109
- * If the animated counter description should be at the top
110
- */
111
- descriptionPosition:PropTypes.oneOf(['top', 'bottom']),
112
- /**
113
- * If the unit should be before or after the animated numbers
114
- */
115
- unitPosition :PropTypes.string,
111
+ delay:PropTypes.number,
116
112
  }
117
113
 
118
114
  AnimatedCounter.defaultProps = {
119
- color :'main1',
120
- descriptionPosition:'bottom',
121
- unitPosition :'after',
115
+ color:'main1',
122
116
  }
123
117
 
124
118
  export default AnimatedCounter
@@ -1,24 +1,16 @@
1
1
  /* @pareto-engineering/generator-front 1.0.12 */
2
2
 
3
3
  @use "@pareto-engineering/bem";
4
-
4
+ //@use "@aztlan/stylebook/src/mixins";
5
+ //@use "@aztlan/stylebook/src/globals" as *;
5
6
 
6
7
  .#{bem.$base}.animated-counter {
7
- align-items: center;
8
8
  display: flex;
9
- flex-direction: column;
9
+ justify-content: center;
10
10
 
11
11
  .count {
12
12
  color: var(--x);
13
13
  }
14
-
15
- .top-description {
16
- margin-bottom: .5em;
17
- }
18
-
19
- .info {
20
- color: var(--metadata);
21
- }
22
14
  }
23
15
 
24
16
 
@@ -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,2 @@
1
+ /* @pareto-engineering/generator-front 1.0.12 */
2
+ export { default as BackgroundGradient } from './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(transparent, var(--y) 25%, var(--light-y) 75%, transparent);
11
+ opacity: .4;
12
+ z-index: -1;
13
+ }
14
+
15
+
16
+
@@ -28,19 +28,19 @@ const Conversation = ({
28
28
  ourColor,
29
29
  theirColor,
30
30
  children,
31
+ hasTriangle,
31
32
  // ...otherProps
32
33
  }) => {
33
34
  useLayoutEffect(() => {
34
35
  import('./styles.scss')
35
36
  }, [])
36
37
 
37
- // const messageColors = { ours: color, theirs: 'main2' }
38
-
39
38
  return (
40
39
  <ConversationContext.Provider
41
40
  value={{
42
41
  ourColor,
43
42
  theirColor,
43
+ hasTriangle,
44
44
  }}
45
45
  >
46
46
  <div
@@ -76,11 +76,13 @@ Conversation.propTypes = {
76
76
  /**
77
77
  * The React-written, css properties for this element.
78
78
  */
79
- style :PropTypes.objectOf(PropTypes.string),
79
+ style:PropTypes.objectOf(PropTypes.string),
80
+
80
81
  /**
81
82
  * The base color to our messages component
82
83
  */
83
- ourColor :PropTypes.string,
84
+ ourColor:PropTypes.string,
85
+
84
86
  /**
85
87
  * The base color to their messages component
86
88
  */
@@ -94,12 +96,18 @@ Conversation.propTypes = {
94
96
  * The children JSX
95
97
  */
96
98
  children :PropTypes.node,
99
+
100
+ /**
101
+ * whether to add triangle to bubble chats
102
+ */
103
+ hasTriangle:PropTypes.bool,
97
104
  }
98
105
 
99
106
  Conversation.defaultProps = {
100
- backgroundColor:'background',
101
- ourColor :'main2',
102
- theirColor :'background2',
107
+ backgroundColor:'background2',
108
+ ourColor :'background1',
109
+ theirColor :'background1',
110
+ hasTriangle :'false',
103
111
  }
104
112
 
105
113
  Conversation.Message = Message
@@ -23,9 +23,12 @@ const Message = ({
23
23
  message,
24
24
  sender,
25
25
  from,
26
+ attachment,
27
+ attachmentIcon,
28
+ attachmentColor,
26
29
  // ...otherProps
27
30
  }) => {
28
- const { ourColor, theirColor } = useConversation()
31
+ const { hasTriangle, ourColor, theirColor } = useConversation()
29
32
 
30
33
  return (
31
34
  <div
@@ -36,6 +39,8 @@ const Message = ({
36
39
  userClassName,
37
40
  `x-${from === 'ours' ? ourColor : theirColor}`,
38
41
  from === 'ours' && 'ours',
42
+ hasTriangle === true ? 'has-triangle' : '',
43
+ 'v1',
39
44
  ]
40
45
  .filter((e) => e)
41
46
  .join(' ')}
@@ -49,11 +54,19 @@ const Message = ({
49
54
  <p>
50
55
  {message}
51
56
  </p>
57
+ {attachment
58
+ && (
59
+ <div className={`attachment y-${attachmentColor}`}>
60
+ <span className="f-icons">{attachmentIcon}</span>
61
+ <p className="ml-v">
62
+ {attachment}
63
+ </p>
64
+ </div>
65
+ )}
52
66
  </div>
53
67
  </div>
54
68
  )
55
69
  }
56
-
57
70
  Message.propTypes = {
58
71
  /**
59
72
  * The HTML id for this element
@@ -65,26 +78,46 @@ Message.propTypes = {
65
78
  */
66
79
  className:PropTypes.string,
67
80
 
81
+ /**
82
+ * The React-written, css properties for this element.
83
+ */
84
+ style:PropTypes.objectOf(PropTypes.string),
85
+
68
86
  /**
69
87
  * The message in the conversation
70
88
  */
71
89
  message:PropTypes.string.isRequired,
90
+
72
91
  /**
73
92
  * The sender of the message
74
93
  */
75
- sender :PropTypes.string.isRequired,
94
+ sender:PropTypes.string.isRequired,
95
+
76
96
  /**
77
97
  * The owner of the message
78
98
  */
79
- from :PropTypes.oneOf(['ours', 'theirs']),
99
+ from:PropTypes.oneOf(['ours', 'theirs']),
100
+
80
101
  /**
81
- * The React-written, css properties for this element.
102
+ * name of the attachment file
103
+ */
104
+ attachment:PropTypes.string,
105
+
106
+ /**
107
+ * source of the attachment icon
108
+ */
109
+ attachmentIcon:PropTypes.string,
110
+
111
+ /**
112
+ * background color of the attachment box
82
113
  */
83
- style :PropTypes.objectOf(PropTypes.string),
114
+ attachmentColor:PropTypes.string,
84
115
  }
85
116
 
86
117
  Message.defaultProps = {
87
- from:'theirs',
118
+ from :'theirs',
119
+ attachmentIcon :'A',
120
+ attachmentColor:'main4',
88
121
  }
89
122
 
90
123
  export default Message
@@ -1,52 +1,149 @@
1
1
  /* @pareto-engineering/generator-front 1.0.12 */
2
+
2
3
  @use "@pareto-engineering/bem";
3
4
  @use "@aztlan/stylebook/src/mixins";
4
5
  @use "@aztlan/stylebook/src/globals" as *;
5
6
 
6
7
  $default-padding: var(--u);
7
8
  $default-conversation-background: var(--y);
8
- $default-message-max-width: calc(100% - #{$default-padding});
9
+ $default-message-max-width: calc(100% - 4 * #{$default-padding});
9
10
  $default-message-min-width: 12em;
11
+ $default-message-border: var(--theme-border);
12
+ $triangle-border-size: 15px;
13
+ $triangle-border-style: $triangle-border-size solid;
14
+ $triangle-border-style-subtracted: ($triangle-border-size - 1px) solid;
15
+ $triangle-border1: $triangle-border-style var(--paragraph);
16
+ $triangle-border2: $triangle-border-style transparent;
17
+ $triangle-border3: $triangle-border-style-subtracted var(--x);
18
+ $triangle-border4: $triangle-border-style-subtracted transparent;
19
+ $triangle-before-side:24px;
20
+ $triangle-before-bottom:-30px;
21
+ $triangle-after-bottom:-27px;
22
+ $triangle-after-side:25px;
10
23
 
11
24
  .#{bem.$base}.conversation {
12
- display: flex;
13
- flex-direction: column;
14
- background-color: $default-conversation-background;
15
- padding: $default-padding;
25
+ background-color: $default-conversation-background;
26
+ border-radius: var(--theme-border-radius);
27
+ display: flex;
28
+ flex-direction: column;
29
+ padding: $default-padding;
30
+
31
+ >:not(:last-child) {
32
+ margin-bottom: $default-padding;
33
+ }
34
+
35
+ // >:nth-child(1) {
36
+ // animation-delay: 1s;
37
+ // }
38
+ // >:nth-child(2) {
39
+ // animation-delay: 3s;
40
+ // }
41
+
42
+ .#{bem.$base}.message {
43
+ align-self: flex-start;
44
+ background-color: var(--x);
45
+ // animation: fadeIn 1s ease-in both;
46
+ border: $default-message-border;
16
47
  border-radius: var(--theme-border-radius);
48
+ max-width: $default-message-max-width;
49
+ min-width: $default-message-min-width;
50
+ padding: $default-padding;
51
+ position: relative;
17
52
 
18
- >:not(:last-child) {
19
- margin-bottom: $default-padding;
20
- }
53
+ .#{bem.$element-content} {
54
+ display: flex;
55
+ flex-direction: column;
56
+
57
+ >p {
58
+ color: var(--on-x);
59
+ }
60
+
61
+ .sender {
62
+ font-weight: 800;
63
+ margin-bottom: .5em;
64
+ }
65
+
66
+ .attachment {
67
+ align-self: baseline;
68
+ background-color: var(--y);
69
+ display: flex;
70
+ flex-direction: row;
71
+ padding: .5em 1em;
21
72
 
22
- .#{bem.$base}.message {
23
- min-width: $default-message-min-width;
24
- max-width: $default-message-max-width;
25
- padding: $default-padding;
26
- border-radius: var(--theme-border-radius);
27
- background-color: var(--x);
28
- align-self: flex-start;
29
-
30
- .#{bem.$element-content} {
31
- display: flex;
32
- flex-direction: column;
33
-
34
- >p {
35
- color: var(--on-x);
36
- }
37
-
38
- .sender {
39
- font-weight: 800;
40
- margin-bottom: .5em;
41
- }
73
+ > p {
74
+ margin-bottom: 0;
42
75
  }
43
- }
44
76
 
45
- .#{bem.$base}.ours {
46
- align-self: flex-end;
77
+ > img {
78
+ width: 40px;
79
+ }
80
+ }
81
+ }
82
+ &.#{bem.$base}.ours {
83
+ align-self: flex-end;
47
84
  }
48
85
 
49
- }
86
+ &.has-triangle {
87
+ ::before {
88
+ border-bottom: $triangle-border2;
89
+ border-left: $triangle-border2;
90
+ border-right: $triangle-border1;
91
+ border-top: $triangle-border1;
92
+ bottom: $triangle-before-bottom;
93
+ content: "";
94
+ height: 0;
95
+ position: absolute;
96
+ right: $triangle-before-side;
97
+ width: 0;
98
+ }
99
+
100
+ ::after {
101
+ border-bottom: $triangle-border4;
102
+ border-left: $triangle-border4;
103
+ border-right: $triangle-border3;
104
+ border-top: $triangle-border3;
105
+ bottom: $triangle-after-bottom;
106
+ content: "";
107
+ height: 0;
108
+ position: absolute;
109
+ right: $triangle-after-side;
110
+ width: 0;
111
+ }
50
112
 
113
+ &:not(.ours) {
114
+ ::before {
115
+ border-bottom: $triangle-border2;
116
+ border-left: $triangle-border1;
117
+ border-right: $triangle-border2;
118
+ border-top: $triangle-border1;
119
+ bottom: $triangle-before-bottom;
120
+ content: "";
121
+ height: 0;
122
+ left: $triangle-before-side;
123
+ position: absolute;
124
+ width: 0;
125
+ }
51
126
 
127
+ ::after {
128
+ border-bottom: $triangle-border4;
129
+ border-left: $triangle-border3;
130
+ border-right: $triangle-border4;
131
+ border-top: $triangle-border3;
132
+ bottom: $triangle-after-bottom;
133
+ content: "";
134
+ height: 0;
135
+ left: $triangle-after-side;
136
+ position: absolute;
137
+ width: 0;
138
+ }
139
+ }
140
+ }
52
141
 
142
+ // mobile style
143
+ @include mixins.media($to:$sm-md) {
144
+ .message {
145
+ margin-top: 2em;
146
+ }
147
+ }
148
+ }
149
+ }
@@ -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'