@experium/findy-form 1.3.12 → 1.3.14

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.
@@ -7,7 +7,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
7
7
  Object.defineProperty(exports, "__esModule", {
8
8
  value: true
9
9
  });
10
- exports["default"] = void 0;
10
+ exports["default"] = exports.AUDIO_WEB_NAME = void 0;
11
11
 
12
12
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
13
13
 
@@ -68,6 +68,8 @@ var styles = {
68
68
  "timeIndicator": "index__timeIndicator",
69
69
  "modalButtonGroup": "index__modalButtonGroup"
70
70
  };
71
+ var AUDIO_WEB_NAME = 'audio.webm';
72
+ exports.AUDIO_WEB_NAME = AUDIO_WEB_NAME;
71
73
 
72
74
  var AudioFile = /*#__PURE__*/function (_Component) {
73
75
  (0, _inherits2["default"])(AudioFile, _Component);
@@ -97,7 +99,9 @@ var AudioFile = /*#__PURE__*/function (_Component) {
97
99
  (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "stop", function () {
98
100
  return _this.recorder.stop().then(function (_ref) {
99
101
  var blob = _ref.blob;
100
- return _this.setState({
102
+ blob.name = AUDIO_WEB_NAME;
103
+
104
+ _this.setState({
101
105
  recording: false,
102
106
  audio: blob
103
107
  });
@@ -37,11 +37,11 @@ var _getusermedia = _interopRequireDefault(require("getusermedia"));
37
37
 
38
38
  var _withFieldWrapper = _interopRequireDefault(require("../hocs/withFieldWrapper"));
39
39
 
40
- var _ImageFile = _interopRequireDefault(require("./ImageFile"));
40
+ var _ImageFile = _interopRequireWildcard(require("./ImageFile"));
41
41
 
42
- var _VideoFile = _interopRequireDefault(require("./VideoFile"));
42
+ var _VideoFile = _interopRequireWildcard(require("./VideoFile"));
43
43
 
44
- var _AudioFile = _interopRequireDefault(require("./AudioFile"));
44
+ var _AudioFile = _interopRequireWildcard(require("./AudioFile"));
45
45
 
46
46
  var _Spinner = _interopRequireDefault(require("./Spinner"));
47
47
 
@@ -181,7 +181,7 @@ var File = /*#__PURE__*/function (_Component) {
181
181
  var fileExtenstion = (0, _ramda.last)("".concat(file.name).split('.'));
182
182
  var fileType = file.type || (0, _ramda.path)([type, fileExtenstion], _allowFileExtensions.defaultAllowFileExtensions);
183
183
  var validFileType = (0, _validation.checkFileType)(type, file.type, fileExtenstion, allowFileExtensions);
184
- fd.append('file', file);
184
+ fd.append('file', file, file.name);
185
185
  fd.append('name', file.name);
186
186
 
187
187
  if (validFileType) {
@@ -355,7 +355,7 @@ var File = /*#__PURE__*/function (_Component) {
355
355
  (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "renderPreview", function (url, index, type) {
356
356
  var name = _this.props.input.name;
357
357
  var fileName = (0, _ramda.path)(['fileNames', name, index], _this.state);
358
- var isBlob = fileName === 'blob';
358
+ var isBlob = fileName === 'blob' || fileName === _ImageFile.IMAGE_WEB_NAME || fileName === _VideoFile.VIDEO_WEB_NAME || fileName === _AudioFile.AUDIO_WEB_NAME;
359
359
 
360
360
  switch (type) {
361
361
  case FILE_TYPES.image:
@@ -472,7 +472,7 @@ var File = /*#__PURE__*/function (_Component) {
472
472
  open: this.state.visibleModal,
473
473
  onClose: this.closeModal,
474
474
  classNames: {
475
- modal: 'modal',
475
+ modal: 'modal file-modal',
476
476
  closeButton: 'modalCloseButton'
477
477
  }
478
478
  }, /*#__PURE__*/_react["default"].createElement(ModalContent, {
@@ -7,7 +7,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
7
7
  Object.defineProperty(exports, "__esModule", {
8
8
  value: true
9
9
  });
10
- exports["default"] = void 0;
10
+ exports["default"] = exports.IMAGE_WEB_NAME = void 0;
11
11
 
12
12
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
13
13
 
@@ -68,6 +68,8 @@ var styles = {
68
68
  "timeIndicator": "index__timeIndicator",
69
69
  "modalButtonGroup": "index__modalButtonGroup"
70
70
  };
71
+ var IMAGE_WEB_NAME = 'webcam.jpeg';
72
+ exports.IMAGE_WEB_NAME = IMAGE_WEB_NAME;
71
73
 
72
74
  var ImageFile = /*#__PURE__*/function (_Component) {
73
75
  (0, _inherits2["default"])(ImageFile, _Component);
@@ -98,7 +100,7 @@ var ImageFile = /*#__PURE__*/function (_Component) {
98
100
  });
99
101
  });
100
102
  (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "save", function () {
101
- _this.props.onChange((0, _file.dataURItoBlob)(_this.state.image, 'webcam.jpeg'));
103
+ _this.props.onChange((0, _file.dataURItoBlob)(_this.state.image, IMAGE_WEB_NAME));
102
104
  });
103
105
  return _this;
104
106
  }
@@ -7,7 +7,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
7
7
  Object.defineProperty(exports, "__esModule", {
8
8
  value: true
9
9
  });
10
- exports["default"] = void 0;
10
+ exports["default"] = exports.VIDEO_WEB_NAME = void 0;
11
11
 
12
12
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
13
13
 
@@ -68,6 +68,8 @@ var styles = {
68
68
  "timeIndicator": "index__timeIndicator",
69
69
  "modalButtonGroup": "index__modalButtonGroup"
70
70
  };
71
+ var VIDEO_WEB_NAME = 'video.webm';
72
+ exports.VIDEO_WEB_NAME = VIDEO_WEB_NAME;
71
73
  var videoConstraints = {
72
74
  width: 640,
73
75
  height: 480,
@@ -106,7 +108,9 @@ var VideoFile = /*#__PURE__*/function (_Component) {
106
108
 
107
109
  _this.recorder.ondataavailable = function (_ref) {
108
110
  var data = _ref.data;
109
- return _this.setState({
111
+ data.name = VIDEO_WEB_NAME;
112
+
113
+ _this.setState({
110
114
  data: data
111
115
  });
112
116
  };
@@ -459,6 +459,15 @@ body .rc-checkbox:hover .rc-checkbox-inner, body .rc-checkbox-input:focus + .rc-
459
459
  }
460
460
 
461
461
  /* Modal */
462
+ .file-modal image, .file-modal video {
463
+ width: 100%;
464
+ }
465
+ @media screen and (max-width: 700px) {
466
+ .file-modal {
467
+ width: 100%;
468
+ }
469
+ }
470
+
462
471
  .pda-modal {
463
472
  min-width: 50%;
464
473
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@experium/findy-form",
3
- "version": "1.3.12",
3
+ "version": "1.3.14",
4
4
  "main": "./lib/index.js",
5
5
  "homepage": "https://experium.github.io/findy-form",
6
6
  "repository": "https://github.com/experium/findy-form",
@@ -5,6 +5,8 @@ import { withTranslation } from 'react-i18next';
5
5
  import MediaLength from './MediaLength';
6
6
  import styles from '../../styles/index.module.css';
7
7
 
8
+ export const AUDIO_WEB_NAME = 'audio.webm';
9
+
8
10
  class AudioFile extends Component {
9
11
  constructor(props) {
10
12
  super(props);
@@ -30,7 +32,10 @@ class AudioFile extends Component {
30
32
 
31
33
  start = () => this.recorder.start().then(() => this.setState({ recording: true }));
32
34
 
33
- stop = () => this.recorder.stop().then(({ blob }) => this.setState({ recording: false, audio: blob }));
35
+ stop = () => this.recorder.stop().then(({ blob }) => {
36
+ blob.name = AUDIO_WEB_NAME;
37
+ this.setState({ recording: false, audio: blob });
38
+ });
34
39
 
35
40
  render() {
36
41
  const { available, t, disabled } = this.props;
@@ -5,9 +5,9 @@ import { withTranslation } from 'react-i18next';
5
5
  import getusermedia from 'getusermedia';
6
6
 
7
7
  import withFieldWrapper from '../hocs/withFieldWrapper';
8
- import ImageFile from './ImageFile';
9
- import VideoFile from './VideoFile';
10
- import AudioFile from './AudioFile';
8
+ import ImageFile, { IMAGE_WEB_NAME } from './ImageFile';
9
+ import VideoFile, { VIDEO_WEB_NAME } from './VideoFile';
10
+ import AudioFile, { AUDIO_WEB_NAME } from './AudioFile';
11
11
  import styles from '../../styles/index.module.css';
12
12
  import formStyles from '../../styles/index.module.css';
13
13
  import Spinner from './Spinner';
@@ -59,7 +59,7 @@ class File extends Component {
59
59
  const fileType = file.type || path([type, fileExtenstion], defaultAllowFileExtensions);
60
60
  const validFileType = checkFileType(type, file.type, fileExtenstion, allowFileExtensions);
61
61
 
62
- fd.append('file', file);
62
+ fd.append('file', file, file.name);
63
63
  fd.append('name', file.name);
64
64
 
65
65
  if (validFileType) {
@@ -209,7 +209,7 @@ class File extends Component {
209
209
  renderPreview = (url, index, type) => {
210
210
  const { input: { name } } = this.props;
211
211
  const fileName = path(['fileNames', name, index], this.state);
212
- const isBlob = fileName === 'blob';
212
+ const isBlob = fileName === 'blob' || fileName === IMAGE_WEB_NAME || fileName === VIDEO_WEB_NAME || fileName === AUDIO_WEB_NAME;
213
213
 
214
214
  switch (type) {
215
215
  case FILE_TYPES.image:
@@ -335,7 +335,7 @@ class File extends Component {
335
335
  open={this.state.visibleModal}
336
336
  onClose={this.closeModal}
337
337
  classNames={{
338
- modal: 'modal',
338
+ modal: 'modal file-modal',
339
339
  closeButton: 'modalCloseButton',
340
340
  }}
341
341
  >
@@ -5,6 +5,8 @@ import { withTranslation } from 'react-i18next';
5
5
  import styles from '../../styles/index.module.css';
6
6
  import { dataURItoBlob } from '../../utils/file';
7
7
 
8
+ export const IMAGE_WEB_NAME = 'webcam.jpeg';
9
+
8
10
  class ImageFile extends Component {
9
11
  state = {
10
12
  image: null
@@ -15,7 +17,7 @@ class ImageFile extends Component {
15
17
  cancel = () => this.setState({ image: null });
16
18
 
17
19
  save = () => {
18
- this.props.onChange(dataURItoBlob(this.state.image, 'webcam.jpeg'));
20
+ this.props.onChange(dataURItoBlob(this.state.image, IMAGE_WEB_NAME));
19
21
  }
20
22
 
21
23
  render() {
@@ -5,6 +5,8 @@ import { withTranslation } from 'react-i18next';
5
5
  import styles from '../../styles/index.module.css';
6
6
  import MediaLength from './MediaLength';
7
7
 
8
+ export const VIDEO_WEB_NAME = 'video.webm';
9
+
8
10
  const videoConstraints = {
9
11
  width: 640,
10
12
  height: 480,
@@ -25,7 +27,10 @@ class VideoFile extends Component {
25
27
 
26
28
  onUserMedia = () => {
27
29
  this.recorder = new MediaRecorder(this.webcam.stream);
28
- this.recorder.ondataavailable = ({ data }) => this.setState({ data });
30
+ this.recorder.ondataavailable = ({ data }) => {
31
+ data.name = VIDEO_WEB_NAME;
32
+ this.setState({ data });
33
+ };
29
34
  }
30
35
 
31
36
  start = () => {
@@ -128,6 +128,15 @@ body .rc-checkbox:hover .rc-checkbox-inner, body .rc-checkbox-input:focus + .rc-
128
128
  }
129
129
 
130
130
  /* Modal */
131
+ .file-modal image, .file-modal video {
132
+ width: 100%;
133
+ }
134
+ @media screen and (max-width: 700px) {
135
+ .file-modal {
136
+ width: 100%;
137
+ }
138
+ }
139
+
131
140
  .pda-modal {
132
141
  min-width: 50%;
133
142
  }