@elliemae/ds-floating-context 3.70.0-next.7 → 3.70.0-next.70
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/dist/cjs/DSFloatingContext.js +129 -41
- package/dist/cjs/DSFloatingContext.js.map +2 -2
- package/dist/cjs/hooks/useFloatingClickOutside.js +60 -0
- package/dist/cjs/hooks/useFloatingClickOutside.js.map +7 -0
- package/dist/cjs/hooks/useFloatingResizeObserver.js +52 -0
- package/dist/cjs/hooks/useFloatingResizeObserver.js.map +7 -0
- package/dist/cjs/hooks/useLatestRef.js +41 -0
- package/dist/cjs/hooks/useLatestRef.js.map +7 -0
- package/dist/cjs/hooks/useReferenceHiddenByBoundary.js +59 -0
- package/dist/cjs/hooks/useReferenceHiddenByBoundary.js.map +7 -0
- package/dist/cjs/hooks/useResolvedReference.js +52 -0
- package/dist/cjs/hooks/useResolvedReference.js.map +7 -0
- package/dist/cjs/hooks/useSyntheticEventFromControlledState.js +53 -0
- package/dist/cjs/hooks/useSyntheticEventFromControlledState.js.map +7 -0
- package/dist/cjs/package.json +1 -4
- package/dist/cjs/parts/FloatingWrapper/react-desc-prop-types.js +1 -1
- package/dist/cjs/parts/FloatingWrapper/react-desc-prop-types.js.map +2 -2
- package/dist/cjs/parts/PopoverArrow.js.map +2 -2
- package/dist/cjs/react-desc-prop-types.js +23 -5
- package/dist/cjs/react-desc-prop-types.js.map +2 -2
- package/dist/cjs/typescript-testing/typescript-floating-context-valid.js +8 -2
- package/dist/cjs/typescript-testing/typescript-floating-context-valid.js.map +2 -2
- package/dist/cjs/useComputedPositionStyles.js +41 -18
- package/dist/cjs/useComputedPositionStyles.js.map +2 -2
- package/dist/cjs/utils/computePosition.js +26 -10
- package/dist/cjs/utils/computePosition.js.map +2 -2
- package/dist/cjs/utils/floatingPositioning.js +11 -0
- package/dist/cjs/utils/floatingPositioning.js.map +2 -2
- package/dist/esm/DSFloatingContext.js +130 -42
- package/dist/esm/DSFloatingContext.js.map +2 -2
- package/dist/esm/hooks/useFloatingClickOutside.js +30 -0
- package/dist/esm/hooks/useFloatingClickOutside.js.map +7 -0
- package/dist/esm/hooks/useFloatingResizeObserver.js +22 -0
- package/dist/esm/hooks/useFloatingResizeObserver.js.map +7 -0
- package/dist/esm/hooks/useLatestRef.js +11 -0
- package/dist/esm/hooks/useLatestRef.js.map +7 -0
- package/dist/esm/hooks/useReferenceHiddenByBoundary.js +29 -0
- package/dist/esm/hooks/useReferenceHiddenByBoundary.js.map +7 -0
- package/dist/esm/hooks/useResolvedReference.js +22 -0
- package/dist/esm/hooks/useResolvedReference.js.map +7 -0
- package/dist/esm/hooks/useSyntheticEventFromControlledState.js +23 -0
- package/dist/esm/hooks/useSyntheticEventFromControlledState.js.map +7 -0
- package/dist/esm/package.json +1 -4
- package/dist/esm/parts/FloatingWrapper/react-desc-prop-types.js +1 -1
- package/dist/esm/parts/FloatingWrapper/react-desc-prop-types.js.map +2 -2
- package/dist/esm/parts/PopoverArrow.js.map +2 -2
- package/dist/esm/react-desc-prop-types.js +23 -5
- package/dist/esm/react-desc-prop-types.js.map +2 -2
- package/dist/esm/typescript-testing/typescript-floating-context-valid.js +8 -2
- package/dist/esm/typescript-testing/typescript-floating-context-valid.js.map +2 -2
- package/dist/esm/useComputedPositionStyles.js +41 -18
- package/dist/esm/useComputedPositionStyles.js.map +2 -2
- package/dist/esm/utils/computePosition.js +27 -10
- package/dist/esm/utils/computePosition.js.map +2 -2
- package/dist/esm/utils/floatingPositioning.js +11 -0
- package/dist/esm/utils/floatingPositioning.js.map +2 -2
- package/dist/types/DSFloatingContext.d.ts +48 -8
- package/dist/types/hooks/useFloatingClickOutside.d.ts +20 -0
- package/dist/types/hooks/useFloatingResizeObserver.d.ts +11 -0
- package/dist/types/hooks/useLatestRef.d.ts +7 -0
- package/dist/types/hooks/useReferenceHiddenByBoundary.d.ts +17 -0
- package/dist/types/hooks/useResolvedReference.d.ts +19 -0
- package/dist/types/hooks/useSyntheticEventFromControlledState.d.ts +32 -0
- package/dist/types/react-desc-prop-types.d.ts +76 -2
- package/dist/types/useComputedPositionStyles.d.ts +7 -4
- package/dist/types/utils/computePosition.d.ts +25 -2
- package/dist/types/utils/floatingPositioning.d.ts +13 -1
- package/package.json +10 -10
- package/dist/types/tests/ControlledTestRenderer.d.ts +0 -1
- package/dist/types/tests/FloatingContext.a11y.test.d.ts +0 -1
- package/dist/types/tests/FloatingContext.data-testid.test.d.ts +0 -1
- package/dist/types/tests/FloatingContext.event.test.d.ts +0 -1
- package/dist/types/tests/FloatingContext.exports.test.d.ts +0 -1
- package/dist/types/tests/FloatingContext.get-owner-props.test.d.ts +0 -1
- package/dist/types/tests/FloatingContext.utils.test.d.ts +0 -1
- package/dist/types/tests/playwright/FloatingContext.test.playwright.d.ts +0 -1
- package/dist/types/typescript-testing/typescript-floating-context-valid.d.ts +0 -1
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var useSyntheticEventFromControlledState_exports = {};
|
|
30
|
+
__export(useSyntheticEventFromControlledState_exports, {
|
|
31
|
+
useSyntheticEventFromControlledState: () => useSyntheticEventFromControlledState
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(useSyntheticEventFromControlledState_exports);
|
|
34
|
+
var React = __toESM(require("react"));
|
|
35
|
+
var import_react = require("react");
|
|
36
|
+
var import_useLatestRef = require("./useLatestRef.js");
|
|
37
|
+
const useSyntheticEventFromControlledState = ({
|
|
38
|
+
controlledValue,
|
|
39
|
+
onEnter,
|
|
40
|
+
onExit
|
|
41
|
+
}) => {
|
|
42
|
+
const onEnterRef = (0, import_useLatestRef.useLatestRef)(onEnter);
|
|
43
|
+
const onExitRef = (0, import_useLatestRef.useLatestRef)(onExit);
|
|
44
|
+
const previousValueRef = (0, import_react.useRef)(controlledValue);
|
|
45
|
+
(0, import_react.useEffect)(() => {
|
|
46
|
+
const previousValue = previousValueRef.current;
|
|
47
|
+
previousValueRef.current = controlledValue;
|
|
48
|
+
if (previousValue === controlledValue) return;
|
|
49
|
+
if (controlledValue === true) onEnterRef.current?.();
|
|
50
|
+
else if (controlledValue === false) onExitRef.current?.();
|
|
51
|
+
}, [controlledValue, onEnterRef, onExitRef]);
|
|
52
|
+
};
|
|
53
|
+
//# sourceMappingURL=useSyntheticEventFromControlledState.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/hooks/useSyntheticEventFromControlledState.ts", "../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["import { useEffect, useRef } from 'react';\nimport { useLatestRef } from './useLatestRef.js';\n\ninterface UseSyntheticEventFromControlledStateParams {\n /**\n * The externally-controlled value whose transitions are turned into events. `undefined` means\n * the value is not being controlled (uncontrolled usage) \u2014 no events are synthesized in that case.\n */\n controlledValue: boolean | undefined;\n /** Fired when `controlledValue` transitions to `true`. Passed inline is fine (latest-ref'd). */\n onEnter?: () => void;\n /** Fired when `controlledValue` transitions to `false`. Passed inline is fine (latest-ref'd). */\n onExit?: () => void;\n}\n\n/**\n * Synthesizes semantic enter/exit events from transitions of an **externally-controlled** value.\n *\n * Why this is a hook (and an effect), not something a caller should hand-roll: when a value is\n * controlled by the consumer, its changes originate *outside* this component \u2014 there is no\n * interaction handler in here to hang a notification on. Reacting to that change and emitting an\n * event is the *sanctioned* `useEffect` use: **synchronizing with an external system**, where the\n * external system is the consumer that owns the controlled state. This is categorically different\n * from the `useEffect` misuse (deriving/coordinating internal state), and it is the reason the\n * emitted callback is a genuine \"for whatever reason the owner changed it\" event rather than a\n * per-interaction one.\n *\n * Guarantees:\n * - Never fires on mount \u2014 only on real transitions after the initial value.\n * - Never fires while uncontrolled (`undefined`); only on explicit `false \u2194 true` edges.\n * - The prev-value bookkeeping is a ref (not state) *on purpose*: it is read/written only inside\n * the effect (post-commit), never during render, so it carries none of the render-purity hazards\n * that would make a ref wrong for an in-render transition guard.\n */\nexport const useSyntheticEventFromControlledState = ({\n controlledValue,\n onEnter,\n onExit,\n}: UseSyntheticEventFromControlledStateParams) => {\n const onEnterRef = useLatestRef(onEnter);\n const onExitRef = useLatestRef(onExit);\n const previousValueRef = useRef(controlledValue);\n\n useEffect(() => {\n const previousValue = previousValueRef.current;\n previousValueRef.current = controlledValue;\n if (previousValue === controlledValue) return;\n if (controlledValue === true) onEnterRef.current?.();\n else if (controlledValue === false) onExitRef.current?.();\n }, [controlledValue, onEnterRef, onExitRef]);\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAAkC;AAClC,0BAA6B;AAiCtB,MAAM,uCAAuC,CAAC;AAAA,EACnD;AAAA,EACA;AAAA,EACA;AACF,MAAkD;AAChD,QAAM,iBAAa,kCAAa,OAAO;AACvC,QAAM,gBAAY,kCAAa,MAAM;AACrC,QAAM,uBAAmB,qBAAO,eAAe;AAE/C,8BAAU,MAAM;AACd,UAAM,gBAAgB,iBAAiB;AACvC,qBAAiB,UAAU;AAC3B,QAAI,kBAAkB,gBAAiB;AACvC,QAAI,oBAAoB,KAAM,YAAW,UAAU;AAAA,aAC1C,oBAAoB,MAAO,WAAU,UAAU;AAAA,EAC1D,GAAG,CAAC,iBAAiB,YAAY,SAAS,CAAC;AAC7C;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/dist/cjs/package.json
CHANGED
|
@@ -53,7 +53,7 @@ const DSFloatingWrapperPropTypes = {
|
|
|
53
53
|
isOpen: import_ds_props_helpers.PropTypes.bool.description("Whether the floating wrapper is open").isRequired,
|
|
54
54
|
floatingStyles: import_ds_props_helpers.PropTypes.object.description("Style for the floating wrapper").isRequired,
|
|
55
55
|
context: import_ds_props_helpers.PropTypes.shape({
|
|
56
|
-
portalDOMContainer: import_ds_props_helpers.PropTypes.
|
|
56
|
+
portalDOMContainer: import_ds_props_helpers.PropTypes.object.description("The DOM element where the tooltip will be rendered.").defaultValue('the first "main" landmark available in the document or the body if no "main" is found'),
|
|
57
57
|
withoutPortal: import_ds_props_helpers.PropTypes.bool.description("Whether to render the floating wrapper without a portal"),
|
|
58
58
|
animationDuration: import_ds_props_helpers.PropTypes.number.description("Duration of the animation"),
|
|
59
59
|
withoutAnimation: import_ds_props_helpers.PropTypes.bool.description("Whether to render the floating wrapper without animation")
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/parts/FloatingWrapper/react-desc-prop-types.ts", "../../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;
|
|
4
|
+
"sourcesContent": ["import type { GlobalAttributesT, XstyledProps, DSPropTypesSchema, ValidationMap } from '@elliemae/ds-props-helpers';\nimport {\n PropTypes,\n getPropsPerSlotPropTypes,\n globalAttributesPropTypes,\n xstyledPropTypes,\n} from '@elliemae/ds-props-helpers';\nimport { type TypescriptHelpersT } from '@elliemae/ds-typescript-helpers';\nimport { DSFloatingWrapperName, DSFloatingWrapperSlots } from '../../constants/index.js';\n\nexport declare namespace DSFloatingWrapperT {\n export interface RequiredProps {\n children: TypescriptHelpersT.ReactChildrenComplete;\n innerRef: TypescriptHelpersT.AnyRef<HTMLDivElement>;\n isOpen: boolean;\n floatingStyles: React.CSSProperties;\n }\n\n export interface DefaultProps {\n context: {\n portalDOMContainer?: HTMLElement;\n withoutPortal: boolean;\n animationDuration: number;\n withoutAnimation: boolean;\n };\n customOffset: [number, number];\n }\n\n export interface OptionalProps extends TypescriptHelpersT.PropsForGlobalOnSlots<\n typeof DSFloatingWrapperName,\n typeof DSFloatingWrapperSlots\n > {\n onAnimationEnd?: React.AnimationEventHandler<HTMLDivElement>;\n onAnimationStartTriggered?: () => void;\n }\n\n export interface Props\n extends\n Partial<DefaultProps>,\n RequiredProps,\n OptionalProps,\n Omit<\n GlobalAttributesT<HTMLElement>,\n keyof DefaultProps | keyof OptionalProps | keyof RequiredProps | keyof XstyledProps\n >,\n XstyledProps {}\n\n export interface InternalProps\n extends\n DefaultProps,\n RequiredProps,\n OptionalProps,\n Omit<\n GlobalAttributesT<HTMLElement>,\n keyof DefaultProps | keyof OptionalProps | keyof RequiredProps | keyof XstyledProps\n >,\n XstyledProps {}\n}\n\nexport const defaultProps: Partial<DSFloatingWrapperT.DefaultProps> = {\n context: {\n withoutPortal: false,\n animationDuration: 300,\n withoutAnimation: false,\n },\n customOffset: [0, 12],\n};\n\nexport const DSFloatingWrapperPropTypes: DSPropTypesSchema<DSFloatingWrapperT.InternalProps> = {\n ...getPropsPerSlotPropTypes(DSFloatingWrapperName, DSFloatingWrapperSlots),\n ...globalAttributesPropTypes,\n ...xstyledPropTypes,\n children: PropTypes.node.description('Content of the floating wrapper').isRequired,\n innerRef: PropTypes.oneOfType([PropTypes.object, PropTypes.func]).description('Ref for the floating wrapper')\n .isRequired,\n isOpen: PropTypes.bool.description('Whether the floating wrapper is open').isRequired,\n floatingStyles: PropTypes.object.description('Style for the floating wrapper').isRequired,\n context: PropTypes.shape({\n portalDOMContainer: PropTypes.object\n .description('The DOM element where the tooltip will be rendered.')\n .defaultValue('the first \"main\" landmark available in the document or the body if no \"main\" is found'),\n withoutPortal: PropTypes.bool.description('Whether to render the floating wrapper without a portal'),\n animationDuration: PropTypes.number.description('Duration of the animation'),\n withoutAnimation: PropTypes.bool.description('Whether to render the floating wrapper without animation'),\n }).description('Context for the floating wrapper'),\n onAnimationStartTriggered: PropTypes.func.description(\n 'Callback invoked when the component trigger the animation start. Required to properly position nested floating context without visual artefacts in case animations are used.',\n ),\n onAnimationEnd: PropTypes.func.description(\n 'Callback when the animation ends. Required to properly position nested floating context without visual artefacts in case animations are used.',\n ),\n customOffset: PropTypes.arrayOf(PropTypes.number).description('Custom offset for the floating wrapper'),\n};\n\nexport const DSFloatingWrapperPropTypesSchema =\n DSFloatingWrapperPropTypes as unknown as ValidationMap<DSFloatingWrapperT.Props>;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA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shim.js"],
|
|
4
|
-
"sourcesContent": ["import React from 'react';\nimport { useOwnerProps, useGetGlobalAttributes, useGetXstyledProps } from '@elliemae/ds-props-helpers';\nimport { styled } from '@elliemae/ds-system';\nimport type { TypescriptHelpersT } from '@elliemae/ds-typescript-helpers';\nimport { DSFloatingWrapperSlots, DSFloatingWrapperName } from '../constants/index.js';\nexport interface PopoverArrowT
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;
|
|
4
|
+
"sourcesContent": ["import React from 'react';\nimport { useOwnerProps, useGetGlobalAttributes, useGetXstyledProps } from '@elliemae/ds-props-helpers';\nimport { styled } from '@elliemae/ds-system';\nimport type { TypescriptHelpersT } from '@elliemae/ds-typescript-helpers';\nimport { DSFloatingWrapperSlots, DSFloatingWrapperName } from '../constants/index.js';\nexport interface PopoverArrowT extends TypescriptHelpersT.PropsForGlobalOnSlots<\n typeof DSFloatingWrapperName,\n typeof DSFloatingWrapperSlots\n> {\n placement: string;\n style: React.CSSProperties;\n arrowElementRef?: React.Dispatch<React.SetStateAction<HTMLDivElement | null>>;\n}\nconst arrowWidth = 18;\nconst OFFSET_FIX_SHADOW_DEFECT = 0.25;\n\nconst arrowDimensionBase13 = arrowWidth / 13;\nconst OFFSET_FIX_SHADOW_DEFECT_BASE13 = OFFSET_FIX_SHADOW_DEFECT / 13;\nconst arrowDimensionBase16 = arrowWidth / 16;\nconst OFFSET_FIX_SHADOW_DEFECT_BASE16 = OFFSET_FIX_SHADOW_DEFECT / 16;\n\nconst arrowPlacementBase13 = arrowDimensionBase13 - OFFSET_FIX_SHADOW_DEFECT_BASE13;\nconst arrowPlacementBase16 = arrowDimensionBase16 - OFFSET_FIX_SHADOW_DEFECT_BASE16;\n\nconst isTopOrBottom = (placement: string) => placement.startsWith('top') || placement.startsWith('bottom');\n\nconst isLeftOrRight = (placement: string) => placement.startsWith('left') || placement.startsWith('right');\n\nconst StyledArrow = styled('div', {\n name: DSFloatingWrapperName,\n slot: DSFloatingWrapperSlots.ARROW,\n})<{ 'data-placement': string }>`\n line-height: 0;\n position: absolute;\n width: ${arrowDimensionBase16}rem;\n height: ${arrowDimensionBase16}rem;\n pointer-events: none;\n background-color: transparent;\n & .stroke {\n fill: rgb(105, 116, 137);\n fill-opacity: 0.4;\n }\n & .fill {\n fill: rgb(255, 255, 255);\n }\n\n &[data-placement^='top'] {\n svg {\n transform: rotateZ(180deg);\n }\n bottom: -${arrowPlacementBase16}rem;\n left: ${(props) => {\n if (props['data-placement'].endsWith('start')) return `25%`;\n if (props['data-placement'].endsWith('end')) return `75%`;\n return '';\n }};\n }\n &[data-placement^='right'] {\n svg {\n transform: rotateZ(-90deg);\n }\n left: -${arrowPlacementBase16}rem;\n }\n &[data-placement^='bottom'] {\n top: -${arrowPlacementBase16}rem;\n left: ${(props) => {\n if (props['data-placement'].endsWith('start')) return `25%`;\n if (props['data-placement'].endsWith('end')) return `75%`;\n return '';\n }};\n }\n &[data-placement^='left'] {\n svg {\n transform: rotateZ(90deg);\n }\n right: -${arrowPlacementBase16}rem;\n }\n margin-left: ${(props) => (isTopOrBottom(props['data-placement']) ? `-${arrowDimensionBase16 / 2}rem` : '0')};\n margin-top: ${(props) => (isLeftOrRight(props['data-placement']) ? `-${arrowDimensionBase16 / 2}rem` : '0')};\n\n @media (min-width: ${({ theme }) => theme.breakpoints.small}) {\n width: ${arrowDimensionBase13}rem;\n height: ${arrowDimensionBase13}rem;\n\n &[data-placement^='top'] {\n bottom: -${arrowPlacementBase13}rem;\n }\n\n &[data-placement^='bottom'] {\n top: -${arrowPlacementBase13}rem;\n }\n\n &[data-placement^='left'] {\n right: -${arrowPlacementBase13}rem;\n }\n\n &[data-placement^='right'] {\n left: -${arrowPlacementBase13}rem;\n }\n\n margin-left: ${(props) => (isTopOrBottom(props['data-placement']) ? `-${arrowDimensionBase13 / 2}rem` : '0')};\n\n margin-top: ${(props) => (isLeftOrRight(props['data-placement']) ? `-${arrowDimensionBase13 / 2}rem` : '0')};\n }\n`;\n\nconst StylePathShadow = styled('path', {\n name: DSFloatingWrapperName,\n slot: DSFloatingWrapperSlots.ARROW_SHADOW,\n})``;\n\nconst StylePathFill = styled('path', {\n name: DSFloatingWrapperName,\n slot: DSFloatingWrapperSlots.ARROW_FILL,\n})``;\n\nexport const PopoverArrow = ({ placement, style, arrowElementRef, ...rest }: PopoverArrowT): React.ReactElement => {\n const ownerProps = useOwnerProps(rest);\n const globalAttributes = useGetGlobalAttributes(rest);\n const xstyledProps = useGetXstyledProps(rest);\n return (\n <StyledArrow\n key=\"popper-arrow\"\n data-placement={placement}\n style={style}\n innerRef={arrowElementRef}\n data-testid=\"ds-tooltip-arrow\"\n aria-hidden=\"true\"\n {...ownerProps}\n {...globalAttributes}\n {...xstyledProps}\n >\n <svg viewBox=\"0 0 30 30\">\n <StylePathShadow\n {...ownerProps}\n className=\"stroke\"\n d=\"M23.7,27.1L17,19.9C16.5,19.3,15.8,19,15,19s-1.6,0.3-2.1,0.9l-6.6,7.2C5.3,28.1,3.4,29,2,29h26\n C26.7,29,24.6,28.1,23.7,27.1z\"\n />\n <StylePathFill\n {...ownerProps}\n className=\"fill\"\n d=\"M23,27.8c1.1,1.2,3.4,2.2,5,2.2h2H0h2c1.7,0,3.9-1,5-2.2l6.6-7.2c0.7-0.8,2-0.8,2.7,0L23,27.8L23,27.8z\"\n />\n </svg>\n </StyledArrow>\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADoIjB;AAnIN,8BAA0E;AAC1E,uBAAuB;AAEvB,uBAA8D;AAS9D,MAAM,aAAa;AACnB,MAAM,2BAA2B;AAEjC,MAAM,uBAAuB,aAAa;AAC1C,MAAM,kCAAkC,2BAA2B;AACnE,MAAM,uBAAuB,aAAa;AAC1C,MAAM,kCAAkC,2BAA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
39
39
|
animationDuration: 300,
|
|
40
40
|
withoutPortal: false,
|
|
41
41
|
placement: "top",
|
|
42
|
-
customOffset: [0, 12]
|
|
42
|
+
customOffset: [0, 12],
|
|
43
|
+
closeOnEscape: false,
|
|
44
|
+
returnFocusToReference: false
|
|
43
45
|
};
|
|
44
46
|
const DSFloatingContextPropTypes = {
|
|
45
47
|
withoutPortal: import_ds_props_helpers.PropTypes.bool.description("If true, the tooltip will not be rendered inside a portal.").defaultValue(false),
|
|
46
48
|
withoutAnimation: import_ds_props_helpers.PropTypes.bool.description("If true, the tooltip will not have an animation.").defaultValue(false),
|
|
47
|
-
portalDOMContainer: import_ds_props_helpers.PropTypes.
|
|
49
|
+
portalDOMContainer: import_ds_props_helpers.PropTypes.object.description("The DOM element where the tooltip will be rendered.").defaultValue('the first "main" landmark available in the document or the body if no "main" is found'),
|
|
48
50
|
animationDuration: import_ds_props_helpers.PropTypes.number.description("The duration of the animation in milliseconds.").defaultValue(300),
|
|
49
51
|
placement: import_ds_props_helpers.PropTypes.oneOf([
|
|
50
52
|
"top-start",
|
|
@@ -75,10 +77,26 @@ const DSFloatingContextPropTypes = {
|
|
|
75
77
|
import_ds_props_helpers.PropTypes.tuple([import_ds_props_helpers.PropTypes.oneOf(["left"])]),
|
|
76
78
|
import_ds_props_helpers.PropTypes.tuple([import_ds_props_helpers.PropTypes.oneOf(["left-start"])])
|
|
77
79
|
]).description("The order of the placement preference."),
|
|
78
|
-
onOpen: import_ds_props_helpers.PropTypes.func.description(
|
|
79
|
-
|
|
80
|
+
onOpen: import_ds_props_helpers.PropTypes.func.description(
|
|
81
|
+
"Called on every open transition (interaction or controlled-flip); receives arguments with a `reason`."
|
|
82
|
+
),
|
|
83
|
+
onClose: import_ds_props_helpers.PropTypes.func.description(
|
|
84
|
+
"Called on every close transition (interaction or controlled-flip); receives arguments with a `reason`."
|
|
85
|
+
),
|
|
80
86
|
externallyControlledIsOpen: import_ds_props_helpers.PropTypes.bool.description(
|
|
81
87
|
"If true, the context open/close state will be controlled externally."
|
|
82
|
-
)
|
|
88
|
+
),
|
|
89
|
+
externalReferenceElement: import_ds_props_helpers.PropTypes.object.description(
|
|
90
|
+
"Pre-resolved reference element. When provided, used as the source of truth for positioning, avoiding the need for a follow-up refs.setReference() effect and the visibility:hidden race on open."
|
|
91
|
+
),
|
|
92
|
+
boundaryElement: import_ds_props_helpers.PropTypes.object.description(
|
|
93
|
+
"Opt-in extra boundary the floating element should stay visually contained within, in addition to the viewport, when portaled. Not the same as withoutPortal: that clips unconditionally via native CSS overflow (cutting off oversized content); this only changes the clipping math and is ignored per-axis when the floating content does not fit that axis of the boundary, so oversized content still escapes fully into the page. Also auto-hides/shows the floating element (visually only) as the reference scrolls in and out of this boundary."
|
|
94
|
+
),
|
|
95
|
+
onClickOutside: import_ds_props_helpers.PropTypes.func.description(
|
|
96
|
+
"Called on mousedown/touchstart outside both the floating element and the reference element while open."
|
|
97
|
+
),
|
|
98
|
+
closeOnEscape: import_ds_props_helpers.PropTypes.bool.description("If true, listens for Escape on the floating element and calls onEscape (or onClose).").defaultValue(false),
|
|
99
|
+
onEscape: import_ds_props_helpers.PropTypes.func.description("Called when Escape is pressed while focus is within the floating element."),
|
|
100
|
+
returnFocusToReference: import_ds_props_helpers.PropTypes.bool.description("If true, returns focus to the reference element after Escape-close.").defaultValue(false)
|
|
83
101
|
};
|
|
84
102
|
//# sourceMappingURL=react-desc-prop-types.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/react-desc-prop-types.ts", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADEvB,8BAA0B;
|
|
4
|
+
"sourcesContent": ["import type React from 'react';\nimport type { DSPropTypesSchema } from '@elliemae/ds-props-helpers';\nimport { PropTypes } from '@elliemae/ds-props-helpers';\nexport declare namespace DSHookFloatingContextT {\n export interface DefaultProps {\n withoutPortal: boolean;\n withoutAnimation: boolean;\n portalDOMContainer?: HTMLElement;\n animationDuration: number;\n placement: PopperPlacementsT;\n customOffset: [number, number];\n closeOnEscape: boolean;\n returnFocusToReference: boolean;\n }\n\n /**\n * Describes why onOpen/onClose fired.\n * - `interaction`: driven by this hook's own interaction handling (focus/hover/escape, via\n * ds-hooks-headless-tooltip). Fires synchronously in the event catch phase and carries the\n * originating DOM event when there is one (absent for imperative show/hide). Fires for\n * controlled contexts too \u2014 it is the pre-flip, event-carrying signal a controlled consumer can\n * choose to act on.\n * - `controlled-flip`: driven by the consumer flipping `externallyControlledIsOpen`. Fires from a\n * post-commit effect \u2014 the change originates outside this hook, so there is no event to carry.\n *\n * A controlled consumer may see BOTH for one logical transition (the pre-flip interaction, then\n * the post-flip controlled-flip when they echo it into the prop); discriminate on `reason` (and\n * `isControlled`) to pick which one your logic cares about. That choice is the consumer's \u2014 this\n * hook does not decide it for them.\n */\n export type OpenChange =\n | {\n reason: 'interaction';\n event?: React.FocusEvent | React.MouseEvent | React.KeyboardEvent | KeyboardEvent;\n isControlled: boolean;\n }\n | {\n reason: 'controlled-flip';\n isControlled: true;\n };\n\n export interface OptionalProps {\n placementOrderPreference?: PopperPlacementsT[];\n /**\n * Called on every open transition \u2014 both interaction-driven (pre-flip, with `event`) and\n * controlled-flip-driven (post-flip). Discriminate on the `OpenChange` argument's `reason`.\n */\n onOpen?: (info: OpenChange) => void;\n /**\n * Called on every close transition \u2014 both interaction-driven and controlled-flip-driven.\n * Discriminate on `reason`. Note a scoped Escape close routes to `onEscape` instead of `onClose`\n * (see `onEscape`).\n */\n onClose?: (info: OpenChange) => void;\n externallyControlledIsOpen?: boolean;\n /**\n * Pre-resolved reference element. When provided, the hook uses this as the\n * source of truth for positioning and ignores its internal reference state.\n * Eliminates the need for a follow-up `refs.setReference(...)` effect and\n * removes the visibility:hidden race that breaks programmatic focus on open.\n */\n externalReferenceElement?: Element | null;\n /**\n * Opt-in extra boundary \u2014 e.g. a scrollable ancestor of the reference \u2014 the floating\n * element should stay visually contained within, in addition to the viewport. Only\n * applied when portaled (withoutPortal: false, the default).\n *\n * Not the same as `withoutPortal: true`, and not a substitute for it: withoutPortal already\n * derives a clipping ancestor automatically, but does so by rendering the floating element\n * as a literal DOM descendant of it \u2014 so the browser's own CSS overflow clipping applies\n * unconditionally, cutting off any floating content taller/wider than that ancestor, with no\n * way for position math to prevent it. boundaryElement keeps the portal, so oversized\n * content (e.g. a full calendar popover inside a short container) still escapes fully into\n * the page, unclipped \u2014 it only changes the clipping *math* used for shift/flip, ignored\n * per-axis when the floating content doesn't fit that axis of the boundary, falling back to\n * the plain viewport for that axis instead of forcing an impossible position.\n *\n * Also hides the floating element (opacity/pointer-events only \u2014 isOpen state is untouched)\n * whenever the reference scrolls fully out of this boundary's visible area, and shows it\n * again automatically once the reference is back in view.\n */\n boundaryElement?: Element | null;\n /**\n * Called when the user clicks/taps outside both the floating element and\n * the reference element while the floating is open.\n */\n onClickOutside?: (event: MouseEvent | TouchEvent) => void;\n /**\n * Called when Escape is pressed while the floating element is open and focus is within the\n * floating element or the reference element. Only fires when `closeOnEscape` is true.\n * Receives the native KeyboardEvent \u2014 this is delivered via a document-level listener, not a\n * JSX handler, so there is no React SyntheticEvent to hand back.\n */\n onEscape?: (event: KeyboardEvent) => void;\n }\n export interface Props extends Partial<DefaultProps>, OptionalProps {}\n\n export interface InternalProps extends DefaultProps, OptionalProps {}\n\n export type PopperPlacementsT =\n | 'top-start'\n | 'top'\n | 'top-end'\n | 'right-start'\n | 'right'\n | 'right-end'\n | 'bottom-end'\n | 'bottom'\n | 'bottom-start'\n | 'left-end'\n | 'left'\n | 'left-start';\n}\n\nexport const defaultProps: DSHookFloatingContextT.DefaultProps = {\n withoutAnimation: false,\n animationDuration: 300,\n withoutPortal: false,\n placement: 'top',\n customOffset: [0, 12],\n closeOnEscape: false,\n returnFocusToReference: false,\n};\n\nexport const DSFloatingContextPropTypes: DSPropTypesSchema<DSHookFloatingContextT.Props> = {\n withoutPortal: PropTypes.bool\n .description('If true, the tooltip will not be rendered inside a portal.')\n .defaultValue(false),\n withoutAnimation: PropTypes.bool.description('If true, the tooltip will not have an animation.').defaultValue(false),\n portalDOMContainer: PropTypes.object\n .description('The DOM element where the tooltip will be rendered.')\n .defaultValue('the first \"main\" landmark available in the document or the body if no \"main\" is found'),\n animationDuration: PropTypes.number.description('The duration of the animation in milliseconds.').defaultValue(300),\n placement: PropTypes.oneOf([\n 'top-start',\n 'top',\n 'top-end',\n 'right-start',\n 'right',\n 'right-end',\n 'bottom-end',\n 'bottom',\n 'bottom-start',\n 'left-end',\n 'left',\n 'left-start',\n ])\n .description('The placement of the tooltip.')\n .defaultValue('top'),\n customOffset: PropTypes.arrayOf(PropTypes.number)\n .description('The custom offset of the tooltip.')\n .defaultValue([12, 12]),\n placementOrderPreference: PropTypes.oneOfType([\n PropTypes.tuple([PropTypes.oneOf(['top-start'])]),\n PropTypes.tuple([PropTypes.oneOf(['top'])]),\n PropTypes.tuple([PropTypes.oneOf(['top-end'])]),\n PropTypes.tuple([PropTypes.oneOf(['right-start'])]),\n PropTypes.tuple([PropTypes.oneOf(['right'])]),\n PropTypes.tuple([PropTypes.oneOf(['right-end'])]),\n PropTypes.tuple([PropTypes.oneOf(['bottom-end'])]),\n PropTypes.tuple([PropTypes.oneOf(['bottom'])]),\n PropTypes.tuple([PropTypes.oneOf(['bottom-start'])]),\n PropTypes.tuple([PropTypes.oneOf(['left-end'])]),\n PropTypes.tuple([PropTypes.oneOf(['left'])]),\n PropTypes.tuple([PropTypes.oneOf(['left-start'])]),\n ]).description('The order of the placement preference.'),\n onOpen: PropTypes.func.description(\n 'Called on every open transition (interaction or controlled-flip); receives arguments with a `reason`.',\n ),\n onClose: PropTypes.func.description(\n 'Called on every close transition (interaction or controlled-flip); receives arguments with a `reason`.',\n ),\n externallyControlledIsOpen: PropTypes.bool.description(\n 'If true, the context open/close state will be controlled externally.',\n ),\n externalReferenceElement: PropTypes.object.description(\n 'Pre-resolved reference element. When provided, used as the source of truth for positioning, ' +\n 'avoiding the need for a follow-up refs.setReference() effect and the visibility:hidden race on open.',\n ),\n boundaryElement: PropTypes.object.description(\n 'Opt-in extra boundary the floating element should stay visually contained within, in addition to the ' +\n 'viewport, when portaled. Not the same as withoutPortal: that clips unconditionally via native CSS ' +\n 'overflow (cutting off oversized content); this only changes the clipping math and is ignored per-axis ' +\n 'when the floating content does not fit that axis of the boundary, so oversized content still escapes ' +\n 'fully into the page. Also auto-hides/shows the floating element (visually only) as the reference ' +\n 'scrolls in and out of this boundary.',\n ),\n onClickOutside: PropTypes.func.description(\n 'Called on mousedown/touchstart outside both the floating element and the reference element while open.',\n ),\n closeOnEscape: PropTypes.bool\n .description('If true, listens for Escape on the floating element and calls onEscape (or onClose).')\n .defaultValue(false),\n onEscape: PropTypes.func.description('Called when Escape is pressed while focus is within the floating element.'),\n returnFocusToReference: PropTypes.bool\n .description('If true, returns focus to the reference element after Escape-close.')\n .defaultValue(false),\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADEvB,8BAA0B;AAgHnB,MAAM,eAAoD;AAAA,EAC/D,kBAAkB;AAAA,EAClB,mBAAmB;AAAA,EACnB,eAAe;AAAA,EACf,WAAW;AAAA,EACX,cAAc,CAAC,GAAG,EAAE;AAAA,EACpB,eAAe;AAAA,EACf,wBAAwB;AAC1B;AAEO,MAAM,6BAA8E;AAAA,EACzF,eAAe,kCAAU,KACtB,YAAY,4DAA4D,EACxE,aAAa,KAAK;AAAA,EACrB,kBAAkB,kCAAU,KAAK,YAAY,kDAAkD,EAAE,aAAa,KAAK;AAAA,EACnH,oBAAoB,kCAAU,OAC3B,YAAY,qDAAqD,EACjE,aAAa,uF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,MAAM,CAAC,CAAC,CAAC;AAAA,IAC3C,kCAAU,MAAM,CAAC,kCAAU,MAAM,CAAC,YAAY,CAAC,CAAC,CAAC;AAAA,EACnD,CAAC,EAAE,YAAY,wCAAwC;AAAA,EACvD,QAAQ,kCAAU,KAAK;AAAA,IACrB;AAAA,EACF;AAAA,EACA,SAAS,kCAAU,KAAK;AAAA,IACtB;AAAA,EACF;AAAA,EACA,4BAA4B,kCAAU,KAAK;AAAA,IACzC;AAAA,EACF;AAAA,EACA,0BAA0B,kCAAU,OAAO;AAAA,IACzC;AAAA,EAEF;AAAA,EACA,iBAAiB,kCAAU,OAAO;AAAA,IAChC;AAAA,EAMF;AAAA,EACA,gBAAgB,kCAAU,KAAK;AAAA,IAC7B;AAAA,EACF;AAAA,EACA,eAAe,kCAAU,KACtB,YAAY,sFAAsF,EAClG,aAAa,KAAK;AAAA,EACrB,UAAU,kCAAU,KAAK,YAAY,2EAA2E;AAAA,EAChH,wBAAwB,kCAAU,KAC/B,YAAY,qEAAqE,EACjF,aAAa,KAAK;AACvB;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -25,7 +25,9 @@ var React = __toESM(require("react"));
|
|
|
25
25
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
26
26
|
var import_react = __toESM(require("react"));
|
|
27
27
|
var import__ = require("../index.js");
|
|
28
|
-
const testOptionalProps = {
|
|
28
|
+
const testOptionalProps = {
|
|
29
|
+
boundaryElement: document.body
|
|
30
|
+
};
|
|
29
31
|
const testPartialDefaults = {
|
|
30
32
|
withoutAnimation: false,
|
|
31
33
|
withoutPortal: false,
|
|
@@ -37,7 +39,9 @@ const testCompleteDefaults = {
|
|
|
37
39
|
animationDuration: 300,
|
|
38
40
|
placement: "top",
|
|
39
41
|
customOffset: [10, 10],
|
|
40
|
-
portalDOMContainer: document.body
|
|
42
|
+
portalDOMContainer: document.body,
|
|
43
|
+
closeOnEscape: false,
|
|
44
|
+
returnFocusToReference: false
|
|
41
45
|
};
|
|
42
46
|
const testInternalProps = {
|
|
43
47
|
...testOptionalProps,
|
|
@@ -54,6 +58,8 @@ const testExplicitDefinition = {
|
|
|
54
58
|
placement: "top",
|
|
55
59
|
customOffset: [10, 10],
|
|
56
60
|
portalDOMContainer: document.body,
|
|
61
|
+
closeOnEscape: false,
|
|
62
|
+
returnFocusToReference: false,
|
|
57
63
|
...testOptionalProps
|
|
58
64
|
};
|
|
59
65
|
const testInferedTypeCompatibility = {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../src/typescript-testing/typescript-floating-context-valid.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable @typescript-eslint/no-unused-vars, no-unused-vars */\nimport React from 'react';\nimport { FloatingWrapper } from '../index.js';\nimport type { DSHookFloatingContextT } from '../index.js';\n\n// test we expose the namespace and the namespace follows our deliverable conventions\ntype ComponentPropsForApp = DSHookFloatingContextT.Props;\ntype ComponentPropsInternals = DSHookFloatingContextT.InternalProps;\ntype ComponentPropsDefaultProps = DSHookFloatingContextT.DefaultProps;\ntype ComponentPropsOptionalProps = DSHookFloatingContextT.OptionalProps;\n\nconst testOptionalProps: ComponentPropsOptionalProps = {};\n\n// difference Props and InternalProps is that InternalProps has all the default props filled in\n// Props allows for partial defaults\nconst testPartialDefaults: Partial<ComponentPropsDefaultProps> = {\n withoutAnimation: false,\n withoutPortal: false,\n animationDuration: 300,\n};\n\n// InternalProps requires all defaults to be filled in\nconst testCompleteDefaults: Required<ComponentPropsDefaultProps> = {\n withoutAnimation: false,\n withoutPortal: false,\n animationDuration: 300,\n placement: 'top',\n customOffset: [10, 10],\n portalDOMContainer: document.body,\n};\n\nconst testInternalProps: ComponentPropsInternals = {\n ...testOptionalProps,\n ...testCompleteDefaults,\n};\n\nconst testInternalPropsAsSyntax = {\n ...testOptionalProps,\n ...testCompleteDefaults,\n} as ComponentPropsInternals;\n\n// using the explicit type definition, if there is an error, it will be marked on the key that is wrong\nconst testExplicitDefinition: ComponentPropsForApp = {\n animationDuration: 300,\n withoutAnimation: false,\n withoutPortal: false,\n placement: 'top',\n customOffset: [10, 10],\n portalDOMContainer: document.body,\n ...testOptionalProps,\n};\n\n// using the \"as\" syntax, if there is an error, it will be marking the whole object as wrong because it is not compatible with the type\nconst testInferedTypeCompatibility = {\n ...testOptionalProps,\n ...testPartialDefaults,\n animationDuration: 300,\n} as ComponentPropsForApp;\n\nconst testDefinitionAsConst = {\n animationDuration: 300,\n withoutAnimation: false,\n withoutPortal: false,\n placement: 'top',\n portalDOMContainer: document.body,\n} as const;\n\nconst ExampleUsageComponent = () => (\n <>\n {/* works with explicitly casted props, all syntaxes */}\n <FloatingWrapper\n {...testExplicitDefinition}\n innerRef={React.createRef<HTMLDivElement>()}\n isOpen\n floatingStyles={{}}\n >\n <div>Content</div>\n </FloatingWrapper>\n <FloatingWrapper\n {...testInferedTypeCompatibility}\n innerRef={React.createRef<HTMLDivElement>()}\n isOpen\n floatingStyles={{}}\n >\n <div>Content</div>\n </FloatingWrapper>\n <FloatingWrapper {...testDefinitionAsConst} innerRef={React.createRef<HTMLDivElement>()} isOpen floatingStyles={{}}>\n <div>Content</div>\n </FloatingWrapper>\n {/* works with inline values */}\n </>\n);\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;AAAA,YAAuB;
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable @typescript-eslint/no-unused-vars, no-unused-vars */\nimport React from 'react';\nimport { FloatingWrapper } from '../index.js';\nimport type { DSHookFloatingContextT } from '../index.js';\n\n// test we expose the namespace and the namespace follows our deliverable conventions\ntype ComponentPropsForApp = DSHookFloatingContextT.Props;\ntype ComponentPropsInternals = DSHookFloatingContextT.InternalProps;\ntype ComponentPropsDefaultProps = DSHookFloatingContextT.DefaultProps;\ntype ComponentPropsOptionalProps = DSHookFloatingContextT.OptionalProps;\n\n// boundaryElement (PUI-17187): exercises the optional prop through the same buckets/spreads\n// below, so a broken or missing type on DSHookFloatingContextT.OptionalProps.boundaryElement\n// would fail compilation here.\nconst testOptionalProps: ComponentPropsOptionalProps = {\n boundaryElement: document.body,\n};\n\n// difference Props and InternalProps is that InternalProps has all the default props filled in\n// Props allows for partial defaults\nconst testPartialDefaults: Partial<ComponentPropsDefaultProps> = {\n withoutAnimation: false,\n withoutPortal: false,\n animationDuration: 300,\n};\n\n// InternalProps requires all defaults to be filled in\nconst testCompleteDefaults: Required<ComponentPropsDefaultProps> = {\n withoutAnimation: false,\n withoutPortal: false,\n animationDuration: 300,\n placement: 'top',\n customOffset: [10, 10],\n portalDOMContainer: document.body,\n closeOnEscape: false,\n returnFocusToReference: false,\n};\n\nconst testInternalProps: ComponentPropsInternals = {\n ...testOptionalProps,\n ...testCompleteDefaults,\n};\n\nconst testInternalPropsAsSyntax = {\n ...testOptionalProps,\n ...testCompleteDefaults,\n} as ComponentPropsInternals;\n\n// using the explicit type definition, if there is an error, it will be marked on the key that is wrong\nconst testExplicitDefinition: ComponentPropsForApp = {\n animationDuration: 300,\n withoutAnimation: false,\n withoutPortal: false,\n placement: 'top',\n customOffset: [10, 10],\n portalDOMContainer: document.body,\n closeOnEscape: false,\n returnFocusToReference: false,\n ...testOptionalProps,\n};\n\n// using the \"as\" syntax, if there is an error, it will be marking the whole object as wrong because it is not compatible with the type\nconst testInferedTypeCompatibility = {\n ...testOptionalProps,\n ...testPartialDefaults,\n animationDuration: 300,\n} as ComponentPropsForApp;\n\nconst testDefinitionAsConst = {\n animationDuration: 300,\n withoutAnimation: false,\n withoutPortal: false,\n placement: 'top',\n portalDOMContainer: document.body,\n} as const;\n\nconst ExampleUsageComponent = () => (\n <>\n {/* works with explicitly casted props, all syntaxes */}\n <FloatingWrapper\n {...testExplicitDefinition}\n innerRef={React.createRef<HTMLDivElement>()}\n isOpen\n floatingStyles={{}}\n >\n <div>Content</div>\n </FloatingWrapper>\n <FloatingWrapper\n {...testInferedTypeCompatibility}\n innerRef={React.createRef<HTMLDivElement>()}\n isOpen\n floatingStyles={{}}\n >\n <div>Content</div>\n </FloatingWrapper>\n <FloatingWrapper {...testDefinitionAsConst} innerRef={React.createRef<HTMLDivElement>()} isOpen floatingStyles={{}}>\n <div>Content</div>\n </FloatingWrapper>\n {/* works with inline values */}\n </>\n);\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;AAAA,YAAuB;AC6ErB;AA5EF,mBAAkB;AAClB,eAAgC;AAYhC,MAAM,oBAAiD;AAAA,EACrD,iBAAiB,SAAS;AAC5B;AAIA,MAAM,sBAA2D;AAAA,EAC/D,kBAAkB;AAAA,EAClB,eAAe;AAAA,EACf,mBAAmB;AACrB;AAGA,MAAM,uBAA6D;AAAA,EACjE,kBAAkB;AAAA,EAClB,eAAe;AAAA,EACf,mBAAmB;AAAA,EACnB,WAAW;AAAA,EACX,cAAc,CAAC,IAAI,EAAE;AAAA,EACrB,oBAAoB,SAAS;AAAA,EAC7B,eAAe;AAAA,EACf,wBAAwB;AAC1B;AAEA,MAAM,oBAA6C;AAAA,EACjD,GAAG;AAAA,EACH,GAAG;AACL;AAEA,MAAM,4BAA4B;AAAA,EAChC,GAAG;AAAA,EACH,GAAG;AACL;AAGA,MAAM,yBAA+C;AAAA,EACnD,mBAAmB;AAAA,EACnB,kBAAkB;AAAA,EAClB,eAAe;AAAA,EACf,WAAW;AAAA,EACX,cAAc,CAAC,IAAI,EAAE;AAAA,EACrB,oBAAoB,SAAS;AAAA,EAC7B,eAAe;AAAA,EACf,wBAAwB;AAAA,EACxB,GAAG;AACL;AAGA,MAAM,+BAA+B;AAAA,EACnC,GAAG;AAAA,EACH,GAAG;AAAA,EACH,mBAAmB;AACrB;AAEA,MAAM,wBAAwB;AAAA,EAC5B,mBAAmB;AAAA,EACnB,kBAAkB;AAAA,EAClB,eAAe;AAAA,EACf,WAAW;AAAA,EACX,oBAAoB,SAAS;AAC/B;AAEA,MAAM,wBAAwB,MAC5B,4EAEE;AAAA;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACJ,UAAU,aAAAA,QAAM,UAA0B;AAAA,MAC1C,QAAM;AAAA,MACN,gBAAgB,CAAC;AAAA,MAEjB,sDAAC,SAAI,qBAAO;AAAA;AAAA,EACd;AAAA,EACA;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACJ,UAAU,aAAAA,QAAM,UAA0B;AAAA,MAC1C,QAAM;AAAA,MACN,gBAAgB,CAAC;AAAA,MAEjB,sDAAC,SAAI,qBAAO;AAAA;AAAA,EACd;AAAA,EACA,4CAAC,4BAAiB,GAAG,uBAAuB,UAAU,aAAAA,QAAM,UAA0B,GAAG,QAAM,MAAC,gBAAgB,CAAC,GAC/G,sDAAC,SAAI,qBAAO,GACd;AAAA,GAEF;",
|
|
6
6
|
"names": ["React"]
|
|
7
7
|
}
|
|
@@ -37,43 +37,54 @@ var import_lodash_es = require("lodash-es");
|
|
|
37
37
|
var import_computePosition = require("./utils/computePosition.js");
|
|
38
38
|
const useComputedPositionStyles = (config) => {
|
|
39
39
|
const {
|
|
40
|
-
|
|
41
|
-
|
|
40
|
+
triggerElementReference,
|
|
41
|
+
floatingWrapperNode,
|
|
42
42
|
placement,
|
|
43
43
|
placementOrderPreference,
|
|
44
44
|
customOffset,
|
|
45
45
|
withoutPortal,
|
|
46
|
-
|
|
46
|
+
boundaryElement,
|
|
47
|
+
isClose = false,
|
|
47
48
|
debounceMs = 150
|
|
48
49
|
} = config;
|
|
49
50
|
const [arrowStyles, setArrowStyles] = (0, import_react.useState)({ style: { left: 0 }, placement: "top" });
|
|
50
51
|
const [floatingStyles, setFloatingStyles] = (0, import_react.useState)({
|
|
51
52
|
position: "absolute",
|
|
52
53
|
zIndex: 3e3,
|
|
53
|
-
|
|
54
|
+
opacity: 0,
|
|
55
|
+
pointerEvents: "none",
|
|
54
56
|
willChange: "transform"
|
|
55
57
|
});
|
|
56
58
|
const [hasComputedOnce, setHasComputedOnce] = (0, import_react.useState)(false);
|
|
57
|
-
const canCompute =
|
|
59
|
+
const canCompute = triggerElementReference !== null && floatingWrapperNode !== null && !isClose;
|
|
58
60
|
const updateStyles = (0, import_react.useCallback)(() => {
|
|
59
61
|
if (!canCompute) return;
|
|
60
62
|
const { coordsStyle, finalPlacement, coordsArrow } = (0, import_computePosition.computePosition)({
|
|
61
|
-
|
|
62
|
-
|
|
63
|
+
triggerElementReference,
|
|
64
|
+
floatingWrapperNode,
|
|
63
65
|
placement,
|
|
64
66
|
placementOrderPreference,
|
|
65
67
|
customOffset,
|
|
66
|
-
withoutPortal
|
|
68
|
+
withoutPortal,
|
|
69
|
+
boundaryElement
|
|
70
|
+
});
|
|
71
|
+
const { transform, top, left } = coordsStyle;
|
|
72
|
+
setFloatingStyles((prev) => {
|
|
73
|
+
if (prev.transform === transform) return prev;
|
|
74
|
+
return { position: "absolute", zIndex: 3e3, ...prev, transform, top, left };
|
|
67
75
|
});
|
|
68
|
-
setFloatingStyles((prev) => ({
|
|
69
|
-
position: "absolute",
|
|
70
|
-
zIndex: 3e3,
|
|
71
|
-
...prev,
|
|
72
|
-
...coordsStyle
|
|
73
|
-
}));
|
|
74
76
|
setArrowStyles({ style: coordsArrow, placement: finalPlacement });
|
|
75
77
|
setHasComputedOnce(true);
|
|
76
|
-
}, [
|
|
78
|
+
}, [
|
|
79
|
+
canCompute,
|
|
80
|
+
triggerElementReference,
|
|
81
|
+
floatingWrapperNode,
|
|
82
|
+
placement,
|
|
83
|
+
placementOrderPreference,
|
|
84
|
+
customOffset,
|
|
85
|
+
withoutPortal,
|
|
86
|
+
boundaryElement
|
|
87
|
+
]);
|
|
77
88
|
const mutableUpdateStyles = (0, import_react.useRef)(updateStyles);
|
|
78
89
|
mutableUpdateStyles.current = updateStyles;
|
|
79
90
|
const debouncedUpdateStyles = (0, import_react.useMemo)(() => {
|
|
@@ -82,6 +93,8 @@ const useComputedPositionStyles = (config) => {
|
|
|
82
93
|
}, debounceMs);
|
|
83
94
|
return d;
|
|
84
95
|
}, [debounceMs]);
|
|
96
|
+
const mutableDebouncedStyles = (0, import_react.useRef)(debouncedUpdateStyles);
|
|
97
|
+
mutableDebouncedStyles.current = debouncedUpdateStyles;
|
|
85
98
|
(0, import_react.useLayoutEffect)(
|
|
86
99
|
() => () => {
|
|
87
100
|
debouncedUpdateStyles.cancel();
|
|
@@ -92,14 +105,24 @@ const useComputedPositionStyles = (config) => {
|
|
|
92
105
|
if (canCompute) {
|
|
93
106
|
mutableUpdateStyles.current();
|
|
94
107
|
}
|
|
95
|
-
}, [
|
|
108
|
+
}, [
|
|
109
|
+
canCompute,
|
|
110
|
+
triggerElementReference,
|
|
111
|
+
floatingWrapperNode,
|
|
112
|
+
placement,
|
|
113
|
+
placementOrderPreference,
|
|
114
|
+
customOffset,
|
|
115
|
+
withoutPortal,
|
|
116
|
+
boundaryElement
|
|
117
|
+
]);
|
|
96
118
|
const forceUpdatePosition = (0, import_react.useCallback)(() => {
|
|
97
119
|
mutableUpdateStyles.current();
|
|
98
120
|
}, []);
|
|
99
121
|
const resetVisibilityOnly = (0, import_react.useCallback)(() => {
|
|
100
122
|
setFloatingStyles((prev) => ({
|
|
101
123
|
...prev,
|
|
102
|
-
|
|
124
|
+
opacity: 0,
|
|
125
|
+
pointerEvents: "none"
|
|
103
126
|
}));
|
|
104
127
|
}, []);
|
|
105
128
|
return (0, import_react.useMemo)(
|
|
@@ -109,7 +132,7 @@ const useComputedPositionStyles = (config) => {
|
|
|
109
132
|
hasComputedOnce,
|
|
110
133
|
updateStyles: forceUpdatePosition,
|
|
111
134
|
debouncedUpdateStyles,
|
|
112
|
-
mutableUpdateStyles,
|
|
135
|
+
mutableUpdateStyles: mutableDebouncedStyles,
|
|
113
136
|
resetVisibilityOnly
|
|
114
137
|
}),
|
|
115
138
|
[arrowStyles, floatingStyles, hasComputedOnce, forceUpdatePosition, debouncedUpdateStyles, resetVisibilityOnly]
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/useComputedPositionStyles.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["/* eslint-disable max-statements */\nimport { useLayoutEffect, useMemo, useRef, useState, useCallback } from 'react';\nimport { debounce } from 'lodash-es';\nimport { type CSSProperties } from 'styled-components';\nimport { computePosition } from './utils/computePosition.js';\nimport type { DSHookFloatingContextT } from './react-desc-prop-types.js';\nimport type { PopoverArrowT } from './parts/PopoverArrow.js';\n\ntype UseComputedPositionStylesT = {\n /** Prevent computing when closed (optimization + avoids unnecessary frames) */\n
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADCvB,mBAAwE;AACxE,uBAAyB;AAEzB,6BAAgC;
|
|
4
|
+
"sourcesContent": ["/* eslint-disable max-statements */\nimport { useLayoutEffect, useMemo, useRef, useState, useCallback } from 'react';\nimport { debounce } from 'lodash-es';\nimport { type CSSProperties } from 'styled-components';\nimport { computePosition } from './utils/computePosition.js';\nimport type { DSHookFloatingContextT } from './react-desc-prop-types.js';\nimport type { PopoverArrowT } from './parts/PopoverArrow.js';\n\ntype UseComputedPositionStylesT = {\n /** Prevent computing when closed (optimization + avoids unnecessary frames) */\n isClose?: boolean;\n triggerElementReference: Element | null;\n floatingWrapperNode: HTMLElement | null;\n placement: DSHookFloatingContextT.PopperPlacementsT;\n placementOrderPreference?: DSHookFloatingContextT.PopperPlacementsT[];\n customOffset: [number, number];\n withoutPortal: boolean;\n /** Opt-in extra boundary the floating element should stay visually contained within, in\n * addition to the viewport, when portaled. See computePosition's boundaryElement doc. */\n boundaryElement?: Element | null;\n /** Debounce ms for scroll/resize/observer events */\n debounceMs?: number;\n};\n\nexport const useComputedPositionStyles = (config: UseComputedPositionStylesT) => {\n const {\n triggerElementReference,\n floatingWrapperNode,\n placement,\n placementOrderPreference,\n customOffset,\n withoutPortal,\n boundaryElement,\n isClose = false,\n debounceMs = 150,\n } = config;\n\n const [arrowStyles, setArrowStyles] = useState<PopoverArrowT>({ style: { left: 0 }, placement: 'top' });\n\n // Initial state: invisible (opacity:0) but FOCUSABLE.\n // We intentionally use opacity instead of visibility:hidden \u2014 `visibility:hidden` blocks\n // programmatic focus on descendants (including React's `autoFocus` attribute on inputs),\n // which causes a race on first-open: the floating content's autoFocus fires before the\n // position-computation useLayoutEffect can flip visibility to `visible`, so the focus\n // silently no-ops. Opacity:0 keeps the element invisible while letting `.focus()` work.\n // pointer-events:none prevents accidental clicks on the still-unpositioned (0,0) area.\n const [floatingStyles, setFloatingStyles] = useState<CSSProperties>({\n position: 'absolute',\n zIndex: 3000,\n opacity: 0,\n pointerEvents: 'none',\n willChange: 'transform',\n });\n\n const [hasComputedOnce, setHasComputedOnce] = useState(false);\n\n const canCompute = triggerElementReference !== null && floatingWrapperNode !== null && !isClose;\n\n const updateStyles = useCallback(() => {\n if (!canCompute) return;\n\n const { coordsStyle, finalPlacement, coordsArrow } = computePosition({\n triggerElementReference,\n floatingWrapperNode,\n placement,\n placementOrderPreference,\n customOffset,\n withoutPortal,\n boundaryElement,\n });\n // INTENTIONAL explicit destructure \u2014 do NOT replace with `...coordsStyle`.\n //\n // PUI-18470 is a ghost bug: an infinite ResizeObserver \u2192 setState \u2192 re-render loop\n // that only triggers at specific viewport pixel combinations (\"magic pixel\") and is\n // nearly impossible to reproduce consistently across machines. It took a synthetic\n // Playwright ResizeObserver-intercept test to surface it at all.\n //\n // Part of the fix is the bail-out below (`prev.transform === transform`): if the\n // computed position hasn't changed we return the same state reference, preventing a\n // re-render and breaking the loop. That bail-out only works if we know exactly which\n // properties coordsStyle contributes. Spreading `...coordsStyle` hides that contract:\n // if computePosition ever extends coordsStyle with a new property, the bail-out\n // silently becomes incomplete and the loop can re-emerge with no obvious cause.\n //\n // Keeping the destructure explicit forces any future change to computePosition's\n // coordsStyle contract to be a conscious, visible decision here \u2014 not a silent pass-through.\n const { transform, top, left } = coordsStyle;\n\n // Do not touch visibility here; it is managed outside depending on open/hasComputedOnce\n setFloatingStyles((prev) => {\n if (prev.transform === transform) return prev;\n return { position: 'absolute', zIndex: 3000, ...prev, transform, top, left };\n });\n setArrowStyles({ style: coordsArrow, placement: finalPlacement });\n setHasComputedOnce(true);\n }, [\n canCompute,\n triggerElementReference,\n floatingWrapperNode,\n placement,\n placementOrderPreference,\n customOffset,\n withoutPortal,\n boundaryElement,\n ]);\n\n // Store latest update function in a ref to keep debounced stable\n const mutableUpdateStyles = useRef(updateStyles);\n mutableUpdateStyles.current = updateStyles;\n\n const debouncedUpdateStyles = useMemo(() => {\n const d = debounce(() => {\n mutableUpdateStyles.current();\n }, debounceMs);\n return d;\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [debounceMs]);\n\n const mutableDebouncedStyles = useRef(debouncedUpdateStyles);\n mutableDebouncedStyles.current = debouncedUpdateStyles;\n\n // Clean up debounce on unmount\n useLayoutEffect(\n () => () => {\n debouncedUpdateStyles.cancel();\n },\n [debouncedUpdateStyles],\n );\n\n // Recalculate BEFORE paint when dependencies change\n useLayoutEffect(() => {\n if (canCompute) {\n mutableUpdateStyles.current();\n }\n }, [\n canCompute,\n triggerElementReference,\n floatingWrapperNode,\n placement,\n placementOrderPreference,\n customOffset,\n withoutPortal,\n boundaryElement,\n ]);\n\n const forceUpdatePosition = useCallback(() => {\n mutableUpdateStyles.current();\n }, []);\n\n // Do not reset coordinates when closing; just hide via opacity (keeps element focusable\n // if anything inside needs to remain focusable during animations).\n const resetVisibilityOnly = useCallback(() => {\n setFloatingStyles((prev) => ({\n ...prev,\n opacity: 0,\n pointerEvents: 'none',\n }));\n }, []);\n\n return useMemo(\n () => ({\n arrowStyles,\n floatingStyles,\n hasComputedOnce,\n updateStyles: forceUpdatePosition,\n debouncedUpdateStyles,\n mutableUpdateStyles: mutableDebouncedStyles,\n resetVisibilityOnly,\n }),\n [arrowStyles, floatingStyles, hasComputedOnce, forceUpdatePosition, debouncedUpdateStyles, resetVisibilityOnly],\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADCvB,mBAAwE;AACxE,uBAAyB;AAEzB,6BAAgC;AAoBzB,MAAM,4BAA4B,CAAC,WAAuC;AAC/E,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,UAAU;AAAA,IACV,aAAa;AAAA,EACf,IAAI;AAEJ,QAAM,CAAC,aAAa,cAAc,QAAI,uBAAwB,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,WAAW,MAAM,CAAC;AAStG,QAAM,CAAC,gBAAgB,iBAAiB,QAAI,uBAAwB;AAAA,IAClE,UAAU;AAAA,IACV,QAAQ;AAAA,IACR,SAAS;AAAA,IACT,eAAe;AAAA,IACf,YAAY;AAAA,EACd,CAAC;AAED,QAAM,CAAC,iBAAiB,kBAAkB,QAAI,uBAAS,KAAK;AAE5D,QAAM,aAAa,4BAA4B,QAAQ,wBAAwB,QAAQ,CAAC;AAExF,QAAM,mBAAe,0BAAY,MAAM;AACrC,QAAI,CAAC,WAAY;AAEjB,UAAM,EAAE,aAAa,gBAAgB,YAAY,QAAI,wCAAgB;AAAA,MACnE;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF,CAAC;AAiBD,UAAM,EAAE,WAAW,KAAK,KAAK,IAAI;AAGjC,sBAAkB,CAAC,SAAS;AAC1B,UAAI,KAAK,cAAc,UAAW,QAAO;AACzC,aAAO,EAAE,UAAU,YAAY,QAAQ,KAAM,GAAG,MAAM,WAAW,KAAK,KAAK;AAAA,IAC7E,CAAC;AACD,mBAAe,EAAE,OAAO,aAAa,WAAW,eA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,32 @@ var import_getArrowOffset = require("./getArrowOffset.js");
|
|
|
37
37
|
var import_detectOverflow = require("./detectOverflow.js");
|
|
38
38
|
var import_floatingPositioning = require("./floatingPositioning.js");
|
|
39
39
|
const computePosition = (props) => {
|
|
40
|
-
const {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
40
|
+
const {
|
|
41
|
+
triggerElementReference,
|
|
42
|
+
floatingWrapperNode,
|
|
43
|
+
placement,
|
|
44
|
+
placementOrderPreference,
|
|
45
|
+
customOffset,
|
|
46
|
+
withoutPortal,
|
|
47
|
+
boundaryElement
|
|
48
|
+
} = props;
|
|
49
|
+
const parentOffsets = withoutPortal ? (0, import_floatingPositioning.adjustForFixedParent)(triggerElementReference) : { top: 0, left: 0 };
|
|
50
|
+
const referenceRect = triggerElementReference.getBoundingClientRect();
|
|
51
|
+
const floatingRect = floatingWrapperNode.getBoundingClientRect();
|
|
44
52
|
const fallbackPlacements = placementOrderPreference || (0, import_getExpandedFallbackPlacements.getExpandedFallbackPlacements)(placement);
|
|
45
53
|
const placements = (0, import_floatingPositioning.expandWithVariations)(
|
|
46
54
|
[placement].concat(fallbackPlacements)
|
|
47
55
|
);
|
|
48
|
-
const clippingParent = withoutPortal ? (0, import_floatingPositioning.getClippingParent)(
|
|
49
|
-
const
|
|
56
|
+
const clippingParent = withoutPortal ? (0, import_floatingPositioning.getClippingParent)(triggerElementReference) : null;
|
|
57
|
+
const viewportRect = (0, import_floatingPositioning.getViewportRect)();
|
|
58
|
+
let clippingRect;
|
|
59
|
+
if (clippingParent) {
|
|
60
|
+
clippingRect = clippingParent.getBoundingClientRect();
|
|
61
|
+
} else if (boundaryElement) {
|
|
62
|
+
clippingRect = (0, import_floatingPositioning.getBoundaryConstrainedRect)(viewportRect, boundaryElement.getBoundingClientRect(), floatingRect);
|
|
63
|
+
} else {
|
|
64
|
+
clippingRect = viewportRect;
|
|
65
|
+
}
|
|
50
66
|
let bestPlacement = placement;
|
|
51
67
|
let bestOverflows = null;
|
|
52
68
|
let bestScore = { total: Number.POSITIVE_INFINITY, maxSide: Number.POSITIVE_INFINITY };
|
|
@@ -71,10 +87,10 @@ const computePosition = (props) => {
|
|
|
71
87
|
let x = -overflows.left - parentOffsets.left;
|
|
72
88
|
let y = -overflows.top - parentOffsets.top;
|
|
73
89
|
if (!withoutPortal) {
|
|
74
|
-
x += window.scrollX;
|
|
75
|
-
y += window.scrollY;
|
|
90
|
+
x += window.scrollX + clippingRect.left;
|
|
91
|
+
y += window.scrollY + clippingRect.top;
|
|
76
92
|
} else {
|
|
77
|
-
const op = (0, import_floatingPositioning.getOffsetParentData)(
|
|
93
|
+
const op = (0, import_floatingPositioning.getOffsetParentData)(floatingWrapperNode);
|
|
78
94
|
x = x + clippingRect.left - op.left + op.scrollLeft;
|
|
79
95
|
y = y + clippingRect.top - op.top + op.scrollTop;
|
|
80
96
|
}
|
|
@@ -87,7 +103,7 @@ const computePosition = (props) => {
|
|
|
87
103
|
y,
|
|
88
104
|
withoutPortal,
|
|
89
105
|
parentOffsets,
|
|
90
|
-
floatingEl:
|
|
106
|
+
floatingEl: floatingWrapperNode,
|
|
91
107
|
arrowPadding: 12
|
|
92
108
|
});
|
|
93
109
|
return {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/utils/computePosition.ts", "../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["/* eslint-disable max-lines */\n/* eslint-disable no-nested-ternary */\n/* eslint-disable complexity */\n/* eslint-disable max-statements */\n/* eslint-disable @typescript-eslint/no-use-before-define */\n/* eslint-disable max-params */\n/* eslint-disable @typescript-eslint/no-unsafe-assignment */\n/* eslint-disable arrow-body-style */\nimport type { DSHookFloatingContextT } from '../react-desc-prop-types.js';\nimport { getExpandedFallbackPlacements } from './getExpandedFallbackPlacements.js';\nimport { getArrowOffsetDynamic } from './getArrowOffset.js';\nimport { detectOverflow } from './detectOverflow.js';\nimport {\n applyShift,\n adjustForFixedParent,\n expandWithVariations,\n fits,\n getClippingParent,\n getOverflowScore,\n getOffsetParentData,\n getViewportRect,\n type RectLike,\n type OverflowOffsets,\n} from './floatingPositioning.js';\n\ninterface ComputePositionProps {\n
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADSvB,2CAA8C;AAC9C,4BAAsC;AACtC,4BAA+B;AAC/B,
|
|
4
|
+
"sourcesContent": ["/* eslint-disable max-lines */\n/* eslint-disable no-nested-ternary */\n/* eslint-disable complexity */\n/* eslint-disable max-statements */\n/* eslint-disable @typescript-eslint/no-use-before-define */\n/* eslint-disable max-params */\n/* eslint-disable @typescript-eslint/no-unsafe-assignment */\n/* eslint-disable arrow-body-style */\nimport type { DSHookFloatingContextT } from '../react-desc-prop-types.js';\nimport { getExpandedFallbackPlacements } from './getExpandedFallbackPlacements.js';\nimport { getArrowOffsetDynamic } from './getArrowOffset.js';\nimport { detectOverflow } from './detectOverflow.js';\nimport {\n applyShift,\n adjustForFixedParent,\n expandWithVariations,\n fits,\n getBoundaryConstrainedRect,\n getClippingParent,\n getOverflowScore,\n getOffsetParentData,\n getViewportRect,\n type RectLike,\n type OverflowOffsets,\n} from './floatingPositioning.js';\n\ninterface ComputePositionProps {\n triggerElementReference: Element;\n floatingWrapperNode: HTMLElement;\n placement: DSHookFloatingContextT.PopperPlacementsT;\n placementOrderPreference?: DSHookFloatingContextT.PopperPlacementsT[];\n customOffset: [number, number];\n withoutPortal: boolean;\n /**\n * Opt-in extra boundary (e.g. a scrollable ancestor of the reference) the floating element\n * should stay visually contained within, in addition to the viewport. Only applied when\n * portaled \u2014 the non-portal path already derives its own clipping ancestor automatically via\n * getClippingParent, by walking up from the reference.\n *\n * Why this exists instead of just setting `withoutPortal: true` to get that same automatic\n * clipping-ancestor derivation: withoutPortal renders the floating element as a literal DOM\n * descendant of the clipping ancestor, so the browser's own CSS overflow clipping applies\n * unconditionally \u2014 any floating content taller/wider than that ancestor gets visually cut\n * off, with no way for position math to prevent it. That is fine for content that always fits\n * (e.g. a small filter's low/high inputs), but breaks content that can legitimately be larger\n * than its reference's scroll container (e.g. a date-range calendar popover inside a short\n * table row) \u2014 see PUI-17187 in ds-data-table's FilterPopover for the exact regression this\n * caused when withoutPortal was tried first.\n *\n * boundaryElement keeps the portal (so oversized content still escapes fully into the page,\n * unclipped, exactly like the no-boundaryElement case) and only changes the clipping *rect*\n * used for shift/flip math \u2014 ignored per-axis when the floating content doesn't fit that axis\n * of the boundary (see getBoundaryConstrainedRect), falling back to the plain viewport for\n * that axis so oversized content is never forced into an impossible position.\n */\n boundaryElement?: Element | null;\n}\n\nexport const computePosition = (props: ComputePositionProps) => {\n const {\n triggerElementReference,\n floatingWrapperNode,\n placement,\n placementOrderPreference,\n customOffset,\n withoutPortal,\n boundaryElement,\n } = props;\n\n // When WITHOUT portal: only apply fixed-parent offsets (absolute parents scroll and must NOT be treated as fixed)\n const parentOffsets = withoutPortal ? adjustForFixedParent(triggerElementReference) : { top: 0, left: 0 };\n\n const referenceRect = triggerElementReference.getBoundingClientRect();\n const floatingRect = floatingWrapperNode.getBoundingClientRect();\n\n const fallbackPlacements = placementOrderPreference || getExpandedFallbackPlacements(placement);\n\n const placements = expandWithVariations(\n [placement].concat(fallbackPlacements as DSHookFloatingContextT.PopperPlacementsT[]),\n );\n\n // Boundary selection:\n // - No portal => nearest clipping/scroll container (fallback viewport rect)\n // - Portal + boundaryElement => viewport intersected with that element, per-axis (see\n // getBoundaryConstrainedRect)\n // - Portal, no boundaryElement => viewport (inset by body padding for Storybook)\n const clippingParent = withoutPortal ? getClippingParent(triggerElementReference) : null;\n const viewportRect = getViewportRect();\n let clippingRect: RectLike;\n if (clippingParent) {\n clippingRect = clippingParent.getBoundingClientRect();\n } else if (boundaryElement) {\n clippingRect = getBoundaryConstrainedRect(viewportRect, boundaryElement.getBoundingClientRect(), floatingRect);\n } else {\n clippingRect = viewportRect;\n }\n\n // Best-fit selection:\n // 1) choose first placement that fully fits\n // 2) otherwise choose placement with smallest max overflow, tie-break by total overflow\n let bestPlacement = placement;\n let bestOverflows: OverflowOffsets | null = null;\n let bestScore = { total: Number.POSITIVE_INFINITY, maxSide: Number.POSITIVE_INFINITY };\n\n for (let i = 0; i < placements.length; i += 1) {\n const currentPlacement = placements[i];\n\n const overflows = detectOverflow(referenceRect, floatingRect, currentPlacement, customOffset, clippingRect);\n\n if (fits(overflows)) {\n bestPlacement = currentPlacement;\n bestOverflows = overflows;\n break;\n }\n\n const score = getOverflowScore(overflows);\n\n const isBetter =\n score.maxSide < bestScore.maxSide || (score.maxSide === bestScore.maxSide && score.total < bestScore.total);\n\n if (isBetter) {\n bestPlacement = currentPlacement;\n bestOverflows = overflows;\n bestScore = score;\n }\n }\n\n const finalPlacement = bestPlacement;\n\n const overflows =\n bestOverflows ?? detectOverflow(referenceRect, floatingRect, finalPlacement, customOffset, clippingRect);\n\n // Convert overflow -> coordinates.\n // detectOverflow uses viewport/clipping-rect coordinates.\n //\n // - If tooltip is rendered IN A PORTAL (withoutPortal === false) and is positioned with `position: absolute`,\n // convert viewport coords to page coords by adding window.scrollX/Y, plus clippingRect.left/top \u2014\n // normally 0 (plain viewport), but non-zero when boundaryElement constrains clippingRect to a\n // region that doesn't start at the viewport's own origin (e.g. below a sticky header).\n //\n // - If tooltip is rendered WITHOUT portal, convert viewport coords to offsetParent coords\n // (subtract offsetParent rect, add its scroll).\n let x = -overflows.left - parentOffsets.left;\n let y = -overflows.top - parentOffsets.top;\n\n if (!withoutPortal) {\n x += window.scrollX + clippingRect.left;\n y += window.scrollY + clippingRect.top;\n } else {\n // clippingRect.top/left may be non-zero (e.g. a scroll container below the viewport top).\n // The overflow values already subtracted it; add it back so we convert pure viewport coords\n // to offset-parent-relative coords: viewportCoord - offsetParent.top + offsetParent.scrollTop\n const op = getOffsetParentData(floatingWrapperNode);\n x = x + clippingRect.left - op.left + op.scrollLeft;\n y = y + clippingRect.top - op.top + op.scrollTop;\n }\n\n // Always shift back inside boundary\n ({ x, y } = applyShift(x, y, overflows));\n\n const coordsArrow = getArrowOffsetDynamic({\n placement: finalPlacement,\n referenceRect,\n floatingRect,\n x,\n y,\n withoutPortal,\n parentOffsets,\n floatingEl: floatingWrapperNode,\n arrowPadding: 12,\n });\n\n return {\n coordsStyle: {\n transform: `translate3d(${Math.round(x)}px, ${Math.round(y)}px, 0)`,\n top: 0,\n left: 0,\n },\n finalPlacement,\n coordsArrow,\n };\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADSvB,2CAA8C;AAC9C,4BAAsC;AACtC,4BAA+B;AAC/B,iCAYO;AAkCA,MAAM,kBAAkB,CAAC,UAAgC;AAC9D,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,IAAI;AAGJ,QAAM,gBAAgB,oBAAgB,iDAAqB,uBAAuB,IAAI,EAAE,KAAK,GAAG,MAAM,EAAE;AAExG,QAAM,gBAAgB,wBAAwB,sBAAsB;AACpE,QAAM,eAAe,oBAAoB,sBAAsB;AAE/D,QAAM,qBAAqB,gCAA4B,oEAA8B,SAAS;AAE9F,QAAM,iBAAa;AAAA,IACjB,CAAC,SAAS,EAAE,OAAO,kBAAgE;AAAA,EACrF;AAOA,QAAM,iBAAiB,oBAAgB,8CAAkB,uBAAuB,IAAI;AACpF,QAAM,mBAAe,4CAAgB;AACrC,MAAI;AACJ,MAAI,gBAAgB;AAClB,mBAAe,eAAe,sBAAsB;AAAA,EACtD,WAAW,iBAAiB;AAC1B,uBAAe,uDAA2B,cAAc,gBAAgB,sBAAsB,GAAG,YAAY;AAAA,EAC/G,OAAO;AACL,mBAAe;AAAA,EACjB;AAKA,MAAI,gBAAgB;AACpB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