@searchstax-inc/searchstudio-ux-react 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +116 -4
- package/dist/@searchstax-inc/components/SearchstaxOverviewWidget.d.ts +5 -0
- package/dist/@searchstax-inc/components/SearchstaxPaginationWidget.d.ts +5 -0
- package/dist/@searchstax-inc/components/SearchstaxSortingWidget.d.ts +5 -0
- package/dist/@searchstax-inc/main.d.ts +7 -1
- package/dist/@searchstax-inc/searchstudio-ux-react.cjs +22 -22
- package/dist/@searchstax-inc/searchstudio-ux-react.d.cts +7 -0
- package/dist/@searchstax-inc/searchstudio-ux-react.iife.js +21 -21
- package/dist/@searchstax-inc/searchstudio-ux-react.mjs +1089 -1100
- package/package.json +2 -2
- package/dist/App.d.ts +0 -2
- package/dist/style.css +0 -1
- /package/dist/{components → @searchstax-inc/components}/SearchstaxInputWidget.d.ts +0 -0
- /package/dist/{components → @searchstax-inc/components}/SearchstaxResultWidget.d.ts +0 -0
- /package/dist/{components → @searchstax-inc/components}/SearchstaxWrapper.d.ts +0 -0
- /package/dist/{stores → @searchstax-inc/stores}/searchstaxStore.d.ts +0 -0
package/README.md
CHANGED
|
@@ -325,7 +325,49 @@ example of pagination widget initialization with minimum options
|
|
|
325
325
|
|
|
326
326
|
example of pagination widget initialization with various options
|
|
327
327
|
```
|
|
328
|
+
function paginationTemplate(
|
|
329
|
+
paginationData: IPaginationData | null,
|
|
330
|
+
nextPage: (event: React.MouseEvent<HTMLAnchorElement, MouseEvent>) => void,
|
|
331
|
+
previousPage: (event: React.MouseEvent<HTMLAnchorElement, MouseEvent>) => void
|
|
332
|
+
) {
|
|
333
|
+
return (
|
|
334
|
+
<>
|
|
335
|
+
{paginationData && paginationData?.totalResults !== 0 && (
|
|
336
|
+
<div className="searchstax-pagination-container">
|
|
337
|
+
<div className="searchstax-pagination-content">
|
|
338
|
+
<a
|
|
339
|
+
className="searchstax-pagination-previous"
|
|
340
|
+
style={paginationData?.isFirstPage ? { pointerEvents: "none" } : {}}
|
|
341
|
+
onClick={(e) => {
|
|
342
|
+
previousPage(e);
|
|
343
|
+
}}
|
|
344
|
+
id="searchstax-pagination-previous"
|
|
345
|
+
>
|
|
346
|
+
{" "}
|
|
347
|
+
< Previous{" "}
|
|
348
|
+
</a>
|
|
349
|
+
<div className="searchstax-pagination-details">
|
|
350
|
+
{" "}
|
|
351
|
+
{paginationData?.startResultIndex} - {paginationData?.endResultIndex} of {paginationData?.totalResults}
|
|
352
|
+
</div>
|
|
353
|
+
<a
|
|
354
|
+
className="searchstax-pagination-next"
|
|
355
|
+
style={paginationData?.isLastPage ? { pointerEvents: "none" } : {}}
|
|
356
|
+
onClick={(e) => {
|
|
357
|
+
nextPage(e);
|
|
358
|
+
}}
|
|
359
|
+
id="searchstax-pagination-next"
|
|
360
|
+
>
|
|
361
|
+
Next >
|
|
362
|
+
</a>
|
|
363
|
+
</div>
|
|
364
|
+
</div>
|
|
365
|
+
)}
|
|
366
|
+
</>
|
|
367
|
+
);
|
|
368
|
+
}
|
|
328
369
|
|
|
370
|
+
<SearchstaxPaginationWidget paginationTemplate={paginationTemplate}></SearchstaxPaginationWidget>
|
|
329
371
|
```
|
|
330
372
|
|
|
331
373
|
### Facets Widget ###
|
|
@@ -345,13 +387,54 @@ example of facets widget initialization with template overrides
|
|
|
345
387
|
|
|
346
388
|
example of search feedback widget initialization with minimum options
|
|
347
389
|
```
|
|
348
|
-
|
|
390
|
+
<SearchstaxOverviewWidget></SearchstaxOverviewWidget>
|
|
349
391
|
```
|
|
350
392
|
|
|
351
393
|
|
|
352
394
|
example of search feedback widget initialization with template overrides
|
|
353
395
|
```
|
|
354
|
-
|
|
396
|
+
function searchOverviewTemplate(
|
|
397
|
+
searchFeedbackData: null | ISearchstaxSearchFeedbackData,
|
|
398
|
+
onOriginalQueryClick: (event: React.MouseEvent<HTMLAnchorElement, MouseEvent>) => void
|
|
399
|
+
) {
|
|
400
|
+
return (
|
|
401
|
+
<>
|
|
402
|
+
{searchFeedbackData && searchFeedbackData?.searchExecuted && searchFeedbackData?.totalResults && (
|
|
403
|
+
<>
|
|
404
|
+
Showing{" "}
|
|
405
|
+
<b>
|
|
406
|
+
{searchFeedbackData.startResultIndex} - {searchFeedbackData.endResultIndex}
|
|
407
|
+
</b>{" "}
|
|
408
|
+
of
|
|
409
|
+
<b> {searchFeedbackData.totalResults}</b> results
|
|
410
|
+
{searchFeedbackData.searchTerm && (
|
|
411
|
+
<span>
|
|
412
|
+
for "<b>{searchFeedbackData.searchTerm}</b>"{" "}
|
|
413
|
+
</span>
|
|
414
|
+
)}
|
|
415
|
+
<div className="searchstax-feedback-container-suggested">
|
|
416
|
+
{searchFeedbackData.autoCorrectedQuery && (
|
|
417
|
+
<div>
|
|
418
|
+
{" "}
|
|
419
|
+
Search instead for{" "}
|
|
420
|
+
<a
|
|
421
|
+
href="#"
|
|
422
|
+
onClick={(e) => {
|
|
423
|
+
onOriginalQueryClick(e);
|
|
424
|
+
}}
|
|
425
|
+
className="searchstax-feedback-original-query"
|
|
426
|
+
>
|
|
427
|
+
{searchFeedbackData.originalQuery}
|
|
428
|
+
</a>
|
|
429
|
+
</div>
|
|
430
|
+
)}
|
|
431
|
+
</div>
|
|
432
|
+
</>
|
|
433
|
+
)}
|
|
434
|
+
</>
|
|
435
|
+
);
|
|
436
|
+
}
|
|
437
|
+
<SearchstaxOverviewWidget searchOverviewTemplate={searchOverviewTemplate}></SearchstaxOverviewWidget>
|
|
355
438
|
```
|
|
356
439
|
|
|
357
440
|
## RelatedSearches widget
|
|
@@ -387,13 +470,42 @@ example of search feedback widget initialization with template overrides
|
|
|
387
470
|
|
|
388
471
|
example of sorting widget initialization with minimum options
|
|
389
472
|
```
|
|
390
|
-
|
|
473
|
+
<SearchstaxSortingWidget></SearchstaxSortingWidget>
|
|
391
474
|
```
|
|
392
475
|
|
|
393
476
|
|
|
394
477
|
example of sorting widget initialization with template override
|
|
395
478
|
```
|
|
396
|
-
|
|
479
|
+
function searchSortingTemplate(
|
|
480
|
+
sortingData: null | ISearchstaxSearchSortingData,
|
|
481
|
+
orderChange: (value: string) => void,
|
|
482
|
+
selectedSorting: string
|
|
483
|
+
) {
|
|
484
|
+
return (
|
|
485
|
+
<>
|
|
486
|
+
{sortingData && sortingData?.searchExecuted && sortingData?.hasResultsOrExternalPromotions && (
|
|
487
|
+
<div className="searchstax-sorting-container">
|
|
488
|
+
<label className="searchstax-sorting-label" htmlFor="sort-by">
|
|
489
|
+
Sort By
|
|
490
|
+
</label>
|
|
491
|
+
<select
|
|
492
|
+
id="searchstax-search-order-select"
|
|
493
|
+
className="searchstax-search-order-select"
|
|
494
|
+
value={selectedSorting}
|
|
495
|
+
onChange={(e) => {
|
|
496
|
+
orderChange(e.target.value);
|
|
497
|
+
}}
|
|
498
|
+
>
|
|
499
|
+
<option value=""> Relevance </option>
|
|
500
|
+
<option value="date desc"> Newest Content </option>
|
|
501
|
+
<option value="date asc"> Oldest Content </option>
|
|
502
|
+
</select>
|
|
503
|
+
</div>
|
|
504
|
+
)}
|
|
505
|
+
</>
|
|
506
|
+
);
|
|
507
|
+
}
|
|
508
|
+
<SearchstaxSortingWidget searchSortingTemplate={searchSortingTemplate}></SearchstaxSortingWidget>
|
|
397
509
|
```
|
|
398
510
|
|
|
399
511
|
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { ISearchstaxSearchFeedbackData } from "@searchstax-inc/searchstudio-ux-js";
|
|
2
|
+
declare function SearchstaxOverviewWidget(props: {
|
|
3
|
+
searchOverviewTemplate?: (searchFeedbackData: null | ISearchstaxSearchFeedbackData, onOriginalQueryClick: (event: React.MouseEvent<HTMLAnchorElement, MouseEvent>) => void) => React.ReactElement;
|
|
4
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
export default SearchstaxOverviewWidget;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { IPaginationData } from "@searchstax-inc/searchstudio-ux-js";
|
|
2
|
+
declare function SearchstaxPaginationWidget(props: {
|
|
3
|
+
paginationTemplate?: (paginationData: IPaginationData | null, nextPage: (event: React.MouseEvent<HTMLAnchorElement, MouseEvent>) => void, previousPage: (event: React.MouseEvent<HTMLAnchorElement, MouseEvent>) => void) => React.ReactElement;
|
|
4
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
export default SearchstaxPaginationWidget;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { ISearchstaxSearchSortingData } from "@searchstax-inc/searchstudio-ux-js";
|
|
2
|
+
declare function SearchstaxSortingWidget(props: {
|
|
3
|
+
searchSortingTemplate?: (sortingData: null | ISearchstaxSearchSortingData, orderChange: (value: string) => void, selectedSorting: string) => React.ReactElement;
|
|
4
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
export default SearchstaxSortingWidget;
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
import SearchstaxInputWidget from "./components/SearchstaxInputWidget";
|
|
2
|
+
import SearchstaxWrapper from "./components/SearchstaxWrapper";
|
|
3
|
+
import SearchstaxResultWidget from "./components/SearchstaxResultWidget";
|
|
4
|
+
import SearchstaxPaginationWidget from "./components/SearchstaxPaginationWidget";
|
|
5
|
+
import SearchstaxSortingWidget from "./components/SearchstaxSortingWidget";
|
|
6
|
+
import SearchstaxOverviewWidget from "./components/SearchstaxOverviewWidget";
|
|
7
|
+
export { SearchstaxWrapper, SearchstaxResultWidget, SearchstaxInputWidget, SearchstaxPaginationWidget, SearchstaxSortingWidget, SearchstaxOverviewWidget };
|