@instructure/ui-navigation 8.56.0 → 9.0.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/CHANGELOG.md +11 -0
- package/README.md +2 -23
- package/es/index.js +1 -2
- package/lib/index.js +1 -14
- package/package.json +24 -24
- package/src/index.ts +0 -3
- package/tsconfig.build.tsbuildinfo +1 -1
- package/types/index.d.ts +0 -3
- package/types/index.d.ts.map +1 -1
- package/es/Navigation/NavigationItem/NavigationItemLocator.js +0 -33
- package/es/Navigation/NavigationItem/index.js +0 -106
- package/es/Navigation/NavigationItem/locator.js +0 -26
- package/es/Navigation/NavigationItem/props.js +0 -36
- package/es/Navigation/NavigationItem/styles.js +0 -93
- package/es/Navigation/NavigationItem/theme.js +0 -73
- package/es/Navigation/NavigationLocator.js +0 -37
- package/es/Navigation/index.js +0 -129
- package/es/Navigation/locator.js +0 -27
- package/es/Navigation/props.js +0 -42
- package/es/Navigation/styles.js +0 -77
- package/es/Navigation/theme.js +0 -61
- package/lib/Navigation/NavigationItem/NavigationItemLocator.js +0 -40
- package/lib/Navigation/NavigationItem/index.js +0 -112
- package/lib/Navigation/NavigationItem/locator.js +0 -37
- package/lib/Navigation/NavigationItem/props.js +0 -43
- package/lib/Navigation/NavigationItem/styles.js +0 -99
- package/lib/Navigation/NavigationItem/theme.js +0 -79
- package/lib/Navigation/NavigationLocator.js +0 -48
- package/lib/Navigation/index.js +0 -145
- package/lib/Navigation/locator.js +0 -43
- package/lib/Navigation/props.js +0 -49
- package/lib/Navigation/styles.js +0 -83
- package/lib/Navigation/theme.js +0 -67
- package/src/Navigation/NavigationItem/NavigationItemLocator.ts +0 -34
- package/src/Navigation/NavigationItem/index.tsx +0 -117
- package/src/Navigation/NavigationItem/locator.ts +0 -27
- package/src/Navigation/NavigationItem/props.ts +0 -102
- package/src/Navigation/NavigationItem/styles.ts +0 -103
- package/src/Navigation/NavigationItem/theme.ts +0 -82
- package/src/Navigation/NavigationLocator.ts +0 -40
- package/src/Navigation/README.md +0 -85
- package/src/Navigation/index.tsx +0 -168
- package/src/Navigation/locator.ts +0 -29
- package/src/Navigation/props.ts +0 -118
- package/src/Navigation/styles.ts +0 -83
- package/src/Navigation/theme.ts +0 -66
- package/types/Navigation/NavigationItem/NavigationItemLocator.d.ts +0 -576
- package/types/Navigation/NavigationItem/NavigationItemLocator.d.ts.map +0 -1
- package/types/Navigation/NavigationItem/index.d.ts +0 -47
- package/types/Navigation/NavigationItem/index.d.ts.map +0 -1
- package/types/Navigation/NavigationItem/locator.d.ts +0 -4
- package/types/Navigation/NavigationItem/locator.d.ts.map +0 -1
- package/types/Navigation/NavigationItem/props.d.ts +0 -46
- package/types/Navigation/NavigationItem/props.d.ts.map +0 -1
- package/types/Navigation/NavigationItem/styles.d.ts +0 -15
- package/types/Navigation/NavigationItem/styles.d.ts.map +0 -1
- package/types/Navigation/NavigationItem/theme.d.ts +0 -10
- package/types/Navigation/NavigationItem/theme.d.ts.map +0 -1
- package/types/Navigation/NavigationLocator.d.ts +0 -1983
- package/types/Navigation/NavigationLocator.d.ts.map +0 -1
- package/types/Navigation/index.d.ts +0 -58
- package/types/Navigation/index.d.ts.map +0 -1
- package/types/Navigation/locator.d.ts +0 -5
- package/types/Navigation/locator.d.ts.map +0 -1
- package/types/Navigation/props.d.ts +0 -49
- package/types/Navigation/props.d.ts.map +0 -1
- package/types/Navigation/styles.d.ts +0 -15
- package/types/Navigation/styles.d.ts.map +0 -1
- package/types/Navigation/theme.d.ts +0 -10
- package/types/Navigation/theme.d.ts.map +0 -1
package/types/index.d.ts
CHANGED
|
@@ -1,7 +1,4 @@
|
|
|
1
1
|
export { AppNav } from './AppNav';
|
|
2
|
-
export { Navigation, NavigationItem } from './Navigation';
|
|
3
2
|
export type { AppNavProps } from './AppNav/props';
|
|
4
3
|
export type { AppNavItemProps } from './AppNav/Item/props';
|
|
5
|
-
export type { NavigationProps } from './Navigation/props';
|
|
6
|
-
export type { NavigationItemProps } from './Navigation/NavigationItem/props';
|
|
7
4
|
//# sourceMappingURL=index.d.ts.map
|
package/types/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAwBA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAwBA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AAEjC,YAAY,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AACjD,YAAY,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAA"}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* The MIT License (MIT)
|
|
3
|
-
*
|
|
4
|
-
* Copyright (c) 2015 - present Instructure, Inc.
|
|
5
|
-
*
|
|
6
|
-
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
-
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
-
* in the Software without restriction, including without limitation the rights
|
|
9
|
-
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
-
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
-
* furnished to do so, subject to the following conditions:
|
|
12
|
-
*
|
|
13
|
-
* The above copyright notice and this permission notice shall be included in all
|
|
14
|
-
* copies or substantial portions of the Software.
|
|
15
|
-
*
|
|
16
|
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
-
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
-
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
-
* SOFTWARE.
|
|
23
|
-
*/
|
|
24
|
-
import { locator } from '@instructure/ui-test-locator';
|
|
25
|
-
// @ts-expect-error ts-migrate(7016) FIXME: Could not find a declaration file for module '@ins... Remove this comment to see the full error message
|
|
26
|
-
// eslint-disable-next-line no-restricted-imports
|
|
27
|
-
import { TooltipLocator } from '@instructure/ui-tooltip/es/Tooltip/TooltipLocator';
|
|
28
|
-
import { NavigationItem } from './index';
|
|
29
|
-
|
|
30
|
-
// @ts-expect-error ts-migrate(2339) FIXME: Property 'selector' does not exist on type 'typeof... Remove this comment to see the full error message
|
|
31
|
-
export const NavigationItemLocator = locator(NavigationItem.selector, {
|
|
32
|
-
findTooltipContent: (...args) => TooltipLocator.findContent(...args)
|
|
33
|
-
});
|
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
var _dec, _dec2, _class, _class2;
|
|
2
|
-
/*
|
|
3
|
-
* The MIT License (MIT)
|
|
4
|
-
*
|
|
5
|
-
* Copyright (c) 2015 - present Instructure, Inc.
|
|
6
|
-
*
|
|
7
|
-
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
8
|
-
* of this software and associated documentation files (the "Software"), to deal
|
|
9
|
-
* in the Software without restriction, including without limitation the rights
|
|
10
|
-
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
11
|
-
* copies of the Software, and to permit persons to whom the Software is
|
|
12
|
-
* furnished to do so, subject to the following conditions:
|
|
13
|
-
*
|
|
14
|
-
* The above copyright notice and this permission notice shall be included in all
|
|
15
|
-
* copies or substantial portions of the Software.
|
|
16
|
-
*
|
|
17
|
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
18
|
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
19
|
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
20
|
-
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
21
|
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
22
|
-
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
23
|
-
* SOFTWARE.
|
|
24
|
-
*/
|
|
25
|
-
/** @jsx jsx */
|
|
26
|
-
import { Component } from 'react';
|
|
27
|
-
import { testable } from '@instructure/ui-testable';
|
|
28
|
-
import { omitProps, getElementType } from '@instructure/ui-react-utils';
|
|
29
|
-
import { Tooltip } from '@instructure/ui-tooltip';
|
|
30
|
-
import { hasVisibleChildren } from '@instructure/ui-a11y-utils';
|
|
31
|
-
import { withStyle, jsx } from '@instructure/emotion';
|
|
32
|
-
import generateStyle from './styles';
|
|
33
|
-
import generateComponentTheme from './theme';
|
|
34
|
-
import { allowedProps, propTypes } from './props';
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
---
|
|
38
|
-
parent: Navigation
|
|
39
|
-
id: Navigation.Item
|
|
40
|
-
---
|
|
41
|
-
**/
|
|
42
|
-
let NavigationItem = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2 = testable(), _dec(_class = _dec2(_class = (_class2 = class NavigationItem extends Component {
|
|
43
|
-
constructor(...args) {
|
|
44
|
-
super(...args);
|
|
45
|
-
this.ref = null;
|
|
46
|
-
this.handleRef = el => {
|
|
47
|
-
const elementRef = this.props.elementRef;
|
|
48
|
-
this.ref = el;
|
|
49
|
-
if (typeof elementRef === 'function') {
|
|
50
|
-
elementRef(el);
|
|
51
|
-
}
|
|
52
|
-
};
|
|
53
|
-
}
|
|
54
|
-
componentDidMount() {
|
|
55
|
-
var _this$props$makeStyle, _this$props;
|
|
56
|
-
(_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props, {
|
|
57
|
-
minimized: this.props.minimized
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
componentDidUpdate() {
|
|
61
|
-
var _this$props$makeStyle2, _this$props2;
|
|
62
|
-
(_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2, {
|
|
63
|
-
minimized: this.props.minimized
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
|
-
renderLink(addRef) {
|
|
67
|
-
var _this$props$styles, _this$props$styles2, _this$props$styles3;
|
|
68
|
-
const ElementType = getElementType(NavigationItem, this.props);
|
|
69
|
-
const _this$props3 = this.props,
|
|
70
|
-
href = _this$props3.href,
|
|
71
|
-
onClick = _this$props3.onClick,
|
|
72
|
-
icon = _this$props3.icon,
|
|
73
|
-
label = _this$props3.label;
|
|
74
|
-
const props = omitProps(this.props, NavigationItem.allowedProps);
|
|
75
|
-
return jsx(ElementType, Object.assign({}, props, {
|
|
76
|
-
href: href,
|
|
77
|
-
onClick: onClick,
|
|
78
|
-
ref: addRef ? this.handleRef : void 0,
|
|
79
|
-
css: (_this$props$styles = this.props.styles) === null || _this$props$styles === void 0 ? void 0 : _this$props$styles.navigationItem,
|
|
80
|
-
"aria-label": this.props.minimized ? label : void 0
|
|
81
|
-
}), jsx("div", {
|
|
82
|
-
css: (_this$props$styles2 = this.props.styles) === null || _this$props$styles2 === void 0 ? void 0 : _this$props$styles2.icon,
|
|
83
|
-
"aria-hidden": "true"
|
|
84
|
-
}, icon), !this.props.minimized ? jsx("div", {
|
|
85
|
-
css: (_this$props$styles3 = this.props.styles) === null || _this$props$styles3 === void 0 ? void 0 : _this$props$styles3.label
|
|
86
|
-
}, label) : null);
|
|
87
|
-
}
|
|
88
|
-
render() {
|
|
89
|
-
const _this$props4 = this.props,
|
|
90
|
-
minimized = _this$props4.minimized,
|
|
91
|
-
label = _this$props4.label;
|
|
92
|
-
const hasTooltip = minimized && hasVisibleChildren(label);
|
|
93
|
-
const link = this.renderLink(!hasTooltip);
|
|
94
|
-
return hasTooltip ? jsx(Tooltip, {
|
|
95
|
-
renderTip: label,
|
|
96
|
-
placement: "end",
|
|
97
|
-
elementRef: this.handleRef
|
|
98
|
-
}, link) : link;
|
|
99
|
-
}
|
|
100
|
-
}, _class2.displayName = "NavigationItem", _class2.componentId = 'Navigation.Item', _class2.allowedProps = allowedProps, _class2.propTypes = propTypes, _class2.defaultProps = {
|
|
101
|
-
as: 'a',
|
|
102
|
-
selected: false,
|
|
103
|
-
minimized: false
|
|
104
|
-
}, _class2)) || _class) || _class);
|
|
105
|
-
export default NavigationItem;
|
|
106
|
-
export { NavigationItem };
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* The MIT License (MIT)
|
|
3
|
-
*
|
|
4
|
-
* Copyright (c) 2015 - present Instructure, Inc.
|
|
5
|
-
*
|
|
6
|
-
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
-
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
-
* in the Software without restriction, including without limitation the rights
|
|
9
|
-
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
-
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
-
* furnished to do so, subject to the following conditions:
|
|
12
|
-
*
|
|
13
|
-
* The above copyright notice and this permission notice shall be included in all
|
|
14
|
-
* copies or substantial portions of the Software.
|
|
15
|
-
*
|
|
16
|
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
-
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
-
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
-
* SOFTWARE.
|
|
23
|
-
*/
|
|
24
|
-
import { NavigationItemLocator } from './NavigationItemLocator';
|
|
25
|
-
export { NavigationItemLocator };
|
|
26
|
-
export default NavigationItemLocator;
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* The MIT License (MIT)
|
|
3
|
-
*
|
|
4
|
-
* Copyright (c) 2015 - present Instructure, Inc.
|
|
5
|
-
*
|
|
6
|
-
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
-
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
-
* in the Software without restriction, including without limitation the rights
|
|
9
|
-
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
-
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
-
* furnished to do so, subject to the following conditions:
|
|
12
|
-
*
|
|
13
|
-
* The above copyright notice and this permission notice shall be included in all
|
|
14
|
-
* copies or substantial portions of the Software.
|
|
15
|
-
*
|
|
16
|
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
-
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
-
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
-
* SOFTWARE.
|
|
23
|
-
*/
|
|
24
|
-
import PropTypes from 'prop-types';
|
|
25
|
-
const propTypes = {
|
|
26
|
-
elementRef: PropTypes.func,
|
|
27
|
-
icon: PropTypes.node.isRequired,
|
|
28
|
-
label: PropTypes.node.isRequired,
|
|
29
|
-
as: PropTypes.elementType,
|
|
30
|
-
href: PropTypes.string,
|
|
31
|
-
onClick: PropTypes.func,
|
|
32
|
-
selected: PropTypes.bool,
|
|
33
|
-
minimized: PropTypes.bool
|
|
34
|
-
};
|
|
35
|
-
const allowedProps = ['elementRef', 'icon', 'label', 'as', 'href', 'onClick', 'selected', 'minimized'];
|
|
36
|
-
export { propTypes, allowedProps };
|
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* The MIT License (MIT)
|
|
3
|
-
*
|
|
4
|
-
* Copyright (c) 2015 - present Instructure, Inc.
|
|
5
|
-
*
|
|
6
|
-
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
-
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
-
* in the Software without restriction, including without limitation the rights
|
|
9
|
-
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
-
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
-
* furnished to do so, subject to the following conditions:
|
|
12
|
-
*
|
|
13
|
-
* The above copyright notice and this permission notice shall be included in all
|
|
14
|
-
* copies or substantial portions of the Software.
|
|
15
|
-
*
|
|
16
|
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
-
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
-
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
-
* SOFTWARE.
|
|
23
|
-
*/
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* ---
|
|
27
|
-
* private: true
|
|
28
|
-
* ---
|
|
29
|
-
* Generates the style object from the theme and provided additional information
|
|
30
|
-
* @param {Object} componentTheme The theme variable object.
|
|
31
|
-
* @param {Object} props the props of the component, the style is applied to
|
|
32
|
-
* @param {Object} state the state of the component, the style is applied to
|
|
33
|
-
* @return {Object} The final style object, which will be used in the component
|
|
34
|
-
*/
|
|
35
|
-
const generateStyle = (componentTheme, props) => {
|
|
36
|
-
const selected = props.selected;
|
|
37
|
-
return {
|
|
38
|
-
navigationItem: {
|
|
39
|
-
label: 'navigationItem',
|
|
40
|
-
fontFamily: componentTheme.fontFamily,
|
|
41
|
-
fontWeight: componentTheme.fontWeight,
|
|
42
|
-
display: 'block',
|
|
43
|
-
width: '100%',
|
|
44
|
-
textAlign: 'center',
|
|
45
|
-
padding: componentTheme.contentPadding,
|
|
46
|
-
cursor: 'pointer',
|
|
47
|
-
border: 'none',
|
|
48
|
-
boxSizing: 'border-box',
|
|
49
|
-
textDecoration: componentTheme.linkTextDecoration,
|
|
50
|
-
overflowWrap: 'break-word',
|
|
51
|
-
wordWrap: 'break-word',
|
|
52
|
-
hyphens: 'auto',
|
|
53
|
-
...(selected ? {
|
|
54
|
-
backgroundColor: componentTheme.selectedBackgroundColor,
|
|
55
|
-
fill: componentTheme.selectedIconColor,
|
|
56
|
-
color: componentTheme.selectedFontColor,
|
|
57
|
-
'&:active, &:hover': {
|
|
58
|
-
backgroundColor: componentTheme.selectedBackgroundColor
|
|
59
|
-
},
|
|
60
|
-
'&:focus': {
|
|
61
|
-
backgroundColor: componentTheme.selectedBackgroundColor,
|
|
62
|
-
boxShadow: `${componentTheme.selectedOuterFocusOutline}, ${componentTheme.selectedInnerFocusOutline}`,
|
|
63
|
-
outline: 'none'
|
|
64
|
-
}
|
|
65
|
-
} : {
|
|
66
|
-
backgroundColor: componentTheme.backgroundColor,
|
|
67
|
-
color: componentTheme.fontColor,
|
|
68
|
-
'&:active': {
|
|
69
|
-
backgroundColor: componentTheme.hoverBackgroundColor
|
|
70
|
-
},
|
|
71
|
-
'&:hover': {
|
|
72
|
-
backgroundColor: componentTheme.hoverBackgroundColor
|
|
73
|
-
},
|
|
74
|
-
'&:focus': {
|
|
75
|
-
backgroundColor: componentTheme.hoverBackgroundColor,
|
|
76
|
-
boxShadow: `${componentTheme.outerFocusOutline}, ${componentTheme.innerFocusOutline}`,
|
|
77
|
-
outline: 'none'
|
|
78
|
-
}
|
|
79
|
-
})
|
|
80
|
-
},
|
|
81
|
-
icon: {
|
|
82
|
-
label: 'navigationItem__icon',
|
|
83
|
-
fontSize: componentTheme.iconSize,
|
|
84
|
-
fill: componentTheme.iconColor
|
|
85
|
-
},
|
|
86
|
-
label: {
|
|
87
|
-
label: 'navigationItem__label',
|
|
88
|
-
fontSize: componentTheme.fontSize,
|
|
89
|
-
lineHeight: componentTheme.lineHeight
|
|
90
|
-
}
|
|
91
|
-
};
|
|
92
|
-
};
|
|
93
|
-
export default generateStyle;
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* The MIT License (MIT)
|
|
3
|
-
*
|
|
4
|
-
* Copyright (c) 2015 - present Instructure, Inc.
|
|
5
|
-
*
|
|
6
|
-
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
-
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
-
* in the Software without restriction, including without limitation the rights
|
|
9
|
-
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
-
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
-
* furnished to do so, subject to the following conditions:
|
|
12
|
-
*
|
|
13
|
-
* The above copyright notice and this permission notice shall be included in all
|
|
14
|
-
* copies or substantial portions of the Software.
|
|
15
|
-
*
|
|
16
|
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
-
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
-
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
-
* SOFTWARE.
|
|
23
|
-
*/
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* Generates the theme object for the component from the theme and provided additional information
|
|
27
|
-
* @param {Object} theme The actual theme object.
|
|
28
|
-
* @return {Object} The final theme object with the overrides and component variables
|
|
29
|
-
*/
|
|
30
|
-
const generateComponentTheme = theme => {
|
|
31
|
-
const colors = theme.colors,
|
|
32
|
-
spacing = theme.spacing,
|
|
33
|
-
typography = theme.typography,
|
|
34
|
-
themeName = theme.key;
|
|
35
|
-
const themeSpecificStyle = {
|
|
36
|
-
canvas: {
|
|
37
|
-
fontColor: theme['ic-brand-global-nav-menu-item__text-color'],
|
|
38
|
-
iconColor: theme['ic-brand-global-nav-ic-icon-svg-fill'],
|
|
39
|
-
backgroundColor: theme['ic-brand-global-nav-bgd'],
|
|
40
|
-
hoverBackgroundColor: theme['ic-global-nav-link-hover'],
|
|
41
|
-
selectedFontColor: theme['ic-brand-global-nav-menu-item__text-color--active'],
|
|
42
|
-
selectedIconColor: theme['ic-brand-global-nav-ic-icon-svg-fill--active']
|
|
43
|
-
},
|
|
44
|
-
'canvas-high-contrast': {
|
|
45
|
-
linkTextDecoration: 'underline'
|
|
46
|
-
}
|
|
47
|
-
};
|
|
48
|
-
const componentVariables = {
|
|
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
|
-
iconSize: '1.625rem',
|
|
54
|
-
iconColor: colors === null || colors === void 0 ? void 0 : colors.textLightest,
|
|
55
|
-
lineHeight: typography === null || typography === void 0 ? void 0 : typography.lineHeight,
|
|
56
|
-
backgroundColor: 'transparent',
|
|
57
|
-
linkTextDecoration: 'none',
|
|
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
|
-
};
|
|
68
|
-
return {
|
|
69
|
-
...componentVariables,
|
|
70
|
-
...themeSpecificStyle[themeName]
|
|
71
|
-
};
|
|
72
|
-
};
|
|
73
|
-
export default generateComponentTheme;
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* The MIT License (MIT)
|
|
3
|
-
*
|
|
4
|
-
* Copyright (c) 2015 - present Instructure, Inc.
|
|
5
|
-
*
|
|
6
|
-
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
-
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
-
* in the Software without restriction, including without limitation the rights
|
|
9
|
-
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
-
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
-
* furnished to do so, subject to the following conditions:
|
|
12
|
-
*
|
|
13
|
-
* The above copyright notice and this permission notice shall be included in all
|
|
14
|
-
* copies or substantial portions of the Software.
|
|
15
|
-
*
|
|
16
|
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
-
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
-
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
-
* SOFTWARE.
|
|
23
|
-
*/
|
|
24
|
-
import { locator } from '@instructure/ui-test-locator';
|
|
25
|
-
import { Navigation } from './index';
|
|
26
|
-
import { NavigationItemLocator } from './NavigationItem/NavigationItemLocator';
|
|
27
|
-
export { NavigationItemLocator };
|
|
28
|
-
|
|
29
|
-
// @ts-expect-error ts-migrate(2339) FIXME: Property 'selector' does not exist on type 'typeof... Remove this comment to see the full error message
|
|
30
|
-
export const NavigationLocator = locator(Navigation.selector, {
|
|
31
|
-
findAllItems: (...args) => {
|
|
32
|
-
return NavigationItemLocator.findAll(...args);
|
|
33
|
-
},
|
|
34
|
-
findItem: (...args) => {
|
|
35
|
-
return NavigationItemLocator.find(...args);
|
|
36
|
-
}
|
|
37
|
-
});
|
package/es/Navigation/index.js
DELETED
|
@@ -1,129 +0,0 @@
|
|
|
1
|
-
var _dec, _dec2, _dec3, _class, _class2;
|
|
2
|
-
/*
|
|
3
|
-
* The MIT License (MIT)
|
|
4
|
-
*
|
|
5
|
-
* Copyright (c) 2015 - present Instructure, Inc.
|
|
6
|
-
*
|
|
7
|
-
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
8
|
-
* of this software and associated documentation files (the "Software"), to deal
|
|
9
|
-
* in the Software without restriction, including without limitation the rights
|
|
10
|
-
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
11
|
-
* copies of the Software, and to permit persons to whom the Software is
|
|
12
|
-
* furnished to do so, subject to the following conditions:
|
|
13
|
-
*
|
|
14
|
-
* The above copyright notice and this permission notice shall be included in all
|
|
15
|
-
* copies or substantial portions of the Software.
|
|
16
|
-
*
|
|
17
|
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
18
|
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
19
|
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
20
|
-
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
21
|
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
22
|
-
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
23
|
-
* SOFTWARE.
|
|
24
|
-
*/
|
|
25
|
-
/** @jsx jsx */
|
|
26
|
-
import React, { Component, Children } from 'react';
|
|
27
|
-
import { testable } from '@instructure/ui-testable';
|
|
28
|
-
import { omitProps, safeCloneElement, deprecated } from '@instructure/ui-react-utils';
|
|
29
|
-
import { IconMoveStartLine } from '@instructure/ui-icons';
|
|
30
|
-
import { ScreenReaderContent } from '@instructure/ui-a11y-content';
|
|
31
|
-
import { withStyle, jsx } from '@instructure/emotion';
|
|
32
|
-
import { NavigationItem } from './NavigationItem';
|
|
33
|
-
import generateStyle from './styles';
|
|
34
|
-
import generateComponentTheme from './theme';
|
|
35
|
-
import { allowedProps, propTypes } from './props';
|
|
36
|
-
const navMinimized = ({
|
|
37
|
-
minimized
|
|
38
|
-
}) => ({
|
|
39
|
-
minimized: !minimized
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
---
|
|
44
|
-
category: components/deprecated
|
|
45
|
-
---
|
|
46
|
-
**/
|
|
47
|
-
let Navigation = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2 = testable(), _dec3 = deprecated('9.0.0', null, 'This component is deprecated and will be removed in a later version. Use <SideNavBar /> instead.'), _dec(_class = _dec2(_class = _dec3(_class = (_class2 = class Navigation extends Component {
|
|
48
|
-
constructor(props) {
|
|
49
|
-
super(props);
|
|
50
|
-
this.ref = null;
|
|
51
|
-
this.handleNavToggle = event => {
|
|
52
|
-
if (!this.isControlled()) {
|
|
53
|
-
this.setState(navMinimized);
|
|
54
|
-
}
|
|
55
|
-
if (typeof this.props.onMinimized === 'function') {
|
|
56
|
-
this.props.onMinimized(event, !this.minimized);
|
|
57
|
-
}
|
|
58
|
-
};
|
|
59
|
-
this.state = {
|
|
60
|
-
minimized: this.isControlled(props) ? !!props.minimized : !!props.defaultMinimized
|
|
61
|
-
};
|
|
62
|
-
}
|
|
63
|
-
componentDidMount() {
|
|
64
|
-
var _this$props$makeStyle, _this$props;
|
|
65
|
-
(_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props, {
|
|
66
|
-
minimized: this.minimized
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
|
-
componentDidUpdate() {
|
|
70
|
-
var _this$props$makeStyle2, _this$props2;
|
|
71
|
-
(_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2, {
|
|
72
|
-
minimized: this.minimized
|
|
73
|
-
});
|
|
74
|
-
}
|
|
75
|
-
get minimized() {
|
|
76
|
-
if (this.isControlled()) {
|
|
77
|
-
return !!this.props.minimized;
|
|
78
|
-
}
|
|
79
|
-
return !!this.state.minimized;
|
|
80
|
-
}
|
|
81
|
-
isControlled(props = this.props) {
|
|
82
|
-
return typeof props.minimized === 'boolean';
|
|
83
|
-
}
|
|
84
|
-
renderChildren() {
|
|
85
|
-
return Children.map(this.props.children, child => {
|
|
86
|
-
var _this$props$styles;
|
|
87
|
-
const navItem = safeCloneElement(child, {
|
|
88
|
-
minimized: this.state.minimized
|
|
89
|
-
});
|
|
90
|
-
return jsx("li", {
|
|
91
|
-
css: (_this$props$styles = this.props.styles) === null || _this$props$styles === void 0 ? void 0 : _this$props$styles.list
|
|
92
|
-
}, navItem);
|
|
93
|
-
});
|
|
94
|
-
}
|
|
95
|
-
toggleMessage() {
|
|
96
|
-
return this.state.minimized ? this.props.toggleLabel.minimizedLabel : this.props.toggleLabel.expandedLabel;
|
|
97
|
-
}
|
|
98
|
-
render() {
|
|
99
|
-
var _this$props$styles2, _this$props$styles3, _this$props$styles4, _this$props$styles5;
|
|
100
|
-
const label = this.props.label;
|
|
101
|
-
const props = omitProps(this.props, Navigation.allowedProps, ['minimized']);
|
|
102
|
-
return jsx("nav", Object.assign({}, props, {
|
|
103
|
-
css: (_this$props$styles2 = this.props.styles) === null || _this$props$styles2 === void 0 ? void 0 : _this$props$styles2.navigation,
|
|
104
|
-
"aria-label": label,
|
|
105
|
-
ref: element => {
|
|
106
|
-
this.ref = element;
|
|
107
|
-
}
|
|
108
|
-
}), jsx("ul", {
|
|
109
|
-
css: (_this$props$styles3 = this.props.styles) === null || _this$props$styles3 === void 0 ? void 0 : _this$props$styles3.content
|
|
110
|
-
}, this.renderChildren()), jsx("div", {
|
|
111
|
-
css: (_this$props$styles4 = this.props.styles) === null || _this$props$styles4 === void 0 ? void 0 : _this$props$styles4.toggle
|
|
112
|
-
}, jsx(NavigationItem, {
|
|
113
|
-
"aria-expanded": !this.minimized,
|
|
114
|
-
onClick: this.handleNavToggle,
|
|
115
|
-
icon: jsx(IconMoveStartLine, {
|
|
116
|
-
css: (_this$props$styles5 = this.props.styles) === null || _this$props$styles5 === void 0 ? void 0 : _this$props$styles5.toggleIcon,
|
|
117
|
-
inline: false
|
|
118
|
-
}),
|
|
119
|
-
label: jsx(ScreenReaderContent, null, this.toggleMessage())
|
|
120
|
-
})));
|
|
121
|
-
}
|
|
122
|
-
}, _class2.displayName = "Navigation", _class2.componentId = 'Navigation', _class2.allowedProps = allowedProps, _class2.propTypes = propTypes, _class2.defaultProps = {
|
|
123
|
-
children: null,
|
|
124
|
-
defaultMinimized: false,
|
|
125
|
-
// TODO we should investigate later if it used or not
|
|
126
|
-
onClick: function (_e) {}
|
|
127
|
-
}, _class2.Item = NavigationItem, _class2)) || _class) || _class) || _class);
|
|
128
|
-
export default Navigation;
|
|
129
|
-
export { Navigation, NavigationItem };
|
package/es/Navigation/locator.js
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* The MIT License (MIT)
|
|
3
|
-
*
|
|
4
|
-
* Copyright (c) 2015 - present Instructure, Inc.
|
|
5
|
-
*
|
|
6
|
-
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
-
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
-
* in the Software without restriction, including without limitation the rights
|
|
9
|
-
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
-
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
-
* furnished to do so, subject to the following conditions:
|
|
12
|
-
*
|
|
13
|
-
* The above copyright notice and this permission notice shall be included in all
|
|
14
|
-
* copies or substantial portions of the Software.
|
|
15
|
-
*
|
|
16
|
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
-
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
-
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
-
* SOFTWARE.
|
|
23
|
-
*/
|
|
24
|
-
import { NavigationLocator } from './NavigationLocator';
|
|
25
|
-
export { NavigationItemLocator } from './NavigationLocator';
|
|
26
|
-
export { NavigationLocator };
|
|
27
|
-
export default NavigationLocator;
|
package/es/Navigation/props.js
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* The MIT License (MIT)
|
|
3
|
-
*
|
|
4
|
-
* Copyright (c) 2015 - present Instructure, Inc.
|
|
5
|
-
*
|
|
6
|
-
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
-
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
-
* in the Software without restriction, including without limitation the rights
|
|
9
|
-
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
-
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
-
* furnished to do so, subject to the following conditions:
|
|
12
|
-
*
|
|
13
|
-
* The above copyright notice and this permission notice shall be included in all
|
|
14
|
-
* copies or substantial portions of the Software.
|
|
15
|
-
*
|
|
16
|
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
-
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
-
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
-
* SOFTWARE.
|
|
23
|
-
*/
|
|
24
|
-
|
|
25
|
-
import PropTypes from 'prop-types';
|
|
26
|
-
import { controllable, Children as ChildrenPropTypes } from '@instructure/ui-prop-types';
|
|
27
|
-
import { NavigationItem } from './NavigationItem';
|
|
28
|
-
const propTypes = {
|
|
29
|
-
children: ChildrenPropTypes.oneOf([NavigationItem]),
|
|
30
|
-
minimized: controllable(PropTypes.bool, 'onMinimized', 'defaultMinimized'),
|
|
31
|
-
defaultMinimized: PropTypes.bool,
|
|
32
|
-
onMinimized: PropTypes.func,
|
|
33
|
-
label: PropTypes.string.isRequired,
|
|
34
|
-
toggleLabel: PropTypes.shape({
|
|
35
|
-
expandedLabel: PropTypes.string,
|
|
36
|
-
minimizedLabel: PropTypes.string
|
|
37
|
-
}).isRequired,
|
|
38
|
-
href: PropTypes.string,
|
|
39
|
-
onClick: PropTypes.func
|
|
40
|
-
};
|
|
41
|
-
const allowedProps = ['children', 'minimized', 'defaultMinimized', 'onMinimized', 'label', 'toggleLabel', 'href', 'onClick'];
|
|
42
|
-
export { propTypes, allowedProps };
|