@instructure/ui-dialog 8.10.3-snapshot.19 → 8.10.3-snapshot.23

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.
@@ -47,12 +47,14 @@ class Dialog extends Component {
47
47
  this._root = null;
48
48
 
49
49
  this.getRef = el => {
50
- var _this$props$elementRe, _this$props;
50
+ const elementRef = this.props.elementRef; // TODO: deprecate _root? ref should be enough
51
51
 
52
- // TODO: deprecate _root? ref should be enough
53
52
  this._root = el;
54
53
  this.ref = el;
55
- (_this$props$elementRe = (_this$props = this.props).elementRef) === null || _this$props$elementRe === void 0 ? void 0 : _this$props$elementRe.call(_this$props, el);
54
+
55
+ if (typeof elementRef === 'function') {
56
+ elementRef(el);
57
+ }
56
58
  };
57
59
  }
58
60
 
@@ -91,10 +93,10 @@ class Dialog extends Component {
91
93
  }
92
94
 
93
95
  open() {
94
- const _this$props2 = this.props,
95
- open = _this$props2.open,
96
- contentElement = _this$props2.contentElement,
97
- options = _objectWithoutProperties(_this$props2, _excluded);
96
+ const _this$props = this.props,
97
+ open = _this$props.open,
98
+ contentElement = _this$props.contentElement,
99
+ options = _objectWithoutProperties(_this$props, _excluded);
98
100
 
99
101
  this._raf.push(requestAnimationFrame(() => {
100
102
  // It needs to wait a heartbeat until the content is fully loaded
@@ -68,6 +68,10 @@ const propTypes = {
68
68
  shouldCloseOnDocumentClick: PropTypes.bool,
69
69
  shouldCloseOnEscape: PropTypes.bool,
70
70
  shouldFocusOnOpen: PropTypes.bool,
71
+
72
+ /**
73
+ * provides a reference to the underlying html root element
74
+ */
71
75
  elementRef: PropTypes.func
72
76
  };
73
77
  const allowedProps = ['children', 'as', 'display', 'label', 'open', 'onBlur', 'onDismiss', 'defaultFocusElement', 'contentElement', 'liveRegion', 'shouldContainFocus', 'shouldReturnFocus', 'shouldCloseOnDocumentClick', 'shouldCloseOnEscape', 'shouldFocusOnOpen', 'elementRef'];
@@ -45,12 +45,14 @@ class Dialog extends _react.Component {
45
45
  this._root = null;
46
46
 
47
47
  this.getRef = el => {
48
- var _this$props$elementRe, _this$props;
48
+ const elementRef = this.props.elementRef; // TODO: deprecate _root? ref should be enough
49
49
 
50
- // TODO: deprecate _root? ref should be enough
51
50
  this._root = el;
52
51
  this.ref = el;
53
- (_this$props$elementRe = (_this$props = this.props).elementRef) === null || _this$props$elementRe === void 0 ? void 0 : _this$props$elementRe.call(_this$props, el);
52
+
53
+ if (typeof elementRef === 'function') {
54
+ elementRef(el);
55
+ }
54
56
  };
55
57
  }
56
58
 
@@ -89,10 +91,10 @@ class Dialog extends _react.Component {
89
91
  }
90
92
 
91
93
  open() {
92
- const _this$props2 = this.props,
93
- open = _this$props2.open,
94
- contentElement = _this$props2.contentElement,
95
- options = (0, _objectWithoutProperties2.default)(_this$props2, _excluded);
94
+ const _this$props = this.props,
95
+ open = _this$props.open,
96
+ contentElement = _this$props.contentElement,
97
+ options = (0, _objectWithoutProperties2.default)(_this$props, _excluded);
96
98
 
97
99
  this._raf.push((0, _requestAnimationFrame.requestAnimationFrame)(() => {
98
100
  // It needs to wait a heartbeat until the content is fully loaded
@@ -78,6 +78,10 @@ const propTypes = {
78
78
  shouldCloseOnDocumentClick: _propTypes.default.bool,
79
79
  shouldCloseOnEscape: _propTypes.default.bool,
80
80
  shouldFocusOnOpen: _propTypes.default.bool,
81
+
82
+ /**
83
+ * provides a reference to the underlying html root element
84
+ */
81
85
  elementRef: _propTypes.default.func
82
86
  };
83
87
  exports.propTypes = propTypes;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@instructure/ui-dialog",
3
- "version": "8.10.3-snapshot.19+ff8a37832",
3
+ "version": "8.10.3-snapshot.23+5aaa29662",
4
4
  "description": "A utility component for managing keyboard accessibility and screen reader behavior",
5
5
  "author": "Instructure, Inc. Engineering and Product Design",
6
6
  "type": "commonjs",
@@ -25,18 +25,18 @@
25
25
  "license": "MIT",
26
26
  "dependencies": {
27
27
  "@babel/runtime": "^7.13.10",
28
- "@instructure/shared-types": "8.10.3-snapshot.19+ff8a37832",
29
- "@instructure/ui-a11y-utils": "8.10.3-snapshot.19+ff8a37832",
30
- "@instructure/ui-dom-utils": "8.10.3-snapshot.19+ff8a37832",
31
- "@instructure/ui-react-utils": "8.10.3-snapshot.19+ff8a37832",
32
- "@instructure/ui-testable": "8.10.3-snapshot.19+ff8a37832",
28
+ "@instructure/shared-types": "8.10.3-snapshot.23+5aaa29662",
29
+ "@instructure/ui-a11y-utils": "8.10.3-snapshot.23+5aaa29662",
30
+ "@instructure/ui-dom-utils": "8.10.3-snapshot.23+5aaa29662",
31
+ "@instructure/ui-react-utils": "8.10.3-snapshot.23+5aaa29662",
32
+ "@instructure/ui-testable": "8.10.3-snapshot.23+5aaa29662",
33
33
  "prop-types": "^15"
34
34
  },
35
35
  "devDependencies": {
36
- "@instructure/console": "8.10.3-snapshot.19+ff8a37832",
37
- "@instructure/ui-babel-preset": "8.10.3-snapshot.19+ff8a37832",
38
- "@instructure/ui-prop-types": "8.10.3-snapshot.19+ff8a37832",
39
- "@instructure/ui-test-utils": "8.10.3-snapshot.19+ff8a37832"
36
+ "@instructure/console": "8.10.3-snapshot.23+5aaa29662",
37
+ "@instructure/ui-babel-preset": "8.10.3-snapshot.23+5aaa29662",
38
+ "@instructure/ui-prop-types": "8.10.3-snapshot.23+5aaa29662",
39
+ "@instructure/ui-test-utils": "8.10.3-snapshot.23+5aaa29662"
40
40
  },
41
41
  "peerDependencies": {
42
42
  "react": ">=16.8 <=17"
@@ -45,5 +45,5 @@
45
45
  "access": "public"
46
46
  },
47
47
  "sideEffects": false,
48
- "gitHead": "ff8a37832bae778ea0507342d81a32c63cd5f023"
48
+ "gitHead": "5aaa296621d72faebe1a809a8895a8185587008d"
49
49
  }
@@ -28,7 +28,6 @@ import { omitProps, getElementType } from '@instructure/ui-react-utils'
28
28
  import { findDOMNode, requestAnimationFrame } from '@instructure/ui-dom-utils'
29
29
  import type { RequestAnimationFrameType } from '@instructure/ui-dom-utils'
30
30
  import { logError as error } from '@instructure/console'
31
- import type { OtherHTMLAttributes } from '@instructure/shared-types'
32
31
  import { FocusRegionManager } from '@instructure/ui-a11y-utils'
33
32
 
34
33
  import { propTypes, allowedProps } from './props'
@@ -41,7 +40,7 @@ category: components/utilities
41
40
  @module Dialog
42
41
  **/
43
42
 
44
- class Dialog extends Component<DialogProps & OtherHTMLAttributes<DialogProps>> {
43
+ class Dialog extends Component<DialogProps> {
45
44
  static readonly componentId = 'Dialog'
46
45
 
47
46
  static propTypes = propTypes
@@ -156,10 +155,15 @@ class Dialog extends Component<DialogProps & OtherHTMLAttributes<DialogProps>> {
156
155
  }
157
156
 
158
157
  getRef = (el: Element | null) => {
158
+ const { elementRef } = this.props
159
+
159
160
  // TODO: deprecate _root? ref should be enough
160
161
  this._root = el
161
162
  this.ref = el
162
- this.props.elementRef?.(el)
163
+
164
+ if (typeof elementRef === 'function') {
165
+ elementRef(el)
166
+ }
163
167
  }
164
168
 
165
169
  get contentElement() {
@@ -25,7 +25,11 @@
25
25
  import React from 'react'
26
26
  import PropTypes from 'prop-types'
27
27
 
28
- import type { AsElementType, PropValidators } from '@instructure/shared-types'
28
+ import type {
29
+ AsElementType,
30
+ OtherHTMLAttributes,
31
+ PropValidators
32
+ } from '@instructure/shared-types'
29
33
 
30
34
  type DialogOwnProps = {
31
35
  children?: React.ReactNode
@@ -53,7 +57,7 @@ type PropKeys = keyof DialogOwnProps
53
57
 
54
58
  type AllowedPropKeys = Readonly<Array<PropKeys>>
55
59
 
56
- type DialogProps = DialogOwnProps
60
+ type DialogProps = DialogOwnProps & OtherHTMLAttributes<DialogOwnProps>
57
61
 
58
62
  const propTypes: PropValidators<PropKeys> = {
59
63
  /**
@@ -110,6 +114,9 @@ const propTypes: PropValidators<PropKeys> = {
110
114
  shouldCloseOnDocumentClick: PropTypes.bool,
111
115
  shouldCloseOnEscape: PropTypes.bool,
112
116
  shouldFocusOnOpen: PropTypes.bool,
117
+ /**
118
+ * provides a reference to the underlying html root element
119
+ */
113
120
  elementRef: PropTypes.func
114
121
  }
115
122
 
@@ -1,6 +1,5 @@
1
1
  import React, { Component } from 'react';
2
2
  import type { RequestAnimationFrameType } from '@instructure/ui-dom-utils';
3
- import type { OtherHTMLAttributes } from '@instructure/shared-types';
4
3
  import type { DialogProps } from './props';
5
4
  /**
6
5
  ---
@@ -8,7 +7,7 @@ category: components/utilities
8
7
  ---
9
8
  @module Dialog
10
9
  **/
11
- declare class Dialog extends Component<DialogProps & OtherHTMLAttributes<DialogProps>> {
10
+ declare class Dialog extends Component<DialogProps> {
12
11
  static readonly componentId = "Dialog";
13
12
  static propTypes: import("@instructure/shared-types/types/UtilityTypes").PropValidators<keyof {
14
13
  children?: React.ReactNode;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/Dialog/index.tsx"],"names":[],"mappings":"AAwBA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAIxC,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,2BAA2B,CAAA;AAE1E,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAA;AAIpE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAE1C;;;;;GAKG;AAEH,cAAM,MAAO,SAAQ,SAAS,CAAC,WAAW,GAAG,mBAAmB,CAAC,WAAW,CAAC,CAAC;IAC5E,MAAM,CAAC,QAAQ,CAAC,WAAW,YAAW;IAEtC,MAAM,CAAC,SAAS;;;;;;;;;;;;;;;;;OAAY;IAC5B,MAAM,CAAC,YAAY;;;;;;;;;;;;;;;;;SAAe;IAClC,MAAM,CAAC,YAAY;;;;;;;;;;;;;MAeT;IAEV,SAAS,EAAE,UAAU,CAAC,OAAO,UAAU,CAAC,EAAE,CAAK;IAC/C,IAAI,EAAE,yBAAyB,EAAE,CAAK;IACtC,YAAY,OAAO;IACnB,GAAG,EAAE,OAAO,GAAG,IAAI,C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B;IAED,IAAI,OAAO,qBAOV;IAED,MAAM;CAgBP;AAED,eAAe,MAAM,CAAA;AACrB,OAAO,EAAE,MAAM,EAAE,CAAA"}
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import type { AsElementType, PropValidators } from '@instructure/shared-types';
2
+ import type { AsElementType, OtherHTMLAttributes, PropValidators } from '@instructure/shared-types';
3
3
  declare type DialogOwnProps = {
4
4
  children?: React.ReactNode;
5
5
  as?: AsElementType;
@@ -20,7 +20,7 @@ declare type DialogOwnProps = {
20
20
  };
21
21
  declare type PropKeys = keyof DialogOwnProps;
22
22
  declare type AllowedPropKeys = Readonly<Array<PropKeys>>;
23
- declare type DialogProps = DialogOwnProps;
23
+ declare type DialogProps = DialogOwnProps & OtherHTMLAttributes<DialogOwnProps>;
24
24
  declare const propTypes: PropValidators<PropKeys>;
25
25
  declare const allowedProps: AllowedPropKeys;
26
26
  export type { DialogProps };
@@ -1 +1 @@
1
- {"version":3,"file":"props.d.ts","sourceRoot":"","sources":["../../src/Dialog/props.ts"],"names":[],"mappings":"AAwBA,OAAO,KAAK,MAAM,OAAO,CAAA;AAGzB,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAA;AAE9E,aAAK,cAAc,GAAG;IACpB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAC1B,EAAE,CAAC,EAAE,aAAa,CAAA;IAClB,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,cAAc,CAAA;IAC3C,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,IAAI,CAAC,EAAE,OAAO,CAAA;IACd,MAAM,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,CAAA;IAChC,SAAS,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,CAAA;IACnC,mBAAmB,CAAC,EAAE,KAAK,CAAC,YAAY,GAAG,CAAC,CAAC,GAAG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