Skip to content

Commit ada2a22

Browse files
driskullbenelan
authored andcommitted
fix(sheet): fix rounded corners when displayMode="float" (#11086)
**Related Issue:** #10731 ## Summary - add a new content container to hide overflowed slotted content - add story screenshot test BEGIN_COMMIT_OVERRIDE END_COMMIT_OVERRIDE
1 parent 04ab859 commit ada2a22

File tree

4 files changed

+62
-8
lines changed

4 files changed

+62
-8
lines changed

packages/calcite-components/src/components/sheet/resources.ts

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ export const CSS = {
44
container: "container",
55
containerOpen: "container--open",
66
content: "content",
7+
contentContainer: "content-container",
78
containerEmbedded: "container--embedded",
89
resizeHandle: "resize-handle",
910
resizeHandleBar: "resize-handle-bar",

packages/calcite-components/src/components/sheet/sheet.scss

+38-7
Original file line numberDiff line numberDiff line change
@@ -175,12 +175,17 @@
175175
transform: var(--calcite-sheet-hidden-position-internal);
176176
}
177177

178+
.content-container {
179+
@apply flex flex-1 relative max-h-full max-w-full overflow-hidden;
180+
}
181+
178182
.container--open .content {
179183
transform: translate3d(0, 0, 0);
180184
}
181185

182186
:host([display-mode="float"]) .content,
183-
:host([display-mode="float"]) .container {
187+
:host([display-mode="float"]) .container,
188+
:host([display-mode="float"]) .content-container {
184189
@apply rounded;
185190
}
186191

@@ -229,20 +234,30 @@
229234
@apply flex-col-reverse;
230235
}
231236

232-
:host([resizable][position="inline-start"]),
233-
:host([resizable][position="inline-end"]) {
237+
:host([resizable][position="inline-start"]) {
234238
.content {
235239
padding-inline-end: var(--calcite-size-fixed-sm-plus);
236240
}
237241
}
238242

239-
:host([resizable][position="block-start"]),
240-
:host([resizable][position="block-end"]) {
243+
:host([resizable][position="inline-end"]) {
244+
.content {
245+
padding-inline-start: var(--calcite-size-fixed-sm-plus);
246+
}
247+
}
248+
249+
:host([resizable][position="block-start"]) {
241250
.content {
242251
padding-block-end: var(--calcite-size-fixed-sm-plus);
243252
}
244253
}
245254

255+
:host([resizable][position="block-end"]) {
256+
.content {
257+
padding-block-start: var(--calcite-size-fixed-sm-plus);
258+
}
259+
}
260+
246261
.resize-handle {
247262
@apply absolute flex justify-center items-center select-none box-border outline-none;
248263
--calcite-internal-sheet-resize-handle-offset: calc(
@@ -279,6 +294,10 @@
279294
inline-size: var(--calcite-size-fixed-sm-plus);
280295
border-inline-start: 1px solid var(--calcite-color-border-3);
281296
}
297+
298+
&:host([display-mode="float"]) .resize-handle-bar {
299+
@apply rounded-e;
300+
}
282301
}
283302

284303
:host([position="inline-end"]) {
@@ -293,11 +312,15 @@
293312
inline-size: var(--calcite-size-fixed-sm-plus);
294313
border-inline-end: 1px solid var(--calcite-color-border-3);
295314
}
315+
316+
&:host([display-mode="float"]) .resize-handle-bar {
317+
@apply rounded-s;
318+
}
296319
}
297320

298321
:host([position="block-start"]) {
299322
.resize-handle {
300-
block-size: var(--calcite-size-fixed-sm-plus);
323+
block-size: var(--calcite-size-fixed-xxl);
301324
inline-size: 100%;
302325
inset-block-end: var(--calcite-internal-sheet-resize-handle-offset);
303326
}
@@ -307,11 +330,15 @@
307330
block-size: var(--calcite-size-fixed-sm-plus);
308331
border-block-start: 1px solid var(--calcite-color-border-3);
309332
}
333+
334+
&:host([display-mode="float"]) .resize-handle-bar {
335+
@apply rounded-b;
336+
}
310337
}
311338

312339
:host([position="block-end"]) {
313340
.resize-handle {
314-
block-size: var(--calcite-size-fixed-sm-plus);
341+
block-size: var(--calcite-size-fixed-xxl);
315342
inline-size: 100%;
316343
inset-block-start: var(--calcite-internal-sheet-resize-handle-offset);
317344
}
@@ -321,6 +348,10 @@
321348
block-size: var(--calcite-size-fixed-sm-plus);
322349
border-block-end: 1px solid var(--calcite-color-border-3);
323350
}
351+
352+
&:host([display-mode="float"]) .resize-handle-bar {
353+
@apply rounded-t;
354+
}
324355
}
325356

326357
/**

packages/calcite-components/src/components/sheet/sheet.stories.ts

+20
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,26 @@ export const resizable = (): string =>
7171
export const resizableBlockStart = (): string =>
7272
html`<calcite-sheet resizable label="libero nunc" open position="block-start">${panelHTML}</calcite-sheet>`;
7373

74+
export const resizableFloatInlineStart = (): string =>
75+
html`<calcite-sheet display-mode="float" resizable label="libero nunc" open position="inline-start"
76+
>${panelHTML}</calcite-sheet
77+
>`;
78+
79+
export const resizableFloatInlineEnd = (): string =>
80+
html`<calcite-sheet display-mode="float" resizable label="libero nunc" open position="inline-end"
81+
>${panelHTML}</calcite-sheet
82+
>`;
83+
84+
export const resizableFloatBlockStart = (): string =>
85+
html`<calcite-sheet display-mode="float" resizable label="libero nunc" open position="block-start"
86+
>${panelHTML}</calcite-sheet
87+
>`;
88+
89+
export const resizableFloatBlockEnd = (): string =>
90+
html`<calcite-sheet display-mode="float" resizable label="libero nunc" open position="block-end"
91+
>${panelHTML}</calcite-sheet
92+
>`;
93+
7494
export const resizableLoremIpsum = (): string =>
7595
html`<calcite-sheet resizable label="libero nunc" open position="inline-end"
7696
>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed vel viverra purus. Vestibulum fringilla fringilla orci

packages/calcite-components/src/components/sheet/sheet.tsx

+3-1
Original file line numberDiff line numberDiff line change
@@ -635,7 +635,9 @@ export class Sheet
635635
>
636636
<calcite-scrim class={CSS.scrim} onClick={this.handleOutsideClose} />
637637
<div class={CSS.content} ref={this.setContentEl}>
638-
<slot />
638+
<div class={CSS.contentContainer}>
639+
<slot />
640+
</div>
639641
{resizable ? (
640642
<div
641643
ariaLabel={this.messages.resizeEnabled}

0 commit comments

Comments
 (0)