@papillonbits/components 1.13.0 → 1.14.0
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/build/index.js +1 -12
- package/build/primer/Alert/Alert.js +82 -94
- package/build/primer/Alert/Alert.prop.js +19 -25
- package/build/primer/Alert/index.js +2 -19
- package/build/primer/Blankslate/Blankslate.js +22 -26
- package/build/primer/Blankslate/Blankslate.prop.js +11 -17
- package/build/primer/Blankslate/index.js +2 -19
- package/build/primer/Breadcrumb/Breadcrumb.js +59 -61
- package/build/primer/Breadcrumb/Breadcrumb.prop.js +14 -20
- package/build/primer/Breadcrumb/index.js +2 -19
- package/build/primer/Button/Button.js +63 -72
- package/build/primer/Button/Button.prop.js +27 -33
- package/build/primer/Button/index.js +2 -49
- package/build/primer/Dropdown/Dropdown.js +79 -85
- package/build/primer/Dropdown/Dropdown.prop.js +15 -21
- package/build/primer/Dropdown/index.js +2 -19
- package/build/primer/ErrorBoundary/ErrorBoundary.js +35 -55
- package/build/primer/ErrorBoundary/ErrorBoundary.prop.js +4 -10
- package/build/primer/ErrorBoundary/index.js +1 -12
- package/build/primer/Form/Checkbox/Checkbox.js +29 -39
- package/build/primer/Form/Checkbox/Checkbox.prop.js +15 -21
- package/build/primer/Form/Checkbox/index.js +2 -19
- package/build/primer/Form/Input/Input.js +29 -43
- package/build/primer/Form/Input/Input.prop.js +19 -25
- package/build/primer/Form/Input/index.js +2 -25
- package/build/primer/Form/Radio/Radio.js +26 -38
- package/build/primer/Form/Radio/Radio.prop.js +14 -20
- package/build/primer/Form/Radio/index.js +2 -19
- package/build/primer/Form/index.js +11 -17
- package/build/primer/Grid/DisplayTable/DisplayTable.js +44 -54
- package/build/primer/Grid/DisplayTable/DisplayTable.prop.js +7 -13
- package/build/primer/Grid/DisplayTable/index.js +1 -12
- package/build/primer/Grid/FlexGrid/FlexGrid.js +186 -207
- package/build/primer/Grid/FlexGrid/FlexGrid.prop.js +24 -30
- package/build/primer/Grid/FlexGrid/index.js +2 -25
- package/build/primer/Grid/index.js +7 -13
- package/build/primer/Icon/Icon.js +35 -52
- package/build/primer/Icon/Icon.part.js +1287 -1294
- package/build/primer/Icon/Icon.prop.js +20 -26
- package/build/primer/Icon/index.js +2 -25
- package/build/primer/Label/Label.js +22 -28
- package/build/primer/Label/Label.prop.js +11 -17
- package/build/primer/Label/index.js +1 -12
- package/build/primer/Loader/Loader.js +38 -45
- package/build/primer/Loader/Loader.prop.js +7 -13
- package/build/primer/Loader/index.js +2 -19
- package/build/primer/Navigation/Menu/Menu.js +52 -59
- package/build/primer/Navigation/Menu/Menu.prop.js +16 -22
- package/build/primer/Navigation/Menu/index.js +1 -12
- package/build/primer/Navigation/TabNav/TabNav.js +89 -94
- package/build/primer/Navigation/TabNav/TabNav.prop.js +19 -25
- package/build/primer/Navigation/TabNav/index.js +2 -19
- package/build/primer/Navigation/UnderlineNav/UnderlineNav.js +82 -86
- package/build/primer/Navigation/UnderlineNav/UnderlineNav.prop.js +21 -27
- package/build/primer/Navigation/UnderlineNav/index.js +2 -25
- package/build/primer/Navigation/index.js +10 -16
- package/build/primer/Pagination/PreviousNext/PreviousNext.js +53 -54
- package/build/primer/Pagination/PreviousNext/PreviousNext.prop.js +22 -28
- package/build/primer/Pagination/PreviousNext/index.js +2 -19
- package/build/primer/Pagination/index.js +4 -10
- package/build/primer/Popover/Popover.js +59 -50
- package/build/primer/Popover/Popover.prop.js +16 -22
- package/build/primer/Popover/index.js +2 -25
- package/build/primer/Progress/Progress.js +20 -26
- package/build/primer/Progress/Progress.prop.js +7 -13
- package/build/primer/Progress/index.js +2 -19
- package/build/primer/Select/Select.js +43 -51
- package/build/primer/Select/Select.prop.js +12 -18
- package/build/primer/Select/index.js +2 -19
- package/build/primer/SelectMenu/SelectMenu.js +65 -74
- package/build/primer/SelectMenu/SelectMenu.prop.js +14 -20
- package/build/primer/SelectMenu/index.js +1 -12
- package/build/primer/Subhead/Subhead.js +16 -23
- package/build/primer/Subhead/Subhead.prop.js +6 -12
- package/build/primer/Subhead/index.js +1 -12
- package/build/primer/Toast/Toast.js +39 -46
- package/build/primer/Toast/Toast.prop.js +10 -16
- package/build/primer/Toast/index.js +2 -19
- package/build/primer/index.js +58 -64
- package/package.json +4 -4
|
@@ -1,125 +1,120 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
var _ref$className = _ref.className,
|
|
20
|
-
className = _ref$className === void 0 ? _TabNav.defaultProps.className : _ref$className,
|
|
21
|
-
ariaAttr = _ref.ariaAttr,
|
|
22
|
-
items = _ref.items,
|
|
23
|
-
_ref$actions = _ref.actions,
|
|
24
|
-
actions = _ref$actions === void 0 ? _TabNav.defaultProps.actions : _ref$actions,
|
|
25
|
-
_onClick = _ref.onClick,
|
|
26
|
-
_ref$children = _ref.children,
|
|
27
|
-
children = _ref$children === void 0 ? _TabNav.defaultProps.children : _ref$children,
|
|
28
|
-
_ref$state = _ref.state,
|
|
29
|
-
state = _ref$state === void 0 ? _TabNav.defaultProps.state : _ref$state;
|
|
1
|
+
import "core-js/modules/es.iterator.constructor.js";
|
|
2
|
+
import "core-js/modules/es.iterator.map.js";
|
|
3
|
+
import { Fragment } from 'react';
|
|
4
|
+
import cx from 'classnames';
|
|
5
|
+
import { v1 as uuidv1 } from 'uuid';
|
|
6
|
+
import { getIndexItems, getIndexItemsWithSelected } from '@papillonbits/library/array';
|
|
7
|
+
import { propTypes, defaultProps, tabNavState } from './TabNav.prop';
|
|
8
|
+
import styles from './TabNav.scss';
|
|
9
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
10
|
+
export function TabNav({
|
|
11
|
+
className = defaultProps.className,
|
|
12
|
+
ariaAttr,
|
|
13
|
+
items,
|
|
14
|
+
actions = defaultProps.actions,
|
|
15
|
+
onClick,
|
|
16
|
+
children = defaultProps.children,
|
|
17
|
+
state = defaultProps.state
|
|
18
|
+
}) {
|
|
30
19
|
if (!items) {
|
|
31
20
|
return null;
|
|
32
21
|
}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
22
|
+
const {
|
|
23
|
+
label,
|
|
24
|
+
current
|
|
25
|
+
} = ariaAttr;
|
|
26
|
+
const indexItems = getIndexItems(items);
|
|
36
27
|
function renderActions() {
|
|
37
|
-
return /*#__PURE__*/(
|
|
28
|
+
return /*#__PURE__*/_jsx(Fragment, {
|
|
38
29
|
children: actions
|
|
39
30
|
}); // eslint-disable-line react/jsx-no-useless-fragment
|
|
40
31
|
}
|
|
41
|
-
return /*#__PURE__*/(
|
|
42
|
-
className: (
|
|
43
|
-
|
|
44
|
-
|
|
32
|
+
return /*#__PURE__*/_jsxs("div", {
|
|
33
|
+
className: cx(className, styles.tabnav, {
|
|
34
|
+
[styles['tabnav-inactive']]: state === tabNavState.inactive
|
|
35
|
+
}),
|
|
36
|
+
children: [actions && renderActions(), /*#__PURE__*/_jsx("nav", {
|
|
37
|
+
className: styles['tabnav-tabs'],
|
|
45
38
|
"aria-label": label,
|
|
46
|
-
children: indexItems.map(
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
39
|
+
children: indexItems.map(indexItem => {
|
|
40
|
+
const {
|
|
41
|
+
href,
|
|
42
|
+
text,
|
|
43
|
+
link,
|
|
44
|
+
isSelected,
|
|
45
|
+
enabled,
|
|
46
|
+
visible
|
|
47
|
+
} = indexItem;
|
|
48
|
+
const itemOtherProps = isSelected ? {
|
|
49
|
+
...{
|
|
50
|
+
'aria-current': current
|
|
51
|
+
}
|
|
52
|
+
} : null;
|
|
56
53
|
if (href && text) {
|
|
57
|
-
return /*#__PURE__*/(
|
|
58
|
-
onClick:
|
|
54
|
+
return /*#__PURE__*/_jsx("a", {
|
|
55
|
+
onClick: () => {
|
|
59
56
|
if (!enabled) {
|
|
60
57
|
return;
|
|
61
58
|
}
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
ariaAttr
|
|
65
|
-
items: newIndexItems.map(
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
};
|
|
77
|
-
}(newIndexItem);
|
|
78
|
-
} // eslint-disable-line
|
|
59
|
+
const newIndexItems = getIndexItemsWithSelected(indexItems, indexItem);
|
|
60
|
+
onClick({
|
|
61
|
+
ariaAttr,
|
|
62
|
+
items: newIndexItems.map(newIndexItem => (({
|
|
63
|
+
href,
|
|
64
|
+
text,
|
|
65
|
+
isSelected
|
|
66
|
+
}) => ({
|
|
67
|
+
href,
|
|
68
|
+
text,
|
|
69
|
+
isSelected,
|
|
70
|
+
enabled,
|
|
71
|
+
visible
|
|
72
|
+
}))(newIndexItem) // eslint-disable-line
|
|
79
73
|
)
|
|
80
74
|
});
|
|
81
75
|
},
|
|
82
|
-
className:
|
|
83
|
-
href: href
|
|
84
|
-
|
|
76
|
+
className: styles['tabnav-tab'],
|
|
77
|
+
href: href,
|
|
78
|
+
...itemOtherProps,
|
|
85
79
|
children: text
|
|
86
|
-
}
|
|
80
|
+
}, uuidv1());
|
|
87
81
|
}
|
|
88
82
|
if (link) {
|
|
89
|
-
|
|
90
|
-
return /*#__PURE__*/(
|
|
91
|
-
onClick:
|
|
83
|
+
const Link = link.component;
|
|
84
|
+
return /*#__PURE__*/_jsx(Link, {
|
|
85
|
+
onClick: () => {
|
|
92
86
|
if (!enabled) {
|
|
93
87
|
return;
|
|
94
88
|
}
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
ariaAttr
|
|
98
|
-
items: newIndexItems.map(
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
};
|
|
110
|
-
}(newIndexItem);
|
|
111
|
-
} // eslint-disable-line
|
|
89
|
+
const newIndexItems = getIndexItemsWithSelected(indexItems, indexItem);
|
|
90
|
+
onClick({
|
|
91
|
+
ariaAttr,
|
|
92
|
+
items: newIndexItems.map(newIndexItem => (({
|
|
93
|
+
link,
|
|
94
|
+
isSelected,
|
|
95
|
+
enabled,
|
|
96
|
+
visible
|
|
97
|
+
}) => ({
|
|
98
|
+
link,
|
|
99
|
+
isSelected,
|
|
100
|
+
enabled,
|
|
101
|
+
visible
|
|
102
|
+
}))(newIndexItem) // eslint-disable-line
|
|
112
103
|
)
|
|
113
104
|
});
|
|
114
105
|
},
|
|
115
|
-
className: (
|
|
116
|
-
|
|
106
|
+
className: cx(className, styles['tabnav-tab'], {
|
|
107
|
+
[styles['tabnav-tab-inactive']]: enabled === false,
|
|
108
|
+
[styles['tabnav-tab-hidden']]: visible === false
|
|
109
|
+
}),
|
|
110
|
+
...itemOtherProps,
|
|
111
|
+
...link.props,
|
|
117
112
|
children: link.children
|
|
118
|
-
}
|
|
113
|
+
}, uuidv1());
|
|
119
114
|
}
|
|
120
115
|
return null;
|
|
121
116
|
})
|
|
122
117
|
}), children]
|
|
123
118
|
});
|
|
124
119
|
}
|
|
125
|
-
TabNav.propTypes =
|
|
120
|
+
TabNav.propTypes = propTypes;
|
|
@@ -1,34 +1,28 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.tabNavState = exports.propTypes = exports.defaultProps = void 0;
|
|
7
|
-
var _propTypes = require("prop-types");
|
|
8
|
-
var tabNavState = exports.tabNavState = {
|
|
1
|
+
import { string, arrayOf, oneOf, shape, bool, node, func } from 'prop-types';
|
|
2
|
+
export const tabNavState = {
|
|
9
3
|
active: 'active',
|
|
10
4
|
inactive: 'inactive'
|
|
11
5
|
};
|
|
12
|
-
|
|
13
|
-
className:
|
|
14
|
-
ariaAttr:
|
|
15
|
-
label:
|
|
16
|
-
current:
|
|
6
|
+
export const propTypes = {
|
|
7
|
+
className: string,
|
|
8
|
+
ariaAttr: shape({
|
|
9
|
+
label: string,
|
|
10
|
+
current: string
|
|
17
11
|
}).isRequired,
|
|
18
|
-
items:
|
|
19
|
-
href:
|
|
20
|
-
text:
|
|
21
|
-
link:
|
|
22
|
-
isSelected:
|
|
23
|
-
enabled:
|
|
24
|
-
visible:
|
|
12
|
+
items: arrayOf(shape({
|
|
13
|
+
href: string,
|
|
14
|
+
text: string,
|
|
15
|
+
link: shape,
|
|
16
|
+
isSelected: bool,
|
|
17
|
+
enabled: bool,
|
|
18
|
+
visible: bool
|
|
25
19
|
})).isRequired,
|
|
26
|
-
actions:
|
|
27
|
-
onClick:
|
|
28
|
-
children:
|
|
29
|
-
state:
|
|
20
|
+
actions: arrayOf(node),
|
|
21
|
+
onClick: func.isRequired,
|
|
22
|
+
children: node,
|
|
23
|
+
state: oneOf(Object.keys(tabNavState))
|
|
30
24
|
};
|
|
31
|
-
|
|
25
|
+
export const defaultProps = {
|
|
32
26
|
className: null,
|
|
33
27
|
actions: null,
|
|
34
28
|
children: null,
|
|
@@ -1,19 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
Object.defineProperty(exports, "TabNav", {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: function get() {
|
|
9
|
-
return _TabNav.TabNav;
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
|
-
Object.defineProperty(exports, "tabNavState", {
|
|
13
|
-
enumerable: true,
|
|
14
|
-
get: function get() {
|
|
15
|
-
return _TabNav2.tabNavState;
|
|
16
|
-
}
|
|
17
|
-
});
|
|
18
|
-
var _TabNav = require("./TabNav");
|
|
19
|
-
var _TabNav2 = require("./TabNav.prop");
|
|
1
|
+
export { TabNav } from './TabNav';
|
|
2
|
+
export { tabNavState } from './TabNav.prop';
|
|
@@ -1,121 +1,117 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
actions = _ref$actions === void 0 ? _UnderlineNav.defaultProps.actions : _ref$actions,
|
|
30
|
-
_ref$align = _ref.align,
|
|
31
|
-
align = _ref$align === void 0 ? _UnderlineNav.defaultProps.align : _ref$align,
|
|
32
|
-
_ref$fullContainer = _ref.fullContainer,
|
|
33
|
-
fullContainer = _ref$fullContainer === void 0 ? _UnderlineNav.defaultProps.fullContainer : _ref$fullContainer,
|
|
34
|
-
_onClick = _ref.onClick;
|
|
35
|
-
var _useState = (0, _hooks.useState)((0, _array.getIndexItems)(items)),
|
|
36
|
-
_useState2 = (0, _slicedToArray2["default"])(_useState, 2),
|
|
37
|
-
indexItems = _useState2[0],
|
|
38
|
-
setIndexItems = _useState2[1];
|
|
39
|
-
var label = ariaAttr.label,
|
|
40
|
-
selected = ariaAttr.selected,
|
|
41
|
-
current = ariaAttr.current;
|
|
1
|
+
import "core-js/modules/es.iterator.constructor.js";
|
|
2
|
+
import "core-js/modules/es.iterator.map.js";
|
|
3
|
+
import { Fragment } from 'react';
|
|
4
|
+
import cx from 'classnames';
|
|
5
|
+
import { v1 as uuidv1 } from 'uuid';
|
|
6
|
+
import { getIndexItems, getIndexItemsWithSelected } from '@papillonbits/library/array';
|
|
7
|
+
import { useState } from '@papillonbits/library/hooks';
|
|
8
|
+
import { propTypes, defaultProps, underlineNavAlignmentType } from './UnderlineNav.prop';
|
|
9
|
+
import styles from './UnderlineNav.scss';
|
|
10
|
+
import containerStyles from '../../Layout/container.scss';
|
|
11
|
+
import { Icon, iconSize } from '../../Icon';
|
|
12
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
+
export function UnderlineNav({
|
|
14
|
+
className = defaultProps.className,
|
|
15
|
+
ariaAttr,
|
|
16
|
+
items,
|
|
17
|
+
itemType,
|
|
18
|
+
actions = defaultProps.actions,
|
|
19
|
+
align = defaultProps.align,
|
|
20
|
+
fullContainer = defaultProps.fullContainer,
|
|
21
|
+
onClick
|
|
22
|
+
}) {
|
|
23
|
+
const [indexItems, setIndexItems] = useState(getIndexItems(items));
|
|
24
|
+
const {
|
|
25
|
+
label,
|
|
26
|
+
selected,
|
|
27
|
+
current
|
|
28
|
+
} = ariaAttr;
|
|
42
29
|
function renderActions() {
|
|
43
|
-
return /*#__PURE__*/(
|
|
44
|
-
className:
|
|
30
|
+
return /*#__PURE__*/_jsx("div", {
|
|
31
|
+
className: styles['UnderlineNav-actions'],
|
|
45
32
|
children: actions
|
|
46
33
|
});
|
|
47
34
|
}
|
|
48
35
|
function renderBody() {
|
|
49
|
-
return /*#__PURE__*/(
|
|
50
|
-
children: [align ===
|
|
51
|
-
className:
|
|
36
|
+
return /*#__PURE__*/_jsxs(Fragment, {
|
|
37
|
+
children: [align === underlineNavAlignmentType.right && actions && renderActions(), /*#__PURE__*/_jsx("div", {
|
|
38
|
+
className: styles['UnderlineNav-body'],
|
|
52
39
|
role: "tablist",
|
|
53
|
-
children: indexItems.map(
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
40
|
+
children: indexItems.map(indexItem => {
|
|
41
|
+
const {
|
|
42
|
+
href,
|
|
43
|
+
icon,
|
|
44
|
+
text,
|
|
45
|
+
html,
|
|
46
|
+
isSelected
|
|
47
|
+
} = indexItem;
|
|
48
|
+
const anchorOtherProps = isSelected ? {
|
|
49
|
+
...{
|
|
50
|
+
'aria-selected': selected
|
|
51
|
+
}
|
|
52
|
+
} : null;
|
|
53
|
+
const buttonOtherProps = isSelected ? {
|
|
54
|
+
...{
|
|
55
|
+
'aria-current': current
|
|
56
|
+
}
|
|
57
|
+
} : null;
|
|
65
58
|
switch (itemType) {
|
|
66
59
|
case 'button':
|
|
67
|
-
return /*#__PURE__*/(
|
|
68
|
-
onClick:
|
|
60
|
+
return /*#__PURE__*/_jsxs("button", {
|
|
61
|
+
onClick: e => {
|
|
69
62
|
e.preventDefault();
|
|
70
|
-
|
|
63
|
+
const newIndexItems = getIndexItemsWithSelected(indexItems, indexItem);
|
|
71
64
|
setIndexItems(newIndexItems);
|
|
72
|
-
|
|
65
|
+
onClick(newIndexItems);
|
|
73
66
|
},
|
|
74
|
-
className:
|
|
67
|
+
className: styles['UnderlineNav-item'],
|
|
75
68
|
role: "tab",
|
|
76
69
|
type: "button",
|
|
77
|
-
href: href
|
|
78
|
-
|
|
79
|
-
children: [icon && /*#__PURE__*/(
|
|
80
|
-
className:
|
|
70
|
+
href: href,
|
|
71
|
+
...anchorOtherProps,
|
|
72
|
+
children: [icon && /*#__PURE__*/_jsx(Icon, {
|
|
73
|
+
className: styles['UnderlineNav-octicon'],
|
|
81
74
|
icon: icon,
|
|
82
|
-
size:
|
|
75
|
+
size: iconSize.small
|
|
83
76
|
}), html || null, text]
|
|
84
|
-
}
|
|
77
|
+
}, uuidv1());
|
|
85
78
|
case 'a':
|
|
86
|
-
return /*#__PURE__*/(
|
|
87
|
-
onClick:
|
|
79
|
+
return /*#__PURE__*/_jsxs("a", {
|
|
80
|
+
onClick: e => {
|
|
88
81
|
e.preventDefault();
|
|
89
|
-
|
|
82
|
+
const newIndexItems = getIndexItemsWithSelected(indexItems, indexItem);
|
|
90
83
|
setIndexItems(newIndexItems);
|
|
91
|
-
|
|
84
|
+
onClick(newIndexItems);
|
|
92
85
|
},
|
|
93
|
-
className:
|
|
94
|
-
href: href
|
|
95
|
-
|
|
96
|
-
children: [icon && /*#__PURE__*/(
|
|
97
|
-
className:
|
|
86
|
+
className: styles['UnderlineNav-item'],
|
|
87
|
+
href: href,
|
|
88
|
+
...buttonOtherProps,
|
|
89
|
+
children: [icon && /*#__PURE__*/_jsx(Icon, {
|
|
90
|
+
className: styles['UnderlineNav-octicon'],
|
|
98
91
|
icon: icon,
|
|
99
|
-
size:
|
|
92
|
+
size: iconSize.small
|
|
100
93
|
}), html || null, text]
|
|
101
|
-
}
|
|
94
|
+
}, uuidv1());
|
|
102
95
|
default:
|
|
103
96
|
return null;
|
|
104
97
|
}
|
|
105
98
|
})
|
|
106
|
-
}), align ===
|
|
99
|
+
}), align === underlineNavAlignmentType.left && actions && renderActions()]
|
|
107
100
|
});
|
|
108
101
|
}
|
|
109
102
|
function renderBodyFullContainer() {
|
|
110
|
-
return /*#__PURE__*/(
|
|
111
|
-
className: (
|
|
103
|
+
return /*#__PURE__*/_jsx("div", {
|
|
104
|
+
className: cx(containerStyles['container-lg'], styles['UnderlineNav-container']),
|
|
112
105
|
children: renderBody()
|
|
113
106
|
});
|
|
114
107
|
}
|
|
115
|
-
return /*#__PURE__*/(
|
|
116
|
-
className: (
|
|
108
|
+
return /*#__PURE__*/_jsxs("nav", {
|
|
109
|
+
className: cx(className, styles.UnderlineNav, {
|
|
110
|
+
[styles['UnderlineNav--right']]: align === underlineNavAlignmentType.right,
|
|
111
|
+
[styles['UnderlineNav--full']]: fullContainer === true
|
|
112
|
+
}),
|
|
117
113
|
"aria-label": label,
|
|
118
114
|
children: [fullContainer === false && renderBody(), fullContainer === true && renderBodyFullContainer()]
|
|
119
115
|
});
|
|
120
116
|
}
|
|
121
|
-
UnderlineNav.propTypes =
|
|
117
|
+
UnderlineNav.propTypes = propTypes;
|
|
@@ -1,39 +1,33 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.underlineNavItemType = exports.underlineNavAlignmentType = exports.propTypes = exports.defaultProps = void 0;
|
|
7
|
-
var _propTypes = require("prop-types");
|
|
8
|
-
var underlineNavItemType = exports.underlineNavItemType = {
|
|
1
|
+
import { string, node, arrayOf, shape, bool, oneOf, func } from 'prop-types';
|
|
2
|
+
export const underlineNavItemType = {
|
|
9
3
|
a: 'a',
|
|
10
4
|
button: 'button'
|
|
11
5
|
};
|
|
12
|
-
|
|
6
|
+
export const underlineNavAlignmentType = {
|
|
13
7
|
right: 'right',
|
|
14
8
|
left: 'left'
|
|
15
9
|
};
|
|
16
|
-
|
|
17
|
-
className:
|
|
18
|
-
ariaAttr:
|
|
19
|
-
label:
|
|
20
|
-
selected:
|
|
21
|
-
current:
|
|
10
|
+
export const propTypes = {
|
|
11
|
+
className: string,
|
|
12
|
+
ariaAttr: shape({
|
|
13
|
+
label: string,
|
|
14
|
+
selected: string,
|
|
15
|
+
current: string
|
|
22
16
|
}).isRequired,
|
|
23
|
-
items:
|
|
24
|
-
href:
|
|
25
|
-
icon:
|
|
26
|
-
text:
|
|
27
|
-
html:
|
|
28
|
-
isSelected:
|
|
17
|
+
items: arrayOf(shape({
|
|
18
|
+
href: string,
|
|
19
|
+
icon: string,
|
|
20
|
+
text: string,
|
|
21
|
+
html: node,
|
|
22
|
+
isSelected: bool
|
|
29
23
|
})).isRequired,
|
|
30
|
-
itemType:
|
|
31
|
-
actions:
|
|
32
|
-
align:
|
|
33
|
-
fullContainer:
|
|
34
|
-
onClick:
|
|
24
|
+
itemType: oneOf(Object.keys(underlineNavItemType)).isRequired,
|
|
25
|
+
actions: arrayOf(node),
|
|
26
|
+
align: oneOf(Object.keys(underlineNavAlignmentType)).isRequired,
|
|
27
|
+
fullContainer: bool,
|
|
28
|
+
onClick: func.isRequired
|
|
35
29
|
};
|
|
36
|
-
|
|
30
|
+
export const defaultProps = {
|
|
37
31
|
className: null,
|
|
38
32
|
actions: null,
|
|
39
33
|
align: 'left',
|
|
@@ -1,25 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
Object.defineProperty(exports, "UnderlineNav", {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: function get() {
|
|
9
|
-
return _UnderlineNav.UnderlineNav;
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
|
-
Object.defineProperty(exports, "underlineNavAlignmentType", {
|
|
13
|
-
enumerable: true,
|
|
14
|
-
get: function get() {
|
|
15
|
-
return _UnderlineNav2.underlineNavAlignmentType;
|
|
16
|
-
}
|
|
17
|
-
});
|
|
18
|
-
Object.defineProperty(exports, "underlineNavItemType", {
|
|
19
|
-
enumerable: true,
|
|
20
|
-
get: function get() {
|
|
21
|
-
return _UnderlineNav2.underlineNavItemType;
|
|
22
|
-
}
|
|
23
|
-
});
|
|
24
|
-
var _UnderlineNav = require("./UnderlineNav");
|
|
25
|
-
var _UnderlineNav2 = require("./UnderlineNav.prop");
|
|
1
|
+
export { UnderlineNav } from './UnderlineNav';
|
|
2
|
+
export { underlineNavItemType, underlineNavAlignmentType } from './UnderlineNav.prop';
|
|
@@ -1,17 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
Menu: _Menu.Menu,
|
|
12
|
-
TabNav: _TabNav.TabNav,
|
|
13
|
-
tabNavState: _TabNav.tabNavState,
|
|
14
|
-
UnderlineNav: _UnderlineNav.UnderlineNav,
|
|
15
|
-
underlineNavItemType: _UnderlineNav.underlineNavItemType,
|
|
16
|
-
underlineNavAlignmentType: _UnderlineNav.underlineNavAlignmentType
|
|
1
|
+
import { Menu } from './Menu';
|
|
2
|
+
import { TabNav, tabNavState } from './TabNav';
|
|
3
|
+
import { UnderlineNav, underlineNavItemType, underlineNavAlignmentType } from './UnderlineNav';
|
|
4
|
+
export const Navigation = {
|
|
5
|
+
Menu,
|
|
6
|
+
TabNav,
|
|
7
|
+
tabNavState,
|
|
8
|
+
UnderlineNav,
|
|
9
|
+
underlineNavItemType,
|
|
10
|
+
underlineNavAlignmentType
|
|
17
11
|
};
|