@nurvus/ui 0.1.0-alpha.13 → 0.1.0-alpha.15
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/README.md +8 -0
- package/dist/index.js +1 -1
- package/dist/nurvus.css +7 -5
- package/dist/respawn.js +1 -1
- package/dist/types/components/Icon/Icon.d.ts +20 -0
- package/dist/types/components/Menu/Menu.d.ts +35 -27
- package/dist/types/components/Select/Select.d.ts +55 -0
- package/dist/types/components/Tree/Tree.d.ts +39 -0
- package/dist/types/icons.d.ts +55 -0
- package/dist/types/index.d.ts +9 -3
- package/dist/types/menu.d.ts +24 -0
- package/dist/types/respawn/Icon.d.ts +22 -0
- package/dist/types/respawn/Menu.d.ts +36 -26
- package/dist/types/respawn/Select.d.ts +54 -0
- package/dist/types/respawn/Tree.d.ts +36 -0
- package/dist/types/respawn/index.d.ts +9 -3
- package/dist/types/respawn/spawn.d.ts +2 -0
- package/dist/types/select.d.ts +70 -0
- package/dist/types/tree.d.ts +9 -0
- package/package.json +2 -2
- package/src/components/Button/Button.scss +8 -2
- package/src/components/ButtonGroup/ButtonGroup.md +8 -12
- package/src/components/Icon/Icon.md +22 -0
- package/src/components/Icon/Icon.scss +10 -0
- package/src/components/Icon/Icon.tsx +45 -0
- package/src/components/Layout/Layout.md +10 -18
- package/src/components/Link/Link.md +11 -2
- package/src/components/Menu/Menu.md +34 -126
- package/src/components/Menu/Menu.scss +133 -51
- package/src/components/Menu/Menu.tsx +118 -67
- package/src/components/Select/Select.md +72 -0
- package/src/components/Select/Select.scss +170 -0
- package/src/components/Select/Select.tsx +196 -0
- package/src/components/Table/Table.md +3 -2
- package/src/components/Tag/Tag.scss +3 -1
- package/src/components/Text/Text.md +3 -5
- package/src/components/Tree/Tree.md +62 -0
- package/src/components/Tree/Tree.scss +73 -0
- package/src/components/Tree/Tree.tsx +125 -0
- package/src/css.ts +3 -1
- package/src/icons.ts +88 -0
- package/src/index.ts +9 -3
- package/src/menu.ts +66 -0
- package/src/respawn/Icon.ts +47 -0
- package/src/respawn/Menu.ts +113 -62
- package/src/respawn/Select.ts +212 -0
- package/src/respawn/Tree.ts +116 -0
- package/src/respawn/index.ts +9 -3
- package/src/respawn/spawn.ts +5 -3
- package/src/select.ts +140 -0
- package/src/styles/theme.scss +1 -1
- package/src/styles/type.json +1 -1
- package/src/tree.ts +46 -0
- package/dist/types/components/NavList/NavList.d.ts +0 -43
- package/dist/types/navList.d.ts +0 -7
- package/dist/types/respawn/NavList.d.ts +0 -43
- package/src/components/NavList/NavList.md +0 -39
- package/src/components/NavList/NavList.scss +0 -149
- package/src/components/NavList/NavList.tsx +0 -129
- package/src/navList.ts +0 -9
- package/src/respawn/NavList.ts +0 -126
|
@@ -1,25 +1,21 @@
|
|
|
1
1
|
```jsx
|
|
2
|
-
import { Button, ButtonGroup, Layout } from '@nurvus/ui';
|
|
3
|
-
import AddIcon from '@material-ui/icons/Add';
|
|
4
|
-
import FileCopyIcon from '@material-ui/icons/FileCopy';
|
|
5
|
-
import RemoveRedEyeIcon from '@material-ui/icons/RemoveRedEye';
|
|
6
|
-
import LockOpenIcon from '@material-ui/icons/LockOpen';
|
|
2
|
+
import { Button, ButtonGroup, Icon, Layout } from '@nurvus/ui';
|
|
7
3
|
|
|
8
4
|
<Layout>
|
|
9
5
|
<ButtonGroup>
|
|
10
|
-
<Button><
|
|
11
|
-
<Button><
|
|
12
|
-
<Button disabled={ true }><
|
|
13
|
-
<Button><
|
|
6
|
+
<Button aria-label="Add"><Icon name="add" size="1.25em" /></Button>
|
|
7
|
+
<Button aria-label="Copy"><Icon name="copy" size="1.25em" /></Button>
|
|
8
|
+
<Button disabled={ true } aria-label="Show"><Icon name="eye" size="1.25em" /></Button>
|
|
9
|
+
<Button aria-label="Unlock"><Icon name="unlock" size="1.25em" /></Button>
|
|
14
10
|
</ButtonGroup>
|
|
15
11
|
|
|
16
12
|
<ButtonGroup>
|
|
17
|
-
<Button disabled={ true }><
|
|
18
|
-
<Button><
|
|
13
|
+
<Button disabled={ true } aria-label="Show"><Icon name="eye" size="1.25em" /></Button>
|
|
14
|
+
<Button aria-label="Unlock"><Icon name="unlock" size="1.25em" /></Button>
|
|
19
15
|
</ButtonGroup>
|
|
20
16
|
|
|
21
17
|
<ButtonGroup>
|
|
22
|
-
<Button><
|
|
18
|
+
<Button aria-label="Unlock"><Icon name="unlock" size="1.25em" /></Button>
|
|
23
19
|
</ButtonGroup>
|
|
24
20
|
</Layout>
|
|
25
21
|
```
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
Icons are 1em by default, so they are as big as the text they sit in, and they take its color. Every icon is in **Foundations → Icons**.
|
|
2
|
+
```jsx
|
|
3
|
+
import { Icon, Layout, Text, Title } from '@nurvus/ui';
|
|
4
|
+
|
|
5
|
+
<Layout itemSpacing={ 12 }>
|
|
6
|
+
<Title level={ 3 }><Icon name="layers" /> Layers</Title>
|
|
7
|
+
<Text as="p" variant="body"><Icon name="info" /> Body text, and its icon is body size.</Text>
|
|
8
|
+
<Text as="p" variant="caption" tone="muted"><Icon name="check" /> A caption, a smaller icon.</Text>
|
|
9
|
+
</Layout>
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
In a button: put the icon beside the words. An icon alone needs a `label`, which screen readers read; with words beside it, leave the label out (the icon is decorative).
|
|
13
|
+
```jsx
|
|
14
|
+
import { Button, Icon, Layout } from '@nurvus/ui';
|
|
15
|
+
|
|
16
|
+
<Layout display="flex" alignItems="center" itemSpacing={ 8 }>
|
|
17
|
+
<Button type="primary"><Icon name="add" /> New layer</Button>
|
|
18
|
+
<Button type="secondary"><Icon name="download" /> Export</Button>
|
|
19
|
+
<Button type="secondary" aria-label="Delete layer"><Icon name="delete" /></Button>
|
|
20
|
+
<Icon name="warning" label="Unsaved changes" size={ 24 } style={ { color: 'var(--nv-warning)' } } />
|
|
21
|
+
</Layout>
|
|
22
|
+
```
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
@import "../../styles/variables.scss";
|
|
2
|
+
|
|
3
|
+
// Icons sit on the text's baseline like a letter: 1em tall, nudged down an
|
|
4
|
+
// eighth so their middle lines up with the middle of capitals and lowercase.
|
|
5
|
+
.#{$cls-prefix}.icon {
|
|
6
|
+
display: inline-block;
|
|
7
|
+
flex: none;
|
|
8
|
+
vertical-align: -0.125em;
|
|
9
|
+
overflow: visible;
|
|
10
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import classNames from 'classnames';
|
|
3
|
+
import CONSTANT from '../../constants';
|
|
4
|
+
import { iconNodes, IconName } from '../../icons';
|
|
5
|
+
import './Icon.scss';
|
|
6
|
+
|
|
7
|
+
export interface IconProps extends Omit<React.SVGAttributes<SVGSVGElement>, 'name'> {
|
|
8
|
+
/** Which icon (Foundations > Icons lists them all). */
|
|
9
|
+
name: IconName;
|
|
10
|
+
/** Width and height. Defaults to 1em: the icon is as big as the text around it. A number is pixels. */
|
|
11
|
+
size?: number | string;
|
|
12
|
+
/** Says what the icon means, for an icon that stands alone (screen readers read it). Leave it out when text beside it already says it. */
|
|
13
|
+
label?: string;
|
|
14
|
+
/** Line thickness in grid units (the grid is 24). */
|
|
15
|
+
strokeWidth?: number;
|
|
16
|
+
/** Custom class name. */
|
|
17
|
+
className?: string;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* An icon from the NURVUS set: drawn on a 24-unit grid with round 2-unit
|
|
22
|
+
* lines, in the text's color (currentColor), and 1em by default so it matches
|
|
23
|
+
* the text it sits in. Decorative unless you give it a label.
|
|
24
|
+
*/
|
|
25
|
+
export default function Icon({ name, size = '1em', label, strokeWidth = 2, className, ...restProps }: IconProps) {
|
|
26
|
+
const a11y = label ? { role: 'img', 'aria-label': label } : { 'aria-hidden': true, focusable: 'false' as const };
|
|
27
|
+
return (
|
|
28
|
+
<svg
|
|
29
|
+
className={ classNames(className, 'icon', CONSTANT.CLASS_PREFIX) }
|
|
30
|
+
data-icon={ name }
|
|
31
|
+
viewBox="0 0 24 24"
|
|
32
|
+
width={ size }
|
|
33
|
+
height={ size }
|
|
34
|
+
fill="none"
|
|
35
|
+
stroke="currentColor"
|
|
36
|
+
strokeWidth={ strokeWidth }
|
|
37
|
+
strokeLinecap="round"
|
|
38
|
+
strokeLinejoin="round"
|
|
39
|
+
{ ...a11y }
|
|
40
|
+
{ ...restProps }
|
|
41
|
+
>
|
|
42
|
+
{ iconNodes(name).map(([tag, attrs], i) => React.createElement(tag, { key: i, ...attrs })) }
|
|
43
|
+
</svg>
|
|
44
|
+
);
|
|
45
|
+
}
|
|
@@ -1,34 +1,26 @@
|
|
|
1
1
|
Basic Example
|
|
2
2
|
```jsx
|
|
3
|
-
import { Button, Layout, Title } from '@nurvus/ui';
|
|
4
|
-
import AddIcon from '@material-ui/icons/Add';
|
|
5
|
-
import FileCopyIcon from '@material-ui/icons/FileCopy';
|
|
6
|
-
import RemoveRedEyeIcon from '@material-ui/icons/RemoveRedEye';
|
|
7
|
-
import LockOpenIcon from '@material-ui/icons/LockOpen';
|
|
3
|
+
import { Button, Icon, Layout, Title } from '@nurvus/ui';
|
|
8
4
|
|
|
9
5
|
<Layout>
|
|
10
6
|
<Title level={ 3 }>Layers</Title>
|
|
11
|
-
<Button>
|
|
12
|
-
<
|
|
7
|
+
<Button aria-label="Add">
|
|
8
|
+
<Icon name="add" size="1.25em" />
|
|
13
9
|
</Button>
|
|
14
10
|
</Layout>
|
|
15
11
|
```
|
|
16
12
|
|
|
17
13
|
Horizontal Example
|
|
18
14
|
```jsx
|
|
19
|
-
import { Button, Layout, Title } from '@nurvus/ui';
|
|
20
|
-
import AddIcon from '@material-ui/icons/Add';
|
|
21
|
-
import FileCopyIcon from '@material-ui/icons/FileCopy';
|
|
22
|
-
import RemoveRedEyeIcon from '@material-ui/icons/RemoveRedEye';
|
|
23
|
-
import LockOpenIcon from '@material-ui/icons/LockOpen';
|
|
15
|
+
import { Button, Icon, Layout, Title } from '@nurvus/ui';
|
|
24
16
|
|
|
25
17
|
<Layout itemSpacing={ 32 }>
|
|
26
18
|
<Layout itemSpacing={ 8 }>
|
|
27
19
|
<Title level={ 4 }>Display Flex</Title>
|
|
28
20
|
<Layout display="flex">
|
|
29
21
|
<Title level={ 3 }>Layers</Title>
|
|
30
|
-
<Button>
|
|
31
|
-
<
|
|
22
|
+
<Button aria-label="Add">
|
|
23
|
+
<Icon name="add" size="1.25em" />
|
|
32
24
|
</Button>
|
|
33
25
|
</Layout>
|
|
34
26
|
</Layout>
|
|
@@ -36,8 +28,8 @@ import LockOpenIcon from '@material-ui/icons/LockOpen';
|
|
|
36
28
|
<Title level={ 4 }>Display Flex and Align Item</Title>
|
|
37
29
|
<Layout display="flex" alignItems="center">
|
|
38
30
|
<Title level={ 3 }>Layers</Title>
|
|
39
|
-
<Button>
|
|
40
|
-
<
|
|
31
|
+
<Button aria-label="Add">
|
|
32
|
+
<Icon name="add" size="1.25em" />
|
|
41
33
|
</Button>
|
|
42
34
|
</Layout>
|
|
43
35
|
</Layout>
|
|
@@ -45,8 +37,8 @@ import LockOpenIcon from '@material-ui/icons/LockOpen';
|
|
|
45
37
|
<Title level={ 4 }>Display Flex and Align Item and Spaced Apart</Title>
|
|
46
38
|
<Layout display="flex" alignItems="center" justifyContent="space-between">
|
|
47
39
|
<Title level={ 3 }>Layers</Title>
|
|
48
|
-
<Button>
|
|
49
|
-
<
|
|
40
|
+
<Button aria-label="Add">
|
|
41
|
+
<Icon name="add" size="1.25em" />
|
|
50
42
|
</Button>
|
|
51
43
|
</Layout>
|
|
52
44
|
</Layout>
|
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
```jsx
|
|
2
2
|
import { Link } from '@nurvus/ui';
|
|
3
3
|
|
|
4
|
-
<Link>Link on Me</Link>
|
|
5
|
-
```
|
|
4
|
+
<Link href="#/Components/Link">Link on Me</Link>
|
|
5
|
+
```
|
|
6
|
+
|
|
7
|
+
Opening another site: add `target` and `rel`, and say so in the text.
|
|
8
|
+
```jsx
|
|
9
|
+
import { Link } from '@nurvus/ui';
|
|
10
|
+
|
|
11
|
+
<Link href="https://github.com/kwehhh/nurvus-design-system" target="_blank" rel="noopener noreferrer">
|
|
12
|
+
NURVUS UI on GitHub (opens in a new tab)
|
|
13
|
+
</Link>
|
|
14
|
+
```
|
|
@@ -1,135 +1,43 @@
|
|
|
1
|
-
|
|
2
|
-
```jsx
|
|
3
|
-
import { Menu } from '@nurvus/ui';
|
|
4
|
-
|
|
5
|
-
const initialPath = [1];
|
|
6
|
-
const items = [
|
|
7
|
-
{
|
|
8
|
-
label: 'Item 1',
|
|
9
|
-
},
|
|
10
|
-
{
|
|
11
|
-
label: 'Item 2'
|
|
12
|
-
},
|
|
13
|
-
{
|
|
14
|
-
label: 'Item 3'
|
|
15
|
-
},
|
|
16
|
-
{
|
|
17
|
-
label: 'Item 4'
|
|
18
|
-
}
|
|
19
|
-
];
|
|
1
|
+
**Menu or Tree?** Menu takes people to pages: its rows are links (a `<nav>`), Tab visits each one, and the current page is marked. [Tree](#/Components/Tree) picks an item in a list on the same page, like layers in an editor: one Tab stop, the arrow keys move, and the picked row is selected. Screen readers announce them differently (links in a navigation area versus a tree you choose from), so they are two components with the same look.
|
|
20
2
|
|
|
21
|
-
|
|
22
|
-
const [activePath, setActivePath] = React.useState(initialPath);
|
|
3
|
+
Sections open and close with the chevron (or the whole heading, when it isn't a link). The current page is marked with a bar beside it, and its section opens by itself.
|
|
23
4
|
|
|
24
|
-
|
|
25
|
-
<Menu
|
|
26
|
-
activePath={ activePath }
|
|
27
|
-
items={ items }
|
|
28
|
-
onClick={ (e, path) => setActivePath(path) }
|
|
29
|
-
/>
|
|
30
|
-
);
|
|
31
|
-
}
|
|
32
|
-
<MyApp initialPath={ initialPath } />
|
|
33
|
-
```
|
|
34
|
-
|
|
35
|
-
Using Sub Menus
|
|
5
|
+
By keyboard: Tab goes link by link as usual, and inside the menu ↑ ↓ move between rows (going round at the ends), Home and End jump to the first and last, → opens a section and ← closes it. Enter follows a link; Enter or Space opens and closes a section (its chevron is a button). Links take Enter only, as everywhere on the web: Space scrolls the page.
|
|
36
6
|
```jsx
|
|
37
7
|
import { Menu } from '@nurvus/ui';
|
|
38
8
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
{
|
|
45
|
-
label: '
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
label: 'Sub 2'
|
|
57
|
-
}
|
|
58
|
-
]
|
|
59
|
-
},
|
|
60
|
-
{
|
|
61
|
-
label: 'Item 2'
|
|
62
|
-
}
|
|
63
|
-
];
|
|
64
|
-
|
|
65
|
-
const MyApp = ({initialPath}) => {
|
|
66
|
-
const [activePath, setActivePath] = React.useState(initialPath);
|
|
67
|
-
|
|
68
|
-
return (
|
|
69
|
-
<Menu
|
|
70
|
-
activePath={ activePath }
|
|
71
|
-
items={ items }
|
|
72
|
-
onClick={ (e, path) => setActivePath(path) }
|
|
73
|
-
/>
|
|
74
|
-
);
|
|
75
|
-
}
|
|
76
|
-
<MyApp initialPath={ initialPath } />
|
|
9
|
+
<div style={ { maxWidth: 260 } }>
|
|
10
|
+
<Menu
|
|
11
|
+
current="#/settings/billing"
|
|
12
|
+
onNavigate={ (href, event) => event.preventDefault() }
|
|
13
|
+
sections={ [
|
|
14
|
+
{ title: 'Account', href: '#/account', items: [
|
|
15
|
+
{ label: 'Profile', href: '#/account/profile' },
|
|
16
|
+
{ label: 'Security', href: '#/account/security' },
|
|
17
|
+
] },
|
|
18
|
+
{ title: 'Settings', items: [
|
|
19
|
+
{ label: 'General', href: '#/settings/general' },
|
|
20
|
+
{ label: 'Billing', href: '#/settings/billing' },
|
|
21
|
+
{ label: 'Danger zone', href: '#/settings/danger', divider: true },
|
|
22
|
+
] },
|
|
23
|
+
] }
|
|
24
|
+
/>
|
|
25
|
+
</div>
|
|
77
26
|
```
|
|
78
27
|
|
|
79
|
-
|
|
28
|
+
Start with some sections closed: `defaultOpen` takes a map of section ids (the title as a slug, or the section's own `id`).
|
|
80
29
|
```jsx
|
|
81
|
-
import
|
|
82
|
-
import LockOpenIcon from '@material-ui/icons/LockOpen';
|
|
83
|
-
import { Layout, Menu, Text } from '@nurvus/ui';
|
|
84
|
-
|
|
85
|
-
const itemRenderer = ({ label }) => {
|
|
86
|
-
return (
|
|
87
|
-
<Layout display="flex" alignItems="center" justifyContent="space-between">
|
|
88
|
-
<Text>{ label }</Text>
|
|
89
|
-
<Layout display="flex" alignItems="center" justifyContent="space-between">
|
|
90
|
-
<RemoveRedEyeIcon />
|
|
91
|
-
<LockOpenIcon />
|
|
92
|
-
</Layout>
|
|
93
|
-
</Layout>
|
|
94
|
-
);
|
|
95
|
-
};
|
|
96
|
-
const initialPath = [0, 0, 0];
|
|
97
|
-
const items = [
|
|
98
|
-
{
|
|
99
|
-
label: 'Item 1',
|
|
100
|
-
items: [
|
|
101
|
-
{
|
|
102
|
-
label: 'Sub 1',
|
|
103
|
-
items: [
|
|
104
|
-
{
|
|
105
|
-
label: 'Sub Item 1'
|
|
106
|
-
},
|
|
107
|
-
{
|
|
108
|
-
label: 'Sub Item 2'
|
|
109
|
-
}
|
|
110
|
-
]
|
|
111
|
-
},
|
|
112
|
-
{
|
|
113
|
-
label: 'Sub 2'
|
|
114
|
-
}
|
|
115
|
-
]
|
|
116
|
-
},
|
|
117
|
-
{
|
|
118
|
-
label: 'Item 2'
|
|
119
|
-
}
|
|
120
|
-
];
|
|
121
|
-
|
|
122
|
-
const MyApp = ({initialPath}) => {
|
|
123
|
-
const [activePath, setActivePath] = React.useState(initialPath);
|
|
30
|
+
import { Menu } from '@nurvus/ui';
|
|
124
31
|
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
|
|
32
|
+
<div style={ { maxWidth: 260 } }>
|
|
33
|
+
<Menu
|
|
34
|
+
id="closed-example"
|
|
35
|
+
defaultOpen={ { reports: false } }
|
|
36
|
+
onNavigate={ (href, event) => event.preventDefault() }
|
|
37
|
+
sections={ [
|
|
38
|
+
{ title: 'Projects', items: [{ label: 'Website', href: '#/p/web' }, { label: 'App', href: '#/p/app' }] },
|
|
39
|
+
{ title: 'Reports', items: [{ label: 'Weekly', href: '#/r/week' }, { label: 'Monthly', href: '#/r/month' }] },
|
|
40
|
+
] }
|
|
41
|
+
/>
|
|
42
|
+
</div>
|
|
43
|
+
```
|
|
@@ -1,68 +1,150 @@
|
|
|
1
1
|
@import "../../styles/variables.scss";
|
|
2
|
-
|
|
2
|
+
|
|
3
|
+
// Site navigation. Sections open and close by animating the list's row
|
|
4
|
+
// (grid-template-rows 1fr <-> 0fr): smooth, no height measuring, any length.
|
|
5
|
+
$menu-speed: 0.2s;
|
|
3
6
|
|
|
4
7
|
.#{$cls-prefix}.menu {
|
|
5
|
-
|
|
6
|
-
|
|
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: var(--nv-bg);
|
|
17
|
-
color: var(--nv-text);
|
|
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;
|
|
8
|
+
font-size: 14px;
|
|
9
|
+
line-height: 20px;
|
|
23
10
|
|
|
24
|
-
.menu-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
11
|
+
.menu-section + .menu-section { margin-top: var(--space--8); }
|
|
12
|
+
|
|
13
|
+
.menu-heading {
|
|
14
|
+
display: flex;
|
|
15
|
+
align-items: center;
|
|
16
|
+
gap: var(--space--4);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.menu-title {
|
|
20
|
+
flex: 1;
|
|
21
|
+
min-width: 0;
|
|
22
|
+
padding: var(--space--4) 10px;
|
|
23
|
+
border: 0;
|
|
24
|
+
border-radius: 6px;
|
|
25
|
+
background: none;
|
|
33
26
|
color: var(--nv-text);
|
|
27
|
+
font: inherit;
|
|
28
|
+
font-weight: 600;
|
|
29
|
+
text-align: left;
|
|
30
|
+
text-decoration: none;
|
|
34
31
|
cursor: pointer;
|
|
35
32
|
|
|
36
|
-
&:hover {
|
|
37
|
-
|
|
38
|
-
|
|
33
|
+
&:hover { background: var(--nv-surface-hover); }
|
|
34
|
+
&:focus-visible { outline: 2px solid var(--nv-accent); outline-offset: -2px; }
|
|
35
|
+
&[data-active="true"] { background: var(--nv-accent-soft); }
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// The chevron: a turned corner. Down when the section is closed (there is
|
|
39
|
+
// more below), up when it is open; it turns half a circle between the two.
|
|
40
|
+
.menu-toggle {
|
|
41
|
+
display: inline-flex;
|
|
42
|
+
align-items: center;
|
|
43
|
+
justify-content: center;
|
|
44
|
+
|
|
45
|
+
&::after {
|
|
46
|
+
content: '';
|
|
47
|
+
width: 6px;
|
|
48
|
+
height: 6px;
|
|
49
|
+
margin: 0 var(--space--4);
|
|
50
|
+
border-right: 1.5px solid currentColor;
|
|
51
|
+
border-bottom: 1.5px solid currentColor;
|
|
52
|
+
transform: translateY(2px) rotate(225deg);
|
|
53
|
+
transition: transform $menu-speed ease;
|
|
39
54
|
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// The icon-only toggle beside a heading that is a link.
|
|
58
|
+
.menu-toggle:not(.menu-title) {
|
|
59
|
+
flex: none;
|
|
60
|
+
width: 24px;
|
|
61
|
+
height: 24px;
|
|
62
|
+
padding: 0;
|
|
63
|
+
border: 0;
|
|
64
|
+
border-radius: 6px;
|
|
65
|
+
background: none;
|
|
66
|
+
color: var(--nv-text-muted);
|
|
67
|
+
cursor: pointer;
|
|
68
|
+
|
|
69
|
+
&::after { margin: 0; }
|
|
70
|
+
&:hover { background: var(--nv-surface-hover); color: var(--nv-text); }
|
|
71
|
+
&:focus-visible { outline: 2px solid var(--nv-accent); outline-offset: -2px; }
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
// A heading with no page of its own: the whole row is the toggle.
|
|
75
|
+
.menu-title.menu-toggle { justify-content: space-between; }
|
|
76
|
+
|
|
77
|
+
.menu-section[data-open="false"] .menu-toggle::after { transform: translateY(-2px) rotate(45deg); }
|
|
78
|
+
|
|
79
|
+
.menu-items {
|
|
80
|
+
display: grid;
|
|
81
|
+
grid-template-rows: 1fr;
|
|
82
|
+
transition: grid-template-rows $menu-speed ease;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.menu-section[data-open="false"] .menu-items { grid-template-rows: 0fr; }
|
|
86
|
+
|
|
87
|
+
ul {
|
|
88
|
+
min-height: 0;
|
|
89
|
+
overflow: hidden;
|
|
90
|
+
// Room on the left for the current-page bar, which sits outside the item.
|
|
91
|
+
margin: 0 0 0 -12px;
|
|
92
|
+
padding: 0 0 0 12px; // no vertical padding: it would stay when the row closes to 0
|
|
93
|
+
list-style: none;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
li:first-child { margin-top: 2px; }
|
|
97
|
+
li:last-child { margin-bottom: var(--space--8); }
|
|
98
|
+
|
|
99
|
+
// Closed: out of sight and out of the tab order once the animation ends.
|
|
100
|
+
.menu-section[data-open="false"] ul {
|
|
101
|
+
visibility: hidden;
|
|
102
|
+
transition: visibility 0s $menu-speed;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
li + li { margin-top: 2px; }
|
|
106
|
+
|
|
107
|
+
li[data-divider] {
|
|
108
|
+
margin-top: var(--space--8);
|
|
109
|
+
padding-top: var(--space--8);
|
|
110
|
+
border-top: 1px solid var(--nv-border);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
.menu-item {
|
|
114
|
+
position: relative;
|
|
115
|
+
display: block;
|
|
116
|
+
padding: var(--space--4) 10px var(--space--4) 20px;
|
|
117
|
+
border-radius: 6px;
|
|
118
|
+
color: var(--nv-text-muted);
|
|
119
|
+
text-decoration: none;
|
|
120
|
+
|
|
121
|
+
&:hover { background: var(--nv-surface-hover); color: var(--nv-text); }
|
|
122
|
+
&:focus-visible { outline: 2px solid var(--nv-accent); outline-offset: -2px; }
|
|
40
123
|
|
|
41
|
-
// Active row: 2px accent rail + a tinted wash, both from the theme's
|
|
42
|
-
// accent, so every theme keeps the same "you are here" language.
|
|
43
124
|
&[data-active="true"] {
|
|
44
125
|
background: var(--nv-accent-soft);
|
|
45
126
|
color: var(--nv-text);
|
|
46
|
-
|
|
47
|
-
&::before {
|
|
48
|
-
content: '';
|
|
49
|
-
position: absolute;
|
|
50
|
-
left: 0;
|
|
51
|
-
top: 0;
|
|
52
|
-
height: 100%;
|
|
53
|
-
width: $--space--2;
|
|
54
|
-
border-radius: $--radius--2;
|
|
55
|
-
background: var(--nv-accent);
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
&:hover {
|
|
59
|
-
background: color-mix(in srgb, var(--nv-accent) 22%, transparent);
|
|
60
|
-
}
|
|
127
|
+
font-weight: 500;
|
|
61
128
|
}
|
|
62
129
|
|
|
63
|
-
//
|
|
64
|
-
|
|
65
|
-
|
|
130
|
+
// The current page's marker: its own small rounded bar beside the item
|
|
131
|
+
// (as GitHub Primer's NavList draws it), not a border on the rounded item.
|
|
132
|
+
&[data-active="true"]::before {
|
|
133
|
+
content: '';
|
|
134
|
+
position: absolute;
|
|
135
|
+
top: 50%;
|
|
136
|
+
left: -8px;
|
|
137
|
+
width: 4px;
|
|
138
|
+
height: 18px;
|
|
139
|
+
border-radius: 2px;
|
|
140
|
+
background: var(--nv-accent);
|
|
141
|
+
transform: translateY(-50%);
|
|
66
142
|
}
|
|
67
143
|
}
|
|
144
|
+
|
|
145
|
+
@media (prefers-reduced-motion: reduce) {
|
|
146
|
+
.menu-items,
|
|
147
|
+
.menu-toggle::after,
|
|
148
|
+
.menu-section[data-open="false"] ul { transition: none; }
|
|
149
|
+
}
|
|
68
150
|
}
|