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

chore: remove popover's dialog property #4751

Merged
merged 3 commits into from
Oct 16, 2024
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
25 changes: 0 additions & 25 deletions packages/popover/src/Popover.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import {
CSSResultArray,
html,
nothing,
PropertyValues,
SpectrumElement,
TemplateResult,
} from '@spectrum-web-components/base';
Expand All @@ -35,13 +34,6 @@ export class Popover extends SpectrumElement {
return [popoverStyles];
}

/**
* Whether the popover should manage the application
* of padding to its content or not.
*/
@property({ type: Boolean, reflect: true })
public dialog = false;

/**
* Whether the popover is visible or not.
*/
Expand Down Expand Up @@ -74,23 +66,6 @@ export class Popover extends SpectrumElement {
`;
}

protected override update(changes: PropertyValues): void {
if (window.__swc.DEBUG) {
if (changes.has('dialog') && this.dialog) {
window.__swc.warn(
this,
`<${this.localName}> no longer supports the "dialog" attribute. Please slot an <sp-dialog> element into the <${this.localName}> instead.`,
'https://opensource.adobe.com/spectrum-web-components/components/popover/#dialog-popovers',
{
type: 'api',
level: 'deprecation',
}
);
}
}
super.update(changes);
}

protected override render(): TemplateResult {
return html`
<slot></slot>
Expand Down
4 changes: 0 additions & 4 deletions packages/popover/src/spectrum-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,6 @@ const config = {
converter.classToHost(),
converter.classToAttribute('is-open', 'open'),
converter.classToAttribute('spectrum-Popover--withTip', 'tip'),
converter.classToAttribute(
'spectrum-Popover--dialog',
'dialog'
),
...converter.enumerateAttributes(
[
['spectrum-Popover--top', 'top'],
Expand Down
1 change: 0 additions & 1 deletion packages/popover/stories/popover.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@ const Template = ({ tip, placement, open }: StoryArgs): TemplateResult => {
style="color: var(--spectrum-gray-800); position: relative; display: contents"
>
<sp-popover
variant="dialog"
placement=${placement}
?open=${open}
style=" max-width: 320px"
Expand Down
9 changes: 5 additions & 4 deletions packages/popover/test/benchmark/test-basic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,17 @@ governing permissions and limitations under the License.
*/

import '@spectrum-web-components/popover/sp-popover.js';
import '@spectrum-web-components/dialog/sp-dialog.js';
import { html } from 'lit';
import { measureFixtureCreation } from '../../../../test/benchmark/helpers.js';

measureFixtureCreation(html`
<sp-popover variant="dialog" direction="top" open>
<div id="title">Popover Title</div>
<div id="content">
<sp-popover direction="top" open>
<sp-dialog>
<h3 slot="heading">Popover title</h3>
Cupcake ipsum dolor sit amet jelly beans. Chocolate jelly caramels.
Icing soufflé chupa chups donut cheesecake. Jelly-o chocolate cake
sweet roll cake danish candy biscuit halvah
</div>
</sp-dialog>
</sp-popover>
`);
49 changes: 23 additions & 26 deletions packages/popover/test/popover.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,26 +10,25 @@ OF ANY KIND, either express or implied. See the License for the specific languag
governing permissions and limitations under the License.
*/
import '@spectrum-web-components/popover/sp-popover.js';
import '@spectrum-web-components/dialog/sp-dialog.js';
import { Popover } from '@spectrum-web-components/popover';
import { elementUpdated, expect, fixture, html } from '@open-wc/testing';

describe('popover', () => {
let popover!: Popover;

beforeEach(async () => {
popover = await fixture<Popover>(
html`
<sp-popover variant="dialog" placement="top" open>
<div id="title">Popover Title</div>
<div id="content">
Cupcake ipsum dolor sit amet jelly beans. Chocolate
jelly caramels. Icing soufflé chupa chups donut
cheesecake. Jelly-o chocolate cake sweet roll cake
danish candy biscuit halvah
</div>
</sp-popover>
`
);
popover = await fixture<Popover>(html`
<sp-popover placement="top" open>
<sp-dialog>
<h3 slot="heading">Popover title</h3>
Cupcake ipsum dolor sit amet jelly beans. Chocolate jelly
caramels. Icing soufflé chupa chups donut cheesecake.
Jelly-o chocolate cake sweet roll cake danish candy biscuit
halvah
</sp-dialog>
</sp-popover>
`);
await elementUpdated(popover);
});

Expand All @@ -53,19 +52,17 @@ describe('popover', () => {
});

it('surfaces tip element', async () => {
const el = await fixture<Popover>(
html`
<sp-popover variant="dialog" placement="top" tip open>
<div id="title">Popover Title</div>
<div id="content">
Cupcake ipsum dolor sit amet jelly beans. Chocolate
jelly caramels. Icing soufflé chupa chups donut
cheesecake. Jelly-o chocolate cake sweet roll cake
danish candy biscuit halvah
</div>
</sp-popover>
`
);
const el = await fixture<Popover>(html`
<sp-popover placement="top" tip open>
<div id="title">Popover Title</div>
<div id="content">
Cupcake ipsum dolor sit amet jelly beans. Chocolate jelly
caramels. Icing soufflé chupa chups donut cheesecake.
Jelly-o chocolate cake sweet roll cake danish candy biscuit
halvah
</div>
</sp-popover>
`);

await elementUpdated(el);

Expand Down