@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,49 @@
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.SideNavBarLocator = void 0;
13
+ var _locator = require("@instructure/ui-test-locator/lib/utils/locator.js");
14
+ var _index = require("./index");
15
+ var _SideNavBarItemLocator = require("./SideNavBarItem/SideNavBarItemLocator");
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 SideNavBarLocator = (0, _locator.locator)(_index.SideNavBar.selector, {
42
+ findAllItems: (...args) => {
43
+ return _SideNavBarItemLocator.SideNavBarItemLocator.findAll(...args);
44
+ },
45
+ findItem: (...args) => {
46
+ return _SideNavBarItemLocator.SideNavBarItemLocator.find(...args);
47
+ }
48
+ });
49
+ exports.SideNavBarLocator = SideNavBarLocator;
@@ -0,0 +1,147 @@
1
+ "use strict";
2
+
3
+ var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
4
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.SideNavBar = void 0;
9
+ Object.defineProperty(exports, "SideNavBarItem", {
10
+ enumerable: true,
11
+ get: function () {
12
+ return _SideNavBarItem.SideNavBarItem;
13
+ }
14
+ });
15
+ exports.default = void 0;
16
+ var _react = _interopRequireWildcard(require("react"));
17
+ var _testable = require("@instructure/ui-testable/lib/testable.js");
18
+ var _omitProps = require("@instructure/ui-react-utils/lib/omitProps.js");
19
+ var _safeCloneElement = require("@instructure/ui-react-utils/lib/safeCloneElement.js");
20
+ var _IconMoveStartLine = require("@instructure/ui-icons/lib/IconMoveStartLine.js");
21
+ var _ScreenReaderContent = require("@instructure/ui-a11y-content/lib/ScreenReaderContent");
22
+ var _emotion = require("@instructure/emotion");
23
+ var _SideNavBarItem = require("./SideNavBarItem");
24
+ var _styles = _interopRequireDefault(require("./styles"));
25
+ var _theme = _interopRequireDefault(require("./theme"));
26
+ var _props = require("./props");
27
+ var _dec, _dec2, _class, _class2;
28
+ /*
29
+ * The MIT License (MIT)
30
+ *
31
+ * Copyright (c) 2015 - present Instructure, Inc.
32
+ *
33
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
34
+ * of this software and associated documentation files (the "Software"), to deal
35
+ * in the Software without restriction, including without limitation the rights
36
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
37
+ * copies of the Software, and to permit persons to whom the Software is
38
+ * furnished to do so, subject to the following conditions:
39
+ *
40
+ * The above copyright notice and this permission notice shall be included in all
41
+ * copies or substantial portions of the Software.
42
+ *
43
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
44
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
45
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
46
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
47
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
48
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
49
+ * SOFTWARE.
50
+ */
51
+ /** @jsx jsx */
52
+ const navMinimized = ({
53
+ minimized
54
+ }) => ({
55
+ minimized: !minimized
56
+ });
57
+
58
+ /**
59
+ ---
60
+ category: components
61
+ ---
62
+ @tsProps
63
+ **/
64
+ let SideNavBar = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec2 = (0, _testable.testable)(), _dec(_class = _dec2(_class = (_class2 = class SideNavBar extends _react.Component {
65
+ constructor(props) {
66
+ super(props);
67
+ this.ref = null;
68
+ this.handleNavToggle = event => {
69
+ if (!this.isControlled()) {
70
+ this.setState(navMinimized);
71
+ }
72
+ if (typeof this.props.onMinimized === 'function') {
73
+ this.props.onMinimized(event, !this.minimized);
74
+ }
75
+ };
76
+ this.state = {
77
+ minimized: this.isControlled(props) ? !!props.minimized : !!props.defaultMinimized
78
+ };
79
+ }
80
+ componentDidMount() {
81
+ var _this$props$makeStyle, _this$props;
82
+ (_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props, {
83
+ minimized: this.minimized
84
+ });
85
+ }
86
+ componentDidUpdate() {
87
+ var _this$props$makeStyle2, _this$props2;
88
+ (_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2, {
89
+ minimized: this.minimized
90
+ });
91
+ }
92
+ get minimized() {
93
+ if (this.isControlled()) {
94
+ return !!this.props.minimized;
95
+ }
96
+ return !!this.state.minimized;
97
+ }
98
+ isControlled(props = this.props) {
99
+ return typeof props.minimized === 'boolean';
100
+ }
101
+ renderChildren() {
102
+ return _react.Children.map(this.props.children, child => {
103
+ var _this$props$styles;
104
+ const navItem = (0, _safeCloneElement.safeCloneElement)(child, {
105
+ minimized: this.state.minimized
106
+ });
107
+ return (0, _emotion.jsx)("li", {
108
+ css: (_this$props$styles = this.props.styles) === null || _this$props$styles === void 0 ? void 0 : _this$props$styles.list
109
+ }, navItem);
110
+ });
111
+ }
112
+ toggleMessage() {
113
+ return this.state.minimized ? this.props.toggleLabel.minimizedLabel : this.props.toggleLabel.expandedLabel;
114
+ }
115
+ render() {
116
+ var _this$props$styles2, _this$props$styles3, _this$props$styles4, _this$props$styles5;
117
+ const label = this.props.label;
118
+ const props = (0, _omitProps.omitProps)(this.props, SideNavBar.allowedProps, ['minimized']);
119
+ return (0, _emotion.jsx)("nav", Object.assign({}, props, {
120
+ css: (_this$props$styles2 = this.props.styles) === null || _this$props$styles2 === void 0 ? void 0 : _this$props$styles2.navigation,
121
+ "aria-label": label,
122
+ ref: element => {
123
+ this.ref = element;
124
+ }
125
+ }), (0, _emotion.jsx)("ul", {
126
+ css: (_this$props$styles3 = this.props.styles) === null || _this$props$styles3 === void 0 ? void 0 : _this$props$styles3.content
127
+ }, this.renderChildren()), (0, _emotion.jsx)("div", {
128
+ css: (_this$props$styles4 = this.props.styles) === null || _this$props$styles4 === void 0 ? void 0 : _this$props$styles4.toggle
129
+ }, (0, _emotion.jsx)(_SideNavBarItem.SideNavBarItem, {
130
+ "aria-expanded": !this.minimized,
131
+ onClick: this.handleNavToggle,
132
+ icon: (0, _emotion.jsx)(_IconMoveStartLine.IconMoveStartLine, {
133
+ css: (_this$props$styles5 = this.props.styles) === null || _this$props$styles5 === void 0 ? void 0 : _this$props$styles5.toggleIcon,
134
+ inline: false
135
+ }),
136
+ label: (0, _emotion.jsx)(_ScreenReaderContent.ScreenReaderContent, null, this.toggleMessage())
137
+ })));
138
+ }
139
+ }, _class2.displayName = "SideNavBar", _class2.componentId = 'SideNavBar', _class2.allowedProps = _props.allowedProps, _class2.propTypes = _props.propTypes, _class2.defaultProps = {
140
+ children: null,
141
+ defaultMinimized: false,
142
+ // TODO we should investigate later if it used or not
143
+ onClick: function (_e) {}
144
+ }, _class2.Item = _SideNavBarItem.SideNavBarItem, _class2)) || _class) || _class);
145
+ exports.SideNavBar = SideNavBar;
146
+ var _default = SideNavBar;
147
+ exports.default = _default;
@@ -0,0 +1,44 @@
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 _SideNavBarLocator.SideNavBarItemLocator;
10
+ }
11
+ });
12
+ Object.defineProperty(exports, "SideNavBarLocator", {
13
+ enumerable: true,
14
+ get: function () {
15
+ return _SideNavBarLocator.SideNavBarLocator;
16
+ }
17
+ });
18
+ exports.default = void 0;
19
+ var _SideNavBarLocator = require("./SideNavBarLocator");
20
+ /*
21
+ * The MIT License (MIT)
22
+ *
23
+ * Copyright (c) 2015 - present Instructure, Inc.
24
+ *
25
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
26
+ * of this software and associated documentation files (the "Software"), to deal
27
+ * in the Software without restriction, including without limitation the rights
28
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
29
+ * copies of the Software, and to permit persons to whom the Software is
30
+ * furnished to do so, subject to the following conditions:
31
+ *
32
+ * The above copyright notice and this permission notice shall be included in all
33
+ * copies or substantial portions of the Software.
34
+ *
35
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
36
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
37
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
38
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
39
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
40
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
41
+ * SOFTWARE.
42
+ */
43
+ var _default = _SideNavBarLocator.SideNavBarLocator;
44
+ exports.default = _default;
@@ -0,0 +1,51 @@
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
+ var _controllable = require("@instructure/ui-prop-types/lib/controllable.js");
10
+ var _Children = require("@instructure/ui-prop-types/lib/Children.js");
11
+ var _SideNavBarItem = require("./SideNavBarItem");
12
+ /*
13
+ * The MIT License (MIT)
14
+ *
15
+ * Copyright (c) 2015 - present Instructure, Inc.
16
+ *
17
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
18
+ * of this software and associated documentation files (the "Software"), to deal
19
+ * in the Software without restriction, including without limitation the rights
20
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
21
+ * copies of the Software, and to permit persons to whom the Software is
22
+ * furnished to do so, subject to the following conditions:
23
+ *
24
+ * The above copyright notice and this permission notice shall be included in all
25
+ * copies or substantial portions of the Software.
26
+ *
27
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
28
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
29
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
30
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
31
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
32
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
33
+ * SOFTWARE.
34
+ */
35
+
36
+ const propTypes = {
37
+ children: _Children.Children.oneOf([_SideNavBarItem.SideNavBarItem]),
38
+ minimized: (0, _controllable.controllable)(_propTypes.default.bool, 'onMinimized', 'defaultMinimized'),
39
+ defaultMinimized: _propTypes.default.bool,
40
+ onMinimized: _propTypes.default.func,
41
+ label: _propTypes.default.string.isRequired,
42
+ toggleLabel: _propTypes.default.shape({
43
+ expandedLabel: _propTypes.default.string,
44
+ minimizedLabel: _propTypes.default.string
45
+ }).isRequired,
46
+ href: _propTypes.default.string,
47
+ onClick: _propTypes.default.func
48
+ };
49
+ exports.propTypes = propTypes;
50
+ const allowedProps = ['children', 'minimized', 'defaultMinimized', 'onMinimized', 'label', 'toggleLabel', 'href', 'onClick'];
51
+ exports.allowedProps = allowedProps;
@@ -0,0 +1,84 @@
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, state) => {
42
+ const minimized = state.minimized;
43
+ return {
44
+ navigation: {
45
+ label: 'navigation',
46
+ color: componentTheme.fontColor,
47
+ backgroundColor: componentTheme.backgroundColor,
48
+ boxSizing: 'border-box',
49
+ display: 'flex',
50
+ flexDirection: 'column',
51
+ width: componentTheme.width,
52
+ height: '100%',
53
+ overflowY: 'auto',
54
+ ...(minimized ? {
55
+ width: componentTheme.minimizedWidth
56
+ } : {})
57
+ },
58
+ list: {
59
+ label: 'navigation__list',
60
+ padding: 0,
61
+ margin: 0
62
+ },
63
+ content: {
64
+ label: 'navigation__content',
65
+ listStyleType: 'none',
66
+ margin: '0',
67
+ padding: '0',
68
+ flex: '1 0 auto'
69
+ },
70
+ toggle: {
71
+ transform: 'translate3d(0, 0, 0)',
72
+ transition: `all ${componentTheme.toggleTransition}`,
73
+ ...(minimized ? {
74
+ transform: 'rotate3d(0, 1, 0, -180deg)'
75
+ } : {})
76
+ },
77
+ toggleIcon: {
78
+ fill: componentTheme.fill,
79
+ margin: '0 auto'
80
+ }
81
+ };
82
+ };
83
+ var _default = generateStyle;
84
+ exports.default = _default;
@@ -0,0 +1,68 @@
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
+ borders = theme.borders,
40
+ transitions = theme.transitions,
41
+ themeName = theme.key;
42
+ const themeSpecificStyle = {
43
+ canvas: {
44
+ backgroundColor: theme['ic-brand-global-nav-bgd'],
45
+ fontColor: theme['ic-brand-global-nav-menu-item__text-color'],
46
+ fill: theme['ic-brand-global-nav-ic-icon-svg-fill']
47
+ }
48
+ };
49
+ const componentVariables = {
50
+ fontColor: colors === null || colors === void 0 ? void 0 : colors.textLightest,
51
+ backgroundColor: colors === null || colors === void 0 ? void 0 : colors.backgroundBrandSecondary,
52
+ width: '5.25rem',
53
+ minimizedWidth: '3.375rem',
54
+ fill: colors === null || colors === void 0 ? void 0 : colors.textLightest,
55
+ focusOutlineInnerWidth: borders === null || borders === void 0 ? void 0 : borders.widthMedium,
56
+ focusOutlineOuterWidth: borders === null || borders === void 0 ? void 0 : borders.widthSmall,
57
+ focusOutlineInnerColor: colors === null || colors === void 0 ? void 0 : colors.borderBrand,
58
+ focusOutlineOuterColor: colors === null || colors === void 0 ? void 0 : colors.borderLightest,
59
+ marginBottom: spacing === null || spacing === void 0 ? void 0 : spacing.small,
60
+ toggleTransition: transitions === null || transitions === void 0 ? void 0 : transitions.duration
61
+ };
62
+ return {
63
+ ...componentVariables,
64
+ ...themeSpecificStyle[themeName]
65
+ };
66
+ };
67
+ var _default = generateComponentTheme;
68
+ exports.default = _default;
package/lib/index.js ADDED
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "SideNavBar", {
7
+ enumerable: true,
8
+ get: function () {
9
+ return _SideNavBar.SideNavBar;
10
+ }
11
+ });
12
+ Object.defineProperty(exports, "SideNavBarItem", {
13
+ enumerable: true,
14
+ get: function () {
15
+ return _SideNavBar.SideNavBarItem;
16
+ }
17
+ });
18
+ var _SideNavBar = require("./SideNavBar");
@@ -0,0 +1 @@
1
+ {"type":"commonjs"}
package/package.json ADDED
@@ -0,0 +1,61 @@
1
+ {
2
+ "name": "@instructure/ui-side-nav-bar",
3
+ "version": "8.38.2-snapshot-11",
4
+ "description": "Main and application level navigational components",
5
+ "author": "Instructure, Inc. Engineering and Product Design",
6
+ "module": "./es/index.js",
7
+ "main": "./lib/index.js",
8
+ "types": "./types/index.d.ts",
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "https://github.com/instructure/instructure-ui.git"
12
+ },
13
+ "homepage": "https://instructure.github.io/instructure-ui/",
14
+ "bugs": "https://github.com/instructure/instructure-ui/issues",
15
+ "scripts": {
16
+ "lint": "run -T ui-scripts lint",
17
+ "lint:fix": "run -T ui-scripts lint --fix",
18
+ "clean": "run -T ui-scripts clean",
19
+ "build": "run -T ui-scripts build --modules es,cjs",
20
+ "build:watch": "yarn ts:check --watch & run -T ui-scripts build --watch",
21
+ "build:types": "run -T tsc -p tsconfig.build.json",
22
+ "ts:check": "run -T tsc -p tsconfig.build.json --noEmit --emitDeclarationOnly false"
23
+ },
24
+ "license": "MIT",
25
+ "devDependencies": {
26
+ "@instructure/ui-babel-preset": "8.38.2-snapshot-11",
27
+ "@instructure/ui-color-utils": "8.38.2-snapshot-11",
28
+ "@instructure/ui-test-locator": "8.38.2-snapshot-11",
29
+ "@instructure/ui-test-utils": "8.38.2-snapshot-11",
30
+ "@instructure/ui-themes": "8.38.2-snapshot-11"
31
+ },
32
+ "dependencies": {
33
+ "@babel/runtime": "^7.22.5",
34
+ "@instructure/console": "8.38.2-snapshot-11",
35
+ "@instructure/debounce": "8.38.2-snapshot-11",
36
+ "@instructure/emotion": "8.38.2-snapshot-11",
37
+ "@instructure/shared-types": "8.38.2-snapshot-11",
38
+ "@instructure/ui-a11y-content": "8.38.2-snapshot-11",
39
+ "@instructure/ui-a11y-utils": "8.38.2-snapshot-11",
40
+ "@instructure/ui-badge": "8.38.2-snapshot-11",
41
+ "@instructure/ui-dom-utils": "8.38.2-snapshot-11",
42
+ "@instructure/ui-focusable": "8.38.2-snapshot-11",
43
+ "@instructure/ui-icons": "8.38.2-snapshot-11",
44
+ "@instructure/ui-menu": "8.38.2-snapshot-11",
45
+ "@instructure/ui-prop-types": "8.38.2-snapshot-11",
46
+ "@instructure/ui-react-utils": "8.38.2-snapshot-11",
47
+ "@instructure/ui-testable": "8.38.2-snapshot-11",
48
+ "@instructure/ui-tooltip": "8.38.2-snapshot-11",
49
+ "@instructure/ui-truncate-list": "8.38.2-snapshot-11",
50
+ "@instructure/ui-utils": "8.38.2-snapshot-11",
51
+ "@instructure/ui-view": "8.38.2-snapshot-11",
52
+ "prop-types": "^15.8.1"
53
+ },
54
+ "peerDependencies": {
55
+ "react": ">=16.8 <=18"
56
+ },
57
+ "publishConfig": {
58
+ "access": "public"
59
+ },
60
+ "sideEffects": false
61
+ }
@@ -0,0 +1,74 @@
1
+ ---
2
+ describes: SideNavBar
3
+ ---
4
+
5
+ A top-level `SideNavBar` component.
6
+
7
+ > Note that this component is experimental and its API might change significantly in the future.
8
+
9
+ ```js
10
+ ---
11
+ example: true
12
+ ---
13
+ <div style={{height: '35rem'}}>
14
+ <SideNavBar
15
+ label="Main navigation"
16
+ toggleLabel={{
17
+ expandedLabel: 'Minimize SideNavBar',
18
+ minimizedLabel: 'Expand SideNavBar'
19
+ }}
20
+ >
21
+ <SideNavBar.Item
22
+ icon={<IconUserLine />}
23
+ label={<ScreenReaderContent>Home</ScreenReaderContent>}
24
+ href="#"
25
+ themeOverride={{
26
+ backgroundColor: 'red',
27
+ hoverBackgroundColor: 'blue'
28
+ }}
29
+ />
30
+ <SideNavBar.Item
31
+ icon={<Avatar name="Ziggy Marley" size="x-small"/>}
32
+ label="Account"
33
+ onClick={() => { this.loadSubNav('account') }}
34
+ />
35
+ <SideNavBar.Item
36
+ icon={<IconAdminLine />}
37
+ label="Admin"
38
+ href="#"
39
+ />
40
+ <SideNavBar.Item selected
41
+ icon={<IconDashboardLine />}
42
+ label="Dashboard"
43
+ href="#"
44
+ />
45
+ <SideNavBar.Item
46
+ icon={<Badge count={99}><IconInboxLine /></Badge>}
47
+ label="Inbox"
48
+ href="#"
49
+ />
50
+ <SideNavBar.Item
51
+ icon={<IconUserLine />}
52
+ label="Supercalifragilistic"
53
+ href="#"
54
+ />
55
+ </SideNavBar>
56
+ </div>
57
+ ```
58
+
59
+ ### Guidelines
60
+
61
+ ```js
62
+ ---
63
+ guidelines: true
64
+ ---
65
+ <Guidelines>
66
+ <Figure recommendation="yes" title="Do">
67
+ <Figure.Item>Use for top-level SideNavBar</Figure.Item>
68
+ <Figure.Item>Remember that SideNavBar can be themed by the institution</Figure.Item>
69
+ </Figure>
70
+ <Figure recommendation="no" title="Don't">
71
+ <Figure.Item>Add LTI links to the main area</Figure.Item>
72
+ </Figure>
73
+ </Guidelines>
74
+ ```
@@ -0,0 +1,34 @@
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
+
29
+ import { SideNavBarItem } from './index'
30
+
31
+ // @ts-expect-error ts-migrate(2339) FIXME: Property 'selector' does not exist on type 'typeof... Remove this comment to see the full error message
32
+ export const SideNavBarItemLocator = locator(SideNavBarItem.selector, {
33
+ findTooltipContent: (...args: any[]) => TooltipLocator.findContent(...args)
34
+ })