@@ -128,7 +128,6 @@ export const TableWithGlobalFiltersExample = () => {
128128 < GoabInput
129129 name = "filterChipInput"
130130 aria-labelledby = "filterChipInput"
131- placeholder = "Filter results"
132131 value = { inputValue }
133132 leadingIcon = "search"
134133 onChange = { handleInputChange }
@@ -198,7 +197,7 @@ export const TableWithGlobalFiltersExample = () => {
198197 tags = "angular"
199198 allowCopy = { true }
200199 code = { `
201- export class TableComponent() {
200+ export class TableComponent {
202201 typedChips: string[] = [];
203202 inputValue = "";
204203 inputError = "";
@@ -307,7 +306,6 @@ export class TableComponent() {
307306 <goa-input
308307 name="filterChipInput"
309308 aria-labelledby="filterChipInput"
310- placeholder="Filter results"
311309 [value]="inputValue"
312310 maxlength="100"
313311 size="large"
@@ -484,7 +482,6 @@ export class TableComponent() {
484482 <GoAInput
485483 name="filterChipInput"
486484 aria-labelledby="filterChipInput"
487- placeholder="Filter results"
488485 value={inputValue}
489486 leadingIcon="search"
490487 onChange={handleInputChange}
@@ -611,8 +608,8 @@ export class TableComponent {
611608 }
612609 }
613610
614- handleInputKeyPress(event: KeyboardEvent ): void {
615- if (event .key === "Enter") {
611+ handleInputKeyPress(detail: GoabInputOnKeyPressDetail ): void {
612+ if (detail .key === "Enter") {
616613 this.applyFilter();
617614 }
618615 }
@@ -673,13 +670,12 @@ export class TableComponent {
673670 <goab-input
674671 name="filterChipInput"
675672 aria-labelledby="filterChipInput"
676- placeholder="Filter results"
677673 [value]="inputValue"
678674 maxlength="100"
679675 size="large"
680676 leadingIcon="search"
681677 (onChange)="handleInputChange($event)"
682- (keydown )="handleInputKeyPress($event)"
678+ (onKeyPress )="handleInputKeyPress($event)"
683679 ></goab-input>
684680
685681 <goab-button
@@ -844,74 +840,73 @@ export class TableComponent {
844840 tags = "react"
845841 allowCopy = { true }
846842 code = { `
847- <>
848- <GoabFormItem id="filterChipInput" error={inputError}>
849- <GoabBlock gap="xs" direction="row" alignment="start">
850- <GoabInput
851- name="filterChipInput"
852- aria-labelledby="filterChipInput"
853- placeholder="Filter results"
854- value={inputValue}
855- leadingIcon="search"
856- onChange={handleInputChange}
857- onKeyPress={handleInputKeyPress}
858- />
859- <GoabButton
860- type="secondary"
861- onClick={applyFilter}
862- disabled={inputValue === ""}
863- leadingIcon="filter">
864- Filter
865- </GoabButton>
866- </GoabBlock>
867- </GoabFormItem>
843+ <>
844+ <GoabFormItem id="filterChipInput" error={inputError}>
845+ <GoabBlock gap="xs" direction="row" alignment="start">
846+ <GoabInput
847+ name="filterChipInput"
848+ aria-labelledby="filterChipInput"
849+ value={inputValue}
850+ leadingIcon="search"
851+ onChange={handleInputChange}
852+ onKeyPress={handleInputKeyPress}
853+ />
854+ <GoabButton
855+ type="secondary"
856+ onClick={applyFilter}
857+ disabled={inputValue === ""}
858+ leadingIcon="filter">
859+ Filter
860+ </GoabButton>
861+ </GoabBlock>
862+ </GoabFormItem>
868863
869- {typedChips.length > 0 && (
870- <div>
871- <GoabText as="span" mr="xs">
872- Filter:
873- </GoabText>
874- {typedChips.length > 0 &&
875- typedChips.map((typedChip, index) => (
876- <GoabFilterChip
877- key={index}
878- content={typedChip}
879- mt="s"
880- mr="xs"
881- onClick={() => removeTypedChip(typedChip)}
882- />
883- ))}
884- <GoabButton type="tertiary" size="compact" mt="s" onClick={() => setTypedChips([])}>
885- Clear all
886- </GoabButton>
887- </div>
888- )}
864+ {typedChips.length > 0 && (
865+ <div>
866+ <GoabText as="span" mr="xs">
867+ Filter:
868+ </GoabText>
869+ {typedChips.length > 0 &&
870+ typedChips.map((typedChip, index) => (
871+ <GoabFilterChip
872+ key={index}
873+ content={typedChip}
874+ mt="s"
875+ mr="xs"
876+ onClick={() => removeTypedChip(typedChip)}
877+ />
878+ ))}
879+ <GoabButton type="tertiary" size="compact" mt="s" onClick={() => setTypedChips([])}>
880+ Clear all
881+ </GoabButton>
882+ </div>
883+ )}
889884
890- <GoabTable width="100%">
891- <thead>
892- <tr>
893- <th>Status</th>
894- <th>Name</th>
895- <th className="goa-table-number-header">ID Number</th>
885+ <GoabTable width="100%">
886+ <thead>
887+ <tr>
888+ <th>Status</th>
889+ <th>Name</th>
890+ <th className="goa-table-number-header">ID Number</th>
891+ </tr>
892+ </thead>
893+ <tbody>
894+ {dataFiltered.map(item => (
895+ <tr key={item.id}>
896+ <td>
897+ <GoabBadge type={item.status.type} content={item.status.text} />
898+ </td>
899+ <td>{item.name}</td>
900+ <td className="goa-table-number-column">{item.id}</td>
896901 </tr>
897- </thead>
898- <tbody>
899- {dataFiltered.map(item => (
900- <tr key={item.id}>
901- <td>
902- <GoabBadge type={item.status.type} content={item.status.text} />
903- </td>
904- <td>{item.name}</td>
905- <td className="goa-table-number-column">{item.id}</td>
906- </tr>
907- ))}
908- </tbody>
909- </GoabTable>
902+ ))}
903+ </tbody>
904+ </GoabTable>
910905
911- {dataFiltered.length === 0 && data.length > 0 && (
912- <GoabBlock mt="m">No results found</GoabBlock>
913- )}
914- </>
906+ {dataFiltered.length === 0 && data.length > 0 && (
907+ <GoabBlock mt="m">No results found</GoabBlock>
908+ )}
909+ </>
915910 ` }
916911 />
917912 </ >
0 commit comments