@pareto-engineering/design-system 4.0.0-alpha.18 → 4.0.0-alpha.21
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/ContentTree/ContentTree.js +8 -2
- package/dist/cjs/a/ContentTree/common/Tree/Tree.js +12 -5
- package/dist/cjs/a/ContentTree/styles.scss +24 -14
- package/dist/cjs/a/Conversation/Conversation.js +1 -1
- package/dist/cjs/a/Conversation/common/Message/Message.js +2 -3
- package/dist/cjs/a/Conversation/styles.scss +44 -28
- package/dist/cjs/a/SnapScroller/styles.scss +9 -4
- package/dist/cjs/b/Button/Button.js +4 -1
- package/dist/cjs/b/Button/styles.scss +22 -4
- package/dist/cjs/b/ThemeSelector/ThemeSelector.js +15 -22
- package/dist/cjs/b/ThemeSelector/styles.scss +2 -8
- package/dist/es/a/ContentTree/ContentTree.js +8 -2
- package/dist/es/a/ContentTree/common/Tree/Tree.js +12 -5
- package/dist/es/a/ContentTree/styles.scss +24 -14
- package/dist/es/a/Conversation/Conversation.js +1 -1
- package/dist/es/a/Conversation/common/Message/Message.js +2 -3
- package/dist/es/a/Conversation/styles.scss +44 -28
- package/dist/es/a/SnapScroller/styles.scss +9 -4
- package/dist/es/b/Button/Button.js +4 -1
- package/dist/es/b/Button/styles.scss +22 -4
- package/dist/es/b/ThemeSelector/ThemeSelector.js +15 -23
- package/dist/es/b/ThemeSelector/styles.scss +2 -8
- package/package.json +4 -4
- package/src/stories/a/Conversation.stories.jsx +5 -1
- package/src/ui/a/ContentTree/ContentTree.jsx +7 -3
- package/src/ui/a/ContentTree/common/Tree/Tree.jsx +19 -7
- package/src/ui/a/ContentTree/styles.scss +24 -14
- package/src/ui/a/Conversation/Conversation.jsx +3 -1
- package/src/ui/a/Conversation/common/Message/Message.jsx +3 -5
- package/src/ui/a/Conversation/styles.scss +44 -28
- package/src/ui/a/SnapScroller/styles.scss +9 -4
- package/src/ui/b/Button/Button.jsx +4 -1
- package/src/ui/b/Button/styles.scss +22 -4
- package/src/ui/b/ThemeSelector/ThemeSelector.jsx +8 -21
- package/src/ui/b/ThemeSelector/styles.scss +2 -8
- package/tests/__snapshots__/Storyshots.test.js.snap +1615 -949
|
@@ -23,7 +23,8 @@ const ContentTree = _ref => {
|
|
|
23
23
|
className: userClassName,
|
|
24
24
|
style,
|
|
25
25
|
target,
|
|
26
|
-
selectors
|
|
26
|
+
selectors,
|
|
27
|
+
color
|
|
27
28
|
// ...otherProps
|
|
28
29
|
} = _ref;
|
|
29
30
|
(0, React.useInsertionEffect)(() => {
|
|
@@ -36,6 +37,7 @@ const ContentTree = _ref => {
|
|
|
36
37
|
style: style
|
|
37
38
|
// {...otherProps}
|
|
38
39
|
}, /*#__PURE__*/React.createElement(_common.Tree, {
|
|
40
|
+
color: color,
|
|
39
41
|
tree: contentTree
|
|
40
42
|
}));
|
|
41
43
|
};
|
|
@@ -61,7 +63,11 @@ ContentTree.propTypes = {
|
|
|
61
63
|
*/
|
|
62
64
|
target: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.shape({
|
|
63
65
|
current: _propTypes.default.node
|
|
64
|
-
})])
|
|
66
|
+
})]),
|
|
67
|
+
/**
|
|
68
|
+
* The color for the tree.
|
|
69
|
+
*/
|
|
70
|
+
color: _propTypes.default.string
|
|
65
71
|
};
|
|
66
72
|
ContentTree.defaultProps = {
|
|
67
73
|
selectors: ['h2', 'h3']
|
|
@@ -7,6 +7,7 @@ exports.default = void 0;
|
|
|
7
7
|
var React = _interopRequireWildcard(require("react"));
|
|
8
8
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
9
|
var _exports = _interopRequireDefault(require("@pareto-engineering/bem/exports"));
|
|
10
|
+
var _ = require("../../../..");
|
|
10
11
|
var _useFirstVisibleNode = _interopRequireDefault(require("../useFirstVisibleNode"));
|
|
11
12
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
13
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
@@ -27,7 +28,8 @@ const Tree = _ref => {
|
|
|
27
28
|
className: userClassName,
|
|
28
29
|
style,
|
|
29
30
|
tree,
|
|
30
|
-
displayDepth
|
|
31
|
+
displayDepth,
|
|
32
|
+
color
|
|
31
33
|
// ...otherProps
|
|
32
34
|
} = _ref;
|
|
33
35
|
// The nodeIds to be used to get the first visible node
|
|
@@ -62,11 +64,11 @@ const Tree = _ref => {
|
|
|
62
64
|
}, node.text)), node.children.length > 0 && /*#__PURE__*/React.createElement("ul", null, node.children.map(child => getNestedTree(child, depth - 1))));
|
|
63
65
|
};
|
|
64
66
|
const ContentTree = (0, React.useMemo)(() => tree.map(node => getNestedTree(node, displayDepth)), [tree]);
|
|
65
|
-
return /*#__PURE__*/React.createElement(
|
|
67
|
+
return ContentTree.length ? /*#__PURE__*/React.createElement(_.Card, {
|
|
66
68
|
id: id,
|
|
67
|
-
className: [baseClassName, componentClassName, userClassName].filter(e => e).join(' '),
|
|
69
|
+
className: [baseClassName, componentClassName, userClassName, color && `x-${color}`].filter(e => e).join(' '),
|
|
68
70
|
style: style
|
|
69
|
-
}, ContentTree);
|
|
71
|
+
}, /*#__PURE__*/React.createElement(_.Card.Section, null, /*#__PURE__*/React.createElement("ul", null, ContentTree))) : null;
|
|
70
72
|
};
|
|
71
73
|
Tree.propTypes = {
|
|
72
74
|
/**
|
|
@@ -95,9 +97,14 @@ Tree.propTypes = {
|
|
|
95
97
|
/**
|
|
96
98
|
* The levels of the tree to display.
|
|
97
99
|
*/
|
|
98
|
-
displayDepth: _propTypes.default.number
|
|
100
|
+
displayDepth: _propTypes.default.number,
|
|
101
|
+
/**
|
|
102
|
+
* The color of the tree.
|
|
103
|
+
*/
|
|
104
|
+
color: _propTypes.default.string
|
|
99
105
|
};
|
|
100
106
|
Tree.defaultProps = {
|
|
107
|
+
color: 'interactive',
|
|
101
108
|
displayDepth: 4
|
|
102
109
|
};
|
|
103
110
|
var _default = Tree;
|
|
@@ -3,26 +3,38 @@
|
|
|
3
3
|
|
|
4
4
|
@use "@pareto-engineering/bem";
|
|
5
5
|
|
|
6
|
+
$default-dot-size: .5em;
|
|
6
7
|
$default-margin: 1em;
|
|
7
8
|
$default-padding: 1em;
|
|
8
9
|
|
|
9
10
|
.#{bem.$base}.content-tree {
|
|
10
|
-
|
|
11
|
-
list-style: none;
|
|
12
|
-
|
|
13
|
-
> li > p > a {
|
|
14
|
-
color: var(--paragraph);
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
.#{bem.$base}.tree {
|
|
19
|
-
padding: 0;
|
|
11
|
+
> .#{bem.$base}.tree {
|
|
20
12
|
position: sticky;
|
|
21
13
|
top: 0;
|
|
22
14
|
|
|
15
|
+
ul {
|
|
16
|
+
list-style: none;
|
|
17
|
+
padding: 0 $default-padding;
|
|
18
|
+
|
|
19
|
+
> li > p > a {
|
|
20
|
+
color: var(--paragraph);
|
|
21
|
+
text-decoration: none;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
23
25
|
.#{bem.$modifier-active} {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
+
font-weight: 700;
|
|
27
|
+
|
|
28
|
+
&::before {
|
|
29
|
+
background: var(--x);
|
|
30
|
+
border-radius: 50%;
|
|
31
|
+
content: "";
|
|
32
|
+
display: inline-block;
|
|
33
|
+
height: $default-dot-size;
|
|
34
|
+
margin-right: $default-margin;
|
|
35
|
+
text-align: center;
|
|
36
|
+
width: $default-dot-size;
|
|
37
|
+
}
|
|
26
38
|
}
|
|
27
39
|
|
|
28
40
|
li:not(:last-child) {
|
|
@@ -34,5 +46,3 @@ $default-padding: 1em;
|
|
|
34
46
|
}
|
|
35
47
|
}
|
|
36
48
|
}
|
|
37
|
-
|
|
38
|
-
|
|
@@ -42,7 +42,7 @@ const Conversation = _ref => {
|
|
|
42
42
|
id: id,
|
|
43
43
|
className: [baseClassName, componentClassName, userClassName, `y-${backgroundColor}`].filter(e => e).join(' '),
|
|
44
44
|
style: style
|
|
45
|
-
}, children));
|
|
45
|
+
}, /*#__PURE__*/React.createElement(_.Card.Section, null, children)));
|
|
46
46
|
};
|
|
47
47
|
Conversation.propTypes = {
|
|
48
48
|
/**
|
|
@@ -7,7 +7,6 @@ exports.default = void 0;
|
|
|
7
7
|
var React = _interopRequireWildcard(require("react"));
|
|
8
8
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
9
|
var _exports = _interopRequireDefault(require("@pareto-engineering/bem/exports"));
|
|
10
|
-
var _ = require("../../../..");
|
|
11
10
|
var _useConversation = _interopRequireDefault(require("../../useConversation"));
|
|
12
11
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
12
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
@@ -39,9 +38,9 @@ const Message = _ref => {
|
|
|
39
38
|
ourColor,
|
|
40
39
|
theirColor
|
|
41
40
|
} = (0, _useConversation.default)();
|
|
42
|
-
return /*#__PURE__*/React.createElement(
|
|
41
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
43
42
|
id: id,
|
|
44
|
-
className: [baseClassName, componentClassName, userClassName, `x-${from === 'ours' ? ourColor : theirColor}`, from
|
|
43
|
+
className: [baseClassName, componentClassName, userClassName, `x-${from === 'ours' ? ourColor : theirColor}`, from].filter(e => e).join(' '),
|
|
45
44
|
style: style
|
|
46
45
|
}, sender && /*#__PURE__*/React.createElement("p", {
|
|
47
46
|
className: "sender"
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/* @pareto-engineering/generator-front 1.0.12 */
|
|
2
|
+
/* stylelint-disable selector-max-compound-selectors -- Required here */
|
|
2
3
|
|
|
3
4
|
@use "@pareto-engineering/bem";
|
|
4
5
|
@use "@pareto-engineering/styles/src/mixins";
|
|
@@ -12,39 +13,54 @@ $default-message-border: 1px solid var(--hard-background-cards);
|
|
|
12
13
|
|
|
13
14
|
.#{bem.$base}.conversation {
|
|
14
15
|
background: var(--y);
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
> .message
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
16
|
+
|
|
17
|
+
> .#{bem.$base}.section {
|
|
18
|
+
display: flex;
|
|
19
|
+
flex-direction: column;
|
|
20
|
+
|
|
21
|
+
> .#{bem.$base}.message + .#{bem.$base}.message {
|
|
22
|
+
padding-top: $default-padding;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
> .#{bem.$base}.message.ours + .#{bem.$base}.message.ours,
|
|
26
|
+
> .#{bem.$base}.message.theirs + .#{bem.$base}.message.theirs {
|
|
27
|
+
padding-top: calc($default-padding / 2);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
> .#{bem.$base}.message {
|
|
31
|
+
align-self: flex-start;
|
|
32
|
+
max-width: $default-message-max-width;
|
|
33
|
+
min-width: $default-message-min-width;
|
|
34
|
+
position: relative;
|
|
35
|
+
|
|
36
|
+
> .sender {
|
|
37
|
+
margin: 0;
|
|
35
38
|
}
|
|
36
39
|
|
|
37
|
-
> .
|
|
38
|
-
|
|
39
|
-
|
|
40
|
+
> .message-content {
|
|
41
|
+
background-color: var(--x);
|
|
42
|
+
border: $default-message-border;
|
|
43
|
+
border-radius: $default-border-radius;
|
|
40
44
|
display: flex;
|
|
41
|
-
flex-direction:
|
|
42
|
-
|
|
45
|
+
flex-direction: column;
|
|
46
|
+
padding: 0 $default-padding;
|
|
47
|
+
|
|
48
|
+
> p {
|
|
49
|
+
color: var(--on-x);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
> .attachment {
|
|
53
|
+
align-items: center;
|
|
54
|
+
align-self: flex-end;
|
|
55
|
+
display: flex;
|
|
56
|
+
flex-direction: row;
|
|
57
|
+
gap: calc($default-padding / 2);
|
|
58
|
+
}
|
|
43
59
|
}
|
|
44
|
-
}
|
|
45
60
|
|
|
46
|
-
|
|
47
|
-
|
|
61
|
+
&.#{bem.$base}.ours {
|
|
62
|
+
align-self: flex-end;
|
|
63
|
+
}
|
|
48
64
|
}
|
|
49
65
|
}
|
|
50
66
|
}
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
@use "@pareto-engineering/styles/src/mixins";
|
|
6
6
|
@use "@pareto-engineering/styles/src/globals" as *;
|
|
7
7
|
|
|
8
|
-
$default-spacing: var(--gap
|
|
8
|
+
$default-spacing: var(--gap);
|
|
9
9
|
|
|
10
10
|
.#{bem.$base}.snap-scroller {
|
|
11
11
|
display: flex;
|
|
@@ -27,10 +27,11 @@ $default-spacing: var(--gap, 1em);
|
|
|
27
27
|
&:first-child {
|
|
28
28
|
margin-left: $default-spacing;
|
|
29
29
|
}
|
|
30
|
+
}
|
|
30
31
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
&::after {
|
|
33
|
+
content: "";
|
|
34
|
+
min-width: calc($default-spacing / 2);
|
|
34
35
|
}
|
|
35
36
|
|
|
36
37
|
@include mixins.media($from: $sm-md) {
|
|
@@ -40,6 +41,10 @@ $default-spacing: var(--gap, 1em);
|
|
|
40
41
|
scroll-snap-type: none;
|
|
41
42
|
scrollbar-width: unset;
|
|
42
43
|
|
|
44
|
+
&::after {
|
|
45
|
+
display: none;
|
|
46
|
+
}
|
|
47
|
+
|
|
43
48
|
>* {
|
|
44
49
|
min-width: unset;
|
|
45
50
|
|
|
@@ -36,6 +36,9 @@ const Button = _ref => {
|
|
|
36
36
|
(0, React.useInsertionEffect)(() => {
|
|
37
37
|
Promise.resolve().then(() => _interopRequireWildcard(require("./styles.scss")));
|
|
38
38
|
}, []);
|
|
39
|
+
const buttonText = isSimple ? /*#__PURE__*/React.createElement("span", {
|
|
40
|
+
className: _exports.default.modifierUnderlined
|
|
41
|
+
}, children) : children;
|
|
39
42
|
return /*#__PURE__*/React.createElement("button", _extends({
|
|
40
43
|
id: id,
|
|
41
44
|
className: [baseClassName, componentClassName, userClassName, `x-${color}`, isGhost && _exports.default.modifierGhost, isCompact && _exports.default.modifierCompact, isSimple && _exports.default.modifierSimple, isGradient && _exports.default.modifierGradient, isSpaced && _exports.default.modifierSpaced, arrowDirection && `arrow-${arrowDirection}`].filter(e => e).join(' '),
|
|
@@ -46,7 +49,7 @@ const Button = _ref => {
|
|
|
46
49
|
'--x': 'var(--on-x)'
|
|
47
50
|
},
|
|
48
51
|
heightWidth: "1.15em"
|
|
49
|
-
}) :
|
|
52
|
+
}) : buttonText);
|
|
50
53
|
};
|
|
51
54
|
Button.propTypes = {
|
|
52
55
|
/**
|
|
@@ -20,7 +20,8 @@ $default-animation-time: .31s;
|
|
|
20
20
|
font-weight: 400;
|
|
21
21
|
justify-content: space-between;
|
|
22
22
|
padding: $default-padding;
|
|
23
|
-
transition: all .25s
|
|
23
|
+
transition: all .25s;
|
|
24
|
+
white-space: nowrap;//var(--theme-default-paragraph);
|
|
24
25
|
|
|
25
26
|
&.arrow-right {
|
|
26
27
|
&::after {
|
|
@@ -57,7 +58,10 @@ $default-animation-time: .31s;
|
|
|
57
58
|
&:not(:disabled) {
|
|
58
59
|
cursor: pointer;
|
|
59
60
|
|
|
60
|
-
&:hover
|
|
61
|
+
&:hover
|
|
62
|
+
:not(.#{bem.$modifier-gradient})
|
|
63
|
+
:not(.#{bem.$modifier-ghost})
|
|
64
|
+
:not(.#{bem.$modifier-simple}) {
|
|
61
65
|
background: var(--soft-x, var(--soft-#{$default-color}));
|
|
62
66
|
}
|
|
63
67
|
|
|
@@ -67,8 +71,18 @@ $default-animation-time: .31s;
|
|
|
67
71
|
}
|
|
68
72
|
|
|
69
73
|
&.#{bem.$modifier-gradient} {
|
|
70
|
-
background: linear-gradient(
|
|
71
|
-
|
|
74
|
+
background-image: linear-gradient(
|
|
75
|
+
to right,
|
|
76
|
+
var(--hard-x) 30%,
|
|
77
|
+
var(--x) 50%,
|
|
78
|
+
var(--hard-x) 100%
|
|
79
|
+
);
|
|
80
|
+
background-position: left;
|
|
81
|
+
background-size: 200% auto;
|
|
82
|
+
|
|
83
|
+
&:not(:disabled):hover {
|
|
84
|
+
background-position: right center;
|
|
85
|
+
}
|
|
72
86
|
}
|
|
73
87
|
|
|
74
88
|
&.#{bem.$modifier-compact} {
|
|
@@ -115,6 +129,10 @@ $default-animation-time: .31s;
|
|
|
115
129
|
color: var(--x, var(--#{$default-color}));
|
|
116
130
|
padding: 0;
|
|
117
131
|
|
|
132
|
+
> .#{bem.$modifier-underlined} {
|
|
133
|
+
text-decoration: underline;
|
|
134
|
+
}
|
|
135
|
+
|
|
118
136
|
&:disabled,
|
|
119
137
|
&:hover,
|
|
120
138
|
&:focus {
|
|
@@ -24,8 +24,7 @@ const ThemeSelector = _ref => {
|
|
|
24
24
|
id,
|
|
25
25
|
className: userClassName,
|
|
26
26
|
style,
|
|
27
|
-
themes
|
|
28
|
-
iconMap
|
|
27
|
+
themes
|
|
29
28
|
} = _ref;
|
|
30
29
|
const {
|
|
31
30
|
userTheme,
|
|
@@ -38,15 +37,18 @@ const ThemeSelector = _ref => {
|
|
|
38
37
|
const current = themes.indexOf(userTheme);
|
|
39
38
|
setPreferredTheme(themes[(current + 1) % themes.length]);
|
|
40
39
|
}, [userTheme]);
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
40
|
+
const themeText = userTheme && userTheme.charAt(0).toUpperCase() + userTheme.slice(1);
|
|
41
|
+
return (
|
|
42
|
+
/*#__PURE__*/
|
|
43
|
+
// eslint-disable-next-line jsx-a11y/anchor-is-valid, jsx-a11y/no-static-element-interactions
|
|
44
|
+
React.createElement("a", {
|
|
45
|
+
className: [baseClassName, componentClassName, userClassName].filter(e => e).join(' '),
|
|
46
|
+
id: id,
|
|
47
|
+
style: style,
|
|
48
|
+
onClick: loopThemes,
|
|
49
|
+
onKeyDown: loopThemes
|
|
50
|
+
}, themeText)
|
|
51
|
+
);
|
|
50
52
|
};
|
|
51
53
|
ThemeSelector.propTypes = {
|
|
52
54
|
/**
|
|
@@ -64,19 +66,10 @@ ThemeSelector.propTypes = {
|
|
|
64
66
|
/**
|
|
65
67
|
* The themes and the order in which they appear
|
|
66
68
|
*/
|
|
67
|
-
themes: _propTypes.default.arrayOf(_propTypes.default.string)
|
|
68
|
-
/**
|
|
69
|
-
* A map of the theme names with the icons that represent them. Uses the default font icon.
|
|
70
|
-
*/
|
|
71
|
-
iconMap: _propTypes.default.objectOf(_propTypes.default.string)
|
|
69
|
+
themes: _propTypes.default.arrayOf(_propTypes.default.string)
|
|
72
70
|
};
|
|
73
71
|
ThemeSelector.defaultProps = {
|
|
74
|
-
themes: ['light', 'dark']
|
|
75
|
-
iconMap: {
|
|
76
|
-
dark: 'd',
|
|
77
|
-
// sun,
|
|
78
|
-
light: 'T' // moon,
|
|
79
|
-
}
|
|
72
|
+
themes: ['light', 'dark']
|
|
80
73
|
};
|
|
81
74
|
var _default = ThemeSelector;
|
|
82
75
|
exports.default = _default;
|
|
@@ -2,14 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
@use "@pareto-engineering/bem";
|
|
4
4
|
|
|
5
|
-
$default-color:var(--x, var(--contrast));
|
|
6
|
-
|
|
7
5
|
.#{bem.$base}.theme-selector {
|
|
8
|
-
align-items: center;
|
|
9
|
-
background: transparent;
|
|
10
|
-
border: none;
|
|
11
|
-
color: $default-color;
|
|
12
6
|
cursor: pointer;
|
|
13
|
-
display:
|
|
14
|
-
|
|
7
|
+
display: block;
|
|
8
|
+
text-decoration: none;
|
|
15
9
|
}
|
|
@@ -17,7 +17,8 @@ const ContentTree = ({
|
|
|
17
17
|
className: userClassName,
|
|
18
18
|
style,
|
|
19
19
|
target,
|
|
20
|
-
selectors
|
|
20
|
+
selectors,
|
|
21
|
+
color
|
|
21
22
|
// ...otherProps
|
|
22
23
|
}) => {
|
|
23
24
|
useInsertionEffect(() => {
|
|
@@ -30,6 +31,7 @@ const ContentTree = ({
|
|
|
30
31
|
style: style
|
|
31
32
|
// {...otherProps}
|
|
32
33
|
}, /*#__PURE__*/React.createElement(Tree, {
|
|
34
|
+
color: color,
|
|
33
35
|
tree: contentTree
|
|
34
36
|
}));
|
|
35
37
|
};
|
|
@@ -55,7 +57,11 @@ ContentTree.propTypes = {
|
|
|
55
57
|
*/
|
|
56
58
|
target: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({
|
|
57
59
|
current: PropTypes.node
|
|
58
|
-
})])
|
|
60
|
+
})]),
|
|
61
|
+
/**
|
|
62
|
+
* The color for the tree.
|
|
63
|
+
*/
|
|
64
|
+
color: PropTypes.string
|
|
59
65
|
};
|
|
60
66
|
ContentTree.defaultProps = {
|
|
61
67
|
selectors: ['h2', 'h3']
|
|
@@ -3,6 +3,7 @@ import * as React from 'react';
|
|
|
3
3
|
import { useState, useEffect, useMemo } from 'react';
|
|
4
4
|
import PropTypes from 'prop-types';
|
|
5
5
|
import styleNames from '@pareto-engineering/bem/exports';
|
|
6
|
+
import { Card } from "../../../..";
|
|
6
7
|
|
|
7
8
|
// Local Definitions
|
|
8
9
|
|
|
@@ -18,7 +19,8 @@ const Tree = ({
|
|
|
18
19
|
className: userClassName,
|
|
19
20
|
style,
|
|
20
21
|
tree,
|
|
21
|
-
displayDepth
|
|
22
|
+
displayDepth,
|
|
23
|
+
color
|
|
22
24
|
// ...otherProps
|
|
23
25
|
}) => {
|
|
24
26
|
// The nodeIds to be used to get the first visible node
|
|
@@ -53,11 +55,11 @@ const Tree = ({
|
|
|
53
55
|
}, node.text)), node.children.length > 0 && /*#__PURE__*/React.createElement("ul", null, node.children.map(child => getNestedTree(child, depth - 1))));
|
|
54
56
|
};
|
|
55
57
|
const ContentTree = useMemo(() => tree.map(node => getNestedTree(node, displayDepth)), [tree]);
|
|
56
|
-
return /*#__PURE__*/React.createElement(
|
|
58
|
+
return ContentTree.length ? /*#__PURE__*/React.createElement(Card, {
|
|
57
59
|
id: id,
|
|
58
|
-
className: [baseClassName, componentClassName, userClassName].filter(e => e).join(' '),
|
|
60
|
+
className: [baseClassName, componentClassName, userClassName, color && `x-${color}`].filter(e => e).join(' '),
|
|
59
61
|
style: style
|
|
60
|
-
}, ContentTree);
|
|
62
|
+
}, /*#__PURE__*/React.createElement(Card.Section, null, /*#__PURE__*/React.createElement("ul", null, ContentTree))) : null;
|
|
61
63
|
};
|
|
62
64
|
Tree.propTypes = {
|
|
63
65
|
/**
|
|
@@ -86,9 +88,14 @@ Tree.propTypes = {
|
|
|
86
88
|
/**
|
|
87
89
|
* The levels of the tree to display.
|
|
88
90
|
*/
|
|
89
|
-
displayDepth: PropTypes.number
|
|
91
|
+
displayDepth: PropTypes.number,
|
|
92
|
+
/**
|
|
93
|
+
* The color of the tree.
|
|
94
|
+
*/
|
|
95
|
+
color: PropTypes.string
|
|
90
96
|
};
|
|
91
97
|
Tree.defaultProps = {
|
|
98
|
+
color: 'interactive',
|
|
92
99
|
displayDepth: 4
|
|
93
100
|
};
|
|
94
101
|
export default Tree;
|
|
@@ -3,26 +3,38 @@
|
|
|
3
3
|
|
|
4
4
|
@use "@pareto-engineering/bem";
|
|
5
5
|
|
|
6
|
+
$default-dot-size: .5em;
|
|
6
7
|
$default-margin: 1em;
|
|
7
8
|
$default-padding: 1em;
|
|
8
9
|
|
|
9
10
|
.#{bem.$base}.content-tree {
|
|
10
|
-
|
|
11
|
-
list-style: none;
|
|
12
|
-
|
|
13
|
-
> li > p > a {
|
|
14
|
-
color: var(--paragraph);
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
.#{bem.$base}.tree {
|
|
19
|
-
padding: 0;
|
|
11
|
+
> .#{bem.$base}.tree {
|
|
20
12
|
position: sticky;
|
|
21
13
|
top: 0;
|
|
22
14
|
|
|
15
|
+
ul {
|
|
16
|
+
list-style: none;
|
|
17
|
+
padding: 0 $default-padding;
|
|
18
|
+
|
|
19
|
+
> li > p > a {
|
|
20
|
+
color: var(--paragraph);
|
|
21
|
+
text-decoration: none;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
23
25
|
.#{bem.$modifier-active} {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
+
font-weight: 700;
|
|
27
|
+
|
|
28
|
+
&::before {
|
|
29
|
+
background: var(--x);
|
|
30
|
+
border-radius: 50%;
|
|
31
|
+
content: "";
|
|
32
|
+
display: inline-block;
|
|
33
|
+
height: $default-dot-size;
|
|
34
|
+
margin-right: $default-margin;
|
|
35
|
+
text-align: center;
|
|
36
|
+
width: $default-dot-size;
|
|
37
|
+
}
|
|
26
38
|
}
|
|
27
39
|
|
|
28
40
|
li:not(:last-child) {
|
|
@@ -34,5 +46,3 @@ $default-padding: 1em;
|
|
|
34
46
|
}
|
|
35
47
|
}
|
|
36
48
|
}
|
|
37
|
-
|
|
38
|
-
|
|
@@ -37,7 +37,7 @@ const Conversation = ({
|
|
|
37
37
|
id: id,
|
|
38
38
|
className: [baseClassName, componentClassName, userClassName, `y-${backgroundColor}`].filter(e => e).join(' '),
|
|
39
39
|
style: style
|
|
40
|
-
}, children));
|
|
40
|
+
}, /*#__PURE__*/React.createElement(Card.Section, null, children)));
|
|
41
41
|
};
|
|
42
42
|
Conversation.propTypes = {
|
|
43
43
|
/**
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import PropTypes from 'prop-types';
|
|
4
4
|
import styleNames from '@pareto-engineering/bem/exports';
|
|
5
|
-
import { Card } from "../../../..";
|
|
6
5
|
|
|
7
6
|
// Local Definitions
|
|
8
7
|
|
|
@@ -29,9 +28,9 @@ const Message = ({
|
|
|
29
28
|
ourColor,
|
|
30
29
|
theirColor
|
|
31
30
|
} = useConversation();
|
|
32
|
-
return /*#__PURE__*/React.createElement(
|
|
31
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
33
32
|
id: id,
|
|
34
|
-
className: [baseClassName, componentClassName, userClassName, `x-${from === 'ours' ? ourColor : theirColor}`, from
|
|
33
|
+
className: [baseClassName, componentClassName, userClassName, `x-${from === 'ours' ? ourColor : theirColor}`, from].filter(e => e).join(' '),
|
|
35
34
|
style: style
|
|
36
35
|
}, sender && /*#__PURE__*/React.createElement("p", {
|
|
37
36
|
className: "sender"
|