File tree 4 files changed +38
-15
lines changed
4 files changed +38
-15
lines changed Original file line number Diff line number Diff line change 1
- import { html , TemplateResult } from " lit" ;
2
- import " ./index.js" ;
3
- import " ../badge" ;
4
- import " ../button" ;
1
+ import { html , TemplateResult } from ' lit' ;
2
+ import ' ./index.js' ;
3
+ import ' ../badge' ;
4
+ import ' ../button' ;
5
5
6
6
export default {
7
- title : " Badge" ,
8
- component : " tap-badge-wrapper" ,
7
+ title : ' Badge' ,
8
+ component : ' tap-badge-wrapper' ,
9
9
argTypes : { } ,
10
10
} ;
11
11
Original file line number Diff line number Diff line change 1
- import { css } from " lit" ;
1
+ import { css } from ' lit' ;
2
2
3
3
export default css `
4
4
.wrapper {
Original file line number Diff line number Diff line change 1
- import { html , LitElement } from " lit" ;
1
+ import { html , LitElement } from ' lit' ;
2
2
3
3
export class BadgeWrapper extends LitElement {
4
4
render ( ) {
5
5
return html `
6
- < span class ="wrapper ">
6
+ < span class ="wrapper " part =" wrapper " >
7
7
< slot > </ slot >
8
- < slot class ="badge " name ="badge "> </ slot >
8
+ < slot class ="badge " name ="badge " part =" badge " > </ slot >
9
9
</ span >
10
10
` ;
11
11
}
Original file line number Diff line number Diff line change 1
- import { customElement } from "lit/decorators.js" ;
2
- import { BadgeWrapper } from "./badge-wrapper" ;
3
- import styles from "./badge-wrapper.style" ;
1
+ // index.ts
4
2
5
- @customElement ( "tap-badge-wrapper" )
3
+ import { customElement } from 'lit/decorators.js' ;
4
+ import { BadgeWrapper } from './badge-wrapper' ;
5
+ import styles from './badge-wrapper.style' ;
6
+
7
+ /**
8
+ * ### Example
9
+ *
10
+ *
11
+ * ##### Simple
12
+ *
13
+ * ```html
14
+ * <tap-badge-wrapper>
15
+ * <tap-button>Click!</tap-button>
16
+ * <tap-badge slot="badge" value="99+"></tap-badge>
17
+ * </tap-badge-wrapper>
18
+ * ```
19
+ *
20
+ * @summary A wrapper component to position a badge relative to its content.
21
+ *
22
+ * @slot - The default slot for the main content.
23
+ * @slot `badge` - The slot for the badge to be positioned.
24
+ *
25
+ * @csspart `wrapper` - The container that wraps the main content and the badge.
26
+ * @csspart `badge` - The container that positions the badge.
27
+ */
28
+ @customElement ( 'tap-badge-wrapper' )
6
29
export class TapBadgeWrapper extends BadgeWrapper {
7
30
static readonly styles = [ styles ] ;
8
31
}
9
32
10
33
declare global {
11
34
interface HTMLElementTagNameMap {
12
- " tap-badge-wrapper" : TapBadgeWrapper ;
35
+ ' tap-badge-wrapper' : TapBadgeWrapper ;
13
36
}
14
37
}
You can’t perform that action at this time.
0 commit comments