Skip to content

Commit fcb0f5d

Browse files
authored
Merge pull request #117 from amir78729/docs/jsdoc/refinement
docs: refine JSDocs
2 parents 44ae811 + 799086a commit fcb0f5d

File tree

7 files changed

+70
-67
lines changed

7 files changed

+70
-67
lines changed

src/avatar/avatar.stories.ts

+15-13
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
1-
import {html, TemplateResult} from "lit";
2-
import "./index.js";
1+
import { html, TemplateResult } from 'lit';
2+
import './index.js';
33

44
export default {
5-
title: "Avatar",
6-
component: "tap-avatar",
5+
title: 'Avatar',
6+
component: 'tap-avatar',
77
argTypes: {
88
image: {
99
description: 'image of the avatar',
1010
},
1111
size: {
12-
control: { type: "inline-radio" },
13-
options: ["xSmall", "small", "medium", "large", "xLarge"],
12+
control: { type: 'inline-radio' },
13+
options: ['xSmall', 'small', 'medium', 'large', 'xLarge'],
1414
description: 'size of the avatar',
1515
},
1616
loading: {
17-
control: {type: "inline-radio" },
18-
options: ["eager", "lazy"],
19-
}
17+
control: { type: 'inline-radio' },
18+
options: ['eager', 'lazy'],
19+
},
2020
},
2121
};
2222

@@ -29,14 +29,16 @@ interface Story<T> {
2929

3030
interface ArgTypes {
3131
image: string;
32-
size: "xSmall" | "small" | "medium" | "large" | "xLarge",
33-
loading: "lazy" | "eager";
32+
size: 'xSmall' | 'small' | 'medium' | 'large' | 'xLarge';
33+
loading: 'lazy' | 'eager';
3434
}
3535

36-
const Template: Story<ArgTypes> = ({image, size, loading}: ArgTypes) => html`
36+
const Template: Story<ArgTypes> = ({ image, size, loading }: ArgTypes) => html`
3737
<tap-avatar image="https://picsum.photos/100">
3838
<svg fill="#666" viewBox="0 0 24 24">
39-
<path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m0 18c-4.41 0-8-3.59-8-8v-.03c2.31-.22 3.43-1.59 4.34-3.41.17-.35.51-.56.9-.56h5.53c.38 0 .72.21.89.55.9 1.8 1.99 3.19 4.34 3.41v.03c0 4.42-3.59 8.01-8 8.01"></path>
39+
<path
40+
d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m0 18c-4.41 0-8-3.59-8-8v-.03c2.31-.22 3.43-1.59 4.34-3.41.17-.35.51-.56.9-.56h5.53c.38 0 .72.21.89.55.9 1.8 1.99 3.19 4.34 3.41v.03c0 4.42-3.59 8.01-8 8.01"
41+
></path>
4042
<circle cx="9" cy="13" r="1.25"></circle>
4143
<circle cx="15" cy="13" r="1.25"></circle>
4244
</svg>

src/avatar/avatar.style.ts

+16-10
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { css } from "lit";
1+
import { css } from 'lit';
22

33
export default css`
44
:host {
@@ -16,48 +16,54 @@ export default css`
1616
}
1717
1818
.avatar {
19-
background-color: var(--tap-avatar-background-color, var(--tap-sys-color-surface-secondary));
20-
border: 1px solid var(--tap-avatar-border-color, var(--tap-sys-color-border-primary));
19+
background-color: var(
20+
--tap-avatar-background-color,
21+
var(--tap-sys-color-surface-secondary)
22+
);
23+
border: 1px solid
24+
var(--tap-avatar-border-color, var(--tap-sys-color-border-primary));
2125
border-radius: var(--tap-avatar-border-radius, var(--tap-sys-radius-full));
2226
display: inline-flex;
2327
align-items: center;
2428
justify-content: center;
2529
}
2630
27-
.avatar img, .avatar .placeholder, .avatar ::slotted(svg) {
31+
.avatar img,
32+
.avatar .placeholder,
33+
.avatar ::slotted(svg) {
2834
width: 100%;
2935
height: 100%;
3036
border-radius: inherit;
3137
}
3238
33-
:host([size="xxSmall"]) .avatar {
39+
:host([size='xxSmall']) .avatar {
3440
width: var(--tap-avatar-width-xxSmall, var(--tap-sys-spacing-8));
3541
height: var(--tap-avatar-height-, vxxSmallar(--tap-sys-spacing-8));
3642
}
3743
38-
:host([size="xSmall"]) .avatar {
44+
:host([size='xSmall']) .avatar {
3945
width: var(--tap-avatar-width-xSmall, var(--tap-sys-spacing-9));
4046
height: var(--tap-avatar-height-xSmall, var(--tap-sys-spacing-9));
4147
}
4248
43-
:host([size="small"]) .avatar {
49+
:host([size='small']) .avatar {
4450
width: var(--tap-avatar-width-small, var(--tap-sys-spacing-10));
4551
height: var(--tap-avatar-height-small, var(--tap-sys-spacing-10));
4652
}
4753
48-
:host([size="medium"]) .avatar {
54+
:host([size='medium']) .avatar {
4955
width: var(--tap-avatar-width-medium, var(--tap-sys-spacing-11));
5056
height: var(--tap-avatar-height-medium, var(--tap-sys-spacing-11));
5157
}
5258
5359
// TODO: add to tokens
54-
:host([size="large"]) .avatar {
60+
:host([size='large']) .avatar {
5561
width: var(--tap-avatar-width-large, 56px);
5662
height: var(--tap-avatar-height-large, 56px);
5763
}
5864
5965
// TODO: add to tokens
60-
:host([size="xLarge"]) .avatar {
66+
:host([size='xLarge']) .avatar {
6167
width: var(--tap-avatar-width-xLarge, 72px);
6268
height: var(--tap-avatar-height-xLarge, 72px);
6369
}

src/avatar/avatar.ts

+9-14
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
1-
import { LitElement, PropertyValues, html } from "lit";
2-
import { property, state } from "lit/decorators.js";
1+
import { LitElement, PropertyValues, html } from 'lit';
2+
import { property, state } from 'lit/decorators.js';
33

44
export class Avatar extends LitElement {
55
@state() private hasError = false;
66

7-
@property() image = "";
7+
@property() image = '';
88

9-
@property() label = "";
9+
@property() label = '';
1010

11-
@property() loading: "eager" | "lazy" = "eager";
11+
@property() loading: 'eager' | 'lazy' = 'eager';
1212

13-
@property() size: "xSmall" | "small" | "medium" | "large" | "xLarge" =
14-
"medium";
13+
@property() size: 'xSmall' | 'small' | 'medium' | 'large' | 'xLarge' =
14+
'medium';
1515

1616
protected updated(changed: PropertyValues) {
17-
if (changed.has("image")) {
17+
if (changed.has('image')) {
1818
this.hasError = false;
1919
}
2020
}
@@ -39,12 +39,7 @@ export class Avatar extends LitElement {
3939

4040
render() {
4141
return html`
42-
<div
43-
role="img"
44-
aria-label=${this.label}
45-
part="avatar"
46-
class="avatar"
47-
>
42+
<div role="img" aria-label=${this.label} part="avatar" class="avatar">
4843
${this.image && !this.hasError
4944
? this.renderImage()
5045
: this.renderPlaceholder()}

src/avatar/index.ts

+24-24
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ import styles from './avatar.style.js';
44

55
/**
66
* ### Example
7-
*
8-
*
7+
*
8+
*
99
* ##### Simple
1010
*
1111
* ```html
@@ -30,36 +30,36 @@ import styles from './avatar.style.js';
3030
*
3131
* @slot - The default slot to use when image is not present.
3232
*
33-
* @prop {string} label - A label to use to describe the avatar to assistive devices.
34-
* @prop {string} image - The image source to use for the avatar.
35-
* @prop {'eager' | 'lazy'} [loading='eager'] - Indicates how the browser should load the image.
36-
* @prop {'xSmall' | 'small' | 'medium' | 'large' | 'xLarge'} [size='medium'] - The size of the avatar.
33+
* @prop {`string`} [`label`=`''`] - A label to use to describe the avatar to assistive devices.
34+
* @prop {`string`} [`image`=`''`] - The image source to use for the avatar.
35+
* @prop {`'eager'` \| `'lazy'`} [`loading`=`'eager'`] - Indicates how the browser should load the image.
36+
* @prop {`'xSmall'` \| `'small'` \| `'medium'` \| `'large'` \| `'xLarge'`} [`size`=`'medium'`] - The size of the avatar.
3737
*
38-
* @csspart avatar - The container that wraps the avatar component.
39-
* @csspart placeholder - The container that wraps the avatar's placeholder.
40-
* @csspart image - The avatar image. Only shown when the image is present.
38+
* @csspart `avatar` - The container that wraps the avatar component.
39+
* @csspart `placeholder` - The container that wraps the avatar's placeholder.
40+
* @csspart `image` - The avatar image. Only shown when the image is present.
4141
*
42-
* @cssprop [--tap-avatar-background-color=--tap-sys-color-surface-secondary]
43-
* @cssprop [--tap-avatar-border-color=--tap-sys-color-border-primary]
44-
* @cssprop [--tap-avatar-border-radius=--tap-sys-radius-full]
42+
* @cssprop [`--tap-avatar-background-color`=`--tap-sys-color-surface-secondary`]
43+
* @cssprop [`--tap-avatar-border-color`=`--tap-sys-color-border-primary`]
44+
* @cssprop [`--tap-avatar-border-radius`=`--tap-sys-radius-full`]
4545
*
46-
* @cssprop [--tap-avatar-width-xxSmall=--tap-sys-spacing-8]
47-
* @cssprop [--tap-avatar-height-xxSmall=--tap-sys-spacing-8]
46+
* @cssprop [`--tap-avatar-width-xxSmall`=`--tap-sys-spacing-8`]
47+
* @cssprop [`--tap-avatar-height-xxSmall`=`--tap-sys-spacing-8`]
4848
*
49-
* @cssprop [--tap-avatar-width-xSmall=--tap-sys-spacing-9]
50-
* @cssprop [--tap-avatar-height-xSmall=--tap-sys-spacing-9]
49+
* @cssprop [`--tap-avatar-width-xSmall`=`--tap-sys-spacing-9`]
50+
* @cssprop [`--tap-avatar-height-xSmall`=`--tap-sys-spacing-9`]
5151
*
52-
* @cssprop [--tap-avatar-width-small=--tap-sys-spacing-10]
53-
* @cssprop [--tap-avatar-height-small=--tap-sys-spacing-10]
52+
* @cssprop [`--tap-avatar-width-small`=`--tap-sys-spacing-10`]
53+
* @cssprop [`--tap-avatar-height-small`=`--tap-sys-spacing-10`]
5454
*
55-
* @cssprop [--tap-avatar-width-medium=--tap-sys-spacing-11]
56-
* @cssprop [--tap-avatar-height-medium=--tap-sys-spacing-11]
55+
* @cssprop [`--tap-avatar-width-medium`=`--tap-sys-spacing-11`]
56+
* @cssprop [`--tap-avatar-height-medium`=`--tap-sys-spacing-11`]
5757
*
58-
* @cssprop [--tap-avatar-width-large=56px]
59-
* @cssprop [--tap-avatar-height-large=56px]
58+
* @cssprop [`--tap-avatar-width-large`=`56px`]
59+
* @cssprop [`--tap-avatar-height-large`=`56px`]
6060
*
61-
* @cssprop [--tap-avatar-width-xLarge=72px]
62-
* @cssprop [--tap-avatar-height-xLarge=72px]
61+
* @cssprop [`--tap-avatar-width-xLarge`=`72px`]
62+
* @cssprop [`--tap-avatar-height-xLarge`=`72px`]
6363
*/
6464
@customElement('tap-avatar')
6565
export class TapAvatar extends Avatar {

src/badge/index.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@ import styles from './badge.style';
2828
*
2929
* @summary Display badge component with different styles and types.
3030
*
31-
* @prop {`string`\|`number`} [`value`=`""`] - The value to display inside the badge.
32-
* @prop {`"pill"` \| `"numeral"` \| `"dot"`} [`type`=`"pill"`] - The type of the badge.
33-
* @prop {`"success"` \| `"error"` \| `"info"` \| `"warning"` \| `"inverse"`} [`variant`=`"inverse"`] - The variant style of the badge.
34-
* @prop {`"high"` \| `"low"`} [`priority`=`"high"`] - The priority level of the badge.
31+
* @prop {`string`\|`number`} [`value`=`''`] - The value to display inside the badge.
32+
* @prop {`'pill'` \| `'numeral'` \| `'dot'`} [`type`=`'pill'`] - The type of the badge.
33+
* @prop {`'success'` \| `'error'` \| `'info'` \| `'warning'` \| `'inverse'`} [`variant`=`'inverse'`] - The variant style of the badge.
34+
* @prop {`'high'` \| `'low'`} [`priority`=`'high'`] - The priority level of the badge.
3535
* @prop {`boolean`} [`leadingIcon`=`false`] - Whether to show an icon before the badge value.
3636
*
3737
* @csspart `badge` - The main badge element.

src/bottom-navigation-item/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import styles from './bottom-navigation-item.style.js';
2424
* @slot `active-icon` - Slot for the icon when the item is active.
2525
* @slot - The default slot for the item label or content.
2626
*
27-
* @prop {`boolean`} `active` - Indicates whether the navigation item is active.
27+
* @prop {`boolean`} [`active`=`false`] - Indicates whether the navigation item is active.
2828
*
2929
* @csspart `bottom-navigation-item` - The main container for the bottom navigation item.
3030
*

src/icon-button/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ import { baseButtonStyles } from '../base-button';
6565
* @prop {`'small'` \| `'medium'` \| `'large'`} [`size`=`'medium'`] - The size of the icon button.
6666
* @prop {`'primary'` \| `'ghost'` \| `'naked'` \| `'elevated'` \| `'destructive'` \| `'brand'`} [`variant`=`'primary'`] - The variant style of the icon button.
6767
*
68-
* @csspart button - The button element.
68+
* @csspart `button` - The button element.
6969
*
7070
* @cssprop [`--tap-font-family`=`--tap-sys-font-family`] - The font family for the button.
7171
* @cssprop [`--tap-sys-radius-full`] - The border radius for the button.

0 commit comments

Comments
 (0)