@instructure/ui-dom-utils 10.25.0 → 10.25.1-pr-snapshot-1757941125745

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/CHANGELOG.md CHANGED
@@ -3,6 +3,17 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [10.25.1-pr-snapshot-1757941125745](https://github.com/instructure/instructure-ui/compare/v10.25.0...v10.25.1-pr-snapshot-1757941125745) (2025-09-15)
7
+
8
+
9
+ ### Features
10
+
11
+ * **many:** remove prop-types; add support for react 19 and upgrade docs app to use it ([22311c7](https://github.com/instructure/instructure-ui/commit/22311c7bcf52d4e7b094c60c92192e5c85eac6c2))
12
+
13
+
14
+
15
+
16
+
6
17
  # [10.25.0](https://github.com/instructure/instructure-ui/compare/v10.24.2...v10.25.0) (2025-09-09)
7
18
 
8
19
  **Note:** Version bump only for package @instructure/ui-dom-utils
package/es/findDOMNode.js CHANGED
@@ -23,22 +23,37 @@
23
23
  */
24
24
 
25
25
  import ReactDOM from 'react-dom';
26
- const isReactNodeWithRef = el => {
27
- return !!el && el.ref !== void 0;
28
- };
29
- const isRefObject = obj => {
30
- return !!obj && obj.current !== void 0;
31
- };
26
+
27
+ /**
28
+ * Return the ref of an element in a way that is compatible both with
29
+ * React 18 (element.ref) and React 19+ (element.props.ref)
30
+ */
31
+ function getElementRef(elem) {
32
+ var _elem$props;
33
+ if ((elem === null || elem === void 0 ? void 0 : (_elem$props = elem.props) === null || _elem$props === void 0 ? void 0 : _elem$props.ref) !== void 0) {
34
+ return elem.props.ref;
35
+ }
36
+ return elem.ref;
37
+ }
38
+
32
39
  /**
33
40
  * ---
34
41
  * category: utilities/DOM
35
42
  * ---
36
43
  *
37
- * Wrapper function for React.findDOMNode
44
+ * Returns the underlying DOM node. It looks the following places:
45
+ * - If it's a native HTML element e.g. `HtmlSpanElement` its returned as is.
46
+ * - If the element has a non-nullish `ref` prop or instance variable which is a
47
+ * `HTMLElement` its returned. If it`s something else then `findDOMNode` is called
48
+ * on the object. (it also checks `ref.current`)
49
+ * - If the element has a `ref` prop or instance variable whose value is `null`,
50
+ * `undefined` is returned.
51
+ * - If the element does not have a `ref` prop or instance variable `undefined`
52
+ * is returned with a warning
38
53
  * @module findDOMNode
39
54
  *
40
- * @param { Node | Window | React.ReactElement | React.Component | function } el - component, DOM node, or function returning a DOM node
41
- * @returns { Node | Window | null | undefined } The root node of this element
55
+ * @param el - component, DOM node, or function returning a DOM node
56
+ * @returns The native DOM node of this element or `undefined`
42
57
  */
43
58
  function findDOMNode(el) {
44
59
  const node = typeof el === 'function' ? el() : el;
@@ -47,17 +62,24 @@ function findDOMNode(el) {
47
62
  } else if (node instanceof Element || node === window || node && typeof node.nodeType !== 'undefined') {
48
63
  return node;
49
64
  } else if (node) {
50
- const reactNode = node;
51
- if (isReactNodeWithRef(reactNode)) {
52
- const refElement = isRefObject(reactNode.ref) ? reactNode.ref.current : reactNode.ref;
65
+ const ref = getElementRef(node);
66
+ const refElement = ref !== null && ref !== void 0 && ref.current ? ref.current : ref;
67
+ if (refElement) {
53
68
  if (!(refElement instanceof HTMLElement)) {
54
69
  return findDOMNode(refElement);
55
70
  }
56
71
  return refElement;
57
- } else {
58
- const elName = reactNode.constructor.componentId ? reactNode.constructor.componentId : reactNode.constructor.name;
59
- return ReactDOM.findDOMNode(node);
72
+ } else if (refElement === null) {
73
+ // weird, but changing it would be a breaking change
74
+ return void 0;
75
+ }
76
+ const elName = node.constructor.componentId ? node.constructor.componentId : node.constructor.name;
77
+ // TODO remove when we only support React 19 or greater
78
+ const ReactDomInstance = ReactDOM;
79
+ if (typeof ReactDomInstance.findDOMNode === 'function') {
80
+ return ReactDomInstance.findDOMNode(node);
60
81
  }
82
+ return void 0;
61
83
  }
62
84
  return void 0;
63
85
  }
@@ -37,7 +37,7 @@
37
37
  // or even better use the native <dialog> component.
38
38
  // tabbable has issues with scrollable containers, e.g.
39
39
  // https://github.com/focus-trap/tabbable/issues/167
40
- import { getComputedStyle, findDOMNode } from './';
40
+ import { getCSSStyleDeclaration, findDOMNode } from './';
41
41
  const focusableSelector = ['a[href]', 'frame', 'iframe', 'object', 'input:not([type=hidden])', 'select', 'textarea', 'button', '*[tabindex]', '[contenteditable="true"]'].join(',');
42
42
  function hasQuerySelectorAll(el) {
43
43
  if (!el || typeof el.querySelectorAll !== 'function') {
@@ -79,16 +79,17 @@ function findFocusable(el, filter, shouldSearchRootNode) {
79
79
  });
80
80
  }
81
81
  function hidden(element) {
82
- const cs = getComputedStyle(element);
83
- return cs.display === 'none';
82
+ const cs = getCSSStyleDeclaration(element);
83
+ return (cs === null || cs === void 0 ? void 0 : cs.display) === 'none';
84
84
  }
85
85
  function positioned(element) {
86
- var _style$position, _getComputedStyle$get;
86
+ var _style$position, _getCSSStyleDeclarati, _getCSSStyleDeclarati2;
87
87
  const POS = ['fixed', 'absolute'];
88
88
  if (POS.includes((_style$position = element.style.position) === null || _style$position === void 0 ? void 0 : _style$position.toLowerCase())) {
89
89
  return true;
90
90
  }
91
- if (POS.includes((_getComputedStyle$get = getComputedStyle(element).getPropertyValue('position')) === null || _getComputedStyle$get === void 0 ? void 0 : _getComputedStyle$get.toLowerCase())) {
91
+ const position = (_getCSSStyleDeclarati = getCSSStyleDeclaration(element)) === null || _getCSSStyleDeclarati === void 0 ? void 0 : (_getCSSStyleDeclarati2 = _getCSSStyleDeclarati.getPropertyValue('position')) === null || _getCSSStyleDeclarati2 === void 0 ? void 0 : _getCSSStyleDeclarati2.toLowerCase();
92
+ if (position && POS.includes(position)) {
92
93
  return true;
93
94
  }
94
95
  return false;
@@ -32,22 +32,26 @@ import { canUseDOM } from './canUseDOM';
32
32
  *
33
33
  * Get the associated CSS properties and values for a
34
34
  * specified element
35
- * @module getComputedStyle
35
+ * @module getCSSStyleDeclaration
36
36
  *
37
37
  * @param { Node | Window | React.ReactElement | React.Component | function } el - component or DOM node
38
38
  * @param { string | null | undefined } pseudoElt - A string specifying the pseudo-element to match. Omitted (or null ) for real elements.
39
- * @returns { Object } object containing css properties and values for the element
39
+ * @returns { CSSStyleDeclaration | undefined } The style declaration containing css properties and values for the element or undefined
40
40
  */
41
- function getComputedStyle(el, pseudoElt) {
42
- let style = {};
41
+ function getCSSStyleDeclaration(el, pseudoElt) {
42
+ let style;
43
43
  if (canUseDOM) {
44
44
  const node = el && findDOMNode(el);
45
45
  if (node) {
46
46
  const window = ownerWindow(el);
47
- style = window ? window.getComputedStyle(node, pseudoElt) : {};
47
+ try {
48
+ style = window ? window.getComputedStyle(node, pseudoElt) : void 0;
49
+ } catch {
50
+ style = void 0;
51
+ }
48
52
  }
49
53
  }
50
54
  return style;
51
55
  }
52
- export default getComputedStyle;
53
- export { getComputedStyle };
56
+ export default getCSSStyleDeclaration;
57
+ export { getCSSStyleDeclaration };
package/es/getFontSize.js CHANGED
@@ -23,7 +23,7 @@
23
23
  */
24
24
  import { canUseDOM } from './canUseDOM';
25
25
  import { ownerDocument } from './ownerDocument';
26
- import { getComputedStyle } from './getComputedStyle';
26
+ import { getCSSStyleDeclaration } from './getCSSStyleDeclaration';
27
27
  const COMPUTED_CACHE = new WeakMap();
28
28
 
29
29
  /**
@@ -50,7 +50,7 @@ function getFontSize(el, ignoreCache = false) {
50
50
  if (!ignoreCache && cachedValue) {
51
51
  return cachedValue;
52
52
  }
53
- const fontSize = parseInt(getComputedStyle(container).getPropertyValue('font-size'));
53
+ const fontSize = parseInt(getCSSStyleDeclaration(container).getPropertyValue('font-size'));
54
54
 
55
55
  // cache the computed font size so that we don't have to compute it again
56
56
  COMPUTED_CACHE.set(container, fontSize);
@@ -24,7 +24,7 @@
24
24
 
25
25
  import { findDOMNode } from './findDOMNode';
26
26
  import { canUseDOM } from './canUseDOM';
27
- import { getComputedStyle } from './getComputedStyle';
27
+ import { getCSSStyleDeclaration } from './getCSSStyleDeclaration';
28
28
  import { ownerDocument } from './ownerDocument';
29
29
  /**
30
30
  * ---
@@ -48,7 +48,7 @@ function getOffsetParents(el) {
48
48
  if (node) {
49
49
  let parent = node;
50
50
  while ((parent = parent.parentNode) && parent && parent.nodeType === 1 && parent.tagName !== 'BODY') {
51
- const style = getComputedStyle(parent);
51
+ const style = getCSSStyleDeclaration(parent);
52
52
  const transform = style.getPropertyValue('-webkit-transform') || style.getPropertyValue('-moz-transform') || style.getPropertyValue('-ms-transform') || style.getPropertyValue('-o-transform') || style.getPropertyValue('transform') || 'none';
53
53
  // initial value of transform can be 'none' or a matrix equivalent
54
54
  const transformDefault = transform === 'none' || transform === 'matrix(1, 0, 0, 1, 0, 0)' ? true : false;
@@ -24,7 +24,7 @@
24
24
 
25
25
  import { findDOMNode } from './findDOMNode';
26
26
  import { canUseDOM } from './canUseDOM';
27
- import { getComputedStyle } from './getComputedStyle';
27
+ import { getCSSStyleDeclaration } from './getCSSStyleDeclaration';
28
28
  /**
29
29
  * ---
30
30
  * category: utilities/DOM
@@ -48,8 +48,8 @@ function getScrollParents(el) {
48
48
  if (node) {
49
49
  // In firefox if the element is inside an iframe with display: none; window.getComputedStyle() will return null;
50
50
  // https://bugzilla.mozilla.org/show_bug.cgi?id=548397
51
- const computedStyle = getComputedStyle(node) || {};
52
- const position = computedStyle.position;
51
+ const computedStyle = getCSSStyleDeclaration(node);
52
+ const position = computedStyle === null || computedStyle === void 0 ? void 0 : computedStyle.position;
53
53
  if (position === 'fixed') {
54
54
  return [node.ownerDocument];
55
55
  }
@@ -57,7 +57,7 @@ function getScrollParents(el) {
57
57
  while (parent && parent.nodeType === 1 && (parent = parent.parentNode)) {
58
58
  let style;
59
59
  try {
60
- style = getComputedStyle(parent);
60
+ style = getCSSStyleDeclaration(parent);
61
61
  } catch (err) {} // eslint-disable-line no-empty
62
62
 
63
63
  if (typeof style === 'undefined' || style === null) {
package/es/index.js CHANGED
@@ -35,7 +35,7 @@ export { findTabbable } from './findTabbable';
35
35
  export { getActiveElement } from './getActiveElement';
36
36
  export { getBoundingClientRect } from './getBoundingClientRect';
37
37
  export { getClassList } from './getClassList';
38
- export { getComputedStyle } from './getComputedStyle';
38
+ export { getCSSStyleDeclaration } from './getCSSStyleDeclaration';
39
39
  export { getFontSize } from './getFontSize';
40
40
  export { getOffsetParents } from './getOffsetParents';
41
41
  export { getScrollParents } from './getScrollParents';
package/es/isVisible.js CHANGED
@@ -23,7 +23,7 @@
23
23
  */
24
24
 
25
25
  import { findDOMNode } from './findDOMNode';
26
- import { getComputedStyle } from './getComputedStyle';
26
+ import { getCSSStyleDeclaration } from './getCSSStyleDeclaration';
27
27
  /**
28
28
  * ---
29
29
  * category: utilities/DOM
@@ -49,18 +49,18 @@ function isVisible(el, recursive = true) {
49
49
  if (node.nodeType === 3) {
50
50
  return isVisible(parent, recursive);
51
51
  }
52
- const style = node ? getComputedStyle(node) : {};
52
+ const style = node ? getCSSStyleDeclaration(node) : {};
53
53
  // physically and visually hidden
54
- if (style.display === 'none') {
54
+ if ((style === null || style === void 0 ? void 0 : style.display) === 'none') {
55
55
  return false;
56
56
  }
57
57
  // visually hidden
58
- if (style.visibility === 'hidden' || style.opacity === '0') {
58
+ if ((style === null || style === void 0 ? void 0 : style.visibility) === 'hidden' || (style === null || style === void 0 ? void 0 : style.opacity) === '0') {
59
59
  return false;
60
60
  }
61
61
  // hidden by clipping
62
- if (style.overflow === 'hidden' && style.position === 'absolute' && style.clip !== 'auto') {
63
- const rect = style.clip.substring(5).slice(0, -1).split(', ');
62
+ if ((style === null || style === void 0 ? void 0 : style.overflow) === 'hidden' && (style === null || style === void 0 ? void 0 : style.position) === 'absolute' && (style === null || style === void 0 ? void 0 : style.clip) !== 'auto') {
63
+ const rect = style === null || style === void 0 ? void 0 : style.clip.substring(5).slice(0, -1).split(', ');
64
64
  let zeros = true;
65
65
  rect.forEach(a => {
66
66
  if (a !== '0px') {
@@ -31,22 +31,36 @@ var _reactDom = _interopRequireDefault(require("react-dom"));
31
31
  * SOFTWARE.
32
32
  */
33
33
 
34
- const isReactNodeWithRef = el => {
35
- return !!el && el.ref !== void 0;
36
- };
37
- const isRefObject = obj => {
38
- return !!obj && obj.current !== void 0;
39
- };
34
+ /**
35
+ * Return the ref of an element in a way that is compatible both with
36
+ * React 18 (element.ref) and React 19+ (element.props.ref)
37
+ */
38
+ function getElementRef(elem) {
39
+ var _elem$props;
40
+ if ((elem === null || elem === void 0 ? void 0 : (_elem$props = elem.props) === null || _elem$props === void 0 ? void 0 : _elem$props.ref) !== void 0) {
41
+ return elem.props.ref;
42
+ }
43
+ return elem.ref;
44
+ }
45
+
40
46
  /**
41
47
  * ---
42
48
  * category: utilities/DOM
43
49
  * ---
44
50
  *
45
- * Wrapper function for React.findDOMNode
51
+ * Returns the underlying DOM node. It looks the following places:
52
+ * - If it's a native HTML element e.g. `HtmlSpanElement` its returned as is.
53
+ * - If the element has a non-nullish `ref` prop or instance variable which is a
54
+ * `HTMLElement` its returned. If it`s something else then `findDOMNode` is called
55
+ * on the object. (it also checks `ref.current`)
56
+ * - If the element has a `ref` prop or instance variable whose value is `null`,
57
+ * `undefined` is returned.
58
+ * - If the element does not have a `ref` prop or instance variable `undefined`
59
+ * is returned with a warning
46
60
  * @module findDOMNode
47
61
  *
48
- * @param { Node | Window | React.ReactElement | React.Component | function } el - component, DOM node, or function returning a DOM node
49
- * @returns { Node | Window | null | undefined } The root node of this element
62
+ * @param el - component, DOM node, or function returning a DOM node
63
+ * @returns The native DOM node of this element or `undefined`
50
64
  */
51
65
  function findDOMNode(el) {
52
66
  const node = typeof el === 'function' ? el() : el;
@@ -55,17 +69,24 @@ function findDOMNode(el) {
55
69
  } else if (node instanceof Element || node === window || node && typeof node.nodeType !== 'undefined') {
56
70
  return node;
57
71
  } else if (node) {
58
- const reactNode = node;
59
- if (isReactNodeWithRef(reactNode)) {
60
- const refElement = isRefObject(reactNode.ref) ? reactNode.ref.current : reactNode.ref;
72
+ const ref = getElementRef(node);
73
+ const refElement = ref !== null && ref !== void 0 && ref.current ? ref.current : ref;
74
+ if (refElement) {
61
75
  if (!(refElement instanceof HTMLElement)) {
62
76
  return findDOMNode(refElement);
63
77
  }
64
78
  return refElement;
65
- } else {
66
- const elName = reactNode.constructor.componentId ? reactNode.constructor.componentId : reactNode.constructor.name;
67
- return _reactDom.default.findDOMNode(node);
79
+ } else if (refElement === null) {
80
+ // weird, but changing it would be a breaking change
81
+ return void 0;
82
+ }
83
+ const elName = node.constructor.componentId ? node.constructor.componentId : node.constructor.name;
84
+ // TODO remove when we only support React 19 or greater
85
+ const ReactDomInstance = _reactDom.default;
86
+ if (typeof ReactDomInstance.findDOMNode === 'function') {
87
+ return ReactDomInstance.findDOMNode(node);
68
88
  }
89
+ return void 0;
69
90
  }
70
91
  return void 0;
71
92
  }
@@ -87,16 +87,17 @@ function findFocusable(el, filter, shouldSearchRootNode) {
87
87
  });
88
88
  }
89
89
  function hidden(element) {
90
- const cs = (0, _.getComputedStyle)(element);
91
- return cs.display === 'none';
90
+ const cs = (0, _.getCSSStyleDeclaration)(element);
91
+ return (cs === null || cs === void 0 ? void 0 : cs.display) === 'none';
92
92
  }
93
93
  function positioned(element) {
94
- var _style$position, _getComputedStyle$get;
94
+ var _style$position, _getCSSStyleDeclarati, _getCSSStyleDeclarati2;
95
95
  const POS = ['fixed', 'absolute'];
96
96
  if (POS.includes((_style$position = element.style.position) === null || _style$position === void 0 ? void 0 : _style$position.toLowerCase())) {
97
97
  return true;
98
98
  }
99
- if (POS.includes((_getComputedStyle$get = (0, _.getComputedStyle)(element).getPropertyValue('position')) === null || _getComputedStyle$get === void 0 ? void 0 : _getComputedStyle$get.toLowerCase())) {
99
+ const position = (_getCSSStyleDeclarati = (0, _.getCSSStyleDeclaration)(element)) === null || _getCSSStyleDeclarati === void 0 ? void 0 : (_getCSSStyleDeclarati2 = _getCSSStyleDeclarati.getPropertyValue('position')) === null || _getCSSStyleDeclarati2 === void 0 ? void 0 : _getCSSStyleDeclarati2.toLowerCase();
100
+ if (position && POS.includes(position)) {
100
101
  return true;
101
102
  }
102
103
  return false;
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
- exports.getComputedStyle = getComputedStyle;
7
+ exports.getCSSStyleDeclaration = getCSSStyleDeclaration;
8
8
  var _findDOMNode = require("./findDOMNode");
9
9
  var _ownerWindow = require("./ownerWindow");
10
10
  var _canUseDOM = require("./canUseDOM");
@@ -39,21 +39,25 @@ var _canUseDOM = require("./canUseDOM");
39
39
  *
40
40
  * Get the associated CSS properties and values for a
41
41
  * specified element
42
- * @module getComputedStyle
42
+ * @module getCSSStyleDeclaration
43
43
  *
44
44
  * @param { Node | Window | React.ReactElement | React.Component | function } el - component or DOM node
45
45
  * @param { string | null | undefined } pseudoElt - A string specifying the pseudo-element to match. Omitted (or null ) for real elements.
46
- * @returns { Object } object containing css properties and values for the element
46
+ * @returns { CSSStyleDeclaration | undefined } The style declaration containing css properties and values for the element or undefined
47
47
  */
48
- function getComputedStyle(el, pseudoElt) {
49
- let style = {};
48
+ function getCSSStyleDeclaration(el, pseudoElt) {
49
+ let style;
50
50
  if (_canUseDOM.canUseDOM) {
51
51
  const node = el && (0, _findDOMNode.findDOMNode)(el);
52
52
  if (node) {
53
53
  const window = (0, _ownerWindow.ownerWindow)(el);
54
- style = window ? window.getComputedStyle(node, pseudoElt) : {};
54
+ try {
55
+ style = window ? window.getComputedStyle(node, pseudoElt) : void 0;
56
+ } catch {
57
+ style = void 0;
58
+ }
55
59
  }
56
60
  }
57
61
  return style;
58
62
  }
59
- var _default = exports.default = getComputedStyle;
63
+ var _default = exports.default = getCSSStyleDeclaration;
@@ -7,7 +7,7 @@ exports.default = void 0;
7
7
  exports.getFontSize = getFontSize;
8
8
  var _canUseDOM = require("./canUseDOM");
9
9
  var _ownerDocument2 = require("./ownerDocument");
10
- var _getComputedStyle = require("./getComputedStyle");
10
+ var _getCSSStyleDeclaration = require("./getCSSStyleDeclaration");
11
11
  /*
12
12
  * The MIT License (MIT)
13
13
  *
@@ -58,7 +58,7 @@ function getFontSize(el, ignoreCache = false) {
58
58
  if (!ignoreCache && cachedValue) {
59
59
  return cachedValue;
60
60
  }
61
- const fontSize = parseInt((0, _getComputedStyle.getComputedStyle)(container).getPropertyValue('font-size'));
61
+ const fontSize = parseInt((0, _getCSSStyleDeclaration.getCSSStyleDeclaration)(container).getPropertyValue('font-size'));
62
62
 
63
63
  // cache the computed font size so that we don't have to compute it again
64
64
  COMPUTED_CACHE.set(container, fontSize);
@@ -7,7 +7,7 @@ exports.default = void 0;
7
7
  exports.getOffsetParents = getOffsetParents;
8
8
  var _findDOMNode = require("./findDOMNode");
9
9
  var _canUseDOM = require("./canUseDOM");
10
- var _getComputedStyle = require("./getComputedStyle");
10
+ var _getCSSStyleDeclaration = require("./getCSSStyleDeclaration");
11
11
  var _ownerDocument = require("./ownerDocument");
12
12
  /*
13
13
  * The MIT License (MIT)
@@ -55,7 +55,7 @@ function getOffsetParents(el) {
55
55
  if (node) {
56
56
  let parent = node;
57
57
  while ((parent = parent.parentNode) && parent && parent.nodeType === 1 && parent.tagName !== 'BODY') {
58
- const style = (0, _getComputedStyle.getComputedStyle)(parent);
58
+ const style = (0, _getCSSStyleDeclaration.getCSSStyleDeclaration)(parent);
59
59
  const transform = style.getPropertyValue('-webkit-transform') || style.getPropertyValue('-moz-transform') || style.getPropertyValue('-ms-transform') || style.getPropertyValue('-o-transform') || style.getPropertyValue('transform') || 'none';
60
60
  // initial value of transform can be 'none' or a matrix equivalent
61
61
  const transformDefault = transform === 'none' || transform === 'matrix(1, 0, 0, 1, 0, 0)' ? true : false;
@@ -7,7 +7,7 @@ exports.default = void 0;
7
7
  exports.getScrollParents = getScrollParents;
8
8
  var _findDOMNode = require("./findDOMNode");
9
9
  var _canUseDOM = require("./canUseDOM");
10
- var _getComputedStyle = require("./getComputedStyle");
10
+ var _getCSSStyleDeclaration = require("./getCSSStyleDeclaration");
11
11
  /*
12
12
  * The MIT License (MIT)
13
13
  *
@@ -55,8 +55,8 @@ function getScrollParents(el) {
55
55
  if (node) {
56
56
  // In firefox if the element is inside an iframe with display: none; window.getComputedStyle() will return null;
57
57
  // https://bugzilla.mozilla.org/show_bug.cgi?id=548397
58
- const computedStyle = (0, _getComputedStyle.getComputedStyle)(node) || {};
59
- const position = computedStyle.position;
58
+ const computedStyle = (0, _getCSSStyleDeclaration.getCSSStyleDeclaration)(node);
59
+ const position = computedStyle === null || computedStyle === void 0 ? void 0 : computedStyle.position;
60
60
  if (position === 'fixed') {
61
61
  return [node.ownerDocument];
62
62
  }
@@ -64,7 +64,7 @@ function getScrollParents(el) {
64
64
  while (parent && parent.nodeType === 1 && (parent = parent.parentNode)) {
65
65
  let style;
66
66
  try {
67
- style = (0, _getComputedStyle.getComputedStyle)(parent);
67
+ style = (0, _getCSSStyleDeclaration.getCSSStyleDeclaration)(parent);
68
68
  } catch (err) {} // eslint-disable-line no-empty
69
69
 
70
70
  if (typeof style === 'undefined' || style === null) {
package/lib/index.js CHANGED
@@ -69,16 +69,16 @@ Object.defineProperty(exports, "getBoundingClientRect", {
69
69
  return _getBoundingClientRect.getBoundingClientRect;
70
70
  }
71
71
  });
72
- Object.defineProperty(exports, "getClassList", {
72
+ Object.defineProperty(exports, "getCSSStyleDeclaration", {
73
73
  enumerable: true,
74
74
  get: function () {
75
- return _getClassList.getClassList;
75
+ return _getCSSStyleDeclaration.getCSSStyleDeclaration;
76
76
  }
77
77
  });
78
- Object.defineProperty(exports, "getComputedStyle", {
78
+ Object.defineProperty(exports, "getClassList", {
79
79
  enumerable: true,
80
80
  get: function () {
81
- return _getComputedStyle.getComputedStyle;
81
+ return _getClassList.getClassList;
82
82
  }
83
83
  });
84
84
  Object.defineProperty(exports, "getFontSize", {
@@ -159,7 +159,7 @@ var _findTabbable = require("./findTabbable");
159
159
  var _getActiveElement = require("./getActiveElement");
160
160
  var _getBoundingClientRect = require("./getBoundingClientRect");
161
161
  var _getClassList = require("./getClassList");
162
- var _getComputedStyle = require("./getComputedStyle");
162
+ var _getCSSStyleDeclaration = require("./getCSSStyleDeclaration");
163
163
  var _getFontSize = require("./getFontSize");
164
164
  var _getOffsetParents = require("./getOffsetParents");
165
165
  var _getScrollParents = require("./getScrollParents");
package/lib/isVisible.js CHANGED
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.default = void 0;
7
7
  exports.isVisible = isVisible;
8
8
  var _findDOMNode = require("./findDOMNode");
9
- var _getComputedStyle = require("./getComputedStyle");
9
+ var _getCSSStyleDeclaration = require("./getCSSStyleDeclaration");
10
10
  /*
11
11
  * The MIT License (MIT)
12
12
  *
@@ -56,18 +56,18 @@ function isVisible(el, recursive = true) {
56
56
  if (node.nodeType === 3) {
57
57
  return isVisible(parent, recursive);
58
58
  }
59
- const style = node ? (0, _getComputedStyle.getComputedStyle)(node) : {};
59
+ const style = node ? (0, _getCSSStyleDeclaration.getCSSStyleDeclaration)(node) : {};
60
60
  // physically and visually hidden
61
- if (style.display === 'none') {
61
+ if ((style === null || style === void 0 ? void 0 : style.display) === 'none') {
62
62
  return false;
63
63
  }
64
64
  // visually hidden
65
- if (style.visibility === 'hidden' || style.opacity === '0') {
65
+ if ((style === null || style === void 0 ? void 0 : style.visibility) === 'hidden' || (style === null || style === void 0 ? void 0 : style.opacity) === '0') {
66
66
  return false;
67
67
  }
68
68
  // hidden by clipping
69
- if (style.overflow === 'hidden' && style.position === 'absolute' && style.clip !== 'auto') {
70
- const rect = style.clip.substring(5).slice(0, -1).split(', ');
69
+ if ((style === null || style === void 0 ? void 0 : style.overflow) === 'hidden' && (style === null || style === void 0 ? void 0 : style.position) === 'absolute' && (style === null || style === void 0 ? void 0 : style.clip) !== 'auto') {
70
+ const rect = style === null || style === void 0 ? void 0 : style.clip.substring(5).slice(0, -1).split(', ');
71
71
  let zeros = true;
72
72
  rect.forEach(a => {
73
73
  if (a !== '0px') {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@instructure/ui-dom-utils",
3
- "version": "10.25.0",
3
+ "version": "10.25.1-pr-snapshot-1757941125745",
4
4
  "description": "A DOM utility library made by Instructure Inc.",
5
5
  "author": "Instructure, Inc. Engineering and Product Design",
6
6
  "module": "./es/index.js",
@@ -22,19 +22,19 @@
22
22
  },
23
23
  "license": "MIT",
24
24
  "devDependencies": {
25
- "@instructure/ui-babel-preset": "10.25.0",
25
+ "@instructure/ui-babel-preset": "10.25.1-pr-snapshot-1757941125745",
26
26
  "@testing-library/jest-dom": "^6.6.3",
27
- "@testing-library/react": "^16.0.1",
27
+ "@testing-library/react": "^16.3.0",
28
28
  "vitest": "^3.2.2"
29
29
  },
30
30
  "dependencies": {
31
31
  "@babel/runtime": "^7.27.6",
32
- "@instructure/console": "10.25.0",
33
- "@instructure/shared-types": "10.25.0"
32
+ "@instructure/console": "10.25.1-pr-snapshot-1757941125745",
33
+ "@instructure/shared-types": "10.25.1-pr-snapshot-1757941125745"
34
34
  },
35
35
  "peerDependencies": {
36
- "react": ">=16.14 <=18",
37
- "react-dom": ">=16.14 <=18"
36
+ "react": ">=18 <=19",
37
+ "react-dom": ">=18 <=19"
38
38
  },
39
39
  "publishConfig": {
40
40
  "access": "public"