@magicx-eng/ai-autocomplete-react 0.59.0 → 0.59.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/README.md +1 -1
- package/dist/index.d.mts +12 -2
- package/dist/index.d.ts +12 -2
- package/dist/index.js +15 -15
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +15 -15
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{buildSubmitResult as ps,cellDay as hs,cellIso as us,DATE_RANGE_META_END as ms,DATE_RANGE_META_START as gs,DEFAULT_OPTION_COUNT_UNIT as fs,dateCellMarks as bs,formatDate as ws,formatDateRange as vs,formatOptionCount as xs,formatPlace as ys,formatTime as ks,isoDate as Cs,LOCATION_META_KEY as Ss,monthLabel as Ts,optionCountLabel as Ps,optionHasImage as Is,optionImageSources as Es,optionImageSrc as As,optionLabel as Rs,optionsShowLeadingVisuals as Os,PRODUCT_PATH_PREFIX as Ls,parseDate as zs,parseLooseDate as Ds,parseLooseDateRange as Ms,parseTime as Ns,productFromMatchedItem as Fs,productImageSources as Hs,productsFromCustomFields as Bs,sanitizeOptionIconSvg as Ws,selectedRangeFor as Gs,TIME_META_KEY as Ks,visibleDateRange as qs,WEEKDAY_LABELS as _s,withSkippedParams as Vs}from"@magicx-eng/ai-autocomplete-vanilla";import{forwardRef as jo,useCallback as
|
|
1
|
+
import{buildSubmitResult as ps,cellDay as hs,cellIso as us,DATE_RANGE_META_END as ms,DATE_RANGE_META_START as gs,DEFAULT_OPTION_COUNT_UNIT as fs,dateCellMarks as bs,formatDate as ws,formatDateRange as vs,formatOptionCount as xs,formatPlace as ys,formatTime as ks,isoDate as Cs,LOCATION_META_KEY as Ss,monthLabel as Ts,optionCountLabel as Ps,optionHasImage as Is,optionImageSources as Es,optionImageSrc as As,optionLabel as Rs,optionsShowLeadingVisuals as Os,PRODUCT_PATH_PREFIX as Ls,parseDate as zs,parseLooseDate as Ds,parseLooseDateRange as Ms,parseTime as Ns,productFromMatchedItem as Fs,productImageSources as Hs,productsFromCustomFields as Bs,sanitizeOptionIconSvg as Ws,selectedRangeFor as Gs,TIME_META_KEY as Ks,visibleDateRange as qs,WEEKDAY_LABELS as _s,withSkippedParams as Vs}from"@magicx-eng/ai-autocomplete-vanilla";import{forwardRef as jo,useCallback as ka,useEffect as Fa,useImperativeHandle as $o,useLayoutEffect as Zo,useRef as ia}from"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
|
|
@@ -406,7 +406,7 @@ import{buildSubmitResult as ps,cellDay as hs,cellIso as us,DATE_RANGE_META_END a
|
|
|
406
406
|
transition: none;
|
|
407
407
|
}
|
|
408
408
|
}
|
|
409
|
-
`,document.head.appendChild(e)}var
|
|
409
|
+
`,document.head.appendChild(e)}var Ve={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",aiaChipForm:"aia-aiaChipForm-tKbNc",aiaTileGrow:"aia-aiaTileGrow-j9Pat",aiaTileSpring:"aia-aiaTileSpring-FEwNg",aiaTileFade:"aia-aiaTileFade-H1LDQ",aiaImageGrow:"aia-aiaImageGrow-i9yw8"};import{attachScrollArrow as oo,attachViewportFit as no,containScroll as ro,dateFloorFor as so,destroyPanelMorph as lo,findMultiSelectDone as co,fitMultiSelectDone as po,hasSkippablePill as ho,isCalendarFormat as uo,labelTraditionalAutocomplete as mo,panelMorphKey as go,queryLive as fo,settlePanelMorph as bo,syncPanelHug as wo,uiStringsFor as vo}from"@magicx-eng/ai-autocomplete-vanilla";import{useEffect as Qe,useLayoutEffect as La,useRef as Je,useState as xo}from"react";if(typeof document<"u"&&!document.getElementById("ac-style-0ae03977")){let e=document.createElement("style");e.id="ac-style-0ae03977",e.textContent=`/*
|
|
410
410
|
* Built-in appearance defaults \u2014 zero specificity via :where().
|
|
411
411
|
* Consumer CSS always wins without !important.
|
|
412
412
|
*
|
|
@@ -1724,7 +1724,7 @@ import{buildSubmitResult as ps,cellDay as hs,cellIso as us,DATE_RANGE_META_END a
|
|
|
1724
1724
|
opacity: 1;
|
|
1725
1725
|
}
|
|
1726
1726
|
}
|
|
1727
|
-
`,document.head.appendChild(e)}var
|
|
1727
|
+
`,document.head.appendChild(e)}var se={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",multiDone:"aia-multiDone-y12U7",seeAllRow:"aia-seeAllRow-icrau",seeAll:"aia-seeAll-0Zbgc",multiActionsLoadingOut:"aia-multiActionsLoadingOut-lSdMh",multiActionsFadeIn:"aia-multiActionsFadeIn-zbGTG",seeAllLoadingOut:"aia-seeAllLoadingOut-THnrl",seeAllFadeIn:"aia-seeAllFadeIn-1GWpl"};import{cellDay as Gt,cellIso as da,dateCellMarks as Kt,isDimmedDay as qt,isoDate as _t,monthLabel as Vt,visibleDateRange as Ut,WEEKDAY_LABELS as Qt}from"@magicx-eng/ai-autocomplete-vanilla";import{useState as Yt}from"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) ---
|
|
1728
1728
|
|
|
1729
1729
|
One of three hand-maintained copies (vanilla styles.css, this file, Angular's
|
|
1730
1730
|
date-grid.component.css). Only the class-naming layer differs \u2014 the
|
|
@@ -1921,7 +1921,7 @@ import{buildSubmitResult as ps,cellDay as hs,cellIso as us,DATE_RANGE_META_END a
|
|
|
1921
1921
|
opacity: 0.8;
|
|
1922
1922
|
background: rgba(var(--aia-streak-rgb, 255, 255, 255), 0.06);
|
|
1923
1923
|
}
|
|
1924
|
-
`,document.head.appendChild(e)}var K={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",reference:"aia-reference-Q5bXf",pressed:"aia-pressed-bEyyN"};import{jsx as
|
|
1924
|
+
`,document.head.appendChild(e)}var K={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",reference:"aia-reference-Q5bXf",pressed:"aia-pressed-bEyyN"};import{jsx as be,jsxs as Qa}from"react/jsx-runtime";var jt=["sunday","monday","tuesday","wednesday","thursday","friday","saturday"];function Ya({options:e,activeIndex:n,listboxId:a,view:t,selection:o,onSelect:s,onHighlight:r,onUnhighlight:l,onPreviousMonth:w,onNextMonth:v}){let y=_t(new Date),f=Ut({pendingStart:o.rangeStart,highlightedIso:da(e[n]),selected:o.selectedRange,floor:o.floor});return Qa("div",{className:K.datepicker,"data-aia-datepicker":"",children:[Qa("div",{className:K.header,children:[be("button",{type:"button",tabIndex:-1,className:K.nav,"data-aia-date-prev":"","aria-label":"Previous month",onMouseDown:h=>h.preventDefault(),onClick:w,children:"\u2039"}),be("span",{className:K.month,"data-aia-date-month":"","aria-live":"polite",children:Vt(t)}),be("button",{type:"button",tabIndex:-1,className:K.nav,"data-aia-date-next":"","aria-label":"Next month",onMouseDown:h=>h.preventDefault(),onClick:v,children:"\u203A"})]}),be("div",{className:K.weekdays,"aria-hidden":"true",children:Qt.map((h,c)=>be("span",{className:K.weekday,children:h},jt[c]))}),be("div",{className:K.grid,"data-aia-date-grid":"",children:e.map((h,c)=>be($t,{option:h,id:`${a}-option-${c}`,index:c,isHighlighted:c===n&&h.is_tappable,isToday:da(h)===y,isPast:qt(da(h),y,o.floor),marks:Kt(da(h),{selectedIso:o.selectedIso,range:f,references:o.references}),onSelect:s,onHighlight:r,onUnhighlight:l},da(h)??`pad-${c}`))})]})}function $t({option:e,id:n,index:a,isHighlighted:t,isToday:o,isPast:s,marks:r,onSelect:l,onHighlight:w,onUnhighlight:v}){let[y,f]=Yt(!1),h=Gt(e);if(h==null)return be("div",{id:n,role:"option","data-aia-option":"","data-aia-date-cell":"","aria-hidden":"true","aria-selected":!1,tabIndex:-1,className:`${K.cell} ${K.blank}`});let c=()=>{f(!0),l(e),setTimeout(()=>f(!1),170)},x=[K.cell,K.day,s?K.past:"",t?K.highlighted:"",o?K.today:"",r.inRange?K.inRange:"",r.selected?K.selected:"",r.reference?K.reference:"",y?K.pressed:""].filter(Boolean).join(" ");return be("div",{id:n,role:"option","data-aia-option":"","data-aia-date-cell":"","aria-selected":t,"aria-label":e.text,tabIndex:0,className:x,onClick:c,onKeyDown:I=>{(I.key==="Enter"||I.key===" ")&&(I.preventDefault(),c())},onMouseEnter:()=>w(a),onMouseLeave:v?()=>v(a):void 0,children:be("span",{className:K.number,children:h})})}import{ATTRIBUTION_URL as Zt,buildAttributionUrl as Xt,getFooterHint as Jt,uiStringsFor as ei}from"@magicx-eng/ai-autocomplete-vanilla";import{useEffect as ai,useState as ti}from"react";if(typeof document<"u"&&!document.getElementById("ac-style-5259a217")){let e=document.createElement("style");e.id="ac-style-5259a217",e.textContent=`.aia-cluster {
|
|
1925
1925
|
display: flex;
|
|
1926
1926
|
flex-wrap: wrap;
|
|
1927
1927
|
gap: var(--aia-cluster-gap, 0.5rem);
|
|
@@ -1961,7 +1961,7 @@ import{buildSubmitResult as ps,cellDay as hs,cellIso as us,DATE_RANGE_META_END a
|
|
|
1961
1961
|
.aia-cluster[data-justify="around"] {
|
|
1962
1962
|
justify-content: space-around;
|
|
1963
1963
|
}
|
|
1964
|
-
`,document.head.appendChild(e)}import{jsx as ja}from"react/jsx-runtime";function
|
|
1964
|
+
`,document.head.appendChild(e)}import{jsx as ja}from"react/jsx-runtime";function ca({gap:e,align:n="center",justify:a="start",noWrap:t=!1,inline:o=!1,className:s,children:r,...l}){let w=e?{"--aia-cluster-gap":e}:void 0,v={className:s?`aia-cluster ${s}`:"aia-cluster","data-align":n,"data-justify":a,"data-nowrap":t||void 0,"data-inline":o||void 0,style:w,...l};return o?ja("span",{...v,children:r}):ja("div",{...v,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
|
|
1965
1965
|
dropdown's rounded edges. The top inset (--aia-footer-gap) adds breathing
|
|
1966
1966
|
room above the hint/branding row so the footer doesn't butt against the last
|
|
1967
1967
|
option row \u2014 additive to the dropdown's 8px section gap. */
|
|
@@ -2108,7 +2108,7 @@ import{buildSubmitResult as ps,cellDay as hs,cellIso as us,DATE_RANGE_META_END a
|
|
|
2108
2108
|
justify-content: flex-end;
|
|
2109
2109
|
}
|
|
2110
2110
|
}
|
|
2111
|
-
`,document.head.appendChild(e)}var Ae={footer:"aia-footer-qQQ7x",row:"aia-row-BgZ6Q",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"};import{jsx as
|
|
2111
|
+
`,document.head.appendChild(e)}var Ae={footer:"aia-footer-qQQ7x",row:"aia-row-BgZ6Q",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"};import{jsx as pa,jsxs as Sa}from"react/jsx-runtime";function $a({isOptionHighlighted:e=!1,isInputEmpty:n=!1,strings:a=ei()}){let{key:t,hint:o}=Jt(e,n,a),[s,r]=ti(Zt);return ai(()=>{r(Xt())},[]),pa("footer",{className:Ae.footer,"data-aia-footer":"",children:Sa(ca,{justify:"between",noWrap:!0,className:Ae.row,children:[Sa(ca,{gap:"5px",className:Ae.hintGroup,children:[pa("kbd",{className:Ae.key,children:t}),pa("span",{className:Ae.hint,children:o})]}),Sa("a",{className:Ae.brandLink,href:s,target:"_blank",rel:"noopener noreferrer",children:[pa("span",{className:Ae.brand,children:"AI"}),pa("span",{className:Ae.badge,children:"Autocomplete"})]})]})})}import{useEffect as Za,useLayoutEffect as ii,useRef as le}from"react";if(typeof document<"u"&&!document.getElementById("ac-style-2feec02e")){let e=document.createElement("style");e.id="ac-style-2feec02e",e.textContent=`/* Location search \u2014 React copy of the vanilla rules in styles.css (and of the
|
|
2112
2112
|
Angular copy). The three are kept identical by
|
|
2113
2113
|
packages/vanilla/tests/render/locationFieldParity.test.ts. */
|
|
2114
2114
|
.aia-location-6-fsr {
|
|
@@ -2242,7 +2242,7 @@ import{buildSubmitResult as ps,cellDay as hs,cellIso as us,DATE_RANGE_META_END a
|
|
|
2242
2242
|
.aia-loadingBar-OLCr4:nth-child(3) {
|
|
2243
2243
|
width: 60%;
|
|
2244
2244
|
}
|
|
2245
|
-
`,document.head.appendChild(e)}var
|
|
2245
|
+
`,document.head.appendChild(e)}var V={location:"aia-location-6-fsr",field:"aia-field-xEzwi",icon:"aia-icon-czx6C",input:"aia-input-Yi9V-",results:"aia-results-C3O0V",row:"aia-row-Q9y8g",highlighted:"aia-highlighted-RJjPx",pin:"aia-pin-OjabL",text:"aia-text-Xs84O",name:"aia-name-Z-WJR",secondary:"aia-secondary-4sCT1",note:"aia-note-xCSvY",empty:"aia-empty-SYBzi",loading:"aia-loading-Ih1gi",loadingBar:"aia-loadingBar-OLCr4"};import{jsx as ne,jsxs as Fe}from"react/jsx-runtime";var oi=0;function ha(e){return e.getRootNode().activeElement??null}function et(e){return e.getRootNode().getSelection?.()??document.getSelection()}function Xa(e){if(!e.isContentEditable)return null;let n=et(e);if(!n||n.rangeCount===0)return null;let a=n.getRangeAt(0);return e.contains(a.startContainer)?a.cloneRange():null}function Ja(e,n){if(e.focus({preventScroll:!0}),!e.isContentEditable)return;let a=et(e);if(!a)return;let t=n;(!t||!t.startContainer.isConnected||!e.contains(t.startContainer))&&(t=document.createRange(),t.selectNodeContents(e),t.collapse(!1)),a.removeAllRanges(),a.addRange(t)}var ni=Fe("svg",{className:V.icon,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[ne("path",{d:"M12 21s-7-6.2-7-11.5A7 7 0 0 1 19 9.5C19 14.8 12 21 12 21z"}),ne("circle",{cx:"12",cy:"9.5",r:"2.5"})]}),ri=Fe("svg",{className:V.icon,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round","aria-hidden":"true",children:[ne("circle",{cx:"11",cy:"11",r:"7"}),ne("path",{d:"m20 20-3.5-3.5"})]});function at({view:e,searchLabel:n,noResultsLabel:a,useTypedLabel:t,widgetFocused:o,reediting:s=!1,visible:r=!0,interactive:l=!0,onQuery:w,onMove:v,onCommit:y,onFocusChange:f}){let h=le(null),c=le(null),x=le(null),I=le(null),q=le(null),D=le(!1),O=le(!1),te=le(!1),T=le(!1),z=le(o);z.current=o;let _=le(f);_.current=f;let F=d=>{T.current=d,f(d)},Q=()=>{let d=h.current;return d!=null&&ha(d)===d},E=()=>{let d=c.current;if(!d)return;let S=ha(d);S instanceof HTMLElement&&S!==h.current&&S!==document.body&&!d.contains(S)&&(I.current=S,q.current=Xa(S))},J=d=>{let S=c.current;!S||!(d instanceof HTMLElement)||d===I.current||d===document.body||S.contains(d)||(I.current=d,q.current=Xa(d))},W=le(null);W.current===null&&(W.current=`aia-location-${++oi}`);let H=`${W.current}-row-`;Za(()=>{let d=h.current;d&&d.value!==e.query&&ha(d)!==d&&(d.value=e.query)},[e.query]),Za(()=>{o&&(s&&!te.current&&(O.current=!1),te.current=s);let d=h.current;if(d){if(!r&&Q()){O.current=!0,Y();return}if(!o){setTimeout(()=>{if(z.current)return;let S=I.current;S&&ha(S)===S||(O.current=!1)},0);return}if(!(!s||O.current||!l||Q())){if(E(),F(!0),d.focus({preventScroll:!0}),!Q()){O.current=!0,F(!1);return}d.value&&d.select()}}}),ii(()=>()=>{if(!T.current)return;let d=h.current,S=I.current;S?.isConnected&&d&&ha(d)===d&&(D.current=!0,Ja(S,q.current),D.current=!1),T.current=!1,_.current(!1)},[]);let Y=(d=!1)=>{d&&(O.current=!0);let S=I.current;S?.isConnected&&Q()&&(D.current=!0,Ja(S,q.current),D.current=!1),F(!1)},re=e.query.trim(),C=e.highlighted>=0&&e.highlighted<e.places.length?`${H}${e.highlighted}`:void 0,B=null;return e.places.length>0?B=e.places.map((d,S)=>Fe("div",{id:`${H}${S}`,role:"option","aria-selected":S===e.highlighted,className:S===e.highlighted?`${V.row} ${V.highlighted}`:V.row,"data-aia-location-row":"","data-aia-index":S,onClick:()=>{l&&(Y(!0),y(S))},children:[ne("span",{className:V.pin,children:ni}),Fe("span",{className:V.text,children:[ne("span",{className:V.name,children:d.name}),d.secondary&&ne("span",{className:V.secondary,children:d.secondary})]})]},d.id)):e.status==="loading"?B=Fe("div",{className:V.loading,"data-aia-location-loading":"",children:[ne("span",{className:V.loadingBar}),ne("span",{className:V.loadingBar}),ne("span",{className:V.loadingBar})]}):re&&(B=Fe("div",{className:V.note,"data-aia-location-note":"",children:[e.status==="done"&&ne("span",{className:V.empty,children:a}),ne("span",{children:t})]})),Fe("div",{ref:c,className:V.location,"data-aia-location":"",onMouseDown:d=>{!(d.target instanceof Node)||!x.current?.contains(d.target)||(d.stopPropagation(),E(),F(!0))},children:[Fe("label",{ref:x,className:V.field,children:[ri,ne("input",{ref:h,type:"text",className:V.input,"data-aia-location-input":"",defaultValue:e.query,placeholder:n,"aria-label":n,"aria-activedescendant":C,autoComplete:"off",autoCapitalize:"words",enterKeyHint:"done",spellCheck:!1,tabIndex:r?0:-1,onChange:d=>w(d.target.value),onFocus:d=>{J(d.relatedTarget),F(!0)},onBlur:()=>{D.current||(O.current=!0,F(!1))},onKeyDown:d=>{if(!d.nativeEvent.isComposing)switch(d.key){case"ArrowDown":case"ArrowUp":d.preventDefault(),v(d.key==="ArrowDown"?1:-1);return;case"Enter":if(d.preventDefault(),!l)return;Y(!0),y();return;case"Escape":d.preventDefault(),d.stopPropagation(),O.current=!0,Y();return;case"Backspace":if(d.currentTarget.value!=="")return;d.preventDefault(),O.current=!0,Y();return}}})]}),ne("div",{className:V.results,"data-aia-location-results":"","aria-live":"polite",children:B})]})}import{isSmartSuggestion as ci,isTraditionalAutocompleteSuggestion as pi}from"@magicx-eng/ai-autocomplete-vanilla";import{SMART_SUGGESTION_SPARKLE_SVG as si}from"@magicx-eng/ai-autocomplete-vanilla";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,
|
|
2246
2246
|
no outline. ~28px via 6px padding + 14px text + the 1px border (border-box).
|
|
2247
2247
|
The border is kept as a 1px transparent line so the box stays the same size
|
|
2248
2248
|
as it was when the outline was dashed. */
|
|
@@ -2400,7 +2400,7 @@ import{buildSubmitResult as ps,cellDay as hs,cellIso as us,DATE_RANGE_META_END a
|
|
|
2400
2400
|
opacity: 0;
|
|
2401
2401
|
}
|
|
2402
2402
|
}
|
|
2403
|
-
`,document.head.appendChild(e)}var
|
|
2403
|
+
`,document.head.appendChild(e)}var we={pill:"aia-pill-6Ga7S",fadeIn:"aia-fadeIn-Ux4eQ",rounded:"aia-rounded-y7xA9",smartText:"aia-smartText-R0cfw","smartSuggestion-shimmer":"aia-smartSuggestion-shimmer-F-yoD",smartSparkle:"aia-smartSparkle-IVabG","smartSuggestion-sparkle":"aia-smartSuggestion-sparkle-Wfj-4","smartSuggestion-sparkle-small":"aia-smartSuggestion-sparkle-small-3VsWJ",skeleton:"aia-skeleton-57P0T",loadingOut:"aia-loadingOut-Aj9xO"};import{Fragment as li,jsx as Ta,jsxs as di}from"react/jsx-runtime";var Pa={selected:1,first:.7,next:.4,last:.2};function tt({label:e,state:n,active:a,rounded:t,loading:o,smartSuggestion:s,completionHeader:r,onClick:l}){let w=[we.pill,t?we.rounded:"",o?we.skeleton:""].filter(Boolean).join(" ");return Ta("button",{type:"button","data-aia-pill":"","data-aia-pill-active":a?"":void 0,"data-aia-loading":o?"":void 0,"data-aia-smart-suggestion":s?r?"header":"":void 0,tabIndex:-1,contentEditable:!1,suppressContentEditableWarning:!0,className:w,style:{"--aia-pill-opacity":Pa[n]},onMouseDown:v=>v.preventDefault(),onClick:o?void 0:l,disabled:o,children:s?di(li,{children:[Ta("span",{className:`${we.smartText} magicx-aia-smart-suggestion-text`,children:e}),Ta("span",{className:`${we.smartSparkle} magicx-aia-smart-suggestion-sparkle`,dangerouslySetInnerHTML:{__html:si}})]}):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 {
|
|
2404
2404
|
position: relative;
|
|
2405
2405
|
z-index: 1;
|
|
2406
2406
|
pointer-events: auto;
|
|
@@ -2410,7 +2410,7 @@ import{buildSubmitResult as ps,cellDay as hs,cellIso as us,DATE_RANGE_META_END a
|
|
|
2410
2410
|
align-items: center;
|
|
2411
2411
|
vertical-align: middle;
|
|
2412
2412
|
}
|
|
2413
|
-
`,document.head.appendChild(e)}var
|
|
2413
|
+
`,document.head.appendChild(e)}var Ia={list:"aia-list-qvLqO"};import{jsx as fa}from"react/jsx-runtime";var hi=[125,69];function it(e){return e===0?"first":e===1?"next":"last"}function ba({pills:e,activePillIndex:n,onSelectPill:a,activeSelected:t,rounded:o,loading:s}){return s&&e.length===0?fa("span",{className:Ia.list,"data-aia-pill-list-loading":"",children:hi.map((r,l)=>fa("span",{"data-aia-pill-skeleton":"",className:`${we.pill} ${o?we.rounded:""} ${we.skeleton}`,style:{width:r,"--aia-pill-opacity":Pa[it(l)]}},`skel-${r}`))}):fa("span",{className:Ia.list,"data-aia-pill-list-loading":s?"":void 0,children:e.map((r,l)=>{let w=!!t&&l===n;return fa(tt,{label:r.text,state:w?"selected":it(l),selected:w,active:l===n,rounded:o,loading:s,smartSuggestion:ci(r),completionHeader:pi(r),onClick:()=>a(l)},`${r.parameter}-${r.text}`)})})}import{attachProductRowWheel as ui,productImageSources as mi,productImageSrc as gi,productInitial as fi,productPhotoFill as bi,uiStringsFor as wi}from"@magicx-eng/ai-autocomplete-vanilla";import{useEffect as Ea,useRef as wa,useState as va}from"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
|
|
2414
2414
|
(packages/vanilla/src/styles.css). Same tokens, same defaults, so a consumer
|
|
2415
2415
|
theming one package sees the same result in the other.
|
|
2416
2416
|
|
|
@@ -3003,7 +3003,7 @@ import{buildSubmitResult as ps,cellDay as hs,cellIso as us,DATE_RANGE_META_END a
|
|
|
3003
3003
|
opacity: 0.01;
|
|
3004
3004
|
}
|
|
3005
3005
|
}
|
|
3006
|
-
`,document.head.appendChild(e)}var
|
|
3006
|
+
`,document.head.appendChild(e)}var U={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",compareAt:"aia-compareAt-ewE54",badge:"aia-badge-j9Hcd",cart:"aia-cart-kSlqU",cartCheck:"aia-cartCheck-YTTQ6",cartGlyph:"aia-cartGlyph-cmqAk",cartSpinner:"aia-cartSpinner-442rc","magicx-aia-product-cart-spin":"aia-magicx-aia-product-cart-spin-x8mgr",stripLoadingOut:"aia-stripLoadingOut-0jOOQ",stripFadeIn:"aia-stripFadeIn-0p9qx"};import{jsx as ee,jsxs as Xe}from"react/jsx-runtime";function ot({products:e,listboxId:n,onSelect:a,onAddToCart:t,onFocusChange:o,focusable:s=!0,loading:r=!1,layout:l="row",imageFallback:w="image",strings:v=wi()}){let y=e.length>0,f=wa(null);if(Ea(()=>{let c=f.current;if(!(!y||!c))return ui(c)},[y]),!y)return null;let h=`${n}-products-label`;return Xe("section",{className:U.section,"data-aia-products":"","data-aia-loading":r?"":void 0,"data-aia-products-layout":l,role:"group","aria-labelledby":h,children:[ee("div",{className:U.label,id:h,"data-aia-products-label":"",children:v.products}),ee("div",{ref:f,className:U.row,"data-aia-products-row":"",children:e.map((c,x)=>ee(vi,{product:c,id:`${n}-product-${x}`,onSelect:a,onAddToCart:t,onFocusChange:o,focusable:s,imageFallback:w,soldOut:v.soldOut,addToCart:v.addToCart},c.id))})]})}function vi({product:e,id:n,onSelect:a,onAddToCart:t,onFocusChange:o,focusable:s,imageFallback:r,soldOut:l,addToCart:w}){let v=!!t&&e.available!==!1,[y,f]=va(null),h=x=>{x.relatedTarget?.closest("[data-aia-dropdown]")||o?.(!1)},c=x=>{x.metaKey||x.ctrlKey||x.shiftKey||x.altKey||x.button!==0||(x.preventDefault(),a(e))};return Xe("a",{id:n,className:U.card,"data-aia-product":"","data-aia-product-sold-out":e.available===!1?"":void 0,"data-aia-product-has-cart":v?"":void 0,role:"option","aria-selected":!1,style:y?{"--aia-product-photo-fill-x":String(y.x),"--aia-product-photo-fill-y":String(y.y)}:void 0,href:e.url,tabIndex:s?0:-1,onClick:c,onKeyDown:x=>{x.key!=="Enter"&&x.key!==" "||(x.preventDefault(),a(e))},onFocus:()=>o?.(!0),onBlur:h,children:[ee(ki,{sources:mi(e.imageUrl),title:e.title,fallback:r,onPhotoFill:f},gi(e.imageUrl)??""),Xe("span",{className:U.body,children:[e.vendor?ee("span",{className:U.vendor,children:e.vendor}):null,ee("span",{className:U.title,children:e.title}),e.price?Xe("span",{className:U.price,children:[e.price,e.compareAtPrice?ee("s",{className:U.compareAt,children:e.compareAtPrice}):null]}):null,e.available===!1?ee("span",{className:U.badge,children:l}):null]}),v&&t?ee(yi,{product:e,label:`${w}: ${e.title}`,focusable:s,onAddToCart:t,onFocus:()=>o?.(!0),onBlur:h},xi(e)):null]})}function xi(e){return[e.id,e.title,e.url,e.imageUrl,e.vendor].map(n=>n??"").join("\0")}function yi({product:e,label:n,focusable:a,onAddToCart:t,onFocus:o,onBlur:s}){let[r,l]=va(null),w=wa(null),v=wa(e);v.current=e;let y=wa(!0);Ea(()=>(y.current=!0,()=>{y.current=!1}),[]);let f=c=>{w.current=c,y.current&&l(c)},h=c=>{if(c.preventDefault(),c.stopPropagation(),w.current==="adding")return;f("adding");let x;try{x=Promise.resolve(t(v.current))}catch(I){x=Promise.reject(I)}x.then(()=>f("added"),()=>f(null))};return ee("span",{className:U.cart,"data-aia-product-cart":"","data-aia-cart-state":r??void 0,"aria-busy":r==="adding"?!0:void 0,role:"button","aria-label":n,tabIndex:a?0:-1,onClick:h,onKeyDown:c=>{c.key!=="Enter"&&c.key!==" "||h(c)},onFocus:c=>{c.stopPropagation(),o()},onBlur:c=>{c.stopPropagation(),s(c)},children:Xe("svg",{viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false",children:[ee("path",{className:U.cartGlyph,d:"M2 3h2.2l2.4 11.2a2 2 0 0 0 2 1.6h8.9a2 2 0 0 0 1.9-1.5L21 8H6"}),ee("path",{className:U.cartGlyph,d:"M13.5 6.5v-4M11.5 4.5h4"}),ee("path",{className:U.cartCheck,d:"M5 12.5l4.5 4.5L19 7.5"}),ee("path",{className:U.cartSpinner,d:"M12 4a8 8 0 1 0 8 8"}),ee("circle",{className:U.cartGlyph,cx:"9",cy:"20",r:"1.3"}),ee("circle",{className:U.cartGlyph,cx:"17.5",cy:"20",r:"1.3"})]})})}function ki({sources:e,title:n,fallback:a,onPhotoFill:t}){let[o,s]=va(0),r=e[o],l=!!r,[w,v]=va(null),y=!l&&a==="initial";return Ea(()=>()=>t(null),[t]),Xe("span",{className:U.media,"aria-hidden":"true","data-aia-product-placeholder":!l&&!y?"":void 0,"data-aia-product-initial":y?"":void 0,"data-aia-image-loaded":l&&w===r?"":void 0,children:[l?ee("img",{className:U.image,src:r,alt:"",loading:"lazy",decoding:"async",onLoad:f=>{v(r),t(bi(f.currentTarget.naturalWidth,f.currentTarget.naturalHeight))},onError:()=>{o+1>=e.length&&t(null),s(f=>f+1)}}):null,y?fi(n):null]})}import{isOptionsGridMobileViewport as Ni,measureOptionsGrid as Fi,needsOptionsGridMeasurement as Hi,OPTIONS_GRID_MOBILE_QUERY as Bi,optionEnterDelayMs as Wi,optionsShowLeadingVisuals as Gi,planOptionsGrid as dt,releasePanelHug as Ki,sameOptionRows as qi,syncPanelHug as _i}from"@magicx-eng/ai-autocomplete-vanilla";import{useEffect as Vi,useLayoutEffect as ct,useRef as pt,useState as ut}from"react";import{optionsGridTemplateColumns as Ci}from"@magicx-eng/ai-autocomplete-vanilla";import{useLayoutEffect as Si,useRef as Ti}from"react";if(typeof document<"u"&&!document.getElementById("ac-style-948e58da")){let e=document.createElement("style");e.id="ac-style-948e58da",e.textContent=`.aia-grid {
|
|
3007
3007
|
display: grid;
|
|
3008
3008
|
grid-template-columns: repeat(
|
|
3009
3009
|
auto-fit,
|
|
@@ -3047,7 +3047,7 @@ import{buildSubmitResult as ps,cellDay as hs,cellIso as us,DATE_RANGE_META_END a
|
|
|
3047
3047
|
:where([data-aia-options-style="classic"]) .aia-grid[data-scroll] {
|
|
3048
3048
|
max-height: var(--aia-grid-max-height, 120px);
|
|
3049
3049
|
}
|
|
3050
|
-
`,document.head.appendChild(e)}import{jsx as Pi}from"react/jsx-runtime";function nt({min:e="16rem",max:n,gap:a,scroll:t=!1,maxHeight:o,scrollResetKey:s,cols:r,template:l,innerRef:
|
|
3050
|
+
`,document.head.appendChild(e)}import{jsx as Pi}from"react/jsx-runtime";function nt({min:e="16rem",max:n,gap:a,scroll:t=!1,maxHeight:o,scrollResetKey:s,cols:r,template:l,innerRef:w,className:v,children:y,...f}){let h=Ti(null);Si(()=>{if(s===void 0)return;let x=h.current;x&&(x.scrollTop=0)},[s]);let c={"--aia-grid-min":e};return n&&(c["--aia-grid-max"]=n),a&&(c["--aia-grid-gap"]=a),o&&(c["--aia-grid-max-height"]=o),r&&(c.gridTemplateColumns=Ci(r)),l&&(c.gridTemplateColumns=l),Pi("div",{ref:x=>{h.current=x,w?.(x)},className:v?`aia-grid ${v}`:"aia-grid","data-scroll":t||void 0,style:c,...f,children:y})}import{formatOptionCount as Ii,highlightParts as Ei,isMultiSelectToggleTap as Ai,OPTION_ENTER_DELAY_VAR as Ri,optionImageSources as rt,optionLabel as st,sanitizeOptionIconSvg as Oi}from"@magicx-eng/ai-autocomplete-vanilla";import{useEffect as Li,useMemo as zi,useRef as Di,useState as ua}from"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 {
|
|
3051
3051
|
position: relative;
|
|
3052
3052
|
/* Clip, not visible: the entrance rise below runs on the inner content,
|
|
3053
3053
|
and a transformed box extends its scroll container's scrollable area.
|
|
@@ -3567,7 +3567,7 @@ import{buildSubmitResult as ps,cellDay as hs,cellIso as us,DATE_RANGE_META_END a
|
|
|
3567
3567
|
border-radius: 6px;
|
|
3568
3568
|
font-size: 11px;
|
|
3569
3569
|
}
|
|
3570
|
-
`,document.head.appendChild(e)}var
|
|
3570
|
+
`,document.head.appendChild(e)}var Z={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",liveMatch:"aia-liveMatch--eYfs",tag:"aia-tag-e3Fwe",pressed:"aia-pressed-98o-r",pressCompress:"aia-pressCompress-ICV3q",scrollHint:"aia-scrollHint-xKXPt",loadingOut:"aia-loadingOut-hI-qI",parameter:"aia-parameter-Dt2zF",match:"aia-match-pp-9v",icon:"aia-icon-Qw938",count:"aia-count-IpYbQ",image:"aia-image-YZAbO",text:"aia-text-yqoh9",checkbox:"aia-checkbox-KGRhg"};import{Fragment as Mi,jsx as ce,jsxs as Aa}from"react/jsx-runtime";function lt({option:e,isHighlighted:n,checked:a,onSelect:t,onHighlight:o,onUnhighlight:s,id:r,loading:l,showIcon:w=!0,showImage:v=!0,showCount:y=!0,scrollHint:f,enterDelayMs:h=0}){let[c]=ua(h),[x,I]=ua(!1),q=v?rt(e.image_url):[],D=q[0]??null,[O,te]=ua([]),T=q.find(C=>!O.includes(C))??null,z=v?(e.imageCollage??[]).map(C=>rt(C)[0]).filter(C=>C!==void 0):[],[_,F]=ua(!1),[Q,E]=ua(null),J=zi(()=>!D&&w&&e.icon_svg?Oi(e.icon_svg):null,[D,w,e.icon_svg]),W=y?Ii(e.item_count):null,H=Di(void 0);Li(()=>()=>clearTimeout(H.current),[]);let Y=C=>{if(l||!e.is_tappable||x&&a===void 0)return;I(!0);let B=C?.currentTarget;a!==void 0&&B!==void 0&&C!==void 0&&!Ai(B,B.querySelector("[data-aia-checkbox]"),C)?t(e,{commit:!0}):t(e),clearTimeout(H.current),H.current=setTimeout(()=>I(!1),170)},re=[Z.item,n&&!l?Z.highlighted:"",e.liveMatch&&!l?Z.liveMatch:"",e.is_tappable?Z.tappable:Z.nonTappable,x?Z.pressed:"",f?Z.scrollHint:""].filter(Boolean).join(" ");return ce("div",{id:r,role:"option","data-aia-option":"","data-aia-loading":l?"":void 0,"data-aia-icon":J&&e.icon?e.icon:void 0,"data-aia-image":D?"":void 0,"data-aia-item-count":W!==null?e.item_count:void 0,"aria-selected":a??n,className:re,style:{[Ri]:`${c}ms`},tabIndex:l||!e.is_tappable?-1:0,onClick:Y,onKeyDown:C=>{!l&&e.is_tappable&&(C.key==="Enter"||C.key===" ")&&(C.preventDefault(),Y())},onMouseEnter:!l&&e.is_tappable?o:void 0,onMouseLeave:s,children:Aa("span",{className:Z.content,children:[a!==void 0&&e.is_tappable&&ce("span",{className:Z.checkbox,"aria-hidden":"true","data-aia-checkbox":"","data-checked":a,children:a?"\u2713":""}),D&&z.length>1&&ce("span",{className:`${Z.image} magicx-aia-option-image`,"aria-hidden":"true","data-aia-collage":z.length,"data-aia-image-loaded":_?"":void 0,children:z.map(C=>ce("img",{src:C,alt:"",loading:"lazy",decoding:"async",referrerPolicy:"no-referrer",draggable:!1,onLoad:()=>F(!0),onError:B=>{B.currentTarget.hidden=!0}},C))}),D&&z.length<=1&&ce("span",{className:`${Z.image} magicx-aia-option-image`,"aria-hidden":"true","data-aia-image-loaded":T!==null&&Q===T?"":void 0,children:ce("img",{src:T??D,alt:"",loading:"lazy",decoding:"async",referrerPolicy:"no-referrer",draggable:!1,hidden:T===null,onLoad:()=>E(T),onError:()=>{T!==null&&te(C=>[...C,T])}})}),J&&ce("span",{className:`${Z.icon} magicx-aia-option-icon`,"aria-hidden":"true",dangerouslySetInnerHTML:{__html:J}}),Aa("span",{className:Z.text,children:[e.matchedText?Ei(st(e),e.matchedText).map((C,B)=>C.bold?ce("strong",{className:`${Z.match} magicx-aia-option-match`,children:C.text},B):C.text):st(e),e.parameterLabel&&Aa(Mi,{children:[" ",ce("span",{className:`${Z.parameter} magicx-aia-option-parameter`,children:e.parameterLabel})]})]}),e.tag&&ce("span",{className:Z.tag,children:e.tag}),W!==null&&ce("span",{className:`${Z.count} magicx-aia-option-count`,children:W})]})})}import{jsx as ht}from"react/jsx-runtime";function Ui(){let[e,n]=ut(Ni);return Vi(()=>{if(typeof window>"u"||!window.matchMedia)return;let a=window.matchMedia(Bi),t=()=>n(a.matches);return t(),a.addEventListener("change",t),()=>a.removeEventListener("change",t)},[]),e}function mt({options:e,activeIndex:n,picked:a,onSelect:t,onHighlight:o,onUnhighlight:s,listboxId:r,loading:l,groupKey:w="",optionsPosition:v="below",showIcons:y=!0,showImages:f=!0,showCounts:h=!0}){let c=Ui(),x=pt(null),[I,q]=ut(null),D=pt(null);ct(()=>{if(l&&qi(D.current,e))return;D.current=l?null:e;let T=x.current,z=T&&!l&&Hi(e.length,c),_=T?.closest("[data-aia-dropdown]");z&&_&&Ki(_);let F=z?Fi(T):null;q(F?dt(e.length,c,F.rowWidths,F.gridWidth):null)},[e,c,l]);let O=I??dt(e.length,c,null,null);ct(()=>{let T=x.current?.closest("[data-aia-dropdown]");T&&_i(T)},[O.template,c]);let te=Gi(e,y,f);return ht(nt,{min:"250px",max:"1fr",gap:"0",scroll:!0,scrollResetKey:w,template:O.template,maxHeight:O.maxHeight,innerRef:T=>{x.current=T},"data-aia-group":w,children:e.map((T,z)=>ht(lt,{option:T,isHighlighted:z===n,checked:a?a.includes(T.text):void 0,onSelect:t,onHighlight:()=>o(z),onUnhighlight:s?()=>s(z):void 0,id:`${r}-option-${z}`,loading:l,showIcon:y&&te,showImage:f&&te,showCount:h,scrollHint:!l&&O.scrollHintIndices.includes(z),enterDelayMs:l?0:Wi(z,O.cols,e.length,v)},`${w}\0${T.parameter??""}\0${T.text}`))})}import{formatTime as Qi,TIME_WHEEL_COLUMNS as Yi,TIME_WHEEL_ROW_HEIGHT as ji,timeWheelIndex as gt,timeWheelIndexFromScroll as $i,timeWheelRows as Zi,withTimeWheelIndex as ft}from"@magicx-eng/ai-autocomplete-vanilla";import{Fragment as Xi,useEffect as Ji,useLayoutEffect as eo,useRef as xa}from"react";if(typeof document<"u"&&!document.getElementById("ac-style-52a922cb")){let e=document.createElement("style");e.id="ac-style-52a922cb",e.textContent=`/* --- Time wheel (replaces the options grid for time suggestions) ---
|
|
3571
3571
|
|
|
3572
3572
|
One of three hand-maintained copies (vanilla styles.css, this file, Angular's
|
|
3573
3573
|
time-wheel.component.css). Only the class-naming layer differs \u2014 the
|
|
@@ -3689,7 +3689,7 @@ import{buildSubmitResult as ps,cellDay as hs,cellIso as us,DATE_RANGE_META_END a
|
|
|
3689
3689
|
.aia-done-llNY5:hover {
|
|
3690
3690
|
background: var(--aia-time-done-bg-hover, var(--aia-done-bg-hover, #d8dde8));
|
|
3691
3691
|
}
|
|
3692
|
-
`,document.head.appendChild(e)}var
|
|
3692
|
+
`,document.head.appendChild(e)}var pe={timeWheel:"aia-timeWheel-KdR4A",value:"aia-value--wqvm",columns:"aia-columns-TaD-f",band:"aia-band-pVy-f",column:"aia-column-lwtdd",row:"aia-row-A3pAx",selected:"aia-selected-xgOWY",separator:"aia-separator-kX9WO",done:"aia-done-llNY5"};import{jsx as Ue,jsxs as Ra}from"react/jsx-runtime";var ao=120;function bt({view:e,label:n,doneLabel:a,interactive:t=!0,onTimeChange:o,onTimeCommit:s}){return Ra("div",{className:pe.timeWheel,"data-aia-time-wheel":"",role:"group","aria-label":n,onMouseDown:r=>r.preventDefault(),children:[Ue("span",{className:pe.value,"data-aia-time-value":"","aria-live":"polite",children:Qi(e.minutes)}),Ra("div",{className:pe.columns,"aria-hidden":"true",children:[Ue("div",{className:pe.band}),Yi.map(r=>Ra(Xi,{children:[r==="minute"&&Ue("span",{className:pe.separator,children:":"}),Ue(to,{column:r,minutes:e.minutes,interactive:t,onTimeChange:o})]},r))]}),Ue("button",{type:"button",tabIndex:-1,className:pe.done,"data-aia-time-done":"",onClick:()=>{t&&s()},children:a})]})}function to({column:e,minutes:n,interactive:a,onTimeChange:t}){let o=xa(null),s=xa(null),r=xa(null),l=xa({minutes:n,interactive:a,onTimeChange:t});l.current={minutes:n,interactive:a,onTimeChange:t};let w=gt(e,n);eo(()=>{let f=o.current;if(!f||r.current)return;let h=w*ji;Math.abs(f.scrollTop-h)<1||(s.current=h,f.scrollTop=h)},[w]),Ji(()=>()=>{r.current&&clearTimeout(r.current)},[]);let v=()=>{r.current=null;let f=o.current,h=l.current;if(!f||!h.interactive)return;let c=$i(e,f.scrollTop);c!==gt(e,h.minutes)&&h.onTimeChange(ft(e,h.minutes,c))},y=()=>{let f=o.current;if(f){if(s.current!=null&&Math.abs(f.scrollTop-s.current)<1){s.current=null;return}s.current=null,r.current&&clearTimeout(r.current),r.current=setTimeout(v,ao)}};return Ue("div",{ref:o,className:pe.column,"data-aia-time-column":e,onScroll:y,children:Zi(e).map((f,h)=>Ue("div",{className:h===w?`${pe.row} ${pe.selected}`:pe.row,"data-aia-time-row":"","data-aia-index":h,onClick:()=>{l.current.interactive&&t(ft(e,l.current.minutes,h))},children:f.label},f.label))})}if(typeof document<"u"&&!document.getElementById("ac-style-8414cd5f")){let e=document.createElement("style");e.id="ac-style-8414cd5f",e.textContent=`.aia-stack {
|
|
3693
3693
|
display: flex;
|
|
3694
3694
|
flex-direction: column;
|
|
3695
3695
|
gap: var(--aia-stack-space, 0.5rem);
|
|
@@ -3704,7 +3704,7 @@ import{buildSubmitResult as ps,cellDay as hs,cellIso as us,DATE_RANGE_META_END a
|
|
|
3704
3704
|
align-items: end;
|
|
3705
3705
|
}
|
|
3706
3706
|
/* data-align="stretch" is the flex default \u2014 no rule needed. */
|
|
3707
|
-
`,document.head.appendChild(e)}import{jsx as io}from"react/jsx-runtime";function wt({space:e,align:n="stretch",className:a,children:t,...o}){let s=e?{"--aia-stack-space":e}:void 0;return io("div",{className:a?`aia-stack ${a}`:"aia-stack","data-align":n,style:s,...o,children:t})}import{jsx as
|
|
3707
|
+
`,document.head.appendChild(e)}import{jsx as io}from"react/jsx-runtime";function wt({space:e,align:n="stretch",className:a,children:t,...o}){let s=e?{"--aia-stack-space":e}:void 0;return io("div",{className:a?`aia-stack ${a}`:"aia-stack","data-align":n,style:s,...o,children:t})}import{jsx as X,jsxs as Oa}from"react/jsx-runtime";var yo=typeof window>"u"?Qe:La,ko=[159,119,164],Co=()=>{},vt=()=>{},So=e=>{},To=()=>{},Po=e=>{},Io=e=>{},Eo=e=>{},Ao=e=>{};function Ro(e){let n=()=>typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-color-scheme: dark)").matches,[a,t]=xo(n);if(Qe(()=>{if(e!=="auto"||typeof window>"u"||typeof window.matchMedia!="function")return;let o=window.matchMedia("(prefers-color-scheme: dark)"),s=()=>t(o.matches);return o.addEventListener("change",s),()=>o.removeEventListener("change",s)},[e]),e!==void 0)return e==="auto"?a?"dark":"light":e}function Oo(e,n){let a=Je(null);Qe(()=>{let t=e.current,o=n.current;if(!t||!o)return;let s=fo(t,".aia-grid[data-scroll]");if(a.current&&a.current.grid!==s&&(a.current.controller.destroy(),a.current=null),s&&!a.current){a.current={grid:s,controller:oo({dropdown:t,grid:s,button:o})};return}a.current?.controller.update()}),Qe(()=>()=>{a.current?.controller.destroy(),a.current=null},[])}function Lo(e,n){let a=Je(n);a.current=n;let t=Je(null);La(()=>{let o=e.current;if(o){if(!t.current){t.current=no({dropdown:o,isOpen:()=>a.current});return}t.current.update()}}),Qe(()=>()=>{t.current?.destroy(),t.current=null},[])}function za({suggestions:e,activeIndex:n,onSelect:a,onHighlight:t,onUnhighlight:o,isOpen:s,id:r,className:l,pills:w,onPillClick:v,showPills:y=!0,onSkip:f,showSkipButton:h=!0,showOptionIcons:c=!0,showOptionImages:x=!0,showOptionCounts:I=!0,skipDisabled:q=!1,activeSelected:D=!1,isLoading:O=!1,skeletonExiting:te=!1,isInputEmpty:T=!1,language:z,products:_,onProductSelect:F,onProductAddToCart:Q,onProductFocusChange:E,productsLayout:J="row",productImageFallback:W="image",formatType:H="options",dateView:Y=null,selectedDateIso:re=null,selectedDateRange:C=null,dateRangeStart:B=null,dateReferences:d,onPreviousMonth:S,onNextMonth:He,timeView:ve=null,multiSelectView:b=null,onMultiSelectCommit:Be,onSeeAllResults:xe,fullWidth:Re=!1,onTimeChange:Oe,onTimeCommit:Le,locationView:m=null,isReediting:k=!1,onLocationQuery:P,onLocationMove:A,onLocationCommit:L,onLocationFocusChange:j,isFocused:de=!1,optionsPosition:ie="below",mode:ze}){let ye=Ro(ze),We=ye!==void 0,$=Je(null),ke=Je(null);Oo($,ke),Qe(()=>{if($.current)return ro($.current)},[]);let Ge=e[0]?.options??[],na=!!(w&&w.length>0&&v),ue=!!(_&&_.length>0),Ye=H==="time"&&ve!=null,De=H==="location"&&m!=null,g=s&&(Ge.length>0||y&&na||O||ue||Ye||De);Lo($,g),yo(()=>{let R=$.current;R&&(po(R,co(R)),wo(R))});let Ce={suggestions:e,activeIndex:n,pills:w,showPills:y,showSkipButton:h,showOptionIcons:c,showOptionImages:x,showOptionCounts:I,skipDisabled:q,activeSelected:D,isLoading:O,skeletonExiting:te,isInputEmpty:T,products:_,formatType:H,dateView:Y,selectedDateIso:re,selectedDateRange:C,dateRangeStart:B,dateReferences:d,timeView:ve,multiSelectView:b,locationView:m,isReediting:k,showsSeeAll:!!xe},Ke=Je(Ce);g&&(Ke.current=Ce);let i=g?Ce:Ke.current,u=vo(z),Se=i.suggestions[0],Te=Se?.options??[],me=i.activeIndex>=0&&!!Te[i.activeIndex]?.is_tappable,Pe=mo(i.pills??[],u.keepTyping),Me=!!(Pe.length>0&&v),ge=i.showPills&&Me,ra=i.showPills&&!Me&&i.isLoading,Ie=ge||ra,fe=Me&&ho(Pe)&&i.showSkipButton&&!i.isInputEmpty&&!!f,Ne=Pe[0]?.text,qe=uo(i.formatType)&&i.dateView!=null,je=Te.length>0&&!qe,Ee=Te.length>0&&qe&&!i.isLoading,_e=i.formatType==="time"&&i.timeView!=null&&!i.isLoading,p=i.formatType==="location"&&i.locationView!=null&&!i.isLoading,G=i.isLoading&&!je&&!Ee&&!_e&&!p,M=i.products??[],$e=go(ge?Pe:[]);return La(()=>{$.current&&bo($.current,$e,{visible:g,anchorBottom:ie==="above"})},[$e,g,ie,i.suggestions,i.pills,i.isLoading,i.skeletonExiting,i.isInputEmpty,i.products,i.formatType,i.dateView,i.selectedDateIso,i.selectedDateRange,i.dateRangeStart,i.dateReferences,i.timeView,i.multiSelectView,i.locationView,i.showPills,i.showSkipButton,i.showOptionIcons,i.showOptionImages,i.showOptionCounts,i.showsSeeAll,J,z]),Qe(()=>{let R=$.current;return()=>{R&&lo(R)}},[]),Oa("div",{ref:$,id:r,role:"listbox","aria-multiselectable":!!i.multiSelectView,"data-aia-dropdown":"","data-options-position":ie,"data-mode":ye,"data-aia-loading":i.isLoading?"":void 0,"data-aia-skeleton-exiting":i.skeletonExiting?"":void 0,"data-aia-has-products":M.length>0?"":void 0,"data-aia-full-width":Re?"":void 0,className:`${We?"magicx-aia ":""}${se.dropdown} ${g?se.visible:""} ${l??""}`,onMouseDown:R=>R.preventDefault(),children:[Oa(wt,{space:"8px",children:[(Ie||fe)&&Oa(ca,{noWrap:!0,className:se.pillBar,"data-aia-pillbar":"",children:[Ie&&X("span",{className:se.pillScroll,"data-aia-pill-scroll":"",children:X(ba,{pills:Pe,activePillIndex:0,activeSelected:i.activeSelected,onSelectPill:v??(()=>{}),rounded:!0,loading:i.isLoading})}),fe&&X("button",{type:"button",tabIndex:-1,className:se.skip,"data-aia-skip":"",disabled:i.isLoading||i.skipDisabled,"aria-label":Ne?`${u.skipLabel} ${Ne}`:u.skipLabel,onClick:f,children:u.skip})]}),je&&X(mt,{options:Te,activeIndex:i.activeIndex,onSelect:a,onHighlight:t,onUnhighlight:o,listboxId:r,loading:i.isLoading,groupKey:Se?`${Se.parameter} ${Se.text}`:"",optionsPosition:ie,showIcons:i.showOptionIcons,showImages:i.showOptionImages,showCounts:i.showOptionCounts,picked:i.multiSelectView?.picked}),i.multiSelectView&&X("div",{"data-aia-multi-actions":"",onClick:R=>{R.target.closest("[data-aia-multi-done]")&&!i.skipDisabled&&!i.isLoading&&Be?.()},children:X("button",{type:"button",tabIndex:-1,disabled:!0,"data-aia-multi-done":"",className:se.multiDone,ref:R=>{R&&(R.disabled=!0,R.offsetHeight,R.disabled=i.skipDisabled||i.isLoading)},children:u.done})}),Ee&&i.dateView&&X(Ya,{options:Te,activeIndex:i.activeIndex,listboxId:r,view:i.dateView,selection:{selectedIso:i.selectedDateIso??null,selectedRange:i.selectedDateRange??null,rangeStart:i.dateRangeStart??null,floor:so(i.formatType,i.dateRangeStart),references:i.dateReferences??[]},onSelect:a,onHighlight:t,onUnhighlight:o,onPreviousMonth:S??vt,onNextMonth:He??vt}),_e&&i.timeView&&X(bt,{view:i.timeView,label:u.timeLabel,doneLabel:u.done,interactive:!i.skipDisabled,onTimeChange:Oe??So,onTimeCommit:Le??To}),p&&i.locationView&&X(at,{view:i.locationView,searchLabel:u.locationSearch,noResultsLabel:u.locationNoResults,useTypedLabel:u.locationUseTyped,widgetFocused:de&&g,reediting:i.isReediting,visible:g,interactive:!i.skipDisabled,onQuery:P??Po,onMove:A??Io,onCommit:L??Eo,onFocusChange:j??Ao}),G&&X("div",{className:se.skeletonBars,"data-aia-skeleton-bars":"",children:ko.map(R=>X("span",{className:se.skeletonBar,style:{width:R}},`bar-${R}`))}),X(ot,{products:M,listboxId:r,onSelect:F??Co,onAddToCart:Q,onFocusChange:E,focusable:g&&!i.isLoading,loading:i.isLoading,layout:J,imageFallback:W,strings:u}),i.showsSeeAll&&X("div",{className:se.seeAllRow,"data-aia-see-all":"",onClick:R=>{R.target.closest("[data-aia-see-all-button]")&&(R.stopPropagation(),!i.isLoading&&xe?.())},children:X("button",{type:"button",tabIndex:-1,disabled:!0,"data-aia-see-all-button":"",className:se.seeAll,ref:R=>{R&&(R.disabled=!0,R.offsetHeight,R.disabled=i.isLoading)},children:u.seeAllResults})}),X($a,{isOptionHighlighted:me,isInputEmpty:i.isInputEmpty,strings:u})]}),X("button",{ref:ke,type:"button",tabIndex:-1,className:se.scrollArrow,"data-aia-scroll-arrow":"","aria-label":u.scrollArrow,"aria-hidden":"true",children:X("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:X("path",{d:"M4 6.5 8 10.5l4-4"})})})]})}import{buildSubmitResult as Xo,ModeController as Jo,setCursorOffset as en,uiStringsFor as an,watchEditorHeight as tn}from"@magicx-eng/ai-autocomplete-vanilla";import{uiStringsFor as zo}from"@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 {
|
|
3708
3708
|
flex-shrink: 0;
|
|
3709
3709
|
width: 32px;
|
|
3710
3710
|
height: 32px;
|
|
@@ -3775,5 +3775,5 @@ import{buildSubmitResult as ps,cellDay as hs,cellIso as us,DATE_RANGE_META_END a
|
|
|
3775
3775
|
transition: none;
|
|
3776
3776
|
}
|
|
3777
3777
|
}
|
|
3778
|
-
`,document.head.appendChild(e)}var xt={submitButton:"aia-submitButton-otz7H"};import{jsx as za}from"react/jsx-runtime";function yt({disabled:e,ready:n,onClick:a,label:t=zo().submit}){return za("button",{type:"button","data-aia-submit":"",className:xt.submitButton,disabled:e,"data-aia-ready":n?"":void 0,onClick:o=>{o.stopPropagation(),a()},"aria-label":t,children:za("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",role:"img","aria-label":t,children:za("path",{d:"M9 14V4M9 4L4 9M9 4L14 9",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})}import{AIAutocomplete as Do,dateSelectionFor as Mo,editingSuggestion as No,identifiedParamLabel as Fo,withoutTraditionalAutocomplete as Ho}from"@magicx-eng/ai-autocomplete-vanilla";import{useCallback as Pt,useEffect as Je,useMemo as Bo,useRef as ae,useState as Wo}from"react";import{useRef as kt}from"react";function Ct(e){let n=kt(e);n.current=e;let a=Object.keys(e??{}).sort().join("\0"),t=kt({key:"",overrides:void 0});if(t.current.key!==a){let o={};for(let s of Object.keys(e??{})){let r=(l,f,w)=>{let y=n.current?.[s];return y?y(l,f,w):[]};o[s]=r}t.current={key:a,overrides:e?o:void 0}}return{overrides:t.current.overrides,key:a}}import{useRef as St}from"react";function Tt(e){let n=St(e);n.current=e;let a=St(null);a.current===null&&(a.current={fetch:(o,s)=>{let r=n.current;return r?r.fetch(o,s):Promise.reject(new Error("products config removed"))},transform:o=>n.current?.transform(o)??[],get limit(){return n.current?.limit}});let t=e!==void 0;return{config:t?a.current:void 0,enabled:t}}var It={text:"",completedParams:[],identifiedParams:[],skippedParams:[],pendingSpan:null,suggestions:[],products:[],traditionalAutocomplete:!1,customFields:null,optionSearch:null,activeDropdownIndex:-1,newParamId:null,isLoading:!0,isReady:!1,error:null,segments:[],actionableSuggestions:[],filteredOptions:[],dropdownLoading:!0,dropdownOptions:[],skeletonOptions:null,skeletonSuggestion:null,skeletonPicked:null,dropdownSuggestion:null,skeletonRequested:!1,skeletonExiting:!1,activeFormatType:"options",dateView:null,dateRangeStart:null,dateReferences:[],dateFloor:null,timeView:null,multiSelectView:null,dropdownMultiSelect:null,multiSelectDraft:null,locationView:null,locationSearch:null,locationAutocomplete:!0,locationFieldFocused:!1,placeholderText:"",leadInText:"",optionQuery:"",isSearchingOptions:!1,isDropdownOpen:!1,isActivePillSelected:!1,filterBase:0,filterInProgress:!1,pillTapped:!1,skipNextFetch:!1,lastRawQuery:"",isFocused:!1,dropdownHeld:!1,editingParam:null,editingIdentified:null,editingAnchor:null,editingTail:null,caretOffset:null,inSelectionAnimation:!1,dateViewMonth:null,pendingRangeStart:null,timeDraft:null};function Da({onSubmit:e,onResult:n,onError:a,optionOverrides:t,maskCompletedText:o,apiConfig:s,additionalContext:r,language:l,currency:f,productId:w,visitorId:y,columns:m=2,dropdownTrigger:h,optionsPosition:c,closeDropdownOnBlur:v,prependPlaceholder:I,allOption:q,showNonTappableOptions:D,locationSearch:O,showOptionIcons:te,showOptionImages:T,showOptionCounts:z,showSkipButton:_,showProducts:F,productImageFallback:Y="image",onFocus:E,onBlur:X,value:G,completedParams:H,onChange:j,onParamsChange:de,products:C,mapProducts:B,onProductSelect:d,onProductAddToCart:S,source:Fe,setCursor:ke}){let g=ae(null),[He,Ce]=Wo(null),Re=ae(e);Re.current=e;let Oe=ae(n);Oe.current=n;let Se=ae(a);Se.current=a;let u=ae(j);u.current=j;let k=ae(de);k.current=de;let P=ae(E);P.current=E;let A=ae(X);A.current=X;let L=ae(ke);L.current=ke;let J=ae(d);J.current=d;let ne=ae(S);ne.current=S;let he=ae(y);he.current=y;let Te=ae(()=>{let p=he.current;return typeof p=="function"?p():p}).current,Le=Tt(C),oe=ae(B);oe.current=B;let ue=ae((p,W)=>{let M=oe.current;return M?M(p,W):p}).current,ze=B?ue:void 0,Be=Ct(t);Je(()=>{if(typeof document>"u")return;let p=new Do(document.createElement("div"),{renderMode:"headless",apiConfig:s,additionalContext:r,language:l,currency:f,productId:w,visitorId:Te,optionOverrides:Be.overrides,maskCompletedText:o,columns:m,dropdownTrigger:h,optionsPosition:c,closeDropdownOnBlur:v,prependPlaceholder:I,allOption:q,showNonTappableOptions:D,locationSearch:O,showProducts:F,source:Fe,value:G,completedParams:H,onSubmit:(...M)=>Re.current?.(...M),onResult:(...M)=>Oe.current?.(...M),onError:(...M)=>Se.current?.(...M),onChange:(...M)=>u.current?.(...M),onParamsChange:(...M)=>k.current?.(...M),onFocus:()=>P.current?.(),onBlur:()=>A.current?.(),onProductSelect:M=>J.current?.(M),onProductAddToCart:M=>ne.current?.(M),setCursor:M=>L.current?.(M),products:Le.config,mapProducts:ze});g.current=p,Ce(p.getState());let W=p.subscribe(M=>Ce(M));return()=>{W(),p.destroy(),g.current===p&&(g.current=null)}},[]),Je(()=>{G!==void 0&&g.current?.setValue(G)},[G]),Je(()=>{H!==void 0&&g.current?.setCompletedParams(H)},[H]);let oa=JSON.stringify(s??null),be;try{be=JSON.stringify(r??null)}catch{be="[unstringifiable]"}Je(()=>{g.current?.update({apiConfig:s,additionalContext:r,language:l,currency:f,productId:w,optionOverrides:Be.overrides,dropdownTrigger:h,optionsPosition:c,closeDropdownOnBlur:v,prependPlaceholder:I,allOption:q,showNonTappableOptions:D,locationSearch:O,showProducts:F})},[oa,be,l,f?.code,f?.rate,f?.country,w,Be.key,h,c,v,I,q,D,O,F]);let Qe=ae(!1);Je(()=>{if(!Qe.current){Qe.current=!0;return}g.current?.update({products:Le.config})},[Le.enabled]),Je(()=>{g.current?.update({mapProducts:ze})},[ze]);let ie=ae(null);ie.current===null&&(ie.current={handleTextChange:p=>g.current?.handleTextChange(p),handleKeyDown:p=>{let W="nativeEvent"in p?p.nativeEvent:p;g.current?.handleKeyDown(W)},setFocused:p=>g.current?.setFocused(p),startEditingParam:p=>g.current?.startEditingParam(p),removeParam:p=>g.current?.removeParam(p)??!1,exitEditMode:()=>g.current?.exitEditMode(),handleCaretAfterInput:p=>g.current?.handleCaretAfterInput(p),handleCaretMove:p=>g.current?.handleCaretMove(p),replaceEditingRange:p=>g.current?.replaceEditingRange(p)??!1,setActivePill:p=>g.current?.setActivePill(p),skipActivePill:()=>g.current?.skipActivePill(),removeLastParam:()=>g.current?.removeLastParam(),clearNewParamId:()=>g.current?.clearNewParamId(),reset:()=>g.current?.reset(),refreshProducts:()=>g.current?.refreshProducts(),prepareSubmit:()=>g.current?.prepareSubmit(),getState:()=>g.current?.getState()??It,recordSubmit:p=>g.current?.recordSubmit(p),selectOption:(p,W)=>g.current?.selectOption(p,W),selectProduct:p=>g.current?.selectProduct(p),addProductToCart:p=>{let W=g.current;return!W||!ne.current?Promise.resolve():W.addProductToCart(p)},setActiveDropdownIndex:p=>g.current?.setActiveDropdownIndex(p),clearHighlight:p=>g.current?.clearHighlight(p),showPreviousMonth:()=>g.current?.showPreviousMonth(),showNextMonth:()=>g.current?.showNextMonth(),setTime:p=>g.current?.setTime(p),commitTime:()=>g.current?.commitTime(),toggleMultiSelectOption:p=>g.current?.toggleMultiSelectOption(p),commitMultiSelect:()=>g.current?.commitMultiSelect(),setLocationQuery:p=>g.current?.setLocationQuery(p),moveLocationHighlight:p=>g.current?.moveLocationHighlight(p),commitLocation:p=>g.current?.commitLocation(p),setLocationFieldFocused:p=>g.current?.setLocationFieldFocused(p),handleFocus:()=>g.current?.setFocused(!0),handleBlur:()=>g.current?.setFocused(!1)});let x=ie.current,De=Pt(p=>{let W=p.target.value,R=W.length>0&&!p.nativeEvent?.isComposing&&W[0]!==W[0].toUpperCase()?W[0].toUpperCase()+W.slice(1):W;g.current?.handleTextChange(R)},[]),i=Pt(p=>{g.current?.handleKeyDown(p.nativeEvent)},[]),V=g.current,b=He??It,we=G!==void 0?G:b.text,na=H!==void 0?H:b.completedParams,re=b.actionableSuggestions,We=re[0],Ge=Bo(()=>Ho(re),[re]),Pe=V?.listboxId??"",Ye=b.activeDropdownIndex>=0&&V?`${Pe}-option-${b.activeDropdownIndex}`:void 0,Ie=b.editingParam,ve=b.editingIdentified,Me=Ie?No(Ie):ve?{parameter:ve.parameter,text:Fo(ve.parameter),required:!0,options:[]}:null,Ke=b.dropdownSuggestion??Me??We,je=Me?[Me]:re,Ee=Mo(b),qe=!V||b.dropdownLoading;return{completedParams:na,multiSelectView:b.multiSelectView,toggleMultiSelectOption:x.toggleMultiSelectOption,commitMultiSelect:x.commitMultiSelect,skippedParams:b.skippedParams,identifiedParams:b.identifiedParams,suggestionPills:Ge,setActivePill:x.setActivePill,skipActivePill:x.skipActivePill,removeLastParam:x.removeLastParam,segments:b.segments,newParamId:b.newParamId,clearNewParamId:x.clearNewParamId,suggestions:b.suggestions,activeIndex:b.activeDropdownIndex,isReady:b.isReady,isLoading:qe,isFocused:b.isFocused,isDropdownOpen:b.isDropdownOpen,isActivePillSelected:b.isActivePillSelected,placeholderText:b.placeholderText,listboxId:Pe,error:b.error,products:b.products,customFields:b.customFields,selectProduct:x.selectProduct,addProductToCart:x.addProductToCart,handleTextChange:x.handleTextChange,handleKeyDown:x.handleKeyDown,setFocused:x.setFocused,editingParam:Ie,editingIdentified:ve,editingAnchor:b.editingAnchor,caretOffset:b.caretOffset,startEditingParam:x.startEditingParam,removeParam:x.removeParam,exitEditMode:x.exitEditMode,handleCaretAfterInput:x.handleCaretAfterInput,handleCaretMove:x.handleCaretMove,replaceEditingRange:x.replaceEditingRange,inputProps:{value:we,placeholder:b.placeholderText||void 0,onChange:De,onKeyDown:i,onFocus:x.handleFocus,onBlur:x.handleBlur,role:"combobox","aria-expanded":b.isDropdownOpen,"aria-activedescendant":Ye,"aria-autocomplete":"list","aria-controls":Pe},reset:x.reset,refreshProducts:x.refreshProducts,prepareSubmit:x.prepareSubmit,getState:x.getState,recordSubmit:x.recordSubmit,dropdownProps:{suggestions:Ke?[{...Ke,options:b.dropdownOptions}]:[],activeIndex:b.activeDropdownIndex,onSelect:x.selectOption,onHighlight:x.setActiveDropdownIndex,onUnhighlight:x.clearHighlight,isOpen:b.isDropdownOpen,id:Pe,pills:je,activeSelected:b.isActivePillSelected,onPillClick:x.setActivePill,onSkip:x.skipActivePill,showSkipButton:(_??!0)&&!Ie&&!ve,showOptionIcons:te??!0,showOptionImages:T??!0,showOptionCounts:z??!0,skipDisabled:b.inSelectionAnimation,isLoading:qe,skeletonExiting:b.skeletonExiting,isInputEmpty:we.trim().length===0,language:l,products:b.products,productImageFallback:Y,onProductSelect:x.selectProduct,onProductAddToCart:S?x.addProductToCart:void 0,onProductFocusChange:x.setFocused,formatType:b.activeFormatType,dateView:b.dateView,selectedDateIso:Ee.selectedIso,selectedDateRange:Ee.selectedRange,dateRangeStart:Ee.rangeStart,dateReferences:Ee.references,onPreviousMonth:x.showPreviousMonth,onNextMonth:x.showNextMonth,timeView:b.timeView,multiSelectView:b.dropdownMultiSelect,onMultiSelectCommit:x.commitMultiSelect,onTimeChange:x.setTime,onTimeCommit:x.commitTime,locationView:b.locationView,isReediting:b.editingParam!=null,onLocationQuery:x.setLocationQuery,onLocationMove:x.moveLocationHighlight,onLocationCommit:x.commitLocation,onLocationFocusChange:x.setLocationFieldFocused,isFocused:b.isFocused||b.locationFieldFocused,optionsPosition:c??"below"}}}import{attachChipRemove as Go,cancelStartingHint as Ko,chipIdFromTap as qo,extractPlainText as Et,getCursorOffset as At,keepCaretOnChip as _o,plainTextLength as Vo,renderEditableContent as Uo,setCursorOffset as Rt,startingHintOptions as Qo}from"@magicx-eng/ai-autocomplete-vanilla";import{useCallback as fe,useEffect as ea,useLayoutEffect as Ma,useRef as aa}from"react";var xa;function Yo(){if(xa!==void 0)return xa;if(typeof document>"u")return!1;let e=document.createElement("div");return e.setAttribute("contenteditable","plaintext-only"),xa=e.contentEditable==="plaintext-only",xa}function Ot(e){let{segments:n,showChipIcons:a=!0,showChipImages:t=!0,showChipRemove:o=!1,removeParam:s,newParamId:r,editingParam:l,editingIdentified:f,editingAnchor:w,caretOffset:y,placeholderText:m,hintSuggestions:h,isFocused:c,isDropdownOpen:v,listboxId:I,activeDescendantId:q,autoFocus:D,handleTextChange:O,handleKeyDown:te,handleCaretAfterInput:T,handleCaretMove:z,startEditingParam:_,replaceEditingRange:F,setFocused:Y}=e,E=aa(null),X=aa(!1),G=aa(""),H=aa(""),j=aa(null),de=aa(0);j.current=y,ea(()=>{if(!D)return;let u=E.current;if(!u)return;document.activeElement===u?Y(!0):u.focus();let k=u.ownerDocument??document,P=k.getSelection(),A=P&&P.rangeCount>0&&u.contains(P.anchorNode);if(P&&!A){let L=k.createRange();L.selectNodeContents(u),L.collapse(!0),P.removeAllRanges(),P.addRange(L)}},[D,Y]),ea(()=>{let u=E.current;if(!u)return;let k=u.ownerDocument??document,P=()=>{let A=k.getSelection();if(!A||A.rangeCount===0||!A.anchorNode||!u.contains(A.anchorNode))return;let L=A.anchorNode,J=L.nodeType===Node.ELEMENT_NODE?L:L.parentElement,he=(A.isCollapsed?J?.closest("strong[data-param-id]"):null)?.dataset.paramId??null,Te=l?.id??f?.id??null;if(he&&he!==Te){_(he);return}performance.now()-de.current<50||z(At(u))};return k.addEventListener("selectionchange",P),()=>k.removeEventListener("selectionchange",P)},[l,f,_,z]),ea(()=>{let u=E.current;if(!u)return;let k=P=>{let A=qo(u,P.target);A&&(_(A),_o(u,A))};return u.addEventListener("click",k),()=>u.removeEventListener("click",k)},[_]),ea(()=>{let u=E.current;if(!(!u||!s||!o))return Go(u,s)},[s,o]),Ma(()=>{let u=E.current;u&&Uo({input:u,segments:n,newParamId:r,editingParamId:l?.id??null,placeholderText:m??"",isFocused:c,showChipIcons:a,showChipImages:t,showChipRemove:o,hintOptions:Qo(h??[])})},[n,r,l,m,h,c,a,t,o]),ea(()=>{let u=E.current;return()=>{u&&Ko(u)}},[]),Ma(()=>{let u=G.current,k=r??"";if(G.current=k,!k||k===u)return;let P=E.current;if(!P)return;P.focus();let A=j.current??Vo(P);Rt(P,A)},[r]),Ma(()=>{let u=H.current,k=l?.id??"";if(H.current=k,!k||k===u||w==null)return;let P=E.current;P&&Rt(P,w)},[l,w]);let C=fe(()=>{if(X.current)return;let u=E.current;if(!u)return;let k=Et(u),A=k.length>0&&k[0]!==k[0].toUpperCase()?k[0].toUpperCase()+k.slice(1):k;O(A)},[O]),B=fe(()=>{de.current=performance.now(),C();let u=E.current;u&&T(At(u))},[C,T]);ea(()=>{let u=E.current;if(!u)return;let k=P=>{let A=P,L=A.inputType;if(L==="insertParagraph"||L==="insertLineBreak"||L==="insertFromDrop"){P.preventDefault();return}if(L.startsWith("insert")||L.startsWith("delete")){let J=L.startsWith("delete")?"":A.data??"";F(J)&&P.preventDefault()}};return u.addEventListener("beforeinput",k),()=>u.removeEventListener("beforeinput",k)},[F]);let d=fe(()=>{X.current=!0,E.current?.setAttribute("data-aia-composing","true")},[]),S=fe(()=>{X.current=!1,E.current?.removeAttribute("data-aia-composing"),C()},[C]),Fe=fe(u=>{u.preventDefault();let k=E.current;if(!k)return;let P=(u.clipboardData.getData("text/plain")??"").replace(/\r?\n/g," ");if(!P)return;let A=k.ownerDocument??document,L=A.getSelection();if(!L||L.rangeCount===0)return;let J=L.getRangeAt(0);if(!k.contains(J.startContainer))return;J.deleteContents();let ne=A.createTextNode(P);J.insertNode(ne),J.setStartAfter(ne),J.collapse(!0),L.removeAllRanges(),L.addRange(J),C()},[C]),ke=fe(u=>te(u),[te]),g=fe(()=>Y(!0),[Y]),He=fe(()=>Y(!1),[Y]),Ce=fe(()=>E.current?.focus(),[]),Re=fe(()=>E.current?.blur(),[]),Oe=fe(()=>{let u=E.current;return u?Et(u):""},[]),Se=Yo()?"plaintext-only":"true";return{inputRef:E,editorProps:{ref:E,contentEditable:Se,suppressContentEditableWarning:!0,tabIndex:0,role:"combobox","aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":I,"aria-expanded":v,"aria-activedescendant":q,spellCheck:!0,enterKeyHint:"send",onInput:B,onKeyDown:ke,onCompositionStart:d,onCompositionEnd:S,onPaste:Fe,onFocus:g,onBlur:He},getPlainText:Oe,focus:Ce,blur:Re}}import{jsx as ia,jsxs as Fa}from"react/jsx-runtime";function on(e){return e!=="auto"?e:typeof window>"u"||window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}var nn=jo(function({onSubmit:n,onResult:a,onError:t,optionOverrides:o,maskCompletedText:s,className:r,apiConfig:l,additionalContext:f,language:w,currency:y,productId:m,visitorId:h,columns:c,pillPlacement:v="dropdown",mode:I="auto",optionsPosition:q="below",animations:D=!0,optionsStyle:O="floating",dropdownTrigger:te,closeDropdownOnBlur:T,prependPlaceholder:z,allOption:_,showNonTappableOptions:F,locationSearch:Y,showOptionIcons:E=!0,showChipIcons:X=!0,showChipImages:G=!0,showChipRemove:H=!1,showOptionImages:j=!0,showOptionCounts:de=!0,showSkipButton:C,showProducts:B,productsLayout:d,productImageFallback:S,autoFocus:Fe=!0,onFocus:ke,onBlur:g,value:He,completedParams:Ce,onChange:Re,onParamsChange:Oe,products:Se,mapProducts:u,onProductSelect:k,onProductAddToCart:P,submitButton:A,resetOnSubmit:L=!0,seeAllResults:J=!1},ne){let he=ta(null),Te=ta(null),Le=ta(null),oe=ta(()=>{}),ue=ta(null),ze=ta(null);Na(()=>{let N=he.current;if(N)return ue.current?ue.current.setMode(I):ue.current=new Jo(N,I),()=>{ue.current?.destroy(),ue.current=null}},[I]);let Be=ya(N=>{let se=ze.current?.current;se&&(se.focus(),en(se,N))},[]),{completedParams:oa,suggestionPills:be,setActivePill:Qe,skipActivePill:ie,segments:x,newParamId:De,clearNewParamId:i,placeholderText:V,isFocused:b,isDropdownOpen:we,isActivePillSelected:na,isLoading:re,isReady:We,activeIndex:Ge,listboxId:Pe,handleTextChange:Ye,handleKeyDown:Ie,setFocused:ve,editingParam:Me,editingIdentified:Ke,editingAnchor:je,caretOffset:Ee,startEditingParam:qe,removeParam:p,handleCaretAfterInput:W,handleCaretMove:M,replaceEditingRange:R,dropdownProps:Ha,reset:ua,refreshProducts:Ba,prepareSubmit:Wa,getState:Ga,recordSubmit:Ka}=Da({onSubmit:N=>oe.current(N),onResult:a,onError:t,optionOverrides:o,maskCompletedText:s,apiConfig:l,additionalContext:f,language:w,currency:y,productId:m,visitorId:h,columns:c,dropdownTrigger:te,optionsPosition:q,closeDropdownOnBlur:T,prependPlaceholder:z,allOption:_,showNonTappableOptions:F,locationSearch:Y,showOptionIcons:E,showOptionImages:j,showOptionCounts:de,showSkipButton:C,showProducts:B,onFocus:ke,onBlur:g,value:He,completedParams:Ce,onChange:Re,onParamsChange:Oe,products:Se,mapProducts:u,onProductSelect:k,onProductAddToCart:P,source:"full-sdk",setCursor:Be});Na(()=>{if(!De)return;let N=window.setTimeout(()=>i(),650);return()=>window.clearTimeout(N)},[De,i]);let Lt=Ge>=0?`${Pe}-option-${Ge}`:void 0,{inputRef:ka,editorProps:zt,focus:ma,blur:qa,getPlainText:_a}=Ot({segments:x,newParamId:De,editingParam:Me,editingIdentified:Ke,editingAnchor:je,caretOffset:Ee,placeholderText:V,hintSuggestions:v==="inline"?[]:be,isFocused:b,showChipIcons:X,showChipImages:G,showChipRemove:H,removeParam:p,isDropdownOpen:we,listboxId:Pe,activeDescendantId:Lt,autoFocus:Fe,handleTextChange:Ye,handleKeyDown:Ie,handleCaretAfterInput:W,handleCaretMove:M,startEditingParam:qe,replaceEditingRange:R,setFocused:ve});ze.current=ka,Zo(()=>{let N=Te.current,se=ka.current;if(!N||!se)return;let sa=()=>{let Ua=N.firstElementChild;if(!Ua)return;let Bt=Ua.getBoundingClientRect(),Wt=se.getBoundingClientRect();Bt.top>=Wt.bottom-2?N.setAttribute("data-aia-pill-wrapped",""):N.removeAttribute("data-aia-pill-wrapped")};sa();let Va=new ResizeObserver(sa);return Va.observe(se),()=>Va.disconnect()},[x,be.length,re,ka]),Na(()=>{let N=Le.current;if(N)return tn(N)},[]),$o(ne,()=>({focus:ma,blur:qa,reset:ua,refreshProducts:Ba,setMode:N=>ue.current?.setMode(N),skipActivePill:ie}),[ma,qa,ua,Ba,ie]);let $e=!!x.length||oa.length>0,ra=ya(N=>{if(!$e)return;N&&Wa();let se=Ga(),sa=Xo(_a(),se.completedParams,se.skippedParams,{identifiedParams:se.identifiedParams,isReady:se.isReady,customFields:se.customFields});N&&Ka(sa),n(sa),L&&ua()},[Ka,L,$e,Wa,Ga,n,ua,_a]);oe.current=()=>ra(!1);let Dt=J&&!Ha.isInputEmpty&&$e,Mt=ya(()=>ra(!0),[ra]),Nt=ya(N=>{N.target?.closest("[data-aia-pill]")||document.activeElement?.closest("[data-aia-location]")||ma()},[ma]),Ft=v==="inline",Ht=v==="dropdown";return Fa("div",{ref:he,className:`magicx-aia ${_e.container} ${r??""}`,"data-pill-placement":v,"data-options-position":q,"data-animations":D?"on":"off","data-aia-options-style":O,"data-mode":on(I),children:[ia(La,{...Ha,showPills:Ht,productsLayout:d,productImageFallback:S,onSeeAllResults:Dt?Mt:void 0}),Fa("div",{className:_e.inputWrapper,"data-aia-input-wrapper":"",onClick:Nt,children:[Fa("div",{ref:Le,className:_e.editorArea,"data-aia-editor":"",children:[ia("div",{...zt,className:_e.input,"data-aia-input":""}),Ft&&(re||be.length>0)&&ia("span",{ref:Te,className:_e.pillListContainer,"data-aia-pill-list-container":"",children:ia(fa,{pills:be,activePillIndex:0,activeSelected:na,onSelectPill:Qe,loading:re})})]}),A===null?null:A===void 0?ia(yt,{disabled:!$e,ready:$e&&We,onClick:()=>ra(!0),label:an(w).submit}):ia("span",{"data-aia-submit":"","data-aia-submit-slot":"",className:_e.submitSlot,onClick:N=>{$e&&(N.stopPropagation(),ra(!0))},children:A})]})]})});export{nn as AIAutocomplete,La as AIAutocompleteDropdown,ms as DATE_RANGE_META_END,gs as DATE_RANGE_META_START,fs as DEFAULT_OPTION_COUNT_UNIT,Ss as LOCATION_META_KEY,Ls as PRODUCT_PATH_PREFIX,Ks as TIME_META_KEY,_s as WEEKDAY_LABELS,ps as buildSubmitResult,hs as cellDay,us as cellIso,bs as dateCellMarks,ws as formatDate,vs as formatDateRange,xs as formatOptionCount,ys as formatPlace,ks as formatTime,Cs as isoDate,Ts as monthLabel,Ps as optionCountLabel,Is as optionHasImage,Es as optionImageSources,As as optionImageSrc,Rs as optionLabel,Os as optionsShowLeadingVisuals,zs as parseDate,Ds as parseLooseDate,Ms as parseLooseDateRange,Ns as parseTime,Fs as productFromMatchedItem,Hs as productImageSources,Bs as productsFromCustomFields,Ws as sanitizeOptionIconSvg,Gs as selectedRangeFor,Da as useAIAutocomplete,qs as visibleDateRange,Vs as withSkippedParams};
|
|
3778
|
+
`,document.head.appendChild(e)}var xt={submitButton:"aia-submitButton-otz7H"};import{jsx as Da}from"react/jsx-runtime";function yt({disabled:e,ready:n,onClick:a,label:t=zo().submit}){return Da("button",{type:"button","data-aia-submit":"",className:xt.submitButton,disabled:e,"data-aia-ready":n?"":void 0,onClick:o=>{o.stopPropagation(),a()},"aria-label":t,children:Da("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",role:"img","aria-label":t,children:Da("path",{d:"M9 14V4M9 4L4 9M9 4L14 9",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})}import{AIAutocomplete as Do,dateSelectionFor as Mo,editingSuggestion as No,identifiedParamLabel as Fo,withoutTraditionalAutocomplete as Ho}from"@magicx-eng/ai-autocomplete-vanilla";import{useCallback as Pt,useEffect as ea,useMemo as Bo,useRef as ae,useState as Wo}from"react";import{useRef as kt}from"react";function Ct(e){let n=kt(e);n.current=e;let a=Object.keys(e??{}).sort().join("\0"),t=kt({key:"",overrides:void 0});if(t.current.key!==a){let o={};for(let s of Object.keys(e??{})){let r=(l,w,v)=>{let y=n.current?.[s];return y?y(l,w,v):[]};o[s]=r}t.current={key:a,overrides:e?o:void 0}}return{overrides:t.current.overrides,key:a}}import{useRef as St}from"react";function Tt(e){let n=St(e);n.current=e;let a=St(null);a.current===null&&(a.current={fetch:(o,s)=>{let r=n.current;return r?r.fetch(o,s):Promise.reject(new Error("products config removed"))},transform:o=>n.current?.transform(o)??[],get limit(){return n.current?.limit}});let t=e!==void 0;return{config:t?a.current:void 0,enabled:t}}var It={text:"",completedParams:[],identifiedParams:[],skippedParams:[],pendingSpan:null,suggestions:[],products:[],traditionalAutocomplete:!1,customFields:null,optionSearch:null,activeDropdownIndex:-1,newParamId:null,isLoading:!0,isReady:!1,error:null,segments:[],actionableSuggestions:[],filteredOptions:[],dropdownLoading:!0,dropdownOptions:[],skeletonOptions:null,skeletonSuggestion:null,skeletonPicked:null,dropdownSuggestion:null,skeletonRequested:!1,skeletonExiting:!1,activeFormatType:"options",dateView:null,dateRangeStart:null,dateReferences:[],dateFloor:null,timeView:null,multiSelectView:null,dropdownMultiSelect:null,multiSelectDraft:null,locationView:null,locationSearch:null,locationAutocomplete:!0,locationFieldFocused:!1,placeholderText:"",leadInText:"",optionQuery:"",isSearchingOptions:!1,isDropdownOpen:!1,isActivePillSelected:!1,filterBase:0,filterInProgress:!1,pillTapped:!1,skipNextFetch:!1,lastRawQuery:"",isFocused:!1,dropdownHeld:!1,editingParam:null,editingIdentified:null,editingAnchor:null,editingTail:null,caretOffset:null,inSelectionAnimation:!1,dateViewMonth:null,pendingRangeStart:null,timeDraft:null};function Ma({onSubmit:e,onResult:n,onError:a,optionOverrides:t,maskCompletedText:o,apiConfig:s,additionalContext:r,language:l,currency:w,productId:v,visitorId:y,columns:f=2,dropdownTrigger:h,optionsPosition:c,closeDropdownOnBlur:x,prependPlaceholder:I,allOption:q,showNonTappableOptions:D,locationSearch:O,showOptionIcons:te,showOptionImages:T,showOptionCounts:z,showSkipButton:_,showProducts:F,productImageFallback:Q="image",onFocus:E,onBlur:J,value:W,completedParams:H,onChange:Y,onParamsChange:re,products:C,mapProducts:B,onProductSelect:d,onProductAddToCart:S,source:He,setCursor:ve}){let b=ae(null),[Be,xe]=Wo(null),Re=ae(e);Re.current=e;let Oe=ae(n);Oe.current=n;let Le=ae(a);Le.current=a;let m=ae(Y);m.current=Y;let k=ae(re);k.current=re;let P=ae(E);P.current=E;let A=ae(J);A.current=J;let L=ae(ve);L.current=ve;let j=ae(d);j.current=d;let de=ae(S);de.current=S;let ie=ae(y);ie.current=y;let ze=ae(()=>{let p=ie.current;return typeof p=="function"?p():p}).current,ye=Tt(C),We=ae(B);We.current=B;let $=ae((p,G)=>{let M=We.current;return M?M(p,G):p}).current,ke=B?$:void 0,Ge=Ct(t);ea(()=>{if(typeof document>"u")return;let p=new Do(document.createElement("div"),{renderMode:"headless",apiConfig:s,additionalContext:r,language:l,currency:w,productId:v,visitorId:ze,optionOverrides:Ge.overrides,maskCompletedText:o,columns:f,dropdownTrigger:h,optionsPosition:c,closeDropdownOnBlur:x,prependPlaceholder:I,allOption:q,showNonTappableOptions:D,locationSearch:O,showProducts:F,source:He,value:W,completedParams:H,onSubmit:(...M)=>Re.current?.(...M),onResult:(...M)=>Oe.current?.(...M),onError:(...M)=>Le.current?.(...M),onChange:(...M)=>m.current?.(...M),onParamsChange:(...M)=>k.current?.(...M),onFocus:()=>P.current?.(),onBlur:()=>A.current?.(),onProductSelect:M=>j.current?.(M),onProductAddToCart:M=>de.current?.(M),setCursor:M=>L.current?.(M),products:ye.config,mapProducts:ke});b.current=p,xe(p.getState());let G=p.subscribe(M=>xe(M));return()=>{G(),p.destroy(),b.current===p&&(b.current=null)}},[]),ea(()=>{W!==void 0&&b.current?.setValue(W)},[W]),ea(()=>{H!==void 0&&b.current?.setCompletedParams(H)},[H]);let na=JSON.stringify(s??null),ue;try{ue=JSON.stringify(r??null)}catch{ue="[unstringifiable]"}ea(()=>{b.current?.update({apiConfig:s,additionalContext:r,language:l,currency:w,productId:v,optionOverrides:Ge.overrides,dropdownTrigger:h,optionsPosition:c,closeDropdownOnBlur:x,prependPlaceholder:I,allOption:q,showNonTappableOptions:D,locationSearch:O,showProducts:F})},[na,ue,l,w?.code,w?.rate,w?.country,v,Ge.key,h,c,x,I,q,D,O,F]);let Ye=ae(!1);ea(()=>{if(!Ye.current){Ye.current=!0;return}b.current?.update({products:ye.config})},[ye.enabled]),ea(()=>{b.current?.update({mapProducts:ke})},[ke]);let De=ae(null);De.current===null&&(De.current={handleTextChange:p=>b.current?.handleTextChange(p),handleKeyDown:p=>{let G="nativeEvent"in p?p.nativeEvent:p;b.current?.handleKeyDown(G)},setFocused:p=>b.current?.setFocused(p),startEditingParam:p=>b.current?.startEditingParam(p),removeParam:p=>b.current?.removeParam(p)??!1,exitEditMode:()=>b.current?.exitEditMode(),handleCaretAfterInput:p=>b.current?.handleCaretAfterInput(p),handleCaretMove:p=>b.current?.handleCaretMove(p),replaceEditingRange:p=>b.current?.replaceEditingRange(p)??!1,setActivePill:p=>b.current?.setActivePill(p),skipActivePill:()=>b.current?.skipActivePill(),removeLastParam:()=>b.current?.removeLastParam(),clearNewParamId:()=>b.current?.clearNewParamId(),reset:()=>b.current?.reset(),refreshProducts:()=>b.current?.refreshProducts(),prepareSubmit:()=>b.current?.prepareSubmit(),getState:()=>b.current?.getState()??It,recordSubmit:p=>b.current?.recordSubmit(p),selectOption:(p,G)=>b.current?.selectOption(p,G),selectProduct:p=>b.current?.selectProduct(p),addProductToCart:p=>{let G=b.current;return!G||!de.current?Promise.resolve():G.addProductToCart(p)},setActiveDropdownIndex:p=>b.current?.setActiveDropdownIndex(p),clearHighlight:p=>b.current?.clearHighlight(p),showPreviousMonth:()=>b.current?.showPreviousMonth(),showNextMonth:()=>b.current?.showNextMonth(),setTime:p=>b.current?.setTime(p),commitTime:()=>b.current?.commitTime(),toggleMultiSelectOption:p=>b.current?.toggleMultiSelectOption(p),commitMultiSelect:()=>b.current?.commitMultiSelect(),setLocationQuery:p=>b.current?.setLocationQuery(p),moveLocationHighlight:p=>b.current?.moveLocationHighlight(p),commitLocation:p=>b.current?.commitLocation(p),setLocationFieldFocused:p=>b.current?.setLocationFieldFocused(p),handleFocus:()=>b.current?.setFocused(!0),handleBlur:()=>b.current?.setFocused(!1)});let g=De.current,Ce=Pt(p=>{let G=p.target.value,$e=G.length>0&&!p.nativeEvent?.isComposing&&G[0]!==G[0].toUpperCase()?G[0].toUpperCase()+G.slice(1):G;b.current?.handleTextChange($e)},[]),Ke=Pt(p=>{b.current?.handleKeyDown(p.nativeEvent)},[]),i=b.current,u=Be??It,Se=W!==void 0?W:u.text,Te=H!==void 0?H:u.completedParams,me=u.actionableSuggestions,Pe=me[0],Me=Bo(()=>Ho(me),[me]),ge=i?.listboxId??"",ra=u.activeDropdownIndex>=0&&i?`${ge}-option-${u.activeDropdownIndex}`:void 0,Ie=u.editingParam,fe=u.editingIdentified,Ne=Ie?No(Ie):fe?{parameter:fe.parameter,text:Fo(fe.parameter),required:!0,options:[]}:null,qe=u.dropdownSuggestion??Ne??Pe,je=Ne?[Ne]:me,Ee=Mo(u),_e=!i||u.dropdownLoading;return{completedParams:Te,multiSelectView:u.multiSelectView,toggleMultiSelectOption:g.toggleMultiSelectOption,commitMultiSelect:g.commitMultiSelect,skippedParams:u.skippedParams,identifiedParams:u.identifiedParams,suggestionPills:Me,setActivePill:g.setActivePill,skipActivePill:g.skipActivePill,removeLastParam:g.removeLastParam,segments:u.segments,newParamId:u.newParamId,clearNewParamId:g.clearNewParamId,suggestions:u.suggestions,activeIndex:u.activeDropdownIndex,isReady:u.isReady,isLoading:_e,isFocused:u.isFocused,isDropdownOpen:u.isDropdownOpen,isActivePillSelected:u.isActivePillSelected,placeholderText:u.placeholderText,listboxId:ge,error:u.error,products:u.products,customFields:u.customFields,selectProduct:g.selectProduct,addProductToCart:g.addProductToCart,handleTextChange:g.handleTextChange,handleKeyDown:g.handleKeyDown,setFocused:g.setFocused,editingParam:Ie,editingIdentified:fe,editingAnchor:u.editingAnchor,caretOffset:u.caretOffset,startEditingParam:g.startEditingParam,removeParam:g.removeParam,exitEditMode:g.exitEditMode,handleCaretAfterInput:g.handleCaretAfterInput,handleCaretMove:g.handleCaretMove,replaceEditingRange:g.replaceEditingRange,inputProps:{value:Se,placeholder:u.placeholderText||void 0,onChange:Ce,onKeyDown:Ke,onFocus:g.handleFocus,onBlur:g.handleBlur,role:"combobox","aria-expanded":u.isDropdownOpen,"aria-activedescendant":ra,"aria-autocomplete":"list","aria-controls":ge},reset:g.reset,refreshProducts:g.refreshProducts,prepareSubmit:g.prepareSubmit,getState:g.getState,recordSubmit:g.recordSubmit,dropdownProps:{suggestions:qe?[{...qe,options:u.dropdownOptions}]:[],activeIndex:u.activeDropdownIndex,onSelect:g.selectOption,onHighlight:g.setActiveDropdownIndex,onUnhighlight:g.clearHighlight,isOpen:u.isDropdownOpen,id:ge,pills:je,activeSelected:u.isActivePillSelected,onPillClick:g.setActivePill,onSkip:g.skipActivePill,showSkipButton:(_??!0)&&!Ie&&!fe,showOptionIcons:te??!0,showOptionImages:T??!0,showOptionCounts:z??!0,skipDisabled:u.inSelectionAnimation,isLoading:_e,skeletonExiting:u.skeletonExiting,isInputEmpty:Se.trim().length===0,language:l,products:u.products,productImageFallback:Q,onProductSelect:g.selectProduct,onProductAddToCart:S?g.addProductToCart:void 0,onProductFocusChange:g.setFocused,formatType:u.activeFormatType,dateView:u.dateView,selectedDateIso:Ee.selectedIso,selectedDateRange:Ee.selectedRange,dateRangeStart:Ee.rangeStart,dateReferences:Ee.references,onPreviousMonth:g.showPreviousMonth,onNextMonth:g.showNextMonth,timeView:u.timeView,multiSelectView:u.dropdownMultiSelect,onMultiSelectCommit:g.commitMultiSelect,onTimeChange:g.setTime,onTimeCommit:g.commitTime,locationView:u.locationView,isReediting:u.editingParam!=null,onLocationQuery:g.setLocationQuery,onLocationMove:g.moveLocationHighlight,onLocationCommit:g.commitLocation,onLocationFocusChange:g.setLocationFieldFocused,isFocused:u.isFocused||u.locationFieldFocused,optionsPosition:c??"below"}}}import{attachChipRemove as Go,cancelStartingHint as Ko,chipIdFromTap as qo,extractPlainText as Et,getCursorOffset as At,keepCaretOnChip as _o,plainTextLength as Vo,renderEditableContent as Uo,setCursorOffset as Rt,startingHintOptions as Qo}from"@magicx-eng/ai-autocomplete-vanilla";import{useCallback as he,useEffect as aa,useLayoutEffect as Na,useRef as ta}from"react";var ya;function Yo(){if(ya!==void 0)return ya;if(typeof document>"u")return!1;let e=document.createElement("div");return e.setAttribute("contenteditable","plaintext-only"),ya=e.contentEditable==="plaintext-only",ya}function Ot(e){let{segments:n,showChipIcons:a=!0,showChipImages:t=!0,showChipRemove:o=!1,removeParam:s,newParamId:r,editingParam:l,editingIdentified:w,editingAnchor:v,caretOffset:y,placeholderText:f,hintSuggestions:h,isFocused:c,isDropdownOpen:x,listboxId:I,activeDescendantId:q,autoFocus:D,handleTextChange:O,handleKeyDown:te,handleCaretAfterInput:T,handleCaretMove:z,startEditingParam:_,replaceEditingRange:F,setFocused:Q}=e,E=ta(null),J=ta(!1),W=ta(""),H=ta(""),Y=ta(null),re=ta(0);Y.current=y,aa(()=>{if(!D)return;let m=E.current;if(!m)return;document.activeElement===m?Q(!0):m.focus();let k=m.ownerDocument??document,P=k.getSelection(),A=P&&P.rangeCount>0&&m.contains(P.anchorNode);if(P&&!A){let L=k.createRange();L.selectNodeContents(m),L.collapse(!0),P.removeAllRanges(),P.addRange(L)}},[D,Q]),aa(()=>{let m=E.current;if(!m)return;let k=m.ownerDocument??document,P=()=>{let A=k.getSelection();if(!A||A.rangeCount===0||!A.anchorNode||!m.contains(A.anchorNode))return;let L=A.anchorNode,j=L.nodeType===Node.ELEMENT_NODE?L:L.parentElement,ie=(A.isCollapsed?j?.closest("strong[data-param-id]"):null)?.dataset.paramId??null,ze=l?.id??w?.id??null;if(ie&&ie!==ze){_(ie);return}performance.now()-re.current<50||z(At(m))};return k.addEventListener("selectionchange",P),()=>k.removeEventListener("selectionchange",P)},[l,w,_,z]),aa(()=>{let m=E.current;if(!m)return;let k=P=>{let A=qo(m,P.target);A&&(_(A),_o(m,A))};return m.addEventListener("click",k),()=>m.removeEventListener("click",k)},[_]),aa(()=>{let m=E.current;if(!(!m||!s||!o))return Go(m,s)},[s,o]),Na(()=>{let m=E.current;m&&Uo({input:m,segments:n,newParamId:r,editingParamId:l?.id??null,placeholderText:f??"",isFocused:c,showChipIcons:a,showChipImages:t,showChipRemove:o,hintOptions:Qo(h??[])})},[n,r,l,f,h,c,a,t,o]),aa(()=>{let m=E.current;return()=>{m&&Ko(m)}},[]),Na(()=>{let m=W.current,k=r??"";if(W.current=k,!k||k===m)return;let P=E.current;if(!P)return;P.focus();let A=Y.current??Vo(P);Rt(P,A)},[r]),Na(()=>{let m=H.current,k=l?.id??"";if(H.current=k,!k||k===m||v==null)return;let P=E.current;P&&Rt(P,v)},[l,v]);let C=he(()=>{if(J.current)return;let m=E.current;if(!m)return;let k=Et(m),A=k.length>0&&k[0]!==k[0].toUpperCase()?k[0].toUpperCase()+k.slice(1):k;O(A)},[O]),B=he(()=>{re.current=performance.now(),C();let m=E.current;m&&T(At(m))},[C,T]);aa(()=>{let m=E.current;if(!m)return;let k=P=>{let A=P,L=A.inputType;if(L==="insertParagraph"||L==="insertLineBreak"||L==="insertFromDrop"){P.preventDefault();return}if(L.startsWith("insert")||L.startsWith("delete")){let j=L.startsWith("delete")?"":A.data??"";F(j)&&P.preventDefault()}};return m.addEventListener("beforeinput",k),()=>m.removeEventListener("beforeinput",k)},[F]);let d=he(()=>{J.current=!0,E.current?.setAttribute("data-aia-composing","true")},[]),S=he(()=>{J.current=!1,E.current?.removeAttribute("data-aia-composing"),C()},[C]),He=he(m=>{m.preventDefault();let k=E.current;if(!k)return;let P=(m.clipboardData.getData("text/plain")??"").replace(/\r?\n/g," ");if(!P)return;let A=k.ownerDocument??document,L=A.getSelection();if(!L||L.rangeCount===0)return;let j=L.getRangeAt(0);if(!k.contains(j.startContainer))return;j.deleteContents();let de=A.createTextNode(P);j.insertNode(de),j.setStartAfter(de),j.collapse(!0),L.removeAllRanges(),L.addRange(j),C()},[C]),ve=he(m=>te(m),[te]),b=he(()=>Q(!0),[Q]),Be=he(()=>Q(!1),[Q]),xe=he(()=>E.current?.focus(),[]),Re=he(()=>E.current?.blur(),[]),Oe=he(()=>{let m=E.current;return m?Et(m):""},[]),Le=Yo()?"plaintext-only":"true";return{inputRef:E,editorProps:{ref:E,contentEditable:Le,suppressContentEditableWarning:!0,tabIndex:0,role:"combobox","aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":I,"aria-expanded":x,"aria-activedescendant":q,spellCheck:!0,enterKeyHint:"send",onInput:B,onKeyDown:ve,onCompositionStart:d,onCompositionEnd:S,onPaste:He,onFocus:b,onBlur:Be},getPlainText:Oe,focus:xe,blur:Re}}import{jsx as oa,jsxs as Ha}from"react/jsx-runtime";function on(e){return e!=="auto"?e:typeof window>"u"||window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}var nn=jo(function({onSubmit:n,onResult:a,onError:t,optionOverrides:o,maskCompletedText:s,className:r,apiConfig:l,additionalContext:w,language:v,currency:y,productId:f,visitorId:h,columns:c,pillPlacement:x="dropdown",mode:I="auto",optionsPosition:q="below",animations:D=!0,optionsStyle:O="floating",dropdownTrigger:te,closeDropdownOnBlur:T,prependPlaceholder:z,allOption:_,showNonTappableOptions:F,locationSearch:Q,showOptionIcons:E=!0,showChipIcons:J=!0,showChipImages:W=!0,showChipRemove:H=!1,showOptionImages:Y=!0,showOptionCounts:re=!0,showSkipButton:C,showProducts:B,productsLayout:d,productImageFallback:S,autoFocus:He=!0,onFocus:ve,onBlur:b,value:Be,completedParams:xe,onChange:Re,onParamsChange:Oe,products:Le,mapProducts:m,onProductSelect:k,onProductAddToCart:P,submitButton:A,resetOnSubmit:L=!0,seeAllResults:j=!1},de){let ie=ia(null),ze=ia(null),ye=ia(null),We=ia(()=>{}),$=ia(null),ke=ia(null);Fa(()=>{let N=ie.current;if(N)return $.current?$.current.setMode(I):$.current=new Jo(N,I),()=>{$.current?.destroy(),$.current=null}},[I]);let Ge=ka(N=>{let oe=ke.current?.current;oe&&(oe.focus(),en(oe,N))},[]),{completedParams:na,suggestionPills:ue,setActivePill:Ye,skipActivePill:De,segments:g,newParamId:Ce,clearNewParamId:Ke,placeholderText:i,isFocused:u,isDropdownOpen:Se,isActivePillSelected:Te,isLoading:me,isReady:Pe,activeIndex:Me,listboxId:ge,handleTextChange:ra,handleKeyDown:Ie,setFocused:fe,editingParam:Ne,editingIdentified:qe,editingAnchor:je,caretOffset:Ee,startEditingParam:_e,removeParam:p,handleCaretAfterInput:G,handleCaretMove:M,replaceEditingRange:$e,dropdownProps:R,reset:ma,refreshProducts:Ba,prepareSubmit:Wa,getState:Ga,recordSubmit:Ka}=Ma({onSubmit:N=>We.current(N),onResult:a,onError:t,optionOverrides:o,maskCompletedText:s,apiConfig:l,additionalContext:w,language:v,currency:y,productId:f,visitorId:h,columns:c,dropdownTrigger:te,optionsPosition:q,closeDropdownOnBlur:T,prependPlaceholder:z,allOption:_,showNonTappableOptions:F,locationSearch:Q,showOptionIcons:E,showOptionImages:Y,showOptionCounts:re,showSkipButton:C,showProducts:B,onFocus:ve,onBlur:b,value:Be,completedParams:xe,onChange:Re,onParamsChange:Oe,products:Le,mapProducts:m,onProductSelect:k,onProductAddToCart:P,source:"full-sdk",setCursor:Ge});Fa(()=>{if(!Ce)return;let N=window.setTimeout(()=>Ke(),650);return()=>window.clearTimeout(N)},[Ce,Ke]);let Lt=Me>=0?`${ge}-option-${Me}`:void 0,{inputRef:Ca,editorProps:zt,focus:ga,blur:qa,getPlainText:_a}=Ot({segments:g,newParamId:Ce,editingParam:Ne,editingIdentified:qe,editingAnchor:je,caretOffset:Ee,placeholderText:i,hintSuggestions:x==="inline"?[]:ue,isFocused:u,showChipIcons:J,showChipImages:W,showChipRemove:H,removeParam:p,isDropdownOpen:Se,listboxId:ge,activeDescendantId:Lt,autoFocus:He,handleTextChange:ra,handleKeyDown:Ie,handleCaretAfterInput:G,handleCaretMove:M,startEditingParam:_e,replaceEditingRange:$e,setFocused:fe});ke.current=Ca,Zo(()=>{let N=ze.current,oe=Ca.current;if(!N||!oe)return;let la=()=>{let Ua=N.firstElementChild;if(!Ua)return;let Bt=Ua.getBoundingClientRect(),Wt=oe.getBoundingClientRect();Bt.top>=Wt.bottom-2?N.setAttribute("data-aia-pill-wrapped",""):N.removeAttribute("data-aia-pill-wrapped")};la();let Va=new ResizeObserver(la);return Va.observe(oe),()=>Va.disconnect()},[g,ue.length,me,Ca]),Fa(()=>{let N=ye.current;if(N)return tn(N)},[]),$o(de,()=>({focus:ga,blur:qa,reset:ma,refreshProducts:Ba,setMode:N=>$.current?.setMode(N),skipActivePill:De}),[ga,qa,ma,Ba,De]);let Ze=!!g.length||na.length>0,sa=ka(N=>{if(!Ze)return;N&&Wa();let oe=Ga(),la=Xo(_a(),oe.completedParams,oe.skippedParams,{identifiedParams:oe.identifiedParams,isReady:oe.isReady,customFields:oe.customFields});N&&Ka(la),n(la),L&&ma()},[Ka,L,Ze,Wa,Ga,n,ma,_a]);We.current=()=>sa(!1);let Dt=j&&!R.isInputEmpty&&Ze,Mt=ka(()=>sa(!0),[sa]),Nt=ka(N=>{N.target?.closest("[data-aia-pill]")||document.activeElement?.closest("[data-aia-location]")||ga()},[ga]),Ft=x==="inline",Ht=x==="dropdown";return Ha("div",{ref:ie,className:`magicx-aia ${Ve.container} ${r??""}`,"data-pill-placement":x,"data-options-position":q,"data-animations":D?"on":"off","data-aia-options-style":O,"data-mode":on(I),children:[oa(za,{...R,showPills:Ht,productsLayout:d,productImageFallback:S,onSeeAllResults:Dt?Mt:void 0,fullWidth:j}),Ha("div",{className:Ve.inputWrapper,"data-aia-input-wrapper":"",onClick:Nt,children:[Ha("div",{ref:ye,className:Ve.editorArea,"data-aia-editor":"",children:[oa("div",{...zt,className:Ve.input,"data-aia-input":""}),Ft&&(me||ue.length>0)&&oa("span",{ref:ze,className:Ve.pillListContainer,"data-aia-pill-list-container":"",children:oa(ba,{pills:ue,activePillIndex:0,activeSelected:Te,onSelectPill:Ye,loading:me})})]}),A===null?null:A===void 0?oa(yt,{disabled:!Ze,ready:Ze&&Pe,onClick:()=>sa(!0),label:an(v).submit}):oa("span",{"data-aia-submit":"","data-aia-submit-slot":"",className:Ve.submitSlot,onClick:N=>{Ze&&(N.stopPropagation(),sa(!0))},children:A})]})]})});export{nn as AIAutocomplete,za as AIAutocompleteDropdown,ms as DATE_RANGE_META_END,gs as DATE_RANGE_META_START,fs as DEFAULT_OPTION_COUNT_UNIT,Ss as LOCATION_META_KEY,Ls as PRODUCT_PATH_PREFIX,Ks as TIME_META_KEY,_s as WEEKDAY_LABELS,ps as buildSubmitResult,hs as cellDay,us as cellIso,bs as dateCellMarks,ws as formatDate,vs as formatDateRange,xs as formatOptionCount,ys as formatPlace,ks as formatTime,Cs as isoDate,Ts as monthLabel,Ps as optionCountLabel,Is as optionHasImage,Es as optionImageSources,As as optionImageSrc,Rs as optionLabel,Os as optionsShowLeadingVisuals,zs as parseDate,Ds as parseLooseDate,Ms as parseLooseDateRange,Ns as parseTime,Fs as productFromMatchedItem,Hs as productImageSources,Bs as productsFromCustomFields,Ws as sanitizeOptionIconSvg,Gs as selectedRangeFor,Ma as useAIAutocomplete,qs as visibleDateRange,Vs as withSkippedParams};
|
|
3779
3779
|
//# sourceMappingURL=index.mjs.map
|