@fluentui/react-positioning 0.0.0-nightlybc5ff01fb020211104.1 → 0.0.0-nightlyc0273fdc6920211123.1
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.json +49 -8
- package/CHANGELOG.md +19 -7
- package/dist/react-positioning.d.ts +28 -0
- package/lib/createArrowStyles.d.ts +27 -0
- package/lib/createArrowStyles.js +75 -0
- package/lib/createArrowStyles.js.map +1 -0
- package/lib/index.d.ts +2 -1
- package/lib/index.js +2 -1
- package/lib/index.js.map +1 -1
- package/lib/utils/positioningHelper.d.ts +1 -1
- package/lib-commonjs/createArrowStyles.d.ts +27 -0
- package/lib-commonjs/createArrowStyles.js +79 -0
- package/lib-commonjs/createArrowStyles.js.map +1 -0
- package/lib-commonjs/index.d.ts +2 -1
- package/lib-commonjs/index.js +2 -1
- package/lib-commonjs/index.js.map +1 -1
- package/lib-commonjs/utils/positioningHelper.d.ts +1 -1
- package/package.json +4 -4
package/CHANGELOG.json
CHANGED
@@ -2,17 +2,50 @@
|
|
2
2
|
"name": "@fluentui/react-positioning",
|
3
3
|
"entries": [
|
4
4
|
{
|
5
|
-
"date": "
|
6
|
-
"tag": "@fluentui/react-positioning_v0.0.0-
|
7
|
-
"version": "0.0.0-
|
5
|
+
"date": "Tue, 23 Nov 2021 04:19:30 GMT",
|
6
|
+
"tag": "@fluentui/react-positioning_v0.0.0-nightlyc0273fdc6920211123.1",
|
7
|
+
"version": "0.0.0-nightlyc0273fdc6920211123.1",
|
8
8
|
"comments": {
|
9
9
|
"prerelease": [
|
10
10
|
{
|
11
11
|
"author": "email not defined",
|
12
12
|
"package": "@fluentui/react-positioning",
|
13
|
-
"commit": "
|
13
|
+
"commit": "ecb84838dc29fe424995bfc3c2983d3cd335936e",
|
14
14
|
"comment": "Release nightly v9"
|
15
15
|
},
|
16
|
+
{
|
17
|
+
"author": "lingfangao@hotmail.com",
|
18
|
+
"package": "@fluentui/react-positioning",
|
19
|
+
"commit": "58db204f28af1d68df7260ff580cf91f0adcfb66",
|
20
|
+
"comment": "Add utility function to create styles for an arrow element"
|
21
|
+
},
|
22
|
+
{
|
23
|
+
"author": "beachball",
|
24
|
+
"package": "@fluentui/react-positioning",
|
25
|
+
"comment": "Bump @fluentui/react-make-styles to v0.0.0-nightlyc0273fdc6920211123.1",
|
26
|
+
"commit": "ecb84838dc29fe424995bfc3c2983d3cd335936e"
|
27
|
+
},
|
28
|
+
{
|
29
|
+
"author": "beachball",
|
30
|
+
"package": "@fluentui/react-positioning",
|
31
|
+
"comment": "Bump @fluentui/react-shared-contexts to v0.0.0-nightlyc0273fdc6920211123.1",
|
32
|
+
"commit": "ecb84838dc29fe424995bfc3c2983d3cd335936e"
|
33
|
+
},
|
34
|
+
{
|
35
|
+
"author": "beachball",
|
36
|
+
"package": "@fluentui/react-positioning",
|
37
|
+
"comment": "Bump @fluentui/react-utilities to v0.0.0-nightlyc0273fdc6920211123.1",
|
38
|
+
"commit": "ecb84838dc29fe424995bfc3c2983d3cd335936e"
|
39
|
+
}
|
40
|
+
]
|
41
|
+
}
|
42
|
+
},
|
43
|
+
{
|
44
|
+
"date": "Fri, 12 Nov 2021 13:25:30 GMT",
|
45
|
+
"tag": "@fluentui/react-positioning_v9.0.0-beta.3",
|
46
|
+
"version": "9.0.0-beta.3",
|
47
|
+
"comments": {
|
48
|
+
"prerelease": [
|
16
49
|
{
|
17
50
|
"author": "gcox@microsoft.com",
|
18
51
|
"package": "@fluentui/react-positioning",
|
@@ -22,14 +55,22 @@
|
|
22
55
|
{
|
23
56
|
"author": "beachball",
|
24
57
|
"package": "@fluentui/react-positioning",
|
25
|
-
"comment": "Bump @fluentui/react-shared-contexts to
|
26
|
-
"commit": "
|
58
|
+
"comment": "Bump @fluentui/react-shared-contexts to v9.0.0-beta.3",
|
59
|
+
"commit": "742342e52c65066f779232e4e1302fedf0dd460d"
|
27
60
|
},
|
28
61
|
{
|
29
62
|
"author": "beachball",
|
30
63
|
"package": "@fluentui/react-positioning",
|
31
|
-
"comment": "Bump @fluentui/react-utilities to
|
32
|
-
"commit": "
|
64
|
+
"comment": "Bump @fluentui/react-utilities to v9.0.0-beta.3",
|
65
|
+
"commit": "742342e52c65066f779232e4e1302fedf0dd460d"
|
66
|
+
}
|
67
|
+
],
|
68
|
+
"none": [
|
69
|
+
{
|
70
|
+
"author": "lingfangao@hotmail.com",
|
71
|
+
"package": "@fluentui/react-positioning",
|
72
|
+
"commit": "00f70581480b536e723fb69edf0ae617beac4807",
|
73
|
+
"comment": "Remove beta release tag"
|
33
74
|
}
|
34
75
|
]
|
35
76
|
}
|
package/CHANGELOG.md
CHANGED
@@ -1,20 +1,32 @@
|
|
1
1
|
# Change Log - @fluentui/react-positioning
|
2
2
|
|
3
|
-
This log was last generated on
|
3
|
+
This log was last generated on Tue, 23 Nov 2021 04:19:30 GMT and should not be manually modified.
|
4
4
|
|
5
5
|
<!-- Start content -->
|
6
6
|
|
7
|
-
## [0.0.0-
|
7
|
+
## [0.0.0-nightlyc0273fdc6920211123.1](https://github.com/microsoft/fluentui/tree/@fluentui/react-positioning_v0.0.0-nightlyc0273fdc6920211123.1)
|
8
8
|
|
9
|
-
|
10
|
-
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-positioning_v9.0.0-beta.
|
9
|
+
Tue, 23 Nov 2021 04:19:30 GMT
|
10
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-positioning_v9.0.0-beta.3..@fluentui/react-positioning_v0.0.0-nightlyc0273fdc6920211123.1)
|
11
|
+
|
12
|
+
### Changes
|
13
|
+
|
14
|
+
- Release nightly v9 ([commit](https://github.com/microsoft/fluentui/commit/ecb84838dc29fe424995bfc3c2983d3cd335936e) by email not defined)
|
15
|
+
- Add utility function to create styles for an arrow element ([PR #20541](https://github.com/microsoft/fluentui/pull/20541) by lingfangao@hotmail.com)
|
16
|
+
- Bump @fluentui/react-make-styles to v0.0.0-nightlyc0273fdc6920211123.1 ([commit](https://github.com/microsoft/fluentui/commit/ecb84838dc29fe424995bfc3c2983d3cd335936e) by beachball)
|
17
|
+
- Bump @fluentui/react-shared-contexts to v0.0.0-nightlyc0273fdc6920211123.1 ([commit](https://github.com/microsoft/fluentui/commit/ecb84838dc29fe424995bfc3c2983d3cd335936e) by beachball)
|
18
|
+
- Bump @fluentui/react-utilities to v0.0.0-nightlyc0273fdc6920211123.1 ([commit](https://github.com/microsoft/fluentui/commit/ecb84838dc29fe424995bfc3c2983d3cd335936e) by beachball)
|
19
|
+
|
20
|
+
## [9.0.0-beta.3](https://github.com/microsoft/fluentui/tree/@fluentui/react-positioning_v9.0.0-beta.3)
|
21
|
+
|
22
|
+
Fri, 12 Nov 2021 13:25:30 GMT
|
23
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-positioning_v9.0.0-beta.2..@fluentui/react-positioning_v9.0.0-beta.3)
|
11
24
|
|
12
25
|
### Changes
|
13
26
|
|
14
|
-
- Release nightly v9 ([commit](https://github.com/microsoft/fluentui/commit/112d5b8815c25532184ed7c1407ba9a777e2f48d) by email not defined)
|
15
27
|
- Updated beta and RC components to ES2019 ([PR #20405](https://github.com/microsoft/fluentui/pull/20405) by gcox@microsoft.com)
|
16
|
-
- Bump @fluentui/react-shared-contexts to
|
17
|
-
- Bump @fluentui/react-utilities to
|
28
|
+
- Bump @fluentui/react-shared-contexts to v9.0.0-beta.3 ([PR #20583](https://github.com/microsoft/fluentui/pull/20583) by beachball)
|
29
|
+
- Bump @fluentui/react-utilities to v9.0.0-beta.3 ([PR #20583](https://github.com/microsoft/fluentui/pull/20583) by beachball)
|
18
30
|
|
19
31
|
## [9.0.0-beta.2](https://github.com/microsoft/fluentui/tree/@fluentui/react-positioning_v9.0.0-beta.2)
|
20
32
|
|
@@ -1,5 +1,7 @@
|
|
1
|
+
import type { MakeStylesStyleRule } from '@fluentui/make-styles';
|
1
2
|
import * as PopperJs from '@popperjs/core';
|
2
3
|
import * as React_2 from 'react';
|
4
|
+
import type { Theme } from '@fluentui/react-theme';
|
3
5
|
|
4
6
|
export declare type Alignment = 'top' | 'bottom' | 'start' | 'end' | 'center';
|
5
7
|
|
@@ -7,6 +9,32 @@ export declare type AutoSize = 'height' | 'height-always' | 'width' | 'width-alw
|
|
7
9
|
|
8
10
|
export declare type Boundary = PopperJs.Boundary | 'scrollParent' | 'window';
|
9
11
|
|
12
|
+
/**
|
13
|
+
* Helper that creates a makeStyles rule for an arrow element.
|
14
|
+
* For runtime arrow size toggling simply create extra classnames to apply to the arrow element
|
15
|
+
*
|
16
|
+
* ```ts
|
17
|
+
* makeStyles({
|
18
|
+
* arrowWithSize: createArrowStyles(5),
|
19
|
+
*
|
20
|
+
* arrowWithoutSize: createArrowStyles(),
|
21
|
+
* mediumArrow: { aspectRatio: 1, width: '4px' }
|
22
|
+
* smallArrow: { aspectRatio: 1, width: '2px' }
|
23
|
+
* })
|
24
|
+
* ...
|
25
|
+
*
|
26
|
+
* state.arrowWithSize.clasName = styles.arrowWithSize
|
27
|
+
* state.arrowWithoutSize.className = mergeClases(
|
28
|
+
* styles.arrowWithoutSize,
|
29
|
+
* state.smallArrow && styles.smallArrow,
|
30
|
+
* state.mediumArrow && styles.mediumArrow,
|
31
|
+
* )
|
32
|
+
* ```
|
33
|
+
*
|
34
|
+
* @param size - dimensions of the square arrow element in pixels.
|
35
|
+
*/
|
36
|
+
export declare function createArrowStyles(size?: number): MakeStylesStyleRule<Theme>;
|
37
|
+
|
10
38
|
/**
|
11
39
|
* Creates a virtual element based on the position of a click event
|
12
40
|
* Can be used as a target for popper in scenarios such as context menus
|
@@ -0,0 +1,27 @@
|
|
1
|
+
import type { MakeStylesStyleRule } from '@fluentui/make-styles';
|
2
|
+
import type { Theme } from '@fluentui/react-theme';
|
3
|
+
/**
|
4
|
+
* Helper that creates a makeStyles rule for an arrow element.
|
5
|
+
* For runtime arrow size toggling simply create extra classnames to apply to the arrow element
|
6
|
+
*
|
7
|
+
* ```ts
|
8
|
+
* makeStyles({
|
9
|
+
* arrowWithSize: createArrowStyles(5),
|
10
|
+
*
|
11
|
+
* arrowWithoutSize: createArrowStyles(),
|
12
|
+
* mediumArrow: { aspectRatio: 1, width: '4px' }
|
13
|
+
* smallArrow: { aspectRatio: 1, width: '2px' }
|
14
|
+
* })
|
15
|
+
* ...
|
16
|
+
*
|
17
|
+
* state.arrowWithSize.clasName = styles.arrowWithSize
|
18
|
+
* state.arrowWithoutSize.className = mergeClases(
|
19
|
+
* styles.arrowWithoutSize,
|
20
|
+
* state.smallArrow && styles.smallArrow,
|
21
|
+
* state.mediumArrow && styles.mediumArrow,
|
22
|
+
* )
|
23
|
+
* ```
|
24
|
+
*
|
25
|
+
* @param size - dimensions of the square arrow element in pixels.
|
26
|
+
*/
|
27
|
+
export declare function createArrowStyles(size?: number): MakeStylesStyleRule<Theme>;
|
@@ -0,0 +1,75 @@
|
|
1
|
+
/**
|
2
|
+
* Helper that creates a makeStyles rule for an arrow element.
|
3
|
+
* For runtime arrow size toggling simply create extra classnames to apply to the arrow element
|
4
|
+
*
|
5
|
+
* ```ts
|
6
|
+
* makeStyles({
|
7
|
+
* arrowWithSize: createArrowStyles(5),
|
8
|
+
*
|
9
|
+
* arrowWithoutSize: createArrowStyles(),
|
10
|
+
* mediumArrow: { aspectRatio: 1, width: '4px' }
|
11
|
+
* smallArrow: { aspectRatio: 1, width: '2px' }
|
12
|
+
* })
|
13
|
+
* ...
|
14
|
+
*
|
15
|
+
* state.arrowWithSize.clasName = styles.arrowWithSize
|
16
|
+
* state.arrowWithoutSize.className = mergeClases(
|
17
|
+
* styles.arrowWithoutSize,
|
18
|
+
* state.smallArrow && styles.smallArrow,
|
19
|
+
* state.mediumArrow && styles.mediumArrow,
|
20
|
+
* )
|
21
|
+
* ```
|
22
|
+
*
|
23
|
+
* @param size - dimensions of the square arrow element in pixels.
|
24
|
+
*/
|
25
|
+
export function createArrowStyles(size) {
|
26
|
+
return theme => {
|
27
|
+
const arrowHCBorderStyle = `1px solid transparent`;
|
28
|
+
const arrowHCBorder = {
|
29
|
+
borderRight: arrowHCBorderStyle,
|
30
|
+
borderBottom: arrowHCBorderStyle,
|
31
|
+
};
|
32
|
+
return {
|
33
|
+
position: 'absolute',
|
34
|
+
background: 'inherit',
|
35
|
+
visibility: 'hidden',
|
36
|
+
zIndex: -1,
|
37
|
+
...(size && {
|
38
|
+
aspectRatio: 1,
|
39
|
+
width: `${size}px`,
|
40
|
+
}),
|
41
|
+
':before': {
|
42
|
+
content: '""',
|
43
|
+
borderRadius: '4px',
|
44
|
+
position: 'absolute',
|
45
|
+
width: 'inherit',
|
46
|
+
height: 'inherit',
|
47
|
+
background: 'inherit',
|
48
|
+
visibility: 'visible',
|
49
|
+
borderBottomRightRadius: theme.borderRadiusSmall,
|
50
|
+
transform: 'rotate(var(--angle)) translate(0, 50%) rotate(45deg)',
|
51
|
+
},
|
52
|
+
':global([data-popper-placement])': {
|
53
|
+
':before': arrowHCBorder,
|
54
|
+
},
|
55
|
+
// Popper sets data-popper-placement on the root element, which is used to align the arrow
|
56
|
+
':global([data-popper-placement^="top"])': {
|
57
|
+
bottom: 0,
|
58
|
+
'--angle': '0',
|
59
|
+
},
|
60
|
+
':global([data-popper-placement^="right"])': {
|
61
|
+
left: 0,
|
62
|
+
'--angle': '90deg',
|
63
|
+
},
|
64
|
+
':global([data-popper-placement^="bottom"])': {
|
65
|
+
top: 0,
|
66
|
+
'--angle': '180deg',
|
67
|
+
},
|
68
|
+
':global([data-popper-placement^="left"])': {
|
69
|
+
right: 0,
|
70
|
+
'--angle': '270deg',
|
71
|
+
},
|
72
|
+
};
|
73
|
+
};
|
74
|
+
}
|
75
|
+
//# sourceMappingURL=createArrowStyles.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"createArrowStyles.js","sourceRoot":"","sources":["../src/createArrowStyles.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,UAAU,iBAAiB,CAAC,IAAa;IAC7C,OAAO,KAAK,CAAC,EAAE;QACb,MAAM,kBAAkB,GAAG,uBAAuB,CAAC;QACnD,MAAM,aAAa,GAAG;YACpB,WAAW,EAAE,kBAAkB;YAC/B,YAAY,EAAE,kBAAkB;SACjC,CAAC;QAEF,OAAO;YACL,QAAQ,EAAE,UAAU;YACpB,UAAU,EAAE,SAAS;YACrB,UAAU,EAAE,QAAQ;YACpB,MAAM,EAAE,CAAC,CAAC;YAEV,GAAG,CAAC,IAAI,IAAI;gBACV,WAAW,EAAE,CAAC;gBACd,KAAK,EAAE,GAAG,IAAI,IAAI;aACnB,CAAC;YAEF,SAAS,EAAE;gBACT,OAAO,EAAE,IAAI;gBACb,YAAY,EAAE,KAAK;gBACnB,QAAQ,EAAE,UAAU;gBACpB,KAAK,EAAE,SAAS;gBAChB,MAAM,EAAE,SAAS;gBACjB,UAAU,EAAE,SAAS;gBACrB,UAAU,EAAE,SAAS;gBACrB,uBAAuB,EAAE,KAAK,CAAC,iBAAiB;gBAChD,SAAS,EAAE,sDAAsD;aAClE;YAED,kCAAkC,EAAE;gBAClC,SAAS,EAAE,aAAa;aACzB;YAED,0FAA0F;YAC1F,yCAAyC,EAAE;gBACzC,MAAM,EAAE,CAAC;gBACT,SAAS,EAAE,GAAG;aACf;YAED,2CAA2C,EAAE;gBAC3C,IAAI,EAAE,CAAC;gBACP,SAAS,EAAE,OAAO;aACnB;YACD,4CAA4C,EAAE;gBAC5C,GAAG,EAAE,CAAC;gBACN,SAAS,EAAE,QAAQ;aACpB;YACD,0CAA0C,EAAE;gBAC1C,KAAK,EAAE,CAAC;gBACR,SAAS,EAAE,QAAQ;aACpB;SACF,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC"}
|
package/lib/index.d.ts
CHANGED
@@ -1,5 +1,6 @@
|
|
1
|
-
export * from './usePopper';
|
2
1
|
export * from './createVirtualElementFromClick';
|
2
|
+
export * from './createArrowStyles';
|
3
|
+
export * from './usePopper';
|
3
4
|
export * from './usePopperMouseTarget';
|
4
5
|
export { resolvePositioningShorthand, mergeArrowOffset } from './utils/index';
|
5
6
|
export * from './types';
|
package/lib/index.js
CHANGED
@@ -1,5 +1,6 @@
|
|
1
|
-
export * from './usePopper';
|
2
1
|
export * from './createVirtualElementFromClick';
|
2
|
+
export * from './createArrowStyles';
|
3
|
+
export * from './usePopper';
|
3
4
|
export * from './usePopperMouseTarget';
|
4
5
|
export { resolvePositioningShorthand, mergeArrowOffset } from './utils/index';
|
5
6
|
export * from './types';
|
package/lib/index.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,iCAAiC,CAAC;AAChD,cAAc,qBAAqB,CAAC;AACpC,cAAc,aAAa,CAAC;AAC5B,cAAc,wBAAwB,CAAC;AACvC,OAAO,EAAE,2BAA2B,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAC9E,cAAc,SAAS,CAAC"}
|
@@ -3,5 +3,5 @@ import type { Offset } from '../types';
|
|
3
3
|
/**
|
4
4
|
* @see positioninHelper.test.ts for expected placement values
|
5
5
|
*/
|
6
|
-
export declare const getPlacement: (align?: "
|
6
|
+
export declare const getPlacement: (align?: "bottom" | "top" | "center" | "start" | "end" | undefined, position?: "above" | "below" | "before" | "after" | undefined, rtl?: boolean | undefined) => PopperJs.Placement;
|
7
7
|
export declare const applyRtlToOffset: (offset: Offset | undefined) => Offset | undefined;
|
@@ -0,0 +1,27 @@
|
|
1
|
+
import type { MakeStylesStyleRule } from '@fluentui/make-styles';
|
2
|
+
import type { Theme } from '@fluentui/react-theme';
|
3
|
+
/**
|
4
|
+
* Helper that creates a makeStyles rule for an arrow element.
|
5
|
+
* For runtime arrow size toggling simply create extra classnames to apply to the arrow element
|
6
|
+
*
|
7
|
+
* ```ts
|
8
|
+
* makeStyles({
|
9
|
+
* arrowWithSize: createArrowStyles(5),
|
10
|
+
*
|
11
|
+
* arrowWithoutSize: createArrowStyles(),
|
12
|
+
* mediumArrow: { aspectRatio: 1, width: '4px' }
|
13
|
+
* smallArrow: { aspectRatio: 1, width: '2px' }
|
14
|
+
* })
|
15
|
+
* ...
|
16
|
+
*
|
17
|
+
* state.arrowWithSize.clasName = styles.arrowWithSize
|
18
|
+
* state.arrowWithoutSize.className = mergeClases(
|
19
|
+
* styles.arrowWithoutSize,
|
20
|
+
* state.smallArrow && styles.smallArrow,
|
21
|
+
* state.mediumArrow && styles.mediumArrow,
|
22
|
+
* )
|
23
|
+
* ```
|
24
|
+
*
|
25
|
+
* @param size - dimensions of the square arrow element in pixels.
|
26
|
+
*/
|
27
|
+
export declare function createArrowStyles(size?: number): MakeStylesStyleRule<Theme>;
|
@@ -0,0 +1,79 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.createArrowStyles = void 0;
|
4
|
+
/**
|
5
|
+
* Helper that creates a makeStyles rule for an arrow element.
|
6
|
+
* For runtime arrow size toggling simply create extra classnames to apply to the arrow element
|
7
|
+
*
|
8
|
+
* ```ts
|
9
|
+
* makeStyles({
|
10
|
+
* arrowWithSize: createArrowStyles(5),
|
11
|
+
*
|
12
|
+
* arrowWithoutSize: createArrowStyles(),
|
13
|
+
* mediumArrow: { aspectRatio: 1, width: '4px' }
|
14
|
+
* smallArrow: { aspectRatio: 1, width: '2px' }
|
15
|
+
* })
|
16
|
+
* ...
|
17
|
+
*
|
18
|
+
* state.arrowWithSize.clasName = styles.arrowWithSize
|
19
|
+
* state.arrowWithoutSize.className = mergeClases(
|
20
|
+
* styles.arrowWithoutSize,
|
21
|
+
* state.smallArrow && styles.smallArrow,
|
22
|
+
* state.mediumArrow && styles.mediumArrow,
|
23
|
+
* )
|
24
|
+
* ```
|
25
|
+
*
|
26
|
+
* @param size - dimensions of the square arrow element in pixels.
|
27
|
+
*/
|
28
|
+
function createArrowStyles(size) {
|
29
|
+
return theme => {
|
30
|
+
const arrowHCBorderStyle = `1px solid transparent`;
|
31
|
+
const arrowHCBorder = {
|
32
|
+
borderRight: arrowHCBorderStyle,
|
33
|
+
borderBottom: arrowHCBorderStyle,
|
34
|
+
};
|
35
|
+
return {
|
36
|
+
position: 'absolute',
|
37
|
+
background: 'inherit',
|
38
|
+
visibility: 'hidden',
|
39
|
+
zIndex: -1,
|
40
|
+
...(size && {
|
41
|
+
aspectRatio: 1,
|
42
|
+
width: `${size}px`,
|
43
|
+
}),
|
44
|
+
':before': {
|
45
|
+
content: '""',
|
46
|
+
borderRadius: '4px',
|
47
|
+
position: 'absolute',
|
48
|
+
width: 'inherit',
|
49
|
+
height: 'inherit',
|
50
|
+
background: 'inherit',
|
51
|
+
visibility: 'visible',
|
52
|
+
borderBottomRightRadius: theme.borderRadiusSmall,
|
53
|
+
transform: 'rotate(var(--angle)) translate(0, 50%) rotate(45deg)',
|
54
|
+
},
|
55
|
+
':global([data-popper-placement])': {
|
56
|
+
':before': arrowHCBorder,
|
57
|
+
},
|
58
|
+
// Popper sets data-popper-placement on the root element, which is used to align the arrow
|
59
|
+
':global([data-popper-placement^="top"])': {
|
60
|
+
bottom: 0,
|
61
|
+
'--angle': '0',
|
62
|
+
},
|
63
|
+
':global([data-popper-placement^="right"])': {
|
64
|
+
left: 0,
|
65
|
+
'--angle': '90deg',
|
66
|
+
},
|
67
|
+
':global([data-popper-placement^="bottom"])': {
|
68
|
+
top: 0,
|
69
|
+
'--angle': '180deg',
|
70
|
+
},
|
71
|
+
':global([data-popper-placement^="left"])': {
|
72
|
+
right: 0,
|
73
|
+
'--angle': '270deg',
|
74
|
+
},
|
75
|
+
};
|
76
|
+
};
|
77
|
+
}
|
78
|
+
exports.createArrowStyles = createArrowStyles;
|
79
|
+
//# sourceMappingURL=createArrowStyles.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"createArrowStyles.js","sourceRoot":"","sources":["../src/createArrowStyles.ts"],"names":[],"mappings":";;;AAGA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,SAAgB,iBAAiB,CAAC,IAAa;IAC7C,OAAO,KAAK,CAAC,EAAE;QACb,MAAM,kBAAkB,GAAG,uBAAuB,CAAC;QACnD,MAAM,aAAa,GAAG;YACpB,WAAW,EAAE,kBAAkB;YAC/B,YAAY,EAAE,kBAAkB;SACjC,CAAC;QAEF,OAAO;YACL,QAAQ,EAAE,UAAU;YACpB,UAAU,EAAE,SAAS;YACrB,UAAU,EAAE,QAAQ;YACpB,MAAM,EAAE,CAAC,CAAC;YAEV,GAAG,CAAC,IAAI,IAAI;gBACV,WAAW,EAAE,CAAC;gBACd,KAAK,EAAE,GAAG,IAAI,IAAI;aACnB,CAAC;YAEF,SAAS,EAAE;gBACT,OAAO,EAAE,IAAI;gBACb,YAAY,EAAE,KAAK;gBACnB,QAAQ,EAAE,UAAU;gBACpB,KAAK,EAAE,SAAS;gBAChB,MAAM,EAAE,SAAS;gBACjB,UAAU,EAAE,SAAS;gBACrB,UAAU,EAAE,SAAS;gBACrB,uBAAuB,EAAE,KAAK,CAAC,iBAAiB;gBAChD,SAAS,EAAE,sDAAsD;aAClE;YAED,kCAAkC,EAAE;gBAClC,SAAS,EAAE,aAAa;aACzB;YAED,0FAA0F;YAC1F,yCAAyC,EAAE;gBACzC,MAAM,EAAE,CAAC;gBACT,SAAS,EAAE,GAAG;aACf;YAED,2CAA2C,EAAE;gBAC3C,IAAI,EAAE,CAAC;gBACP,SAAS,EAAE,OAAO;aACnB;YACD,4CAA4C,EAAE;gBAC5C,GAAG,EAAE,CAAC;gBACN,SAAS,EAAE,QAAQ;aACpB;YACD,0CAA0C,EAAE;gBAC1C,KAAK,EAAE,CAAC;gBACR,SAAS,EAAE,QAAQ;aACpB;SACF,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC;AAvDD,8CAuDC"}
|
package/lib-commonjs/index.d.ts
CHANGED
@@ -1,5 +1,6 @@
|
|
1
|
-
export * from './usePopper';
|
2
1
|
export * from './createVirtualElementFromClick';
|
2
|
+
export * from './createArrowStyles';
|
3
|
+
export * from './usePopper';
|
3
4
|
export * from './usePopperMouseTarget';
|
4
5
|
export { resolvePositioningShorthand, mergeArrowOffset } from './utils/index';
|
5
6
|
export * from './types';
|
package/lib-commonjs/index.js
CHANGED
@@ -2,8 +2,9 @@
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.mergeArrowOffset = exports.resolvePositioningShorthand = void 0;
|
4
4
|
const tslib_1 = require("tslib");
|
5
|
-
tslib_1.__exportStar(require("./usePopper"), exports);
|
6
5
|
tslib_1.__exportStar(require("./createVirtualElementFromClick"), exports);
|
6
|
+
tslib_1.__exportStar(require("./createArrowStyles"), exports);
|
7
|
+
tslib_1.__exportStar(require("./usePopper"), exports);
|
7
8
|
tslib_1.__exportStar(require("./usePopperMouseTarget"), exports);
|
8
9
|
var index_1 = require("./utils/index");
|
9
10
|
Object.defineProperty(exports, "resolvePositioningShorthand", { enumerable: true, get: function () { return index_1.resolvePositioningShorthand; } });
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;AAAA,sDAA4B;AAC5B,
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;AAAA,0EAAgD;AAChD,8DAAoC;AACpC,sDAA4B;AAC5B,iEAAuC;AACvC,uCAA8E;AAArE,oHAAA,2BAA2B,OAAA;AAAE,yGAAA,gBAAgB,OAAA;AACtD,kDAAwB"}
|
@@ -3,5 +3,5 @@ import type { Offset } from '../types';
|
|
3
3
|
/**
|
4
4
|
* @see positioninHelper.test.ts for expected placement values
|
5
5
|
*/
|
6
|
-
export declare const getPlacement: (align?: "
|
6
|
+
export declare const getPlacement: (align?: "bottom" | "top" | "center" | "start" | "end" | undefined, position?: "above" | "below" | "before" | "after" | undefined, rtl?: boolean | undefined) => PopperJs.Placement;
|
7
7
|
export declare const applyRtlToOffset: (offset: Offset | undefined) => Offset | undefined;
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@fluentui/react-positioning",
|
3
|
-
"version": "0.0.0-
|
3
|
+
"version": "0.0.0-nightlyc0273fdc6920211123.1",
|
4
4
|
"description": "A react wrapper around Popper.js for Fluent UI",
|
5
5
|
"main": "lib-commonjs/index.js",
|
6
6
|
"module": "lib/index.js",
|
@@ -33,8 +33,9 @@
|
|
33
33
|
"react-dom": "16.8.6"
|
34
34
|
},
|
35
35
|
"dependencies": {
|
36
|
-
"@fluentui/react-
|
37
|
-
"@fluentui/react-
|
36
|
+
"@fluentui/react-make-styles": "0.0.0-nightlyc0273fdc6920211123.1",
|
37
|
+
"@fluentui/react-shared-contexts": "0.0.0-nightlyc0273fdc6920211123.1",
|
38
|
+
"@fluentui/react-utilities": "0.0.0-nightlyc0273fdc6920211123.1",
|
38
39
|
"@popperjs/core": "~2.4.3",
|
39
40
|
"tslib": "^2.1.0"
|
40
41
|
},
|
@@ -45,7 +46,6 @@
|
|
45
46
|
"react-dom": ">=16.8.0 <18.0.0"
|
46
47
|
},
|
47
48
|
"beachball": {
|
48
|
-
"tag": "beta",
|
49
49
|
"disallowedChangeTypes": [
|
50
50
|
"major",
|
51
51
|
"minor",
|