@instructure/ui-navigation 8.18.0 → 8.18.1-snapshot.12
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/LICENSE.md +27 -0
- package/es/AppNav/Item/index.js +17 -11
- package/es/AppNav/Item/theme.js +6 -6
- package/es/AppNav/index.js +21 -11
- package/es/AppNav/theme.js +5 -5
- package/es/Navigation/NavigationItem/index.js +19 -13
- package/es/Navigation/NavigationItem/theme.js +15 -15
- package/es/Navigation/index.js +15 -7
- package/es/Navigation/theme.js +9 -9
- package/lib/AppNav/Item/index.js +17 -11
- package/lib/AppNav/Item/theme.js +6 -6
- package/lib/AppNav/index.js +21 -11
- package/lib/AppNav/theme.js +5 -5
- package/lib/Navigation/NavigationItem/index.js +19 -13
- package/lib/Navigation/NavigationItem/theme.js +15 -15
- package/lib/Navigation/index.js +15 -7
- package/lib/Navigation/theme.js +9 -9
- package/package.json +25 -24
- package/tsconfig.build.tsbuildinfo +1 -1
package/LICENSE.md
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: The MIT License (MIT)
|
|
3
|
+
category: Getting Started
|
|
4
|
+
order: 9
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# The MIT License (MIT)
|
|
8
|
+
|
|
9
|
+
Copyright (c) 2015 Instructure, Inc.
|
|
10
|
+
|
|
11
|
+
**Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
12
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
13
|
+
in the Software without restriction, including without limitation the rights
|
|
14
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
15
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
16
|
+
furnished to do so, subject to the following conditions.**
|
|
17
|
+
|
|
18
|
+
The above copyright notice and this permission notice shall be included in all
|
|
19
|
+
copies or substantial portions of the Software.
|
|
20
|
+
|
|
21
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
22
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
23
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
24
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
25
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
26
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
27
|
+
SOFTWARE.
|
package/es/AppNav/Item/index.js
CHANGED
|
@@ -72,22 +72,28 @@ let Item = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2 = tes
|
|
|
72
72
|
}
|
|
73
73
|
|
|
74
74
|
componentDidMount() {
|
|
75
|
-
|
|
75
|
+
var _this$props$makeStyle, _this$props2;
|
|
76
|
+
|
|
77
|
+
(_this$props$makeStyle = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props2);
|
|
76
78
|
}
|
|
77
79
|
|
|
78
80
|
componentDidUpdate() {
|
|
79
|
-
|
|
81
|
+
var _this$props$makeStyle2, _this$props3;
|
|
82
|
+
|
|
83
|
+
(_this$props$makeStyle2 = (_this$props3 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props3);
|
|
80
84
|
}
|
|
81
85
|
|
|
82
86
|
render() {
|
|
87
|
+
var _this$props$styles, _this$props$styles2;
|
|
88
|
+
|
|
83
89
|
const ElementType = getElementType(Item, this.props);
|
|
84
|
-
const _this$
|
|
85
|
-
renderIcon = _this$
|
|
86
|
-
renderLabel = _this$
|
|
87
|
-
href = _this$
|
|
88
|
-
renderAfter = _this$
|
|
89
|
-
cursor = _this$
|
|
90
|
-
isDisabled = _this$
|
|
90
|
+
const _this$props4 = this.props,
|
|
91
|
+
renderIcon = _this$props4.renderIcon,
|
|
92
|
+
renderLabel = _this$props4.renderLabel,
|
|
93
|
+
href = _this$props4.href,
|
|
94
|
+
renderAfter = _this$props4.renderAfter,
|
|
95
|
+
cursor = _this$props4.cursor,
|
|
96
|
+
isDisabled = _this$props4.isDisabled;
|
|
91
97
|
const icon = callRenderProp(renderIcon);
|
|
92
98
|
const label = callRenderProp(renderLabel);
|
|
93
99
|
const labelIsForScreenReaders = matchComponentTypes(label, [ScreenReaderContent]);
|
|
@@ -108,9 +114,9 @@ let Item = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2 = tes
|
|
|
108
114
|
onFocus: this.handleFocus,
|
|
109
115
|
onBlur: this.handleBlur,
|
|
110
116
|
cursor: isDisabled ? 'not-allowed' : cursor,
|
|
111
|
-
css: this.props.styles
|
|
117
|
+
css: (_this$props$styles = this.props.styles) === null || _this$props$styles === void 0 ? void 0 : _this$props$styles.item
|
|
112
118
|
}), icon, labelIsForScreenReaders ? label : jsx("span", {
|
|
113
|
-
css: this.props.styles
|
|
119
|
+
css: (_this$props$styles2 = this.props.styles) === null || _this$props$styles2 === void 0 ? void 0 : _this$props$styles2.label
|
|
114
120
|
}, label), renderAfter && callRenderProp(renderAfter));
|
|
115
121
|
}
|
|
116
122
|
|
package/es/AppNav/Item/theme.js
CHANGED
|
@@ -32,14 +32,14 @@ const generateComponentTheme = theme => {
|
|
|
32
32
|
spacing = theme.spacing,
|
|
33
33
|
typography = theme.typography;
|
|
34
34
|
const componentVariables = {
|
|
35
|
-
fontFamily: typography
|
|
35
|
+
fontFamily: typography === null || typography === void 0 ? void 0 : typography.fontFamily,
|
|
36
36
|
fontSize: '1.125rem',
|
|
37
|
-
fontWeight: typography
|
|
38
|
-
textColor: colors
|
|
39
|
-
textColorSelected: colors
|
|
37
|
+
fontWeight: typography === null || typography === void 0 ? void 0 : typography.fontWeightBold,
|
|
38
|
+
textColor: colors === null || colors === void 0 ? void 0 : colors.textLink,
|
|
39
|
+
textColorSelected: colors === null || colors === void 0 ? void 0 : colors.textDarkest,
|
|
40
40
|
height: '2.25rem',
|
|
41
|
-
padding: spacing
|
|
42
|
-
backgroundColor: colors
|
|
41
|
+
padding: spacing === null || spacing === void 0 ? void 0 : spacing.small,
|
|
42
|
+
backgroundColor: colors === null || colors === void 0 ? void 0 : colors.backgroundLightest
|
|
43
43
|
};
|
|
44
44
|
return { ...componentVariables
|
|
45
45
|
};
|
package/es/AppNav/index.js
CHANGED
|
@@ -54,7 +54,9 @@ let AppNav = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2 = t
|
|
|
54
54
|
this._list = null;
|
|
55
55
|
|
|
56
56
|
this.measureItems = () => {
|
|
57
|
-
|
|
57
|
+
var _this$props$styles;
|
|
58
|
+
|
|
59
|
+
const menuTriggerWidth = px((_this$props$styles = this.props.styles) === null || _this$props$styles === void 0 ? void 0 : _this$props$styles.menuTriggerWidth);
|
|
58
60
|
let visibleItemsCount = 0;
|
|
59
61
|
|
|
60
62
|
if (this._list) {
|
|
@@ -113,7 +115,9 @@ let AppNav = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2 = t
|
|
|
113
115
|
}
|
|
114
116
|
|
|
115
117
|
componentDidMount() {
|
|
116
|
-
|
|
118
|
+
var _this$props$makeStyle, _this$props;
|
|
119
|
+
|
|
120
|
+
(_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props);
|
|
117
121
|
|
|
118
122
|
const _getBoundingClientRec3 = getBoundingClientRect(this._list),
|
|
119
123
|
origWidth = _getBoundingClientRec3.width;
|
|
@@ -138,7 +142,9 @@ let AppNav = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2 = t
|
|
|
138
142
|
}
|
|
139
143
|
|
|
140
144
|
componentDidUpdate() {
|
|
141
|
-
|
|
145
|
+
var _this$props$makeStyle2, _this$props2;
|
|
146
|
+
|
|
147
|
+
(_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2);
|
|
142
148
|
}
|
|
143
149
|
|
|
144
150
|
componentWillUnmount() {
|
|
@@ -152,9 +158,11 @@ let AppNav = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2 = t
|
|
|
152
158
|
}
|
|
153
159
|
|
|
154
160
|
renderListItem(item, isMenuTrigger, key) {
|
|
161
|
+
var _this$props$styles2, _this$props$styles3;
|
|
162
|
+
|
|
155
163
|
return jsx("li", {
|
|
156
164
|
key: key,
|
|
157
|
-
css: isMenuTrigger ? this.props.styles
|
|
165
|
+
css: isMenuTrigger ? (_this$props$styles2 = this.props.styles) === null || _this$props$styles2 === void 0 ? void 0 : _this$props$styles2.listItemWithMenuTrigger : (_this$props$styles3 = this.props.styles) === null || _this$props$styles3 === void 0 ? void 0 : _this$props$styles3.listItem
|
|
158
166
|
}, item);
|
|
159
167
|
}
|
|
160
168
|
|
|
@@ -176,11 +184,13 @@ let AppNav = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2 = t
|
|
|
176
184
|
}
|
|
177
185
|
|
|
178
186
|
render() {
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
187
|
+
var _this$props$styles4, _this$props$styles5, _this$props$styles6;
|
|
188
|
+
|
|
189
|
+
const _this$props3 = this.props,
|
|
190
|
+
children = _this$props3.children,
|
|
191
|
+
visibleItemsCount = _this$props3.visibleItemsCount,
|
|
192
|
+
screenReaderLabel = _this$props3.screenReaderLabel,
|
|
193
|
+
margin = _this$props3.margin;
|
|
184
194
|
const passthroughProps = View.omitViewProps(omitProps(this.props, AppNav.allowedProps), AppNav);
|
|
185
195
|
const isMeasuring = this.state.isMeasuring;
|
|
186
196
|
const childrenArray = Children.toArray(children);
|
|
@@ -191,13 +201,13 @@ let AppNav = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2 = t
|
|
|
191
201
|
const hasRenderedContent = renderBeforeItems || renderAfterItems;
|
|
192
202
|
return jsx(View, Object.assign({}, passthroughProps, {
|
|
193
203
|
as: "nav",
|
|
194
|
-
css: [this.props.styles
|
|
204
|
+
css: [(_this$props$styles4 = this.props.styles) === null || _this$props$styles4 === void 0 ? void 0 : _this$props$styles4.appNav, hasRenderedContent ? (_this$props$styles5 = this.props.styles) === null || _this$props$styles5 === void 0 ? void 0 : _this$props$styles5.alignCenter : ''],
|
|
195
205
|
margin: margin,
|
|
196
206
|
display: hasRenderedContent ? 'flex' : 'block',
|
|
197
207
|
elementRef: this.handleRef
|
|
198
208
|
}), renderBeforeItems && jsx("span", null, renderBeforeItems), jsx("ul", {
|
|
199
209
|
ref: el => this._list = el,
|
|
200
|
-
css: this.props.styles
|
|
210
|
+
css: (_this$props$styles6 = this.props.styles) === null || _this$props$styles6 === void 0 ? void 0 : _this$props$styles6.list,
|
|
201
211
|
"aria-label": callRenderProp(screenReaderLabel)
|
|
202
212
|
}, visibleChildren.map((child, index) => {
|
|
203
213
|
return this.renderListItem(child, false, index);
|
package/es/AppNav/theme.js
CHANGED
|
@@ -33,13 +33,13 @@ const generateComponentTheme = theme => {
|
|
|
33
33
|
spacing = theme.spacing,
|
|
34
34
|
typography = theme.typography;
|
|
35
35
|
const componentVariables = {
|
|
36
|
-
fontFamily: typography
|
|
36
|
+
fontFamily: typography === null || typography === void 0 ? void 0 : typography.fontFamily,
|
|
37
37
|
height: '3.75rem',
|
|
38
38
|
// 60px per product design
|
|
39
|
-
borderColor: colors
|
|
40
|
-
borderStyle: borders
|
|
41
|
-
borderWidth: borders
|
|
42
|
-
horizontalMargin: spacing
|
|
39
|
+
borderColor: colors === null || colors === void 0 ? void 0 : colors.borderMedium,
|
|
40
|
+
borderStyle: borders === null || borders === void 0 ? void 0 : borders.style,
|
|
41
|
+
borderWidth: borders === null || borders === void 0 ? void 0 : borders.widthSmall,
|
|
42
|
+
horizontalMargin: spacing === null || spacing === void 0 ? void 0 : spacing.xxSmall,
|
|
43
43
|
menuTriggerWidth: '7.5rem'
|
|
44
44
|
};
|
|
45
45
|
return { ...componentVariables
|
|
@@ -48,45 +48,51 @@ let NavigationItem = (_dec = withStyle(generateStyle, generateComponentTheme), _
|
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
componentDidMount() {
|
|
51
|
-
|
|
51
|
+
var _this$props$makeStyle, _this$props;
|
|
52
|
+
|
|
53
|
+
(_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props, {
|
|
52
54
|
minimized: this.props.minimized
|
|
53
55
|
});
|
|
54
56
|
}
|
|
55
57
|
|
|
56
58
|
componentDidUpdate() {
|
|
57
|
-
|
|
59
|
+
var _this$props$makeStyle2, _this$props2;
|
|
60
|
+
|
|
61
|
+
(_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2, {
|
|
58
62
|
minimized: this.props.minimized
|
|
59
63
|
});
|
|
60
64
|
}
|
|
61
65
|
|
|
62
66
|
renderLink() {
|
|
67
|
+
var _this$props$styles, _this$props$styles2, _this$props$styles3;
|
|
68
|
+
|
|
63
69
|
const ElementType = getElementType(NavigationItem, this.props);
|
|
64
|
-
const _this$
|
|
65
|
-
href = _this$
|
|
66
|
-
onClick = _this$
|
|
67
|
-
icon = _this$
|
|
68
|
-
label = _this$
|
|
70
|
+
const _this$props3 = this.props,
|
|
71
|
+
href = _this$props3.href,
|
|
72
|
+
onClick = _this$props3.onClick,
|
|
73
|
+
icon = _this$props3.icon,
|
|
74
|
+
label = _this$props3.label;
|
|
69
75
|
const props = omitProps(this.props, NavigationItem.allowedProps);
|
|
70
76
|
return jsx(ElementType, Object.assign({}, props, {
|
|
71
77
|
href: href,
|
|
72
78
|
onClick: onClick,
|
|
73
|
-
css: this.props.styles
|
|
79
|
+
css: (_this$props$styles = this.props.styles) === null || _this$props$styles === void 0 ? void 0 : _this$props$styles.navigationItem,
|
|
74
80
|
"aria-label": this.props.minimized ? label : void 0,
|
|
75
81
|
ref: element => {
|
|
76
82
|
this.ref = element;
|
|
77
83
|
}
|
|
78
84
|
}), jsx("div", {
|
|
79
|
-
css: this.props.styles
|
|
85
|
+
css: (_this$props$styles2 = this.props.styles) === null || _this$props$styles2 === void 0 ? void 0 : _this$props$styles2.icon,
|
|
80
86
|
"aria-hidden": "true"
|
|
81
87
|
}, icon), !this.props.minimized ? jsx("div", {
|
|
82
|
-
css: this.props.styles
|
|
88
|
+
css: (_this$props$styles3 = this.props.styles) === null || _this$props$styles3 === void 0 ? void 0 : _this$props$styles3.label
|
|
83
89
|
}, label) : null);
|
|
84
90
|
}
|
|
85
91
|
|
|
86
92
|
render() {
|
|
87
|
-
const _this$
|
|
88
|
-
minimized = _this$
|
|
89
|
-
label = _this$
|
|
93
|
+
const _this$props4 = this.props,
|
|
94
|
+
minimized = _this$props4.minimized,
|
|
95
|
+
label = _this$props4.label;
|
|
90
96
|
const link = this.renderLink();
|
|
91
97
|
return minimized && hasVisibleChildren(label) ? jsx(Tooltip, {
|
|
92
98
|
renderTip: label,
|
|
@@ -46,24 +46,24 @@ const generateComponentTheme = theme => {
|
|
|
46
46
|
}
|
|
47
47
|
};
|
|
48
48
|
const componentVariables = {
|
|
49
|
-
fontSize: typography
|
|
50
|
-
fontFamily: typography
|
|
51
|
-
fontWeight: typography
|
|
52
|
-
fontColor: colors
|
|
49
|
+
fontSize: typography === null || typography === void 0 ? void 0 : typography.fontSizeSmall,
|
|
50
|
+
fontFamily: typography === null || typography === void 0 ? void 0 : typography.fontFamily,
|
|
51
|
+
fontWeight: typography === null || typography === void 0 ? void 0 : typography.fontWeightLight,
|
|
52
|
+
fontColor: colors === null || colors === void 0 ? void 0 : colors.textLightest,
|
|
53
53
|
iconSize: '1.625rem',
|
|
54
|
-
iconColor: colors
|
|
55
|
-
lineHeight: typography
|
|
54
|
+
iconColor: colors === null || colors === void 0 ? void 0 : colors.textLightest,
|
|
55
|
+
lineHeight: typography === null || typography === void 0 ? void 0 : typography.lineHeight,
|
|
56
56
|
backgroundColor: 'transparent',
|
|
57
57
|
linkTextDecoration: 'none',
|
|
58
|
-
hoverBackgroundColor: colors
|
|
59
|
-
outerFocusOutline: `inset 0 0 0 0.125rem ${colors
|
|
60
|
-
innerFocusOutline: `inset 0 0 0 0.25rem ${colors
|
|
61
|
-
selectedFontColor: colors
|
|
62
|
-
selectedIconColor: colors
|
|
63
|
-
selectedBackgroundColor: colors
|
|
64
|
-
selectedOuterFocusOutline: `inset 0 0 0 0.125rem ${colors
|
|
65
|
-
selectedInnerFocusOutline: `inset 0 0 0 0.25rem ${colors
|
|
66
|
-
contentPadding: spacing
|
|
58
|
+
hoverBackgroundColor: colors === null || colors === void 0 ? void 0 : colors.backgroundDarkest,
|
|
59
|
+
outerFocusOutline: `inset 0 0 0 0.125rem ${colors === null || colors === void 0 ? void 0 : colors.borderDarkest}`,
|
|
60
|
+
innerFocusOutline: `inset 0 0 0 0.25rem ${colors === null || colors === void 0 ? void 0 : colors.borderLightest}`,
|
|
61
|
+
selectedFontColor: colors === null || colors === void 0 ? void 0 : colors.textBrand,
|
|
62
|
+
selectedIconColor: colors === null || colors === void 0 ? void 0 : colors.textBrand,
|
|
63
|
+
selectedBackgroundColor: colors === null || colors === void 0 ? void 0 : colors.backgroundLightest,
|
|
64
|
+
selectedOuterFocusOutline: `inset 0 0 0 0.125rem ${colors === null || colors === void 0 ? void 0 : colors.borderLightest}`,
|
|
65
|
+
selectedInnerFocusOutline: `inset 0 0 0 0.25rem ${colors === null || colors === void 0 ? void 0 : colors.borderBrand}`,
|
|
66
|
+
contentPadding: spacing === null || spacing === void 0 ? void 0 : spacing.xxSmall
|
|
67
67
|
};
|
|
68
68
|
return { ...componentVariables,
|
|
69
69
|
...themeSpecificStyle[themeName]
|
package/es/Navigation/index.js
CHANGED
|
@@ -68,13 +68,17 @@ let Navigation = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2
|
|
|
68
68
|
}
|
|
69
69
|
|
|
70
70
|
componentDidMount() {
|
|
71
|
-
|
|
71
|
+
var _this$props$makeStyle, _this$props;
|
|
72
|
+
|
|
73
|
+
(_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props, {
|
|
72
74
|
minimized: this.minimized
|
|
73
75
|
});
|
|
74
76
|
}
|
|
75
77
|
|
|
76
78
|
componentDidUpdate() {
|
|
77
|
-
|
|
79
|
+
var _this$props$makeStyle2, _this$props2;
|
|
80
|
+
|
|
81
|
+
(_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2, {
|
|
78
82
|
minimized: this.minimized
|
|
79
83
|
});
|
|
80
84
|
}
|
|
@@ -94,11 +98,13 @@ let Navigation = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2
|
|
|
94
98
|
|
|
95
99
|
renderChildren() {
|
|
96
100
|
return Children.map(this.props.children, child => {
|
|
101
|
+
var _this$props$styles;
|
|
102
|
+
|
|
97
103
|
const navItem = safeCloneElement(child, {
|
|
98
104
|
minimized: this.state.minimized
|
|
99
105
|
});
|
|
100
106
|
return jsx("li", {
|
|
101
|
-
css: this.props.styles
|
|
107
|
+
css: (_this$props$styles = this.props.styles) === null || _this$props$styles === void 0 ? void 0 : _this$props$styles.list
|
|
102
108
|
}, navItem);
|
|
103
109
|
});
|
|
104
110
|
}
|
|
@@ -108,23 +114,25 @@ let Navigation = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2
|
|
|
108
114
|
}
|
|
109
115
|
|
|
110
116
|
render() {
|
|
117
|
+
var _this$props$styles2, _this$props$styles3, _this$props$styles4, _this$props$styles5;
|
|
118
|
+
|
|
111
119
|
const label = this.props.label;
|
|
112
120
|
const props = omitProps(this.props, Navigation.allowedProps, ['minimized']);
|
|
113
121
|
return jsx("nav", Object.assign({}, props, {
|
|
114
|
-
css: this.props.styles
|
|
122
|
+
css: (_this$props$styles2 = this.props.styles) === null || _this$props$styles2 === void 0 ? void 0 : _this$props$styles2.navigation,
|
|
115
123
|
"aria-label": label,
|
|
116
124
|
ref: element => {
|
|
117
125
|
this.ref = element;
|
|
118
126
|
}
|
|
119
127
|
}), jsx("ul", {
|
|
120
|
-
css: this.props.styles
|
|
128
|
+
css: (_this$props$styles3 = this.props.styles) === null || _this$props$styles3 === void 0 ? void 0 : _this$props$styles3.content
|
|
121
129
|
}, this.renderChildren()), jsx("div", {
|
|
122
|
-
css: this.props.styles
|
|
130
|
+
css: (_this$props$styles4 = this.props.styles) === null || _this$props$styles4 === void 0 ? void 0 : _this$props$styles4.toggle
|
|
123
131
|
}, jsx(NavigationItem, {
|
|
124
132
|
"aria-expanded": !this.minimized,
|
|
125
133
|
onClick: this.handleNavToggle,
|
|
126
134
|
icon: jsx(IconMoveStartLine, {
|
|
127
|
-
css: this.props.styles
|
|
135
|
+
css: (_this$props$styles5 = this.props.styles) === null || _this$props$styles5 === void 0 ? void 0 : _this$props$styles5.toggleIcon,
|
|
128
136
|
inline: false
|
|
129
137
|
}),
|
|
130
138
|
label: jsx(ScreenReaderContent, null, this.toggleMessage())
|
package/es/Navigation/theme.js
CHANGED
|
@@ -41,17 +41,17 @@ const generateComponentTheme = theme => {
|
|
|
41
41
|
}
|
|
42
42
|
};
|
|
43
43
|
const componentVariables = {
|
|
44
|
-
fontColor: colors
|
|
45
|
-
backgroundColor: colors
|
|
44
|
+
fontColor: colors === null || colors === void 0 ? void 0 : colors.textLightest,
|
|
45
|
+
backgroundColor: colors === null || colors === void 0 ? void 0 : colors.backgroundBrandSecondary,
|
|
46
46
|
width: '5.25rem',
|
|
47
47
|
minimizedWidth: '3.375rem',
|
|
48
|
-
fill: colors
|
|
49
|
-
focusOutlineInnerWidth: borders
|
|
50
|
-
focusOutlineOuterWidth: borders
|
|
51
|
-
focusOutlineInnerColor: colors
|
|
52
|
-
focusOutlineOuterColor: colors
|
|
53
|
-
marginBottom: spacing
|
|
54
|
-
toggleTransition: transitions
|
|
48
|
+
fill: colors === null || colors === void 0 ? void 0 : colors.textLightest,
|
|
49
|
+
focusOutlineInnerWidth: borders === null || borders === void 0 ? void 0 : borders.widthMedium,
|
|
50
|
+
focusOutlineOuterWidth: borders === null || borders === void 0 ? void 0 : borders.widthSmall,
|
|
51
|
+
focusOutlineInnerColor: colors === null || colors === void 0 ? void 0 : colors.borderBrand,
|
|
52
|
+
focusOutlineOuterColor: colors === null || colors === void 0 ? void 0 : colors.borderLightest,
|
|
53
|
+
marginBottom: spacing === null || spacing === void 0 ? void 0 : spacing.small,
|
|
54
|
+
toggleTransition: transitions === null || transitions === void 0 ? void 0 : transitions.duration
|
|
55
55
|
};
|
|
56
56
|
return { ...componentVariables,
|
|
57
57
|
...themeSpecificStyle[themeName]
|
package/lib/AppNav/Item/index.js
CHANGED
|
@@ -73,22 +73,28 @@ let Item = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _de
|
|
|
73
73
|
}
|
|
74
74
|
|
|
75
75
|
componentDidMount() {
|
|
76
|
-
|
|
76
|
+
var _this$props$makeStyle, _this$props2;
|
|
77
|
+
|
|
78
|
+
(_this$props$makeStyle = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props2);
|
|
77
79
|
}
|
|
78
80
|
|
|
79
81
|
componentDidUpdate() {
|
|
80
|
-
|
|
82
|
+
var _this$props$makeStyle2, _this$props3;
|
|
83
|
+
|
|
84
|
+
(_this$props$makeStyle2 = (_this$props3 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props3);
|
|
81
85
|
}
|
|
82
86
|
|
|
83
87
|
render() {
|
|
88
|
+
var _this$props$styles, _this$props$styles2;
|
|
89
|
+
|
|
84
90
|
const ElementType = (0, _getElementType.getElementType)(Item, this.props);
|
|
85
|
-
const _this$
|
|
86
|
-
renderIcon = _this$
|
|
87
|
-
renderLabel = _this$
|
|
88
|
-
href = _this$
|
|
89
|
-
renderAfter = _this$
|
|
90
|
-
cursor = _this$
|
|
91
|
-
isDisabled = _this$
|
|
91
|
+
const _this$props4 = this.props,
|
|
92
|
+
renderIcon = _this$props4.renderIcon,
|
|
93
|
+
renderLabel = _this$props4.renderLabel,
|
|
94
|
+
href = _this$props4.href,
|
|
95
|
+
renderAfter = _this$props4.renderAfter,
|
|
96
|
+
cursor = _this$props4.cursor,
|
|
97
|
+
isDisabled = _this$props4.isDisabled;
|
|
92
98
|
const icon = (0, _callRenderProp.callRenderProp)(renderIcon);
|
|
93
99
|
const label = (0, _callRenderProp.callRenderProp)(renderLabel);
|
|
94
100
|
const labelIsForScreenReaders = (0, _matchComponentTypes.matchComponentTypes)(label, [_ScreenReaderContent.ScreenReaderContent]);
|
|
@@ -109,9 +115,9 @@ let Item = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _de
|
|
|
109
115
|
onFocus: this.handleFocus,
|
|
110
116
|
onBlur: this.handleBlur,
|
|
111
117
|
cursor: isDisabled ? 'not-allowed' : cursor,
|
|
112
|
-
css: this.props.styles
|
|
118
|
+
css: (_this$props$styles = this.props.styles) === null || _this$props$styles === void 0 ? void 0 : _this$props$styles.item
|
|
113
119
|
}), icon, labelIsForScreenReaders ? label : (0, _emotion.jsx)("span", {
|
|
114
|
-
css: this.props.styles
|
|
120
|
+
css: (_this$props$styles2 = this.props.styles) === null || _this$props$styles2 === void 0 ? void 0 : _this$props$styles2.label
|
|
115
121
|
}, label), renderAfter && (0, _callRenderProp.callRenderProp)(renderAfter));
|
|
116
122
|
}
|
|
117
123
|
|
package/lib/AppNav/Item/theme.js
CHANGED
|
@@ -39,14 +39,14 @@ const generateComponentTheme = theme => {
|
|
|
39
39
|
spacing = theme.spacing,
|
|
40
40
|
typography = theme.typography;
|
|
41
41
|
const componentVariables = {
|
|
42
|
-
fontFamily: typography
|
|
42
|
+
fontFamily: typography === null || typography === void 0 ? void 0 : typography.fontFamily,
|
|
43
43
|
fontSize: '1.125rem',
|
|
44
|
-
fontWeight: typography
|
|
45
|
-
textColor: colors
|
|
46
|
-
textColorSelected: colors
|
|
44
|
+
fontWeight: typography === null || typography === void 0 ? void 0 : typography.fontWeightBold,
|
|
45
|
+
textColor: colors === null || colors === void 0 ? void 0 : colors.textLink,
|
|
46
|
+
textColorSelected: colors === null || colors === void 0 ? void 0 : colors.textDarkest,
|
|
47
47
|
height: '2.25rem',
|
|
48
|
-
padding: spacing
|
|
49
|
-
backgroundColor: colors
|
|
48
|
+
padding: spacing === null || spacing === void 0 ? void 0 : spacing.small,
|
|
49
|
+
backgroundColor: colors === null || colors === void 0 ? void 0 : colors.backgroundLightest
|
|
50
50
|
};
|
|
51
51
|
return { ...componentVariables
|
|
52
52
|
};
|
package/lib/AppNav/index.js
CHANGED
|
@@ -52,7 +52,9 @@ let AppNav = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _
|
|
|
52
52
|
this._list = null;
|
|
53
53
|
|
|
54
54
|
this.measureItems = () => {
|
|
55
|
-
|
|
55
|
+
var _this$props$styles;
|
|
56
|
+
|
|
57
|
+
const menuTriggerWidth = (0, _px.px)((_this$props$styles = this.props.styles) === null || _this$props$styles === void 0 ? void 0 : _this$props$styles.menuTriggerWidth);
|
|
56
58
|
let visibleItemsCount = 0;
|
|
57
59
|
|
|
58
60
|
if (this._list) {
|
|
@@ -111,7 +113,9 @@ let AppNav = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _
|
|
|
111
113
|
}
|
|
112
114
|
|
|
113
115
|
componentDidMount() {
|
|
114
|
-
|
|
116
|
+
var _this$props$makeStyle, _this$props;
|
|
117
|
+
|
|
118
|
+
(_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props);
|
|
115
119
|
|
|
116
120
|
const _getBoundingClientRec3 = (0, _getBoundingClientRect.getBoundingClientRect)(this._list),
|
|
117
121
|
origWidth = _getBoundingClientRec3.width;
|
|
@@ -136,7 +140,9 @@ let AppNav = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _
|
|
|
136
140
|
}
|
|
137
141
|
|
|
138
142
|
componentDidUpdate() {
|
|
139
|
-
|
|
143
|
+
var _this$props$makeStyle2, _this$props2;
|
|
144
|
+
|
|
145
|
+
(_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2);
|
|
140
146
|
}
|
|
141
147
|
|
|
142
148
|
componentWillUnmount() {
|
|
@@ -150,9 +156,11 @@ let AppNav = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _
|
|
|
150
156
|
}
|
|
151
157
|
|
|
152
158
|
renderListItem(item, isMenuTrigger, key) {
|
|
159
|
+
var _this$props$styles2, _this$props$styles3;
|
|
160
|
+
|
|
153
161
|
return (0, _emotion.jsx)("li", {
|
|
154
162
|
key: key,
|
|
155
|
-
css: isMenuTrigger ? this.props.styles
|
|
163
|
+
css: isMenuTrigger ? (_this$props$styles2 = this.props.styles) === null || _this$props$styles2 === void 0 ? void 0 : _this$props$styles2.listItemWithMenuTrigger : (_this$props$styles3 = this.props.styles) === null || _this$props$styles3 === void 0 ? void 0 : _this$props$styles3.listItem
|
|
156
164
|
}, item);
|
|
157
165
|
}
|
|
158
166
|
|
|
@@ -174,11 +182,13 @@ let AppNav = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _
|
|
|
174
182
|
}
|
|
175
183
|
|
|
176
184
|
render() {
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
185
|
+
var _this$props$styles4, _this$props$styles5, _this$props$styles6;
|
|
186
|
+
|
|
187
|
+
const _this$props3 = this.props,
|
|
188
|
+
children = _this$props3.children,
|
|
189
|
+
visibleItemsCount = _this$props3.visibleItemsCount,
|
|
190
|
+
screenReaderLabel = _this$props3.screenReaderLabel,
|
|
191
|
+
margin = _this$props3.margin;
|
|
182
192
|
|
|
183
193
|
const passthroughProps = _View.View.omitViewProps((0, _omitProps.omitProps)(this.props, AppNav.allowedProps), AppNav);
|
|
184
194
|
|
|
@@ -193,13 +203,13 @@ let AppNav = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _
|
|
|
193
203
|
const hasRenderedContent = renderBeforeItems || renderAfterItems;
|
|
194
204
|
return (0, _emotion.jsx)(_View.View, Object.assign({}, passthroughProps, {
|
|
195
205
|
as: "nav",
|
|
196
|
-
css: [this.props.styles
|
|
206
|
+
css: [(_this$props$styles4 = this.props.styles) === null || _this$props$styles4 === void 0 ? void 0 : _this$props$styles4.appNav, hasRenderedContent ? (_this$props$styles5 = this.props.styles) === null || _this$props$styles5 === void 0 ? void 0 : _this$props$styles5.alignCenter : ''],
|
|
197
207
|
margin: margin,
|
|
198
208
|
display: hasRenderedContent ? 'flex' : 'block',
|
|
199
209
|
elementRef: this.handleRef
|
|
200
210
|
}), renderBeforeItems && (0, _emotion.jsx)("span", null, renderBeforeItems), (0, _emotion.jsx)("ul", {
|
|
201
211
|
ref: el => this._list = el,
|
|
202
|
-
css: this.props.styles
|
|
212
|
+
css: (_this$props$styles6 = this.props.styles) === null || _this$props$styles6 === void 0 ? void 0 : _this$props$styles6.list,
|
|
203
213
|
"aria-label": (0, _callRenderProp.callRenderProp)(screenReaderLabel)
|
|
204
214
|
}, visibleChildren.map((child, index) => {
|
|
205
215
|
return this.renderListItem(child, false, index);
|
package/lib/AppNav/theme.js
CHANGED
|
@@ -40,13 +40,13 @@ const generateComponentTheme = theme => {
|
|
|
40
40
|
spacing = theme.spacing,
|
|
41
41
|
typography = theme.typography;
|
|
42
42
|
const componentVariables = {
|
|
43
|
-
fontFamily: typography
|
|
43
|
+
fontFamily: typography === null || typography === void 0 ? void 0 : typography.fontFamily,
|
|
44
44
|
height: '3.75rem',
|
|
45
45
|
// 60px per product design
|
|
46
|
-
borderColor: colors
|
|
47
|
-
borderStyle: borders
|
|
48
|
-
borderWidth: borders
|
|
49
|
-
horizontalMargin: spacing
|
|
46
|
+
borderColor: colors === null || colors === void 0 ? void 0 : colors.borderMedium,
|
|
47
|
+
borderStyle: borders === null || borders === void 0 ? void 0 : borders.style,
|
|
48
|
+
borderWidth: borders === null || borders === void 0 ? void 0 : borders.widthSmall,
|
|
49
|
+
horizontalMargin: spacing === null || spacing === void 0 ? void 0 : spacing.xxSmall,
|
|
50
50
|
menuTriggerWidth: '7.5rem'
|
|
51
51
|
};
|
|
52
52
|
return { ...componentVariables
|
|
@@ -42,45 +42,51 @@ let NavigationItem = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.def
|
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
componentDidMount() {
|
|
45
|
-
|
|
45
|
+
var _this$props$makeStyle, _this$props;
|
|
46
|
+
|
|
47
|
+
(_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props, {
|
|
46
48
|
minimized: this.props.minimized
|
|
47
49
|
});
|
|
48
50
|
}
|
|
49
51
|
|
|
50
52
|
componentDidUpdate() {
|
|
51
|
-
|
|
53
|
+
var _this$props$makeStyle2, _this$props2;
|
|
54
|
+
|
|
55
|
+
(_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2, {
|
|
52
56
|
minimized: this.props.minimized
|
|
53
57
|
});
|
|
54
58
|
}
|
|
55
59
|
|
|
56
60
|
renderLink() {
|
|
61
|
+
var _this$props$styles, _this$props$styles2, _this$props$styles3;
|
|
62
|
+
|
|
57
63
|
const ElementType = (0, _getElementType.getElementType)(NavigationItem, this.props);
|
|
58
|
-
const _this$
|
|
59
|
-
href = _this$
|
|
60
|
-
onClick = _this$
|
|
61
|
-
icon = _this$
|
|
62
|
-
label = _this$
|
|
64
|
+
const _this$props3 = this.props,
|
|
65
|
+
href = _this$props3.href,
|
|
66
|
+
onClick = _this$props3.onClick,
|
|
67
|
+
icon = _this$props3.icon,
|
|
68
|
+
label = _this$props3.label;
|
|
63
69
|
const props = (0, _omitProps.omitProps)(this.props, NavigationItem.allowedProps);
|
|
64
70
|
return (0, _emotion.jsx)(ElementType, Object.assign({}, props, {
|
|
65
71
|
href: href,
|
|
66
72
|
onClick: onClick,
|
|
67
|
-
css: this.props.styles
|
|
73
|
+
css: (_this$props$styles = this.props.styles) === null || _this$props$styles === void 0 ? void 0 : _this$props$styles.navigationItem,
|
|
68
74
|
"aria-label": this.props.minimized ? label : void 0,
|
|
69
75
|
ref: element => {
|
|
70
76
|
this.ref = element;
|
|
71
77
|
}
|
|
72
78
|
}), (0, _emotion.jsx)("div", {
|
|
73
|
-
css: this.props.styles
|
|
79
|
+
css: (_this$props$styles2 = this.props.styles) === null || _this$props$styles2 === void 0 ? void 0 : _this$props$styles2.icon,
|
|
74
80
|
"aria-hidden": "true"
|
|
75
81
|
}, icon), !this.props.minimized ? (0, _emotion.jsx)("div", {
|
|
76
|
-
css: this.props.styles
|
|
82
|
+
css: (_this$props$styles3 = this.props.styles) === null || _this$props$styles3 === void 0 ? void 0 : _this$props$styles3.label
|
|
77
83
|
}, label) : null);
|
|
78
84
|
}
|
|
79
85
|
|
|
80
86
|
render() {
|
|
81
|
-
const _this$
|
|
82
|
-
minimized = _this$
|
|
83
|
-
label = _this$
|
|
87
|
+
const _this$props4 = this.props,
|
|
88
|
+
minimized = _this$props4.minimized,
|
|
89
|
+
label = _this$props4.label;
|
|
84
90
|
const link = this.renderLink();
|
|
85
91
|
return minimized && (0, _hasVisibleChildren.hasVisibleChildren)(label) ? (0, _emotion.jsx)(_Tooltip.Tooltip, {
|
|
86
92
|
renderTip: label,
|