@instructure/ui-position 8.12.1-snapshot.7 → 8.13.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,6 +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
+ # [8.13.0](https://github.com/instructure/instructure-ui/compare/v8.12.0...v8.13.0) (2021-12-01)
7
+
8
+ ### Bug Fixes
9
+
10
+ - **ui-popover,ui-tooltip:** fixed Tooltip triggers being transformed to links/buttons ([07b0037](https://github.com/instructure/instructure-ui/commit/07b0037b0ddaf6d4f19cca140fc82fc9a2f1efc9))
11
+
6
12
  # [8.12.0](https://github.com/instructure/instructure-ui/compare/v8.11.1...v8.12.0) (2021-11-17)
7
13
 
8
14
  **Note:** Version bump only for package @instructure/ui-position
@@ -26,17 +26,27 @@ import { Position } from './index';
26
26
  import { PositionContentLocator } from './PositionContentLocator';
27
27
  import { PositionTargetLocator } from './PositionTargetLocator';
28
28
  export const customMethods = {
29
- findTarget: (element, ...args) => {
29
+ findTarget: function (element) {
30
30
  if (element && element.getAttribute) {
31
31
  const id = element.getAttribute(Position.locatorAttribute);
32
+
33
+ for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
34
+ args[_key - 1] = arguments[_key];
35
+ }
36
+
32
37
  return locator(`[${Position.targetLocatorAttribute}="${id}"]`).find(...args);
33
38
  }
34
39
 
35
40
  throw new Error('Element ' + element + ' not found');
36
41
  },
37
- findContent: (element, ...args) => {
42
+ findContent: function (element) {
38
43
  if (element && element.getAttribute) {
39
44
  const id = element.getAttribute(Position.locatorAttribute);
45
+
46
+ for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
47
+ args[_key2 - 1] = arguments[_key2];
48
+ }
49
+
40
50
  return locator(`[${Position.contentLocatorAttribute}="${id}"]`).find(...args);
41
51
  }
42
52
 
@@ -112,7 +112,7 @@ let Position = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2 =
112
112
  }
113
113
 
114
114
  componentDidUpdate(prevProps, prevState) {
115
- var _this$props$makeStyle2, _this$props3;
115
+ var _this$props$makeStyle2, _this$props2;
116
116
 
117
117
  this.position();
118
118
  this.toggleLocatorAttributes(true);
@@ -125,17 +125,15 @@ let Position = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2 =
125
125
  style = _this$state.style,
126
126
  placement = _this$state.placement;
127
127
 
128
- if (style && prevState.style && (placement !== prevState.placement || style.top !== prevState.style.top || style.left !== prevState.style.left)) {
129
- var _this$props$onPositio, _this$props2;
130
-
131
- (_this$props$onPositio = (_this$props2 = this.props).onPositionChanged) === null || _this$props$onPositio === void 0 ? void 0 : _this$props$onPositio.call(_this$props2, {
128
+ if (style && prevState.style && (placement !== prevState.placement || style.top !== prevState.style.top || style.left !== prevState.style.left) && typeof this.props.onPositionChanged === 'function') {
129
+ this.props.onPositionChanged({
132
130
  top: style.top,
133
131
  left: style.left,
134
132
  placement
135
133
  });
136
134
  }
137
135
 
138
- (_this$props$makeStyle2 = (_this$props3 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props3);
136
+ (_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2);
139
137
  }
140
138
 
141
139
  componentWillUnmount() {
@@ -261,8 +259,6 @@ let Position = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2 =
261
259
  offsetY: 0,
262
260
  shouldTrackPosition: true,
263
261
  shouldPositionOverTarget: false,
264
- onPositioned: () => {},
265
- onPositionChanged: () => {},
266
262
  children: null
267
263
  }, _class2.locatorAttribute = 'data-position', _class2.targetLocatorAttribute = 'data-position-target', _class2.contentLocatorAttribute = 'data-position-content', _temp)) || _class) || _class);
268
264
  export default Position;
@@ -26,7 +26,9 @@ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
26
26
  import { getBoundingClientRect, getScrollParents, getOffsetParents, canUseDOM, findDOMNode, ownerDocument, ownerWindow } from '@instructure/ui-dom-utils';
27
27
  import { mirrorPlacement } from './mirrorPlacement';
28
28
 
29
- function calculateElementPosition(element, target, options = {}) {
29
+ function calculateElementPosition(element, target) {
30
+ let options = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
31
+
30
32
  if (!element || options.placement === 'offscreen') {
31
33
  // hide offscreen content at the bottom of the DOM from screenreaders
32
34
  // unless content is contained somewhere else
@@ -51,10 +53,11 @@ function calculateElementPosition(element, target, options = {}) {
51
53
  }
52
54
 
53
55
  class PositionedElement {
54
- constructor(element, placement, offset = {
55
- top: 0,
56
- left: 0
57
- }) {
56
+ constructor(element, placement) {
57
+ let offset = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {
58
+ top: 0,
59
+ left: 0
60
+ };
58
61
  this.node = void 0;
59
62
  this.placement = void 0;
60
63
  this.rect = void 0;
@@ -9,13 +9,14 @@ Object.defineProperty(exports, "PositionContentLocator", {
9
9
  return _PositionContentLocator.PositionContentLocator;
10
10
  }
11
11
  });
12
+ exports.PositionLocator = void 0;
12
13
  Object.defineProperty(exports, "PositionTargetLocator", {
13
14
  enumerable: true,
14
15
  get: function () {
15
16
  return _PositionTargetLocator.PositionTargetLocator;
16
17
  }
17
18
  });
18
- exports.PositionLocator = exports.customMethods = void 0;
19
+ exports.customMethods = void 0;
19
20
 
20
21
  var _locator = require("@instructure/ui-test-locator/lib/utils/locator.js");
21
22
 
@@ -49,17 +50,27 @@ var _PositionTargetLocator = require("./PositionTargetLocator");
49
50
  * SOFTWARE.
50
51
  */
51
52
  const customMethods = {
52
- findTarget: (element, ...args) => {
53
+ findTarget: function (element) {
53
54
  if (element && element.getAttribute) {
54
55
  const id = element.getAttribute(_index.Position.locatorAttribute);
56
+
57
+ for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
58
+ args[_key - 1] = arguments[_key];
59
+ }
60
+
55
61
  return (0, _locator.locator)(`[${_index.Position.targetLocatorAttribute}="${id}"]`).find(...args);
56
62
  }
57
63
 
58
64
  throw new Error('Element ' + element + ' not found');
59
65
  },
60
- findContent: (element, ...args) => {
66
+ findContent: function (element) {
61
67
  if (element && element.getAttribute) {
62
68
  const id = element.getAttribute(_index.Position.locatorAttribute);
69
+
70
+ for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
71
+ args[_key2 - 1] = arguments[_key2];
72
+ }
73
+
63
74
  return (0, _locator.locator)(`[${_index.Position.contentLocatorAttribute}="${id}"]`).find(...args);
64
75
  }
65
76
 
@@ -5,7 +5,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
- exports.Position = exports.default = void 0;
8
+ exports.default = exports.Position = void 0;
9
9
 
10
10
  var _react = require("react");
11
11
 
@@ -116,7 +116,7 @@ let Position = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default),
116
116
  }
117
117
 
118
118
  componentDidUpdate(prevProps, prevState) {
119
- var _this$props$makeStyle2, _this$props3;
119
+ var _this$props$makeStyle2, _this$props2;
120
120
 
121
121
  this.position();
122
122
  this.toggleLocatorAttributes(true);
@@ -129,17 +129,15 @@ let Position = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default),
129
129
  style = _this$state.style,
130
130
  placement = _this$state.placement;
131
131
 
132
- if (style && prevState.style && (placement !== prevState.placement || style.top !== prevState.style.top || style.left !== prevState.style.left)) {
133
- var _this$props$onPositio, _this$props2;
134
-
135
- (_this$props$onPositio = (_this$props2 = this.props).onPositionChanged) === null || _this$props$onPositio === void 0 ? void 0 : _this$props$onPositio.call(_this$props2, {
132
+ if (style && prevState.style && (placement !== prevState.placement || style.top !== prevState.style.top || style.left !== prevState.style.left) && typeof this.props.onPositionChanged === 'function') {
133
+ this.props.onPositionChanged({
136
134
  top: style.top,
137
135
  left: style.left,
138
136
  placement
139
137
  });
140
138
  }
141
139
 
142
- (_this$props$makeStyle2 = (_this$props3 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props3);
140
+ (_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2);
143
141
  }
144
142
 
145
143
  componentWillUnmount() {
@@ -265,8 +263,6 @@ let Position = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default),
265
263
  offsetY: 0,
266
264
  shouldTrackPosition: true,
267
265
  shouldPositionOverTarget: false,
268
- onPositioned: () => {},
269
- onPositionChanged: () => {},
270
266
  children: null
271
267
  }, _class2.locatorAttribute = 'data-position', _class2.targetLocatorAttribute = 'data-position-target', _class2.contentLocatorAttribute = 'data-position-content', _temp)) || _class) || _class);
272
268
  exports.Position = Position;
@@ -3,16 +3,16 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- Object.defineProperty(exports, "PositionLocator", {
6
+ Object.defineProperty(exports, "PositionContentLocator", {
7
7
  enumerable: true,
8
8
  get: function () {
9
- return _PositionLocator.PositionLocator;
9
+ return _PositionLocator.PositionContentLocator;
10
10
  }
11
11
  });
12
- Object.defineProperty(exports, "PositionContentLocator", {
12
+ Object.defineProperty(exports, "PositionLocator", {
13
13
  enumerable: true,
14
14
  get: function () {
15
- return _PositionLocator.PositionContentLocator;
15
+ return _PositionLocator.PositionLocator;
16
16
  }
17
17
  });
18
18
  Object.defineProperty(exports, "PositionTargetLocator", {
@@ -5,7 +5,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
- exports.allowedProps = exports.propTypes = void 0;
8
+ exports.propTypes = exports.allowedProps = void 0;
9
9
 
10
10
  var _propTypes = _interopRequireDefault(require("prop-types"));
11
11
 
@@ -5,7 +5,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
- exports.mirrorMap = exports.placementPropValues = exports.PositionPropTypes = exports.default = void 0;
8
+ exports.placementPropValues = exports.mirrorMap = exports.default = exports.PositionPropTypes = void 0;
9
9
 
10
10
  var _propTypes = _interopRequireDefault(require("prop-types"));
11
11
 
@@ -6,8 +6,8 @@ Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
8
  exports.calculateElementPosition = calculateElementPosition;
9
- exports.parsePlacement = parsePlacement;
10
9
  exports.default = void 0;
10
+ exports.parsePlacement = parsePlacement;
11
11
 
12
12
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
13
13
 
@@ -50,7 +50,9 @@ var _mirrorPlacement = require("./mirrorPlacement");
50
50
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
51
51
  * SOFTWARE.
52
52
  */
53
- function calculateElementPosition(element, target, options = {}) {
53
+ function calculateElementPosition(element, target) {
54
+ let options = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
55
+
54
56
  if (!element || options.placement === 'offscreen') {
55
57
  // hide offscreen content at the bottom of the DOM from screenreaders
56
58
  // unless content is contained somewhere else
@@ -75,10 +77,11 @@ function calculateElementPosition(element, target, options = {}) {
75
77
  }
76
78
 
77
79
  class PositionedElement {
78
- constructor(element, placement, offset = {
79
- top: 0,
80
- left: 0
81
- }) {
80
+ constructor(element, placement) {
81
+ let offset = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {
82
+ top: 0,
83
+ left: 0
84
+ };
82
85
  this.node = void 0;
83
86
  this.placement = void 0;
84
87
  this.rect = void 0;
@@ -5,8 +5,8 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
- exports.executeMirrorFunction = executeMirrorFunction;
9
8
  exports.default = void 0;
9
+ exports.executeMirrorFunction = executeMirrorFunction;
10
10
 
11
11
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
12
12
 
package/lib/index.js CHANGED
@@ -9,22 +9,22 @@ Object.defineProperty(exports, "Position", {
9
9
  return _Position.Position;
10
10
  }
11
11
  });
12
- Object.defineProperty(exports, "calculateElementPosition", {
12
+ Object.defineProperty(exports, "PositionPropTypes", {
13
13
  enumerable: true,
14
14
  get: function () {
15
- return _calculateElementPosition.calculateElementPosition;
15
+ return _PositionPropTypes.PositionPropTypes;
16
16
  }
17
17
  });
18
- Object.defineProperty(exports, "executeMirrorFunction", {
18
+ Object.defineProperty(exports, "calculateElementPosition", {
19
19
  enumerable: true,
20
20
  get: function () {
21
- return _executeMirrorFunction.executeMirrorFunction;
21
+ return _calculateElementPosition.calculateElementPosition;
22
22
  }
23
23
  });
24
- Object.defineProperty(exports, "PositionPropTypes", {
24
+ Object.defineProperty(exports, "executeMirrorFunction", {
25
25
  enumerable: true,
26
26
  get: function () {
27
- return _PositionPropTypes.PositionPropTypes;
27
+ return _executeMirrorFunction.executeMirrorFunction;
28
28
  }
29
29
  });
30
30
  Object.defineProperty(exports, "mirrorHorizontalPlacement", {
@@ -5,8 +5,8 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
- exports.mirrorHorizontalPlacement = mirrorHorizontalPlacement;
9
8
  exports.default = void 0;
9
+ exports.mirrorHorizontalPlacement = mirrorHorizontalPlacement;
10
10
 
11
11
  var _PositionPropTypes = require("./PositionPropTypes");
12
12
 
@@ -5,8 +5,8 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
- exports.mirrorPlacement = mirrorPlacement;
9
8
  exports.default = void 0;
9
+ exports.mirrorPlacement = mirrorPlacement;
10
10
 
11
11
  var _PositionPropTypes = require("./PositionPropTypes");
12
12
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@instructure/ui-position",
3
- "version": "8.12.1-snapshot.7+1e7ac8219",
3
+ "version": "8.13.0",
4
4
  "description": "A component for positioning content with respect to a designated target.",
5
5
  "author": "Instructure, Inc. Engineering and Product Design",
6
6
  "type": "commonjs",
@@ -25,24 +25,24 @@
25
25
  "license": "MIT",
26
26
  "dependencies": {
27
27
  "@babel/runtime": "^7.13.10",
28
- "@instructure/debounce": "8.12.1-snapshot.7+1e7ac8219",
29
- "@instructure/emotion": "8.12.1-snapshot.7+1e7ac8219",
30
- "@instructure/shared-types": "8.12.1-snapshot.7+1e7ac8219",
31
- "@instructure/ui-dom-utils": "8.12.1-snapshot.7+1e7ac8219",
32
- "@instructure/ui-portal": "8.12.1-snapshot.7+1e7ac8219",
33
- "@instructure/ui-prop-types": "8.12.1-snapshot.7+1e7ac8219",
34
- "@instructure/ui-react-utils": "8.12.1-snapshot.7+1e7ac8219",
35
- "@instructure/ui-testable": "8.12.1-snapshot.7+1e7ac8219",
36
- "@instructure/ui-utils": "8.12.1-snapshot.7+1e7ac8219",
37
- "@instructure/uid": "8.12.1-snapshot.7+1e7ac8219",
28
+ "@instructure/debounce": "8.13.0",
29
+ "@instructure/emotion": "8.13.0",
30
+ "@instructure/shared-types": "8.13.0",
31
+ "@instructure/ui-dom-utils": "8.13.0",
32
+ "@instructure/ui-portal": "8.13.0",
33
+ "@instructure/ui-prop-types": "8.13.0",
34
+ "@instructure/ui-react-utils": "8.13.0",
35
+ "@instructure/ui-testable": "8.13.0",
36
+ "@instructure/ui-utils": "8.13.0",
37
+ "@instructure/uid": "8.13.0",
38
38
  "prop-types": "^15"
39
39
  },
40
40
  "devDependencies": {
41
- "@instructure/ui-babel-preset": "8.12.1-snapshot.7+1e7ac8219",
42
- "@instructure/ui-color-utils": "8.12.1-snapshot.7+1e7ac8219",
43
- "@instructure/ui-test-locator": "8.12.1-snapshot.7+1e7ac8219",
44
- "@instructure/ui-test-utils": "8.12.1-snapshot.7+1e7ac8219",
45
- "@instructure/ui-themes": "8.12.1-snapshot.7+1e7ac8219"
41
+ "@instructure/ui-babel-preset": "8.13.0",
42
+ "@instructure/ui-color-utils": "8.13.0",
43
+ "@instructure/ui-test-locator": "8.13.0",
44
+ "@instructure/ui-test-utils": "8.13.0",
45
+ "@instructure/ui-themes": "8.13.0"
46
46
  },
47
47
  "peerDependencies": {
48
48
  "react": ">=16.8 <=17"
@@ -50,6 +50,5 @@
50
50
  "publishConfig": {
51
51
  "access": "public"
52
52
  },
53
- "sideEffects": false,
54
- "gitHead": "1e7ac821932a91fe9ef761c96f747c7ea1f3925a"
53
+ "sideEffects": false
55
54
  }
@@ -76,8 +76,6 @@ class Position extends Component<PositionProps, PositionState> {
76
76
  offsetY: 0,
77
77
  shouldTrackPosition: true,
78
78
  shouldPositionOverTarget: false,
79
- onPositioned: () => {},
80
- onPositionChanged: () => {},
81
79
  children: null
82
80
  }
83
81
 
@@ -151,9 +149,10 @@ class Position extends Component<PositionProps, PositionState> {
151
149
  prevState.style &&
152
150
  (placement !== prevState.placement ||
153
151
  style.top !== prevState.style.top ||
154
- style.left !== prevState.style.left)
152
+ style.left !== prevState.style.left) &&
153
+ typeof this.props.onPositionChanged === 'function'
155
154
  ) {
156
- this.props.onPositionChanged?.({
155
+ this.props.onPositionChanged({
157
156
  top: style.top,
158
157
  left: style.left,
159
158
  placement
@@ -42,7 +42,7 @@ type PositionOwnProps = {
42
42
  /**
43
43
  * The node to use as the position target
44
44
  */
45
- renderTarget?: React.ReactNode | ((...args: any[]) => React.ReactNode)
45
+ renderTarget?: React.ReactNode | (() => React.ReactNode)
46
46
 
47
47
  /**
48
48
  * The target to be used when not using `renderTarget`
@@ -100,12 +100,12 @@ type PositionOwnProps = {
100
100
  /**
101
101
  * Callback fired when the position changes
102
102
  */
103
- onPositionChanged?: (position: Position) => any
103
+ onPositionChanged?: (position: PositionObject) => void
104
104
 
105
105
  /**
106
106
  * Callback fired when `<Position />` content has been mounted and is initially positioned
107
107
  */
108
- onPositioned?: (position: Position) => any
108
+ onPositioned?: (position: PositionObject) => void
109
109
 
110
110
  /**
111
111
  * The content to be positioned
@@ -124,7 +124,7 @@ type PositionState = {
124
124
 
125
125
  type PositionStyle = ComponentStyle<'zIndex'>
126
126
 
127
- type Position = ElementPosition['style'] & {
127
+ type PositionObject = ElementPosition['style'] & {
128
128
  placement: ElementPosition['placement']
129
129
  }
130
130
 
@@ -171,5 +171,5 @@ const allowedProps: AllowedPropKeys = [
171
171
  'elementRef'
172
172
  ]
173
173
 
174
- export type { PositionProps, PositionState, PositionStyle }
174
+ export type { PositionProps, PositionState, PositionStyle, PositionObject }
175
175
  export { propTypes, allowedProps }
package/src/index.ts CHANGED
@@ -36,4 +36,4 @@ export type {
36
36
  PositionConstraint
37
37
  } from './PositionPropTypes'
38
38
 
39
- export type { PositionProps } from './Position/props'
39
+ export type { PositionProps, PositionObject } from './Position/props'
@@ -14,7 +14,7 @@ category: components/utilities
14
14
  declare class Position extends Component<PositionProps, PositionState> {
15
15
  static readonly componentId = "Position";
16
16
  static allowedProps: readonly (keyof {
17
- renderTarget?: import("react").ReactNode | ((...args: any[]) => import("react").ReactNode);
17
+ renderTarget?: import("react").ReactNode | (() => import("react").ReactNode);
18
18
  target?: import("../PositionPropTypes").PositionMountNode | undefined;
19
19
  placement?: import("../PositionPropTypes").PlacementPropValues | undefined;
20
20
  mountNode?: import("../PositionPropTypes").PositionMountNode | undefined;
@@ -25,35 +25,13 @@ declare class Position extends Component<PositionProps, PositionState> {
25
25
  id?: string | undefined;
26
26
  shouldTrackPosition?: boolean | undefined;
27
27
  shouldPositionOverTarget?: boolean | undefined;
28
- onPositionChanged?: ((position: {
29
- top?: 0 | undefined;
30
- left?: 0 | "-9999em" | undefined;
31
- overflow?: "hidden" | undefined;
32
- position?: "absolute" | undefined;
33
- display?: "none" | null | undefined;
34
- minWidth?: number | null | undefined;
35
- minHeight?: number | null | undefined;
36
- transform?: string | undefined;
37
- } & {
38
- placement: import("../PositionPropTypes").PlacementPropValues | undefined;
39
- }) => any) | undefined;
40
- onPositioned?: ((position: {
41
- top?: 0 | undefined;
42
- left?: 0 | "-9999em" | undefined;
43
- overflow?: "hidden" | undefined;
44
- position?: "absolute" | undefined;
45
- display?: "none" | null | undefined;
46
- minWidth?: number | null | undefined;
47
- minHeight?: number | null | undefined;
48
- transform?: string | undefined;
49
- } & {
50
- placement: import("../PositionPropTypes").PlacementPropValues | undefined;
51
- }) => any) | undefined;
28
+ onPositionChanged?: ((position: import("./props").PositionObject) => void) | undefined;
29
+ onPositioned?: ((position: import("./props").PositionObject) => void) | undefined;
52
30
  children?: import("react").ReactNode;
53
31
  elementRef?: ((element: Element | null) => void) | undefined;
54
32
  })[];
55
33
  static propTypes: import("@instructure/shared-types/types/UtilityTypes").PropValidators<keyof {
56
- renderTarget?: import("react").ReactNode | ((...args: any[]) => import("react").ReactNode);
34
+ renderTarget?: import("react").ReactNode | (() => import("react").ReactNode);
57
35
  target?: import("../PositionPropTypes").PositionMountNode | undefined;
58
36
  placement?: import("../PositionPropTypes").PlacementPropValues | undefined;
59
37
  mountNode?: import("../PositionPropTypes").PositionMountNode | undefined;
@@ -64,30 +42,8 @@ declare class Position extends Component<PositionProps, PositionState> {
64
42
  id?: string | undefined;
65
43
  shouldTrackPosition?: boolean | undefined;
66
44
  shouldPositionOverTarget?: boolean | undefined;
67
- onPositionChanged?: ((position: {
68
- top?: 0 | undefined;
69
- left?: 0 | "-9999em" | undefined;
70
- overflow?: "hidden" | undefined;
71
- position?: "absolute" | undefined;
72
- display?: "none" | null | undefined;
73
- minWidth?: number | null | undefined;
74
- minHeight?: number | null | undefined;
75
- transform?: string | undefined;
76
- } & {
77
- placement: import("../PositionPropTypes").PlacementPropValues | undefined;
78
- }) => any) | undefined;
79
- onPositioned?: ((position: {
80
- top?: 0 | undefined;
81
- left?: 0 | "-9999em" | undefined;
82
- overflow?: "hidden" | undefined;
83
- position?: "absolute" | undefined;
84
- display?: "none" | null | undefined;
85
- minWidth?: number | null | undefined;
86
- minHeight?: number | null | undefined;
87
- transform?: string | undefined;
88
- } & {
89
- placement: import("../PositionPropTypes").PlacementPropValues | undefined;
90
- }) => any) | undefined;
45
+ onPositionChanged?: ((position: import("./props").PositionObject) => void) | undefined;
46
+ onPositioned?: ((position: import("./props").PositionObject) => void) | undefined;
91
47
  children?: import("react").ReactNode;
92
48
  elementRef?: ((element: Element | null) => void) | undefined;
93
49
  }>;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/Position/index.tsx"],"names":[],"mappings":";AAwBA,eAAe;AACf,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAWjC,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,2BAA2B,CAAA;AAS3E,OAAO,EAAa,GAAG,EAAE,MAAM,sBAAsB,CAAA;AAIrD,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAI3D,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAEtD;;;;;GAKG;AACH,cAEM,QAAS,SAAQ,SAAS,CAAC,aAAa,EAAE,aAAa,CAAC;IAC5D,MAAM,CAAC,QAAQ,CAAC,WAAW,cAAa;IAExC,MAAM,CAAC,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;SAAe;IAClC,MAAM,CAAC,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAAY;IAE5B,MAAM,CAAC,YAAY,EAAE,aAAa,CAYjC;IAED,MAAM,CAAC,gBAAgB,SAAkB;IACzC,MAAM,CAAC,sBAAsB,SAAyB;IACt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AO,EAAE,QAAQ,EAAE,CAAA"}
@@ -6,7 +6,7 @@ declare type PositionOwnProps = {
6
6
  /**
7
7
  * The node to use as the position target
8
8
  */
9
- renderTarget?: React.ReactNode | ((...args: any[]) => React.ReactNode);
9
+ renderTarget?: React.ReactNode | (() => React.ReactNode);
10
10
  /**
11
11
  * The target to be used when not using `renderTarget`
12
12
  */
@@ -53,11 +53,11 @@ declare type PositionOwnProps = {
53
53
  /**
54
54
  * Callback fired when the position changes
55
55
  */
56
- onPositionChanged?: (position: Position) => any;
56
+ onPositionChanged?: (position: PositionObject) => void;
57
57
  /**
58
58
  * Callback fired when `<Position />` content has been mounted and is initially positioned
59
59
  */
60
- onPositioned?: (position: Position) => any;
60
+ onPositioned?: (position: PositionObject) => void;
61
61
  /**
62
62
  * The content to be positioned
63
63
  */
@@ -71,7 +71,7 @@ declare type PositionState = {
71
71
  positioned: boolean;
72
72
  } & ElementPosition;
73
73
  declare type PositionStyle = ComponentStyle<'zIndex'>;
74
- declare type Position = ElementPosition['style'] & {
74
+ declare type PositionObject = ElementPosition['style'] & {
75
75
  placement: ElementPosition['placement'];
76
76
  };
77
77
  declare type PropKeys = keyof PositionOwnProps;
@@ -79,6 +79,6 @@ declare type AllowedPropKeys = Readonly<Array<PropKeys>>;
79
79
  declare type PositionProps = PositionOwnProps & WithStyleProps<PositionTheme, PositionStyle>;
80
80
  declare const propTypes: PropValidators<PropKeys>;
81
81
  declare const allowedProps: AllowedPropKeys;
82
- export type { PositionProps, PositionState, PositionStyle };
82
+ export type { PositionProps, PositionState, PositionStyle, PositionObject };
83
83
  export { propTypes, allowedProps };
84
84
  //# sourceMappingURL=props.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"props.d.ts","sourceRoot":"","sources":["../../src/Position/props.ts"],"names":[],"mappings":"AAwBA,OAAO,KAAK,MAAM,OAAO,CAAA;AAOzB,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAC1E,OAAO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AAM,SAAS,EAAE,cAAc,CAAC,QAAQ,CAgBvC,CAAA;AAED,QAAA,MAAM,YAAY,EAAE,eAgBnB,CAAA;AAED,YAAY,EAAE,aAAa,EAAE,aAAa,EAAE,aAAa,EAAE,cAAc,EAAE,CAAA;AAC3E,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,CAAA"}
package/types/index.d.ts CHANGED
@@ -6,5 +6,5 @@ export { mirrorHorizontalPlacement } from './mirrorHorizontalPlacement';
6
6
  export { mirrorPlacement } from './mirrorPlacement';
7
7
  export { parsePlacement } from './parsePlacement';
8
8
  export type { PlacementPropValues, PositionMountNode, PositionConstraint } from './PositionPropTypes';
9
- export type { PositionProps } from './Position/props';
9
+ export type { PositionProps, PositionObject } from './Position/props';
10
10
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAuBA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AAErC,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAA;AACrE,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAA;AAC/D,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAA;AACvD,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAA;AACvE,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAEjD,YAAY,EACV,mBAAmB,EACnB,iBAAiB,EACjB,kBAAkB,EACnB,MAAM,qBAAqB,CAAA;AAE5B,YAAY,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAuBA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AAErC,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAA;AACrE,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAA;AAC/D,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAA;AACvD,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAA;AACvE,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAEjD,YAAY,EACV,mBAAmB,EACnB,iBAAiB,EACjB,kBAAkB,EACnB,MAAM,qBAAqB,CAAA;AAE5B,YAAY,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA"}
package/LICENSE.md DELETED
@@ -1,27 +0,0 @@
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.