Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(shell-panel): deprecate float displayMode and add float-content and float-all #9795

Merged
merged 32 commits into from
Jul 30, 2024
Merged
Show file tree
Hide file tree
Changes from 30 commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
725a45e
fix(shell-panel): implement float display mode
josercarcamo Jul 16, 2024
8cef11f
Merge branch 'dev' into josercarcamo/7513-shell-panel-add-float-displ…
josercarcamo Jul 16, 2024
d881904
Merge branch 'dev' into josercarcamo/7513-shell-panel-add-float-displ…
josercarcamo Jul 16, 2024
a5cb68c
Merge branch 'dev' into josercarcamo/7513-shell-panel-add-float-displ…
josercarcamo Jul 17, 2024
b9c0b6c
Removed code that reduced action bar size per code review
josercarcamo Jul 19, 2024
57c8731
REmoved undefined --calcite-shell-panel-max-width-internal
josercarcamo Jul 19, 2024
e58b0d5
Removed unused line; renamed display-mode values; other
josercarcamo Jul 22, 2024
f778931
Made further changes to code
josercarcamo Jul 22, 2024
b2698eb
Merge branch 'dev' into josercarcamo/7513-shell-panel-add-float-displ…
josercarcamo Jul 23, 2024
38069e2
Reverted name change
josercarcamo Jul 23, 2024
46011d0
Merge branch 'dev' into josercarcamo/7513-shell-panel-add-float-displ…
josercarcamo Jul 23, 2024
6adf1f7
Merge branch 'josercarcamo/7513-shell-panel-add-float-display-v2' of …
josercarcamo Jul 23, 2024
6c4d128
Reverted name change
josercarcamo Jul 23, 2024
951d1f7
Merge branch 'dev' into josercarcamo/7513-shell-panel-add-float-displ…
josercarcamo Jul 23, 2024
e3b608d
Separated rules for float-detach and float
josercarcamo Jul 24, 2024
cbc1c53
Merge branch 'josercarcamo/7513-shell-panel-add-float-display-v2' of …
josercarcamo Jul 24, 2024
4329cc9
Merge branch 'dev' into josercarcamo/7513-shell-panel-add-float-displ…
josercarcamo Jul 24, 2024
7722db7
Fixing failed test
josercarcamo Jul 24, 2024
3b6755a
Merge branch 'josercarcamo/7513-shell-panel-add-float-display-v2' of …
josercarcamo Jul 24, 2024
84b1026
Fixing failed test
josercarcamo Jul 24, 2024
957b678
Fixing failed test
josercarcamo Jul 24, 2024
50f283f
Fixing failed test
josercarcamo Jul 24, 2024
abf80a5
Moved the '-internal' ending right after 'calcite' for each rule
josercarcamo Jul 24, 2024
5f39407
Merge branch 'dev' into josercarcamo/7513-shell-panel-add-float-displ…
josercarcamo Jul 24, 2024
3540fba
Changed display-mode from float to float-detach
josercarcamo Jul 24, 2024
ea1b001
Merge branch 'josercarcamo/7513-shell-panel-add-float-display-v2' of …
josercarcamo Jul 24, 2024
46b45f8
Added stories for vertical and horizontal float
josercarcamo Jul 25, 2024
271b1a5
Merge branch 'dev' into josercarcamo/7513-shell-panel-add-float-displ…
josercarcamo Jul 25, 2024
c312514
Deprecated display mode float and added float-content and float-all
josercarcamo Jul 29, 2024
c132c44
Merge branch 'dev' into josercarcamo/7513-shell-panel-add-float-displ…
josercarcamo Jul 29, 2024
dd6c2f6
Made tests for float and float-content
josercarcamo Jul 30, 2024
141c097
Merge branch 'josercarcamo/7513-shell-panel-add-float-display-v2' of …
josercarcamo Jul 30, 2024
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
12 changes: 6 additions & 6 deletions packages/calcite-components/src/components.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4518,12 +4518,12 @@ export namespace Components {
*/
"detached": boolean;
/**
* When `displayMode` is `float`, specifies the maximum height of the component.
* When `displayMode` is `float-content`, specifies the maximum height of the component.
* @deprecated Use `heightScale` instead.
*/
"detachedHeightScale": Scale;
/**
* Specifies the display mode of the component, where: `"dock"` displays at full height adjacent to center content, `"overlay"` displays at full height on top of center content, and `"float"` does not display at full height with content separately detached from `calcite-action-bar` on top of center content.
* Specifies the display mode of the component, where: `"dock"` displays at full height adjacent to center content, `"overlay"` displays at full height on top of center content, and `"float"` [Deprecated] does not display at full height with content separately detached from `calcite-action-bar` on top of center content. `"float-content"` does not display at full height with content separately detached from `calcite-action-bar` on top of center content. `"float-all"` detaches the `calcite-panel` and `calcite-action-bar` on top of center content.
*/
"displayMode": DisplayMode1;
/**
Expand All @@ -4547,7 +4547,7 @@ export namespace Components {
*/
"position": Extract<"start" | "end", Position>;
/**
* When `true` and `displayMode` is not `float`, the component's content area is resizable.
* When `true` and `displayMode` is not `float-content`, the component's content area is resizable.
*/
"resizable": boolean;
/**
Expand Down Expand Up @@ -12638,12 +12638,12 @@ declare namespace LocalJSX {
*/
"detached"?: boolean;
/**
* When `displayMode` is `float`, specifies the maximum height of the component.
* When `displayMode` is `float-content`, specifies the maximum height of the component.
* @deprecated Use `heightScale` instead.
*/
"detachedHeightScale"?: Scale;
/**
* Specifies the display mode of the component, where: `"dock"` displays at full height adjacent to center content, `"overlay"` displays at full height on top of center content, and `"float"` does not display at full height with content separately detached from `calcite-action-bar` on top of center content.
* Specifies the display mode of the component, where: `"dock"` displays at full height adjacent to center content, `"overlay"` displays at full height on top of center content, and `"float"` [Deprecated] does not display at full height with content separately detached from `calcite-action-bar` on top of center content. `"float-content"` does not display at full height with content separately detached from `calcite-action-bar` on top of center content. `"float-all"` detaches the `calcite-panel` and `calcite-action-bar` on top of center content.
*/
"displayMode"?: DisplayMode1;
/**
Expand All @@ -12669,7 +12669,7 @@ declare namespace LocalJSX {
*/
"position"?: Extract<"start" | "end", Position>;
/**
* When `true` and `displayMode` is not `float`, the component's content area is resizable.
* When `true` and `displayMode` is not `float-content`, the component's content area is resizable.
*/
"resizable"?: boolean;
/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export type DisplayMode = "dock" | "float" | "overlay";
export type DisplayMode = "dock" | "float" | "overlay" | "float-content" | "float-all";
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@ export const CSS = {
content: "content",
contentHeader: "content__header",
contentBody: "content__body",
contentFloat: "content--float",
floatContent: "float--content",
contentOverlay: "content--overlay",
separator: "separator",
float: "float",
floatAll: "float-all",
};

export const SLOTS = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,21 +147,21 @@ describe("calcite-shell-panel", () => {

await page.setContent("<calcite-shell-panel><div>content</div></calcite-shell-panel>");

let detachedElement = await page.find(`calcite-shell-panel >>> .${CSS.contentFloat}`);
let detachedElement = await page.find(`calcite-shell-panel >>> .${CSS.floatContent}`);

expect(detachedElement).toBeNull();

const panel = await page.find("calcite-shell-panel");

expect(await panel.getProperty("detached")).toBe(false);

panel.setProperty("displayMode", "float");
panel.setProperty("displayMode", "float-content");

await page.waitForChanges();

expect(await panel.getProperty("detached")).toBe(true);

detachedElement = await page.find(`calcite-shell-panel >>> .${CSS.contentFloat}`);
detachedElement = await page.find(`calcite-shell-panel >>> .${CSS.floatContent}`);

expect(detachedElement).not.toBeNull();
});
Expand Down Expand Up @@ -556,7 +556,7 @@ describe("calcite-shell-panel", () => {
const page = await newE2EPage();
await page.setContent(
`<calcite-shell content-behind>
<calcite-shell-panel slot="panel-start" position="start" display-mode="float"></calcite-shell-panel>
<calcite-shell-panel slot="panel-start" position="start" display-mode="float-content"></calcite-shell-panel>
<calcite-action text="test" style="height: 100%; width: 100%;" text-enabled></calcite-action>
</calcite-shell>`,
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
* @prop --calcite-shell-panel-width: Specifies the width of the component.
* @prop --calcite-shell-panel-max-width: Specifies the maximum width of the component.
* @prop --calcite-shell-panel-min-width: Specifies the minimum width of the component.
* @prop --calcite-shell-panel-height: When `layout` is `horizontal`, or `layout` is `vertical` and `displayMode` is `float`, specifies the height of the component.
* @prop --calcite-shell-panel-max-height: When `layout` is `horizontal`, or `layout` is `vertical` and `displayMode` is `float`, specifies the maximum height of the component.
* @prop --calcite-shell-panel-min-height: When `layout` is `horizontal`, or `layout` is `vertical` and `displayMode` is `float`, specifies the minimum height of the component.
* @prop --calcite-shell-panel-detached-max-height: [Deprecated] Use the `heightScale` property instead. When `displayMode` is `float`, specifies the maximum height of the component.
* @prop --calcite-shell-panel-height: When `layout` is `horizontal`, or `layout` is `vertical` and `displayMode` is `float-content`, specifies the height of the component.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question: should this be when displayMode is float-content or float?

* @prop --calcite-shell-panel-max-height: When `layout` is `horizontal`, or `layout` is `vertical` and `displayMode` is `float-content`, specifies the maximum height of the component.
* @prop --calcite-shell-panel-min-height: When `layout` is `horizontal`, or `layout` is `vertical` and `displayMode` is `float-content`, specifies the minimum height of the component.
* @prop --calcite-shell-panel-detached-max-height: [Deprecated] Use the `heightScale` property instead. When `displayMode` is `float-content`, specifies the maximum height of the component.
* @prop --calcite-shell-panel-z-index: Specifies the z-index value for the component.
*
*/
Expand All @@ -23,20 +23,20 @@
z-index: var(--calcite-shell-panel-z-index, theme("zIndex.default"));
--calcite-shell-panel-detached-max-height: unset;
--calcite-shell-panel-max-height: unset;
--calcite-shell-panel-shadow-block-start-internal: 0 4px 8px -1px rgba(0, 0, 0, 0.08),
--calcite-internal-shell-panel-shadow-block-start: 0 4px 8px -1px rgba(0, 0, 0, 0.08),
0 2px 4px -1px rgba(0, 0, 0, 0.04);
--calcite-shell-panel-shadow-block-end-internal: 0 -4px 8px -1px rgba(0, 0, 0, 0.08),
--calcite-internal-shell-panel-shadow-block-end: 0 -4px 8px -1px rgba(0, 0, 0, 0.08),
0 -2px 4px -1px rgba(0, 0, 0, 0.04);
--calcite-shell-panel-shadow-inline-start-internal: 4px 0 8px -1px rgba(0, 0, 0, 0.08),
--calcite-internal-shell-panel-shadow-inline-start: 4px 0 8px -1px rgba(0, 0, 0, 0.08),
2px 0 4px -1px rgba(0, 0, 0, 0.04);
--calcite-shell-panel-shadow-inline-end-internal: -4px 0 8px -1px rgba(0, 0, 0, 0.08),
--calcite-internal-shell-panel-shadow-inline-end: -4px 0 8px -1px rgba(0, 0, 0, 0.08),
-2px 0 4px -1px rgba(0, 0, 0, 0.04);
}

.calcite--rtl.content--overlay {
--calcite-shell-panel-shadow-inline-start-internal: -4px 0 8px -1px rgba(0, 0, 0, 0.08),
--calcite-internal-shell-panel-shadow-inline-start: -4px 0 8px -1px rgba(0, 0, 0, 0.08),
-2px 0 4px -1px rgba(0, 0, 0, 0.04);
--calcite-shell-panel-shadow-inline-end-internal: 4px 0 8px -1px rgba(0, 0, 0, 0.08),
--calcite-internal-shell-panel-shadow-inline-end: 4px 0 8px -1px rgba(0, 0, 0, 0.08),
2px 0 4px -1px rgba(0, 0, 0, 0.04);
}

Expand All @@ -48,41 +48,60 @@
z-index: var(--calcite-shell-panel-z-index, calc(theme("zIndex.header") + 1));
}

:host([layout="vertical"][width-scale="s"]) .content {
--calcite-shell-panel-width-internal: var(--calcite-shell-panel-width, 12vw);
--calcite-shell-panel-max-width-internal: var(--calcite-shell-panel-max-width, 300px);
driskull marked this conversation as resolved.
Show resolved Hide resolved
--calcite-shell-panel-min-width-internal: var(--calcite-shell-panel-min-width, 150px);
:host([layout="vertical"][display-mode="float-all"]) .content {
flex: 2;
}

:host([layout="vertical"][width-scale="m"]) .content {
--calcite-shell-panel-width-internal: var(--calcite-shell-panel-width, 20vw);
--calcite-shell-panel-max-width-internal: var(--calcite-shell-panel-max-width, 420px);
--calcite-shell-panel-min-width-internal: var(--calcite-shell-panel-min-width, 240px);
:host([layout="vertical"][width-scale="s"]:not([display-mode="float-all"])) .content {
--calcite-internal-shell-panel-width: var(--calcite-shell-panel-width, 12vw);
--calcite-internal-shell-panel-max-width: var(--calcite-shell-panel-max-width, 300px);
--calcite-internal-shell-panel-min-width: var(--calcite-shell-panel-min-width, 150px);
}

:host([layout="vertical"][width-scale="l"]) .content {
--calcite-shell-panel-width-internal: var(--calcite-shell-panel-width, 45vw);
--calcite-shell-panel-max-width-internal: var(--calcite-shell-panel-max-width, 680px);
--calcite-shell-panel-min-width-internal: var(--calcite-shell-panel-min-width, 340px);
:host([layout="vertical"][width-scale="s"][display-mode="float-all"]) .content {
--calcite-internal-shell-panel-width: var(--calcite-shell-panel-width, 12vw);
--calcite-internal-shell-panel-min-width: var(--calcite-shell-panel-min-width, 150px);
}

:host([layout="vertical"][width-scale="m"]:not([display-mode="float-all"])) .content {
--calcite-internal-shell-panel-width: var(--calcite-shell-panel-width, 20vw);
--calcite-internal-shell-panel-max-width: var(--calcite-shell-panel-max-width, 420px);
--calcite-internal-shell-panel-min-width: var(--calcite-shell-panel-min-width, 240px);
}

:host([layout="vertical"][width-scale="m"][display-mode="float-all"]) .content {
--calcite-internal-shell-panel-width: var(--calcite-shell-panel-width, 20vw);
--calcite-internal-shell-panel-min-width: var(--calcite-shell-panel-min-width, 240px);
}

:host([layout="vertical"][width-scale="l"]:not([display-mode="float-all"])) .content {
--calcite-internal-shell-panel-width: var(--calcite-shell-panel-width, 45vw);
--calcite-internal-shell-panel-max-width: var(--calcite-shell-panel-max-width, 680px);
--calcite-internal-shell-panel-min-width: var(--calcite-shell-panel-min-width, 340px);
}

:host([layout="vertical"][width-scale="l"][display-mode="float-all"]) .content {
--calcite-internal-shell-panel-width: var(--calcite-shell-panel-width, 45vw);
--calcite-internal-shell-panel-min-width: var(--calcite-shell-panel-min-width, 340px);
}

:host([layout="horizontal"][height-scale="s"]) .content {
--calcite-shell-panel-max-height-internal: var(
--calcite-internal-shell-panel-max-height: var(
--calcite-shell-panel-max-height,
var(--calcite-shell-panel-detached-max-height, 20vh)
);
}

:host([layout="horizontal"]) .content {
--calcite-shell-panel-min-height-internal: var(--calcite-shell-panel-min-height, 5vh);
--calcite-shell-panel-max-height-internal: var(
--calcite-internal-shell-panel-min-height: var(--calcite-shell-panel-min-height, 5vh);
--calcite-internal-shell-panel-max-height: var(
--calcite-shell-panel-max-height,
var(--calcite-shell-panel-detached-max-height, 30vh)
);
}

:host([layout="horizontal"][height-scale="l"]) .content {
--calcite-shell-panel-max-height-internal: var(
--calcite-internal-shell-panel-max-height: var(
--calcite-shell-panel-max-height,
var(--calcite-shell-panel-detached-max-height, 40vh)
);
Expand All @@ -101,6 +120,11 @@
* {
@apply box-border;
}

&.float-all {
margin-block: 0.5rem;
driskull marked this conversation as resolved.
Show resolved Hide resolved
margin-inline: 0.5rem;
}
}

:host([layout="horizontal"]) .container {
Expand Down Expand Up @@ -193,16 +217,21 @@
max-inline-size var(--calcite-animation-timing);
}

:host([layout="vertical"]) .content {
inline-size: var(--calcite-shell-panel-width-internal);
max-inline-size: var(--calcite-shell-panel-max-width-internal);
min-inline-size: var(--calcite-shell-panel-min-width-internal);
:host([layout="vertical"]:not([display-mode="float-all"])) .content {
inline-size: var(--calcite-internal-shell-panel-width);
max-inline-size: var(--calcite-internal-shell-panel-max-width);
min-inline-size: var(--calcite-internal-shell-panel-min-width);
}

:host([layout="vertical"][display-mode="float-all"]) .content {
inline-size: var(--calcite-internal-shell-panel-width);
min-inline-size: var(--calcite-internal-shell-panel-min-width);
}

:host([layout="horizontal"]) .content {
block-size: var(--calcite-shell-panel-height-internal);
max-block-size: var(--calcite-shell-panel-max-height-internal);
min-block-size: var(--calcite-shell-panel-min-height-internal);
block-size: var(--calcite-internal-shell-panel-height);
max-block-size: var(--calcite-internal-shell-panel-max-height);
min-block-size: var(--calcite-internal-shell-panel-min-height);
}

.content__header {
Expand Down Expand Up @@ -235,45 +264,45 @@

:host([layout="vertical"][position="start"]) .content--overlay {
inset-inline-start: 100%;
box-shadow: var(--calcite-shell-panel-shadow-inline-start-internal);
box-shadow: var(--calcite-internal-shell-panel-shadow-inline-start);
}

:host([layout="vertical"][position="end"]) .content--overlay {
inset-inline-end: 100%;
box-shadow: var(--calcite-shell-panel-shadow-inline-end-internal);
box-shadow: var(--calcite-internal-shell-panel-shadow-inline-end);
}

:host([layout="horizontal"][position="start"]) .content--overlay {
inset-block-start: 100%;
box-shadow: var(--calcite-shell-panel-shadow-block-start-internal);
box-shadow: var(--calcite-internal-shell-panel-shadow-block-start);
}

:host([layout="horizontal"][position="end"]) .content--overlay {
inset-block-end: 100%;
box-shadow: var(--calcite-shell-panel-shadow-block-end-internal);
box-shadow: var(--calcite-internal-shell-panel-shadow-block-end);
}

.content--float {
.float--content {
@apply shadow-0
mx-2
mt-2
mb-auto
h-auto
overflow-hidden
rounded;
max-block-size: var(--calcite-shell-panel-max-height-internal, calc(100% - 1rem));
max-block-size: var(--calcite-internal-shell-panel-max-height, calc(100% - 1rem));
::slotted(calcite-panel),
::slotted(calcite-flow) {
max-block-size: unset;
}
}

:host([layout="horizontal"]) .content--float {
:host([layout="horizontal"]) .float--content {
@apply my-2;
}

:host([position="start"]) .content--float,
:host([position="end"]) .content--float {
:host([position="start"]) .float--content,
:host([position="end"]) .float--content {
::slotted(calcite-panel),
::slotted(calcite-flow) {
@apply border-none;
Expand All @@ -290,7 +319,7 @@ slot[name="action-bar"]::slotted(calcite-action-bar),
@apply border-color-3 border border-solid;
}

:host([position="start"]:not([slot="panel-end"])),
:host([position="start"]:not([slot="panel-end"]):not([display-mode="float-all"])),
:host([position="end"][slot="panel-start"]) {
slot[name="action-bar"]::slotted(calcite-action-bar),
.content ::slotted(calcite-flow),
Expand All @@ -308,12 +337,12 @@ slot[name="action-bar"]::slotted(calcite-action-bar),
}
}

:host([layout="horizontal"]) slot[name="action-bar"]::slotted(calcite-action-bar) {
:host([layout="horizontal"]:not([display-mode="float-all"])) slot[name="action-bar"]::slotted(calcite-action-bar) {
border-inline: 0;
}

:host([layout="horizontal"][position="start"]) .content ::slotted(calcite-flow),
:host([layout="horizontal"][position="start"]) .content ::slotted(calcite-panel) {
:host([layout="horizontal"][position="start"]:not([display-mode="float-all"])) .content ::slotted(calcite-flow),
:host([layout="horizontal"][position="start"]:not([display-mode="float-all"])) .content ::slotted(calcite-panel) {
border-inline: 0;
border-block-start: 0;
}
Expand Down
Loading
Loading