From e0a87bf235ce05de8f7b44c0a363d3dbebb9462a Mon Sep 17 00:00:00 2001 From: Matt Driscoll Date: Fri, 26 Jul 2024 14:39:32 -0700 Subject: [PATCH 1/8] fix(panel): add footer slot gaps settings #9858 --- .../src/components/panel/panel.scss | 21 +++++++++------- .../src/components/panel/panel.tsx | 24 ++++++++++++------- .../src/components/panel/resources.ts | 4 ++++ .../calcite-components/src/demos/panel.html | 13 ++++++++++ 4 files changed, 45 insertions(+), 17 deletions(-) diff --git a/packages/calcite-components/src/components/panel/panel.scss b/packages/calcite-components/src/components/panel/panel.scss index 0b49bf01950..dfa1de927a1 100644 --- a/packages/calcite-components/src/components/panel/panel.scss +++ b/packages/calcite-components/src/components/panel/panel.scss @@ -169,24 +169,27 @@ } .footer { - @apply flex mt-auto flex-row content-between justify-center items-center bg-foreground-1; - + @apply flex mt-auto flex-row content-between justify-center items-center bg-foreground-1 text-n2-wrap; + gap: var(--calcite-spacing-md); border-block-start: 1px solid var(--calcite-color-border-3); padding: var(--calcite-panel-footer-padding, var(--calcite-internal-panel-default-padding)); - column-gap: 0; - row-gap: var(--calcite-spacing-md); } -@include slotted("footer-start", "*") { - @apply flex text-n2-wrap self-center; +.footer-content, +.footer-actions { + @apply flex flex-row items-center justify-center; + gap: var(--calcite-spacing-md); +} +.footer-start { + @apply flex flex-row items-center justify-start; margin-inline-end: auto; gap: var(--calcite-spacing-md); } -@include slotted("footer-end", "*") { - @apply flex text-n2-wrap self-center; - +.footer-end { + @apply flex flex-row items-center justify-end; + margin-inline-start: auto; gap: var(--calcite-spacing-md); } diff --git a/packages/calcite-components/src/components/panel/panel.tsx b/packages/calcite-components/src/components/panel/panel.tsx index 17d95d36b8e..4459f80cf41 100644 --- a/packages/calcite-components/src/components/panel/panel.tsx +++ b/packages/calcite-components/src/components/panel/panel.tsx @@ -620,14 +620,22 @@ export class Panel return ( ); } diff --git a/packages/calcite-components/src/components/panel/resources.ts b/packages/calcite-components/src/components/panel/resources.ts index 6fd7f4d449d..f7704b36582 100644 --- a/packages/calcite-components/src/components/panel/resources.ts +++ b/packages/calcite-components/src/components/panel/resources.ts @@ -17,6 +17,10 @@ export const CSS = { contentWrapper: "content-wrapper", fabContainer: "fab-container", footer: "footer", + footerContent: "footer-content", + footerActions: "footer-actions", + footerStart: "footer-start", + footerEnd: "footer-end", }; export const ICONS = { diff --git a/packages/calcite-components/src/demos/panel.html b/packages/calcite-components/src/demos/panel.html index e0fd9209bdc..2f9330a4a73 100644 --- a/packages/calcite-components/src/demos/panel.html +++ b/packages/calcite-components/src/demos/panel.html @@ -178,10 +178,23 @@ icon-start="check" width="full" > + +
+
+ +
From d08e7dc15baf153a4204f377cb0931ab947d997c Mon Sep 17 00:00:00 2001 From: Matt Driscoll Date: Fri, 26 Jul 2024 16:03:19 -0700 Subject: [PATCH 2/8] cleanup --- .../.storybook/preview-head.html | 5 + .../components/flow-item/flow-item.stories.ts | 2 +- .../src/components/panel/panel.scss | 18 ++- .../src/components/panel/panel.stories.ts | 115 ++++++++++++++---- 4 files changed, 110 insertions(+), 30 deletions(-) diff --git a/packages/calcite-components/.storybook/preview-head.html b/packages/calcite-components/.storybook/preview-head.html index e10d36db2f4..46b8971ec63 100644 --- a/packages/calcite-components/.storybook/preview-head.html +++ b/packages/calcite-components/.storybook/preview-head.html @@ -10,6 +10,11 @@ background-color: var(--calcite-color-background); } + hr { + border: var(--calcite-border-width-sm) dashed var(--calcite-color-status-danger); + margin-block: 2rem; + } + calcite-slider { width: 250px; max-width: 100%; diff --git a/packages/calcite-components/src/components/flow-item/flow-item.stories.ts b/packages/calcite-components/src/components/flow-item/flow-item.stories.ts index f80d1efc45d..e0ce6fb4e88 100644 --- a/packages/calcite-components/src/components/flow-item/flow-item.stories.ts +++ b/packages/calcite-components/src/components/flow-item/flow-item.stories.ts @@ -249,7 +249,7 @@ export const footerStartEndAndContentBottom = (): string => `; -export const footerSlotCoexistence = (): string => +export const footerSlot = (): string => html`
Header!
diff --git a/packages/calcite-components/src/components/panel/panel.scss b/packages/calcite-components/src/components/panel/panel.scss index dfa1de927a1..bc4c9c63ba9 100644 --- a/packages/calcite-components/src/components/panel/panel.scss +++ b/packages/calcite-components/src/components/panel/panel.scss @@ -170,27 +170,33 @@ .footer { @apply flex mt-auto flex-row content-between justify-center items-center bg-foreground-1 text-n2-wrap; - gap: var(--calcite-spacing-md); border-block-start: 1px solid var(--calcite-color-border-3); padding: var(--calcite-panel-footer-padding, var(--calcite-internal-panel-default-padding)); } -.footer-content, +.footer-content { + @apply flex flex-col items-center justify-center; + gap: var(--calcite-internal-panel-default-padding); +} + .footer-actions { - @apply flex flex-row items-center justify-center; - gap: var(--calcite-spacing-md); + @apply flex flex-row items-center justify-evenly; + gap: var(--calcite-internal-panel-default-padding); + flex: 1; } .footer-start { @apply flex flex-row items-center justify-start; margin-inline-end: auto; - gap: var(--calcite-spacing-md); + gap: var(--calcite-internal-panel-default-padding); + flex: 1; } .footer-end { @apply flex flex-row items-center justify-end; margin-inline-start: auto; - gap: var(--calcite-spacing-md); + gap: var(--calcite-internal-panel-default-padding); + flex: 1; } .fab-container { diff --git a/packages/calcite-components/src/components/panel/panel.stories.ts b/packages/calcite-components/src/components/panel/panel.stories.ts index 49f721bb0fd..98a3bf880c1 100644 --- a/packages/calcite-components/src/components/panel/panel.stories.ts +++ b/packages/calcite-components/src/components/panel/panel.stories.ts @@ -113,21 +113,21 @@ export const onlyProps = (): string => html`
`; -export const disabledWithStyledSlot_TestOnly = (): string => html` +export const disabledWithStyledSlot = (): string => html`
${contentHTML}
`; -export const darkModeRTL_TestOnly = (): string => html` +export const darkModeRTL = (): string => html` ${panelContent} `; -darkModeRTL_TestOnly.parameters = { themes: modesDarkDefault }; +darkModeRTL.parameters = { themes: modesDarkDefault }; -export const closableWithActions_TestOnly = (): string => html` +export const closableWithActions = (): string => html` html` `; -export const collapsibleWithoutActions_TestOnly = (): string => html` +export const collapsibleWithoutActions = (): string => html` html` `; -export const collapsibleWithActions_TestOnly = (): string => html` +export const collapsibleWithActions = (): string => html` html` `; -export const collapseDirectionUp_TestOnly = (): string => html` +export const collapseDirectionUp = (): string => html` html` `; -export const collapseDirectionUpCollapsed_TestOnly = (): string => html` +export const collapseDirectionUpCollapsed = (): string => html` html` `; -export const collapsedWithActions_TestOnly = (): string => html` +export const collapsedWithActions = (): string => html` html` `; -export const withActionBar_TestOnly = (): string => +export const withActionBar = (): string => html`
@@ -237,16 +237,85 @@ export const withActionBar_TestOnly = (): string =>
`; -export const footerPadding_TestOnly = (): string => +export const footerPadding = (): string => html`
Header!

Slotted content!

-
Footer!
+ 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8
`; -export const actionBarBackgroundColor_TestOnly = (): string => +export const footerStartOnly = (): string => + html`
+ +
Header!
+

Slotted content!

+ 1 + 2 +
+
`; + +export const footerActions = (): string => + html`
+ +
Header!
+

Slotted content!

+ 1 + 2 +
+
+ +
Header!
+

Slotted content!

+ 1 + 2 +
+
`; + +export const footerVariations = (): string => + html`
+ +
Header!
+

Slotted content!

+ 1 + 2 +
+
+ +
Header!
+

Slotted content!

+ 1 + 2 + 3 + 4 +
+
+ +
Header!
+

Slotted content!

+ 1 + 2 + 3 + 4 +
+
+ +
Header!
+

Slotted content!

+ 1 + 2 +
+
`; + +export const actionBarBackgroundColor = (): string => html` @@ -263,7 +332,7 @@ export const actionBarBackgroundColor_TestOnly = (): string =>

Footer!

`; -export const footerWithoutContent_TestOnly = (): string => +export const footerWithoutContent = (): string => html`

Footer!

`; -export const actionBarWithoutContent_TestOnly = (): string => +export const actionBarWithoutContent = (): string => html` `; -export const actionBarZIndex_TestOnly = (): string => +export const actionBarZIndex = (): string => html` @@ -303,7 +372,7 @@ export const actionBarZIndex_TestOnly = (): string =>

Some content

`; -export const footerAndActionBarWithoutContent_TestOnly = (): string => +export const footerAndActionBarWithoutContent = (): string => html`

Footer!

`; -export const flexContent_TestOnly = (): string => +export const flexContent = (): string => html`
`; -export const overflowContent_TestOnly = (): string => +export const overflowContent = (): string => html`