@nuskin/react-search-components 1.0.0 → 1.1.0-cx130-2624.1
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.d.mts +41 -2
- package/dist/index.d.ts +41 -2
- package/dist/index.js +705 -297
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +706 -298
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -1
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { forwardRef, useState, useId, useRef, useImperativeHandle, useEffect, useCallback } from 'react';
|
|
1
|
+
import { forwardRef, useState, useId, useRef, useImperativeHandle, useEffect, useCallback, useLayoutEffect } from 'react';
|
|
2
2
|
import { createPortal } from 'react-dom';
|
|
3
3
|
import styled4 from '@emotion/styled';
|
|
4
4
|
import { NsIcon } from '@nuskin/foundation-ui-components';
|
|
@@ -133,6 +133,7 @@ function Icon({
|
|
|
133
133
|
}
|
|
134
134
|
var { colors } = nuskinTheme;
|
|
135
135
|
var DESKTOP_MIN_PX = 1025;
|
|
136
|
+
var DESKTOP_SEARCH_COLUMN_MAX = "860px";
|
|
136
137
|
var AGENT_DESKTOP_BLOCK_SIZE = "70dvh";
|
|
137
138
|
var SearchPanelLayoutRoot = styled4.dialog`
|
|
138
139
|
background-color: ${colors.primary.white};
|
|
@@ -172,26 +173,46 @@ var SearchPanelLayoutRoot = styled4.dialog`
|
|
|
172
173
|
`}
|
|
173
174
|
`;
|
|
174
175
|
var SearchPanelLayoutInner = styled4.div`
|
|
176
|
+
align-items: ${({ $agentMode }) => $agentMode ? "stretch" : "center"};
|
|
175
177
|
box-sizing: border-box;
|
|
176
178
|
display: grid;
|
|
177
|
-
|
|
178
|
-
|
|
179
|
+
justify-items: stretch;
|
|
180
|
+
grid-template-areas:
|
|
181
|
+
'input cancel'
|
|
182
|
+
'content content';
|
|
183
|
+
grid-template-columns: minmax(0, 1fr) auto;
|
|
184
|
+
inline-size: 100%;
|
|
179
185
|
margin-inline: auto;
|
|
180
|
-
padding:
|
|
186
|
+
padding: 30px 0;
|
|
187
|
+
row-gap: 0;
|
|
188
|
+
|
|
189
|
+
@media (min-width: ${DESKTOP_MIN_PX}px) {
|
|
190
|
+
grid-template-areas:
|
|
191
|
+
'logo cancel'
|
|
192
|
+
'input input'
|
|
193
|
+
'content content';
|
|
194
|
+
padding: 20px clamp(12px, 4vw, 32px) 30px;
|
|
195
|
+
}
|
|
196
|
+
|
|
181
197
|
${({ $agentMode }) => $agentMode && `
|
|
182
198
|
display: flex;
|
|
183
199
|
flex-direction: column;
|
|
184
200
|
flex: 1;
|
|
201
|
+
gap: 1.5rem;
|
|
185
202
|
min-block-size: 0;
|
|
186
203
|
overflow: hidden;
|
|
204
|
+
padding: clamp(1rem, 2vw, 2rem);
|
|
187
205
|
`}
|
|
188
206
|
`;
|
|
189
207
|
var SearchPanelLayoutAgentContent = styled4.div`
|
|
208
|
+
align-self: stretch;
|
|
190
209
|
flex: 1;
|
|
210
|
+
inline-size: 100%;
|
|
191
211
|
min-block-size: 0;
|
|
192
212
|
min-inline-size: 0;
|
|
193
213
|
overflow: hidden;
|
|
194
214
|
position: relative;
|
|
215
|
+
width: 100%;
|
|
195
216
|
`;
|
|
196
217
|
var SearchPanelLayoutHeader = styled4.header`
|
|
197
218
|
display: flex;
|
|
@@ -203,9 +224,23 @@ var SearchPanelLayoutHeader = styled4.header`
|
|
|
203
224
|
`}
|
|
204
225
|
`;
|
|
205
226
|
var SearchPanelLayoutLogoSlot = styled4.div`
|
|
227
|
+
display: none;
|
|
206
228
|
flex: 0 0 auto;
|
|
207
|
-
|
|
229
|
+
grid-area: logo;
|
|
208
230
|
margin-inline-end: auto;
|
|
231
|
+
|
|
232
|
+
@media (min-width: ${DESKTOP_MIN_PX}px) {
|
|
233
|
+
display: block;
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
${({ $agentMode }) => $agentMode && `display: block;`}
|
|
237
|
+
`;
|
|
238
|
+
var SearchPanelLayoutCloseIcon = styled4.span`
|
|
239
|
+
display: none;
|
|
240
|
+
|
|
241
|
+
@media (min-width: ${DESKTOP_MIN_PX}px) {
|
|
242
|
+
display: inline-flex;
|
|
243
|
+
}
|
|
209
244
|
`;
|
|
210
245
|
var SearchPanelLayoutCloseButton = styled4.button`
|
|
211
246
|
align-items: center;
|
|
@@ -217,32 +252,91 @@ var SearchPanelLayoutCloseButton = styled4.button`
|
|
|
217
252
|
display: inline-flex;
|
|
218
253
|
font: inherit;
|
|
219
254
|
gap: 0.375rem;
|
|
220
|
-
|
|
255
|
+
grid-area: cancel;
|
|
256
|
+
justify-self: end;
|
|
257
|
+
padding: 0.5rem 20px 0.5rem 12px;
|
|
258
|
+
text-transform: uppercase;
|
|
221
259
|
|
|
222
260
|
&:focus-visible {
|
|
223
261
|
outline: 2px solid ${colors.primary.black};
|
|
224
262
|
outline-offset: 2px;
|
|
225
263
|
}
|
|
264
|
+
|
|
265
|
+
@media (min-width: ${DESKTOP_MIN_PX}px) {
|
|
266
|
+
padding: 0.5rem;
|
|
267
|
+
text-transform: none;
|
|
268
|
+
}
|
|
226
269
|
`;
|
|
227
270
|
var SearchPanelLayoutContent = styled4.div`
|
|
271
|
+
grid-area: content;
|
|
228
272
|
min-inline-size: 0;
|
|
273
|
+
width: 100%;
|
|
274
|
+
|
|
275
|
+
@media (min-width: ${DESKTOP_MIN_PX}px) {
|
|
276
|
+
inline-size: min(100%, ${DESKTOP_SEARCH_COLUMN_MAX});
|
|
277
|
+
justify-self: center;
|
|
278
|
+
}
|
|
229
279
|
`;
|
|
230
280
|
var SearchPanelLayoutInputSlot = styled4.div`
|
|
231
|
-
|
|
232
|
-
|
|
281
|
+
grid-area: input;
|
|
282
|
+
min-inline-size: 0;
|
|
283
|
+
overflow: visible;
|
|
284
|
+
padding-inline: 20px 0;
|
|
233
285
|
width: 100%;
|
|
286
|
+
|
|
287
|
+
@media (min-width: ${DESKTOP_MIN_PX}px) {
|
|
288
|
+
inline-size: min(100%, ${DESKTOP_SEARCH_COLUMN_MAX});
|
|
289
|
+
justify-self: center;
|
|
290
|
+
margin-block-start: 30px;
|
|
291
|
+
padding-inline: 0;
|
|
292
|
+
}
|
|
234
293
|
`;
|
|
294
|
+
function SearchPanelCloseControl({
|
|
295
|
+
cancelLabelTag,
|
|
296
|
+
cancelShowIconTag,
|
|
297
|
+
closeLabel,
|
|
298
|
+
onClose,
|
|
299
|
+
showCancelIcon
|
|
300
|
+
}) {
|
|
301
|
+
return /* @__PURE__ */ jsxs(
|
|
302
|
+
SearchPanelLayoutCloseButton,
|
|
303
|
+
{
|
|
304
|
+
type: "button",
|
|
305
|
+
onMouseDown: (event) => event.preventDefault(),
|
|
306
|
+
onClick: onClose,
|
|
307
|
+
...showCancelIcon ? {} : cancelShowIconTag != null ? cancelShowIconTag : {},
|
|
308
|
+
children: [
|
|
309
|
+
showCancelIcon ? /* @__PURE__ */ jsx(SearchPanelLayoutCloseIcon, { ...cancelShowIconTag != null ? cancelShowIconTag : {}, children: /* @__PURE__ */ jsx(Icon, { cursor: ICON_CURSORS.POINTER, size: ICON_SIZES.SMALL, type: ICON_TYPES.CLOSE }) }) : null,
|
|
310
|
+
/* @__PURE__ */ jsx("span", { ...cancelLabelTag != null ? cancelLabelTag : {}, children: closeLabel })
|
|
311
|
+
]
|
|
312
|
+
}
|
|
313
|
+
);
|
|
314
|
+
}
|
|
235
315
|
var SearchPanelLayout = forwardRef(
|
|
236
316
|
function SearchPanelLayout2({
|
|
237
317
|
"aria-label": ariaLabel,
|
|
238
318
|
agentMode = false,
|
|
239
319
|
children,
|
|
240
320
|
closeLabel,
|
|
321
|
+
showCancelIcon = true,
|
|
322
|
+
cancelLabelTag,
|
|
323
|
+
cancelShowIconTag,
|
|
241
324
|
inputSlot,
|
|
242
325
|
logoSlot,
|
|
243
326
|
onClose,
|
|
244
327
|
...props
|
|
245
328
|
}, ref) {
|
|
329
|
+
const logo = logoSlot ? /* @__PURE__ */ jsx(SearchPanelLayoutLogoSlot, { $agentMode: agentMode, children: logoSlot }) : null;
|
|
330
|
+
const closeControl = /* @__PURE__ */ jsx(
|
|
331
|
+
SearchPanelCloseControl,
|
|
332
|
+
{
|
|
333
|
+
closeLabel,
|
|
334
|
+
onClose,
|
|
335
|
+
showCancelIcon,
|
|
336
|
+
...cancelLabelTag ? { cancelLabelTag } : {},
|
|
337
|
+
...cancelShowIconTag ? { cancelShowIconTag } : {}
|
|
338
|
+
}
|
|
339
|
+
);
|
|
246
340
|
return /* @__PURE__ */ jsx(
|
|
247
341
|
SearchPanelLayoutRoot,
|
|
248
342
|
{
|
|
@@ -252,22 +346,14 @@ var SearchPanelLayout = forwardRef(
|
|
|
252
346
|
"aria-label": ariaLabel,
|
|
253
347
|
$agentMode: agentMode,
|
|
254
348
|
children: /* @__PURE__ */ jsxs(SearchPanelLayoutInner, { $agentMode: agentMode, children: [
|
|
255
|
-
/* @__PURE__ */ jsxs(SearchPanelLayoutHeader, { $agentMode:
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
onMouseDown: (e) => e.preventDefault(),
|
|
262
|
-
onClick: onClose,
|
|
263
|
-
children: [
|
|
264
|
-
/* @__PURE__ */ jsx(Icon, { cursor: ICON_CURSORS.POINTER, size: ICON_SIZES.SMALL, type: ICON_TYPES.CLOSE }),
|
|
265
|
-
closeLabel
|
|
266
|
-
]
|
|
267
|
-
}
|
|
268
|
-
)
|
|
349
|
+
agentMode ? /* @__PURE__ */ jsxs(SearchPanelLayoutHeader, { $agentMode: true, children: [
|
|
350
|
+
logo,
|
|
351
|
+
closeControl
|
|
352
|
+
] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
353
|
+
logo,
|
|
354
|
+
closeControl
|
|
269
355
|
] }),
|
|
270
|
-
!agentMode && inputSlot
|
|
356
|
+
!agentMode && inputSlot ? /* @__PURE__ */ jsx(SearchPanelLayoutInputSlot, { children: inputSlot }) : null,
|
|
271
357
|
agentMode ? /* @__PURE__ */ jsx(SearchPanelLayoutAgentContent, { "data-agent-container": "", children }) : /* @__PURE__ */ jsx(SearchPanelLayoutContent, { children })
|
|
272
358
|
] })
|
|
273
359
|
}
|
|
@@ -292,9 +378,11 @@ var SearchMessageInputRoot = styled4.form`
|
|
|
292
378
|
border-radius: 999px;
|
|
293
379
|
box-sizing: border-box;
|
|
294
380
|
display: flex;
|
|
381
|
+
flex-wrap: nowrap;
|
|
295
382
|
gap: 0.25rem;
|
|
296
383
|
inline-size: 100%;
|
|
297
384
|
min-block-size: 3rem;
|
|
385
|
+
min-inline-size: 0;
|
|
298
386
|
padding: 0.25rem 0.5rem;
|
|
299
387
|
|
|
300
388
|
&:focus-within {
|
|
@@ -308,15 +396,26 @@ var SearchMessageInputField = styled4.input`
|
|
|
308
396
|
border: 0;
|
|
309
397
|
box-sizing: border-box;
|
|
310
398
|
color: ${colors2.primary.black};
|
|
311
|
-
|
|
399
|
+
display: block;
|
|
312
400
|
font: inherit;
|
|
401
|
+
inline-size: 100%;
|
|
313
402
|
min-inline-size: 0;
|
|
314
403
|
outline: 0;
|
|
315
404
|
padding: 0.5rem;
|
|
405
|
+
text-overflow: clip;
|
|
406
|
+
white-space: nowrap;
|
|
316
407
|
|
|
317
408
|
&::placeholder {
|
|
318
409
|
color: ${colors2.neutral[20]};
|
|
319
410
|
opacity: 1;
|
|
411
|
+
overflow: visible;
|
|
412
|
+
text-overflow: clip;
|
|
413
|
+
white-space: nowrap;
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
&[type='search']::-webkit-search-cancel-button,
|
|
417
|
+
&[type='search']::-webkit-search-decoration {
|
|
418
|
+
appearance: none;
|
|
320
419
|
}
|
|
321
420
|
`;
|
|
322
421
|
var SearchMessageInputSubmit = styled4.button`
|
|
@@ -365,6 +464,200 @@ var SearchMessageInputClear = styled4.button`
|
|
|
365
464
|
outline-offset: 2px;
|
|
366
465
|
}
|
|
367
466
|
`;
|
|
467
|
+
var SearchMessageInputAuxiliary = styled4.span`
|
|
468
|
+
align-items: center;
|
|
469
|
+
display: inline-flex;
|
|
470
|
+
flex: 0 0 auto;
|
|
471
|
+
gap: 0.25rem;
|
|
472
|
+
margin-inline-start: auto;
|
|
473
|
+
|
|
474
|
+
> span {
|
|
475
|
+
align-items: center;
|
|
476
|
+
display: inline-flex;
|
|
477
|
+
flex-shrink: 0;
|
|
478
|
+
inline-size: 2.125rem;
|
|
479
|
+
block-size: 2.125rem;
|
|
480
|
+
justify-content: center;
|
|
481
|
+
line-height: 0;
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
svg {
|
|
485
|
+
display: block;
|
|
486
|
+
overflow: visible;
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
[data-testid='search-nui-voice'] svg {
|
|
490
|
+
block-size: 2.125rem;
|
|
491
|
+
inline-size: 2.125rem;
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
@media (max-width: 1024px) {
|
|
495
|
+
> span {
|
|
496
|
+
block-size: 1.75rem;
|
|
497
|
+
inline-size: 1.75rem;
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
[data-testid='search-nui-voice'] svg {
|
|
501
|
+
block-size: 1.75rem;
|
|
502
|
+
inline-size: 1.75rem;
|
|
503
|
+
}
|
|
504
|
+
}
|
|
505
|
+
`;
|
|
506
|
+
var SearchMessageInputFieldWrap = styled4.span`
|
|
507
|
+
display: block;
|
|
508
|
+
flex: 1 1 auto;
|
|
509
|
+
min-inline-size: 0;
|
|
510
|
+
position: relative;
|
|
511
|
+
`;
|
|
512
|
+
var SearchMessageInputRotatingPlaceholder = styled4.span`
|
|
513
|
+
color: ${colors2.neutral[20]};
|
|
514
|
+
inset-block-start: 50%;
|
|
515
|
+
inset-inline: 0.5rem;
|
|
516
|
+
overflow: hidden;
|
|
517
|
+
pointer-events: none;
|
|
518
|
+
position: absolute;
|
|
519
|
+
text-overflow: ellipsis;
|
|
520
|
+
transform: translateY(-50%);
|
|
521
|
+
white-space: nowrap;
|
|
522
|
+
`;
|
|
523
|
+
function BrandedSparkleIcon() {
|
|
524
|
+
const reactId = useId();
|
|
525
|
+
const largeId = `${reactId}-sparkle-large`;
|
|
526
|
+
const smallId = `${reactId}-sparkle-small`;
|
|
527
|
+
return /* @__PURE__ */ jsxs(
|
|
528
|
+
"svg",
|
|
529
|
+
{
|
|
530
|
+
width: "18",
|
|
531
|
+
height: "26",
|
|
532
|
+
viewBox: "0 0 18 26",
|
|
533
|
+
fill: "none",
|
|
534
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
535
|
+
"aria-hidden": "true",
|
|
536
|
+
focusable: "false",
|
|
537
|
+
children: [
|
|
538
|
+
/* @__PURE__ */ jsx(
|
|
539
|
+
"path",
|
|
540
|
+
{
|
|
541
|
+
d: "M7.72184 7.28096C7.74702 7.14678 8.02273 7.14678 8.04791 7.28096C8.29593 8.60232 8.86587 10.8381 10.0145 11.9867C11.1631 13.1353 13.3989 13.7053 14.7202 13.9533C14.8544 13.9785 14.8544 14.2542 14.7202 14.2794C13.3989 14.5274 11.1631 15.0973 10.0145 16.246C8.86587 17.3946 8.29593 19.6303 8.04791 20.9517C8.02273 21.0859 7.74702 21.0859 7.72184 20.9517C7.47382 19.6303 6.90388 17.3946 5.75524 16.246C4.60661 15.0973 2.37088 14.5274 1.04952 14.2794C0.915335 14.2542 0.915335 13.9785 1.04952 13.9533C2.37088 13.7053 4.60661 13.1353 5.75524 11.9867C6.90388 10.8381 7.47382 8.60232 7.72184 7.28096Z",
|
|
542
|
+
fill: `url(#${largeId})`
|
|
543
|
+
}
|
|
544
|
+
),
|
|
545
|
+
/* @__PURE__ */ jsx(
|
|
546
|
+
"path",
|
|
547
|
+
{
|
|
548
|
+
d: "M14.0975 4.49258C14.1092 4.42963 14.2378 4.42963 14.2495 4.49258C14.3682 5.13172 14.6448 6.23139 15.2073 6.79394C15.7699 7.35648 16.8696 7.63311 17.5087 7.7518C17.5716 7.76349 17.5716 7.89209 17.5087 7.90378C16.8696 8.02246 15.7699 8.29909 15.2073 8.86164C14.6448 9.42418 14.3682 10.5239 14.2495 11.163C14.2378 11.2259 14.1092 11.2259 14.0975 11.163C13.9788 10.5239 13.7022 9.42418 13.1396 8.86164C12.5771 8.29909 11.4774 8.02246 10.8383 7.90378C10.7753 7.89209 10.7753 7.76349 10.8383 7.7518C11.4774 7.63311 12.5771 7.35648 13.1396 6.79394C13.7022 6.23139 13.9788 5.13172 14.0975 4.49258Z",
|
|
549
|
+
fill: `url(#${smallId})`
|
|
550
|
+
}
|
|
551
|
+
),
|
|
552
|
+
/* @__PURE__ */ jsxs("defs", { children: [
|
|
553
|
+
/* @__PURE__ */ jsxs(
|
|
554
|
+
"linearGradient",
|
|
555
|
+
{
|
|
556
|
+
id: largeId,
|
|
557
|
+
x1: "0.985745",
|
|
558
|
+
y1: "8.72141",
|
|
559
|
+
x2: "15.9969",
|
|
560
|
+
y2: "10.2253",
|
|
561
|
+
gradientUnits: "userSpaceOnUse",
|
|
562
|
+
children: [
|
|
563
|
+
/* @__PURE__ */ jsx("stop", { stopColor: "#6964F1" }),
|
|
564
|
+
/* @__PURE__ */ jsx("stop", { offset: "0.361696", stopColor: "#7561F3" }),
|
|
565
|
+
/* @__PURE__ */ jsx("stop", { offset: "0.743652", stopColor: "#855EF5" })
|
|
566
|
+
]
|
|
567
|
+
}
|
|
568
|
+
),
|
|
569
|
+
/* @__PURE__ */ jsxs(
|
|
570
|
+
"linearGradient",
|
|
571
|
+
{
|
|
572
|
+
id: smallId,
|
|
573
|
+
x1: "10.8242",
|
|
574
|
+
y1: "5.20877",
|
|
575
|
+
x2: "18.1115",
|
|
576
|
+
y2: "5.93885",
|
|
577
|
+
gradientUnits: "userSpaceOnUse",
|
|
578
|
+
children: [
|
|
579
|
+
/* @__PURE__ */ jsx("stop", { stopColor: "#6964F1" }),
|
|
580
|
+
/* @__PURE__ */ jsx("stop", { offset: "0.361696", stopColor: "#7561F3" }),
|
|
581
|
+
/* @__PURE__ */ jsx("stop", { offset: "0.743652", stopColor: "#855EF5" })
|
|
582
|
+
]
|
|
583
|
+
}
|
|
584
|
+
)
|
|
585
|
+
] })
|
|
586
|
+
]
|
|
587
|
+
}
|
|
588
|
+
);
|
|
589
|
+
}
|
|
590
|
+
function BrandedVoiceSearchIcon() {
|
|
591
|
+
return /* @__PURE__ */ jsxs(
|
|
592
|
+
"svg",
|
|
593
|
+
{
|
|
594
|
+
width: "32",
|
|
595
|
+
height: "32",
|
|
596
|
+
viewBox: "0 0 32 32",
|
|
597
|
+
fill: "none",
|
|
598
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
599
|
+
"aria-hidden": "true",
|
|
600
|
+
focusable: "false",
|
|
601
|
+
children: [
|
|
602
|
+
/* @__PURE__ */ jsx("rect", { width: "32", height: "32", rx: "16", fill: "#EDEDED" }),
|
|
603
|
+
/* @__PURE__ */ jsx(
|
|
604
|
+
"path",
|
|
605
|
+
{
|
|
606
|
+
d: "M12.125 21V11H13.625V21H12.125ZM15.25 24V8H16.75V24H15.25ZM9 18V14H10.5V18H9ZM18.375 21V11H19.875V21H18.375ZM21.5 18V14H23V18H21.5Z",
|
|
607
|
+
fill: "#5F5F5F"
|
|
608
|
+
}
|
|
609
|
+
)
|
|
610
|
+
]
|
|
611
|
+
}
|
|
612
|
+
);
|
|
613
|
+
}
|
|
614
|
+
var SEARCH_MOBILE_MAX_PX = 1024;
|
|
615
|
+
var MOBILE_QUERY = `(max-width: ${SEARCH_MOBILE_MAX_PX}px)`;
|
|
616
|
+
function useMobileSearchLayout(mediaQuery = MOBILE_QUERY) {
|
|
617
|
+
const [isMobile, setIsMobile] = useState(() => {
|
|
618
|
+
if (typeof window === "undefined") return false;
|
|
619
|
+
return window.matchMedia(mediaQuery).matches;
|
|
620
|
+
});
|
|
621
|
+
useEffect(() => {
|
|
622
|
+
if (typeof window === "undefined") return void 0;
|
|
623
|
+
const mq = window.matchMedia(mediaQuery);
|
|
624
|
+
const onChange = () => setIsMobile(mq.matches);
|
|
625
|
+
onChange();
|
|
626
|
+
mq.addEventListener("change", onChange);
|
|
627
|
+
return () => mq.removeEventListener("change", onChange);
|
|
628
|
+
}, [mediaQuery]);
|
|
629
|
+
return isMobile;
|
|
630
|
+
}
|
|
631
|
+
var DEFAULT_PLACEHOLDER_ROTATION_MS = 3e3;
|
|
632
|
+
function normalizeMessages(messages) {
|
|
633
|
+
if (!messages) return [];
|
|
634
|
+
return messages.filter((message) => message.trim() !== "");
|
|
635
|
+
}
|
|
636
|
+
function useRotatingPlaceholder(enabled, messages, intervalMs) {
|
|
637
|
+
var _a;
|
|
638
|
+
const [index, setIndex] = useState(0);
|
|
639
|
+
const rotationMs = intervalMs && intervalMs > 0 ? intervalMs : DEFAULT_PLACEHOLDER_ROTATION_MS;
|
|
640
|
+
const safeMessages = normalizeMessages(messages);
|
|
641
|
+
const messagesKey = safeMessages.join("\0");
|
|
642
|
+
useEffect(() => {
|
|
643
|
+
if (!enabled || safeMessages.length <= 1) {
|
|
644
|
+
setIndex(0);
|
|
645
|
+
return void 0;
|
|
646
|
+
}
|
|
647
|
+
const prefersReducedMotion = typeof window !== "undefined" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
648
|
+
if (prefersReducedMotion) {
|
|
649
|
+
setIndex(0);
|
|
650
|
+
return void 0;
|
|
651
|
+
}
|
|
652
|
+
const timerId = window.setInterval(
|
|
653
|
+
() => setIndex((current) => (current + 1) % safeMessages.length),
|
|
654
|
+
rotationMs
|
|
655
|
+
);
|
|
656
|
+
return () => window.clearInterval(timerId);
|
|
657
|
+
}, [enabled, rotationMs, messagesKey, safeMessages.length]);
|
|
658
|
+
if (!enabled || safeMessages.length === 0) return "";
|
|
659
|
+
return (_a = safeMessages[index % safeMessages.length]) != null ? _a : "";
|
|
660
|
+
}
|
|
368
661
|
function SearchMessageInput({
|
|
369
662
|
clearLabel,
|
|
370
663
|
inputLabel,
|
|
@@ -375,8 +668,16 @@ function SearchMessageInput({
|
|
|
375
668
|
placeholder,
|
|
376
669
|
submitLabel,
|
|
377
670
|
value,
|
|
671
|
+
showNuiIcons = false,
|
|
672
|
+
voiceSearchLabel = "",
|
|
673
|
+
askNuiLabel = "",
|
|
674
|
+
rotatingPlaceholders,
|
|
675
|
+
rotatingPlaceholderIntervalMs,
|
|
676
|
+
placeholderTag,
|
|
677
|
+
rotatingPlaceholderTag,
|
|
378
678
|
...props
|
|
379
679
|
}) {
|
|
680
|
+
var _a;
|
|
380
681
|
const field = useRef(null);
|
|
381
682
|
const setField = useCallback(
|
|
382
683
|
(node) => {
|
|
@@ -396,6 +697,14 @@ function SearchMessageInput({
|
|
|
396
697
|
event.preventDefault();
|
|
397
698
|
submitMessage();
|
|
398
699
|
}
|
|
700
|
+
const isMobile = useMobileSearchLayout();
|
|
701
|
+
const hasQuery = value.trim() !== "";
|
|
702
|
+
const showRotatingPlaceholder = isMobile && !hasQuery && ((_a = rotatingPlaceholders == null ? void 0 : rotatingPlaceholders.length) != null ? _a : 0) > 0;
|
|
703
|
+
const rotatingPlaceholderText = useRotatingPlaceholder(
|
|
704
|
+
showRotatingPlaceholder,
|
|
705
|
+
rotatingPlaceholders,
|
|
706
|
+
rotatingPlaceholderIntervalMs
|
|
707
|
+
);
|
|
399
708
|
function handleKeyDown(event) {
|
|
400
709
|
if (event.key === "Enter" && !event.nativeEvent.isComposing) {
|
|
401
710
|
event.preventDefault();
|
|
@@ -422,19 +731,40 @@ function SearchMessageInput({
|
|
|
422
731
|
type: ICON_TYPES.SEARCH_FIELD
|
|
423
732
|
}
|
|
424
733
|
) }),
|
|
425
|
-
/* @__PURE__ */
|
|
426
|
-
|
|
734
|
+
/* @__PURE__ */ jsxs(
|
|
735
|
+
SearchMessageInputFieldWrap,
|
|
427
736
|
{
|
|
428
|
-
|
|
429
|
-
"
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
737
|
+
"data-testid": "search-message-input-wrap",
|
|
738
|
+
"data-rotating-placeholder": showRotatingPlaceholder ? "true" : void 0,
|
|
739
|
+
children: [
|
|
740
|
+
showRotatingPlaceholder ? /* @__PURE__ */ jsx(
|
|
741
|
+
SearchMessageInputRotatingPlaceholder,
|
|
742
|
+
{
|
|
743
|
+
"data-testid": "search-rotating-placeholder",
|
|
744
|
+
...rotatingPlaceholderTag != null ? rotatingPlaceholderTag : {},
|
|
745
|
+
children: rotatingPlaceholderText
|
|
746
|
+
}
|
|
747
|
+
) : null,
|
|
748
|
+
/* @__PURE__ */ jsx(
|
|
749
|
+
SearchMessageInputField,
|
|
750
|
+
{
|
|
751
|
+
...placeholderTag != null ? placeholderTag : {},
|
|
752
|
+
ref: setField,
|
|
753
|
+
id: "header-product-search",
|
|
754
|
+
name: "header-product-search",
|
|
755
|
+
"aria-label": inputLabel,
|
|
756
|
+
autoComplete: "off",
|
|
757
|
+
autoCorrect: "off",
|
|
758
|
+
enterKeyHint: "search",
|
|
759
|
+
onChange: (event) => onChange(event.target.value),
|
|
760
|
+
onKeyDown: handleKeyDown,
|
|
761
|
+
placeholder: showRotatingPlaceholder ? "" : placeholder,
|
|
762
|
+
spellCheck: false,
|
|
763
|
+
type: "text",
|
|
764
|
+
value
|
|
765
|
+
}
|
|
766
|
+
)
|
|
767
|
+
]
|
|
438
768
|
}
|
|
439
769
|
),
|
|
440
770
|
value !== "" && /* @__PURE__ */ jsx(
|
|
@@ -443,9 +773,9 @@ function SearchMessageInput({
|
|
|
443
773
|
type: "button",
|
|
444
774
|
"aria-label": clearLabel,
|
|
445
775
|
onClick: () => {
|
|
446
|
-
var
|
|
776
|
+
var _a2;
|
|
447
777
|
onChange("");
|
|
448
|
-
(
|
|
778
|
+
(_a2 = field.current) == null ? void 0 : _a2.focus();
|
|
449
779
|
},
|
|
450
780
|
children: /* @__PURE__ */ jsx(
|
|
451
781
|
Icon,
|
|
@@ -456,7 +786,11 @@ function SearchMessageInput({
|
|
|
456
786
|
}
|
|
457
787
|
)
|
|
458
788
|
}
|
|
459
|
-
)
|
|
789
|
+
),
|
|
790
|
+
showNuiIcons ? /* @__PURE__ */ jsxs(SearchMessageInputAuxiliary, { "data-testid": "search-nui-icons", children: [
|
|
791
|
+
/* @__PURE__ */ jsx("span", { "aria-label": voiceSearchLabel, "data-testid": "search-nui-voice", children: /* @__PURE__ */ jsx(BrandedVoiceSearchIcon, {}) }),
|
|
792
|
+
/* @__PURE__ */ jsx("span", { "aria-label": askNuiLabel, "data-testid": "search-nui-sparkle", children: /* @__PURE__ */ jsx(BrandedSparkleIcon, {}) })
|
|
793
|
+
] }) : null
|
|
460
794
|
]
|
|
461
795
|
}
|
|
462
796
|
);
|
|
@@ -612,19 +946,23 @@ function RecentSearches({
|
|
|
612
946
|
clearLabel,
|
|
613
947
|
moreLabel,
|
|
614
948
|
onSelect,
|
|
615
|
-
onClear
|
|
949
|
+
onClear,
|
|
950
|
+
titleTag,
|
|
951
|
+
clearTag,
|
|
952
|
+
enableTag
|
|
616
953
|
}) {
|
|
617
954
|
const [showAll, setShowAll] = useState(false);
|
|
618
955
|
const visible = showAll ? items : items.slice(0, MAX_RECENT);
|
|
619
|
-
return /* @__PURE__ */ jsxs(RecentSearchesSection, { "aria-label": title, children: [
|
|
956
|
+
return /* @__PURE__ */ jsxs(RecentSearchesSection, { "aria-label": title, ...enableTag != null ? enableTag : {}, children: [
|
|
620
957
|
/* @__PURE__ */ jsxs(RecentSearchesHeader, { children: [
|
|
621
|
-
/* @__PURE__ */ jsx(RecentSearchesTitle, { children: title }),
|
|
958
|
+
/* @__PURE__ */ jsx(RecentSearchesTitle, { ...titleTag != null ? titleTag : {}, children: title }),
|
|
622
959
|
/* @__PURE__ */ jsx(
|
|
623
960
|
RecentSearchesClearButton,
|
|
624
961
|
{
|
|
625
962
|
type: "button",
|
|
626
963
|
onMouseDown: (e) => e.preventDefault(),
|
|
627
964
|
onClick: onClear,
|
|
965
|
+
...clearTag != null ? clearTag : {},
|
|
628
966
|
children: clearLabel
|
|
629
967
|
}
|
|
630
968
|
)
|
|
@@ -654,23 +992,18 @@ function RecentSearches({
|
|
|
654
992
|
}
|
|
655
993
|
var SUGGESTION_MOBILE_MAX_PX = 1024;
|
|
656
994
|
var colors4 = {
|
|
657
|
-
text: "#111827"
|
|
658
|
-
|
|
659
|
-
var
|
|
660
|
-
display:
|
|
995
|
+
text: "#111827"
|
|
996
|
+
};
|
|
997
|
+
var SuggestionRow = styled4.li`
|
|
998
|
+
display: grid;
|
|
999
|
+
grid-template-columns: minmax(0, 1fr);
|
|
661
1000
|
align-items: center;
|
|
1001
|
+
justify-items: stretch;
|
|
662
1002
|
width: 100%;
|
|
663
1003
|
min-height: 58px;
|
|
664
1004
|
padding: 4px 24px;
|
|
665
1005
|
box-sizing: border-box;
|
|
666
1006
|
color: ${colors4.text};
|
|
667
|
-
`;
|
|
668
|
-
var SuggestionRow = styled4(SuggestionOption)`
|
|
669
|
-
display: grid;
|
|
670
|
-
grid-template-columns: minmax(0, 1fr) 18px;
|
|
671
|
-
align-items: center;
|
|
672
|
-
column-gap: 12px;
|
|
673
|
-
width: 100%;
|
|
674
1007
|
background: transparent;
|
|
675
1008
|
|
|
676
1009
|
&[data-highlighted='true'],
|
|
@@ -682,23 +1015,20 @@ var SuggestionRow = styled4(SuggestionOption)`
|
|
|
682
1015
|
opacity: 0.75;
|
|
683
1016
|
}
|
|
684
1017
|
|
|
685
|
-
&[data-suggestion-type='did-you-mean'] {
|
|
686
|
-
grid-template-columns: minmax(0, 1fr);
|
|
687
|
-
}
|
|
688
|
-
|
|
689
1018
|
@media (max-width: ${SUGGESTION_MOBILE_MAX_PX}px) {
|
|
690
1019
|
padding: 6px 24px;
|
|
691
|
-
column-gap: 8px;
|
|
692
1020
|
}
|
|
693
1021
|
`;
|
|
1022
|
+
var SuggestionProductSnippet = styled4.div`
|
|
1023
|
+
display: block;
|
|
1024
|
+
min-width: 0;
|
|
1025
|
+
width: 100%;
|
|
1026
|
+
`;
|
|
694
1027
|
var SuggestionContentWrapper = styled4.button`
|
|
695
1028
|
appearance: none;
|
|
696
1029
|
background: transparent;
|
|
697
1030
|
border: 0;
|
|
698
|
-
display:
|
|
699
|
-
grid-template-columns: 50px minmax(0, 1fr);
|
|
700
|
-
align-items: center;
|
|
701
|
-
column-gap: 16px;
|
|
1031
|
+
display: block;
|
|
702
1032
|
width: 100%;
|
|
703
1033
|
min-width: 0;
|
|
704
1034
|
margin: 0;
|
|
@@ -707,32 +1037,12 @@ var SuggestionContentWrapper = styled4.button`
|
|
|
707
1037
|
cursor: pointer;
|
|
708
1038
|
font: inherit;
|
|
709
1039
|
outline: none;
|
|
710
|
-
border-radius: 6px;
|
|
711
1040
|
text-align: start;
|
|
712
1041
|
|
|
713
|
-
&[data-out-of-stock='true'] {
|
|
714
|
-
cursor: default;
|
|
715
|
-
}
|
|
716
|
-
|
|
717
|
-
&[data-has-image='false'] {
|
|
718
|
-
grid-template-columns: minmax(0, 1fr);
|
|
719
|
-
}
|
|
720
|
-
|
|
721
1042
|
&:focus-visible {
|
|
722
1043
|
outline: 2px solid ${colors4.text};
|
|
723
1044
|
outline-offset: 3px;
|
|
724
1045
|
}
|
|
725
|
-
|
|
726
|
-
&[data-suggestion-type='did-you-mean'] {
|
|
727
|
-
grid-template-columns: minmax(0, 1fr);
|
|
728
|
-
}
|
|
729
|
-
`;
|
|
730
|
-
var SuggestionThumbnail = styled4.img`
|
|
731
|
-
width: 50px;
|
|
732
|
-
height: 50px;
|
|
733
|
-
object-fit: contain;
|
|
734
|
-
flex-shrink: 0;
|
|
735
|
-
align-self: center;
|
|
736
1046
|
`;
|
|
737
1047
|
var SuggestionLabel = styled4.span`
|
|
738
1048
|
display: block;
|
|
@@ -749,202 +1059,187 @@ var SuggestionLabel = styled4.span`
|
|
|
749
1059
|
line-height: 20px;
|
|
750
1060
|
}
|
|
751
1061
|
`;
|
|
752
|
-
var SuggestionActionIcon = styled4.span`
|
|
753
|
-
display: inline-flex;
|
|
754
|
-
align-items: center;
|
|
755
|
-
justify-content: center;
|
|
756
|
-
width: 24px;
|
|
757
|
-
height: 24px;
|
|
758
|
-
color: var(--suggestion-icon-color, ${colors4.text});
|
|
759
|
-
flex-shrink: 0;
|
|
760
|
-
align-self: center;
|
|
761
|
-
|
|
762
|
-
&[data-cart-disabled='true'] {
|
|
763
|
-
color: var(--suggestion-muted, ${colors4.muted});
|
|
764
|
-
}
|
|
765
|
-
|
|
766
|
-
svg {
|
|
767
|
-
width: 24px;
|
|
768
|
-
height: 24px;
|
|
769
|
-
display: block;
|
|
770
|
-
}
|
|
771
|
-
`;
|
|
772
|
-
var SuggestionActionButton = styled4.button`
|
|
773
|
-
display: inline-flex;
|
|
774
|
-
align-items: center;
|
|
775
|
-
justify-content: center;
|
|
776
|
-
width: 24px;
|
|
777
|
-
height: 24px;
|
|
778
|
-
margin: 0;
|
|
779
|
-
padding: 0;
|
|
780
|
-
border: none;
|
|
781
|
-
background: transparent;
|
|
782
|
-
color: var(--suggestion-icon-color, ${colors4.text});
|
|
783
|
-
flex-shrink: 0;
|
|
784
|
-
align-self: center;
|
|
785
|
-
cursor: pointer;
|
|
786
|
-
|
|
787
|
-
&:focus-visible {
|
|
788
|
-
outline: 2px solid ${colors4.text};
|
|
789
|
-
outline-offset: 3px;
|
|
790
|
-
border-radius: 4px;
|
|
791
|
-
}
|
|
792
|
-
|
|
793
|
-
svg {
|
|
794
|
-
width: 24px;
|
|
795
|
-
height: 24px;
|
|
796
|
-
display: block;
|
|
797
|
-
}
|
|
798
|
-
`;
|
|
799
1062
|
|
|
800
1063
|
// src/components/SuggestionRow/helpers.ts
|
|
801
1064
|
function getSuggestionUrl(option) {
|
|
802
1065
|
var _a, _b;
|
|
803
1066
|
return "url" in option ? (_b = (_a = option.url) != null ? _a : option.href) != null ? _b : "" : "";
|
|
804
1067
|
}
|
|
1068
|
+
function suggestionRequiresProductPage(option) {
|
|
1069
|
+
var _a;
|
|
1070
|
+
if (option.requiresProductPage === true) {
|
|
1071
|
+
return true;
|
|
1072
|
+
}
|
|
1073
|
+
if (option.requiresProductPage === false) {
|
|
1074
|
+
return false;
|
|
1075
|
+
}
|
|
1076
|
+
if (option.productType === "bundle") {
|
|
1077
|
+
return true;
|
|
1078
|
+
}
|
|
1079
|
+
const skuCount = Number((_a = option.skuCount) != null ? _a : 0);
|
|
1080
|
+
return skuCount > 1;
|
|
1081
|
+
}
|
|
805
1082
|
function getSuggestionDisplayData(option) {
|
|
806
1083
|
if ("suggestionType" in option) {
|
|
807
1084
|
return {
|
|
808
1085
|
imageSrc: "",
|
|
809
1086
|
displayLabel: option.value,
|
|
1087
|
+
requiresProductPage: false,
|
|
810
1088
|
isBundle: false,
|
|
811
1089
|
isDidYouMean: true,
|
|
812
1090
|
isOutOfStock: false,
|
|
813
1091
|
isCartActionDisabled: false
|
|
814
1092
|
};
|
|
815
1093
|
}
|
|
1094
|
+
const requiresProductPage = suggestionRequiresProductPage(option);
|
|
816
1095
|
return {
|
|
817
1096
|
imageSrc: option.imageURL.trim() || option.thumbnail.trim(),
|
|
818
1097
|
displayLabel: option.value,
|
|
819
|
-
|
|
1098
|
+
requiresProductPage,
|
|
1099
|
+
isBundle: requiresProductPage,
|
|
820
1100
|
isDidYouMean: false,
|
|
821
1101
|
isOutOfStock: option.outOfStock,
|
|
822
1102
|
isCartActionDisabled: option.cartActionDisabled
|
|
823
1103
|
};
|
|
824
1104
|
}
|
|
825
|
-
var
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
if (direction === null) return;
|
|
830
|
-
event.preventDefault();
|
|
831
|
-
onNavigate(direction);
|
|
1105
|
+
var useIsomorphicLayoutEffect = typeof window === "undefined" ? useEffect : useLayoutEffect;
|
|
1106
|
+
function assignProductControlRef(node, controlRef) {
|
|
1107
|
+
const productButton = node == null ? void 0 : node.querySelector("button");
|
|
1108
|
+
controlRef == null ? void 0 : controlRef(productButton != null ? productButton : null);
|
|
832
1109
|
}
|
|
833
|
-
function
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
const image = event.currentTarget;
|
|
847
|
-
if (fallbackImageUrl && image.getAttribute("src") !== fallbackImageUrl) {
|
|
848
|
-
image.src = fallbackImageUrl;
|
|
849
|
-
}
|
|
850
|
-
}
|
|
851
|
-
}
|
|
852
|
-
);
|
|
1110
|
+
function snippetCtaProps(display, addToCartLabel, openBundleLabel, logos) {
|
|
1111
|
+
if (display.requiresProductPage) {
|
|
1112
|
+
return {
|
|
1113
|
+
ctaDisabled: false,
|
|
1114
|
+
ctaLogo: logos.PRODUCT_PAGE_LOGO,
|
|
1115
|
+
ctaAriaLabel: openBundleLabel(display.displayLabel)
|
|
1116
|
+
};
|
|
1117
|
+
}
|
|
1118
|
+
return {
|
|
1119
|
+
ctaDisabled: display.isCartActionDisabled,
|
|
1120
|
+
ctaLogo: logos.CART_LOGO,
|
|
1121
|
+
ctaAriaLabel: addToCartLabel(display.displayLabel)
|
|
1122
|
+
};
|
|
853
1123
|
}
|
|
854
|
-
function
|
|
1124
|
+
function ProductSuggestionSnippet({
|
|
1125
|
+
addToCartLabel,
|
|
855
1126
|
controlRef,
|
|
856
1127
|
display,
|
|
857
1128
|
fallbackImageUrl,
|
|
858
1129
|
onHighlightSuggestion,
|
|
1130
|
+
onNavigate,
|
|
1131
|
+
onRunSuggestionAction,
|
|
859
1132
|
onSelectSuggestion,
|
|
1133
|
+
openBundleLabel,
|
|
1134
|
+
openProductPageLabel,
|
|
860
1135
|
suggestionIndex,
|
|
861
1136
|
suggestionOption
|
|
862
1137
|
}) {
|
|
863
|
-
const
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
{
|
|
867
|
-
|
|
868
|
-
type: "button",
|
|
869
|
-
"aria-disabled": isOutOfStock ? true : void 0,
|
|
870
|
-
"data-testid": `suggestion-content-${suggestionOption.id}`,
|
|
871
|
-
"data-suggestion-type": isDidYouMean ? "did-you-mean" : "product",
|
|
872
|
-
"data-has-image": flag(!isDidYouMean),
|
|
873
|
-
"data-out-of-stock": flag(isOutOfStock),
|
|
874
|
-
"data-gtm-type": GTM_SEARCH_RESULT_CLICK,
|
|
875
|
-
"data-gtm-result-title": displayLabel,
|
|
876
|
-
"data-gtm-result-url": getSuggestionUrl(suggestionOption),
|
|
877
|
-
onFocus: () => onHighlightSuggestion(suggestionIndex),
|
|
878
|
-
onClick: () => {
|
|
879
|
-
if (!isOutOfStock) onSelectSuggestion(suggestionOption);
|
|
880
|
-
},
|
|
881
|
-
children: [
|
|
882
|
-
!isDidYouMean && /* @__PURE__ */ jsx(
|
|
883
|
-
SuggestionImage,
|
|
884
|
-
{
|
|
885
|
-
fallbackImageUrl,
|
|
886
|
-
id: suggestionOption.id,
|
|
887
|
-
src: imageSrc
|
|
888
|
-
}
|
|
889
|
-
),
|
|
890
|
-
/* @__PURE__ */ jsx(SuggestionLabel, { children: displayLabel })
|
|
891
|
-
]
|
|
1138
|
+
const [productModule, setProductModule] = useState(null);
|
|
1139
|
+
const hostRef = useRef(null);
|
|
1140
|
+
useEffect(() => {
|
|
1141
|
+
if (typeof window === "undefined") {
|
|
1142
|
+
return void 0;
|
|
892
1143
|
}
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
testId: isBundle ? `suggestion-bundle-icon-${id}` : `suggestion-cart-icon-${id}`,
|
|
907
|
-
type: isBundle ? ICON_TYPES.SUGGESTION_TASK : ICON_TYPES.SUGGESTION_CART
|
|
1144
|
+
let canceled = false;
|
|
1145
|
+
void import('@nuskin/react-product-components').then((module) => {
|
|
1146
|
+
if (!canceled) {
|
|
1147
|
+
setProductModule(module);
|
|
1148
|
+
}
|
|
1149
|
+
});
|
|
1150
|
+
return () => {
|
|
1151
|
+
canceled = true;
|
|
1152
|
+
};
|
|
1153
|
+
}, []);
|
|
1154
|
+
useIsomorphicLayoutEffect(() => {
|
|
1155
|
+
if (productModule) {
|
|
1156
|
+
assignProductControlRef(hostRef.current, controlRef);
|
|
908
1157
|
}
|
|
1158
|
+
}, [productModule, controlRef]);
|
|
1159
|
+
const { displayLabel, imageSrc } = display;
|
|
1160
|
+
const imageUrl = imageSrc || fallbackImageUrl;
|
|
1161
|
+
const setSnippetRef = useCallback(
|
|
1162
|
+
(node) => {
|
|
1163
|
+
hostRef.current = node;
|
|
1164
|
+
assignProductControlRef(node, controlRef);
|
|
1165
|
+
},
|
|
1166
|
+
[controlRef]
|
|
909
1167
|
);
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
if (isCartActionDisabled) {
|
|
1168
|
+
const onFocusCapture = useCallback(
|
|
1169
|
+
() => onHighlightSuggestion(suggestionIndex),
|
|
1170
|
+
[onHighlightSuggestion, suggestionIndex]
|
|
1171
|
+
);
|
|
1172
|
+
const onKeyDownCapture = useCallback(
|
|
1173
|
+
(event) => {
|
|
1174
|
+
const direction = getArrowDirection(event);
|
|
1175
|
+
if (direction === null) return;
|
|
1176
|
+
event.preventDefault();
|
|
1177
|
+
onNavigate(direction);
|
|
1178
|
+
},
|
|
1179
|
+
[onNavigate]
|
|
1180
|
+
);
|
|
1181
|
+
if (!productModule) {
|
|
925
1182
|
return /* @__PURE__ */ jsx(
|
|
926
|
-
|
|
1183
|
+
SuggestionProductSnippet,
|
|
927
1184
|
{
|
|
928
|
-
|
|
929
|
-
"data-suggestion-
|
|
930
|
-
|
|
931
|
-
|
|
1185
|
+
ref: setSnippetRef,
|
|
1186
|
+
"data-testid": "suggestion-product-snippet",
|
|
1187
|
+
onFocusCapture,
|
|
1188
|
+
onKeyDownCapture,
|
|
1189
|
+
"aria-busy": "true",
|
|
1190
|
+
children: /* @__PURE__ */ jsx(SuggestionLabel, { children: displayLabel })
|
|
932
1191
|
}
|
|
933
1192
|
);
|
|
934
1193
|
}
|
|
1194
|
+
const { ProductSnippet, PRODUCT_SNIPPET_CTA_LOGOS } = productModule;
|
|
1195
|
+
const { ctaDisabled, ctaLogo, ctaAriaLabel } = snippetCtaProps(
|
|
1196
|
+
display,
|
|
1197
|
+
addToCartLabel,
|
|
1198
|
+
openBundleLabel,
|
|
1199
|
+
PRODUCT_SNIPPET_CTA_LOGOS
|
|
1200
|
+
);
|
|
935
1201
|
return /* @__PURE__ */ jsx(
|
|
936
|
-
|
|
1202
|
+
SuggestionProductSnippet,
|
|
937
1203
|
{
|
|
938
|
-
|
|
939
|
-
"data-testid":
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
1204
|
+
ref: setSnippetRef,
|
|
1205
|
+
"data-testid": "suggestion-product-snippet",
|
|
1206
|
+
onFocusCapture,
|
|
1207
|
+
onKeyDownCapture,
|
|
1208
|
+
children: /* @__PURE__ */ jsx(
|
|
1209
|
+
ProductSnippet,
|
|
1210
|
+
{
|
|
1211
|
+
title: displayLabel,
|
|
1212
|
+
imageUrl,
|
|
1213
|
+
imageAlt: "",
|
|
1214
|
+
productAriaLabel: openProductPageLabel(displayLabel),
|
|
1215
|
+
ctaLogo,
|
|
1216
|
+
ctaAriaLabel,
|
|
1217
|
+
ctaDisabled,
|
|
1218
|
+
onProductClick: () => onSelectSuggestion(suggestionOption),
|
|
1219
|
+
onCtaClick: () => {
|
|
1220
|
+
onHighlightSuggestion(suggestionIndex);
|
|
1221
|
+
if (ctaDisabled) {
|
|
1222
|
+
return;
|
|
1223
|
+
}
|
|
1224
|
+
onRunSuggestionAction(suggestionOption);
|
|
1225
|
+
}
|
|
1226
|
+
}
|
|
1227
|
+
)
|
|
945
1228
|
}
|
|
946
1229
|
);
|
|
947
1230
|
}
|
|
1231
|
+
var GTM_SEARCH_RESULT_CLICK = "searchResultClick";
|
|
1232
|
+
var flag = (value) => value ? "true" : "false";
|
|
1233
|
+
function passArrowKeysToList(event, onNavigate) {
|
|
1234
|
+
const direction = getArrowDirection(event);
|
|
1235
|
+
if (direction === null) return;
|
|
1236
|
+
event.preventDefault();
|
|
1237
|
+
onNavigate(direction);
|
|
1238
|
+
}
|
|
1239
|
+
function cartDisabledAttr(isDidYouMean, display) {
|
|
1240
|
+
if (isDidYouMean || display.requiresProductPage) return "false";
|
|
1241
|
+
return flag(display.isCartActionDisabled);
|
|
1242
|
+
}
|
|
948
1243
|
function SuggestionRow2({
|
|
949
1244
|
addToCartLabel,
|
|
950
1245
|
controlRef,
|
|
@@ -954,44 +1249,53 @@ function SuggestionRow2({
|
|
|
954
1249
|
onRunSuggestionAction,
|
|
955
1250
|
onSelectSuggestion,
|
|
956
1251
|
openBundleLabel,
|
|
1252
|
+
openProductPageLabel,
|
|
957
1253
|
suggestionIndex,
|
|
958
1254
|
suggestionOption,
|
|
959
1255
|
fallbackImageUrl = ""
|
|
960
1256
|
}) {
|
|
961
1257
|
const display = getSuggestionDisplayData(suggestionOption);
|
|
962
|
-
const { displayLabel,
|
|
1258
|
+
const { displayLabel, isDidYouMean, isOutOfStock } = display;
|
|
963
1259
|
const controls = { onHighlightSuggestion, suggestionIndex, suggestionOption };
|
|
964
|
-
return /* @__PURE__ */
|
|
1260
|
+
return /* @__PURE__ */ jsx(
|
|
965
1261
|
SuggestionRow,
|
|
966
1262
|
{
|
|
967
1263
|
"data-testid": `suggestion-row-${suggestionOption.id}`,
|
|
968
1264
|
"data-highlighted": flag(isHighlighted),
|
|
969
1265
|
"data-suggestion-type": isDidYouMean ? "did-you-mean" : "product",
|
|
1266
|
+
"data-product-snippet": isDidYouMean ? "false" : "true",
|
|
1267
|
+
"data-cart-disabled": cartDisabledAttr(isDidYouMean, display),
|
|
970
1268
|
onMouseEnter: () => onHighlightSuggestion(suggestionIndex),
|
|
971
1269
|
onKeyDown: (event) => passArrowKeysToList(event, onNavigate),
|
|
972
1270
|
"data-out-of-stock": flag(isOutOfStock),
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
1271
|
+
"data-gtm-type": GTM_SEARCH_RESULT_CLICK,
|
|
1272
|
+
"data-gtm-result-title": displayLabel,
|
|
1273
|
+
"data-gtm-result-url": getSuggestionUrl(suggestionOption),
|
|
1274
|
+
children: isDidYouMean ? /* @__PURE__ */ jsx(
|
|
1275
|
+
SuggestionContentWrapper,
|
|
1276
|
+
{
|
|
1277
|
+
type: "button",
|
|
1278
|
+
"data-testid": `suggestion-content-${suggestionOption.id}`,
|
|
1279
|
+
"data-suggestion-type": "did-you-mean",
|
|
1280
|
+
onFocus: () => onHighlightSuggestion(suggestionIndex),
|
|
1281
|
+
onClick: () => onSelectSuggestion(suggestionOption),
|
|
1282
|
+
children: /* @__PURE__ */ jsx(SuggestionLabel, { children: displayLabel })
|
|
1283
|
+
}
|
|
1284
|
+
) : /* @__PURE__ */ jsx(
|
|
1285
|
+
ProductSuggestionSnippet,
|
|
1286
|
+
{
|
|
1287
|
+
...controls,
|
|
1288
|
+
addToCartLabel,
|
|
1289
|
+
controlRef,
|
|
1290
|
+
display,
|
|
1291
|
+
fallbackImageUrl,
|
|
1292
|
+
onNavigate,
|
|
1293
|
+
onRunSuggestionAction,
|
|
1294
|
+
onSelectSuggestion,
|
|
1295
|
+
openBundleLabel,
|
|
1296
|
+
openProductPageLabel
|
|
1297
|
+
}
|
|
1298
|
+
)
|
|
995
1299
|
}
|
|
996
1300
|
);
|
|
997
1301
|
}
|
|
@@ -1085,6 +1389,7 @@ var SearchSuggestions = forwardRef(function SearchSuggestions2({
|
|
|
1085
1389
|
didYouMeanText,
|
|
1086
1390
|
noSuggestionsText,
|
|
1087
1391
|
openBundleLabel,
|
|
1392
|
+
openProductPageLabel,
|
|
1088
1393
|
seeMoreText,
|
|
1089
1394
|
suggestionsLabel,
|
|
1090
1395
|
fallbackImageUrl,
|
|
@@ -1097,32 +1402,53 @@ var SearchSuggestions = forwardRef(function SearchSuggestions2({
|
|
|
1097
1402
|
const headingId = useId();
|
|
1098
1403
|
const rowControls = useRef([]);
|
|
1099
1404
|
const seeMoreButton = useRef(null);
|
|
1405
|
+
const pendingFirstFocus = useRef(false);
|
|
1100
1406
|
const rowCount = loading ? 0 : items.length;
|
|
1101
1407
|
const showSeeMore = !loading && hasMore && !showDidYouMean;
|
|
1408
|
+
const showDidYouMeanHeading = showDidYouMean && didYouMeanText.trim() !== "";
|
|
1102
1409
|
const stopCount = rowCount + (showSeeMore ? 1 : 0);
|
|
1103
1410
|
function focusStop(index) {
|
|
1104
1411
|
const stop = index < rowCount ? rowControls.current[index] : seeMoreButton.current;
|
|
1105
1412
|
stop == null ? void 0 : stop.focus();
|
|
1413
|
+
return Boolean(stop);
|
|
1106
1414
|
}
|
|
1107
1415
|
function moveFrom(index, direction) {
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1416
|
+
let next = index + direction;
|
|
1417
|
+
while (next >= 0 && next < stopCount) {
|
|
1418
|
+
if (focusStop(next)) return;
|
|
1419
|
+
next += direction;
|
|
1420
|
+
}
|
|
1421
|
+
if (next < 0) {
|
|
1422
|
+
if (index === 0) onLeaveTop();
|
|
1423
|
+
else focusStop(index);
|
|
1424
|
+
}
|
|
1111
1425
|
}
|
|
1112
1426
|
useImperativeHandle(ref, () => ({
|
|
1113
1427
|
focusFirst() {
|
|
1114
|
-
if (
|
|
1115
|
-
|
|
1116
|
-
|
|
1428
|
+
if (rowCount > 0) {
|
|
1429
|
+
const stop = rowControls.current[0];
|
|
1430
|
+
if (!stop) {
|
|
1431
|
+
pendingFirstFocus.current = true;
|
|
1432
|
+
return false;
|
|
1433
|
+
}
|
|
1434
|
+
pendingFirstFocus.current = false;
|
|
1435
|
+
stop.focus();
|
|
1436
|
+
return true;
|
|
1437
|
+
}
|
|
1438
|
+
if (showSeeMore && seeMoreButton.current) {
|
|
1439
|
+
seeMoreButton.current.focus();
|
|
1440
|
+
return true;
|
|
1441
|
+
}
|
|
1442
|
+
return false;
|
|
1117
1443
|
}
|
|
1118
1444
|
}));
|
|
1119
1445
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1120
|
-
|
|
1446
|
+
showDidYouMeanHeading ? /* @__PURE__ */ jsx(SuggestionSectionHeading, { id: headingId, "data-testid": "autocomplete-did-you-mean-heading", children: didYouMeanText }) : null,
|
|
1121
1447
|
/* @__PURE__ */ jsxs(
|
|
1122
1448
|
SearchSuggestionsList,
|
|
1123
1449
|
{
|
|
1124
|
-
"aria-label":
|
|
1125
|
-
"aria-labelledby":
|
|
1450
|
+
"aria-label": showDidYouMeanHeading ? void 0 : suggestionsLabel,
|
|
1451
|
+
"aria-labelledby": showDidYouMeanHeading ? headingId : void 0,
|
|
1126
1452
|
"aria-busy": loading,
|
|
1127
1453
|
"data-testid": "autocomplete-results-list",
|
|
1128
1454
|
children: [
|
|
@@ -1131,8 +1457,13 @@ var SearchSuggestions = forwardRef(function SearchSuggestions2({
|
|
|
1131
1457
|
{
|
|
1132
1458
|
addToCartLabel,
|
|
1133
1459
|
openBundleLabel,
|
|
1460
|
+
openProductPageLabel,
|
|
1134
1461
|
controlRef: (control) => {
|
|
1135
1462
|
rowControls.current[index] = control;
|
|
1463
|
+
if (control && index === 0 && pendingFirstFocus.current) {
|
|
1464
|
+
pendingFirstFocus.current = false;
|
|
1465
|
+
control.focus();
|
|
1466
|
+
}
|
|
1136
1467
|
},
|
|
1137
1468
|
isHighlighted: index === highlightedIndex,
|
|
1138
1469
|
onHighlightSuggestion: setHighlightedIndex,
|
|
@@ -1161,6 +1492,10 @@ var SearchSuggestions = forwardRef(function SearchSuggestions2({
|
|
|
1161
1492
|
)
|
|
1162
1493
|
] });
|
|
1163
1494
|
});
|
|
1495
|
+
function shouldShowRecentSearches(hasQuery, recentSearches) {
|
|
1496
|
+
if (hasQuery || !recentSearches) return false;
|
|
1497
|
+
return recentSearches.items.length > 0 || Boolean(recentSearches.showWhenEmpty);
|
|
1498
|
+
}
|
|
1164
1499
|
function useIsMounted() {
|
|
1165
1500
|
const [isMounted, setIsMounted] = useState(false);
|
|
1166
1501
|
useEffect(() => {
|
|
@@ -1202,6 +1537,83 @@ function getStatusText({ loading, showNoResults, items }, copy) {
|
|
|
1202
1537
|
if (showNoResults) return copy.noSuggestions;
|
|
1203
1538
|
return items.length > 0 ? copy.suggestionsCount(items.length) : "";
|
|
1204
1539
|
}
|
|
1540
|
+
function messageInputEditProps(editTags) {
|
|
1541
|
+
if (!editTags) return {};
|
|
1542
|
+
const props = {};
|
|
1543
|
+
if (editTags.searchPlaceholder) props.placeholderTag = editTags.searchPlaceholder;
|
|
1544
|
+
if (editTags.mobileRotatingPlaceholder) {
|
|
1545
|
+
props.rotatingPlaceholderTag = editTags.mobileRotatingPlaceholder;
|
|
1546
|
+
}
|
|
1547
|
+
return props;
|
|
1548
|
+
}
|
|
1549
|
+
function layoutCancelEditProps(editTags) {
|
|
1550
|
+
if (!editTags) return {};
|
|
1551
|
+
const props = {};
|
|
1552
|
+
if (editTags.cancelLabel) props.cancelLabelTag = editTags.cancelLabel;
|
|
1553
|
+
if (editTags.cancelShowIcon) props.cancelShowIconTag = editTags.cancelShowIcon;
|
|
1554
|
+
return props;
|
|
1555
|
+
}
|
|
1556
|
+
function recentSearchesEditProps(editTags) {
|
|
1557
|
+
if (!editTags) return {};
|
|
1558
|
+
const props = {};
|
|
1559
|
+
if (editTags.recentSearchesHeading) props.titleTag = editTags.recentSearchesHeading;
|
|
1560
|
+
if (editTags.clearAllLabel) props.clearTag = editTags.clearAllLabel;
|
|
1561
|
+
if (editTags.enableRecentSearches) props.enableTag = editTags.enableRecentSearches;
|
|
1562
|
+
return props;
|
|
1563
|
+
}
|
|
1564
|
+
function SearchPanelAutocompleteBody({
|
|
1565
|
+
copy,
|
|
1566
|
+
editTags,
|
|
1567
|
+
fallbackImageUrl,
|
|
1568
|
+
hasQuery,
|
|
1569
|
+
inputRef,
|
|
1570
|
+
recentSearches,
|
|
1571
|
+
showSuggestions,
|
|
1572
|
+
suggestions,
|
|
1573
|
+
suggestionsRef
|
|
1574
|
+
}) {
|
|
1575
|
+
var _a;
|
|
1576
|
+
const showRecent = shouldShowRecentSearches(hasQuery, recentSearches);
|
|
1577
|
+
return /* @__PURE__ */ jsxs(
|
|
1578
|
+
SearchSuggestionsPanel,
|
|
1579
|
+
{
|
|
1580
|
+
"data-testid": "autocomplete-suggestions-panel",
|
|
1581
|
+
...(_a = editTags == null ? void 0 : editTags.enableAutocomplete) != null ? _a : {},
|
|
1582
|
+
children: [
|
|
1583
|
+
/* @__PURE__ */ jsx(SearchPanelStatus, { "aria-atomic": "true", "data-testid": "search-panel-status", children: showSuggestions ? getStatusText(suggestions, copy) : "" }),
|
|
1584
|
+
showSuggestions ? /* @__PURE__ */ jsx(
|
|
1585
|
+
SearchSuggestions,
|
|
1586
|
+
{
|
|
1587
|
+
...suggestions,
|
|
1588
|
+
ref: suggestionsRef,
|
|
1589
|
+
onLeaveTop: () => {
|
|
1590
|
+
var _a2;
|
|
1591
|
+
return (_a2 = inputRef.current) == null ? void 0 : _a2.focus();
|
|
1592
|
+
},
|
|
1593
|
+
addToCartLabel: copy.addToCart,
|
|
1594
|
+
didYouMeanText: copy.didYouMean,
|
|
1595
|
+
noSuggestionsText: copy.noSuggestions,
|
|
1596
|
+
openBundleLabel: copy.openBundle,
|
|
1597
|
+
openProductPageLabel: copy.openProductPage,
|
|
1598
|
+
seeMoreText: copy.seeMoreResults,
|
|
1599
|
+
suggestionsLabel: copy.suggestionsLabel,
|
|
1600
|
+
fallbackImageUrl
|
|
1601
|
+
}
|
|
1602
|
+
) : null,
|
|
1603
|
+
showRecent && recentSearches ? /* @__PURE__ */ jsx(
|
|
1604
|
+
RecentSearches,
|
|
1605
|
+
{
|
|
1606
|
+
...recentSearches,
|
|
1607
|
+
title: copy.recentSearches,
|
|
1608
|
+
clearLabel: copy.clearRecentSearches,
|
|
1609
|
+
moreLabel: copy.moreRecentSearches,
|
|
1610
|
+
...recentSearchesEditProps(editTags)
|
|
1611
|
+
}
|
|
1612
|
+
) : null
|
|
1613
|
+
]
|
|
1614
|
+
}
|
|
1615
|
+
);
|
|
1616
|
+
}
|
|
1205
1617
|
function SearchPanel({
|
|
1206
1618
|
isOpen,
|
|
1207
1619
|
onClose,
|
|
@@ -1210,10 +1622,15 @@ function SearchPanel({
|
|
|
1210
1622
|
copy,
|
|
1211
1623
|
input,
|
|
1212
1624
|
suggestions,
|
|
1625
|
+
showSuggestions = true,
|
|
1213
1626
|
recentSearches,
|
|
1214
|
-
agentPanel
|
|
1627
|
+
agentPanel,
|
|
1628
|
+
showNuiIcons = false,
|
|
1629
|
+
showCancelIcon = true,
|
|
1630
|
+
rotatingPlaceholders,
|
|
1631
|
+
rotatingPlaceholderIntervalMs,
|
|
1632
|
+
editTags
|
|
1215
1633
|
}) {
|
|
1216
|
-
var _a;
|
|
1217
1634
|
const inputRef = useRef(null);
|
|
1218
1635
|
const layoutRef = useRef(null);
|
|
1219
1636
|
const suggestionsRef = useRef(null);
|
|
@@ -1225,7 +1642,6 @@ function SearchPanel({
|
|
|
1225
1642
|
useFocusOnOpen(hasAgent ? layoutRef : inputRef, isShown);
|
|
1226
1643
|
if (!isShown) return null;
|
|
1227
1644
|
const hasQuery = input.value.trim() !== "";
|
|
1228
|
-
const hasRecentSearches = ((_a = recentSearches == null ? void 0 : recentSearches.items.length) != null ? _a : 0) > 0;
|
|
1229
1645
|
const searchInput = /* @__PURE__ */ jsx(
|
|
1230
1646
|
SearchMessageInput,
|
|
1231
1647
|
{
|
|
@@ -1233,14 +1649,20 @@ function SearchPanel({
|
|
|
1233
1649
|
inputLabel: copy.searchLabel,
|
|
1234
1650
|
inputRef,
|
|
1235
1651
|
onArrowDown: () => {
|
|
1236
|
-
var
|
|
1237
|
-
return (_b = (
|
|
1652
|
+
var _a, _b;
|
|
1653
|
+
return (_b = (_a = suggestionsRef.current) == null ? void 0 : _a.focusFirst()) != null ? _b : false;
|
|
1238
1654
|
},
|
|
1239
1655
|
onChange: input.onChange,
|
|
1240
1656
|
onSubmit: input.onSubmit,
|
|
1241
1657
|
placeholder: copy.searchPlaceholder,
|
|
1242
1658
|
submitLabel: copy.submitSearch,
|
|
1243
1659
|
value: input.value,
|
|
1660
|
+
showNuiIcons,
|
|
1661
|
+
voiceSearchLabel: copy.voiceSearch,
|
|
1662
|
+
askNuiLabel: copy.askNui,
|
|
1663
|
+
...messageInputEditProps(editTags),
|
|
1664
|
+
...rotatingPlaceholders ? { rotatingPlaceholders } : {},
|
|
1665
|
+
...rotatingPlaceholderIntervalMs != null ? { rotatingPlaceholderIntervalMs } : {},
|
|
1244
1666
|
"data-testid": "search-panel-input"
|
|
1245
1667
|
}
|
|
1246
1668
|
);
|
|
@@ -1259,40 +1681,26 @@ function SearchPanel({
|
|
|
1259
1681
|
"aria-label": copy.searchLabel,
|
|
1260
1682
|
tabIndex: -1,
|
|
1261
1683
|
closeLabel: copy.cancel,
|
|
1684
|
+
showCancelIcon,
|
|
1685
|
+
...layoutCancelEditProps(editTags),
|
|
1262
1686
|
onClose,
|
|
1263
1687
|
logoSlot: logo,
|
|
1264
1688
|
agentMode: hasAgent,
|
|
1265
1689
|
inputSlot: hasAgent ? void 0 : searchInput,
|
|
1266
|
-
children: agentPanel != null ? agentPanel : /* @__PURE__ */
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
openBundleLabel: copy.openBundle,
|
|
1281
|
-
seeMoreText: copy.seeMoreResults,
|
|
1282
|
-
suggestionsLabel: copy.suggestionsLabel,
|
|
1283
|
-
fallbackImageUrl
|
|
1284
|
-
}
|
|
1285
|
-
),
|
|
1286
|
-
!hasQuery && recentSearches && hasRecentSearches && /* @__PURE__ */ jsx(
|
|
1287
|
-
RecentSearches,
|
|
1288
|
-
{
|
|
1289
|
-
...recentSearches,
|
|
1290
|
-
title: copy.recentSearches,
|
|
1291
|
-
clearLabel: copy.clearRecentSearches,
|
|
1292
|
-
moreLabel: copy.moreRecentSearches
|
|
1293
|
-
}
|
|
1294
|
-
)
|
|
1295
|
-
] })
|
|
1690
|
+
children: agentPanel != null ? agentPanel : /* @__PURE__ */ jsx(
|
|
1691
|
+
SearchPanelAutocompleteBody,
|
|
1692
|
+
{
|
|
1693
|
+
copy,
|
|
1694
|
+
editTags,
|
|
1695
|
+
fallbackImageUrl,
|
|
1696
|
+
hasQuery,
|
|
1697
|
+
inputRef,
|
|
1698
|
+
recentSearches,
|
|
1699
|
+
showSuggestions,
|
|
1700
|
+
suggestions,
|
|
1701
|
+
suggestionsRef
|
|
1702
|
+
}
|
|
1703
|
+
)
|
|
1296
1704
|
}
|
|
1297
1705
|
)
|
|
1298
1706
|
}
|