@pareto-engineering/design-system 4.0.0-alpha.20 → 4.0.0-alpha.22

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.
@@ -28,6 +28,16 @@ var _default = function _default(initialTheme) {
28
28
  setUserTheme('light');
29
29
  }
30
30
  }, [preferredTheme, isClient]);
31
+ (0, _react.useEffect)(() => {
32
+ const fav_theme = userTheme === 'dark' ? 'favicon-dark' : 'favicon-light';
33
+ let link = document.querySelector("link[rel~='icon']");
34
+ if (!link) {
35
+ link = document.createElement('link');
36
+ link.rel = 'icon';
37
+ document.getElementsByTagName('head')[0].appendChild(link);
38
+ }
39
+ link.href = `/${fav_theme}.svg`;
40
+ }, [userTheme]);
31
41
  const isTheme = (0, _react.useCallback)(theme => userTheme === theme || undefined, [userTheme]);
32
42
  return {
33
43
  userTheme,
@@ -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("ul", {
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,46 @@
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
- ul {
11
- list-style: none;
11
+ > .#{bem.$base}.tree {
12
+ position: sticky;
13
+ top: var(--spacing-2);
12
14
 
13
- > li > p > a {
14
- color: var(--paragraph);
15
- }
16
- }
15
+ ul {
16
+ list-style: none;
17
+ padding: 0;
17
18
 
18
- .#{bem.$base}.tree {
19
- padding: 0;
20
- position: sticky;
21
- top: 0;
19
+ &:first-child > li > p {
20
+ margin-top: 0;
21
+ }
22
+
23
+ &:last-child > li > p {
24
+ margin-bottom: 0;
25
+ }
26
+
27
+ > li > p > a {
28
+ color: var(--paragraph);
29
+ text-decoration: none;
30
+ }
31
+ }
22
32
 
23
33
  .#{bem.$modifier-active} {
24
- color: var(--highlighted);
25
- transition: color .2s;
34
+ font-weight: 700;
35
+
36
+ &::before {
37
+ background: var(--x);
38
+ border-radius: 50%;
39
+ content: "";
40
+ display: inline-block;
41
+ height: $default-dot-size;
42
+ margin-right: $default-margin;
43
+ text-align: center;
44
+ width: $default-dot-size;
45
+ }
26
46
  }
27
47
 
28
48
  li:not(:last-child) {
@@ -34,5 +54,3 @@ $default-padding: 1em;
34
54
  }
35
55
  }
36
56
  }
37
-
38
-
@@ -8,7 +8,6 @@
8
8
  $default-border-radius: var(--theme-default-border-radius);
9
9
  $default-padding: var(--gap);
10
10
  $default-message-max-width: calc(100% - 4 * #{$default-padding});
11
- $default-message-min-width: 12em;
12
11
  $default-message-border: 1px solid var(--hard-background-cards);
13
12
 
14
13
  .#{bem.$base}.conversation {
@@ -30,7 +29,6 @@ $default-message-border: 1px solid var(--hard-background-cards);
30
29
  > .#{bem.$base}.message {
31
30
  align-self: flex-start;
32
31
  max-width: $default-message-max-width;
33
- min-width: $default-message-min-width;
34
32
  position: relative;
35
33
 
36
34
  > .sender {
@@ -59,9 +59,9 @@ $default-animation-time: .31s;
59
59
  cursor: pointer;
60
60
 
61
61
  &:hover
62
- :not(.#{bem.$modifier-gradient})
63
- :not(.#{bem.$modifier-ghost})
64
- :not(.#{bem.$modifier-simple}) {
62
+ :not(.#{bem.$modifier-gradient})
63
+ :not(.#{bem.$modifier-ghost})
64
+ :not(.#{bem.$modifier-simple}) {
65
65
  background: var(--soft-x, var(--soft-#{$default-color}));
66
66
  }
67
67
 
@@ -4,7 +4,7 @@
4
4
  @use "../../../form.scss";
5
5
 
6
6
  $default-padding: .75em .75em .55em;
7
- $default-symbol-left: 3em;
7
+ $default-symbol-left: 1em;
8
8
  $default-padding-with-symbol:
9
9
  .75em
10
10
  calc($default-symbol-left - 1em)
@@ -21,6 +21,16 @@ export default ((initialTheme, storageKey = 'theme') => {
21
21
  setUserTheme('light');
22
22
  }
23
23
  }, [preferredTheme, isClient]);
24
+ useEffect(() => {
25
+ const fav_theme = userTheme === 'dark' ? 'favicon-dark' : 'favicon-light';
26
+ let link = document.querySelector("link[rel~='icon']");
27
+ if (!link) {
28
+ link = document.createElement('link');
29
+ link.rel = 'icon';
30
+ document.getElementsByTagName('head')[0].appendChild(link);
31
+ }
32
+ link.href = `/${fav_theme}.svg`;
33
+ }, [userTheme]);
24
34
  const isTheme = useCallback(theme => userTheme === theme || undefined, [userTheme]);
25
35
  return {
26
36
  userTheme,
@@ -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("ul", {
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,46 @@
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
- ul {
11
- list-style: none;
11
+ > .#{bem.$base}.tree {
12
+ position: sticky;
13
+ top: var(--spacing-2);
12
14
 
13
- > li > p > a {
14
- color: var(--paragraph);
15
- }
16
- }
15
+ ul {
16
+ list-style: none;
17
+ padding: 0;
17
18
 
18
- .#{bem.$base}.tree {
19
- padding: 0;
20
- position: sticky;
21
- top: 0;
19
+ &:first-child > li > p {
20
+ margin-top: 0;
21
+ }
22
+
23
+ &:last-child > li > p {
24
+ margin-bottom: 0;
25
+ }
26
+
27
+ > li > p > a {
28
+ color: var(--paragraph);
29
+ text-decoration: none;
30
+ }
31
+ }
22
32
 
23
33
  .#{bem.$modifier-active} {
24
- color: var(--highlighted);
25
- transition: color .2s;
34
+ font-weight: 700;
35
+
36
+ &::before {
37
+ background: var(--x);
38
+ border-radius: 50%;
39
+ content: "";
40
+ display: inline-block;
41
+ height: $default-dot-size;
42
+ margin-right: $default-margin;
43
+ text-align: center;
44
+ width: $default-dot-size;
45
+ }
26
46
  }
27
47
 
28
48
  li:not(:last-child) {
@@ -34,5 +54,3 @@ $default-padding: 1em;
34
54
  }
35
55
  }
36
56
  }
37
-
38
-
@@ -8,7 +8,6 @@
8
8
  $default-border-radius: var(--theme-default-border-radius);
9
9
  $default-padding: var(--gap);
10
10
  $default-message-max-width: calc(100% - 4 * #{$default-padding});
11
- $default-message-min-width: 12em;
12
11
  $default-message-border: 1px solid var(--hard-background-cards);
13
12
 
14
13
  .#{bem.$base}.conversation {
@@ -30,7 +29,6 @@ $default-message-border: 1px solid var(--hard-background-cards);
30
29
  > .#{bem.$base}.message {
31
30
  align-self: flex-start;
32
31
  max-width: $default-message-max-width;
33
- min-width: $default-message-min-width;
34
32
  position: relative;
35
33
 
36
34
  > .sender {
@@ -59,9 +59,9 @@ $default-animation-time: .31s;
59
59
  cursor: pointer;
60
60
 
61
61
  &:hover
62
- :not(.#{bem.$modifier-gradient})
63
- :not(.#{bem.$modifier-ghost})
64
- :not(.#{bem.$modifier-simple}) {
62
+ :not(.#{bem.$modifier-gradient})
63
+ :not(.#{bem.$modifier-ghost})
64
+ :not(.#{bem.$modifier-simple}) {
65
65
  background: var(--soft-x, var(--soft-#{$default-color}));
66
66
  }
67
67
 
@@ -4,7 +4,7 @@
4
4
  @use "../../../form.scss";
5
5
 
6
6
  $default-padding: .75em .75em .55em;
7
- $default-symbol-left: 3em;
7
+ $default-symbol-left: 1em;
8
8
  $default-padding-with-symbol:
9
9
  .75em
10
10
  calc($default-symbol-left - 1em)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pareto-engineering/design-system",
3
- "version": "4.0.0-alpha.20",
3
+ "version": "4.0.0-alpha.22",
4
4
  "description": "",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/es/index.js",
@@ -50,9 +50,9 @@
50
50
  "style-loader": "^3.3.2"
51
51
  },
52
52
  "dependencies": {
53
- "@pareto-engineering/assets": "^4.0.0-alpha.11",
53
+ "@pareto-engineering/assets": "^4.0.0-alpha.22",
54
54
  "@pareto-engineering/bem": "^4.0.0-alpha.20",
55
- "@pareto-engineering/styles": "^4.0.0-alpha.20",
55
+ "@pareto-engineering/styles": "^4.0.0-alpha.22",
56
56
  "date-fns": "^2.29.3",
57
57
  "downshift": "^6.1.12",
58
58
  "formik": "^2.2.9",
@@ -67,5 +67,5 @@
67
67
  "relay-test-utils": "^15.0.0"
68
68
  },
69
69
  "browserslist": "> 2%",
70
- "gitHead": "fffe052db834d7127d1270b562f935789ae17a3a"
70
+ "gitHead": "3701cf2d7e297e33391876a0323bd055f7106ceb"
71
71
  }
@@ -32,6 +32,17 @@ export default (
32
32
  }
33
33
  }, [preferredTheme, isClient])
34
34
 
35
+ useEffect(() => {
36
+ const fav_theme = userTheme === 'dark' ? 'favicon-dark' : 'favicon-light'
37
+ let link = document.querySelector("link[rel~='icon']")
38
+ if (!link) {
39
+ link = document.createElement('link')
40
+ link.rel = 'icon'
41
+ document.getElementsByTagName('head')[0].appendChild(link)
42
+ }
43
+ link.href = `/${fav_theme}.svg`
44
+ }, [userTheme])
45
+
35
46
  const isTheme = useCallback((theme) => (userTheme === theme) || undefined, [userTheme])
36
47
 
37
48
  return {
@@ -23,6 +23,7 @@ const ContentTree = ({
23
23
  style,
24
24
  target,
25
25
  selectors,
26
+ color,
26
27
  // ...otherProps
27
28
  }) => {
28
29
  useInsertionEffect(() => {
@@ -35,9 +36,7 @@ const ContentTree = ({
35
36
  <div
36
37
  id={id}
37
38
  className={[
38
-
39
39
  baseClassName,
40
-
41
40
  componentClassName,
42
41
  userClassName,
43
42
  ]
@@ -46,7 +45,7 @@ const ContentTree = ({
46
45
  style={style}
47
46
  // {...otherProps}
48
47
  >
49
- <Tree tree={contentTree} />
48
+ <Tree color={color} tree={contentTree} />
50
49
  </div>
51
50
  )
52
51
  }
@@ -79,6 +78,11 @@ ContentTree.propTypes = {
79
78
  PropTypes.func,
80
79
  PropTypes.shape({ current: PropTypes.node }),
81
80
  ]),
81
+
82
+ /**
83
+ * The color for the tree.
84
+ */
85
+ color:PropTypes.string,
82
86
  }
83
87
 
84
88
  ContentTree.defaultProps = {
@@ -7,6 +7,8 @@ import PropTypes from 'prop-types'
7
7
 
8
8
  import styleNames from '@pareto-engineering/bem/exports'
9
9
 
10
+ import { Card } from 'ui'
11
+
10
12
  // Local Definitions
11
13
 
12
14
  import useFirstVisibleNode from '../useFirstVisibleNode'
@@ -24,6 +26,7 @@ const Tree = ({
24
26
  style,
25
27
  tree,
26
28
  displayDepth,
29
+ color,
27
30
  // ...otherProps
28
31
  }) => {
29
32
  // The nodeIds to be used to get the first visible node
@@ -80,23 +83,26 @@ const Tree = ({
80
83
  [tree],
81
84
  )
82
85
 
83
- return (
84
- <ul
86
+ return ContentTree.length ? (
87
+ <Card
85
88
  id={id}
86
89
  className={[
87
-
88
90
  baseClassName,
89
-
90
91
  componentClassName,
91
92
  userClassName,
93
+ color && `x-${color}`,
92
94
  ]
93
95
  .filter((e) => e)
94
96
  .join(' ')}
95
97
  style={style}
96
98
  >
97
- {ContentTree}
98
- </ul>
99
- )
99
+ <Card.Section>
100
+ <ul>
101
+ {ContentTree}
102
+ </ul>
103
+ </Card.Section>
104
+ </Card>
105
+ ) : null
100
106
  }
101
107
  Tree.propTypes = {
102
108
  /**
@@ -129,9 +135,15 @@ Tree.propTypes = {
129
135
  * The levels of the tree to display.
130
136
  */
131
137
  displayDepth:PropTypes.number,
138
+
139
+ /**
140
+ * The color of the tree.
141
+ */
142
+ color:PropTypes.string,
132
143
  }
133
144
 
134
145
  Tree.defaultProps = {
146
+ color :'interactive',
135
147
  displayDepth:4,
136
148
  }
137
149
 
@@ -3,26 +3,46 @@
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
- ul {
11
- list-style: none;
11
+ > .#{bem.$base}.tree {
12
+ position: sticky;
13
+ top: var(--spacing-2);
12
14
 
13
- > li > p > a {
14
- color: var(--paragraph);
15
- }
16
- }
15
+ ul {
16
+ list-style: none;
17
+ padding: 0;
17
18
 
18
- .#{bem.$base}.tree {
19
- padding: 0;
20
- position: sticky;
21
- top: 0;
19
+ &:first-child > li > p {
20
+ margin-top: 0;
21
+ }
22
+
23
+ &:last-child > li > p {
24
+ margin-bottom: 0;
25
+ }
26
+
27
+ > li > p > a {
28
+ color: var(--paragraph);
29
+ text-decoration: none;
30
+ }
31
+ }
22
32
 
23
33
  .#{bem.$modifier-active} {
24
- color: var(--highlighted);
25
- transition: color .2s;
34
+ font-weight: 700;
35
+
36
+ &::before {
37
+ background: var(--x);
38
+ border-radius: 50%;
39
+ content: "";
40
+ display: inline-block;
41
+ height: $default-dot-size;
42
+ margin-right: $default-margin;
43
+ text-align: center;
44
+ width: $default-dot-size;
45
+ }
26
46
  }
27
47
 
28
48
  li:not(:last-child) {
@@ -34,5 +54,3 @@ $default-padding: 1em;
34
54
  }
35
55
  }
36
56
  }
37
-
38
-
@@ -8,7 +8,6 @@
8
8
  $default-border-radius: var(--theme-default-border-radius);
9
9
  $default-padding: var(--gap);
10
10
  $default-message-max-width: calc(100% - 4 * #{$default-padding});
11
- $default-message-min-width: 12em;
12
11
  $default-message-border: 1px solid var(--hard-background-cards);
13
12
 
14
13
  .#{bem.$base}.conversation {
@@ -30,7 +29,6 @@ $default-message-border: 1px solid var(--hard-background-cards);
30
29
  > .#{bem.$base}.message {
31
30
  align-self: flex-start;
32
31
  max-width: $default-message-max-width;
33
- min-width: $default-message-min-width;
34
32
  position: relative;
35
33
 
36
34
  > .sender {
@@ -59,9 +59,9 @@ $default-animation-time: .31s;
59
59
  cursor: pointer;
60
60
 
61
61
  &:hover
62
- :not(.#{bem.$modifier-gradient})
63
- :not(.#{bem.$modifier-ghost})
64
- :not(.#{bem.$modifier-simple}) {
62
+ :not(.#{bem.$modifier-gradient})
63
+ :not(.#{bem.$modifier-ghost})
64
+ :not(.#{bem.$modifier-simple}) {
65
65
  background: var(--soft-x, var(--soft-#{$default-color}));
66
66
  }
67
67
 
@@ -4,7 +4,7 @@
4
4
  @use "../../../form.scss";
5
5
 
6
6
  $default-padding: .75em .75em .55em;
7
- $default-symbol-left: 3em;
7
+ $default-symbol-left: 1em;
8
8
  $default-padding-with-symbol:
9
9
  .75em
10
10
  calc($default-symbol-left - 1em)
@@ -598,11 +598,7 @@ exports[`Storyshots a/ContentTree Base 1`] = `
598
598
  </main>
599
599
  <div
600
600
  className="base content-tree v5 ml-v"
601
- >
602
- <ul
603
- className="base tree"
604
- />
605
- </div>
601
+ />
606
602
  </div>
607
603
  `;
608
604