@instructure/ui-position 11.7.3 → 11.7.4-pr-snapshot-1781695314229
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 +12 -0
- package/LICENSE.md +1 -0
- package/{lib/Position/props.js → babel.config.cjs} +12 -7
- package/es/Position/index.js +40 -8
- package/es/PositionPropTypes.js +8 -0
- package/es/calculateElementPosition.js +108 -13
- package/es/index.js +6 -6
- package/es/mirrorHorizontalPlacement.js +4 -2
- package/es/mirrorPlacement.js +4 -2
- package/es/parsePlacement.js +1 -1
- package/package.json +14 -16
- package/src/Position/index.tsx +36 -11
- package/src/PositionPropTypes.ts +11 -0
- package/src/calculateElementPosition.ts +119 -15
- package/src/executeMirrorFunction.ts +1 -1
- package/src/index.ts +6 -6
- package/src/mirrorHorizontalPlacement.ts +2 -2
- package/src/mirrorPlacement.ts +2 -2
- package/src/parsePlacement.ts +1 -1
- package/tsconfig.build.tsbuildinfo +1 -1
- package/types/Position/index.d.ts +11 -7
- package/types/Position/index.d.ts.map +1 -1
- package/types/PositionPropTypes.d.ts +10 -0
- package/types/PositionPropTypes.d.ts.map +1 -1
- package/types/calculateElementPosition.d.ts +2 -2
- package/types/calculateElementPosition.d.ts.map +1 -1
- package/types/executeMirrorFunction.d.ts +1 -1
- package/types/executeMirrorFunction.d.ts.map +1 -1
- package/types/index.d.ts +6 -6
- package/types/index.d.ts.map +1 -1
- package/types/mirrorHorizontalPlacement.d.ts +1 -1
- package/types/mirrorHorizontalPlacement.d.ts.map +1 -1
- package/types/mirrorPlacement.d.ts +1 -1
- package/types/mirrorPlacement.d.ts.map +1 -1
- package/types/parsePlacement.d.ts +1 -1
- package/types/parsePlacement.d.ts.map +1 -1
- package/lib/Position/index.js +0 -249
- package/lib/Position/styles.js +0 -50
- package/lib/Position/theme.js +0 -47
- package/lib/PositionPropTypes.js +0 -57
- package/lib/calculateElementPosition.js +0 -524
- package/lib/executeMirrorFunction.js +0 -37
- package/lib/index.js +0 -47
- package/lib/mirrorHorizontalPlacement.js +0 -60
- package/lib/mirrorPlacement.js +0 -63
- package/lib/package.json +0 -1
- package/lib/parsePlacement.js +0 -12
|
@@ -1,21 +1,22 @@
|
|
|
1
1
|
import { Component } from 'react';
|
|
2
2
|
import type { PositionChangeListenerType } from '@instructure/ui-dom-utils';
|
|
3
3
|
import type { PositionProps, PositionState } from './props';
|
|
4
|
-
import { PositionElement } from '../PositionPropTypes';
|
|
4
|
+
import { PositionElement } from '../PositionPropTypes.js';
|
|
5
5
|
/**
|
|
6
6
|
---
|
|
7
|
-
category: components/
|
|
7
|
+
category: components/Util Components
|
|
8
8
|
---
|
|
9
9
|
**/
|
|
10
10
|
declare class Position extends Component<PositionProps, PositionState> {
|
|
11
|
+
static displayName: string;
|
|
11
12
|
static readonly componentId = "Position";
|
|
12
13
|
static allowedProps: readonly (keyof {
|
|
13
14
|
renderTarget?: import("@instructure/shared-types").Renderable;
|
|
14
|
-
target?: import("
|
|
15
|
-
placement?: import("
|
|
16
|
-
mountNode?: import("
|
|
15
|
+
target?: import("../PositionPropTypes.js").PositionMountNode;
|
|
16
|
+
placement?: import("../PositionPropTypes.js").PlacementPropValues;
|
|
17
|
+
mountNode?: import("../PositionPropTypes.js").PositionMountNode;
|
|
17
18
|
insertAt?: "bottom" | "top";
|
|
18
|
-
constrain?: import("
|
|
19
|
+
constrain?: import("../PositionPropTypes.js").PositionConstraint;
|
|
19
20
|
offsetX?: string | number;
|
|
20
21
|
offsetY?: string | number;
|
|
21
22
|
id?: string;
|
|
@@ -38,6 +39,8 @@ declare class Position extends Component<PositionProps, PositionState> {
|
|
|
38
39
|
_listener: PositionChangeListenerType | null;
|
|
39
40
|
_content?: PositionElement;
|
|
40
41
|
_target?: PositionElement;
|
|
42
|
+
_availableHeight?: number;
|
|
43
|
+
_availableWidth?: number;
|
|
41
44
|
handleRef: (el: Element | null) => void;
|
|
42
45
|
shouldComponentUpdate(nextProps: PositionProps, nextState: PositionState, nextContext: any): boolean;
|
|
43
46
|
componentDidMount(): void;
|
|
@@ -46,7 +49,8 @@ declare class Position extends Component<PositionProps, PositionState> {
|
|
|
46
49
|
toggleLocatorAttributes(set: boolean): void;
|
|
47
50
|
toggleLocatorAttribute(node: Node | Window | null | undefined, locator: string, set: boolean): void;
|
|
48
51
|
handlePortalOpen: () => void;
|
|
49
|
-
|
|
52
|
+
applyAvailableSpaceCustomProperties(): void;
|
|
53
|
+
calculatePosition(props: PositionProps): import("../PositionPropTypes.js").ElementPositionWithAvailableSpace;
|
|
50
54
|
position: () => void;
|
|
51
55
|
startTracking(): void;
|
|
52
56
|
stopTracking(): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/Position/index.tsx"],"names":[],"mappings":"AAwBA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAYjC,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,2BAA2B,CAAA;AAS3E,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAI3D,OAAO,EAAE,eAAe,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/Position/index.tsx"],"names":[],"mappings":"AAwBA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAYjC,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,2BAA2B,CAAA;AAS3E,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAI3D,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAA;AAEzD;;;;GAIG;AACH,cAEM,QAAS,SAAQ,SAAS,CAAC,aAAa,EAAE,aAAa,CAAC;IAC5D,MAAM,CAAC,WAAW,SAAa;IAC/B,MAAM,CAAC,QAAQ,CAAC,WAAW,cAAa;IAExC,MAAM,CAAC,YAAY;;;;;;;;;;;;;;;;;SAAe;IAEl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ElementPosition`, including the available
|
|
35
|
+
* space numbers driving `--ui-position-available-{height,width}`. Kept
|
|
36
|
+
* separate from `ElementPosition` so `PositionState` (which extends
|
|
37
|
+
* `ElementPosition`) doesn't falsely advertise these fields
|
|
38
|
+
*/
|
|
39
|
+
export type ElementPositionWithAvailableSpace = ElementPosition & {
|
|
40
|
+
availableHeight?: number;
|
|
41
|
+
availableWidth?: number;
|
|
42
|
+
};
|
|
33
43
|
export type PositionElement = UIElement;
|
|
34
44
|
export type Offset<Type extends number | string | undefined = number> = {
|
|
35
45
|
top: Type;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PositionPropTypes.d.ts","sourceRoot":"","sources":["../src/PositionPropTypes.ts"],"names":[],"mappings":"AAwBA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAA;AACzD,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAA;AAErD,QAAA,MAAM,mBAAmB,UAwBxB,CAAA;AAED;;GAEG;AACH,MAAM,MAAM,mBAAmB,GAC3B,KAAK,GACL,QAAQ,GACR,OAAO,GACP,KAAK,GACL,WAAW,GACX,YAAY,GACZ,SAAS,GACT,aAAa,GACb,cAAc,GACd,eAAe,GACf,YAAY,GACZ,gBAAgB,GAChB,WAAW,GACX,cAAc,GACd,cAAc,GACd,eAAe,GACf,SAAS,GACT,YAAY,GACZ,YAAY,GACZ,aAAa,GACb,cAAc,GACd,YAAY,GACZ,WAAW,CAAA;AAGf;;GAEG;AACH,MAAM,MAAM,iBAAiB,GAAG,OAAO,GAAG,CAAC,MAAM,OAAO,GAAG,IAAI,CAAC,GAAG,IAAI,CAAA;AAEvE;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAC1B,iBAAiB,GACjB,QAAQ,GACR,eAAe,GACf,QAAQ,GACR,MAAM,CAAA;AAGV,MAAM,MAAM,eAAe,GACvB,KAAK,GACL,OAAO,GACP,KAAK,GACL,QAAQ,GACR,QAAQ,GACR,SAAS,GACT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AC,EAAE,UAAU,CAAA;QACrB,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;QACvB,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;QACxB,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;QACzB,SAAS,CAAC,EAAE,MAAM,CAAA;KACnB,CAAA;CACF,CAAA;AAED;;;;;GAKG;AACH,MAAM,MAAM,iCAAiC,GAAG,eAAe,GAAG;IAChE,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,cAAc,CAAC,EAAE,MAAM,CAAA;CACxB,CAAA;AAED,MAAM,MAAM,eAAe,GAAG,SAAS,CAAA;AAEvC,MAAM,MAAM,MAAM,CAAC,IAAI,SAAS,MAAM,GAAG,MAAM,GAAG,SAAS,GAAG,MAAM,IAAI;IACtE,GAAG,EAAE,IAAI,CAAA;IACT,IAAI,EAAE,IAAI,CAAA;CACX,CAAA;AAED,MAAM,MAAM,IAAI,GAAG,IAAI,CAAC,QAAQ,EAAE,OAAO,GAAG,QAAQ,CAAC,CAAA;AACrD,MAAM,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,EAAE,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,OAAO,CAAC,CAAA;AAE1E,OAAO,EAAE,mBAAmB,EAAE,SAAS,EAAE,CAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { PlacementPropValues, PlacementValues, PositionConstraint, PositionMountNode,
|
|
1
|
+
import type { PlacementPropValues, PlacementValues, PositionConstraint, PositionMountNode, ElementPositionWithAvailableSpace, PositionElement } from './PositionPropTypes';
|
|
2
2
|
type PlacementValuesWithoutOffscreen = Exclude<PlacementValues, 'offscreen'>;
|
|
3
3
|
type PlacementValuesWithoutOffscreenArray = [
|
|
4
4
|
PlacementValuesWithoutOffscreen,
|
|
@@ -34,7 +34,7 @@ type Options = {
|
|
|
34
34
|
* @returns object containing style with the calculated position in the 'transform'
|
|
35
35
|
* property
|
|
36
36
|
*/
|
|
37
|
-
declare function calculateElementPosition(element?: PositionElement, target?: PositionElement, options?: Options):
|
|
37
|
+
declare function calculateElementPosition(element?: PositionElement, target?: PositionElement, options?: Options): ElementPositionWithAvailableSpace;
|
|
38
38
|
/**
|
|
39
39
|
* Returns the following:
|
|
40
40
|
* - When the input is just 1 element, then `[input, 'center']`, else:
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"calculateElementPosition.d.ts","sourceRoot":"","sources":["../src/calculateElementPosition.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"calculateElementPosition.d.ts","sourceRoot":"","sources":["../src/calculateElementPosition.ts"],"names":[],"mappings":"AAqCA,OAAO,KAAK,EACV,mBAAmB,EACnB,eAAe,EACf,kBAAkB,EAClB,iBAAiB,EAEjB,iCAAiC,EACjC,eAAe,EAIhB,MAAM,qBAAqB,CAAA;AAG5B,KAAK,+BAA+B,GAAG,OAAO,CAAC,eAAe,EAAE,WAAW,CAAC,CAAA;AAM5E,KAAK,oCAAoC,GAAG;IAC1C,+BAA+B;IAC/B,+BAA+B;CAChC,CAAA;AAED,KAAK,OAAO,GAAG;IACb,SAAS,CAAC,EAAE,mBAAmB,CAAA;IAC/B,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IACzB,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IACzB,SAAS,CAAC,EAAE,kBAAkB,CAAA;IAC9B,SAAS,CAAC,EAAE,iBAAiB,CAAA;IAC7B,IAAI,CAAC,EAAE,OAAO,CAAA;CACf,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,iBAAS,wBAAwB,CAC/B,OAAO,CAAC,EAAE,eAAe,EACzB,MAAM,CAAC,EAAE,eAAe,EACxB,OAAO,GAAE,OAAY,GACpB,iCAAiC,CA0BnC;AA6lBD;;;;;GAKG;AACH,iBAAS,cAAc,CAAC,SAAS,EAAE,mBAAmB,wCAQrD;AAMD,eAAe,wBAAwB,CAAA;AACvC,OAAO,EAAE,wBAAwB,EAAE,cAAc,EAAE,CAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { PlacementPropValues, PlacementValueArray, PlacementValues, PlacementStringValues } from './PositionPropTypes';
|
|
1
|
+
import { PlacementPropValues, PlacementValueArray, PlacementValues, PlacementStringValues } from './PositionPropTypes.js';
|
|
2
2
|
declare function executeMirrorFunction<D extends string | undefined = undefined>(placement: PlacementValueArray | PlacementStringValues, mirrorFunction: (first: PlacementValues, second: PlacementValues) => PlacementValueArray, delimiter?: D): D extends string ? D extends ' ' ? PlacementPropValues : string : PlacementValueArray;
|
|
3
3
|
export default executeMirrorFunction;
|
|
4
4
|
export { executeMirrorFunction };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"executeMirrorFunction.d.ts","sourceRoot":"","sources":["../src/executeMirrorFunction.ts"],"names":[],"mappings":"AAwBA,OAAO,EACL,mBAAmB,EACnB,mBAAmB,EACnB,eAAe,EACf,qBAAqB,EACtB,MAAM,
|
|
1
|
+
{"version":3,"file":"executeMirrorFunction.d.ts","sourceRoot":"","sources":["../src/executeMirrorFunction.ts"],"names":[],"mappings":"AAwBA,OAAO,EACL,mBAAmB,EACnB,mBAAmB,EACnB,eAAe,EACf,qBAAqB,EACtB,MAAM,wBAAwB,CAAA;AAE/B,iBAAS,qBAAqB,CAAC,CAAC,SAAS,MAAM,GAAG,SAAS,GAAG,SAAS,EACrE,SAAS,EAAE,mBAAmB,GAAG,qBAAqB,EACtD,cAAc,EAAE,CACd,KAAK,EAAE,eAAe,EACtB,MAAM,EAAE,eAAe,KACpB,mBAAmB,EACxB,SAAS,CAAC,EAAE,CAAC,GACZ,CAAC,SAAS,MAAM,GACf,CAAC,SAAS,GAAG,GACX,mBAAmB,GACnB,MAAM,GACR,mBAAmB,CAMtB;AAED,eAAe,qBAAqB,CAAA;AACpC,OAAO,EAAE,qBAAqB,EAAE,CAAA"}
|
package/types/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
export { Position } from './Position';
|
|
2
|
-
export { calculateElementPosition } from './calculateElementPosition';
|
|
3
|
-
export { executeMirrorFunction } from './executeMirrorFunction';
|
|
4
|
-
export { mirrorHorizontalPlacement } from './mirrorHorizontalPlacement';
|
|
5
|
-
export { mirrorPlacement } from './mirrorPlacement';
|
|
6
|
-
export { parsePlacement } from './parsePlacement';
|
|
1
|
+
export { Position } from './Position/index.js';
|
|
2
|
+
export { calculateElementPosition } from './calculateElementPosition.js';
|
|
3
|
+
export { executeMirrorFunction } from './executeMirrorFunction.js';
|
|
4
|
+
export { mirrorHorizontalPlacement } from './mirrorHorizontalPlacement.js';
|
|
5
|
+
export { mirrorPlacement } from './mirrorPlacement.js';
|
|
6
|
+
export { parsePlacement } from './parsePlacement.js';
|
|
7
7
|
export type { PlacementPropValues, PositionMountNode, PositionConstraint } from './PositionPropTypes';
|
|
8
8
|
export type { PositionProps, PositionObject } from './Position/props';
|
|
9
9
|
//# sourceMappingURL=index.d.ts.map
|
package/types/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAuBA,OAAO,EAAE,QAAQ,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAuBA,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAA;AAE9C,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAA;AACxE,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAA;AAClE,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAA;AAC1E,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AAEpD,YAAY,EACV,mBAAmB,EACnB,iBAAiB,EACjB,kBAAkB,EACnB,MAAM,qBAAqB,CAAA;AAE5B,YAAY,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { PlacementPropValues, PlacementValueArray, PlacementStringValues } from './PositionPropTypes';
|
|
1
|
+
import { PlacementPropValues, PlacementValueArray, PlacementStringValues } from './PositionPropTypes.js';
|
|
2
2
|
/**
|
|
3
3
|
* Given a string or array of one or two placement values, mirrors the placement
|
|
4
4
|
* horizontally.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mirrorHorizontalPlacement.d.ts","sourceRoot":"","sources":["../src/mirrorHorizontalPlacement.ts"],"names":[],"mappings":"AAwBA,OAAO,EACL,mBAAmB,EACnB,mBAAmB,EACnB,qBAAqB,EAEtB,MAAM,
|
|
1
|
+
{"version":3,"file":"mirrorHorizontalPlacement.d.ts","sourceRoot":"","sources":["../src/mirrorHorizontalPlacement.ts"],"names":[],"mappings":"AAwBA,OAAO,EACL,mBAAmB,EACnB,mBAAmB,EACnB,qBAAqB,EAEtB,MAAM,wBAAwB,CAAA;AAG/B;;;;;;;;;;;;;;;;;GAiBG;AACH,iBAAS,yBAAyB,CAAC,CAAC,SAAS,MAAM,GAAG,SAAS,GAAG,SAAS,EACzE,SAAS,EAAE,mBAAmB,GAAG,qBAAqB,EACtD,SAAS,CAAC,EAAE,CAAC,GACZ,CAAC,SAAS,MAAM,GACf,CAAC,SAAS,GAAG,GACX,mBAAmB,GACnB,MAAM,GACR,mBAAmB,CAUtB;AAED,eAAe,yBAAyB,CAAA;AACxC,OAAO,EAAE,yBAAyB,EAAE,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mirrorPlacement.d.ts","sourceRoot":"","sources":["../src/mirrorPlacement.ts"],"names":[],"mappings":"AAwBA,OAAO,EACL,mBAAmB,EACnB,mBAAmB,EACnB,qBAAqB,EAEtB,MAAM,
|
|
1
|
+
{"version":3,"file":"mirrorPlacement.d.ts","sourceRoot":"","sources":["../src/mirrorPlacement.ts"],"names":[],"mappings":"AAwBA,OAAO,EACL,mBAAmB,EACnB,mBAAmB,EACnB,qBAAqB,EAEtB,MAAM,wBAAwB,CAAA;AAI/B;;;;;;;;;;;;;;;;;;;;;;IAsBI;AACJ,iBAAS,eAAe,CAAC,CAAC,SAAS,MAAM,GAAG,SAAS,GAAG,SAAS,EAC/D,SAAS,EAAE,mBAAmB,GAAG,qBAAqB,EACtD,SAAS,CAAC,EAAE,CAAC,GACZ,CAAC,SAAS,MAAM,GACf,CAAC,SAAS,GAAG,GACX,mBAAmB,GACnB,MAAM,GACR,mBAAmB,CAQtB;AAED,eAAe,eAAe,CAAA;AAC9B,OAAO,EAAE,eAAe,EAAE,CAAA"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { parsePlacement } from './calculateElementPosition';
|
|
1
|
+
export { parsePlacement } from './calculateElementPosition.js';
|
|
2
2
|
//# sourceMappingURL=parsePlacement.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parsePlacement.d.ts","sourceRoot":"","sources":["../src/parsePlacement.ts"],"names":[],"mappings":"AAuBA,OAAO,EAAE,cAAc,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"parsePlacement.d.ts","sourceRoot":"","sources":["../src/parsePlacement.ts"],"names":[],"mappings":"AAuBA,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAA"}
|
package/lib/Position/index.js
DELETED
|
@@ -1,249 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.default = exports.Position = void 0;
|
|
8
|
-
var _react = require("react");
|
|
9
|
-
var _callRenderProp = require("@instructure/ui-react-utils/lib/callRenderProp.js");
|
|
10
|
-
var _ensureSingleChild = require("@instructure/ui-react-utils/lib/ensureSingleChild.js");
|
|
11
|
-
var _safeCloneElement = require("@instructure/ui-react-utils/lib/safeCloneElement.js");
|
|
12
|
-
var _withDeterministicId = require("@instructure/ui-react-utils/lib/DeterministicIdContext/withDeterministicId.js");
|
|
13
|
-
var _addPositionChangeListener = require("@instructure/ui-dom-utils/lib/addPositionChangeListener.js");
|
|
14
|
-
var _findDOMNode = require("@instructure/ui-dom-utils/lib/findDOMNode.js");
|
|
15
|
-
var _deepEqual = require("@instructure/ui-utils/lib/deepEqual.js");
|
|
16
|
-
var _shallowEqual = require("@instructure/ui-utils/lib/shallowEqual.js");
|
|
17
|
-
var _combineDataCid = require("@instructure/ui-utils/lib/combineDataCid.js");
|
|
18
|
-
var _debounce = require("@instructure/debounce");
|
|
19
|
-
var _Portal = require("@instructure/ui-portal/lib/Portal");
|
|
20
|
-
var _emotion = require("@instructure/emotion");
|
|
21
|
-
var _styles = _interopRequireDefault(require("./styles"));
|
|
22
|
-
var _theme = _interopRequireDefault(require("./theme"));
|
|
23
|
-
var _props = require("./props");
|
|
24
|
-
var _calculateElementPosition = require("../calculateElementPosition");
|
|
25
|
-
var _jsxRuntime = require("@emotion/react/jsx-runtime");
|
|
26
|
-
var _dec, _dec2, _class;
|
|
27
|
-
/*
|
|
28
|
-
* The MIT License (MIT)
|
|
29
|
-
*
|
|
30
|
-
* Copyright (c) 2015 - present Instructure, Inc.
|
|
31
|
-
*
|
|
32
|
-
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
33
|
-
* of this software and associated documentation files (the "Software"), to deal
|
|
34
|
-
* in the Software without restriction, including without limitation the rights
|
|
35
|
-
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
36
|
-
* copies of the Software, and to permit persons to whom the Software is
|
|
37
|
-
* furnished to do so, subject to the following conditions:
|
|
38
|
-
*
|
|
39
|
-
* The above copyright notice and this permission notice shall be included in all
|
|
40
|
-
* copies or substantial portions of the Software.
|
|
41
|
-
*
|
|
42
|
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
43
|
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
44
|
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
45
|
-
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
46
|
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
47
|
-
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
48
|
-
* SOFTWARE.
|
|
49
|
-
*/
|
|
50
|
-
/**
|
|
51
|
-
---
|
|
52
|
-
category: components/utilities
|
|
53
|
-
---
|
|
54
|
-
**/
|
|
55
|
-
let Position = exports.Position = (_dec = (0, _withDeterministicId.withDeterministicId)(), _dec2 = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec(_class = _dec2(_class = class Position extends _react.Component {
|
|
56
|
-
static displayName = "Position";
|
|
57
|
-
static componentId = 'Position';
|
|
58
|
-
static allowedProps = _props.allowedProps;
|
|
59
|
-
static defaultProps = {
|
|
60
|
-
placement: 'bottom center',
|
|
61
|
-
mountNode: null,
|
|
62
|
-
insertAt: 'bottom',
|
|
63
|
-
constrain: 'window',
|
|
64
|
-
offsetX: 0,
|
|
65
|
-
offsetY: 0,
|
|
66
|
-
shouldTrackPosition: true,
|
|
67
|
-
shouldPositionOverTarget: false,
|
|
68
|
-
children: null
|
|
69
|
-
};
|
|
70
|
-
static locatorAttribute = 'data-position';
|
|
71
|
-
static targetLocatorAttribute = 'data-position-target';
|
|
72
|
-
static contentLocatorAttribute = 'data-position-content';
|
|
73
|
-
constructor(props) {
|
|
74
|
-
super(props);
|
|
75
|
-
this.state = {
|
|
76
|
-
positioned: false,
|
|
77
|
-
...this.calculatePosition(props)
|
|
78
|
-
};
|
|
79
|
-
this.position = (0, _debounce.debounce)(this.position, 0, {
|
|
80
|
-
leading: false,
|
|
81
|
-
trailing: true
|
|
82
|
-
});
|
|
83
|
-
this._id = this.props.id || props.deterministicId();
|
|
84
|
-
}
|
|
85
|
-
ref = null;
|
|
86
|
-
_id;
|
|
87
|
-
_timeouts = [];
|
|
88
|
-
_listener = null;
|
|
89
|
-
_content;
|
|
90
|
-
_target;
|
|
91
|
-
handleRef = el => {
|
|
92
|
-
const {
|
|
93
|
-
elementRef
|
|
94
|
-
} = this.props;
|
|
95
|
-
this.ref = el;
|
|
96
|
-
if (typeof elementRef === 'function') {
|
|
97
|
-
elementRef(el);
|
|
98
|
-
}
|
|
99
|
-
};
|
|
100
|
-
shouldComponentUpdate(nextProps, nextState, nextContext) {
|
|
101
|
-
return !(0, _deepEqual.deepEqual)(this.state, nextState) || !(0, _shallowEqual.shallowEqual)(this.props, nextProps) || !(0, _shallowEqual.shallowEqual)(this.context, nextContext);
|
|
102
|
-
}
|
|
103
|
-
componentDidMount() {
|
|
104
|
-
this.toggleLocatorAttributes(true);
|
|
105
|
-
this.props.makeStyles?.();
|
|
106
|
-
}
|
|
107
|
-
componentDidUpdate(prevProps, prevState) {
|
|
108
|
-
this.position();
|
|
109
|
-
this.toggleLocatorAttributes(true);
|
|
110
|
-
if (this.props.shouldTrackPosition !== prevProps.shouldTrackPosition) {
|
|
111
|
-
this.props.shouldTrackPosition ? this.startTracking() : this.stopTracking();
|
|
112
|
-
}
|
|
113
|
-
const {
|
|
114
|
-
style,
|
|
115
|
-
placement
|
|
116
|
-
} = this.state;
|
|
117
|
-
if (style && prevState.style && (placement !== prevState.placement || style.top !== prevState.style.top || style.left !== prevState.style.left) && typeof this.props.onPositionChanged === 'function') {
|
|
118
|
-
this.props.onPositionChanged({
|
|
119
|
-
top: style.top,
|
|
120
|
-
left: style.left,
|
|
121
|
-
placement
|
|
122
|
-
});
|
|
123
|
-
}
|
|
124
|
-
this.props.makeStyles?.();
|
|
125
|
-
}
|
|
126
|
-
componentWillUnmount() {
|
|
127
|
-
;
|
|
128
|
-
this.position.cancel();
|
|
129
|
-
this.stopTracking();
|
|
130
|
-
this._timeouts.forEach(timeout => clearTimeout(timeout));
|
|
131
|
-
this.toggleLocatorAttributes(false);
|
|
132
|
-
}
|
|
133
|
-
toggleLocatorAttributes(set) {
|
|
134
|
-
// We have to find the actual DOM nodes and append the attributes
|
|
135
|
-
// directly, as we can't be sure when safe cloning the child that
|
|
136
|
-
// it will accept the data attribute as a prop
|
|
137
|
-
this.toggleLocatorAttribute((0, _findDOMNode.findDOMNode)(this._content), Position.contentLocatorAttribute, set);
|
|
138
|
-
this.toggleLocatorAttribute((0, _findDOMNode.findDOMNode)(this._target), Position.targetLocatorAttribute, set);
|
|
139
|
-
}
|
|
140
|
-
toggleLocatorAttribute(node, locator, set) {
|
|
141
|
-
if (node && node.hasAttribute) {
|
|
142
|
-
if (set && !node.hasAttribute(locator)) {
|
|
143
|
-
;
|
|
144
|
-
node.setAttribute(locator, this._id);
|
|
145
|
-
}
|
|
146
|
-
if (!set && node.hasAttribute(locator)) {
|
|
147
|
-
;
|
|
148
|
-
node.removeAttribute(locator);
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
handlePortalOpen = () => {
|
|
153
|
-
this.position();
|
|
154
|
-
if (this.props.shouldTrackPosition) {
|
|
155
|
-
this.startTracking();
|
|
156
|
-
}
|
|
157
|
-
this._timeouts.push(setTimeout(() => {
|
|
158
|
-
if (this.state.positioned && typeof this.props.onPositioned === 'function') {
|
|
159
|
-
this.props.onPositioned({
|
|
160
|
-
top: this.state.style.top,
|
|
161
|
-
left: this.state.style.left,
|
|
162
|
-
placement: this.state.placement
|
|
163
|
-
});
|
|
164
|
-
}
|
|
165
|
-
}, 0));
|
|
166
|
-
};
|
|
167
|
-
calculatePosition(props) {
|
|
168
|
-
return (0, _calculateElementPosition.calculateElementPosition)(this._content, this._target, {
|
|
169
|
-
placement: props.placement,
|
|
170
|
-
offsetX: props.offsetX,
|
|
171
|
-
offsetY: props.offsetY,
|
|
172
|
-
constrain: props.constrain,
|
|
173
|
-
container: props.mountNode,
|
|
174
|
-
over: props.shouldPositionOverTarget
|
|
175
|
-
});
|
|
176
|
-
}
|
|
177
|
-
position = () => {
|
|
178
|
-
this.setState({
|
|
179
|
-
positioned: true,
|
|
180
|
-
...this.calculatePosition(this.props)
|
|
181
|
-
});
|
|
182
|
-
};
|
|
183
|
-
startTracking() {
|
|
184
|
-
this._listener = this._listener || (0, _addPositionChangeListener.addPositionChangeListener)(this._target, this.position);
|
|
185
|
-
}
|
|
186
|
-
stopTracking() {
|
|
187
|
-
if (this._listener) {
|
|
188
|
-
this._listener.remove();
|
|
189
|
-
this._listener = null;
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
// content that needs to be positioned relative to the target
|
|
194
|
-
renderContent() {
|
|
195
|
-
let content = (0, _ensureSingleChild.ensureSingleChild)(this.props.children);
|
|
196
|
-
if (content) {
|
|
197
|
-
content = (0, _safeCloneElement.safeCloneElement)(content, {
|
|
198
|
-
ref: el => {
|
|
199
|
-
this._content = el;
|
|
200
|
-
},
|
|
201
|
-
style: {
|
|
202
|
-
boxSizing: 'border-box',
|
|
203
|
-
zIndex: this.props.styles?.zIndex,
|
|
204
|
-
...content.props.style,
|
|
205
|
-
...this.state.style
|
|
206
|
-
},
|
|
207
|
-
...(content.props.className && {
|
|
208
|
-
className: content.props.className
|
|
209
|
-
}),
|
|
210
|
-
[Position.contentLocatorAttribute]: this._id
|
|
211
|
-
});
|
|
212
|
-
content = (0, _jsxRuntime.jsx)(_Portal.Portal, {
|
|
213
|
-
open: true,
|
|
214
|
-
onOpen: this.handlePortalOpen,
|
|
215
|
-
mountNode: this.props.mountNode,
|
|
216
|
-
insertAt: this.props.insertAt,
|
|
217
|
-
children: content
|
|
218
|
-
});
|
|
219
|
-
}
|
|
220
|
-
return content;
|
|
221
|
-
}
|
|
222
|
-
renderTarget() {
|
|
223
|
-
const target = (0, _callRenderProp.callRenderProp)(this.props.renderTarget);
|
|
224
|
-
if (target) {
|
|
225
|
-
return (0, _safeCloneElement.safeCloneElement)(target, {
|
|
226
|
-
ref: el => {
|
|
227
|
-
this._target = el;
|
|
228
|
-
},
|
|
229
|
-
[Position.targetLocatorAttribute]: this._id
|
|
230
|
-
});
|
|
231
|
-
} else if (this.props.target) {
|
|
232
|
-
this._target = (0, _callRenderProp.callRenderProp)(this.props.target);
|
|
233
|
-
}
|
|
234
|
-
return null;
|
|
235
|
-
}
|
|
236
|
-
render() {
|
|
237
|
-
const props = {
|
|
238
|
-
[Position.locatorAttribute]: this._id
|
|
239
|
-
};
|
|
240
|
-
return (0, _jsxRuntime.jsxs)("span", {
|
|
241
|
-
...props,
|
|
242
|
-
css: this.props.styles?.position,
|
|
243
|
-
ref: this.handleRef,
|
|
244
|
-
"data-cid": (0, _combineDataCid.combineDataCid)('Position', this.props),
|
|
245
|
-
children: [this.renderTarget(), this.renderContent()]
|
|
246
|
-
});
|
|
247
|
-
}
|
|
248
|
-
}) || _class) || _class);
|
|
249
|
-
var _default = exports.default = Position;
|
package/lib/Position/styles.js
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
/*
|
|
8
|
-
* The MIT License (MIT)
|
|
9
|
-
*
|
|
10
|
-
* Copyright (c) 2015 - present Instructure, Inc.
|
|
11
|
-
*
|
|
12
|
-
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
13
|
-
* of this software and associated documentation files (the "Software"), to deal
|
|
14
|
-
* in the Software without restriction, including without limitation the rights
|
|
15
|
-
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
16
|
-
* copies of the Software, and to permit persons to whom the Software is
|
|
17
|
-
* furnished to do so, subject to the following conditions:
|
|
18
|
-
*
|
|
19
|
-
* The above copyright notice and this permission notice shall be included in all
|
|
20
|
-
* copies or substantial portions of the Software.
|
|
21
|
-
*
|
|
22
|
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
23
|
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
24
|
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
25
|
-
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
26
|
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
27
|
-
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
28
|
-
* SOFTWARE.
|
|
29
|
-
*/
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* ---
|
|
33
|
-
* private: true
|
|
34
|
-
* ---
|
|
35
|
-
* Generates the style object from the theme and provided additional information
|
|
36
|
-
* @param {Object} componentTheme The theme variable object.
|
|
37
|
-
* @param {Object} props the props of the component, the style is applied to
|
|
38
|
-
* @param {Object} state the state of the component, the style is applied to
|
|
39
|
-
* @return {Object} The final style object, which will be used in the component
|
|
40
|
-
*/
|
|
41
|
-
const generateStyle = (componentTheme, props) => {
|
|
42
|
-
return {
|
|
43
|
-
position: {
|
|
44
|
-
label: 'position',
|
|
45
|
-
display: props.containerDisplay
|
|
46
|
-
},
|
|
47
|
-
zIndex: componentTheme.zIndex
|
|
48
|
-
};
|
|
49
|
-
};
|
|
50
|
-
var _default = exports.default = generateStyle;
|
package/lib/Position/theme.js
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
/*
|
|
8
|
-
* The MIT License (MIT)
|
|
9
|
-
*
|
|
10
|
-
* Copyright (c) 2015 - present Instructure, Inc.
|
|
11
|
-
*
|
|
12
|
-
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
13
|
-
* of this software and associated documentation files (the "Software"), to deal
|
|
14
|
-
* in the Software without restriction, including without limitation the rights
|
|
15
|
-
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
16
|
-
* copies of the Software, and to permit persons to whom the Software is
|
|
17
|
-
* furnished to do so, subject to the following conditions:
|
|
18
|
-
*
|
|
19
|
-
* The above copyright notice and this permission notice shall be included in all
|
|
20
|
-
* copies or substantial portions of the Software.
|
|
21
|
-
*
|
|
22
|
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
23
|
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
24
|
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
25
|
-
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
26
|
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
27
|
-
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
28
|
-
* SOFTWARE.
|
|
29
|
-
*/
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* Generates the theme object for the component from the theme and provided additional information
|
|
33
|
-
* @param {Object} theme The actual theme object.
|
|
34
|
-
* @return {Object} The final theme object with the overrides and component variables
|
|
35
|
-
*/
|
|
36
|
-
const generateComponentTheme = theme => {
|
|
37
|
-
const {
|
|
38
|
-
stacking
|
|
39
|
-
} = theme;
|
|
40
|
-
const componentVariables = {
|
|
41
|
-
zIndex: stacking?.topmost
|
|
42
|
-
};
|
|
43
|
-
return {
|
|
44
|
-
...componentVariables
|
|
45
|
-
};
|
|
46
|
-
};
|
|
47
|
-
var _default = exports.default = generateComponentTheme;
|
package/lib/PositionPropTypes.js
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.placementPropValues = exports.mirrorMap = void 0;
|
|
7
|
-
/*
|
|
8
|
-
* The MIT License (MIT)
|
|
9
|
-
*
|
|
10
|
-
* Copyright (c) 2015 - present Instructure, Inc.
|
|
11
|
-
*
|
|
12
|
-
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
13
|
-
* of this software and associated documentation files (the "Software"), to deal
|
|
14
|
-
* in the Software without restriction, including without limitation the rights
|
|
15
|
-
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
16
|
-
* copies of the Software, and to permit persons to whom the Software is
|
|
17
|
-
* furnished to do so, subject to the following conditions:
|
|
18
|
-
*
|
|
19
|
-
* The above copyright notice and this permission notice shall be included in all
|
|
20
|
-
* copies or substantial portions of the Software.
|
|
21
|
-
*
|
|
22
|
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
23
|
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
24
|
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
25
|
-
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
26
|
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
27
|
-
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
28
|
-
* SOFTWARE.
|
|
29
|
-
*/
|
|
30
|
-
|
|
31
|
-
const placementPropValues = exports.placementPropValues = ['top', 'bottom', 'start', 'end', 'top start', 'top center', 'top end', 'top stretch', 'bottom start', 'bottom center', 'bottom end', 'bottom stretch', 'start top', 'start center', 'start bottom', 'start stretch', 'end top', 'end center', 'end bottom', 'end stretch', 'center start', 'center end', 'offscreen'];
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* The placement of the content in relation to the trigger
|
|
35
|
-
*/
|
|
36
|
-
|
|
37
|
-
// TODO: merge with PropTypes once react-docgen can parse `typeof array[number]`
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* An element or a function returning an element to use as the mount node
|
|
41
|
-
*/
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* The parent in which to constrain a placement
|
|
45
|
-
*/
|
|
46
|
-
|
|
47
|
-
// TODO: merge with PropTypes once react-docgen can parse `typeof array[number]`
|
|
48
|
-
|
|
49
|
-
const mirrorMap = exports.mirrorMap = {
|
|
50
|
-
center: 'center',
|
|
51
|
-
start: 'end',
|
|
52
|
-
end: 'start',
|
|
53
|
-
top: 'bottom',
|
|
54
|
-
bottom: 'top',
|
|
55
|
-
stretch: 'stretch',
|
|
56
|
-
offscreen: 'offscreen'
|
|
57
|
-
};
|