@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.
Files changed (70) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/README.md +2 -23
  3. package/es/index.js +1 -2
  4. package/lib/index.js +1 -14
  5. package/package.json +24 -24
  6. package/src/index.ts +0 -3
  7. package/tsconfig.build.tsbuildinfo +1 -1
  8. package/types/index.d.ts +0 -3
  9. package/types/index.d.ts.map +1 -1
  10. package/es/Navigation/NavigationItem/NavigationItemLocator.js +0 -33
  11. package/es/Navigation/NavigationItem/index.js +0 -106
  12. package/es/Navigation/NavigationItem/locator.js +0 -26
  13. package/es/Navigation/NavigationItem/props.js +0 -36
  14. package/es/Navigation/NavigationItem/styles.js +0 -93
  15. package/es/Navigation/NavigationItem/theme.js +0 -73
  16. package/es/Navigation/NavigationLocator.js +0 -37
  17. package/es/Navigation/index.js +0 -129
  18. package/es/Navigation/locator.js +0 -27
  19. package/es/Navigation/props.js +0 -42
  20. package/es/Navigation/styles.js +0 -77
  21. package/es/Navigation/theme.js +0 -61
  22. package/lib/Navigation/NavigationItem/NavigationItemLocator.js +0 -40
  23. package/lib/Navigation/NavigationItem/index.js +0 -112
  24. package/lib/Navigation/NavigationItem/locator.js +0 -37
  25. package/lib/Navigation/NavigationItem/props.js +0 -43
  26. package/lib/Navigation/NavigationItem/styles.js +0 -99
  27. package/lib/Navigation/NavigationItem/theme.js +0 -79
  28. package/lib/Navigation/NavigationLocator.js +0 -48
  29. package/lib/Navigation/index.js +0 -145
  30. package/lib/Navigation/locator.js +0 -43
  31. package/lib/Navigation/props.js +0 -49
  32. package/lib/Navigation/styles.js +0 -83
  33. package/lib/Navigation/theme.js +0 -67
  34. package/src/Navigation/NavigationItem/NavigationItemLocator.ts +0 -34
  35. package/src/Navigation/NavigationItem/index.tsx +0 -117
  36. package/src/Navigation/NavigationItem/locator.ts +0 -27
  37. package/src/Navigation/NavigationItem/props.ts +0 -102
  38. package/src/Navigation/NavigationItem/styles.ts +0 -103
  39. package/src/Navigation/NavigationItem/theme.ts +0 -82
  40. package/src/Navigation/NavigationLocator.ts +0 -40
  41. package/src/Navigation/README.md +0 -85
  42. package/src/Navigation/index.tsx +0 -168
  43. package/src/Navigation/locator.ts +0 -29
  44. package/src/Navigation/props.ts +0 -118
  45. package/src/Navigation/styles.ts +0 -83
  46. package/src/Navigation/theme.ts +0 -66
  47. package/types/Navigation/NavigationItem/NavigationItemLocator.d.ts +0 -576
  48. package/types/Navigation/NavigationItem/NavigationItemLocator.d.ts.map +0 -1
  49. package/types/Navigation/NavigationItem/index.d.ts +0 -47
  50. package/types/Navigation/NavigationItem/index.d.ts.map +0 -1
  51. package/types/Navigation/NavigationItem/locator.d.ts +0 -4
  52. package/types/Navigation/NavigationItem/locator.d.ts.map +0 -1
  53. package/types/Navigation/NavigationItem/props.d.ts +0 -46
  54. package/types/Navigation/NavigationItem/props.d.ts.map +0 -1
  55. package/types/Navigation/NavigationItem/styles.d.ts +0 -15
  56. package/types/Navigation/NavigationItem/styles.d.ts.map +0 -1
  57. package/types/Navigation/NavigationItem/theme.d.ts +0 -10
  58. package/types/Navigation/NavigationItem/theme.d.ts.map +0 -1
  59. package/types/Navigation/NavigationLocator.d.ts +0 -1983
  60. package/types/Navigation/NavigationLocator.d.ts.map +0 -1
  61. package/types/Navigation/index.d.ts +0 -58
  62. package/types/Navigation/index.d.ts.map +0 -1
  63. package/types/Navigation/locator.d.ts +0 -5
  64. package/types/Navigation/locator.d.ts.map +0 -1
  65. package/types/Navigation/props.d.ts +0 -49
  66. package/types/Navigation/props.d.ts.map +0 -1
  67. package/types/Navigation/styles.d.ts +0 -15
  68. package/types/Navigation/styles.d.ts.map +0 -1
  69. package/types/Navigation/theme.d.ts +0 -10
  70. package/types/Navigation/theme.d.ts.map +0 -1
@@ -1,77 +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, state) => {
36
- const minimized = state.minimized;
37
- return {
38
- navigation: {
39
- label: 'navigation',
40
- color: componentTheme.fontColor,
41
- backgroundColor: componentTheme.backgroundColor,
42
- boxSizing: 'border-box',
43
- display: 'flex',
44
- flexDirection: 'column',
45
- width: componentTheme.width,
46
- height: '100%',
47
- overflowY: 'auto',
48
- ...(minimized ? {
49
- width: componentTheme.minimizedWidth
50
- } : {})
51
- },
52
- list: {
53
- label: 'navigation__list',
54
- padding: 0,
55
- margin: 0
56
- },
57
- content: {
58
- label: 'navigation__content',
59
- listStyleType: 'none',
60
- margin: '0',
61
- padding: '0',
62
- flex: '1 0 auto'
63
- },
64
- toggle: {
65
- transform: 'translate3d(0, 0, 0)',
66
- transition: `all ${componentTheme.toggleTransition}`,
67
- ...(minimized ? {
68
- transform: 'rotate3d(0, 1, 0, -180deg)'
69
- } : {})
70
- },
71
- toggleIcon: {
72
- fill: componentTheme.fill,
73
- margin: '0 auto'
74
- }
75
- };
76
- };
77
- export default generateStyle;
@@ -1,61 +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
- borders = theme.borders,
34
- transitions = theme.transitions,
35
- themeName = theme.key;
36
- const themeSpecificStyle = {
37
- canvas: {
38
- backgroundColor: theme['ic-brand-global-nav-bgd'],
39
- fontColor: theme['ic-brand-global-nav-menu-item__text-color'],
40
- fill: theme['ic-brand-global-nav-ic-icon-svg-fill']
41
- }
42
- };
43
- const componentVariables = {
44
- fontColor: colors === null || colors === void 0 ? void 0 : colors.textLightest,
45
- backgroundColor: colors === null || colors === void 0 ? void 0 : colors.backgroundBrandSecondary,
46
- width: '5.25rem',
47
- minimizedWidth: '3.375rem',
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
- };
56
- return {
57
- ...componentVariables,
58
- ...themeSpecificStyle[themeName]
59
- };
60
- };
61
- export default generateComponentTheme;
@@ -1,40 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.NavigationItemLocator = void 0;
7
- var _locator = require("@instructure/ui-test-locator/lib/utils/locator.js");
8
- var _TooltipLocator = require("@instructure/ui-tooltip/lib/Tooltip/TooltipLocator");
9
- var _index = require("./index");
10
- /*
11
- * The MIT License (MIT)
12
- *
13
- * Copyright (c) 2015 - present Instructure, Inc.
14
- *
15
- * Permission is hereby granted, free of charge, to any person obtaining a copy
16
- * of this software and associated documentation files (the "Software"), to deal
17
- * in the Software without restriction, including without limitation the rights
18
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
19
- * copies of the Software, and to permit persons to whom the Software is
20
- * furnished to do so, subject to the following conditions:
21
- *
22
- * The above copyright notice and this permission notice shall be included in all
23
- * copies or substantial portions of the Software.
24
- *
25
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
26
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
27
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
28
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
29
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
30
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
31
- * SOFTWARE.
32
- */
33
-
34
- // @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
35
- // eslint-disable-next-line no-restricted-imports
36
-
37
- // @ts-expect-error ts-migrate(2339) FIXME: Property 'selector' does not exist on type 'typeof... Remove this comment to see the full error message
38
- const NavigationItemLocator = exports.NavigationItemLocator = (0, _locator.locator)(_index.NavigationItem.selector, {
39
- findTooltipContent: (...args) => _TooltipLocator.TooltipLocator.findContent(...args)
40
- });
@@ -1,112 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.default = exports.NavigationItem = void 0;
8
- var _react = require("react");
9
- var _testable = require("@instructure/ui-testable/lib/testable.js");
10
- var _omitProps = require("@instructure/ui-react-utils/lib/omitProps.js");
11
- var _getElementType = require("@instructure/ui-react-utils/lib/getElementType.js");
12
- var _Tooltip = require("@instructure/ui-tooltip/lib/Tooltip");
13
- var _hasVisibleChildren = require("@instructure/ui-a11y-utils/lib/hasVisibleChildren.js");
14
- var _emotion = require("@instructure/emotion");
15
- var _styles = _interopRequireDefault(require("./styles"));
16
- var _theme = _interopRequireDefault(require("./theme"));
17
- var _props = require("./props");
18
- var _dec, _dec2, _class, _class2;
19
- /*
20
- * The MIT License (MIT)
21
- *
22
- * Copyright (c) 2015 - present Instructure, Inc.
23
- *
24
- * Permission is hereby granted, free of charge, to any person obtaining a copy
25
- * of this software and associated documentation files (the "Software"), to deal
26
- * in the Software without restriction, including without limitation the rights
27
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
28
- * copies of the Software, and to permit persons to whom the Software is
29
- * furnished to do so, subject to the following conditions:
30
- *
31
- * The above copyright notice and this permission notice shall be included in all
32
- * copies or substantial portions of the Software.
33
- *
34
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
35
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
36
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
37
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
38
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
39
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
40
- * SOFTWARE.
41
- */
42
- /** @jsx jsx */
43
- /**
44
- ---
45
- parent: Navigation
46
- id: Navigation.Item
47
- ---
48
- **/
49
- let NavigationItem = exports.NavigationItem = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec2 = (0, _testable.testable)(), _dec(_class = _dec2(_class = (_class2 = class NavigationItem extends _react.Component {
50
- constructor(...args) {
51
- super(...args);
52
- this.ref = null;
53
- this.handleRef = el => {
54
- const elementRef = this.props.elementRef;
55
- this.ref = el;
56
- if (typeof elementRef === 'function') {
57
- elementRef(el);
58
- }
59
- };
60
- }
61
- componentDidMount() {
62
- var _this$props$makeStyle, _this$props;
63
- (_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props, {
64
- minimized: this.props.minimized
65
- });
66
- }
67
- componentDidUpdate() {
68
- var _this$props$makeStyle2, _this$props2;
69
- (_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2, {
70
- minimized: this.props.minimized
71
- });
72
- }
73
- renderLink(addRef) {
74
- var _this$props$styles, _this$props$styles2, _this$props$styles3;
75
- const ElementType = (0, _getElementType.getElementType)(NavigationItem, this.props);
76
- const _this$props3 = this.props,
77
- href = _this$props3.href,
78
- onClick = _this$props3.onClick,
79
- icon = _this$props3.icon,
80
- label = _this$props3.label;
81
- const props = (0, _omitProps.omitProps)(this.props, NavigationItem.allowedProps);
82
- return (0, _emotion.jsx)(ElementType, Object.assign({}, props, {
83
- href: href,
84
- onClick: onClick,
85
- ref: addRef ? this.handleRef : void 0,
86
- css: (_this$props$styles = this.props.styles) === null || _this$props$styles === void 0 ? void 0 : _this$props$styles.navigationItem,
87
- "aria-label": this.props.minimized ? label : void 0
88
- }), (0, _emotion.jsx)("div", {
89
- css: (_this$props$styles2 = this.props.styles) === null || _this$props$styles2 === void 0 ? void 0 : _this$props$styles2.icon,
90
- "aria-hidden": "true"
91
- }, icon), !this.props.minimized ? (0, _emotion.jsx)("div", {
92
- css: (_this$props$styles3 = this.props.styles) === null || _this$props$styles3 === void 0 ? void 0 : _this$props$styles3.label
93
- }, label) : null);
94
- }
95
- render() {
96
- const _this$props4 = this.props,
97
- minimized = _this$props4.minimized,
98
- label = _this$props4.label;
99
- const hasTooltip = minimized && (0, _hasVisibleChildren.hasVisibleChildren)(label);
100
- const link = this.renderLink(!hasTooltip);
101
- return hasTooltip ? (0, _emotion.jsx)(_Tooltip.Tooltip, {
102
- renderTip: label,
103
- placement: "end",
104
- elementRef: this.handleRef
105
- }, link) : link;
106
- }
107
- }, _class2.displayName = "NavigationItem", _class2.componentId = 'Navigation.Item', _class2.allowedProps = _props.allowedProps, _class2.propTypes = _props.propTypes, _class2.defaultProps = {
108
- as: 'a',
109
- selected: false,
110
- minimized: false
111
- }, _class2)) || _class) || _class);
112
- var _default = exports.default = NavigationItem;
@@ -1,37 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- Object.defineProperty(exports, "NavigationItemLocator", {
7
- enumerable: true,
8
- get: function () {
9
- return _NavigationItemLocator.NavigationItemLocator;
10
- }
11
- });
12
- exports.default = void 0;
13
- var _NavigationItemLocator = require("./NavigationItemLocator");
14
- /*
15
- * The MIT License (MIT)
16
- *
17
- * Copyright (c) 2015 - present Instructure, Inc.
18
- *
19
- * Permission is hereby granted, free of charge, to any person obtaining a copy
20
- * of this software and associated documentation files (the "Software"), to deal
21
- * in the Software without restriction, including without limitation the rights
22
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
23
- * copies of the Software, and to permit persons to whom the Software is
24
- * furnished to do so, subject to the following conditions:
25
- *
26
- * The above copyright notice and this permission notice shall be included in all
27
- * copies or substantial portions of the Software.
28
- *
29
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
30
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
31
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
32
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
33
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
34
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
35
- * SOFTWARE.
36
- */
37
- var _default = exports.default = _NavigationItemLocator.NavigationItemLocator;
@@ -1,43 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.propTypes = exports.allowedProps = void 0;
8
- var _propTypes = _interopRequireDefault(require("prop-types"));
9
- /*
10
- * The MIT License (MIT)
11
- *
12
- * Copyright (c) 2015 - present Instructure, Inc.
13
- *
14
- * Permission is hereby granted, free of charge, to any person obtaining a copy
15
- * of this software and associated documentation files (the "Software"), to deal
16
- * in the Software without restriction, including without limitation the rights
17
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
18
- * copies of the Software, and to permit persons to whom the Software is
19
- * furnished to do so, subject to the following conditions:
20
- *
21
- * The above copyright notice and this permission notice shall be included in all
22
- * copies or substantial portions of the Software.
23
- *
24
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
25
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
26
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
27
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
28
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
29
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
30
- * SOFTWARE.
31
- */
32
-
33
- const propTypes = exports.propTypes = {
34
- elementRef: _propTypes.default.func,
35
- icon: _propTypes.default.node.isRequired,
36
- label: _propTypes.default.node.isRequired,
37
- as: _propTypes.default.elementType,
38
- href: _propTypes.default.string,
39
- onClick: _propTypes.default.func,
40
- selected: _propTypes.default.bool,
41
- minimized: _propTypes.default.bool
42
- };
43
- const allowedProps = exports.allowedProps = ['elementRef', 'icon', 'label', 'as', 'href', 'onClick', 'selected', 'minimized'];
@@ -1,99 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
- /*
8
- * The MIT License (MIT)
9
- *
10
- * Copyright (c) 2015 - present Instructure, Inc.
11
- *
12
- * Permission is hereby granted, free of charge, to any person obtaining a copy
13
- * of this software and associated documentation files (the "Software"), to deal
14
- * in the Software without restriction, including without limitation the rights
15
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
16
- * copies of the Software, and to permit persons to whom the Software is
17
- * furnished to do so, subject to the following conditions:
18
- *
19
- * The above copyright notice and this permission notice shall be included in all
20
- * copies or substantial portions of the Software.
21
- *
22
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
23
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
25
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
26
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
27
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
28
- * SOFTWARE.
29
- */
30
-
31
- /**
32
- * ---
33
- * private: true
34
- * ---
35
- * Generates the style object from the theme and provided additional information
36
- * @param {Object} componentTheme The theme variable object.
37
- * @param {Object} props the props of the component, the style is applied to
38
- * @param {Object} state the state of the component, the style is applied to
39
- * @return {Object} The final style object, which will be used in the component
40
- */
41
- const generateStyle = (componentTheme, props) => {
42
- const selected = props.selected;
43
- return {
44
- navigationItem: {
45
- label: 'navigationItem',
46
- fontFamily: componentTheme.fontFamily,
47
- fontWeight: componentTheme.fontWeight,
48
- display: 'block',
49
- width: '100%',
50
- textAlign: 'center',
51
- padding: componentTheme.contentPadding,
52
- cursor: 'pointer',
53
- border: 'none',
54
- boxSizing: 'border-box',
55
- textDecoration: componentTheme.linkTextDecoration,
56
- overflowWrap: 'break-word',
57
- wordWrap: 'break-word',
58
- hyphens: 'auto',
59
- ...(selected ? {
60
- backgroundColor: componentTheme.selectedBackgroundColor,
61
- fill: componentTheme.selectedIconColor,
62
- color: componentTheme.selectedFontColor,
63
- '&:active, &:hover': {
64
- backgroundColor: componentTheme.selectedBackgroundColor
65
- },
66
- '&:focus': {
67
- backgroundColor: componentTheme.selectedBackgroundColor,
68
- boxShadow: `${componentTheme.selectedOuterFocusOutline}, ${componentTheme.selectedInnerFocusOutline}`,
69
- outline: 'none'
70
- }
71
- } : {
72
- backgroundColor: componentTheme.backgroundColor,
73
- color: componentTheme.fontColor,
74
- '&:active': {
75
- backgroundColor: componentTheme.hoverBackgroundColor
76
- },
77
- '&:hover': {
78
- backgroundColor: componentTheme.hoverBackgroundColor
79
- },
80
- '&:focus': {
81
- backgroundColor: componentTheme.hoverBackgroundColor,
82
- boxShadow: `${componentTheme.outerFocusOutline}, ${componentTheme.innerFocusOutline}`,
83
- outline: 'none'
84
- }
85
- })
86
- },
87
- icon: {
88
- label: 'navigationItem__icon',
89
- fontSize: componentTheme.iconSize,
90
- fill: componentTheme.iconColor
91
- },
92
- label: {
93
- label: 'navigationItem__label',
94
- fontSize: componentTheme.fontSize,
95
- lineHeight: componentTheme.lineHeight
96
- }
97
- };
98
- };
99
- var _default = exports.default = generateStyle;
@@ -1,79 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
- /*
8
- * The MIT License (MIT)
9
- *
10
- * Copyright (c) 2015 - present Instructure, Inc.
11
- *
12
- * Permission is hereby granted, free of charge, to any person obtaining a copy
13
- * of this software and associated documentation files (the "Software"), to deal
14
- * in the Software without restriction, including without limitation the rights
15
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
16
- * copies of the Software, and to permit persons to whom the Software is
17
- * furnished to do so, subject to the following conditions:
18
- *
19
- * The above copyright notice and this permission notice shall be included in all
20
- * copies or substantial portions of the Software.
21
- *
22
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
23
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
25
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
26
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
27
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
28
- * SOFTWARE.
29
- */
30
-
31
- /**
32
- * Generates the theme object for the component from the theme and provided additional information
33
- * @param {Object} theme The actual theme object.
34
- * @return {Object} The final theme object with the overrides and component variables
35
- */
36
- const generateComponentTheme = theme => {
37
- const colors = theme.colors,
38
- spacing = theme.spacing,
39
- typography = theme.typography,
40
- themeName = theme.key;
41
- const themeSpecificStyle = {
42
- canvas: {
43
- fontColor: theme['ic-brand-global-nav-menu-item__text-color'],
44
- iconColor: theme['ic-brand-global-nav-ic-icon-svg-fill'],
45
- backgroundColor: theme['ic-brand-global-nav-bgd'],
46
- hoverBackgroundColor: theme['ic-global-nav-link-hover'],
47
- selectedFontColor: theme['ic-brand-global-nav-menu-item__text-color--active'],
48
- selectedIconColor: theme['ic-brand-global-nav-ic-icon-svg-fill--active']
49
- },
50
- 'canvas-high-contrast': {
51
- linkTextDecoration: 'underline'
52
- }
53
- };
54
- const componentVariables = {
55
- fontSize: typography === null || typography === void 0 ? void 0 : typography.fontSizeSmall,
56
- fontFamily: typography === null || typography === void 0 ? void 0 : typography.fontFamily,
57
- fontWeight: typography === null || typography === void 0 ? void 0 : typography.fontWeightLight,
58
- fontColor: colors === null || colors === void 0 ? void 0 : colors.textLightest,
59
- iconSize: '1.625rem',
60
- iconColor: colors === null || colors === void 0 ? void 0 : colors.textLightest,
61
- lineHeight: typography === null || typography === void 0 ? void 0 : typography.lineHeight,
62
- backgroundColor: 'transparent',
63
- linkTextDecoration: 'none',
64
- hoverBackgroundColor: colors === null || colors === void 0 ? void 0 : colors.backgroundDarkest,
65
- outerFocusOutline: `inset 0 0 0 0.125rem ${colors === null || colors === void 0 ? void 0 : colors.borderDarkest}`,
66
- innerFocusOutline: `inset 0 0 0 0.25rem ${colors === null || colors === void 0 ? void 0 : colors.borderLightest}`,
67
- selectedFontColor: colors === null || colors === void 0 ? void 0 : colors.textBrand,
68
- selectedIconColor: colors === null || colors === void 0 ? void 0 : colors.textBrand,
69
- selectedBackgroundColor: colors === null || colors === void 0 ? void 0 : colors.backgroundLightest,
70
- selectedOuterFocusOutline: `inset 0 0 0 0.125rem ${colors === null || colors === void 0 ? void 0 : colors.borderLightest}`,
71
- selectedInnerFocusOutline: `inset 0 0 0 0.25rem ${colors === null || colors === void 0 ? void 0 : colors.borderBrand}`,
72
- contentPadding: spacing === null || spacing === void 0 ? void 0 : spacing.xxSmall
73
- };
74
- return {
75
- ...componentVariables,
76
- ...themeSpecificStyle[themeName]
77
- };
78
- };
79
- var _default = exports.default = generateComponentTheme;
@@ -1,48 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- Object.defineProperty(exports, "NavigationItemLocator", {
7
- enumerable: true,
8
- get: function () {
9
- return _NavigationItemLocator.NavigationItemLocator;
10
- }
11
- });
12
- exports.NavigationLocator = void 0;
13
- var _locator = require("@instructure/ui-test-locator/lib/utils/locator.js");
14
- var _index = require("./index");
15
- var _NavigationItemLocator = require("./NavigationItem/NavigationItemLocator");
16
- /*
17
- * The MIT License (MIT)
18
- *
19
- * Copyright (c) 2015 - present Instructure, Inc.
20
- *
21
- * Permission is hereby granted, free of charge, to any person obtaining a copy
22
- * of this software and associated documentation files (the "Software"), to deal
23
- * in the Software without restriction, including without limitation the rights
24
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
25
- * copies of the Software, and to permit persons to whom the Software is
26
- * furnished to do so, subject to the following conditions:
27
- *
28
- * The above copyright notice and this permission notice shall be included in all
29
- * copies or substantial portions of the Software.
30
- *
31
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
32
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
33
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
34
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
35
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
36
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
37
- * SOFTWARE.
38
- */
39
-
40
- // @ts-expect-error ts-migrate(2339) FIXME: Property 'selector' does not exist on type 'typeof... Remove this comment to see the full error message
41
- const NavigationLocator = exports.NavigationLocator = (0, _locator.locator)(_index.Navigation.selector, {
42
- findAllItems: (...args) => {
43
- return _NavigationItemLocator.NavigationItemLocator.findAll(...args);
44
- },
45
- findItem: (...args) => {
46
- return _NavigationItemLocator.NavigationItemLocator.find(...args);
47
- }
48
- });