Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/plenty-colts-lie.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"reshaped": minor
---

Flyout, Popover, DropdownMenu, Tooltip, ContextMenu, Autocomplete: Added contentZIndex property
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ const Autocomplete: React.FC<T.Props> = (props) => {
fallbackMinWidth,
fallbackMinHeight,
contentMaxHeight,
contentZIndex,
...textFieldProps
} = props;
const [highlightedId, setHighlightedId] = React.useState<string>();
Expand Down Expand Up @@ -194,6 +195,7 @@ const Autocomplete: React.FC<T.Props> = (props) => {
fallbackMinWidth={fallbackMinWidth}
fallbackMinHeight={fallbackMinHeight}
contentMaxHeight={contentMaxHeight}
contentZIndex={contentZIndex}
disableHideAnimation
instanceRef={instanceRef}
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export type Props = TextFieldProps &
| "fallbackMinWidth"
| "fallbackMinHeight"
| "contentMaxHeight"
| "contentZIndex"
> & {
/** Callback for when value changes from user input */
onInput?: TextFieldProps["onChange"];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export type Props = Pick<
| "contentGap"
| "contentShift"
| "contentMaxHeight"
| "contentZIndex"
| "onOpen"
| "onClose"
| "active"
Expand Down
3 changes: 2 additions & 1 deletion packages/reshaped/src/components/Flyout/Flyout.module.css
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
.content {
--rs-flyout-max-h: 100%;
--rs-flyout-max-w: 100%;
--rs-flyout-z-index: var(--rs-z-index-absolute);
--rs-flyout-origin-x: 50%;
--rs-flyout-origin-y: 50%;

position: absolute;
isolation: isolate;
z-index: var(--rs-z-index-absolute);
z-index: var(--rs-flyout-z-index);

/* Make content child grow based on its max height with flex grow */
display: flex;
Expand Down
3 changes: 3 additions & 0 deletions packages/reshaped/src/components/Flyout/Flyout.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,8 @@ type BaseProps = {
contentMaxHeight?: string;
/** Maximum width for the content */
contentMaxWidth?: string;
/** Z-index for the content element */
contentZIndex?: number;
/** Additional classname for the content element */
contentClassName?: string;
/** Additional attributes for the content element */
Expand Down Expand Up @@ -218,6 +220,7 @@ export type ContextProps = {
| "contentGap"
| "contentMaxHeight"
| "contentMaxWidth"
| "contentZIndex"
| "trapFocusMode"
| "containerRef"
| "disableContentHover"
Expand Down
4 changes: 4 additions & 0 deletions packages/reshaped/src/components/Flyout/FlyoutContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ const FlyoutContent: React.FC<T.ContentProps> = (props) => {
contentAttributes,
contentMaxHeight,
contentMaxWidth,
contentZIndex,
trapFocusMode,
disableContentHover,
autoFocus,
Expand Down Expand Up @@ -71,6 +72,8 @@ const FlyoutContent: React.FC<T.ContentProps> = (props) => {
role = "menubar";
}

console.log("contentZIndex", contentZIndex);

const content = (
<ContentProvider value={{ elRef: flyoutElRef }}>
{/* eslint-disable-next-line jsx-a11y/no-static-element-interactions */}
Expand All @@ -80,6 +83,7 @@ const FlyoutContent: React.FC<T.ContentProps> = (props) => {
{
"--rs-flyout-max-h": contentMaxHeight,
"--rs-flyout-max-w": contentMaxWidth,
"--rs-flyout-z-index": contentZIndex,
} as React.CSSProperties
}
ref={flyoutElRef}
Expand Down
2 changes: 2 additions & 0 deletions packages/reshaped/src/components/Flyout/FlyoutControlled.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ const FlyoutControlled: React.FC<T.ControlledProps & T.DefaultProps> = (props) =
contentShift,
contentMaxHeight,
contentMaxWidth,
contentZIndex,
contentClassName,
contentAttributes,
position: passedPosition,
Expand Down Expand Up @@ -459,6 +460,7 @@ const FlyoutControlled: React.FC<T.ControlledProps & T.DefaultProps> = (props) =
handleContentMouseUp,
triggerType,
trapFocusMode,
contentZIndex,
contentClassName,
contentAttributes,
contentGap,
Expand Down
20 changes: 20 additions & 0 deletions packages/reshaped/src/components/Flyout/tests/Flyout.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -640,6 +640,26 @@ export const contentShift = {
render: () => <Demo contentShift={10} defaultActive />,
};

export const contentZIndex = {
name: "contentZIndex",
render: () => (
<View gap={6}>
<View direction="row" gap={20}>
<Demo contentZIndex={8999} active />
<Demo contentZIndex={9001} active />
</View>
<View
backgroundColor="primary-faded"
height={100}
width={100}
borderRadius="medium"
position="relative"
zIndex={9000}
/>
</View>
),
};

export const contentMaxHeight = {
name: "contentMaxHeight",
render: () => (
Expand Down
1 change: 1 addition & 0 deletions packages/reshaped/src/components/Popover/Popover.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export type Props = Pick<
| "contentGap"
| "contentShift"
| "contentMaxHeight"
| "contentZIndex"
| "instanceRef"
| "triggerType"
| "disableHideAnimation"
Expand Down
1 change: 1 addition & 0 deletions packages/reshaped/src/components/Tooltip/Tooltip.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export type Props = Pick<
| "contentGap"
| "contentShift"
| "contentMaxWidth"
| "contentZIndex"
| "originCoordinates"
| "contentAttributes"
| "contentClassName"
Expand Down
4 changes: 2 additions & 2 deletions packages/utilities/src/flyout/utilities/applyPosition.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,9 +155,9 @@ const applyPosition = (
transform: `translate(${translateX}px, ${translateY}px)`,
};

content.style.cssText = "";

Object.entries(resolvedStyles).forEach(([key, value]) => {
content.style.removeProperty(key);

if (!value) return;
content.style.setProperty(key, value);
});
Expand Down
2 changes: 1 addition & 1 deletion pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.