pollination-react-io 0.0.44 → 0.0.45-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.
package/build/index.js CHANGED
@@ -242,7 +242,7 @@ function isNumber(val) {
242
242
  * @param {Object} val The value to test
243
243
  * @returns {boolean} True if value is an Object, otherwise false
244
244
  */
245
- function isObject$1(val) {
245
+ function isObject$2(val) {
246
246
  return val !== null && typeof val === 'object';
247
247
  }
248
248
 
@@ -314,7 +314,7 @@ function isFunction(val) {
314
314
  * @returns {boolean} True if value is a Stream, otherwise false
315
315
  */
316
316
  function isStream(val) {
317
- return isObject$1(val) && isFunction(val.pipe);
317
+ return isObject$2(val) && isFunction(val.pipe);
318
318
  }
319
319
 
320
320
  /**
@@ -581,7 +581,7 @@ var utils = {
581
581
  isArrayBufferView: isArrayBufferView,
582
582
  isString: isString,
583
583
  isNumber: isNumber,
584
- isObject: isObject$1,
584
+ isObject: isObject$2,
585
585
  isPlainObject: isPlainObject$1,
586
586
  isUndefined: isUndefined,
587
587
  isDate: isDate,
@@ -25441,7 +25441,7 @@ function isOrContainsNode(parent, child, environment) {
25441
25441
  */
25442
25442
 
25443
25443
 
25444
- function debounce(fn, time) {
25444
+ function debounce$1(fn, time) {
25445
25445
  var timeoutId;
25446
25446
 
25447
25447
  function cancel() {
@@ -25805,7 +25805,7 @@ if (process.env.NODE_ENV !== 'production') {
25805
25805
  };
25806
25806
  }
25807
25807
 
25808
- var cleanupStatus = debounce(function (documentProp) {
25808
+ var cleanupStatus = debounce$1(function (documentProp) {
25809
25809
  getStatusDiv(documentProp).textContent = '';
25810
25810
  }, 500);
25811
25811
  /**
@@ -26591,7 +26591,7 @@ var Downshift = /*#__PURE__*/function () {
26591
26591
  }, cb);
26592
26592
  };
26593
26593
 
26594
- _this.updateStatus = debounce(function () {
26594
+ _this.updateStatus = debounce$1(function () {
26595
26595
  var state = _this.getState();
26596
26596
 
26597
26597
  var item = _this.items[state.highlightedIndex];
@@ -27135,7 +27135,7 @@ function getA11ySelectionMessage(selectionParameters) {
27135
27135
  */
27136
27136
 
27137
27137
 
27138
- var updateA11yStatus = debounce(function (getA11yMessage, document) {
27138
+ var updateA11yStatus = debounce$1(function (getA11yMessage, document) {
27139
27139
  setStatus(getA11yMessage(), document);
27140
27140
  }, 200); // istanbul ignore next
27141
27141
 
@@ -28973,6 +28973,384 @@ var slugify = createCommonjsModule(function (module, exports) {
28973
28973
  }));
28974
28974
  });
28975
28975
 
28976
+ /**
28977
+ * lodash (Custom Build) <https://lodash.com/>
28978
+ * Build: `lodash modularize exports="npm" -o ./`
28979
+ * Copyright jQuery Foundation and other contributors <https://jquery.org/>
28980
+ * Released under MIT license <https://lodash.com/license>
28981
+ * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
28982
+ * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
28983
+ */
28984
+
28985
+ /** Used as the `TypeError` message for "Functions" methods. */
28986
+ var FUNC_ERROR_TEXT = 'Expected a function';
28987
+
28988
+ /** Used as references for various `Number` constants. */
28989
+ var NAN = 0 / 0;
28990
+
28991
+ /** `Object#toString` result references. */
28992
+ var symbolTag = '[object Symbol]';
28993
+
28994
+ /** Used to match leading and trailing whitespace. */
28995
+ var reTrim = /^\s+|\s+$/g;
28996
+
28997
+ /** Used to detect bad signed hexadecimal string values. */
28998
+ var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
28999
+
29000
+ /** Used to detect binary string values. */
29001
+ var reIsBinary = /^0b[01]+$/i;
29002
+
29003
+ /** Used to detect octal string values. */
29004
+ var reIsOctal = /^0o[0-7]+$/i;
29005
+
29006
+ /** Built-in method references without a dependency on `root`. */
29007
+ var freeParseInt = parseInt;
29008
+
29009
+ /** Detect free variable `global` from Node.js. */
29010
+ var freeGlobal = typeof commonjsGlobal == 'object' && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
29011
+
29012
+ /** Detect free variable `self`. */
29013
+ var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
29014
+
29015
+ /** Used as a reference to the global object. */
29016
+ var root = freeGlobal || freeSelf || Function('return this')();
29017
+
29018
+ /** Used for built-in method references. */
29019
+ var objectProto = Object.prototype;
29020
+
29021
+ /**
29022
+ * Used to resolve the
29023
+ * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
29024
+ * of values.
29025
+ */
29026
+ var objectToString = objectProto.toString;
29027
+
29028
+ /* Built-in method references for those with the same name as other `lodash` methods. */
29029
+ var nativeMax = Math.max,
29030
+ nativeMin = Math.min;
29031
+
29032
+ /**
29033
+ * Gets the timestamp of the number of milliseconds that have elapsed since
29034
+ * the Unix epoch (1 January 1970 00:00:00 UTC).
29035
+ *
29036
+ * @static
29037
+ * @memberOf _
29038
+ * @since 2.4.0
29039
+ * @category Date
29040
+ * @returns {number} Returns the timestamp.
29041
+ * @example
29042
+ *
29043
+ * _.defer(function(stamp) {
29044
+ * console.log(_.now() - stamp);
29045
+ * }, _.now());
29046
+ * // => Logs the number of milliseconds it took for the deferred invocation.
29047
+ */
29048
+ var now = function() {
29049
+ return root.Date.now();
29050
+ };
29051
+
29052
+ /**
29053
+ * Creates a debounced function that delays invoking `func` until after `wait`
29054
+ * milliseconds have elapsed since the last time the debounced function was
29055
+ * invoked. The debounced function comes with a `cancel` method to cancel
29056
+ * delayed `func` invocations and a `flush` method to immediately invoke them.
29057
+ * Provide `options` to indicate whether `func` should be invoked on the
29058
+ * leading and/or trailing edge of the `wait` timeout. The `func` is invoked
29059
+ * with the last arguments provided to the debounced function. Subsequent
29060
+ * calls to the debounced function return the result of the last `func`
29061
+ * invocation.
29062
+ *
29063
+ * **Note:** If `leading` and `trailing` options are `true`, `func` is
29064
+ * invoked on the trailing edge of the timeout only if the debounced function
29065
+ * is invoked more than once during the `wait` timeout.
29066
+ *
29067
+ * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
29068
+ * until to the next tick, similar to `setTimeout` with a timeout of `0`.
29069
+ *
29070
+ * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
29071
+ * for details over the differences between `_.debounce` and `_.throttle`.
29072
+ *
29073
+ * @static
29074
+ * @memberOf _
29075
+ * @since 0.1.0
29076
+ * @category Function
29077
+ * @param {Function} func The function to debounce.
29078
+ * @param {number} [wait=0] The number of milliseconds to delay.
29079
+ * @param {Object} [options={}] The options object.
29080
+ * @param {boolean} [options.leading=false]
29081
+ * Specify invoking on the leading edge of the timeout.
29082
+ * @param {number} [options.maxWait]
29083
+ * The maximum time `func` is allowed to be delayed before it's invoked.
29084
+ * @param {boolean} [options.trailing=true]
29085
+ * Specify invoking on the trailing edge of the timeout.
29086
+ * @returns {Function} Returns the new debounced function.
29087
+ * @example
29088
+ *
29089
+ * // Avoid costly calculations while the window size is in flux.
29090
+ * jQuery(window).on('resize', _.debounce(calculateLayout, 150));
29091
+ *
29092
+ * // Invoke `sendMail` when clicked, debouncing subsequent calls.
29093
+ * jQuery(element).on('click', _.debounce(sendMail, 300, {
29094
+ * 'leading': true,
29095
+ * 'trailing': false
29096
+ * }));
29097
+ *
29098
+ * // Ensure `batchLog` is invoked once after 1 second of debounced calls.
29099
+ * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });
29100
+ * var source = new EventSource('/stream');
29101
+ * jQuery(source).on('message', debounced);
29102
+ *
29103
+ * // Cancel the trailing debounced invocation.
29104
+ * jQuery(window).on('popstate', debounced.cancel);
29105
+ */
29106
+ function debounce(func, wait, options) {
29107
+ var lastArgs,
29108
+ lastThis,
29109
+ maxWait,
29110
+ result,
29111
+ timerId,
29112
+ lastCallTime,
29113
+ lastInvokeTime = 0,
29114
+ leading = false,
29115
+ maxing = false,
29116
+ trailing = true;
29117
+
29118
+ if (typeof func != 'function') {
29119
+ throw new TypeError(FUNC_ERROR_TEXT);
29120
+ }
29121
+ wait = toNumber(wait) || 0;
29122
+ if (isObject$1(options)) {
29123
+ leading = !!options.leading;
29124
+ maxing = 'maxWait' in options;
29125
+ maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
29126
+ trailing = 'trailing' in options ? !!options.trailing : trailing;
29127
+ }
29128
+
29129
+ function invokeFunc(time) {
29130
+ var args = lastArgs,
29131
+ thisArg = lastThis;
29132
+
29133
+ lastArgs = lastThis = undefined;
29134
+ lastInvokeTime = time;
29135
+ result = func.apply(thisArg, args);
29136
+ return result;
29137
+ }
29138
+
29139
+ function leadingEdge(time) {
29140
+ // Reset any `maxWait` timer.
29141
+ lastInvokeTime = time;
29142
+ // Start the timer for the trailing edge.
29143
+ timerId = setTimeout(timerExpired, wait);
29144
+ // Invoke the leading edge.
29145
+ return leading ? invokeFunc(time) : result;
29146
+ }
29147
+
29148
+ function remainingWait(time) {
29149
+ var timeSinceLastCall = time - lastCallTime,
29150
+ timeSinceLastInvoke = time - lastInvokeTime,
29151
+ result = wait - timeSinceLastCall;
29152
+
29153
+ return maxing ? nativeMin(result, maxWait - timeSinceLastInvoke) : result;
29154
+ }
29155
+
29156
+ function shouldInvoke(time) {
29157
+ var timeSinceLastCall = time - lastCallTime,
29158
+ timeSinceLastInvoke = time - lastInvokeTime;
29159
+
29160
+ // Either this is the first call, activity has stopped and we're at the
29161
+ // trailing edge, the system time has gone backwards and we're treating
29162
+ // it as the trailing edge, or we've hit the `maxWait` limit.
29163
+ return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||
29164
+ (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));
29165
+ }
29166
+
29167
+ function timerExpired() {
29168
+ var time = now();
29169
+ if (shouldInvoke(time)) {
29170
+ return trailingEdge(time);
29171
+ }
29172
+ // Restart the timer.
29173
+ timerId = setTimeout(timerExpired, remainingWait(time));
29174
+ }
29175
+
29176
+ function trailingEdge(time) {
29177
+ timerId = undefined;
29178
+
29179
+ // Only invoke if we have `lastArgs` which means `func` has been
29180
+ // debounced at least once.
29181
+ if (trailing && lastArgs) {
29182
+ return invokeFunc(time);
29183
+ }
29184
+ lastArgs = lastThis = undefined;
29185
+ return result;
29186
+ }
29187
+
29188
+ function cancel() {
29189
+ if (timerId !== undefined) {
29190
+ clearTimeout(timerId);
29191
+ }
29192
+ lastInvokeTime = 0;
29193
+ lastArgs = lastCallTime = lastThis = timerId = undefined;
29194
+ }
29195
+
29196
+ function flush() {
29197
+ return timerId === undefined ? result : trailingEdge(now());
29198
+ }
29199
+
29200
+ function debounced() {
29201
+ var time = now(),
29202
+ isInvoking = shouldInvoke(time);
29203
+
29204
+ lastArgs = arguments;
29205
+ lastThis = this;
29206
+ lastCallTime = time;
29207
+
29208
+ if (isInvoking) {
29209
+ if (timerId === undefined) {
29210
+ return leadingEdge(lastCallTime);
29211
+ }
29212
+ if (maxing) {
29213
+ // Handle invocations in a tight loop.
29214
+ timerId = setTimeout(timerExpired, wait);
29215
+ return invokeFunc(lastCallTime);
29216
+ }
29217
+ }
29218
+ if (timerId === undefined) {
29219
+ timerId = setTimeout(timerExpired, wait);
29220
+ }
29221
+ return result;
29222
+ }
29223
+ debounced.cancel = cancel;
29224
+ debounced.flush = flush;
29225
+ return debounced;
29226
+ }
29227
+
29228
+ /**
29229
+ * Checks if `value` is the
29230
+ * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
29231
+ * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
29232
+ *
29233
+ * @static
29234
+ * @memberOf _
29235
+ * @since 0.1.0
29236
+ * @category Lang
29237
+ * @param {*} value The value to check.
29238
+ * @returns {boolean} Returns `true` if `value` is an object, else `false`.
29239
+ * @example
29240
+ *
29241
+ * _.isObject({});
29242
+ * // => true
29243
+ *
29244
+ * _.isObject([1, 2, 3]);
29245
+ * // => true
29246
+ *
29247
+ * _.isObject(_.noop);
29248
+ * // => true
29249
+ *
29250
+ * _.isObject(null);
29251
+ * // => false
29252
+ */
29253
+ function isObject$1(value) {
29254
+ var type = typeof value;
29255
+ return !!value && (type == 'object' || type == 'function');
29256
+ }
29257
+
29258
+ /**
29259
+ * Checks if `value` is object-like. A value is object-like if it's not `null`
29260
+ * and has a `typeof` result of "object".
29261
+ *
29262
+ * @static
29263
+ * @memberOf _
29264
+ * @since 4.0.0
29265
+ * @category Lang
29266
+ * @param {*} value The value to check.
29267
+ * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
29268
+ * @example
29269
+ *
29270
+ * _.isObjectLike({});
29271
+ * // => true
29272
+ *
29273
+ * _.isObjectLike([1, 2, 3]);
29274
+ * // => true
29275
+ *
29276
+ * _.isObjectLike(_.noop);
29277
+ * // => false
29278
+ *
29279
+ * _.isObjectLike(null);
29280
+ * // => false
29281
+ */
29282
+ function isObjectLike(value) {
29283
+ return !!value && typeof value == 'object';
29284
+ }
29285
+
29286
+ /**
29287
+ * Checks if `value` is classified as a `Symbol` primitive or object.
29288
+ *
29289
+ * @static
29290
+ * @memberOf _
29291
+ * @since 4.0.0
29292
+ * @category Lang
29293
+ * @param {*} value The value to check.
29294
+ * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
29295
+ * @example
29296
+ *
29297
+ * _.isSymbol(Symbol.iterator);
29298
+ * // => true
29299
+ *
29300
+ * _.isSymbol('abc');
29301
+ * // => false
29302
+ */
29303
+ function isSymbol(value) {
29304
+ return typeof value == 'symbol' ||
29305
+ (isObjectLike(value) && objectToString.call(value) == symbolTag);
29306
+ }
29307
+
29308
+ /**
29309
+ * Converts `value` to a number.
29310
+ *
29311
+ * @static
29312
+ * @memberOf _
29313
+ * @since 4.0.0
29314
+ * @category Lang
29315
+ * @param {*} value The value to process.
29316
+ * @returns {number} Returns the number.
29317
+ * @example
29318
+ *
29319
+ * _.toNumber(3.2);
29320
+ * // => 3.2
29321
+ *
29322
+ * _.toNumber(Number.MIN_VALUE);
29323
+ * // => 5e-324
29324
+ *
29325
+ * _.toNumber(Infinity);
29326
+ * // => Infinity
29327
+ *
29328
+ * _.toNumber('3.2');
29329
+ * // => 3.2
29330
+ */
29331
+ function toNumber(value) {
29332
+ if (typeof value == 'number') {
29333
+ return value;
29334
+ }
29335
+ if (isSymbol(value)) {
29336
+ return NAN;
29337
+ }
29338
+ if (isObject$1(value)) {
29339
+ var other = typeof value.valueOf == 'function' ? value.valueOf() : value;
29340
+ value = isObject$1(other) ? (other + '') : other;
29341
+ }
29342
+ if (typeof value != 'string') {
29343
+ return value === 0 ? value : +value;
29344
+ }
29345
+ value = value.replace(reTrim, '');
29346
+ var isBinary = reIsBinary.test(value);
29347
+ return (isBinary || reIsOctal.test(value))
29348
+ ? freeParseInt(value.slice(2), isBinary ? 2 : 8)
29349
+ : (reIsBadHex.test(value) ? NAN : +value);
29350
+ }
29351
+
29352
+ var lodash_debounce = debounce;
29353
+
28976
29354
  function styleInject(css, ref) {
28977
29355
  if ( ref === void 0 ) ref = {};
28978
29356
  var insertAt = ref.insertAt;
@@ -30618,11 +30996,16 @@ var PerfectScrollbar = /*@__PURE__*/getDefaultExportFromCjs(lib);
30618
30996
 
30619
30997
  var ICON_SIZE = 18;
30620
30998
  var ComboBox = React__default["default"].forwardRef(function ComboBox(_a, ref) {
30621
- var items = _a.items, renderItem = _a.renderItem, setSelected = _a.setSelected, _b = _a.disabled, disabled = _b === void 0 ? false : _b, _c = _a.loading, loading = _c === void 0 ? false : _c, inputStyle = _a.inputStyle, menuStyle = _a.menuStyle, inputProps = _a.inputProps, footer = _a.footer, _d = _a.noMatchText, noMatchText = _d === void 0 ? 'No matching items' : _d, environment = _a.environment;
30999
+ var items = _a.items, renderItem = _a.renderItem, setSelected = _a.setSelected, _b = _a.disabled, disabled = _b === void 0 ? false : _b, _c = _a.loading, loading = _c === void 0 ? false : _c, inputStyle = _a.inputStyle, menuStyle = _a.menuStyle, inputProps = _a.inputProps, footer = _a.footer, _d = _a.noMatchText, noMatchText = _d === void 0 ? 'No matching items' : _d; _a.environment; var onScrollReachEnd = _a.onScrollReachEnd;
30622
31000
  var _e = React.useState(items), inputItems = _e[0], setInputItems = _e[1];
30623
31001
  React.useEffect(function () {
30624
31002
  setInputItems(items);
30625
31003
  }, [items]);
31004
+ var debouncedOnScrollReachEnd = React.useMemo(function () {
31005
+ return onScrollReachEnd ?
31006
+ lodash_debounce(onScrollReachEnd, 1000, { leading: true, trailing: false })
31007
+ : undefined;
31008
+ }, [onScrollReachEnd]);
30626
31009
  var _f = useCombobox({
30627
31010
  items: inputItems,
30628
31011
  onInputValueChange: function (_a) {
@@ -30635,8 +31018,9 @@ var ComboBox = React__default["default"].forwardRef(function ComboBox(_a, ref) {
30635
31018
  setInputItems(items);
30636
31019
  }
30637
31020
  },
30638
- environment: environment !== null && environment !== void 0 ? environment : undefined,
30639
- }), isOpen = _f.isOpen, getToggleButtonProps = _f.getToggleButtonProps, getMenuProps = _f.getMenuProps, getInputProps = _f.getInputProps, getComboboxProps = _f.getComboboxProps, highlightedIndex = _f.highlightedIndex, getItemProps = _f.getItemProps, openMenu = _f.openMenu, selectItem = _f.selectItem, selectedItem = _f.selectedItem, inputValue = _f.inputValue;
31021
+ // to what extent is this necessary?
31022
+ // environment: environment ? environment : undefined
31023
+ }), isOpen = _f.isOpen, getToggleButtonProps = _f.getToggleButtonProps, getMenuProps = _f.getMenuProps, getInputProps = _f.getInputProps, getComboboxProps = _f.getComboboxProps, highlightedIndex = _f.highlightedIndex, getItemProps = _f.getItemProps, openMenu = _f.openMenu, closeMenu = _f.closeMenu, selectItem = _f.selectItem, selectedItem = _f.selectedItem, inputValue = _f.inputValue;
30640
31024
  React.useImperativeHandle(ref, function () { return ({
30641
31025
  selectItem: selectItem,
30642
31026
  selectedItem: selectedItem,
@@ -30648,12 +31032,13 @@ var ComboBox = React__default["default"].forwardRef(function ComboBox(_a, ref) {
30648
31032
  if (setSelected) {
30649
31033
  setSelected(selectedItem);
30650
31034
  }
30651
- }, [selectedItem, setSelected]);
31035
+ closeMenu();
31036
+ }, [closeMenu, selectedItem, setSelected]);
30652
31037
  return (React__default["default"].createElement("div", { "data-testid": "ComboBoxSelect", className: "poll-combobox" },
30653
31038
  React__default["default"].createElement("div", __assign$3({}, getComboboxProps(), { style: __assign$3(__assign$3({}, inputStyle), { position: 'relative', width: '100%' }), className: "poll-combo-group ".concat(disabled && 'poll-combo-group-disabled') }),
30654
31039
  React__default["default"].createElement("input", __assign$3({}, getInputProps(__assign$3(__assign$3({ placeholder: 'Search for something...' }, inputProps), { onFocus: function () {
30655
31040
  openMenu();
30656
- } })), { disabled: disabled, style: {
31041
+ } })), { spellCheck: false, disabled: disabled, style: {
30657
31042
  paddingLeft: 50,
30658
31043
  borderTopLeftRadius: 4,
30659
31044
  borderBottomLeftRadius: isOpen ? 0 : 4,
@@ -30694,24 +31079,40 @@ var ComboBox = React__default["default"].forwardRef(function ComboBox(_a, ref) {
30694
31079
  padding: isOpen ? '6px 4px' : 0,
30695
31080
  visibility: isOpen ? undefined : 'hidden'
30696
31081
  } },
30697
- React__default["default"].createElement(PerfectScrollbar, null,
30698
- React__default["default"].createElement("ul", __assign$3({}, getMenuProps(), { style: __assign$3(__assign$3({}, menuStyle), { display: 'flex', width: '100%', boxSizing: 'border-box', zIndex: 100, padding: 0, flexDirection: 'column' }) }), inputItems.map(function (item, index) { return (React__default["default"].createElement("li", __assign$3({ className: "poll-combobox-item", style: highlightedIndex === index ? { backgroundColor: '#bde4ff' } : {}, key: "".concat(item.name, "-").concat(index) }, getItemProps({
31082
+ React__default["default"].createElement(PerfectScrollbar, { options: {
31083
+ wheelPropagation: false,
31084
+ }, onYReachEnd: function () {
31085
+ if (items.length < 1 || !isOpen)
31086
+ return;
31087
+ debouncedOnScrollReachEnd && debouncedOnScrollReachEnd();
31088
+ } },
31089
+ React__default["default"].createElement("ul", __assign$3({}, getMenuProps(), { style: __assign$3(__assign$3({}, menuStyle), { display: 'flex', width: '100%', boxSizing: 'border-box', zIndex: 100, padding: 0, flexDirection: 'column' }) }), inputItems.map(function (item, i, arr) { return (React__default["default"].createElement("li", __assign$3({ className: "poll-combobox-item", style: highlightedIndex === i ? { backgroundColor: '#bde4ff' } : {}, key: "".concat(item.name, "-").concat(i) }, getItemProps({
30699
31090
  item: item,
30700
- index: index,
30701
- isSelected: selectedItem === item,
30702
- })), renderItem ? renderItem(item) : item.name)); }))),
31091
+ index: i,
31092
+ isSelected: selectedItem && selectedItem.id === item.id,
31093
+ })), renderItem ? renderItem(item, i, arr) : item.name)); }))),
30703
31094
  React__default["default"].createElement("div", { className: 'poll-combo-footer-container', style: {
30704
31095
  opacity: isOpen ? 1 : 0
30705
31096
  } },
30706
31097
  React__default["default"].createElement(Root$8, { key: "poll-separator", className: "poll-separator" }),
30707
- inputItems.length > 0 && footer,
30708
- inputItems.length < 1
30709
- && (React__default["default"].createElement("div", { key: "footer", style: {
30710
- width: '100%',
31098
+ loading &&
31099
+ React__default["default"].createElement("div", { style: {
30711
31100
  display: 'flex',
31101
+ alignItems: 'center',
30712
31102
  justifyContent: 'center',
31103
+ background: 'var(--slate3)',
30713
31104
  color: 'var(--slate10)',
30714
- } }, noMatchText))))));
31105
+ padding: '6px 0px',
31106
+ } }, "Loading..."),
31107
+ inputItems.length > 0 && !loading && footer,
31108
+ inputItems.length < 1 && !loading &&
31109
+ React__default["default"].createElement("div", { key: "footer", style: {
31110
+ display: 'flex',
31111
+ alignItems: 'center',
31112
+ justifyContent: 'center',
31113
+ color: 'var(--slate10)',
31114
+ padding: '10px 0px',
31115
+ } }, noMatchText)))));
30715
31116
  });
30716
31117
 
30717
31118
  const r$3=React__namespace["useId".toString()]||(()=>{});let n$2=0;function useId(o){const[u,i]=React__namespace.useState(r$3());return useLayoutEffect((()=>{o||i((t=>null!=t?t:String(n$2++)));}),[o]),o||(u?`radix-${u}`:"")}
@@ -33807,6 +34208,50 @@ var SelectAccount = function (_a) {
33807
34208
  } }, "".concat(accounts === null || accounts === void 0 ? void 0 : accounts.total_count, " accounts"))) }));
33808
34209
  };
33809
34210
 
34211
+ var SelectStudy = function (_a) {
34212
+ var _b;
34213
+ var projectOwner = _a.projectOwner, authUser = _a.authUser, client = _a.client, setSelStudy = _a.setSelStudy, queryConfig = _a.queryConfig, environment = _a.environment;
34214
+ var _c = React.useState(), studies = _c[0], setStudies = _c[1];
34215
+ var comboBoxRef = React.useRef();
34216
+ var _d = React.useState(false), loading = _d[0], setLoading = _d[1];
34217
+ var fetchStudies = React.useCallback(function (owner) {
34218
+ if (!authUser)
34219
+ return;
34220
+ setLoading(true);
34221
+ client.jobs.listJobs(__assign$3({
34222
+ // @ts-ignore
34223
+ owner: owner, page: 1, perPage: 25 }, queryConfig))
34224
+ .then(function (_a) {
34225
+ var data = _a.data;
34226
+ setStudies(data);
34227
+ })
34228
+ .finally(function () {
34229
+ setLoading(false);
34230
+ });
34231
+ }, [authUser, client.jobs, queryConfig]);
34232
+ React.useEffect(function () {
34233
+ // recent selection on refetch
34234
+ if (comboBoxRef.current) {
34235
+ comboBoxRef.current.selectItem(null);
34236
+ }
34237
+ }, [queryConfig]);
34238
+ // initial fetch
34239
+ React.useEffect(function () {
34240
+ if (!authUser)
34241
+ return;
34242
+ var owner = projectOwner !== null && projectOwner !== void 0 ? projectOwner : authUser.username;
34243
+ fetchStudies(owner);
34244
+ }, [authUser, fetchStudies, projectOwner]);
34245
+ return (React__default["default"].createElement(ComboBox, { ref: comboBoxRef, environment: environment, items: (_b = studies === null || studies === void 0 ? void 0 : studies.resources.map(function (r) { var _a; return (__assign$3(__assign$3({}, r), { name: (_a = r.spec.name) !== null && _a !== void 0 ? _a : "".concat(r.recipe.metadata.name, " : ").concat(r.status.id.slice(0, 5), "...") })); })) !== null && _b !== void 0 ? _b : [], setSelected: setSelStudy, inputProps: {
34246
+ placeholder: 'Select a study...',
34247
+ }, loading: !client || loading, disabled: !client || !(queryConfig === null || queryConfig === void 0 ? void 0 : queryConfig.owner), footer: (React__default["default"].createElement("div", { key: "footer", style: {
34248
+ width: '100%',
34249
+ display: 'flex',
34250
+ justifyContent: 'center',
34251
+ color: 'var(--grey4)',
34252
+ } }, "".concat(studies === null || studies === void 0 ? void 0 : studies.total_count, " studies"))) }));
34253
+ };
34254
+
33810
34255
  var SelectProject = function (_a) {
33811
34256
  var _b;
33812
34257
  var authUser = _a.authUser, client = _a.client, setSelProject = _a.setSelProject, queryConfig = _a.queryConfig, environment = _a.environment;
@@ -33849,31 +34294,43 @@ var SelectProject = function (_a) {
33849
34294
  };
33850
34295
 
33851
34296
  var SelectRecipe = function (_a) {
33852
- var _b;
34297
+ var _b, _c;
33853
34298
  var projectName = _a.projectName, authUser = _a.authUser, client = _a.client, setSelRecipe = _a.setSelRecipe, environment = _a.environment;
33854
- var _c = React.useState(), recipes = _c[0], setRecipes = _c[1];
34299
+ var _d = React.useState(), recipes = _d[0], setRecipes = _d[1];
34300
+ var totalRecipesRef = React.useRef({
34301
+ loaded: 0,
34302
+ total: undefined
34303
+ });
34304
+ var _e = React.useState(0), total = _e[0], setTotal = _e[1];
34305
+ var _f = React.useState(1), page = _f[0], setPage = _f[1];
33855
34306
  var comboBoxRef = React.useRef();
33856
- var _d = React.useState(false), loading = _d[0], setLoading = _d[1];
34307
+ var _g = React.useState(false), loading = _g[0], setLoading = _g[1];
33857
34308
  var fetchRecipes = React.useCallback(function (name, owner) {
33858
34309
  if (!client)
33859
34310
  return;
34311
+ // we've already loaded all recipes
34312
+ var _a = totalRecipesRef.current, total = _a.total, loaded = _a.loaded;
34313
+ if (total && loaded >= total)
34314
+ return;
33860
34315
  setLoading(true);
33861
34316
  client.projects.getProjectRecipes({
33862
34317
  name: name,
33863
34318
  owner: owner,
33864
- page: 1,
34319
+ page: page,
33865
34320
  perPage: 10,
33866
34321
  })
33867
34322
  .then(function (_a) {
33868
34323
  var data = _a.data;
33869
- setRecipes(data);
34324
+ setRecipes(function (state) { return state ? __spreadArray$2(__spreadArray$2([], state, true), data.resources, true) : __spreadArray$2([], data.resources, true); });
34325
+ setTotal(data.total_count);
34326
+ totalRecipesRef.current.loaded += data.resources.length;
34327
+ totalRecipesRef.current.total = data.total_count;
33870
34328
  })
33871
34329
  .finally(function () {
33872
34330
  setLoading(false);
33873
34331
  });
33874
- }, [client]);
34332
+ }, [client, page]);
33875
34333
  React.useEffect(function () {
33876
- console.log(projectName);
33877
34334
  // recent selection on refetch
33878
34335
  if (comboBoxRef.current) {
33879
34336
  comboBoxRef.current.selectItem(null);
@@ -33885,9 +34342,20 @@ var SelectRecipe = function (_a) {
33885
34342
  return;
33886
34343
  fetchRecipes(projectName, authUser.username);
33887
34344
  }, [authUser, fetchRecipes, projectName]);
33888
- return (React__default["default"].createElement(ComboBox, { ref: comboBoxRef, environment: environment, items: (_b = recipes === null || recipes === void 0 ? void 0 : recipes.resources.map(function (r, i) { return (__assign$3(__assign$3({}, r), { name: r.metadata.name, id: "".concat(r.metadata.name, "-").concat(r.metadata.tag) })); })) !== null && _b !== void 0 ? _b : [], renderItem: function (item) { return (React__default["default"].createElement("div", { style: {
34345
+ var onScrollReachEnd = React.useCallback(function () {
34346
+ console.log(totalRecipesRef.current);
34347
+ var _a = totalRecipesRef.current, total = _a.total, loaded = _a.loaded;
34348
+ if (total && loaded >= total)
34349
+ return;
34350
+ setPage(function (p) {
34351
+ p++;
34352
+ return p;
34353
+ });
34354
+ }, []);
34355
+ return (React__default["default"].createElement(ComboBox, { ref: comboBoxRef, environment: environment, items: (_b = recipes === null || recipes === void 0 ? void 0 : recipes.map(function (r, i) { return (__assign$3(__assign$3({}, r), { name: "".concat(r.metadata.name, "-").concat(r.metadata.tag), id: "".concat(r.metadata.name, "-").concat(r.metadata.tag) })); })) !== null && _b !== void 0 ? _b : [], renderItem: function (item) { return (React__default["default"].createElement("div", { style: {
33889
34356
  display: 'flex',
33890
- gap: 16,
34357
+ alignItems: 'center',
34358
+ gap: 8,
33891
34359
  }, id: "".concat(item.metadata.name, "-").concat(item.metadata.tag) },
33892
34360
  React__default["default"].createElement(Avatar, { src: item.metadata.icon, alt: item.metadata.name, fallback: item.metadata.name, size: 24 }), "".concat(item.metadata.name, "-").concat(item.metadata.tag))); }, setSelected: setSelRecipe, inputProps: {
33893
34361
  placeholder: 'Select a recipe...',
@@ -33896,7 +34364,96 @@ var SelectRecipe = function (_a) {
33896
34364
  display: 'flex',
33897
34365
  justifyContent: 'center',
33898
34366
  color: 'var(--grey4)',
33899
- } }, "".concat(recipes === null || recipes === void 0 ? void 0 : recipes.total_count, " recipes"))) }));
34367
+ padding: '6px 0px',
34368
+ } }, "Showing ".concat((_c = recipes === null || recipes === void 0 ? void 0 : recipes.length) !== null && _c !== void 0 ? _c : 0, " of ").concat(total, " recipes"))), onScrollReachEnd: onScrollReachEnd }));
34369
+ };
34370
+
34371
+ var SelectRun = function (_a) {
34372
+ var _b, _c;
34373
+ var projectOwner = _a.projectOwner, projectName = _a.projectName, jobId = _a.jobId, authUser = _a.authUser, client = _a.client, setSelRun = _a.setSelRun, environment = _a.environment;
34374
+ var _d = React.useState(), runs = _d[0], setRuns = _d[1];
34375
+ var totalRunsRef = React.useRef({
34376
+ loaded: 0,
34377
+ total: undefined
34378
+ });
34379
+ var _e = React.useState(0), total = _e[0], setTotal = _e[1];
34380
+ var _f = React.useState(1), page = _f[0], setPage = _f[1];
34381
+ var comboBoxRef = React.useRef();
34382
+ var _g = React.useState(false), loading = _g[0], setLoading = _g[1];
34383
+ var fetchRuns = React.useCallback(function (name, owner, jobId) {
34384
+ if (!client)
34385
+ return;
34386
+ // we've already loaded all Runs
34387
+ var _a = totalRunsRef.current, total = _a.total, loaded = _a.loaded;
34388
+ if (total && loaded >= total)
34389
+ return;
34390
+ setLoading(true);
34391
+ client.runs.listRuns({
34392
+ name: name,
34393
+ owner: owner,
34394
+ jobId: jobId,
34395
+ page: page,
34396
+ perPage: 10,
34397
+ })
34398
+ .then(function (_a) {
34399
+ var data = _a.data;
34400
+ setRuns(function (state) { return state ? __spreadArray$2(__spreadArray$2([], state, true), data.resources, true) : __spreadArray$2([], data.resources, true); });
34401
+ setTotal(data.total_count);
34402
+ totalRunsRef.current.loaded += data.resources.length;
34403
+ totalRunsRef.current.total = data.total_count;
34404
+ })
34405
+ .finally(function () {
34406
+ setLoading(false);
34407
+ });
34408
+ }, [client, page]);
34409
+ React.useEffect(function () {
34410
+ // recent selection on refetch
34411
+ if (comboBoxRef.current) {
34412
+ comboBoxRef.current.selectItem(null);
34413
+ }
34414
+ }, [projectName]);
34415
+ // initial fetch
34416
+ React.useEffect(function () {
34417
+ if (!authUser || !projectName)
34418
+ return;
34419
+ var owner = projectOwner !== null && projectOwner !== void 0 ? projectOwner : authUser.username;
34420
+ fetchRuns(projectName, owner, jobId);
34421
+ }, [authUser, fetchRuns, jobId, projectName, projectOwner]);
34422
+ var onScrollReachEnd = React.useCallback(function () {
34423
+ var _a = totalRunsRef.current, total = _a.total, loaded = _a.loaded;
34424
+ if (total && loaded >= total)
34425
+ return;
34426
+ setPage(function (p) {
34427
+ p++;
34428
+ return p;
34429
+ });
34430
+ }, []);
34431
+ return (React__default["default"].createElement(ComboBox, { ref: comboBoxRef, environment: environment, items: (_b = runs === null || runs === void 0 ? void 0 : runs.map(function (r) { return (__assign$3(__assign$3({}, r), { name: "".concat(r.recipe.metadata.name, " : ").concat(r.status.status) })); })) !== null && _b !== void 0 ? _b : [], renderItem: function (item, i) { return (React__default["default"].createElement("div", { style: {
34432
+ display: 'flex',
34433
+ justifyContent: 'space-between',
34434
+ paddingRight: 14
34435
+ } },
34436
+ React__default["default"].createElement("div", { style: {
34437
+ display: 'flex',
34438
+ gap: 8,
34439
+ alignItems: 'center',
34440
+ }, id: "".concat(item.id) },
34441
+ React__default["default"].createElement(Avatar, { src: item.recipe.metadata.icon, alt: item.recipe.metadata.name, fallback: item.recipe.metadata.name, size: 24 }),
34442
+ React__default["default"].createElement("span", null, "".concat(item.recipe.metadata.name, " : ").concat(item.status.status))),
34443
+ React__default["default"].createElement("span", { style: {
34444
+ fontVariantNumeric: 'tabular-nums',
34445
+ width: 24,
34446
+ display: 'flex',
34447
+ justifyContent: 'flex-end'
34448
+ }, className: 'secondary' }, "".concat(i)))); }, setSelected: setSelRun, inputProps: {
34449
+ placeholder: 'Select a run...',
34450
+ }, loading: !client || loading, disabled: !client || !projectName, footer: (React__default["default"].createElement("div", { key: "footer", style: {
34451
+ width: '100%',
34452
+ display: 'flex',
34453
+ justifyContent: 'center',
34454
+ color: 'var(--grey4)',
34455
+ padding: '6px 0px',
34456
+ } }, "Showing ".concat((_c = runs === null || runs === void 0 ? void 0 : runs.length) !== null && _c !== void 0 ? _c : 0, " of ").concat(total, " recipes"))), onScrollReachEnd: onScrollReachEnd }));
33900
34457
  };
33901
34458
 
33902
34459
  var getAction$1 = function (key) {
@@ -34145,6 +34702,8 @@ exports.PreviewBakeModel = PreviewBakeModel;
34145
34702
  exports.SelectAccount = SelectAccount;
34146
34703
  exports.SelectProject = SelectProject;
34147
34704
  exports.SelectRecipe = SelectRecipe;
34705
+ exports.SelectRun = SelectRun;
34706
+ exports.SelectStudy = SelectStudy;
34148
34707
  exports.SendGeometry = SendGeometry;
34149
34708
  exports.SendModel = SendModel;
34150
34709
  exports.SendResults = SendResults;