Skip to content

Commit d0fc1a7

Browse files
committed
chore: replace native input with pf-text-input
1 parent 616475b commit d0fc1a7

File tree

2 files changed

+21
-10
lines changed

2 files changed

+21
-10
lines changed

elements/pf-search-input/pf-search-input.css

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -242,14 +242,11 @@
242242
border: none;
243243
text-align: left;
244244
border-radius: 0;
245-
flex: 1 0 auto;
246245
}
247246

248247
#toggle-input {
249248
justify-content: space-between;
250-
padding: var(--pf-global--spacer--xs, 0.25rem) var(--pf-global--spacer--sm, 0.5rem);
251-
padding-left: 2.5rem;
252-
width: 90%;
249+
min-width: calc(100% - 33px);
253250
box-sizing: border-box;
254251
max-height: 2.25rem;
255252
}
@@ -277,7 +274,7 @@
277274

278275
pf-icon {
279276
position: relative;
280-
top: 3px;
277+
top: 5px;
281278
}
282279
}
283280

@@ -377,4 +374,16 @@ div.visually-hidden {
377374
::slotted(pf-option[selected]) {
378375
--_pf-option-svg-display: none;
379376
--_pf-option-selected-background-color: var(--pf-global--BackgroundColor--100, #fff);
377+
}
378+
379+
pf-text-input {
380+
--pf-c-form-control--LineHeight: 36px;
381+
--pf-c-form-control--PaddingTop: 0px;
382+
--pf-c-form-control--PaddingBottom: 0px;
383+
--pf-c-form-control--PaddingLeft: 2.5rem;
384+
--pf-c-form-control--BorderWidth: 0px;
385+
--pf-c-form-control--Width: 100%;
386+
387+
border: none;
388+
box-sizing: border-box;
380389
}

elements/pf-search-input/pf-search-input.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ import { FloatingDOMController } from '@patternfly/pfe-core/controllers/floating
1515

1616
import { arraysAreEquivalent } from '@patternfly/pfe-core/functions/arraysAreEquivalent.js';
1717
import { observes } from '@patternfly/pfe-core/decorators/observes.js';
18-
19-
import styles from './pf-search-input.css';
2018
import { PfOption } from '../pf-select/pf-option.js';
2119
import { bound } from '@patternfly/pfe-core/decorators.js';
20+
import '@patternfly/elements/pf-text-input/pf-text-input.js';
21+
import styles from './pf-search-input.css';
2222

2323
export class PfSearchChangeEvent extends Event {
2424
constructor() {
@@ -186,11 +186,13 @@ export class PfSearchInput extends LitElement {
186186
<div class="search-icon">
187187
<pf-icon size="md" icon="search" set="fas">search</pf-icon>
188188
</div>
189-
<input
189+
<pf-text-input
190+
icon="search"
191+
accessible-label="search"
190192
id="toggle-input"
191193
?disabled="${disabled}"
192-
placeholder="${placeholder || this.#buttonLabel}"
193-
>
194+
placeholder="${placeholder || this.#buttonLabel}">
195+
</pf-text-input>
194196
<pf-button
195197
@click="${this.#OnClose}"
196198
?hidden="${this.#hideCloseButton()}"

0 commit comments

Comments
 (0)