@magicx-eng/ai-autocomplete-react 0.24.2 → 0.26.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 +7 -2
- package/dist/index.d.mts +33 -3
- package/dist/index.d.ts +33 -3
- package/dist/index.js +174 -43
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +174 -43
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var ot=Object.defineProperty;var Vt=Object.getOwnPropertyDescriptor;var Zt=Object.getOwnPropertyNames;var Xt=Object.prototype.hasOwnProperty;var Jt=(e,o)=>{for(var t in o)ot(e,t,{get:o[t],enumerable:!0})},ea=(e,o,t,s)=>{if(o&&typeof o=="object"||typeof o=="function")for(let n of Zt(o))!Xt.call(e,n)&&n!==t&&ot(e,n,{get:()=>o[n],enumerable:!(s=Vt(o,n))||s.enumerable});return e};var ta=e=>ea(ot({},"__esModule",{value:!0}),e);var ma={};Jt(ma,{AIAutocomplete:()=>Ht,AIAutocompleteDropdown:()=>Ve,DATE_RANGE_META_END:()=>l.DATE_RANGE_META_END,DATE_RANGE_META_START:()=>l.DATE_RANGE_META_START,DEFAULT_OPTION_COUNT_UNIT:()=>l.DEFAULT_OPTION_COUNT_UNIT,PRODUCT_PATH_PREFIX:()=>l.PRODUCT_PATH_PREFIX,WEEKDAY_LABELS:()=>l.WEEKDAY_LABELS,buildSubmitResult:()=>l.buildSubmitResult,cellDay:()=>l.cellDay,cellIso:()=>l.cellIso,dateCellMarks:()=>l.dateCellMarks,formatDate:()=>l.formatDate,formatDateRange:()=>l.formatDateRange,formatOptionCount:()=>l.formatOptionCount,isoDate:()=>l.isoDate,monthLabel:()=>l.monthLabel,optionCountLabel:()=>l.optionCountLabel,optionHasImage:()=>l.optionHasImage,optionImageSrc:()=>l.optionImageSrc,optionLabel:()=>l.optionLabel,parseDate:()=>l.parseDate,parseLooseDate:()=>l.parseLooseDate,parseLooseDateRange:()=>l.parseLooseDateRange,productFromMatchedItem:()=>l.productFromMatchedItem,productsFromCustomFields:()=>l.productsFromCustomFields,sanitizeOptionIconSvg:()=>l.sanitizeOptionIconSvg,selectedRangeFor:()=>l.selectedRangeFor,useAIAutocomplete:()=>Xe,visibleDateRange:()=>l.visibleDateRange,withSkippedParams:()=>l.withSkippedParams});module.exports=ta(ma);var l=require("@magicx-eng/ai-autocomplete-vanilla");var M=require("react");if(typeof document<"u"&&!document.getElementById("ac-style-67791514")){let e=document.createElement("style");e.id="ac-style-67791514",e.textContent=`.aia-container-KKjFU {
|
|
2
2
|
position: relative;
|
|
3
3
|
/* Inherits the host page's font by default. Consumers can pin a specific
|
|
4
4
|
font on the library via \`--aia-font-family: 'Custom Font'\` without
|
|
@@ -17,8 +17,9 @@
|
|
|
17
17
|
10px the two sides would diverge; flooring both keeps them together. */
|
|
18
18
|
padding: 12px 16px 12px max(10px, var(--aia-content-inset-left, 16px));
|
|
19
19
|
border: 1px solid var(--aia-border, #b0b0b0);
|
|
20
|
-
border-radius:
|
|
20
|
+
border-radius: 10px;
|
|
21
21
|
background: var(--aia-surface, #ffffff);
|
|
22
|
+
/* Flat by default; consumers can set --aia-shadow for elevation. */
|
|
22
23
|
box-shadow: var(--aia-shadow, none);
|
|
23
24
|
overflow: hidden;
|
|
24
25
|
display: flex;
|
|
@@ -150,6 +151,27 @@
|
|
|
150
151
|
height: 100%;
|
|
151
152
|
}
|
|
152
153
|
|
|
154
|
+
/* The picked option's picture: a small rounded tile inline before the chip
|
|
155
|
+
text, in place of the icon. It is an empty inline span whose left padding
|
|
156
|
+
is the tile's width and whose background is the picture (set inline as
|
|
157
|
+
--aia-chip-image by the renderer) over a placeholder fill \u2014 not an <img>,
|
|
158
|
+
which as an atomic inline would let the line break between it and the
|
|
159
|
+
chip's text. The tile's height is the chip's own content height, so it
|
|
160
|
+
never grows the input's line. The fill shows until the picture paints and
|
|
161
|
+
stays if it never does; contentEditable is off on it (the renderer sets
|
|
162
|
+
that) so it adds no characters to the caret's plain text. */
|
|
163
|
+
:where(.aia-input-IW-P-) span[class~="magicx-aia-segment-image"] {
|
|
164
|
+
display: inline;
|
|
165
|
+
padding-left: var(--aia-chip-image-size, 1.25em);
|
|
166
|
+
margin-right: 5px;
|
|
167
|
+
border-radius: var(--aia-chip-image-radius, 4px);
|
|
168
|
+
background:
|
|
169
|
+
var(--aia-chip-image, none) center / cover no-repeat,
|
|
170
|
+
var(--aia-chip-image-bg, var(--aia-pill-bg, rgba(189, 189, 189, 0.25)));
|
|
171
|
+
pointer-events: none;
|
|
172
|
+
user-select: none;
|
|
173
|
+
}
|
|
174
|
+
|
|
153
175
|
/* Re-edit highlight \u2014 applied to the completed pill being re-edited (after a
|
|
154
176
|
tap). Reuses the exact hover fill so the highlight persists from tap until an
|
|
155
177
|
option is selected. Hides the native caret; cursor switches to text since the
|
|
@@ -240,7 +262,7 @@
|
|
|
240
262
|
opacity: 0;
|
|
241
263
|
}
|
|
242
264
|
}
|
|
243
|
-
`,document.head.appendChild(e)}var
|
|
265
|
+
`,document.head.appendChild(e)}var Re={container:"aia-container-KKjFU",inputWrapper:"aia-inputWrapper-FLq1b",editorArea:"aia-editorArea-7rBWq",input:"aia-input-IW-P-",pillListContainer:"aia-pillListContainer-h92IA",submitSlot:"aia-submitSlot-GhuCM",aiaPillReveal:"aia-aiaPillReveal-wf05b"};var Me=require("@magicx-eng/ai-autocomplete-vanilla"),te=require("react");if(typeof document<"u"&&!document.getElementById("ac-style-0ae03977")){let e=document.createElement("style");e.id="ac-style-0ae03977",e.textContent=`/*
|
|
244
266
|
* Built-in appearance defaults \u2014 zero specificity via :where().
|
|
245
267
|
* Consumer CSS always wins without !important.
|
|
246
268
|
*
|
|
@@ -424,15 +446,14 @@
|
|
|
424
446
|
:where(.magicx-aia[data-mode="light"]) {
|
|
425
447
|
--aia-surface: var(--aia-primitive-neutral-1000);
|
|
426
448
|
--aia-border: rgba(17, 24, 39, 0.14); /* subtle slate hairline (off-palette) */
|
|
427
|
-
/*
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
0 8px 24px rgba(16, 24, 40, 0.08);
|
|
449
|
+
/* Flat by default \u2014 no elevation on the input container. Consumers set
|
|
450
|
+
--aia-shadow to add one. */
|
|
451
|
+
--aia-shadow: none;
|
|
431
452
|
/* Half-strength stroke: neutral-900 (was #e5e7eb \u2014 snapped to palette,
|
|
432
453
|
\u03942) at 50% alpha over the surface, so the hairline lands exactly
|
|
433
454
|
halfway between its old value and the white behind it. */
|
|
434
455
|
--aia-dropdown-border: var(--aia-primitive-neutral-900-a50);
|
|
435
|
-
--aia-dropdown-shadow:
|
|
456
|
+
--aia-dropdown-shadow: none; /* flat by default */
|
|
436
457
|
/* Suggestion pills (Figma "ParamPill"): transparent fill, no visible border;
|
|
437
458
|
per-pill opacity via getPillOpacity. */
|
|
438
459
|
--aia-pill-bg: var(--aia-primitive-neutral-750);
|
|
@@ -479,15 +500,13 @@
|
|
|
479
500
|
:where(.magicx-aia[data-mode="dark"]) {
|
|
480
501
|
--aia-surface: var(--aia-primitive-neutral-0);
|
|
481
502
|
--aia-border: var(--aia-primitive-neutral-500);
|
|
482
|
-
/*
|
|
483
|
-
|
|
484
|
-
--aia-shadow:
|
|
485
|
-
inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 1px 2px rgba(0, 0, 0, 0.2),
|
|
486
|
-
0 8px 24px rgba(0, 0, 0, 0.25);
|
|
503
|
+
/* Flat by default \u2014 no elevation on the input container. Consumers set
|
|
504
|
+
--aia-shadow to add one. */
|
|
505
|
+
--aia-shadow: none;
|
|
487
506
|
/* Half-strength stroke \u2014 neutral-400 (was #484848 \u2014 snapped to palette,
|
|
488
507
|
\u03942) at 50% alpha; see the light-mode note above. */
|
|
489
508
|
--aia-dropdown-border: var(--aia-primitive-neutral-400-a50);
|
|
490
|
-
--aia-dropdown-shadow:
|
|
509
|
+
--aia-dropdown-shadow: none; /* flat by default */
|
|
491
510
|
/* Suggestion pills (Figma "ParamPill"): transparent fill, no visible border. */
|
|
492
511
|
--aia-pill-bg: var(--aia-primitive-neutral-750);
|
|
493
512
|
--aia-pill-color: var(--aia-primitive-neutral-700);
|
|
@@ -547,7 +566,7 @@
|
|
|
547
566
|
(the kbd is shorter and centers against it). The band derives from it, so
|
|
548
567
|
restyling the badge's height keeps the overlap in step. */
|
|
549
568
|
--aia-footer-row-height: 23px;
|
|
550
|
-
--aia-footer-band: calc(var(--aia-footer-gap,
|
|
569
|
+
--aia-footer-band: calc(var(--aia-footer-gap, 12px) + var(--aia-footer-row-height, 23px));
|
|
551
570
|
--aia-grid-scroll-bottom: var(--aia-footer-band);
|
|
552
571
|
--aia-grid-overlap-bottom: calc(-1 * (var(--aia-footer-band) + 8px));
|
|
553
572
|
/* How far above the band the fade starts. */
|
|
@@ -679,7 +698,7 @@
|
|
|
679
698
|
bottom edge \u2014 the side the option rows scroll under. */
|
|
680
699
|
:where(.magicx-aia[data-options-position="above"]) [data-aia-dropdown] [data-aia-footer],
|
|
681
700
|
[data-aia-dropdown][data-options-position="above"] [data-aia-footer] {
|
|
682
|
-
padding: 0 0 var(--aia-footer-gap,
|
|
701
|
+
padding: 0 0 var(--aia-footer-gap, 12px) 8px;
|
|
683
702
|
}
|
|
684
703
|
|
|
685
704
|
/* ...and the fade runs the other way, out of the footer and down into the list. */
|
|
@@ -750,8 +769,9 @@
|
|
|
750
769
|
frosted-glass look with data-aia-surface="glass". */
|
|
751
770
|
background: var(--aia-surface, #ffffff);
|
|
752
771
|
border: 1px solid var(--aia-dropdown-border, rgba(231, 231, 231, 0.5));
|
|
753
|
-
border-radius:
|
|
754
|
-
|
|
772
|
+
border-radius: 9px;
|
|
773
|
+
/* Flat by default; consumers can set --aia-dropdown-shadow for elevation. */
|
|
774
|
+
box-shadow: var(--aia-dropdown-shadow, none);
|
|
755
775
|
}
|
|
756
776
|
|
|
757
777
|
/* A calendar has nothing wide to read, so the whole panel narrows with it \u2014
|
|
@@ -774,8 +794,7 @@
|
|
|
774
794
|
hsla(0, 0%, 100%, 0.15) 0px -1.6px 0px -1.6px inset,
|
|
775
795
|
hsla(0, 0%, 100%, 0.3) 0px 1.6px 0px 0px inset,
|
|
776
796
|
hsla(0, 0%, 100%, 0.3) 1.6px 0px 0px 0px inset,
|
|
777
|
-
inset 0 0 30px 5px hsla(0, 0%, 0%, 0.05)
|
|
778
|
-
hsla(0, 0%, 0%, 0.08) 0px 0px 30px 2px;
|
|
797
|
+
inset 0 0 30px 5px hsla(0, 0%, 0%, 0.05);
|
|
779
798
|
backdrop-filter: blur(30px);
|
|
780
799
|
}
|
|
781
800
|
|
|
@@ -995,7 +1014,7 @@
|
|
|
995
1014
|
opacity: 0.25;
|
|
996
1015
|
}
|
|
997
1016
|
}
|
|
998
|
-
`,document.head.appendChild(e)}var
|
|
1017
|
+
`,document.head.appendChild(e)}var xe={dropdown:"aia-dropdown-yz2KC",visible:"aia-visible-QCoXj",scrollArrow:"aia-scrollArrow-uUzV0","magicx-aia-scroll-arrow-bob":"aia-magicx-aia-scroll-arrow-bob-z-HXC",pillBar:"aia-pillBar-pwTXe",pillScroll:"aia-pillScroll-Tpzus",skip:"aia-skip-7-olS",skeletonBars:"aia-skeletonBars-HVr9C",skeletonBar:"aia-skeletonBar-O3xIx",aiaSkeletonPulse:"aia-aiaSkeletonPulse-G8W7q"};var O=require("@magicx-eng/ai-autocomplete-vanilla"),gt=require("react");if(typeof document<"u"&&!document.getElementById("ac-style-f687bd03")){let e=document.createElement("style");e.id="ac-style-f687bd03",e.textContent=`/* --- Datepicker (replaces the options grid for date suggestions) ---
|
|
999
1018
|
|
|
1000
1019
|
One of three hand-maintained copies (vanilla styles.css, this file, Angular's
|
|
1001
1020
|
date-grid.component.css). Only the class-naming layer differs \u2014 the
|
|
@@ -1158,7 +1177,7 @@
|
|
|
1158
1177
|
opacity: 0.8;
|
|
1159
1178
|
background: rgba(var(--aia-streak-rgb, 255, 255, 255), 0.06);
|
|
1160
1179
|
}
|
|
1161
|
-
`,document.head.appendChild(e)}var
|
|
1180
|
+
`,document.head.appendChild(e)}var D={datepicker:"aia-datepicker-6RrTs",header:"aia-header-z4LRk",month:"aia-month-urB2T",nav:"aia-nav-ap4AN",weekdays:"aia-weekdays-3EA3q",grid:"aia-grid-mQCgw",weekday:"aia-weekday-3lF4B",cell:"aia-cell-59k0y",number:"aia-number-aoT01",day:"aia-day-cB3u9",blank:"aia-blank-ivgRC",past:"aia-past-CEZsj",highlighted:"aia-highlighted-YIdtK",today:"aia-today-iI3ME",inRange:"aia-inRange-r9S2q",selected:"aia-selected-28KDn",pressed:"aia-pressed-bEyyN"};var _=require("react/jsx-runtime"),aa=["sunday","monday","tuesday","wednesday","thursday","friday","saturday"];function bt({options:e,activeIndex:o,listboxId:t,view:s,selection:n,onSelect:i,onHighlight:r,onPreviousMonth:m,onNextMonth:w}){let g=(0,O.isoDate)(new Date),x=(0,O.visibleDateRange)({pendingStart:n.rangeStart,highlightedIso:(0,O.cellIso)(e[o]),selected:n.selectedRange});return(0,_.jsxs)("div",{className:D.datepicker,"data-aia-datepicker":"",children:[(0,_.jsxs)("div",{className:D.header,children:[(0,_.jsx)("button",{type:"button",tabIndex:-1,className:D.nav,"data-aia-date-prev":"","aria-label":"Previous month",onMouseDown:h=>h.preventDefault(),onClick:m,children:"\u2039"}),(0,_.jsx)("span",{className:D.month,"data-aia-date-month":"","aria-live":"polite",children:(0,O.monthLabel)(s)}),(0,_.jsx)("button",{type:"button",tabIndex:-1,className:D.nav,"data-aia-date-next":"","aria-label":"Next month",onMouseDown:h=>h.preventDefault(),onClick:w,children:"\u203A"})]}),(0,_.jsx)("div",{className:D.weekdays,"aria-hidden":"true",children:O.WEEKDAY_LABELS.map((h,C)=>(0,_.jsx)("span",{className:D.weekday,children:h},aa[C]))}),(0,_.jsx)("div",{className:D.grid,"data-aia-date-grid":"",children:e.map((h,C)=>(0,_.jsx)(ia,{option:h,id:`${t}-option-${C}`,index:C,isHighlighted:C===o&&h.is_tappable,isToday:(0,O.cellIso)(h)===g,isPast:(0,O.cellIso)(h)!=null&&(0,O.cellIso)(h)<g,marks:(0,O.dateCellMarks)((0,O.cellIso)(h),{selectedIso:n.selectedIso,range:x}),onSelect:i,onHighlight:r},(0,O.cellIso)(h)??`pad-${C}`))})]})}function ia({option:e,id:o,index:t,isHighlighted:s,isToday:n,isPast:i,marks:r,onSelect:m,onHighlight:w}){let[g,x]=(0,gt.useState)(!1),h=(0,O.cellDay)(e);if(h==null)return(0,_.jsx)("div",{id:o,role:"option","data-aia-option":"","data-aia-date-cell":"","aria-hidden":"true","aria-selected":!1,tabIndex:-1,className:`${D.cell} ${D.blank}`});let C=()=>{x(!0),m(e),setTimeout(()=>x(!1),170)},E=[D.cell,D.day,i?D.past:"",s?D.highlighted:"",n?D.today:"",r.inRange?D.inRange:"",r.selected?D.selected:"",g?D.pressed:""].filter(Boolean).join(" ");return(0,_.jsx)("div",{id:o,role:"option","data-aia-option":"","data-aia-date-cell":"","aria-selected":s,"aria-label":e.text,tabIndex:0,className:E,onClick:C,onKeyDown:k=>{(k.key==="Enter"||k.key===" ")&&(k.preventDefault(),C())},onMouseEnter:()=>w(t),children:(0,_.jsx)("span",{className:D.number,children:h})})}var Oe=require("@magicx-eng/ai-autocomplete-vanilla"),je=require("react");if(typeof document<"u"&&!document.getElementById("ac-style-5259a217")){let e=document.createElement("style");e.id="ac-style-5259a217",e.textContent=`.aia-cluster {
|
|
1162
1181
|
display: flex;
|
|
1163
1182
|
flex-wrap: wrap;
|
|
1164
1183
|
gap: var(--aia-cluster-gap, 0.5rem);
|
|
@@ -1198,7 +1217,7 @@
|
|
|
1198
1217
|
.aia-cluster[data-justify="around"] {
|
|
1199
1218
|
justify-content: space-around;
|
|
1200
1219
|
}
|
|
1201
|
-
`,document.head.appendChild(e)}var
|
|
1220
|
+
`,document.head.appendChild(e)}var nt=require("react/jsx-runtime");function Ke({gap:e,align:o="center",justify:t="start",noWrap:s=!1,inline:n=!1,className:i,children:r,...m}){let w=e?{"--aia-cluster-gap":e}:void 0,g={className:i?`aia-cluster ${i}`:"aia-cluster","data-align":o,"data-justify":t,"data-nowrap":s||void 0,"data-inline":n||void 0,style:w,...m};return n?(0,nt.jsx)("span",{...g,children:r}):(0,nt.jsx)("div",{...g,children:r})}if(typeof document<"u"&&!document.getElementById("ac-style-56b0c577")){let e=document.createElement("style");e.id="ac-style-56b0c577",e.textContent=`/* The footer adds its own 8px horizontal inset so it stays clear of the
|
|
1202
1221
|
dropdown's rounded edges. The top inset (--aia-footer-gap) adds breathing
|
|
1203
1222
|
room above the hint/branding row so the footer doesn't butt against the last
|
|
1204
1223
|
option row \u2014 additive to the dropdown's 8px section gap. */
|
|
@@ -1210,7 +1229,7 @@
|
|
|
1210
1229
|
badge sits as far from the right edge as it does from the bottom \u2014 12px
|
|
1211
1230
|
both ways (dropdown padding 10 + pill 2 down, dropdown padding 8 + pill 4
|
|
1212
1231
|
across). */
|
|
1213
|
-
padding: var(--aia-footer-gap,
|
|
1232
|
+
padding: var(--aia-footer-gap, 12px) 0 0 8px;
|
|
1214
1233
|
/* The fade itself lives in appearance.css, on the footer's background.
|
|
1215
1234
|
Paints above the rows it covers: option content sits at z-index 2 (see
|
|
1216
1235
|
SuggestionItem.module.css) in this same stacking context, so anything
|
|
@@ -1332,7 +1351,7 @@
|
|
|
1332
1351
|
justify-content: flex-end;
|
|
1333
1352
|
}
|
|
1334
1353
|
}
|
|
1335
|
-
`,document.head.appendChild(e)}var
|
|
1354
|
+
`,document.head.appendChild(e)}var ye={footer:"aia-footer-qQQ7x",hintGroup:"aia-hintGroup-ZzbPf",brandLink:"aia-brandLink-r4f3R",key:"aia-key-Bz1H-",hint:"aia-hint-GKEOH",brand:"aia-brand-Al-lR",badge:"aia-badge-Fk9vg",row:"aia-row-BgZ6Q"};var ie=require("react/jsx-runtime");function vt({isOptionHighlighted:e=!1,isInputEmpty:o=!1}){let{key:t,hint:s}=(0,Oe.getFooterHint)(e,o),[n,i]=(0,je.useState)(Oe.ATTRIBUTION_URL);return(0,je.useEffect)(()=>{i((0,Oe.buildAttributionUrl)())},[]),(0,ie.jsx)("footer",{className:ye.footer,"data-aia-footer":"",children:(0,ie.jsxs)(Ke,{justify:"between",noWrap:!0,className:ye.row,children:[(0,ie.jsxs)(Ke,{gap:"5px",className:ye.hintGroup,children:[(0,ie.jsx)("kbd",{className:ye.key,children:t}),(0,ie.jsx)("span",{className:ye.hint,children:s})]}),(0,ie.jsxs)("a",{className:ye.brandLink,href:n,target:"_blank",rel:"noopener noreferrer",children:[(0,ie.jsx)("span",{className:ye.brand,children:"AI"}),(0,ie.jsx)("span",{className:ye.badge,children:"Autocomplete"})]})]})})}if(typeof document<"u"&&!document.getElementById("ac-style-199d0432")){let e=document.createElement("style");e.id="ac-style-199d0432",e.textContent=`/* ParamPill (Figma "ParamPill") \u2014 unfilled suggestion pill: transparent fill,
|
|
1336
1355
|
no outline. ~28px via 6px padding + 14px text + the 1px border (border-box).
|
|
1337
1356
|
The border is kept as a 1px transparent line so the box stays the same size
|
|
1338
1357
|
as it was when the outline was dashed. */
|
|
@@ -1389,7 +1408,7 @@
|
|
|
1389
1408
|
opacity: 0;
|
|
1390
1409
|
}
|
|
1391
1410
|
}
|
|
1392
|
-
`,document.head.appendChild(e)}var
|
|
1411
|
+
`,document.head.appendChild(e)}var Ae={pill:"aia-pill-6Ga7S",fadeIn:"aia-fadeIn-Ux4eQ",rounded:"aia-rounded-y7xA9",skeleton:"aia-skeleton-57P0T",skeletonPulse:"aia-skeletonPulse-xGcUy"};var xt=require("react/jsx-runtime"),rt={selected:1,first:.7,next:.4,last:.2};function wt({label:e,state:o,rounded:t,loading:s,onClick:n}){let i=[Ae.pill,t?Ae.rounded:"",s?Ae.skeleton:""].filter(Boolean).join(" ");return(0,xt.jsx)("button",{type:"button","data-aia-pill":"","data-aia-loading":s?"":void 0,tabIndex:-1,contentEditable:!1,suppressContentEditableWarning:!0,className:i,style:{opacity:rt[o]},onMouseDown:r=>r.preventDefault(),onClick:s?void 0:n,disabled:s,children:e})}if(typeof document<"u"&&!document.getElementById("ac-style-0fcb7940")){let e=document.createElement("style");e.id="ac-style-0fcb7940",e.textContent=`.aia-list-qvLqO {
|
|
1393
1412
|
position: relative;
|
|
1394
1413
|
z-index: 1;
|
|
1395
1414
|
pointer-events: auto;
|
|
@@ -1399,7 +1418,7 @@
|
|
|
1399
1418
|
align-items: center;
|
|
1400
1419
|
vertical-align: middle;
|
|
1401
1420
|
}
|
|
1402
|
-
`,document.head.appendChild(e)}var
|
|
1421
|
+
`,document.head.appendChild(e)}var st={list:"aia-list-qvLqO"};var Ge=require("react/jsx-runtime"),oa=[125,69];function yt(e){return e===0?"first":e===1?"next":"last"}function Qe({pills:e,activePillIndex:o,onSelectPill:t,activeSelected:s,rounded:n,loading:i}){return i&&e.length===0?(0,Ge.jsx)("span",{className:st.list,"data-aia-pill-list-loading":"",children:oa.map((r,m)=>(0,Ge.jsx)("span",{"data-aia-pill-skeleton":"",className:`${Ae.pill} ${n?Ae.rounded:""} ${Ae.skeleton}`,style:{width:r,opacity:rt[yt(m)]}},`skel-${r}`))}):(0,Ge.jsx)("span",{className:st.list,"data-aia-pill-list-loading":i?"":void 0,children:e.map((r,m)=>{let w=!!s&&m===o;return(0,Ge.jsx)(wt,{label:r.text,state:w?"selected":yt(m),selected:w,rounded:n,loading:i,onClick:()=>t(m)},`${r.type}-${r.text}`)})})}var kt=require("@magicx-eng/ai-autocomplete-vanilla"),Ye=require("react");if(typeof document<"u"&&!document.getElementById("ac-style-fef1688d")){let e=document.createElement("style");e.id="ac-style-fef1688d",e.textContent=`/* Product strip \u2014 the React counterpart of the vanilla core's strip rules
|
|
1403
1422
|
(packages/vanilla/src/styles.css). Same tokens, same defaults, so a consumer
|
|
1404
1423
|
theming one package sees the same result in the other.
|
|
1405
1424
|
|
|
@@ -1617,7 +1636,7 @@
|
|
|
1617
1636
|
.aia-section-Hugfg[data-aia-products-layout="list"] .aia-body-ly032 {
|
|
1618
1637
|
flex: 1 1 auto;
|
|
1619
1638
|
}
|
|
1620
|
-
`,document.head.appendChild(e)}var
|
|
1639
|
+
`,document.head.appendChild(e)}var ee={section:"aia-section-Hugfg",label:"aia-label-nuc93",row:"aia-row-WDVBX",card:"aia-card-JBGYT",media:"aia-media-RrbGe",image:"aia-image-5pNL7",body:"aia-body-ly032",vendor:"aia-vendor-Gvu7G",title:"aia-title-gCNmq",price:"aia-price-gULcE"};var q=require("react/jsx-runtime");function Ct({products:e,listboxId:o,onSelect:t,onFocusChange:s,focusable:n=!0,layout:i="row"}){let r=e.length>0,m=(0,Ye.useRef)(null);if((0,Ye.useEffect)(()=>{let g=m.current;if(!(!r||!g))return(0,kt.attachProductRowWheel)(g)},[r]),!r)return null;let w=`${o}-products-label`;return(0,q.jsxs)("section",{className:ee.section,"data-aia-products":"","data-aia-products-layout":i,role:"group","aria-labelledby":w,children:[(0,q.jsx)("div",{className:ee.label,id:w,"data-aia-products-label":"",children:"Products"}),(0,q.jsx)("div",{ref:m,className:ee.row,"data-aia-products-row":"",children:e.map((g,x)=>(0,q.jsx)(na,{product:g,id:`${o}-product-${x}`,onSelect:t,onFocusChange:s,focusable:n},g.id))})]})}function na({product:e,id:o,onSelect:t,onFocusChange:s,focusable:n}){let i=r=>{r.metaKey||r.ctrlKey||r.shiftKey||r.altKey||r.button!==0||(r.preventDefault(),t(e))};return(0,q.jsxs)("a",{id:o,className:ee.card,"data-aia-product":"",role:"option","aria-selected":!1,href:e.url,tabIndex:n?0:-1,onClick:i,onKeyDown:r=>{r.key!=="Enter"&&r.key!==" "||(r.preventDefault(),t(e))},onFocus:()=>s?.(!0),onBlur:r=>{r.relatedTarget?.closest("[data-aia-dropdown]")||s?.(!1)},children:[(0,q.jsx)("span",{className:ee.media,"data-aia-product-placeholder":e.imageUrl?void 0:"",children:e.imageUrl?(0,q.jsx)("img",{className:ee.image,src:e.imageUrl,alt:"",loading:"lazy",decoding:"async"}):null}),(0,q.jsxs)("span",{className:ee.body,children:[e.vendor?(0,q.jsx)("span",{className:ee.vendor,children:e.vendor}):null,(0,q.jsx)("span",{className:ee.title,children:e.title}),e.price?(0,q.jsx)("span",{className:ee.price,children:e.price}):null]})]})}var j=require("@magicx-eng/ai-autocomplete-vanilla"),ke=require("react");var Pt=require("@magicx-eng/ai-autocomplete-vanilla"),$e=require("react");if(typeof document<"u"&&!document.getElementById("ac-style-948e58da")){let e=document.createElement("style");e.id="ac-style-948e58da",e.textContent=`.aia-grid {
|
|
1621
1640
|
display: grid;
|
|
1622
1641
|
grid-template-columns: repeat(
|
|
1623
1642
|
auto-fit,
|
|
@@ -1650,7 +1669,7 @@
|
|
|
1650
1669
|
background: var(--aia-scrollbar-thumb, rgba(0, 0, 0, 0.3));
|
|
1651
1670
|
border-radius: 3px;
|
|
1652
1671
|
}
|
|
1653
|
-
`,document.head.appendChild(e)}var
|
|
1672
|
+
`,document.head.appendChild(e)}var It=require("react/jsx-runtime");function St({min:e="16rem",max:o,gap:t,scroll:s=!1,maxHeight:n,scrollResetKey:i,cols:r,template:m,innerRef:w,className:g,children:x,...h}){let C=(0,$e.useRef)(null);(0,$e.useLayoutEffect)(()=>{if(i===void 0)return;let k=C.current;k&&(k.scrollTop=0)},[i]);let E={"--aia-grid-min":e};return o&&(E["--aia-grid-max"]=o),t&&(E["--aia-grid-gap"]=t),n&&(E["--aia-grid-max-height"]=n),r&&(E.gridTemplateColumns=(0,Pt.optionsGridTemplateColumns)(r)),m&&(E.gridTemplateColumns=m),(0,It.jsx)("div",{ref:k=>{C.current=k,w?.(k)},className:g?`aia-grid ${g}`:"aia-grid","data-scroll":s||void 0,style:E,...h,children:x})}var re=require("@magicx-eng/ai-autocomplete-vanilla"),ne=require("react");if(typeof document<"u"&&!document.getElementById("ac-style-82820da7")){let e=document.createElement("style");e.id="ac-style-82820da7",e.textContent=`.aia-item-d4vpD {
|
|
1654
1673
|
position: relative;
|
|
1655
1674
|
/* Clip, not visible: the entrance rise below runs on the inner content,
|
|
1656
1675
|
and a transformed box extends its scroll container's scrollable area.
|
|
@@ -1678,13 +1697,13 @@
|
|
|
1678
1697
|
SuggestionItem selection. The 9px/10px inset is the item's own padding. */
|
|
1679
1698
|
border-radius: 8px;
|
|
1680
1699
|
padding: 8px 10px;
|
|
1681
|
-
/*
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1700
|
+
/* No entrance animation on the row itself \u2014 deliberately. The row is the
|
|
1701
|
+
tappable element, and iOS Safari drops a tap on a scripted-clickable
|
|
1702
|
+
element (a div with a click handler; a native button is exempt) whose
|
|
1703
|
+
own opacity is mid-animation \u2014 its tap-or-hover pass counts the change
|
|
1704
|
+
as content moving under the finger, fires only the hover events (the
|
|
1705
|
+
row highlights) and never the click. Both halves of the entrance run
|
|
1706
|
+
on the inner content instead (next rule). */
|
|
1688
1707
|
}
|
|
1689
1708
|
|
|
1690
1709
|
@keyframes aia-fadeIn-I8u35 {
|
|
@@ -1710,9 +1729,17 @@
|
|
|
1710
1729
|
.aia-content-T-Qba {
|
|
1711
1730
|
position: relative;
|
|
1712
1731
|
z-index: 2;
|
|
1713
|
-
/* The entrance
|
|
1714
|
-
|
|
1715
|
-
|
|
1732
|
+
/* The entrance: fade in while rising into place, each row a beat after the
|
|
1733
|
+
one before it (--aia-option-enter-delay is set inline per row from the
|
|
1734
|
+
core's optionEnterDelayMs). Both run here, on the inner content, never on
|
|
1735
|
+
the row: the rise because a transformed cell extends the grid's
|
|
1736
|
+
scrollable area (see the overflow note on the row), the fade because iOS
|
|
1737
|
+
Safari drops a tap on a tappable element whose own opacity is animating
|
|
1738
|
+
(see the row's own comment). The durations and distance mirror
|
|
1739
|
+
OPTION_ENTER_* in the core's derive/optionsEntrance.ts \u2014 change both together. */
|
|
1740
|
+
animation:
|
|
1741
|
+
aia-riseIn-etXZT 280ms cubic-bezier(0.25, 0.46, 0.45, 0.94) both,
|
|
1742
|
+
aia-fadeIn-I8u35 150ms ease-out both;
|
|
1716
1743
|
animation-delay: var(--aia-option-enter-delay, 0ms);
|
|
1717
1744
|
}
|
|
1718
1745
|
|
|
@@ -1841,11 +1868,115 @@
|
|
|
1841
1868
|
first line's text rather than under the icon. \`.content\` is a flex item
|
|
1842
1869
|
(blockified), so text-indent applies to it directly. Skeleton rows keep
|
|
1843
1870
|
it too: their icon is hidden but still occupies its column. */
|
|
1844
|
-
.aia-content-T-Qba:has(.aia-icon-Qw938) {
|
|
1871
|
+
.aia-content-T-Qba:not(:has(.aia-count-IpYbQ)):has(.aia-icon-Qw938) {
|
|
1845
1872
|
padding-left: calc(1em + 8px);
|
|
1846
1873
|
text-indent: calc(-1em - 8px);
|
|
1847
1874
|
}
|
|
1848
1875
|
|
|
1876
|
+
/* --- Option pictures and counts ---
|
|
1877
|
+
A row that carries a thumbnail (\`image_url\`) or a count (\`item_count\`) lays
|
|
1878
|
+
its content out as a flex row instead of inline flow: the text becomes its
|
|
1879
|
+
own box, so wrapped lines start under the first line without the hanging
|
|
1880
|
+
indent, and the count can sit at the trailing edge. It also fills the row \u2014
|
|
1881
|
+
the content is a flex item of the row that would otherwise shrink to its
|
|
1882
|
+
text, leaving the count's auto margin nothing to push against. The inline
|
|
1883
|
+
flow is kept for every other row, so nothing existing moves. */
|
|
1884
|
+
.aia-content-T-Qba:has(.aia-image-YZAbO),
|
|
1885
|
+
.aia-content-T-Qba:has(.aia-count-IpYbQ) {
|
|
1886
|
+
display: flex;
|
|
1887
|
+
flex: 1 1 auto;
|
|
1888
|
+
align-items: flex-start;
|
|
1889
|
+
min-width: 0;
|
|
1890
|
+
}
|
|
1891
|
+
|
|
1892
|
+
.aia-content-T-Qba:has(.aia-image-YZAbO) .aia-text-yqoh9,
|
|
1893
|
+
.aia-content-T-Qba:has(.aia-count-IpYbQ) .aia-text-yqoh9 {
|
|
1894
|
+
flex: 1 1 auto;
|
|
1895
|
+
min-width: 0;
|
|
1896
|
+
}
|
|
1897
|
+
|
|
1898
|
+
/* The picture: a square tile, centred on the text beside it (a one-line
|
|
1899
|
+
option reads as the reference row; a wrapped one keeps the tile on its
|
|
1900
|
+
vertical middle). Sized and rounded by token so a consumer can shrink it
|
|
1901
|
+
or square it off; the placeholder fill shows through until the picture
|
|
1902
|
+
paints and stays if it never does. */
|
|
1903
|
+
.aia-content-T-Qba:has(.aia-image-YZAbO) {
|
|
1904
|
+
align-items: center;
|
|
1905
|
+
gap: var(--aia-option-image-gap, 12px);
|
|
1906
|
+
}
|
|
1907
|
+
|
|
1908
|
+
.aia-image-YZAbO {
|
|
1909
|
+
flex: 0 0 auto;
|
|
1910
|
+
display: block;
|
|
1911
|
+
width: var(--aia-option-image-size, 40px);
|
|
1912
|
+
height: var(--aia-option-image-size, 40px);
|
|
1913
|
+
border-radius: var(--aia-option-image-radius, 12px);
|
|
1914
|
+
overflow: hidden;
|
|
1915
|
+
background: var(--aia-option-image-bg, var(--aia-pill-bg, rgba(189, 189, 189, 0.25)));
|
|
1916
|
+
}
|
|
1917
|
+
|
|
1918
|
+
.aia-image-YZAbO img {
|
|
1919
|
+
display: block;
|
|
1920
|
+
width: 100%;
|
|
1921
|
+
height: 100%;
|
|
1922
|
+
object-fit: cover;
|
|
1923
|
+
}
|
|
1924
|
+
|
|
1925
|
+
/* A picture that failed to load hides itself with the \`hidden\` attribute.
|
|
1926
|
+
The tile's \`display: block\` above would win over the browser's own
|
|
1927
|
+
\`[hidden] { display: none }\` (an author rule beats a user-agent rule at
|
|
1928
|
+
any specificity), so the attribute is honoured here explicitly. */
|
|
1929
|
+
.aia-image-YZAbO img[hidden] {
|
|
1930
|
+
display: none;
|
|
1931
|
+
}
|
|
1932
|
+
|
|
1933
|
+
/* The count: a muted, tabular label at the trailing edge, on the first
|
|
1934
|
+
line's baseline. Never wraps \u2014 a long option wraps its text instead. */
|
|
1935
|
+
.aia-count-IpYbQ {
|
|
1936
|
+
flex: 0 0 auto;
|
|
1937
|
+
margin-left: auto;
|
|
1938
|
+
padding-left: 12px;
|
|
1939
|
+
font-size: var(--aia-option-count-font-size, 12px);
|
|
1940
|
+
font-weight: 400;
|
|
1941
|
+
line-height: 21px; /* = the option's line-height */
|
|
1942
|
+
font-variant-numeric: tabular-nums;
|
|
1943
|
+
white-space: nowrap;
|
|
1944
|
+
color: var(--aia-option-count-color, inherit);
|
|
1945
|
+
opacity: var(--aia-option-count-opacity, 0.6);
|
|
1946
|
+
}
|
|
1947
|
+
|
|
1948
|
+
/* The unit word after the number is a token, so a consumer names what is
|
|
1949
|
+
being counted ("sneakers", "towels") or blanks it (an empty string) without
|
|
1950
|
+
a render option. A count of one reads the singular token, which falls back
|
|
1951
|
+
to the plural one, so a consumer who sets only \`--aia-option-count-unit\`
|
|
1952
|
+
gets that word for every count. Generated content joins the row's
|
|
1953
|
+
accessible name after the number, the way the word did as text. */
|
|
1954
|
+
.aia-count-IpYbQ::after {
|
|
1955
|
+
content: " " var(--aia-option-count-unit, "items");
|
|
1956
|
+
}
|
|
1957
|
+
|
|
1958
|
+
.aia-item-d4vpD[data-aia-item-count="1"] .aia-count-IpYbQ::after {
|
|
1959
|
+
content: " " var(--aia-option-count-unit-one, var(--aia-option-count-unit, "item"));
|
|
1960
|
+
}
|
|
1961
|
+
|
|
1962
|
+
/* Skeleton rows keep the tile (its placeholder fill pulses with the row)
|
|
1963
|
+
but not the picture, and drop the count like the tag. */
|
|
1964
|
+
.aia-item-d4vpD[data-aia-loading] .aia-image-YZAbO img {
|
|
1965
|
+
visibility: hidden;
|
|
1966
|
+
}
|
|
1967
|
+
|
|
1968
|
+
.aia-item-d4vpD[data-aia-loading] .aia-count-IpYbQ {
|
|
1969
|
+
display: none;
|
|
1970
|
+
}
|
|
1971
|
+
|
|
1972
|
+
/* A grid of picture rows is taller per row: the visible-rows cap
|
|
1973
|
+
(\`--aia-grid-max-height\`, computed from \`--aia-option-row-height\` by
|
|
1974
|
+
planOptionsGrid) follows the tile's height plus the row's padding, so the
|
|
1975
|
+
same number of rows shows before the list scrolls. */
|
|
1976
|
+
[data-aia-group]:has(.aia-image-YZAbO) {
|
|
1977
|
+
--aia-option-row-height: calc(var(--aia-option-image-size, 40px) + 16px);
|
|
1978
|
+
}
|
|
1979
|
+
|
|
1849
1980
|
@keyframes aia-skeletonPulse-plvdD {
|
|
1850
1981
|
0%,
|
|
1851
1982
|
100% {
|
|
@@ -1855,7 +1986,7 @@
|
|
|
1855
1986
|
filter: brightness(0.55);
|
|
1856
1987
|
}
|
|
1857
1988
|
}
|
|
1858
|
-
`,document.head.appendChild(e)}var
|
|
1989
|
+
`,document.head.appendChild(e)}var U={item:"aia-item-d4vpD",content:"aia-content-T-Qba",riseIn:"aia-riseIn-etXZT",fadeIn:"aia-fadeIn-I8u35",tappable:"aia-tappable-70KcX",nonTappable:"aia-nonTappable-xSZM-",highlighted:"aia-highlighted-Hb0SU",tag:"aia-tag-e3Fwe",pressed:"aia-pressed-98o-r",pressCompress:"aia-pressCompress-ICV3q",scrollHint:"aia-scrollHint-xKXPt",skeletonPulse:"aia-skeletonPulse-plvdD",text:"aia-text-yqoh9",icon:"aia-icon-Qw938",count:"aia-count-IpYbQ",image:"aia-image-YZAbO"};var oe=require("react/jsx-runtime");function Et({option:e,isHighlighted:o,onSelect:t,onHighlight:s,id:n,loading:i,showIcon:r=!0,showImage:m=!0,showCount:w=!0,scrollHint:g,enterDelayMs:x=0}){let[h]=(0,ne.useState)(x),[C,E]=(0,ne.useState)(!1),k=m?(0,re.optionImageSrc)(e.image_url):null,[K,R]=(0,ne.useState)(null),T=(0,ne.useMemo)(()=>!k&&r&&e.icon_svg?(0,re.sanitizeOptionIconSvg)(e.icon_svg):null,[k,r,e.icon_svg]),N=w?(0,re.formatOptionCount)(e.item_count):null,L=(0,ne.useRef)(void 0);(0,ne.useEffect)(()=>()=>clearTimeout(L.current),[]);let F=()=>{i||!e.is_tappable||C||(E(!0),t(e),clearTimeout(L.current),L.current=setTimeout(()=>E(!1),170))},G=[U.item,o&&!i?U.highlighted:"",e.is_tappable?U.tappable:U.nonTappable,C?U.pressed:"",g?U.scrollHint:""].filter(Boolean).join(" ");return(0,oe.jsx)("div",{id:n,role:"option","data-aia-option":"","data-aia-loading":i?"":void 0,"data-aia-icon":T&&e.icon?e.icon:void 0,"data-aia-image":k?"":void 0,"data-aia-item-count":N!==null?e.item_count:void 0,"aria-selected":o,className:G,style:{[re.OPTION_ENTER_DELAY_VAR]:`${h}ms`},tabIndex:i||!e.is_tappable?-1:0,onClick:F,onKeyDown:S=>{!i&&e.is_tappable&&(S.key==="Enter"||S.key===" ")&&(S.preventDefault(),F())},onMouseEnter:!i&&e.is_tappable?s:void 0,children:(0,oe.jsxs)("span",{className:U.content,children:[k&&(0,oe.jsx)("span",{className:`${U.image} magicx-aia-option-image`,"aria-hidden":"true",children:(0,oe.jsx)("img",{src:k,alt:"",loading:"lazy",decoding:"async",referrerPolicy:"no-referrer",draggable:!1,hidden:K===k,onError:()=>R(k)})}),T&&(0,oe.jsx)("span",{className:`${U.icon} magicx-aia-option-icon`,"aria-hidden":"true",dangerouslySetInnerHTML:{__html:T}}),(0,oe.jsx)("span",{className:U.text,children:(0,re.optionLabel)(e)}),e.tag&&(0,oe.jsx)("span",{className:U.tag,children:e.tag}),N!==null&&(0,oe.jsx)("span",{className:`${U.count} magicx-aia-option-count`,children:N})]})})}var lt=require("react/jsx-runtime");function ra(){let[e,o]=(0,ke.useState)(j.isOptionsGridMobileViewport);return(0,ke.useEffect)(()=>{if(typeof window>"u"||!window.matchMedia)return;let t=window.matchMedia(j.OPTIONS_GRID_MOBILE_QUERY),s=()=>o(t.matches);return s(),t.addEventListener("change",s),()=>t.removeEventListener("change",s)},[]),e}function Tt({options:e,activeIndex:o,onSelect:t,onHighlight:s,listboxId:n,loading:i,groupKey:r="",optionsPosition:m="below",showIcons:w=!0,showImages:g=!0,showCounts:x=!0}){let h=ra(),C=(0,ke.useRef)(null),[E,k]=(0,ke.useState)(null);(0,ke.useLayoutEffect)(()=>{let R=C.current,N=R&&!i&&(0,j.needsOptionsGridMeasurement)(e.length,h)?(0,j.measureOptionsGrid)(R):null;k(N?(0,j.planOptionsGrid)(e.length,h,N.rowWidths,N.gridWidth):null)},[e,h,i]);let K=E??(0,j.planOptionsGrid)(e.length,h,null,null);return(0,lt.jsx)(St,{min:"250px",max:"1fr",gap:"0",scroll:!0,scrollResetKey:r,template:K.template,maxHeight:K.maxHeight,innerRef:R=>{C.current=R},"data-aia-group":r,children:e.map((R,T)=>(0,lt.jsx)(Et,{option:R,isHighlighted:T===o,onSelect:t,onHighlight:()=>s(T),id:`${n}-option-${T}`,loading:i,showIcon:w,showImage:g,showCount:x,scrollHint:!i&&K.scrollHintIndices.includes(T),enterDelayMs:i?0:(0,j.optionEnterDelayMs)(T,K.cols,e.length,m)},`${r}\0${R.text}`))})}if(typeof document<"u"&&!document.getElementById("ac-style-8414cd5f")){let e=document.createElement("style");e.id="ac-style-8414cd5f",e.textContent=`.aia-stack {
|
|
1859
1990
|
display: flex;
|
|
1860
1991
|
flex-direction: column;
|
|
1861
1992
|
gap: var(--aia-stack-space, 0.5rem);
|
|
@@ -1870,7 +2001,7 @@
|
|
|
1870
2001
|
align-items: end;
|
|
1871
2002
|
}
|
|
1872
2003
|
/* data-align="stretch" is the flex default \u2014 no rule needed. */
|
|
1873
|
-
`,document.head.appendChild(e)}var
|
|
2004
|
+
`,document.head.appendChild(e)}var Rt=require("react/jsx-runtime");function At({space:e,align:o="stretch",className:t,children:s,...n}){let i=e?{"--aia-stack-space":e}:void 0;return(0,Rt.jsx)("div",{className:t?`aia-stack ${t}`:"aia-stack","data-align":o,style:i,...n,children:s})}var B=require("react/jsx-runtime"),sa=[159,119,164],la=()=>{},Dt=()=>{};function da(e){let o=()=>typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-color-scheme: dark)").matches,[t,s]=(0,te.useState)(o);if((0,te.useEffect)(()=>{if(e!=="auto"||typeof window>"u"||typeof window.matchMedia!="function")return;let n=window.matchMedia("(prefers-color-scheme: dark)"),i=()=>s(n.matches);return n.addEventListener("change",i),()=>n.removeEventListener("change",i)},[e]),e!==void 0)return e==="auto"?t?"dark":"light":e}function ca(e,o){let t=(0,te.useRef)(null);(0,te.useEffect)(()=>{let s=e.current,n=o.current;if(!s||!n)return;let i=s.querySelector(".aia-grid[data-scroll]");if(t.current&&t.current.grid!==i&&(t.current.controller.destroy(),t.current=null),i&&!t.current){t.current={grid:i,controller:(0,Me.attachScrollArrow)({dropdown:s,grid:i,button:n})};return}t.current?.controller.update()}),(0,te.useEffect)(()=>()=>{t.current?.controller.destroy(),t.current=null},[])}function Ve({suggestions:e,activeIndex:o,onSelect:t,onHighlight:s,isOpen:n,id:i,className:r,pills:m,onPillClick:w,showPills:g=!0,onSkip:x,showSkipButton:h=!0,showOptionIcons:C=!0,showOptionImages:E=!0,showOptionCounts:k=!0,skipDisabled:K=!1,activeSelected:R=!1,isLoading:T=!1,isInputEmpty:N=!1,products:L,onProductSelect:F,onProductFocusChange:G,productsLayout:S="row",formatType:se="options",dateView:le=null,selectedDateIso:Ce=null,selectedDateRange:de=null,dateRangeStart:u=null,onPreviousMonth:Y,onNextMonth:Pe,optionsPosition:ce="below",mode:Se}){let pe=da(Se),Ie=pe!==void 0,Z=(0,te.useRef)(null),he=(0,te.useRef)(null);ca(Z,he);let ue=e[0]?.options??[],me=!!(m&&m.length>0&&w),fe=!!(L&&L.length>0),H=n&&(ue.length>0||g&&me||T||fe),d={suggestions:e,activeIndex:o,pills:m,showPills:g,showSkipButton:h,showOptionIcons:C,showOptionImages:E,showOptionCounts:k,skipDisabled:K,activeSelected:R,isLoading:T,isInputEmpty:N,products:L,formatType:se,dateView:le,selectedDateIso:Ce,selectedDateRange:de,dateRangeStart:u},b=(0,te.useRef)(d);H&&(b.current=d);let a=H?d:b.current,y=a.suggestions[0],v=y?.options??[],p=a.activeIndex>=0&&!!v[a.activeIndex]?.is_tappable,$=!!(a.pills&&a.pills.length>0&&w),X=a.showPills&&$,ge=a.showPills&&!$&&a.isLoading,c=X||ge,be=$&&a.showSkipButton&&!a.isInputEmpty&&!!x,Ee=a.pills?.[0]?.text,ve=(0,Me.isCalendarFormat)(a.formatType)&&a.dateView!=null,De=v.length>0&&!ve,we=v.length>0&&ve&&!a.isLoading,He=a.isLoading&&!De&&!we,J=a.products??[];return(0,B.jsxs)("div",{ref:Z,id:i,role:"listbox","data-aia-dropdown":"","data-options-position":ce,"data-mode":pe,"data-aia-loading":a.isLoading?"":void 0,"data-aia-has-products":J.length>0?"":void 0,className:`${Ie?"magicx-aia ":""}${xe.dropdown} ${H?xe.visible:""} ${r??""}`,onMouseDown:W=>W.preventDefault(),children:[(0,B.jsxs)(At,{space:"8px",children:[(c||be)&&(0,B.jsxs)(Ke,{noWrap:!0,className:xe.pillBar,"data-aia-pillbar":"",children:[c&&(0,B.jsx)("span",{className:xe.pillScroll,"data-aia-pill-scroll":"",children:(0,B.jsx)(Qe,{pills:a.pills??[],activePillIndex:0,activeSelected:a.activeSelected,onSelectPill:w??(()=>{}),rounded:!0,loading:a.isLoading})}),be&&(0,B.jsx)("button",{type:"button",tabIndex:-1,className:xe.skip,"data-aia-skip":"",disabled:a.isLoading||a.skipDisabled,"aria-label":Ee?`Skip ${Ee}`:"Skip",onClick:x,children:"skip"})]}),De&&(0,B.jsx)(Tt,{options:v,activeIndex:a.activeIndex,onSelect:t,onHighlight:s,listboxId:i,loading:a.isLoading,groupKey:y?`${y.type} ${y.text}`:"",optionsPosition:ce,showIcons:a.showOptionIcons,showImages:a.showOptionImages,showCounts:a.showOptionCounts}),we&&a.dateView&&(0,B.jsx)(bt,{options:v,activeIndex:a.activeIndex,listboxId:i,view:a.dateView,selection:{selectedIso:a.selectedDateIso??null,selectedRange:a.selectedDateRange??null,rangeStart:a.dateRangeStart??null},onSelect:t,onHighlight:s,onPreviousMonth:Y??Dt,onNextMonth:Pe??Dt}),He&&(0,B.jsx)("div",{className:xe.skeletonBars,"data-aia-skeleton-bars":"",children:sa.map(W=>(0,B.jsx)("span",{className:xe.skeletonBar,style:{width:W}},`bar-${W}`))}),(0,B.jsx)(Ct,{products:J,listboxId:i,onSelect:F??la,onFocusChange:G,focusable:H,layout:S}),(0,B.jsx)(vt,{isOptionHighlighted:p,isInputEmpty:a.isInputEmpty})]}),(0,B.jsx)("button",{ref:he,type:"button",tabIndex:-1,className:xe.scrollArrow,"data-aia-scroll-arrow":"","aria-label":Me.SCROLL_ARROW_LABEL,"aria-hidden":"true",children:(0,B.jsx)("svg",{viewBox:"0 0 16 16",width:"18",height:"18",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",children:(0,B.jsx)("path",{d:"M4 6.5 8 10.5l4-4"})})})]})}var Ne=require("@magicx-eng/ai-autocomplete-vanilla");if(typeof document<"u"&&!document.getElementById("ac-style-fdee06e6")){let e=document.createElement("style");e.id="ac-style-fdee06e6",e.textContent=`.aia-submitButton-otz7H {
|
|
1874
2005
|
flex-shrink: 0;
|
|
1875
2006
|
width: 32px;
|
|
1876
2007
|
height: 32px;
|
|
@@ -1923,5 +2054,5 @@
|
|
|
1923
2054
|
);
|
|
1924
2055
|
cursor: default;
|
|
1925
2056
|
}
|
|
1926
|
-
`,document.head.appendChild(e)}var Rt={submitButton:"aia-submitButton-otz7H"};var Qe=require("react/jsx-runtime");function Dt({disabled:e,onClick:i}){return(0,Qe.jsx)("button",{type:"button","data-aia-submit":"",className:Rt.submitButton,disabled:e,onClick:t=>{t.stopPropagation(),i()},"aria-label":"Submit",children:(0,Qe.jsx)("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",role:"img","aria-label":"Submit",children:(0,Qe.jsx)("path",{d:"M9 14V4M9 4L4 9M9 4L14 9",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})}var Me=require("@magicx-eng/ai-autocomplete-vanilla"),S=require("react");var st=require("react");function Lt(e){let i=(0,st.useRef)(e);i.current=e;let t=Object.keys(e??{}).sort().join("\0"),r=(0,st.useRef)({key:"",overrides:void 0});if(r.current.key!==t){let n={};for(let o of Object.keys(e??{})){let s=(b,v,h)=>{let y=i.current?.[o];return y?y(b,v,h):[]};n[o]=s}r.current={key:t,overrides:e?n:void 0}}return{overrides:r.current.overrides,key:t}}var lt=require("react");function Mt(e){let i=(0,lt.useRef)(e);i.current=e;let t=(0,lt.useRef)(null);t.current===null&&(t.current={fetch:(n,o)=>{let s=i.current;return s?s.fetch(n,o):Promise.reject(new Error("products config removed"))},transform:n=>i.current?.transform(n)??[],get limit(){return i.current?.limit}});let r=e!==void 0;return{config:r?t.current:void 0,enabled:r}}var la={text:"",completedParams:[],identifiedParams:[],skippedParams:[],pendingSpan:null,suggestions:[],products:[],customFields:null,optionSearch:null,activeDropdownIndex:-1,newParamId:null,isLoading:!0,isReady:!1,error:null,segments:[],actionableSuggestions:[],filteredOptions:[],activeFormatType:"options",dateView:null,dateRangeStart:null,placeholderText:"",optionQuery:"",isSearchingOptions:!1,isDropdownOpen:!1,isActivePillSelected:!1,filterBase:0,filterInProgress:!1,pillTapped:!1,skipNextFetch:!1,lastRawQuery:"",isFocused:!1,editingParam:null,editingIdentified:null,editingAnchor:null,editingTail:null,caretOffset:null,inSelectionAnimation:!1,dateViewMonth:null,pendingRangeStart:null};function Ze({onSubmit:e,onResult:i,onError:t,optionOverrides:r,maskCompletedText:n,apiConfig:o,additionalContext:s,columns:b=2,dropdownTrigger:v,optionsPosition:h,closeDropdownOnBlur:y,showNonTappableOptions:f,showOptionIcons:k,showSkipButton:P,showProducts:w,onFocus:R,onBlur:O,value:N,completedParams:B,onChange:ne,onParamsChange:F,products:I,onProductSelect:te,source:we,setCursor:re}){let u=(0,S.useRef)(null),[xe,K]=(0,S.useState)(null),se=(0,S.useRef)(e);se.current=e;let ye=(0,S.useRef)(i);ye.current=i;let le=(0,S.useRef)(t);le.current=t;let ae=(0,S.useRef)(ne);ae.current=ne;let de=(0,S.useRef)(F);de.current=F;let ie=(0,S.useRef)(R);ie.current=R;let ce=(0,S.useRef)(O);ce.current=O;let pe=(0,S.useRef)(re);pe.current=re;let W=(0,S.useRef)(te);W.current=te;let G=Mt(I),Z=Lt(r);(0,S.useEffect)(()=>{if(typeof document>"u")return;let g=new Me.AIAutocomplete(document.createElement("div"),{renderMode:"headless",apiConfig:o,additionalContext:s,optionOverrides:Z.overrides,maskCompletedText:n,columns:b,dropdownTrigger:v,optionsPosition:h,closeDropdownOnBlur:y,showNonTappableOptions:f,showProducts:w,source:we,value:N,completedParams:B,onSubmit:(...M)=>se.current?.(...M),onResult:(...M)=>ye.current?.(...M),onError:(...M)=>le.current?.(...M),onChange:(...M)=>ae.current?.(...M),onParamsChange:(...M)=>de.current?.(...M),onFocus:()=>ie.current?.(),onBlur:()=>ce.current?.(),onProductSelect:M=>W.current?.(M),setCursor:M=>pe.current?.(M),products:G.config});u.current=g,K(g.getState());let Q=g.subscribe(M=>K(M));return()=>{Q(),g.destroy(),u.current===g&&(u.current=null)}},[]),(0,S.useEffect)(()=>{N!==void 0&&u.current?.setValue(N)},[N]),(0,S.useEffect)(()=>{B!==void 0&&u.current?.setCompletedParams(B)},[B]);let c=JSON.stringify(o??null),a;try{a=JSON.stringify(s??null)}catch{a="[unstringifiable]"}(0,S.useEffect)(()=>{u.current?.update({apiConfig:o,additionalContext:s,optionOverrides:Z.overrides,dropdownTrigger:v,optionsPosition:h,closeDropdownOnBlur:y,showNonTappableOptions:f,showProducts:w})},[c,a,Z.key,v,h,y,f,w]);let m=(0,S.useRef)(!1);(0,S.useEffect)(()=>{if(!m.current){m.current=!0;return}u.current?.update({products:G.config})},[G.enabled]);let x=(0,S.useRef)(null);x.current===null&&(x.current={handleTextChange:g=>u.current?.handleTextChange(g),handleKeyDown:g=>{let Q="nativeEvent"in g?g.nativeEvent:g;u.current?.handleKeyDown(Q)},setFocused:g=>u.current?.setFocused(g),startEditingParam:g=>u.current?.startEditingParam(g),exitEditMode:()=>u.current?.exitEditMode(),handleCaretAfterInput:g=>u.current?.handleCaretAfterInput(g),handleCaretMove:g=>u.current?.handleCaretMove(g),replaceEditingRange:g=>u.current?.replaceEditingRange(g)??!1,setActivePill:g=>u.current?.setActivePill(g),skipActivePill:()=>u.current?.skipActivePill(),removeLastParam:()=>u.current?.removeLastParam(),clearNewParamId:()=>u.current?.clearNewParamId(),reset:()=>u.current?.reset(),selectOption:g=>u.current?.selectOption(g),selectProduct:g=>u.current?.selectProduct(g),setActiveDropdownIndex:g=>u.current?.setActiveDropdownIndex(g),showPreviousMonth:()=>u.current?.showPreviousMonth(),showNextMonth:()=>u.current?.showNextMonth(),handleFocus:()=>u.current?.setFocused(!0),handleBlur:()=>u.current?.setFocused(!1)});let l=x.current,T=(0,S.useCallback)(g=>{let Q=g.target.value,Je=Q.length>0&&!g.nativeEvent?.isComposing&&Q[0]!==Q[0].toUpperCase()?Q[0].toUpperCase()+Q.slice(1):Q;u.current?.handleTextChange(Je)},[]),he=(0,S.useCallback)(g=>{u.current?.handleKeyDown(g.nativeEvent)},[]),V=u.current,d=xe??la,ue=N!==void 0?N:d.text,Se=B!==void 0?B:d.completedParams,ke=d.actionableSuggestions,Te=ke[0],fe=V?.listboxId??"",ze=d.activeDropdownIndex>=0&&V?`${fe}-option-${d.activeDropdownIndex}`:void 0,_=d.editingParam,q=d.editingIdentified,Ae=_?{type:_.suggestionType,text:_.suggestionPlaceholder,required:!0,options:_.options}:q?{type:q.type,text:(0,Me.identifiedParamLabel)(q.type),required:!0,options:[]}:null,Fe=Ae??Te,Xe=Ae?[Ae]:ke,Ne=(0,Me.dateSelectionFor)(d),Ke=!V||d.isLoading&&!d.editingParam&&!d.inSelectionAnimation||d.isSearchingOptions;return{completedParams:Se,skippedParams:d.skippedParams,identifiedParams:d.identifiedParams,suggestionPills:ke,setActivePill:l.setActivePill,skipActivePill:l.skipActivePill,removeLastParam:l.removeLastParam,segments:d.segments,newParamId:d.newParamId,clearNewParamId:l.clearNewParamId,suggestions:d.suggestions,activeIndex:d.activeDropdownIndex,isReady:d.isReady,isLoading:Ke,isFocused:d.isFocused,isDropdownOpen:d.isDropdownOpen,isActivePillSelected:d.isActivePillSelected,placeholderText:d.placeholderText,listboxId:fe,error:d.error,products:d.products,customFields:d.customFields,selectProduct:l.selectProduct,handleTextChange:l.handleTextChange,handleKeyDown:l.handleKeyDown,setFocused:l.setFocused,editingParam:_,editingIdentified:q,editingAnchor:d.editingAnchor,caretOffset:d.caretOffset,startEditingParam:l.startEditingParam,exitEditMode:l.exitEditMode,handleCaretAfterInput:l.handleCaretAfterInput,handleCaretMove:l.handleCaretMove,replaceEditingRange:l.replaceEditingRange,inputProps:{value:ue,placeholder:d.placeholderText||void 0,onChange:T,onKeyDown:he,onFocus:l.handleFocus,onBlur:l.handleBlur,role:"combobox","aria-expanded":d.isDropdownOpen,"aria-activedescendant":ze,"aria-autocomplete":"list","aria-controls":fe},reset:l.reset,dropdownProps:{suggestions:Fe?[{...Fe,options:d.filteredOptions}]:[],activeIndex:d.activeDropdownIndex,onSelect:l.selectOption,onHighlight:l.setActiveDropdownIndex,isOpen:d.isDropdownOpen,id:fe,pills:Xe,activeSelected:d.isActivePillSelected,onPillClick:l.setActivePill,onSkip:l.skipActivePill,showSkipButton:(P??!0)&&!_&&!q,showOptionIcons:k??!0,skipDisabled:d.inSelectionAnimation,isLoading:Ke,isInputEmpty:ue.trim().length===0,products:d.products,onProductSelect:l.selectProduct,onProductFocusChange:l.setFocused,formatType:d.activeFormatType,dateView:d.dateView,selectedDateIso:Ne.selectedIso,selectedDateRange:Ne.selectedRange,dateRangeStart:Ne.rangeStart,onPreviousMonth:l.showPreviousMonth,onNextMonth:l.showNextMonth,optionsPosition:h??"below"}}}var $=require("@magicx-eng/ai-autocomplete-vanilla"),C=require("react"),Ye;function da(){if(Ye!==void 0)return Ye;if(typeof document>"u")return!1;let e=document.createElement("div");return e.setAttribute("contenteditable","plaintext-only"),Ye=e.contentEditable==="plaintext-only",Ye}function Ot(e){let{segments:i,showChipIcons:t=!0,newParamId:r,editingParam:n,editingIdentified:o,editingAnchor:s,caretOffset:b,placeholderText:v,isFocused:h,isDropdownOpen:y,listboxId:f,activeDescendantId:k,autoFocus:P,handleTextChange:w,handleKeyDown:R,handleCaretAfterInput:O,handleCaretMove:N,startEditingParam:B,replaceEditingRange:ne,setFocused:F}=e,I=(0,C.useRef)(null),te=(0,C.useRef)(!1),we=(0,C.useRef)(""),re=(0,C.useRef)(""),u=(0,C.useRef)(null),xe=(0,C.useRef)(0);u.current=b,(0,C.useEffect)(()=>{if(!P)return;let c=I.current;if(!c)return;document.activeElement===c?F(!0):c.focus();let a=c.ownerDocument??document,m=a.getSelection(),x=m&&m.rangeCount>0&&c.contains(m.anchorNode);if(m&&!x){let l=a.createRange();l.selectNodeContents(c),l.collapse(!0),m.removeAllRanges(),m.addRange(l)}},[P,F]),(0,C.useEffect)(()=>{let c=I.current;if(!c)return;let a=c.ownerDocument??document,m=()=>{let x=a.getSelection();if(!x||x.rangeCount===0||!x.anchorNode||!c.contains(x.anchorNode))return;let l=x.anchorNode,T=l.nodeType===Node.ELEMENT_NODE?l:l.parentElement,V=(x.isCollapsed?T?.closest("strong[data-param-id]"):null)?.dataset.paramId??null,d=n?.id??o?.id??null;if(V&&V!==d){B(V);return}performance.now()-xe.current<50||N((0,$.getCursorOffset)(c))};return a.addEventListener("selectionchange",m),()=>a.removeEventListener("selectionchange",m)},[n,o,B,N]),(0,C.useLayoutEffect)(()=>{let c=I.current;c&&(0,$.renderEditableContent)({input:c,segments:i,newParamId:r,editingParamId:n?.id??null,placeholderText:v??"",isFocused:h,showChipIcons:t})},[i,r,n,v,h,t]),(0,C.useLayoutEffect)(()=>{let c=we.current,a=r??"";if(we.current=a,!a||a===c)return;let m=I.current;if(!m)return;m.focus();let x=u.current??(0,$.plainTextLength)(m);(0,$.setCursorOffset)(m,x)},[r]),(0,C.useLayoutEffect)(()=>{let c=re.current,a=n?.id??"";if(re.current=a,!a||a===c||s==null)return;let m=I.current;m&&(0,$.setCursorOffset)(m,s)},[n,s]);let K=(0,C.useCallback)(()=>{if(te.current)return;let c=I.current;if(!c)return;let a=(0,$.extractPlainText)(c),x=a.length>0&&a[0]!==a[0].toUpperCase()?a[0].toUpperCase()+a.slice(1):a;w(x)},[w]),se=(0,C.useCallback)(()=>{xe.current=performance.now(),K();let c=I.current;c&&O((0,$.getCursorOffset)(c))},[K,O]);(0,C.useEffect)(()=>{let c=I.current;if(!c)return;let a=m=>{let x=m,l=x.inputType;if(l==="insertParagraph"||l==="insertLineBreak"||l==="insertFromDrop"){m.preventDefault();return}if(l.startsWith("insert")||l.startsWith("delete")){let T=l.startsWith("delete")?"":x.data??"";ne(T)&&m.preventDefault()}};return c.addEventListener("beforeinput",a),()=>c.removeEventListener("beforeinput",a)},[ne]);let ye=(0,C.useCallback)(()=>{te.current=!0},[]),le=(0,C.useCallback)(()=>{te.current=!1,K()},[K]),ae=(0,C.useCallback)(c=>{c.preventDefault();let a=I.current;if(!a)return;let m=(c.clipboardData.getData("text/plain")??"").replace(/\r?\n/g," ");if(!m)return;let x=a.ownerDocument??document,l=x.getSelection();if(!l||l.rangeCount===0)return;let T=l.getRangeAt(0);if(!a.contains(T.startContainer))return;T.deleteContents();let he=x.createTextNode(m);T.insertNode(he),T.setStartAfter(he),T.collapse(!0),l.removeAllRanges(),l.addRange(T),K()},[K]),de=(0,C.useCallback)(c=>R(c),[R]),ie=(0,C.useCallback)(()=>F(!0),[F]),ce=(0,C.useCallback)(()=>F(!1),[F]),pe=(0,C.useCallback)(()=>I.current?.focus(),[]),W=(0,C.useCallback)(()=>I.current?.blur(),[]),G=(0,C.useCallback)(()=>{let c=I.current;return c?(0,$.extractPlainText)(c):""},[]),Z=da()?"plaintext-only":"true";return{inputRef:I,editorProps:{ref:I,contentEditable:Z,suppressContentEditableWarning:!0,tabIndex:0,role:"combobox","aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":f,"aria-expanded":y,"aria-activedescendant":k,spellCheck:!0,enterKeyHint:"send",onInput:se,onKeyDown:de,onCompositionStart:ye,onCompositionEnd:le,onPaste:ae,onFocus:ie,onBlur:ce},getPlainText:G,focus:pe,blur:W}}var ee=require("react/jsx-runtime");function ca(e){return e!=="auto"?e:typeof window>"u"||window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}var zt=(0,L.forwardRef)(function({onSubmit:i,onResult:t,onError:r,optionOverrides:n,maskCompletedText:o,className:s,apiConfig:b,additionalContext:v,columns:h,pillPlacement:y="dropdown",mode:f="auto",optionsPosition:k="below",animations:P=!0,dropdownTrigger:w,closeDropdownOnBlur:R,showNonTappableOptions:O,showOptionIcons:N=!0,showChipIcons:B=!0,showSkipButton:ne,showProducts:F,productsLayout:I,autoFocus:te=!0,onFocus:we,onBlur:re,value:u,completedParams:xe,onChange:K,onParamsChange:se,products:ye,onProductSelect:le,submitButton:ae},de){let ie=(0,L.useRef)(null),ce=(0,L.useRef)(null),pe=(0,L.useRef)(()=>{}),W=(0,L.useRef)(null),G=(0,L.useRef)(null);(0,L.useEffect)(()=>{let E=ie.current;if(E)return W.current?W.current.setMode(f):W.current=new Oe.ModeController(E,f),()=>{W.current?.destroy(),W.current=null}},[f]);let Z=(0,L.useCallback)(E=>{let Ce=G.current?.current;Ce&&(Ce.focus(),(0,Oe.setCursorOffset)(Ce,E))},[]),{completedParams:c,skippedParams:a,identifiedParams:m,isReady:x,customFields:l,suggestionPills:T,setActivePill:he,skipActivePill:V,segments:d,newParamId:ue,clearNewParamId:Se,placeholderText:ke,isFocused:Te,isDropdownOpen:fe,isActivePillSelected:ze,isLoading:_,activeIndex:q,listboxId:Ae,handleTextChange:Fe,handleKeyDown:Xe,setFocused:Ne,editingParam:Ke,editingIdentified:g,editingAnchor:Q,caretOffset:M,startEditingParam:Je,handleCaretAfterInput:Nt,handleCaretMove:Ht,replaceEditingRange:Bt,dropdownProps:Ft,reset:We}=Ze({onSubmit:E=>pe.current(E),onResult:t,onError:r,optionOverrides:n,maskCompletedText:o,apiConfig:b,additionalContext:v,columns:h,dropdownTrigger:w,optionsPosition:k,closeDropdownOnBlur:R,showNonTappableOptions:O,showOptionIcons:N,showSkipButton:ne,showProducts:F,onFocus:we,onBlur:re,value:u,completedParams:xe,onChange:K,onParamsChange:se,products:ye,onProductSelect:le,source:"full-sdk",setCursor:Z});(0,L.useEffect)(()=>{if(!ue)return;let E=window.setTimeout(()=>Se(),650);return()=>window.clearTimeout(E)},[ue,Se]);let Kt=q>=0?`${Ae}-option-${q}`:void 0,{inputRef:et,editorProps:Wt,focus:Ge,blur:dt,getPlainText:ct}=Ot({segments:d,newParamId:ue,editingParam:Ke,editingIdentified:g,editingAnchor:Q,caretOffset:M,placeholderText:ke,isFocused:Te,showChipIcons:B,isDropdownOpen:fe,listboxId:Ae,activeDescendantId:Kt,autoFocus:te,handleTextChange:Fe,handleKeyDown:Xe,handleCaretAfterInput:Nt,handleCaretMove:Ht,startEditingParam:Je,replaceEditingRange:Bt,setFocused:Ne});G.current=et,(0,L.useLayoutEffect)(()=>{let E=ce.current,Ce=et.current;if(!E||!Ce)return;let pt=()=>{let ut=E.firstElementChild;if(!ut)return;let Ut=ut.getBoundingClientRect(),jt=Ce.getBoundingClientRect();Ut.top>=jt.bottom-2?E.setAttribute("data-aia-pill-wrapped",""):E.removeAttribute("data-aia-pill-wrapped")};pt();let ht=new ResizeObserver(pt);return ht.observe(Ce),()=>ht.disconnect()},[d,T.length,_,et]),(0,L.useImperativeHandle)(de,()=>({focus:Ge,blur:dt,reset:We,setMode:E=>W.current?.setMode(E),skipActivePill:V}),[Ge,dt,We,V]);let _e=!!d.length||c.length>0,tt=(0,L.useCallback)(()=>{if(!_e)return;let E=ct();i((0,Oe.buildSubmitResult)(E,c,a,{identifiedParams:m,isReady:x,customFields:l})),We()},[_e,c,a,m,x,l,i,We,ct]);pe.current=tt;let Gt=(0,L.useCallback)(E=>{E.target?.closest("[data-aia-pill]")||Ge()},[Ge]),_t=y==="inline",qt=y==="dropdown";return(0,ee.jsxs)("div",{ref:ie,className:`magicx-aia ${Ee.container} ${s??""}`,"data-pill-placement":y,"data-options-position":k,"data-animations":P?"on":"off","data-mode":ca(f),children:[(0,ee.jsx)(Ve,{...Ft,showPills:qt,productsLayout:I}),(0,ee.jsxs)("div",{className:Ee.inputWrapper,"data-aia-input-wrapper":"",onClick:Gt,children:[(0,ee.jsxs)("div",{className:Ee.editorArea,"data-aia-editor":"",children:[(0,ee.jsx)("div",{...Wt,className:Ee.input,"data-aia-input":""}),_t&&(_||T.length>0)&&(0,ee.jsx)("span",{ref:ce,className:Ee.pillListContainer,"data-aia-pill-list-container":"",children:(0,ee.jsx)(Ue,{pills:T,activePillIndex:0,activeSelected:ze,onSelectPill:he,loading:_})})]}),ae===null?null:ae===void 0?(0,ee.jsx)(Dt,{disabled:!_e,onClick:tt}):(0,ee.jsx)("span",{"data-aia-submit":"","data-aia-submit-slot":"",className:Ee.submitSlot,onClick:E=>{_e&&(E.stopPropagation(),tt())},children:ae})]})]})});0&&(module.exports={AIAutocomplete,AIAutocompleteDropdown,DATE_RANGE_META_END,DATE_RANGE_META_START,PRODUCT_PATH_PREFIX,WEEKDAY_LABELS,buildSubmitResult,cellDay,cellIso,dateCellMarks,formatDate,formatDateRange,isoDate,monthLabel,optionLabel,parseDate,parseLooseDate,parseLooseDateRange,productFromMatchedItem,productsFromCustomFields,sanitizeOptionIconSvg,selectedRangeFor,useAIAutocomplete,visibleDateRange,withSkippedParams});
|
|
2057
|
+
`,document.head.appendChild(e)}var Lt={submitButton:"aia-submitButton-otz7H"};var Ze=require("react/jsx-runtime");function Ot({disabled:e,onClick:o}){return(0,Ze.jsx)("button",{type:"button","data-aia-submit":"",className:Lt.submitButton,disabled:e,onClick:t=>{t.stopPropagation(),o()},"aria-label":"Submit",children:(0,Ze.jsx)("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",role:"img","aria-label":"Submit",children:(0,Ze.jsx)("path",{d:"M9 14V4M9 4L4 9M9 4L14 9",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})}var ze=require("@magicx-eng/ai-autocomplete-vanilla"),I=require("react");var dt=require("react");function Mt(e){let o=(0,dt.useRef)(e);o.current=e;let t=Object.keys(e??{}).sort().join("\0"),s=(0,dt.useRef)({key:"",overrides:void 0});if(s.current.key!==t){let n={};for(let i of Object.keys(e??{})){let r=(m,w,g)=>{let x=o.current?.[i];return x?x(m,w,g):[]};n[i]=r}s.current={key:t,overrides:e?n:void 0}}return{overrides:s.current.overrides,key:t}}var ct=require("react");function zt(e){let o=(0,ct.useRef)(e);o.current=e;let t=(0,ct.useRef)(null);t.current===null&&(t.current={fetch:(n,i)=>{let r=o.current;return r?r.fetch(n,i):Promise.reject(new Error("products config removed"))},transform:n=>o.current?.transform(n)??[],get limit(){return o.current?.limit}});let s=e!==void 0;return{config:s?t.current:void 0,enabled:s}}var pa={text:"",completedParams:[],identifiedParams:[],skippedParams:[],pendingSpan:null,suggestions:[],products:[],customFields:null,optionSearch:null,activeDropdownIndex:-1,newParamId:null,isLoading:!0,isReady:!1,error:null,segments:[],actionableSuggestions:[],filteredOptions:[],activeFormatType:"options",dateView:null,dateRangeStart:null,placeholderText:"",optionQuery:"",isSearchingOptions:!1,isDropdownOpen:!1,isActivePillSelected:!1,filterBase:0,filterInProgress:!1,pillTapped:!1,skipNextFetch:!1,lastRawQuery:"",isFocused:!1,editingParam:null,editingIdentified:null,editingAnchor:null,editingTail:null,caretOffset:null,inSelectionAnimation:!1,dateViewMonth:null,pendingRangeStart:null};function Xe({onSubmit:e,onResult:o,onError:t,optionOverrides:s,maskCompletedText:n,apiConfig:i,additionalContext:r,columns:m=2,dropdownTrigger:w,optionsPosition:g,closeDropdownOnBlur:x,showNonTappableOptions:h,showOptionIcons:C,showOptionImages:E,showOptionCounts:k,showSkipButton:K,showProducts:R,onFocus:T,onBlur:N,value:L,completedParams:F,onChange:G,onParamsChange:S,products:se,onProductSelect:le,source:Ce,setCursor:de}){let u=(0,I.useRef)(null),[Y,Pe]=(0,I.useState)(null),ce=(0,I.useRef)(e);ce.current=e;let Se=(0,I.useRef)(o);Se.current=o;let pe=(0,I.useRef)(t);pe.current=t;let Ie=(0,I.useRef)(G);Ie.current=G;let Z=(0,I.useRef)(S);Z.current=S;let he=(0,I.useRef)(T);he.current=T;let ue=(0,I.useRef)(N);ue.current=N;let me=(0,I.useRef)(de);me.current=de;let fe=(0,I.useRef)(le);fe.current=le;let H=zt(se),d=Mt(s);(0,I.useEffect)(()=>{if(typeof document>"u")return;let f=new ze.AIAutocomplete(document.createElement("div"),{renderMode:"headless",apiConfig:i,additionalContext:r,optionOverrides:d.overrides,maskCompletedText:n,columns:m,dropdownTrigger:w,optionsPosition:g,closeDropdownOnBlur:x,showNonTappableOptions:h,showProducts:R,source:Ce,value:L,completedParams:F,onSubmit:(...z)=>ce.current?.(...z),onResult:(...z)=>Se.current?.(...z),onError:(...z)=>pe.current?.(...z),onChange:(...z)=>Ie.current?.(...z),onParamsChange:(...z)=>Z.current?.(...z),onFocus:()=>he.current?.(),onBlur:()=>ue.current?.(),onProductSelect:z=>fe.current?.(z),setCursor:z=>me.current?.(z),products:H.config});u.current=f,Pe(f.getState());let V=f.subscribe(z=>Pe(z));return()=>{V(),f.destroy(),u.current===f&&(u.current=null)}},[]),(0,I.useEffect)(()=>{L!==void 0&&u.current?.setValue(L)},[L]),(0,I.useEffect)(()=>{F!==void 0&&u.current?.setCompletedParams(F)},[F]);let b=JSON.stringify(i??null),a;try{a=JSON.stringify(r??null)}catch{a="[unstringifiable]"}(0,I.useEffect)(()=>{u.current?.update({apiConfig:i,additionalContext:r,optionOverrides:d.overrides,dropdownTrigger:w,optionsPosition:g,closeDropdownOnBlur:x,showNonTappableOptions:h,showProducts:R})},[b,a,d.key,w,g,x,h,R]);let y=(0,I.useRef)(!1);(0,I.useEffect)(()=>{if(!y.current){y.current=!0;return}u.current?.update({products:H.config})},[H.enabled]);let v=(0,I.useRef)(null);v.current===null&&(v.current={handleTextChange:f=>u.current?.handleTextChange(f),handleKeyDown:f=>{let V="nativeEvent"in f?f.nativeEvent:f;u.current?.handleKeyDown(V)},setFocused:f=>u.current?.setFocused(f),startEditingParam:f=>u.current?.startEditingParam(f),exitEditMode:()=>u.current?.exitEditMode(),handleCaretAfterInput:f=>u.current?.handleCaretAfterInput(f),handleCaretMove:f=>u.current?.handleCaretMove(f),replaceEditingRange:f=>u.current?.replaceEditingRange(f)??!1,setActivePill:f=>u.current?.setActivePill(f),skipActivePill:()=>u.current?.skipActivePill(),removeLastParam:()=>u.current?.removeLastParam(),clearNewParamId:()=>u.current?.clearNewParamId(),reset:()=>u.current?.reset(),selectOption:f=>u.current?.selectOption(f),selectProduct:f=>u.current?.selectProduct(f),setActiveDropdownIndex:f=>u.current?.setActiveDropdownIndex(f),showPreviousMonth:()=>u.current?.showPreviousMonth(),showNextMonth:()=>u.current?.showNextMonth(),handleFocus:()=>u.current?.setFocused(!0),handleBlur:()=>u.current?.setFocused(!1)});let p=v.current,$=(0,I.useCallback)(f=>{let V=f.target.value,tt=V.length>0&&!f.nativeEvent?.isComposing&&V[0]!==V[0].toUpperCase()?V[0].toUpperCase()+V.slice(1):V;u.current?.handleTextChange(tt)},[]),X=(0,I.useCallback)(f=>{u.current?.handleKeyDown(f.nativeEvent)},[]),ge=u.current,c=Y??pa,be=L!==void 0?L:c.text,Ee=F!==void 0?F:c.completedParams,ve=c.actionableSuggestions,De=ve[0],we=ge?.listboxId??"",He=c.activeDropdownIndex>=0&&ge?`${we}-option-${c.activeDropdownIndex}`:void 0,J=c.editingParam,W=c.editingIdentified,Le=J?{type:J.suggestionType,text:J.suggestionPlaceholder,required:!0,options:J.options}:W?{type:W.type,text:(0,ze.identifiedParamLabel)(W.type),required:!0,options:[]}:null,Be=Le??De,et=Le?[Le]:ve,Fe=(0,ze.dateSelectionFor)(c),We=!ge||c.isLoading&&!c.editingParam&&!c.inSelectionAnimation||c.isSearchingOptions;return{completedParams:Ee,skippedParams:c.skippedParams,identifiedParams:c.identifiedParams,suggestionPills:ve,setActivePill:p.setActivePill,skipActivePill:p.skipActivePill,removeLastParam:p.removeLastParam,segments:c.segments,newParamId:c.newParamId,clearNewParamId:p.clearNewParamId,suggestions:c.suggestions,activeIndex:c.activeDropdownIndex,isReady:c.isReady,isLoading:We,isFocused:c.isFocused,isDropdownOpen:c.isDropdownOpen,isActivePillSelected:c.isActivePillSelected,placeholderText:c.placeholderText,listboxId:we,error:c.error,products:c.products,customFields:c.customFields,selectProduct:p.selectProduct,handleTextChange:p.handleTextChange,handleKeyDown:p.handleKeyDown,setFocused:p.setFocused,editingParam:J,editingIdentified:W,editingAnchor:c.editingAnchor,caretOffset:c.caretOffset,startEditingParam:p.startEditingParam,exitEditMode:p.exitEditMode,handleCaretAfterInput:p.handleCaretAfterInput,handleCaretMove:p.handleCaretMove,replaceEditingRange:p.replaceEditingRange,inputProps:{value:be,placeholder:c.placeholderText||void 0,onChange:$,onKeyDown:X,onFocus:p.handleFocus,onBlur:p.handleBlur,role:"combobox","aria-expanded":c.isDropdownOpen,"aria-activedescendant":He,"aria-autocomplete":"list","aria-controls":we},reset:p.reset,dropdownProps:{suggestions:Be?[{...Be,options:c.filteredOptions}]:[],activeIndex:c.activeDropdownIndex,onSelect:p.selectOption,onHighlight:p.setActiveDropdownIndex,isOpen:c.isDropdownOpen,id:we,pills:et,activeSelected:c.isActivePillSelected,onPillClick:p.setActivePill,onSkip:p.skipActivePill,showSkipButton:(K??!0)&&!J&&!W,showOptionIcons:C??!0,showOptionImages:E??!0,showOptionCounts:k??!0,skipDisabled:c.inSelectionAnimation,isLoading:We,isInputEmpty:be.trim().length===0,products:c.products,onProductSelect:p.selectProduct,onProductFocusChange:p.setFocused,formatType:c.activeFormatType,dateView:c.dateView,selectedDateIso:Fe.selectedIso,selectedDateRange:Fe.selectedRange,dateRangeStart:Fe.rangeStart,onPreviousMonth:p.showPreviousMonth,onNextMonth:p.showNextMonth,optionsPosition:g??"below"}}}var Q=require("@magicx-eng/ai-autocomplete-vanilla"),P=require("react"),Je;function ha(){if(Je!==void 0)return Je;if(typeof document>"u")return!1;let e=document.createElement("div");return e.setAttribute("contenteditable","plaintext-only"),Je=e.contentEditable==="plaintext-only",Je}function Nt(e){let{segments:o,showChipIcons:t=!0,showChipImages:s=!0,newParamId:n,editingParam:i,editingIdentified:r,editingAnchor:m,caretOffset:w,placeholderText:g,isFocused:x,isDropdownOpen:h,listboxId:C,activeDescendantId:E,autoFocus:k,handleTextChange:K,handleKeyDown:R,handleCaretAfterInput:T,handleCaretMove:N,startEditingParam:L,replaceEditingRange:F,setFocused:G}=e,S=(0,P.useRef)(null),se=(0,P.useRef)(!1),le=(0,P.useRef)(""),Ce=(0,P.useRef)(""),de=(0,P.useRef)(null),u=(0,P.useRef)(0);de.current=w,(0,P.useEffect)(()=>{if(!k)return;let d=S.current;if(!d)return;document.activeElement===d?G(!0):d.focus();let b=d.ownerDocument??document,a=b.getSelection(),y=a&&a.rangeCount>0&&d.contains(a.anchorNode);if(a&&!y){let v=b.createRange();v.selectNodeContents(d),v.collapse(!0),a.removeAllRanges(),a.addRange(v)}},[k,G]),(0,P.useEffect)(()=>{let d=S.current;if(!d)return;let b=d.ownerDocument??document,a=()=>{let y=b.getSelection();if(!y||y.rangeCount===0||!y.anchorNode||!d.contains(y.anchorNode))return;let v=y.anchorNode,p=v.nodeType===Node.ELEMENT_NODE?v:v.parentElement,X=(y.isCollapsed?p?.closest("strong[data-param-id]"):null)?.dataset.paramId??null,ge=i?.id??r?.id??null;if(X&&X!==ge){L(X);return}performance.now()-u.current<50||N((0,Q.getCursorOffset)(d))};return b.addEventListener("selectionchange",a),()=>b.removeEventListener("selectionchange",a)},[i,r,L,N]),(0,P.useLayoutEffect)(()=>{let d=S.current;d&&(0,Q.renderEditableContent)({input:d,segments:o,newParamId:n,editingParamId:i?.id??null,placeholderText:g??"",isFocused:x,showChipIcons:t,showChipImages:s})},[o,n,i,g,x,t,s]),(0,P.useLayoutEffect)(()=>{let d=le.current,b=n??"";if(le.current=b,!b||b===d)return;let a=S.current;if(!a)return;a.focus();let y=de.current??(0,Q.plainTextLength)(a);(0,Q.setCursorOffset)(a,y)},[n]),(0,P.useLayoutEffect)(()=>{let d=Ce.current,b=i?.id??"";if(Ce.current=b,!b||b===d||m==null)return;let a=S.current;a&&(0,Q.setCursorOffset)(a,m)},[i,m]);let Y=(0,P.useCallback)(()=>{if(se.current)return;let d=S.current;if(!d)return;let b=(0,Q.extractPlainText)(d),y=b.length>0&&b[0]!==b[0].toUpperCase()?b[0].toUpperCase()+b.slice(1):b;K(y)},[K]),Pe=(0,P.useCallback)(()=>{u.current=performance.now(),Y();let d=S.current;d&&T((0,Q.getCursorOffset)(d))},[Y,T]);(0,P.useEffect)(()=>{let d=S.current;if(!d)return;let b=a=>{let y=a,v=y.inputType;if(v==="insertParagraph"||v==="insertLineBreak"||v==="insertFromDrop"){a.preventDefault();return}if(v.startsWith("insert")||v.startsWith("delete")){let p=v.startsWith("delete")?"":y.data??"";F(p)&&a.preventDefault()}};return d.addEventListener("beforeinput",b),()=>d.removeEventListener("beforeinput",b)},[F]);let ce=(0,P.useCallback)(()=>{se.current=!0},[]),Se=(0,P.useCallback)(()=>{se.current=!1,Y()},[Y]),pe=(0,P.useCallback)(d=>{d.preventDefault();let b=S.current;if(!b)return;let a=(d.clipboardData.getData("text/plain")??"").replace(/\r?\n/g," ");if(!a)return;let y=b.ownerDocument??document,v=y.getSelection();if(!v||v.rangeCount===0)return;let p=v.getRangeAt(0);if(!b.contains(p.startContainer))return;p.deleteContents();let $=y.createTextNode(a);p.insertNode($),p.setStartAfter($),p.collapse(!0),v.removeAllRanges(),v.addRange(p),Y()},[Y]),Ie=(0,P.useCallback)(d=>R(d),[R]),Z=(0,P.useCallback)(()=>G(!0),[G]),he=(0,P.useCallback)(()=>G(!1),[G]),ue=(0,P.useCallback)(()=>S.current?.focus(),[]),me=(0,P.useCallback)(()=>S.current?.blur(),[]),fe=(0,P.useCallback)(()=>{let d=S.current;return d?(0,Q.extractPlainText)(d):""},[]),H=ha()?"plaintext-only":"true";return{inputRef:S,editorProps:{ref:S,contentEditable:H,suppressContentEditableWarning:!0,tabIndex:0,role:"combobox","aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":C,"aria-expanded":h,"aria-activedescendant":E,spellCheck:!0,enterKeyHint:"send",onInput:Pe,onKeyDown:Ie,onCompositionStart:ce,onCompositionEnd:Se,onPaste:pe,onFocus:Z,onBlur:he},getPlainText:fe,focus:ue,blur:me}}var ae=require("react/jsx-runtime");function ua(e){return e!=="auto"?e:typeof window>"u"||window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}var Ht=(0,M.forwardRef)(function({onSubmit:o,onResult:t,onError:s,optionOverrides:n,maskCompletedText:i,className:r,apiConfig:m,additionalContext:w,columns:g,pillPlacement:x="dropdown",mode:h="auto",optionsPosition:C="below",animations:E=!0,dropdownTrigger:k,closeDropdownOnBlur:K,showNonTappableOptions:R,showOptionIcons:T=!0,showChipIcons:N=!0,showChipImages:L=!0,showOptionImages:F=!0,showOptionCounts:G=!0,showSkipButton:S,showProducts:se,productsLayout:le,autoFocus:Ce=!0,onFocus:de,onBlur:u,value:Y,completedParams:Pe,onChange:ce,onParamsChange:Se,products:pe,onProductSelect:Ie,submitButton:Z},he){let ue=(0,M.useRef)(null),me=(0,M.useRef)(null),fe=(0,M.useRef)(()=>{}),H=(0,M.useRef)(null),d=(0,M.useRef)(null);(0,M.useEffect)(()=>{let A=ue.current;if(A)return H.current?H.current.setMode(h):H.current=new Ne.ModeController(A,h),()=>{H.current?.destroy(),H.current=null}},[h]);let b=(0,M.useCallback)(A=>{let Te=d.current?.current;Te&&(Te.focus(),(0,Ne.setCursorOffset)(Te,A))},[]),{completedParams:a,skippedParams:y,identifiedParams:v,isReady:p,customFields:$,suggestionPills:X,setActivePill:ge,skipActivePill:c,segments:be,newParamId:Ee,clearNewParamId:ve,placeholderText:De,isFocused:we,isDropdownOpen:He,isActivePillSelected:J,isLoading:W,activeIndex:Le,listboxId:Be,handleTextChange:et,handleKeyDown:Fe,setFocused:We,editingParam:f,editingIdentified:V,editingAnchor:z,caretOffset:tt,startEditingParam:Bt,handleCaretAfterInput:Ft,handleCaretMove:Kt,replaceEditingRange:Gt,dropdownProps:Wt,reset:_e}=Xe({onSubmit:A=>fe.current(A),onResult:t,onError:s,optionOverrides:n,maskCompletedText:i,apiConfig:m,additionalContext:w,columns:g,dropdownTrigger:k,optionsPosition:C,closeDropdownOnBlur:K,showNonTappableOptions:R,showOptionIcons:T,showOptionImages:F,showOptionCounts:G,showSkipButton:S,showProducts:se,onFocus:de,onBlur:u,value:Y,completedParams:Pe,onChange:ce,onParamsChange:Se,products:pe,onProductSelect:Ie,source:"full-sdk",setCursor:b});(0,M.useEffect)(()=>{if(!Ee)return;let A=window.setTimeout(()=>ve(),650);return()=>window.clearTimeout(A)},[Ee,ve]);let _t=Le>=0?`${Be}-option-${Le}`:void 0,{inputRef:at,editorProps:qt,focus:qe,blur:pt,getPlainText:ht}=Nt({segments:be,newParamId:Ee,editingParam:f,editingIdentified:V,editingAnchor:z,caretOffset:tt,placeholderText:De,isFocused:we,showChipIcons:N,showChipImages:L,isDropdownOpen:He,listboxId:Be,activeDescendantId:_t,autoFocus:Ce,handleTextChange:et,handleKeyDown:Fe,handleCaretAfterInput:Ft,handleCaretMove:Kt,startEditingParam:Bt,replaceEditingRange:Gt,setFocused:We});d.current=at,(0,M.useLayoutEffect)(()=>{let A=me.current,Te=at.current;if(!A||!Te)return;let ut=()=>{let ft=A.firstElementChild;if(!ft)return;let Yt=ft.getBoundingClientRect(),$t=Te.getBoundingClientRect();Yt.top>=$t.bottom-2?A.setAttribute("data-aia-pill-wrapped",""):A.removeAttribute("data-aia-pill-wrapped")};ut();let mt=new ResizeObserver(ut);return mt.observe(Te),()=>mt.disconnect()},[be,X.length,W,at]),(0,M.useImperativeHandle)(he,()=>({focus:qe,blur:pt,reset:_e,setMode:A=>H.current?.setMode(A),skipActivePill:c}),[qe,pt,_e,c]);let Ue=!!be.length||a.length>0,it=(0,M.useCallback)(()=>{if(!Ue)return;let A=ht();o((0,Ne.buildSubmitResult)(A,a,y,{identifiedParams:v,isReady:p,customFields:$})),_e()},[Ue,a,y,v,p,$,o,_e,ht]);fe.current=it;let Ut=(0,M.useCallback)(A=>{A.target?.closest("[data-aia-pill]")||qe()},[qe]),jt=x==="inline",Qt=x==="dropdown";return(0,ae.jsxs)("div",{ref:ue,className:`magicx-aia ${Re.container} ${r??""}`,"data-pill-placement":x,"data-options-position":C,"data-animations":E?"on":"off","data-mode":ua(h),children:[(0,ae.jsx)(Ve,{...Wt,showPills:Qt,productsLayout:le}),(0,ae.jsxs)("div",{className:Re.inputWrapper,"data-aia-input-wrapper":"",onClick:Ut,children:[(0,ae.jsxs)("div",{className:Re.editorArea,"data-aia-editor":"",children:[(0,ae.jsx)("div",{...qt,className:Re.input,"data-aia-input":""}),jt&&(W||X.length>0)&&(0,ae.jsx)("span",{ref:me,className:Re.pillListContainer,"data-aia-pill-list-container":"",children:(0,ae.jsx)(Qe,{pills:X,activePillIndex:0,activeSelected:J,onSelectPill:ge,loading:W})})]}),Z===null?null:Z===void 0?(0,ae.jsx)(Ot,{disabled:!Ue,onClick:it}):(0,ae.jsx)("span",{"data-aia-submit":"","data-aia-submit-slot":"",className:Re.submitSlot,onClick:A=>{Ue&&(A.stopPropagation(),it())},children:Z})]})]})});0&&(module.exports={AIAutocomplete,AIAutocompleteDropdown,DATE_RANGE_META_END,DATE_RANGE_META_START,DEFAULT_OPTION_COUNT_UNIT,PRODUCT_PATH_PREFIX,WEEKDAY_LABELS,buildSubmitResult,cellDay,cellIso,dateCellMarks,formatDate,formatDateRange,formatOptionCount,isoDate,monthLabel,optionCountLabel,optionHasImage,optionImageSrc,optionLabel,parseDate,parseLooseDate,parseLooseDateRange,productFromMatchedItem,productsFromCustomFields,sanitizeOptionIconSvg,selectedRangeFor,useAIAutocomplete,visibleDateRange,withSkippedParams});
|
|
1927
2058
|
//# sourceMappingURL=index.js.map
|