@councilbox/councilbox-ui 0.0.2 → 0.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/HOCs/useWindowSize.js +78 -0
- package/dist/assets/img/check.svg +3 -0
- package/dist/assets/img/info.svg +5 -0
- package/dist/build-index.js +10 -2
- package/dist/components/Avatar/Avatar.js +13 -11
- package/dist/components/Avatar/Avatar.stories.js +5 -23
- package/dist/components/Avatar/{DesignAvatar.js → DesignAvatar.stories.js} +0 -0
- package/dist/components/Avatar/{DesignAvatarText.js → DesignAvatarText.stories.js} +0 -0
- package/dist/components/AvatarGroup/AvatarGroup.css +0 -0
- package/dist/components/AvatarGroup/AvatarGroup.js +43 -0
- package/dist/components/AvatarGroup/AvatarGroup.stories.js +32 -0
- package/dist/components/{Avatar/DesignAvatarGroup.js → AvatarGroup/DesignAvatarGroup.stories.js} +4 -2
- package/dist/components/Button/Button.stories.js +1 -12
- package/dist/components/Button/ButtonV1.js +63 -0
- package/dist/components/Grid/DesignGrid.js +1 -5
- package/dist/components/Grid/Grid.js +1 -5
- package/dist/components/Grid/GridItem.js +1 -5
- package/dist/components/Header/Header.js +4 -4
- package/dist/components/InputPassword/InputPassword.js +160 -32
- package/dist/components/InputPassword/InputPassword.stories.js +2 -34
- package/dist/components/InputText/InputText.js +124 -28
- package/dist/components/InputText/InputText.stories.js +3 -35
- package/dist/components/ThemeProvider/ThemeProvider.js +3 -3
- package/dist/index.js +6 -18
- package/dist/setupTests.js +6 -3
- package/dist/styles/main.css +2 -2
- package/dist/styles/reset.css +69 -37
- package/dist/styles/stylesheet.js +83 -0
- package/dist/testing/TestComponents.js +14 -2
- package/package.json +9 -3
- package/dist/Button/Button.js +0 -36
- package/dist/Button/Button.stories.js +0 -71
- package/dist/Button/button.css +0 -30
- package/dist/HOCs/withWindowSize.js +0 -122
- package/dist/Header/Header.js +0 -68
- package/dist/Header/Header.stories.js +0 -31
- package/dist/Header/header.css +0 -26
- package/dist/Introduction.stories.mdx +0 -211
- package/dist/styles/stylesheet.ts +0 -49
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.theme = exports.getSecondary = exports.getPrimary = exports.defaultBreakpoints = void 0;
|
|
7
|
+
|
|
8
|
+
var _styles = require("@mui/material/styles");
|
|
9
|
+
|
|
10
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
11
|
+
|
|
12
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
13
|
+
|
|
14
|
+
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; }
|
|
15
|
+
|
|
16
|
+
var primary = '#38398C';
|
|
17
|
+
var secondary = '#61ABB7';
|
|
18
|
+
var defaultBreakpoints = {
|
|
19
|
+
xs: 320,
|
|
20
|
+
sm: 768,
|
|
21
|
+
md: 1024,
|
|
22
|
+
lg: 1440,
|
|
23
|
+
xl: 1920
|
|
24
|
+
};
|
|
25
|
+
exports.defaultBreakpoints = defaultBreakpoints;
|
|
26
|
+
|
|
27
|
+
var getPrimary = function getPrimary() {
|
|
28
|
+
var actual = document.documentElement.style.getPropertyValue('--primary') || primary;
|
|
29
|
+
return actual;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
exports.getPrimary = getPrimary;
|
|
33
|
+
|
|
34
|
+
var getSecondary = function getSecondary() {
|
|
35
|
+
var actual = document.documentElement.style.getPropertyValue('--secondary') || secondary;
|
|
36
|
+
return actual;
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
exports.getSecondary = getSecondary;
|
|
40
|
+
|
|
41
|
+
var theme = function theme() {
|
|
42
|
+
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
43
|
+
_ref$colors = _ref.colors,
|
|
44
|
+
colors = _ref$colors === void 0 ? {} : _ref$colors,
|
|
45
|
+
_ref$breakpoints = _ref.breakpoints,
|
|
46
|
+
breakpoints = _ref$breakpoints === void 0 ? defaultBreakpoints : _ref$breakpoints;
|
|
47
|
+
|
|
48
|
+
return (0, _styles.createTheme)({
|
|
49
|
+
breakpoints: {
|
|
50
|
+
values: _objectSpread(_objectSpread({}, defaultBreakpoints), breakpoints)
|
|
51
|
+
},
|
|
52
|
+
typography: {
|
|
53
|
+
fontFamily: 'Lato',
|
|
54
|
+
fontSize: 16,
|
|
55
|
+
body1: {
|
|
56
|
+
color: '#616161',
|
|
57
|
+
fontSize: '16px',
|
|
58
|
+
lineHeight: '24px'
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
spacing: [0, 4, 8, 16, 32, 64],
|
|
62
|
+
palette: {
|
|
63
|
+
primary: {
|
|
64
|
+
main: colors.primary || getPrimary()
|
|
65
|
+
},
|
|
66
|
+
secondary: {
|
|
67
|
+
main: colors.secondary || getSecondary()
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
components: {
|
|
71
|
+
MuiAvatar: {
|
|
72
|
+
styleOverrides: {
|
|
73
|
+
root: {
|
|
74
|
+
width: '56px',
|
|
75
|
+
height: '56px'
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
exports.theme = theme;
|
|
@@ -7,6 +7,8 @@ exports.default = void 0;
|
|
|
7
7
|
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
9
|
|
|
10
|
+
var _material = require("@mui/material");
|
|
11
|
+
|
|
10
12
|
var _ThemeProvider = _interopRequireDefault(require("../components/ThemeProvider/ThemeProvider"));
|
|
11
13
|
|
|
12
14
|
var _CouncilboxThemeContext = require("../components/ThemeProvider/CouncilboxThemeContext");
|
|
@@ -17,8 +19,12 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
17
19
|
|
|
18
20
|
var Body = function Body() {
|
|
19
21
|
var cbxTheme = (0, _CouncilboxThemeContext.useCouncilboxTheme)();
|
|
20
|
-
|
|
21
|
-
|
|
22
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_material.Card, {
|
|
23
|
+
style: {
|
|
24
|
+
width: '10em',
|
|
25
|
+
height: '10em'
|
|
26
|
+
}
|
|
27
|
+
}, /*#__PURE__*/_react.default.createElement(_material.Typography, null, "HELLO ", cbxTheme.theme.darkMode ? 'DARK' : 'LIGHT')), /*#__PURE__*/_react.default.createElement(_Button.default, {
|
|
22
28
|
color: "primary",
|
|
23
29
|
text: "texto",
|
|
24
30
|
onClick: function onClick() {
|
|
@@ -34,6 +40,12 @@ var Body = function Body() {
|
|
|
34
40
|
secondary: '#008800'
|
|
35
41
|
});
|
|
36
42
|
}
|
|
43
|
+
}), /*#__PURE__*/_react.default.createElement(_Button.default, {
|
|
44
|
+
color: "secondary",
|
|
45
|
+
text: "Cambiar a dark",
|
|
46
|
+
onClick: function onClick() {
|
|
47
|
+
return cbxTheme.setDarkMode(true);
|
|
48
|
+
}
|
|
37
49
|
}));
|
|
38
50
|
};
|
|
39
51
|
|
package/package.json
CHANGED
|
@@ -1,15 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@councilbox/councilbox-ui",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.5",
|
|
4
4
|
"main": "dist/build-index.js",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist",
|
|
7
7
|
"README.md"
|
|
8
8
|
],
|
|
9
9
|
"author": "Aarón Fuentes González <aaronfuentes86@gmail.com>",
|
|
10
|
+
"contributors": [
|
|
11
|
+
"Anxo Rodriguez <anxo.rodriguez@councilbox.com>",
|
|
12
|
+
"Lorena Vázquez <lorena.vazquez@councilbox.com>",
|
|
13
|
+
"Alexis Sierra <alexis.sierra@councilbox.com>"
|
|
14
|
+
],
|
|
10
15
|
"dependencies": {
|
|
11
16
|
"@emotion/react": "^11.7.1",
|
|
12
17
|
"@emotion/styled": "^11.6.0",
|
|
18
|
+
"@mui/icons-material": "^5.4.4",
|
|
13
19
|
"@mui/material": "^5.2.8",
|
|
14
20
|
"cross-env": "^7.0.3",
|
|
15
21
|
"prop-types": "^15.8.1",
|
|
@@ -25,7 +31,7 @@
|
|
|
25
31
|
"build-storybook": "build-storybook -s public",
|
|
26
32
|
"lint": "eslint . --quiet --ext .js --ext .jsx",
|
|
27
33
|
"clean": "rimraf dist",
|
|
28
|
-
"compile": "yarn run clean && cross-env NODE_ENV=production babel src --out-dir dist --copy-files --ignore testing/*,__tests__,spec.js,test.js
|
|
34
|
+
"compile": "yarn run clean && cross-env NODE_ENV=production babel src --out-dir dist --copy-files --ignore testing/*,__tests__,spec.js,test.js,*.stories.js,__snapshots__"
|
|
29
35
|
},
|
|
30
36
|
"babel": {
|
|
31
37
|
"presets": [
|
|
@@ -77,13 +83,13 @@
|
|
|
77
83
|
"@storybook/addon-actions": "^6.4.13",
|
|
78
84
|
"@storybook/addon-essentials": "^6.4.13",
|
|
79
85
|
"@storybook/addon-links": "^6.4.13",
|
|
86
|
+
"@storybook/addon-storyshots": "^6.4.13",
|
|
80
87
|
"@storybook/addons": "^6.4.13",
|
|
81
88
|
"@storybook/builder-webpack5": "^6.4.13",
|
|
82
89
|
"@storybook/manager-webpack5": "^6.4.13",
|
|
83
90
|
"@storybook/node-logger": "^6.4.13",
|
|
84
91
|
"@storybook/preset-create-react-app": "^4.0.0",
|
|
85
92
|
"@storybook/react": "^6.4.13",
|
|
86
|
-
"@storybook/addon-storyshots": "^6.4.13",
|
|
87
93
|
"@storybook/theming": "^6.4.13",
|
|
88
94
|
"@testing-library/jest-dom": "^5.14.1",
|
|
89
95
|
"@testing-library/react": "^12.0.0",
|
package/dist/Button/Button.js
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
|
|
8
|
-
var _react = _interopRequireDefault(require("react"));
|
|
9
|
-
|
|
10
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
|
-
|
|
12
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
-
|
|
14
|
-
var Button = function Button(_ref) {
|
|
15
|
-
var label = _ref.label,
|
|
16
|
-
backgroundColor = _ref.backgroundColor,
|
|
17
|
-
onClick = _ref.onClick;
|
|
18
|
-
return /*#__PURE__*/_react.default.createElement("button", {
|
|
19
|
-
onClick: onClick,
|
|
20
|
-
style: backgroundColor && {
|
|
21
|
-
backgroundColor: backgroundColor
|
|
22
|
-
}
|
|
23
|
-
}, label);
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
Button.propTypes = {
|
|
27
|
-
backgroundColor: _propTypes.default.string,
|
|
28
|
-
label: _propTypes.default.string.isRequired,
|
|
29
|
-
onClick: _propTypes.default.func
|
|
30
|
-
};
|
|
31
|
-
Button.defaultProps = {
|
|
32
|
-
backgroundColor: null,
|
|
33
|
-
onClick: undefined
|
|
34
|
-
};
|
|
35
|
-
var _default = Button;
|
|
36
|
-
exports.default = _default;
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = exports.Default = void 0;
|
|
7
|
-
|
|
8
|
-
var _react = _interopRequireDefault(require("react"));
|
|
9
|
-
|
|
10
|
-
var _Button = _interopRequireDefault(require("./Button"));
|
|
11
|
-
|
|
12
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
-
|
|
14
|
-
var _default = {
|
|
15
|
-
title: 'Example/Button',
|
|
16
|
-
component: _Button.default,
|
|
17
|
-
argTypes: {
|
|
18
|
-
backgroundColor: {
|
|
19
|
-
control: 'color'
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
};
|
|
23
|
-
exports.default = _default;
|
|
24
|
-
|
|
25
|
-
var Template = function Template(args) {
|
|
26
|
-
return /*#__PURE__*/_react.default.createElement(_Button.default, args);
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
var Default = Template.bind({});
|
|
30
|
-
exports.Default = Default;
|
|
31
|
-
Default.args = {
|
|
32
|
-
label: 'My Button'
|
|
33
|
-
};
|
|
34
|
-
/*
|
|
35
|
-
|
|
36
|
-
export default {
|
|
37
|
-
title: 'Example/Button',
|
|
38
|
-
component: Button,
|
|
39
|
-
// More on argTypes: https://storybook.js.org/docs/react/api/argtypes
|
|
40
|
-
argTypes: {
|
|
41
|
-
backgroundColor: { control: 'color' },
|
|
42
|
-
},
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
// More on component templates: https://storybook.js.org/docs/react/writing-stories/introduction#using-args
|
|
46
|
-
const Template = (args) => <Button {...args} />;
|
|
47
|
-
|
|
48
|
-
export const Primary = Template.bind({});
|
|
49
|
-
// More on args: https://storybook.js.org/docs/react/writing-stories/args
|
|
50
|
-
Primary.args = {
|
|
51
|
-
primary: true,
|
|
52
|
-
label: 'Button',
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
export const Secondary = Template.bind({});
|
|
56
|
-
Secondary.args = {
|
|
57
|
-
label: 'Button',
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
export const Large = Template.bind({});
|
|
61
|
-
Large.args = {
|
|
62
|
-
size: 'large',
|
|
63
|
-
label: 'Button',
|
|
64
|
-
};
|
|
65
|
-
|
|
66
|
-
export const Small = Template.bind({});
|
|
67
|
-
Small.args = {
|
|
68
|
-
size: 'small',
|
|
69
|
-
label: 'Button',
|
|
70
|
-
};
|
|
71
|
-
*/
|
package/dist/Button/button.css
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
.storybook-button {
|
|
2
|
-
font-family: 'Nunito Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;
|
|
3
|
-
font-weight: 700;
|
|
4
|
-
border: 0;
|
|
5
|
-
border-radius: 3em;
|
|
6
|
-
cursor: pointer;
|
|
7
|
-
display: inline-block;
|
|
8
|
-
line-height: 1;
|
|
9
|
-
}
|
|
10
|
-
.storybook-button--primary {
|
|
11
|
-
color: white;
|
|
12
|
-
background-color: #1ea7fd;
|
|
13
|
-
}
|
|
14
|
-
.storybook-button--secondary {
|
|
15
|
-
color: #333;
|
|
16
|
-
background-color: transparent;
|
|
17
|
-
box-shadow: rgba(0, 0, 0, 0.15) 0px 0px 0px 1px inset;
|
|
18
|
-
}
|
|
19
|
-
.storybook-button--small {
|
|
20
|
-
font-size: 12px;
|
|
21
|
-
padding: 10px 16px;
|
|
22
|
-
}
|
|
23
|
-
.storybook-button--medium {
|
|
24
|
-
font-size: 14px;
|
|
25
|
-
padding: 11px 20px;
|
|
26
|
-
}
|
|
27
|
-
.storybook-button--large {
|
|
28
|
-
font-size: 16px;
|
|
29
|
-
padding: 12px 24px;
|
|
30
|
-
}
|
|
@@ -1,122 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports.default = void 0;
|
|
9
|
-
|
|
10
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
11
|
-
|
|
12
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
13
|
-
|
|
14
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
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 ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
19
|
-
|
|
20
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
21
|
-
|
|
22
|
-
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; }
|
|
23
|
-
|
|
24
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
25
|
-
|
|
26
|
-
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); } }
|
|
27
|
-
|
|
28
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
29
|
-
|
|
30
|
-
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 } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
31
|
-
|
|
32
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
33
|
-
|
|
34
|
-
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); }; }
|
|
35
|
-
|
|
36
|
-
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); }
|
|
37
|
-
|
|
38
|
-
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
39
|
-
|
|
40
|
-
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; } }
|
|
41
|
-
|
|
42
|
-
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
43
|
-
|
|
44
|
-
var withWindowSize = function withWindowSize(WrappedComponent) {
|
|
45
|
-
return /*#__PURE__*/function (_Component) {
|
|
46
|
-
_inherits(WithWindowSize, _Component);
|
|
47
|
-
|
|
48
|
-
var _super = _createSuper(WithWindowSize);
|
|
49
|
-
|
|
50
|
-
function WithWindowSize() {
|
|
51
|
-
var _this;
|
|
52
|
-
|
|
53
|
-
_classCallCheck(this, WithWindowSize);
|
|
54
|
-
|
|
55
|
-
_this = _super.call(this);
|
|
56
|
-
_this.state = {
|
|
57
|
-
size: 'md',
|
|
58
|
-
innerHeight: window.innerHeight,
|
|
59
|
-
innerWidth: window.innerWidth
|
|
60
|
-
};
|
|
61
|
-
return _this;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
_createClass(WithWindowSize, [{
|
|
65
|
-
key: "updateSize",
|
|
66
|
-
value: function updateSize() {
|
|
67
|
-
var state = _objectSpread({}, this.state);
|
|
68
|
-
|
|
69
|
-
state.innerWidth = window.innerWidth;
|
|
70
|
-
|
|
71
|
-
if (window.innerWidth <= 767) {
|
|
72
|
-
state.size = 'xs';
|
|
73
|
-
} else if (window.innerWidth <= 1023) {
|
|
74
|
-
state.size = 'sm';
|
|
75
|
-
} else if (window.innerWidth <= 1439) {
|
|
76
|
-
state.size = 'md';
|
|
77
|
-
} else if (window.innerWidth <= 1919) {
|
|
78
|
-
state.size = 'lg';
|
|
79
|
-
} else {
|
|
80
|
-
state.size = 'xl';
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
if (window.innerWidth < window.innerHeight) {
|
|
84
|
-
state.orientation = 'portrait';
|
|
85
|
-
} else if (window.innerWidth > window.innerHeight) {
|
|
86
|
-
state.orientation = 'landscape';
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
if (state.size !== this.state.size) {
|
|
90
|
-
this.setState(_objectSpread({}, state));
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
}, {
|
|
94
|
-
key: "componentDidMount",
|
|
95
|
-
value: function componentDidMount() {
|
|
96
|
-
this.updateSize();
|
|
97
|
-
window.addEventListener('resize', this.updateSize);
|
|
98
|
-
}
|
|
99
|
-
}, {
|
|
100
|
-
key: "componentWillUnmount",
|
|
101
|
-
value: function componentWillUnmount() {
|
|
102
|
-
window.removeEventListener('resize', this.updateSize);
|
|
103
|
-
}
|
|
104
|
-
}, {
|
|
105
|
-
key: "render",
|
|
106
|
-
value: function render() {
|
|
107
|
-
return /*#__PURE__*/_react.default.createElement(WrappedComponent, _extends({
|
|
108
|
-
updateSize: this.updateSize,
|
|
109
|
-
orientation: this.state.orientation,
|
|
110
|
-
innherHeight: this.state.innerHeight,
|
|
111
|
-
innerWidth: this.state.innerWidth,
|
|
112
|
-
windowSize: this.state.size
|
|
113
|
-
}, this.props));
|
|
114
|
-
}
|
|
115
|
-
}]);
|
|
116
|
-
|
|
117
|
-
return WithWindowSize;
|
|
118
|
-
}(_react.Component);
|
|
119
|
-
};
|
|
120
|
-
|
|
121
|
-
var _default = withWindowSize;
|
|
122
|
-
exports.default = _default;
|
package/dist/Header/Header.js
DELETED
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
|
|
8
|
-
var _react = _interopRequireDefault(require("react"));
|
|
9
|
-
|
|
10
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
|
-
|
|
12
|
-
var _ = require("..");
|
|
13
|
-
|
|
14
|
-
require("./header.css");
|
|
15
|
-
|
|
16
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
|
-
|
|
18
|
-
var Header = function Header(_ref) {
|
|
19
|
-
var user = _ref.user,
|
|
20
|
-
onLogin = _ref.onLogin,
|
|
21
|
-
onLogout = _ref.onLogout,
|
|
22
|
-
onCreateAccount = _ref.onCreateAccount;
|
|
23
|
-
return /*#__PURE__*/_react.default.createElement("header", null, /*#__PURE__*/_react.default.createElement("div", {
|
|
24
|
-
className: "wrapper"
|
|
25
|
-
}, /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement("svg", {
|
|
26
|
-
width: "32",
|
|
27
|
-
height: "32",
|
|
28
|
-
viewBox: "0 0 32 32",
|
|
29
|
-
xmlns: "http://www.w3.org/2000/svg"
|
|
30
|
-
}, /*#__PURE__*/_react.default.createElement("g", {
|
|
31
|
-
fill: "none",
|
|
32
|
-
fillRule: "evenodd"
|
|
33
|
-
}, /*#__PURE__*/_react.default.createElement("path", {
|
|
34
|
-
d: "M10 0h12a10 10 0 0110 10v12a10 10 0 01-10 10H10A10 10 0 010 22V10A10 10 0 0110 0z",
|
|
35
|
-
fill: "#FFF"
|
|
36
|
-
}), /*#__PURE__*/_react.default.createElement("path", {
|
|
37
|
-
d: "M5.3 10.6l10.4 6v11.1l-10.4-6v-11zm11.4-6.2l9.7 5.5-9.7 5.6V4.4z",
|
|
38
|
-
fill: "#555AB9"
|
|
39
|
-
}), /*#__PURE__*/_react.default.createElement("path", {
|
|
40
|
-
d: "M27.2 10.6v11.2l-10.5 6V16.5l10.5-6zM15.7 4.4v11L6 10l9.7-5.5z",
|
|
41
|
-
fill: "#91BAF8"
|
|
42
|
-
}))), /*#__PURE__*/_react.default.createElement("h1", null, "Acme")), /*#__PURE__*/_react.default.createElement("div", null, user ? /*#__PURE__*/_react.default.createElement(_.Button, {
|
|
43
|
-
size: "small",
|
|
44
|
-
onClick: onLogout,
|
|
45
|
-
label: "Log out"
|
|
46
|
-
}) : /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_.Button, {
|
|
47
|
-
size: "small",
|
|
48
|
-
onClick: onLogin,
|
|
49
|
-
label: "Log in"
|
|
50
|
-
}), /*#__PURE__*/_react.default.createElement(_.Button, {
|
|
51
|
-
primary: true,
|
|
52
|
-
size: "small",
|
|
53
|
-
onClick: onCreateAccount,
|
|
54
|
-
label: "Sign up"
|
|
55
|
-
})))));
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
Header.propTypes = {
|
|
59
|
-
user: _propTypes.default.shape({}),
|
|
60
|
-
onLogin: _propTypes.default.func.isRequired,
|
|
61
|
-
onLogout: _propTypes.default.func.isRequired,
|
|
62
|
-
onCreateAccount: _propTypes.default.func.isRequired
|
|
63
|
-
};
|
|
64
|
-
Header.defaultProps = {
|
|
65
|
-
user: null
|
|
66
|
-
};
|
|
67
|
-
var _default = Header;
|
|
68
|
-
exports.default = _default;
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = exports.LoggedOut = exports.LoggedIn = void 0;
|
|
7
|
-
|
|
8
|
-
var _react = _interopRequireDefault(require("react"));
|
|
9
|
-
|
|
10
|
-
var _Header = _interopRequireDefault(require("./Header"));
|
|
11
|
-
|
|
12
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
-
|
|
14
|
-
var _default = {
|
|
15
|
-
title: 'Example/Header',
|
|
16
|
-
component: _Header.default
|
|
17
|
-
};
|
|
18
|
-
exports.default = _default;
|
|
19
|
-
|
|
20
|
-
var Template = function Template(args) {
|
|
21
|
-
return /*#__PURE__*/_react.default.createElement(_Header.default, args);
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
var LoggedIn = Template.bind({});
|
|
25
|
-
exports.LoggedIn = LoggedIn;
|
|
26
|
-
LoggedIn.args = {
|
|
27
|
-
user: {}
|
|
28
|
-
};
|
|
29
|
-
var LoggedOut = Template.bind({});
|
|
30
|
-
exports.LoggedOut = LoggedOut;
|
|
31
|
-
LoggedOut.args = {};
|
package/dist/Header/header.css
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
.wrapper {
|
|
2
|
-
font-family: 'Nunito Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;
|
|
3
|
-
border-bottom: 1px solid rgba(0, 0, 0, 0.1);
|
|
4
|
-
padding: 15px 20px;
|
|
5
|
-
display: flex;
|
|
6
|
-
align-items: center;
|
|
7
|
-
justify-content: space-between;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
svg {
|
|
11
|
-
display: inline-block;
|
|
12
|
-
vertical-align: top;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
h1 {
|
|
16
|
-
font-weight: 900;
|
|
17
|
-
font-size: 20px;
|
|
18
|
-
line-height: 1;
|
|
19
|
-
margin: 6px 0 6px 10px;
|
|
20
|
-
display: inline-block;
|
|
21
|
-
vertical-align: top;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
button + button {
|
|
25
|
-
margin-left: 10px;
|
|
26
|
-
}
|