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

docs: deprecate add custom-content slot for dialog component #11072

Open
wants to merge 6 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 5 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
Original file line number Diff line number Diff line change
Expand Up @@ -592,7 +592,7 @@ describe("calcite-dialog", () => {
const page = await newE2EPage();
await page.setContent(
html`<calcite-dialog close-disabled>
<div slot="content">
<div slot="custom-content">
<button id="${button1Id}">Focus1</button>
<button id="${button2Id}">Focus2</button>
</div>
Expand Down
3 changes: 2 additions & 1 deletion packages/calcite-components/src/components/dialog/dialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ let initialDocumentOverflowStyle: string = "";

/**
* @slot - A slot for adding content.
* @slot content - A slot for adding custom content.
* @slot content - [Deprecated] Use `custom-content` slot instead.
Copy link
Member

Choose a reason for hiding this comment

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

@DitwanP we would actually need to add this slot in the code. It not just a doc change.

I'm kinda unsure how this change would work without being breaking since we put the panel inside the content slot by default.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@driskull Yeah good point. That being said, what are your thoughts on changing the slot to the new one overall? Are you in favor or not in favor of such a change?

Copy link
Member

Choose a reason for hiding this comment

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

I'm in favor of it, i'm just not sure how it will work exactly.

Copy link
Contributor

Choose a reason for hiding this comment

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

Can this coincide with the rest of 3.0 breaking changes?

Copy link
Member

Choose a reason for hiding this comment

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

Thats a question for @jcfranco

Copy link
Contributor

Choose a reason for hiding this comment

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

Could we deprecate (w/o removing) "content" slot and add "custom-content"? That wouldn't be breaking as the recommendation is to use the "unnamed" default slot, right?

Copy link
Member

Choose a reason for hiding this comment

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

The problem is we put default content in the content slot now. So we don't have a good way to counter that.

Copy link
Member

Choose a reason for hiding this comment

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

Basically, we can't have this in both the content and custom-content slots or it would show up twice.

   <slot name={SLOTS.content}>
            <calcite-panel
              beforeClose={this.beforeClose}
              class={CSS.panel}
              closable={!this.closeDisabled}
              closed={!opened}

I don't think we can do this right?

<slot name="custom-content">
            <slot name={SLOTS.content}>

Copy link
Contributor

Choose a reason for hiding this comment

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

That... does seem to work pretty well, in local testing...

Copy link
Member

Choose a reason for hiding this comment

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

Well i'll be... 🤯

* @slot custom-content - A slot for displaying custom content. Will prevent the rendering of any default Dialog UI, except for `box-shadow` and `corner-radius`.
* @slot action-bar - A slot for adding a `calcite-action-bar` to the component.
* @slot alerts - A slot for adding `calcite-alert`s to the component.
* @slot content-bottom - A slot for adding content below the unnamed (default) slot and - if populated - the `footer` slot.
Expand Down
Loading