@instructure/ui-dom-utils 10.26.1-snapshot-2 → 10.26.2

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,30 +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.26.1-snapshot-2](https://github.com/instructure/instructure-ui/compare/v10.26.0...v10.26.1-snapshot-2) (2025-10-06)
6
+ ## [10.26.2](https://github.com/instructure/instructure-ui/compare/v10.26.1...v10.26.2) (2025-10-13)
7
7
 
8
+ **Note:** Version bump only for package @instructure/ui-dom-utils
8
9
 
9
- ### Features
10
10
 
11
- * **many:** instUI v11 release ([36f5438](https://github.com/instructure/instructure-ui/commit/36f54382669186227ba24798bbf7201ef2f5cd4c))
12
11
 
13
12
 
14
- ### BREAKING CHANGES
15
13
 
16
- * **many:** InstUI v11 contains the following breaking changes:
17
- - React 16 and 17 are no longer supported
18
- - remove `PropTypes` from all packages
19
- - remove `CodeEditor` component
20
- - remove `@instui/theme-registry` package
21
- - remove `@testable`, `@experimental`, `@hack` decorators
22
- - InstUISettingsProvider's `as` prop is removed
23
- - `canvas.use()`, `canvasHighContrast.use()` functions are removed
24
- - `canvasThemeLocal`, `canvasHighContrastThemeLocal` are removed
25
- - `variables` field on theme objects are removed
26
- - remove deprecated props from Table: Row's `isStacked`, Body's
27
- `isStacked`, `hover`, and `headers`
28
- - `Table`'s `caption` prop is now required
29
- - `ui-dom-utils`'s `getComputedStyle` can now return `undefined`
14
+ ## [10.26.1](https://github.com/instructure/instructure-ui/compare/v10.26.0...v10.26.1) (2025-10-06)
15
+
16
+ **Note:** Version bump only for package @instructure/ui-dom-utils
30
17
 
31
18
 
32
19
 
package/es/findDOMNode.js CHANGED
@@ -23,41 +23,22 @@
23
23
  */
24
24
 
25
25
  import ReactDOM from 'react-dom';
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
- // Note that this is added by InstUI components like Position
34
- if (elem.ref) {
35
- return elem.ref;
36
- }
37
- // note that trying to access this will display a warning in React 18.
38
- // this is OK because without it React itself would show an error because
39
- // its using findDOMNode
40
- return elem === null || elem === void 0 ? void 0 : (_elem$props = elem.props) === null || _elem$props === void 0 ? void 0 : _elem$props.ref;
41
- }
42
-
26
+ const isReactNodeWithRef = el => {
27
+ return !!el && el.ref !== void 0;
28
+ };
29
+ const isRefObject = obj => {
30
+ return !!obj && obj.current !== void 0;
31
+ };
43
32
  /**
44
33
  * ---
45
34
  * category: utilities/DOM
46
35
  * ---
47
36
  *
48
- * Returns the underlying DOM node. It looks the following places:
49
- * - If it's a native HTML element e.g. `HtmlSpanElement` its returned as is.
50
- * - If the element has a non-nullish `ref` prop or instance variable which is a
51
- * `HTMLElement` its returned. If it`s something else then `findDOMNode` is called
52
- * on the object. (it also checks `ref.current`)
53
- * - If the element has a `ref` prop or instance variable whose value is `null`,
54
- * `undefined` is returned.
55
- * - If the element does not have a `ref` prop or instance variable `undefined`
56
- * is returned with a warning
37
+ * Wrapper function for React.findDOMNode
57
38
  * @module findDOMNode
58
39
  *
59
- * @param el - component, DOM node, or function returning a DOM node
60
- * @returns The native DOM node of this element or `undefined`
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
61
42
  */
62
43
  function findDOMNode(el) {
63
44
  const node = typeof el === 'function' ? el() : el;
@@ -66,24 +47,17 @@ function findDOMNode(el) {
66
47
  } else if (node instanceof Element || node === window || node && typeof node.nodeType !== 'undefined') {
67
48
  return node;
68
49
  } else if (node) {
69
- const ref = getElementRef(node);
70
- const refElement = ref !== null && ref !== void 0 && ref.current ? ref.current : ref;
71
- if (refElement) {
50
+ const reactNode = node;
51
+ if (isReactNodeWithRef(reactNode)) {
52
+ const refElement = isRefObject(reactNode.ref) ? reactNode.ref.current : reactNode.ref;
72
53
  if (!(refElement instanceof HTMLElement)) {
73
54
  return findDOMNode(refElement);
74
55
  }
75
56
  return refElement;
76
- } else if (refElement === null) {
77
- // weird, but changing it would be a breaking change
78
- return void 0;
79
- }
80
- const elName = node.constructor.componentId ? node.constructor.componentId : node.constructor.name;
81
- // TODO remove when we only support React 19 or greater
82
- const ReactDomInstance = ReactDOM;
83
- if (typeof ReactDomInstance.findDOMNode === 'function') {
84
- return ReactDomInstance.findDOMNode(node);
57
+ } else {
58
+ const elName = reactNode.constructor.componentId ? reactNode.constructor.componentId : reactNode.constructor.name;
59
+ return ReactDOM.findDOMNode(node);
85
60
  }
86
- return void 0;
87
61
  }
88
62
  return void 0;
89
63
  }
@@ -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 { getCSSStyleDeclaration, findDOMNode } from './';
40
+ import { getComputedStyle, 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,17 +79,16 @@ function findFocusable(el, filter, shouldSearchRootNode) {
79
79
  });
80
80
  }
81
81
  function hidden(element) {
82
- const cs = getCSSStyleDeclaration(element);
83
- return (cs === null || cs === void 0 ? void 0 : cs.display) === 'none';
82
+ const cs = getComputedStyle(element);
83
+ return cs.display === 'none';
84
84
  }
85
85
  function positioned(element) {
86
- var _style$position, _getCSSStyleDeclarati, _getCSSStyleDeclarati2;
86
+ var _style$position, _getComputedStyle$get;
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
- 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)) {
91
+ if (POS.includes((_getComputedStyle$get = getComputedStyle(element).getPropertyValue('position')) === null || _getComputedStyle$get === void 0 ? void 0 : _getComputedStyle$get.toLowerCase())) {
93
92
  return true;
94
93
  }
95
94
  return false;
@@ -32,26 +32,22 @@ import { canUseDOM } from './canUseDOM';
32
32
  *
33
33
  * Get the associated CSS properties and values for a
34
34
  * specified element
35
- * @module getCSSStyleDeclaration
35
+ * @module getComputedStyle
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 { CSSStyleDeclaration | undefined } The style declaration containing css properties and values for the element or undefined
39
+ * @returns { Object } object containing css properties and values for the element
40
40
  */
41
- function getCSSStyleDeclaration(el, pseudoElt) {
42
- let style;
41
+ function getComputedStyle(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
- try {
48
- style = window ? window.getComputedStyle(node, pseudoElt) : void 0;
49
- } catch {
50
- style = void 0;
51
- }
47
+ style = window ? window.getComputedStyle(node, pseudoElt) : {};
52
48
  }
53
49
  }
54
50
  return style;
55
51
  }
56
- export default getCSSStyleDeclaration;
57
- export { getCSSStyleDeclaration };
52
+ export default getComputedStyle;
53
+ export { getComputedStyle };
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 { getCSSStyleDeclaration } from './getCSSStyleDeclaration';
26
+ import { getComputedStyle } from './getComputedStyle';
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(getCSSStyleDeclaration(container).getPropertyValue('font-size'));
53
+ const fontSize = parseInt(getComputedStyle(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 { getCSSStyleDeclaration } from './getCSSStyleDeclaration';
27
+ import { getComputedStyle } from './getComputedStyle';
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 = getCSSStyleDeclaration(parent);
51
+ const style = getComputedStyle(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 { getCSSStyleDeclaration } from './getCSSStyleDeclaration';
27
+ import { getComputedStyle } from './getComputedStyle';
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 = getCSSStyleDeclaration(node);
52
- const position = computedStyle === null || computedStyle === void 0 ? void 0 : computedStyle.position;
51
+ const computedStyle = getComputedStyle(node) || {};
52
+ const position = 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 = getCSSStyleDeclaration(parent);
60
+ style = getComputedStyle(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 { getCSSStyleDeclaration } from './getCSSStyleDeclaration';
38
+ export { getComputedStyle } from './getComputedStyle';
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 { getCSSStyleDeclaration } from './getCSSStyleDeclaration';
26
+ import { getComputedStyle } from './getComputedStyle';
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 ? getCSSStyleDeclaration(node) : {};
52
+ const style = node ? getComputedStyle(node) : {};
53
53
  // physically and visually hidden
54
- if ((style === null || style === void 0 ? void 0 : style.display) === 'none') {
54
+ if (style.display === 'none') {
55
55
  return false;
56
56
  }
57
57
  // visually hidden
58
- if ((style === null || style === void 0 ? void 0 : style.visibility) === 'hidden' || (style === null || style === void 0 ? void 0 : style.opacity) === '0') {
58
+ if (style.visibility === 'hidden' || style.opacity === '0') {
59
59
  return false;
60
60
  }
61
61
  // hidden by clipping
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(', ');
62
+ if (style.overflow === 'hidden' && style.position === 'absolute' && style.clip !== 'auto') {
63
+ const rect = style.clip.substring(5).slice(0, -1).split(', ');
64
64
  let zeros = true;
65
65
  rect.forEach(a => {
66
66
  if (a !== '0px') {
@@ -31,40 +31,22 @@ var _reactDom = _interopRequireDefault(require("react-dom"));
31
31
  * SOFTWARE.
32
32
  */
33
33
 
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
- // Note that this is added by InstUI components like Position
41
- if (elem.ref) {
42
- return elem.ref;
43
- }
44
- // note that trying to access this will display a warning in React 18.
45
- // this is OK because without it React itself would show an error because
46
- // its using findDOMNode
47
- return elem === null || elem === void 0 ? void 0 : (_elem$props = elem.props) === null || _elem$props === void 0 ? void 0 : _elem$props.ref;
48
- }
49
-
34
+ const isReactNodeWithRef = el => {
35
+ return !!el && el.ref !== void 0;
36
+ };
37
+ const isRefObject = obj => {
38
+ return !!obj && obj.current !== void 0;
39
+ };
50
40
  /**
51
41
  * ---
52
42
  * category: utilities/DOM
53
43
  * ---
54
44
  *
55
- * Returns the underlying DOM node. It looks the following places:
56
- * - If it's a native HTML element e.g. `HtmlSpanElement` its returned as is.
57
- * - If the element has a non-nullish `ref` prop or instance variable which is a
58
- * `HTMLElement` its returned. If it`s something else then `findDOMNode` is called
59
- * on the object. (it also checks `ref.current`)
60
- * - If the element has a `ref` prop or instance variable whose value is `null`,
61
- * `undefined` is returned.
62
- * - If the element does not have a `ref` prop or instance variable `undefined`
63
- * is returned with a warning
45
+ * Wrapper function for React.findDOMNode
64
46
  * @module findDOMNode
65
47
  *
66
- * @param el - component, DOM node, or function returning a DOM node
67
- * @returns The native DOM node of this element or `undefined`
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
68
50
  */
69
51
  function findDOMNode(el) {
70
52
  const node = typeof el === 'function' ? el() : el;
@@ -73,24 +55,17 @@ function findDOMNode(el) {
73
55
  } else if (node instanceof Element || node === window || node && typeof node.nodeType !== 'undefined') {
74
56
  return node;
75
57
  } else if (node) {
76
- const ref = getElementRef(node);
77
- const refElement = ref !== null && ref !== void 0 && ref.current ? ref.current : ref;
78
- if (refElement) {
58
+ const reactNode = node;
59
+ if (isReactNodeWithRef(reactNode)) {
60
+ const refElement = isRefObject(reactNode.ref) ? reactNode.ref.current : reactNode.ref;
79
61
  if (!(refElement instanceof HTMLElement)) {
80
62
  return findDOMNode(refElement);
81
63
  }
82
64
  return refElement;
83
- } else if (refElement === null) {
84
- // weird, but changing it would be a breaking change
85
- return void 0;
86
- }
87
- const elName = node.constructor.componentId ? node.constructor.componentId : node.constructor.name;
88
- // TODO remove when we only support React 19 or greater
89
- const ReactDomInstance = _reactDom.default;
90
- if (typeof ReactDomInstance.findDOMNode === 'function') {
91
- return ReactDomInstance.findDOMNode(node);
65
+ } else {
66
+ const elName = reactNode.constructor.componentId ? reactNode.constructor.componentId : reactNode.constructor.name;
67
+ return _reactDom.default.findDOMNode(node);
92
68
  }
93
- return void 0;
94
69
  }
95
70
  return void 0;
96
71
  }
@@ -87,17 +87,16 @@ function findFocusable(el, filter, shouldSearchRootNode) {
87
87
  });
88
88
  }
89
89
  function hidden(element) {
90
- const cs = (0, _.getCSSStyleDeclaration)(element);
91
- return (cs === null || cs === void 0 ? void 0 : cs.display) === 'none';
90
+ const cs = (0, _.getComputedStyle)(element);
91
+ return cs.display === 'none';
92
92
  }
93
93
  function positioned(element) {
94
- var _style$position, _getCSSStyleDeclarati, _getCSSStyleDeclarati2;
94
+ var _style$position, _getComputedStyle$get;
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
- 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)) {
99
+ if (POS.includes((_getComputedStyle$get = (0, _.getComputedStyle)(element).getPropertyValue('position')) === null || _getComputedStyle$get === void 0 ? void 0 : _getComputedStyle$get.toLowerCase())) {
101
100
  return true;
102
101
  }
103
102
  return false;
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
- exports.getCSSStyleDeclaration = getCSSStyleDeclaration;
7
+ exports.getComputedStyle = getComputedStyle;
8
8
  var _findDOMNode = require("./findDOMNode");
9
9
  var _ownerWindow = require("./ownerWindow");
10
10
  var _canUseDOM = require("./canUseDOM");
@@ -39,25 +39,21 @@ var _canUseDOM = require("./canUseDOM");
39
39
  *
40
40
  * Get the associated CSS properties and values for a
41
41
  * specified element
42
- * @module getCSSStyleDeclaration
42
+ * @module getComputedStyle
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 { CSSStyleDeclaration | undefined } The style declaration containing css properties and values for the element or undefined
46
+ * @returns { Object } object containing css properties and values for the element
47
47
  */
48
- function getCSSStyleDeclaration(el, pseudoElt) {
49
- let style;
48
+ function getComputedStyle(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
- try {
55
- style = window ? window.getComputedStyle(node, pseudoElt) : void 0;
56
- } catch {
57
- style = void 0;
58
- }
54
+ style = window ? window.getComputedStyle(node, pseudoElt) : {};
59
55
  }
60
56
  }
61
57
  return style;
62
58
  }
63
- var _default = exports.default = getCSSStyleDeclaration;
59
+ var _default = exports.default = getComputedStyle;
@@ -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 _getCSSStyleDeclaration = require("./getCSSStyleDeclaration");
10
+ var _getComputedStyle = require("./getComputedStyle");
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, _getCSSStyleDeclaration.getCSSStyleDeclaration)(container).getPropertyValue('font-size'));
61
+ const fontSize = parseInt((0, _getComputedStyle.getComputedStyle)(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 _getCSSStyleDeclaration = require("./getCSSStyleDeclaration");
10
+ var _getComputedStyle = require("./getComputedStyle");
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, _getCSSStyleDeclaration.getCSSStyleDeclaration)(parent);
58
+ const style = (0, _getComputedStyle.getComputedStyle)(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 _getCSSStyleDeclaration = require("./getCSSStyleDeclaration");
10
+ var _getComputedStyle = require("./getComputedStyle");
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, _getCSSStyleDeclaration.getCSSStyleDeclaration)(node);
59
- const position = computedStyle === null || computedStyle === void 0 ? void 0 : computedStyle.position;
58
+ const computedStyle = (0, _getComputedStyle.getComputedStyle)(node) || {};
59
+ const position = 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, _getCSSStyleDeclaration.getCSSStyleDeclaration)(parent);
67
+ style = (0, _getComputedStyle.getComputedStyle)(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, "getCSSStyleDeclaration", {
72
+ Object.defineProperty(exports, "getClassList", {
73
73
  enumerable: true,
74
74
  get: function () {
75
- return _getCSSStyleDeclaration.getCSSStyleDeclaration;
75
+ return _getClassList.getClassList;
76
76
  }
77
77
  });
78
- Object.defineProperty(exports, "getClassList", {
78
+ Object.defineProperty(exports, "getComputedStyle", {
79
79
  enumerable: true,
80
80
  get: function () {
81
- return _getClassList.getClassList;
81
+ return _getComputedStyle.getComputedStyle;
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 _getCSSStyleDeclaration = require("./getCSSStyleDeclaration");
162
+ var _getComputedStyle = require("./getComputedStyle");
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 _getCSSStyleDeclaration = require("./getCSSStyleDeclaration");
9
+ var _getComputedStyle = require("./getComputedStyle");
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, _getCSSStyleDeclaration.getCSSStyleDeclaration)(node) : {};
59
+ const style = node ? (0, _getComputedStyle.getComputedStyle)(node) : {};
60
60
  // physically and visually hidden
61
- if ((style === null || style === void 0 ? void 0 : style.display) === 'none') {
61
+ if (style.display === 'none') {
62
62
  return false;
63
63
  }
64
64
  // visually hidden
65
- if ((style === null || style === void 0 ? void 0 : style.visibility) === 'hidden' || (style === null || style === void 0 ? void 0 : style.opacity) === '0') {
65
+ if (style.visibility === 'hidden' || style.opacity === '0') {
66
66
  return false;
67
67
  }
68
68
  // hidden by clipping
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(', ');
69
+ if (style.overflow === 'hidden' && style.position === 'absolute' && style.clip !== 'auto') {
70
+ const rect = 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.26.1-snapshot-2",
3
+ "version": "10.26.2",
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.26.1-snapshot-2",
25
+ "@instructure/ui-babel-preset": "10.26.2",
26
26
  "@testing-library/jest-dom": "^6.6.3",
27
- "@testing-library/react": "15.0.7",
27
+ "@testing-library/react": "^16.0.1",
28
28
  "vitest": "^3.2.2"
29
29
  },
30
30
  "dependencies": {
31
31
  "@babel/runtime": "^7.27.6",
32
- "@instructure/console": "10.26.1-snapshot-2",
33
- "@instructure/shared-types": "10.26.1-snapshot-2"
32
+ "@instructure/console": "10.26.2",
33
+ "@instructure/shared-types": "10.26.2"
34
34
  },
35
35
  "peerDependencies": {
36
- "react": ">=18 <=19",
37
- "react-dom": ">=18 <=19"
36
+ "react": ">=16.14 <=18",
37
+ "react-dom": ">=16.14 <=18"
38
38
  },
39
39
  "publishConfig": {
40
40
  "access": "public"