Skip to content

Commit 5fde074

Browse files
committed
docs: move slot jsdoc to inline
1 parent 804f8f4 commit 5fde074

File tree

21 files changed

+46
-80
lines changed

21 files changed

+46
-80
lines changed

elements/.config/cem.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@ generate:
1010
noDefaultExcludes: false
1111
demoDiscovery:
1212
fileGlob: '*/demo/*.html'
13-
urlPattern: :tag/demo/:demo.html
13+
urlPattern: ':tag/demo/:demo.html'
1414
urlTemplate: https://patternflyelements.org/components/{{.tag | alias | slug}}/demo/{{.demo | slug}}/

elements/pf-accordion/pf-accordion.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,6 @@ export class PfAccordionCollapseEvent extends Event {
4040
* @alias Accordion
4141
* @fires {AccordionExpandEvent} expand - when a panel expands
4242
* @fires {AccordionCollapseEvent} collapse - when a panel collapses
43-
* @slot
44-
* Place the `pf-accordion-header` and `pf-accordion-panel` elements here.
4543
* @cssprop [--pf-c-accordion--BackgroundColor=var(--pf-global--BackgroundColor--100, #fff)]
4644
* @cssprop [--pf-c-accordion__toggle--PaddingTop=var(--pf-global--spacer--sm, 0.5rem)]
4745
* @cssprop [--pf-c-accordion__toggle--PaddingRight=var(--pf-global--spacer--md, 1rem)]
@@ -186,6 +184,7 @@ export class PfAccordion extends LitElement {
186184

187185
render(): TemplateResult<1> {
188186
return html`
187+
<!-- Place the \`pf-accordion-header\` and \`pf-accordion-panel\` elements here. -->
189188
<slot></slot>
190189
`;
191190
}

elements/pf-back-to-top/pf-back-to-top.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,6 @@ import styles from './pf-back-to-top.css';
1515
* @summary A shortcut that allows users to quickly navigate to the top of a lengthy content page.
1616
* @alias Back to Top
1717
* @csspart trigger - The `<a>` or `<pf-button>` element
18-
* @slot icon
19-
* Contains the prefix icon to display before the link or button.
20-
* @slot
21-
* Text to display inside the link or button.
2218
* @cssprop {<length>} [--pf-c-back-to-top--Right=3rem`]
2319
* @cssprop {<length>} [--pf-c-back-to-top--Bottom=1.5rem`]
2420
* @cssprop [--pf-c-back-to-top--c-button--BoxShadow=0 0.75rem 0.75rem -0.5rem rgba(3, 3, 3, 0.18)]
@@ -114,7 +110,9 @@ export class PfBackToTop extends LitElement {
114110
if (this.href) {
115111
return html`
116112
<a href="${this.href}" ?hidden="${!this.#visible}" part="trigger" aria-label="${ifDefined(this.#ariaLabel)}">
113+
<!-- Contains the prefix icon to display before the link or button. -->
117114
<slot name="icon"></slot>
115+
<!-- Text to display inside the link or button. -->
118116
<slot @slotchange="${this.#onSlotchange}"></slot>
119117
<pf-icon icon="angle-up" set="fas"></pf-icon>
120118
</a>
@@ -129,8 +127,10 @@ export class PfBackToTop extends LitElement {
129127
part="trigger"
130128
label="${ifDefined(this.#ariaLabel)}"
131129
>
130+
<!-- Contains the prefix icon to display before the link or button. -->
132131
<slot name="icon" slot="icon"></slot>
133132
<span>
133+
<!-- Text to display inside the link or button. -->
134134
<slot></slot>
135135
<pf-icon icon="angle-up" set="fas"></pf-icon>
136136
</span>

elements/pf-background-image/pf-background-image.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import styles from './pf-background-image.css';
1212
* A **background image** allows you to place an image in the background of your page or area of a page.
1313
* @summary Allows users to place an image in the background of your page or area of a page.
1414
* @alias Background Image
15-
* @slot filter - Overrides the default svg filter for the background image.
1615
* @cssprop {<color>} [--pf-c-background-image--BackgroundColor=#151515]
1716
* @cssprop [--pf-c-background-image--Filter=url("#image_overlay")]
1817
* @cssprop --pf-c-background-image--BackgroundImage
@@ -83,6 +82,7 @@ export class PfBackgroundImage extends LitElement {
8382
return html`
8483
<div id="container" part="container" style="${styleMap(cssProps)}">
8584
${!this.filter ? html`` : html`
85+
<!-- Overrides the default svg filter for the background image. -->
8686
<slot name="filter" @slotchange=${this.#onSlotChange}>
8787
${(this.#svg && this.#updated) ? this.#svg : html`
8888
<svg xmlns="http://www.w3.org/2000/svg" width="0" height="0">

elements/pf-banner/pf-banner.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,6 @@ export type BannerVariant = (
3636
* @cssprop [--pf-c-banner--m-sticky--ZIndex=300]
3737
* @cssprop [--pf-c-banner--m-sticky--BoxShadow=0 0.5rem 0.5rem -0.375rem rgba(3, 3, 3, 0.18)]
3838
* @csspart container - The container of the banner
39-
* @slot icon
40-
* Contains the labels's icon, e.g. web-icon-alert-success.
41-
* @slot
42-
* Contains the text for the banner
4339
*/
4440
@customElement('pf-banner')
4541
export class PfBanner extends LitElement {
@@ -69,9 +65,11 @@ export class PfBanner extends LitElement {
6965
return html`
7066
<div id="container" part="container"
7167
class=${classMap({ hasIcon, [variant ?? '']: !!variant })}>
68+
<!-- Contains the labels's icon, e.g. web-icon-alert-success. -->
7269
<slot name="icon" part="icon">${!this.icon ? '' : html`
7370
<pf-icon icon="${this.icon}"></pf-icon>`}
7471
</slot>
72+
<!-- Contains the text for the banner -->
7573
<slot id="text"></slot>
7674
</div>
7775
`;

elements/pf-card/pf-card.ts

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,6 @@ import style from './pf-card.css';
1515
* like card views, or for positioning content on a page.
1616
* @summary Gives a preview of information in a small layout
1717
* @alias Card
18-
* @slot header
19-
* When included, defines the contents of a card. Card headers can contain images as well as
20-
* the title of a card and an actions menu represented by the right-aligned kebab.
21-
* In most cases, your card should include a header. The only exceptions are when cards being
22-
* used as a layout element to create a white background behind other content.
23-
* @slot title
24-
* Communicates the title of a card if it's not included in the header.
25-
* If a card will be utilized as a selectable and clickable card, the title needs to be made as a linked text to trigger action and indicate interaction.
26-
* @slot - Body. Provides details about the item. A card body can include any combination of static
27-
* text and/or active content.
28-
* @slot footer
29-
* Contains external links, actions, or static text at the bottom of a card.
3018
* @csspart header - The container for *header* content
3119
* @csspart body - The container for *body* content
3220
* @csspart footer - The container for *footer* content
@@ -89,17 +77,21 @@ export class PfCard extends LitElement {
8977
<header id="header"
9078
part="header"
9179
class="${classMap({ empty: this.#slots.isEmpty('header') })}">
80+
<!-- When included, defines the contents of a card. Card headers can contain images as well as the title of a card and an actions menu represented by the right-aligned kebab. In most cases, your card should include a header. The only exceptions are when cards being used as a layout element to create a white background behind other content. -->
9281
<slot name="header"></slot>
82+
<!-- Communicates the title of a card if it's not included in the header. If a card will be utilized as a selectable and clickable card, the title needs to be made as a linked text to trigger action and indicate interaction. -->
9383
<slot id="title" name="title" ?hidden="${this.#slots.isEmpty('title')}"></slot>
9484
</header>
9585
<div id="body"
9686
part="body"
9787
class="${classMap({ empty: this.#slots.isEmpty(null) })}">
88+
<!-- Body. Provides details about the item. A card body can include any combination of static text and/or active content. -->
9889
<slot></slot>
9990
</div>
10091
<footer id="footer"
10192
part="footer"
10293
class="${classMap({ empty: this.#slots.isEmpty('footer') })}">
94+
<!-- Contains external links, actions, or static text at the bottom of a card. -->
10395
<slot name="footer"></slot>
10496
</footer>
10597
</article>

elements/pf-chip/pf-chip.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@ export class PfChipRemoveEvent extends Event {
1818
* @alias Chip
1919
* @fires {ChipRemoveEvent} remove - Fires when chip is removed
2020
* @fires {Event} click - when close button is clicked
21-
* @slot
22-
* chip text
2321
* @csspart text - container for chip text
2422
* @cssprop [--pf-c-chip--PaddingTop=var(--pf-global--spacer--xs, 0.25rem)]
2523
* @cssprop [--pf-c-chip--PaddingRight=var(--pf-global--spacer--sm, 0.5rem)]
@@ -67,12 +65,14 @@ export class PfChip extends LitElement {
6765
return this.overflowChip ? html`
6866
<button id="outer">
6967
<span part="text">
68+
<!-- chip text -->
7069
<slot></slot>
7170
</span>
7271
</button>
7372
` : html`
7473
<div id="outer">
7574
<span id="chip-text" part="text">
75+
<!-- chip text -->
7676
<slot></slot>
7777
</span>
7878
<pf-button id="close-button"

elements/pf-clipboard-copy/pf-clipboard-copy.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@ export class PfClipboardCopyCopiedEvent extends Event {
2222
/**
2323
* The **clipboard copy** component allows users to quickly and easily copy content to their clipboard.
2424
* @alias Clipboard Copy
25-
* @slot - Place content to copy here, or use the `value` attribute
26-
* @slot actions - Place additional action buttons here
2725
* @fires {PfClipboardCopyCopiedEvent} copy - when the text snippet is successfully copied.
2826
* @cssprop [--pf-c-clipboard-copy__toggle-icon--Transition=.2s ease-in 0s]
2927
* @cssprop [--pf-c-clipboard-copy--m-expanded__toggle-icon--Rotate=90deg]
@@ -149,6 +147,7 @@ export class PfClipboardCopy extends LitElement {
149147
</pf-button>
150148
<span slot="content">${this.#copied ? this.clickTip : this.hoverTip}</span>
151149
</pf-tooltip>
150+
<!-- Place additional action buttons here -->
152151
<slot name="actions"></slot>
153152
</div>
154153
<textarea .value="${this.value}"

elements/pf-code-block/pf-code-block.ts

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,6 @@ import styles from './pf-code-block.css';
77
/**
88
* A **code block** is a component that contains 2 or more lines of read-only code. The code in a code block can be copied to the clipboard.
99
* @alias Code Block
10-
* @slot code
11-
* The slot to put the code in
12-
* @slot expandable-code
13-
* The slot to put the code in that should be revealed when the "Show more" button is
14-
* clicked to expand the code-block
15-
* @slot actions
16-
* Contains the actions for the code-block. For example, copy to clipboard.
1710
* @attr {boolean} [expanded=false]
1811
* Indicates if the code-block has been expanded
1912
* @cssprop {<color>} [--pf-c-code-block--BackgroundColor=#f0f0f0]
@@ -59,6 +52,7 @@ export class PfCodeBlock extends LitElement {
5952
return html`
6053
<div id="header">
6154
<div id="actions">
55+
<!-- Contains the actions for the code-block. For example, copy to clipboard. -->
6256
<slot name="actions"></slot>
6357
</div>
6458
</div>

elements/pf-dropdown/pf-dropdown.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,6 @@ export class PfDropdownSelectEvent extends Event {
3232
* A **dropdown** presents a menu of actions or links in a constrained space that
3333
* will trigger a process or navigate to a new location.
3434
* @alias Dropdown
35-
* @slot - Must contain one or more `<pf-dropdown-item>` or `<pf-dropdown-group>`
36-
* @slot toggle - Custom toggle button
37-
* @slot menu - when using a custom toggle, you must slot a `<pf-dropdown-menu>` in alongside it
3835
* @csspart menu - The dropdown menu wrapper
3936
* @cssprop {<length>} [--pf-c-dropdown__menu--PaddingTop=0.5rem] Dropdown top padding
4037
* @cssprop {<length>} [--pf-c-tooltip__content--PaddingRight=0.5rem] Dropdown right padding
@@ -104,6 +101,7 @@ export class PfDropdown extends LitElement {
104101
[alignment ?? '']: !!alignment })}"
105102
style="${styleMap(styles)}"
106103
@slotchange="${this.#onSlotchange}">
104+
<!-- Custom toggle button -->
107105
<slot name="toggle"
108106
@keydown="${this.#onButtonKeydown}"
109107
@click="${() => this.toggle()}">
@@ -112,12 +110,14 @@ export class PfDropdown extends LitElement {
112110
<pf-icon icon="caret-down" size="md"></pf-icon>
113111
</pf-button>
114112
</slot>
113+
<!-- when using a custom toggle, you must slot a \`<pf-dropdown-menu>\` in alongside it -->
115114
<slot name="menu"
116115
?hidden="${!this.expanded}"
117116
@focusout="${this.#onMenuFocusout}"
118117
@keydown="${this.#onMenuKeydown}"
119118
@click="${this.#onSelect}">
120119
<pf-dropdown-menu id="menu" part="menu" ?disabled="${disabled}">
120+
<!-- Must contain one or more \`<pf-dropdown-item>\` or \`<pf-dropdown-group>\` -->
121121
<slot></slot>
122122
</pf-dropdown-menu>
123123
</slot>

0 commit comments

Comments
 (0)