@carbon/react 1.6.0-rc.0 → 1.7.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/es/components/DataTable/TableToolbarSearch.js +10 -2
- package/es/components/Form/Form.js +1 -1
- package/es/components/FormGroup/FormGroup.js +4 -4
- package/es/components/FormItem/FormItem.js +5 -6
- package/es/components/Layer/index.js +13 -1
- package/es/components/MultiSelect/next/FilterableMultiSelect.js +3 -1
- package/es/components/OverflowMenu/OverflowMenu.js +0 -1
- package/es/components/Popover/index.js +137 -8
- package/es/components/ProgressBar/ProgressBar.js +6 -3
- package/es/components/Select/Select.js +14 -7
- package/es/components/UIShell/HeaderMenu.js +1 -1
- package/es/components/UIShell/HeaderMenuButton.js +3 -4
- package/es/components/UIShell/HeaderName.js +3 -4
- package/es/components/UIShell/HeaderNavigation.js +27 -75
- package/es/components/UIShell/SideNavDetails.js +8 -3
- package/es/components/UIShell/SideNavFooter.js +3 -10
- package/es/components/UIShell/SideNavIcon.js +3 -4
- package/es/components/UIShell/SideNavItem.js +4 -5
- package/es/components/UIShell/SideNavLink.js +0 -6
- package/es/components/UIShell/SideNavLinkText.js +3 -4
- package/es/components/UIShell/SideNavMenu.js +93 -131
- package/es/components/UIShell/SideNavSwitcher.js +4 -2
- package/es/components/UIShell/SkipToContent.js +3 -4
- package/es/index.js +10 -9
- package/lib/components/DataTable/TableToolbarSearch.js +10 -2
- package/lib/components/Form/Form.js +1 -1
- package/lib/components/FormGroup/FormGroup.js +4 -4
- package/lib/components/FormItem/FormItem.js +5 -6
- package/lib/components/Layer/index.js +13 -0
- package/lib/components/MultiSelect/next/FilterableMultiSelect.js +3 -1
- package/lib/components/OverflowMenu/OverflowMenu.js +0 -1
- package/lib/components/Popover/index.js +135 -6
- package/lib/components/ProgressBar/ProgressBar.js +6 -3
- package/lib/components/Select/Select.js +14 -7
- package/lib/components/UIShell/HeaderMenu.js +1 -1
- package/lib/components/UIShell/HeaderMenuButton.js +3 -4
- package/lib/components/UIShell/HeaderName.js +3 -4
- package/lib/components/UIShell/HeaderNavigation.js +25 -73
- package/lib/components/UIShell/SideNavDetails.js +8 -3
- package/lib/components/UIShell/SideNavFooter.js +3 -10
- package/lib/components/UIShell/SideNavIcon.js +3 -4
- package/lib/components/UIShell/SideNavItem.js +4 -5
- package/lib/components/UIShell/SideNavLink.js +0 -6
- package/lib/components/UIShell/SideNavLinkText.js +3 -4
- package/lib/components/UIShell/SideNavMenu.js +89 -128
- package/lib/components/UIShell/SideNavSwitcher.js +4 -2
- package/lib/components/UIShell/SkipToContent.js +3 -4
- package/lib/index.js +42 -40
- package/package.json +4 -4
- package/es/components/UIShell/index.js +0 -17
- package/es/components/UIShell/next/HeaderNavigation.js +0 -52
- package/es/components/UIShell/next/SideNavMenu.js +0 -160
- package/lib/components/UIShell/index.js +0 -42
- package/lib/components/UIShell/next/HeaderNavigation.js +0 -62
- package/lib/components/UIShell/next/SideNavMenu.js +0 -170
|
@@ -13,6 +13,8 @@ var _rollupPluginBabelHelpers = require('../../_virtual/_rollupPluginBabelHelper
|
|
|
13
13
|
var cx = require('classnames');
|
|
14
14
|
var PropTypes = require('prop-types');
|
|
15
15
|
var React = require('react');
|
|
16
|
+
var useIsomorphicEffect = require('../../internal/useIsomorphicEffect.js');
|
|
17
|
+
var useMergedRefs = require('../../internal/useMergedRefs.js');
|
|
16
18
|
var usePrefix = require('../../internal/usePrefix.js');
|
|
17
19
|
|
|
18
20
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
@@ -21,15 +23,22 @@ var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
|
|
|
21
23
|
var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
|
|
22
24
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
23
25
|
|
|
24
|
-
var _excluded = ["align", "as", "caret", "className", "children", "dropShadow", "highContrast", "open"],
|
|
26
|
+
var _excluded = ["align", "as", "autoAlign", "caret", "className", "children", "dropShadow", "highContrast", "open"],
|
|
25
27
|
_excluded2 = ["className", "children"];
|
|
26
|
-
var
|
|
28
|
+
var PopoverContext = /*#__PURE__*/React__default["default"].createContext({
|
|
29
|
+
floating: {
|
|
30
|
+
current: null
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
var Popover = /*#__PURE__*/React__default["default"].forwardRef(function Popover(props, forwardRef) {
|
|
27
34
|
var _cx;
|
|
28
35
|
|
|
29
36
|
var _props$align = props.align,
|
|
30
37
|
align = _props$align === void 0 ? 'bottom' : _props$align,
|
|
31
38
|
_props$as = props.as,
|
|
32
39
|
BaseComponent = _props$as === void 0 ? 'span' : _props$as,
|
|
40
|
+
_props$autoAlign = props.autoAlign,
|
|
41
|
+
autoAlign = _props$autoAlign === void 0 ? false : _props$autoAlign,
|
|
33
42
|
_props$caret = props.caret,
|
|
34
43
|
caret = _props$caret === void 0 ? true : _props$caret,
|
|
35
44
|
customClassName = props.className,
|
|
@@ -42,11 +51,121 @@ var Popover = /*#__PURE__*/React__default["default"].forwardRef(function Popover
|
|
|
42
51
|
rest = _rollupPluginBabelHelpers.objectWithoutProperties(props, _excluded);
|
|
43
52
|
|
|
44
53
|
var prefix = usePrefix.usePrefix();
|
|
45
|
-
var
|
|
46
|
-
|
|
54
|
+
var floating = React.useRef();
|
|
55
|
+
var popover = React.useRef();
|
|
56
|
+
var value = React.useMemo(function () {
|
|
57
|
+
return {
|
|
58
|
+
floating: floating
|
|
59
|
+
};
|
|
60
|
+
}, []);
|
|
61
|
+
var ref = useMergedRefs.useMergedRefs([forwardRef, popover]);
|
|
62
|
+
|
|
63
|
+
var _useState = React.useState(false),
|
|
64
|
+
_useState2 = _rollupPluginBabelHelpers.slicedToArray(_useState, 2),
|
|
65
|
+
autoAligned = _useState2[0],
|
|
66
|
+
setAutoAligned = _useState2[1];
|
|
67
|
+
|
|
68
|
+
var _useState3 = React.useState(align),
|
|
69
|
+
_useState4 = _rollupPluginBabelHelpers.slicedToArray(_useState3, 2),
|
|
70
|
+
autoAlignment = _useState4[0],
|
|
71
|
+
setAutoAlignment = _useState4[1];
|
|
72
|
+
|
|
73
|
+
var className = cx__default["default"]((_cx = {}, _rollupPluginBabelHelpers.defineProperty(_cx, "".concat(prefix, "--popover-container"), true), _rollupPluginBabelHelpers.defineProperty(_cx, "".concat(prefix, "--popover--caret"), caret), _rollupPluginBabelHelpers.defineProperty(_cx, "".concat(prefix, "--popover--drop-shadow"), dropShadow), _rollupPluginBabelHelpers.defineProperty(_cx, "".concat(prefix, "--popover--high-contrast"), highContrast), _rollupPluginBabelHelpers.defineProperty(_cx, "".concat(prefix, "--popover--open"), open), _rollupPluginBabelHelpers.defineProperty(_cx, "".concat(prefix, "--popover--").concat(autoAlignment), autoAligned), _rollupPluginBabelHelpers.defineProperty(_cx, "".concat(prefix, "--popover--").concat(align), !autoAligned), _rollupPluginBabelHelpers.defineProperty(_cx, customClassName, !!customClassName), _cx));
|
|
74
|
+
useIsomorphicEffect["default"](function () {
|
|
75
|
+
if (!autoAlign) {
|
|
76
|
+
setAutoAligned(false);
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
if (!floating.current) {
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
if (autoAligned === true) {
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
var rect = floating.current.getBoundingClientRect(); // The conditions, per side, of when the popover is not visible, excluding the popover's internal padding(16)
|
|
89
|
+
|
|
90
|
+
var conditions = {
|
|
91
|
+
left: rect.x < -16,
|
|
92
|
+
top: rect.y < -16,
|
|
93
|
+
right: rect.x + (rect.width - 16) > document.documentElement.clientWidth,
|
|
94
|
+
bottom: rect.y + (rect.height - 16) > document.documentElement.clientHeight
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
if (!conditions.left && !conditions.top && !conditions.right && !conditions.bottom) {
|
|
98
|
+
setAutoAligned(false);
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
var alignments = ['top', 'top-left', 'right-bottom', 'right', 'right-top', 'bottom-left', 'bottom', 'bottom-right', 'left-top', 'left', 'left-bottom', 'top-right']; // Creates the prioritized list of options depending on ideal alignment coming from `align`
|
|
103
|
+
|
|
104
|
+
var options = [align];
|
|
105
|
+
var option = alignments[(alignments.indexOf(align) + 1) % alignments.length];
|
|
106
|
+
|
|
107
|
+
while (option) {
|
|
108
|
+
if (options.includes(option)) {
|
|
109
|
+
break;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
options.push(option);
|
|
113
|
+
option = alignments[(alignments.indexOf(option) + 1) % alignments.length];
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
function isVisible(alignment) {
|
|
117
|
+
popover.current.classList.add("".concat(prefix, "--popover--").concat(alignment));
|
|
118
|
+
var rect = floating.current.getBoundingClientRect(); // Check if popover is not visible to the left of the screen
|
|
119
|
+
|
|
120
|
+
if (rect.x < -16) {
|
|
121
|
+
popover.current.classList.remove("".concat(prefix, "--popover--").concat(alignment));
|
|
122
|
+
return false;
|
|
123
|
+
} // Check if popover is not visible at the top of the screen
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
if (rect.y < -16) {
|
|
127
|
+
popover.current.classList.remove("".concat(prefix, "--popover--").concat(alignment));
|
|
128
|
+
return false;
|
|
129
|
+
} // Check if popover is not visible to right of screen
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
if (rect.x + (rect.width - 16) > document.documentElement.clientWidth) {
|
|
133
|
+
popover.current.classList.remove("".concat(prefix, "--popover--").concat(alignment));
|
|
134
|
+
return false;
|
|
135
|
+
} // Check if popover is not visible to bottom of screen
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
if (rect.y + (rect.height - 16) > document.documentElement.clientHeight) {
|
|
139
|
+
popover.current.classList.remove("".concat(prefix, "--popover--").concat(alignment));
|
|
140
|
+
return false;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
popover.current.classList.remove("".concat(prefix, "--popover--").concat(alignment));
|
|
144
|
+
return true;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
var alignment = null;
|
|
148
|
+
|
|
149
|
+
for (var i = 0; i < options.length; i++) {
|
|
150
|
+
var _option = options[i];
|
|
151
|
+
|
|
152
|
+
if (isVisible(_option)) {
|
|
153
|
+
alignment = _option;
|
|
154
|
+
break;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
if (alignment) {
|
|
159
|
+
setAutoAligned(true);
|
|
160
|
+
setAutoAlignment(alignment);
|
|
161
|
+
}
|
|
162
|
+
}, [autoAligned, align, autoAlign, prefix]);
|
|
163
|
+
return /*#__PURE__*/React__default["default"].createElement(PopoverContext.Provider, {
|
|
164
|
+
value: value
|
|
165
|
+
}, /*#__PURE__*/React__default["default"].createElement(BaseComponent, _rollupPluginBabelHelpers["extends"]({}, rest, {
|
|
47
166
|
className: className,
|
|
48
167
|
ref: ref
|
|
49
|
-
}), children);
|
|
168
|
+
}), children));
|
|
50
169
|
}); // Note: this displayName is temporarily set so that Storybook ArgTable
|
|
51
170
|
// correctly displays the name of this component
|
|
52
171
|
|
|
@@ -66,6 +185,11 @@ Popover.propTypes = {
|
|
|
66
185
|
*/
|
|
67
186
|
as: PropTypes__default["default"].oneOfType([PropTypes__default["default"].string, PropTypes__default["default"].elementType]),
|
|
68
187
|
|
|
188
|
+
/**
|
|
189
|
+
* Will auto-align the popover on first render if it is not visible. This prop is currently experimental and is subject to futurue changes.
|
|
190
|
+
*/
|
|
191
|
+
autoAlign: PropTypes__default["default"].bool,
|
|
192
|
+
|
|
69
193
|
/**
|
|
70
194
|
* Specify whether a caret should be rendered
|
|
71
195
|
*/
|
|
@@ -97,12 +221,17 @@ Popover.propTypes = {
|
|
|
97
221
|
*/
|
|
98
222
|
open: PropTypes__default["default"].bool.isRequired
|
|
99
223
|
};
|
|
100
|
-
var PopoverContent = /*#__PURE__*/React__default["default"].forwardRef(function PopoverContent(_ref,
|
|
224
|
+
var PopoverContent = /*#__PURE__*/React__default["default"].forwardRef(function PopoverContent(_ref, forwardRef) {
|
|
101
225
|
var className = _ref.className,
|
|
102
226
|
children = _ref.children,
|
|
103
227
|
rest = _rollupPluginBabelHelpers.objectWithoutProperties(_ref, _excluded2);
|
|
104
228
|
|
|
105
229
|
var prefix = usePrefix.usePrefix();
|
|
230
|
+
|
|
231
|
+
var _React$useContext = React__default["default"].useContext(PopoverContext),
|
|
232
|
+
floating = _React$useContext.floating;
|
|
233
|
+
|
|
234
|
+
var ref = useMergedRefs.useMergedRefs([floating, forwardRef]);
|
|
106
235
|
return /*#__PURE__*/React__default["default"].createElement("span", _rollupPluginBabelHelpers["extends"]({}, rest, {
|
|
107
236
|
className: "".concat(prefix, "--popover")
|
|
108
237
|
}), /*#__PURE__*/React__default["default"].createElement("span", {
|
|
@@ -94,9 +94,9 @@ function ProgressBar(_ref) {
|
|
|
94
94
|
})), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
95
95
|
className: "".concat(prefix, "--progress-bar__track"),
|
|
96
96
|
role: "progressbar",
|
|
97
|
+
"aria-busy": !isFinished,
|
|
97
98
|
"aria-invalid": isError,
|
|
98
99
|
"aria-labelledby": labelId,
|
|
99
|
-
"aria-describedby": helperText ? helperId : null,
|
|
100
100
|
"aria-valuemin": !indeterminate ? 0 : null,
|
|
101
101
|
"aria-valuemax": !indeterminate ? max : null,
|
|
102
102
|
"aria-valuenow": !indeterminate ? cappedValue : null
|
|
@@ -106,9 +106,12 @@ function ProgressBar(_ref) {
|
|
|
106
106
|
transform: "scaleX(".concat(percentage, ")")
|
|
107
107
|
} : null
|
|
108
108
|
})), helperText && /*#__PURE__*/React__default["default"].createElement("div", {
|
|
109
|
-
id: helperId,
|
|
110
109
|
className: "".concat(prefix, "--progress-bar__helper-text")
|
|
111
|
-
}, helperText
|
|
110
|
+
}, helperText, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
111
|
+
className: "".concat(prefix, "--visually-hidden"),
|
|
112
|
+
"aria-live": "polite",
|
|
113
|
+
id: helperId
|
|
114
|
+
}, isFinished ? 'Done' : 'Loading')));
|
|
112
115
|
}
|
|
113
116
|
|
|
114
117
|
ProgressBar.propTypes = {
|
|
@@ -30,18 +30,25 @@ var Select = /*#__PURE__*/React__default["default"].forwardRef(function Select(_
|
|
|
30
30
|
|
|
31
31
|
var className = _ref.className,
|
|
32
32
|
id = _ref.id,
|
|
33
|
-
inline = _ref.inline,
|
|
33
|
+
_ref$inline = _ref.inline,
|
|
34
|
+
inline = _ref$inline === void 0 ? false : _ref$inline,
|
|
34
35
|
labelText = _ref.labelText,
|
|
35
|
-
disabled = _ref.disabled,
|
|
36
|
+
_ref$disabled = _ref.disabled,
|
|
37
|
+
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
|
|
36
38
|
children = _ref.children,
|
|
37
|
-
noLabel = _ref.noLabel,
|
|
38
|
-
|
|
39
|
-
|
|
39
|
+
_ref$noLabel = _ref.noLabel,
|
|
40
|
+
noLabel = _ref$noLabel === void 0 ? false : _ref$noLabel,
|
|
41
|
+
_ref$hideLabel = _ref.hideLabel,
|
|
42
|
+
hideLabel = _ref$hideLabel === void 0 ? false : _ref$hideLabel,
|
|
43
|
+
_ref$invalid = _ref.invalid,
|
|
44
|
+
invalid = _ref$invalid === void 0 ? false : _ref$invalid,
|
|
40
45
|
invalidText = _ref.invalidText,
|
|
41
46
|
helperText = _ref.helperText,
|
|
42
|
-
light = _ref.light,
|
|
47
|
+
_ref$light = _ref.light,
|
|
48
|
+
light = _ref$light === void 0 ? false : _ref$light,
|
|
43
49
|
size = _ref.size,
|
|
44
|
-
warn = _ref.warn,
|
|
50
|
+
_ref$warn = _ref.warn,
|
|
51
|
+
warn = _ref$warn === void 0 ? false : _ref$warn,
|
|
45
52
|
warnText = _ref.warnText,
|
|
46
53
|
other = _rollupPluginBabelHelpers.objectWithoutProperties(_ref, _excluded);
|
|
47
54
|
|
|
@@ -173,7 +173,7 @@ var HeaderMenu = /*#__PURE__*/function (_React$Component) {
|
|
|
173
173
|
'aria-label': ariaLabel,
|
|
174
174
|
'aria-labelledby': ariaLabelledBy
|
|
175
175
|
};
|
|
176
|
-
var className = cx__default["default"]((_cx = {}, _rollupPluginBabelHelpers.defineProperty(_cx, "".concat(prefix, "--header__submenu"), true), _rollupPluginBabelHelpers.defineProperty(_cx,
|
|
176
|
+
var className = cx__default["default"]((_cx = {}, _rollupPluginBabelHelpers.defineProperty(_cx, "".concat(prefix, "--header__submenu"), true), _rollupPluginBabelHelpers.defineProperty(_cx, "".concat(prefix, "--header__submenu--current"), isCurrentPage), _rollupPluginBabelHelpers.defineProperty(_cx, customClassName, !!customClassName), _cx)); // Notes on eslint comments and based on the examples in:
|
|
177
177
|
// https://www.w3.org/TR/wai-aria-practices/examples/menubar/menubar-1/menubar-1.html#
|
|
178
178
|
// - The focus is handled by the <a> menuitem, onMouseOver is for mouse
|
|
179
179
|
// users
|
|
@@ -27,7 +27,7 @@ var _Menu, _Close;
|
|
|
27
27
|
|
|
28
28
|
var _excluded = ["aria-label", "aria-labelledby", "className", "renderMenuIcon", "renderCloseIcon", "onClick", "isActive", "isCollapsible"];
|
|
29
29
|
|
|
30
|
-
|
|
30
|
+
function HeaderMenuButton(_ref) {
|
|
31
31
|
var _cx;
|
|
32
32
|
|
|
33
33
|
var ariaLabel = _ref['aria-label'],
|
|
@@ -58,7 +58,7 @@ var HeaderMenuButton = function HeaderMenuButton(_ref) {
|
|
|
58
58
|
type: "button",
|
|
59
59
|
onClick: onClick
|
|
60
60
|
}), isActive ? closeIcon : menuIcon);
|
|
61
|
-
}
|
|
61
|
+
}
|
|
62
62
|
|
|
63
63
|
HeaderMenuButton.propTypes = _rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({}, AriaPropTypes.AriaLabelPropType), {}, {
|
|
64
64
|
/**
|
|
@@ -74,6 +74,5 @@ HeaderMenuButton.propTypes = _rollupPluginBabelHelpers.objectSpread2(_rollupPlug
|
|
|
74
74
|
*/
|
|
75
75
|
onClick: PropTypes__default["default"].func
|
|
76
76
|
});
|
|
77
|
-
var HeaderMenuButton$1 = HeaderMenuButton;
|
|
78
77
|
|
|
79
|
-
exports["default"] = HeaderMenuButton
|
|
78
|
+
exports["default"] = HeaderMenuButton;
|
|
@@ -24,7 +24,7 @@ var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
|
|
|
24
24
|
|
|
25
25
|
var _excluded = ["children", "className", "prefix", "href"];
|
|
26
26
|
|
|
27
|
-
|
|
27
|
+
function HeaderName(_ref) {
|
|
28
28
|
var children = _ref.children,
|
|
29
29
|
customClassName = _ref.className,
|
|
30
30
|
prefix = _ref.prefix,
|
|
@@ -39,7 +39,7 @@ var HeaderName = function HeaderName(_ref) {
|
|
|
39
39
|
}), prefix && /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement("span", {
|
|
40
40
|
className: "".concat(selectorPrefix, "--header__name--prefix")
|
|
41
41
|
}, prefix), "\xA0"), children);
|
|
42
|
-
}
|
|
42
|
+
}
|
|
43
43
|
|
|
44
44
|
HeaderName.propTypes = _rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({}, Link.LinkPropTypes), {}, {
|
|
45
45
|
/**
|
|
@@ -67,6 +67,5 @@ HeaderName.propTypes = _rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabe
|
|
|
67
67
|
HeaderName.defaultProps = {
|
|
68
68
|
prefix: 'IBM'
|
|
69
69
|
};
|
|
70
|
-
var HeaderName$1 = HeaderName;
|
|
71
70
|
|
|
72
|
-
exports["default"] = HeaderName
|
|
71
|
+
exports["default"] = HeaderName;
|
|
@@ -24,75 +24,29 @@ var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
|
|
|
24
24
|
|
|
25
25
|
var _excluded = ["aria-label", "aria-labelledby", "children", "className"];
|
|
26
26
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
}
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
_this.items = [];
|
|
54
|
-
_this.state = {
|
|
55
|
-
selectedIndex: 0
|
|
56
|
-
};
|
|
57
|
-
return _this;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
_rollupPluginBabelHelpers.createClass(HeaderNavigation, [{
|
|
61
|
-
key: "render",
|
|
62
|
-
value: function render() {
|
|
63
|
-
var prefix = this.context;
|
|
64
|
-
|
|
65
|
-
var _this$props = this.props,
|
|
66
|
-
ariaLabel = _this$props['aria-label'],
|
|
67
|
-
ariaLabelledBy = _this$props['aria-labelledby'],
|
|
68
|
-
children = _this$props.children,
|
|
69
|
-
customClassName = _this$props.className,
|
|
70
|
-
rest = _rollupPluginBabelHelpers.objectWithoutProperties(_this$props, _excluded);
|
|
71
|
-
|
|
72
|
-
var className = cx__default["default"]("".concat(prefix, "--header__nav"), customClassName); // Assign both label strategies in this option, only one should be defined
|
|
73
|
-
// so when we spread that should be the one that is applied to the node
|
|
74
|
-
|
|
75
|
-
var accessibilityLabel = {
|
|
76
|
-
'aria-label': ariaLabel,
|
|
77
|
-
'aria-labelledby': ariaLabelledBy
|
|
78
|
-
};
|
|
79
|
-
return /*#__PURE__*/React__default["default"].createElement("nav", _rollupPluginBabelHelpers["extends"]({}, rest, accessibilityLabel, {
|
|
80
|
-
className: className
|
|
81
|
-
}), /*#__PURE__*/React__default["default"].createElement("ul", _rollupPluginBabelHelpers["extends"]({}, accessibilityLabel, {
|
|
82
|
-
className: "".concat(prefix, "--header__menu-bar")
|
|
83
|
-
}), React__default["default"].Children.map(children, this._renderNavItem)));
|
|
84
|
-
}
|
|
85
|
-
/**
|
|
86
|
-
* Render an individual menuitem, adding a `ref` for each child inside of
|
|
87
|
-
* `this.items` to properly manage focus.
|
|
88
|
-
*/
|
|
89
|
-
|
|
90
|
-
}]);
|
|
91
|
-
|
|
92
|
-
return HeaderNavigation;
|
|
93
|
-
}(React__default["default"].Component);
|
|
94
|
-
|
|
95
|
-
_rollupPluginBabelHelpers.defineProperty(HeaderNavigation, "propTypes", _rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({}, AriaPropTypes.AriaLabelPropType), {}, {
|
|
27
|
+
function HeaderNavigation(props) {
|
|
28
|
+
var ariaLabel = props['aria-label'],
|
|
29
|
+
ariaLabelledBy = props['aria-labelledby'],
|
|
30
|
+
children = props.children,
|
|
31
|
+
customClassName = props.className,
|
|
32
|
+
rest = _rollupPluginBabelHelpers.objectWithoutProperties(props, _excluded);
|
|
33
|
+
|
|
34
|
+
var prefix = usePrefix.usePrefix();
|
|
35
|
+
var className = cx__default["default"]("".concat(prefix, "--header__nav"), customClassName); // Assign both label strategies in this option, only one should be defined
|
|
36
|
+
// so when we spread that should be the one that is applied to the node
|
|
37
|
+
|
|
38
|
+
var accessibilityLabel = {
|
|
39
|
+
'aria-label': ariaLabel,
|
|
40
|
+
'aria-labelledby': ariaLabelledBy
|
|
41
|
+
};
|
|
42
|
+
return /*#__PURE__*/React__default["default"].createElement("nav", _rollupPluginBabelHelpers["extends"]({}, rest, accessibilityLabel, {
|
|
43
|
+
className: className
|
|
44
|
+
}), /*#__PURE__*/React__default["default"].createElement("ul", {
|
|
45
|
+
className: "".concat(prefix, "--header__menu-bar")
|
|
46
|
+
}, children));
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
HeaderNavigation.propTypes = _rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({}, AriaPropTypes.AriaLabelPropType), {}, {
|
|
96
50
|
/**
|
|
97
51
|
* Provide valid children of HeaderNavigation, for example `HeaderMenuItem`
|
|
98
52
|
* or `HeaderMenu`
|
|
@@ -103,8 +57,6 @@ _rollupPluginBabelHelpers.defineProperty(HeaderNavigation, "propTypes", _rollupP
|
|
|
103
57
|
* Optionally provide a custom class to apply to the underlying <nav> node
|
|
104
58
|
*/
|
|
105
59
|
className: PropTypes__default["default"].string
|
|
106
|
-
})
|
|
107
|
-
|
|
108
|
-
_rollupPluginBabelHelpers.defineProperty(HeaderNavigation, "contextType", usePrefix.PrefixContext);
|
|
60
|
+
});
|
|
109
61
|
|
|
110
|
-
exports
|
|
62
|
+
exports.HeaderNavigation = HeaderNavigation;
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
|
|
10
10
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
11
11
|
|
|
12
|
+
var _rollupPluginBabelHelpers = require('../../_virtual/_rollupPluginBabelHelpers.js');
|
|
12
13
|
var cx = require('classnames');
|
|
13
14
|
var PropTypes = require('prop-types');
|
|
14
15
|
var React = require('react');
|
|
@@ -20,15 +21,19 @@ var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
|
|
|
20
21
|
var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
|
|
21
22
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
22
23
|
|
|
24
|
+
var _excluded = ["children", "className", "title"];
|
|
25
|
+
|
|
23
26
|
var SideNavDetails = function SideNavDetails(_ref) {
|
|
24
27
|
var children = _ref.children,
|
|
25
28
|
customClassName = _ref.className,
|
|
26
|
-
title = _ref.title
|
|
29
|
+
title = _ref.title,
|
|
30
|
+
rest = _rollupPluginBabelHelpers.objectWithoutProperties(_ref, _excluded);
|
|
31
|
+
|
|
27
32
|
var prefix = usePrefix.usePrefix();
|
|
28
33
|
var className = cx__default["default"]("".concat(prefix, "--side-nav__details"), customClassName);
|
|
29
|
-
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
34
|
+
return /*#__PURE__*/React__default["default"].createElement("div", _rollupPluginBabelHelpers["extends"]({
|
|
30
35
|
className: className
|
|
31
|
-
}, /*#__PURE__*/React__default["default"].createElement("h2", {
|
|
36
|
+
}, rest), /*#__PURE__*/React__default["default"].createElement("h2", {
|
|
32
37
|
className: "".concat(prefix, "--side-nav__title"),
|
|
33
38
|
title: title
|
|
34
39
|
}, title), children);
|
|
@@ -28,7 +28,7 @@ var _Close, _ChevronRight;
|
|
|
28
28
|
* user interaction to expand or collapse the side navigation.
|
|
29
29
|
*/
|
|
30
30
|
|
|
31
|
-
|
|
31
|
+
function SideNavFooter(_ref) {
|
|
32
32
|
var assistiveText = _ref.assistiveText,
|
|
33
33
|
customClassName = _ref.className,
|
|
34
34
|
expanded = _ref.expanded,
|
|
@@ -53,7 +53,7 @@ var SideNavFooter = function SideNavFooter(_ref) {
|
|
|
53
53
|
}))), /*#__PURE__*/React__default["default"].createElement("span", {
|
|
54
54
|
className: "".concat(prefix, "--assistive-text")
|
|
55
55
|
}, assistiveText)));
|
|
56
|
-
}
|
|
56
|
+
}
|
|
57
57
|
|
|
58
58
|
SideNavFooter.propTypes = {
|
|
59
59
|
/**
|
|
@@ -68,12 +68,6 @@ SideNavFooter.propTypes = {
|
|
|
68
68
|
*/
|
|
69
69
|
expanded: PropTypes__default["default"].bool.isRequired,
|
|
70
70
|
|
|
71
|
-
/**
|
|
72
|
-
* Property to indicate if the side nav container is open (or not). Use to
|
|
73
|
-
* keep local state and styling in step with the SideNav expansion state.
|
|
74
|
-
*/
|
|
75
|
-
isSideNavExpanded: PropTypes__default["default"].bool,
|
|
76
|
-
|
|
77
71
|
/**
|
|
78
72
|
* Provide a function that is called when the toggle button is interacted
|
|
79
73
|
* with. Useful for controlling the expansion state of the side navigation.
|
|
@@ -83,6 +77,5 @@ SideNavFooter.propTypes = {
|
|
|
83
77
|
SideNavFooter.defaultProps = {
|
|
84
78
|
assistiveText: 'Toggle opening or closing the side navigation'
|
|
85
79
|
};
|
|
86
|
-
var SideNavFooter$1 = SideNavFooter;
|
|
87
80
|
|
|
88
|
-
exports["default"] = SideNavFooter
|
|
81
|
+
exports["default"] = SideNavFooter;
|
|
@@ -21,7 +21,7 @@ var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
|
|
|
21
21
|
var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
|
|
22
22
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
function SideNavIcon(_ref) {
|
|
25
25
|
var _cx;
|
|
26
26
|
|
|
27
27
|
var children = _ref.children,
|
|
@@ -32,7 +32,7 @@ var SideNavIcon = function SideNavIcon(_ref) {
|
|
|
32
32
|
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
33
33
|
className: className
|
|
34
34
|
}, children);
|
|
35
|
-
}
|
|
35
|
+
}
|
|
36
36
|
|
|
37
37
|
SideNavIcon.propTypes = {
|
|
38
38
|
/**
|
|
@@ -54,6 +54,5 @@ SideNavIcon.propTypes = {
|
|
|
54
54
|
SideNavIcon.defaultProps = {
|
|
55
55
|
small: false
|
|
56
56
|
};
|
|
57
|
-
var SideNavIcon$1 = SideNavIcon;
|
|
58
57
|
|
|
59
|
-
exports["default"] = SideNavIcon
|
|
58
|
+
exports["default"] = SideNavIcon;
|
|
@@ -21,7 +21,7 @@ var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
|
|
|
21
21
|
var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
|
|
22
22
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
function SideNavItem(_ref) {
|
|
25
25
|
var _cx;
|
|
26
26
|
|
|
27
27
|
var customClassName = _ref.className,
|
|
@@ -33,11 +33,11 @@ var SideNavItem = function SideNavItem(_ref) {
|
|
|
33
33
|
return /*#__PURE__*/React__default["default"].createElement("li", {
|
|
34
34
|
className: className
|
|
35
35
|
}, children);
|
|
36
|
-
}
|
|
36
|
+
}
|
|
37
37
|
|
|
38
38
|
SideNavItem.propTypes = {
|
|
39
39
|
/**
|
|
40
|
-
* Provide a single icon as the child to `
|
|
40
|
+
* Provide a single icon as the child to `SideNavItem` to render in the
|
|
41
41
|
* container
|
|
42
42
|
*/
|
|
43
43
|
children: PropTypes__default["default"].node.isRequired,
|
|
@@ -52,6 +52,5 @@ SideNavItem.propTypes = {
|
|
|
52
52
|
*/
|
|
53
53
|
large: PropTypes__default["default"].bool
|
|
54
54
|
};
|
|
55
|
-
var SideNavItem$1 = SideNavItem;
|
|
56
55
|
|
|
57
|
-
exports["default"] = SideNavItem
|
|
56
|
+
exports["default"] = SideNavItem;
|
|
@@ -59,12 +59,6 @@ SideNavLink.propTypes = _rollupPluginBabelHelpers.objectSpread2(_rollupPluginBab
|
|
|
59
59
|
*/
|
|
60
60
|
className: PropTypes__default["default"].string,
|
|
61
61
|
|
|
62
|
-
/**
|
|
63
|
-
* Property to indicate if the side nav container is open (or not). Use to
|
|
64
|
-
* keep local state and styling in step with the SideNav expansion state.
|
|
65
|
-
*/
|
|
66
|
-
isSideNavExpanded: PropTypes__default["default"].bool,
|
|
67
|
-
|
|
68
62
|
/**
|
|
69
63
|
* Specify if this is a large variation of the SideNavLink
|
|
70
64
|
*/
|
|
@@ -23,7 +23,7 @@ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
|
23
23
|
|
|
24
24
|
var _excluded = ["className", "children"];
|
|
25
25
|
|
|
26
|
-
|
|
26
|
+
function SideNavLinkText(_ref) {
|
|
27
27
|
var customClassName = _ref.className,
|
|
28
28
|
children = _ref.children,
|
|
29
29
|
rest = _rollupPluginBabelHelpers.objectWithoutProperties(_ref, _excluded);
|
|
@@ -33,7 +33,7 @@ var SideNavLinkText = function SideNavLinkText(_ref) {
|
|
|
33
33
|
return /*#__PURE__*/React__default["default"].createElement("span", _rollupPluginBabelHelpers["extends"]({}, rest, {
|
|
34
34
|
className: className
|
|
35
35
|
}), children);
|
|
36
|
-
}
|
|
36
|
+
}
|
|
37
37
|
|
|
38
38
|
SideNavLinkText.propTypes = {
|
|
39
39
|
/**
|
|
@@ -46,6 +46,5 @@ SideNavLinkText.propTypes = {
|
|
|
46
46
|
*/
|
|
47
47
|
className: PropTypes__default["default"].string
|
|
48
48
|
};
|
|
49
|
-
var SideNavLinkText$1 = SideNavLinkText;
|
|
50
49
|
|
|
51
|
-
exports["default"] = SideNavLinkText
|
|
50
|
+
exports["default"] = SideNavLinkText;
|