@deque/cauldron-react 6.1.0-canary.66285037 → 6.1.0-canary.c2d49bda

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/lib/index.js CHANGED
@@ -1345,7 +1345,8 @@ SideBarItem.defaultProps = {
1345
1345
  */
1346
1346
  var AriaIsolate = /** @class */ (function () {
1347
1347
  function AriaIsolate(el) {
1348
- if (!(el instanceof HTMLElement)) {
1348
+ // eslint-disable-next-line ssr-friendly/no-dom-globals-in-constructor
1349
+ if (typeof HTMLElement === 'undefined' || !(el instanceof HTMLElement)) {
1349
1350
  throw new Error('AriaIsolate must be instantiated with a valid HTML element');
1350
1351
  }
1351
1352
  this.element = el;
@@ -1735,7 +1736,9 @@ function Tooltip(_a) {
1735
1736
  }), ref: setTooltipElement, role: "tooltip", style: styles.popper }, attributes.popper, props),
1736
1737
  variant !== 'big' && (React__default["default"].createElement("div", { className: "TooltipArrow", ref: setArrowElement, style: styles.arrow })),
1737
1738
  children), (portal && 'current' in portal ? portal.current : portal) ||
1738
- document.body)
1739
+ (
1740
+ // eslint-disable-next-line ssr-friendly/no-dom-globals-in-react-fc
1741
+ document === null || document === void 0 ? void 0 : document.body))
1739
1742
  : null));
1740
1743
  }
1741
1744
  Tooltip.displayName = 'Tooltip';
@@ -3717,10 +3720,13 @@ var Combobox = React.forwardRef(function (_a, ref) {
3717
3720
  onClick: handleInputClick },
3718
3721
  React__default["default"].createElement("input", tslib.__assign({ type: "text", id: "".concat(id, "-input"), ref: inputRef, value: value, role: "combobox", "aria-autocomplete": !isAutoComplete ? 'none' : 'list', "aria-controls": "".concat(id, "-listbox"), "aria-expanded": open, "aria-haspopup": "listbox", "aria-activedescendant": open && activeDescendant ? activeDescendant.element.id : undefined }, inputProps, { onChange: handleChange, onKeyDown: handleKeyDown, onFocus: handleFocus, onBlur: handleBlur })),
3719
3722
  React__default["default"].createElement("span", { className: "Combobox__arrow" })),
3720
- React__default["default"].createElement(ComboboxProvider, { autocomplete: autocomplete, inputValue: value, formValue: formValue, selectedValue: selectedValue, matches: !isAutoComplete || defaultAutoCompleteMatches, matchingOptions: matchingOptions, setMatchingOptions: setMatchingOptions, setFormValue: setFormValue }, portal
3721
- ? reactDom.createPortal(comboboxListbox, portal instanceof HTMLElement
3723
+ React__default["default"].createElement(ComboboxProvider, { autocomplete: autocomplete, inputValue: value, formValue: formValue, selectedValue: selectedValue, matches: !isAutoComplete || defaultAutoCompleteMatches, matchingOptions: matchingOptions, setMatchingOptions: setMatchingOptions, setFormValue: setFormValue }, portal && typeof document !== 'undefined'
3724
+ ? reactDom.createPortal(comboboxListbox,
3725
+ // eslint-disable-next-line ssr-friendly/no-dom-globals-in-react-fc
3726
+ portal instanceof HTMLElement
3722
3727
  ? portal
3723
3728
  : portal.current ||
3729
+ // eslint-disable-next-line ssr-friendly/no-dom-globals-in-react-fc
3724
3730
  /* istanbul ignore next: default fallback value */ document.body)
3725
3731
  : comboboxListbox),
3726
3732
  hasError && (React__default["default"].createElement("div", { className: "Error", id: errorId }, error))));
@@ -3868,7 +3874,10 @@ var Popover = React.forwardRef(function (_a, ref) {
3868
3874
  }), ref: popoverRef, role: "dialog", style: styles.popper }, attributes.popper, additionalProps, props),
3869
3875
  React__default["default"].createElement("div", { className: "Popover__popoverArrow", ref: setArrowElement, style: styles.arrow }),
3870
3876
  React__default["default"].createElement("div", { className: "Popover__borderLeft" }),
3871
- variant === 'prompt' ? (React__default["default"].createElement(PromptPopoverContent, { applyButtonText: applyButtonText, onApply: onApply, closeButtonText: closeButtonText, infoText: infoText || '', onClose: handleClosePopover, infoTextId: "".concat(id, "-label") })) : (children)))), (portal && 'current' in portal ? portal.current : portal) || document.body);
3877
+ variant === 'prompt' ? (React__default["default"].createElement(PromptPopoverContent, { applyButtonText: applyButtonText, onApply: onApply, closeButtonText: closeButtonText, infoText: infoText || '', onClose: handleClosePopover, infoTextId: "".concat(id, "-label") })) : (children)))), (portal && 'current' in portal ? portal.current : portal) ||
3878
+ // Dependent on "isBrowser" check above:
3879
+ // eslint-disable-next-line ssr-friendly/no-dom-globals-in-react-fc
3880
+ document.body);
3872
3881
  });
3873
3882
  Popover.displayName = 'Popover';
3874
3883
 
@@ -3893,17 +3902,21 @@ var ThemeContext = React.createContext({
3893
3902
  }
3894
3903
  });
3895
3904
  var ThemeProvider = function (_a) {
3896
- var children = _a.children, _b = _a.context, context = _b === void 0 ? document.body : _b, _c = _a.initialTheme, initialTheme = _c === void 0 ? 'light' : _c;
3905
+ var children = _a.children,
3906
+ // eslint-disable-next-line ssr-friendly/no-dom-globals-in-react-fc
3907
+ _b = _a.context,
3908
+ // eslint-disable-next-line ssr-friendly/no-dom-globals-in-react-fc
3909
+ context = _b === void 0 ? document === null || document === void 0 ? void 0 : document.body : _b, _c = _a.initialTheme, initialTheme = _c === void 0 ? 'light' : _c;
3897
3910
  var _d = tslib.__read(React.useState(initialTheme), 2), theme = _d[0], setTheme = _d[1];
3898
3911
  var getThemeFromContext = function () {
3899
- return context.classList.contains(DARK_THEME_CLASS) ? 'dark' : 'light';
3912
+ return (context === null || context === void 0 ? void 0 : context.classList.contains(DARK_THEME_CLASS)) ? 'dark' : 'light';
3900
3913
  };
3901
3914
  var toggleTheme = function () {
3902
3915
  return setTheme(getThemeFromContext() === 'dark' ? 'light' : 'dark');
3903
3916
  };
3904
3917
  React.useEffect(function () {
3905
- context.classList.toggle(LIGHT_THEME_CLASS, theme === 'light');
3906
- context.classList.toggle(DARK_THEME_CLASS, theme === 'dark');
3918
+ context === null || context === void 0 ? void 0 : context.classList.toggle(LIGHT_THEME_CLASS, theme === 'light');
3919
+ context === null || context === void 0 ? void 0 : context.classList.toggle(DARK_THEME_CLASS, theme === 'dark');
3907
3920
  }, [context, theme]);
3908
3921
  // Use a MutationObserver to track changes to the classes outside of the context of React
3909
3922
  var handleMutation = function (mutationList) {
@@ -3926,6 +3939,9 @@ var ThemeProvider = function (_a) {
3926
3939
  }
3927
3940
  };
3928
3941
  React.useEffect(function () {
3942
+ if (!context) {
3943
+ return;
3944
+ }
3929
3945
  var observer = new MutationObserver(handleMutation);
3930
3946
  observer.observe(context, {
3931
3947
  childList: false,
@@ -28,5 +28,5 @@ interface ComboboxProps extends React.InputHTMLAttributes<Omit<HTMLInputElement,
28
28
  portal?: React.RefObject<HTMLElement> | HTMLElement;
29
29
  inputRef?: React.Ref<HTMLInputElement>;
30
30
  }
31
- declare const Combobox: React.ForwardRefExoticComponent<ComboboxProps & React.RefAttributes<HTMLInputElement>>;
31
+ declare const Combobox: React.ForwardRefExoticComponent<ComboboxProps & React.RefAttributes<HTMLDivElement>>;
32
32
  export default Combobox;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deque/cauldron-react",
3
- "version": "6.1.0-canary.66285037",
3
+ "version": "6.1.0-canary.c2d49bda",
4
4
  "license": "MPL-2.0",
5
5
  "description": "Fully accessible react components library for Deque Cauldron",
6
6
  "homepage": "https://cauldron.dequelabs.com/",