@sprinklrjs/spaceweb 14.15.0 → 14.15.1

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.
@@ -202,14 +202,19 @@ var DateInput = function (_a) {
202
202
  }, [_onKeyDown, closeDatePicker]);
203
203
  var onBlur = (0, useLatestCallback_1.useLatestCallback)(function (e) {
204
204
  var _a;
205
- setIsContainerFocused(false);
206
205
  var contentEl = contentRef.current;
207
206
  // The Year/Month selector menu (which gets autofocused on open) is rendered as a sibling of contentEl
208
207
  // We check contentEl.parentElement(Popover.Inner) as a potential container for events
208
+ // While open, the popover's focus lock blurs the chevron towards a non-element (null / document)
209
+ if ((isOpen && !(e.relatedTarget instanceof Element)) ||
210
+ e.currentTarget.contains(e.relatedTarget) ||
211
+ ((_a = contentEl === null || contentEl === void 0 ? void 0 : contentEl.parentElement) === null || _a === void 0 ? void 0 : _a.contains(e.relatedTarget)) ||
212
+ (contentEl === null || contentEl === void 0 ? void 0 : contentEl.contains(e.relatedTarget))) {
213
+ return;
214
+ }
215
+ setIsContainerFocused(false);
209
216
  if (isOpen) {
210
- if (!contentEl || !(((_a = contentEl.parentElement) === null || _a === void 0 ? void 0 : _a.contains(e.relatedTarget)) || contentEl.contains(e.relatedTarget))) {
211
- closeDatePicker();
212
- }
217
+ closeDatePicker();
213
218
  }
214
219
  // on blur, clear the input if the value is malformed
215
220
  if (!value && inputValue) {
@@ -230,7 +235,7 @@ var DateInput = function (_a) {
230
235
  else
231
236
  we close the Popover.
232
237
  */
233
- getTimeRangesForDate: getTimeRangesForDate, disableTimezoneSwitch: disableTimezoneSwitch }, contentProps), timezoneAdaptedValue === null || timezoneAdaptedValue === void 0 ? void 0 : timezoneAdaptedValue.getTime()) }, popoverProps, { children: (0, jsx_runtime_1.jsx)(Root, tslib_1.__assign({}, rootProps, { children: (0, jsx_runtime_1.jsx)(Input, tslib_1.__assign({ value: inputValue, onChange: handleInputChange, disabled: restProps.disabled, onFocus: onFocus, onBlur: onBlur, onKeyDown: handleKeyDown }, restProps, { placeholder: placeholder !== null && placeholder !== void 0 ? placeholder : formatString.toLowerCase(), intent: error ? 'error' : intent }, inputProps, { inputRef: (0, useCombinedRef_1.combineRefs)(inputRef, inputProps.ref) })) })) })));
238
+ getTimeRangesForDate: getTimeRangesForDate, disableTimezoneSwitch: disableTimezoneSwitch }, contentProps), timezoneAdaptedValue === null || timezoneAdaptedValue === void 0 ? void 0 : timezoneAdaptedValue.getTime()) }, popoverProps, { children: (0, jsx_runtime_1.jsx)(Root, tslib_1.__assign({ onBlur: onBlur }, rootProps, { children: (0, jsx_runtime_1.jsx)(Input, tslib_1.__assign({ value: inputValue, onChange: handleInputChange, disabled: restProps.disabled, onFocus: onFocus, onKeyDown: handleKeyDown }, restProps, { placeholder: placeholder !== null && placeholder !== void 0 ? placeholder : formatString.toLowerCase(), intent: error ? 'error' : intent }, inputProps, { inputRef: (0, useCombinedRef_1.combineRefs)(inputRef, inputProps.ref) })) })) })));
234
239
  };
235
240
  exports.DateInput = DateInput;
236
241
  exports.DateInput.__standard = 'Component';
@@ -199,14 +199,19 @@ export var DateInput = function (_a) {
199
199
  }, [_onKeyDown, closeDatePicker]);
200
200
  var onBlur = useLatestCallback(function (e) {
201
201
  var _a;
202
- setIsContainerFocused(false);
203
202
  var contentEl = contentRef.current;
204
203
  // The Year/Month selector menu (which gets autofocused on open) is rendered as a sibling of contentEl
205
204
  // We check contentEl.parentElement(Popover.Inner) as a potential container for events
205
+ // While open, the popover's focus lock blurs the chevron towards a non-element (null / document)
206
+ if ((isOpen && !(e.relatedTarget instanceof Element)) ||
207
+ e.currentTarget.contains(e.relatedTarget) ||
208
+ ((_a = contentEl === null || contentEl === void 0 ? void 0 : contentEl.parentElement) === null || _a === void 0 ? void 0 : _a.contains(e.relatedTarget)) ||
209
+ (contentEl === null || contentEl === void 0 ? void 0 : contentEl.contains(e.relatedTarget))) {
210
+ return;
211
+ }
212
+ setIsContainerFocused(false);
206
213
  if (isOpen) {
207
- if (!contentEl || !(((_a = contentEl.parentElement) === null || _a === void 0 ? void 0 : _a.contains(e.relatedTarget)) || contentEl.contains(e.relatedTarget))) {
208
- closeDatePicker();
209
- }
214
+ closeDatePicker();
210
215
  }
211
216
  // on blur, clear the input if the value is malformed
212
217
  if (!value && inputValue) {
@@ -227,6 +232,6 @@ export var DateInput = function (_a) {
227
232
  else
228
233
  we close the Popover.
229
234
  */
230
- getTimeRangesForDate: getTimeRangesForDate, disableTimezoneSwitch: disableTimezoneSwitch }, contentProps), timezoneAdaptedValue === null || timezoneAdaptedValue === void 0 ? void 0 : timezoneAdaptedValue.getTime()) }, popoverProps, { children: _jsx(Root, __assign({}, rootProps, { children: _jsx(Input, __assign({ value: inputValue, onChange: handleInputChange, disabled: restProps.disabled, onFocus: onFocus, onBlur: onBlur, onKeyDown: handleKeyDown }, restProps, { placeholder: placeholder !== null && placeholder !== void 0 ? placeholder : formatString.toLowerCase(), intent: error ? 'error' : intent }, inputProps, { inputRef: combineRefs(inputRef, inputProps.ref) })) })) })));
235
+ getTimeRangesForDate: getTimeRangesForDate, disableTimezoneSwitch: disableTimezoneSwitch }, contentProps), timezoneAdaptedValue === null || timezoneAdaptedValue === void 0 ? void 0 : timezoneAdaptedValue.getTime()) }, popoverProps, { children: _jsx(Root, __assign({ onBlur: onBlur }, rootProps, { children: _jsx(Input, __assign({ value: inputValue, onChange: handleInputChange, disabled: restProps.disabled, onFocus: onFocus, onKeyDown: handleKeyDown }, restProps, { placeholder: placeholder !== null && placeholder !== void 0 ? placeholder : formatString.toLowerCase(), intent: error ? 'error' : intent }, inputProps, { inputRef: combineRefs(inputRef, inputProps.ref) })) })) })));
231
236
  };
232
237
  DateInput.__standard = 'Component';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sprinklrjs/spaceweb",
3
- "version": "14.15.0",
3
+ "version": "14.15.1",
4
4
  "description": "Components for SpaceWeb",
5
5
  "main": "index.js",
6
6
  "module": "./esm/index.js",
@@ -102,7 +102,7 @@
102
102
  "typescript": "~5.0.0"
103
103
  },
104
104
  "peerDependencies": {
105
- "@sprinklrjs/spaceweb-themes": "14.15.0",
105
+ "@sprinklrjs/spaceweb-themes": "14.15.1",
106
106
  "react": ">=17.0.2 <19.0.0",
107
107
  "react-dom": ">=17.0.2 <19.0.0"
108
108
  }