@torq-north/react-tools 1.4.6 → 1.4.7

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.es.js CHANGED
@@ -480,7 +480,18 @@ function SelectFormField(_a) {
480
480
  var _a;
481
481
  setIsFocused(false);
482
482
  (_a = inputSlotProps === null || inputSlotProps === void 0 ? void 0 : inputSlotProps.onBlur) === null || _a === void 0 ? void 0 : _a.call(inputSlotProps, event);
483
- } }), select: __assign(__assign({}, textFieldSlotProps === null || textFieldSlotProps === void 0 ? void 0 : textFieldSlotProps.select), (hasEndAdornment && {
483
+ } }), select: __assign(__assign(__assign({}, textFieldSlotProps === null || textFieldSlotProps === void 0 ? void 0 : textFieldSlotProps.select), { onClose: function (e) {
484
+ var _a, _b;
485
+ typeof (textFieldSlotProps === null || textFieldSlotProps === void 0 ? void 0 : textFieldSlotProps.select) === "function"
486
+ ? undefined
487
+ : (_b = (_a = textFieldSlotProps === null || textFieldSlotProps === void 0 ? void 0 : textFieldSlotProps.select) === null || _a === void 0 ? void 0 : _a.onClose) === null || _b === void 0 ? void 0 : _b.call(_a, e);
488
+ //When opening a select and then moving the mouse away, the input does not register as
489
+ // being unhovered. We can fudge this by setting the hover state to false when the options
490
+ // menu is closed. If the mouse is still over the input when the menu is closed, the hover state
491
+ // will be set to true automatically by the onMouseEnter event handler (and the focus state is
492
+ // always true the whole time so the clear button won't flicker)
493
+ setIsMousedOver(false);
494
+ } }), (hasEndAdornment && {
484
495
  endAdornment: (jsxs(Stack, { direction: "row", spacing: 1, pr: 2, children: [isClearable &&
485
496
  (isMousedOver || isFocused) &&
486
497
  value != null &&
@@ -531,7 +542,18 @@ function MultiSelectFormField(_a) {
531
542
  var _a;
532
543
  setIsFocused(false);
533
544
  (_a = inputSlotProps === null || inputSlotProps === void 0 ? void 0 : inputSlotProps.onBlur) === null || _a === void 0 ? void 0 : _a.call(inputSlotProps, event);
534
- } }), select: __assign(__assign({}, textFieldSlotProps === null || textFieldSlotProps === void 0 ? void 0 : textFieldSlotProps.select), { endAdornment: (jsxs(Stack, { direction: "row", spacing: 1, pr: 2, children: [isClearable && (isMousedOver || isFocused) && (value === null || value === void 0 ? void 0 : value.length) > 0 && (jsx(IconButton, { size: "small", onClick: function () { return onChange([]); }, tabIndex: -1, children: jsx(CloseIcon, { fontSize: "small" }) })), inputSlotProps === null || inputSlotProps === void 0 ? void 0 : inputSlotProps.endAdornment] })), multiple: true, renderValue: function (selected) { return (jsx(Stack, { direction: "row", spacing: 1, flexWrap: "wrap", children: selected.map(function (s, index) {
545
+ } }), select: __assign(__assign({}, textFieldSlotProps === null || textFieldSlotProps === void 0 ? void 0 : textFieldSlotProps.select), { onClose: function (e) {
546
+ var _a, _b;
547
+ typeof (textFieldSlotProps === null || textFieldSlotProps === void 0 ? void 0 : textFieldSlotProps.select) === "function"
548
+ ? undefined
549
+ : (_b = (_a = textFieldSlotProps === null || textFieldSlotProps === void 0 ? void 0 : textFieldSlotProps.select) === null || _a === void 0 ? void 0 : _a.onClose) === null || _b === void 0 ? void 0 : _b.call(_a, e);
550
+ //When opening a select and then moving the mouse away, the input does not register as
551
+ // being unhovered. We can fudge this by setting the hover state to false when the options
552
+ // menu is closed. If the mouse is still over the input when the menu is closed, the hover state
553
+ // will be set to true automatically by the onMouseEnter event handler (and the focus state is
554
+ // always true the whole time so the clear button won't flicker)
555
+ setIsMousedOver(false);
556
+ }, endAdornment: (jsxs(Stack, { direction: "row", spacing: 1, pr: 2, children: [isClearable && (isMousedOver || isFocused) && (value === null || value === void 0 ? void 0 : value.length) > 0 && (jsx(IconButton, { size: "small", onClick: function () { return onChange([]); }, tabIndex: -1, children: jsx(CloseIcon, { fontSize: "small" }) })), inputSlotProps === null || inputSlotProps === void 0 ? void 0 : inputSlotProps.endAdornment] })), multiple: true, renderValue: function (selected) { return (jsx(Stack, { direction: "row", spacing: 1, flexWrap: "wrap", children: selected.map(function (s, index) {
535
557
  var _a;
536
558
  return (jsxs(React.Fragment, { children: [index > 0 && ", ", (_a = findTextFor(s, options)) !== null && _a !== void 0 ? _a : "Unknown"] }, s));
537
559
  }) })); } }) });