Skip to content

Commit

Permalink
chore: remove 'variant' attribute from coach indicator
Browse files Browse the repository at this point in the history
  • Loading branch information
rubencarvalho committed Sep 18, 2024
1 parent 55dbbf9 commit e7428df
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 51 deletions.
12 changes: 6 additions & 6 deletions packages/coachmark/coach-indicator.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,16 @@ When looking to leverage the `CoachIndicator` base class as a type and/or for ex
import { CoachIndicator } from '@spectrum-web-components/coachmark';
```

## Variants
## Static variants

<sp-tabs selected="standard" auto label="Variant Options">
<sp-tabs selected="standard" auto label="Static Options">
<sp-tab value="standard">Standard</sp-tab>
<sp-tab-panel value="standard">

```html
<sp-coach-indicator></sp-coach-indicator>
<sp-coach-indicator variant="dark"></sp-coach-indicator>
<sp-coach-indicator variant="light"></sp-coach-indicator>
<sp-coach-indicator static="dark"></sp-coach-indicator>
<sp-coach-indicator static="light"></sp-coach-indicator>
```

</sp-tab-panel>
Expand All @@ -41,8 +41,8 @@ import { CoachIndicator } from '@spectrum-web-components/coachmark';

```html
<sp-coach-indicator quiet></sp-coach-indicator>
<sp-coach-indicator quiet variant="dark"></sp-coach-indicator>
<sp-coach-indicator quiet variant="light"></sp-coach-indicator>
<sp-coach-indicator quiet static="dark"></sp-coach-indicator>
<sp-coach-indicator quiet static="light"></sp-coach-indicator>
```

</sp-tab-panel>
Expand Down
22 changes: 0 additions & 22 deletions packages/coachmark/src/CoachIndicator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ governing permissions and limitations under the License.
import {
CSSResultArray,
html,
PropertyValues,
SpectrumElement,
TemplateResult,
} from '@spectrum-web-components/base';
Expand All @@ -33,32 +32,11 @@ export class CoachIndicator extends SpectrumElement {
@property({ reflect: true })
public static?: 'white' | 'black';

@property({ reflect: true })
public variant?: 'white' | 'black';

protected override render(): TemplateResult {
return html`
<div class="ring"></div>
<div class="ring"></div>
<div class="ring"></div>
`;
}

protected override updated(changes: PropertyValues): void {
super.updated(changes);
if (
changes.has('variant') &&
(this.variant || typeof changes.get('variant'))
) {
this.static = this.variant;
if (window.__swc.DEBUG) {
window.__swc.warn(
this,
`The "variant" attribute/property of <${this.localName}> have been deprecated. Use "static" with any of the same values instead. "variant" will be removed in a future release.`,
'https://opensource.adobe.com/spectrum-web-components/components/badge/#fixed',
{ level: 'deprecation' }
);
}
}
}
}
8 changes: 4 additions & 4 deletions packages/coachmark/stories/coach-indicator-static.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@ export default {

export const staticWhite = (): TemplateResult => {
return html`
<sp-coach-indicator variant="white"></sp-coach-indicator>
<sp-coach-indicator quiet variant="white"></sp-coach-indicator>
<sp-coach-indicator static="white"></sp-coach-indicator>
<sp-coach-indicator quiet static="white"></sp-coach-indicator>
`;
};

export const staticBlack = (): TemplateResult => {
return html`
<sp-coach-indicator variant="black"></sp-coach-indicator>
<sp-coach-indicator quiet variant="black"></sp-coach-indicator>
<sp-coach-indicator static="black"></sp-coach-indicator>
<sp-coach-indicator quiet static="black"></sp-coach-indicator>
`;
};
25 changes: 6 additions & 19 deletions packages/coachmark/test/coach-indicator.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,28 +18,15 @@ import { testForLitDevWarnings } from '../../../test/testing-helpers.js';
describe('CoachIndicator', () => {
testForLitDevWarnings(
async () =>
await fixture<CoachIndicator>(
html`
<sp-coach-indicator></sp-coach-indicator>
`
)
await fixture<CoachIndicator>(html`
<sp-coach-indicator></sp-coach-indicator>
`)
);
it('loads default coach-indicator accessibly', async () => {
const el = await fixture<CoachIndicator>(
html`
<sp-coach-indicator></sp-coach-indicator>
`
);
const el = await fixture<CoachIndicator>(html`
<sp-coach-indicator></sp-coach-indicator>
`);
await elementUpdated(el);
await expect(el).to.be.accessible();
});
it('loads coach-indicator white static variant', async () => {
const el = await fixture<CoachIndicator>(
html`
<sp-coach-indicator variant="white"></sp-coach-indicator>
`
);
await elementUpdated(el);
expect(el.static == 'white').to.be.true;
});
});

0 comments on commit e7428df

Please sign in to comment.