Skip to content

Commit ffdea77

Browse files
committed
feat(filter-menu): allow search value override
1 parent 495147f commit ffdea77

File tree

5 files changed

+24
-5
lines changed

5 files changed

+24
-5
lines changed

src/components/ebay-filter-menu-button/component.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,9 @@ interface FilterMenuButtonInput
3434
"form-method"?: string;
3535
disabled?: boolean;
3636
"a11y-text"?: AttrString;
37-
"search-header-placeholder-text"?: string;
38-
"a11y-search-header-clear-text"?: string;
37+
"search-header-value"?: string;
38+
"search-header-placeholder-text"?: AttrString;
39+
"a11y-search-header-clear-text"?: AttrString;
3940
"on-expand"?: () => void;
4041
"on-change"?: (event: FilterMenuButtonEvent) => void;
4142
"on-collapse"?: (event: FilterMenuButtonEvent) => void;

src/components/ebay-filter-menu-button/filter-menu-button.stories.ts

+5
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,11 @@ export default {
6868
category: "@attribute tags",
6969
},
7070
},
71+
searchHeaderValue: {
72+
control: { type: "text" },
73+
description:
74+
"optional value override for the input in the search header",
75+
},
7176
searchHeaderPlaceholderText: {
7277
control: { type: "text" },
7378
description:

src/components/ebay-filter-menu-button/index.marko

+2
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ $ const {
1313
formAction,
1414
formMethod,
1515
items,
16+
searchHeaderValue,
1617
searchHeaderPlaceholderText,
1718
a11ySearchHeaderClearText,
1819
type: inputType,
@@ -48,6 +49,7 @@ $ const {
4849
formMethod=formMethod
4950
footerText=footerText
5051
a11yFooterText=a11yFooterText
52+
searchHeaderValue=searchHeaderValue
5153
searchHeaderPlaceholderText=searchHeaderPlaceholderText
5254
a11ySearchHeaderClearText=a11ySearchHeaderClearText
5355
on-keydown("handleMenuKeydown")

src/components/ebay-filter-menu/component.ts

+9-3
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,9 @@ interface FilterMenuInput
3434
"a11y-footer-text"?: AttrString;
3535
}
3636
>;
37-
"search-header-placeholder-text"?: string;
38-
"a11y-search-header-clear-text"?: string;
37+
"search-header-value"?: string;
38+
"search-header-placeholder-text"?: AttrString;
39+
"a11y-search-header-clear-text"?: AttrString;
3940
"render-body"?: Marko.Body;
4041
"on-footer-click"?: (event: FilterMenuEvent) => void;
4142
"on-form-submit"?: (event: FilterMenuEvent) => void;
@@ -121,7 +122,12 @@ export default class extends MenuUtils<Input, State> {
121122
onInput(input: Input) {
122123
this.state = {
123124
...super.getInputState(input),
124-
searchTerm: this.state ? this.state.searchTerm : "",
125+
searchTerm:
126+
input.searchHeaderValue !== undefined
127+
? input.searchHeaderValue
128+
: this.state
129+
? this.state.searchTerm
130+
: "",
125131
};
126132
}
127133

src/components/ebay-filter-menu/filter-menu.stories.ts

+5
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,11 @@ export default {
5252
control: { type: "text" },
5353
description: "forms `method` attribute",
5454
},
55+
searchHeaderValue: {
56+
control: { type: "text" },
57+
description:
58+
"optional value override for the input in the search header",
59+
},
5560
searchHeaderPlaceholderText: {
5661
control: { type: "text" },
5762
description:

0 commit comments

Comments
 (0)