@instructure/ui-alerts 8.17.0 → 8.17.1-snapshot.17

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/LICENSE.md ADDED
@@ -0,0 +1,27 @@
1
+ ---
2
+ title: The MIT License (MIT)
3
+ category: Getting Started
4
+ order: 9
5
+ ---
6
+
7
+ # The MIT License (MIT)
8
+
9
+ Copyright (c) 2015 Instructure, Inc.
10
+
11
+ **Permission is hereby granted, free of charge, to any person obtaining a copy
12
+ of this software and associated documentation files (the "Software"), to deal
13
+ in the Software without restriction, including without limitation the rights
14
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15
+ copies of the Software, and to permit persons to whom the Software is
16
+ furnished to do so, subject to the following conditions.**
17
+
18
+ The above copyright notice and this permission notice shall be included in all
19
+ copies or substantial portions of the Software.
20
+
21
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
27
+ SOFTWARE.
package/es/Alert/index.js CHANGED
@@ -1,4 +1,4 @@
1
- var _dec, _class, _class2, _temp;
1
+ var _dec, _dec2, _class, _class2, _temp;
2
2
 
3
3
  /*
4
4
  * The MIT License (MIT)
@@ -28,14 +28,13 @@ var _dec, _class, _class2, _temp;
28
28
  import React, { Component } from 'react';
29
29
  import ReactDOM from 'react-dom';
30
30
  import keycode from 'keycode';
31
- import { callRenderProp } from '@instructure/ui-react-utils';
31
+ import { callRenderProp, withDeterministicId } from '@instructure/ui-react-utils';
32
32
  import { CloseButton } from '@instructure/ui-buttons';
33
33
  import { View } from '@instructure/ui-view';
34
34
  import { ScreenReaderContent } from '@instructure/ui-a11y-content';
35
35
  import { IconCheckMarkSolid, IconInfoBorderlessSolid, IconWarningBorderlessSolid, IconNoSolid } from '@instructure/ui-icons';
36
36
  import { Transition } from '@instructure/ui-motion';
37
37
  import { logError as error } from '@instructure/console';
38
- import { uid } from '@instructure/uid';
39
38
  import { canvas } from '@instructure/ui-themes';
40
39
  import { withStyle, jsx, InstUISettingsProvider } from '@instructure/emotion';
41
40
  import generateStyle from './styles';
@@ -48,7 +47,7 @@ category: components
48
47
  ---
49
48
  @tsProps
50
49
  **/
51
- let Alert = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_class = (_temp = _class2 = class Alert extends Component {
50
+ let Alert = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyle, generateComponentTheme), _dec(_class = _dec2(_class = (_temp = _class2 = class Alert extends Component {
52
51
  constructor(props) {
53
52
  super(props);
54
53
  this._timeouts = [];
@@ -141,7 +140,7 @@ let Alert = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_clas
141
140
  const liveRegion = this.getLiveRegion();
142
141
 
143
142
  if (liveRegion) {
144
- this.srid = uid('Alert');
143
+ this.srid = this.props.deterministicId();
145
144
  const div = document.createElement('div');
146
145
  div.setAttribute('id', this.srid);
147
146
  this.renderScreenreeaderAlert(div);
@@ -297,6 +296,6 @@ let Alert = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_clas
297
296
  isLiveRegionAtomic: false,
298
297
  children: null,
299
298
  hasShadow: true
300
- }, _temp)) || _class);
299
+ }, _temp)) || _class) || _class);
301
300
  export default Alert;
302
301
  export { Alert };
@@ -17,6 +17,8 @@ var _keycode = _interopRequireDefault(require("keycode"));
17
17
 
18
18
  var _callRenderProp = require("@instructure/ui-react-utils/lib/callRenderProp.js");
19
19
 
20
+ var _withDeterministicId = require("@instructure/ui-react-utils/lib/DeterministicIdContext/withDeterministicId.js");
21
+
20
22
  var _CloseButton = require("@instructure/ui-buttons/lib/CloseButton");
21
23
 
22
24
  var _View = require("@instructure/ui-view/lib/View");
@@ -35,8 +37,6 @@ var _Transition = require("@instructure/ui-motion/lib/Transition");
35
37
 
36
38
  var _console = require("@instructure/console");
37
39
 
38
- var _uid = require("@instructure/uid");
39
-
40
40
  var _uiThemes = require("@instructure/ui-themes");
41
41
 
42
42
  var _emotion = require("@instructure/emotion");
@@ -47,7 +47,7 @@ var _theme = _interopRequireDefault(require("./theme"));
47
47
 
48
48
  var _props = require("./props");
49
49
 
50
- var _dec, _class, _class2, _temp;
50
+ var _dec, _dec2, _class, _class2, _temp;
51
51
 
52
52
  /**
53
53
  ---
@@ -55,7 +55,7 @@ category: components
55
55
  ---
56
56
  @tsProps
57
57
  **/
58
- let Alert = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec(_class = (_temp = _class2 = class Alert extends _react.Component {
58
+ let Alert = (_dec = (0, _withDeterministicId.withDeterministicId)(), _dec2 = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec(_class = _dec2(_class = (_temp = _class2 = class Alert extends _react.Component {
59
59
  constructor(props) {
60
60
  super(props);
61
61
  this._timeouts = [];
@@ -148,7 +148,7 @@ let Alert = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _d
148
148
  const liveRegion = this.getLiveRegion();
149
149
 
150
150
  if (liveRegion) {
151
- this.srid = (0, _uid.uid)('Alert');
151
+ this.srid = this.props.deterministicId();
152
152
  const div = document.createElement('div');
153
153
  div.setAttribute('id', this.srid);
154
154
  this.renderScreenreeaderAlert(div);
@@ -307,7 +307,7 @@ let Alert = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _d
307
307
  isLiveRegionAtomic: false,
308
308
  children: null,
309
309
  hasShadow: true
310
- }, _temp)) || _class);
310
+ }, _temp)) || _class) || _class);
311
311
  exports.Alert = Alert;
312
312
  var _default = Alert;
313
313
  exports.default = _default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@instructure/ui-alerts",
3
- "version": "8.17.0",
3
+ "version": "8.17.1-snapshot.17+8e38d5a2e",
4
4
  "description": "An alert component",
5
5
  "author": "Instructure, Inc. Engineering and Product Design",
6
6
  "module": "./es/index.js",
@@ -23,24 +23,24 @@
23
23
  },
24
24
  "license": "MIT",
25
25
  "devDependencies": {
26
- "@instructure/ui-babel-preset": "8.17.0",
27
- "@instructure/ui-color-utils": "8.17.0",
28
- "@instructure/ui-test-utils": "8.17.0"
26
+ "@instructure/ui-babel-preset": "8.17.1-snapshot.17+8e38d5a2e",
27
+ "@instructure/ui-color-utils": "8.17.1-snapshot.17+8e38d5a2e",
28
+ "@instructure/ui-test-utils": "8.17.1-snapshot.17+8e38d5a2e"
29
29
  },
30
30
  "dependencies": {
31
31
  "@babel/runtime": "^7.13.10",
32
- "@instructure/console": "8.17.0",
33
- "@instructure/emotion": "8.17.0",
34
- "@instructure/shared-types": "8.17.0",
35
- "@instructure/ui-a11y-content": "8.17.0",
36
- "@instructure/ui-buttons": "8.17.0",
37
- "@instructure/ui-icons": "8.17.0",
38
- "@instructure/ui-motion": "8.17.0",
39
- "@instructure/ui-react-utils": "8.17.0",
40
- "@instructure/ui-themes": "8.17.0",
41
- "@instructure/ui-utils": "8.17.0",
42
- "@instructure/ui-view": "8.17.0",
43
- "@instructure/uid": "8.17.0",
32
+ "@instructure/console": "8.17.1-snapshot.17+8e38d5a2e",
33
+ "@instructure/emotion": "8.17.1-snapshot.17+8e38d5a2e",
34
+ "@instructure/shared-types": "8.17.1-snapshot.17+8e38d5a2e",
35
+ "@instructure/ui-a11y-content": "8.17.1-snapshot.17+8e38d5a2e",
36
+ "@instructure/ui-buttons": "8.17.1-snapshot.17+8e38d5a2e",
37
+ "@instructure/ui-icons": "8.17.1-snapshot.17+8e38d5a2e",
38
+ "@instructure/ui-motion": "8.17.1-snapshot.17+8e38d5a2e",
39
+ "@instructure/ui-react-utils": "8.17.1-snapshot.17+8e38d5a2e",
40
+ "@instructure/ui-themes": "8.17.1-snapshot.17+8e38d5a2e",
41
+ "@instructure/ui-utils": "8.17.1-snapshot.17+8e38d5a2e",
42
+ "@instructure/ui-view": "8.17.1-snapshot.17+8e38d5a2e",
43
+ "@instructure/uid": "8.17.1-snapshot.17+8e38d5a2e",
44
44
  "keycode": "^2",
45
45
  "prop-types": "^15"
46
46
  },
@@ -51,5 +51,6 @@
51
51
  "publishConfig": {
52
52
  "access": "public"
53
53
  },
54
- "sideEffects": false
54
+ "sideEffects": false,
55
+ "gitHead": "8e38d5a2e11e842eafa2fa270e47a261c6ebb626"
55
56
  }
@@ -26,7 +26,10 @@ import React, { Component } from 'react'
26
26
  import ReactDOM from 'react-dom'
27
27
  import keycode from 'keycode'
28
28
 
29
- import { callRenderProp } from '@instructure/ui-react-utils'
29
+ import {
30
+ callRenderProp,
31
+ withDeterministicId
32
+ } from '@instructure/ui-react-utils'
30
33
  import { CloseButton } from '@instructure/ui-buttons'
31
34
  import { View } from '@instructure/ui-view'
32
35
  import type { ViewOwnProps } from '@instructure/ui-view'
@@ -39,7 +42,6 @@ import {
39
42
  } from '@instructure/ui-icons'
40
43
  import { Transition } from '@instructure/ui-motion'
41
44
  import { logError as error } from '@instructure/console'
42
- import { uid } from '@instructure/uid'
43
45
  import { canvas } from '@instructure/ui-themes'
44
46
  import { withStyle, jsx, InstUISettingsProvider } from '@instructure/emotion'
45
47
 
@@ -55,6 +57,7 @@ category: components
55
57
  ---
56
58
  @tsProps
57
59
  **/
60
+ @withDeterministicId()
58
61
  @withStyle(generateStyle, generateComponentTheme)
59
62
  class Alert extends Component<AlertProps, AlertState> {
60
63
  static readonly componentId = 'Alert'
@@ -166,7 +169,7 @@ class Alert extends Component<AlertProps, AlertState> {
166
169
  createScreenreaderAlert() {
167
170
  const liveRegion = this.getLiveRegion()
168
171
  if (liveRegion) {
169
- this.srid = uid('Alert')
172
+ this.srid = this.props.deterministicId!()
170
173
 
171
174
  const div = document.createElement('div')
172
175
  div.setAttribute('id', this.srid)
@@ -33,6 +33,7 @@ import type {
33
33
  ComponentStyle
34
34
  } from '@instructure/emotion'
35
35
  import type { AlertTheme, PropValidators } from '@instructure/shared-types'
36
+ import type { WithDeterministicIdProps } from '@instructure/ui-react-utils'
36
37
 
37
38
  type AlertOwnProps = {
38
39
  /**
@@ -96,7 +97,7 @@ type PropKeys = keyof AlertOwnProps
96
97
 
97
98
  type AllowedPropKeys = Readonly<Array<PropKeys>>
98
99
 
99
- type AlertProps = AlertOwnProps & WithStyleProps<AlertTheme, AlertStyle>
100
+ type AlertProps = AlertOwnProps & WithStyleProps<AlertTheme, AlertStyle> & WithDeterministicIdProps
100
101
 
101
102
  type AlertStyle = ComponentStyle<'alert' | 'icon' | 'closeButton' | 'content'>
102
103