hds-web 1.16.1 → 1.16.3
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/dist/index.css +1 -1
- package/dist/index.es.css +1 -1
- package/dist/index.es.js +5 -5
- package/dist/index.js +5 -5
- package/package.json +1 -1
- package/src/HDS/assets/icons/search-sm.svg +1 -1
- package/src/HDS/components/Cards/Menu/flyoutA.js +16 -16
- package/src/HDS/components/Headers/v3Header.js +61 -57
- package/src/HDS/helpers/AlgoliaSearch/constants.js +48 -0
- package/src/HDS/helpers/AlgoliaSearch/index.js +1 -0
- package/src/HDS/helpers/AlgoliaSearch/search.js +40 -0
- package/src/HDS/helpers/AlgoliaSearch/searchbox.js +88 -0
- package/src/HDS/helpers/AlgoliaSearch/searchfooter.js +30 -0
- package/src/HDS/helpers/AlgoliaSearch/searchoverlay.js +36 -0
- package/src/HDS/helpers/AlgoliaSearch/searchresults.js +98 -0
- package/src/HDS/helpers/AlgoliaSearch/searchwrapper.js +126 -0
- package/src/HDS/helpers/index.js +1 -0
- package/src/index.css +52 -0
- package/src/styles/tailwind.css +155 -8
@@ -0,0 +1,126 @@
|
|
1
|
+
import algoliasearch from "algoliasearch/lite";
|
2
|
+
import React, { useRef, useState } from "react";
|
3
|
+
import { InstantSearch, connectStateResults, Index } from "react-instantsearch-dom";
|
4
|
+
import SearchBox from "./searchbox";
|
5
|
+
import SearchResults from "./searchresults";
|
6
|
+
import { INDEX_TYPES } from "./constants";
|
7
|
+
import SearchFooter from "./searchfooter";
|
8
|
+
import { Typography } from '../../foundation/Typography'
|
9
|
+
|
10
|
+
|
11
|
+
const algoliaClient = algoliasearch(
|
12
|
+
process.env.ALGOLIA_APP_ID,
|
13
|
+
process.env.ALGOLIA_SEARCH_KEY
|
14
|
+
);
|
15
|
+
|
16
|
+
const searchClient = {
|
17
|
+
...algoliaClient,
|
18
|
+
search(requests) {
|
19
|
+
if (requests.every(({ params }) => !params.query)) {
|
20
|
+
return Promise.resolve({
|
21
|
+
results: requests.map(() => ({
|
22
|
+
hits: [],
|
23
|
+
nbHits: 0,
|
24
|
+
nbPages: 0,
|
25
|
+
processingTimeMS: 0,
|
26
|
+
})),
|
27
|
+
});
|
28
|
+
}
|
29
|
+
|
30
|
+
return algoliaClient.search(requests);
|
31
|
+
},
|
32
|
+
};
|
33
|
+
|
34
|
+
const AllResults = ({ allSearchResults, children, indices, searchState, searching }) => {
|
35
|
+
if (!searchState?.query) return null;
|
36
|
+
|
37
|
+
const hasResults =
|
38
|
+
allSearchResults && Object.values(allSearchResults).some(results => results.nbHits > 0);
|
39
|
+
return !hasResults ? (
|
40
|
+
<div>
|
41
|
+
<div>
|
42
|
+
{searching ? (
|
43
|
+
<span>
|
44
|
+
Searching for "<em>{searchState?.query}</em>"
|
45
|
+
</span>
|
46
|
+
) : (
|
47
|
+
<span>
|
48
|
+
No results for "<em>{searchState?.query}</em>"
|
49
|
+
</span>
|
50
|
+
)}
|
51
|
+
</div>
|
52
|
+
{indices.map(index => (
|
53
|
+
<Index indexName={index.name} key={index.name} />
|
54
|
+
))}
|
55
|
+
<SearchFooter />
|
56
|
+
</div>
|
57
|
+
) : (
|
58
|
+
children
|
59
|
+
);
|
60
|
+
};
|
61
|
+
|
62
|
+
const CustomAllResults = connectStateResults(AllResults);
|
63
|
+
|
64
|
+
const IndexTypeFilter = ({ activeIndexTypes, setActiveIndexTypes }) => {
|
65
|
+
const handleOnChange = indexType => ({ target }) => {
|
66
|
+
setActiveIndexTypes(prevState => ({
|
67
|
+
...prevState,
|
68
|
+
[indexType]: target.checked,
|
69
|
+
}));
|
70
|
+
};
|
71
|
+
|
72
|
+
return (
|
73
|
+
<div className="tb-m:min-w-[150px] static tb-m:sticky top-[96px] self-start">
|
74
|
+
<Typography textStyle="h6" as="h6" className="text-neutral-700 uppercase">Filter</Typography>
|
75
|
+
<ul className="flex tb-m:block">
|
76
|
+
{Object.values(INDEX_TYPES).map(index => (
|
77
|
+
<li key={index} className="flex items-center py-3 mr-4 tb-m:mr-0">
|
78
|
+
<input
|
79
|
+
type="checkbox"
|
80
|
+
id={"algolia_index_type_" + index}
|
81
|
+
name={"algolia_index_type_" + index}
|
82
|
+
value={index}
|
83
|
+
checked={activeIndexTypes[index]}
|
84
|
+
onChange={handleOnChange(index)}
|
85
|
+
className="mr-2 focus:outline-none"
|
86
|
+
/>
|
87
|
+
<label htmlFor={"algolia_index_type_" + index}>{index}</label>
|
88
|
+
</li>
|
89
|
+
))}
|
90
|
+
</ul>
|
91
|
+
</div>
|
92
|
+
);
|
93
|
+
};
|
94
|
+
|
95
|
+
export default function SearchWrapper({ indices }) {
|
96
|
+
const defaultIndexTypesState = Object.values(INDEX_TYPES).reduce((a, c) => {
|
97
|
+
a[c] = true;
|
98
|
+
return a;
|
99
|
+
}, {});
|
100
|
+
const wrapperRef = useRef(null);
|
101
|
+
const [activeIndexTypes, setActiveIndexTypes] = useState(defaultIndexTypesState);
|
102
|
+
return (
|
103
|
+
<InstantSearch
|
104
|
+
searchClient={searchClient}
|
105
|
+
indexName={indices[0].name}
|
106
|
+
onSearchStateChange={() => setActiveIndexTypes(defaultIndexTypesState)}
|
107
|
+
>
|
108
|
+
<SearchBox />
|
109
|
+
<CustomAllResults indices={indices}>
|
110
|
+
<div className="tb-m:flex">
|
111
|
+
<IndexTypeFilter
|
112
|
+
activeIndexTypes={activeIndexTypes}
|
113
|
+
setActiveIndexTypes={setActiveIndexTypes}
|
114
|
+
/>
|
115
|
+
<SearchResults
|
116
|
+
id="search-results"
|
117
|
+
indices={indices}
|
118
|
+
wrapperRef={wrapperRef}
|
119
|
+
activeIndexTypes={activeIndexTypes}
|
120
|
+
className="search-results"
|
121
|
+
/>
|
122
|
+
</div>
|
123
|
+
</CustomAllResults>
|
124
|
+
</InstantSearch>
|
125
|
+
);
|
126
|
+
}
|
package/src/HDS/helpers/index.js
CHANGED
package/src/index.css
CHANGED
@@ -4,6 +4,58 @@
|
|
4
4
|
@tailwind utilities;
|
5
5
|
/* Typography classes */
|
6
6
|
|
7
|
+
.hds-hidden{
|
8
|
+
display: none;
|
9
|
+
|
10
|
+
}
|
11
|
+
@media (min-width: 905px) {
|
12
|
+
.hds-hidden-tbl {
|
13
|
+
display: none;
|
14
|
+
}
|
15
|
+
}
|
16
|
+
|
17
|
+
.search-results {
|
18
|
+
width: calc(100% - 150px);
|
19
|
+
}
|
20
|
+
|
21
|
+
.search-results .ais-Hits .ais-Hits-list,
|
22
|
+
.search-results .Hits .ais-Hits-list {
|
23
|
+
display: grid;
|
24
|
+
grid-template-columns: repeat(3, 1fr);
|
25
|
+
grid-gap: 40px;
|
26
|
+
}
|
27
|
+
|
28
|
+
.search-results .ais-Hits .ais-Hits-list .ais-Hits-item,
|
29
|
+
.search-results .Hits .ais-Hits-list .ais-Hits-item {
|
30
|
+
border-bottom: 1px solid transparent;
|
31
|
+
}
|
32
|
+
|
33
|
+
.search-results .ais-Hits .ais-Hits-list .ais-Hits-item:hover,
|
34
|
+
.search-results .Hits .ais-Hits-list .ais-Hits-item:hover {
|
35
|
+
border-bottom: 1px solid #e5e7eb;
|
36
|
+
}
|
37
|
+
|
38
|
+
.search-results .ais-Hits .ais-Hits-list .ais-Hits-item .hit-slug,
|
39
|
+
.search-results .Hits .ais-Hits-list .ais-Hits-item .hit-slug {
|
40
|
+
word-break: break-word;
|
41
|
+
}
|
42
|
+
|
43
|
+
@media (max-width: 799px) {
|
44
|
+
|
45
|
+
.search-results .ais-Hits .ais-Hits-list,
|
46
|
+
.search-results .Hits .ais-Hits-list {
|
47
|
+
grid-template-columns: 1fr;
|
48
|
+
}
|
49
|
+
}
|
50
|
+
|
51
|
+
@media (min-width: 800px) and (max-width: 905px) {
|
52
|
+
|
53
|
+
.search-results .ais-Hits .ais-Hits-list,
|
54
|
+
.search-results .Hits .ais-Hits-list {
|
55
|
+
grid-template-columns: 1fr 1fr;
|
56
|
+
}
|
57
|
+
}
|
58
|
+
|
7
59
|
.card {
|
8
60
|
max-width: 920px;
|
9
61
|
background-size: cover;
|
package/src/styles/tailwind.css
CHANGED
@@ -836,6 +836,10 @@ select{
|
|
836
836
|
visibility: hidden;
|
837
837
|
}
|
838
838
|
|
839
|
+
.static{
|
840
|
+
position: static;
|
841
|
+
}
|
842
|
+
|
839
843
|
.fixed{
|
840
844
|
position: fixed;
|
841
845
|
}
|
@@ -895,6 +899,10 @@ select{
|
|
895
899
|
right: -44px;
|
896
900
|
}
|
897
901
|
|
902
|
+
.-top-20{
|
903
|
+
top: -5rem;
|
904
|
+
}
|
905
|
+
|
898
906
|
.bottom-0{
|
899
907
|
bottom: 0px;
|
900
908
|
}
|
@@ -979,6 +987,10 @@ select{
|
|
979
987
|
right: 0.5rem;
|
980
988
|
}
|
981
989
|
|
990
|
+
.right-4{
|
991
|
+
right: 1rem;
|
992
|
+
}
|
993
|
+
|
982
994
|
.right-8{
|
983
995
|
right: 2rem;
|
984
996
|
}
|
@@ -1003,6 +1015,10 @@ select{
|
|
1003
1015
|
top: 0.5rem;
|
1004
1016
|
}
|
1005
1017
|
|
1018
|
+
.top-4{
|
1019
|
+
top: 1rem;
|
1020
|
+
}
|
1021
|
+
|
1006
1022
|
.top-5{
|
1007
1023
|
top: 1.25rem;
|
1008
1024
|
}
|
@@ -1011,10 +1027,6 @@ select{
|
|
1011
1027
|
top: 2rem;
|
1012
1028
|
}
|
1013
1029
|
|
1014
|
-
.top-9{
|
1015
|
-
top: 2.25rem;
|
1016
|
-
}
|
1017
|
-
|
1018
1030
|
.top-\[112px\]{
|
1019
1031
|
top: 112px;
|
1020
1032
|
}
|
@@ -1031,6 +1043,10 @@ select{
|
|
1031
1043
|
top: 72px;
|
1032
1044
|
}
|
1033
1045
|
|
1046
|
+
.top-\[96px\]{
|
1047
|
+
top: 96px;
|
1048
|
+
}
|
1049
|
+
|
1034
1050
|
.isolate{
|
1035
1051
|
isolation: isolate;
|
1036
1052
|
}
|
@@ -1059,6 +1075,10 @@ select{
|
|
1059
1075
|
z-index: 50;
|
1060
1076
|
}
|
1061
1077
|
|
1078
|
+
.z-\[10000\]{
|
1079
|
+
z-index: 10000;
|
1080
|
+
}
|
1081
|
+
|
1062
1082
|
.z-\[100\]{
|
1063
1083
|
z-index: 100;
|
1064
1084
|
}
|
@@ -1067,6 +1087,10 @@ select{
|
|
1067
1087
|
z-index: 10;
|
1068
1088
|
}
|
1069
1089
|
|
1090
|
+
.z-\[11\]{
|
1091
|
+
z-index: 11;
|
1092
|
+
}
|
1093
|
+
|
1070
1094
|
.z-\[1\]{
|
1071
1095
|
z-index: 1;
|
1072
1096
|
}
|
@@ -1091,6 +1115,10 @@ select{
|
|
1091
1115
|
grid-column: span 4 / span 4;
|
1092
1116
|
}
|
1093
1117
|
|
1118
|
+
.clear-both{
|
1119
|
+
clear: both;
|
1120
|
+
}
|
1121
|
+
|
1094
1122
|
.-m-1{
|
1095
1123
|
margin: -0.25rem;
|
1096
1124
|
}
|
@@ -1111,6 +1139,10 @@ select{
|
|
1111
1139
|
margin: -0.75rem;
|
1112
1140
|
}
|
1113
1141
|
|
1142
|
+
.m-1{
|
1143
|
+
margin: 0.25rem;
|
1144
|
+
}
|
1145
|
+
|
1114
1146
|
.m-2{
|
1115
1147
|
margin: 0.5rem;
|
1116
1148
|
}
|
@@ -1258,6 +1290,10 @@ select{
|
|
1258
1290
|
margin-left: -1px;
|
1259
1291
|
}
|
1260
1292
|
|
1293
|
+
.-mt-1{
|
1294
|
+
margin-top: -0.25rem;
|
1295
|
+
}
|
1296
|
+
|
1261
1297
|
.-mt-4{
|
1262
1298
|
margin-top: -1rem;
|
1263
1299
|
}
|
@@ -2284,6 +2320,14 @@ select{
|
|
2284
2320
|
justify-content: space-around;
|
2285
2321
|
}
|
2286
2322
|
|
2323
|
+
.gap-0{
|
2324
|
+
gap: 0px;
|
2325
|
+
}
|
2326
|
+
|
2327
|
+
.gap-0\.5{
|
2328
|
+
gap: 0.125rem;
|
2329
|
+
}
|
2330
|
+
|
2287
2331
|
.gap-1{
|
2288
2332
|
gap: 0.25rem;
|
2289
2333
|
}
|
@@ -2663,6 +2707,10 @@ select{
|
|
2663
2707
|
border-width: 1.5px;
|
2664
2708
|
}
|
2665
2709
|
|
2710
|
+
.border-\[3px\]{
|
2711
|
+
border-width: 3px;
|
2712
|
+
}
|
2713
|
+
|
2666
2714
|
.border-x{
|
2667
2715
|
border-left-width: 1px;
|
2668
2716
|
border-right-width: 1px;
|
@@ -3210,11 +3258,21 @@ select{
|
|
3210
3258
|
border-bottom-color: rgb(157 164 174 / var(--tw-border-opacity));
|
3211
3259
|
}
|
3212
3260
|
|
3261
|
+
.border-t-blue-500{
|
3262
|
+
--tw-border-opacity: 1;
|
3263
|
+
border-top-color: rgb(57 112 253 / var(--tw-border-opacity));
|
3264
|
+
}
|
3265
|
+
|
3213
3266
|
.border-t-neutral-150{
|
3214
3267
|
--tw-border-opacity: 1;
|
3215
3268
|
border-top-color: rgb(236 237 240 / var(--tw-border-opacity));
|
3216
3269
|
}
|
3217
3270
|
|
3271
|
+
.border-t-neutral-200{
|
3272
|
+
--tw-border-opacity: 1;
|
3273
|
+
border-top-color: rgb(229 231 235 / var(--tw-border-opacity));
|
3274
|
+
}
|
3275
|
+
|
3218
3276
|
.bg-amber-100{
|
3219
3277
|
--tw-bg-opacity: 1;
|
3220
3278
|
background-color: rgb(255 243 212 / var(--tw-bg-opacity));
|
@@ -5926,10 +5984,6 @@ select{
|
|
5926
5984
|
padding-top: 2.5rem;
|
5927
5985
|
}
|
5928
5986
|
|
5929
|
-
.pt-11{
|
5930
|
-
padding-top: 2.75rem;
|
5931
|
-
}
|
5932
|
-
|
5933
5987
|
.pt-12{
|
5934
5988
|
padding-top: 3rem;
|
5935
5989
|
}
|
@@ -5966,6 +6020,10 @@ select{
|
|
5966
6020
|
padding-top: 2rem;
|
5967
6021
|
}
|
5968
6022
|
|
6023
|
+
.pt-9{
|
6024
|
+
padding-top: 2.25rem;
|
6025
|
+
}
|
6026
|
+
|
5969
6027
|
.pt-\[72px\]{
|
5970
6028
|
padding-top: 72px;
|
5971
6029
|
}
|
@@ -5986,6 +6044,10 @@ select{
|
|
5986
6044
|
text-align: right;
|
5987
6045
|
}
|
5988
6046
|
|
6047
|
+
.indent-5{
|
6048
|
+
text-indent: 1.25rem;
|
6049
|
+
}
|
6050
|
+
|
5989
6051
|
.font-petrona{
|
5990
6052
|
font-family: Petrona, serif;
|
5991
6053
|
}
|
@@ -7020,6 +7082,56 @@ select{
|
|
7020
7082
|
|
7021
7083
|
/* Typography classes */
|
7022
7084
|
|
7085
|
+
.hds-hidden{
|
7086
|
+
display: none;
|
7087
|
+
}
|
7088
|
+
|
7089
|
+
@media (min-width: 905px) {
|
7090
|
+
.hds-hidden-tbl {
|
7091
|
+
display: none;
|
7092
|
+
}
|
7093
|
+
}
|
7094
|
+
|
7095
|
+
.search-results {
|
7096
|
+
width: calc(100% - 150px);
|
7097
|
+
}
|
7098
|
+
|
7099
|
+
.search-results .ais-Hits .ais-Hits-list,
|
7100
|
+
.search-results .Hits .ais-Hits-list {
|
7101
|
+
display: grid;
|
7102
|
+
grid-template-columns: repeat(3, 1fr);
|
7103
|
+
grid-gap: 40px;
|
7104
|
+
}
|
7105
|
+
|
7106
|
+
.search-results .ais-Hits .ais-Hits-list .ais-Hits-item,
|
7107
|
+
.search-results .Hits .ais-Hits-list .ais-Hits-item {
|
7108
|
+
border-bottom: 1px solid transparent;
|
7109
|
+
}
|
7110
|
+
|
7111
|
+
.search-results .ais-Hits .ais-Hits-list .ais-Hits-item:hover,
|
7112
|
+
.search-results .Hits .ais-Hits-list .ais-Hits-item:hover {
|
7113
|
+
border-bottom: 1px solid #e5e7eb;
|
7114
|
+
}
|
7115
|
+
|
7116
|
+
.search-results .ais-Hits .ais-Hits-list .ais-Hits-item .hit-slug,
|
7117
|
+
.search-results .Hits .ais-Hits-list .ais-Hits-item .hit-slug {
|
7118
|
+
word-break: break-word;
|
7119
|
+
}
|
7120
|
+
|
7121
|
+
@media (max-width: 799px) {
|
7122
|
+
.search-results .ais-Hits .ais-Hits-list,
|
7123
|
+
.search-results .Hits .ais-Hits-list {
|
7124
|
+
grid-template-columns: 1fr;
|
7125
|
+
}
|
7126
|
+
}
|
7127
|
+
|
7128
|
+
@media (min-width: 800px) and (max-width: 905px) {
|
7129
|
+
.search-results .ais-Hits .ais-Hits-list,
|
7130
|
+
.search-results .Hits .ais-Hits-list {
|
7131
|
+
grid-template-columns: 1fr 1fr;
|
7132
|
+
}
|
7133
|
+
}
|
7134
|
+
|
7023
7135
|
.card {
|
7024
7136
|
max-width: 920px;
|
7025
7137
|
background-size: cover;
|
@@ -8991,6 +9103,11 @@ select{
|
|
8991
9103
|
color: rgb(30 86 227 / var(--tw-text-opacity));
|
8992
9104
|
}
|
8993
9105
|
|
9106
|
+
.hover\:text-blue-700:hover{
|
9107
|
+
--tw-text-opacity: 1;
|
9108
|
+
color: rgb(13 65 198 / var(--tw-text-opacity));
|
9109
|
+
}
|
9110
|
+
|
8994
9111
|
.hover\:text-neutral-0:hover{
|
8995
9112
|
--tw-text-opacity: 1;
|
8996
9113
|
color: rgb(255 255 255 / var(--tw-text-opacity));
|
@@ -10373,6 +10490,23 @@ select{
|
|
10373
10490
|
}
|
10374
10491
|
|
10375
10492
|
@media (min-width: 800px){
|
10493
|
+
.tb-m\:sticky{
|
10494
|
+
position: -webkit-sticky;
|
10495
|
+
position: sticky;
|
10496
|
+
}
|
10497
|
+
|
10498
|
+
.tb-m\:-top-20{
|
10499
|
+
top: -5rem;
|
10500
|
+
}
|
10501
|
+
|
10502
|
+
.tb-m\:mr-0{
|
10503
|
+
margin-right: 0px;
|
10504
|
+
}
|
10505
|
+
|
10506
|
+
.tb-m\:block{
|
10507
|
+
display: block;
|
10508
|
+
}
|
10509
|
+
|
10376
10510
|
.tb-m\:flex{
|
10377
10511
|
display: flex;
|
10378
10512
|
}
|
@@ -10381,6 +10515,10 @@ select{
|
|
10381
10515
|
width: 50%;
|
10382
10516
|
}
|
10383
10517
|
|
10518
|
+
.tb-m\:min-w-\[150px\]{
|
10519
|
+
min-width: 150px;
|
10520
|
+
}
|
10521
|
+
|
10384
10522
|
.tb-m\:snap-start{
|
10385
10523
|
scroll-snap-align: start;
|
10386
10524
|
}
|
@@ -10397,6 +10535,11 @@ select{
|
|
10397
10535
|
border-top-width: 0px;
|
10398
10536
|
}
|
10399
10537
|
|
10538
|
+
.tb-m\:py-9{
|
10539
|
+
padding-top: 2.25rem;
|
10540
|
+
padding-bottom: 2.25rem;
|
10541
|
+
}
|
10542
|
+
|
10400
10543
|
.tb-m\:pb-0{
|
10401
10544
|
padding-bottom: 0px;
|
10402
10545
|
}
|
@@ -10404,6 +10547,10 @@ select{
|
|
10404
10547
|
.tb-m\:pt-0{
|
10405
10548
|
padding-top: 0px;
|
10406
10549
|
}
|
10550
|
+
|
10551
|
+
.tb-m\:pt-16{
|
10552
|
+
padding-top: 4rem;
|
10553
|
+
}
|
10407
10554
|
}
|
10408
10555
|
|
10409
10556
|
@media (min-width: 905px){
|