@trackunit/react-components 1.21.17 → 1.21.18
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/index.cjs.js
CHANGED
|
@@ -9128,10 +9128,11 @@ const useSheetMotionOverflow = ({ panelEl, isDragging, scrollAreaEl, separatorEl
|
|
|
9128
9128
|
* CSS transitions on transform; the component stays mounted during the
|
|
9129
9129
|
* close animation and unmounts after the transition completes.
|
|
9130
9130
|
*/
|
|
9131
|
-
const Sheet = ({ isOpen, state, snap, onGeometryChange, onSnap, onClickHandle, onCloseGesture, floatingUi, ref, anchor = "center", snapping = true, resizable = true, variant = "default", trapFocus = true, container, dockedContent, className, "data-testid": dataTestId, onCloseComplete, entryAnimation = "subsequent", children, }) => {
|
|
9131
|
+
const Sheet = ({ isOpen, state, snap, onGeometryChange, onSnap, onClickHandle, onCloseGesture, floatingUi, ref, anchor = "center", snapping = true, resizable = true, variant = "default", trapFocus = true, container, dockedContent, persistentContent, className, "data-testid": dataTestId, onCloseComplete, entryAnimation = "subsequent", children, }) => {
|
|
9132
9132
|
const isFirstRender = useIsFirstRender();
|
|
9133
9133
|
const skipEntryAnimation = entryAnimation === "never" || (entryAnimation === "subsequent" && isFirstRender);
|
|
9134
9134
|
const effectiveSnapping = resizable && snapping;
|
|
9135
|
+
const dockingEnabled = dockedContent !== undefined || persistentContent !== undefined;
|
|
9135
9136
|
const [animState, animDispatch] = react.useReducer(sheetAnimationReducer, INITIAL_ANIMATION_STATE);
|
|
9136
9137
|
if (isOpen !== animState.prevIsOpen) {
|
|
9137
9138
|
animDispatch({
|
|
@@ -9143,7 +9144,7 @@ const Sheet = ({ isOpen, state, snap, onGeometryChange, onSnap, onClickHandle, o
|
|
|
9143
9144
|
const measurements = useSheetMeasurements({
|
|
9144
9145
|
shouldRender: animState.shouldRender,
|
|
9145
9146
|
state,
|
|
9146
|
-
dockingEnabled
|
|
9147
|
+
dockingEnabled,
|
|
9147
9148
|
snapping: effectiveSnapping,
|
|
9148
9149
|
externalRef: ref,
|
|
9149
9150
|
onGeometryChange,
|
|
@@ -9218,7 +9219,7 @@ const Sheet = ({ isOpen, state, snap, onGeometryChange, onSnap, onClickHandle, o
|
|
|
9218
9219
|
? `${state.effectiveDockedHeight}px`
|
|
9219
9220
|
: fitHeightMeasured
|
|
9220
9221
|
? `${cappedFitHeight}px`
|
|
9221
|
-
: getSnapLevelCssHeight(state.level, state.totalLevels,
|
|
9222
|
+
: getSnapLevelCssHeight(state.level, state.totalLevels, dockingEnabled, state.effectiveDockedHeight);
|
|
9222
9223
|
const fitMaxHeight = state.sizingMode === "fit" ? `calc(100cqh - ${FULL_HEIGHT_TOP_MARGIN_PX}px)` : undefined;
|
|
9223
9224
|
if (!animState.shouldRender)
|
|
9224
9225
|
return null;
|
|
@@ -9242,7 +9243,7 @@ const Sheet = ({ isOpen, state, snap, onGeometryChange, onSnap, onClickHandle, o
|
|
|
9242
9243
|
snapHeight: snapHeightCss,
|
|
9243
9244
|
suppressTransition: skipEntryAnimation && animState.visuallyOpen,
|
|
9244
9245
|
variant,
|
|
9245
|
-
}), children: [resizable ? (jsxRuntime.jsx(SheetHandle, { "data-testid": dataTestId !== undefined ? `${dataTestId}-handle` : undefined, isDragging: gestures.isDragging, onClick: handleClick, onMouseEnter: onMouseEnter, onMouseLeave: onMouseLeave, ...gestureHandlers })) : null, jsxRuntime.jsx("div", { className: "h-px shrink-0 bg-neutral-200 opacity-0 transition-opacity duration-200", ref: setSeparatorEl }), jsxRuntime.
|
|
9246
|
+
}), children: [resizable ? (jsxRuntime.jsx(SheetHandle, { "data-testid": dataTestId !== undefined ? `${dataTestId}-handle` : undefined, isDragging: gestures.isDragging, onClick: handleClick, onMouseEnter: onMouseEnter, onMouseLeave: onMouseLeave, ...gestureHandlers })) : null, jsxRuntime.jsx("div", { className: "h-px shrink-0 bg-neutral-200 opacity-0 transition-opacity duration-200", ref: setSeparatorEl }), jsxRuntime.jsxs("div", { className: cvaSheetScrollArea({ fillHeight: state.sizingMode !== "fit" }), "data-sheet-scroll-area": true, ref: setScrollAreaEl, children: [persistentContent, state.sizingMode === "docked" ? dockedContent : children] })] }));
|
|
9246
9247
|
return (jsxRuntime.jsx(Portal, { root: container, children: jsxRuntime.jsxs("div", { className: cvaSheetContainer({
|
|
9247
9248
|
docked: state.sizingMode === "docked",
|
|
9248
9249
|
}), "data-testid": dataTestId !== undefined ? `${dataTestId}-container` : undefined, ref: containerRef, children: [jsxRuntime.jsx(SheetOverlay, { "data-testid": dataTestId !== undefined ? `${dataTestId}-overlay` : undefined, visible: showOverlay }), shouldTrapFocus === true ? (jsxRuntime.jsx(react$1.FloatingFocusManager, { context: floatingUi.context, children: panel })) : (panel)] }) }));
|
package/index.esm.js
CHANGED
|
@@ -9126,10 +9126,11 @@ const useSheetMotionOverflow = ({ panelEl, isDragging, scrollAreaEl, separatorEl
|
|
|
9126
9126
|
* CSS transitions on transform; the component stays mounted during the
|
|
9127
9127
|
* close animation and unmounts after the transition completes.
|
|
9128
9128
|
*/
|
|
9129
|
-
const Sheet = ({ isOpen, state, snap, onGeometryChange, onSnap, onClickHandle, onCloseGesture, floatingUi, ref, anchor = "center", snapping = true, resizable = true, variant = "default", trapFocus = true, container, dockedContent, className, "data-testid": dataTestId, onCloseComplete, entryAnimation = "subsequent", children, }) => {
|
|
9129
|
+
const Sheet = ({ isOpen, state, snap, onGeometryChange, onSnap, onClickHandle, onCloseGesture, floatingUi, ref, anchor = "center", snapping = true, resizable = true, variant = "default", trapFocus = true, container, dockedContent, persistentContent, className, "data-testid": dataTestId, onCloseComplete, entryAnimation = "subsequent", children, }) => {
|
|
9130
9130
|
const isFirstRender = useIsFirstRender();
|
|
9131
9131
|
const skipEntryAnimation = entryAnimation === "never" || (entryAnimation === "subsequent" && isFirstRender);
|
|
9132
9132
|
const effectiveSnapping = resizable && snapping;
|
|
9133
|
+
const dockingEnabled = dockedContent !== undefined || persistentContent !== undefined;
|
|
9133
9134
|
const [animState, animDispatch] = useReducer(sheetAnimationReducer, INITIAL_ANIMATION_STATE);
|
|
9134
9135
|
if (isOpen !== animState.prevIsOpen) {
|
|
9135
9136
|
animDispatch({
|
|
@@ -9141,7 +9142,7 @@ const Sheet = ({ isOpen, state, snap, onGeometryChange, onSnap, onClickHandle, o
|
|
|
9141
9142
|
const measurements = useSheetMeasurements({
|
|
9142
9143
|
shouldRender: animState.shouldRender,
|
|
9143
9144
|
state,
|
|
9144
|
-
dockingEnabled
|
|
9145
|
+
dockingEnabled,
|
|
9145
9146
|
snapping: effectiveSnapping,
|
|
9146
9147
|
externalRef: ref,
|
|
9147
9148
|
onGeometryChange,
|
|
@@ -9216,7 +9217,7 @@ const Sheet = ({ isOpen, state, snap, onGeometryChange, onSnap, onClickHandle, o
|
|
|
9216
9217
|
? `${state.effectiveDockedHeight}px`
|
|
9217
9218
|
: fitHeightMeasured
|
|
9218
9219
|
? `${cappedFitHeight}px`
|
|
9219
|
-
: getSnapLevelCssHeight(state.level, state.totalLevels,
|
|
9220
|
+
: getSnapLevelCssHeight(state.level, state.totalLevels, dockingEnabled, state.effectiveDockedHeight);
|
|
9220
9221
|
const fitMaxHeight = state.sizingMode === "fit" ? `calc(100cqh - ${FULL_HEIGHT_TOP_MARGIN_PX}px)` : undefined;
|
|
9221
9222
|
if (!animState.shouldRender)
|
|
9222
9223
|
return null;
|
|
@@ -9240,7 +9241,7 @@ const Sheet = ({ isOpen, state, snap, onGeometryChange, onSnap, onClickHandle, o
|
|
|
9240
9241
|
snapHeight: snapHeightCss,
|
|
9241
9242
|
suppressTransition: skipEntryAnimation && animState.visuallyOpen,
|
|
9242
9243
|
variant,
|
|
9243
|
-
}), children: [resizable ? (jsx(SheetHandle, { "data-testid": dataTestId !== undefined ? `${dataTestId}-handle` : undefined, isDragging: gestures.isDragging, onClick: handleClick, onMouseEnter: onMouseEnter, onMouseLeave: onMouseLeave, ...gestureHandlers })) : null, jsx("div", { className: "h-px shrink-0 bg-neutral-200 opacity-0 transition-opacity duration-200", ref: setSeparatorEl }),
|
|
9244
|
+
}), children: [resizable ? (jsx(SheetHandle, { "data-testid": dataTestId !== undefined ? `${dataTestId}-handle` : undefined, isDragging: gestures.isDragging, onClick: handleClick, onMouseEnter: onMouseEnter, onMouseLeave: onMouseLeave, ...gestureHandlers })) : null, jsx("div", { className: "h-px shrink-0 bg-neutral-200 opacity-0 transition-opacity duration-200", ref: setSeparatorEl }), jsxs("div", { className: cvaSheetScrollArea({ fillHeight: state.sizingMode !== "fit" }), "data-sheet-scroll-area": true, ref: setScrollAreaEl, children: [persistentContent, state.sizingMode === "docked" ? dockedContent : children] })] }));
|
|
9244
9245
|
return (jsx(Portal, { root: container, children: jsxs("div", { className: cvaSheetContainer({
|
|
9245
9246
|
docked: state.sizingMode === "docked",
|
|
9246
9247
|
}), "data-testid": dataTestId !== undefined ? `${dataTestId}-container` : undefined, ref: containerRef, children: [jsx(SheetOverlay, { "data-testid": dataTestId !== undefined ? `${dataTestId}-overlay` : undefined, visible: showOverlay }), shouldTrapFocus === true ? (jsx(FloatingFocusManager, { context: floatingUi.context, children: panel })) : (panel)] }) }));
|
package/package.json
CHANGED
|
@@ -26,4 +26,4 @@ import type { SheetProps } from "./sheet-types";
|
|
|
26
26
|
* CSS transitions on transform; the component stays mounted during the
|
|
27
27
|
* close animation and unmounts after the transition completes.
|
|
28
28
|
*/
|
|
29
|
-
export declare const Sheet: ({ isOpen, state, snap, onGeometryChange, onSnap, onClickHandle, onCloseGesture, floatingUi, ref, anchor, snapping, resizable, variant, trapFocus, container, dockedContent, className, "data-testid": dataTestId, onCloseComplete, entryAnimation, children, }: SheetProps) => ReactElement | null;
|
|
29
|
+
export declare const Sheet: ({ isOpen, state, snap, onGeometryChange, onSnap, onClickHandle, onCloseGesture, floatingUi, ref, anchor, snapping, resizable, variant, trapFocus, container, dockedContent, persistentContent, className, "data-testid": dataTestId, onCloseComplete, entryAnimation, children, }: SheetProps) => ReactElement | null;
|
|
@@ -187,6 +187,15 @@ export type SheetProps = {
|
|
|
187
187
|
readonly container: HTMLElement | null;
|
|
188
188
|
/** Content rendered when in docked mode. Presence enables docking behavior. */
|
|
189
189
|
readonly dockedContent?: ReactNode;
|
|
190
|
+
/**
|
|
191
|
+
* Content rendered above `dockedContent`/`children` in every sizing mode.
|
|
192
|
+
* Use this when the same subtree (e.g. a filter bar with an input) must
|
|
193
|
+
* stay mounted across snap transitions so its DOM — and any focused
|
|
194
|
+
* element inside it — is preserved. Presence alone also enables docking
|
|
195
|
+
* behavior even when `dockedContent` is omitted; in that case the docked
|
|
196
|
+
* mode shows only `persistentContent`.
|
|
197
|
+
*/
|
|
198
|
+
readonly persistentContent?: ReactNode;
|
|
190
199
|
/** Custom class name. */
|
|
191
200
|
readonly className?: string;
|
|
192
201
|
/** Test ID for the sheet. */
|