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