@teselagen/ui 0.4.18 → 0.4.19-beta.2

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.
@@ -0,0 +1 @@
1
+ export function withAbstractWrapper(ComponentToWrap: any, opts?: {}): (props: any) => import("react/jsx-runtime").JSX.Element;
package/README.md CHANGED
@@ -23,3 +23,9 @@ nx run ui:start
23
23
  ```
24
24
  nx run ui:publish
25
25
  ```
26
+
27
+ ## Publishing a beta version (for use when linking to a branch in another project)
28
+
29
+ ```
30
+ nx run ui:publish-beta
31
+ ```
package/index.cjs.js CHANGED
@@ -3123,63 +3123,89 @@ function getAugmentedNamespace(n2) {
3123
3123
  }
3124
3124
  __name(getAugmentedNamespace, "getAugmentedNamespace");
3125
3125
  var propTypes$1 = { exports: {} };
3126
- var ReactPropTypesSecret$1 = "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";
3127
- var ReactPropTypesSecret_1 = ReactPropTypesSecret$1;
3128
- var ReactPropTypesSecret = ReactPropTypesSecret_1;
3129
- function emptyFunction() {
3130
- }
3131
- __name(emptyFunction, "emptyFunction");
3132
- function emptyFunctionWithReset() {
3133
- }
3134
- __name(emptyFunctionWithReset, "emptyFunctionWithReset");
3135
- emptyFunctionWithReset.resetWarningCache = emptyFunction;
3136
- var factoryWithThrowingShims = /* @__PURE__ */ __name(function() {
3137
- function shim2(props, propName, componentName, location2, propFullName, secret) {
3138
- if (secret === ReactPropTypesSecret) {
3139
- return;
3126
+ var ReactPropTypesSecret_1;
3127
+ var hasRequiredReactPropTypesSecret;
3128
+ function requireReactPropTypesSecret() {
3129
+ if (hasRequiredReactPropTypesSecret)
3130
+ return ReactPropTypesSecret_1;
3131
+ hasRequiredReactPropTypesSecret = 1;
3132
+ var ReactPropTypesSecret = "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";
3133
+ ReactPropTypesSecret_1 = ReactPropTypesSecret;
3134
+ return ReactPropTypesSecret_1;
3135
+ }
3136
+ __name(requireReactPropTypesSecret, "requireReactPropTypesSecret");
3137
+ var factoryWithThrowingShims;
3138
+ var hasRequiredFactoryWithThrowingShims;
3139
+ function requireFactoryWithThrowingShims() {
3140
+ if (hasRequiredFactoryWithThrowingShims)
3141
+ return factoryWithThrowingShims;
3142
+ hasRequiredFactoryWithThrowingShims = 1;
3143
+ var ReactPropTypesSecret = requireReactPropTypesSecret();
3144
+ function emptyFunction() {
3145
+ }
3146
+ __name(emptyFunction, "emptyFunction");
3147
+ function emptyFunctionWithReset() {
3148
+ }
3149
+ __name(emptyFunctionWithReset, "emptyFunctionWithReset");
3150
+ emptyFunctionWithReset.resetWarningCache = emptyFunction;
3151
+ factoryWithThrowingShims = /* @__PURE__ */ __name(function() {
3152
+ function shim2(props, propName, componentName, location2, propFullName, secret) {
3153
+ if (secret === ReactPropTypesSecret) {
3154
+ return;
3155
+ }
3156
+ var err = new Error(
3157
+ "Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types"
3158
+ );
3159
+ err.name = "Invariant Violation";
3160
+ throw err;
3140
3161
  }
3141
- var err = new Error(
3142
- "Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types"
3143
- );
3144
- err.name = "Invariant Violation";
3145
- throw err;
3162
+ __name(shim2, "shim");
3163
+ shim2.isRequired = shim2;
3164
+ function getShim() {
3165
+ return shim2;
3166
+ }
3167
+ __name(getShim, "getShim");
3168
+ var ReactPropTypes = {
3169
+ array: shim2,
3170
+ bigint: shim2,
3171
+ bool: shim2,
3172
+ func: shim2,
3173
+ number: shim2,
3174
+ object: shim2,
3175
+ string: shim2,
3176
+ symbol: shim2,
3177
+ any: shim2,
3178
+ arrayOf: getShim,
3179
+ element: shim2,
3180
+ elementType: shim2,
3181
+ instanceOf: getShim,
3182
+ node: shim2,
3183
+ objectOf: getShim,
3184
+ oneOf: getShim,
3185
+ oneOfType: getShim,
3186
+ shape: getShim,
3187
+ exact: getShim,
3188
+ checkPropTypes: emptyFunctionWithReset,
3189
+ resetWarningCache: emptyFunction
3190
+ };
3191
+ ReactPropTypes.PropTypes = ReactPropTypes;
3192
+ return ReactPropTypes;
3193
+ }, "factoryWithThrowingShims");
3194
+ return factoryWithThrowingShims;
3195
+ }
3196
+ __name(requireFactoryWithThrowingShims, "requireFactoryWithThrowingShims");
3197
+ var hasRequiredPropTypes;
3198
+ function requirePropTypes() {
3199
+ if (hasRequiredPropTypes)
3200
+ return propTypes$1.exports;
3201
+ hasRequiredPropTypes = 1;
3202
+ {
3203
+ propTypes$1.exports = requireFactoryWithThrowingShims()();
3146
3204
  }
3147
- __name(shim2, "shim");
3148
- shim2.isRequired = shim2;
3149
- function getShim() {
3150
- return shim2;
3151
- }
3152
- __name(getShim, "getShim");
3153
- var ReactPropTypes = {
3154
- array: shim2,
3155
- bigint: shim2,
3156
- bool: shim2,
3157
- func: shim2,
3158
- number: shim2,
3159
- object: shim2,
3160
- string: shim2,
3161
- symbol: shim2,
3162
- any: shim2,
3163
- arrayOf: getShim,
3164
- element: shim2,
3165
- elementType: shim2,
3166
- instanceOf: getShim,
3167
- node: shim2,
3168
- objectOf: getShim,
3169
- oneOf: getShim,
3170
- oneOfType: getShim,
3171
- shape: getShim,
3172
- exact: getShim,
3173
- checkPropTypes: emptyFunctionWithReset,
3174
- resetWarningCache: emptyFunction
3175
- };
3176
- ReactPropTypes.PropTypes = ReactPropTypes;
3177
- return ReactPropTypes;
3178
- }, "factoryWithThrowingShims");
3179
- {
3180
- propTypes$1.exports = factoryWithThrowingShims();
3205
+ return propTypes$1.exports;
3181
3206
  }
3182
- var propTypesExports = propTypes$1.exports;
3207
+ __name(requirePropTypes, "requirePropTypes");
3208
+ var propTypesExports = requirePropTypes();
3183
3209
  const PropTypes$1 = /* @__PURE__ */ getDefaultExportFromCjs(propTypesExports);
3184
3210
  function __awaiter(thisArg, _arguments, P2, generator) {
3185
3211
  function adopt(value) {
@@ -18291,7 +18317,7 @@ var reactList = {};
18291
18317
  (function(exports2) {
18292
18318
  (function(global2, factory) {
18293
18319
  {
18294
- factory(exports2, propTypesExports, React$1);
18320
+ factory(exports2, requirePropTypes(), React$1);
18295
18321
  }
18296
18322
  })(commonjsGlobal, function(_exports, _propTypes2, _react3) {
18297
18323
  Object.defineProperty(_exports, "__esModule", {
@@ -49930,7 +49956,11 @@ const renderBlueprintNumericInput = /* @__PURE__ */ __name((props) => {
49930
49956
  }, removeUnwantedProps(rest)), hideValue ? { value: "" } : {}), {
49931
49957
  className: classNames(core.Classes.FILL, inputClassName),
49932
49958
  onValueChange: (numericVal, stringVal) => {
49933
- input.onChange(stringVal);
49959
+ if (isNumber$2(stringVal)) {
49960
+ input.onChange(numericVal);
49961
+ } else {
49962
+ input.onChange(stringVal);
49963
+ }
49934
49964
  onAnyNumberChange && onAnyNumberChange(numericVal);
49935
49965
  },
49936
49966
  onButtonClick: function(numericVal, stringVal) {
@@ -69514,7 +69544,7 @@ Object.defineProperty(DraggableCore$2, "__esModule", {
69514
69544
  });
69515
69545
  DraggableCore$2.default = void 0;
69516
69546
  var React = _interopRequireWildcard$1(React$1);
69517
- var _propTypes = _interopRequireDefault$2(propTypesExports);
69547
+ var _propTypes = _interopRequireDefault$2(requirePropTypes());
69518
69548
  var _reactDom$1 = _interopRequireDefault$2(require$$2$1);
69519
69549
  var _domFns = domFns;
69520
69550
  var _positionFns = positionFns;
@@ -70106,7 +70136,7 @@ _defineProperty(DraggableCore$1, "defaultProps", {
70106
70136
  });
70107
70137
  exports2.default = void 0;
70108
70138
  var React2 = _interopRequireWildcard2(React$1);
70109
- var _propTypes2 = _interopRequireDefault2(propTypesExports);
70139
+ var _propTypes2 = _interopRequireDefault2(requirePropTypes());
70110
70140
  var _reactDom2 = _interopRequireDefault2(require$$2$1);
70111
70141
  var _clsx2 = _interopRequireDefault2(require$$3);
70112
70142
  var _domFns2 = domFns;
@@ -73826,7 +73856,7 @@ var Transition$1 = {};
73826
73856
  const require$$2 = /* @__PURE__ */ getAugmentedNamespace(reactLifecyclesCompat_es);
73827
73857
  Transition$1.__esModule = true;
73828
73858
  Transition$1.default = Transition$1.EXITING = Transition$1.ENTERED = Transition$1.ENTERING = Transition$1.EXITED = Transition$1.UNMOUNTED = void 0;
73829
- var PropTypes = _interopRequireWildcard(propTypesExports);
73859
+ var PropTypes = _interopRequireWildcard(requirePropTypes());
73830
73860
  var _react$1 = _interopRequireDefault$1(React$1);
73831
73861
  var _reactDom = _interopRequireDefault$1(require$$2$1);
73832
73862
  var _reactLifecyclesCompat = require$$2;
@@ -74144,7 +74174,7 @@ Transition$1.default = _default;
74144
74174
  (function(module2, exports2) {
74145
74175
  exports2.__esModule = true;
74146
74176
  exports2.default = void 0;
74147
- _interopRequireWildcard2(propTypesExports);
74177
+ _interopRequireWildcard2(requirePropTypes());
74148
74178
  var _addClass = _interopRequireDefault2(addClassExports);
74149
74179
  var _removeClass = _interopRequireDefault2(removeClass);
74150
74180
  var _react3 = _interopRequireDefault2(React$1);
@@ -74427,7 +74457,7 @@ __name(getNextChildMapping, "getNextChildMapping");
74427
74457
  (function(module2, exports2) {
74428
74458
  exports2.__esModule = true;
74429
74459
  exports2.default = void 0;
74430
- var _propTypes2 = _interopRequireDefault2(propTypesExports);
74460
+ var _propTypes2 = _interopRequireDefault2(requirePropTypes());
74431
74461
  var _react3 = _interopRequireDefault2(React$1);
74432
74462
  var _reactLifecyclesCompat2 = require$$2;
74433
74463
  var _ChildMapping = ChildMapping;
@@ -74581,7 +74611,7 @@ var TransitionGroupExports = TransitionGroup.exports;
74581
74611
  (function(module2, exports2) {
74582
74612
  exports2.__esModule = true;
74583
74613
  exports2.default = void 0;
74584
- _interopRequireDefault2(propTypesExports);
74614
+ _interopRequireDefault2(requirePropTypes());
74585
74615
  var _react3 = _interopRequireDefault2(React$1);
74586
74616
  var _reactDom2 = require$$2$1;
74587
74617
  var _TransitionGroup2 = _interopRequireDefault2(TransitionGroupExports);
package/index.es.js CHANGED
@@ -3105,63 +3105,89 @@ function getAugmentedNamespace(n2) {
3105
3105
  }
3106
3106
  __name(getAugmentedNamespace, "getAugmentedNamespace");
3107
3107
  var propTypes$1 = { exports: {} };
3108
- var ReactPropTypesSecret$1 = "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";
3109
- var ReactPropTypesSecret_1 = ReactPropTypesSecret$1;
3110
- var ReactPropTypesSecret = ReactPropTypesSecret_1;
3111
- function emptyFunction() {
3112
- }
3113
- __name(emptyFunction, "emptyFunction");
3114
- function emptyFunctionWithReset() {
3115
- }
3116
- __name(emptyFunctionWithReset, "emptyFunctionWithReset");
3117
- emptyFunctionWithReset.resetWarningCache = emptyFunction;
3118
- var factoryWithThrowingShims = /* @__PURE__ */ __name(function() {
3119
- function shim2(props, propName, componentName, location2, propFullName, secret) {
3120
- if (secret === ReactPropTypesSecret) {
3121
- return;
3108
+ var ReactPropTypesSecret_1;
3109
+ var hasRequiredReactPropTypesSecret;
3110
+ function requireReactPropTypesSecret() {
3111
+ if (hasRequiredReactPropTypesSecret)
3112
+ return ReactPropTypesSecret_1;
3113
+ hasRequiredReactPropTypesSecret = 1;
3114
+ var ReactPropTypesSecret = "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";
3115
+ ReactPropTypesSecret_1 = ReactPropTypesSecret;
3116
+ return ReactPropTypesSecret_1;
3117
+ }
3118
+ __name(requireReactPropTypesSecret, "requireReactPropTypesSecret");
3119
+ var factoryWithThrowingShims;
3120
+ var hasRequiredFactoryWithThrowingShims;
3121
+ function requireFactoryWithThrowingShims() {
3122
+ if (hasRequiredFactoryWithThrowingShims)
3123
+ return factoryWithThrowingShims;
3124
+ hasRequiredFactoryWithThrowingShims = 1;
3125
+ var ReactPropTypesSecret = requireReactPropTypesSecret();
3126
+ function emptyFunction() {
3127
+ }
3128
+ __name(emptyFunction, "emptyFunction");
3129
+ function emptyFunctionWithReset() {
3130
+ }
3131
+ __name(emptyFunctionWithReset, "emptyFunctionWithReset");
3132
+ emptyFunctionWithReset.resetWarningCache = emptyFunction;
3133
+ factoryWithThrowingShims = /* @__PURE__ */ __name(function() {
3134
+ function shim2(props, propName, componentName, location2, propFullName, secret) {
3135
+ if (secret === ReactPropTypesSecret) {
3136
+ return;
3137
+ }
3138
+ var err = new Error(
3139
+ "Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types"
3140
+ );
3141
+ err.name = "Invariant Violation";
3142
+ throw err;
3122
3143
  }
3123
- var err = new Error(
3124
- "Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types"
3125
- );
3126
- err.name = "Invariant Violation";
3127
- throw err;
3144
+ __name(shim2, "shim");
3145
+ shim2.isRequired = shim2;
3146
+ function getShim() {
3147
+ return shim2;
3148
+ }
3149
+ __name(getShim, "getShim");
3150
+ var ReactPropTypes = {
3151
+ array: shim2,
3152
+ bigint: shim2,
3153
+ bool: shim2,
3154
+ func: shim2,
3155
+ number: shim2,
3156
+ object: shim2,
3157
+ string: shim2,
3158
+ symbol: shim2,
3159
+ any: shim2,
3160
+ arrayOf: getShim,
3161
+ element: shim2,
3162
+ elementType: shim2,
3163
+ instanceOf: getShim,
3164
+ node: shim2,
3165
+ objectOf: getShim,
3166
+ oneOf: getShim,
3167
+ oneOfType: getShim,
3168
+ shape: getShim,
3169
+ exact: getShim,
3170
+ checkPropTypes: emptyFunctionWithReset,
3171
+ resetWarningCache: emptyFunction
3172
+ };
3173
+ ReactPropTypes.PropTypes = ReactPropTypes;
3174
+ return ReactPropTypes;
3175
+ }, "factoryWithThrowingShims");
3176
+ return factoryWithThrowingShims;
3177
+ }
3178
+ __name(requireFactoryWithThrowingShims, "requireFactoryWithThrowingShims");
3179
+ var hasRequiredPropTypes;
3180
+ function requirePropTypes() {
3181
+ if (hasRequiredPropTypes)
3182
+ return propTypes$1.exports;
3183
+ hasRequiredPropTypes = 1;
3184
+ {
3185
+ propTypes$1.exports = requireFactoryWithThrowingShims()();
3128
3186
  }
3129
- __name(shim2, "shim");
3130
- shim2.isRequired = shim2;
3131
- function getShim() {
3132
- return shim2;
3133
- }
3134
- __name(getShim, "getShim");
3135
- var ReactPropTypes = {
3136
- array: shim2,
3137
- bigint: shim2,
3138
- bool: shim2,
3139
- func: shim2,
3140
- number: shim2,
3141
- object: shim2,
3142
- string: shim2,
3143
- symbol: shim2,
3144
- any: shim2,
3145
- arrayOf: getShim,
3146
- element: shim2,
3147
- elementType: shim2,
3148
- instanceOf: getShim,
3149
- node: shim2,
3150
- objectOf: getShim,
3151
- oneOf: getShim,
3152
- oneOfType: getShim,
3153
- shape: getShim,
3154
- exact: getShim,
3155
- checkPropTypes: emptyFunctionWithReset,
3156
- resetWarningCache: emptyFunction
3157
- };
3158
- ReactPropTypes.PropTypes = ReactPropTypes;
3159
- return ReactPropTypes;
3160
- }, "factoryWithThrowingShims");
3161
- {
3162
- propTypes$1.exports = factoryWithThrowingShims();
3187
+ return propTypes$1.exports;
3163
3188
  }
3164
- var propTypesExports = propTypes$1.exports;
3189
+ __name(requirePropTypes, "requirePropTypes");
3190
+ var propTypesExports = requirePropTypes();
3165
3191
  const PropTypes$1 = /* @__PURE__ */ getDefaultExportFromCjs(propTypesExports);
3166
3192
  function __awaiter(thisArg, _arguments, P2, generator) {
3167
3193
  function adopt(value) {
@@ -18273,7 +18299,7 @@ var reactList = {};
18273
18299
  (function(exports2) {
18274
18300
  (function(global2, factory) {
18275
18301
  {
18276
- factory(exports2, propTypesExports, React__default);
18302
+ factory(exports2, requirePropTypes(), React__default);
18277
18303
  }
18278
18304
  })(commonjsGlobal, function(_exports, _propTypes2, _react3) {
18279
18305
  Object.defineProperty(_exports, "__esModule", {
@@ -49912,7 +49938,11 @@ const renderBlueprintNumericInput = /* @__PURE__ */ __name((props) => {
49912
49938
  }, removeUnwantedProps(rest)), hideValue ? { value: "" } : {}), {
49913
49939
  className: classNames(Classes.FILL, inputClassName),
49914
49940
  onValueChange: (numericVal, stringVal) => {
49915
- input.onChange(stringVal);
49941
+ if (isNumber$2(stringVal)) {
49942
+ input.onChange(numericVal);
49943
+ } else {
49944
+ input.onChange(stringVal);
49945
+ }
49916
49946
  onAnyNumberChange && onAnyNumberChange(numericVal);
49917
49947
  },
49918
49948
  onButtonClick: function(numericVal, stringVal) {
@@ -69496,7 +69526,7 @@ Object.defineProperty(DraggableCore$2, "__esModule", {
69496
69526
  });
69497
69527
  DraggableCore$2.default = void 0;
69498
69528
  var React = _interopRequireWildcard$1(React__default);
69499
- var _propTypes = _interopRequireDefault$2(propTypesExports);
69529
+ var _propTypes = _interopRequireDefault$2(requirePropTypes());
69500
69530
  var _reactDom$1 = _interopRequireDefault$2(require$$2$1);
69501
69531
  var _domFns = domFns;
69502
69532
  var _positionFns = positionFns;
@@ -70088,7 +70118,7 @@ _defineProperty(DraggableCore$1, "defaultProps", {
70088
70118
  });
70089
70119
  exports2.default = void 0;
70090
70120
  var React2 = _interopRequireWildcard2(React__default);
70091
- var _propTypes2 = _interopRequireDefault2(propTypesExports);
70121
+ var _propTypes2 = _interopRequireDefault2(requirePropTypes());
70092
70122
  var _reactDom2 = _interopRequireDefault2(require$$2$1);
70093
70123
  var _clsx2 = _interopRequireDefault2(require$$3);
70094
70124
  var _domFns2 = domFns;
@@ -73808,7 +73838,7 @@ var Transition$1 = {};
73808
73838
  const require$$2 = /* @__PURE__ */ getAugmentedNamespace(reactLifecyclesCompat_es);
73809
73839
  Transition$1.__esModule = true;
73810
73840
  Transition$1.default = Transition$1.EXITING = Transition$1.ENTERED = Transition$1.ENTERING = Transition$1.EXITED = Transition$1.UNMOUNTED = void 0;
73811
- var PropTypes = _interopRequireWildcard(propTypesExports);
73841
+ var PropTypes = _interopRequireWildcard(requirePropTypes());
73812
73842
  var _react$1 = _interopRequireDefault$1(React__default);
73813
73843
  var _reactDom = _interopRequireDefault$1(require$$2$1);
73814
73844
  var _reactLifecyclesCompat = require$$2;
@@ -74126,7 +74156,7 @@ Transition$1.default = _default;
74126
74156
  (function(module2, exports2) {
74127
74157
  exports2.__esModule = true;
74128
74158
  exports2.default = void 0;
74129
- _interopRequireWildcard2(propTypesExports);
74159
+ _interopRequireWildcard2(requirePropTypes());
74130
74160
  var _addClass = _interopRequireDefault2(addClassExports);
74131
74161
  var _removeClass = _interopRequireDefault2(removeClass);
74132
74162
  var _react3 = _interopRequireDefault2(React__default);
@@ -74409,7 +74439,7 @@ __name(getNextChildMapping, "getNextChildMapping");
74409
74439
  (function(module2, exports2) {
74410
74440
  exports2.__esModule = true;
74411
74441
  exports2.default = void 0;
74412
- var _propTypes2 = _interopRequireDefault2(propTypesExports);
74442
+ var _propTypes2 = _interopRequireDefault2(requirePropTypes());
74413
74443
  var _react3 = _interopRequireDefault2(React__default);
74414
74444
  var _reactLifecyclesCompat2 = require$$2;
74415
74445
  var _ChildMapping = ChildMapping;
@@ -74563,7 +74593,7 @@ var TransitionGroupExports = TransitionGroup.exports;
74563
74593
  (function(module2, exports2) {
74564
74594
  exports2.__esModule = true;
74565
74595
  exports2.default = void 0;
74566
- _interopRequireDefault2(propTypesExports);
74596
+ _interopRequireDefault2(requirePropTypes());
74567
74597
  var _react3 = _interopRequireDefault2(React__default);
74568
74598
  var _reactDom2 = require$$2$1;
74569
74599
  var _TransitionGroup2 = _interopRequireDefault2(TransitionGroupExports);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@teselagen/ui",
3
- "version": "0.4.18",
3
+ "version": "0.4.19-beta.2",
4
4
  "main": "./src/index.js",
5
5
  "exports": {
6
6
  ".": {
@@ -19,7 +19,6 @@
19
19
  "@dnd-kit/core": "^6.1.0",
20
20
  "@dnd-kit/modifiers": "^7.0.0",
21
21
  "@dnd-kit/sortable": "^8.0.0",
22
- "@dnd-kit/utilities": "3.2.2",
23
22
  "@teselagen/react-table": "6.10.16",
24
23
  "bluebird": "3.7.2",
25
24
  "buffer": "5.7.1",
@@ -0,0 +1,388 @@
1
+ import { Button, FormGroup, Position, Tooltip } from "@blueprintjs/core";
2
+ import { useCallback, useContext, useEffect, useRef, useState } from "react";
3
+ import {
4
+ AssignDefaultsModeContext,
5
+ WorkflowDefaultParamsContext,
6
+ workflowDefaultParamsObj
7
+ } from "../AssignDefaultsModeContext";
8
+ import { difference, isEqual, kebabCase } from "lodash-es";
9
+ import {
10
+ fakeWait,
11
+ getIntent,
12
+ getIntentClass,
13
+ LabelWithTooltipInfo
14
+ } from "./utils";
15
+ import useDeepCompareEffect from "use-deep-compare-effect";
16
+ import { change } from "redux-form";
17
+ import popoverOverflowModifiers from "../utils/popoverOverflowModifiers";
18
+ import classNames from "classnames";
19
+
20
+ const AbstractInput = props => {
21
+ const {
22
+ defaultValue,
23
+ meta: { dispatch, form, touched, error, warning },
24
+ onDefaultValChanged,
25
+ onFieldSubmit,
26
+ children,
27
+ tooltipProps,
28
+ tooltipError,
29
+ disabled,
30
+ intent,
31
+ tooltipInfo,
32
+ label,
33
+ inlineLabel,
34
+ isLabelTooltip,
35
+ secondaryLabel,
36
+ className,
37
+ showErrorIfUntouched,
38
+ asyncValidating,
39
+ containerStyle,
40
+ leftEl,
41
+ rightEl,
42
+ labelStyle,
43
+ noOuterLabel,
44
+ fileLimit,
45
+ noMarginBottom,
46
+ assignDefaultButton,
47
+ showGenerateDefaultDot,
48
+ setAssignDefaultsMode,
49
+ startAssigningDefault,
50
+ input,
51
+ noFillField,
52
+ isRequired,
53
+ isLoadingDefaultValue,
54
+ enableReinitialize,
55
+ defaultValCount
56
+ } = props;
57
+
58
+ const prevProps = useRef({ defaultValue, defaultValCount });
59
+
60
+ const updateDefaultValue = useCallback(() => {
61
+ dispatch(change(form, input.name, defaultValue));
62
+ onDefaultValChanged &&
63
+ onDefaultValChanged(defaultValue, input.name, form, props);
64
+ onFieldSubmit && onFieldSubmit(defaultValue);
65
+ }, [
66
+ defaultValue,
67
+ dispatch,
68
+ form,
69
+ input.name,
70
+ onDefaultValChanged,
71
+ onFieldSubmit,
72
+ props
73
+ ]);
74
+
75
+ useEffect(() => {
76
+ if (
77
+ ((input.value !== false && !input.value) || enableReinitialize) &&
78
+ defaultValue !== undefined
79
+ ) {
80
+ updateDefaultValue();
81
+ }
82
+ }, [defaultValue, enableReinitialize, input.value, updateDefaultValue]);
83
+
84
+ useEffect(() => {
85
+ const {
86
+ defaultValue: oldDefaultValue,
87
+ defaultValCount: oldDefaultValCount
88
+ } = prevProps.current;
89
+
90
+ if (
91
+ ((input.value !== false && !input.value) ||
92
+ enableReinitialize ||
93
+ defaultValCount !== oldDefaultValCount) &&
94
+ !isEqual(defaultValue, oldDefaultValue)
95
+ ) {
96
+ updateDefaultValue();
97
+ }
98
+
99
+ prevProps.current = { defaultValue, defaultValCount };
100
+ }, [
101
+ defaultValue,
102
+ defaultValCount,
103
+ enableReinitialize,
104
+ input.value,
105
+ updateDefaultValue
106
+ ]);
107
+
108
+ // if our custom field level validation is happening then we don't want to show the error visually
109
+ const showError =
110
+ (touched || showErrorIfUntouched) && error && !asyncValidating;
111
+ const showWarning = (touched || showErrorIfUntouched) && warning;
112
+ let componentToWrap =
113
+ isLabelTooltip || tooltipError ? (
114
+ <Tooltip
115
+ disabled={isLabelTooltip ? false : !showError}
116
+ intent={isLabelTooltip ? "none" : error ? "danger" : "warning"}
117
+ content={isLabelTooltip ? label : error || warning}
118
+ position={Position.TOP}
119
+ modifiers={popoverOverflowModifiers}
120
+ {...tooltipProps}
121
+ >
122
+ {children}
123
+ </Tooltip>
124
+ ) : (
125
+ children
126
+ );
127
+ const testClassName = "tg-test-" + kebabCase(input.name);
128
+ if (noFillField) {
129
+ componentToWrap = <div className="tg-no-fill-field">{componentToWrap}</div>;
130
+ }
131
+
132
+ let helperText;
133
+ if (!tooltipError) {
134
+ if (showError) {
135
+ helperText = error;
136
+ } else if (showWarning) {
137
+ helperText = warning;
138
+ }
139
+ }
140
+
141
+ // if in a cypress test show message so that inputs will not be interactable
142
+ if (window.Cypress && isLoadingDefaultValue) {
143
+ return "Loading default value...";
144
+ }
145
+
146
+ let labelInfo = secondaryLabel;
147
+
148
+ const hasOuterLabel = !noOuterLabel && !isLabelTooltip;
149
+ function getFileLimitInfo() {
150
+ if (!fileLimit) return "";
151
+ return `max ${fileLimit} file${fileLimit === 1 ? "" : "s"}`;
152
+ }
153
+
154
+ if (isRequired && hasOuterLabel && label && !labelInfo) {
155
+ labelInfo = `(required${fileLimit ? `, ${getFileLimitInfo()}` : ""})`;
156
+ } else if (!labelInfo && fileLimit) {
157
+ labelInfo = `(${getFileLimitInfo()})`;
158
+ }
159
+
160
+ return (
161
+ <FormGroup
162
+ className={classNames(className, testClassName, {
163
+ "tg-flex-form-content": leftEl || rightEl,
164
+ "tg-tooltipError": tooltipError,
165
+ "tg-has-error": showError && error
166
+ })}
167
+ disabled={disabled}
168
+ helperText={helperText}
169
+ intent={intent}
170
+ label={
171
+ hasOuterLabel && (
172
+ <LabelWithTooltipInfo
173
+ labelStyle={labelStyle}
174
+ label={label}
175
+ tooltipInfo={tooltipInfo}
176
+ />
177
+ )
178
+ }
179
+ inline={inlineLabel}
180
+ labelInfo={labelInfo}
181
+ style={{
182
+ ...(noMarginBottom && { marginBottom: 0 }),
183
+ ...containerStyle
184
+ }}
185
+ >
186
+ {showGenerateDefaultDot && (
187
+ <div style={{ zIndex: 10, position: "relative", height: 0, width: 0 }}>
188
+ <div style={{ position: "absolute", left: "0px", top: "0px" }}>
189
+ <Tooltip
190
+ modifiers={popoverOverflowModifiers}
191
+ content="Allows a Default to be Set. Click to Enter Set Default Mode (or press Shift+D when outside the input field)"
192
+ >
193
+ <div
194
+ onClick={() => {
195
+ setAssignDefaultsMode(true);
196
+ startAssigningDefault();
197
+ }}
198
+ className="generateDefaultDot"
199
+ ></div>
200
+ </Tooltip>
201
+ </div>
202
+ </div>
203
+ )}
204
+ {assignDefaultButton}
205
+ {leftEl} {componentToWrap} {rightEl}
206
+ </FormGroup>
207
+ );
208
+ };
209
+
210
+ export const withAbstractWrapper = (ComponentToWrap, opts = {}) => {
211
+ return props => {
212
+ const {
213
+ massageDefaultIdValue,
214
+ generateDefaultValue,
215
+ defaultValueByIdOverride,
216
+ defaultValue: defaultValueFromProps,
217
+ isRequired,
218
+ ...rest
219
+ } = props;
220
+
221
+ //get is assign defaults mode
222
+ //if assign default value mode then add on to the component
223
+ const [defaultValCount, setDefaultValCount] = useState(0);
224
+ const [defaultValueFromBackend, setDefault] = useState();
225
+ const [allowUserOverride, setUserOverride] = useState(true);
226
+ const [isLoadingDefaultValue, setLoadingDefaultValue] = useState(false);
227
+ const { inAssignDefaultsMode, setAssignDefaultsMode } = useContext(
228
+ AssignDefaultsModeContext
229
+ );
230
+ // tnr: we might want to grab this context object off the window in the future and have it live in lims by default
231
+ // there is no reason for those vals to live in TRC. Example code below:
232
+ // const workflowParams = useContext(window.__tgDefaultValParamsContext || defaultNullContext);
233
+ const workflowParams = useContext(WorkflowDefaultParamsContext);
234
+
235
+ const caresAboutToolContext = generateDefaultValue?.params?.toolName;
236
+
237
+ const customParamsToUse = {
238
+ ...(caresAboutToolContext
239
+ ? { ...workflowDefaultParamsObj, ...workflowParams }
240
+ : {}),
241
+ ...(generateDefaultValue ? generateDefaultValue.customParams : {})
242
+ };
243
+
244
+ async function triggerGetDefault() {
245
+ if (!defaultValueByIdOverride) {
246
+ //if defaultValueByIdOverride is passed, we can skip over getting the value from the backend straight to massaging the default value
247
+ if (!window.__triggerGetDefaultValueRequest) return;
248
+ if (!generateDefaultValue) return;
249
+ setLoadingDefaultValue(true);
250
+ //custom params should match params keys. if not throw an error
251
+ const doParamsMatch = isEqual(
252
+ Object.keys({
253
+ ...(caresAboutToolContext ? workflowDefaultParamsObj : {}), //we don't want to compare these keys so we just spread them here
254
+ ...(generateDefaultValue.params || {})
255
+ }).sort(),
256
+ Object.keys(customParamsToUse).sort()
257
+ );
258
+ if (!doParamsMatch) {
259
+ console.warn(
260
+ `Issue with generateDefaultValue. customParams don't match params`
261
+ );
262
+ console.warn(
263
+ `generateDefaultValue.params:`,
264
+ generateDefaultValue.params
265
+ );
266
+ console.warn(`generateDefaultValue.customParams:`, customParamsToUse);
267
+ throw new Error(
268
+ `Issue with generateDefaultValue code=${
269
+ generateDefaultValue.code
270
+ }: Difference detected with: ${difference(
271
+ Object.keys(generateDefaultValue.params || {}),
272
+ Object.keys(customParamsToUse || {})
273
+ ).join(
274
+ ", "
275
+ )}. customParams passed into the field should match params (as defined in defaultValueConstants.js). See console for more details.`
276
+ );
277
+ }
278
+ }
279
+
280
+ try {
281
+ let { defaultValue, allowUserOverride } = defaultValueByIdOverride
282
+ ? { defaultValue: defaultValueByIdOverride }
283
+ : await window.__triggerGetDefaultValueRequest(
284
+ generateDefaultValue.code,
285
+ customParamsToUse
286
+ );
287
+ if (massageDefaultIdValue) {
288
+ const massagedRes = await massageDefaultIdValue({
289
+ defaultValueById: defaultValue
290
+ });
291
+ if (massagedRes.defaultValue) {
292
+ defaultValue = massagedRes.defaultValue;
293
+ }
294
+ if (massagedRes.preventUserOverrideFromBeingDisabled) {
295
+ allowUserOverride = true;
296
+ }
297
+ }
298
+
299
+ // TODO:Add ths back in when we have a better way to determine if a field is a checkbox or switch
300
+ // if (
301
+ // "false" === false
302
+ // // ComponentToWrap === renderBlueprintCheckbox ||
303
+ // // ComponentToWrap === renderBlueprintSwitch
304
+ // ) {
305
+ // setDefault(defaultValue === "true");
306
+ // } else {
307
+ if (typeof defaultValue === "string") {
308
+ // remove double spaces and leading/trailing
309
+ defaultValue = defaultValue.replace(/\s+/g, " ").trim();
310
+ }
311
+ setDefault(defaultValue);
312
+ // }
313
+ setUserOverride(allowUserOverride);
314
+ setDefaultValCount(defaultValCount + 1);
315
+ } catch (error) {
316
+ console.error(`error aswf298f:`, error);
317
+ }
318
+ if (window.Cypress && window.Cypress.addFakeDefaultValueWait) {
319
+ await fakeWait();
320
+ }
321
+ setLoadingDefaultValue(false);
322
+ }
323
+ // if generateDefaultValue, hit the backend for that value
324
+ useDeepCompareEffect(() => {
325
+ // if the input already has a value we don't want to override with the default value request
326
+ if (rest.input.value) return;
327
+ triggerGetDefault();
328
+ }, [generateDefaultValue || {}]);
329
+ // const asyncValidating = props.asyncValidating;
330
+ const defaultProps = {
331
+ ...rest,
332
+ defaultValue: defaultValueFromBackend || defaultValueFromProps,
333
+ disabled: props.disabled || allowUserOverride === false,
334
+ readOnly: props.readOnly || isLoadingDefaultValue,
335
+ intent: getIntent(props),
336
+ intentClass: getIntentClass(props)
337
+ };
338
+
339
+ // don't show intent while async validating
340
+ // if (asyncValidating) {
341
+ // delete defaultProps.intent;
342
+ // delete defaultProps.intentClass;
343
+ // }
344
+
345
+ const startAssigningDefault = () =>
346
+ window.__showAssignDefaultValueModal &&
347
+ window.__showAssignDefaultValueModal({
348
+ ...props,
349
+ generateDefaultValue: {
350
+ ...props.generateDefaultValue,
351
+ customParams: customParamsToUse
352
+ },
353
+ onFinish: () => {
354
+ triggerGetDefault();
355
+ }
356
+ });
357
+
358
+ return (
359
+ <AbstractInput
360
+ {...{
361
+ ...opts,
362
+ defaultValCount,
363
+ isRequired,
364
+ ...defaultProps,
365
+ isLoadingDefaultValue,
366
+ showGenerateDefaultDot:
367
+ !inAssignDefaultsMode &&
368
+ window.__showGenerateDefaultDot &&
369
+ window.__showGenerateDefaultDot() &&
370
+ !!generateDefaultValue,
371
+ setAssignDefaultsMode,
372
+ startAssigningDefault,
373
+ assignDefaultButton: inAssignDefaultsMode && generateDefaultValue && (
374
+ <Button
375
+ onClick={startAssigningDefault}
376
+ small
377
+ style={{ background: "yellow", color: "black" }}
378
+ >
379
+ Assign Default
380
+ </Button>
381
+ )
382
+ }}
383
+ >
384
+ <ComponentToWrap {...defaultProps} />
385
+ </AbstractInput>
386
+ );
387
+ };
388
+ };
@@ -925,8 +925,12 @@ export const renderBlueprintNumericInput = props => {
925
925
  {...(hideValue ? { value: "" } : {})}
926
926
  className={classNames(Classes.FILL, inputClassName)}
927
927
  onValueChange={(numericVal, stringVal) => {
928
- // needed for redux form to change value
929
- input.onChange(stringVal);
928
+ if (isNumber(stringVal)) {
929
+ input.onChange(numericVal);
930
+ } else {
931
+ // Allows to keep match expressions and empty strings
932
+ input.onChange(stringVal);
933
+ }
930
934
  //tnr: use this handler if you want to listen to all value changes!
931
935
  onAnyNumberChange && onAnyNumberChange(numericVal);
932
936
  }}