@primer/react 0.0.0-20260226201328 → 0.0.0-20260226204353
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 +1 -1
- package/dist/ActionMenu/ActionMenu.d.ts.map +1 -1
- package/dist/ActionMenu/ActionMenu.js +0 -2
- package/dist/AnchoredOverlay/AnchoredOverlay.d.ts +0 -9
- package/dist/AnchoredOverlay/AnchoredOverlay.d.ts.map +1 -1
- package/dist/AnchoredOverlay/AnchoredOverlay.js +7 -9
- package/dist/FeatureFlags/DefaultFeatureFlags.d.ts.map +1 -1
- package/dist/FeatureFlags/DefaultFeatureFlags.js +1 -0
- package/dist/Overlay/Overlay.d.ts +0 -2
- package/dist/Overlay/Overlay.d.ts.map +1 -1
- package/dist/Overlay/Overlay.js +75 -79
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ActionMenu.d.ts","sourceRoot":"","sources":["../../src/ActionMenu/ActionMenu.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA8D,MAAM,OAAO,CAAA;AAElF,OAAO,KAAK,EAAC,oBAAoB,EAAC,MAAM,oBAAoB,CAAA;AAE5D,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,YAAY,CAAA;AAI5C,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,WAAW,CAAA;AAC1C,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,mBAAmB,CAAA;AAIrD,OAAO,KAAK,EAAC,mBAAmB,IAAI,8BAA8B,EAAC,MAAM,sBAAsB,CAAA;AAK/F,OAAO,KAAK,EAAC,gBAAgB,EAAE,cAAc,EAAC,MAAM,sBAAsB,CAAA;AAE1E,MAAM,MAAM,gBAAgB,GAAG,CAC7B,OAAO,EAAE,cAAc,GAAG,eAAe,GAAG,QAAQ,GAAG,KAAK,GAAG,aAAa,GAAG,YAAY,GAAG,OAAO,KAClG,IAAI,CAAA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A;CAAC,GAAG,KAAK,CAAC,cAAc,CAAC,WAAW,CAAC,CAAA;AA0DxH,6CAA6C;AAC7C,MAAM,MAAM,qBAAqB,GAAG,WAAW,CAAA;AAe/C,KAAK,gBAAgB,GAAG,OAAO,CAAC,YAAY,CAAC,GAC3C,IAAI,CAAC,oBAAoB,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,GAAG,mBAAmB,CAAC,GAAG;IAC/E;;OAEG;IACH,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;IACzB,gBAAgB,CAAC,EAAE,CAAC,EAAC,QAAQ,EAAC,EAAE;QAAC,QAAQ,EAAE,cAAc,CAAA;KAAC,KAAK,IAAI,CAAA;CACpE,CAAA;AAwGH,eAAO,MAAM,UAAU;;;kBApLP,KAAK,CAAC,YAAY,CAAC,GAAG,CAAC;aAC5B,MAAM;;;;CAmL4E,CAAA"}
|
|
@@ -272,8 +272,6 @@ const Overlay = ({
|
|
|
272
272
|
onPositionChange: onPositionChange,
|
|
273
273
|
variant: variant,
|
|
274
274
|
displayInViewport: displayInViewport,
|
|
275
|
-
preventPortal: true,
|
|
276
|
-
preventAnchorPositioning: true,
|
|
277
275
|
children: /*#__PURE__*/jsx("div", {
|
|
278
276
|
ref: containerRef,
|
|
279
277
|
className: styles.ActionMenuContainer,
|
|
@@ -94,15 +94,6 @@ interface AnchoredOverlayBaseProps extends Pick<OverlayProps, 'height' | 'width'
|
|
|
94
94
|
* Props to be spread on the close button in the overlay.
|
|
95
95
|
*/
|
|
96
96
|
closeButtonProps?: Partial<IconButtonProps>;
|
|
97
|
-
/**
|
|
98
|
-
* If true, the overlay will render inline instead of inside a Portal.
|
|
99
|
-
*/
|
|
100
|
-
preventPortal?: boolean;
|
|
101
|
-
/**
|
|
102
|
-
* If true, the overlay will not use the internal anchor positioning provided by `useAnchoredPosition`.
|
|
103
|
-
* Use this when you want to control the overlay position yourself via `overlayProps`.
|
|
104
|
-
*/
|
|
105
|
-
preventAnchorPositioning?: boolean;
|
|
106
97
|
popover?: boolean;
|
|
107
98
|
}
|
|
108
99
|
export type AnchoredOverlayProps = AnchoredOverlayBaseProps & (AnchoredOverlayPropsWithAnchor | AnchoredOverlayPropsWithoutAnchor) & Partial<Pick<PositionSettings, 'align' | 'side' | 'anchorOffset' | 'alignmentOffset' | 'displayInViewport'>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AnchoredOverlay.d.ts","sourceRoot":"","sources":["../../src/AnchoredOverlay/AnchoredOverlay.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAyB,KAAK,GAAG,EAAC,MAAM,OAAO,CAAA;AACtD,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,YAAY,CAAA;AAE5C,OAAO,KAAK,EAAC,qBAAqB,EAAC,MAAM,uBAAuB,CAAA;AAEhE,OAAO,KAAK,EAAC,qBAAqB,EAAC,MAAM,uBAAuB,CAAA;AAIhE,OAAO,KAAK,EAAC,cAAc,EAAE,gBAAgB,EAAC,MAAM,mBAAmB,CAAA;AACvE,OAAO,EAAC,KAAK,eAAe,EAAC,MAAM,6BAA6B,CAAA;AAChE,OAAO,EAAa,KAAK,eAAe,EAAC,MAAM,WAAW,CAAA;
|
|
1
|
+
{"version":3,"file":"AnchoredOverlay.d.ts","sourceRoot":"","sources":["../../src/AnchoredOverlay/AnchoredOverlay.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAyB,KAAK,GAAG,EAAC,MAAM,OAAO,CAAA;AACtD,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,YAAY,CAAA;AAE5C,OAAO,KAAK,EAAC,qBAAqB,EAAC,MAAM,uBAAuB,CAAA;AAEhE,OAAO,KAAK,EAAC,qBAAqB,EAAC,MAAM,uBAAuB,CAAA;AAIhE,OAAO,KAAK,EAAC,cAAc,EAAE,gBAAgB,EAAC,MAAM,mBAAm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AAiB,CAAC,EAAE,OAAO,CAAC,qBAAqB,CAAC,CAAA;IAElD;;OAEG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAC,qBAAqB,CAAC,CAAA;IAElD;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB;;;OAGG;IACH,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB;;OAEG;IACH,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB;;OAEG;IACH,OAAO,CAAC,EAAE,eAAe,CAAC,UAAU,EAAE,UAAU,GAAG,YAAY,CAAC,CAAA;IAChE;;OAEG;IACH,gBAAgB,CAAC,EAAE,CAAC,EAAC,QAAQ,EAAC,EAAE;QAAC,QAAQ,EAAE,cAAc,CAAA;KAAC,KAAK,IAAI,CAAA;IACnE;;OAEG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAA;IAC5B;;OAEG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC,eAAe,CAAC,CAAA;IAC3C,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB;AAED,MAAM,MAAM,oBAAoB,GAAG,wBAAwB,GACzD,CAAC,8BAA8B,GAAG,iCAAiC,CAAC,GACpE,OAAO,CAAC,IAAI,CAAC,gBAAgB,EAAE,OAAO,GAAG,MAAM,GAAG,cAAc,GAAG,iBAAiB,GAAG,mBAAmB,CAAC,CAAC,CAAA;AAS9G;;;GAGG;AACH,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,iBAAiB,CAAC,oBAAoB,CAAC,CAiKnF,CAAA"}
|
|
@@ -7,6 +7,7 @@ import { XIcon } from '@primer/octicons-react';
|
|
|
7
7
|
import classes from './AnchoredOverlay.module.css.js';
|
|
8
8
|
import { clsx } from 'clsx';
|
|
9
9
|
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
10
|
+
import { useFeatureFlag } from '../FeatureFlags/useFeatureFlag.js';
|
|
10
11
|
import { useProvidedRefOrCreate } from '../hooks/useProvidedRefOrCreate.js';
|
|
11
12
|
import { useRenderForcingRef } from '../hooks/useRenderForcingRef.js';
|
|
12
13
|
import { useAnchoredPosition } from '../hooks/useAnchoredPosition.js';
|
|
@@ -40,17 +41,15 @@ const AnchoredOverlay = ({
|
|
|
40
41
|
alignmentOffset,
|
|
41
42
|
anchorOffset,
|
|
42
43
|
displayInViewport,
|
|
43
|
-
className,
|
|
44
44
|
pinPosition,
|
|
45
45
|
variant = defaultVariant,
|
|
46
46
|
preventOverflow = true,
|
|
47
47
|
onPositionChange,
|
|
48
48
|
displayCloseButton = true,
|
|
49
49
|
closeButtonProps = defaultCloseButtonProps,
|
|
50
|
-
preventPortal,
|
|
51
|
-
preventAnchorPositioning,
|
|
52
50
|
popover = false
|
|
53
51
|
}) => {
|
|
52
|
+
const cssAnchorPositioning = useFeatureFlag('primer_react_css_anchor_positioning');
|
|
54
53
|
const anchorRef = useProvidedRefOrCreate(externalAnchorRef);
|
|
55
54
|
const [overlayRef, updateOverlayRef] = useRenderForcingRef();
|
|
56
55
|
const anchorId = useId(externalAnchorId);
|
|
@@ -129,16 +128,15 @@ const AnchoredOverlay = ({
|
|
|
129
128
|
ignoreClickRefs: [anchorRef],
|
|
130
129
|
onEscape: onEscape,
|
|
131
130
|
role: "none",
|
|
132
|
-
visibility:
|
|
131
|
+
visibility: cssAnchorPositioning || position_0 ? 'visible' : 'hidden',
|
|
133
132
|
height: height,
|
|
134
133
|
width: width,
|
|
135
|
-
top:
|
|
136
|
-
left:
|
|
134
|
+
top: cssAnchorPositioning ? undefined : (position_0 === null || position_0 === void 0 ? void 0 : position_0.top) || 0,
|
|
135
|
+
left: cssAnchorPositioning ? undefined : (position_0 === null || position_0 === void 0 ? void 0 : position_0.left) || 0,
|
|
137
136
|
responsiveVariant: variant.narrow === 'fullscreen' ? 'fullscreen' : undefined,
|
|
138
|
-
anchorSide:
|
|
137
|
+
anchorSide: cssAnchorPositioning ? undefined : position_0 === null || position_0 === void 0 ? void 0 : position_0.anchorSide,
|
|
139
138
|
className: classes.AnchoredOverlay,
|
|
140
139
|
preventOverflow: preventOverflow,
|
|
141
|
-
preventPortal: preventPortal,
|
|
142
140
|
popover: popover,
|
|
143
141
|
"data-component": "AnchoredOverlay",
|
|
144
142
|
...overlayProps,
|
|
@@ -148,7 +146,7 @@ const AnchoredOverlay = ({
|
|
|
148
146
|
}
|
|
149
147
|
updateOverlayRef(node);
|
|
150
148
|
},
|
|
151
|
-
"data-anchor-position":
|
|
149
|
+
"data-anchor-position": cssAnchorPositioning,
|
|
152
150
|
children: [showXIcon ? /*#__PURE__*/jsx("div", {
|
|
153
151
|
className: classes.ResponsiveCloseButtonContainer,
|
|
154
152
|
children: /*#__PURE__*/jsx(IconButton, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DefaultFeatureFlags.d.ts","sourceRoot":"","sources":["../../src/FeatureFlags/DefaultFeatureFlags.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,gBAAgB,EAAC,MAAM,oBAAoB,CAAA;AAEnD,eAAO,MAAM,mBAAmB,
|
|
1
|
+
{"version":3,"file":"DefaultFeatureFlags.d.ts","sourceRoot":"","sources":["../../src/FeatureFlags/DefaultFeatureFlags.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,gBAAgB,EAAC,MAAM,oBAAoB,CAAA;AAEnD,eAAO,MAAM,mBAAmB,kBAQ9B,CAAA"}
|
|
@@ -2,6 +2,7 @@ import { FeatureFlagScope } from './FeatureFlagScope.js';
|
|
|
2
2
|
|
|
3
3
|
const DefaultFeatureFlags = FeatureFlagScope.create({
|
|
4
4
|
primer_react_breadcrumbs_overflow_menu: false,
|
|
5
|
+
primer_react_css_anchor_positioning: false,
|
|
5
6
|
primer_react_css_has_selector_perf: false,
|
|
6
7
|
primer_react_select_panel_fullscreen_on_narrow: false,
|
|
7
8
|
primer_react_select_panel_order_selected_at_top: false,
|
|
@@ -68,7 +68,6 @@ type ContainerProps = {
|
|
|
68
68
|
portalContainerName?: string;
|
|
69
69
|
preventOverflow?: boolean;
|
|
70
70
|
preventFocusOnOpen?: boolean;
|
|
71
|
-
preventPortal?: boolean;
|
|
72
71
|
/**
|
|
73
72
|
* If true, applies the `popover` attribute to the overlay element,
|
|
74
73
|
* enabling the Popover API for top-layer rendering and light dismiss.
|
|
@@ -88,7 +87,6 @@ type internalOverlayProps = Merge<OwnOverlayProps, ContainerProps>;
|
|
|
88
87
|
* @param portalContainerName Optional. The name of the portal container to render the Overlay into.
|
|
89
88
|
* @param preventOverflow Optional. The Overlay width will be adjusted responsively if there is not enough space to display the Overlay. If `preventOverflow` is `true`, the width of the `Overlay` will not be adjusted.
|
|
90
89
|
* @param preventFocusOnOpen Optional. If 'true', focus will not be applied when the component is first mounted, even if initialFocusRef prop is given.
|
|
91
|
-
* @param preventPortal Optional. If `true`, the Overlay will not be rendered inside a Portal and will instead render inline.
|
|
92
90
|
* @param returnFocusRef Required. Ref for the element to focus when the `Overlay` is closed.
|
|
93
91
|
* @param right Optional. Horizontal right position of the overlay, relative to its closest positioned ancestor (often its `Portal`).
|
|
94
92
|
* @param width Sets the width of the `Overlay`, pick from our set list of widths, or pass `auto` to automatically set the width based on the content of the `Overlay`. `small` corresponds to `256px`, `medium` corresponds to `320px`, `large` corresponds to `480px`, `xlarge` corresponds to `640px`, `xxlarge` corresponds to `960px`.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Overlay.d.ts","sourceRoot":"","sources":["../../src/Overlay/Overlay.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,qBAAqB,EAAe,MAAM,OAAO,CAAA;AAC9D,OAAO,KAA0B,MAAM,OAAO,CAAA;AAE9C,OAAO,KAAK,EAAC,QAAQ,EAAE,KAAK,EAAC,MAAM,gBAAgB,CAAA;AACnD,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,UAAU,CAAA;AAI/C,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,mBAAmB,CAAA;AACjD,OAAO,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CAAA;AAED,KAAK,oBAAoB,GAAG,KAAK,CAAC,eAAe,EAAE,cAAc,CAAC,CAAA;AAElE;;;;;;;;;;;;;;;GAeG;AACH,QAAA,MAAM,OAAO,EAwFR,8BAA8B,CAAC,KAAK,EAAE,oBAAoB,CAAC,CAAA;AAEhE,MAAM,MAAM,YAAY,GAAG,qBAAqB,CAAC,OAAO,OAAO,CAAC,CAAA;AAEhE,eAAe,OAAO,CAAA"}
|
package/dist/Overlay/Overlay.js
CHANGED
|
@@ -6,6 +6,7 @@ import { useRefObjectAsForwardedRef } from '../hooks/useRefObjectAsForwardedRef.
|
|
|
6
6
|
import classes from './Overlay.module.css.js';
|
|
7
7
|
import { clsx } from 'clsx';
|
|
8
8
|
import { jsx } from 'react/jsx-runtime';
|
|
9
|
+
import { useFeatureFlag } from '../FeatureFlags/useFeatureFlag.js';
|
|
9
10
|
import { useOverlay } from '../hooks/useOverlay.js';
|
|
10
11
|
|
|
11
12
|
const heightMap = {
|
|
@@ -109,14 +110,13 @@ const BaseOverlay = /*#__PURE__*/React.forwardRef(({
|
|
|
109
110
|
* @param portalContainerName Optional. The name of the portal container to render the Overlay into.
|
|
110
111
|
* @param preventOverflow Optional. The Overlay width will be adjusted responsively if there is not enough space to display the Overlay. If `preventOverflow` is `true`, the width of the `Overlay` will not be adjusted.
|
|
111
112
|
* @param preventFocusOnOpen Optional. If 'true', focus will not be applied when the component is first mounted, even if initialFocusRef prop is given.
|
|
112
|
-
* @param preventPortal Optional. If `true`, the Overlay will not be rendered inside a Portal and will instead render inline.
|
|
113
113
|
* @param returnFocusRef Required. Ref for the element to focus when the `Overlay` is closed.
|
|
114
114
|
* @param right Optional. Horizontal right position of the overlay, relative to its closest positioned ancestor (often its `Portal`).
|
|
115
115
|
* @param width Sets the width of the `Overlay`, pick from our set list of widths, or pass `auto` to automatically set the width based on the content of the `Overlay`. `small` corresponds to `256px`, `medium` corresponds to `320px`, `large` corresponds to `480px`, `xlarge` corresponds to `640px`, `xxlarge` corresponds to `960px`.
|
|
116
116
|
|
|
117
117
|
*/
|
|
118
118
|
const Overlay = /*#__PURE__*/React.forwardRef((t0, forwardedRef) => {
|
|
119
|
-
const $ = c(
|
|
119
|
+
const $ = c(49);
|
|
120
120
|
let anchorSide;
|
|
121
121
|
let ignoreClickRefs;
|
|
122
122
|
let initialFocusRef;
|
|
@@ -135,7 +135,6 @@ const Overlay = /*#__PURE__*/React.forwardRef((t0, forwardedRef) => {
|
|
|
135
135
|
let t4;
|
|
136
136
|
let t5;
|
|
137
137
|
let t6;
|
|
138
|
-
let t7;
|
|
139
138
|
if ($[0] !== t0) {
|
|
140
139
|
({
|
|
141
140
|
anchorSide,
|
|
@@ -148,13 +147,12 @@ const Overlay = /*#__PURE__*/React.forwardRef((t0, forwardedRef) => {
|
|
|
148
147
|
portalContainerName,
|
|
149
148
|
preventOverflow: t2,
|
|
150
149
|
preventFocusOnOpen,
|
|
151
|
-
|
|
152
|
-
popover: t4,
|
|
150
|
+
popover: t3,
|
|
153
151
|
returnFocusRef,
|
|
154
152
|
right,
|
|
155
|
-
role:
|
|
156
|
-
visibility:
|
|
157
|
-
width:
|
|
153
|
+
role: t4,
|
|
154
|
+
visibility: t5,
|
|
155
|
+
width: t6,
|
|
158
156
|
responsiveVariant,
|
|
159
157
|
...props
|
|
160
158
|
} = t0);
|
|
@@ -177,7 +175,6 @@ const Overlay = /*#__PURE__*/React.forwardRef((t0, forwardedRef) => {
|
|
|
177
175
|
$[16] = t4;
|
|
178
176
|
$[17] = t5;
|
|
179
177
|
$[18] = t6;
|
|
180
|
-
$[19] = t7;
|
|
181
178
|
} else {
|
|
182
179
|
anchorSide = $[1];
|
|
183
180
|
ignoreClickRefs = $[2];
|
|
@@ -197,20 +194,19 @@ const Overlay = /*#__PURE__*/React.forwardRef((t0, forwardedRef) => {
|
|
|
197
194
|
t4 = $[16];
|
|
198
195
|
t5 = $[17];
|
|
199
196
|
t6 = $[18];
|
|
200
|
-
t7 = $[19];
|
|
201
197
|
}
|
|
202
198
|
const height = t1 === undefined ? "auto" : t1;
|
|
203
199
|
const preventOverflow = t2 === undefined ? true : t2;
|
|
204
|
-
const
|
|
205
|
-
const
|
|
206
|
-
const
|
|
207
|
-
const
|
|
208
|
-
const
|
|
200
|
+
const popover = t3 === undefined ? false : t3;
|
|
201
|
+
const role = t4 === undefined ? "none" : t4;
|
|
202
|
+
const visibility = t5 === undefined ? "visible" : t5;
|
|
203
|
+
const width = t6 === undefined ? "auto" : t6;
|
|
204
|
+
const cssAnchorPositioning = useFeatureFlag("primer_react_css_anchor_positioning");
|
|
209
205
|
const overlayRef = useRef(null);
|
|
210
206
|
useRefObjectAsForwardedRef(forwardedRef, overlayRef);
|
|
211
|
-
let
|
|
212
|
-
if ($[
|
|
213
|
-
|
|
207
|
+
let t7;
|
|
208
|
+
if ($[19] !== ignoreClickRefs || $[20] !== initialFocusRef || $[21] !== onClickOutside || $[22] !== onEscape || $[23] !== preventFocusOnOpen || $[24] !== returnFocusRef) {
|
|
209
|
+
t7 = {
|
|
214
210
|
overlayRef,
|
|
215
211
|
returnFocusRef,
|
|
216
212
|
onEscape,
|
|
@@ -219,39 +215,39 @@ const Overlay = /*#__PURE__*/React.forwardRef((t0, forwardedRef) => {
|
|
|
219
215
|
initialFocusRef,
|
|
220
216
|
preventFocusOnOpen
|
|
221
217
|
};
|
|
222
|
-
$[
|
|
223
|
-
$[
|
|
224
|
-
$[
|
|
225
|
-
$[
|
|
226
|
-
$[
|
|
227
|
-
$[
|
|
228
|
-
$[
|
|
218
|
+
$[19] = ignoreClickRefs;
|
|
219
|
+
$[20] = initialFocusRef;
|
|
220
|
+
$[21] = onClickOutside;
|
|
221
|
+
$[22] = onEscape;
|
|
222
|
+
$[23] = preventFocusOnOpen;
|
|
223
|
+
$[24] = returnFocusRef;
|
|
224
|
+
$[25] = t7;
|
|
229
225
|
} else {
|
|
230
|
-
|
|
226
|
+
t7 = $[25];
|
|
231
227
|
}
|
|
232
|
-
useOverlay(
|
|
233
|
-
let
|
|
228
|
+
useOverlay(t7);
|
|
229
|
+
let t8;
|
|
234
230
|
let t9;
|
|
235
|
-
if ($[
|
|
236
|
-
|
|
231
|
+
if ($[26] !== height) {
|
|
232
|
+
t8 = () => {
|
|
237
233
|
var _overlayRef$current;
|
|
238
234
|
if (height === "initial" && (_overlayRef$current = overlayRef.current) !== null && _overlayRef$current !== void 0 && _overlayRef$current.clientHeight) {
|
|
239
235
|
overlayRef.current.style.height = `${overlayRef.current.clientHeight}px`;
|
|
240
236
|
}
|
|
241
237
|
};
|
|
242
|
-
|
|
243
|
-
$[
|
|
244
|
-
$[
|
|
245
|
-
$[
|
|
238
|
+
t9 = [height];
|
|
239
|
+
$[26] = height;
|
|
240
|
+
$[27] = t8;
|
|
241
|
+
$[28] = t9;
|
|
246
242
|
} else {
|
|
247
|
-
|
|
248
|
-
t9 = $[
|
|
243
|
+
t8 = $[27];
|
|
244
|
+
t9 = $[28];
|
|
249
245
|
}
|
|
250
|
-
useEffect(
|
|
246
|
+
useEffect(t8, t9);
|
|
247
|
+
let t10;
|
|
251
248
|
let t11;
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
t11 = () => {
|
|
249
|
+
if ($[29] !== anchorSide || $[30] !== visibility) {
|
|
250
|
+
t10 = () => {
|
|
255
251
|
var _overlayRef$current2;
|
|
256
252
|
const {
|
|
257
253
|
x,
|
|
@@ -267,74 +263,74 @@ const Overlay = /*#__PURE__*/React.forwardRef((t0, forwardedRef) => {
|
|
|
267
263
|
easing: "cubic-bezier(0.33, 1, 0.68, 1)"
|
|
268
264
|
});
|
|
269
265
|
};
|
|
270
|
-
|
|
271
|
-
$[
|
|
272
|
-
$[
|
|
266
|
+
t11 = [anchorSide, 8, "cubic-bezier(0.33, 1, 0.68, 1)", visibility];
|
|
267
|
+
$[29] = anchorSide;
|
|
268
|
+
$[30] = visibility;
|
|
269
|
+
$[31] = t10;
|
|
273
270
|
$[32] = t11;
|
|
274
|
-
$[33] = t12;
|
|
275
271
|
} else {
|
|
272
|
+
t10 = $[31];
|
|
276
273
|
t11 = $[32];
|
|
277
|
-
t12 = $[33];
|
|
278
274
|
}
|
|
279
|
-
useIsomorphicLayoutEffect(
|
|
275
|
+
useIsomorphicLayoutEffect(t10, t11);
|
|
280
276
|
const leftPosition = left === undefined && right === undefined ? 0 : left;
|
|
281
|
-
const
|
|
282
|
-
let
|
|
283
|
-
if ($[
|
|
284
|
-
|
|
277
|
+
const t12 = !preventOverflow ? true : undefined;
|
|
278
|
+
let t13;
|
|
279
|
+
if ($[33] !== popover) {
|
|
280
|
+
t13 = popover ? {
|
|
285
281
|
popover: "auto"
|
|
286
282
|
} : {};
|
|
287
|
-
$[
|
|
288
|
-
$[
|
|
283
|
+
$[33] = popover;
|
|
284
|
+
$[34] = t13;
|
|
289
285
|
} else {
|
|
290
|
-
|
|
286
|
+
t13 = $[34];
|
|
291
287
|
}
|
|
292
|
-
let
|
|
293
|
-
if ($[
|
|
294
|
-
|
|
288
|
+
let t14;
|
|
289
|
+
if ($[35] !== height || $[36] !== leftPosition || $[37] !== props || $[38] !== responsiveVariant || $[39] !== right || $[40] !== role || $[41] !== t12 || $[42] !== t13 || $[43] !== visibility || $[44] !== width) {
|
|
290
|
+
t14 = /*#__PURE__*/jsx(BaseOverlay, {
|
|
295
291
|
role: role,
|
|
296
292
|
width: width,
|
|
297
|
-
"data-reflow-container":
|
|
293
|
+
"data-reflow-container": t12,
|
|
298
294
|
ref: overlayRef,
|
|
299
295
|
left: leftPosition,
|
|
300
296
|
right: right,
|
|
301
297
|
height: height,
|
|
302
298
|
visibility: visibility,
|
|
303
299
|
"data-responsive": responsiveVariant,
|
|
304
|
-
...
|
|
300
|
+
...t13,
|
|
305
301
|
...props
|
|
306
302
|
});
|
|
307
|
-
$[
|
|
308
|
-
$[
|
|
309
|
-
$[
|
|
310
|
-
$[
|
|
311
|
-
$[
|
|
312
|
-
$[
|
|
303
|
+
$[35] = height;
|
|
304
|
+
$[36] = leftPosition;
|
|
305
|
+
$[37] = props;
|
|
306
|
+
$[38] = responsiveVariant;
|
|
307
|
+
$[39] = right;
|
|
308
|
+
$[40] = role;
|
|
309
|
+
$[41] = t12;
|
|
313
310
|
$[42] = t13;
|
|
314
|
-
$[43] =
|
|
315
|
-
$[44] =
|
|
316
|
-
$[45] =
|
|
317
|
-
$[46] = t15;
|
|
311
|
+
$[43] = visibility;
|
|
312
|
+
$[44] = width;
|
|
313
|
+
$[45] = t14;
|
|
318
314
|
} else {
|
|
319
|
-
|
|
315
|
+
t14 = $[45];
|
|
320
316
|
}
|
|
321
|
-
const overlayContent =
|
|
322
|
-
if (
|
|
317
|
+
const overlayContent = t14;
|
|
318
|
+
if (cssAnchorPositioning) {
|
|
323
319
|
return overlayContent;
|
|
324
320
|
}
|
|
325
|
-
let
|
|
326
|
-
if ($[
|
|
327
|
-
|
|
321
|
+
let t15;
|
|
322
|
+
if ($[46] !== overlayContent || $[47] !== portalContainerName) {
|
|
323
|
+
t15 = /*#__PURE__*/jsx(Portal, {
|
|
328
324
|
containerName: portalContainerName,
|
|
329
325
|
children: overlayContent
|
|
330
326
|
});
|
|
331
|
-
$[
|
|
332
|
-
$[
|
|
333
|
-
$[
|
|
327
|
+
$[46] = overlayContent;
|
|
328
|
+
$[47] = portalContainerName;
|
|
329
|
+
$[48] = t15;
|
|
334
330
|
} else {
|
|
335
|
-
|
|
331
|
+
t15 = $[48];
|
|
336
332
|
}
|
|
337
|
-
return
|
|
333
|
+
return t15;
|
|
338
334
|
});
|
|
339
335
|
|
|
340
336
|
export { BaseOverlay, Overlay as default, heightMap };
|
package/package.json
CHANGED