Skip to content

Commit fd562de

Browse files
Yannick CroissantHaroenv
Yannick Croissant
andauthoredApr 6, 2021
feat(ts): convert RefinementList component to TypeScript (#4702)
* feat(ts): convert rating-menu to TypeScript * feat(ts): convert RefinementList to TypeScript * fixup! feat(ts): convert RefinementList to TypeScript * fixup! feat(ts): convert RefinementList to TypeScript * fixup! fixup! feat(ts): convert RefinementList to TypeScript * Update src/components/RefinementList/RefinementList.tsx Co-authored-by: Haroen Viaene <hello@haroen.me> * fixup! feat(ts): convert RefinementList to TypeScript * fixup! feat(ts): convert RefinementList to TypeScript Co-authored-by: Haroen Viaene <hello@haroen.me>
1 parent e73257a commit fd562de

File tree

12 files changed

+481
-296
lines changed

12 files changed

+481
-296
lines changed
 
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,102 @@
11
/** @jsx h */
22

3-
import { h, Component } from 'preact';
4-
import PropTypes from 'prop-types';
3+
import { h, createRef, Component } from 'preact';
54
import cx from 'classnames';
65
import { isSpecialClick, isEqual } from '../../lib/utils';
6+
import { PreparedTemplateProps } from '../../lib/utils/prepareTemplateProps';
77
import Template from '../Template/Template';
88
import RefinementListItem from './RefinementListItem';
99
import SearchBox from '../SearchBox/SearchBox';
10+
import { RefinementListItem as TRefinementListItem } from '../../connectors/refinement-list/connectRefinementList';
11+
import { SearchBoxTemplates } from '../../widgets/search-box/types';
12+
import { CreateURL, Templates } from '../../types';
1013

11-
class RefinementList extends Component {
12-
constructor(props) {
14+
type CSSClasses = {
15+
searchable?: Record<string, string>;
16+
[key: string]: any;
17+
};
18+
19+
export type RefinementListProps<
20+
TTemplates extends Templates,
21+
TCSSClasses extends CSSClasses
22+
> = {
23+
createURL: CreateURL<string>;
24+
cssClasses: TCSSClasses;
25+
depth?: number;
26+
facetValues?: TRefinementListItem[];
27+
attribute?: string;
28+
templateProps?: PreparedTemplateProps<TTemplates>;
29+
searchBoxTemplateProps?: PreparedTemplateProps<SearchBoxTemplates>;
30+
toggleRefinement: (value: string) => void;
31+
searchFacetValues?: (query: string) => void;
32+
searchPlaceholder?: string;
33+
isFromSearch?: boolean;
34+
showMore?: boolean;
35+
toggleShowMore?: () => void;
36+
isShowingMore?: boolean;
37+
hasExhaustiveItems?: boolean;
38+
canToggleShowMore?: boolean;
39+
searchIsAlwaysActive?: boolean;
40+
className?: string;
41+
children?: h.JSX.Element;
42+
};
43+
44+
const defaultProps = {
45+
cssClasses: {},
46+
depth: 0,
47+
};
48+
49+
type RefinementListPropsWithDefaultProps<
50+
TTemplates extends Templates,
51+
TCSSClasses extends CSSClasses
52+
> = RefinementListProps<TTemplates, TCSSClasses> &
53+
Readonly<typeof defaultProps>;
54+
55+
type RefinementListItemTemplateData<
56+
TTemplates extends Templates,
57+
TCSSClasses extends CSSClasses
58+
> = TRefinementListItem & {
59+
url: string;
60+
} & Pick<
61+
RefinementListProps<TTemplates, TCSSClasses>,
62+
'attribute' | 'cssClasses' | 'isFromSearch'
63+
>;
64+
65+
class RefinementList<
66+
TTemplates extends Templates,
67+
TCSSClasses extends CSSClasses
68+
> extends Component<
69+
RefinementListPropsWithDefaultProps<TTemplates, TCSSClasses>
70+
> {
71+
public static defaultProps = defaultProps;
72+
73+
private searchBox = createRef<SearchBox>();
74+
75+
public constructor(
76+
props: RefinementListPropsWithDefaultProps<TTemplates, TCSSClasses>
77+
) {
1378
super(props);
1479
this.handleItemClick = this.handleItemClick.bind(this);
1580
}
1681

17-
shouldComponentUpdate(nextProps, nextState) {
18-
const isStateDifferent = this.state !== nextState;
82+
public shouldComponentUpdate(
83+
nextProps: RefinementListPropsWithDefaultProps<TTemplates, TCSSClasses>
84+
) {
1985
const areFacetValuesDifferent = !isEqual(
2086
this.props.facetValues,
2187
nextProps.facetValues
2288
);
2389

24-
return isStateDifferent || areFacetValuesDifferent;
90+
return areFacetValuesDifferent;
2591
}
2692

27-
refine(facetValueToRefine, isRefined) {
28-
this.props.toggleRefinement(facetValueToRefine, isRefined);
93+
private refine(facetValueToRefine: string) {
94+
this.props.toggleRefinement(facetValueToRefine);
2995
}
3096

31-
_generateFacetItem(facetValue) {
97+
private _generateFacetItem(facetValue: TRefinementListItem) {
3298
let subItems;
33-
const hasChildren = facetValue.data && facetValue.data.length > 0;
34-
if (hasChildren) {
99+
if (facetValue.data && facetValue.data.length > 0) {
35100
const { root, ...cssClasses } = this.props.cssClasses;
36101
subItems = (
37102
<RefinementList
@@ -46,7 +111,10 @@ class RefinementList extends Component {
46111
}
47112

48113
const url = this.props.createURL(facetValue.value);
49-
const templateData = {
114+
const templateData: RefinementListItemTemplateData<
115+
TTemplates,
116+
TCSSClasses
117+
> = {
50118
...facetValue,
51119
url,
52120
attribute: this.props.attribute,
@@ -63,18 +131,21 @@ class RefinementList extends Component {
63131
key += `/${facetValue.count}`;
64132
}
65133

134+
const refinementListItemClassName = cx(this.props.cssClasses.item, {
135+
[this.props.cssClasses.selectedItem]: facetValue.isRefined,
136+
[this.props.cssClasses.disabledItem]: !facetValue.count,
137+
[this.props.cssClasses.parentItem]:
138+
facetValue.data && facetValue.data.length > 0,
139+
});
140+
66141
return (
67142
<RefinementListItem
68143
templateKey="item"
69144
key={key}
70145
facetValueToRefine={facetValue.value}
71146
handleClick={this.handleItemClick}
72147
isRefined={facetValue.isRefined}
73-
className={cx(this.props.cssClasses.item, {
74-
[this.props.cssClasses.selectedItem]: facetValue.isRefined,
75-
[this.props.cssClasses.disabledItem]: !facetValue.count,
76-
[this.props.cssClasses.parentItem]: hasChildren,
77-
})}
148+
className={refinementListItemClassName}
78149
subItems={subItems}
79150
templateData={templateData}
80151
templateProps={this.props.templateProps}
@@ -97,13 +168,28 @@ class RefinementList extends Component {
97168
//
98169
// Finally, we always stop propagation of the event to avoid multiple levels RefinementLists to fail: click
99170
// on child would click on parent also
100-
handleItemClick({ facetValueToRefine, originalEvent, isRefined }) {
171+
private handleItemClick({
172+
facetValueToRefine,
173+
isRefined,
174+
originalEvent,
175+
}: {
176+
facetValueToRefine: string;
177+
isRefined: boolean;
178+
originalEvent: MouseEvent;
179+
}) {
101180
if (isSpecialClick(originalEvent)) {
102181
// do not alter the default browser behavior
103182
// if one special key is down
104183
return;
105184
}
106185

186+
if (
187+
!(originalEvent.target instanceof HTMLElement) ||
188+
!(originalEvent.target.parentNode instanceof HTMLElement)
189+
) {
190+
return;
191+
}
192+
107193
if (
108194
isRefined &&
109195
originalEvent.target.parentNode.querySelector(
@@ -115,7 +201,7 @@ class RefinementList extends Component {
115201
}
116202

117203
if (originalEvent.target.tagName === 'INPUT') {
118-
this.refine(facetValueToRefine, isRefined);
204+
this.refine(facetValueToRefine);
119205
return;
120206
}
121207

@@ -130,39 +216,35 @@ class RefinementList extends Component {
130216
return;
131217
}
132218

133-
if (parent.tagName === 'A' && parent.href) {
219+
if (parent.tagName === 'A' && (parent as HTMLAnchorElement).href) {
134220
originalEvent.preventDefault();
135221
}
136222

137-
parent = parent.parentNode;
223+
parent = parent.parentNode as HTMLElement;
138224
}
139225

140226
originalEvent.stopPropagation();
141227

142-
this.refine(facetValueToRefine, isRefined);
228+
this.refine(facetValueToRefine);
143229
}
144230

145-
componentWillReceiveProps(nextProps) {
146-
if (this.searchBox && !nextProps.isFromSearch) {
147-
this.searchBox.resetInput();
231+
public componentWillReceiveProps(
232+
nextProps: RefinementListPropsWithDefaultProps<TTemplates, TCSSClasses>
233+
) {
234+
if (this.searchBox.current && !nextProps.isFromSearch) {
235+
this.searchBox.current.resetInput();
148236
}
149237
}
150238

151-
refineFirstValue() {
152-
const firstValue = this.props.facetValues[0];
239+
private refineFirstValue() {
240+
const firstValue = this.props.facetValues && this.props.facetValues[0];
153241
if (firstValue) {
154242
const actualValue = firstValue.value;
155243
this.props.toggleRefinement(actualValue);
156244
}
157245
}
158246

159-
render() {
160-
// Adding `-lvl0` classes
161-
const cssClassList = cx(this.props.cssClasses.list, {
162-
[`${this.props.cssClasses.depth}${this.props.depth}`]: this.props
163-
.cssClasses.depth,
164-
});
165-
247+
public render() {
166248
const showMoreButtonClassName = cx(this.props.cssClasses.showMore, {
167249
[this.props.cssClasses.disabledShowMore]: !(
168250
this.props.showMore === true && this.props.canToggleShowMore
@@ -191,18 +273,22 @@ class RefinementList extends Component {
191273

192274
const templates = this.props.searchBoxTemplateProps
193275
? this.props.searchBoxTemplateProps.templates
194-
: {};
276+
: undefined;
195277

196278
const searchBox = this.props.searchFacetValues && (
197279
<div className={this.props.cssClasses.searchBox}>
198280
<SearchBox
199-
ref={searchBoxRef => (this.searchBox = searchBoxRef)}
281+
ref={this.searchBox}
200282
placeholder={this.props.searchPlaceholder}
201283
disabled={shouldDisableSearchBox}
202-
cssClasses={this.props.cssClasses.searchable}
284+
cssClasses={this.props.cssClasses.searchable!}
203285
templates={templates}
204-
onChange={event => this.props.searchFacetValues(event.target.value)}
205-
onReset={() => this.props.searchFacetValues('')}
286+
onChange={(event: Event) =>
287+
this.props.searchFacetValues!(
288+
(event.target as HTMLInputElement).value
289+
)
290+
}
291+
onReset={() => this.props.searchFacetValues!('')}
206292
onSubmit={() => this.refineFirstValue()}
207293
// This sets the search box to a controlled state because
208294
// we don't rely on the `refine` prop but on `onChange`.
@@ -213,32 +299,32 @@ class RefinementList extends Component {
213299

214300
const facetValues = this.props.facetValues &&
215301
this.props.facetValues.length > 0 && (
216-
<ul className={cssClassList}>
302+
<ul className={this.props.cssClasses.list}>
217303
{this.props.facetValues.map(this._generateFacetItem, this)}
218304
</ul>
219305
);
220306

221307
const noResults = this.props.searchFacetValues &&
222308
this.props.isFromSearch &&
223-
this.props.facetValues.length === 0 && (
309+
(!this.props.facetValues || this.props.facetValues.length === 0) && (
224310
<Template
225311
{...this.props.templateProps}
226312
templateKey="searchableNoResults"
227313
rootProps={{ className: this.props.cssClasses.noResults }}
228314
/>
229315
);
230316

317+
const rootClassName = cx(
318+
this.props.cssClasses.root,
319+
{
320+
[this.props.cssClasses.noRefinementRoot]:
321+
!this.props.facetValues || this.props.facetValues.length === 0,
322+
},
323+
this.props.className
324+
);
325+
231326
return (
232-
<div
233-
className={cx(
234-
this.props.cssClasses.root,
235-
{
236-
[this.props.cssClasses.noRefinementRoot]:
237-
!this.props.facetValues || this.props.facetValues.length === 0,
238-
},
239-
this.props.className
240-
)}
241-
>
327+
<div className={rootClassName}>
242328
{this.props.children}
243329
{searchBox}
244330
{facetValues}
@@ -249,61 +335,4 @@ class RefinementList extends Component {
249335
}
250336
}
251337

252-
RefinementList.propTypes = {
253-
Template: PropTypes.func,
254-
createURL: PropTypes.func,
255-
cssClasses: PropTypes.shape({
256-
depth: PropTypes.string,
257-
root: PropTypes.string,
258-
noRefinementRoot: PropTypes.string,
259-
list: PropTypes.string,
260-
item: PropTypes.string,
261-
selectedItem: PropTypes.string,
262-
parentItem: PropTypes.string,
263-
childList: PropTypes.string,
264-
searchBox: PropTypes.string,
265-
label: PropTypes.string,
266-
checkbox: PropTypes.string,
267-
labelText: PropTypes.string,
268-
count: PropTypes.string,
269-
noResults: PropTypes.string,
270-
showMore: PropTypes.string,
271-
disabledShowMore: PropTypes.string,
272-
disabledItem: PropTypes.string,
273-
searchable: PropTypes.shape({
274-
root: PropTypes.string,
275-
form: PropTypes.string,
276-
input: PropTypes.string,
277-
submit: PropTypes.string,
278-
submitIcon: PropTypes.string,
279-
reset: PropTypes.string,
280-
resetIcon: PropTypes.string,
281-
loadingIndicator: PropTypes.string,
282-
loadingIcon: PropTypes.string,
283-
}),
284-
}).isRequired,
285-
depth: PropTypes.number,
286-
facetValues: PropTypes.array,
287-
attribute: PropTypes.string,
288-
templateProps: PropTypes.object.isRequired,
289-
searchBoxTemplateProps: PropTypes.object,
290-
toggleRefinement: PropTypes.func.isRequired,
291-
searchFacetValues: PropTypes.func,
292-
searchPlaceholder: PropTypes.string,
293-
isFromSearch: PropTypes.bool,
294-
showMore: PropTypes.bool,
295-
toggleShowMore: PropTypes.func,
296-
isShowingMore: PropTypes.bool,
297-
hasExhaustiveItems: PropTypes.bool,
298-
canToggleShowMore: PropTypes.bool,
299-
searchIsAlwaysActive: PropTypes.bool,
300-
className: PropTypes.string,
301-
children: PropTypes.element,
302-
};
303-
304-
RefinementList.defaultProps = {
305-
cssClasses: {},
306-
depth: 0,
307-
};
308-
309338
export default RefinementList;

‎src/components/RefinementList/RefinementListItem.js ‎src/components/RefinementList/RefinementListItem.tsx

+16-13
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,23 @@
11
/** @jsx h */
22

33
import { h } from 'preact';
4-
import PropTypes from 'prop-types';
54
import Template from '../Template/Template';
65

6+
export type RefinementListItemProps = {
7+
facetValueToRefine: string;
8+
handleClick: (args: {
9+
facetValueToRefine: string;
10+
isRefined: boolean;
11+
originalEvent: MouseEvent;
12+
}) => void;
13+
isRefined: boolean;
14+
subItems?: h.JSX.Element;
15+
templateData: Record<string, any>;
16+
templateKey: string;
17+
templateProps?: Record<string, any>;
18+
className: string;
19+
};
20+
721
function RefinementListItem({
822
className,
923
handleClick,
@@ -13,7 +27,7 @@ function RefinementListItem({
1327
templateKey,
1428
templateData,
1529
subItems,
16-
}) {
30+
}: RefinementListItemProps) {
1731
return (
1832
<li
1933
className={className}
@@ -35,15 +49,4 @@ function RefinementListItem({
3549
);
3650
}
3751

38-
RefinementListItem.propTypes = {
39-
facetValueToRefine: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
40-
handleClick: PropTypes.func.isRequired,
41-
isRefined: PropTypes.bool.isRequired,
42-
subItems: PropTypes.object,
43-
templateData: PropTypes.object.isRequired,
44-
templateKey: PropTypes.string.isRequired,
45-
templateProps: PropTypes.object.isRequired,
46-
className: PropTypes.string.isRequired,
47-
};
48-
4952
export default RefinementListItem;

‎src/components/RefinementList/__tests__/RefinementList-test.js ‎src/components/RefinementList/__tests__/RefinementList-test.tsx

+261-131
Large diffs are not rendered by default.

‎src/components/RefinementList/__tests__/RefinementListItem-test.js ‎src/components/RefinementList/__tests__/RefinementListItem-test.tsx

+12-6
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,13 @@
22

33
import { h } from 'preact';
44
import { shallow } from 'enzyme';
5-
import RefinementListItem from '../RefinementListItem';
5+
import { ReactElementLike } from 'prop-types';
6+
import RefinementListItem, {
7+
RefinementListItemProps,
8+
} from '../RefinementListItem';
69

710
describe('RefinementListItem', () => {
8-
const props = {
9-
facetValue: 'Hello',
11+
const props: RefinementListItemProps = {
1012
facetValueToRefine: 'wi',
1113
isRefined: false,
1214
handleClick: jest.fn(),
@@ -18,7 +20,9 @@ describe('RefinementListItem', () => {
1820
};
1921

2022
it('renders an item', () => {
21-
const wrapper = shallow(<RefinementListItem {...props} />);
23+
const wrapper = shallow(
24+
(<RefinementListItem {...props} />) as ReactElementLike
25+
);
2226
expect(wrapper).toMatchSnapshot();
2327
});
2428

@@ -28,7 +32,9 @@ describe('RefinementListItem', () => {
2832
expect(props.handleClick).toHaveBeenCalledTimes(1);
2933
});
3034

31-
function render(askedProps) {
32-
return shallow(<RefinementListItem {...askedProps} />);
35+
function render(askedProps: RefinementListItemProps) {
36+
return shallow(
37+
(<RefinementListItem {...askedProps} />) as ReactElementLike
38+
);
3339
}
3440
});

‎src/components/RefinementList/types.ts

-7
This file was deleted.

‎src/connectors/refinement-list/connectRefinementList.ts

+4
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,10 @@ export type RefinementListItem = {
5151
* Indicates if the list item is refined.
5252
*/
5353
isRefined: boolean;
54+
/**
55+
* List item childrens.
56+
*/
57+
data?: RefinementListItem[];
5458
};
5559

5660
export type RefinementListConnectorParams = {

‎src/widgets/numeric-menu/__tests__/numeric-menu-test.ts

+16-6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { render as preactRender, VNode } from 'preact';
2-
import numericMenu from '../numeric-menu';
2+
import defaultTemplates from '../defaultTemplates';
3+
import numericMenu, { NumericMenuCSSClasses } from '../numeric-menu';
34
import algoliasearchHelper, {
45
SearchParameters,
56
SearchResults,
@@ -13,7 +14,7 @@ import {
1314
} from '../../../../test/mock/createWidget';
1415
import { createSingleSearchResponse } from '../../../../test/mock/createAPIResponse';
1516
import { createSearchClient } from '../../../../test/mock/createSearchClient';
16-
import { RefinementListProps } from '../../../components/RefinementList/types';
17+
import { RefinementListProps } from '../../../components/RefinementList/RefinementList';
1718

1819
const render = castToJestMock(preactRender);
1920
jest.mock('preact', () => {
@@ -85,8 +86,12 @@ describe('numericMenu()', () => {
8586
widget.render!(createRenderOptions({ state, results }));
8687
widget.render!(createRenderOptions({ state, results }));
8788

88-
const firstRender = render.mock.calls[0][0] as VNode<RefinementListProps>;
89-
const secondRender = render.mock.calls[1][0] as VNode<RefinementListProps>;
89+
const firstRender = render.mock.calls[0][0] as VNode<
90+
RefinementListProps<typeof defaultTemplates, NumericMenuCSSClasses>
91+
>;
92+
const secondRender = render.mock.calls[1][0] as VNode<
93+
RefinementListProps<typeof defaultTemplates, NumericMenuCSSClasses>
94+
>;
9095
const firstContainer = render.mock.calls[0][1];
9196
const secondContainer = render.mock.calls[1][1];
9297

@@ -109,8 +114,13 @@ describe('numericMenu()', () => {
109114
widget.init!(createInitOptions({ helper }));
110115
widget.render!(createRenderOptions({ state, results }));
111116

112-
const firstRender = render.mock.calls[0][0] as VNode<RefinementListProps>;
113-
const { facetValues } = firstRender.props as RefinementListProps;
117+
const firstRender = render.mock.calls[0][0] as VNode<
118+
RefinementListProps<typeof defaultTemplates, NumericMenuCSSClasses>
119+
>;
120+
const { facetValues } = firstRender.props as RefinementListProps<
121+
typeof defaultTemplates,
122+
NumericMenuCSSClasses
123+
>;
114124

115125
expect(facetValues).toEqual([
116126
{

‎src/widgets/numeric-menu/numeric-menu.tsx

+7-1
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,12 @@ export type NumericMenuCSSClasses = {
9393
radio?: string | string[];
9494
};
9595

96+
type NumericMenuRendererCSSClasses = Required<
97+
{
98+
[key in keyof NumericMenuCSSClasses]: string;
99+
}
100+
>;
101+
96102
export type NumericMenuTemplates = {
97103
/**
98104
* Item template, provided with `label` (the name in the configuration), `isRefined`, `url`, `value` (the setting for the filter) data properties.
@@ -129,7 +135,7 @@ export type NumericMenuTemplates = {
129135
/**
130136
* The CSS classes provided to the widget.
131137
*/
132-
cssClasses: NumericMenuCSSClasses;
138+
cssClasses: NumericMenuRendererCSSClasses;
133139
}>;
134140
};
135141

‎src/widgets/rating-menu/rating-menu.tsx

+5-1
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,10 @@ export type RatingMenuCSSClasses = {
7878
count: string | string[];
7979
};
8080

81+
type RatingMenuRendererCSSClasses = {
82+
[key in keyof RatingMenuCSSClasses]: string;
83+
};
84+
8185
export type RatingMenuWidgetParams = {
8286
/**
8387
* Place where to insert the widget in your webpage.
@@ -108,7 +112,7 @@ const renderer = ({
108112
renderState,
109113
}: {
110114
containerNode: HTMLElement;
111-
cssClasses: Record<string, string>;
115+
cssClasses: RatingMenuRendererCSSClasses;
112116
templates: Partial<RatingMenuTemplates>;
113117
renderState: { templateProps?: PreparedTemplateProps<RatingMenuTemplates> };
114118
}) => (

‎src/widgets/refinement-list/refinement-list.tsx

+22-22
Original file line numberDiff line numberDiff line change
@@ -95,64 +95,64 @@ type RefinementListOwnCSSClasses = {
9595
/**
9696
* CSS class to add to the root element.
9797
*/
98-
root: string;
98+
root: string | string[];
9999
/**
100100
* CSS class to add to the root element when no refinements.
101101
*/
102-
noRefinementRoot: string;
102+
noRefinementRoot: string | string[];
103103
/**
104104
* CSS class to add to the root element with no results.
105105
*/
106-
noResults: string;
106+
noResults: string | string[];
107107
/**
108108
* CSS class to add to the list element.
109109
*/
110-
list: string;
110+
list: string | string[];
111111
/**
112112
* CSS class to add to each item element.
113113
*/
114-
item: string;
114+
item: string | string[];
115115
/**
116116
* CSS class to add to each selected element.
117117
*/
118-
selectedItem: string;
118+
selectedItem: string | string[];
119119
/**
120120
* CSS class to add to each label element (when using the default template).
121121
*/
122-
label: string;
122+
label: string | string[];
123123
/**
124124
* CSS class to add to each checkbox element (when using the default template).
125125
*/
126-
checkbox: string;
126+
checkbox: string | string[];
127127
/**
128128
* CSS class to add to each label text element.
129129
*/
130-
labelText: string;
130+
labelText: string | string[];
131131
/**
132132
* CSS class to add to the show more element
133133
*/
134-
showMore: string;
134+
showMore: string | string[];
135135
/**
136136
* CSS class to add to the disabled show more element
137137
*/
138-
disabledShowMore: string;
138+
disabledShowMore: string | string[];
139139
/**
140140
* CSS class to add to each count element (when using the default template).
141141
*/
142-
count: string;
142+
count: string | string[];
143143
};
144144

145145
type RefinementListSearchableCSSClasses = {
146-
searchBox: string;
147-
searchableRoot: string;
148-
searchableForm: string;
149-
searchableInput: string;
150-
searchableSubmit: string;
151-
searchableSubmitIcon: string;
152-
searchableReset: string;
153-
searchableResetIcon: string;
154-
searchableLoadingIndicator: string;
155-
searchableLoadingIcon: string;
146+
searchBox: string | string[];
147+
searchableRoot: string | string[];
148+
searchableForm: string | string[];
149+
searchableInput: string | string[];
150+
searchableSubmit: string | string[];
151+
searchableSubmitIcon: string | string[];
152+
searchableReset: string | string[];
153+
searchableResetIcon: string | string[];
154+
searchableLoadingIndicator: string | string[];
155+
searchableLoadingIcon: string | string[];
156156
};
157157

158158
export type RefinementListCSSClasses = RefinementListOwnCSSClasses &

0 commit comments

Comments
 (0)
Please sign in to comment.