@hipay/hipay-material-ui 2.2.0-beta-core2 → 2.2.0-beta-core4

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/es/index.js CHANGED
@@ -13,6 +13,7 @@ export { default as HiMap } from './HiMap/HiMap';
13
13
  export { default as HiMapExpand } from './HiMap/HiMapExpand';
14
14
  export { default as HiTextField } from './HiForm/HiTextField';
15
15
  export { default as HiPasswordField } from './HiForm/HiPasswordField';
16
+ export { default as HiPdfReader } from './HiPdfReader/HiPdfReader';
16
17
  export { default as HiSlider } from './HiForm/HiSlider';
17
18
  export { default as HiSwitch } from './HiSwitch';
18
19
  export { default as HiSwitchState } from './HiSwitch/HiSwitchState';
@@ -20,7 +21,6 @@ export { default as HiTable } from './HiTable/HiTable';
20
21
  export { default as HiDotsStepper } from './HiDotsStepper/HiDotsStepper';
21
22
  export { default as HiDot } from './HiDotsStepper/HiDot';
22
23
  export { default as withMobileDialog } from './withMobileDialog';
23
- export { default as withWidth } from './withWidth';
24
24
  export { default as HiDatePicker } from './HiDatePicker/HiDatePicker';
25
25
  export { default as HiDateRangePicker } from './HiDatePicker/HiDateRangePicker';
26
26
  export { default as HiDateRangeSelector } from './HiDatePicker/HiDateRangeSelector';
@@ -1,7 +1,7 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import React from 'react';
3
3
  import PropTypes from 'prop-types';
4
- import withWidth, { isWidthDown } from '../withWidth';
4
+ import withWidth, { isWidthDown } from '@material-ui/core/withWidth';
5
5
  /**
6
6
  * Dialog will responsively be full screen *at or below* the given breakpoint
7
7
  * (defaults to 'sm' for mobile devices).
package/index.es.js CHANGED
@@ -1,4 +1,4 @@
1
- /** @license HiPay-Material-UI v2.2.0-beta-core
1
+ /** @license HiPay-Material-UI v2.2.0-beta-core4
2
2
  *
3
3
  * This source code is licensed under the MIT license found in the
4
4
  * LICENSE file in the root directory of this source tree.
@@ -18,6 +18,7 @@ export { default as HiMap } from './HiMap/HiMap';
18
18
  export { default as HiMapExpand } from './HiMap/HiMapExpand';
19
19
  export { default as HiTextField } from './HiForm/HiTextField';
20
20
  export { default as HiPasswordField } from './HiForm/HiPasswordField';
21
+ export { default as HiPdfReader } from './HiPdfReader/HiPdfReader';
21
22
  export { default as HiSlider } from './HiForm/HiSlider';
22
23
  export { default as HiSwitch } from './HiSwitch';
23
24
  export { default as HiSwitchState } from './HiSwitch/HiSwitchState';
@@ -25,7 +26,6 @@ export { default as HiTable } from './HiTable/HiTable';
25
26
  export { default as HiDotsStepper } from './HiDotsStepper/HiDotsStepper';
26
27
  export { default as HiDot } from './HiDotsStepper/HiDot';
27
28
  export { default as withMobileDialog } from './withMobileDialog';
28
- export { default as withWidth } from './withWidth';
29
29
  export { default as HiDatePicker } from './HiDatePicker/HiDatePicker';
30
30
  export { default as HiDateRangePicker } from './HiDatePicker/HiDateRangePicker';
31
31
  export { default as HiDateRangeSelector } from './HiDatePicker/HiDateRangeSelector';
package/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /** @license HiPay-Material-UI v2.2.0-beta-core
1
+ /** @license HiPay-Material-UI v2.2.0-beta-core4
2
2
  *
3
3
  * This source code is licensed under the MIT license found in the
4
4
  * LICENSE file in the root directory of this source tree.
@@ -136,6 +136,12 @@ Object.defineProperty(exports, "HiPasswordField", {
136
136
  return _HiPasswordField.default;
137
137
  }
138
138
  });
139
+ Object.defineProperty(exports, "HiPdfReader", {
140
+ enumerable: true,
141
+ get: function get() {
142
+ return _HiPdfReader.default;
143
+ }
144
+ });
139
145
  Object.defineProperty(exports, "HiSlider", {
140
146
  enumerable: true,
141
147
  get: function get() {
@@ -178,12 +184,6 @@ Object.defineProperty(exports, "withMobileDialog", {
178
184
  return _withMobileDialog.default;
179
185
  }
180
186
  });
181
- Object.defineProperty(exports, "withWidth", {
182
- enumerable: true,
183
- get: function get() {
184
- return _withWidth.default;
185
- }
186
- });
187
187
  Object.defineProperty(exports, "HiDatePicker", {
188
188
  enumerable: true,
189
189
  get: function get() {
@@ -239,6 +239,8 @@ var _HiTextField = _interopRequireDefault(require("./HiForm/HiTextField"));
239
239
 
240
240
  var _HiPasswordField = _interopRequireDefault(require("./HiForm/HiPasswordField"));
241
241
 
242
+ var _HiPdfReader = _interopRequireDefault(require("./HiPdfReader/HiPdfReader"));
243
+
242
244
  var _HiSlider = _interopRequireDefault(require("./HiForm/HiSlider"));
243
245
 
244
246
  var _HiSwitch = _interopRequireDefault(require("./HiSwitch"));
@@ -253,8 +255,6 @@ var _HiDot = _interopRequireDefault(require("./HiDotsStepper/HiDot"));
253
255
 
254
256
  var _withMobileDialog = _interopRequireDefault(require("./withMobileDialog"));
255
257
 
256
- var _withWidth = _interopRequireDefault(require("./withWidth"));
257
-
258
258
  var _HiDatePicker = _interopRequireDefault(require("./HiDatePicker/HiDatePicker"));
259
259
 
260
260
  var _HiDateRangePicker = _interopRequireDefault(require("./HiDatePicker/HiDateRangePicker"));
package/package.json CHANGED
@@ -1,8 +1,7 @@
1
1
  {
2
2
  "name": "@hipay/hipay-material-ui",
3
- "private": false,
4
3
  "author": "HiPay PSYCHE Team",
5
- "version": "2.2.0-beta-core2",
4
+ "version": "2.2.0-beta-core4",
6
5
  "description": "React components that implement Google's Material Design.",
7
6
  "keywords": [
8
7
  "react",
@@ -60,6 +59,7 @@
60
59
  "react-jss": "^8.1.0",
61
60
  "react-lazyload": "^2.5.0",
62
61
  "react-leaflet": "^2.3.0",
62
+ "react-pdf": "^3.0.5",
63
63
  "react-spinners": "^0.4.5",
64
64
  "react-transition-group": "^2.2.1",
65
65
  "recompose": "^0.29.0",
@@ -15,7 +15,7 @@ var _react = _interopRequireDefault(require("react"));
15
15
 
16
16
  var _propTypes = _interopRequireDefault(require("prop-types"));
17
17
 
18
- var _withWidth = _interopRequireWildcard(require("../withWidth"));
18
+ var _withWidth = _interopRequireWildcard(require("@material-ui/core/withWidth"));
19
19
 
20
20
  /**
21
21
  * Dialog will responsively be full screen *at or below* the given breakpoint
@@ -1,2 +0,0 @@
1
- export { default } from './withWidth';
2
- export * from './withWidth';
@@ -1,176 +0,0 @@
1
- import _extends from "@babel/runtime/helpers/extends";
2
- import _objectSpread from "@babel/runtime/helpers/objectSpread";
3
- import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
4
-
5
- /* eslint-disable react/no-did-mount-set-state */
6
- import React from 'react';
7
- import PropTypes from 'prop-types';
8
- import EventListener from 'react-event-listener';
9
- import debounce from 'debounce'; // < 1kb payload overhead when lodash/debounce is > 3kb.
10
-
11
- import wrapDisplayName from 'recompose/wrapDisplayName';
12
- import hoistNonReactStatics from 'hoist-non-react-statics';
13
- import withTheme from '@material-ui/core/styles/withTheme';
14
- import { keys as breakpointKeys } from '@material-ui/core/styles/createBreakpoints';
15
- import getThemeProps from '@material-ui/core/styles/getThemeProps'; // By default, returns true if screen width is the same or greater than the given breakpoint.
16
-
17
- export const isWidthUp = (breakpoint, width, inclusive = true) => {
18
- if (inclusive) {
19
- return breakpointKeys.indexOf(breakpoint) <= breakpointKeys.indexOf(width);
20
- }
21
-
22
- return breakpointKeys.indexOf(breakpoint) < breakpointKeys.indexOf(width);
23
- }; // By default, returns true if screen width is the same or less than the given breakpoint.
24
-
25
- export const isWidthDown = (breakpoint, width, inclusive = true) => {
26
- if (inclusive) {
27
- return breakpointKeys.indexOf(width) <= breakpointKeys.indexOf(breakpoint);
28
- }
29
-
30
- return breakpointKeys.indexOf(width) < breakpointKeys.indexOf(breakpoint);
31
- };
32
-
33
- const withWidth = (options = {}) => Component => {
34
- const {
35
- withTheme: withThemeOption = false,
36
- noSSR = false,
37
- initialWidth: initialWidthOption,
38
- resizeInterval = 166 // Corresponds to 10 frames at 60 Hz.
39
-
40
- } = options;
41
-
42
- class WithWidth extends React.Component {
43
- constructor(props) {
44
- super(props);
45
- this.handleResize = debounce(() => {
46
- const width = this.getWidth();
47
-
48
- if (width !== this.state.width) {
49
- this.setState({
50
- width
51
- });
52
- }
53
- }, resizeInterval);
54
- this.state = {
55
- width: undefined
56
- };
57
-
58
- if (noSSR) {
59
- this.state.width = this.getWidth();
60
- }
61
- }
62
-
63
- componentDidMount() {
64
- const width = this.getWidth();
65
-
66
- if (width !== this.state.width) {
67
- this.setState({
68
- width
69
- });
70
- }
71
- }
72
-
73
- componentWillUnmount() {
74
- this.handleResize.clear();
75
- }
76
-
77
- getWidth(innerWidth = window.innerWidth) {
78
- const breakpoints = this.props.theme.breakpoints;
79
- let width = null;
80
- /**
81
- * Start with the slowest value as low end devices often have a small screen.
82
- *
83
- * innerWidth |xs sm md lg xl
84
- * |-------|-------|-------|-------|------>
85
- * width | xs | sm | md | lg | xl
86
- */
87
-
88
- let index = 1;
89
-
90
- while (width === null && index < breakpointKeys.length) {
91
- const currentWidth = breakpointKeys[index]; // @media are inclusive, so reproduce the behavior here.
92
-
93
- if (innerWidth < breakpoints.values[currentWidth]) {
94
- width = breakpointKeys[index - 1];
95
- break;
96
- }
97
-
98
- index += 1;
99
- }
100
-
101
- width = width || 'xl';
102
- return width;
103
- }
104
-
105
- render() {
106
- const _this$props = this.props,
107
- {
108
- initialWidth,
109
- theme,
110
- width
111
- } = _this$props,
112
- other = _objectWithoutProperties(_this$props, ["initialWidth", "theme", "width"]);
113
-
114
- const props = _objectSpread({
115
- width: width || this.state.width || initialWidth || initialWidthOption || getThemeProps({
116
- theme,
117
- name: 'MuiWithWidth'
118
- }).initialWidth
119
- }, other);
120
-
121
- const more = {};
122
-
123
- if (withThemeOption) {
124
- more.theme = theme;
125
- } // When rendering the component on the server,
126
- // we have no idea about the client browser screen width.
127
- // In order to prevent blinks and help the reconciliation of the React tree
128
- // we are not rendering the child component.
129
- //
130
- // An alternative is to use the `initialWidth` property.
131
-
132
-
133
- if (props.width === undefined) {
134
- return null;
135
- }
136
-
137
- return React.createElement(EventListener, {
138
- target: "window",
139
- onResize: this.handleResize
140
- }, React.createElement(Component, _extends({}, more, props)));
141
- }
142
-
143
- }
144
-
145
- WithWidth.propTypes = process.env.NODE_ENV !== "production" ? {
146
- /**
147
- * As `window.innerWidth` is unavailable on the server,
148
- * we default to rendering an empty component during the first mount.
149
- * In some situation, you might want to use an heuristic to approximate
150
- * the screen width of the client browser screen width.
151
- *
152
- * For instance, you could be using the user-agent or the client-hints.
153
- * http://caniuse.com/#search=client%20hint
154
- */
155
- initialWidth: PropTypes.oneOf(['xs', 'sm', 'md', 'lg', 'xl']),
156
-
157
- /**
158
- * @ignore
159
- */
160
- theme: PropTypes.object.isRequired,
161
-
162
- /**
163
- * Bypass the width calculation logic.
164
- */
165
- width: PropTypes.oneOf(['xs', 'sm', 'md', 'lg', 'xl'])
166
- } : {};
167
-
168
- if (process.env.NODE_ENV !== 'production') {
169
- WithWidth.displayName = wrapDisplayName(Component, 'WithWidth');
170
- }
171
-
172
- hoistNonReactStatics(WithWidth, Component);
173
- return withTheme()(WithWidth);
174
- };
175
-
176
- export default withWidth;
@@ -1,27 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");
4
-
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
7
- });
8
- var _exportNames = {};
9
- Object.defineProperty(exports, "default", {
10
- enumerable: true,
11
- get: function get() {
12
- return _withWidth.default;
13
- }
14
- });
15
-
16
- var _withWidth = _interopRequireWildcard(require("./withWidth"));
17
-
18
- Object.keys(_withWidth).forEach(function (key) {
19
- if (key === "default" || key === "__esModule") return;
20
- if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
21
- Object.defineProperty(exports, key, {
22
- enumerable: true,
23
- get: function get() {
24
- return _withWidth[key];
25
- }
26
- });
27
- });
@@ -1,229 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
7
- });
8
- exports.default = exports.isWidthDown = exports.isWidthUp = void 0;
9
-
10
- var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
11
-
12
- var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
13
-
14
- var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
15
-
16
- var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
17
-
18
- var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
19
-
20
- var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
21
-
22
- var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
23
-
24
- var _react = _interopRequireDefault(require("react"));
25
-
26
- var _propTypes = _interopRequireDefault(require("prop-types"));
27
-
28
- var _reactEventListener = _interopRequireDefault(require("react-event-listener"));
29
-
30
- var _debounce = _interopRequireDefault(require("debounce"));
31
-
32
- var _wrapDisplayName = _interopRequireDefault(require("recompose/wrapDisplayName"));
33
-
34
- var _hoistNonReactStatics = _interopRequireDefault(require("hoist-non-react-statics"));
35
-
36
- var _withTheme = _interopRequireDefault(require("@material-ui/core/styles/withTheme"));
37
-
38
- var _createBreakpoints = require("@material-ui/core/styles/createBreakpoints");
39
-
40
- var _getThemeProps = _interopRequireDefault(require("@material-ui/core/styles/getThemeProps"));
41
-
42
- /* eslint-disable react/no-did-mount-set-state */
43
- // < 1kb payload overhead when lodash/debounce is > 3kb.
44
- // By default, returns true if screen width is the same or greater than the given breakpoint.
45
- var isWidthUp = function isWidthUp(breakpoint, width) {
46
- var inclusive = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
47
-
48
- if (inclusive) {
49
- return _createBreakpoints.keys.indexOf(breakpoint) <= _createBreakpoints.keys.indexOf(width);
50
- }
51
-
52
- return _createBreakpoints.keys.indexOf(breakpoint) < _createBreakpoints.keys.indexOf(width);
53
- }; // By default, returns true if screen width is the same or less than the given breakpoint.
54
-
55
-
56
- exports.isWidthUp = isWidthUp;
57
-
58
- var isWidthDown = function isWidthDown(breakpoint, width) {
59
- var inclusive = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
60
-
61
- if (inclusive) {
62
- return _createBreakpoints.keys.indexOf(width) <= _createBreakpoints.keys.indexOf(breakpoint);
63
- }
64
-
65
- return _createBreakpoints.keys.indexOf(width) < _createBreakpoints.keys.indexOf(breakpoint);
66
- };
67
-
68
- exports.isWidthDown = isWidthDown;
69
-
70
- var withWidth = function withWidth() {
71
- var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
72
- return function (Component) {
73
- var _options$withTheme = options.withTheme,
74
- withThemeOption = _options$withTheme === void 0 ? false : _options$withTheme,
75
- _options$noSSR = options.noSSR,
76
- noSSR = _options$noSSR === void 0 ? false : _options$noSSR,
77
- initialWidthOption = options.initialWidth,
78
- _options$resizeInterv = options.resizeInterval,
79
- resizeInterval = _options$resizeInterv === void 0 ? 166 : _options$resizeInterv;
80
-
81
- var WithWidth =
82
- /*#__PURE__*/
83
- function (_React$Component) {
84
- (0, _inherits2.default)(WithWidth, _React$Component);
85
-
86
- function WithWidth(props) {
87
- var _this;
88
-
89
- (0, _classCallCheck2.default)(this, WithWidth);
90
- _this = (0, _possibleConstructorReturn2.default)(this, (0, _getPrototypeOf2.default)(WithWidth).call(this, props));
91
- _this.handleResize = (0, _debounce.default)(function () {
92
- var width = _this.getWidth();
93
-
94
- if (width !== _this.state.width) {
95
- _this.setState({
96
- width: width
97
- });
98
- }
99
- }, resizeInterval);
100
- _this.state = {
101
- width: undefined
102
- };
103
-
104
- if (noSSR) {
105
- _this.state.width = _this.getWidth();
106
- }
107
-
108
- return _this;
109
- }
110
-
111
- (0, _createClass2.default)(WithWidth, [{
112
- key: "componentDidMount",
113
- value: function componentDidMount() {
114
- var width = this.getWidth();
115
-
116
- if (width !== this.state.width) {
117
- this.setState({
118
- width: width
119
- });
120
- }
121
- }
122
- }, {
123
- key: "componentWillUnmount",
124
- value: function componentWillUnmount() {
125
- this.handleResize.clear();
126
- }
127
- }, {
128
- key: "getWidth",
129
- value: function getWidth() {
130
- var innerWidth = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : window.innerWidth;
131
- var breakpoints = this.props.theme.breakpoints;
132
- var width = null;
133
- /**
134
- * Start with the slowest value as low end devices often have a small screen.
135
- *
136
- * innerWidth |xs sm md lg xl
137
- * |-------|-------|-------|-------|------>
138
- * width | xs | sm | md | lg | xl
139
- */
140
-
141
- var index = 1;
142
-
143
- while (width === null && index < _createBreakpoints.keys.length) {
144
- var currentWidth = _createBreakpoints.keys[index]; // @media are inclusive, so reproduce the behavior here.
145
-
146
- if (innerWidth < breakpoints.values[currentWidth]) {
147
- width = _createBreakpoints.keys[index - 1];
148
- break;
149
- }
150
-
151
- index += 1;
152
- }
153
-
154
- width = width || 'xl';
155
- return width;
156
- }
157
- }, {
158
- key: "render",
159
- value: function render() {
160
- var _this$props = this.props,
161
- initialWidth = _this$props.initialWidth,
162
- theme = _this$props.theme,
163
- width = _this$props.width,
164
- other = (0, _objectWithoutProperties2.default)(_this$props, ["initialWidth", "theme", "width"]);
165
- var props = (0, _extends2.default)({
166
- width: width || this.state.width || initialWidth || initialWidthOption || (0, _getThemeProps.default)({
167
- theme: theme,
168
- name: 'MuiWithWidth'
169
- }).initialWidth
170
- }, other);
171
- var more = {};
172
-
173
- if (withThemeOption) {
174
- more.theme = theme;
175
- } // When rendering the component on the server,
176
- // we have no idea about the client browser screen width.
177
- // In order to prevent blinks and help the reconciliation of the React tree
178
- // we are not rendering the child component.
179
- //
180
- // An alternative is to use the `initialWidth` property.
181
-
182
-
183
- if (props.width === undefined) {
184
- return null;
185
- }
186
-
187
- return _react.default.createElement(_reactEventListener.default, {
188
- target: "window",
189
- onResize: this.handleResize
190
- }, _react.default.createElement(Component, (0, _extends2.default)({}, more, props)));
191
- }
192
- }]);
193
- return WithWidth;
194
- }(_react.default.Component);
195
-
196
- WithWidth.propTypes = process.env.NODE_ENV !== "production" ? {
197
- /**
198
- * As `window.innerWidth` is unavailable on the server,
199
- * we default to rendering an empty component during the first mount.
200
- * In some situation, you might want to use an heuristic to approximate
201
- * the screen width of the client browser screen width.
202
- *
203
- * For instance, you could be using the user-agent or the client-hints.
204
- * http://caniuse.com/#search=client%20hint
205
- */
206
- initialWidth: _propTypes.default.oneOf(['xs', 'sm', 'md', 'lg', 'xl']),
207
-
208
- /**
209
- * @ignore
210
- */
211
- theme: _propTypes.default.object.isRequired,
212
-
213
- /**
214
- * Bypass the width calculation logic.
215
- */
216
- width: _propTypes.default.oneOf(['xs', 'sm', 'md', 'lg', 'xl'])
217
- } : {};
218
-
219
- if (process.env.NODE_ENV !== 'production') {
220
- WithWidth.displayName = (0, _wrapDisplayName.default)(Component, 'WithWidth');
221
- }
222
-
223
- (0, _hoistNonReactStatics.default)(WithWidth, Component);
224
- return (0, _withTheme.default)()(WithWidth);
225
- };
226
- };
227
-
228
- var _default = withWidth;
229
- exports.default = _default;