Skip to content

Commit 1035574

Browse files
committed
chore: variable added for listbox max-height
1 parent 0333d28 commit 1035574

File tree

3 files changed

+23
-29
lines changed

3 files changed

+23
-29
lines changed

elements/pf-search-input/docs/pf-search-input.md

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -77,17 +77,16 @@ Listbox options use the [APG's Roving tabindex](https://www.w3.org/WAI/ARIA/apg/
7777

7878
{% endband %}
7979

80-
81-
82-
83-
{% renderSlots %}{% endrenderSlots %}
84-
85-
{% renderAttributes %}{% endrenderAttributes %}
86-
87-
{% renderMethods %}{% endrenderMethods %}
88-
89-
{% renderEvents %}{% endrenderEvents %}
90-
91-
{% renderCssCustomProperties %}{% endrenderCssCustomProperties %}
92-
93-
{% renderCssParts %}{% endrenderCssParts %}
80+
{% renderSlots for="pf-search-input", header="Slots on `pf-search-input`" %}{% endrenderSlots %}
81+
{% renderAttributes for="pf-search-input", header="Attributes on `pf-search-input`" %}{% endrenderAttributes %}
82+
{% renderMethods for="pf-search-input", header="Methods on `pf-search-input`" %}{% endrenderMethods %}
83+
{% renderEvents for="pf-search-input", header="Events on `pf-search-input`" %}{% endrenderEvents %}
84+
{% renderCssCustomProperties for="pf-search-input", header="CSS Custom Properties on `pf-search-input`" %}{% endrenderCssCustomProperties %}
85+
{% renderCssParts for="pf-search-input", header="CSS Parts on `pf-search-input`" %}{% endrenderCssParts %}
86+
87+
{% renderSlots for="pf-option", header="Slots on `pf-option`" %}{% endrenderSlots %}
88+
{% renderAttributes for="pf-option", header="Attributes on `pf-option`" %}{% endrenderAttributes %}
89+
{% renderMethods for="pf-option", header="Methods on `pf-option`" %}{% endrenderMethods %}
90+
{% renderEvents for="pf-option", header="Events on `pf-option`" %}{% endrenderEvents %}
91+
{% renderCssCustomProperties for="pf-option", header="CSS Custom Properties on `pf-option`" %}{% endrenderCssCustomProperties %}
92+
{% renderCssParts for="pf-option", header="CSS Parts on `pf-option`" %}{% endrenderCssParts %}

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

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -68,19 +68,15 @@
6868
--pf-c-search-input__toggle-clear--toggle-button--PaddingLeft: var(--pf-global--spacer--sm, 0.5rem);
6969
--pf-c-search-input__toggle-button--Color: var(--pf-global--Color--100, #151515);
7070
--pf-c-search-input__list-item--m-loading--PaddingTop: var(--pf-global--spacer--sm, 0.5rem);
71-
72-
/* --pf-c-search-input__toggle--FontSize: var(--pf-global--FontSize--md, 1rem);
73-
--pf-c-search-input__toggle--FontWeight: var(--pf-global--FontWeight--normal, 400);
74-
--pf-c-search-input__toggle--LineHeight: var(--pf-global--LineHeight--md, 1.5);
75-
--pf-c-search-input__toggle--BackgroundColor: var(--pf-global--BackgroundColor--100, #fff); */
71+
--pf-c-search-input__menu-content--MaxHeight: 20rem;
7672
}
7773

7874
:host,
7975
#outer {
8076
display: flex;
8177
flex-direction: column;
8278
align-items: stretch;
83-
width: fit-content;
79+
width: 100%;
8480
}
8581

8682
:host([hidden]),
@@ -113,7 +109,7 @@
113109
#outer.expanded #listbox-container {
114110
opacity: 1;
115111
z-index: 9999 !important;
116-
max-height: 300px;
112+
max-height: var(--pf-c-search-input__menu-content--MaxHeight, 20rem);
117113
overflow: hidden;
118114
}
119115

@@ -158,10 +154,9 @@
158154
color: var(--pf-global--Color--dark-200, #6a6e73) !important;
159155
background-color: var(--pf-theme--color--surface--lighter, #f0f0f0) !important;
160156
border-color: var(--pf-theme--color--surface--lighter, #f0f0f0) !important;
157+
caret-color: transparent;
161158
}
162159

163-
164-
/* #toggle-button, */
165160
#toggle-input {
166161
background: transparent;
167162
border: none;
@@ -172,7 +167,7 @@
172167

173168
#toggle-input {
174169
justify-content: space-between;
175-
min-width: calc(100% - 33px);
170+
width: 100%;
176171
box-sizing: border-box;
177172
height: 2.25rem;
178173
}
@@ -298,10 +293,10 @@ div.search-icon {
298293

299294
&::after {
300295
content: '';
301-
width: 2.25rem;
296+
width: 36px;
302297
height: var(--pf-global--spacer--xs, 0.125rem);
303298
bottom: 0px;
304-
left: -3px;
299+
left: 0px;
305300
background-color: var(--pf-theme--color--accent, #0066cc);
306301
position: absolute;
307302
}

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ export class PfSearchChangeEvent extends Event {
100100
* @cssprop [--pf-c-search-input__toggle-clear--toggle-button--PaddingLeft=var(--pf-global--spacer--sm, 0.5rem)]
101101
* @cssprop [--pf-c-search-input__toggle-button--Color=var(--pf-global--Color--100, #151515)]
102102
* @cssprop [--pf-c-search-input__list-item--m-loading--PaddingTop=var(--pf-global--spacer--sm, 0.5rem)]
103+
* @cssprop [--pf-c-search-input__menu-content--MaxHeight=20rem;]
103104
**/
104105
@customElement('pf-search-input')
105106
export class PfSearchInput extends LitElement {
@@ -432,9 +433,8 @@ export class PfSearchInput extends LitElement {
432433

433434
#setItemActive(item: PfOption, active: boolean) {
434435
item.active = active;
435-
if (this.expanded) {
436-
const activeOption = this.querySelector('pf-option[active]');
437-
activeOption?.scrollIntoView({ behavior: 'auto', block: 'nearest', inline: 'nearest' });
436+
if (this.expanded && active) {
437+
item?.scrollIntoView({ behavior: 'auto', block: 'nearest', inline: 'nearest' });
438438
}
439439
}
440440
}

0 commit comments

Comments
 (0)