react-survey-builder 1.0.69 → 1.0.70

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.
@@ -5,7 +5,8 @@ var _excluded = ["name", "onChange", "value", "style", "item"],
5
5
  _excluded4 = ["name", "onChange", "value", "style", "item"],
6
6
  _excluded5 = ["name", "onChange", "value", "style", "item"],
7
7
  _excluded6 = ["name", "onChange", "value", "style", "item"],
8
- _excluded7 = ["name", "onChange", "value", "style", "item"];
8
+ _excluded7 = ["name", "onChange", "value", "style", "item"],
9
+ _excluded8 = ["name", "onChange", "value", "style", "item"];
9
10
  function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator["return"] && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, "catch": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
10
11
  function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
11
12
  function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
@@ -517,12 +518,12 @@ export var PhoneNumber = function PhoneNumber(_ref5) {
517
518
  var _item$required7, _item$disabled5, _item$required8;
518
519
  var name = _ref5.name,
519
520
  onChange = _ref5.onChange,
520
- value = _ref5.value,
521
+ _ref5$value = _ref5.value,
522
+ value = _ref5$value === void 0 ? '' : _ref5$value,
521
523
  style = _ref5.style,
522
524
  item = _ref5.item,
523
525
  props = _objectWithoutProperties(_ref5, _excluded3);
524
526
  var methods = useFormContext();
525
- var inputField = React.useRef(null);
526
527
  var onChangeHandler = function onChangeHandler(value) {
527
528
  if (onChange !== undefined) {
528
529
  onChange(value);
@@ -546,6 +547,12 @@ export var PhoneNumber = function PhoneNumber(_ref5) {
546
547
  return '';
547
548
  }
548
549
  };
550
+ var validatePhoneNumber = function validatePhoneNumber(value) {
551
+ if (value !== undefined && value !== null && value !== '') {
552
+ return isValidPhoneNumber(toE164PhoneNumber(value), 'US');
553
+ }
554
+ return true;
555
+ };
549
556
  var inputProps = {
550
557
  type: 'text',
551
558
  required: (_item$required7 = item === null || item === void 0 ? void 0 : item.required) !== null && _item$required7 !== void 0 ? _item$required7 : false,
@@ -560,22 +567,14 @@ export var PhoneNumber = function PhoneNumber(_ref5) {
560
567
  } else if (item !== null && item !== void 0 && item.label) {
561
568
  inputProps.placeholder = item === null || item === void 0 ? void 0 : item.label;
562
569
  }
563
- if (item !== null && item !== void 0 && item.mutable) {
564
- inputProps.ref = inputField;
565
- }
566
570
  var fieldRules = {
567
571
  validate: function validate(value) {
568
- return isValidPhoneNumber(toE164PhoneNumber(value), 'US') || "".concat(item === null || item === void 0 ? void 0 : item.label, " field requires a valid phone number");
572
+ return validatePhoneNumber(value) || "".concat(item === null || item === void 0 ? void 0 : item.label, " field requires a valid phone number");
569
573
  }
570
574
  };
571
575
  if ((_item$required8 = item === null || item === void 0 ? void 0 : item.required) !== null && _item$required8 !== void 0 ? _item$required8 : false) {
572
576
  fieldRules.required = 'Required Field';
573
577
  }
574
-
575
- // if (CustomPhoneInput !== undefined) {
576
- // inputProps.as = CustomPhoneInput;
577
- // }
578
-
579
578
  var controllerProps = {
580
579
  name: name,
581
580
  rules: fieldRules
@@ -684,7 +683,6 @@ export var PhoneNumber = function PhoneNumber(_ref5) {
684
683
  }, labelLocation === "FLOATING" ? /*#__PURE__*/React.createElement(Form.Floating, null, /*#__PURE__*/React.createElement(Form.Control, _extends({
685
684
  value: value,
686
685
  name: name,
687
- ref: inputField,
688
686
  id: name + '-' + ID.uuid()
689
687
  }, inputProps)), /*#__PURE__*/React.createElement(ComponentLabel, {
690
688
  item: item,
@@ -697,7 +695,6 @@ export var PhoneNumber = function PhoneNumber(_ref5) {
697
695
  }), /*#__PURE__*/React.createElement(Form.Control, _extends({
698
696
  value: value,
699
697
  name: name,
700
- ref: inputField,
701
698
  id: name + '-' + ID.uuid()
702
699
  }, inputProps))), item !== null && item !== void 0 && item.help ? /*#__PURE__*/React.createElement(Form.Text, {
703
700
  muted: true
@@ -751,7 +748,6 @@ export var DatePicker = function DatePicker(_ref8) {
751
748
  item = _ref8.item,
752
749
  props = _objectWithoutProperties(_ref8, _excluded4);
753
750
  var methods = useFormContext();
754
- var inputField = React.useRef(null);
755
751
  var onChangeHandler = function onChangeHandler(value) {
756
752
  if (onChange !== undefined) {
757
753
  onChange(value);
@@ -819,9 +815,6 @@ export var DatePicker = function DatePicker(_ref8) {
819
815
  } else if (item !== null && item !== void 0 && item.label) {
820
816
  inputProps.placeholder = item === null || item === void 0 ? void 0 : item.label;
821
817
  }
822
- if (item !== null && item !== void 0 && item.mutable) {
823
- inputProps.ref = inputField;
824
- }
825
818
  var fieldRules = {
826
819
  validate: function validate(value) {
827
820
  return validateDate(value) || 'Please enter a valid Date in the format MM/DD/YYYY';
@@ -963,7 +956,9 @@ export var DatePicker = function DatePicker(_ref8) {
963
956
  if (item !== null && item !== void 0 && item.pageBreakBefore) {
964
957
  baseClasses += ' alwaysbreak';
965
958
  }
966
- console.log('controllerProps', controllerProps);
959
+
960
+ // console.log('controllerProps', controllerProps);
961
+
967
962
  if (!methods) {
968
963
  return /*#__PURE__*/React.createElement("div", {
969
964
  style: _objectSpread({}, style),
@@ -975,7 +970,6 @@ export var DatePicker = function DatePicker(_ref8) {
975
970
  }, labelLocation === "FLOATING" ? /*#__PURE__*/React.createElement(Form.Floating, null, /*#__PURE__*/React.createElement(Form.Control, _extends({
976
971
  value: value,
977
972
  name: name,
978
- ref: inputField,
979
973
  id: name + '-' + ID.uuid()
980
974
  }, inputProps)), /*#__PURE__*/React.createElement(ComponentLabel, {
981
975
  item: item,
@@ -988,7 +982,6 @@ export var DatePicker = function DatePicker(_ref8) {
988
982
  }), /*#__PURE__*/React.createElement(Form.Control, _extends({
989
983
  value: value,
990
984
  name: name,
991
- ref: inputField,
992
985
  id: name + '-' + ID.uuid()
993
986
  }, inputProps))), item !== null && item !== void 0 && item.help ? /*#__PURE__*/React.createElement(Form.Text, {
994
987
  muted: true
@@ -1042,7 +1035,6 @@ export var NumberInput = function NumberInput(_ref11) {
1042
1035
  item = _ref11.item,
1043
1036
  props = _objectWithoutProperties(_ref11, _excluded5);
1044
1037
  var methods = useFormContext();
1045
- var inputField = React.useRef(null);
1046
1038
  var onChangeHandler = function onChangeHandler(value) {
1047
1039
  if (onChange !== undefined) {
1048
1040
  onChange(value);
@@ -1062,9 +1054,6 @@ export var NumberInput = function NumberInput(_ref11) {
1062
1054
  } else if (item !== null && item !== void 0 && item.label) {
1063
1055
  inputProps.placeholder = item === null || item === void 0 ? void 0 : item.label;
1064
1056
  }
1065
- if (item !== null && item !== void 0 && item.mutable) {
1066
- inputProps.ref = inputField;
1067
- }
1068
1057
  var fieldRules = {};
1069
1058
  if ((_item$required14 = item === null || item === void 0 ? void 0 : item.required) !== null && _item$required14 !== void 0 ? _item$required14 : false) {
1070
1059
  fieldRules.required = 'Required Field';
@@ -1129,7 +1118,6 @@ export var NumberInput = function NumberInput(_ref11) {
1129
1118
  }, labelLocation === "FLOATING" ? /*#__PURE__*/React.createElement(Form.Floating, null, /*#__PURE__*/React.createElement(Form.Control, _extends({
1130
1119
  value: value,
1131
1120
  name: name,
1132
- ref: inputField,
1133
1121
  id: name + '-2-' + ID.uuid()
1134
1122
  }, inputProps)), /*#__PURE__*/React.createElement(ComponentLabel, {
1135
1123
  item: item,
@@ -1142,7 +1130,6 @@ export var NumberInput = function NumberInput(_ref11) {
1142
1130
  }), /*#__PURE__*/React.createElement(Form.Control, _extends({
1143
1131
  value: value,
1144
1132
  name: name,
1145
- ref: inputField,
1146
1133
  id: name + '-2-' + ID.uuid()
1147
1134
  }, inputProps))), item !== null && item !== void 0 && item.help ? /*#__PURE__*/React.createElement(Form.Text, {
1148
1135
  muted: true
@@ -1196,7 +1183,6 @@ export var TextArea = function TextArea(_ref13) {
1196
1183
  item = _ref13.item,
1197
1184
  props = _objectWithoutProperties(_ref13, _excluded6);
1198
1185
  var methods = useFormContext();
1199
- var inputField = React.useRef(null);
1200
1186
  var onChangeHandler = function onChangeHandler(value) {
1201
1187
  if (onChange !== undefined) {
1202
1188
  onChange(value);
@@ -1216,9 +1202,6 @@ export var TextArea = function TextArea(_ref13) {
1216
1202
  } else if (item !== null && item !== void 0 && item.label) {
1217
1203
  inputProps.placeholder = item === null || item === void 0 ? void 0 : item.label;
1218
1204
  }
1219
- if (item !== null && item !== void 0 && item.mutable) {
1220
- inputProps.ref = inputField;
1221
- }
1222
1205
  var fieldRules = {};
1223
1206
  if ((_item$required17 = item === null || item === void 0 ? void 0 : item.required) !== null && _item$required17 !== void 0 ? _item$required17 : false) {
1224
1207
  fieldRules.required = 'Required Field';
@@ -1284,7 +1267,6 @@ export var TextArea = function TextArea(_ref13) {
1284
1267
  }, labelLocation === "FLOATING" ? /*#__PURE__*/React.createElement(Form.Floating, null, /*#__PURE__*/React.createElement(Form.Control, _extends({
1285
1268
  value: value,
1286
1269
  name: name,
1287
- ref: inputField,
1288
1270
  id: name + '-2-' + ID.uuid(),
1289
1271
  as: "textarea"
1290
1272
  }, inputProps)), /*#__PURE__*/React.createElement(ComponentLabel, {
@@ -1298,7 +1280,6 @@ export var TextArea = function TextArea(_ref13) {
1298
1280
  }), /*#__PURE__*/React.createElement(Form.Control, _extends({
1299
1281
  value: value,
1300
1282
  name: name,
1301
- ref: inputField,
1302
1283
  id: name + '-2-' + ID.uuid(),
1303
1284
  as: "textarea"
1304
1285
  }, inputProps))), item !== null && item !== void 0 && item.help ? /*#__PURE__*/React.createElement(Form.Text, {
@@ -1353,7 +1334,6 @@ export var Dropdown = function Dropdown(_ref15) {
1353
1334
  item = _ref15.item,
1354
1335
  props = _objectWithoutProperties(_ref15, _excluded7);
1355
1336
  var methods = useFormContext();
1356
- var inputField = React.useRef(null);
1357
1337
  var onChangeHandler = function onChangeHandler(value) {
1358
1338
  if (onChange !== undefined) {
1359
1339
  onChange(value);
@@ -1373,9 +1353,6 @@ export var Dropdown = function Dropdown(_ref15) {
1373
1353
  } else if (item !== null && item !== void 0 && item.label) {
1374
1354
  inputProps.placeholder = item === null || item === void 0 ? void 0 : item.label;
1375
1355
  }
1376
- if (item !== null && item !== void 0 && item.mutable) {
1377
- inputProps.ref = inputField;
1378
- }
1379
1356
  var fieldRules = {};
1380
1357
  if ((_item$required20 = item === null || item === void 0 ? void 0 : item.required) !== null && _item$required20 !== void 0 ? _item$required20 : false) {
1381
1358
  fieldRules.required = 'Required Field';
@@ -1448,8 +1425,7 @@ export var Dropdown = function Dropdown(_ref15) {
1448
1425
  }, labelLocation === "FLOATING" ? /*#__PURE__*/React.createElement(Form.Floating, null, /*#__PURE__*/React.createElement(Form.Select, _extends({
1449
1426
  id: name + '-' + ID.uuid(),
1450
1427
  value: value,
1451
- name: name,
1452
- ref: inputField
1428
+ name: name
1453
1429
  }, inputProps), inputProps.placeholder ? /*#__PURE__*/React.createElement("option", {
1454
1430
  value: ""
1455
1431
  }, inputProps.placeholder) : null, item === null || item === void 0 ? void 0 : item.options.map(function (option) {
@@ -1469,8 +1445,7 @@ export var Dropdown = function Dropdown(_ref15) {
1469
1445
  }), /*#__PURE__*/React.createElement(Form.Select, _extends({
1470
1446
  id: name + '-' + ID.uuid(),
1471
1447
  value: value,
1472
- name: name,
1473
- ref: inputField
1448
+ name: name
1474
1449
  }, inputProps), inputProps.placeholder ? /*#__PURE__*/React.createElement("option", {
1475
1450
  value: ""
1476
1451
  }, inputProps.placeholder) : null, item === null || item === void 0 ? void 0 : item.options.map(function (option) {
@@ -1712,134 +1687,223 @@ export var Signature = /*#__PURE__*/function (_React$Component6) {
1712
1687
  }
1713
1688
  }]);
1714
1689
  }(React.Component);
1715
- export var Tags = /*#__PURE__*/function (_React$Component7) {
1716
- function Tags(props) {
1717
- var _this3;
1718
- _classCallCheck(this, Tags);
1719
- _this3 = _callSuper(this, Tags, [props]);
1720
- _this3.inputField = /*#__PURE__*/React.createRef();
1721
- return _this3;
1722
- }
1723
- _inherits(Tags, _React$Component7);
1724
- return _createClass(Tags, [{
1725
- key: "getDefaultValue",
1726
- value: function getDefaultValue(val, options) {
1727
- if (val) {
1728
- return options.filter(function (option) {
1729
- return val.indexOf(option.value) > -1;
1730
- });
1731
- }
1732
- return [];
1690
+ export var Tags = function Tags(_ref18) {
1691
+ var _item$required22, _item$disabled15, _item$required23;
1692
+ var name = _ref18.name,
1693
+ onChange = _ref18.onChange,
1694
+ value = _ref18.value,
1695
+ style = _ref18.style,
1696
+ item = _ref18.item,
1697
+ props = _objectWithoutProperties(_ref18, _excluded8);
1698
+ var methods = useFormContext();
1699
+ var onChangeHandler = function onChangeHandler(value) {
1700
+ if (onChange !== undefined) {
1701
+ onChange(value);
1733
1702
  }
1734
- }, {
1735
- key: "render",
1736
- value: function render() {
1737
- var _this4 = this;
1738
- var options = this.props.item.options.map(function (option) {
1739
- return {
1740
- value: option.value,
1741
- label: option.text,
1742
- key: option.value
1743
- };
1703
+ };
1704
+ var getDefaultValue = function getDefaultValue(val, options) {
1705
+ if (val) {
1706
+ return options.filter(function (option) {
1707
+ return val.indexOf(option.value) > -1;
1744
1708
  });
1745
- var props = {};
1746
- props.name = this.props.name;
1747
- props.placeholder = this.props.item.placeholder || 'Select...';
1748
- props.onChange = function (val) {
1749
- _this4.props.onChange(val !== undefined && val !== null && val.length > 0 ? val.map(function (i) {
1750
- return i.value;
1751
- }) : []);
1752
- };
1753
- props.isInvalid = this.props.isInvalid;
1754
- if (this.props.onBlur) {
1755
- props.onBlur = this.props.onBlur;
1756
- }
1757
- props.autoComplete = "new-password";
1758
- if (this.props.item.disabled) {
1759
- props.disabled = 'disabled';
1760
- }
1761
- if (this.props.item.mutable) {
1762
- props.ref = this.inputField;
1763
- }
1764
- props.multiple = true;
1765
- props.selected = this.getDefaultValue(this.props.value, options);
1766
- props.options = options;
1767
- // props.required = this.props.item.required;
1768
-
1769
- var baseClasses = 'SortableItem rfb-item';
1770
- if (this.props.item.pageBreakBefore) {
1771
- baseClasses += ' alwaysbreak';
1772
- }
1773
- var labelLocation = 'ABOVE';
1774
- if (this.props.item.labelLocation) {
1775
- labelLocation = this.props.item.labelLocation;
1776
- }
1777
- if (this.props.item.print === true) {
1778
- return /*#__PURE__*/React.createElement("div", {
1779
- style: _objectSpread({}, this.props.style),
1780
- className: baseClasses
1781
- }, /*#__PURE__*/React.createElement(Form.Group, {
1782
- className: "form-group mb-3"
1783
- }, /*#__PURE__*/React.createElement(ComponentLabel, _extends({}, this.props, {
1784
- htmlFor: props.name
1785
- })), /*#__PURE__*/React.createElement("div", null, this.props.item.options.filter(function (option) {
1786
- return _this4.props.value.includes(option.value);
1787
- }).map(function (option) {
1788
- return option.text;
1789
- }).join(', '))));
1790
- }
1791
- return /*#__PURE__*/React.createElement("div", {
1792
- style: _objectSpread({}, this.props.style),
1793
- className: baseClasses
1794
- }, /*#__PURE__*/React.createElement(ComponentHeader, this.props), /*#__PURE__*/React.createElement(Form.Group, {
1795
- className: "form-group mb-3"
1796
- }, labelLocation === "FLOATING" ? /*#__PURE__*/React.createElement(Form.Floating, null, /*#__PURE__*/React.createElement(Typeahead, _extends({
1797
- labelKey: function labelKey(option) {
1798
- return option.label;
1799
- },
1800
- id: props.name + '-' + ID.uuid()
1801
- }, props)), /*#__PURE__*/React.createElement(ComponentLabel, _extends({}, this.props, {
1802
- htmlFor: props.name
1803
- }))) : /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(ComponentLabel, _extends({}, this.props, {
1804
- htmlFor: props.name
1805
- })), /*#__PURE__*/React.createElement(Typeahead, _extends({
1806
- labelKey: function labelKey(option) {
1807
- return option.label;
1808
- },
1809
- id: props.name + '-' + ID.uuid()
1810
- }, props))), this.props.item.help ? /*#__PURE__*/React.createElement(Form.Text, {
1811
- muted: true
1812
- }, this.props.item.help) : null, /*#__PURE__*/React.createElement(ComponentErrorMessage, {
1813
- name: props.name
1814
- })));
1815
1709
  }
1816
- }]);
1817
- }(React.Component);
1818
- export var Checkboxes = /*#__PURE__*/function (_React$Component8) {
1710
+ return [];
1711
+ };
1712
+ var options = item === null || item === void 0 ? void 0 : item.options.map(function (option) {
1713
+ return {
1714
+ value: option.value,
1715
+ label: option.text,
1716
+ key: option.value
1717
+ };
1718
+ });
1719
+ var inputProps = {
1720
+ multiple: true,
1721
+ required: (_item$required22 = item === null || item === void 0 ? void 0 : item.required) !== null && _item$required22 !== void 0 ? _item$required22 : false,
1722
+ disabled: (_item$disabled15 = item === null || item === void 0 ? void 0 : item.disabled) !== null && _item$disabled15 !== void 0 ? _item$disabled15 : false,
1723
+ autoComplete: 'new-password' // hack to prevent auto-complete for form fields
1724
+ };
1725
+ if (item !== null && item !== void 0 && item.label) {
1726
+ inputProps.label = item === null || item === void 0 ? void 0 : item.label;
1727
+ }
1728
+ if (item !== null && item !== void 0 && item.placeholder) {
1729
+ inputProps.placeholder = item === null || item === void 0 ? void 0 : item.placeholder;
1730
+ } else if (item !== null && item !== void 0 && item.label) {
1731
+ inputProps.placeholder = item === null || item === void 0 ? void 0 : item.label;
1732
+ } else {
1733
+ inputProps.placeholder = 'Select...';
1734
+ }
1735
+ var fieldRules = {};
1736
+ if ((_item$required23 = item === null || item === void 0 ? void 0 : item.required) !== null && _item$required23 !== void 0 ? _item$required23 : false) {
1737
+ fieldRules.required = 'Required Field';
1738
+ }
1739
+ var controllerProps = {
1740
+ name: name,
1741
+ rules: fieldRules
1742
+ };
1743
+ controllerProps.render = function (_ref19) {
1744
+ var _ref19$field = _ref19.field,
1745
+ _onChange8 = _ref19$field.onChange,
1746
+ onBlur = _ref19$field.onBlur,
1747
+ value = _ref19$field.value,
1748
+ name = _ref19$field.name,
1749
+ ref = _ref19$field.ref,
1750
+ _ref19$fieldState = _ref19.fieldState,
1751
+ invalid = _ref19$fieldState.invalid,
1752
+ isTouched = _ref19$fieldState.isTouched,
1753
+ isDirty = _ref19$fieldState.isDirty,
1754
+ error = _ref19$fieldState.error,
1755
+ formState = _ref19.formState;
1756
+ return /*#__PURE__*/React.createElement(Typeahead, _extends({
1757
+ labelKey: function labelKey(option) {
1758
+ return option.label;
1759
+ },
1760
+ onBlur: onBlur,
1761
+ onChange: function onChange(selected) {
1762
+ // console.log(selected);
1763
+ if (selected.length >= 1) {
1764
+ //console.log(selected[0]);
1765
+ _onChange8(selected.map(function (i) {
1766
+ return i.value;
1767
+ }));
1768
+ onChangeHandler(selected.map(function (i) {
1769
+ return i.value;
1770
+ }));
1771
+ } else if (selected.length === 0) {
1772
+ _onChange8([]);
1773
+ onChangeHandler([]);
1774
+ }
1775
+ },
1776
+ options: options,
1777
+ selected: getDefaultValue(value, options),
1778
+ name: name,
1779
+ ref: ref,
1780
+ isInvalid: invalid,
1781
+ id: name + '-' + ID.uuid()
1782
+ }, inputProps));
1783
+ };
1784
+ if (value !== undefined) {
1785
+ controllerProps.defaultValue = value;
1786
+ }
1787
+ if ((item === null || item === void 0 ? void 0 : item.disabled) !== undefined) {
1788
+ var _item$disabled16;
1789
+ controllerProps.disabled = (_item$disabled16 = item === null || item === void 0 ? void 0 : item.disabled) !== null && _item$disabled16 !== void 0 ? _item$disabled16 : false;
1790
+ }
1791
+ if ((item === null || item === void 0 ? void 0 : item.required) !== undefined) {
1792
+ var _item$required24;
1793
+ controllerProps.required = (_item$required24 = item === null || item === void 0 ? void 0 : item.required) !== null && _item$required24 !== void 0 ? _item$required24 : false;
1794
+ }
1795
+ var labelLocation = 'ABOVE';
1796
+ if (item !== null && item !== void 0 && item.labelLocation) {
1797
+ labelLocation = item === null || item === void 0 ? void 0 : item.labelLocation;
1798
+ }
1799
+ var baseClasses = 'SortableItem rfb-item';
1800
+ if (item !== null && item !== void 0 && item.pageBreakBefore) {
1801
+ baseClasses += ' alwaysbreak';
1802
+ }
1803
+ if (!methods) {
1804
+ return /*#__PURE__*/React.createElement("div", {
1805
+ style: _objectSpread({}, style),
1806
+ className: baseClasses
1807
+ }, /*#__PURE__*/React.createElement(ComponentHeader, _extends({
1808
+ item: item
1809
+ }, props)), /*#__PURE__*/React.createElement(Form.Group, {
1810
+ className: "form-group mb-3"
1811
+ }, labelLocation === "FLOATING" ? /*#__PURE__*/React.createElement(Form.Floating, null, /*#__PURE__*/React.createElement(Typeahead, _extends({
1812
+ labelKey: function labelKey(option) {
1813
+ return option.label;
1814
+ },
1815
+ options: options,
1816
+ selected: getDefaultValue(value, options),
1817
+ name: name,
1818
+ id: name + '-' + ID.uuid()
1819
+ }, inputProps)), /*#__PURE__*/React.createElement(ComponentLabel, {
1820
+ item: item,
1821
+ className: item === null || item === void 0 ? void 0 : item.labelClassName,
1822
+ htmlFor: name
1823
+ })) : /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(ComponentLabel, {
1824
+ item: item,
1825
+ className: item === null || item === void 0 ? void 0 : item.labelClassName,
1826
+ htmlFor: name
1827
+ }), /*#__PURE__*/React.createElement(Typeahead, _extends({
1828
+ labelKey: function labelKey(option) {
1829
+ return option.label;
1830
+ },
1831
+ options: options,
1832
+ selected: getDefaultValue(value, options),
1833
+ name: name,
1834
+ id: name + '-' + ID.uuid()
1835
+ }, inputProps))), item !== null && item !== void 0 && item.help ? /*#__PURE__*/React.createElement(Form.Text, {
1836
+ muted: true
1837
+ }, item === null || item === void 0 ? void 0 : item.help) : null, /*#__PURE__*/React.createElement(ComponentErrorMessage, {
1838
+ name: name
1839
+ })));
1840
+ }
1841
+ if ((item === null || item === void 0 ? void 0 : item.print) === true) {
1842
+ return /*#__PURE__*/React.createElement("div", {
1843
+ style: _objectSpread({}, style),
1844
+ className: baseClasses
1845
+ }, /*#__PURE__*/React.createElement(Form.Group, {
1846
+ className: "form-group mb-3"
1847
+ }, /*#__PURE__*/React.createElement(ComponentLabel, {
1848
+ item: item,
1849
+ className: item === null || item === void 0 ? void 0 : item.labelClassName,
1850
+ htmlFor: name
1851
+ }), /*#__PURE__*/React.createElement("div", null, item === null || item === void 0 ? void 0 : item.options.filter(function (option) {
1852
+ return value === null || value === void 0 ? void 0 : value.includes(option.value);
1853
+ }).map(function (option) {
1854
+ return option.text;
1855
+ }).join(', '))));
1856
+ }
1857
+ return /*#__PURE__*/React.createElement("div", {
1858
+ style: _objectSpread({}, style),
1859
+ className: baseClasses
1860
+ }, /*#__PURE__*/React.createElement(ComponentHeader, _extends({
1861
+ item: item
1862
+ }, props)), /*#__PURE__*/React.createElement(Form.Group, {
1863
+ className: "form-group mb-3"
1864
+ }, labelLocation === "FLOATING" ? /*#__PURE__*/React.createElement(Form.Floating, null, /*#__PURE__*/React.createElement(Controller, _extends({
1865
+ control: methods.control
1866
+ }, controllerProps)), /*#__PURE__*/React.createElement(ComponentLabel, {
1867
+ item: item,
1868
+ className: item === null || item === void 0 ? void 0 : item.labelClassName,
1869
+ htmlFor: name
1870
+ })) : /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(ComponentLabel, {
1871
+ item: item,
1872
+ className: item === null || item === void 0 ? void 0 : item.labelClassName,
1873
+ htmlFor: name
1874
+ }), /*#__PURE__*/React.createElement(Controller, _extends({
1875
+ control: methods.control
1876
+ }, controllerProps))), item !== null && item !== void 0 && item.help ? /*#__PURE__*/React.createElement(Form.Text, {
1877
+ muted: true
1878
+ }, item === null || item === void 0 ? void 0 : item.help) : null, /*#__PURE__*/React.createElement(ComponentErrorMessage, {
1879
+ name: name
1880
+ })));
1881
+ };
1882
+ export var Checkboxes = /*#__PURE__*/function (_React$Component7) {
1819
1883
  function Checkboxes(props) {
1820
- var _this5;
1884
+ var _this3;
1821
1885
  _classCallCheck(this, Checkboxes);
1822
- _this5 = _callSuper(this, Checkboxes, [props]);
1823
- _defineProperty(_this5, "onCheckboxChange", function (checkboxValue, event) {
1824
- var checkedValues = _this5.props.value;
1825
- if (_this5.props.onChange) {
1886
+ _this3 = _callSuper(this, Checkboxes, [props]);
1887
+ _defineProperty(_this3, "onCheckboxChange", function (checkboxValue, event) {
1888
+ var checkedValues = _this3.props.value;
1889
+ if (_this3.props.onChange) {
1826
1890
  if (event.target.checked) {
1827
- _this5.props.onChange(checkedValues.concat(checkboxValue));
1891
+ _this3.props.onChange(checkedValues.concat(checkboxValue));
1828
1892
  } else {
1829
- _this5.props.onChange(checkedValues.filter(function (v) {
1893
+ _this3.props.onChange(checkedValues.filter(function (v) {
1830
1894
  return v !== checkboxValue;
1831
1895
  }));
1832
1896
  }
1833
1897
  }
1834
1898
  });
1835
- _this5.options = {};
1836
- return _this5;
1899
+ _this3.options = {};
1900
+ return _this3;
1837
1901
  }
1838
- _inherits(Checkboxes, _React$Component8);
1902
+ _inherits(Checkboxes, _React$Component7);
1839
1903
  return _createClass(Checkboxes, [{
1840
1904
  key: "render",
1841
1905
  value: function render() {
1842
- var _this6 = this;
1906
+ var _this4 = this;
1843
1907
  var self = this;
1844
1908
  var baseClasses = 'SortableItem rfb-item';
1845
1909
  if (this.props.item.pageBreakBefore) {
@@ -1854,7 +1918,7 @@ export var Checkboxes = /*#__PURE__*/function (_React$Component8) {
1854
1918
  }, /*#__PURE__*/React.createElement(ComponentLabel, _extends({}, this.props, {
1855
1919
  htmlFor: this.props.name
1856
1920
  })), /*#__PURE__*/React.createElement("div", null, this.props.item.options.filter(function (option) {
1857
- return _this6.props.value.includes(option.value);
1921
+ return _this4.props.value.includes(option.value);
1858
1922
  }).map(function (option) {
1859
1923
  return option.text;
1860
1924
  }).join(', '))));
@@ -1867,7 +1931,7 @@ export var Checkboxes = /*#__PURE__*/function (_React$Component8) {
1867
1931
  }, /*#__PURE__*/React.createElement(ComponentLabel, _extends({}, this.props, {
1868
1932
  htmlFor: this.props.name
1869
1933
  })), this.props.item.options.map(function (option) {
1870
- var _this6$props$checkbox;
1934
+ var _this4$props$checkbox;
1871
1935
  var props = {};
1872
1936
  props.name = "option_".concat(option.key);
1873
1937
  props.value = option.value;
@@ -1878,7 +1942,7 @@ export var Checkboxes = /*#__PURE__*/function (_React$Component8) {
1878
1942
  }
1879
1943
  return /*#__PURE__*/React.createElement(ToggleButton, _extends({
1880
1944
  type: "checkbox",
1881
- variant: (_this6$props$checkbox = _this6.props.checkboxButtonClassName) !== null && _this6$props$checkbox !== void 0 ? _this6$props$checkbox : "outline-light",
1945
+ variant: (_this4$props$checkbox = _this4.props.checkboxButtonClassName) !== null && _this4$props$checkbox !== void 0 ? _this4$props$checkbox : "outline-light",
1882
1946
  className: "btn-survey-builder-checkbox",
1883
1947
  key: "preview_".concat(option.key),
1884
1948
  id: self.props.name + '-' + ID.uuid(),
@@ -1909,19 +1973,19 @@ export var Checkboxes = /*#__PURE__*/function (_React$Component8) {
1909
1973
  }
1910
1974
  }]);
1911
1975
  }(React.Component);
1912
- export var Checkbox = /*#__PURE__*/function (_React$Component9) {
1976
+ export var Checkbox = /*#__PURE__*/function (_React$Component8) {
1913
1977
  function Checkbox(props) {
1914
- var _this7;
1978
+ var _this5;
1915
1979
  _classCallCheck(this, Checkbox);
1916
- _this7 = _callSuper(this, Checkbox, [props]);
1917
- _this7.inputField = /*#__PURE__*/React.createRef();
1918
- return _this7;
1980
+ _this5 = _callSuper(this, Checkbox, [props]);
1981
+ _this5.inputField = /*#__PURE__*/React.createRef();
1982
+ return _this5;
1919
1983
  }
1920
- _inherits(Checkbox, _React$Component9);
1984
+ _inherits(Checkbox, _React$Component8);
1921
1985
  return _createClass(Checkbox, [{
1922
1986
  key: "render",
1923
1987
  value: function render() {
1924
- var _this8 = this,
1988
+ var _this6 = this,
1925
1989
  _this$props$checkboxB;
1926
1990
  var baseClasses = 'SortableItem rfb-item';
1927
1991
  if (this.props.item.pageBreakBefore) {
@@ -1931,8 +1995,8 @@ export var Checkbox = /*#__PURE__*/function (_React$Component9) {
1931
1995
  // eslint-disable-next-line no-undef
1932
1996
  props.name = this.props.name;
1933
1997
  props.onChange = function (event) {
1934
- if (_this8.props.onChange) {
1935
- _this8.props.onChange(event.target.checked);
1998
+ if (_this6.props.onChange) {
1999
+ _this6.props.onChange(event.target.checked);
1936
2000
  }
1937
2001
  };
1938
2002
  //props.isInvalid = this.props.isInvalid;
@@ -1998,19 +2062,19 @@ export var Checkbox = /*#__PURE__*/function (_React$Component9) {
1998
2062
  }
1999
2063
  }]);
2000
2064
  }(React.Component);
2001
- export var RadioButtons = /*#__PURE__*/function (_React$Component10) {
2065
+ export var RadioButtons = /*#__PURE__*/function (_React$Component9) {
2002
2066
  function RadioButtons(props) {
2003
- var _this9;
2067
+ var _this7;
2004
2068
  _classCallCheck(this, RadioButtons);
2005
- _this9 = _callSuper(this, RadioButtons, [props]);
2006
- _this9.options = {};
2007
- return _this9;
2069
+ _this7 = _callSuper(this, RadioButtons, [props]);
2070
+ _this7.options = {};
2071
+ return _this7;
2008
2072
  }
2009
- _inherits(RadioButtons, _React$Component10);
2073
+ _inherits(RadioButtons, _React$Component9);
2010
2074
  return _createClass(RadioButtons, [{
2011
2075
  key: "render",
2012
2076
  value: function render() {
2013
- var _this10 = this;
2077
+ var _this8 = this;
2014
2078
  var self = this;
2015
2079
  var baseClasses = 'SortableItem rfb-item';
2016
2080
  if (this.props.item.pageBreakBefore) {
@@ -2025,7 +2089,7 @@ export var RadioButtons = /*#__PURE__*/function (_React$Component10) {
2025
2089
  }, /*#__PURE__*/React.createElement(ComponentLabel, _extends({}, this.props, {
2026
2090
  htmlFor: this.props.name
2027
2091
  })), /*#__PURE__*/React.createElement("div", null, this.props.item.options.filter(function (option) {
2028
- return _this10.props.value === option.value;
2092
+ return _this8.props.value === option.value;
2029
2093
  }).map(function (option) {
2030
2094
  return option.text;
2031
2095
  }).join(', '))));
@@ -2085,12 +2149,12 @@ export var RadioButtons = /*#__PURE__*/function (_React$Component10) {
2085
2149
  }
2086
2150
  }]);
2087
2151
  }(React.Component);
2088
- export var Image = /*#__PURE__*/function (_React$Component11) {
2152
+ export var Image = /*#__PURE__*/function (_React$Component10) {
2089
2153
  function Image() {
2090
2154
  _classCallCheck(this, Image);
2091
2155
  return _callSuper(this, Image, arguments);
2092
2156
  }
2093
- _inherits(Image, _React$Component11);
2157
+ _inherits(Image, _React$Component10);
2094
2158
  return _createClass(Image, [{
2095
2159
  key: "render",
2096
2160
  value: function render() {
@@ -2114,19 +2178,19 @@ export var Image = /*#__PURE__*/function (_React$Component11) {
2114
2178
  }
2115
2179
  }]);
2116
2180
  }(React.Component);
2117
- export var Rating = /*#__PURE__*/function (_React$Component12) {
2181
+ export var Rating = /*#__PURE__*/function (_React$Component11) {
2118
2182
  function Rating(props) {
2119
- var _this11;
2183
+ var _this9;
2120
2184
  _classCallCheck(this, Rating);
2121
- _this11 = _callSuper(this, Rating, [props]);
2122
- _this11.inputField = /*#__PURE__*/React.createRef();
2123
- return _this11;
2185
+ _this9 = _callSuper(this, Rating, [props]);
2186
+ _this9.inputField = /*#__PURE__*/React.createRef();
2187
+ return _this9;
2124
2188
  }
2125
- _inherits(Rating, _React$Component12);
2189
+ _inherits(Rating, _React$Component11);
2126
2190
  return _createClass(Rating, [{
2127
2191
  key: "render",
2128
2192
  value: function render() {
2129
- var _this12 = this;
2193
+ var _this10 = this;
2130
2194
  var props = {};
2131
2195
  props.name = this.props.name;
2132
2196
  props.ratingAmount = 5;
@@ -2135,9 +2199,9 @@ export var Rating = /*#__PURE__*/function (_React$Component12) {
2135
2199
  if (this.props.item.disabled) {
2136
2200
  props.disabled = true;
2137
2201
  }
2138
- props.onRatingClick = function (event, _ref18) {
2139
- var rating = _ref18.rating;
2140
- _this12.props.onChange(rating);
2202
+ props.onRatingClick = function (event, _ref20) {
2203
+ var rating = _ref20.rating;
2204
+ _this10.props.onChange(rating);
2141
2205
  };
2142
2206
  if (this.props.item.mutable) {
2143
2207
  props.editing = true;
@@ -2172,12 +2236,12 @@ export var Rating = /*#__PURE__*/function (_React$Component12) {
2172
2236
  }
2173
2237
  }]);
2174
2238
  }(React.Component);
2175
- export var HyperLink = /*#__PURE__*/function (_React$Component13) {
2239
+ export var HyperLink = /*#__PURE__*/function (_React$Component12) {
2176
2240
  function HyperLink() {
2177
2241
  _classCallCheck(this, HyperLink);
2178
2242
  return _callSuper(this, HyperLink, arguments);
2179
2243
  }
2180
- _inherits(HyperLink, _React$Component13);
2244
+ _inherits(HyperLink, _React$Component12);
2181
2245
  return _createClass(HyperLink, [{
2182
2246
  key: "render",
2183
2247
  value: function render() {
@@ -2200,12 +2264,12 @@ export var HyperLink = /*#__PURE__*/function (_React$Component13) {
2200
2264
  }
2201
2265
  }]);
2202
2266
  }(React.Component);
2203
- export var Download = /*#__PURE__*/function (_React$Component14) {
2267
+ export var Download = /*#__PURE__*/function (_React$Component13) {
2204
2268
  function Download() {
2205
2269
  _classCallCheck(this, Download);
2206
2270
  return _callSuper(this, Download, arguments);
2207
2271
  }
2208
- _inherits(Download, _React$Component14);
2272
+ _inherits(Download, _React$Component13);
2209
2273
  return _createClass(Download, [{
2210
2274
  key: "render",
2211
2275
  value: function render() {
@@ -2224,41 +2288,41 @@ export var Download = /*#__PURE__*/function (_React$Component14) {
2224
2288
  }
2225
2289
  }]);
2226
2290
  }(React.Component);
2227
- export var Camera = /*#__PURE__*/function (_React$Component15) {
2291
+ export var Camera = /*#__PURE__*/function (_React$Component14) {
2228
2292
  function Camera(props) {
2229
- var _this13;
2293
+ var _this11;
2230
2294
  _classCallCheck(this, Camera);
2231
- _this13 = _callSuper(this, Camera, [props]);
2232
- _defineProperty(_this13, "handleChange", function (event) {
2295
+ _this11 = _callSuper(this, Camera, [props]);
2296
+ _defineProperty(_this11, "handleChange", function (event) {
2233
2297
  if (event.target.files && event.target.files.length > 0) {
2234
- _this13.setState({
2298
+ _this11.setState({
2235
2299
  img: event.target.files[0]
2236
2300
  });
2237
- if (_this13.props.onChange) {
2238
- _this13.props.onChange(event.target.files[0]);
2301
+ if (_this11.props.onChange) {
2302
+ _this11.props.onChange(event.target.files[0]);
2239
2303
  }
2240
2304
  }
2241
2305
  });
2242
- _defineProperty(_this13, "clearImage", function () {
2243
- _this13.setState({
2306
+ _defineProperty(_this11, "clearImage", function () {
2307
+ _this11.setState({
2244
2308
  img: null
2245
2309
  });
2246
- if (_this13.props.onChange) {
2247
- _this13.props.onChange(null);
2310
+ if (_this11.props.onChange) {
2311
+ _this11.props.onChange(null);
2248
2312
  }
2249
2313
  });
2250
- _this13.inputField = /*#__PURE__*/React.createRef();
2251
- _this13.state = {
2314
+ _this11.inputField = /*#__PURE__*/React.createRef();
2315
+ _this11.state = {
2252
2316
  img: props.value
2253
2317
  };
2254
- return _this13;
2318
+ return _this11;
2255
2319
  }
2256
- _inherits(Camera, _React$Component15);
2320
+ _inherits(Camera, _React$Component14);
2257
2321
  return _createClass(Camera, [{
2258
2322
  key: "getImageSizeProps",
2259
- value: function getImageSizeProps(_ref19) {
2260
- var width = _ref19.width,
2261
- height = _ref19.height;
2323
+ value: function getImageSizeProps(_ref21) {
2324
+ var width = _ref21.width,
2325
+ height = _ref21.height;
2262
2326
  var imgProps = {
2263
2327
  width: '100%'
2264
2328
  };
@@ -2351,37 +2415,37 @@ export var Camera = /*#__PURE__*/function (_React$Component15) {
2351
2415
  }
2352
2416
  }]);
2353
2417
  }(React.Component);
2354
- export var FileUpload = /*#__PURE__*/function (_React$Component16) {
2418
+ export var FileUpload = /*#__PURE__*/function (_React$Component15) {
2355
2419
  function FileUpload(props) {
2356
- var _this14;
2420
+ var _this12;
2357
2421
  _classCallCheck(this, FileUpload);
2358
- _this14 = _callSuper(this, FileUpload, [props]);
2359
- _defineProperty(_this14, "handleChange", function (event) {
2422
+ _this12 = _callSuper(this, FileUpload, [props]);
2423
+ _defineProperty(_this12, "handleChange", function (event) {
2360
2424
  if (event.target.files && event.target.files.length > 0) {
2361
- _this14.setState({
2425
+ _this12.setState({
2362
2426
  fileUpload: event.target.files[0]
2363
2427
  });
2364
- if (_this14.props.onChange) {
2365
- _this14.props.onChange(event.target.files[0]);
2428
+ if (_this12.props.onChange) {
2429
+ _this12.props.onChange(event.target.files[0]);
2366
2430
  }
2367
2431
  }
2368
2432
  });
2369
- _defineProperty(_this14, "clearFileUpload", function () {
2370
- _this14.setState({
2433
+ _defineProperty(_this12, "clearFileUpload", function () {
2434
+ _this12.setState({
2371
2435
  fileUpload: null
2372
2436
  });
2373
- if (_this14.props.onChange) {
2374
- _this14.props.onChange(null);
2437
+ if (_this12.props.onChange) {
2438
+ _this12.props.onChange(null);
2375
2439
  }
2376
2440
  });
2377
- _defineProperty(_this14, "saveFile", /*#__PURE__*/function () {
2378
- var _ref20 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(e) {
2441
+ _defineProperty(_this12, "saveFile", /*#__PURE__*/function () {
2442
+ var _ref22 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(e) {
2379
2443
  var sourceUrl, response, dispositionHeader, resBlob, blob, fileName, _fileName;
2380
2444
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
2381
2445
  while (1) switch (_context2.prev = _context2.next) {
2382
2446
  case 0:
2383
2447
  e.preventDefault();
2384
- sourceUrl = _this14.props.value;
2448
+ sourceUrl = _this12.props.value;
2385
2449
  _context2.next = 4;
2386
2450
  return fetch(sourceUrl, {
2387
2451
  method: 'GET',
@@ -2400,7 +2464,7 @@ export var FileUpload = /*#__PURE__*/function (_React$Component16) {
2400
2464
  resBlob = _context2.sent;
2401
2465
  // eslint-disable-next-line no-undef
2402
2466
  blob = new Blob([resBlob], {
2403
- type: _this14.props.item.fileType || response.headers.get('Content-Type')
2467
+ type: _this12.props.item.fileType || response.headers.get('Content-Type')
2404
2468
  });
2405
2469
  if (dispositionHeader && dispositionHeader.indexOf(';filename=') > -1) {
2406
2470
  fileName = dispositionHeader.split(';filename=')[1];
@@ -2416,16 +2480,16 @@ export var FileUpload = /*#__PURE__*/function (_React$Component16) {
2416
2480
  }, _callee2);
2417
2481
  }));
2418
2482
  return function (_x) {
2419
- return _ref20.apply(this, arguments);
2483
+ return _ref22.apply(this, arguments);
2420
2484
  };
2421
2485
  }());
2422
- _this14.inputField = /*#__PURE__*/React.createRef();
2423
- _this14.state = {
2486
+ _this12.inputField = /*#__PURE__*/React.createRef();
2487
+ _this12.state = {
2424
2488
  fileUpload: props.value
2425
2489
  };
2426
- return _this14;
2490
+ return _this12;
2427
2491
  }
2428
- _inherits(FileUpload, _React$Component16);
2492
+ _inherits(FileUpload, _React$Component15);
2429
2493
  return _createClass(FileUpload, [{
2430
2494
  key: "render",
2431
2495
  value: function render() {
@@ -2500,25 +2564,25 @@ export var FileUpload = /*#__PURE__*/function (_React$Component16) {
2500
2564
  }
2501
2565
  }]);
2502
2566
  }(React.Component);
2503
- export var Range = /*#__PURE__*/function (_React$Component17) {
2567
+ export var Range = /*#__PURE__*/function (_React$Component16) {
2504
2568
  function Range(props) {
2505
- var _this15;
2569
+ var _this13;
2506
2570
  _classCallCheck(this, Range);
2507
- _this15 = _callSuper(this, Range, [props]);
2508
- _this15.inputField = /*#__PURE__*/React.createRef();
2509
- return _this15;
2571
+ _this13 = _callSuper(this, Range, [props]);
2572
+ _this13.inputField = /*#__PURE__*/React.createRef();
2573
+ return _this13;
2510
2574
  }
2511
- _inherits(Range, _React$Component17);
2575
+ _inherits(Range, _React$Component16);
2512
2576
  return _createClass(Range, [{
2513
2577
  key: "render",
2514
2578
  value: function render() {
2515
- var _this16 = this;
2579
+ var _this14 = this;
2516
2580
  var props = {};
2517
2581
  var name = this.props.name;
2518
2582
  props.name = this.props.name;
2519
2583
  props.value = this.props.value;
2520
2584
  props.onChange = function (event) {
2521
- _this16.props.onChange(event.target.value);
2585
+ _this14.props.onChange(event.target.value);
2522
2586
  };
2523
2587
  if (this.props.item.disabled) {
2524
2588
  props.disabled = true;