react-survey-builder 1.0.29 → 1.0.31

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.
@@ -35,6 +35,8 @@ var _ipUtils = require("../utils/ipUtils");
35
35
  var _momentTimezone = _interopRequireDefault(require("moment-timezone"));
36
36
  var _ri = require("react-icons/ri");
37
37
  var _UUID = _interopRequireDefault(require("../UUID"));
38
+ var _md = require("react-icons/md");
39
+ var _io = require("react-icons/io5");
38
40
  var _excluded = ["onChange"],
39
41
  _excluded2 = ["onChange", "formatMask"]; // eslint-disable-next-line max-classes-per-file
40
42
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
@@ -1166,12 +1168,12 @@ var Checkboxes = /*#__PURE__*/function (_React$Component15) {
1166
1168
  }, /*#__PURE__*/_react["default"].createElement(_componentLabel["default"], (0, _extends2["default"])({}, this.props, {
1167
1169
  htmlFor: this.props.name
1168
1170
  })), this.props.item.options.map(function (option) {
1169
- var _self$props$item$inli, _this20$props$checkbo;
1171
+ var _this20$props$checkbo;
1170
1172
  var props = {};
1171
1173
  props.name = "option_".concat(option.key);
1172
1174
  props.value = option.value;
1173
1175
  props.checked = self.props.value ? self.props.value.indexOf(option.value) > -1 : false;
1174
- props.inline = (_self$props$item$inli = self.props.item.inline) !== null && _self$props$item$inli !== void 0 ? _self$props$item$inli : false;
1176
+ //props.inline = self.props.item.inline ?? false;
1175
1177
  if (self.props.item.disabled) {
1176
1178
  props.disabled = 'disabled';
1177
1179
  }
@@ -1180,7 +1182,7 @@ var Checkboxes = /*#__PURE__*/function (_React$Component15) {
1180
1182
  variant: (_this20$props$checkbo = _this20.props.checkboxButtonClassName) !== null && _this20$props$checkbo !== void 0 ? _this20$props$checkbo : "outline-light",
1181
1183
  className: "btn-survey-builder-checkbox",
1182
1184
  key: "preview_".concat(option.key),
1183
- id: "fid_preview_".concat(option.key),
1185
+ id: self.props.name + '-' + _UUID["default"].uuid(),
1184
1186
  inputRef: function inputRef(c) {
1185
1187
  if (c && self.props.item.mutable) {
1186
1188
  self.options["child_ref_".concat(option.key)] = c;
@@ -1230,7 +1232,7 @@ var Checkbox = /*#__PURE__*/function (_React$Component16) {
1230
1232
  }
1231
1233
  var props = {};
1232
1234
  // eslint-disable-next-line no-undef
1233
- props.name = this.props.name + '-' + _UUID["default"].uuid();
1235
+ props.name = this.props.name;
1234
1236
  props.onChange = function (event) {
1235
1237
  if (_this22.props.onChange) {
1236
1238
  _this22.props.onChange(event.target.checked);
@@ -1274,7 +1276,7 @@ var Checkbox = /*#__PURE__*/function (_React$Component16) {
1274
1276
  variant: (_this$props$checkboxB = this.props.checkboxButtonClassName) !== null && _this$props$checkboxB !== void 0 ? _this$props$checkboxB : "outline-light",
1275
1277
  className: "btn-survey-builder-checkbox",
1276
1278
  value: props.name,
1277
- id: props.name
1279
+ id: props.name + '-' + _UUID["default"].uuid()
1278
1280
  }, props), /*#__PURE__*/_react["default"].createElement("div", {
1279
1281
  className: "d-flex align-items-center justify-content-between text-black text-survey-builder-checkbox"
1280
1282
  }, props.checked !== true && /*#__PURE__*/_react["default"].createElement(_ri.RiCheckboxBlankLine, {
@@ -1331,55 +1333,57 @@ var RadioButtons = /*#__PURE__*/function (_React$Component17) {
1331
1333
  return option.text;
1332
1334
  }).join(', '))));
1333
1335
  }
1336
+ console.log('self.props', self.props);
1334
1337
  return /*#__PURE__*/_react["default"].createElement("div", {
1335
- style: _objectSpread({}, this.props.style),
1338
+ style: _objectSpread({}, self.props.style),
1336
1339
  className: baseClasses
1337
- }, /*#__PURE__*/_react["default"].createElement(_componentHeader["default"], this.props), /*#__PURE__*/_react["default"].createElement(_reactBootstrap.Form.Group, {
1340
+ }, /*#__PURE__*/_react["default"].createElement(_componentHeader["default"], self.props), /*#__PURE__*/_react["default"].createElement(_reactBootstrap.Form.Group, {
1338
1341
  className: "form-group mb-3"
1339
- }, /*#__PURE__*/_react["default"].createElement(_componentLabel["default"], this.props), this.props.item.options.map(function (option) {
1340
- var _self$props$item$inli2, _this24$props$checkbo;
1341
- var props = {};
1342
- props.name = self.props.name;
1343
- props.value = option.value;
1344
- props.checked = self.props.value === option.value;
1345
- props.onChange = function (event) {
1346
- self.props.onChange(event.target.value);
1347
- };
1348
- if (self.props.item.disabled) {
1349
- props.disabled = 'disabled';
1350
- }
1351
- props.inline = (_self$props$item$inli2 = self.props.item.inline) !== null && _self$props$item$inli2 !== void 0 ? _self$props$item$inli2 : false;
1352
- return /*#__PURE__*/_react["default"].createElement(_reactBootstrap.ToggleButton, (0, _extends2["default"])({
1342
+ }, /*#__PURE__*/_react["default"].createElement(_componentLabel["default"], self.props), self.props.item.options.map(function (option) {
1343
+ var _self$props$checkboxB, _self$props, _self$props2, _self$props3, _self$props5, _self$props6;
1344
+ console.log('option', option);
1345
+ return /*#__PURE__*/_react["default"].createElement(_reactBootstrap.ToggleButton, {
1353
1346
  label: option.text,
1354
1347
  type: "radio",
1355
- variant: (_this24$props$checkbo = _this24.props.checkboxButtonClassName) !== null && _this24$props$checkbo !== void 0 ? _this24$props$checkbo : "outline-light",
1348
+ variant: (_self$props$checkboxB = self.props.checkboxButtonClassName) !== null && _self$props$checkboxB !== void 0 ? _self$props$checkboxB : "outline-light",
1356
1349
  className: "btn-survey-builder-checkbox",
1357
1350
  key: "preview_".concat(option.key),
1358
- id: "fid_preview_".concat(option.key),
1351
+ id: self.props.name + '-' + _UUID["default"].uuid(),
1359
1352
  inputRef: function inputRef(c) {
1360
1353
  if (c && self.props.item.mutable) {
1361
1354
  self.options["child_ref_".concat(option.key)] = c;
1362
1355
  }
1356
+ },
1357
+ disabled: self === null || self === void 0 || (_self$props = self.props) === null || _self$props === void 0 || (_self$props = _self$props.item) === null || _self$props === void 0 ? void 0 : _self$props.disabled,
1358
+ name: self === null || self === void 0 || (_self$props2 = self.props) === null || _self$props2 === void 0 ? void 0 : _self$props2.name,
1359
+ value: option.value,
1360
+ checked: (self === null || self === void 0 || (_self$props3 = self.props) === null || _self$props3 === void 0 ? void 0 : _self$props3.value) === option.value,
1361
+ onChange: function onChange(e) {
1362
+ var _self$props4;
1363
+ if ((self === null || self === void 0 || (_self$props4 = self.props) === null || _self$props4 === void 0 ? void 0 : _self$props4.onChange) !== undefined) {
1364
+ console.log(e.target.value);
1365
+ self.props.onChange(e.target.value);
1366
+ }
1363
1367
  }
1364
- }, props), /*#__PURE__*/_react["default"].createElement("div", {
1368
+ }, /*#__PURE__*/_react["default"].createElement("div", {
1365
1369
  className: "d-flex align-items-center justify-content-between text-black text-survey-builder-checkbox"
1366
- }, props.checked !== true && /*#__PURE__*/_react["default"].createElement(_ri.RiRadioButtonLine, {
1370
+ }, (self === null || self === void 0 || (_self$props5 = self.props) === null || _self$props5 === void 0 ? void 0 : _self$props5.value) !== option.value && /*#__PURE__*/_react["default"].createElement(_io.IoRadioButtonOff, {
1367
1371
  size: "40px",
1368
1372
  className: "me-3 flex-shrink-0"
1369
- }), props.checked === true && /*#__PURE__*/_react["default"].createElement(_ri.RiRadioButtonFill, {
1373
+ }), (self === null || self === void 0 || (_self$props6 = self.props) === null || _self$props6 === void 0 ? void 0 : _self$props6.value) === option.value && /*#__PURE__*/_react["default"].createElement(_io.IoRadioButtonOn, {
1370
1374
  size: "40px",
1371
1375
  className: "me-3 flex-shrink-0"
1372
1376
  }), /*#__PURE__*/_react["default"].createElement("div", {
1373
1377
  className: "text-start"
1374
1378
  }, /*#__PURE__*/_react["default"].createElement("span", {
1375
1379
  dangerouslySetInnerHTML: {
1376
- __html: _this24.props.item.boxLabel
1380
+ __html: option.text
1377
1381
  }
1378
1382
  }))));
1379
- }), this.props.item.help ? /*#__PURE__*/_react["default"].createElement(_reactBootstrap.Form.Text, {
1383
+ }), self.props.item.help ? /*#__PURE__*/_react["default"].createElement(_reactBootstrap.Form.Text, {
1380
1384
  muted: true
1381
- }, this.props.item.help) : null, /*#__PURE__*/_react["default"].createElement(_componentErrorMessage["default"], {
1382
- name: this.props.name
1385
+ }, self.props.item.help) : null, /*#__PURE__*/_react["default"].createElement(_componentErrorMessage["default"], {
1386
+ name: self.props.name
1383
1387
  })));
1384
1388
  }
1385
1389
  }]);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-survey-builder",
3
- "version": "1.0.29",
3
+ "version": "1.0.31",
4
4
  "description": "A complete survey builder for react.",
5
5
  "main": "lib/index.js",
6
6
  "types": "types/index.d.ts",