@carbon/react 1.5.0 → 1.7.0-rc.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/ComposedModal/ComposedModal.js +2 -1
- package/es/components/ComposedModal/next/ComposedModal.js +2 -1
- package/es/components/DataTable/TableToolbarSearch.js +10 -2
- package/es/components/DatePicker/DatePicker.js +14 -5
- package/es/components/FileUploader/FileUploader.js +1 -1
- package/es/components/FileUploader/FileUploaderButton.js +1 -1
- package/es/components/FileUploader/Filename.js +1 -1
- 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/Link/Link.js +6 -3
- package/es/components/ListBox/ListBoxPropTypes.js +1 -2
- package/es/components/ListBox/ListBoxSelection.js +3 -4
- package/es/components/OverflowMenu/OverflowMenu.js +0 -1
- package/es/components/Popover/index.js +137 -8
- package/es/components/RadioButton/next/RadioButton.js +2 -1
- package/es/components/Select/Select.js +14 -7
- package/es/components/Tabs/next/Tabs.js +42 -4
- package/es/components/Toggle/Toggle.js +147 -109
- 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/SideNav.js +3 -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 +13 -11
- package/lib/components/ComposedModal/ComposedModal.js +2 -1
- package/lib/components/ComposedModal/next/ComposedModal.js +2 -1
- package/lib/components/DataTable/TableToolbarSearch.js +10 -2
- package/lib/components/DatePicker/DatePicker.js +14 -5
- package/lib/components/FileUploader/FileUploader.js +1 -1
- package/lib/components/FileUploader/FileUploaderButton.js +1 -1
- package/lib/components/FileUploader/Filename.js +1 -1
- 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/Link/Link.js +6 -3
- package/lib/components/ListBox/ListBoxPropTypes.js +1 -21
- package/lib/components/ListBox/ListBoxSelection.js +3 -4
- package/lib/components/OverflowMenu/OverflowMenu.js +0 -1
- package/lib/components/Popover/index.js +135 -6
- package/lib/components/RadioButton/next/RadioButton.js +2 -1
- package/lib/components/Select/Select.js +14 -7
- package/lib/components/Tabs/next/Tabs.js +42 -4
- package/lib/components/Toggle/Toggle.js +146 -107
- 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/SideNav.js +3 -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 +86 -82
- package/package.json +3 -3
- package/es/components/Toggle/index.js +0 -19
- package/es/components/Toggle/next/Toggle.js +0 -158
- 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/Toggle/index.js +0 -23
- package/lib/components/Toggle/next/Toggle.js +0 -169
- 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
|
@@ -5,116 +5,154 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
import {
|
|
9
|
-
import PropTypes from 'prop-types';
|
|
8
|
+
import { objectWithoutProperties as _objectWithoutProperties, slicedToArray as _slicedToArray, defineProperty as _defineProperty, extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
|
10
9
|
import React__default from 'react';
|
|
10
|
+
import PropTypes from 'prop-types';
|
|
11
11
|
import cx from 'classnames';
|
|
12
|
-
import
|
|
13
|
-
import {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
var
|
|
18
|
-
|
|
19
|
-
var
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
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
|
-
|
|
54
|
-
|
|
55
|
-
var checkedProps = {};
|
|
56
|
-
|
|
57
|
-
if (typeof toggled !== 'undefined') {
|
|
58
|
-
checkedProps.checked = toggled;
|
|
59
|
-
} else {
|
|
60
|
-
checkedProps.defaultChecked = defaultToggled;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
return /*#__PURE__*/React__default.createElement("div", {
|
|
64
|
-
className: wrapperClasses
|
|
65
|
-
}, /*#__PURE__*/React__default.createElement("input", _extends({}, other, checkedProps, {
|
|
66
|
-
"aria-label": null,
|
|
67
|
-
type: "checkbox",
|
|
68
|
-
id: id,
|
|
69
|
-
className: toggleClasses,
|
|
70
|
-
onChange: function onChange(evt) {
|
|
71
|
-
_onChange && _onChange(evt);
|
|
72
|
-
onToggle(input.checked, id, evt);
|
|
73
|
-
},
|
|
74
|
-
ref: function ref(el) {
|
|
75
|
-
input = el;
|
|
76
|
-
},
|
|
77
|
-
onKeyUp: function onKeyUp(evt) {
|
|
78
|
-
if (match(evt, Enter)) {
|
|
79
|
-
input.checked = !input.checked;
|
|
80
|
-
_onChange && _onChange(evt);
|
|
81
|
-
onToggle(input.checked, id, evt);
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
})), /*#__PURE__*/React__default.createElement("label", {
|
|
85
|
-
className: "".concat(prefix, "--toggle-input__label"),
|
|
86
|
-
htmlFor: id,
|
|
87
|
-
"aria-label": typeof labelText === 'string' ? null : this.props['aria-label']
|
|
88
|
-
}, labelText, /*#__PURE__*/React__default.createElement("span", {
|
|
89
|
-
className: "".concat(prefix, "--toggle__switch")
|
|
90
|
-
}, size && /*#__PURE__*/React__default.createElement("svg", {
|
|
91
|
-
className: "".concat(prefix, "--toggle__check"),
|
|
92
|
-
width: "6px",
|
|
93
|
-
height: "5px",
|
|
94
|
-
viewBox: "0 0 6 5"
|
|
95
|
-
}, _path || (_path = /*#__PURE__*/React__default.createElement("path", {
|
|
96
|
-
d: "M2.2 2.7L5 0 6 1 2.2 5 0 2.7 1 1.5z"
|
|
97
|
-
}))), /*#__PURE__*/React__default.createElement("span", {
|
|
98
|
-
className: "".concat(prefix, "--toggle__text--off"),
|
|
99
|
-
"aria-hidden": "true"
|
|
100
|
-
}, labelA), /*#__PURE__*/React__default.createElement("span", {
|
|
101
|
-
className: "".concat(prefix, "--toggle__text--on"),
|
|
102
|
-
"aria-hidden": "true"
|
|
103
|
-
}, labelB))));
|
|
12
|
+
import { useControllableState } from '../../internal/useControllableState.js';
|
|
13
|
+
import { usePrefix } from '../../internal/usePrefix.js';
|
|
14
|
+
|
|
15
|
+
var _path;
|
|
16
|
+
|
|
17
|
+
var _excluded = ["className", "defaultToggled", "disabled", "hideLabel", "id", "labelA", "labelB", "labelText", "onClick", "onToggle", "size", "toggled"];
|
|
18
|
+
function Toggle(_ref) {
|
|
19
|
+
var className = _ref.className,
|
|
20
|
+
_ref$defaultToggled = _ref.defaultToggled,
|
|
21
|
+
defaultToggled = _ref$defaultToggled === void 0 ? false : _ref$defaultToggled,
|
|
22
|
+
_ref$disabled = _ref.disabled,
|
|
23
|
+
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
|
|
24
|
+
_ref$hideLabel = _ref.hideLabel,
|
|
25
|
+
hideLabel = _ref$hideLabel === void 0 ? false : _ref$hideLabel,
|
|
26
|
+
id = _ref.id,
|
|
27
|
+
_ref$labelA = _ref.labelA,
|
|
28
|
+
labelA = _ref$labelA === void 0 ? 'Off' : _ref$labelA,
|
|
29
|
+
_ref$labelB = _ref.labelB,
|
|
30
|
+
labelB = _ref$labelB === void 0 ? 'On' : _ref$labelB,
|
|
31
|
+
labelText = _ref.labelText,
|
|
32
|
+
onClick = _ref.onClick,
|
|
33
|
+
onToggle = _ref.onToggle,
|
|
34
|
+
_ref$size = _ref.size,
|
|
35
|
+
size = _ref$size === void 0 ? 'md' : _ref$size,
|
|
36
|
+
toggled = _ref.toggled,
|
|
37
|
+
other = _objectWithoutProperties(_ref, _excluded);
|
|
38
|
+
|
|
39
|
+
var prefix = usePrefix();
|
|
40
|
+
|
|
41
|
+
var _useControllableState = useControllableState({
|
|
42
|
+
value: toggled,
|
|
43
|
+
onChange: onToggle,
|
|
44
|
+
defaultValue: defaultToggled
|
|
45
|
+
}),
|
|
46
|
+
_useControllableState2 = _slicedToArray(_useControllableState, 2),
|
|
47
|
+
checked = _useControllableState2[0],
|
|
48
|
+
setChecked = _useControllableState2[1];
|
|
49
|
+
|
|
50
|
+
function handleClick(e) {
|
|
51
|
+
setChecked(!checked);
|
|
52
|
+
|
|
53
|
+
if (onClick) {
|
|
54
|
+
onClick(e);
|
|
104
55
|
}
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
return Toggle;
|
|
108
|
-
}(React__default.Component);
|
|
109
|
-
|
|
110
|
-
_defineProperty(Toggle, "propTypes", (_defineProperty2 = {}, _defineProperty(_defineProperty2, 'aria-label', PropTypes.string.isRequired), _defineProperty(_defineProperty2, "className", PropTypes.string), _defineProperty(_defineProperty2, "defaultToggled", PropTypes.bool), _defineProperty(_defineProperty2, "id", PropTypes.string.isRequired), _defineProperty(_defineProperty2, "labelA", PropTypes.node.isRequired), _defineProperty(_defineProperty2, "labelB", PropTypes.node.isRequired), _defineProperty(_defineProperty2, "labelText", PropTypes.node), _defineProperty(_defineProperty2, "onChange", PropTypes.func), _defineProperty(_defineProperty2, "onToggle", PropTypes.func), _defineProperty(_defineProperty2, "size", PropTypes.oneOf(['sm', 'md'])), _defineProperty(_defineProperty2, "toggled", PropTypes.bool), _defineProperty2));
|
|
111
|
-
|
|
112
|
-
_defineProperty(Toggle, "contextType", PrefixContext);
|
|
113
|
-
|
|
114
|
-
_defineProperty(Toggle, "defaultProps", (_defineProperty3 = {
|
|
115
|
-
defaultToggled: false
|
|
116
|
-
}, _defineProperty(_defineProperty3, 'aria-label', 'Toggle'), _defineProperty(_defineProperty3, "labelA", 'Off'), _defineProperty(_defineProperty3, "labelB", 'On'), _defineProperty(_defineProperty3, "onToggle", function onToggle() {}), _defineProperty3));
|
|
117
|
-
|
|
118
|
-
var ToggleClassic = Toggle;
|
|
56
|
+
}
|
|
119
57
|
|
|
120
|
-
|
|
58
|
+
var isSm = size === 'sm';
|
|
59
|
+
var sideLabel = hideLabel ? labelText : checked ? labelB : labelA;
|
|
60
|
+
var wrapperClasses = cx("".concat(prefix, "--toggle"), _defineProperty({}, "".concat(prefix, "--toggle--disabled"), disabled), className);
|
|
61
|
+
var labelTextClasses = cx("".concat(prefix, "--toggle__label-text"), _defineProperty({}, "".concat(prefix, "--visually-hidden"), hideLabel));
|
|
62
|
+
var appearanceClasses = cx("".concat(prefix, "--toggle__appearance"), _defineProperty({}, "".concat(prefix, "--toggle__appearance--sm"), isSm));
|
|
63
|
+
var switchClasses = cx("".concat(prefix, "--toggle__switch"), _defineProperty({}, "".concat(prefix, "--toggle__switch--checked"), checked));
|
|
64
|
+
return /*#__PURE__*/React__default.createElement("div", {
|
|
65
|
+
className: wrapperClasses
|
|
66
|
+
}, /*#__PURE__*/React__default.createElement("button", _extends({}, other, {
|
|
67
|
+
id: id,
|
|
68
|
+
className: "".concat(prefix, "--toggle__button"),
|
|
69
|
+
role: "switch",
|
|
70
|
+
type: "button",
|
|
71
|
+
"aria-checked": checked,
|
|
72
|
+
disabled: disabled,
|
|
73
|
+
onClick: handleClick
|
|
74
|
+
})), /*#__PURE__*/React__default.createElement("label", {
|
|
75
|
+
htmlFor: id,
|
|
76
|
+
className: "".concat(prefix, "--toggle__label")
|
|
77
|
+
}, /*#__PURE__*/React__default.createElement("span", {
|
|
78
|
+
className: labelTextClasses
|
|
79
|
+
}, labelText), /*#__PURE__*/React__default.createElement("div", {
|
|
80
|
+
className: appearanceClasses
|
|
81
|
+
}, /*#__PURE__*/React__default.createElement("div", {
|
|
82
|
+
className: switchClasses
|
|
83
|
+
}, isSm && /*#__PURE__*/React__default.createElement("svg", {
|
|
84
|
+
className: "".concat(prefix, "--toggle__check"),
|
|
85
|
+
width: "6px",
|
|
86
|
+
height: "5px",
|
|
87
|
+
viewBox: "0 0 6 5"
|
|
88
|
+
}, _path || (_path = /*#__PURE__*/React__default.createElement("path", {
|
|
89
|
+
d: "M2.2 2.7L5 0 6 1 2.2 5 0 2.7 1 1.5z"
|
|
90
|
+
})))), /*#__PURE__*/React__default.createElement("span", {
|
|
91
|
+
className: "".concat(prefix, "--toggle__text"),
|
|
92
|
+
"aria-hidden": "true"
|
|
93
|
+
}, sideLabel))));
|
|
94
|
+
}
|
|
95
|
+
Toggle.propTypes = {
|
|
96
|
+
/**
|
|
97
|
+
* Specify a custom className to apply to the form-item node
|
|
98
|
+
*/
|
|
99
|
+
className: PropTypes.string,
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Specify whether the toggle should be on by default
|
|
103
|
+
*/
|
|
104
|
+
defaultToggled: PropTypes.bool,
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Whether this control should be disabled
|
|
108
|
+
*/
|
|
109
|
+
disabled: PropTypes.bool,
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Specify whether the label should be hidden, or not
|
|
113
|
+
*/
|
|
114
|
+
hideLabel: PropTypes.bool,
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* Provide an id that unique represents the underlying `<button>`
|
|
118
|
+
*/
|
|
119
|
+
id: PropTypes.string.isRequired,
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* Specify the label for the "off" position
|
|
123
|
+
*/
|
|
124
|
+
labelA: PropTypes.node,
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* Specify the label for the "on" position
|
|
128
|
+
*/
|
|
129
|
+
labelB: PropTypes.node,
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* Provide the text that will be read by a screen reader when visiting this
|
|
133
|
+
* control
|
|
134
|
+
*/
|
|
135
|
+
labelText: PropTypes.node.isRequired,
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* Provide an event listener that is called when the control is clicked
|
|
139
|
+
*/
|
|
140
|
+
onClick: PropTypes.func,
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* Provide an event listener that is called when the control is toggled
|
|
144
|
+
*/
|
|
145
|
+
onToggle: PropTypes.func,
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* Specify the size of the Toggle. Currently only supports 'sm' or 'md' (default)
|
|
149
|
+
*/
|
|
150
|
+
size: PropTypes.oneOf(['sm', 'md']),
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* Specify whether the control is toggled
|
|
154
|
+
*/
|
|
155
|
+
toggled: PropTypes.bool
|
|
156
|
+
};
|
|
157
|
+
|
|
158
|
+
export { Toggle, Toggle as default };
|
|
@@ -163,7 +163,7 @@ var HeaderMenu = /*#__PURE__*/function (_React$Component) {
|
|
|
163
163
|
'aria-label': ariaLabel,
|
|
164
164
|
'aria-labelledby': ariaLabelledBy
|
|
165
165
|
};
|
|
166
|
-
var className = cx((_cx = {}, _defineProperty(_cx, "".concat(prefix, "--header__submenu"), true), _defineProperty(_cx,
|
|
166
|
+
var className = cx((_cx = {}, _defineProperty(_cx, "".concat(prefix, "--header__submenu"), true), _defineProperty(_cx, "".concat(prefix, "--header__submenu--current"), isCurrentPage), _defineProperty(_cx, customClassName, !!customClassName), _cx)); // Notes on eslint comments and based on the examples in:
|
|
167
167
|
// https://www.w3.org/TR/wai-aria-practices/examples/menubar/menubar-1/menubar-1.html#
|
|
168
168
|
// - The focus is handled by the <a> menuitem, onMouseOver is for mouse
|
|
169
169
|
// users
|
|
@@ -17,7 +17,7 @@ var _Menu, _Close;
|
|
|
17
17
|
|
|
18
18
|
var _excluded = ["aria-label", "aria-labelledby", "className", "renderMenuIcon", "renderCloseIcon", "onClick", "isActive", "isCollapsible"];
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
function HeaderMenuButton(_ref) {
|
|
21
21
|
var _cx;
|
|
22
22
|
|
|
23
23
|
var ariaLabel = _ref['aria-label'],
|
|
@@ -48,7 +48,7 @@ var HeaderMenuButton = function HeaderMenuButton(_ref) {
|
|
|
48
48
|
type: "button",
|
|
49
49
|
onClick: onClick
|
|
50
50
|
}), isActive ? closeIcon : menuIcon);
|
|
51
|
-
}
|
|
51
|
+
}
|
|
52
52
|
|
|
53
53
|
HeaderMenuButton.propTypes = _objectSpread2(_objectSpread2({}, AriaLabelPropType), {}, {
|
|
54
54
|
/**
|
|
@@ -64,6 +64,5 @@ HeaderMenuButton.propTypes = _objectSpread2(_objectSpread2({}, AriaLabelPropType
|
|
|
64
64
|
*/
|
|
65
65
|
onClick: PropTypes.func
|
|
66
66
|
});
|
|
67
|
-
var HeaderMenuButton$1 = HeaderMenuButton;
|
|
68
67
|
|
|
69
|
-
export { HeaderMenuButton
|
|
68
|
+
export { HeaderMenuButton as default };
|
|
@@ -14,7 +14,7 @@ import { usePrefix } from '../../internal/usePrefix.js';
|
|
|
14
14
|
|
|
15
15
|
var _excluded = ["children", "className", "prefix", "href"];
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
function HeaderName(_ref) {
|
|
18
18
|
var children = _ref.children,
|
|
19
19
|
customClassName = _ref.className,
|
|
20
20
|
prefix = _ref.prefix,
|
|
@@ -29,7 +29,7 @@ var HeaderName = function HeaderName(_ref) {
|
|
|
29
29
|
}), prefix && /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("span", {
|
|
30
30
|
className: "".concat(selectorPrefix, "--header__name--prefix")
|
|
31
31
|
}, prefix), "\xA0"), children);
|
|
32
|
-
}
|
|
32
|
+
}
|
|
33
33
|
|
|
34
34
|
HeaderName.propTypes = _objectSpread2(_objectSpread2({}, LinkPropTypes), {}, {
|
|
35
35
|
/**
|
|
@@ -57,6 +57,5 @@ HeaderName.propTypes = _objectSpread2(_objectSpread2({}, LinkPropTypes), {}, {
|
|
|
57
57
|
HeaderName.defaultProps = {
|
|
58
58
|
prefix: 'IBM'
|
|
59
59
|
};
|
|
60
|
-
var HeaderName$1 = HeaderName;
|
|
61
60
|
|
|
62
|
-
export { HeaderName
|
|
61
|
+
export { HeaderName as default };
|
|
@@ -5,84 +5,38 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
import {
|
|
8
|
+
import { objectWithoutProperties as _objectWithoutProperties, extends as _extends, objectSpread2 as _objectSpread2 } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
|
9
9
|
import cx from 'classnames';
|
|
10
10
|
import React__default from 'react';
|
|
11
11
|
import PropTypes from 'prop-types';
|
|
12
12
|
import { AriaLabelPropType } from '../../prop-types/AriaPropTypes.js';
|
|
13
|
-
import {
|
|
13
|
+
import { usePrefix } from '../../internal/usePrefix.js';
|
|
14
14
|
|
|
15
15
|
var _excluded = ["aria-label", "aria-labelledby", "children", "className"];
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
}
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
_this.items = [];
|
|
44
|
-
_this.state = {
|
|
45
|
-
selectedIndex: 0
|
|
46
|
-
};
|
|
47
|
-
return _this;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
_createClass(HeaderNavigation, [{
|
|
51
|
-
key: "render",
|
|
52
|
-
value: function render() {
|
|
53
|
-
var prefix = this.context;
|
|
54
|
-
|
|
55
|
-
var _this$props = this.props,
|
|
56
|
-
ariaLabel = _this$props['aria-label'],
|
|
57
|
-
ariaLabelledBy = _this$props['aria-labelledby'],
|
|
58
|
-
children = _this$props.children,
|
|
59
|
-
customClassName = _this$props.className,
|
|
60
|
-
rest = _objectWithoutProperties(_this$props, _excluded);
|
|
61
|
-
|
|
62
|
-
var className = cx("".concat(prefix, "--header__nav"), customClassName); // Assign both label strategies in this option, only one should be defined
|
|
63
|
-
// so when we spread that should be the one that is applied to the node
|
|
64
|
-
|
|
65
|
-
var accessibilityLabel = {
|
|
66
|
-
'aria-label': ariaLabel,
|
|
67
|
-
'aria-labelledby': ariaLabelledBy
|
|
68
|
-
};
|
|
69
|
-
return /*#__PURE__*/React__default.createElement("nav", _extends({}, rest, accessibilityLabel, {
|
|
70
|
-
className: className
|
|
71
|
-
}), /*#__PURE__*/React__default.createElement("ul", _extends({}, accessibilityLabel, {
|
|
72
|
-
className: "".concat(prefix, "--header__menu-bar")
|
|
73
|
-
}), React__default.Children.map(children, this._renderNavItem)));
|
|
74
|
-
}
|
|
75
|
-
/**
|
|
76
|
-
* Render an individual menuitem, adding a `ref` for each child inside of
|
|
77
|
-
* `this.items` to properly manage focus.
|
|
78
|
-
*/
|
|
79
|
-
|
|
80
|
-
}]);
|
|
81
|
-
|
|
82
|
-
return HeaderNavigation;
|
|
83
|
-
}(React__default.Component);
|
|
84
|
-
|
|
85
|
-
_defineProperty(HeaderNavigation, "propTypes", _objectSpread2(_objectSpread2({}, AriaLabelPropType), {}, {
|
|
17
|
+
function HeaderNavigation(props) {
|
|
18
|
+
var ariaLabel = props['aria-label'],
|
|
19
|
+
ariaLabelledBy = props['aria-labelledby'],
|
|
20
|
+
children = props.children,
|
|
21
|
+
customClassName = props.className,
|
|
22
|
+
rest = _objectWithoutProperties(props, _excluded);
|
|
23
|
+
|
|
24
|
+
var prefix = usePrefix();
|
|
25
|
+
var className = cx("".concat(prefix, "--header__nav"), customClassName); // Assign both label strategies in this option, only one should be defined
|
|
26
|
+
// so when we spread that should be the one that is applied to the node
|
|
27
|
+
|
|
28
|
+
var accessibilityLabel = {
|
|
29
|
+
'aria-label': ariaLabel,
|
|
30
|
+
'aria-labelledby': ariaLabelledBy
|
|
31
|
+
};
|
|
32
|
+
return /*#__PURE__*/React__default.createElement("nav", _extends({}, rest, accessibilityLabel, {
|
|
33
|
+
className: className
|
|
34
|
+
}), /*#__PURE__*/React__default.createElement("ul", {
|
|
35
|
+
className: "".concat(prefix, "--header__menu-bar")
|
|
36
|
+
}, children));
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
HeaderNavigation.propTypes = _objectSpread2(_objectSpread2({}, AriaLabelPropType), {}, {
|
|
86
40
|
/**
|
|
87
41
|
* Provide valid children of HeaderNavigation, for example `HeaderMenuItem`
|
|
88
42
|
* or `HeaderMenu`
|
|
@@ -93,8 +47,6 @@ _defineProperty(HeaderNavigation, "propTypes", _objectSpread2(_objectSpread2({},
|
|
|
93
47
|
* Optionally provide a custom class to apply to the underlying <nav> node
|
|
94
48
|
*/
|
|
95
49
|
className: PropTypes.string
|
|
96
|
-
})
|
|
97
|
-
|
|
98
|
-
_defineProperty(HeaderNavigation, "contextType", PrefixContext);
|
|
50
|
+
});
|
|
99
51
|
|
|
100
|
-
export { HeaderNavigation
|
|
52
|
+
export { HeaderNavigation };
|
|
@@ -212,15 +212,15 @@ SideNav.propTypes = _objectSpread2(_objectSpread2({}, AriaLabelPropType), {}, {
|
|
|
212
212
|
* @param {object} event
|
|
213
213
|
* @param {boolean} value
|
|
214
214
|
*/
|
|
215
|
-
onToggle: PropTypes.func
|
|
216
|
-
|
|
215
|
+
onToggle: PropTypes.func
|
|
217
216
|
/**
|
|
218
217
|
* Provide a custom function for translating all message ids within this
|
|
219
218
|
* component. This function will take in two arguments: the mesasge Id and the
|
|
220
219
|
* state of the component. From this, you should return a string representing
|
|
221
220
|
* the label you want displayed or read by screen readers.
|
|
222
221
|
*/
|
|
223
|
-
translateById: PropTypes.func
|
|
222
|
+
// translateById: PropTypes.func,
|
|
223
|
+
|
|
224
224
|
});
|
|
225
225
|
var SideNav$1 = SideNav;
|
|
226
226
|
|
|
@@ -18,7 +18,7 @@ var _Close, _ChevronRight;
|
|
|
18
18
|
* user interaction to expand or collapse the side navigation.
|
|
19
19
|
*/
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
function SideNavFooter(_ref) {
|
|
22
22
|
var assistiveText = _ref.assistiveText,
|
|
23
23
|
customClassName = _ref.className,
|
|
24
24
|
expanded = _ref.expanded,
|
|
@@ -43,7 +43,7 @@ var SideNavFooter = function SideNavFooter(_ref) {
|
|
|
43
43
|
}))), /*#__PURE__*/React__default.createElement("span", {
|
|
44
44
|
className: "".concat(prefix, "--assistive-text")
|
|
45
45
|
}, assistiveText)));
|
|
46
|
-
}
|
|
46
|
+
}
|
|
47
47
|
|
|
48
48
|
SideNavFooter.propTypes = {
|
|
49
49
|
/**
|
|
@@ -58,12 +58,6 @@ SideNavFooter.propTypes = {
|
|
|
58
58
|
*/
|
|
59
59
|
expanded: PropTypes.bool.isRequired,
|
|
60
60
|
|
|
61
|
-
/**
|
|
62
|
-
* Property to indicate if the side nav container is open (or not). Use to
|
|
63
|
-
* keep local state and styling in step with the SideNav expansion state.
|
|
64
|
-
*/
|
|
65
|
-
isSideNavExpanded: PropTypes.bool,
|
|
66
|
-
|
|
67
61
|
/**
|
|
68
62
|
* Provide a function that is called when the toggle button is interacted
|
|
69
63
|
* with. Useful for controlling the expansion state of the side navigation.
|
|
@@ -73,6 +67,5 @@ SideNavFooter.propTypes = {
|
|
|
73
67
|
SideNavFooter.defaultProps = {
|
|
74
68
|
assistiveText: 'Toggle opening or closing the side navigation'
|
|
75
69
|
};
|
|
76
|
-
var SideNavFooter$1 = SideNavFooter;
|
|
77
70
|
|
|
78
|
-
export { SideNavFooter
|
|
71
|
+
export { SideNavFooter as default };
|
|
@@ -11,7 +11,7 @@ import PropTypes from 'prop-types';
|
|
|
11
11
|
import React__default from 'react';
|
|
12
12
|
import { usePrefix } from '../../internal/usePrefix.js';
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
function SideNavIcon(_ref) {
|
|
15
15
|
var _cx;
|
|
16
16
|
|
|
17
17
|
var children = _ref.children,
|
|
@@ -22,7 +22,7 @@ var SideNavIcon = function SideNavIcon(_ref) {
|
|
|
22
22
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
23
23
|
className: className
|
|
24
24
|
}, children);
|
|
25
|
-
}
|
|
25
|
+
}
|
|
26
26
|
|
|
27
27
|
SideNavIcon.propTypes = {
|
|
28
28
|
/**
|
|
@@ -44,6 +44,5 @@ SideNavIcon.propTypes = {
|
|
|
44
44
|
SideNavIcon.defaultProps = {
|
|
45
45
|
small: false
|
|
46
46
|
};
|
|
47
|
-
var SideNavIcon$1 = SideNavIcon;
|
|
48
47
|
|
|
49
|
-
export { SideNavIcon
|
|
48
|
+
export { SideNavIcon as default };
|
|
@@ -11,7 +11,7 @@ import PropTypes from 'prop-types';
|
|
|
11
11
|
import React__default from 'react';
|
|
12
12
|
import { usePrefix } from '../../internal/usePrefix.js';
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
function SideNavItem(_ref) {
|
|
15
15
|
var _cx;
|
|
16
16
|
|
|
17
17
|
var customClassName = _ref.className,
|
|
@@ -23,11 +23,11 @@ var SideNavItem = function SideNavItem(_ref) {
|
|
|
23
23
|
return /*#__PURE__*/React__default.createElement("li", {
|
|
24
24
|
className: className
|
|
25
25
|
}, children);
|
|
26
|
-
}
|
|
26
|
+
}
|
|
27
27
|
|
|
28
28
|
SideNavItem.propTypes = {
|
|
29
29
|
/**
|
|
30
|
-
* Provide a single icon as the child to `
|
|
30
|
+
* Provide a single icon as the child to `SideNavItem` to render in the
|
|
31
31
|
* container
|
|
32
32
|
*/
|
|
33
33
|
children: PropTypes.node.isRequired,
|
|
@@ -42,6 +42,5 @@ SideNavItem.propTypes = {
|
|
|
42
42
|
*/
|
|
43
43
|
large: PropTypes.bool
|
|
44
44
|
};
|
|
45
|
-
var SideNavItem$1 = SideNavItem;
|
|
46
45
|
|
|
47
|
-
export { SideNavItem
|
|
46
|
+
export { SideNavItem as default };
|
|
@@ -49,12 +49,6 @@ SideNavLink.propTypes = _objectSpread2(_objectSpread2({}, LinkPropTypes), {}, {
|
|
|
49
49
|
*/
|
|
50
50
|
className: PropTypes.string,
|
|
51
51
|
|
|
52
|
-
/**
|
|
53
|
-
* Property to indicate if the side nav container is open (or not). Use to
|
|
54
|
-
* keep local state and styling in step with the SideNav expansion state.
|
|
55
|
-
*/
|
|
56
|
-
isSideNavExpanded: PropTypes.bool,
|
|
57
|
-
|
|
58
52
|
/**
|
|
59
53
|
* Specify if this is a large variation of the SideNavLink
|
|
60
54
|
*/
|
|
@@ -13,7 +13,7 @@ import { usePrefix } from '../../internal/usePrefix.js';
|
|
|
13
13
|
|
|
14
14
|
var _excluded = ["className", "children"];
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
function SideNavLinkText(_ref) {
|
|
17
17
|
var customClassName = _ref.className,
|
|
18
18
|
children = _ref.children,
|
|
19
19
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
@@ -23,7 +23,7 @@ var SideNavLinkText = function SideNavLinkText(_ref) {
|
|
|
23
23
|
return /*#__PURE__*/React__default.createElement("span", _extends({}, rest, {
|
|
24
24
|
className: className
|
|
25
25
|
}), children);
|
|
26
|
-
}
|
|
26
|
+
}
|
|
27
27
|
|
|
28
28
|
SideNavLinkText.propTypes = {
|
|
29
29
|
/**
|
|
@@ -36,6 +36,5 @@ SideNavLinkText.propTypes = {
|
|
|
36
36
|
*/
|
|
37
37
|
className: PropTypes.string
|
|
38
38
|
};
|
|
39
|
-
var SideNavLinkText$1 = SideNavLinkText;
|
|
40
39
|
|
|
41
|
-
export { SideNavLinkText
|
|
40
|
+
export { SideNavLinkText as default };
|