@@ -7,6 +7,7 @@ import '@patternfly/elements/pf-button/pf-button.js';
77
88import styles from './pf-label-group.css' ;
99
10+ import { state } from 'lit/decorators/state.js' ;
1011import { query } from 'lit/decorators/query.js' ;
1112import { queryAssignedNodes } from 'lit/decorators/query-assigned-nodes.js' ;
1213import { observes } from '@patternfly/pfe-core/decorators/observes.js' ;
@@ -35,12 +36,12 @@ const REMAINING_RE = /\$\{\s*remaining\s*\}/g;
3536 *
3637 * @fires expand - Fired when label group is expanded to show all labels
3738 *
38- * @slot category-name - Category name text for label group category. If supplied, label group will have category styling applied
39+ * @slot category - Category name text for label group category. If supplied, label group will have category styling applied
3940 * @slot - Default slot for `<pf-label>` elements
4041 *
4142 * @example
4243 * <pf-label-group num-labels="2 ">
43- * <span slot="category-name ">Fruit Types</span>
44+ * <span slot="category">Fruit Types</span>
4445 * <pf-label>Apple</pf-label>
4546 * <pf-label>Banana</pf-label>
4647 * <pf-label>Orange</pf-label>
@@ -57,7 +58,6 @@ export class PfLabelGroup extends LitElement {
5758
5859 /**
5960 * Orientation of the label group.
60- * @default 'horizontal'
6161 */
6262 @property ( ) orientation : 'horizontal' | 'vertical' = 'horizontal' ;
6363
@@ -103,12 +103,12 @@ export class PfLabelGroup extends LitElement {
103103 */
104104 @property ( { reflect : true , type : Boolean } ) closeable = false ;
105105
106- @property ( ) private _overflowText = '' ;
106+ @state ( ) private _overflowText = '' ;
107107
108108 @query ( '#close-button' ) private _button ?: HTMLButtonElement ;
109109
110110 @queryAssignedNodes ( {
111- slot : 'category-name ' ,
111+ slot : 'category' ,
112112 flatten : true ,
113113 } )
114114 private _categorySlotted ?: HTMLElement [ ] ;
@@ -134,7 +134,7 @@ export class PfLabelGroup extends LitElement {
134134
135135 return html `
136136 < div id ="outer " class ="${ classMap ( { 'has-category' : hasCategory , empty } ) } " role ="toolbar ">
137- < slot id ="category " name ="category-name " @slotchange ="${ this . #onCategorySlotChange} ">
137+ < slot id ="category " name ="category " @slotchange ="${ this . #onCategorySlotChange} ">
138138 < span class ="visually-hidden label-text " ?hidden ="${ ! this . accessibleLabel } ">
139139 ${ this . accessibleLabel ?? '' }
140140 </ span >
@@ -143,18 +143,18 @@ export class PfLabelGroup extends LitElement {
143143 < slot id ="labels " @slotchange ="${ this . #onSlotchange} "> </ slot >
144144
145145 ${ this . _overflowText ?
146- html `< pf-label
146+ html `< pf-label
147147 id ="overflow "
148148 aria-controls ="labels "
149149 overflow-label
150150 @click ="${ this . #onMoreClick} "
151151 >
152152 ${ this . _overflowText }
153153 </ pf-label > `
154- : '' }
154+ : '' }
155155
156156 ${ this . closeable ?
157- html `< pf-button
157+ html `< pf-button
158158 id ="close-button "
159159 plain
160160 icon ="times-circle "
@@ -163,7 +163,7 @@ export class PfLabelGroup extends LitElement {
163163 aria-describedby ="category "
164164 @click ="${ this . #onCloseClick} "
165165 > </ pf-button > `
166- : '' }
166+ : '' }
167167 </ div >
168168 ` ;
169169 }
@@ -239,8 +239,8 @@ export class PfLabelGroup extends LitElement {
239239 this . _overflowText = rem < 1 ?
240240 ''
241241 : this . open ?
242- this . expandedText
243- : this . collapsedText . replace ( REMAINING_RE , rem . toString ( ) ) ;
242+ this . expandedText
243+ : this . collapsedText . replace ( REMAINING_RE , rem . toString ( ) ) ;
244244
245245 if ( rem < 1 && this . open ) {
246246 this . open = false ;
0 commit comments