@instructure/ui-alerts 10.25.1-snapshot-11 → 10.25.1-snapshot-13

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,9 +3,12 @@
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-snapshot-11](https://github.com/instructure/instructure-ui/compare/v10.25.0...v10.25.1-snapshot-11) (2025-10-01)
6
+ ## [10.25.1-snapshot-13](https://github.com/instructure/instructure-ui/compare/v10.25.0...v10.25.1-snapshot-13) (2025-10-01)
7
7
 
8
- **Note:** Version bump only for package @instructure/ui-alerts
8
+
9
+ ### Features
10
+
11
+ * **ui-alerts:** expand Alert's liveRegion to accept direct DOM element ([e457a0b](https://github.com/instructure/instructure-ui/commit/e457a0bcc928c4b094cc2df6998f7dd853b9774f))
9
12
 
10
13
 
11
14
 
package/es/Alert/index.js CHANGED
@@ -102,10 +102,7 @@ let Alert = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyle, gene
102
102
  return n && typeof n === 'object' && n.nodeType === 1;
103
103
  }
104
104
  getLiveRegion() {
105
- let lr = null;
106
- if (typeof this.props.liveRegion === 'function') {
107
- lr = this.props.liveRegion();
108
- }
105
+ const lr = typeof this.props.liveRegion === 'function' ? this.props.liveRegion() : this.props.liveRegion;
109
106
  return this.isDOMNode(lr) ? lr : null;
110
107
  }
111
108
  initLiveRegion(liveRegion) {
package/es/Alert/props.js CHANGED
@@ -27,7 +27,7 @@ const propTypes = {
27
27
  children: PropTypes.node,
28
28
  variant: PropTypes.oneOf(['info', 'success', 'warning', 'error']),
29
29
  margin: PropTypes.string,
30
- liveRegion: PropTypes.func,
30
+ liveRegion: PropTypes.oneOfType([PropTypes.func, PropTypes.element]),
31
31
  liveRegionPoliteness: PropTypes.oneOf(['polite', 'assertive']),
32
32
  isLiveRegionAtomic: PropTypes.bool,
33
33
  screenReaderOnly: PropTypes.bool,
@@ -113,10 +113,7 @@ let Alert = exports.Alert = (_dec = (0, _withDeterministicId.withDeterministicId
113
113
  return n && typeof n === 'object' && n.nodeType === 1;
114
114
  }
115
115
  getLiveRegion() {
116
- let lr = null;
117
- if (typeof this.props.liveRegion === 'function') {
118
- lr = this.props.liveRegion();
119
- }
116
+ const lr = typeof this.props.liveRegion === 'function' ? this.props.liveRegion() : this.props.liveRegion;
120
117
  return this.isDOMNode(lr) ? lr : null;
121
118
  }
122
119
  initLiveRegion(liveRegion) {
@@ -34,7 +34,7 @@ const propTypes = exports.propTypes = {
34
34
  children: _propTypes.default.node,
35
35
  variant: _propTypes.default.oneOf(['info', 'success', 'warning', 'error']),
36
36
  margin: _propTypes.default.string,
37
- liveRegion: _propTypes.default.func,
37
+ liveRegion: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.element]),
38
38
  liveRegionPoliteness: _propTypes.default.oneOf(['polite', 'assertive']),
39
39
  isLiveRegionAtomic: _propTypes.default.bool,
40
40
  screenReaderOnly: _propTypes.default.bool,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@instructure/ui-alerts",
3
- "version": "10.25.1-snapshot-11",
3
+ "version": "10.25.1-snapshot-13",
4
4
  "description": "An alert component",
5
5
  "author": "Instructure, Inc. Engineering and Product Design",
6
6
  "module": "./es/index.js",
@@ -23,10 +23,10 @@
23
23
  },
24
24
  "license": "MIT",
25
25
  "devDependencies": {
26
- "@instructure/ui-axe-check": "10.25.1-snapshot-11",
27
- "@instructure/ui-babel-preset": "10.25.1-snapshot-11",
28
- "@instructure/ui-color-utils": "10.25.1-snapshot-11",
29
- "@instructure/ui-scripts": "10.25.1-snapshot-11",
26
+ "@instructure/ui-axe-check": "10.25.1-snapshot-13",
27
+ "@instructure/ui-babel-preset": "10.25.1-snapshot-13",
28
+ "@instructure/ui-color-utils": "10.25.1-snapshot-13",
29
+ "@instructure/ui-scripts": "10.25.1-snapshot-13",
30
30
  "@testing-library/jest-dom": "^6.6.3",
31
31
  "@testing-library/react": "^16.0.1",
32
32
  "@testing-library/user-event": "^14.6.1",
@@ -34,16 +34,16 @@
34
34
  },
35
35
  "dependencies": {
36
36
  "@babel/runtime": "^7.27.6",
37
- "@instructure/console": "10.25.1-snapshot-11",
38
- "@instructure/emotion": "10.25.1-snapshot-11",
39
- "@instructure/shared-types": "10.25.1-snapshot-11",
40
- "@instructure/ui-a11y-content": "10.25.1-snapshot-11",
41
- "@instructure/ui-buttons": "10.25.1-snapshot-11",
42
- "@instructure/ui-icons": "10.25.1-snapshot-11",
43
- "@instructure/ui-motion": "10.25.1-snapshot-11",
44
- "@instructure/ui-react-utils": "10.25.1-snapshot-11",
45
- "@instructure/ui-themes": "10.25.1-snapshot-11",
46
- "@instructure/ui-view": "10.25.1-snapshot-11",
37
+ "@instructure/console": "10.25.1-snapshot-13",
38
+ "@instructure/emotion": "10.25.1-snapshot-13",
39
+ "@instructure/shared-types": "10.25.1-snapshot-13",
40
+ "@instructure/ui-a11y-content": "10.25.1-snapshot-13",
41
+ "@instructure/ui-buttons": "10.25.1-snapshot-13",
42
+ "@instructure/ui-icons": "10.25.1-snapshot-13",
43
+ "@instructure/ui-motion": "10.25.1-snapshot-13",
44
+ "@instructure/ui-react-utils": "10.25.1-snapshot-13",
45
+ "@instructure/ui-themes": "10.25.1-snapshot-13",
46
+ "@instructure/ui-view": "10.25.1-snapshot-13",
47
47
  "keycode": "^2",
48
48
  "prop-types": "^15.8.1"
49
49
  },
@@ -136,15 +136,15 @@ class Alert extends Component<AlertProps, AlertState> {
136
136
  }
137
137
 
138
138
  // duck type for a dom node
139
- isDOMNode(n: Element | null) {
139
+ isDOMNode(n: Element | null | undefined) {
140
140
  return n && typeof n === 'object' && n.nodeType === 1
141
141
  }
142
142
 
143
143
  getLiveRegion() {
144
- let lr = null
145
- if (typeof this.props.liveRegion === 'function') {
146
- lr = this.props.liveRegion()
147
- }
144
+ const lr =
145
+ typeof this.props.liveRegion === 'function'
146
+ ? this.props.liveRegion()
147
+ : this.props.liveRegion
148
148
 
149
149
  return this.isDOMNode(lr) ? lr : null
150
150
  }
@@ -51,9 +51,9 @@ type AlertOwnProps = {
51
51
  */
52
52
  variantScreenReaderLabel?: string
53
53
  /**
54
- * Function that returns the DIV where screenreader alerts will be placed.
54
+ * A DOM element or function that returns an element where screenreader alerts will be placed.
55
55
  */
56
- liveRegion?: () => Element
56
+ liveRegion?: Element | null | (() => Element | null | undefined)
57
57
  /**
58
58
  * Choose the politeness level of screenreader alerts, sets the value of
59
59
  * `aria-live`.
@@ -132,7 +132,7 @@ const propTypes: PropValidators<PropKeys> = {
132
132
  children: PropTypes.node,
133
133
  variant: PropTypes.oneOf(['info', 'success', 'warning', 'error']),
134
134
  margin: PropTypes.string,
135
- liveRegion: PropTypes.func,
135
+ liveRegion: PropTypes.oneOfType([PropTypes.func, PropTypes.element]),
136
136
  liveRegionPoliteness: PropTypes.oneOf(['polite', 'assertive']),
137
137
  isLiveRegionAtomic: PropTypes.bool,
138
138
  screenReaderOnly: PropTypes.bool,