@nurvus/ui 0.1.0-alpha.1 → 0.1.0-alpha.3

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.
@@ -0,0 +1,89 @@
1
+ @import "../../styles/variables.scss";
2
+ @import "../../styles/tokens.scss";
3
+
4
+ // Token-only, so it follows the light/dark theme. The current step uses the
5
+ // same accent rail + wash language as Menu's active row.
6
+ .#{$cls-prefix}.history-list {
7
+ list-style: none;
8
+ margin: 0;
9
+ padding: $--space--8;
10
+ min-width: 0;
11
+
12
+ .history-list-item {
13
+ display: flex;
14
+ align-items: center;
15
+ gap: $--space--8;
16
+ width: 100%;
17
+ margin: 0 0 $--space--4;
18
+ padding: $--space--4 $--space--8;
19
+ font: inherit;
20
+ text-align: left;
21
+ color: $--base--1100;
22
+ background: transparent;
23
+ border: 1px solid transparent;
24
+ border-radius: $--radius--4;
25
+ cursor: pointer;
26
+
27
+ &:hover {
28
+ background: $--primary-opacity--8;
29
+ }
30
+
31
+ &:focus-visible {
32
+ outline: 2px solid $--primary--500;
33
+ outline-offset: 1px;
34
+ }
35
+
36
+ // Where you are now.
37
+ &[data-current="true"] {
38
+ border-color: $--primary--500;
39
+ background: $--primary-opacity--16;
40
+ color: $--base--1200;
41
+ cursor: default;
42
+ }
43
+
44
+ // Undone steps: still listed (one click redoes to them), but faded.
45
+ &[data-future="true"] {
46
+ opacity: 0.45;
47
+
48
+ &:hover {
49
+ opacity: 0.75;
50
+ }
51
+ }
52
+ }
53
+
54
+ .history-list-index {
55
+ flex: 0 0 auto;
56
+ min-width: $--space--24;
57
+ padding: 1px $--space--4;
58
+ text-align: center;
59
+ font-size: 11px;
60
+ color: $--base--700;
61
+ border: 1px solid $--base--300;
62
+ border-radius: $--radius--4;
63
+ }
64
+
65
+ .history-list-text {
66
+ display: flex;
67
+ flex-direction: column;
68
+ min-width: 0;
69
+ flex: 1 1 auto;
70
+ }
71
+
72
+ .history-list-label,
73
+ .history-list-detail {
74
+ overflow: hidden;
75
+ text-overflow: ellipsis;
76
+ white-space: nowrap;
77
+ }
78
+
79
+ .history-list-detail,
80
+ .history-list-time {
81
+ color: $--base--700;
82
+ font-size: 11px;
83
+ }
84
+
85
+ .history-list-time {
86
+ flex: 0 0 auto;
87
+ font-variant-numeric: tabular-nums;
88
+ }
89
+ }
@@ -31,7 +31,9 @@ class Menu extends React.Component {
31
31
  const isActive = this.isActiveItem(activePath, i);
32
32
  const [ first, ...remainingPath ] = activePath;
33
33
  const nextPath = [...path, i];
34
- const indent = (20 * path.length) + 10;
34
+ // Clamped so a deep tree cannot indent the label out of a narrow panel.
35
+ // The px maths lives in Menu.scss against spacing tokens; JS only supplies depth.
36
+ const depth = Math.min(path.length, this.props.maxIndentDepth);
35
37
 
36
38
  let itemChildren;
37
39
  if (itemRenderer) {
@@ -48,7 +50,7 @@ class Menu extends React.Component {
48
50
  data-type={ type }
49
51
  onClick={ e => this.handleClick(e, nextPath) }
50
52
  style={ {
51
- paddingLeft: indent,
53
+ '--nurvus-menu-depth': String(depth),
52
54
  ...style
53
55
  } }
54
56
  >
@@ -66,7 +68,7 @@ class Menu extends React.Component {
66
68
 
67
69
 
68
70
  render() {
69
- const { activePath, className, children, itemRenderer, items, ...props } = this.props;
71
+ const { activePath, className, children, itemRenderer, items, maxIndentDepth, ...props } = this.props;
70
72
 
71
73
  return (
72
74
  <div
@@ -103,7 +105,16 @@ Menu.propTypes = {
103
105
  * @param {object} event - object
104
106
  * @param {array} activePath - of clicked menu item.
105
107
  */
106
- onClick: PropTypes.func
108
+ onClick: PropTypes.func,
109
+ /**
110
+ * Maximum nesting depth that still adds indentation. Deeper rows render at the
111
+ * max indent so the label keeps its room in a narrow panel.
112
+ */
113
+ maxIndentDepth: PropTypes.number
114
+ };
115
+
116
+ Menu.defaultProps = {
117
+ maxIndentDepth: 6
107
118
  };
108
119
 
109
120
  export default Menu;
@@ -1,36 +1,69 @@
1
1
  @import "../../styles/variables.scss";
2
+ @import "../../styles/tokens.scss";
2
3
 
3
4
  .#{$cls-prefix}.menu {
4
- background: #403960;
5
+ // ---------------------------------------------------------------------------
6
+ // Indentation is token-driven, not a magic number in JS.
7
+ // Rows are FLAT siblings in the DOM (see Menu.jsx) — nesting is purely visual,
8
+ // produced by padding-left. Menu.jsx stamps `--nurvus-menu-depth` per row and
9
+ // clamps it with the `maxIndentDepth` prop, so a deep tree can never indent
10
+ // the label out of a narrow panel.
11
+ // Consumers retune the whole tree by overriding these two on .nurvus.menu.
12
+ // ---------------------------------------------------------------------------
13
+ --nurvus-menu-indent-base: #{$--space--8};
14
+ --nurvus-menu-indent-step: #{$--space--12};
15
+
16
+ background: $--base--50;
17
+ color: $--base--1100;
18
+ padding: $--space--4;
19
+
20
+ // Allow the menu to shrink inside a flex/grid parent instead of forcing its
21
+ // intrinsic width and pushing the row content out.
22
+ min-width: 0;
5
23
 
6
24
  .menu-item {
7
25
  position: relative;
8
- padding: 10px;
9
- color: #e6e6e6;
26
+ min-width: 0; // ...and let row content ellipsis rather than collapse to 0
27
+ padding: $--space--8 $--space--12;
28
+ padding-left: calc(
29
+ var(--nurvus-menu-indent-base) +
30
+ var(--nurvus-menu-depth, 0) * var(--nurvus-menu-indent-step)
31
+ );
32
+ border-radius: $--radius--4;
33
+ color: $--base--1100;
10
34
  cursor: pointer;
11
35
 
12
- // Hover / Pressed
13
- &:hover,
14
- &[data-active="true"] {
15
- color: white;
36
+ &:hover {
37
+ background: $--base--200;
38
+ color: $--base--1200;
16
39
  }
17
40
 
41
+ // Active row: 2px accent rail + a neon wash. Both sides of the wash are
42
+ // primary-opacity tokens, which are identical in light and dark — the neon
43
+ // is the one constant across themes.
18
44
  &[data-active="true"] {
45
+ background: $--primary-opacity--8;
46
+ color: $--base--1200;
47
+
19
48
  &::before {
20
49
  content: '';
21
- height: 100%;
22
- width: 2px;
23
50
  position: absolute;
24
51
  left: 0;
25
52
  top: 0;
26
- background: #48c3f4;
53
+ height: 100%;
54
+ width: $--space--2;
55
+ border-radius: $--radius--2;
56
+ background: $--primary--500;
57
+ }
58
+
59
+ &:hover {
60
+ background: $--primary-opacity--16;
27
61
  }
28
- // border-left: 2px solid #48c3f4;
29
- background: linear-gradient(90deg, rgba(72,195,244, 0.5) 0%, rgba(64,57,96,1) 100%);
30
62
  }
31
63
 
32
- > [data-type="group"] {
33
- margin-left: 20px;
64
+ // Nested groups read one step quieter than leaf rows.
65
+ &[data-type="group"] {
66
+ color: $--base--700;
34
67
  }
35
68
  }
36
- }
69
+ }
@@ -29,7 +29,7 @@
29
29
  }
30
30
 
31
31
  tr {
32
- background-color: $--pure--white;
32
+ background-color: $--base--50;
33
33
  color: $--base--1200;
34
34
  }
35
35
 
@@ -8,7 +8,9 @@
8
8
 
9
9
  // TYPE
10
10
  &[data-type="primary"] {
11
- color: $--pure--black;
11
+ // Ink token (near-black in light, near-white in dark) so Title follows the
12
+ // theme instead of being frozen pure-black.
13
+ color: $--base--1200;
12
14
  }
13
15
 
14
16
  &[data-type="secondary"] {
package/src/index.js CHANGED
@@ -6,6 +6,7 @@ export { default as Progress } from './components/Progress/Progress.jsx';
6
6
  export { default as Layout } from './components/Layout/Layout.jsx';
7
7
  export { default as Menu } from './components/Menu/Menu.jsx';
8
8
  export { default as FullPageModal } from './components/FullPageModal/FullPageModal.jsx';
9
+ export { default as HistoryList } from './components/HistoryList/HistoryList.jsx';
9
10
  export { default as Table } from './components/Table/Table.jsx';
10
11
  export { default as Text } from './components/Text/Text.jsx';
11
12
  export { default as Title } from './components/Title/Title.jsx';