@instructure/ui-side-nav-bar 8.38.2-snapshot-11

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 (73) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/README.md +53 -0
  3. package/es/SideNavBar/SideNavBarItem/SideNavBarItemLocator.js +33 -0
  4. package/es/SideNavBar/SideNavBarItem/index.js +107 -0
  5. package/es/SideNavBar/SideNavBarItem/locator.js +26 -0
  6. package/es/SideNavBar/SideNavBarItem/props.js +36 -0
  7. package/es/SideNavBar/SideNavBarItem/styles.js +93 -0
  8. package/es/SideNavBar/SideNavBarItem/theme.js +73 -0
  9. package/es/SideNavBar/SideNavBarLocator.js +37 -0
  10. package/es/SideNavBar/index.js +130 -0
  11. package/es/SideNavBar/locator.js +27 -0
  12. package/es/SideNavBar/props.js +42 -0
  13. package/es/SideNavBar/styles.js +77 -0
  14. package/es/SideNavBar/theme.js +61 -0
  15. package/es/index.js +25 -0
  16. package/lib/SideNavBar/SideNavBarItem/SideNavBarItemLocator.js +41 -0
  17. package/lib/SideNavBar/SideNavBarItem/index.js +115 -0
  18. package/lib/SideNavBar/SideNavBarItem/locator.js +38 -0
  19. package/lib/SideNavBar/SideNavBarItem/props.js +45 -0
  20. package/lib/SideNavBar/SideNavBarItem/styles.js +100 -0
  21. package/lib/SideNavBar/SideNavBarItem/theme.js +80 -0
  22. package/lib/SideNavBar/SideNavBarLocator.js +49 -0
  23. package/lib/SideNavBar/index.js +147 -0
  24. package/lib/SideNavBar/locator.js +44 -0
  25. package/lib/SideNavBar/props.js +51 -0
  26. package/lib/SideNavBar/styles.js +84 -0
  27. package/lib/SideNavBar/theme.js +68 -0
  28. package/lib/index.js +18 -0
  29. package/lib/package.json +1 -0
  30. package/package.json +61 -0
  31. package/src/SideNavBar/README.md +74 -0
  32. package/src/SideNavBar/SideNavBarItem/SideNavBarItemLocator.ts +34 -0
  33. package/src/SideNavBar/SideNavBarItem/index.tsx +118 -0
  34. package/src/SideNavBar/SideNavBarItem/locator.ts +27 -0
  35. package/src/SideNavBar/SideNavBarItem/props.ts +102 -0
  36. package/src/SideNavBar/SideNavBarItem/styles.ts +103 -0
  37. package/src/SideNavBar/SideNavBarItem/theme.ts +82 -0
  38. package/src/SideNavBar/SideNavBarLocator.ts +40 -0
  39. package/src/SideNavBar/index.tsx +160 -0
  40. package/src/SideNavBar/locator.ts +29 -0
  41. package/src/SideNavBar/props.ts +118 -0
  42. package/src/SideNavBar/styles.ts +83 -0
  43. package/src/SideNavBar/theme.ts +66 -0
  44. package/src/index.ts +28 -0
  45. package/tsconfig.build.json +34 -0
  46. package/tsconfig.build.tsbuildinfo +1 -0
  47. package/tsconfig.json +4 -0
  48. package/types/SideNavBar/SideNavBarItem/SideNavBarItemLocator.d.ts +576 -0
  49. package/types/SideNavBar/SideNavBarItem/SideNavBarItemLocator.d.ts.map +1 -0
  50. package/types/SideNavBar/SideNavBarItem/index.d.ts +48 -0
  51. package/types/SideNavBar/SideNavBarItem/index.d.ts.map +1 -0
  52. package/types/SideNavBar/SideNavBarItem/locator.d.ts +4 -0
  53. package/types/SideNavBar/SideNavBarItem/locator.d.ts.map +1 -0
  54. package/types/SideNavBar/SideNavBarItem/props.d.ts +46 -0
  55. package/types/SideNavBar/SideNavBarItem/props.d.ts.map +1 -0
  56. package/types/SideNavBar/SideNavBarItem/styles.d.ts +15 -0
  57. package/types/SideNavBar/SideNavBarItem/styles.d.ts.map +1 -0
  58. package/types/SideNavBar/SideNavBarItem/theme.d.ts +10 -0
  59. package/types/SideNavBar/SideNavBarItem/theme.d.ts.map +1 -0
  60. package/types/SideNavBar/SideNavBarLocator.d.ts +1983 -0
  61. package/types/SideNavBar/SideNavBarLocator.d.ts.map +1 -0
  62. package/types/SideNavBar/index.d.ts +59 -0
  63. package/types/SideNavBar/index.d.ts.map +1 -0
  64. package/types/SideNavBar/locator.d.ts +5 -0
  65. package/types/SideNavBar/locator.d.ts.map +1 -0
  66. package/types/SideNavBar/props.d.ts +49 -0
  67. package/types/SideNavBar/props.d.ts.map +1 -0
  68. package/types/SideNavBar/styles.d.ts +15 -0
  69. package/types/SideNavBar/styles.d.ts.map +1 -0
  70. package/types/SideNavBar/theme.d.ts +10 -0
  71. package/types/SideNavBar/theme.d.ts.map +1 -0
  72. package/types/index.d.ts +4 -0
  73. package/types/index.d.ts.map +1 -0
@@ -0,0 +1,42 @@
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 { SideNavBarItem } from './SideNavBarItem';
28
+ const propTypes = {
29
+ children: ChildrenPropTypes.oneOf([SideNavBarItem]),
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 };
@@ -0,0 +1,77 @@
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;
@@ -0,0 +1,61 @@
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;
package/es/index.js ADDED
@@ -0,0 +1,25 @@
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
+ export { SideNavBar, SideNavBarItem } from './SideNavBar';
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.SideNavBarItemLocator = 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 SideNavBarItemLocator = (0, _locator.locator)(_index.SideNavBarItem.selector, {
39
+ findTooltipContent: (...args) => _TooltipLocator.TooltipLocator.findContent(...args)
40
+ });
41
+ exports.SideNavBarItemLocator = SideNavBarItemLocator;
@@ -0,0 +1,115 @@
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.SideNavBarItem = 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: SideNavBar
46
+ id: SideNavBar.Item
47
+ ---
48
+ @tsProps
49
+ **/
50
+ let SideNavBarItem = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec2 = (0, _testable.testable)(), _dec(_class = _dec2(_class = (_class2 = class SideNavBarItem extends _react.Component {
51
+ constructor(...args) {
52
+ super(...args);
53
+ this.ref = null;
54
+ this.handleRef = el => {
55
+ const elementRef = this.props.elementRef;
56
+ this.ref = el;
57
+ if (typeof elementRef === 'function') {
58
+ elementRef(el);
59
+ }
60
+ };
61
+ }
62
+ componentDidMount() {
63
+ var _this$props$makeStyle, _this$props;
64
+ (_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props, {
65
+ minimized: this.props.minimized
66
+ });
67
+ }
68
+ componentDidUpdate() {
69
+ var _this$props$makeStyle2, _this$props2;
70
+ (_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2, {
71
+ minimized: this.props.minimized
72
+ });
73
+ }
74
+ renderLink(addRef) {
75
+ var _this$props$styles, _this$props$styles2, _this$props$styles3;
76
+ const ElementType = (0, _getElementType.getElementType)(SideNavBarItem, this.props);
77
+ const _this$props3 = this.props,
78
+ href = _this$props3.href,
79
+ onClick = _this$props3.onClick,
80
+ icon = _this$props3.icon,
81
+ label = _this$props3.label;
82
+ const props = (0, _omitProps.omitProps)(this.props, SideNavBarItem.allowedProps);
83
+ return (0, _emotion.jsx)(ElementType, Object.assign({}, props, {
84
+ href: href,
85
+ onClick: onClick,
86
+ ref: addRef ? this.handleRef : void 0,
87
+ css: (_this$props$styles = this.props.styles) === null || _this$props$styles === void 0 ? void 0 : _this$props$styles.navigationItem,
88
+ "aria-label": this.props.minimized ? label : void 0
89
+ }), (0, _emotion.jsx)("div", {
90
+ css: (_this$props$styles2 = this.props.styles) === null || _this$props$styles2 === void 0 ? void 0 : _this$props$styles2.icon,
91
+ "aria-hidden": "true"
92
+ }, icon), !this.props.minimized ? (0, _emotion.jsx)("div", {
93
+ css: (_this$props$styles3 = this.props.styles) === null || _this$props$styles3 === void 0 ? void 0 : _this$props$styles3.label
94
+ }, label) : null);
95
+ }
96
+ render() {
97
+ const _this$props4 = this.props,
98
+ minimized = _this$props4.minimized,
99
+ label = _this$props4.label;
100
+ const hasTooltip = minimized && (0, _hasVisibleChildren.hasVisibleChildren)(label);
101
+ const link = this.renderLink(!hasTooltip);
102
+ return hasTooltip ? (0, _emotion.jsx)(_Tooltip.Tooltip, {
103
+ renderTip: label,
104
+ placement: "end",
105
+ elementRef: this.handleRef
106
+ }, link) : link;
107
+ }
108
+ }, _class2.displayName = "SideNavBarItem", _class2.componentId = 'SideNavBar.Item', _class2.allowedProps = _props.allowedProps, _class2.propTypes = _props.propTypes, _class2.defaultProps = {
109
+ as: 'a',
110
+ selected: false,
111
+ minimized: false
112
+ }, _class2)) || _class) || _class);
113
+ exports.SideNavBarItem = SideNavBarItem;
114
+ var _default = SideNavBarItem;
115
+ exports.default = _default;
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "SideNavBarItemLocator", {
7
+ enumerable: true,
8
+ get: function () {
9
+ return _SideNavBarItemLocator.SideNavBarItemLocator;
10
+ }
11
+ });
12
+ exports.default = void 0;
13
+ var _SideNavBarItemLocator = require("./SideNavBarItemLocator");
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 = _SideNavBarItemLocator.SideNavBarItemLocator;
38
+ exports.default = _default;
@@ -0,0 +1,45 @@
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 = {
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
+ exports.propTypes = propTypes;
44
+ const allowedProps = ['elementRef', 'icon', 'label', 'as', 'href', 'onClick', 'selected', 'minimized'];
45
+ exports.allowedProps = allowedProps;
@@ -0,0 +1,100 @@
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 = generateStyle;
100
+ exports.default = _default;
@@ -0,0 +1,80 @@
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 = generateComponentTheme;
80
+ exports.default = _default;