@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.
- package/dist/cjs/a/AnimatedCounter/AnimatedCounter.js +16 -29
- package/dist/cjs/a/AnimatedCounter/styles.scss +3 -11
- package/dist/cjs/a/BackgroundGradient/BackgroundGradient.js +77 -0
- package/dist/cjs/a/BackgroundGradient/index.js +15 -0
- package/dist/cjs/a/BackgroundGradient/styles.scss +16 -0
- package/dist/cjs/a/Conversation/Conversation.js +15 -8
- package/dist/cjs/a/Conversation/common/Message/Message.js +33 -6
- package/dist/cjs/a/Conversation/styles.scss +129 -32
- package/dist/cjs/a/OvalIllustration/OvalIllustration.js +133 -0
- package/dist/cjs/a/OvalIllustration/index.js +15 -0
- package/dist/cjs/a/OvalIllustration/styles.scss +102 -0
- package/dist/cjs/a/People/People.js +15 -7
- package/dist/cjs/a/People/common/Person/Person.js +11 -4
- package/dist/cjs/a/People/styles.scss +13 -15
- package/dist/cjs/a/Shapes/Shapes.js +171 -0
- package/dist/cjs/a/Shapes/index.js +15 -0
- package/dist/cjs/a/Shapes/styles.scss +255 -0
- package/dist/cjs/a/SnapScroller/SnapScroller.js +77 -0
- package/dist/cjs/a/SnapScroller/index.js +15 -0
- package/dist/cjs/a/SnapScroller/styles.scss +38 -0
- package/dist/cjs/a/TeamInfo/styles.scss +2 -2
- package/dist/cjs/a/index.js +33 -1
- package/dist/cjs/b/Button/Button.js +10 -4
- package/dist/cjs/b/Button/styles.scss +83 -19
- package/dist/cjs/b/Metrics/Metrics.js +89 -0
- package/dist/cjs/b/Metrics/index.js +15 -0
- package/dist/cjs/b/Metrics/styles.scss +91 -0
- package/dist/cjs/b/Page/common/Section/Section.js +56 -5
- package/dist/cjs/b/Page/styles.scss +8 -2
- package/dist/cjs/b/QuestionDropdown/styles.scss +1 -1
- package/dist/cjs/b/index.js +9 -1
- package/dist/cjs/c/ContentSlides/common/HorizontalMenu/HorizontalMenu.js +4 -4
- package/dist/cjs/c/ContentSlides/common/Navigator/Navigator.js +4 -3
- package/dist/cjs/c/ContentSlides/styles.scss +10 -4
- package/dist/cjs/f/common/Debugger/Debugger.js +1 -1
- package/dist/cjs/f/common/Label/Label.js +1 -1
- package/dist/cjs/f/common/Label/styles.scss +1 -1
- package/dist/cjs/f/fields/ChoicesInput/ChoicesInput.js +2 -2
- package/dist/cjs/f/fields/ChoicesInput/styles.scss +17 -2
- package/dist/cjs/f/fields/RatingsInput/common/Rating/Rating.js +2 -2
- package/dist/cjs/f/fields/SelectInput/SelectInput.js +37 -10
- package/dist/cjs/f/fields/SelectInput/styles.scss +13 -8
- package/dist/cjs/f/fields/TaskRecommendationInput/TaskRecommendationInput.js +1 -1
- package/dist/cjs/f/fields/TaskRecommendationInput/styles.scss +4 -0
- package/dist/cjs/f/fields/TextInput/TextInput.js +28 -7
- package/dist/cjs/f/fields/TextInput/styles.scss +16 -7
- package/dist/cjs/f/fields/TextareaInput/TextareaInput.js +15 -8
- package/dist/cjs/f/fields/TextareaInput/styles.scss +19 -6
- package/dist/cjs/f/fields/index.js +0 -24
- package/dist/cjs/form-reset.scss +1 -1
- package/dist/cjs/form.scss +1 -1
- package/dist/es/a/AnimatedCounter/AnimatedCounter.js +17 -30
- package/dist/es/a/AnimatedCounter/styles.scss +3 -11
- package/dist/es/a/BackgroundGradient/BackgroundGradient.js +55 -0
- package/dist/es/a/BackgroundGradient/index.js +2 -0
- package/dist/es/a/BackgroundGradient/styles.scss +16 -0
- package/dist/es/a/Conversation/Conversation.js +15 -8
- package/dist/es/a/Conversation/common/Message/Message.js +33 -6
- package/dist/es/a/Conversation/styles.scss +129 -32
- package/dist/es/a/OvalIllustration/OvalIllustration.js +111 -0
- package/dist/es/a/OvalIllustration/index.js +2 -0
- package/dist/es/a/OvalIllustration/styles.scss +102 -0
- package/dist/es/a/People/People.js +14 -7
- package/dist/es/a/People/common/Person/Person.js +11 -4
- package/dist/es/a/People/styles.scss +13 -15
- package/dist/es/a/Shapes/Shapes.js +149 -0
- package/dist/es/a/Shapes/index.js +2 -0
- package/dist/es/a/Shapes/styles.scss +255 -0
- package/dist/es/a/SnapScroller/SnapScroller.js +61 -0
- package/dist/es/a/SnapScroller/index.js +2 -0
- package/dist/es/a/SnapScroller/styles.scss +38 -0
- package/dist/es/a/TeamInfo/styles.scss +2 -2
- package/dist/es/a/index.js +5 -1
- package/dist/es/b/Button/Button.js +8 -2
- package/dist/es/b/Button/styles.scss +83 -19
- package/dist/es/b/Metrics/Metrics.js +72 -0
- package/dist/es/b/Metrics/index.js +2 -0
- package/dist/es/b/Metrics/styles.scss +91 -0
- package/dist/es/b/Page/common/Section/Section.js +55 -4
- package/dist/es/b/Page/styles.scss +8 -2
- package/dist/es/b/QuestionDropdown/styles.scss +1 -1
- package/dist/es/b/index.js +2 -1
- package/dist/es/c/ContentSlides/common/HorizontalMenu/HorizontalMenu.js +4 -4
- package/dist/es/c/ContentSlides/common/Navigator/Navigator.js +4 -3
- package/dist/es/c/ContentSlides/styles.scss +10 -4
- package/dist/es/f/common/Debugger/Debugger.js +1 -1
- package/dist/es/f/common/Label/Label.js +1 -1
- package/dist/es/f/common/Label/styles.scss +1 -1
- package/dist/es/f/fields/ChoicesInput/ChoicesInput.js +2 -2
- package/dist/es/f/fields/ChoicesInput/styles.scss +17 -2
- package/dist/es/f/fields/RatingsInput/common/Rating/Rating.js +2 -2
- package/dist/es/f/fields/SelectInput/SelectInput.js +37 -10
- package/dist/es/f/fields/SelectInput/styles.scss +13 -8
- package/dist/es/f/fields/TaskRecommendationInput/TaskRecommendationInput.js +1 -1
- package/dist/es/f/fields/TaskRecommendationInput/styles.scss +4 -0
- package/dist/es/f/fields/TextInput/TextInput.js +28 -7
- package/dist/es/f/fields/TextInput/styles.scss +16 -7
- package/dist/es/f/fields/TextareaInput/TextareaInput.js +15 -8
- package/dist/es/f/fields/TextareaInput/styles.scss +19 -6
- package/dist/es/f/fields/index.js +0 -3
- package/dist/es/form-reset.scss +1 -1
- package/dist/es/form.scss +1 -1
- package/package.json +3 -3
- package/src/__snapshots__/Storyshots.test.js.snap +6050 -812
- package/src/local.scss +4 -0
- package/src/stories/a/AnimatedCounter.stories.jsx +9 -5
- package/src/stories/a/BackgroundGradient.stories.jsx +38 -0
- package/src/stories/a/ContentCard.stories.jsx +1 -1
- package/src/stories/a/Conversation.stories.jsx +78 -1
- package/src/stories/a/OvalIllustration.stories.jsx +59 -0
- package/src/stories/a/People.stories.jsx +25 -1
- package/src/stories/a/ProgressBar.stories.jsx +1 -1
- package/src/stories/a/Quote.stories.jsx +1 -1
- package/src/stories/a/Shapes.stories.jsx +143 -0
- package/src/stories/a/SnapScroller.stories.jsx +98 -0
- package/src/stories/a/Spinner.stories.jsx +1 -1
- package/src/stories/b/Button.stories.jsx +83 -54
- package/src/stories/b/Metrics.stories.jsx +62 -0
- package/src/stories/b/Page.stories.jsx +51 -1
- package/src/stories/b/ThemeSelector.stories.jsx +1 -1
- package/src/stories/b/Title.stories.jsx +1 -1
- package/src/stories/c/ContentSlides.stories.jsx +154 -2
- package/src/stories/colors.js +5 -3
- package/src/stories/f/SelectInput.stories.jsx +36 -5
- package/src/stories/f/TextInput.stories.jsx +16 -5
- package/src/stories/f/TextareaInput.stories.jsx +42 -6
- package/src/ui/a/AnimatedCounter/AnimatedCounter.jsx +21 -27
- package/src/ui/a/AnimatedCounter/styles.scss +3 -11
- package/src/ui/a/BackgroundGradient/BackgroundGradient.jsx +76 -0
- package/src/ui/a/BackgroundGradient/index.js +2 -0
- package/src/ui/a/BackgroundGradient/styles.scss +16 -0
- package/src/ui/a/Conversation/Conversation.jsx +15 -7
- package/src/ui/a/Conversation/common/Message/Message.jsx +40 -7
- package/src/ui/a/Conversation/styles.scss +129 -32
- package/src/ui/a/OvalIllustration/OvalIllustration.jsx +134 -0
- package/src/ui/a/OvalIllustration/index.js +2 -0
- package/src/ui/a/OvalIllustration/styles.scss +102 -0
- package/src/ui/a/People/People.jsx +12 -4
- package/src/ui/a/People/common/Person/Person.jsx +7 -1
- package/src/ui/a/People/styles.scss +13 -15
- package/src/ui/a/Shapes/Shapes.jsx +191 -0
- package/src/ui/a/Shapes/index.js +2 -0
- package/src/ui/a/Shapes/styles.scss +255 -0
- package/src/ui/a/SnapScroller/SnapScroller.jsx +83 -0
- package/src/ui/a/SnapScroller/index.js +2 -0
- package/src/ui/a/SnapScroller/styles.scss +38 -0
- package/src/ui/a/TeamInfo/styles.scss +2 -2
- package/src/ui/a/index.js +4 -0
- package/src/ui/b/Button/Button.jsx +9 -1
- package/src/ui/b/Button/styles.scss +83 -19
- package/src/ui/b/Metrics/Metrics.jsx +93 -0
- package/src/ui/b/Metrics/index.js +2 -0
- package/src/ui/b/Metrics/styles.scss +91 -0
- package/src/ui/b/Page/common/Section/Section.jsx +68 -2
- package/src/ui/b/Page/styles.scss +8 -2
- package/src/ui/b/QuestionDropdown/styles.scss +1 -1
- package/src/ui/b/index.js +1 -0
- package/src/ui/c/ContentSlides/common/HorizontalMenu/HorizontalMenu.jsx +4 -4
- package/src/ui/c/ContentSlides/common/Navigator/Navigator.jsx +3 -2
- package/src/ui/c/ContentSlides/styles.scss +10 -4
- package/src/ui/f/common/Debugger/Debugger.jsx +1 -1
- package/src/ui/f/common/Label/Label.jsx +1 -1
- package/src/ui/f/common/Label/styles.scss +1 -1
- package/src/ui/f/fields/ChoicesInput/ChoicesInput.jsx +2 -2
- package/src/ui/f/fields/ChoicesInput/styles.scss +17 -2
- package/src/ui/f/fields/RatingsInput/common/Rating/Rating.jsx +2 -2
- package/src/ui/f/fields/SelectInput/SelectInput.jsx +44 -5
- package/src/ui/f/fields/SelectInput/styles.scss +13 -8
- package/src/ui/f/fields/TextInput/TextInput.jsx +24 -3
- package/src/ui/f/fields/TextInput/styles.scss +16 -7
- package/src/ui/f/fields/TextareaInput/TextareaInput.jsx +24 -13
- package/src/ui/f/fields/TextareaInput/styles.scss +19 -6
- package/src/ui/f/fields/index.js +0 -3
- package/src/ui/form-reset.scss +1 -1
- package/src/ui/form.scss +1 -1
- package/src/stories/f/CheckboxInput.stories.jsx +0 -37
- package/src/stories/f/RadioInput.stories.jsx +0 -37
- package/src/stories/f/TaskRecommendationInput.stories.jsx +0 -38
- package/src/ui/f/fields/CheckboxInput/CheckboxInput.jsx +0 -107
- package/src/ui/f/fields/CheckboxInput/index.js +0 -2
- package/src/ui/f/fields/CheckboxInput/styles.scss +0 -28
- package/src/ui/f/fields/RadioInput/RadioInput.jsx +0 -112
- package/src/ui/f/fields/RadioInput/index.js +0 -2
- package/src/ui/f/fields/RadioInput/styles.scss +0 -26
- package/src/ui/f/fields/TaskRecommendationInput/TaskRecommendationInput.jsx +0 -130
- package/src/ui/f/fields/TaskRecommendationInput/index.js +0 -2
- package/src/ui/f/fields/TaskRecommendationInput/styles.scss +0 -37
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/* @pareto-engineering/generator-front 1.0.12 */
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
import { useLayoutEffect } from 'react';
|
|
3
|
+
import { useLayoutEffect, useCallback } from 'react';
|
|
4
4
|
import CountUp from 'react-countup';
|
|
5
5
|
import VisibilitySensor from 'react-visibility-sensor';
|
|
6
6
|
import PropTypes from 'prop-types';
|
|
@@ -18,28 +18,29 @@ const AnimatedCounter = ({
|
|
|
18
18
|
style,
|
|
19
19
|
color,
|
|
20
20
|
number,
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
descriptionPosition,
|
|
24
|
-
unitPosition,
|
|
21
|
+
before,
|
|
22
|
+
after,
|
|
25
23
|
delay // ...otherProps
|
|
26
24
|
|
|
27
25
|
}) => {
|
|
28
26
|
useLayoutEffect(() => {
|
|
29
27
|
import("./styles.scss");
|
|
30
28
|
}, []);
|
|
29
|
+
const countDecimals = useCallback(value => {
|
|
30
|
+
if (value % 1 !== 0) return value.toString().split('.')[1].length;
|
|
31
|
+
return 0;
|
|
32
|
+
}, []);
|
|
31
33
|
return /*#__PURE__*/React.createElement("div", {
|
|
32
34
|
id: id,
|
|
33
35
|
className: [baseClassName, componentClassName, userClassName, `x-${color}`].filter(e => e).join(' '),
|
|
34
36
|
style: style // {...otherProps}
|
|
35
37
|
|
|
36
|
-
},
|
|
37
|
-
className: "info top-description uc s-1 md-s0"
|
|
38
|
-
}, description), /*#__PURE__*/React.createElement("div", {
|
|
38
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
39
39
|
className: "count s3"
|
|
40
|
-
},
|
|
40
|
+
}, before && /*#__PURE__*/React.createElement("span", null, before), /*#__PURE__*/React.createElement(CountUp, {
|
|
41
41
|
end: number,
|
|
42
42
|
delay: delay,
|
|
43
|
+
decimals: countDecimals(number),
|
|
43
44
|
redraw: true
|
|
44
45
|
}, ({
|
|
45
46
|
countUpRef,
|
|
@@ -49,9 +50,7 @@ const AnimatedCounter = ({
|
|
|
49
50
|
delayedCall: true
|
|
50
51
|
}, /*#__PURE__*/React.createElement("span", {
|
|
51
52
|
ref: countUpRef
|
|
52
|
-
}))),
|
|
53
|
-
className: "info uc s-1 md-s0 v50 mt-v"
|
|
54
|
-
}, description));
|
|
53
|
+
}))), after && /*#__PURE__*/React.createElement("span", null, after)));
|
|
55
54
|
};
|
|
56
55
|
|
|
57
56
|
AnimatedCounter.propTypes = {
|
|
@@ -81,33 +80,21 @@ AnimatedCounter.propTypes = {
|
|
|
81
80
|
number: PropTypes.number,
|
|
82
81
|
|
|
83
82
|
/**
|
|
84
|
-
* The
|
|
83
|
+
* The unit before the number
|
|
85
84
|
*/
|
|
86
|
-
|
|
85
|
+
before: PropTypes.string,
|
|
87
86
|
|
|
88
87
|
/**
|
|
89
|
-
* The
|
|
88
|
+
* The unit after the number
|
|
90
89
|
*/
|
|
91
|
-
|
|
90
|
+
after: PropTypes.string,
|
|
92
91
|
|
|
93
92
|
/**
|
|
94
93
|
* react counter delay
|
|
95
94
|
*/
|
|
96
|
-
delay: PropTypes.number
|
|
97
|
-
|
|
98
|
-
/**
|
|
99
|
-
* If the animated counter description should be at the top
|
|
100
|
-
*/
|
|
101
|
-
descriptionPosition: PropTypes.oneOf(['top', 'bottom']),
|
|
102
|
-
|
|
103
|
-
/**
|
|
104
|
-
* If the unit should be before or after the animated numbers
|
|
105
|
-
*/
|
|
106
|
-
unitPosition: PropTypes.string
|
|
95
|
+
delay: PropTypes.number
|
|
107
96
|
};
|
|
108
97
|
AnimatedCounter.defaultProps = {
|
|
109
|
-
color: 'main1'
|
|
110
|
-
descriptionPosition: 'bottom',
|
|
111
|
-
unitPosition: 'after'
|
|
98
|
+
color: 'main1'
|
|
112
99
|
};
|
|
113
100
|
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
|
-
|
|
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,55 @@
|
|
|
1
|
+
/* @pareto-engineering/generator-front 1.0.12 */
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { useLayoutEffect } from 'react';
|
|
4
|
+
import PropTypes from 'prop-types';
|
|
5
|
+
import styleNames from '@pareto-engineering/bem'; // Local Definitions
|
|
6
|
+
|
|
7
|
+
const baseClassName = styleNames.base;
|
|
8
|
+
const componentClassName = 'background-gradient';
|
|
9
|
+
/**
|
|
10
|
+
* This is the component description.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
const BackgroundGradient = ({
|
|
14
|
+
id,
|
|
15
|
+
className: userClassName,
|
|
16
|
+
style,
|
|
17
|
+
height // ...otherProps
|
|
18
|
+
|
|
19
|
+
}) => {
|
|
20
|
+
useLayoutEffect(() => {
|
|
21
|
+
import("./styles.scss");
|
|
22
|
+
}, []);
|
|
23
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
24
|
+
id: id,
|
|
25
|
+
className: [baseClassName, componentClassName, userClassName].filter(e => e).join(' '),
|
|
26
|
+
style: { ...style,
|
|
27
|
+
'--gradient-height': height
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
BackgroundGradient.propTypes = {
|
|
33
|
+
/**
|
|
34
|
+
* The HTML id for this element
|
|
35
|
+
*/
|
|
36
|
+
id: PropTypes.string,
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* The HTML class names for this element
|
|
40
|
+
*/
|
|
41
|
+
className: PropTypes.string,
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* The React-written, css properties for this element.
|
|
45
|
+
*/
|
|
46
|
+
style: PropTypes.objectOf(PropTypes.string),
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* The height of the shape.
|
|
50
|
+
*/
|
|
51
|
+
height: PropTypes.string
|
|
52
|
+
};
|
|
53
|
+
BackgroundGradient.defaultProps = {// someProp: false,
|
|
54
|
+
};
|
|
55
|
+
export default BackgroundGradient;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/* @pareto-engineering/generator-front 1.0.12 */
|
|
2
|
+
@use "@pareto-engineering/bem";
|
|
3
|
+
|
|
4
|
+
.#{bem.$base}.background-gradient{
|
|
5
|
+
position: absolute;
|
|
6
|
+
top: 0;
|
|
7
|
+
left: 0;
|
|
8
|
+
width: 100%;
|
|
9
|
+
height: var(--gradient-height);
|
|
10
|
+
background-image: linear-gradient(transparent, var(--y) 25%, var(--light-y) 75%, transparent);
|
|
11
|
+
opacity: .4;
|
|
12
|
+
z-index: -1;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
@@ -19,17 +19,18 @@ const Conversation = ({
|
|
|
19
19
|
backgroundColor,
|
|
20
20
|
ourColor,
|
|
21
21
|
theirColor,
|
|
22
|
-
children
|
|
22
|
+
children,
|
|
23
|
+
hasTriangle // ...otherProps
|
|
23
24
|
|
|
24
25
|
}) => {
|
|
25
26
|
useLayoutEffect(() => {
|
|
26
27
|
import("./styles.scss");
|
|
27
|
-
}, []);
|
|
28
|
-
|
|
28
|
+
}, []);
|
|
29
29
|
return /*#__PURE__*/React.createElement(ConversationContext.Provider, {
|
|
30
30
|
value: {
|
|
31
31
|
ourColor,
|
|
32
|
-
theirColor
|
|
32
|
+
theirColor,
|
|
33
|
+
hasTriangle
|
|
33
34
|
}
|
|
34
35
|
}, /*#__PURE__*/React.createElement("div", {
|
|
35
36
|
id: id,
|
|
@@ -72,12 +73,18 @@ Conversation.propTypes = {
|
|
|
72
73
|
/**
|
|
73
74
|
* The children JSX
|
|
74
75
|
*/
|
|
75
|
-
children: PropTypes.node
|
|
76
|
+
children: PropTypes.node,
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* whether to add triangle to bubble chats
|
|
80
|
+
*/
|
|
81
|
+
hasTriangle: PropTypes.bool
|
|
76
82
|
};
|
|
77
83
|
Conversation.defaultProps = {
|
|
78
|
-
backgroundColor: '
|
|
79
|
-
ourColor: '
|
|
80
|
-
theirColor: '
|
|
84
|
+
backgroundColor: 'background2',
|
|
85
|
+
ourColor: 'background1',
|
|
86
|
+
theirColor: 'background1',
|
|
87
|
+
hasTriangle: 'false'
|
|
81
88
|
};
|
|
82
89
|
Conversation.Message = Message;
|
|
83
90
|
export default Conversation;
|
|
@@ -16,22 +16,32 @@ const Message = ({
|
|
|
16
16
|
style,
|
|
17
17
|
message,
|
|
18
18
|
sender,
|
|
19
|
-
from
|
|
19
|
+
from,
|
|
20
|
+
attachment,
|
|
21
|
+
attachmentIcon,
|
|
22
|
+
attachmentColor // ...otherProps
|
|
20
23
|
|
|
21
24
|
}) => {
|
|
22
25
|
const {
|
|
26
|
+
hasTriangle,
|
|
23
27
|
ourColor,
|
|
24
28
|
theirColor
|
|
25
29
|
} = useConversation();
|
|
26
30
|
return /*#__PURE__*/React.createElement("div", {
|
|
27
31
|
id: id,
|
|
28
|
-
className: [baseClassName, componentClassName, userClassName, `x-${from === 'ours' ? ourColor : theirColor}`, from === 'ours' && 'ours'].filter(e => e).join(' '),
|
|
32
|
+
className: [baseClassName, componentClassName, userClassName, `x-${from === 'ours' ? ourColor : theirColor}`, from === 'ours' && 'ours', hasTriangle === true ? 'has-triangle' : '', 'v1'].filter(e => e).join(' '),
|
|
29
33
|
style: style
|
|
30
34
|
}, /*#__PURE__*/React.createElement("div", {
|
|
31
35
|
className: styleNames.elementContent
|
|
32
36
|
}, /*#__PURE__*/React.createElement("p", {
|
|
33
37
|
className: "sender v25 mb-v s-1"
|
|
34
|
-
}, sender, ":"), /*#__PURE__*/React.createElement("p", null, message)
|
|
38
|
+
}, sender, ":"), /*#__PURE__*/React.createElement("p", null, message), attachment && /*#__PURE__*/React.createElement("div", {
|
|
39
|
+
className: `attachment y-${attachmentColor}`
|
|
40
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
41
|
+
className: "f-icons"
|
|
42
|
+
}, attachmentIcon), /*#__PURE__*/React.createElement("p", {
|
|
43
|
+
className: "ml-v"
|
|
44
|
+
}, attachment))));
|
|
35
45
|
};
|
|
36
46
|
|
|
37
47
|
Message.propTypes = {
|
|
@@ -45,6 +55,11 @@ Message.propTypes = {
|
|
|
45
55
|
*/
|
|
46
56
|
className: PropTypes.string,
|
|
47
57
|
|
|
58
|
+
/**
|
|
59
|
+
* The React-written, css properties for this element.
|
|
60
|
+
*/
|
|
61
|
+
style: PropTypes.objectOf(PropTypes.string),
|
|
62
|
+
|
|
48
63
|
/**
|
|
49
64
|
* The message in the conversation
|
|
50
65
|
*/
|
|
@@ -61,11 +76,23 @@ Message.propTypes = {
|
|
|
61
76
|
from: PropTypes.oneOf(['ours', 'theirs']),
|
|
62
77
|
|
|
63
78
|
/**
|
|
64
|
-
*
|
|
79
|
+
* name of the attachment file
|
|
80
|
+
*/
|
|
81
|
+
attachment: PropTypes.string,
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* source of the attachment icon
|
|
85
|
+
*/
|
|
86
|
+
attachmentIcon: PropTypes.string,
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* background color of the attachment box
|
|
65
90
|
*/
|
|
66
|
-
|
|
91
|
+
attachmentColor: PropTypes.string
|
|
67
92
|
};
|
|
68
93
|
Message.defaultProps = {
|
|
69
|
-
from: 'theirs'
|
|
94
|
+
from: 'theirs',
|
|
95
|
+
attachmentIcon: 'A',
|
|
96
|
+
attachmentColor: 'main4'
|
|
70
97
|
};
|
|
71
98
|
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
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
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
|
-
|
|
19
|
-
|
|
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
|
-
|
|
23
|
-
|
|
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
|
-
|
|
46
|
-
|
|
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,111 @@
|
|
|
1
|
+
/* @pareto-engineering/generator-front 1.0.12 */
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { useLayoutEffect } from 'react';
|
|
4
|
+
import PropTypes from 'prop-types';
|
|
5
|
+
import styleNames from '@pareto-engineering/bem'; // Local Definitions
|
|
6
|
+
|
|
7
|
+
const baseClassName = styleNames.base;
|
|
8
|
+
const componentClassName = 'oval-illustration';
|
|
9
|
+
/**
|
|
10
|
+
* This is the component description.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
const OvalIllustration = ({
|
|
14
|
+
id,
|
|
15
|
+
className: userClassName,
|
|
16
|
+
style,
|
|
17
|
+
layout,
|
|
18
|
+
src,
|
|
19
|
+
alt,
|
|
20
|
+
ovalBackground,
|
|
21
|
+
backgroundColor,
|
|
22
|
+
mobileSize,
|
|
23
|
+
tabletSize,
|
|
24
|
+
desktopSize // ...otherProps
|
|
25
|
+
|
|
26
|
+
}) => {
|
|
27
|
+
useLayoutEffect(() => {
|
|
28
|
+
import("./styles.scss");
|
|
29
|
+
}, []);
|
|
30
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
31
|
+
id: id,
|
|
32
|
+
className: [baseClassName, componentClassName, userClassName, layout].filter(e => e).join(' '),
|
|
33
|
+
style: { ...style,
|
|
34
|
+
'--mobile-size': mobileSize,
|
|
35
|
+
'--tablet-size': tabletSize,
|
|
36
|
+
'--desktop-size': desktopSize
|
|
37
|
+
} // {...otherProps}
|
|
38
|
+
|
|
39
|
+
}, ovalBackground && /*#__PURE__*/React.createElement("div", {
|
|
40
|
+
className: `oval-background y-${backgroundColor}`
|
|
41
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
42
|
+
className: "illustration"
|
|
43
|
+
}, /*#__PURE__*/React.createElement("img", {
|
|
44
|
+
src: src,
|
|
45
|
+
alt: alt
|
|
46
|
+
})));
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
OvalIllustration.propTypes = {
|
|
50
|
+
/**
|
|
51
|
+
* The HTML id for this element
|
|
52
|
+
*/
|
|
53
|
+
id: PropTypes.string,
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* The HTML class names for this element
|
|
57
|
+
*/
|
|
58
|
+
className: PropTypes.string,
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* The React-written, css properties for this element.
|
|
62
|
+
*/
|
|
63
|
+
style: PropTypes.objectOf(PropTypes.string),
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* side definition of the illustration
|
|
67
|
+
*/
|
|
68
|
+
layout: PropTypes.oneOf(['left', 'right']),
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* image url
|
|
72
|
+
*/
|
|
73
|
+
src: PropTypes.string,
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* alt tag for the image
|
|
77
|
+
*/
|
|
78
|
+
alt: PropTypes.string,
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* whether to have a oval shape as background
|
|
82
|
+
*/
|
|
83
|
+
ovalBackground: PropTypes.bool,
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* background color of the oval behind the image
|
|
87
|
+
*/
|
|
88
|
+
backgroundColor: PropTypes.string,
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* size of the oval for mobile screen
|
|
92
|
+
*/
|
|
93
|
+
mobileSize: PropTypes.string,
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* size of the oval for tablet screen
|
|
97
|
+
*/
|
|
98
|
+
tabletSize: PropTypes.string,
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* size of the oval for desktop screen
|
|
102
|
+
*/
|
|
103
|
+
desktopSize: PropTypes.string
|
|
104
|
+
};
|
|
105
|
+
OvalIllustration.defaultProps = {
|
|
106
|
+
layout: 'left',
|
|
107
|
+
mobileSize: '20em',
|
|
108
|
+
tabletSize: '35em',
|
|
109
|
+
desktopSize: '45em'
|
|
110
|
+
};
|
|
111
|
+
export default OvalIllustration;
|