@nurvus/ui 0.1.0-alpha.1 → 0.1.0-alpha.11
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/LICENSE +1 -1
- package/README.md +26 -9
- package/dist/index.js +2 -6
- package/dist/index.js.LICENSE.txt +5 -0
- package/package.json +28 -16
- package/src/components/Button/Button.jsx +8 -10
- package/src/components/Button/Button.md +0 -4
- package/src/components/Button/Button.scss +10 -10
- package/src/components/ButtonGroup/ButtonGroup.jsx +17 -6
- package/src/components/FullPageModal/FullPageModal.jsx +9 -11
- package/src/components/HistoryList/HistoryList.jsx +120 -0
- package/src/components/HistoryList/HistoryList.md +30 -0
- package/src/components/HistoryList/HistoryList.scss +89 -0
- package/src/components/Layout/Layout.jsx +51 -13
- package/src/components/Layout/Layout.scss +12 -0
- package/src/components/Link/Link.jsx +1 -1
- package/src/components/Menu/Menu.jsx +17 -6
- package/src/components/Menu/Menu.scss +47 -15
- package/src/components/Panel/Panel.jsx +57 -0
- package/src/components/Panel/Panel.md +23 -0
- package/src/components/Panel/Panel.scss +33 -0
- package/src/components/Progress/Progress.jsx +10 -12
- package/src/components/Progress/Progress.scss +6 -6
- package/src/components/Table/Table.jsx +5 -3
- package/src/components/Table/Table.scss +23 -49
- package/src/components/Tag/Tag.jsx +41 -0
- package/src/components/Tag/Tag.md +13 -0
- package/src/components/Tag/Tag.scss +23 -0
- package/src/components/Text/Text.jsx +48 -18
- package/src/components/Text/Text.md +13 -0
- package/src/components/Text/Text.scss +22 -0
- package/src/components/Title/Title.jsx +38 -41
- package/src/components/Title/Title.scss +3 -2
- package/src/index.js +9 -0
- package/src/styles/theme.scss +497 -0
- package/src/styles/tokens.scss +244 -459
- package/src/styles/type.json +13 -0
- package/src/theme.js +64 -0
- package/src/themes/apollo-white.json +52 -0
- package/src/themes/arcane.json +52 -0
- package/src/themes/dopamine.json +52 -0
- package/src/themes/index.js +22 -0
- package/src/themes/nether-neon.json +52 -0
- package/src/themes/nether.json +52 -0
- package/src/themes/outworld.json +52 -0
- package/src/themes/roles.json +29 -0
- package/src/themes/tokyo-neon.json +52 -0
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
Give it a `title`, a `caption` footer, or both.
|
|
2
|
+
```jsx
|
|
3
|
+
import { Panel, Tag, Text } from '@nurvus/ui';
|
|
4
|
+
|
|
5
|
+
<div style={ { display: 'grid', gridTemplateColumns: 'repeat(auto-fill, minmax(240px, 1fr))', gap: 16 } }>
|
|
6
|
+
<Panel title="Deploys" caption="Updated 2 minutes ago">
|
|
7
|
+
<Text variant="display">128</Text>
|
|
8
|
+
<Text as="p" variant="caption" tone="muted">this week, up 12%</Text>
|
|
9
|
+
</Panel>
|
|
10
|
+
<Panel title="Status" caption={ <Tag tone="success">All systems normal</Tag> }>
|
|
11
|
+
<Text as="p" variant="body">Every service answered in under 200 ms.</Text>
|
|
12
|
+
</Panel>
|
|
13
|
+
</div>
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
With `padding="none"`, content runs to the edges, for an image or a table.
|
|
17
|
+
```jsx
|
|
18
|
+
import { Panel } from '@nurvus/ui';
|
|
19
|
+
|
|
20
|
+
<Panel padding="none" caption="Full-bleed content, then a caption" style={ { maxWidth: 360 } }>
|
|
21
|
+
<div style={ { height: 120, background: 'linear-gradient(135deg, var(--nv-accent-fill), var(--nv-syntax-tag))' } } />
|
|
22
|
+
</Panel>
|
|
23
|
+
```
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
@import "../../styles/variables.scss";
|
|
2
|
+
@import "../../styles/tokens.scss";
|
|
3
|
+
|
|
4
|
+
.#{$cls-prefix}.panel {
|
|
5
|
+
overflow: hidden;
|
|
6
|
+
background: var(--nv-surface);
|
|
7
|
+
color: var(--nv-text);
|
|
8
|
+
border: 1px solid var(--nv-border);
|
|
9
|
+
border-radius: $--radius--12;
|
|
10
|
+
|
|
11
|
+
.panel-body {
|
|
12
|
+
padding: $--space--16;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
&[data-padding="small"] .panel-body { padding: $--space--12; }
|
|
16
|
+
&[data-padding="none"] .panel-body { padding: 0; }
|
|
17
|
+
|
|
18
|
+
.panel-title {
|
|
19
|
+
margin: 0 0 $--space--8;
|
|
20
|
+
font-size: var(--nv-type-title-size);
|
|
21
|
+
line-height: var(--nv-type-title-line);
|
|
22
|
+
font-weight: var(--nv-type-title-weight);
|
|
23
|
+
letter-spacing: var(--nv-type-title-tracking);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.panel-caption {
|
|
27
|
+
padding: $--space--12 $--space--16;
|
|
28
|
+
border-top: 1px solid var(--nv-border);
|
|
29
|
+
color: var(--nv-text-muted);
|
|
30
|
+
font-size: var(--nv-type-caption-size);
|
|
31
|
+
line-height: var(--nv-type-caption-line);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -8,17 +8,15 @@ import './Progress.scss';
|
|
|
8
8
|
* Progress component. Use it to track progress!
|
|
9
9
|
* @returns {ReactElement} of Progress component.
|
|
10
10
|
*/
|
|
11
|
-
function Progress(
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
} = props;
|
|
18
|
-
|
|
11
|
+
function Progress({
|
|
12
|
+
className,
|
|
13
|
+
percent = 0,
|
|
14
|
+
size = 'medium',
|
|
15
|
+
status = 'active'
|
|
16
|
+
}) {
|
|
19
17
|
return (
|
|
20
18
|
<div
|
|
21
|
-
className={ classNames(
|
|
19
|
+
className={ classNames(className, 'progress', CONSTANT.CLASS_PREFIX) }
|
|
22
20
|
data-size={ size }
|
|
23
21
|
data-status={ status }
|
|
24
22
|
>
|
|
@@ -37,7 +35,7 @@ Progress.propTypes = {
|
|
|
37
35
|
*/
|
|
38
36
|
percent: PropTypes.number,
|
|
39
37
|
/**
|
|
40
|
-
*
|
|
38
|
+
* Bar height.
|
|
41
39
|
*/
|
|
42
40
|
size: PropTypes.oneOf([
|
|
43
41
|
'small',
|
|
@@ -45,9 +43,9 @@ Progress.propTypes = {
|
|
|
45
43
|
'large'
|
|
46
44
|
]),
|
|
47
45
|
/**
|
|
48
|
-
* Progress status.
|
|
46
|
+
* Progress status: the bar color (accent, success, warning, danger).
|
|
49
47
|
*/
|
|
50
|
-
|
|
48
|
+
status: PropTypes.oneOf([
|
|
51
49
|
'active',
|
|
52
50
|
'success',
|
|
53
51
|
'warning',
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
@import "../../styles/tokens.scss";
|
|
4
4
|
|
|
5
5
|
.#{$cls-prefix}.progress {
|
|
6
|
-
background:
|
|
6
|
+
background: var(--nv-surface);
|
|
7
7
|
|
|
8
8
|
&,
|
|
9
9
|
> .bar {
|
|
@@ -27,28 +27,28 @@
|
|
|
27
27
|
height: 8px;
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
//
|
|
30
|
+
// Status
|
|
31
31
|
&[data-status="active"] {
|
|
32
32
|
> .bar {
|
|
33
|
-
background-color:
|
|
33
|
+
background-color: var(--nv-accent-fill);
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
&[data-status="success"] {
|
|
38
38
|
> .bar {
|
|
39
|
-
background-color:
|
|
39
|
+
background-color: var(--nv-success);
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
&[data-status="warning"] {
|
|
44
44
|
> .bar {
|
|
45
|
-
background-color:
|
|
45
|
+
background-color: var(--nv-warning);
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
&[data-status="critical"] {
|
|
50
50
|
> .bar {
|
|
51
|
-
background-color:
|
|
51
|
+
background-color: var(--nv-danger);
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
54
|
}
|
|
@@ -9,7 +9,8 @@ class Table extends React.Component {
|
|
|
9
9
|
const { columns } = this.props;
|
|
10
10
|
|
|
11
11
|
return columns.map((columnProps, i) => {
|
|
12
|
-
|
|
12
|
+
// title and render describe the column; they are not <td> attributes.
|
|
13
|
+
const { dataKey, render, title, ...props } = columnProps;
|
|
13
14
|
const value = rowProps[columnProps.dataKey];
|
|
14
15
|
|
|
15
16
|
let children = value;
|
|
@@ -29,7 +30,8 @@ class Table extends React.Component {
|
|
|
29
30
|
const { columns } = this.props;
|
|
30
31
|
|
|
31
32
|
return columns.map((columnProps, i) => {
|
|
32
|
-
|
|
33
|
+
// render formats cells; passing it on to <th> made React warn.
|
|
34
|
+
const { dataKey, title, render, ...props } = columnProps;
|
|
33
35
|
|
|
34
36
|
return (
|
|
35
37
|
<th key={ dataKey || i } { ...props }>
|
|
@@ -59,7 +61,7 @@ class Table extends React.Component {
|
|
|
59
61
|
const { className } = this.props;
|
|
60
62
|
return (
|
|
61
63
|
<table
|
|
62
|
-
className={ classNames(
|
|
64
|
+
className={ classNames(className, 'table', CONSTANT.CLASS_PREFIX) }
|
|
63
65
|
>
|
|
64
66
|
<thead>
|
|
65
67
|
<tr>
|
|
@@ -2,62 +2,36 @@
|
|
|
2
2
|
@import "../../styles/variables.scss";
|
|
3
3
|
@import "../../styles/tokens.scss";
|
|
4
4
|
|
|
5
|
+
// A light table: one hairline frame with 12px corners, sentence-case headers on
|
|
6
|
+
// a tinted row, hairline rows, no boxed cells. Role tokens only (--nv-*).
|
|
5
7
|
.#{$cls-prefix}.table {
|
|
6
8
|
width: 100%;
|
|
7
|
-
|
|
8
|
-
color: $white;
|
|
9
|
+
border-collapse: separate;
|
|
9
10
|
border-spacing: 0;
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
&:first-child {
|
|
21
|
-
border-left: 1px solid $--base--300;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
&:last-child {
|
|
25
|
-
border-right: 1px solid $--base--300;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
tr {
|
|
32
|
-
background-color: $--pure--white;
|
|
33
|
-
color: $--base--1200;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
th, td {
|
|
11
|
+
overflow: hidden;
|
|
12
|
+
border: 1px solid var(--nv-border);
|
|
13
|
+
border-radius: $--radius--12;
|
|
14
|
+
background-color: var(--nv-bg);
|
|
15
|
+
color: var(--nv-text);
|
|
16
|
+
font-size: var(--nv-type-caption-size);
|
|
17
|
+
line-height: var(--nv-type-caption-line);
|
|
18
|
+
|
|
19
|
+
th,
|
|
20
|
+
td {
|
|
37
21
|
box-sizing: border-box;
|
|
38
|
-
padding: 10px;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
th {
|
|
42
|
-
text-align: left;
|
|
22
|
+
padding: 10px $--space--12;
|
|
43
23
|
text-align: left;
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
min-height: 34px;
|
|
47
|
-
height: 34px;
|
|
24
|
+
vertical-align: middle;
|
|
25
|
+
border-bottom: 1px solid var(--nv-border);
|
|
48
26
|
}
|
|
49
27
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
&:first-child {
|
|
56
|
-
border-left: 1px solid $--base--300;
|
|
57
|
-
}
|
|
28
|
+
thead th {
|
|
29
|
+
background-color: var(--nv-surface);
|
|
30
|
+
color: var(--nv-text-muted);
|
|
31
|
+
font-weight: 600;
|
|
32
|
+
}
|
|
58
33
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
}
|
|
34
|
+
tbody tr:last-child td {
|
|
35
|
+
border-bottom: 0;
|
|
62
36
|
}
|
|
63
37
|
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import classNames from 'classnames';
|
|
4
|
+
import CONSTANT from '../../constants.js';
|
|
5
|
+
import './Tag.scss';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* A small pill for a status or label ("new", "preview", "demo"). The text and
|
|
9
|
+
* the border take the tone's theme color; the fill is a faint tint of it.
|
|
10
|
+
*/
|
|
11
|
+
export default function Tag({
|
|
12
|
+
tone = 'neutral',
|
|
13
|
+
children,
|
|
14
|
+
className,
|
|
15
|
+
...restProps
|
|
16
|
+
}) {
|
|
17
|
+
return (
|
|
18
|
+
<span
|
|
19
|
+
className={ classNames(className, 'tag', CONSTANT.CLASS_PREFIX) }
|
|
20
|
+
data-tone={ tone }
|
|
21
|
+
{ ...restProps }
|
|
22
|
+
>
|
|
23
|
+
{ children }
|
|
24
|
+
</span>
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
Tag.propTypes = {
|
|
29
|
+
/**
|
|
30
|
+
* Color: neutral (muted text) or one of the theme's accent / status colors.
|
|
31
|
+
*/
|
|
32
|
+
tone: PropTypes.oneOf(['neutral', 'accent', 'success', 'warning', 'danger', 'info']),
|
|
33
|
+
/**
|
|
34
|
+
* Custom class name.
|
|
35
|
+
*/
|
|
36
|
+
className: PropTypes.string,
|
|
37
|
+
/**
|
|
38
|
+
* The label.
|
|
39
|
+
*/
|
|
40
|
+
children: PropTypes.node
|
|
41
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
A small pill for a status or label. Each tone uses the theme's own color, so it reads in every theme.
|
|
2
|
+
```jsx
|
|
3
|
+
import { Tag } from '@nurvus/ui';
|
|
4
|
+
|
|
5
|
+
<div style={ { display: 'flex', flexWrap: 'wrap', gap: 8 } }>
|
|
6
|
+
<Tag>neutral</Tag>
|
|
7
|
+
<Tag tone="accent">preview</Tag>
|
|
8
|
+
<Tag tone="success">new</Tag>
|
|
9
|
+
<Tag tone="warning">beta</Tag>
|
|
10
|
+
<Tag tone="danger">deprecated</Tag>
|
|
11
|
+
<Tag tone="info">demo</Tag>
|
|
12
|
+
</div>
|
|
13
|
+
```
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
@import "../../styles/variables.scss";
|
|
2
|
+
@import "../../styles/tokens.scss";
|
|
3
|
+
|
|
4
|
+
.#{$cls-prefix}.tag {
|
|
5
|
+
--tag-color: var(--nv-text-muted);
|
|
6
|
+
display: inline-flex;
|
|
7
|
+
align-items: center;
|
|
8
|
+
padding: 1px $--space--8;
|
|
9
|
+
border: 1px solid color-mix(in srgb, var(--tag-color) 45%, transparent);
|
|
10
|
+
border-radius: $--radius--full;
|
|
11
|
+
background: color-mix(in srgb, var(--tag-color) 10%, transparent);
|
|
12
|
+
color: var(--tag-color);
|
|
13
|
+
font-size: 12px;
|
|
14
|
+
font-weight: 500;
|
|
15
|
+
line-height: 18px;
|
|
16
|
+
white-space: nowrap;
|
|
17
|
+
|
|
18
|
+
&[data-tone="accent"] { --tag-color: var(--nv-accent); }
|
|
19
|
+
&[data-tone="success"] { --tag-color: var(--nv-success); }
|
|
20
|
+
&[data-tone="warning"] { --tag-color: var(--nv-warning); }
|
|
21
|
+
&[data-tone="danger"] { --tag-color: var(--nv-danger); }
|
|
22
|
+
&[data-tone="info"] { --tag-color: var(--nv-info); }
|
|
23
|
+
}
|
|
@@ -1,24 +1,54 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import classNames from 'classnames';
|
|
3
4
|
import CONSTANT from '../../constants.js';
|
|
5
|
+
import './Text.scss';
|
|
4
6
|
|
|
5
7
|
/**
|
|
6
|
-
* Text
|
|
7
|
-
*
|
|
8
|
+
* Text in one of the type roles (display, title, body, caption, mono). The
|
|
9
|
+
* sizes come from the `--nv-type-*` tokens, so every NURVUS page uses the same
|
|
10
|
+
* scale. Without a `variant` it inherits its parent's type, as before.
|
|
8
11
|
*/
|
|
9
|
-
export default function Text(
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
export default function Text({
|
|
13
|
+
as: Element = 'span',
|
|
14
|
+
variant,
|
|
15
|
+
tone,
|
|
16
|
+
children,
|
|
17
|
+
className,
|
|
18
|
+
...restProps
|
|
19
|
+
}) {
|
|
20
|
+
return (
|
|
21
|
+
<Element
|
|
22
|
+
className={ classNames(className, 'text', CONSTANT.CLASS_PREFIX) }
|
|
23
|
+
data-variant={ variant }
|
|
24
|
+
data-tone={ tone }
|
|
25
|
+
{ ...restProps }
|
|
26
|
+
>
|
|
27
|
+
{ children }
|
|
28
|
+
</Element>
|
|
29
|
+
);
|
|
30
|
+
}
|
|
15
31
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
32
|
+
Text.propTypes = {
|
|
33
|
+
/**
|
|
34
|
+
* The element to render, e.g. 'p', 'h1', 'span'.
|
|
35
|
+
*/
|
|
36
|
+
as: PropTypes.elementType,
|
|
37
|
+
/**
|
|
38
|
+
* Type role: display (the one big headline), title (section headings),
|
|
39
|
+
* body (running text), caption (labels and notes), mono (values and code).
|
|
40
|
+
*/
|
|
41
|
+
variant: PropTypes.oneOf(['display', 'title', 'body', 'caption', 'mono']),
|
|
42
|
+
/**
|
|
43
|
+
* Text color from the theme: default (text), muted or subtle.
|
|
44
|
+
*/
|
|
45
|
+
tone: PropTypes.oneOf(['default', 'muted', 'subtle']),
|
|
46
|
+
/**
|
|
47
|
+
* Custom class name.
|
|
48
|
+
*/
|
|
49
|
+
className: PropTypes.string,
|
|
50
|
+
/**
|
|
51
|
+
* The text.
|
|
52
|
+
*/
|
|
53
|
+
children: PropTypes.node
|
|
54
|
+
};
|
|
@@ -1,3 +1,16 @@
|
|
|
1
|
+
The type roles. Every size comes from the `--nv-type-*` tokens.
|
|
2
|
+
```jsx
|
|
3
|
+
import { Text } from '@nurvus/ui';
|
|
4
|
+
|
|
5
|
+
<div style={ { display: 'grid', gap: 10 } }>
|
|
6
|
+
<Text as="h1" variant="display">Display: the one big headline</Text>
|
|
7
|
+
<Text as="h2" variant="title">Title: section headings</Text>
|
|
8
|
+
<Text as="p" variant="body">Body: running text, 16px with room to breathe between lines.</Text>
|
|
9
|
+
<Text as="p" variant="caption" tone="muted">Caption: labels, notes and table cells.</Text>
|
|
10
|
+
<Text variant="mono">mono: #245CC7 --nv-accent 0.1.0-alpha.6</Text>
|
|
11
|
+
</div>
|
|
12
|
+
```
|
|
13
|
+
|
|
1
14
|
Basic Usage
|
|
2
15
|
```jsx
|
|
3
16
|
<Text>Hi</Text>
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
@import "../../styles/variables.scss";
|
|
2
|
+
|
|
3
|
+
// Type roles: sizes and weights from the --nv-type-* tokens (src/styles/type.json).
|
|
4
|
+
.#{$cls-prefix}.text {
|
|
5
|
+
@each $role in display, title, body, caption, mono {
|
|
6
|
+
&[data-variant="#{$role}"] {
|
|
7
|
+
margin: 0;
|
|
8
|
+
font-size: var(--nv-type-#{$role}-size);
|
|
9
|
+
line-height: var(--nv-type-#{$role}-line);
|
|
10
|
+
font-weight: var(--nv-type-#{$role}-weight);
|
|
11
|
+
letter-spacing: var(--nv-type-#{$role}-tracking);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
&[data-variant="mono"] {
|
|
16
|
+
font-family: var(--nv-font-mono);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
&[data-tone="default"] { color: var(--nv-text); }
|
|
20
|
+
&[data-tone="muted"] { color: var(--nv-text-muted); }
|
|
21
|
+
&[data-tone="subtle"] { color: var(--nv-text-subtle); }
|
|
22
|
+
}
|
|
@@ -1,51 +1,48 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
2
3
|
import classNames from 'classnames';
|
|
3
4
|
import CONSTANT from '../../constants.js';
|
|
4
5
|
import './Title.scss';
|
|
5
6
|
|
|
6
|
-
|
|
7
|
-
switch (level) {
|
|
8
|
-
case 1:
|
|
9
|
-
return 'h1';
|
|
10
|
-
break;
|
|
11
|
-
case 2:
|
|
12
|
-
return 'h2';
|
|
13
|
-
break;
|
|
14
|
-
case 3:
|
|
15
|
-
return 'h3';
|
|
16
|
-
break;
|
|
17
|
-
case 4:
|
|
18
|
-
return 'h4';
|
|
19
|
-
break;
|
|
20
|
-
case 5:
|
|
21
|
-
return 'h5';
|
|
22
|
-
break;
|
|
23
|
-
case 6:
|
|
24
|
-
default:
|
|
25
|
-
return 'h6';
|
|
26
|
-
}
|
|
27
|
-
}
|
|
7
|
+
const TAGS = { 1: 'h1', 2: 'h2', 3: 'h3', 4: 'h4', 5: 'h5', 6: 'h6' };
|
|
28
8
|
|
|
29
9
|
/**
|
|
30
|
-
*
|
|
31
|
-
*
|
|
10
|
+
* A heading, `<h1>` to `<h6>`, in the theme's text color. For the larger
|
|
11
|
+
* type roles (display, title, caption) use `Text` with a `variant`.
|
|
32
12
|
*/
|
|
33
|
-
export default function Title(
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
13
|
+
export default function Title({
|
|
14
|
+
children,
|
|
15
|
+
className,
|
|
16
|
+
level = 1,
|
|
17
|
+
type = 'primary',
|
|
18
|
+
...restProps
|
|
19
|
+
}) {
|
|
20
|
+
return React.createElement(
|
|
21
|
+
TAGS[level] || 'h6',
|
|
22
|
+
{
|
|
23
|
+
className: classNames(className, 'title', CONSTANT.CLASS_PREFIX),
|
|
24
|
+
['data-type']: type,
|
|
39
25
|
...restProps
|
|
40
|
-
}
|
|
26
|
+
},
|
|
27
|
+
children
|
|
28
|
+
);
|
|
29
|
+
}
|
|
41
30
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
31
|
+
Title.propTypes = {
|
|
32
|
+
/**
|
|
33
|
+
* Heading level: 1 renders `<h1>` (24px) down to 6 (`<h6>`).
|
|
34
|
+
*/
|
|
35
|
+
level: PropTypes.oneOf([1, 2, 3, 4, 5, 6]),
|
|
36
|
+
/**
|
|
37
|
+
* `primary` uses the theme's text color; `secondary` the muted one.
|
|
38
|
+
*/
|
|
39
|
+
type: PropTypes.oneOf(['primary', 'secondary']),
|
|
40
|
+
/**
|
|
41
|
+
* Custom class name.
|
|
42
|
+
*/
|
|
43
|
+
className: PropTypes.string,
|
|
44
|
+
/**
|
|
45
|
+
* The heading text.
|
|
46
|
+
*/
|
|
47
|
+
children: PropTypes.node
|
|
48
|
+
};
|
|
@@ -8,11 +8,12 @@
|
|
|
8
8
|
|
|
9
9
|
// TYPE
|
|
10
10
|
&[data-type="primary"] {
|
|
11
|
-
color
|
|
11
|
+
// Theme text color, so Title follows whichever theme is applied.
|
|
12
|
+
color: var(--nv-text);
|
|
12
13
|
}
|
|
13
14
|
|
|
14
15
|
&[data-type="secondary"] {
|
|
15
|
-
color:
|
|
16
|
+
color: var(--nv-text-muted);
|
|
16
17
|
}
|
|
17
18
|
|
|
18
19
|
@at-root {
|
package/src/index.js
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
// Themes: the primitives + every [data-theme] block, injected once.
|
|
2
|
+
import './styles/theme.scss';
|
|
3
|
+
|
|
4
|
+
export { themes, DEFAULT_THEME, THEME_STORAGE_KEY, THEME_CHANGE_EVENT, getTheme, currentTheme, setTheme, initTheme } from './theme';
|
|
5
|
+
export { roles as themeRoles } from './themes';
|
|
6
|
+
|
|
1
7
|
// Components
|
|
2
8
|
export { default as Button } from './components/Button/Button.jsx';
|
|
3
9
|
export { default as ButtonGroup } from './components/ButtonGroup/ButtonGroup.jsx';
|
|
@@ -6,6 +12,9 @@ export { default as Progress } from './components/Progress/Progress.jsx';
|
|
|
6
12
|
export { default as Layout } from './components/Layout/Layout.jsx';
|
|
7
13
|
export { default as Menu } from './components/Menu/Menu.jsx';
|
|
8
14
|
export { default as FullPageModal } from './components/FullPageModal/FullPageModal.jsx';
|
|
15
|
+
export { default as HistoryList } from './components/HistoryList/HistoryList.jsx';
|
|
16
|
+
export { default as Panel } from './components/Panel/Panel.jsx';
|
|
9
17
|
export { default as Table } from './components/Table/Table.jsx';
|
|
18
|
+
export { default as Tag } from './components/Tag/Tag.jsx';
|
|
10
19
|
export { default as Text } from './components/Text/Text.jsx';
|
|
11
20
|
export { default as Title } from './components/Title/Title.jsx';
|