@fluentui/react-positioning 0.0.0-nightly9edaf68d4420211116.1 → 0.0.0-nightlya0aef7969220220228.1
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.json +189 -8
- package/CHANGELOG.md +53 -7
- package/dist/react-positioning.d.ts +113 -35
- package/lib/createArrowStyles.d.ts +64 -0
- package/lib/createArrowStyles.js +87 -0
- package/lib/createArrowStyles.js.map +1 -0
- package/lib/createVirtualElementFromClick.js +17 -15
- package/lib/createVirtualElementFromClick.js.map +1 -1
- package/lib/index.d.ts +2 -1
- package/lib/index.js +2 -1
- package/lib/index.js.map +1 -1
- package/lib/isIntersectingModifier.d.ts +4 -0
- package/lib/isIntersectingModifier.js +26 -0
- package/lib/isIntersectingModifier.js.map +1 -0
- package/lib/types.d.ts +28 -7
- package/lib/types.js.map +1 -1
- package/lib/usePopper.d.ts +2 -14
- package/lib/usePopper.js +368 -311
- package/lib/usePopper.js.map +1 -1
- package/lib/usePopperMouseTarget.js +28 -22
- package/lib/usePopperMouseTarget.js.map +1 -1
- package/lib/utils/getBasePlacement.js +1 -1
- package/lib/utils/getBasePlacement.js.map +1 -1
- package/lib/utils/getBoundary.js +15 -10
- package/lib/utils/getBoundary.js.map +1 -1
- package/lib/utils/getReactFiberFromNode.js +39 -35
- package/lib/utils/getReactFiberFromNode.js.map +1 -1
- package/lib/utils/getScrollParent.js +46 -32
- package/lib/utils/getScrollParent.js.map +1 -1
- package/lib/utils/index.js.map +1 -1
- package/lib/utils/mergeArrowOffset.js +29 -24
- package/lib/utils/mergeArrowOffset.js.map +1 -1
- package/lib/utils/positioningHelper.d.ts +2 -2
- package/lib/utils/positioningHelper.js +38 -30
- package/lib/utils/positioningHelper.js.map +1 -1
- package/lib/utils/resolvePositioningShorthand.js +57 -19
- package/lib/utils/resolvePositioningShorthand.js.map +1 -1
- package/lib/utils/useCallbackRef.js +35 -29
- package/lib/utils/useCallbackRef.js.map +1 -1
- package/lib-commonjs/createArrowStyles.d.ts +64 -0
- package/lib-commonjs/createArrowStyles.js +100 -0
- package/lib-commonjs/createArrowStyles.js.map +1 -0
- package/lib-commonjs/createVirtualElementFromClick.js +23 -16
- package/lib-commonjs/createVirtualElementFromClick.js.map +1 -1
- package/lib-commonjs/index.d.ts +2 -1
- package/lib-commonjs/index.js +28 -6
- package/lib-commonjs/index.js.map +1 -1
- package/lib-commonjs/isIntersectingModifier.d.ts +4 -0
- package/lib-commonjs/isIntersectingModifier.js +34 -0
- package/lib-commonjs/isIntersectingModifier.js.map +1 -0
- package/lib-commonjs/types.d.ts +28 -7
- package/lib-commonjs/types.js +4 -1
- package/lib-commonjs/types.js.map +1 -1
- package/lib-commonjs/usePopper.d.ts +2 -14
- package/lib-commonjs/usePopper.js +384 -316
- package/lib-commonjs/usePopper.js.map +1 -1
- package/lib-commonjs/usePopperMouseTarget.js +38 -25
- package/lib-commonjs/usePopperMouseTarget.js.map +1 -1
- package/lib-commonjs/utils/getBasePlacement.js +7 -2
- package/lib-commonjs/utils/getBasePlacement.js.map +1 -1
- package/lib-commonjs/utils/getBoundary.js +23 -12
- package/lib-commonjs/utils/getBoundary.js.map +1 -1
- package/lib-commonjs/utils/getReactFiberFromNode.js +44 -36
- package/lib-commonjs/utils/getReactFiberFromNode.js.map +1 -1
- package/lib-commonjs/utils/getScrollParent.js +53 -33
- package/lib-commonjs/utils/getScrollParent.js.map +1 -1
- package/lib-commonjs/utils/index.js +14 -2
- package/lib-commonjs/utils/index.js.map +1 -1
- package/lib-commonjs/utils/mergeArrowOffset.js +35 -25
- package/lib-commonjs/utils/mergeArrowOffset.js.map +1 -1
- package/lib-commonjs/utils/positioningHelper.d.ts +2 -2
- package/lib-commonjs/utils/positioningHelper.js +46 -31
- package/lib-commonjs/utils/positioningHelper.js.map +1 -1
- package/lib-commonjs/utils/resolvePositioningShorthand.js +65 -22
- package/lib-commonjs/utils/resolvePositioningShorthand.js.map +1 -1
- package/lib-commonjs/utils/useCallbackRef.js +45 -32
- package/lib-commonjs/utils/useCallbackRef.js.map +1 -1
- package/package.json +8 -7
package/CHANGELOG.json
CHANGED
@@ -2,28 +2,209 @@
|
|
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": "Mon, 28 Feb 2022 04:13:58 GMT",
|
6
|
+
"tag": "@fluentui/react-positioning_v0.0.0-nightlya0aef7969220220228.1",
|
7
|
+
"version": "0.0.0-nightlya0aef7969220220228.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": "357dddd59345f57e77408824366096081c934571",
|
14
14
|
"comment": "Release nightly v9"
|
15
15
|
},
|
16
|
+
{
|
17
|
+
"author": "olfedias@microsoft.com",
|
18
|
+
"package": "@fluentui/react-positioning",
|
19
|
+
"commit": "def76fff08777fcd5492f47824b943bab22d4515",
|
20
|
+
"comment": "feat: add isIntersectingModifier to usePopper"
|
21
|
+
},
|
22
|
+
{
|
23
|
+
"author": "olfedias@microsoft.com",
|
24
|
+
"package": "@fluentui/react-positioning",
|
25
|
+
"commit": "084d7408855f3e52b67cbca172da1acef9dcb98f",
|
26
|
+
"comment": "fix: Add react-theme as dependency"
|
27
|
+
},
|
28
|
+
{
|
29
|
+
"author": "beachball",
|
30
|
+
"package": "@fluentui/react-positioning",
|
31
|
+
"comment": "Bump @fluentui/react-shared-contexts to v0.0.0-nightlya0aef7969220220228.1",
|
32
|
+
"commit": "357dddd59345f57e77408824366096081c934571"
|
33
|
+
},
|
34
|
+
{
|
35
|
+
"author": "beachball",
|
36
|
+
"package": "@fluentui/react-positioning",
|
37
|
+
"comment": "Bump @fluentui/react-theme to v0.0.0-nightlya0aef7969220220228.1",
|
38
|
+
"commit": "357dddd59345f57e77408824366096081c934571"
|
39
|
+
},
|
40
|
+
{
|
41
|
+
"author": "beachball",
|
42
|
+
"package": "@fluentui/react-positioning",
|
43
|
+
"comment": "Bump @fluentui/react-utilities to v0.0.0-nightlya0aef7969220220228.1",
|
44
|
+
"commit": "357dddd59345f57e77408824366096081c934571"
|
45
|
+
}
|
46
|
+
]
|
47
|
+
}
|
48
|
+
},
|
49
|
+
{
|
50
|
+
"date": "Fri, 18 Feb 2022 13:35:33 GMT",
|
51
|
+
"tag": "@fluentui/react-positioning_v9.0.0-rc.3",
|
52
|
+
"version": "9.0.0-rc.3",
|
53
|
+
"comments": {
|
54
|
+
"prerelease": [
|
55
|
+
{
|
56
|
+
"author": "lingfangao@hotmail.com",
|
57
|
+
"package": "@fluentui/react-positioning",
|
58
|
+
"commit": "1aa9e691fcccd9a64168cea7941c0f1e71fa1d14",
|
59
|
+
"comment": "fix: Source maps contain original source code"
|
60
|
+
},
|
61
|
+
{
|
62
|
+
"author": "beachball",
|
63
|
+
"package": "@fluentui/react-positioning",
|
64
|
+
"comment": "Bump @fluentui/react-shared-contexts to v9.0.0-rc.3",
|
65
|
+
"commit": "3b9c1e931c23173da3d1af0c696cdc58516ce504"
|
66
|
+
},
|
67
|
+
{
|
68
|
+
"author": "beachball",
|
69
|
+
"package": "@fluentui/react-positioning",
|
70
|
+
"comment": "Bump @fluentui/react-utilities to v9.0.0-rc.3",
|
71
|
+
"commit": "3b9c1e931c23173da3d1af0c696cdc58516ce504"
|
72
|
+
}
|
73
|
+
]
|
74
|
+
}
|
75
|
+
},
|
76
|
+
{
|
77
|
+
"date": "Thu, 10 Feb 2022 08:50:40 GMT",
|
78
|
+
"tag": "@fluentui/react-positioning_v9.0.0-rc.1",
|
79
|
+
"version": "9.0.0-rc.1",
|
80
|
+
"comments": {
|
81
|
+
"prerelease": [
|
82
|
+
{
|
83
|
+
"author": "olfedias@microsoft.com",
|
84
|
+
"package": "@fluentui/react-positioning",
|
85
|
+
"commit": "a76afe26daad901ff5458ffdda7e66e600d5bcac",
|
86
|
+
"comment": "use new types from makeStyles core"
|
87
|
+
},
|
88
|
+
{
|
89
|
+
"author": "Humberto.Morimoto@microsoft.com",
|
90
|
+
"package": "@fluentui/react-positioning",
|
91
|
+
"commit": "db6526ee2d04991e4473174969e3795299b52f9e",
|
92
|
+
"comment": "Replacing use of functions in makeStyles with direct use of tokens."
|
93
|
+
},
|
94
|
+
{
|
95
|
+
"author": "behowell@microsoft.com",
|
96
|
+
"package": "@fluentui/react-positioning",
|
97
|
+
"commit": "2e34c026a354af1bbfe6a5ead1ade41348d5488f",
|
98
|
+
"comment": "Fix tooltip arrow's high contrast border in RTL"
|
99
|
+
},
|
100
|
+
{
|
101
|
+
"author": "olfedias@microsoft.com",
|
102
|
+
"package": "@fluentui/react-positioning",
|
103
|
+
"commit": "523b5785eafd28cf56b677af40274cefe5d42dcb",
|
104
|
+
"comment": "use Griffel packages"
|
105
|
+
},
|
106
|
+
{
|
107
|
+
"author": "lingfangao@hotmail.com",
|
108
|
+
"package": "@fluentui/react-positioning",
|
109
|
+
"commit": "a548a59bd94f9c4b656da3bdd149db7ac2de726f",
|
110
|
+
"comment": "feat: Imperative `setTarget` for `usePopper` and `positioning`"
|
111
|
+
},
|
112
|
+
{
|
113
|
+
"author": "bsunderhus@microsoft.com",
|
114
|
+
"package": "@fluentui/react-positioning",
|
115
|
+
"commit": "e382ad22539fc97bb283ca4ed856e126c7477e89",
|
116
|
+
"comment": "Adds @noflip annotation to data-popper-placement styles"
|
117
|
+
},
|
118
|
+
{
|
119
|
+
"author": "olfedias@microsoft.com",
|
120
|
+
"package": "@fluentui/react-positioning",
|
121
|
+
"commit": "967d6b74cf0507685a24e0cfaa8c7b9d52a351e1",
|
122
|
+
"comment": "update styles to not use CSS shorthands"
|
123
|
+
},
|
124
|
+
{
|
125
|
+
"author": "lingfangao@hotmail.com",
|
126
|
+
"package": "@fluentui/react-positioning",
|
127
|
+
"commit": "c00913d50e2dd15bbfbb0757cefe43b192ff1d7f",
|
128
|
+
"comment": "Bump Fluent UI packages to 9.0.0-rc"
|
129
|
+
},
|
130
|
+
{
|
131
|
+
"author": "behowell@microsoft.com",
|
132
|
+
"package": "@fluentui/react-positioning",
|
133
|
+
"commit": "09804275c7f346db54c33d4ff347bffc33676014",
|
134
|
+
"comment": "Fix popover arrow styling"
|
135
|
+
},
|
136
|
+
{
|
137
|
+
"author": "beachball",
|
138
|
+
"package": "@fluentui/react-positioning",
|
139
|
+
"comment": "Bump @fluentui/react-shared-contexts to v9.0.0-rc.1",
|
140
|
+
"commit": "e6c855f6d9019d6c73668d15fc9bc3a13291a6c8"
|
141
|
+
},
|
142
|
+
{
|
143
|
+
"author": "beachball",
|
144
|
+
"package": "@fluentui/react-positioning",
|
145
|
+
"comment": "Bump @fluentui/react-utilities to v9.0.0-rc.1",
|
146
|
+
"commit": "e6c855f6d9019d6c73668d15fc9bc3a13291a6c8"
|
147
|
+
}
|
148
|
+
],
|
149
|
+
"none": [
|
150
|
+
{
|
151
|
+
"author": "olfedias@microsoft.com",
|
152
|
+
"package": "@fluentui/react-positioning",
|
153
|
+
"commit": "c061e98be4b4a718c72a144a1f60bb5515824612",
|
154
|
+
"comment": "remove inline-style-expand-shorthand from tsconfigs"
|
155
|
+
},
|
156
|
+
{
|
157
|
+
"author": "martinhochel@microsoft.com",
|
158
|
+
"package": "@fluentui/react-positioning",
|
159
|
+
"commit": "8dfa712156b70414205b87b5b6d099367b0c297d",
|
160
|
+
"comment": "chore: use storybook runner for all vNext packages"
|
161
|
+
}
|
162
|
+
]
|
163
|
+
}
|
164
|
+
},
|
165
|
+
{
|
166
|
+
"date": "Thu, 25 Nov 2021 08:34:15 GMT",
|
167
|
+
"tag": "@fluentui/react-positioning_v9.0.0-beta.4",
|
168
|
+
"version": "9.0.0-beta.4",
|
169
|
+
"comments": {
|
170
|
+
"none": [
|
171
|
+
{
|
172
|
+
"author": "lingfangao@hotmail.com",
|
173
|
+
"package": "@fluentui/react-positioning",
|
174
|
+
"commit": "718e63006d8d07d24efab9c32942041963d78dc7",
|
175
|
+
"comment": "Migrate package to use solution style ts-configs"
|
176
|
+
}
|
177
|
+
],
|
178
|
+
"prerelease": [
|
179
|
+
{
|
180
|
+
"author": "lingfangao@hotmail.com",
|
181
|
+
"package": "@fluentui/react-positioning",
|
182
|
+
"commit": "58db204f28af1d68df7260ff580cf91f0adcfb66",
|
183
|
+
"comment": "Add utility function to create styles for an arrow element"
|
184
|
+
},
|
185
|
+
{
|
186
|
+
"author": "beachball",
|
187
|
+
"package": "@fluentui/react-positioning",
|
188
|
+
"comment": "Bump @fluentui/react-make-styles to v9.0.0-beta.4",
|
189
|
+
"commit": "48d236ac53a4950fabc3ddd52f91dac93ca0195b"
|
190
|
+
},
|
191
|
+
{
|
192
|
+
"author": "beachball",
|
193
|
+
"package": "@fluentui/react-positioning",
|
194
|
+
"comment": "Bump @fluentui/react-shared-contexts to v9.0.0-beta.4",
|
195
|
+
"commit": "48d236ac53a4950fabc3ddd52f91dac93ca0195b"
|
196
|
+
},
|
16
197
|
{
|
17
198
|
"author": "beachball",
|
18
199
|
"package": "@fluentui/react-positioning",
|
19
|
-
"comment": "Bump @fluentui/react-
|
20
|
-
"commit": "
|
200
|
+
"comment": "Bump @fluentui/react-utilities to v9.0.0-beta.4",
|
201
|
+
"commit": "48d236ac53a4950fabc3ddd52f91dac93ca0195b"
|
21
202
|
},
|
22
203
|
{
|
23
204
|
"author": "beachball",
|
24
205
|
"package": "@fluentui/react-positioning",
|
25
|
-
"comment": "Bump @fluentui/
|
26
|
-
"commit": "
|
206
|
+
"comment": "Bump @fluentui/babel-make-styles to v9.0.0-beta.4",
|
207
|
+
"commit": "48d236ac53a4950fabc3ddd52f91dac93ca0195b"
|
27
208
|
}
|
28
209
|
]
|
29
210
|
}
|
package/CHANGELOG.md
CHANGED
@@ -1,19 +1,65 @@
|
|
1
1
|
# Change Log - @fluentui/react-positioning
|
2
2
|
|
3
|
-
This log was last generated on
|
3
|
+
This log was last generated on Mon, 28 Feb 2022 04:13:58 GMT and should not be manually modified.
|
4
4
|
|
5
5
|
<!-- Start content -->
|
6
6
|
|
7
|
-
## [0.0.0-
|
7
|
+
## [0.0.0-nightlya0aef7969220220228.1](https://github.com/microsoft/fluentui/tree/@fluentui/react-positioning_v0.0.0-nightlya0aef7969220220228.1)
|
8
8
|
|
9
|
-
|
10
|
-
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-positioning_v9.0.0-
|
9
|
+
Mon, 28 Feb 2022 04:13:58 GMT
|
10
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-positioning_v9.0.0-rc.3..@fluentui/react-positioning_v0.0.0-nightlya0aef7969220220228.1)
|
11
11
|
|
12
12
|
### Changes
|
13
13
|
|
14
|
-
- Release nightly v9 ([commit](https://github.com/microsoft/fluentui/commit/
|
15
|
-
-
|
16
|
-
-
|
14
|
+
- Release nightly v9 ([commit](https://github.com/microsoft/fluentui/commit/357dddd59345f57e77408824366096081c934571) by email not defined)
|
15
|
+
- feat: add isIntersectingModifier to usePopper ([PR #21855](https://github.com/microsoft/fluentui/pull/21855) by olfedias@microsoft.com)
|
16
|
+
- fix: Add react-theme as dependency ([PR #21825](https://github.com/microsoft/fluentui/pull/21825) by olfedias@microsoft.com)
|
17
|
+
- Bump @fluentui/react-shared-contexts to v0.0.0-nightlya0aef7969220220228.1 ([commit](https://github.com/microsoft/fluentui/commit/357dddd59345f57e77408824366096081c934571) by beachball)
|
18
|
+
- Bump @fluentui/react-theme to v0.0.0-nightlya0aef7969220220228.1 ([commit](https://github.com/microsoft/fluentui/commit/357dddd59345f57e77408824366096081c934571) by beachball)
|
19
|
+
- Bump @fluentui/react-utilities to v0.0.0-nightlya0aef7969220220228.1 ([commit](https://github.com/microsoft/fluentui/commit/357dddd59345f57e77408824366096081c934571) by beachball)
|
20
|
+
|
21
|
+
## [9.0.0-rc.3](https://github.com/microsoft/fluentui/tree/@fluentui/react-positioning_v9.0.0-rc.3)
|
22
|
+
|
23
|
+
Fri, 18 Feb 2022 13:35:33 GMT
|
24
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-positioning_v9.0.0-rc.1..@fluentui/react-positioning_v9.0.0-rc.3)
|
25
|
+
|
26
|
+
### Changes
|
27
|
+
|
28
|
+
- fix: Source maps contain original source code ([PR #21690](https://github.com/microsoft/fluentui/pull/21690) by lingfangao@hotmail.com)
|
29
|
+
- Bump @fluentui/react-shared-contexts to v9.0.0-rc.3 ([PR #21800](https://github.com/microsoft/fluentui/pull/21800) by beachball)
|
30
|
+
- Bump @fluentui/react-utilities to v9.0.0-rc.3 ([PR #21800](https://github.com/microsoft/fluentui/pull/21800) by beachball)
|
31
|
+
|
32
|
+
## [9.0.0-rc.1](https://github.com/microsoft/fluentui/tree/@fluentui/react-positioning_v9.0.0-rc.1)
|
33
|
+
|
34
|
+
Thu, 10 Feb 2022 08:50:40 GMT
|
35
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-positioning_v9.0.0-beta.4..@fluentui/react-positioning_v9.0.0-rc.1)
|
36
|
+
|
37
|
+
### Changes
|
38
|
+
|
39
|
+
- use new types from makeStyles core ([PR #20786](https://github.com/microsoft/fluentui/pull/20786) by olfedias@microsoft.com)
|
40
|
+
- Replacing use of functions in makeStyles with direct use of tokens. ([PR #21051](https://github.com/microsoft/fluentui/pull/21051) by Humberto.Morimoto@microsoft.com)
|
41
|
+
- Fix tooltip arrow's high contrast border in RTL ([PR #21354](https://github.com/microsoft/fluentui/pull/21354) by behowell@microsoft.com)
|
42
|
+
- use Griffel packages ([PR #21421](https://github.com/microsoft/fluentui/pull/21421) by olfedias@microsoft.com)
|
43
|
+
- feat: Imperative `setTarget` for `usePopper` and `positioning` ([PR #21632](https://github.com/microsoft/fluentui/pull/21632) by lingfangao@hotmail.com)
|
44
|
+
- Adds @noflip annotation to data-popper-placement styles ([PR #20845](https://github.com/microsoft/fluentui/pull/20845) by bsunderhus@microsoft.com)
|
45
|
+
- update styles to not use CSS shorthands ([PR #20842](https://github.com/microsoft/fluentui/pull/20842) by olfedias@microsoft.com)
|
46
|
+
- Bump Fluent UI packages to 9.0.0-rc ([PR #21623](https://github.com/microsoft/fluentui/pull/21623) by lingfangao@hotmail.com)
|
47
|
+
- Fix popover arrow styling ([PR #21086](https://github.com/microsoft/fluentui/pull/21086) by behowell@microsoft.com)
|
48
|
+
- Bump @fluentui/react-shared-contexts to v9.0.0-rc.1 ([commit](https://github.com/microsoft/fluentui/commit/e6c855f6d9019d6c73668d15fc9bc3a13291a6c8) by beachball)
|
49
|
+
- Bump @fluentui/react-utilities to v9.0.0-rc.1 ([commit](https://github.com/microsoft/fluentui/commit/e6c855f6d9019d6c73668d15fc9bc3a13291a6c8) by beachball)
|
50
|
+
|
51
|
+
## [9.0.0-beta.4](https://github.com/microsoft/fluentui/tree/@fluentui/react-positioning_v9.0.0-beta.4)
|
52
|
+
|
53
|
+
Thu, 25 Nov 2021 08:34:15 GMT
|
54
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-positioning_v9.0.0-beta.3..@fluentui/react-positioning_v9.0.0-beta.4)
|
55
|
+
|
56
|
+
### Changes
|
57
|
+
|
58
|
+
- Add utility function to create styles for an arrow element ([PR #20541](https://github.com/microsoft/fluentui/pull/20541) by lingfangao@hotmail.com)
|
59
|
+
- Bump @fluentui/react-make-styles to v9.0.0-beta.4 ([PR #20762](https://github.com/microsoft/fluentui/pull/20762) by beachball)
|
60
|
+
- Bump @fluentui/react-shared-contexts to v9.0.0-beta.4 ([PR #20762](https://github.com/microsoft/fluentui/pull/20762) by beachball)
|
61
|
+
- Bump @fluentui/react-utilities to v9.0.0-beta.4 ([PR #20762](https://github.com/microsoft/fluentui/pull/20762) by beachball)
|
62
|
+
- Bump @fluentui/babel-make-styles to v9.0.0-beta.4 ([PR #20762](https://github.com/microsoft/fluentui/pull/20762) by beachball)
|
17
63
|
|
18
64
|
## [9.0.0-beta.3](https://github.com/microsoft/fluentui/tree/@fluentui/react-positioning_v9.0.0-beta.3)
|
19
65
|
|
@@ -1,3 +1,4 @@
|
|
1
|
+
import type { GriffelStyle } from '@griffel/react';
|
1
2
|
import * as PopperJs from '@popperjs/core';
|
2
3
|
import * as React_2 from 'react';
|
3
4
|
|
@@ -7,6 +8,72 @@ export declare type AutoSize = 'height' | 'height-always' | 'width' | 'width-alw
|
|
7
8
|
|
8
9
|
export declare type Boundary = PopperJs.Boundary | 'scrollParent' | 'window';
|
9
10
|
|
11
|
+
/**
|
12
|
+
* Creates CSS styles to size the arrow created by createArrowStyles to the given height.
|
13
|
+
*
|
14
|
+
* Use this when you need to create classes for several different arrow sizes. If you only need a
|
15
|
+
* constant arrow size, you can pass the `arrowHeight` param to createArrowStyles instead.
|
16
|
+
*/
|
17
|
+
export declare function createArrowHeightStyles(arrowHeight: number): {
|
18
|
+
width: string;
|
19
|
+
height: string;
|
20
|
+
};
|
21
|
+
|
22
|
+
/**
|
23
|
+
* Helper that creates a makeStyles rule for an arrow element.
|
24
|
+
* For runtime arrow size toggling simply create extra classnames to apply to the arrow element
|
25
|
+
*
|
26
|
+
* ```ts
|
27
|
+
* makeStyles({
|
28
|
+
* arrowWithSize: createArrowStyles({ arrowHeight: 6 }),
|
29
|
+
*
|
30
|
+
* arrowWithoutSize: createArrowStyles({ arrowHeight: undefined }),
|
31
|
+
* mediumArrow: createArrowHeightStyles(4),
|
32
|
+
* smallArrow: createArrowHeightStyles(2),
|
33
|
+
* })
|
34
|
+
* ...
|
35
|
+
*
|
36
|
+
* state.arrowWithSize.className = styles.arrowWithSize;
|
37
|
+
* state.arrowWithoutSize.className = mergeClasses(
|
38
|
+
* styles.arrowWithoutSize,
|
39
|
+
* state.smallArrow && styles.smallArrow,
|
40
|
+
* state.mediumArrow && styles.mediumArrow,
|
41
|
+
* )
|
42
|
+
* ```
|
43
|
+
*/
|
44
|
+
export declare function createArrowStyles(options: CreateArrowStylesOptions): GriffelStyle;
|
45
|
+
|
46
|
+
/**
|
47
|
+
* Options parameter for the createArrowStyles function
|
48
|
+
*/
|
49
|
+
export declare type CreateArrowStylesOptions = {
|
50
|
+
/**
|
51
|
+
* The height of the arrow from the base to the tip, in px. The base width of the arrow is always twice its height.
|
52
|
+
*
|
53
|
+
* This can be undefined to leave out the arrow size styles. You must then add styles created by
|
54
|
+
* createArrowHeightStyles to set the arrow's size correctly. This can be useful if the arrow can be different sizes.
|
55
|
+
*/
|
56
|
+
arrowHeight: number | undefined;
|
57
|
+
/**
|
58
|
+
* The borderWidth of the arrow. Should be the same borderWidth as the parent element.
|
59
|
+
*
|
60
|
+
* @defaultvalue 1px
|
61
|
+
*/
|
62
|
+
borderWidth?: GriffelStyle['borderBottomWidth'];
|
63
|
+
/**
|
64
|
+
* The borderStyle for the arrow. Should be the same borderStyle as the parent element.
|
65
|
+
*
|
66
|
+
* @defaultvalue solid
|
67
|
+
*/
|
68
|
+
borderStyle?: GriffelStyle['borderBottomStyle'];
|
69
|
+
/**
|
70
|
+
* The borderColor of the arrow. Should be the same borderColor as the parent element.
|
71
|
+
*
|
72
|
+
* @defaultvalue tokens.colorTransparentStroke
|
73
|
+
*/
|
74
|
+
borderColor?: GriffelStyle['borderBottomColor'];
|
75
|
+
};
|
76
|
+
|
10
77
|
/**
|
11
78
|
* Creates a virtual element based on the position of a click event
|
12
79
|
* Can be used as a target for popper in scenarios such as context menus
|
@@ -33,42 +100,13 @@ export declare type OffsetFunctionParam = {
|
|
33
100
|
placement: PopperJs.Placement;
|
34
101
|
};
|
35
102
|
|
36
|
-
declare interface PopperOptions
|
37
|
-
/**
|
38
|
-
* If false, delays Popper's creation.
|
39
|
-
* @default true
|
40
|
-
*/
|
41
|
-
enabled?: boolean;
|
42
|
-
onStateUpdate?: (state: Partial<PopperJs.State>) => void;
|
43
|
-
/**
|
44
|
-
* Enables the Popper box to position itself in 'fixed' mode (default value is position: 'absolute')
|
45
|
-
* @default false
|
46
|
-
*/
|
47
|
-
positionFixed?: boolean;
|
48
|
-
/**
|
49
|
-
* When the reference element or the viewport is outside viewport allows a popper element to be fully in viewport.
|
50
|
-
* "all" enables this behavior for all axis.
|
51
|
-
*/
|
52
|
-
unstable_disableTether?: boolean | 'all';
|
53
|
-
}
|
54
|
-
|
55
|
-
export declare type PopperRefHandle = {
|
56
|
-
updatePosition: () => void;
|
57
|
-
};
|
58
|
-
|
59
|
-
export declare type PopperVirtualElement = PopperJs.VirtualElement;
|
60
|
-
|
61
|
-
export declare type Position = 'above' | 'below' | 'before' | 'after';
|
62
|
-
|
63
|
-
export declare interface PositioningProps {
|
103
|
+
export declare interface PopperOptions {
|
64
104
|
/** Alignment for the component. Only has an effect if used with the @see position option */
|
65
105
|
align?: Alignment;
|
66
106
|
/** The element which will define the boundaries of the popper position for the flip behavior. */
|
67
107
|
flipBoundary?: Boundary;
|
68
108
|
/** The element which will define the boundaries of the popper position for the overflow behavior. */
|
69
109
|
overflowBoundary?: Boundary;
|
70
|
-
/** An imperative handle to Popper methods. */
|
71
|
-
popperRef?: React_2.Ref<PopperRefHandle>;
|
72
110
|
/**
|
73
111
|
* Position for the component. Position has higher priority than align. If position is vertical ('above' | 'below')
|
74
112
|
* and align is also vertical ('top' | 'bottom') or if both position and align are horizontal ('before' | 'after'
|
@@ -76,6 +114,11 @@ export declare interface PositioningProps {
|
|
76
114
|
* then provided value for 'align' will be ignored and 'center' will be used instead.
|
77
115
|
*/
|
78
116
|
position?: Position;
|
117
|
+
/**
|
118
|
+
* Enables the Popper box to position itself in 'fixed' mode (default value is position: 'absolute')
|
119
|
+
* @default false
|
120
|
+
*/
|
121
|
+
positionFixed?: boolean;
|
79
122
|
/**
|
80
123
|
* Lets you displace a popper element from its reference element.
|
81
124
|
* This can be useful if you need to apply some margin between them or if you need to fine tune the
|
@@ -95,10 +138,6 @@ export declare interface PositioningProps {
|
|
95
138
|
* `height-always` applies `max-height` regardless of overflow, and 'width-always' for always applying `max-width`
|
96
139
|
*/
|
97
140
|
autoSize?: AutoSize;
|
98
|
-
/**
|
99
|
-
* Manual override for popper target. Useful for scenarios where a component accepts user prop to override target
|
100
|
-
*/
|
101
|
-
target?: HTMLElement | PopperVirtualElement | null;
|
102
141
|
/**
|
103
142
|
* Modifies position and alignment to cover the target
|
104
143
|
*/
|
@@ -108,6 +147,37 @@ export declare interface PositioningProps {
|
|
108
147
|
* `position` props, regardless of the size of the component, the reference element or the viewport.
|
109
148
|
*/
|
110
149
|
pinned?: boolean;
|
150
|
+
/**
|
151
|
+
* When the reference element or the viewport is outside viewport allows a popper element to be fully in viewport.
|
152
|
+
* "all" enables this behavior for all axis.
|
153
|
+
*/
|
154
|
+
unstable_disableTether?: boolean | 'all';
|
155
|
+
}
|
156
|
+
|
157
|
+
export declare type PopperRefHandle = {
|
158
|
+
/**
|
159
|
+
* Updates the position of the popper imperatively.
|
160
|
+
* Useful when the position of the target changes from other factors than scrolling of window resize.
|
161
|
+
*/
|
162
|
+
updatePosition: () => void;
|
163
|
+
/**
|
164
|
+
* Sets the target and updates positioning imperatively.
|
165
|
+
* Useful for avoiding double renders with the target option.
|
166
|
+
*/
|
167
|
+
setTarget: (target: HTMLElement) => void;
|
168
|
+
};
|
169
|
+
|
170
|
+
export declare type PopperVirtualElement = PopperJs.VirtualElement;
|
171
|
+
|
172
|
+
export declare type Position = 'above' | 'below' | 'before' | 'after';
|
173
|
+
|
174
|
+
export declare interface PositioningProps extends Omit<PopperOptions, 'positionFixed' | 'unstable_disableTether'> {
|
175
|
+
/** An imperative handle to Popper methods. */
|
176
|
+
popperRef?: React_2.Ref<PopperRefHandle>;
|
177
|
+
/**
|
178
|
+
* Manual override for popper target. Useful for scenarios where a component accepts user prop to override target
|
179
|
+
*/
|
180
|
+
target?: HTMLElement | PopperVirtualElement | null;
|
111
181
|
}
|
112
182
|
|
113
183
|
export declare type PositioningShorthand = PositioningProps | PositioningShorthandValue;
|
@@ -124,7 +194,7 @@ export declare function resolvePositioningShorthand(shorthand: PositioningShorth
|
|
124
194
|
* - contains a specific to React fix related to initial positioning when containers have components with managed focus
|
125
195
|
* to avoid focus jumps
|
126
196
|
*/
|
127
|
-
export declare function usePopper(options?:
|
197
|
+
export declare function usePopper(options?: UsePopperOptions): {
|
128
198
|
targetRef: React_2.MutableRefObject<any>;
|
129
199
|
containerRef: React_2.MutableRefObject<any>;
|
130
200
|
arrowRef: React_2.MutableRefObject<any>;
|
@@ -140,4 +210,12 @@ export declare function usePopper(options?: PopperOptions): {
|
|
140
210
|
*/
|
141
211
|
export declare const usePopperMouseTarget: (initialState?: PopperJs.VirtualElement | (() => PopperJs.VirtualElement) | undefined) => readonly [PopperJs.VirtualElement | undefined, (event: React_2.MouseEvent | MouseEvent | undefined | null) => void];
|
142
212
|
|
213
|
+
declare interface UsePopperOptions extends PositioningProps {
|
214
|
+
/**
|
215
|
+
* If false, delays Popper's creation.
|
216
|
+
* @default true
|
217
|
+
*/
|
218
|
+
enabled?: boolean;
|
219
|
+
}
|
220
|
+
|
143
221
|
export { }
|
@@ -0,0 +1,64 @@
|
|
1
|
+
import type { GriffelStyle } from '@griffel/react';
|
2
|
+
/**
|
3
|
+
* Options parameter for the createArrowStyles function
|
4
|
+
*/
|
5
|
+
export declare type CreateArrowStylesOptions = {
|
6
|
+
/**
|
7
|
+
* The height of the arrow from the base to the tip, in px. The base width of the arrow is always twice its height.
|
8
|
+
*
|
9
|
+
* This can be undefined to leave out the arrow size styles. You must then add styles created by
|
10
|
+
* createArrowHeightStyles to set the arrow's size correctly. This can be useful if the arrow can be different sizes.
|
11
|
+
*/
|
12
|
+
arrowHeight: number | undefined;
|
13
|
+
/**
|
14
|
+
* The borderWidth of the arrow. Should be the same borderWidth as the parent element.
|
15
|
+
*
|
16
|
+
* @defaultvalue 1px
|
17
|
+
*/
|
18
|
+
borderWidth?: GriffelStyle['borderBottomWidth'];
|
19
|
+
/**
|
20
|
+
* The borderStyle for the arrow. Should be the same borderStyle as the parent element.
|
21
|
+
*
|
22
|
+
* @defaultvalue solid
|
23
|
+
*/
|
24
|
+
borderStyle?: GriffelStyle['borderBottomStyle'];
|
25
|
+
/**
|
26
|
+
* The borderColor of the arrow. Should be the same borderColor as the parent element.
|
27
|
+
*
|
28
|
+
* @defaultvalue tokens.colorTransparentStroke
|
29
|
+
*/
|
30
|
+
borderColor?: GriffelStyle['borderBottomColor'];
|
31
|
+
};
|
32
|
+
/**
|
33
|
+
* Helper that creates a makeStyles rule for an arrow element.
|
34
|
+
* For runtime arrow size toggling simply create extra classnames to apply to the arrow element
|
35
|
+
*
|
36
|
+
* ```ts
|
37
|
+
* makeStyles({
|
38
|
+
* arrowWithSize: createArrowStyles({ arrowHeight: 6 }),
|
39
|
+
*
|
40
|
+
* arrowWithoutSize: createArrowStyles({ arrowHeight: undefined }),
|
41
|
+
* mediumArrow: createArrowHeightStyles(4),
|
42
|
+
* smallArrow: createArrowHeightStyles(2),
|
43
|
+
* })
|
44
|
+
* ...
|
45
|
+
*
|
46
|
+
* state.arrowWithSize.className = styles.arrowWithSize;
|
47
|
+
* state.arrowWithoutSize.className = mergeClasses(
|
48
|
+
* styles.arrowWithoutSize,
|
49
|
+
* state.smallArrow && styles.smallArrow,
|
50
|
+
* state.mediumArrow && styles.mediumArrow,
|
51
|
+
* )
|
52
|
+
* ```
|
53
|
+
*/
|
54
|
+
export declare function createArrowStyles(options: CreateArrowStylesOptions): GriffelStyle;
|
55
|
+
/**
|
56
|
+
* Creates CSS styles to size the arrow created by createArrowStyles to the given height.
|
57
|
+
*
|
58
|
+
* Use this when you need to create classes for several different arrow sizes. If you only need a
|
59
|
+
* constant arrow size, you can pass the `arrowHeight` param to createArrowStyles instead.
|
60
|
+
*/
|
61
|
+
export declare function createArrowHeightStyles(arrowHeight: number): {
|
62
|
+
width: string;
|
63
|
+
height: string;
|
64
|
+
};
|
@@ -0,0 +1,87 @@
|
|
1
|
+
import { shorthands } from '@griffel/react';
|
2
|
+
import { tokens } 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({ arrowHeight: 6 }),
|
10
|
+
*
|
11
|
+
* arrowWithoutSize: createArrowStyles({ arrowHeight: undefined }),
|
12
|
+
* mediumArrow: createArrowHeightStyles(4),
|
13
|
+
* smallArrow: createArrowHeightStyles(2),
|
14
|
+
* })
|
15
|
+
* ...
|
16
|
+
*
|
17
|
+
* state.arrowWithSize.className = styles.arrowWithSize;
|
18
|
+
* state.arrowWithoutSize.className = mergeClasses(
|
19
|
+
* styles.arrowWithoutSize,
|
20
|
+
* state.smallArrow && styles.smallArrow,
|
21
|
+
* state.mediumArrow && styles.mediumArrow,
|
22
|
+
* )
|
23
|
+
* ```
|
24
|
+
*/
|
25
|
+
|
26
|
+
export function createArrowStyles(options) {
|
27
|
+
const {
|
28
|
+
arrowHeight,
|
29
|
+
borderWidth = '1px',
|
30
|
+
borderStyle = 'solid',
|
31
|
+
borderColor = tokens.colorTransparentStroke
|
32
|
+
} = options;
|
33
|
+
return {
|
34
|
+
position: 'absolute',
|
35
|
+
backgroundColor: 'inherit',
|
36
|
+
visibility: 'hidden',
|
37
|
+
zIndex: -1,
|
38
|
+
...(arrowHeight && createArrowHeightStyles(arrowHeight)),
|
39
|
+
':before': {
|
40
|
+
content: '""',
|
41
|
+
visibility: 'visible',
|
42
|
+
position: 'absolute',
|
43
|
+
boxSizing: 'border-box',
|
44
|
+
width: 'inherit',
|
45
|
+
height: 'inherit',
|
46
|
+
backgroundColor: 'inherit',
|
47
|
+
...shorthands.borderRight(`${borderWidth} /* @noflip */`, `${borderStyle} /* @noflip */`, `${borderColor} /* @noflip */`),
|
48
|
+
...shorthands.borderBottom(borderWidth, borderStyle, borderColor),
|
49
|
+
borderBottomRightRadius: tokens.borderRadiusSmall,
|
50
|
+
transform: 'rotate(var(--angle)) translate(0, 50%) rotate(45deg)'
|
51
|
+
},
|
52
|
+
// Popper sets data-popper-placement on the root element, which is used to align the arrow
|
53
|
+
':global([data-popper-placement^="top"])': {
|
54
|
+
bottom: `-${borderWidth}`,
|
55
|
+
'--angle': '0'
|
56
|
+
},
|
57
|
+
':global([data-popper-placement^="right"])': {
|
58
|
+
left: `-${borderWidth} /* @noflip */`,
|
59
|
+
'--angle': '90deg'
|
60
|
+
},
|
61
|
+
':global([data-popper-placement^="bottom"])': {
|
62
|
+
top: `-${borderWidth}`,
|
63
|
+
'--angle': '180deg'
|
64
|
+
},
|
65
|
+
':global([data-popper-placement^="left"])': {
|
66
|
+
right: `-${borderWidth} /* @noflip */`,
|
67
|
+
'--angle': '270deg'
|
68
|
+
}
|
69
|
+
};
|
70
|
+
}
|
71
|
+
/**
|
72
|
+
* Creates CSS styles to size the arrow created by createArrowStyles to the given height.
|
73
|
+
*
|
74
|
+
* Use this when you need to create classes for several different arrow sizes. If you only need a
|
75
|
+
* constant arrow size, you can pass the `arrowHeight` param to createArrowStyles instead.
|
76
|
+
*/
|
77
|
+
|
78
|
+
export function createArrowHeightStyles(arrowHeight) {
|
79
|
+
// The arrow is a square rotated 45 degrees to have its bottom and right edges form a right triangle.
|
80
|
+
// Multiply the triangle's height by sqrt(2) to get length of its edges.
|
81
|
+
const edgeLength = `${1.414 * arrowHeight}px`;
|
82
|
+
return {
|
83
|
+
width: edgeLength,
|
84
|
+
height: edgeLength
|
85
|
+
};
|
86
|
+
}
|
87
|
+
//# sourceMappingURL=createArrowStyles.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["createArrowStyles.ts"],"names":[],"mappings":"AAAA,SAAS,UAAT,QAA2B,gBAA3B;AACA,SAAS,MAAT,QAAuB,uBAAvB;AAqCA;;;;;;;;;;;;;;;;;;;;;AAqBG;;AACH,OAAM,SAAU,iBAAV,CAA4B,OAA5B,EAA6D;AACjE,QAAM;AACJ,IAAA,WADI;AAEJ,IAAA,WAAW,GAAG,KAFV;AAGJ,IAAA,WAAW,GAAG,OAHV;AAIJ,IAAA,WAAW,GAAG,MAAM,CAAC;AAJjB,MAKF,OALJ;AAOA,SAAO;AACL,IAAA,QAAQ,EAAE,UADL;AAEL,IAAA,eAAe,EAAE,SAFZ;AAGL,IAAA,UAAU,EAAE,QAHP;AAIL,IAAA,MAAM,EAAE,CAAC,CAJJ;AAML,QAAI,WAAW,IAAI,uBAAuB,CAAC,WAAD,CAA1C,CANK;AAQL,eAAW;AACT,MAAA,OAAO,EAAE,IADA;AAET,MAAA,UAAU,EAAE,SAFH;AAGT,MAAA,QAAQ,EAAE,UAHD;AAIT,MAAA,SAAS,EAAE,YAJF;AAKT,MAAA,KAAK,EAAE,SALE;AAMT,MAAA,MAAM,EAAE,SANC;AAOT,MAAA,eAAe,EAAE,SAPR;AAQT,SAAG,UAAU,CAAC,WAAX,CACD,GAAG,WAAW,gBADb,EAED,GAAG,WAAW,gBAFb,EAGD,GAAG,WAAW,gBAHb,CARM;AAaT,SAAG,UAAU,CAAC,YAAX,CAAwB,WAAxB,EAAqC,WAArC,EAAkD,WAAlD,CAbM;AAcT,MAAA,uBAAuB,EAAE,MAAM,CAAC,iBAdvB;AAeT,MAAA,SAAS,EAAE;AAfF,KARN;AA0BL;AACA,+CAA2C;AACzC,MAAA,MAAM,EAAE,IAAI,WAAW,EADkB;AAEzC,iBAAW;AAF8B,KA3BtC;AA+BL,iDAA6C;AAC3C,MAAA,IAAI,EAAE,IAAI,WAAW,gBADsB;AAE3C,iBAAW;AAFgC,KA/BxC;AAmCL,kDAA8C;AAC5C,MAAA,GAAG,EAAE,IAAI,WAAW,EADwB;AAE5C,iBAAW;AAFiC,KAnCzC;AAuCL,gDAA4C;AAC1C,MAAA,KAAK,EAAE,IAAI,WAAW,gBADoB;AAE1C,iBAAW;AAF+B;AAvCvC,GAAP;AA4CD;AAED;;;;;AAKG;;AACH,OAAM,SAAU,uBAAV,CAAkC,WAAlC,EAAqD;AACzD;AACA;AACA,QAAM,UAAU,GAAG,GAAG,QAAQ,WAAW,IAAzC;AACA,SAAO;AAAE,IAAA,KAAK,EAAE,UAAT;AAAqB,IAAA,MAAM,EAAE;AAA7B,GAAP;AACD","sourcesContent":["import { shorthands } from '@griffel/react';\nimport { tokens } from '@fluentui/react-theme';\nimport type { GriffelStyle } from '@griffel/react';\n\n/**\n * Options parameter for the createArrowStyles function\n */\nexport type CreateArrowStylesOptions = {\n /**\n * The height of the arrow from the base to the tip, in px. The base width of the arrow is always twice its height.\n *\n * This can be undefined to leave out the arrow size styles. You must then add styles created by\n * createArrowHeightStyles to set the arrow's size correctly. This can be useful if the arrow can be different sizes.\n */\n arrowHeight: number | undefined;\n\n /**\n * The borderWidth of the arrow. Should be the same borderWidth as the parent element.\n *\n * @defaultvalue 1px\n */\n borderWidth?: GriffelStyle['borderBottomWidth'];\n\n /**\n * The borderStyle for the arrow. Should be the same borderStyle as the parent element.\n *\n * @defaultvalue solid\n */\n borderStyle?: GriffelStyle['borderBottomStyle'];\n\n /**\n * The borderColor of the arrow. Should be the same borderColor as the parent element.\n *\n * @defaultvalue tokens.colorTransparentStroke\n */\n borderColor?: GriffelStyle['borderBottomColor'];\n};\n\n/**\n * Helper that creates a makeStyles rule for an arrow element.\n * For runtime arrow size toggling simply create extra classnames to apply to the arrow element\n *\n * ```ts\n * makeStyles({\n * arrowWithSize: createArrowStyles({ arrowHeight: 6 }),\n *\n * arrowWithoutSize: createArrowStyles({ arrowHeight: undefined }),\n * mediumArrow: createArrowHeightStyles(4),\n * smallArrow: createArrowHeightStyles(2),\n * })\n * ...\n *\n * state.arrowWithSize.className = styles.arrowWithSize;\n * state.arrowWithoutSize.className = mergeClasses(\n * styles.arrowWithoutSize,\n * state.smallArrow && styles.smallArrow,\n * state.mediumArrow && styles.mediumArrow,\n * )\n * ```\n */\nexport function createArrowStyles(options: CreateArrowStylesOptions): GriffelStyle {\n const {\n arrowHeight,\n borderWidth = '1px',\n borderStyle = 'solid',\n borderColor = tokens.colorTransparentStroke,\n } = options;\n\n return {\n position: 'absolute',\n backgroundColor: 'inherit',\n visibility: 'hidden',\n zIndex: -1,\n\n ...(arrowHeight && createArrowHeightStyles(arrowHeight)),\n\n ':before': {\n content: '\"\"',\n visibility: 'visible',\n position: 'absolute',\n boxSizing: 'border-box',\n width: 'inherit',\n height: 'inherit',\n backgroundColor: 'inherit',\n ...shorthands.borderRight(\n `${borderWidth} /* @noflip */`,\n `${borderStyle} /* @noflip */`,\n `${borderColor} /* @noflip */`,\n ),\n ...shorthands.borderBottom(borderWidth, borderStyle, borderColor),\n borderBottomRightRadius: tokens.borderRadiusSmall,\n transform: 'rotate(var(--angle)) translate(0, 50%) rotate(45deg)',\n },\n\n // Popper sets data-popper-placement on the root element, which is used to align the arrow\n ':global([data-popper-placement^=\"top\"])': {\n bottom: `-${borderWidth}`,\n '--angle': '0',\n },\n ':global([data-popper-placement^=\"right\"])': {\n left: `-${borderWidth} /* @noflip */`,\n '--angle': '90deg',\n },\n ':global([data-popper-placement^=\"bottom\"])': {\n top: `-${borderWidth}`,\n '--angle': '180deg',\n },\n ':global([data-popper-placement^=\"left\"])': {\n right: `-${borderWidth} /* @noflip */`,\n '--angle': '270deg',\n },\n };\n}\n\n/**\n * Creates CSS styles to size the arrow created by createArrowStyles to the given height.\n *\n * Use this when you need to create classes for several different arrow sizes. If you only need a\n * constant arrow size, you can pass the `arrowHeight` param to createArrowStyles instead.\n */\nexport function createArrowHeightStyles(arrowHeight: number) {\n // The arrow is a square rotated 45 degrees to have its bottom and right edges form a right triangle.\n // Multiply the triangle's height by sqrt(2) to get length of its edges.\n const edgeLength = `${1.414 * arrowHeight}px`;\n return { width: edgeLength, height: edgeLength };\n}\n"],"sourceRoot":"../src/"}
|