@instructure/ui-top-nav-bar 8.33.1 → 8.33.2
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/CHANGELOG.md +4 -0
- package/es/TopNavBar/TopNavBarActionItems/TopNavBarActionItemsLocator.js +4 -2
- package/es/TopNavBar/TopNavBarActionItems/index.js +10 -35
- package/es/TopNavBar/TopNavBarActionItems/props.js +1 -0
- package/es/TopNavBar/TopNavBarActionItems/styles.js +0 -1
- package/es/TopNavBar/TopNavBarActionItems/theme.js +4 -4
- package/es/TopNavBar/TopNavBarBrand/TopNavBarBrandLocator.js +3 -5
- package/es/TopNavBar/TopNavBarBrand/index.js +6 -17
- package/es/TopNavBar/TopNavBarBrand/props.js +1 -0
- package/es/TopNavBar/TopNavBarBrand/styles.js +1 -2
- package/es/TopNavBar/TopNavBarBrand/theme.js +2 -2
- package/es/TopNavBar/TopNavBarContext.js +1 -1
- package/es/TopNavBar/TopNavBarItem/TopNavBarItemLocator.js +12 -15
- package/es/TopNavBar/TopNavBarItem/index.js +49 -136
- package/es/TopNavBar/TopNavBarItem/props.js +1 -0
- package/es/TopNavBar/TopNavBarItem/styles.js +5 -6
- package/es/TopNavBar/TopNavBarItem/theme.js +5 -5
- package/es/TopNavBar/TopNavBarLayout/DesktopLayout/TopNavBarDesktopLayoutLocator.js +3 -6
- package/es/TopNavBar/TopNavBarLayout/DesktopLayout/index.js +6 -20
- package/es/TopNavBar/TopNavBarLayout/DesktopLayout/props.js +5 -2
- package/es/TopNavBar/TopNavBarLayout/DesktopLayout/styles.js +3 -4
- package/es/TopNavBar/TopNavBarLayout/DesktopLayout/theme.js +6 -6
- package/es/TopNavBar/TopNavBarLayout/SmallViewportLayout/TopNavBarSmallViewportLayoutLocator.js +8 -16
- package/es/TopNavBar/TopNavBarLayout/SmallViewportLayout/index.js +25 -83
- package/es/TopNavBar/TopNavBarLayout/SmallViewportLayout/props.js +5 -2
- package/es/TopNavBar/TopNavBarLayout/SmallViewportLayout/styles.js +4 -5
- package/es/TopNavBar/TopNavBarLayout/SmallViewportLayout/theme.js +6 -6
- package/es/TopNavBar/TopNavBarLayout/TopNavBarLayoutLocator.js +3 -1
- package/es/TopNavBar/TopNavBarLayout/index.js +8 -19
- package/es/TopNavBar/TopNavBarLayout/props.js +3 -1
- package/es/TopNavBar/TopNavBarLayout/theme.js +6 -4
- package/es/TopNavBar/TopNavBarLocator.js +2 -1
- package/es/TopNavBar/TopNavBarMenuItems/TopNavBarMenuItemsLocator.js +4 -4
- package/es/TopNavBar/TopNavBarMenuItems/index.js +9 -35
- package/es/TopNavBar/TopNavBarMenuItems/props.js +1 -0
- package/es/TopNavBar/TopNavBarMenuItems/styles.js +0 -1
- package/es/TopNavBar/TopNavBarMenuItems/theme.js +3 -3
- package/es/TopNavBar/TopNavBarUser/TopNavBarUserLocator.js +3 -1
- package/es/TopNavBar/TopNavBarUser/index.js +2 -18
- package/es/TopNavBar/TopNavBarUser/props.js +1 -0
- package/es/TopNavBar/TopNavBarUser/styles.js +0 -1
- package/es/TopNavBar/index.js +4 -12
- package/es/TopNavBar/props.js +1 -0
- package/es/TopNavBar/utils/exampleHelpers.js +9 -17
- package/es/TopNavBar/utils/exampleSvgFiles.js +1 -4
- package/es/TopNavBar/utils/mapItemsForDrilldown.js +16 -25
- package/es/index.js +1 -0
- package/lib/TopNavBar/TopNavBarActionItems/TopNavBarActionItemsLocator.js +3 -6
- package/lib/TopNavBar/TopNavBarActionItems/index.js +10 -55
- package/lib/TopNavBar/TopNavBarActionItems/props.js +1 -6
- package/lib/TopNavBar/TopNavBarActionItems/styles.js +0 -2
- package/lib/TopNavBar/TopNavBarActionItems/theme.js +4 -5
- package/lib/TopNavBar/TopNavBarBrand/TopNavBarBrandLocator.js +1 -8
- package/lib/TopNavBar/TopNavBarBrand/index.js +6 -30
- package/lib/TopNavBar/TopNavBarBrand/props.js +1 -3
- package/lib/TopNavBar/TopNavBarBrand/styles.js +1 -3
- package/lib/TopNavBar/TopNavBarBrand/theme.js +2 -3
- package/lib/TopNavBar/TopNavBarContext.js +0 -2
- package/lib/TopNavBar/TopNavBarItem/TopNavBarItemLocator.js +5 -15
- package/lib/TopNavBar/TopNavBarItem/index.js +49 -162
- package/lib/TopNavBar/TopNavBarItem/props.js +1 -6
- package/lib/TopNavBar/TopNavBarItem/styles.js +5 -7
- package/lib/TopNavBar/TopNavBarItem/theme.js +5 -6
- package/lib/TopNavBar/TopNavBarLayout/DesktopLayout/TopNavBarDesktopLayoutLocator.js +3 -15
- package/lib/TopNavBar/TopNavBarLayout/DesktopLayout/index.js +6 -30
- package/lib/TopNavBar/TopNavBarLayout/DesktopLayout/props.js +5 -4
- package/lib/TopNavBar/TopNavBarLayout/DesktopLayout/styles.js +3 -5
- package/lib/TopNavBar/TopNavBarLayout/DesktopLayout/theme.js +6 -7
- package/lib/TopNavBar/TopNavBarLayout/SmallViewportLayout/TopNavBarSmallViewportLayoutLocator.js +5 -21
- package/lib/TopNavBar/TopNavBarLayout/SmallViewportLayout/index.js +25 -111
- package/lib/TopNavBar/TopNavBarLayout/SmallViewportLayout/props.js +5 -4
- package/lib/TopNavBar/TopNavBarLayout/SmallViewportLayout/styles.js +4 -6
- package/lib/TopNavBar/TopNavBarLayout/SmallViewportLayout/theme.js +6 -7
- package/lib/TopNavBar/TopNavBarLayout/TopNavBarLayoutLocator.js +1 -5
- package/lib/TopNavBar/TopNavBarLayout/index.js +8 -30
- package/lib/TopNavBar/TopNavBarLayout/props.js +3 -11
- package/lib/TopNavBar/TopNavBarLayout/theme.js +4 -7
- package/lib/TopNavBar/TopNavBarLocator.js +1 -3
- package/lib/TopNavBar/TopNavBarMenuItems/TopNavBarMenuItemsLocator.js +1 -7
- package/lib/TopNavBar/TopNavBarMenuItems/index.js +9 -52
- package/lib/TopNavBar/TopNavBarMenuItems/props.js +1 -5
- package/lib/TopNavBar/TopNavBarMenuItems/styles.js +0 -2
- package/lib/TopNavBar/TopNavBarMenuItems/theme.js +3 -4
- package/lib/TopNavBar/TopNavBarUser/TopNavBarUserLocator.js +1 -3
- package/lib/TopNavBar/TopNavBarUser/index.js +2 -29
- package/lib/TopNavBar/TopNavBarUser/props.js +1 -5
- package/lib/TopNavBar/TopNavBarUser/styles.js +0 -2
- package/lib/TopNavBar/index.js +3 -27
- package/lib/TopNavBar/props.js +1 -3
- package/lib/TopNavBar/utils/exampleHelpers.js +9 -39
- package/lib/TopNavBar/utils/exampleSvgFiles.js +0 -6
- package/lib/TopNavBar/utils/mapItemsForDrilldown.js +16 -37
- package/lib/index.js +0 -1
- package/package.json +27 -27
- package/tsconfig.build.tsbuildinfo +1 -1
|
@@ -1,34 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.itemSubmenuExample = exports.getUser = exports.getMenuItems = exports.getLayoutProps = exports.getInPlaceDialogConfig = exports.getCustomPopoverContent = exports.getCustomPopoverConfig = exports.getBrand = exports.getActionItems = exports.avatarExample = exports.SmallViewportModeWrapper = void 0;
|
|
9
|
-
|
|
10
8
|
var _react = _interopRequireDefault(require("react"));
|
|
11
|
-
|
|
12
9
|
var _Drilldown = require("@instructure/ui-drilldown/lib/Drilldown");
|
|
13
|
-
|
|
14
10
|
var _IconQuestionLine = require("@instructure/ui-icons/lib/IconQuestionLine.js");
|
|
15
|
-
|
|
16
11
|
var _IconAlertsLine = require("@instructure/ui-icons/lib/IconAlertsLine.js");
|
|
17
|
-
|
|
18
12
|
var _IconConfigureLine = require("@instructure/ui-icons/lib/IconConfigureLine.js");
|
|
19
|
-
|
|
20
13
|
var _IconSearchLine = require("@instructure/ui-icons/lib/IconSearchLine.js");
|
|
21
|
-
|
|
22
14
|
var _IconDiscussionLine = require("@instructure/ui-icons/lib/IconDiscussionLine.js");
|
|
23
|
-
|
|
24
15
|
var _IconDashboardLine = require("@instructure/ui-icons/lib/IconDashboardLine.js");
|
|
25
|
-
|
|
26
16
|
var _TopNavBarContext = require("../TopNavBarContext");
|
|
27
|
-
|
|
28
17
|
var _index = require("../index");
|
|
29
|
-
|
|
30
18
|
var _exampleSvgFiles = require("./exampleSvgFiles");
|
|
31
|
-
|
|
32
19
|
/*
|
|
33
20
|
* The MIT License (MIT)
|
|
34
21
|
*
|
|
@@ -52,12 +39,12 @@ var _exampleSvgFiles = require("./exampleSvgFiles");
|
|
|
52
39
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
53
40
|
* SOFTWARE.
|
|
54
41
|
*/
|
|
42
|
+
|
|
55
43
|
const avatarExample = {
|
|
56
44
|
avatarName: 'User Name',
|
|
57
45
|
avatarSrc: 'https://images.pexels.com/photos/220453/pexels-photo-220453.jpeg?auto=compress&cs=tinysrgb&w=1260&h=750&dpr=1'
|
|
58
46
|
};
|
|
59
47
|
exports.avatarExample = avatarExample;
|
|
60
|
-
|
|
61
48
|
const itemSubmenuExample = /*#__PURE__*/_react.default.createElement(_Drilldown.Drilldown, {
|
|
62
49
|
rootPageId: "root"
|
|
63
50
|
}, /*#__PURE__*/_react.default.createElement(_Drilldown.Drilldown.Page, {
|
|
@@ -72,9 +59,7 @@ const itemSubmenuExample = /*#__PURE__*/_react.default.createElement(_Drilldown.
|
|
|
72
59
|
id: "linkExampleOption3",
|
|
73
60
|
href: "/#Three"
|
|
74
61
|
}, "Link Three")));
|
|
75
|
-
|
|
76
62
|
exports.itemSubmenuExample = itemSubmenuExample;
|
|
77
|
-
|
|
78
63
|
const getCustomPopoverConfig = function (inverseColor) {
|
|
79
64
|
let extraProps = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
80
65
|
return {
|
|
@@ -85,18 +70,14 @@ const getCustomPopoverConfig = function (inverseColor) {
|
|
|
85
70
|
...extraProps
|
|
86
71
|
};
|
|
87
72
|
};
|
|
88
|
-
|
|
89
73
|
exports.getCustomPopoverConfig = getCustomPopoverConfig;
|
|
90
|
-
|
|
91
74
|
const getCustomPopoverContent = inverseColor => /*#__PURE__*/_react.default.createElement("div", {
|
|
92
75
|
style: {
|
|
93
76
|
color: inverseColor ? 'black' : 'white',
|
|
94
77
|
padding: '0 0.5rem'
|
|
95
78
|
}
|
|
96
79
|
}, "dialog content");
|
|
97
|
-
|
|
98
80
|
exports.getCustomPopoverContent = getCustomPopoverContent;
|
|
99
|
-
|
|
100
81
|
const getInPlaceDialogConfig = function (inverseColor) {
|
|
101
82
|
let extraProps = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
102
83
|
return {
|
|
@@ -111,9 +92,7 @@ const getInPlaceDialogConfig = function (inverseColor) {
|
|
|
111
92
|
...extraProps
|
|
112
93
|
};
|
|
113
94
|
};
|
|
114
|
-
|
|
115
95
|
exports.getInPlaceDialogConfig = getInPlaceDialogConfig;
|
|
116
|
-
|
|
117
96
|
const SmallViewportModeWrapper = props => {
|
|
118
97
|
return /*#__PURE__*/_react.default.createElement(_TopNavBarContext.TopNavBarContext.Provider, {
|
|
119
98
|
value: {
|
|
@@ -122,13 +101,11 @@ const SmallViewportModeWrapper = props => {
|
|
|
122
101
|
}
|
|
123
102
|
}, props.children);
|
|
124
103
|
};
|
|
125
|
-
|
|
126
104
|
exports.SmallViewportModeWrapper = SmallViewportModeWrapper;
|
|
127
105
|
SmallViewportModeWrapper.defaultProps = {
|
|
128
106
|
layout: 'smallViewport',
|
|
129
107
|
inverseColor: false
|
|
130
108
|
};
|
|
131
|
-
|
|
132
109
|
const getBrand = function () {
|
|
133
110
|
let config = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
134
111
|
const logo = config.inverseColor ? _exampleSvgFiles.elevateLogoInverse : _exampleSvgFiles.elevateLogo;
|
|
@@ -142,9 +119,7 @@ const getBrand = function () {
|
|
|
142
119
|
href: "/#TopNavBar"
|
|
143
120
|
}, config.brandProps));
|
|
144
121
|
};
|
|
145
|
-
|
|
146
122
|
exports.getBrand = getBrand;
|
|
147
|
-
|
|
148
123
|
const getMenuItems = function () {
|
|
149
124
|
let config = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
150
125
|
const items = config.menuItemsCustomIdList || ['Overview', 'Admin', 'Settings', 'Maps', 'Assessments', 'Community'];
|
|
@@ -164,12 +139,9 @@ const getMenuItems = function () {
|
|
|
164
139
|
}, itemProps), (itemProps === null || itemProps === void 0 ? void 0 : itemProps.children) || item);
|
|
165
140
|
}));
|
|
166
141
|
};
|
|
167
|
-
|
|
168
142
|
exports.getMenuItems = getMenuItems;
|
|
169
|
-
|
|
170
143
|
const getActionItems = function () {
|
|
171
144
|
var _config$actionItemsPr, _config$actionItemsPr2;
|
|
172
|
-
|
|
173
145
|
let config = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
174
146
|
const items = [{
|
|
175
147
|
label: 'Search',
|
|
@@ -207,12 +179,9 @@ const getActionItems = function () {
|
|
|
207
179
|
}, itemProps), (itemProps === null || itemProps === void 0 ? void 0 : itemProps.children) || item.label);
|
|
208
180
|
}));
|
|
209
181
|
};
|
|
210
|
-
|
|
211
182
|
exports.getActionItems = getActionItems;
|
|
212
|
-
|
|
213
183
|
const getUser = function () {
|
|
214
184
|
var _config$userProps, _config$userItemProps;
|
|
215
|
-
|
|
216
185
|
let config = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
217
186
|
return /*#__PURE__*/_react.default.createElement(_index.TopNavBar.User, config.userProps, config.userProps && 'children' in config.userProps ? (_config$userProps = config.userProps) === null || _config$userProps === void 0 ? void 0 : _config$userProps.children : /*#__PURE__*/_react.default.createElement(_index.TopNavBar.Item, Object.assign({
|
|
218
187
|
id: config.userId || 'User',
|
|
@@ -222,9 +191,7 @@ const getUser = function () {
|
|
|
222
191
|
renderSubmenu: config.userWithSubmenu ? itemSubmenuExample : void 0
|
|
223
192
|
}, config.userItemProps), ((_config$userItemProps = config.userItemProps) === null || _config$userItemProps === void 0 ? void 0 : _config$userItemProps.children) || (config.userVariant === 'button' ? 'Log In/Register' : 'User Name')));
|
|
224
193
|
};
|
|
225
|
-
|
|
226
194
|
exports.getUser = getUser;
|
|
227
|
-
|
|
228
195
|
const getLayoutProps = function (props) {
|
|
229
196
|
let config = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
230
197
|
return {
|
|
@@ -237,19 +204,22 @@ const getLayoutProps = function (props) {
|
|
|
237
204
|
alternativeTitle: config.hasAlternativeTitle ? 'Page title' : void 0,
|
|
238
205
|
renderInPlaceDialogConfig: config.hasRenderInPlaceDialogConfig ? getInPlaceDialogConfig(props.inverseColor) : void 0
|
|
239
206
|
},
|
|
240
|
-
renderBrand: getBrand({
|
|
207
|
+
renderBrand: getBrand({
|
|
208
|
+
...props,
|
|
241
209
|
...config
|
|
242
210
|
}),
|
|
243
|
-
renderMenuItems: getMenuItems({
|
|
211
|
+
renderMenuItems: getMenuItems({
|
|
212
|
+
...props,
|
|
244
213
|
...config
|
|
245
214
|
}),
|
|
246
|
-
renderActionItems: getActionItems({
|
|
215
|
+
renderActionItems: getActionItems({
|
|
216
|
+
...props,
|
|
247
217
|
...config
|
|
248
218
|
}),
|
|
249
|
-
renderUser: getUser({
|
|
219
|
+
renderUser: getUser({
|
|
220
|
+
...props,
|
|
250
221
|
...config
|
|
251
222
|
})
|
|
252
223
|
};
|
|
253
224
|
};
|
|
254
|
-
|
|
255
225
|
exports.getLayoutProps = getLayoutProps;
|
|
@@ -1,16 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.elevateLogoInverse = exports.elevateLogo = exports.elevateIconInverse = exports.elevateIcon = void 0;
|
|
9
|
-
|
|
10
8
|
var _react = _interopRequireDefault(require("react"));
|
|
11
|
-
|
|
12
9
|
var _g, _path, _path2, _path3;
|
|
13
|
-
|
|
14
10
|
const getElevateLogo = fill => /*#__PURE__*/_react.default.createElement("svg", {
|
|
15
11
|
id: "elevateLogo",
|
|
16
12
|
width: "90",
|
|
@@ -49,7 +45,6 @@ const getElevateLogo = fill => /*#__PURE__*/_react.default.createElement("svg",
|
|
|
49
45
|
}), /*#__PURE__*/_react.default.createElement("path", {
|
|
50
46
|
d: "M80.9401 26.8809C80.9401 23.8156 83.1444 21.6397 86.1574 21.6397C88.1792 21.6397 89.4053 22.5318 90.0574 23.4424L88.3618 25.0597C88.1345 24.7133 87.823 24.4322 87.4575 24.2435C87.0919 24.0548 86.6846 23.9649 86.2748 23.9824C84.7096 23.9824 83.5983 25.1418 83.5983 26.8941C83.5983 28.6465 84.7018 29.8059 86.2748 29.8059C86.6855 29.8148 87.0919 29.7189 87.4565 29.527C87.8212 29.335 88.1325 29.0532 88.3618 28.7074L90.0574 30.3247C89.4053 31.2353 88.1792 32.1485 86.1574 32.1485C83.1444 32.1459 80.9401 29.97 80.9401 26.8809Z"
|
|
51
47
|
}))));
|
|
52
|
-
|
|
53
48
|
const getElevateIcon = fill => /*#__PURE__*/_react.default.createElement("svg", {
|
|
54
49
|
id: "elevateIcon",
|
|
55
50
|
width: "40",
|
|
@@ -64,7 +59,6 @@ const getElevateIcon = fill => /*#__PURE__*/_react.default.createElement("svg",
|
|
|
64
59
|
})), _path3 || (_path3 = /*#__PURE__*/_react.default.createElement("path", {
|
|
65
60
|
d: "M26.7973 21.0347C26.7966 20.4238 26.5537 19.8382 26.1217 19.4063C25.6898 18.9743 25.1042 18.7314 24.4933 18.7307H24.376C24.3739 17.6701 23.9768 16.6484 23.2623 15.8647C22.5478 15.081 21.567 14.5915 20.5112 14.4916C19.4554 14.3917 18.4002 14.6886 17.5514 15.3244C16.7026 15.9602 16.121 16.8893 15.92 17.9307H15.808C15.0909 17.9307 14.4031 18.2155 13.896 18.7226C13.3889 19.2297 13.104 19.9175 13.104 20.6347C13.104 21.3518 13.3889 22.0396 13.896 22.5467C14.4031 23.0538 15.0909 23.3387 15.808 23.3387H24.4933C25.1044 23.3387 25.6904 23.0959 26.1225 22.6638C26.5546 22.2317 26.7973 21.6457 26.7973 21.0347ZM24.4933 22.0053H15.808C15.4445 22.0053 15.0958 21.8609 14.8388 21.6039C14.5817 21.3468 14.4373 20.9982 14.4373 20.6347C14.4373 20.2711 14.5817 19.9225 14.8388 19.6654C15.0958 19.4084 15.4445 19.264 15.808 19.264H17.1227L17.1627 18.64C17.1878 17.8599 17.5217 17.1217 18.0911 16.5879C18.6605 16.054 19.4186 15.7682 20.1987 15.7933C20.9788 15.8184 21.7169 16.1524 22.2508 16.7218C22.7846 17.2911 23.0704 18.0492 23.0453 18.8293V19.0587C23.0453 19.152 23.0453 19.2453 23.0293 19.3253L22.9627 20.0533H24.4933C24.7508 20.0533 24.9977 20.1556 25.1797 20.3376C25.3617 20.5197 25.464 20.7666 25.464 21.024C25.464 21.2814 25.3617 21.5283 25.1797 21.7104C24.9977 21.8924 24.7508 21.9947 24.4933 21.9947V22.0053Z"
|
|
66
61
|
})));
|
|
67
|
-
|
|
68
62
|
const elevateLogo = getElevateLogo('white');
|
|
69
63
|
exports.elevateLogo = elevateLogo;
|
|
70
64
|
const elevateLogoInverse = getElevateLogo('black');
|
|
@@ -1,26 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.renderMappedItemsAsDrilldownOptions = exports.renderMappedItemDrilldownSubpages = exports.mapItemsForDrilldown = exports.default = void 0;
|
|
9
|
-
|
|
10
8
|
var _react = _interopRequireWildcard(require("react"));
|
|
11
|
-
|
|
12
9
|
var _console = require("@instructure/console");
|
|
13
|
-
|
|
14
10
|
var _generateId = require("@instructure/ui-utils/lib/generateId.js");
|
|
15
|
-
|
|
16
11
|
var _matchComponentTypes = require("@instructure/ui-react-utils/lib/matchComponentTypes.js");
|
|
17
|
-
|
|
18
12
|
var _generateInstanceCounterMap = require("@instructure/ui-react-utils/lib/DeterministicIdContext/generateInstanceCounterMap.js");
|
|
19
|
-
|
|
20
13
|
var _Drilldown = require("@instructure/ui-drilldown/lib/Drilldown");
|
|
21
|
-
|
|
22
14
|
var _TopNavBarItem = require("../TopNavBarItem");
|
|
23
|
-
|
|
24
15
|
/*
|
|
25
16
|
* The MIT License (MIT)
|
|
26
17
|
*
|
|
@@ -44,55 +35,52 @@ var _TopNavBarItem = require("../TopNavBarItem");
|
|
|
44
35
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
45
36
|
* SOFTWARE.
|
|
46
37
|
*/
|
|
38
|
+
|
|
47
39
|
const mapItemsForDrilldown = function (itemList) {
|
|
48
40
|
let options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
49
41
|
const submenus = [];
|
|
50
42
|
const currentPageId = options.currentPageId,
|
|
51
|
-
|
|
43
|
+
renderOptionContent = options.renderOptionContent;
|
|
52
44
|
const customPopoverIdMap = (0, _generateInstanceCounterMap.generateInstanceCounterMap)();
|
|
53
|
-
|
|
54
45
|
_react.Children.forEach(itemList, item => {
|
|
55
46
|
if (!item || !(0, _matchComponentTypes.matchComponentTypes)(item, [_TopNavBarItem.TopNavBarItem])) return;
|
|
56
47
|
const _item$props = item.props,
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
48
|
+
renderSubmenu = _item$props.renderSubmenu,
|
|
49
|
+
customPopoverConfig = _item$props.customPopoverConfig,
|
|
50
|
+
id = _item$props.id,
|
|
51
|
+
children = _item$props.children,
|
|
52
|
+
status = _item$props.status,
|
|
53
|
+
variant = _item$props.variant,
|
|
54
|
+
href = _item$props.href,
|
|
55
|
+
onClick = _item$props.onClick;
|
|
65
56
|
let submenu = renderSubmenu;
|
|
66
57
|
let customPopover = customPopoverConfig;
|
|
67
58
|
let customPopoverId;
|
|
68
59
|
let optionSubPageId;
|
|
69
60
|
const submenuPages = [];
|
|
70
|
-
|
|
71
61
|
if (submenu) {
|
|
72
62
|
if (!(0, _matchComponentTypes.matchComponentTypes)(submenu, [_Drilldown.Drilldown])) {
|
|
73
63
|
(0, _console.warn)(false, `The "renderSubmenu" prop accepts only Drilldown components, but the item with id "${id}" received: "${renderSubmenu}".`);
|
|
74
64
|
submenu = void 0;
|
|
75
|
-
}
|
|
76
|
-
|
|
65
|
+
}
|
|
77
66
|
|
|
67
|
+
// if still has submenu...
|
|
78
68
|
if (submenu) {
|
|
79
69
|
optionSubPageId = submenu.props.rootPageId;
|
|
80
70
|
submenuPages.push(..._react.Children.toArray(submenu.props.children));
|
|
81
71
|
}
|
|
82
72
|
}
|
|
83
|
-
|
|
84
73
|
if (customPopover) {
|
|
85
74
|
if (!customPopover.children) {
|
|
86
75
|
(0, _console.warn)(false, `Pass the content of the custom Popover as "customPopoverConfig.children" for the item with id: "${id}".`);
|
|
87
76
|
customPopover = void 0;
|
|
88
77
|
}
|
|
89
|
-
|
|
90
78
|
if (submenu) {
|
|
91
79
|
(0, _console.warn)(false, `TopNavBar.Items are not allowed to have both the "renderSubmenu" and "customPopoverConfig" props. For submenus, pass a Drilldown component via the "renderSubmenu" prop, and only use "customPopoverConfig" for custom features. Item with id: "${id}" will ignore the "customPopoverConfig" prop.`);
|
|
92
80
|
customPopover = void 0;
|
|
93
|
-
}
|
|
94
|
-
|
|
81
|
+
}
|
|
95
82
|
|
|
83
|
+
// if still has customPopover...
|
|
96
84
|
if (customPopover) {
|
|
97
85
|
customPopoverId = (0, _generateId.generateId)(`TopNavBarItem__customPopoverOption`, customPopoverIdMap);
|
|
98
86
|
optionSubPageId = customPopoverId;
|
|
@@ -104,21 +92,17 @@ const mapItemsForDrilldown = function (itemList) {
|
|
|
104
92
|
}, customPopover.children)));
|
|
105
93
|
}
|
|
106
94
|
}
|
|
107
|
-
|
|
108
95
|
let ariaCurrent = item.props['aria-current'] || (id === currentPageId ? 'page' : void 0);
|
|
109
|
-
|
|
110
96
|
if (ariaCurrent) {
|
|
111
97
|
if (variant !== 'default') {
|
|
112
98
|
(0, _console.warn)(false, `Only \`variant="default"\` items can be set to current/active, but the item with id "${id}" is "${variant}" variant.`);
|
|
113
99
|
ariaCurrent = void 0;
|
|
114
100
|
}
|
|
115
|
-
|
|
116
101
|
if (status === 'disabled') {
|
|
117
102
|
(0, _console.warn)(false, `Disabled items can not be set to current/active, but the item with id "${id}" is disabled.`);
|
|
118
103
|
ariaCurrent = void 0;
|
|
119
104
|
}
|
|
120
105
|
}
|
|
121
|
-
|
|
122
106
|
submenus.push({
|
|
123
107
|
item,
|
|
124
108
|
submenuPages,
|
|
@@ -129,7 +113,8 @@ const mapItemsForDrilldown = function (itemList) {
|
|
|
129
113
|
onOptionClick: event => {
|
|
130
114
|
onClick === null || onClick === void 0 ? void 0 : onClick(event);
|
|
131
115
|
},
|
|
132
|
-
children: typeof renderOptionContent === 'function' ? renderOptionContent(children, {
|
|
116
|
+
children: typeof renderOptionContent === 'function' ? renderOptionContent(children, {
|
|
117
|
+
...item.props,
|
|
133
118
|
status: ariaCurrent === 'page' ? 'active' : item.props.status
|
|
134
119
|
}) : children,
|
|
135
120
|
subPageId: optionSubPageId,
|
|
@@ -137,19 +122,14 @@ const mapItemsForDrilldown = function (itemList) {
|
|
|
137
122
|
}
|
|
138
123
|
});
|
|
139
124
|
});
|
|
140
|
-
|
|
141
125
|
return submenus;
|
|
142
126
|
};
|
|
143
|
-
|
|
144
127
|
exports.mapItemsForDrilldown = mapItemsForDrilldown;
|
|
145
|
-
|
|
146
128
|
const renderMappedItemDrilldownSubpages = mappedItems => {
|
|
147
129
|
const subPages = mappedItems.map(option => option.submenuPages).filter(submenu => !!submenu);
|
|
148
130
|
return subPages.flat();
|
|
149
131
|
};
|
|
150
|
-
|
|
151
132
|
exports.renderMappedItemDrilldownSubpages = renderMappedItemDrilldownSubpages;
|
|
152
|
-
|
|
153
133
|
const renderMappedItemsAsDrilldownOptions = mappedItems => {
|
|
154
134
|
return mappedItems.map(mappedItem => {
|
|
155
135
|
const optionData = mappedItem.optionData;
|
|
@@ -159,7 +139,6 @@ const renderMappedItemsAsDrilldownOptions = mappedItems => {
|
|
|
159
139
|
}), optionData.children);
|
|
160
140
|
});
|
|
161
141
|
};
|
|
162
|
-
|
|
163
142
|
exports.renderMappedItemsAsDrilldownOptions = renderMappedItemsAsDrilldownOptions;
|
|
164
143
|
var _default = mapItemsForDrilldown;
|
|
165
144
|
exports.default = _default;
|
package/lib/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@instructure/ui-top-nav-bar",
|
|
3
|
-
"version": "8.33.
|
|
3
|
+
"version": "8.33.2",
|
|
4
4
|
"description": "A UI component library made by Instructure Inc.",
|
|
5
5
|
"author": "Instructure, Inc. Engineering and Product Design",
|
|
6
6
|
"module": "./es/index.js",
|
|
@@ -24,35 +24,35 @@
|
|
|
24
24
|
"license": "MIT",
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"@babel/runtime": "^7.13.10",
|
|
27
|
-
"@instructure/console": "8.33.
|
|
28
|
-
"@instructure/emotion": "8.33.
|
|
29
|
-
"@instructure/shared-types": "8.33.
|
|
30
|
-
"@instructure/ui-a11y-content": "8.33.
|
|
31
|
-
"@instructure/ui-avatar": "8.33.
|
|
32
|
-
"@instructure/ui-buttons": "8.33.
|
|
33
|
-
"@instructure/ui-dialog": "8.33.
|
|
34
|
-
"@instructure/ui-dom-utils": "8.33.
|
|
35
|
-
"@instructure/ui-drilldown": "8.33.
|
|
36
|
-
"@instructure/ui-icons": "8.33.
|
|
37
|
-
"@instructure/ui-link": "8.33.
|
|
38
|
-
"@instructure/ui-popover": "8.33.
|
|
39
|
-
"@instructure/ui-prop-types": "8.33.
|
|
40
|
-
"@instructure/ui-react-utils": "8.33.
|
|
41
|
-
"@instructure/ui-responsive": "8.33.
|
|
42
|
-
"@instructure/ui-testable": "8.33.
|
|
43
|
-
"@instructure/ui-tooltip": "8.33.
|
|
44
|
-
"@instructure/ui-tray": "8.33.
|
|
45
|
-
"@instructure/ui-truncate-list": "8.33.
|
|
46
|
-
"@instructure/ui-utils": "8.33.
|
|
47
|
-
"@instructure/ui-view": "8.33.
|
|
27
|
+
"@instructure/console": "8.33.2",
|
|
28
|
+
"@instructure/emotion": "8.33.2",
|
|
29
|
+
"@instructure/shared-types": "8.33.2",
|
|
30
|
+
"@instructure/ui-a11y-content": "8.33.2",
|
|
31
|
+
"@instructure/ui-avatar": "8.33.2",
|
|
32
|
+
"@instructure/ui-buttons": "8.33.2",
|
|
33
|
+
"@instructure/ui-dialog": "8.33.2",
|
|
34
|
+
"@instructure/ui-dom-utils": "8.33.2",
|
|
35
|
+
"@instructure/ui-drilldown": "8.33.2",
|
|
36
|
+
"@instructure/ui-icons": "8.33.2",
|
|
37
|
+
"@instructure/ui-link": "8.33.2",
|
|
38
|
+
"@instructure/ui-popover": "8.33.2",
|
|
39
|
+
"@instructure/ui-prop-types": "8.33.2",
|
|
40
|
+
"@instructure/ui-react-utils": "8.33.2",
|
|
41
|
+
"@instructure/ui-responsive": "8.33.2",
|
|
42
|
+
"@instructure/ui-testable": "8.33.2",
|
|
43
|
+
"@instructure/ui-tooltip": "8.33.2",
|
|
44
|
+
"@instructure/ui-tray": "8.33.2",
|
|
45
|
+
"@instructure/ui-truncate-list": "8.33.2",
|
|
46
|
+
"@instructure/ui-utils": "8.33.2",
|
|
47
|
+
"@instructure/ui-view": "8.33.2",
|
|
48
48
|
"prop-types": "^15"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
|
-
"@instructure/ui-babel-preset": "8.33.
|
|
52
|
-
"@instructure/ui-color-utils": "8.33.
|
|
53
|
-
"@instructure/ui-test-locator": "8.33.
|
|
54
|
-
"@instructure/ui-test-utils": "8.33.
|
|
55
|
-
"@instructure/ui-themes": "8.33.
|
|
51
|
+
"@instructure/ui-babel-preset": "8.33.2",
|
|
52
|
+
"@instructure/ui-color-utils": "8.33.2",
|
|
53
|
+
"@instructure/ui-test-locator": "8.33.2",
|
|
54
|
+
"@instructure/ui-test-utils": "8.33.2",
|
|
55
|
+
"@instructure/ui-themes": "8.33.2"
|
|
56
56
|
},
|
|
57
57
|
"peerDependencies": {
|
|
58
58
|
"react": ">=16.8 <=18"
|