@instructure/ui-navigation 8.17.1-snapshot.18 → 8.17.1-snapshot.32
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/AppNav/Item/index.js +11 -17
- package/es/AppNav/Item/theme.js +6 -6
- package/es/AppNav/index.js +11 -21
- package/es/AppNav/theme.js +5 -5
- package/es/Navigation/NavigationItem/index.js +13 -19
- package/es/Navigation/NavigationItem/theme.js +15 -15
- package/es/Navigation/index.js +7 -15
- package/es/Navigation/theme.js +9 -9
- package/lib/AppNav/Item/index.js +11 -17
- package/lib/AppNav/Item/theme.js +6 -6
- package/lib/AppNav/index.js +11 -21
- package/lib/AppNav/theme.js +5 -5
- package/lib/Navigation/NavigationItem/index.js +13 -19
- package/lib/Navigation/NavigationItem/theme.js +15 -15
- package/lib/Navigation/index.js +7 -15
- package/lib/Navigation/theme.js +9 -9
- package/package.json +24 -24
- package/tsconfig.build.tsbuildinfo +1 -1
package/es/AppNav/Item/index.js
CHANGED
|
@@ -72,28 +72,22 @@ let Item = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2 = tes
|
|
|
72
72
|
}
|
|
73
73
|
|
|
74
74
|
componentDidMount() {
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
(_this$props$makeStyle = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props2);
|
|
75
|
+
this.props.makeStyles?.();
|
|
78
76
|
}
|
|
79
77
|
|
|
80
78
|
componentDidUpdate() {
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
(_this$props$makeStyle2 = (_this$props3 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props3);
|
|
79
|
+
this.props.makeStyles?.();
|
|
84
80
|
}
|
|
85
81
|
|
|
86
82
|
render() {
|
|
87
|
-
var _this$props$styles, _this$props$styles2;
|
|
88
|
-
|
|
89
83
|
const ElementType = getElementType(Item, this.props);
|
|
90
|
-
const _this$
|
|
91
|
-
renderIcon = _this$
|
|
92
|
-
renderLabel = _this$
|
|
93
|
-
href = _this$
|
|
94
|
-
renderAfter = _this$
|
|
95
|
-
cursor = _this$
|
|
96
|
-
isDisabled = _this$
|
|
84
|
+
const _this$props2 = this.props,
|
|
85
|
+
renderIcon = _this$props2.renderIcon,
|
|
86
|
+
renderLabel = _this$props2.renderLabel,
|
|
87
|
+
href = _this$props2.href,
|
|
88
|
+
renderAfter = _this$props2.renderAfter,
|
|
89
|
+
cursor = _this$props2.cursor,
|
|
90
|
+
isDisabled = _this$props2.isDisabled;
|
|
97
91
|
const icon = callRenderProp(renderIcon);
|
|
98
92
|
const label = callRenderProp(renderLabel);
|
|
99
93
|
const labelIsForScreenReaders = matchComponentTypes(label, [ScreenReaderContent]);
|
|
@@ -114,9 +108,9 @@ let Item = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2 = tes
|
|
|
114
108
|
onFocus: this.handleFocus,
|
|
115
109
|
onBlur: this.handleBlur,
|
|
116
110
|
cursor: isDisabled ? 'not-allowed' : cursor,
|
|
117
|
-
css:
|
|
111
|
+
css: this.props.styles?.item
|
|
118
112
|
}), icon, labelIsForScreenReaders ? label : jsx("span", {
|
|
119
|
-
css:
|
|
113
|
+
css: this.props.styles?.label
|
|
120
114
|
}, label), renderAfter && callRenderProp(renderAfter));
|
|
121
115
|
}
|
|
122
116
|
|
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?.fontFamily,
|
|
36
36
|
fontSize: '1.125rem',
|
|
37
|
-
fontWeight: typography
|
|
38
|
-
textColor: colors
|
|
39
|
-
textColorSelected: colors
|
|
37
|
+
fontWeight: typography?.fontWeightBold,
|
|
38
|
+
textColor: colors?.textLink,
|
|
39
|
+
textColorSelected: colors?.textDarkest,
|
|
40
40
|
height: '2.25rem',
|
|
41
|
-
padding: spacing
|
|
42
|
-
backgroundColor: colors
|
|
41
|
+
padding: spacing?.small,
|
|
42
|
+
backgroundColor: colors?.backgroundLightest
|
|
43
43
|
};
|
|
44
44
|
return { ...componentVariables
|
|
45
45
|
};
|
package/es/AppNav/index.js
CHANGED
|
@@ -54,9 +54,7 @@ let AppNav = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2 = t
|
|
|
54
54
|
this._list = null;
|
|
55
55
|
|
|
56
56
|
this.measureItems = () => {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
const menuTriggerWidth = px((_this$props$styles = this.props.styles) === null || _this$props$styles === void 0 ? void 0 : _this$props$styles.menuTriggerWidth);
|
|
57
|
+
const menuTriggerWidth = px(this.props.styles?.menuTriggerWidth);
|
|
60
58
|
let visibleItemsCount = 0;
|
|
61
59
|
|
|
62
60
|
if (this._list) {
|
|
@@ -115,9 +113,7 @@ let AppNav = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2 = t
|
|
|
115
113
|
}
|
|
116
114
|
|
|
117
115
|
componentDidMount() {
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
(_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props);
|
|
116
|
+
this.props.makeStyles?.();
|
|
121
117
|
|
|
122
118
|
const _getBoundingClientRec3 = getBoundingClientRect(this._list),
|
|
123
119
|
origWidth = _getBoundingClientRec3.width;
|
|
@@ -142,9 +138,7 @@ let AppNav = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2 = t
|
|
|
142
138
|
}
|
|
143
139
|
|
|
144
140
|
componentDidUpdate() {
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
(_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2);
|
|
141
|
+
this.props.makeStyles?.();
|
|
148
142
|
}
|
|
149
143
|
|
|
150
144
|
componentWillUnmount() {
|
|
@@ -158,11 +152,9 @@ let AppNav = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2 = t
|
|
|
158
152
|
}
|
|
159
153
|
|
|
160
154
|
renderListItem(item, isMenuTrigger, key) {
|
|
161
|
-
var _this$props$styles2, _this$props$styles3;
|
|
162
|
-
|
|
163
155
|
return jsx("li", {
|
|
164
156
|
key: key,
|
|
165
|
-
css: isMenuTrigger ?
|
|
157
|
+
css: isMenuTrigger ? this.props.styles?.listItemWithMenuTrigger : this.props.styles?.listItem
|
|
166
158
|
}, item);
|
|
167
159
|
}
|
|
168
160
|
|
|
@@ -184,13 +176,11 @@ let AppNav = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2 = t
|
|
|
184
176
|
}
|
|
185
177
|
|
|
186
178
|
render() {
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
screenReaderLabel = _this$props3.screenReaderLabel,
|
|
193
|
-
margin = _this$props3.margin;
|
|
179
|
+
const _this$props = this.props,
|
|
180
|
+
children = _this$props.children,
|
|
181
|
+
visibleItemsCount = _this$props.visibleItemsCount,
|
|
182
|
+
screenReaderLabel = _this$props.screenReaderLabel,
|
|
183
|
+
margin = _this$props.margin;
|
|
194
184
|
const passthroughProps = View.omitViewProps(omitProps(this.props, AppNav.allowedProps), AppNav);
|
|
195
185
|
const isMeasuring = this.state.isMeasuring;
|
|
196
186
|
const childrenArray = Children.toArray(children);
|
|
@@ -201,13 +191,13 @@ let AppNav = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2 = t
|
|
|
201
191
|
const hasRenderedContent = renderBeforeItems || renderAfterItems;
|
|
202
192
|
return jsx(View, Object.assign({}, passthroughProps, {
|
|
203
193
|
as: "nav",
|
|
204
|
-
css: [
|
|
194
|
+
css: [this.props.styles?.appNav, hasRenderedContent ? this.props.styles?.alignCenter : ''],
|
|
205
195
|
margin: margin,
|
|
206
196
|
display: hasRenderedContent ? 'flex' : 'block',
|
|
207
197
|
elementRef: this.handleRef
|
|
208
198
|
}), renderBeforeItems && jsx("span", null, renderBeforeItems), jsx("ul", {
|
|
209
199
|
ref: el => this._list = el,
|
|
210
|
-
css:
|
|
200
|
+
css: this.props.styles?.list,
|
|
211
201
|
"aria-label": callRenderProp(screenReaderLabel)
|
|
212
202
|
}, visibleChildren.map((child, index) => {
|
|
213
203
|
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?.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?.borderMedium,
|
|
40
|
+
borderStyle: borders?.style,
|
|
41
|
+
borderWidth: borders?.widthSmall,
|
|
42
|
+
horizontalMargin: spacing?.xxSmall,
|
|
43
43
|
menuTriggerWidth: '7.5rem'
|
|
44
44
|
};
|
|
45
45
|
return { ...componentVariables
|
|
@@ -48,51 +48,45 @@ let NavigationItem = (_dec = withStyle(generateStyle, generateComponentTheme), _
|
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
componentDidMount() {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
(_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props, {
|
|
51
|
+
this.props.makeStyles?.({
|
|
54
52
|
minimized: this.props.minimized
|
|
55
53
|
});
|
|
56
54
|
}
|
|
57
55
|
|
|
58
56
|
componentDidUpdate() {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
(_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2, {
|
|
57
|
+
this.props.makeStyles?.({
|
|
62
58
|
minimized: this.props.minimized
|
|
63
59
|
});
|
|
64
60
|
}
|
|
65
61
|
|
|
66
62
|
renderLink() {
|
|
67
|
-
var _this$props$styles, _this$props$styles2, _this$props$styles3;
|
|
68
|
-
|
|
69
63
|
const ElementType = getElementType(NavigationItem, this.props);
|
|
70
|
-
const _this$
|
|
71
|
-
href = _this$
|
|
72
|
-
onClick = _this$
|
|
73
|
-
icon = _this$
|
|
74
|
-
label = _this$
|
|
64
|
+
const _this$props = this.props,
|
|
65
|
+
href = _this$props.href,
|
|
66
|
+
onClick = _this$props.onClick,
|
|
67
|
+
icon = _this$props.icon,
|
|
68
|
+
label = _this$props.label;
|
|
75
69
|
const props = omitProps(this.props, NavigationItem.allowedProps);
|
|
76
70
|
return jsx(ElementType, Object.assign({}, props, {
|
|
77
71
|
href: href,
|
|
78
72
|
onClick: onClick,
|
|
79
|
-
css:
|
|
73
|
+
css: this.props.styles?.navigationItem,
|
|
80
74
|
"aria-label": this.props.minimized ? label : void 0,
|
|
81
75
|
ref: element => {
|
|
82
76
|
this.ref = element;
|
|
83
77
|
}
|
|
84
78
|
}), jsx("div", {
|
|
85
|
-
css:
|
|
79
|
+
css: this.props.styles?.icon,
|
|
86
80
|
"aria-hidden": "true"
|
|
87
81
|
}, icon), !this.props.minimized ? jsx("div", {
|
|
88
|
-
css:
|
|
82
|
+
css: this.props.styles?.label
|
|
89
83
|
}, label) : null);
|
|
90
84
|
}
|
|
91
85
|
|
|
92
86
|
render() {
|
|
93
|
-
const _this$
|
|
94
|
-
minimized = _this$
|
|
95
|
-
label = _this$
|
|
87
|
+
const _this$props2 = this.props,
|
|
88
|
+
minimized = _this$props2.minimized,
|
|
89
|
+
label = _this$props2.label;
|
|
96
90
|
const link = this.renderLink();
|
|
97
91
|
return minimized && hasVisibleChildren(label) ? jsx(Tooltip, {
|
|
98
92
|
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?.fontSizeSmall,
|
|
50
|
+
fontFamily: typography?.fontFamily,
|
|
51
|
+
fontWeight: typography?.fontWeightLight,
|
|
52
|
+
fontColor: colors?.textLightest,
|
|
53
53
|
iconSize: '1.625rem',
|
|
54
|
-
iconColor: colors
|
|
55
|
-
lineHeight: typography
|
|
54
|
+
iconColor: colors?.textLightest,
|
|
55
|
+
lineHeight: 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?.backgroundDarkest,
|
|
59
|
+
outerFocusOutline: `inset 0 0 0 0.125rem ${colors?.borderDarkest}`,
|
|
60
|
+
innerFocusOutline: `inset 0 0 0 0.25rem ${colors?.borderLightest}`,
|
|
61
|
+
selectedFontColor: colors?.textBrand,
|
|
62
|
+
selectedIconColor: colors?.textBrand,
|
|
63
|
+
selectedBackgroundColor: colors?.backgroundLightest,
|
|
64
|
+
selectedOuterFocusOutline: `inset 0 0 0 0.125rem ${colors?.borderLightest}`,
|
|
65
|
+
selectedInnerFocusOutline: `inset 0 0 0 0.25rem ${colors?.borderBrand}`,
|
|
66
|
+
contentPadding: spacing?.xxSmall
|
|
67
67
|
};
|
|
68
68
|
return { ...componentVariables,
|
|
69
69
|
...themeSpecificStyle[themeName]
|
package/es/Navigation/index.js
CHANGED
|
@@ -68,17 +68,13 @@ let Navigation = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2
|
|
|
68
68
|
}
|
|
69
69
|
|
|
70
70
|
componentDidMount() {
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
(_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props, {
|
|
71
|
+
this.props.makeStyles?.({
|
|
74
72
|
minimized: this.minimized
|
|
75
73
|
});
|
|
76
74
|
}
|
|
77
75
|
|
|
78
76
|
componentDidUpdate() {
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
(_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2, {
|
|
77
|
+
this.props.makeStyles?.({
|
|
82
78
|
minimized: this.minimized
|
|
83
79
|
});
|
|
84
80
|
}
|
|
@@ -98,13 +94,11 @@ let Navigation = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2
|
|
|
98
94
|
|
|
99
95
|
renderChildren() {
|
|
100
96
|
return Children.map(this.props.children, child => {
|
|
101
|
-
var _this$props$styles;
|
|
102
|
-
|
|
103
97
|
const navItem = safeCloneElement(child, {
|
|
104
98
|
minimized: this.state.minimized
|
|
105
99
|
});
|
|
106
100
|
return jsx("li", {
|
|
107
|
-
css:
|
|
101
|
+
css: this.props.styles?.list
|
|
108
102
|
}, navItem);
|
|
109
103
|
});
|
|
110
104
|
}
|
|
@@ -114,25 +108,23 @@ let Navigation = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2
|
|
|
114
108
|
}
|
|
115
109
|
|
|
116
110
|
render() {
|
|
117
|
-
var _this$props$styles2, _this$props$styles3, _this$props$styles4, _this$props$styles5;
|
|
118
|
-
|
|
119
111
|
const label = this.props.label;
|
|
120
112
|
const props = omitProps(this.props, Navigation.allowedProps, ['minimized']);
|
|
121
113
|
return jsx("nav", Object.assign({}, props, {
|
|
122
|
-
css:
|
|
114
|
+
css: this.props.styles?.navigation,
|
|
123
115
|
"aria-label": label,
|
|
124
116
|
ref: element => {
|
|
125
117
|
this.ref = element;
|
|
126
118
|
}
|
|
127
119
|
}), jsx("ul", {
|
|
128
|
-
css:
|
|
120
|
+
css: this.props.styles?.content
|
|
129
121
|
}, this.renderChildren()), jsx("div", {
|
|
130
|
-
css:
|
|
122
|
+
css: this.props.styles?.toggle
|
|
131
123
|
}, jsx(NavigationItem, {
|
|
132
124
|
"aria-expanded": !this.minimized,
|
|
133
125
|
onClick: this.handleNavToggle,
|
|
134
126
|
icon: jsx(IconMoveStartLine, {
|
|
135
|
-
css:
|
|
127
|
+
css: this.props.styles?.toggleIcon,
|
|
136
128
|
inline: false
|
|
137
129
|
}),
|
|
138
130
|
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?.textLightest,
|
|
45
|
+
backgroundColor: 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?.textLightest,
|
|
49
|
+
focusOutlineInnerWidth: borders?.widthMedium,
|
|
50
|
+
focusOutlineOuterWidth: borders?.widthSmall,
|
|
51
|
+
focusOutlineInnerColor: colors?.borderBrand,
|
|
52
|
+
focusOutlineOuterColor: colors?.borderLightest,
|
|
53
|
+
marginBottom: spacing?.small,
|
|
54
|
+
toggleTransition: transitions?.duration
|
|
55
55
|
};
|
|
56
56
|
return { ...componentVariables,
|
|
57
57
|
...themeSpecificStyle[themeName]
|
package/lib/AppNav/Item/index.js
CHANGED
|
@@ -73,28 +73,22 @@ let Item = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _de
|
|
|
73
73
|
}
|
|
74
74
|
|
|
75
75
|
componentDidMount() {
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
(_this$props$makeStyle = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props2);
|
|
76
|
+
this.props.makeStyles?.();
|
|
79
77
|
}
|
|
80
78
|
|
|
81
79
|
componentDidUpdate() {
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
(_this$props$makeStyle2 = (_this$props3 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props3);
|
|
80
|
+
this.props.makeStyles?.();
|
|
85
81
|
}
|
|
86
82
|
|
|
87
83
|
render() {
|
|
88
|
-
var _this$props$styles, _this$props$styles2;
|
|
89
|
-
|
|
90
84
|
const ElementType = (0, _getElementType.getElementType)(Item, this.props);
|
|
91
|
-
const _this$
|
|
92
|
-
renderIcon = _this$
|
|
93
|
-
renderLabel = _this$
|
|
94
|
-
href = _this$
|
|
95
|
-
renderAfter = _this$
|
|
96
|
-
cursor = _this$
|
|
97
|
-
isDisabled = _this$
|
|
85
|
+
const _this$props2 = this.props,
|
|
86
|
+
renderIcon = _this$props2.renderIcon,
|
|
87
|
+
renderLabel = _this$props2.renderLabel,
|
|
88
|
+
href = _this$props2.href,
|
|
89
|
+
renderAfter = _this$props2.renderAfter,
|
|
90
|
+
cursor = _this$props2.cursor,
|
|
91
|
+
isDisabled = _this$props2.isDisabled;
|
|
98
92
|
const icon = (0, _callRenderProp.callRenderProp)(renderIcon);
|
|
99
93
|
const label = (0, _callRenderProp.callRenderProp)(renderLabel);
|
|
100
94
|
const labelIsForScreenReaders = (0, _matchComponentTypes.matchComponentTypes)(label, [_ScreenReaderContent.ScreenReaderContent]);
|
|
@@ -115,9 +109,9 @@ let Item = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _de
|
|
|
115
109
|
onFocus: this.handleFocus,
|
|
116
110
|
onBlur: this.handleBlur,
|
|
117
111
|
cursor: isDisabled ? 'not-allowed' : cursor,
|
|
118
|
-
css:
|
|
112
|
+
css: this.props.styles?.item
|
|
119
113
|
}), icon, labelIsForScreenReaders ? label : (0, _emotion.jsx)("span", {
|
|
120
|
-
css:
|
|
114
|
+
css: this.props.styles?.label
|
|
121
115
|
}, label), renderAfter && (0, _callRenderProp.callRenderProp)(renderAfter));
|
|
122
116
|
}
|
|
123
117
|
|
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?.fontFamily,
|
|
43
43
|
fontSize: '1.125rem',
|
|
44
|
-
fontWeight: typography
|
|
45
|
-
textColor: colors
|
|
46
|
-
textColorSelected: colors
|
|
44
|
+
fontWeight: typography?.fontWeightBold,
|
|
45
|
+
textColor: colors?.textLink,
|
|
46
|
+
textColorSelected: colors?.textDarkest,
|
|
47
47
|
height: '2.25rem',
|
|
48
|
-
padding: spacing
|
|
49
|
-
backgroundColor: colors
|
|
48
|
+
padding: spacing?.small,
|
|
49
|
+
backgroundColor: colors?.backgroundLightest
|
|
50
50
|
};
|
|
51
51
|
return { ...componentVariables
|
|
52
52
|
};
|
package/lib/AppNav/index.js
CHANGED
|
@@ -52,9 +52,7 @@ let AppNav = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _
|
|
|
52
52
|
this._list = null;
|
|
53
53
|
|
|
54
54
|
this.measureItems = () => {
|
|
55
|
-
|
|
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);
|
|
55
|
+
const menuTriggerWidth = (0, _px.px)(this.props.styles?.menuTriggerWidth);
|
|
58
56
|
let visibleItemsCount = 0;
|
|
59
57
|
|
|
60
58
|
if (this._list) {
|
|
@@ -113,9 +111,7 @@ let AppNav = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _
|
|
|
113
111
|
}
|
|
114
112
|
|
|
115
113
|
componentDidMount() {
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
(_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props);
|
|
114
|
+
this.props.makeStyles?.();
|
|
119
115
|
|
|
120
116
|
const _getBoundingClientRec3 = (0, _getBoundingClientRect.getBoundingClientRect)(this._list),
|
|
121
117
|
origWidth = _getBoundingClientRec3.width;
|
|
@@ -140,9 +136,7 @@ let AppNav = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _
|
|
|
140
136
|
}
|
|
141
137
|
|
|
142
138
|
componentDidUpdate() {
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
(_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2);
|
|
139
|
+
this.props.makeStyles?.();
|
|
146
140
|
}
|
|
147
141
|
|
|
148
142
|
componentWillUnmount() {
|
|
@@ -156,11 +150,9 @@ let AppNav = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _
|
|
|
156
150
|
}
|
|
157
151
|
|
|
158
152
|
renderListItem(item, isMenuTrigger, key) {
|
|
159
|
-
var _this$props$styles2, _this$props$styles3;
|
|
160
|
-
|
|
161
153
|
return (0, _emotion.jsx)("li", {
|
|
162
154
|
key: key,
|
|
163
|
-
css: isMenuTrigger ?
|
|
155
|
+
css: isMenuTrigger ? this.props.styles?.listItemWithMenuTrigger : this.props.styles?.listItem
|
|
164
156
|
}, item);
|
|
165
157
|
}
|
|
166
158
|
|
|
@@ -182,13 +174,11 @@ let AppNav = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _
|
|
|
182
174
|
}
|
|
183
175
|
|
|
184
176
|
render() {
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
screenReaderLabel = _this$props3.screenReaderLabel,
|
|
191
|
-
margin = _this$props3.margin;
|
|
177
|
+
const _this$props = this.props,
|
|
178
|
+
children = _this$props.children,
|
|
179
|
+
visibleItemsCount = _this$props.visibleItemsCount,
|
|
180
|
+
screenReaderLabel = _this$props.screenReaderLabel,
|
|
181
|
+
margin = _this$props.margin;
|
|
192
182
|
|
|
193
183
|
const passthroughProps = _View.View.omitViewProps((0, _omitProps.omitProps)(this.props, AppNav.allowedProps), AppNav);
|
|
194
184
|
|
|
@@ -203,13 +193,13 @@ let AppNav = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _
|
|
|
203
193
|
const hasRenderedContent = renderBeforeItems || renderAfterItems;
|
|
204
194
|
return (0, _emotion.jsx)(_View.View, Object.assign({}, passthroughProps, {
|
|
205
195
|
as: "nav",
|
|
206
|
-
css: [
|
|
196
|
+
css: [this.props.styles?.appNav, hasRenderedContent ? this.props.styles?.alignCenter : ''],
|
|
207
197
|
margin: margin,
|
|
208
198
|
display: hasRenderedContent ? 'flex' : 'block',
|
|
209
199
|
elementRef: this.handleRef
|
|
210
200
|
}), renderBeforeItems && (0, _emotion.jsx)("span", null, renderBeforeItems), (0, _emotion.jsx)("ul", {
|
|
211
201
|
ref: el => this._list = el,
|
|
212
|
-
css:
|
|
202
|
+
css: this.props.styles?.list,
|
|
213
203
|
"aria-label": (0, _callRenderProp.callRenderProp)(screenReaderLabel)
|
|
214
204
|
}, visibleChildren.map((child, index) => {
|
|
215
205
|
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?.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?.borderMedium,
|
|
47
|
+
borderStyle: borders?.style,
|
|
48
|
+
borderWidth: borders?.widthSmall,
|
|
49
|
+
horizontalMargin: spacing?.xxSmall,
|
|
50
50
|
menuTriggerWidth: '7.5rem'
|
|
51
51
|
};
|
|
52
52
|
return { ...componentVariables
|
|
@@ -42,51 +42,45 @@ let NavigationItem = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.def
|
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
componentDidMount() {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
(_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props, {
|
|
45
|
+
this.props.makeStyles?.({
|
|
48
46
|
minimized: this.props.minimized
|
|
49
47
|
});
|
|
50
48
|
}
|
|
51
49
|
|
|
52
50
|
componentDidUpdate() {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
(_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2, {
|
|
51
|
+
this.props.makeStyles?.({
|
|
56
52
|
minimized: this.props.minimized
|
|
57
53
|
});
|
|
58
54
|
}
|
|
59
55
|
|
|
60
56
|
renderLink() {
|
|
61
|
-
var _this$props$styles, _this$props$styles2, _this$props$styles3;
|
|
62
|
-
|
|
63
57
|
const ElementType = (0, _getElementType.getElementType)(NavigationItem, this.props);
|
|
64
|
-
const _this$
|
|
65
|
-
href = _this$
|
|
66
|
-
onClick = _this$
|
|
67
|
-
icon = _this$
|
|
68
|
-
label = _this$
|
|
58
|
+
const _this$props = this.props,
|
|
59
|
+
href = _this$props.href,
|
|
60
|
+
onClick = _this$props.onClick,
|
|
61
|
+
icon = _this$props.icon,
|
|
62
|
+
label = _this$props.label;
|
|
69
63
|
const props = (0, _omitProps.omitProps)(this.props, NavigationItem.allowedProps);
|
|
70
64
|
return (0, _emotion.jsx)(ElementType, Object.assign({}, props, {
|
|
71
65
|
href: href,
|
|
72
66
|
onClick: onClick,
|
|
73
|
-
css:
|
|
67
|
+
css: this.props.styles?.navigationItem,
|
|
74
68
|
"aria-label": this.props.minimized ? label : void 0,
|
|
75
69
|
ref: element => {
|
|
76
70
|
this.ref = element;
|
|
77
71
|
}
|
|
78
72
|
}), (0, _emotion.jsx)("div", {
|
|
79
|
-
css:
|
|
73
|
+
css: this.props.styles?.icon,
|
|
80
74
|
"aria-hidden": "true"
|
|
81
75
|
}, icon), !this.props.minimized ? (0, _emotion.jsx)("div", {
|
|
82
|
-
css:
|
|
76
|
+
css: this.props.styles?.label
|
|
83
77
|
}, label) : null);
|
|
84
78
|
}
|
|
85
79
|
|
|
86
80
|
render() {
|
|
87
|
-
const _this$
|
|
88
|
-
minimized = _this$
|
|
89
|
-
label = _this$
|
|
81
|
+
const _this$props2 = this.props,
|
|
82
|
+
minimized = _this$props2.minimized,
|
|
83
|
+
label = _this$props2.label;
|
|
90
84
|
const link = this.renderLink();
|
|
91
85
|
return minimized && (0, _hasVisibleChildren.hasVisibleChildren)(label) ? (0, _emotion.jsx)(_Tooltip.Tooltip, {
|
|
92
86
|
renderTip: label,
|