@instructure/ui-dom-utils 10.26.1 → 11.0.1-snapshot-0

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,7 +3,7 @@
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](https://github.com/instructure/instructure-ui/compare/v10.26.0...v10.26.1) (2025-10-06)
6
+ ## [11.0.1-snapshot-0](https://github.com/instructure/instructure-ui/compare/v11.0.0...v11.0.1-snapshot-0) (2025-10-07)
7
7
 
8
8
  **Note:** Version bump only for package @instructure/ui-dom-utils
9
9
 
@@ -11,6 +11,35 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
11
11
 
12
12
 
13
13
 
14
+ # [11.0.0](https://github.com/instructure/instructure-ui/compare/v10.26.0...v11.0.0) (2025-10-06)
15
+
16
+
17
+ ### Features
18
+
19
+ * **many:** instUI v11 release ([36f5438](https://github.com/instructure/instructure-ui/commit/36f54382669186227ba24798bbf7201ef2f5cd4c))
20
+
21
+
22
+ ### BREAKING CHANGES
23
+
24
+ * **many:** InstUI v11 contains the following breaking changes:
25
+ - React 16 and 17 are no longer supported
26
+ - remove `PropTypes` from all packages
27
+ - remove `CodeEditor` component
28
+ - remove `@instui/theme-registry` package
29
+ - remove `@testable`, `@experimental`, `@hack` decorators
30
+ - InstUISettingsProvider's `as` prop is removed
31
+ - `canvas.use()`, `canvasHighContrast.use()` functions are removed
32
+ - `canvasThemeLocal`, `canvasHighContrastThemeLocal` are removed
33
+ - `variables` field on theme objects are removed
34
+ - remove deprecated props from Table: Row's `isStacked`, Body's
35
+ `isStacked`, `hover`, and `headers`
36
+ - `Table`'s `caption` prop is now required
37
+ - `ui-dom-utils`'s `getComputedStyle` can now return `undefined`
38
+
39
+
40
+
41
+
42
+
14
43
  # [10.26.0](https://github.com/instructure/instructure-ui/compare/v10.25.0...v10.26.0) (2025-10-01)
15
44
 
16
45
  **Note:** Version bump only for package @instructure/ui-dom-utils
package/es/findDOMNode.js CHANGED
@@ -23,22 +23,41 @@
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
+ // 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
+
32
43
  /**
33
44
  * ---
34
45
  * category: utilities/DOM
35
46
  * ---
36
47
  *
37
- * Wrapper function for React.findDOMNode
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
38
57
  * @module findDOMNode
39
58
  *
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
59
+ * @param el - component, DOM node, or function returning a DOM node
60
+ * @returns The native DOM node of this element or `undefined`
42
61
  */
43
62
  function findDOMNode(el) {
44
63
  const node = typeof el === 'function' ? el() : el;
@@ -47,17 +66,24 @@ function findDOMNode(el) {
47
66
  } else if (node instanceof Element || node === window || node && typeof node.nodeType !== 'undefined') {
48
67
  return node;
49
68
  } else if (node) {
50
- const reactNode = node;
51
- if (isReactNodeWithRef(reactNode)) {
52
- const refElement = isRefObject(reactNode.ref) ? reactNode.ref.current : reactNode.ref;
69
+ const ref = getElementRef(node);
70
+ const refElement = ref !== null && ref !== void 0 && ref.current ? ref.current : ref;
71
+ if (refElement) {
53
72
  if (!(refElement instanceof HTMLElement)) {
54
73
  return findDOMNode(refElement);
55
74
  }
56
75
  return refElement;
57
- } else {
58
- const elName = reactNode.constructor.componentId ? reactNode.constructor.componentId : reactNode.constructor.name;
59
- return ReactDOM.findDOMNode(node);
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);
60
85
  }
86
+ return void 0;
61
87
  }
62
88
  return void 0;
63
89
  }
@@ -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,40 @@ 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
+ // 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
+
40
50
  /**
41
51
  * ---
42
52
  * category: utilities/DOM
43
53
  * ---
44
54
  *
45
- * Wrapper function for React.findDOMNode
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
46
64
  * @module findDOMNode
47
65
  *
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
66
+ * @param el - component, DOM node, or function returning a DOM node
67
+ * @returns The native DOM node of this element or `undefined`
50
68
  */
51
69
  function findDOMNode(el) {
52
70
  const node = typeof el === 'function' ? el() : el;
@@ -55,17 +73,24 @@ function findDOMNode(el) {
55
73
  } else if (node instanceof Element || node === window || node && typeof node.nodeType !== 'undefined') {
56
74
  return node;
57
75
  } else if (node) {
58
- const reactNode = node;
59
- if (isReactNodeWithRef(reactNode)) {
60
- const refElement = isRefObject(reactNode.ref) ? reactNode.ref.current : reactNode.ref;
76
+ const ref = getElementRef(node);
77
+ const refElement = ref !== null && ref !== void 0 && ref.current ? ref.current : ref;
78
+ if (refElement) {
61
79
  if (!(refElement instanceof HTMLElement)) {
62
80
  return findDOMNode(refElement);
63
81
  }
64
82
  return refElement;
65
- } else {
66
- const elName = reactNode.constructor.componentId ? reactNode.constructor.componentId : reactNode.constructor.name;
67
- return _reactDom.default.findDOMNode(node);
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);
68
92
  }
93
+ return void 0;
69
94
  }
70
95
  return void 0;
71
96
  }
@@ -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.26.1",
3
+ "version": "11.0.1-snapshot-0",
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",
25
+ "@instructure/ui-babel-preset": "11.0.1-snapshot-0",
26
26
  "@testing-library/jest-dom": "^6.6.3",
27
- "@testing-library/react": "^16.0.1",
27
+ "@testing-library/react": "15.0.7",
28
28
  "vitest": "^3.2.2"
29
29
  },
30
30
  "dependencies": {
31
31
  "@babel/runtime": "^7.27.6",
32
- "@instructure/console": "10.26.1",
33
- "@instructure/shared-types": "10.26.1"
32
+ "@instructure/console": "11.0.1-snapshot-0",
33
+ "@instructure/shared-types": "11.0.1-snapshot-0"
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"