@goldenpine/react-form-builder2 0.18.4-patch.1 → 0.20.3-build.1

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,56 +5,52 @@ Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports["default"] = void 0;
8
- var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
9
- var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
10
- var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
11
- var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
12
- var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
8
+ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
13
9
  var _react = _interopRequireDefault(require("react"));
14
10
  var _reactDnd = require("react-dnd");
15
11
  var _ItemTypes = _interopRequireDefault(require("./ItemTypes"));
16
12
  var _UUID = _interopRequireDefault(require("./UUID"));
17
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2["default"])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2["default"])(this, result); }; }
18
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } /**
13
+ /**
19
14
  * <ToolbarItem />
20
15
  */
21
- var cardSource = {
22
- beginDrag: function beginDrag(props) {
23
- return {
24
- id: _UUID["default"].uuid(),
25
- index: -1,
26
- data: props.data,
27
- onCreate: props.onCreate
28
- };
29
- }
30
- };
31
- var ToolbarItem = /*#__PURE__*/function (_React$Component) {
32
- (0, _inherits2["default"])(ToolbarItem, _React$Component);
33
- var _super = _createSuper(ToolbarItem);
34
- function ToolbarItem() {
35
- (0, _classCallCheck2["default"])(this, ToolbarItem);
36
- return _super.apply(this, arguments);
37
- }
38
- (0, _createClass2["default"])(ToolbarItem, [{
39
- key: "render",
40
- value: function render() {
41
- var _this$props = this.props,
42
- connectDragSource = _this$props.connectDragSource,
43
- data = _this$props.data,
44
- onClick = _this$props.onClick;
45
- if (!connectDragSource) return null;
46
- return connectDragSource(/*#__PURE__*/_react["default"].createElement("li", {
47
- onClick: onClick
48
- }, /*#__PURE__*/_react["default"].createElement("i", {
49
- className: data.icon
50
- }), data.name));
16
+
17
+ var ToolbarItem = function ToolbarItem(_ref) {
18
+ var data = _ref.data,
19
+ onCreate = _ref.onCreate,
20
+ onClick = _ref.onClick;
21
+ // Setup drag functionality using the useDrag hook
22
+ var _useDrag = (0, _reactDnd.useDrag)({
23
+ type: _ItemTypes["default"].CARD,
24
+ item: function item() {
25
+ return {
26
+ id: _UUID["default"].uuid(),
27
+ index: -1,
28
+ data: data,
29
+ onCreate: onCreate
30
+ };
31
+ },
32
+ collect: function collect(monitor) {
33
+ return {
34
+ isDragging: monitor.isDragging()
35
+ };
36
+ }
37
+ }),
38
+ _useDrag2 = (0, _slicedToArray2["default"])(_useDrag, 2),
39
+ isDragging = _useDrag2[0].isDragging,
40
+ drag = _useDrag2[1];
41
+
42
+ // Apply slight opacity while dragging for better UX
43
+ var opacity = isDragging ? 0.5 : 1;
44
+ return /*#__PURE__*/_react["default"].createElement("li", {
45
+ ref: drag,
46
+ onClick: onClick,
47
+ style: {
48
+ opacity: opacity,
49
+ cursor: 'move'
51
50
  }
52
- }]);
53
- return ToolbarItem;
54
- }(_react["default"].Component);
55
- var _default = (0, _reactDnd.DragSource)(_ItemTypes["default"].CARD, cardSource, function (connect) {
56
- return {
57
- connectDragSource: connect.dragSource()
58
- };
59
- })(ToolbarItem);
51
+ }, /*#__PURE__*/_react["default"].createElement("i", {
52
+ className: data.icon
53
+ }), data.name);
54
+ };
55
+ var _default = ToolbarItem;
60
56
  exports["default"] = _default;
package/lib/toolbar.js CHANGED
@@ -459,7 +459,7 @@ var Toolbar = /*#__PURE__*/function (_React$Component) {
459
459
  key: "addCustomOptions",
460
460
  value: function addCustomOptions(item, elementOptions) {
461
461
  if (item.type === 'custom') {
462
- var customOptions = Object.assign({}, item, elementOptions);
462
+ var customOptions = _objectSpread(_objectSpread({}, item), elementOptions);
463
463
  customOptions.custom = true;
464
464
  customOptions.component = item.component || null;
465
465
  customOptions.custom_options = item.custom_options || [];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@goldenpine/react-form-builder2",
3
- "version": "0.18.4-patch.1",
3
+ "version": "0.20.3-build.1",
4
4
  "description": "A complete form builder for react.",
5
5
  "main": "lib/index.js",
6
6
  "types": "types/index.d.ts",
@@ -27,46 +27,38 @@
27
27
  "drop"
28
28
  ],
29
29
  "engines": {
30
- "node": ">=12.0.0"
30
+ "node": ">=18.0.0"
31
31
  },
32
32
  "author": "Kiho Chang",
33
- "contributors": [
34
- {
35
- "name": "Zach Robichaud",
36
- "email": "zach2825@gmail.com",
37
- "url": "https://turtlebytes.com"
38
- }
39
- ],
40
33
  "dependencies": {
41
34
  "beedle": "^0.8.1",
42
35
  "classnames": "^2.2.6",
43
- "cors": "^2.8.5",
44
36
  "date-fns": "^2.16.1",
45
37
  "draft-js": "^0.11.7",
46
- "draftjs-to-html": "^0.9.1",
38
+ "draftjs-to-html": "^0.8.4",
47
39
  "es6-promise": "^4.2.8",
48
40
  "fbemitter": "^3.0.0",
49
41
  "file-saver": "^2.0.5",
50
42
  "immutability-helper": "^3.1.1",
51
43
  "isomorphic-fetch": "^3.0.0",
52
44
  "prop-types": "^15.7.2",
53
- "react-bootstrap-slider": "^2.2.3",
54
- "react-datepicker": "^3.4.1",
55
- "react-dnd": "^11.1.3",
56
- "react-dnd-html5-backend": "^11.1.3",
57
- "react-draft-wysiwyg": "^1.14.7",
58
- "react-intl": "^5.24.3",
59
- "react-select": "^3.2.0",
60
- "react-signature-canvas": "^1.0.3",
61
- "react-textarea-autosize": "^7.1.2",
45
+ "react-bootstrap-slider": "^3.0.0",
46
+ "react-datepicker": "^8.3.0",
47
+ "react-dnd": "^16.0.1",
48
+ "react-dnd-html5-backend": "^16.0.1",
49
+ "react-draft-wysiwyg": "^1.15.0",
50
+ "react-intl": "^7.1.11",
51
+ "react-select": "^5.10.1",
52
+ "react-signature-canvas": "^1.1.0-alpha.2",
53
+ "react-textarea-autosize": "^8.5.9",
62
54
  "xss": "^1.0.8"
63
55
  },
64
56
  "peerDependencies": {
65
- "react": ">=16.8.6",
66
- "react-dom": ">=16.8.6"
57
+ "react": ">=18.3.1",
58
+ "react-dom": ">=18.3.1"
67
59
  },
68
60
  "devDependencies": {
69
- "@babel/cli": "^7.26.4",
61
+ "@babel/cli": "^7.12.10",
70
62
  "@babel/core": "^7.12.10",
71
63
  "@babel/plugin-proposal-class-properties": "^7.12.1",
72
64
  "@babel/plugin-proposal-json-strings": "^7.12.1",
@@ -74,7 +66,7 @@
74
66
  "@babel/plugin-syntax-import-meta": "^7.10.4",
75
67
  "@babel/plugin-transform-runtime": "^7.17.10",
76
68
  "@babel/preset-env": "^7.12.11",
77
- "@babel/preset-react": "^7.26.3",
69
+ "@babel/preset-react": "^7.14.5",
78
70
  "@babel/runtime-corejs2": "^7.12.5",
79
71
  "add": "^2.0.6",
80
72
  "babel-eslint": "^10.1.0",
@@ -89,19 +81,19 @@
89
81
  "eslint-plugin-react": "^7.22.0",
90
82
  "express": "^4.17.1",
91
83
  "multer": "^1.4.2",
92
- "react": "^16.14.0",
93
- "react-dom": "^16.14.0",
84
+ "react": "^18.3.1",
85
+ "react-dom": "^18.3.1",
94
86
  "rimraf": "^3.0.2",
95
- "sass": "^1.52.3",
96
- "sass-loader": "^10.0.0",
97
- "style-loader": "^1.3.0",
98
- "webpack": "^4.46.0",
99
- "webpack-cli": "^3.3.12",
100
- "webpack-dev-server": "^3.11.2"
87
+ "sass": "^1.88.0",
88
+ "sass-loader": "^16.0.5",
89
+ "style-loader": "^4.0.0",
90
+ "webpack": "^5.99.8",
91
+ "webpack-cli": "^6.0.1",
92
+ "webpack-dev-server": "^5.2.1"
101
93
  },
102
94
  "scripts": {
103
95
  "build": "NODE_OPTIONS=--openssl-legacy-provider webpack --mode production --config webpack.production.config.js",
104
- "build:dev": "NODE_OPTIONS=--openssl-legacy-provider webpack --mode development",
96
+ "build:dev": "webpack --mode development",
105
97
  "build:umd": "webpack --mode development --config webpack.production.config.js",
106
98
  "build:style": "sass ./scss/application.scss dist/app.css --style compressed",
107
99
  "build:lib": "npm run transpile && npm run build:style",
@@ -110,7 +102,7 @@
110
102
  "copy:dist": "copyfiles -f \"./dist/*\" \"./public/dist\"",
111
103
  "prepublishOnly": "npm run clean && NODE_OPTIONS=--openssl-legacy-provider npm run build:lib && NODE_OPTIONS=--openssl-legacy-provider npm run build",
112
104
  "watch": "webpack --watch",
113
- "start": "NODE_OPTIONS=--openssl-legacy-provider webpack-dev-server --hot --mode development",
105
+ "start": "NODE_OPTIONS=--openssl-legacy-provider && webpack-dev-server --hot --mode development",
114
106
  "serve:api": "node server/index.js",
115
107
  "pretranspile": "rimraf lib",
116
108
  "transpile": "babel --out-dir lib src --copy-files"