@rkmodules/rules 0.0.133 → 0.0.135

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/dist/index.cjs.js CHANGED
@@ -772,7 +772,7 @@ var value = {
772
772
  case "number":
773
773
  return [2 /*return*/, { value: broadCast(Number(value)) }];
774
774
  case "boolean":
775
- return [2 /*return*/, { value: broadCast(Boolean(value)) }];
775
+ return [2 /*return*/, { value: broadCast(value.toLowerCase() === "true") }];
776
776
  case "string":
777
777
  return [2 /*return*/, { value: broadCast(String(value)) }];
778
778
  default:
@@ -6114,6 +6114,24 @@ var InputText = React.memo(function (_a) {
6114
6114
  }, [inner, value, onChange]);
6115
6115
  return (React.createElement("textarea", { value: inner, onChange: function (e) { return setInner(e.target.value); }, onBlur: handleBlur, onKeyDown: handleKey, onMouseDown: function (e) { return e.stopPropagation(); }, rows: 4 }));
6116
6116
  });
6117
+ var InputBoolean = React.memo(function (_a) {
6118
+ var value = _a.value, onChange = _a.onChange, allowEmpty = _a.allowEmpty;
6119
+ var inputRef = React.useRef(null);
6120
+ React.useEffect(function () {
6121
+ if (allowEmpty && inputRef.current) {
6122
+ console.log("setting indeterminate");
6123
+ inputRef.current.indeterminate = value === undefined;
6124
+ }
6125
+ }, [value]);
6126
+ var handleChange = function () {
6127
+ var next = !value;
6128
+ if (value === false && allowEmpty)
6129
+ next = undefined;
6130
+ console.log("setting next", next);
6131
+ onChange === null || onChange === void 0 ? void 0 : onChange(next);
6132
+ };
6133
+ return (React.createElement("input", { ref: inputRef, type: "checkbox", checked: Boolean(value), onChange: handleChange }));
6134
+ });
6117
6135
  function Control(_a) {
6118
6136
  var _b;
6119
6137
  var value = _a.value, vardef = _a.vardef, data = _a.data, onChange = _a.onChange;
@@ -6138,7 +6156,7 @@ function Control(_a) {
6138
6156
  return (React.createElement(InputNumber, { value: value, onChange: onChange, step: vardef.step, min: vardef.min, max: vardef.max, inputMode: "numeric", onMouseDown: function (e) { return e.stopPropagation(); } }));
6139
6157
  }
6140
6158
  case "boolean":
6141
- return (React.createElement("input", { type: "checkbox", checked: Boolean(value), onChange: function (e) { return onChange === null || onChange === void 0 ? void 0 : onChange(e.target.checked); } }));
6159
+ return (React.createElement(InputBoolean, { value: value, onChange: onChange, allowEmpty: vardef.allowEmpty }));
6142
6160
  default:
6143
6161
  return React.createElement("span", { className: styles$1.PortLabel },
6144
6162
  "(",