@occmundial/occ-atomic 3.0.0-beta.59 → 3.0.0-beta.60
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +7 -0
- package/build/Menu/Menu.js +111 -0
- package/build/Menu/index.js +34 -0
- package/build/Menu/styles.js +28 -0
- package/build/index.js +6 -17
- package/build/plugin/babel.js +0 -2
- package/package.json +2 -2
- package/build/Header/Header.js +0 -163
- package/build/Header/Header.test.js +0 -118
- package/build/Header/Menu/Menu.js +0 -135
- package/build/Header/Menu/Menu.test.js +0 -107
- package/build/Header/Menu/__snapshots__/Menu.test.js.snap +0 -113
- package/build/Header/Menu/index.js +0 -18
- package/build/Header/Menu/styles.js +0 -123
- package/build/Header/Nav/Nav.js +0 -95
- package/build/Header/Nav/Nav.test.js +0 -81
- package/build/Header/Nav/__snapshots__/Nav.test.js.snap +0 -101
- package/build/Header/Nav/index.js +0 -18
- package/build/Header/Nav/styles.js +0 -110
- package/build/Header/__snapshots__/Header.test.js.snap +0 -79
- package/build/Header/index.js +0 -18
- package/build/Header/styles.js +0 -94
@@ -1,135 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
4
|
-
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
6
|
-
value: true
|
7
|
-
});
|
8
|
-
exports["default"] = void 0;
|
9
|
-
|
10
|
-
var _react = _interopRequireDefault(require("react"));
|
11
|
-
|
12
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
13
|
-
|
14
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
15
|
-
|
16
|
-
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
17
|
-
|
18
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
19
|
-
|
20
|
-
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
21
|
-
|
22
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
23
|
-
|
24
|
-
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
25
|
-
|
26
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
27
|
-
|
28
|
-
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
29
|
-
|
30
|
-
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
31
|
-
|
32
|
-
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
33
|
-
|
34
|
-
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
35
|
-
|
36
|
-
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
37
|
-
|
38
|
-
var Menu = /*#__PURE__*/function (_React$Component) {
|
39
|
-
_inherits(Menu, _React$Component);
|
40
|
-
|
41
|
-
var _super = _createSuper(Menu);
|
42
|
-
|
43
|
-
function Menu(props) {
|
44
|
-
var _this;
|
45
|
-
|
46
|
-
_classCallCheck(this, Menu);
|
47
|
-
|
48
|
-
_this = _super.call(this, props);
|
49
|
-
_this.state = {
|
50
|
-
open: false
|
51
|
-
};
|
52
|
-
_this.toggleMenu = _this.toggleMenu.bind(_assertThisInitialized(_this));
|
53
|
-
_this.closeMenu = _this.closeMenu.bind(_assertThisInitialized(_this));
|
54
|
-
return _this;
|
55
|
-
}
|
56
|
-
|
57
|
-
_createClass(Menu, [{
|
58
|
-
key: "componentDidMount",
|
59
|
-
value: function componentDidMount() {
|
60
|
-
if (process.env.NODE_ENV === 'development') {
|
61
|
-
console.warn('DEPRECATED: The Menu component will be removed soon. Use the NavTab component instead.');
|
62
|
-
}
|
63
|
-
}
|
64
|
-
}, {
|
65
|
-
key: "toggleMenu",
|
66
|
-
value: function toggleMenu(e) {
|
67
|
-
e.stopPropagation();
|
68
|
-
this.setState({
|
69
|
-
open: !this.state.open
|
70
|
-
});
|
71
|
-
|
72
|
-
if (!this.state.open) {
|
73
|
-
window.addEventListener("click", this.closeMenu);
|
74
|
-
}
|
75
|
-
}
|
76
|
-
}, {
|
77
|
-
key: "closeMenu",
|
78
|
-
value: function closeMenu() {
|
79
|
-
this.setState({
|
80
|
-
open: false
|
81
|
-
});
|
82
|
-
window.removeEventListener("click", this.closeMenu);
|
83
|
-
}
|
84
|
-
}, {
|
85
|
-
key: "render",
|
86
|
-
value: function render() {
|
87
|
-
var open = this.state.open;
|
88
|
-
var _this$props = this.props,
|
89
|
-
classes = _this$props.classes,
|
90
|
-
id = _this$props.id,
|
91
|
-
label = _this$props.label,
|
92
|
-
buttons = _this$props.buttons;
|
93
|
-
return /*#__PURE__*/_react["default"].createElement("div", {
|
94
|
-
id: id,
|
95
|
-
className: classes.menu
|
96
|
-
}, /*#__PURE__*/_react["default"].createElement("div", {
|
97
|
-
className: classes.btnContainer
|
98
|
-
}, /*#__PURE__*/_react["default"].createElement("button", {
|
99
|
-
className: "".concat(classes.btnMenu, " ").concat(open ? classes.btnMenuOpen : ''),
|
100
|
-
onClick: this.toggleMenu
|
101
|
-
}, /*#__PURE__*/_react["default"].createElement("p", {
|
102
|
-
className: classes.label
|
103
|
-
}, label), /*#__PURE__*/_react["default"].createElement("i", {
|
104
|
-
className: classes.menuIcon
|
105
|
-
})), /*#__PURE__*/_react["default"].createElement("ul", {
|
106
|
-
className: "".concat(classes.dropdownMenu, " ").concat(open ? classes.dropdownMenuOpen : '')
|
107
|
-
}, buttons.map(function (button, index) {
|
108
|
-
if (button == 'separator') {
|
109
|
-
return /*#__PURE__*/_react["default"].createElement("li", {
|
110
|
-
key: index,
|
111
|
-
className: classes.separator
|
112
|
-
});
|
113
|
-
} else {
|
114
|
-
return /*#__PURE__*/_react["default"].createElement("li", {
|
115
|
-
key: button.id
|
116
|
-
}, /*#__PURE__*/_react["default"].createElement("a", _extends({
|
117
|
-
className: "".concat(classes.listAnchor).concat(button.type == "signOut" ? " ".concat(classes.signOut) : '')
|
118
|
-
}, button), button.label));
|
119
|
-
}
|
120
|
-
}))));
|
121
|
-
}
|
122
|
-
}]);
|
123
|
-
|
124
|
-
return Menu;
|
125
|
-
}(_react["default"].Component);
|
126
|
-
|
127
|
-
Menu.propTypes = {
|
128
|
-
classes: _propTypes["default"].object,
|
129
|
-
config: _propTypes["default"].object,
|
130
|
-
label: _propTypes["default"].string,
|
131
|
-
buttons: _propTypes["default"].array,
|
132
|
-
id: _propTypes["default"].string
|
133
|
-
};
|
134
|
-
var _default = Menu;
|
135
|
-
exports["default"] = _default;
|
@@ -1,107 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
var _react = _interopRequireDefault(require("react"));
|
4
|
-
|
5
|
-
var _enzyme = require("enzyme");
|
6
|
-
|
7
|
-
var _Menu = _interopRequireDefault(require("./Menu"));
|
8
|
-
|
9
|
-
var _styles = _interopRequireDefault(require("./styles"));
|
10
|
-
|
11
|
-
var _index = _interopRequireDefault(require("./index"));
|
12
|
-
|
13
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
14
|
-
|
15
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
16
|
-
|
17
|
-
var reduceClasses = function reduceClasses(prev, curr) {
|
18
|
-
return Object.assign({}, prev, _defineProperty({}, curr, curr));
|
19
|
-
};
|
20
|
-
|
21
|
-
var classes = Object.keys(_styles["default"]).reduce(reduceClasses, {});
|
22
|
-
var buttons = [{
|
23
|
-
id: 'item1',
|
24
|
-
href: '#',
|
25
|
-
label: 'Item 1'
|
26
|
-
}, {
|
27
|
-
id: 'item2',
|
28
|
-
href: '#',
|
29
|
-
label: 'Item 2'
|
30
|
-
}, {
|
31
|
-
id: 'item3',
|
32
|
-
href: '#',
|
33
|
-
label: 'Item 3'
|
34
|
-
}, "separator", {
|
35
|
-
id: 'item4',
|
36
|
-
href: '#',
|
37
|
-
label: 'Item 4',
|
38
|
-
type: 'signOut'
|
39
|
-
}];
|
40
|
-
describe("Menu", function () {
|
41
|
-
it('matches the snapshot', function () {
|
42
|
-
var wrapper = (0, _enzyme.shallow)( /*#__PURE__*/_react["default"].createElement(_Menu["default"], {
|
43
|
-
classes: classes,
|
44
|
-
buttons: buttons
|
45
|
-
}));
|
46
|
-
expect(wrapper).toMatchSnapshot();
|
47
|
-
});
|
48
|
-
it('renders the label', function () {
|
49
|
-
var wrapper = (0, _enzyme.shallow)( /*#__PURE__*/_react["default"].createElement(_Menu["default"], {
|
50
|
-
classes: classes,
|
51
|
-
label: "Menu",
|
52
|
-
buttons: buttons
|
53
|
-
}));
|
54
|
-
expect(wrapper.find('.label').text()).toBe('Menu');
|
55
|
-
});
|
56
|
-
it('toggles the menu', function () {
|
57
|
-
var propagation = jest.fn();
|
58
|
-
var wrapper = (0, _enzyme.shallow)( /*#__PURE__*/_react["default"].createElement(_Menu["default"], {
|
59
|
-
classes: classes,
|
60
|
-
buttons: buttons
|
61
|
-
}));
|
62
|
-
expect(wrapper.find('.dropdownMenu').hasClass('dropdownMenuOpen')).toBe(false);
|
63
|
-
wrapper.find('.btnMenu').simulate('click', {
|
64
|
-
stopPropagation: propagation
|
65
|
-
});
|
66
|
-
expect(wrapper.find('.dropdownMenu').hasClass('dropdownMenuOpen')).toBe(true);
|
67
|
-
});
|
68
|
-
it('renders all the items', function () {
|
69
|
-
var wrapper = (0, _enzyme.shallow)( /*#__PURE__*/_react["default"].createElement(_Menu["default"], {
|
70
|
-
classes: classes,
|
71
|
-
buttons: buttons
|
72
|
-
}));
|
73
|
-
expect(wrapper.find('li').length).toBe(5);
|
74
|
-
});
|
75
|
-
it('renders a separator', function () {
|
76
|
-
var wrapper = (0, _enzyme.shallow)( /*#__PURE__*/_react["default"].createElement(_Menu["default"], {
|
77
|
-
classes: classes,
|
78
|
-
buttons: buttons
|
79
|
-
}));
|
80
|
-
expect(wrapper.find('li').at(3).hasClass('separator')).toBe(true);
|
81
|
-
});
|
82
|
-
it('renders a button to sign out', function () {
|
83
|
-
var wrapper = (0, _enzyme.shallow)( /*#__PURE__*/_react["default"].createElement(_Menu["default"], {
|
84
|
-
classes: classes,
|
85
|
-
buttons: buttons
|
86
|
-
}));
|
87
|
-
expect(wrapper.find('li').at(4).find('a').hasClass('signOut')).toBe(true);
|
88
|
-
});
|
89
|
-
});
|
90
|
-
describe("MenuJSS", function () {
|
91
|
-
it('matches the snapshot', function () {
|
92
|
-
var buttons = [{
|
93
|
-
id: 'item1',
|
94
|
-
href: 'http://occ.com.mx',
|
95
|
-
label: 'Item 1'
|
96
|
-
}];
|
97
|
-
var wrapper = (0, _enzyme.shallow)( /*#__PURE__*/_react["default"].createElement(_index["default"], {
|
98
|
-
buttons: buttons
|
99
|
-
}));
|
100
|
-
expect(wrapper).toMatchSnapshot();
|
101
|
-
});
|
102
|
-
});
|
103
|
-
describe("Menu styles", function () {
|
104
|
-
it('matches the snapshot', function () {
|
105
|
-
expect(_styles["default"]).toMatchSnapshot();
|
106
|
-
});
|
107
|
-
});
|
@@ -1,113 +0,0 @@
|
|
1
|
-
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
2
|
-
|
3
|
-
exports[`Menu matches the snapshot 1`] = `ShallowWrapper {}`;
|
4
|
-
|
5
|
-
exports[`Menu styles matches the snapshot 1`] = `
|
6
|
-
Object {
|
7
|
-
"@media (max-width: 767px)": Object {
|
8
|
-
"dropdownMenu": Object {
|
9
|
-
"width": "200px",
|
10
|
-
},
|
11
|
-
},
|
12
|
-
"btnContainer": Object {
|
13
|
-
"display": "inline-block",
|
14
|
-
"position": "relative",
|
15
|
-
"verticalAlign": "middle",
|
16
|
-
},
|
17
|
-
"btnMenu": Object {
|
18
|
-
"&:hover": Object {
|
19
|
-
"background": "#ffffff",
|
20
|
-
"color": "#1476fb",
|
21
|
-
},
|
22
|
-
"&:hover $menuIcon": Object {
|
23
|
-
"background": "url(data:image/svg+xml;base64,PHN2ZyB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4IgogICAgICAgICAgICAJIHZpZXdCb3g9IjAgMCAxNiAxNiIgc3R5bGU9ImVuYWJsZS1iYWNrZ3JvdW5kOm5ldyAwIDAgMTYgMTY7IiB4bWw6c3BhY2U9InByZXNlcnZlIj4KICAgICAgICAgICAgPGNpcmNsZSBmaWxsPSIjMTQ3NmZiIiBjeD0iNy45IiBjeT0iMi45IiByPSIxLjUiLz4KICAgICAgICAgICAgPGNpcmNsZSBmaWxsPSIjMTQ3NmZiIiBjeD0iNy45IiBjeT0iMTIuOSIgcj0iMS41Ii8+CiAgICAgICAgICAgIDxjaXJjbGUgZmlsbD0iIzE0NzZmYiIgY3g9IjcuOSIgY3k9IjcuOSIgcj0iMS41Ii8+CiAgICAgICAgICAgIDwvc3ZnPg==)",
|
24
|
-
},
|
25
|
-
"background": "none",
|
26
|
-
"border": "none",
|
27
|
-
"borderRadius": "3px",
|
28
|
-
"color": "#ffffff",
|
29
|
-
"cursor": "pointer",
|
30
|
-
"marginLeft": "10px",
|
31
|
-
"outline": "none !important",
|
32
|
-
"padding": "5px 10px 2px 10px",
|
33
|
-
"transition": "0.3s all",
|
34
|
-
},
|
35
|
-
"btnMenuOpen": Object {
|
36
|
-
"& $menuIcon": Object {
|
37
|
-
"background": "url(data:image/svg+xml;base64,PHN2ZyB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4IgogICAgICAgICAgICAJIHZpZXdCb3g9IjAgMCAxNiAxNiIgc3R5bGU9ImVuYWJsZS1iYWNrZ3JvdW5kOm5ldyAwIDAgMTYgMTY7IiB4bWw6c3BhY2U9InByZXNlcnZlIj4KICAgICAgICAgICAgPGNpcmNsZSBmaWxsPSIjMTQ3NmZiIiBjeD0iNy45IiBjeT0iMi45IiByPSIxLjUiLz4KICAgICAgICAgICAgPGNpcmNsZSBmaWxsPSIjMTQ3NmZiIiBjeD0iNy45IiBjeT0iMTIuOSIgcj0iMS41Ii8+CiAgICAgICAgICAgIDxjaXJjbGUgZmlsbD0iIzE0NzZmYiIgY3g9IjcuOSIgY3k9IjcuOSIgcj0iMS41Ii8+CiAgICAgICAgICAgIDwvc3ZnPg==)",
|
38
|
-
},
|
39
|
-
"background": "#ffffff",
|
40
|
-
"color": "#1476fb",
|
41
|
-
},
|
42
|
-
"dropdownMenu": Object {
|
43
|
-
"backgroundClip": "padding-box",
|
44
|
-
"backgroundColor": "#ffffff",
|
45
|
-
"border": "1px solid rgba(0,0,0,.15)",
|
46
|
-
"boxShadow": "0 6px 12px rgba(0,0,0,.175)",
|
47
|
-
"display": "none",
|
48
|
-
"float": "left",
|
49
|
-
"fontSize": "14px",
|
50
|
-
"listStyle": "none",
|
51
|
-
"margin": "13px 0 0 -187px",
|
52
|
-
"minWidth": "160px",
|
53
|
-
"padding": "5px 0",
|
54
|
-
"position": "absolute",
|
55
|
-
"right": "0",
|
56
|
-
"textAlign": "left",
|
57
|
-
"top": "100%",
|
58
|
-
"zIndex": "1000",
|
59
|
-
},
|
60
|
-
"dropdownMenuOpen": Object {
|
61
|
-
"display": "block",
|
62
|
-
},
|
63
|
-
"label": Object {
|
64
|
-
"display": "inline-block",
|
65
|
-
"margin": "0",
|
66
|
-
"maxWidth": "65px",
|
67
|
-
"overflow": "hidden",
|
68
|
-
"paddingRight": "5px",
|
69
|
-
"textOverflow": "ellipsis",
|
70
|
-
"whiteSpace": "nowrap",
|
71
|
-
},
|
72
|
-
"listAnchor": Object {
|
73
|
-
"&:hover, &:focus": Object {
|
74
|
-
"color": "#1476fb",
|
75
|
-
"textDecoration": "none",
|
76
|
-
},
|
77
|
-
"clear": "both",
|
78
|
-
"color": "#000",
|
79
|
-
"cursor": "pointer",
|
80
|
-
"display": "block",
|
81
|
-
"fontWeight": "400",
|
82
|
-
"lineHeight": "1.42857143",
|
83
|
-
"margin": "5px 0 5px 0",
|
84
|
-
"padding": "0 10px",
|
85
|
-
"textDecoration": "none",
|
86
|
-
"whiteSpace": "nowrap",
|
87
|
-
},
|
88
|
-
"menu": Object {
|
89
|
-
"cursor": "pointer !important",
|
90
|
-
"display": "inline-block",
|
91
|
-
"marginTop": "5px",
|
92
|
-
},
|
93
|
-
"menuIcon": Object {
|
94
|
-
"background": "url(data:image/svg+xml;base64,PHN2ZyB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4IgogICAgICAgICAgICAJIHZpZXdCb3g9IjAgMCAxNiAxNiIgc3R5bGU9ImVuYWJsZS1iYWNrZ3JvdW5kOm5ldyAwIDAgMTYgMTY7IiB4bWw6c3BhY2U9InByZXNlcnZlIj4KICAgICAgICAgICAgPGNpcmNsZSBmaWxsPSIjRkZGRkZGIiBjeD0iNy45IiBjeT0iMi45IiByPSIxLjUiLz4KICAgICAgICAgICAgPGNpcmNsZSBmaWxsPSIjRkZGRkZGIiBjeD0iNy45IiBjeT0iMTIuOSIgcj0iMS41Ii8+CiAgICAgICAgICAgIDxjaXJjbGUgZmlsbD0iI0ZGRkZGRiIgY3g9IjcuOSIgY3k9IjcuOSIgcj0iMS41Ii8+CiAgICAgICAgICAgIDwvc3ZnPg==)",
|
95
|
-
"backgroundPosition": "center center",
|
96
|
-
"backgroundRepeat": "no-repeat",
|
97
|
-
"display": "inline-block",
|
98
|
-
"height": "16px",
|
99
|
-
"transition": "0.3s all",
|
100
|
-
"width": "16px",
|
101
|
-
},
|
102
|
-
"separator": Object {
|
103
|
-
"background": "#ebebeb",
|
104
|
-
"height": "1px",
|
105
|
-
},
|
106
|
-
"signOut": Object {
|
107
|
-
"color": "#ff456a !important",
|
108
|
-
"margin": "10px 0 5px 0",
|
109
|
-
},
|
110
|
-
}
|
111
|
-
`;
|
112
|
-
|
113
|
-
exports[`MenuJSS matches the snapshot 1`] = `ShallowWrapper {}`;
|
@@ -1,18 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
4
|
-
value: true
|
5
|
-
});
|
6
|
-
exports["default"] = void 0;
|
7
|
-
|
8
|
-
var _reactJss = _interopRequireDefault(require("react-jss"));
|
9
|
-
|
10
|
-
var _Menu = _interopRequireDefault(require("./Menu"));
|
11
|
-
|
12
|
-
var _styles = _interopRequireDefault(require("./styles"));
|
13
|
-
|
14
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
15
|
-
|
16
|
-
var _default = (0, _reactJss["default"])(_styles["default"])(_Menu["default"]);
|
17
|
-
|
18
|
-
exports["default"] = _default;
|
@@ -1,123 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
4
|
-
value: true
|
5
|
-
});
|
6
|
-
exports["default"] = void 0;
|
7
|
-
|
8
|
-
var _colors = _interopRequireDefault(require("../../subatomic/colors"));
|
9
|
-
|
10
|
-
var _grid = _interopRequireDefault(require("../../subatomic/grid"));
|
11
|
-
|
12
|
-
var _icons = _interopRequireDefault(require("../../subatomic/icons"));
|
13
|
-
|
14
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
15
|
-
|
16
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
17
|
-
|
18
|
-
var _default = _defineProperty({
|
19
|
-
menu: {
|
20
|
-
marginTop: '5px',
|
21
|
-
display: 'inline-block',
|
22
|
-
cursor: 'pointer !important'
|
23
|
-
},
|
24
|
-
btnContainer: {
|
25
|
-
position: 'relative',
|
26
|
-
display: 'inline-block',
|
27
|
-
verticalAlign: 'middle'
|
28
|
-
},
|
29
|
-
btnMenu: {
|
30
|
-
cursor: 'pointer',
|
31
|
-
background: 'none',
|
32
|
-
border: 'none',
|
33
|
-
padding: '5px 10px 2px 10px',
|
34
|
-
marginLeft: '10px',
|
35
|
-
color: _colors["default"].white,
|
36
|
-
transition: '0.3s all',
|
37
|
-
outline: 'none !important',
|
38
|
-
borderRadius: '3px',
|
39
|
-
'&:hover': {
|
40
|
-
color: _colors["default"].blue,
|
41
|
-
background: _colors["default"].white
|
42
|
-
},
|
43
|
-
'&:hover $menuIcon': {
|
44
|
-
background: _icons["default"].base(_icons["default"].menu.icon(["#1476fb"]))
|
45
|
-
}
|
46
|
-
},
|
47
|
-
btnMenuOpen: {
|
48
|
-
color: _colors["default"].blue,
|
49
|
-
background: _colors["default"].white,
|
50
|
-
'& $menuIcon': {
|
51
|
-
background: _icons["default"].base(_icons["default"].menu.icon(["#1476fb"]))
|
52
|
-
}
|
53
|
-
},
|
54
|
-
label: {
|
55
|
-
paddingRight: '5px',
|
56
|
-
margin: '0',
|
57
|
-
display: 'inline-block',
|
58
|
-
overflow: 'hidden',
|
59
|
-
textOverflow: 'ellipsis',
|
60
|
-
maxWidth: '65px',
|
61
|
-
whiteSpace: 'nowrap'
|
62
|
-
},
|
63
|
-
menuIcon: {
|
64
|
-
width: _icons["default"].menu.width,
|
65
|
-
height: _icons["default"].menu.height,
|
66
|
-
display: _icons["default"].menu.display,
|
67
|
-
transition: '0.3s all',
|
68
|
-
background: _icons["default"].base(_icons["default"].menu.icon(["#FFFFFF"])),
|
69
|
-
backgroundRepeat: 'no-repeat',
|
70
|
-
backgroundPosition: 'center center'
|
71
|
-
},
|
72
|
-
dropdownMenu: {
|
73
|
-
position: 'absolute',
|
74
|
-
top: '100%',
|
75
|
-
zIndex: '1000',
|
76
|
-
display: 'none',
|
77
|
-
"float": 'left',
|
78
|
-
minWidth: '160px',
|
79
|
-
padding: '5px 0',
|
80
|
-
fontSize: '14px',
|
81
|
-
textAlign: 'left',
|
82
|
-
listStyle: 'none',
|
83
|
-
backgroundColor: _colors["default"].white,
|
84
|
-
backgroundClip: 'padding-box',
|
85
|
-
border: '1px solid rgba(0,0,0,.15)',
|
86
|
-
boxShadow: '0 6px 12px rgba(0,0,0,.175)',
|
87
|
-
margin: '13px 0 0 -187px',
|
88
|
-
right: '0'
|
89
|
-
},
|
90
|
-
dropdownMenuOpen: {
|
91
|
-
display: 'block'
|
92
|
-
},
|
93
|
-
listAnchor: {
|
94
|
-
textDecoration: 'none',
|
95
|
-
display: 'block',
|
96
|
-
padding: '0 10px',
|
97
|
-
margin: '5px 0 5px 0',
|
98
|
-
clear: 'both',
|
99
|
-
fontWeight: '400',
|
100
|
-
lineHeight: '1.42857143',
|
101
|
-
whiteSpace: 'nowrap',
|
102
|
-
color: '#000',
|
103
|
-
cursor: 'pointer',
|
104
|
-
'&:hover, &:focus': {
|
105
|
-
textDecoration: 'none',
|
106
|
-
color: _colors["default"].blue
|
107
|
-
}
|
108
|
-
},
|
109
|
-
signOut: {
|
110
|
-
color: "".concat(_colors["default"].pink, " !important"),
|
111
|
-
margin: '10px 0 5px 0'
|
112
|
-
},
|
113
|
-
separator: {
|
114
|
-
height: '1px',
|
115
|
-
background: '#ebebeb'
|
116
|
-
}
|
117
|
-
}, "@media (max-width: ".concat(_grid["default"].sm - 1, "px)"), {
|
118
|
-
dropdownMenu: {
|
119
|
-
width: '200px'
|
120
|
-
}
|
121
|
-
});
|
122
|
-
|
123
|
-
exports["default"] = _default;
|
package/build/Header/Nav/Nav.js
DELETED
@@ -1,95 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
4
|
-
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
6
|
-
value: true
|
7
|
-
});
|
8
|
-
exports["default"] = void 0;
|
9
|
-
|
10
|
-
var _react = _interopRequireDefault(require("react"));
|
11
|
-
|
12
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
13
|
-
|
14
|
-
var _Icon = _interopRequireDefault(require("../../Icon"));
|
15
|
-
|
16
|
-
var _colors = _interopRequireDefault(require("../../subatomic/colors"));
|
17
|
-
|
18
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
19
|
-
|
20
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
21
|
-
|
22
|
-
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
23
|
-
|
24
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
25
|
-
|
26
|
-
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
27
|
-
|
28
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
29
|
-
|
30
|
-
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
31
|
-
|
32
|
-
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
33
|
-
|
34
|
-
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
35
|
-
|
36
|
-
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
37
|
-
|
38
|
-
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
39
|
-
|
40
|
-
var Nav = /*#__PURE__*/function (_React$Component) {
|
41
|
-
_inherits(Nav, _React$Component);
|
42
|
-
|
43
|
-
var _super = _createSuper(Nav);
|
44
|
-
|
45
|
-
function Nav() {
|
46
|
-
_classCallCheck(this, Nav);
|
47
|
-
|
48
|
-
return _super.apply(this, arguments);
|
49
|
-
}
|
50
|
-
|
51
|
-
_createClass(Nav, [{
|
52
|
-
key: "componentDidMount",
|
53
|
-
value: function componentDidMount() {
|
54
|
-
if (process.env.NODE_ENV === 'development') {
|
55
|
-
console.warn('DEPRECATED: The Nav component will be removed soon. Please look for another solution.');
|
56
|
-
}
|
57
|
-
}
|
58
|
-
}, {
|
59
|
-
key: "render",
|
60
|
-
value: function render() {
|
61
|
-
var _this$props = this.props,
|
62
|
-
classes = _this$props.classes,
|
63
|
-
active = _this$props.active,
|
64
|
-
navigate = _this$props.navigate,
|
65
|
-
buttons = _this$props.buttons;
|
66
|
-
return /*#__PURE__*/_react["default"].createElement("ul", {
|
67
|
-
className: classes.menu
|
68
|
-
}, buttons.map(function (button) {
|
69
|
-
return /*#__PURE__*/_react["default"].createElement("li", {
|
70
|
-
key: button.id,
|
71
|
-
onClick: navigate,
|
72
|
-
className: "".concat(classes.listItem, " ").concat(active == button.id ? classes.activeItem : ''),
|
73
|
-
id: button.id
|
74
|
-
}, /*#__PURE__*/_react["default"].createElement(_Icon["default"], {
|
75
|
-
iconName: button.icon,
|
76
|
-
colors: active == button.id ? [_colors["default"].white] : [_colors["default"].darkBlue],
|
77
|
-
className: classes.icon
|
78
|
-
}), /*#__PURE__*/_react["default"].createElement("a", {
|
79
|
-
className: classes.listAnchor
|
80
|
-
}, button.label));
|
81
|
-
}));
|
82
|
-
}
|
83
|
-
}]);
|
84
|
-
|
85
|
-
return Nav;
|
86
|
-
}(_react["default"].Component);
|
87
|
-
|
88
|
-
Nav.propTypes = {
|
89
|
-
classes: _propTypes["default"].object,
|
90
|
-
active: _propTypes["default"].string,
|
91
|
-
navigate: _propTypes["default"].func,
|
92
|
-
buttons: _propTypes["default"].array
|
93
|
-
};
|
94
|
-
var _default = Nav;
|
95
|
-
exports["default"] = _default;
|
@@ -1,81 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
var _react = _interopRequireDefault(require("react"));
|
4
|
-
|
5
|
-
var _enzyme = require("enzyme");
|
6
|
-
|
7
|
-
var _Nav = _interopRequireDefault(require("./Nav"));
|
8
|
-
|
9
|
-
var _styles = _interopRequireDefault(require("./styles"));
|
10
|
-
|
11
|
-
var _index = _interopRequireDefault(require("./index"));
|
12
|
-
|
13
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
14
|
-
|
15
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
16
|
-
|
17
|
-
var reduceClasses = function reduceClasses(prev, curr) {
|
18
|
-
return Object.assign({}, prev, _defineProperty({}, curr, curr));
|
19
|
-
};
|
20
|
-
|
21
|
-
var classes = Object.keys(_styles["default"]).reduce(reduceClasses, {});
|
22
|
-
var buttons = [{
|
23
|
-
id: 'item1',
|
24
|
-
icon: 'dashboard',
|
25
|
-
label: 'Item 1'
|
26
|
-
}, {
|
27
|
-
id: 'item2',
|
28
|
-
icon: 'publications',
|
29
|
-
label: 'Item 2'
|
30
|
-
}, {
|
31
|
-
id: 'item3',
|
32
|
-
icon: 'talent',
|
33
|
-
label: 'Item 3'
|
34
|
-
}];
|
35
|
-
describe("Nav", function () {
|
36
|
-
it('matches the snapshot', function () {
|
37
|
-
var wrapper = (0, _enzyme.shallow)( /*#__PURE__*/_react["default"].createElement(_Nav["default"], {
|
38
|
-
classes: classes,
|
39
|
-
buttons: buttons
|
40
|
-
}));
|
41
|
-
expect(wrapper).toMatchSnapshot();
|
42
|
-
});
|
43
|
-
it('renders all the buttons', function () {
|
44
|
-
var wrapper = (0, _enzyme.shallow)( /*#__PURE__*/_react["default"].createElement(_Nav["default"], {
|
45
|
-
classes: classes,
|
46
|
-
buttons: buttons
|
47
|
-
}));
|
48
|
-
expect(wrapper.find('li').length).toBe(3);
|
49
|
-
});
|
50
|
-
it('calls the onClick function', function () {
|
51
|
-
var onClick = jest.fn();
|
52
|
-
var wrapper = (0, _enzyme.shallow)( /*#__PURE__*/_react["default"].createElement(_Nav["default"], {
|
53
|
-
classes: classes,
|
54
|
-
navigate: onClick,
|
55
|
-
buttons: buttons
|
56
|
-
}));
|
57
|
-
wrapper.find('li').at(1).simulate('click');
|
58
|
-
expect(onClick.mock.calls.length).toBe(1);
|
59
|
-
});
|
60
|
-
it('sets an active button', function () {
|
61
|
-
var wrapper = (0, _enzyme.shallow)( /*#__PURE__*/_react["default"].createElement(_Nav["default"], {
|
62
|
-
classes: classes,
|
63
|
-
active: "item1",
|
64
|
-
buttons: buttons
|
65
|
-
}));
|
66
|
-
expect(wrapper.find('li').at(0).hasClass('activeItem')).toBe(true);
|
67
|
-
});
|
68
|
-
});
|
69
|
-
describe("NavJSS", function () {
|
70
|
-
it('matches the snapshot', function () {
|
71
|
-
var wrapper = (0, _enzyme.shallow)( /*#__PURE__*/_react["default"].createElement(_index["default"], {
|
72
|
-
buttons: buttons
|
73
|
-
}));
|
74
|
-
expect(wrapper).toMatchSnapshot();
|
75
|
-
});
|
76
|
-
});
|
77
|
-
describe("Nav styles", function () {
|
78
|
-
it('matches the snapshot', function () {
|
79
|
-
expect(_styles["default"]).toMatchSnapshot();
|
80
|
-
});
|
81
|
-
});
|