@magicx-eng/ai-autocomplete-react 0.17.0 → 0.17.2
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.js +26 -41
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +26 -41
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -679,7 +679,7 @@ Override on the container (via `className`). All defaults use `:where()` (zero s
|
|
|
679
679
|
| `--aia-product-bg` | `transparent` | `transparent` | Product card background. |
|
|
680
680
|
| `--aia-product-bg-active` | `--aia-option-bg` | `--aia-option-bg` | Product card background on hover. |
|
|
681
681
|
| `--aia-product-media-bg` | `--aia-skeleton-bg` | `--aia-skeleton-bg` | Fill behind the product image, and of the placeholder tile when a product has no image. |
|
|
682
|
-
| `--aia-scroll-arrow-bg` | `--aia-surface` | `--aia-surface` | Fill of the "more below" arrow — the round button that
|
|
682
|
+
| `--aia-scroll-arrow-bg` | `--aia-surface` | `--aia-surface` | Fill of the "more below" arrow — the round button that fades in at the bottom of the option list while there is more to scroll to, and out while it scrolls. |
|
|
683
683
|
| `--aia-scroll-arrow-color` | `--aia-option-color` | `--aia-option-color` | Chevron color of the arrow (`--aia-scroll-arrow-color-hover` on hover). |
|
|
684
684
|
| `--aia-scroll-arrow-border` | `--aia-dropdown-border` | `--aia-dropdown-border` | Hairline around the arrow. |
|
|
685
685
|
| `--aia-scroll-arrow-shadow` | `0 2px 8px rgba(0,0,0,0.12)` | `0 2px 8px rgba(0,0,0,0.12)` | Elevation of the arrow. |
|
package/dist/index.js
CHANGED
|
@@ -193,7 +193,7 @@
|
|
|
193
193
|
opacity: 0;
|
|
194
194
|
}
|
|
195
195
|
}
|
|
196
|
-
`,document.head.appendChild(e)}var ke={container:"AIAutocomplete-module_container_KKjFU",inputWrapper:"AIAutocomplete-module_inputWrapper_FLq1b",editorArea:"AIAutocomplete-module_editorArea_7rBWq",input:"AIAutocomplete-module_input_IW-P-",pillListContainer:"AIAutocomplete-module_pillListContainer_h92IA",submitSlot:"AIAutocomplete-module_submitSlot_GhuCM",aiaPillReveal:"AIAutocomplete-module_aiaPillReveal_wf05b"};var Ce=require("@magicx-eng/ai-autocomplete-vanilla"),
|
|
196
|
+
`,document.head.appendChild(e)}var ke={container:"AIAutocomplete-module_container_KKjFU",inputWrapper:"AIAutocomplete-module_inputWrapper_FLq1b",editorArea:"AIAutocomplete-module_editorArea_7rBWq",input:"AIAutocomplete-module_input_IW-P-",pillListContainer:"AIAutocomplete-module_pillListContainer_h92IA",submitSlot:"AIAutocomplete-module_submitSlot_GhuCM",aiaPillReveal:"AIAutocomplete-module_aiaPillReveal_wf05b"};var Ce=require("@magicx-eng/ai-autocomplete-vanilla"),Y=require("react");if(typeof document<"u"&&!document.getElementById("ac-style-0ae03977")){let e=document.createElement("style");e.id="ac-style-0ae03977",e.textContent=`/*
|
|
197
197
|
* Built-in appearance defaults \u2014 zero specificity via :where().
|
|
198
198
|
* Consumer CSS always wins without !important.
|
|
199
199
|
*
|
|
@@ -616,22 +616,24 @@
|
|
|
616
616
|
transform 320ms cubic-bezier(0.22, 1.28, 0.36, 1);
|
|
617
617
|
}
|
|
618
618
|
|
|
619
|
-
/* "More below" scroll arrow \u2014 see the core's render/scrollArrow.ts.
|
|
620
|
-
disc at the bottom-centre of the option list, shown while
|
|
621
|
-
scroll
|
|
622
|
-
(--aia-scroll-arrow-bottom is measured and set inline by the controller so
|
|
623
|
-
tracks the grid's bottom edge in every layout).
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
mirror vanilla's .magicx-aia-scroll-arrow
|
|
629
|
-
three in the same commit. */
|
|
619
|
+
/* "More below" scroll arrow \u2014 see the core's render/scrollArrow.ts.
|
|
620
|
+
A round disc at the bottom-centre of the option list, shown while there is
|
|
621
|
+
more to scroll to. It rests just above the grid's reserved band
|
|
622
|
+
(--aia-scroll-arrow-bottom is measured and set inline by the controller so
|
|
623
|
+
it tracks the grid's bottom edge in every layout). It never moves: the
|
|
624
|
+
controller toggles data-aia-visible and the only thing that transitions is
|
|
625
|
+
opacity \u2014 a slow, even second in and the same second out. Any travel read as
|
|
626
|
+
the disc sliding with the scroll (2026-09-04). z-index 4 puts it over the
|
|
627
|
+
option rows and the footer (z-index 3), whose opaque fade plate would
|
|
628
|
+
otherwise bury it. Declarations mirror vanilla's .magicx-aia-scroll-arrow
|
|
629
|
+
and Angular's copy \u2014 change all three in the same commit. */
|
|
630
630
|
.AIAutocompleteDropdown-module_scrollArrow_uUzV0 {
|
|
631
631
|
position: absolute;
|
|
632
632
|
left: 50%;
|
|
633
633
|
bottom: var(--aia-scroll-arrow-bottom, 8px);
|
|
634
|
-
z-index:
|
|
634
|
+
/* Above the footer (z-index 3): its fade plate is opaque on desktop and
|
|
635
|
+
would otherwise bury the disc, which sits half over it by design. */
|
|
636
|
+
z-index: 4;
|
|
635
637
|
display: inline-flex;
|
|
636
638
|
align-items: center;
|
|
637
639
|
justify-content: center;
|
|
@@ -650,32 +652,16 @@
|
|
|
650
652
|
box-shadow: var(--aia-scroll-arrow-shadow, 0 2px 8px rgba(0, 0, 0, 0.12));
|
|
651
653
|
cursor: pointer;
|
|
652
654
|
pointer-events: none;
|
|
653
|
-
/*
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
in on the way up. */
|
|
655
|
+
/* Hidden: transparent, in place. Only opacity ever transitions, so the disc
|
|
656
|
+
cannot travel. One second each way \u2014 SCROLL_ARROW_FADE_MS in
|
|
657
|
+
scrollArrow.ts documents this number; change both together. */
|
|
657
658
|
opacity: 0;
|
|
658
|
-
|
|
659
|
-
transition: transform 180ms cubic-bezier(0.4, 0, 0.2, 1);
|
|
659
|
+
transition: opacity 1000ms cubic-bezier(0.4, 0, 0.2, 1);
|
|
660
660
|
}
|
|
661
661
|
|
|
662
662
|
.AIAutocompleteDropdown-module_scrollArrow_uUzV0[data-aia-visible] {
|
|
663
663
|
pointer-events: auto;
|
|
664
664
|
opacity: 1;
|
|
665
|
-
transform: translateY(0);
|
|
666
|
-
}
|
|
667
|
-
|
|
668
|
-
/* Leaving: dissolve where it stands \u2014 no travel. Ease-out so most of the fade
|
|
669
|
-
happens at once and the last of it lingers; the shrink keeps it from reading
|
|
670
|
-
as a flat cut. The controller holds this attribute for SCROLL_ARROW_LEAVE_MS
|
|
671
|
-
(scrollArrow.ts) \u2014 keep the two durations equal. */
|
|
672
|
-
.AIAutocompleteDropdown-module_scrollArrow_uUzV0[data-aia-leaving] {
|
|
673
|
-
pointer-events: none;
|
|
674
|
-
opacity: 0;
|
|
675
|
-
transform: translateY(0) scale(0.86);
|
|
676
|
-
transition:
|
|
677
|
-
opacity 240ms cubic-bezier(0.22, 0.61, 0.36, 1),
|
|
678
|
-
transform 240ms cubic-bezier(0.22, 0.61, 0.36, 1);
|
|
679
665
|
}
|
|
680
666
|
|
|
681
667
|
.AIAutocompleteDropdown-module_scrollArrow_uUzV0:hover {
|
|
@@ -687,7 +673,6 @@
|
|
|
687
673
|
|
|
688
674
|
@media (prefers-reduced-motion: reduce) {
|
|
689
675
|
.AIAutocompleteDropdown-module_scrollArrow_uUzV0,
|
|
690
|
-
.AIAutocompleteDropdown-module_scrollArrow_uUzV0[data-aia-leaving],
|
|
691
676
|
.AIAutocompleteDropdown-module_dropdown_yz2KC {
|
|
692
677
|
transition-duration: 0s;
|
|
693
678
|
}
|
|
@@ -801,7 +786,7 @@
|
|
|
801
786
|
opacity: 0.25;
|
|
802
787
|
}
|
|
803
788
|
}
|
|
804
|
-
`,document.head.appendChild(e)}var
|
|
789
|
+
`,document.head.appendChild(e)}var me={dropdown:"AIAutocompleteDropdown-module_dropdown_yz2KC",visible:"AIAutocompleteDropdown-module_visible_QCoXj",scrollArrow:"AIAutocompleteDropdown-module_scrollArrow_uUzV0",pillBar:"AIAutocompleteDropdown-module_pillBar_pwTXe",pillScroll:"AIAutocompleteDropdown-module_pillScroll_Tpzus",skip:"AIAutocompleteDropdown-module_skip_7-olS",skeletonBars:"AIAutocompleteDropdown-module_skeletonBars_HVr9C",skeletonBar:"AIAutocompleteDropdown-module_skeletonBar_O3xIx",aiaSkeletonPulse:"AIAutocompleteDropdown-module_aiaSkeletonPulse_G8W7q"};var C=require("@magicx-eng/ai-autocomplete-vanilla"),ct=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) ---
|
|
805
790
|
|
|
806
791
|
One of three hand-maintained copies (vanilla styles.css, this file, Angular's
|
|
807
792
|
date-grid.component.css). Only the class-naming layer differs \u2014 the
|
|
@@ -1197,7 +1182,7 @@
|
|
|
1197
1182
|
opacity: 0;
|
|
1198
1183
|
}
|
|
1199
1184
|
}
|
|
1200
|
-
`,document.head.appendChild(e)}var _e={pill:"ParamPill-module_pill_6Ga7S",fadeIn:"ParamPill-module_fadeIn_Ux4eQ",rounded:"ParamPill-module_rounded_y7xA9",skeleton:"ParamPill-module_skeleton_57P0T",skeletonPulse:"ParamPill-module_skeletonPulse_xGcUy"};var
|
|
1185
|
+
`,document.head.appendChild(e)}var _e={pill:"ParamPill-module_pill_6Ga7S",fadeIn:"ParamPill-module_fadeIn_Ux4eQ",rounded:"ParamPill-module_rounded_y7xA9",skeleton:"ParamPill-module_skeleton_57P0T",skeletonPulse:"ParamPill-module_skeletonPulse_xGcUy"};var mt=require("react/jsx-runtime"),et={selected:1,first:.7,next:.4,last:.2};function ht({label:e,state:o,rounded:a,loading:n,onClick:r}){let i=[_e.pill,a?_e.rounded:"",n?_e.skeleton:""].filter(Boolean).join(" ");return(0,mt.jsx)("button",{type:"button","data-aia-pill":"","data-aia-loading":n?"":void 0,tabIndex:-1,contentEditable:!1,suppressContentEditableWarning:!0,className:i,style:{opacity:et[o]},onMouseDown:s=>s.preventDefault(),onClick:n?void 0:r,disabled:n,children:e})}if(typeof document<"u"&&!document.getElementById("ac-style-0fcb7940")){let e=document.createElement("style");e.id="ac-style-0fcb7940",e.textContent=`.PillList-module_list_qvLqO {
|
|
1201
1186
|
position: relative;
|
|
1202
1187
|
z-index: 1;
|
|
1203
1188
|
pointer-events: auto;
|
|
@@ -1207,7 +1192,7 @@
|
|
|
1207
1192
|
align-items: center;
|
|
1208
1193
|
vertical-align: middle;
|
|
1209
1194
|
}
|
|
1210
|
-
`,document.head.appendChild(e)}var tt={list:"PillList-module_list_qvLqO"};var Me=require("react/jsx-runtime"),Vt=[125,69];function ft(e){return e===0?"first":e===1?"next":"last"}function Ke({pills:e,activePillIndex:o,onSelectPill:a,activeSelected:n,rounded:r,loading:i}){return i&&e.length===0?(0,Me.jsx)("span",{className:tt.list,"data-aia-pill-list-loading":"",children:Vt.map((s,f)=>(0,Me.jsx)("span",{"data-aia-pill-skeleton":"",className:`${_e.pill} ${r?_e.rounded:""} ${_e.skeleton}`,style:{width:s,opacity:et[ft(f)]}},`skel-${s}`))}):(0,Me.jsx)("span",{className:tt.list,"data-aia-pill-list-loading":i?"":void 0,children:e.map((s,f)=>{let b=!!n&&f===o;return(0,Me.jsx)(
|
|
1195
|
+
`,document.head.appendChild(e)}var tt={list:"PillList-module_list_qvLqO"};var Me=require("react/jsx-runtime"),Vt=[125,69];function ft(e){return e===0?"first":e===1?"next":"last"}function Ke({pills:e,activePillIndex:o,onSelectPill:a,activeSelected:n,rounded:r,loading:i}){return i&&e.length===0?(0,Me.jsx)("span",{className:tt.list,"data-aia-pill-list-loading":"",children:Vt.map((s,f)=>(0,Me.jsx)("span",{"data-aia-pill-skeleton":"",className:`${_e.pill} ${r?_e.rounded:""} ${_e.skeleton}`,style:{width:s,opacity:et[ft(f)]}},`skel-${s}`))}):(0,Me.jsx)("span",{className:tt.list,"data-aia-pill-list-loading":i?"":void 0,children:e.map((s,f)=>{let b=!!n&&f===o;return(0,Me.jsx)(ht,{label:s.text,state:b?"selected":ft(f),selected:b,rounded:r,loading:i,onClick:()=>a(f)},`${s.type}-${s.text}`)})})}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
|
|
1211
1196
|
(packages/vanilla/src/styles.css). Same tokens, same defaults, so a consumer
|
|
1212
1197
|
theming one package sees the same result in the other.
|
|
1213
1198
|
|
|
@@ -1374,7 +1359,7 @@
|
|
|
1374
1359
|
var(--aia-option-color-selected, var(--aia-color-text-default, #fff))
|
|
1375
1360
|
);
|
|
1376
1361
|
}
|
|
1377
|
-
`,document.head.appendChild(e)}var
|
|
1362
|
+
`,document.head.appendChild(e)}var Q={section:"ProductStrip-module_section_Hugfg",label:"ProductStrip-module_label_nuc93",row:"ProductStrip-module_row_WDVBX",card:"ProductStrip-module_card_JBGYT",media:"ProductStrip-module_media_RrbGe",image:"ProductStrip-module_image_5pNL7",body:"ProductStrip-module_body_ly032",vendor:"ProductStrip-module_vendor_Gvu7G",title:"ProductStrip-module_title_gCNmq",price:"ProductStrip-module_price_gULcE"};var F=require("react/jsx-runtime");function gt({products:e,listboxId:o,onSelect:a,onFocusChange:n,focusable:r=!0}){if(e.length===0)return null;let i=`${o}-products-label`;return(0,F.jsxs)("section",{className:Q.section,"data-aia-products":"",role:"group","aria-labelledby":i,children:[(0,F.jsx)("div",{className:Q.label,id:i,children:"Products"}),(0,F.jsx)("div",{className:Q.row,"data-aia-products-row":"",children:e.map((s,f)=>(0,F.jsx)(Qt,{product:s,id:`${o}-product-${f}`,onSelect:a,onFocusChange:n,focusable:r},s.id))})]})}function Qt({product:e,id:o,onSelect:a,onFocusChange:n,focusable:r}){let i=s=>{s.metaKey||s.ctrlKey||s.shiftKey||s.altKey||s.button!==0||(s.preventDefault(),a(e))};return(0,F.jsxs)("a",{id:o,className:Q.card,"data-aia-product":"",role:"option","aria-selected":!1,href:e.url,tabIndex:r?0:-1,onClick:i,onKeyDown:s=>{s.key!=="Enter"&&s.key!==" "||(s.preventDefault(),a(e))},onFocus:()=>n?.(!0),onBlur:s=>{s.relatedTarget?.closest("[data-aia-dropdown]")||n?.(!1)},children:[(0,F.jsx)("span",{className:Q.media,"data-aia-product-placeholder":e.imageUrl?void 0:"",children:e.imageUrl?(0,F.jsx)("img",{className:Q.image,src:e.imageUrl,alt:"",loading:"lazy",decoding:"async"}):null}),(0,F.jsxs)("span",{className:Q.body,children:[e.vendor?(0,F.jsx)("span",{className:Q.vendor,children:e.vendor}):null,(0,F.jsx)("span",{className:Q.title,children:e.title}),e.price?(0,F.jsx)("span",{className:Q.price,children:e.price}):null]})]})}var H=require("@magicx-eng/ai-autocomplete-vanilla"),ge=require("react");var bt=require("@magicx-eng/ai-autocomplete-vanilla"),We=require("react");if(typeof document<"u"&&!document.getElementById("ac-style-948e58da")){let e=document.createElement("style");e.id="ac-style-948e58da",e.textContent=`@layer layout {
|
|
1378
1363
|
.aia-grid {
|
|
1379
1364
|
display: grid;
|
|
1380
1365
|
grid-template-columns: repeat(
|
|
@@ -1556,7 +1541,7 @@
|
|
|
1556
1541
|
filter: brightness(0.55);
|
|
1557
1542
|
}
|
|
1558
1543
|
}
|
|
1559
|
-
`,document.head.appendChild(e)}var oe={item:"SuggestionItem-module_item_d4vpD",fadeIn:"SuggestionItem-module_fadeIn_I8u35",riseIn:"SuggestionItem-module_riseIn_etXZT",content:"SuggestionItem-module_content_T-Qba",tappable:"SuggestionItem-module_tappable_70KcX",nonTappable:"SuggestionItem-module_nonTappable_xSZM-",highlighted:"SuggestionItem-module_highlighted_Hb0SU",tag:"SuggestionItem-module_tag_e3Fwe",pressed:"SuggestionItem-module_pressed_98o-r",pressCompress:"SuggestionItem-module_pressCompress_ICV3q",scrollHint:"SuggestionItem-module_scrollHint_xKXPt",skeletonPulse:"SuggestionItem-module_skeletonPulse_plvdD",text:"SuggestionItem-module_text_yqoh9"};var De=require("react/jsx-runtime");function yt({option:e,isHighlighted:o,onSelect:a,onHighlight:n,id:r,loading:i,scrollHint:s,enterDelayMs:f=0}){let[b]=(0,Pe.useState)(f),[w,k]=(0,Pe.useState)(!1),p=(0,Pe.useRef)(void 0);(0,Pe.useEffect)(()=>()=>clearTimeout(p.current),[]);let x=()=>{i||!e.is_tappable||w||(k(!0),a(e),clearTimeout(p.current),p.current=setTimeout(()=>k(!1),170))},_=[oe.item,o&&!i?oe.highlighted:"",e.is_tappable?oe.tappable:oe.nonTappable,w?oe.pressed:"",s?oe.scrollHint:""].filter(Boolean).join(" ");return(0,De.jsx)("div",{id:r,role:"option","data-aia-option":"","data-aia-loading":i?"":void 0,"aria-selected":o,className:_,style:{[xt.OPTION_ENTER_DELAY_VAR]:`${b}ms`},tabIndex:i||!e.is_tappable?-1:0,onClick:x,onKeyDown:v=>{!i&&e.is_tappable&&(v.key==="Enter"||v.key===" ")&&(v.preventDefault(),x())},onMouseEnter:!i&&e.is_tappable?n:void 0,children:(0,De.jsxs)("span",{className:oe.content,children:[(0,De.jsx)("span",{className:oe.text,children:e.icon?`${e.icon} ${e.text}`:e.text}),e.tag&&(0,De.jsx)("span",{className:oe.tag,children:e.tag})]})})}var at=require("react/jsx-runtime");function
|
|
1544
|
+
`,document.head.appendChild(e)}var oe={item:"SuggestionItem-module_item_d4vpD",fadeIn:"SuggestionItem-module_fadeIn_I8u35",riseIn:"SuggestionItem-module_riseIn_etXZT",content:"SuggestionItem-module_content_T-Qba",tappable:"SuggestionItem-module_tappable_70KcX",nonTappable:"SuggestionItem-module_nonTappable_xSZM-",highlighted:"SuggestionItem-module_highlighted_Hb0SU",tag:"SuggestionItem-module_tag_e3Fwe",pressed:"SuggestionItem-module_pressed_98o-r",pressCompress:"SuggestionItem-module_pressCompress_ICV3q",scrollHint:"SuggestionItem-module_scrollHint_xKXPt",skeletonPulse:"SuggestionItem-module_skeletonPulse_plvdD",text:"SuggestionItem-module_text_yqoh9"};var De=require("react/jsx-runtime");function yt({option:e,isHighlighted:o,onSelect:a,onHighlight:n,id:r,loading:i,scrollHint:s,enterDelayMs:f=0}){let[b]=(0,Pe.useState)(f),[w,k]=(0,Pe.useState)(!1),p=(0,Pe.useRef)(void 0);(0,Pe.useEffect)(()=>()=>clearTimeout(p.current),[]);let x=()=>{i||!e.is_tappable||w||(k(!0),a(e),clearTimeout(p.current),p.current=setTimeout(()=>k(!1),170))},_=[oe.item,o&&!i?oe.highlighted:"",e.is_tappable?oe.tappable:oe.nonTappable,w?oe.pressed:"",s?oe.scrollHint:""].filter(Boolean).join(" ");return(0,De.jsx)("div",{id:r,role:"option","data-aia-option":"","data-aia-loading":i?"":void 0,"aria-selected":o,className:_,style:{[xt.OPTION_ENTER_DELAY_VAR]:`${b}ms`},tabIndex:i||!e.is_tappable?-1:0,onClick:x,onKeyDown:v=>{!i&&e.is_tappable&&(v.key==="Enter"||v.key===" ")&&(v.preventDefault(),x())},onMouseEnter:!i&&e.is_tappable?n:void 0,children:(0,De.jsxs)("span",{className:oe.content,children:[(0,De.jsx)("span",{className:oe.text,children:e.icon?`${e.icon} ${e.text}`:e.text}),e.tag&&(0,De.jsx)("span",{className:oe.tag,children:e.tag})]})})}var at=require("react/jsx-runtime");function Yt(){let[e,o]=(0,ge.useState)(H.isOptionsGridMobileViewport);return(0,ge.useEffect)(()=>{if(typeof window>"u"||!window.matchMedia)return;let a=window.matchMedia(H.OPTIONS_GRID_MOBILE_QUERY),n=()=>o(a.matches);return n(),a.addEventListener("change",n),()=>a.removeEventListener("change",n)},[]),e}function _t({options:e,activeIndex:o,onSelect:a,onHighlight:n,listboxId:r,loading:i,groupKey:s="",optionsPosition:f="below"}){let b=Yt(),w=(0,ge.useRef)(null),[k,p]=(0,ge.useState)(null);(0,ge.useLayoutEffect)(()=>{let _=w.current,L=_&&!i&&(0,H.needsOptionsGridMeasurement)(e.length,b)?(0,H.measureOptionsGrid)(_):null;p(L?(0,H.planOptionsGrid)(e.length,b,L.rowWidths,L.gridWidth):null)},[e,b,i]);let x=k??(0,H.planOptionsGrid)(e.length,b,null,null);return(0,at.jsx)(vt,{min:"250px",max:"1fr",gap:"0",scroll:!0,scrollResetKey:s,template:x.template,maxHeight:x.maxHeight,innerRef:_=>{w.current=_},"data-aia-group":s,children:e.map((_,v)=>(0,at.jsx)(yt,{option:_,isHighlighted:v===o,onSelect:a,onHighlight:()=>n(v),id:`${r}-option-${v}`,loading:i,scrollHint:!i&&x.scrollHintIndices.includes(v),enterDelayMs:i?0:(0,H.optionEnterDelayMs)(v,x.cols,e.length,f)},`${s}\0${_.text}`))})}if(typeof document<"u"&&!document.getElementById("ac-style-8414cd5f")){let e=document.createElement("style");e.id="ac-style-8414cd5f",e.textContent=`@layer layout {
|
|
1560
1545
|
.aia-stack {
|
|
1561
1546
|
display: flex;
|
|
1562
1547
|
flex-direction: column;
|
|
@@ -1573,7 +1558,7 @@
|
|
|
1573
1558
|
}
|
|
1574
1559
|
/* data-align="stretch" is the flex default \u2014 no rule needed. */
|
|
1575
1560
|
}
|
|
1576
|
-
`,document.head.appendChild(e)}var Pt=require("react/jsx-runtime");function kt({space:e,align:o="stretch",className:a,children:n,...r}){let i=e?{"--aia-stack-space":e}:void 0;return(0,Pt.jsx)("div",{className:a?`aia-stack ${a}`:"aia-stack","data-align":o,style:i,...r,children:n})}var O=require("react/jsx-runtime"),Xt=[159,119,164],Zt=()=>{},It=()=>{};function Jt(e){let o=()=>typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-color-scheme: dark)").matches,[a,n]=(0,
|
|
1561
|
+
`,document.head.appendChild(e)}var Pt=require("react/jsx-runtime");function kt({space:e,align:o="stretch",className:a,children:n,...r}){let i=e?{"--aia-stack-space":e}:void 0;return(0,Pt.jsx)("div",{className:a?`aia-stack ${a}`:"aia-stack","data-align":o,style:i,...r,children:n})}var O=require("react/jsx-runtime"),Xt=[159,119,164],Zt=()=>{},It=()=>{};function Jt(e){let o=()=>typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-color-scheme: dark)").matches,[a,n]=(0,Y.useState)(o);if((0,Y.useEffect)(()=>{if(e!=="auto"||typeof window>"u"||typeof window.matchMedia!="function")return;let r=window.matchMedia("(prefers-color-scheme: dark)"),i=()=>n(r.matches);return r.addEventListener("change",i),()=>r.removeEventListener("change",i)},[e]),e!==void 0)return e==="auto"?a?"dark":"light":e}function ea(e,o){let a=(0,Y.useRef)(null);(0,Y.useEffect)(()=>{let n=e.current,r=o.current;if(!n||!r)return;let i=n.querySelector(".aia-grid[data-scroll]");if(a.current&&a.current.grid!==i&&(a.current.controller.destroy(),a.current=null),i&&!a.current){a.current={grid:i,controller:(0,Ce.attachScrollArrow)({dropdown:n,grid:i,button:r})};return}a.current?.controller.update()}),(0,Y.useEffect)(()=>()=>{a.current?.controller.destroy(),a.current=null},[])}function qe({suggestions:e,activeIndex:o,onSelect:a,onHighlight:n,isOpen:r,id:i,className:s,pills:f,onPillClick:b,showPills:w=!0,onSkip:k,showSkipButton:p=!0,skipDisabled:x=!1,activeSelected:_=!1,isLoading:v=!1,isInputEmpty:L=!1,products:M,onProductSelect:ie,onProductFocusChange:ne,formatType:W="options",dateView:A=null,selectedDateIso:re=null,selectedDateRange:se=null,dateRangeStart:u=null,onPreviousMonth:be,onNextMonth:le,optionsPosition:N="below",mode:Z}){let de=Jt(Z),ce=de!==void 0,J=(0,Y.useRef)(null),ee=(0,Y.useRef)(null);ea(J,ee);let G=e[0]?.options??[],pe=!!(f&&f.length>0&&b),ve=!!(M&&M.length>0),z=r&&(G.length>0||w&&pe||v||ve),q={suggestions:e,activeIndex:o,pills:f,showPills:w,showSkipButton:p,skipDisabled:x,activeSelected:_,isLoading:v,isInputEmpty:L,products:M,formatType:W,dateView:A,selectedDateIso:re,selectedDateRange:se,dateRangeStart:u},ue=(0,Y.useRef)(q);z&&(ue.current=q);let t=z?q:ue.current,c=t.suggestions[0],h=c?.options??[],l=t.activeIndex>=0&&!!h[t.activeIndex]?.is_tappable,y=!!(t.pills&&t.pills.length>0&&b),T=t.showPills&&y,U=t.showPills&&!y&&t.isLoading,d=T||U,he=y&&t.showSkipButton&&!t.isInputEmpty&&!!k,Ie=t.pills?.[0]?.text,we=(0,Ce.isCalendarFormat)(t.formatType)&&t.dateView!=null,xe=h.length>0&&!we,te=h.length>0&&we,Ae=t.isLoading&&!xe&&!te,V=t.products??[];return(0,O.jsxs)("div",{ref:J,id:i,role:"listbox","data-aia-dropdown":"","data-options-position":N,"data-mode":de,"data-aia-loading":t.isLoading?"":void 0,"data-aia-has-products":V.length>0?"":void 0,className:`${ce?"magicx-aia ":""}${me.dropdown} ${z?me.visible:""} ${s??""}`,onMouseDown:j=>j.preventDefault(),children:[(0,O.jsxs)(kt,{space:"8px",children:[(d||he)&&(0,O.jsxs)(Oe,{noWrap:!0,className:me.pillBar,"data-aia-pillbar":"",children:[d&&(0,O.jsx)("span",{className:me.pillScroll,"data-aia-pill-scroll":"",children:(0,O.jsx)(Ke,{pills:t.pills??[],activePillIndex:0,activeSelected:t.activeSelected,onSelectPill:b??(()=>{}),rounded:!0,loading:t.isLoading})}),he&&(0,O.jsx)("button",{type:"button",tabIndex:-1,className:me.skip,"data-aia-skip":"",disabled:t.isLoading||t.skipDisabled,"aria-label":Ie?`Skip ${Ie}`:"Skip",onClick:k,children:"skip"})]}),xe&&(0,O.jsx)(_t,{options:h,activeIndex:t.activeIndex,onSelect:a,onHighlight:n,listboxId:i,loading:t.isLoading,groupKey:c?`${c.type} ${c.text}`:"",optionsPosition:N}),te&&t.dateView&&(0,O.jsx)(pt,{options:h,activeIndex:t.activeIndex,listboxId:i,view:t.dateView,selection:{selectedIso:t.selectedDateIso??null,selectedRange:t.selectedDateRange??null,rangeStart:t.dateRangeStart??null},onSelect:a,onHighlight:n,onPreviousMonth:be??It,onNextMonth:le??It}),Ae&&(0,O.jsx)("div",{className:me.skeletonBars,"data-aia-skeleton-bars":"",children:Xt.map(j=>(0,O.jsx)("span",{className:me.skeletonBar,style:{width:j}},`bar-${j}`))}),(0,O.jsx)(gt,{products:V,listboxId:i,onSelect:ie??Zt,onFocusChange:ne,focusable:z}),(0,O.jsx)(ut,{isOptionHighlighted:l,isInputEmpty:t.isInputEmpty})]}),(0,O.jsx)("button",{ref:ee,type:"button",tabIndex:-1,className:me.scrollArrow,"data-aia-scroll-arrow":"","aria-label":Ce.SCROLL_ARROW_LABEL,"aria-hidden":"true",children:(0,O.jsx)("svg",{viewBox:"0 0 16 16",width:"14",height:"14",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",children:(0,O.jsx)("path",{d:"M4 6.5 8 10.5l4-4"})})})]})}var Te=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=`.SubmitButton-module_submitButton_otz7H {
|
|
1577
1562
|
flex-shrink: 0;
|
|
1578
1563
|
width: 32px;
|
|
1579
1564
|
height: 32px;
|
|
@@ -1608,5 +1593,5 @@
|
|
|
1608
1593
|
);
|
|
1609
1594
|
cursor: default;
|
|
1610
1595
|
}
|
|
1611
|
-
`,document.head.appendChild(e)}var At={submitButton:"SubmitButton-module_submitButton_otz7H"};var Ue=require("react/jsx-runtime");function St({disabled:e,onClick:o}){return(0,Ue.jsx)("button",{type:"button","data-aia-submit":"",className:At.submitButton,disabled:e,onClick:a=>{a.stopPropagation(),o()},"aria-label":"Submit",children:(0,Ue.jsx)("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",role:"img","aria-label":"Submit",children:(0,Ue.jsx)("path",{d:"M9 14V4M9 4L4 9M9 4L14 9",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})}var Ee=require("@magicx-eng/ai-autocomplete-vanilla"),I=require("react");var ot=require("react");function Dt(e){let o=(0,ot.useRef)(e);o.current=e;let a=Object.keys(e??{}).sort().join("\0"),n=(0,ot.useRef)({key:"",overrides:void 0});if(n.current.key!==a){let r={};for(let i of Object.keys(e??{})){let s=(f,b,w)=>{let k=o.current?.[i];return k?k(f,b,w):[]};r[i]=s}n.current={key:a,overrides:e?r:void 0}}return{overrides:n.current.overrides,key:a}}var it=require("react");function Ct(e){let o=(0,it.useRef)(e);o.current=e;let a=(0,it.useRef)(null);a.current===null&&(a.current={fetch:(r,i)=>{let s=o.current;return s?s.fetch(r,i):Promise.reject(new Error("products config removed"))},transform:r=>o.current?.transform(r)??[],get limit(){return o.current?.limit}});let n=e!==void 0;return{config:n?a.current:void 0,enabled:n}}var ta={text:"",completedParams:[],identifiedParams:[],skippedParams:[],pendingSpan:null,suggestions:[],products:[],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 je({onSubmit:e,onResult:o,onError:a,optionOverrides:n,maskCompletedText:r,apiConfig:i,additionalContext:s,columns:f=2,dropdownTrigger:b,optionsPosition:w,closeDropdownOnBlur:k,showNonTappableOptions:p,showSkipButton:x,onFocus:_,onBlur:v,value:L,completedParams:M,onChange:ie,onParamsChange:ne,products:W,onProductSelect:A,source:re,setCursor:se}){let u=(0,I.useRef)(null),[be,le]=(0,I.useState)(null),N=(0,I.useRef)(e);N.current=e;let Z=(0,I.useRef)(o);Z.current=o;let de=(0,I.useRef)(a);de.current=a;let ce=(0,I.useRef)(ie);ce.current=ie;let J=(0,I.useRef)(ne);J.current=ne;let ee=(0,I.useRef)(_);ee.current=_;let G=(0,I.useRef)(v);G.current=v;let pe=(0,I.useRef)(se);pe.current=se;let ve=(0,I.useRef)(A);ve.current=A;let z=Ct(W),q=Dt(n);(0,I.useEffect)(()=>{if(typeof document>"u")return;let h=new Ee.AIAutocomplete(document.createElement("div"),{renderMode:"headless",apiConfig:i,additionalContext:s,optionOverrides:q.overrides,maskCompletedText:r,columns:f,dropdownTrigger:b,optionsPosition:w,closeDropdownOnBlur:k,showNonTappableOptions:p,source:re,value:L,completedParams:M,onSubmit:(...R)=>N.current?.(...R),onResult:(...R)=>Z.current?.(...R),onError:(...R)=>de.current?.(...R),onChange:(...R)=>ce.current?.(...R),onParamsChange:(...R)=>J.current?.(...R),onFocus:()=>ee.current?.(),onBlur:()=>G.current?.(),onProductSelect:R=>ve.current?.(R),setCursor:R=>pe.current?.(R),products:z.config});u.current=h,le(h.getState());let $=h.subscribe(R=>le(R));return()=>{$(),h.destroy(),u.current===h&&(u.current=null)}},[]),(0,I.useEffect)(()=>{L!==void 0&&u.current?.setValue(L)},[L]),(0,I.useEffect)(()=>{M!==void 0&&u.current?.setCompletedParams(M)},[M]);let ue=JSON.stringify(i??null),t;try{t=JSON.stringify(s??null)}catch{t="[unstringifiable]"}(0,I.useEffect)(()=>{u.current?.update({apiConfig:i,additionalContext:s,optionOverrides:q.overrides,dropdownTrigger:b,optionsPosition:w,closeDropdownOnBlur:k,showNonTappableOptions:p})},[ue,t,q.key,b,w,k,p]);let c=(0,I.useRef)(!1);(0,I.useEffect)(()=>{if(!c.current){c.current=!0;return}u.current?.update({products:z.config})},[z.enabled]);let m=(0,I.useRef)(null);m.current===null&&(m.current={handleTextChange:h=>u.current?.handleTextChange(h),handleKeyDown:h=>{let $="nativeEvent"in h?h.nativeEvent:h;u.current?.handleKeyDown($)},setFocused:h=>u.current?.setFocused(h),startEditingParam:h=>u.current?.startEditingParam(h),exitEditMode:()=>u.current?.exitEditMode(),handleCaretAfterInput:h=>u.current?.handleCaretAfterInput(h),handleCaretMove:h=>u.current?.handleCaretMove(h),replaceEditingRange:h=>u.current?.replaceEditingRange(h)??!1,setActivePill:h=>u.current?.setActivePill(h),skipActivePill:()=>u.current?.skipActivePill(),removeLastParam:()=>u.current?.removeLastParam(),clearNewParamId:()=>u.current?.clearNewParamId(),reset:()=>u.current?.reset(),selectOption:h=>u.current?.selectOption(h),selectProduct:h=>u.current?.selectProduct(h),setActiveDropdownIndex:h=>u.current?.setActiveDropdownIndex(h),showPreviousMonth:()=>u.current?.showPreviousMonth(),showNextMonth:()=>u.current?.showNextMonth(),handleFocus:()=>u.current?.setFocused(!0),handleBlur:()=>u.current?.setFocused(!1)});let l=m.current,y=(0,I.useCallback)(h=>{let $=h.target.value,Ye=$.length>0&&!h.nativeEvent?.isComposing&&$[0]!==$[0].toUpperCase()?$[0].toUpperCase()+$.slice(1):$;u.current?.handleTextChange(Ye)},[]),T=(0,I.useCallback)(h=>{u.current?.handleKeyDown(h.nativeEvent)},[]),U=u.current,d=be??ta,me=L!==void 0?L:d.text,Ie=M!==void 0?M:d.completedParams,we=d.actionableSuggestions,xe=we[0],te=U?.listboxId??"",Ae=d.activeDropdownIndex>=0&&U?`${te}-option-${d.activeDropdownIndex}`:void 0,V=d.editingParam,j=d.editingIdentified,Re=V?{type:V.suggestionType,text:V.suggestionPlaceholder,required:!0,options:V.options}:j?{type:j.type,text:(0,Ee.identifiedParamLabel)(j.type),required:!0,options:[]}:null,Ne=Re??xe,Ve=Re?[Re]:we,Le=(0,Ee.dateSelectionFor)(d),ze=!U||d.isLoading&&!d.editingParam&&!d.inSelectionAnimation||d.isSearchingOptions;return{completedParams:Ie,skippedParams:d.skippedParams,identifiedParams:d.identifiedParams,suggestionPills:we,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:ze,isFocused:d.isFocused,isDropdownOpen:d.isDropdownOpen,isActivePillSelected:d.isActivePillSelected,placeholderText:d.placeholderText,listboxId:te,error:d.error,products:d.products,selectProduct:l.selectProduct,handleTextChange:l.handleTextChange,handleKeyDown:l.handleKeyDown,setFocused:l.setFocused,editingParam:V,editingIdentified:j,editingAnchor:d.editingAnchor,caretOffset:d.caretOffset,startEditingParam:l.startEditingParam,exitEditMode:l.exitEditMode,handleCaretAfterInput:l.handleCaretAfterInput,handleCaretMove:l.handleCaretMove,replaceEditingRange:l.replaceEditingRange,inputProps:{value:me,placeholder:d.placeholderText||void 0,onChange:y,onKeyDown:T,onFocus:l.handleFocus,onBlur:l.handleBlur,role:"combobox","aria-expanded":d.isDropdownOpen,"aria-activedescendant":Ae,"aria-autocomplete":"list","aria-controls":te},reset:l.reset,dropdownProps:{suggestions:Ne?[{...Ne,options:d.filteredOptions}]:[],activeIndex:d.activeDropdownIndex,onSelect:l.selectOption,onHighlight:l.setActiveDropdownIndex,isOpen:d.isDropdownOpen,id:te,pills:Ve,activeSelected:d.isActivePillSelected,onPillClick:l.setActivePill,onSkip:l.skipActivePill,showSkipButton:(x??!0)&&!V&&!j,skipDisabled:d.inSelectionAnimation,isLoading:ze,isInputEmpty:me.trim().length===0,products:d.products,onProductSelect:l.selectProduct,onProductFocusChange:l.setFocused,formatType:d.activeFormatType,dateView:d.dateView,selectedDateIso:Le.selectedIso,selectedDateRange:Le.selectedRange,dateRangeStart:Le.rangeStart,onPreviousMonth:l.showPreviousMonth,onNextMonth:l.showNextMonth,optionsPosition:w??"below"}}}var K=require("@magicx-eng/ai-autocomplete-vanilla"),P=require("react"),$e;function aa(){if($e!==void 0)return $e;if(typeof document>"u")return!1;let e=document.createElement("div");return e.setAttribute("contenteditable","plaintext-only"),$e=e.contentEditable==="plaintext-only",$e}function Et(e){let{segments:o,newParamId:a,editingParam:n,editingIdentified:r,editingAnchor:i,caretOffset:s,placeholderText:f,isFocused:b,isDropdownOpen:w,listboxId:k,activeDescendantId:p,autoFocus:x,handleTextChange:_,handleKeyDown:v,handleCaretAfterInput:L,handleCaretMove:M,startEditingParam:ie,replaceEditingRange:ne,setFocused:W}=e,A=(0,P.useRef)(null),re=(0,P.useRef)(!1),se=(0,P.useRef)(""),u=(0,P.useRef)(""),be=(0,P.useRef)(null),le=(0,P.useRef)(0);be.current=s,(0,P.useEffect)(()=>{if(!x)return;let t=A.current;if(!t)return;document.activeElement===t?W(!0):t.focus();let c=t.ownerDocument??document,m=c.getSelection(),l=m&&m.rangeCount>0&&t.contains(m.anchorNode);if(m&&!l){let y=c.createRange();y.selectNodeContents(t),y.collapse(!0),m.removeAllRanges(),m.addRange(y)}},[x,W]),(0,P.useEffect)(()=>{let t=A.current;if(!t)return;let c=t.ownerDocument??document,m=()=>{let l=c.getSelection();if(!l||l.rangeCount===0||!l.anchorNode||!t.contains(l.anchorNode))return;let y=l.anchorNode,T=y.nodeType===Node.ELEMENT_NODE?y:y.parentElement,d=(l.isCollapsed?T?.closest("strong[data-param-id]"):null)?.dataset.paramId??null,me=n?.id??r?.id??null;if(d&&d!==me){ie(d);return}performance.now()-le.current<50||M((0,K.getCursorOffset)(t))};return c.addEventListener("selectionchange",m),()=>c.removeEventListener("selectionchange",m)},[n,r,ie,M]),(0,P.useLayoutEffect)(()=>{let t=A.current;t&&(0,K.renderEditableContent)({input:t,segments:o,newParamId:a,editingParamId:n?.id??null,placeholderText:f??"",isFocused:b})},[o,a,n,f,b]),(0,P.useLayoutEffect)(()=>{let t=se.current,c=a??"";if(se.current=c,!c||c===t)return;let m=A.current;if(!m)return;m.focus();let l=be.current??(0,K.plainTextLength)(m);(0,K.setCursorOffset)(m,l)},[a]),(0,P.useLayoutEffect)(()=>{let t=u.current,c=n?.id??"";if(u.current=c,!c||c===t||i==null)return;let m=A.current;m&&(0,K.setCursorOffset)(m,i)},[n,i]);let N=(0,P.useCallback)(()=>{if(re.current)return;let t=A.current;if(!t)return;let c=(0,K.extractPlainText)(t),l=c.length>0&&c[0]!==c[0].toUpperCase()?c[0].toUpperCase()+c.slice(1):c;_(l)},[_]),Z=(0,P.useCallback)(()=>{le.current=performance.now(),N();let t=A.current;t&&L((0,K.getCursorOffset)(t))},[N,L]);(0,P.useEffect)(()=>{let t=A.current;if(!t)return;let c=m=>{let l=m,y=l.inputType;if(y==="insertParagraph"||y==="insertLineBreak"||y==="insertFromDrop"){m.preventDefault();return}if(y.startsWith("insert")||y.startsWith("delete")){let T=y.startsWith("delete")?"":l.data??"";ne(T)&&m.preventDefault()}};return t.addEventListener("beforeinput",c),()=>t.removeEventListener("beforeinput",c)},[ne]);let de=(0,P.useCallback)(()=>{re.current=!0},[]),ce=(0,P.useCallback)(()=>{re.current=!1,N()},[N]),J=(0,P.useCallback)(t=>{t.preventDefault();let c=A.current;if(!c)return;let m=(t.clipboardData.getData("text/plain")??"").replace(/\r?\n/g," ");if(!m)return;let l=c.ownerDocument??document,y=l.getSelection();if(!y||y.rangeCount===0)return;let T=y.getRangeAt(0);if(!c.contains(T.startContainer))return;T.deleteContents();let U=l.createTextNode(m);T.insertNode(U),T.setStartAfter(U),T.collapse(!0),y.removeAllRanges(),y.addRange(T),N()},[N]),ee=(0,P.useCallback)(t=>v(t),[v]),G=(0,P.useCallback)(()=>W(!0),[W]),pe=(0,P.useCallback)(()=>W(!1),[W]),ve=(0,P.useCallback)(()=>A.current?.focus(),[]),z=(0,P.useCallback)(()=>A.current?.blur(),[]),q=(0,P.useCallback)(()=>{let t=A.current;return t?(0,K.extractPlainText)(t):""},[]),ue=aa()?"plaintext-only":"true";return{inputRef:A,editorProps:{ref:A,contentEditable:ue,suppressContentEditableWarning:!0,tabIndex:0,role:"combobox","aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":k,"aria-expanded":w,"aria-activedescendant":p,spellCheck:!0,enterKeyHint:"send",onInput:Z,onKeyDown:ee,onCompositionStart:de,onCompositionEnd:ce,onPaste:J,onFocus:G,onBlur:pe},getPlainText:q,focus:ve,blur:z}}var X=require("react/jsx-runtime");function oa(e){return e!=="auto"?e:typeof window>"u"||window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}var Tt=(0,E.forwardRef)(function({onSubmit:o,onResult:a,onError:n,optionOverrides:r,maskCompletedText:i,className:s,apiConfig:f,additionalContext:b,columns:w,pillPlacement:k="dropdown",mode:p="auto",optionsPosition:x="below",animations:_=!0,dropdownTrigger:v,closeDropdownOnBlur:L,showNonTappableOptions:M,showSkipButton:ie,autoFocus:ne=!0,onFocus:W,onBlur:A,value:re,completedParams:se,onChange:u,onParamsChange:be,products:le,onProductSelect:N,submitButton:Z},de){let ce=(0,E.useRef)(null),J=(0,E.useRef)(null),ee=(0,E.useRef)(()=>{}),G=(0,E.useRef)(null),pe=(0,E.useRef)(null);(0,E.useEffect)(()=>{let S=ce.current;if(S)return G.current?G.current.setMode(p):G.current=new Te.ModeController(S,p),()=>{G.current?.destroy(),G.current=null}},[p]);let ve=(0,E.useCallback)(S=>{let ye=pe.current?.current;ye&&(ye.focus(),(0,Te.setCursorOffset)(ye,S))},[]),{completedParams:z,skippedParams:q,identifiedParams:ue,isReady:t,suggestionPills:c,setActivePill:m,skipActivePill:l,segments:y,newParamId:T,clearNewParamId:U,placeholderText:d,isFocused:me,isDropdownOpen:Ie,isActivePillSelected:we,isLoading:xe,activeIndex:te,listboxId:Ae,handleTextChange:V,handleKeyDown:j,setFocused:Re,editingParam:Ne,editingIdentified:Ve,editingAnchor:Le,caretOffset:ze,startEditingParam:h,handleCaretAfterInput:$,handleCaretMove:R,replaceEditingRange:Ye,dropdownProps:Rt,reset:Be}=je({onSubmit:S=>ee.current(S),onResult:a,onError:n,optionOverrides:r,maskCompletedText:i,apiConfig:f,additionalContext:b,columns:w,dropdownTrigger:v,optionsPosition:x,closeDropdownOnBlur:L,showNonTappableOptions:M,showSkipButton:ie,onFocus:W,onBlur:A,value:re,completedParams:se,onChange:u,onParamsChange:be,products:le,onProductSelect:N,source:"full-sdk",setCursor:ve});(0,E.useEffect)(()=>{if(!T)return;let S=window.setTimeout(()=>U(),650);return()=>window.clearTimeout(S)},[T,U]);let Lt=te>=0?`${Ae}-option-${te}`:void 0,{inputRef:Qe,editorProps:Ot,focus:Ge,blur:nt,getPlainText:rt}=Et({segments:y,newParamId:T,editingParam:Ne,editingIdentified:Ve,editingAnchor:Le,caretOffset:ze,placeholderText:d,isFocused:me,isDropdownOpen:Ie,listboxId:Ae,activeDescendantId:Lt,autoFocus:ne,handleTextChange:V,handleKeyDown:j,handleCaretAfterInput:$,handleCaretMove:R,startEditingParam:h,replaceEditingRange:Ye,setFocused:Re});pe.current=Qe,(0,E.useLayoutEffect)(()=>{let S=J.current,ye=Qe.current;if(!S||!ye)return;let st=()=>{let dt=S.firstElementChild;if(!dt)return;let Bt=dt.getBoundingClientRect(),Gt=ye.getBoundingClientRect();Bt.top>=Gt.bottom-2?S.setAttribute("data-aia-pill-wrapped",""):S.removeAttribute("data-aia-pill-wrapped")};st();let lt=new ResizeObserver(st);return lt.observe(ye),()=>lt.disconnect()},[y,c.length,xe,Qe]),(0,E.useImperativeHandle)(de,()=>({focus:Ge,blur:nt,reset:Be,setMode:S=>G.current?.setMode(S),skipActivePill:l}),[Ge,nt,Be,l]);let Fe=!!y.length||z.length>0,Xe=(0,E.useCallback)(()=>{if(!Fe)return;let S=rt();o((0,Te.buildSubmitResult)(S,z,q,{identifiedParams:ue,isReady:t})),Be()},[Fe,z,q,ue,t,o,Be,rt]);ee.current=Xe;let Mt=(0,E.useCallback)(S=>{S.target?.closest("[data-aia-pill]")||Ge()},[Ge]),Nt=k==="inline",zt=k==="dropdown";return(0,X.jsxs)("div",{ref:ce,className:`magicx-aia ${ke.container} ${s??""}`,"data-pill-placement":k,"data-options-position":x,"data-animations":_?"on":"off","data-mode":oa(p),children:[(0,X.jsx)(qe,{...Rt,showPills:zt}),(0,X.jsxs)("div",{className:ke.inputWrapper,onClick:Mt,children:[(0,X.jsxs)("div",{className:ke.editorArea,"data-aia-editor":"",children:[(0,X.jsx)("div",{...Ot,className:ke.input,"data-aia-input":""}),Nt&&(xe||c.length>0)&&(0,X.jsx)("span",{ref:J,className:ke.pillListContainer,"data-aia-pill-list-container":"",children:(0,X.jsx)(Ke,{pills:c,activePillIndex:0,activeSelected:we,onSelectPill:m,loading:xe})})]}),Z===null?null:Z===void 0?(0,X.jsx)(St,{disabled:!Fe,onClick:Xe}):(0,X.jsx)("span",{"data-aia-submit":"",className:ke.submitSlot,onClick:S=>{Fe&&(S.stopPropagation(),Xe())},children:Z})]})]})});0&&(module.exports={AIAutocomplete,AIAutocompleteDropdown,DATE_RANGE_META_END,DATE_RANGE_META_START,WEEKDAY_LABELS,buildSubmitResult,cellDay,cellIso,dateCellMarks,formatDate,formatDateRange,isoDate,monthLabel,parseDate,parseLooseDate,parseLooseDateRange,selectedRangeFor,useAIAutocomplete,visibleDateRange,withSkippedParams});
|
|
1596
|
+
`,document.head.appendChild(e)}var At={submitButton:"SubmitButton-module_submitButton_otz7H"};var Ue=require("react/jsx-runtime");function St({disabled:e,onClick:o}){return(0,Ue.jsx)("button",{type:"button","data-aia-submit":"",className:At.submitButton,disabled:e,onClick:a=>{a.stopPropagation(),o()},"aria-label":"Submit",children:(0,Ue.jsx)("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",role:"img","aria-label":"Submit",children:(0,Ue.jsx)("path",{d:"M9 14V4M9 4L4 9M9 4L14 9",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})}var Ee=require("@magicx-eng/ai-autocomplete-vanilla"),I=require("react");var ot=require("react");function Dt(e){let o=(0,ot.useRef)(e);o.current=e;let a=Object.keys(e??{}).sort().join("\0"),n=(0,ot.useRef)({key:"",overrides:void 0});if(n.current.key!==a){let r={};for(let i of Object.keys(e??{})){let s=(f,b,w)=>{let k=o.current?.[i];return k?k(f,b,w):[]};r[i]=s}n.current={key:a,overrides:e?r:void 0}}return{overrides:n.current.overrides,key:a}}var it=require("react");function Ct(e){let o=(0,it.useRef)(e);o.current=e;let a=(0,it.useRef)(null);a.current===null&&(a.current={fetch:(r,i)=>{let s=o.current;return s?s.fetch(r,i):Promise.reject(new Error("products config removed"))},transform:r=>o.current?.transform(r)??[],get limit(){return o.current?.limit}});let n=e!==void 0;return{config:n?a.current:void 0,enabled:n}}var ta={text:"",completedParams:[],identifiedParams:[],skippedParams:[],pendingSpan:null,suggestions:[],products:[],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 je({onSubmit:e,onResult:o,onError:a,optionOverrides:n,maskCompletedText:r,apiConfig:i,additionalContext:s,columns:f=2,dropdownTrigger:b,optionsPosition:w,closeDropdownOnBlur:k,showNonTappableOptions:p,showSkipButton:x,onFocus:_,onBlur:v,value:L,completedParams:M,onChange:ie,onParamsChange:ne,products:W,onProductSelect:A,source:re,setCursor:se}){let u=(0,I.useRef)(null),[be,le]=(0,I.useState)(null),N=(0,I.useRef)(e);N.current=e;let Z=(0,I.useRef)(o);Z.current=o;let de=(0,I.useRef)(a);de.current=a;let ce=(0,I.useRef)(ie);ce.current=ie;let J=(0,I.useRef)(ne);J.current=ne;let ee=(0,I.useRef)(_);ee.current=_;let G=(0,I.useRef)(v);G.current=v;let pe=(0,I.useRef)(se);pe.current=se;let ve=(0,I.useRef)(A);ve.current=A;let z=Ct(W),q=Dt(n);(0,I.useEffect)(()=>{if(typeof document>"u")return;let m=new Ee.AIAutocomplete(document.createElement("div"),{renderMode:"headless",apiConfig:i,additionalContext:s,optionOverrides:q.overrides,maskCompletedText:r,columns:f,dropdownTrigger:b,optionsPosition:w,closeDropdownOnBlur:k,showNonTappableOptions:p,source:re,value:L,completedParams:M,onSubmit:(...R)=>N.current?.(...R),onResult:(...R)=>Z.current?.(...R),onError:(...R)=>de.current?.(...R),onChange:(...R)=>ce.current?.(...R),onParamsChange:(...R)=>J.current?.(...R),onFocus:()=>ee.current?.(),onBlur:()=>G.current?.(),onProductSelect:R=>ve.current?.(R),setCursor:R=>pe.current?.(R),products:z.config});u.current=m,le(m.getState());let $=m.subscribe(R=>le(R));return()=>{$(),m.destroy(),u.current===m&&(u.current=null)}},[]),(0,I.useEffect)(()=>{L!==void 0&&u.current?.setValue(L)},[L]),(0,I.useEffect)(()=>{M!==void 0&&u.current?.setCompletedParams(M)},[M]);let ue=JSON.stringify(i??null),t;try{t=JSON.stringify(s??null)}catch{t="[unstringifiable]"}(0,I.useEffect)(()=>{u.current?.update({apiConfig:i,additionalContext:s,optionOverrides:q.overrides,dropdownTrigger:b,optionsPosition:w,closeDropdownOnBlur:k,showNonTappableOptions:p})},[ue,t,q.key,b,w,k,p]);let c=(0,I.useRef)(!1);(0,I.useEffect)(()=>{if(!c.current){c.current=!0;return}u.current?.update({products:z.config})},[z.enabled]);let h=(0,I.useRef)(null);h.current===null&&(h.current={handleTextChange:m=>u.current?.handleTextChange(m),handleKeyDown:m=>{let $="nativeEvent"in m?m.nativeEvent:m;u.current?.handleKeyDown($)},setFocused:m=>u.current?.setFocused(m),startEditingParam:m=>u.current?.startEditingParam(m),exitEditMode:()=>u.current?.exitEditMode(),handleCaretAfterInput:m=>u.current?.handleCaretAfterInput(m),handleCaretMove:m=>u.current?.handleCaretMove(m),replaceEditingRange:m=>u.current?.replaceEditingRange(m)??!1,setActivePill:m=>u.current?.setActivePill(m),skipActivePill:()=>u.current?.skipActivePill(),removeLastParam:()=>u.current?.removeLastParam(),clearNewParamId:()=>u.current?.clearNewParamId(),reset:()=>u.current?.reset(),selectOption:m=>u.current?.selectOption(m),selectProduct:m=>u.current?.selectProduct(m),setActiveDropdownIndex:m=>u.current?.setActiveDropdownIndex(m),showPreviousMonth:()=>u.current?.showPreviousMonth(),showNextMonth:()=>u.current?.showNextMonth(),handleFocus:()=>u.current?.setFocused(!0),handleBlur:()=>u.current?.setFocused(!1)});let l=h.current,y=(0,I.useCallback)(m=>{let $=m.target.value,Qe=$.length>0&&!m.nativeEvent?.isComposing&&$[0]!==$[0].toUpperCase()?$[0].toUpperCase()+$.slice(1):$;u.current?.handleTextChange(Qe)},[]),T=(0,I.useCallback)(m=>{u.current?.handleKeyDown(m.nativeEvent)},[]),U=u.current,d=be??ta,he=L!==void 0?L:d.text,Ie=M!==void 0?M:d.completedParams,we=d.actionableSuggestions,xe=we[0],te=U?.listboxId??"",Ae=d.activeDropdownIndex>=0&&U?`${te}-option-${d.activeDropdownIndex}`:void 0,V=d.editingParam,j=d.editingIdentified,Re=V?{type:V.suggestionType,text:V.suggestionPlaceholder,required:!0,options:V.options}:j?{type:j.type,text:(0,Ee.identifiedParamLabel)(j.type),required:!0,options:[]}:null,Ne=Re??xe,Ve=Re?[Re]:we,Le=(0,Ee.dateSelectionFor)(d),ze=!U||d.isLoading&&!d.editingParam&&!d.inSelectionAnimation||d.isSearchingOptions;return{completedParams:Ie,skippedParams:d.skippedParams,identifiedParams:d.identifiedParams,suggestionPills:we,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:ze,isFocused:d.isFocused,isDropdownOpen:d.isDropdownOpen,isActivePillSelected:d.isActivePillSelected,placeholderText:d.placeholderText,listboxId:te,error:d.error,products:d.products,selectProduct:l.selectProduct,handleTextChange:l.handleTextChange,handleKeyDown:l.handleKeyDown,setFocused:l.setFocused,editingParam:V,editingIdentified:j,editingAnchor:d.editingAnchor,caretOffset:d.caretOffset,startEditingParam:l.startEditingParam,exitEditMode:l.exitEditMode,handleCaretAfterInput:l.handleCaretAfterInput,handleCaretMove:l.handleCaretMove,replaceEditingRange:l.replaceEditingRange,inputProps:{value:he,placeholder:d.placeholderText||void 0,onChange:y,onKeyDown:T,onFocus:l.handleFocus,onBlur:l.handleBlur,role:"combobox","aria-expanded":d.isDropdownOpen,"aria-activedescendant":Ae,"aria-autocomplete":"list","aria-controls":te},reset:l.reset,dropdownProps:{suggestions:Ne?[{...Ne,options:d.filteredOptions}]:[],activeIndex:d.activeDropdownIndex,onSelect:l.selectOption,onHighlight:l.setActiveDropdownIndex,isOpen:d.isDropdownOpen,id:te,pills:Ve,activeSelected:d.isActivePillSelected,onPillClick:l.setActivePill,onSkip:l.skipActivePill,showSkipButton:(x??!0)&&!V&&!j,skipDisabled:d.inSelectionAnimation,isLoading:ze,isInputEmpty:he.trim().length===0,products:d.products,onProductSelect:l.selectProduct,onProductFocusChange:l.setFocused,formatType:d.activeFormatType,dateView:d.dateView,selectedDateIso:Le.selectedIso,selectedDateRange:Le.selectedRange,dateRangeStart:Le.rangeStart,onPreviousMonth:l.showPreviousMonth,onNextMonth:l.showNextMonth,optionsPosition:w??"below"}}}var K=require("@magicx-eng/ai-autocomplete-vanilla"),P=require("react"),$e;function aa(){if($e!==void 0)return $e;if(typeof document>"u")return!1;let e=document.createElement("div");return e.setAttribute("contenteditable","plaintext-only"),$e=e.contentEditable==="plaintext-only",$e}function Et(e){let{segments:o,newParamId:a,editingParam:n,editingIdentified:r,editingAnchor:i,caretOffset:s,placeholderText:f,isFocused:b,isDropdownOpen:w,listboxId:k,activeDescendantId:p,autoFocus:x,handleTextChange:_,handleKeyDown:v,handleCaretAfterInput:L,handleCaretMove:M,startEditingParam:ie,replaceEditingRange:ne,setFocused:W}=e,A=(0,P.useRef)(null),re=(0,P.useRef)(!1),se=(0,P.useRef)(""),u=(0,P.useRef)(""),be=(0,P.useRef)(null),le=(0,P.useRef)(0);be.current=s,(0,P.useEffect)(()=>{if(!x)return;let t=A.current;if(!t)return;document.activeElement===t?W(!0):t.focus();let c=t.ownerDocument??document,h=c.getSelection(),l=h&&h.rangeCount>0&&t.contains(h.anchorNode);if(h&&!l){let y=c.createRange();y.selectNodeContents(t),y.collapse(!0),h.removeAllRanges(),h.addRange(y)}},[x,W]),(0,P.useEffect)(()=>{let t=A.current;if(!t)return;let c=t.ownerDocument??document,h=()=>{let l=c.getSelection();if(!l||l.rangeCount===0||!l.anchorNode||!t.contains(l.anchorNode))return;let y=l.anchorNode,T=y.nodeType===Node.ELEMENT_NODE?y:y.parentElement,d=(l.isCollapsed?T?.closest("strong[data-param-id]"):null)?.dataset.paramId??null,he=n?.id??r?.id??null;if(d&&d!==he){ie(d);return}performance.now()-le.current<50||M((0,K.getCursorOffset)(t))};return c.addEventListener("selectionchange",h),()=>c.removeEventListener("selectionchange",h)},[n,r,ie,M]),(0,P.useLayoutEffect)(()=>{let t=A.current;t&&(0,K.renderEditableContent)({input:t,segments:o,newParamId:a,editingParamId:n?.id??null,placeholderText:f??"",isFocused:b})},[o,a,n,f,b]),(0,P.useLayoutEffect)(()=>{let t=se.current,c=a??"";if(se.current=c,!c||c===t)return;let h=A.current;if(!h)return;h.focus();let l=be.current??(0,K.plainTextLength)(h);(0,K.setCursorOffset)(h,l)},[a]),(0,P.useLayoutEffect)(()=>{let t=u.current,c=n?.id??"";if(u.current=c,!c||c===t||i==null)return;let h=A.current;h&&(0,K.setCursorOffset)(h,i)},[n,i]);let N=(0,P.useCallback)(()=>{if(re.current)return;let t=A.current;if(!t)return;let c=(0,K.extractPlainText)(t),l=c.length>0&&c[0]!==c[0].toUpperCase()?c[0].toUpperCase()+c.slice(1):c;_(l)},[_]),Z=(0,P.useCallback)(()=>{le.current=performance.now(),N();let t=A.current;t&&L((0,K.getCursorOffset)(t))},[N,L]);(0,P.useEffect)(()=>{let t=A.current;if(!t)return;let c=h=>{let l=h,y=l.inputType;if(y==="insertParagraph"||y==="insertLineBreak"||y==="insertFromDrop"){h.preventDefault();return}if(y.startsWith("insert")||y.startsWith("delete")){let T=y.startsWith("delete")?"":l.data??"";ne(T)&&h.preventDefault()}};return t.addEventListener("beforeinput",c),()=>t.removeEventListener("beforeinput",c)},[ne]);let de=(0,P.useCallback)(()=>{re.current=!0},[]),ce=(0,P.useCallback)(()=>{re.current=!1,N()},[N]),J=(0,P.useCallback)(t=>{t.preventDefault();let c=A.current;if(!c)return;let h=(t.clipboardData.getData("text/plain")??"").replace(/\r?\n/g," ");if(!h)return;let l=c.ownerDocument??document,y=l.getSelection();if(!y||y.rangeCount===0)return;let T=y.getRangeAt(0);if(!c.contains(T.startContainer))return;T.deleteContents();let U=l.createTextNode(h);T.insertNode(U),T.setStartAfter(U),T.collapse(!0),y.removeAllRanges(),y.addRange(T),N()},[N]),ee=(0,P.useCallback)(t=>v(t),[v]),G=(0,P.useCallback)(()=>W(!0),[W]),pe=(0,P.useCallback)(()=>W(!1),[W]),ve=(0,P.useCallback)(()=>A.current?.focus(),[]),z=(0,P.useCallback)(()=>A.current?.blur(),[]),q=(0,P.useCallback)(()=>{let t=A.current;return t?(0,K.extractPlainText)(t):""},[]),ue=aa()?"plaintext-only":"true";return{inputRef:A,editorProps:{ref:A,contentEditable:ue,suppressContentEditableWarning:!0,tabIndex:0,role:"combobox","aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":k,"aria-expanded":w,"aria-activedescendant":p,spellCheck:!0,enterKeyHint:"send",onInput:Z,onKeyDown:ee,onCompositionStart:de,onCompositionEnd:ce,onPaste:J,onFocus:G,onBlur:pe},getPlainText:q,focus:ve,blur:z}}var X=require("react/jsx-runtime");function oa(e){return e!=="auto"?e:typeof window>"u"||window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}var Tt=(0,E.forwardRef)(function({onSubmit:o,onResult:a,onError:n,optionOverrides:r,maskCompletedText:i,className:s,apiConfig:f,additionalContext:b,columns:w,pillPlacement:k="dropdown",mode:p="auto",optionsPosition:x="below",animations:_=!0,dropdownTrigger:v,closeDropdownOnBlur:L,showNonTappableOptions:M,showSkipButton:ie,autoFocus:ne=!0,onFocus:W,onBlur:A,value:re,completedParams:se,onChange:u,onParamsChange:be,products:le,onProductSelect:N,submitButton:Z},de){let ce=(0,E.useRef)(null),J=(0,E.useRef)(null),ee=(0,E.useRef)(()=>{}),G=(0,E.useRef)(null),pe=(0,E.useRef)(null);(0,E.useEffect)(()=>{let S=ce.current;if(S)return G.current?G.current.setMode(p):G.current=new Te.ModeController(S,p),()=>{G.current?.destroy(),G.current=null}},[p]);let ve=(0,E.useCallback)(S=>{let ye=pe.current?.current;ye&&(ye.focus(),(0,Te.setCursorOffset)(ye,S))},[]),{completedParams:z,skippedParams:q,identifiedParams:ue,isReady:t,suggestionPills:c,setActivePill:h,skipActivePill:l,segments:y,newParamId:T,clearNewParamId:U,placeholderText:d,isFocused:he,isDropdownOpen:Ie,isActivePillSelected:we,isLoading:xe,activeIndex:te,listboxId:Ae,handleTextChange:V,handleKeyDown:j,setFocused:Re,editingParam:Ne,editingIdentified:Ve,editingAnchor:Le,caretOffset:ze,startEditingParam:m,handleCaretAfterInput:$,handleCaretMove:R,replaceEditingRange:Qe,dropdownProps:Rt,reset:Be}=je({onSubmit:S=>ee.current(S),onResult:a,onError:n,optionOverrides:r,maskCompletedText:i,apiConfig:f,additionalContext:b,columns:w,dropdownTrigger:v,optionsPosition:x,closeDropdownOnBlur:L,showNonTappableOptions:M,showSkipButton:ie,onFocus:W,onBlur:A,value:re,completedParams:se,onChange:u,onParamsChange:be,products:le,onProductSelect:N,source:"full-sdk",setCursor:ve});(0,E.useEffect)(()=>{if(!T)return;let S=window.setTimeout(()=>U(),650);return()=>window.clearTimeout(S)},[T,U]);let Lt=te>=0?`${Ae}-option-${te}`:void 0,{inputRef:Ye,editorProps:Ot,focus:Ge,blur:nt,getPlainText:rt}=Et({segments:y,newParamId:T,editingParam:Ne,editingIdentified:Ve,editingAnchor:Le,caretOffset:ze,placeholderText:d,isFocused:he,isDropdownOpen:Ie,listboxId:Ae,activeDescendantId:Lt,autoFocus:ne,handleTextChange:V,handleKeyDown:j,handleCaretAfterInput:$,handleCaretMove:R,startEditingParam:m,replaceEditingRange:Qe,setFocused:Re});pe.current=Ye,(0,E.useLayoutEffect)(()=>{let S=J.current,ye=Ye.current;if(!S||!ye)return;let st=()=>{let dt=S.firstElementChild;if(!dt)return;let Bt=dt.getBoundingClientRect(),Gt=ye.getBoundingClientRect();Bt.top>=Gt.bottom-2?S.setAttribute("data-aia-pill-wrapped",""):S.removeAttribute("data-aia-pill-wrapped")};st();let lt=new ResizeObserver(st);return lt.observe(ye),()=>lt.disconnect()},[y,c.length,xe,Ye]),(0,E.useImperativeHandle)(de,()=>({focus:Ge,blur:nt,reset:Be,setMode:S=>G.current?.setMode(S),skipActivePill:l}),[Ge,nt,Be,l]);let Fe=!!y.length||z.length>0,Xe=(0,E.useCallback)(()=>{if(!Fe)return;let S=rt();o((0,Te.buildSubmitResult)(S,z,q,{identifiedParams:ue,isReady:t})),Be()},[Fe,z,q,ue,t,o,Be,rt]);ee.current=Xe;let Mt=(0,E.useCallback)(S=>{S.target?.closest("[data-aia-pill]")||Ge()},[Ge]),Nt=k==="inline",zt=k==="dropdown";return(0,X.jsxs)("div",{ref:ce,className:`magicx-aia ${ke.container} ${s??""}`,"data-pill-placement":k,"data-options-position":x,"data-animations":_?"on":"off","data-mode":oa(p),children:[(0,X.jsx)(qe,{...Rt,showPills:zt}),(0,X.jsxs)("div",{className:ke.inputWrapper,onClick:Mt,children:[(0,X.jsxs)("div",{className:ke.editorArea,"data-aia-editor":"",children:[(0,X.jsx)("div",{...Ot,className:ke.input,"data-aia-input":""}),Nt&&(xe||c.length>0)&&(0,X.jsx)("span",{ref:J,className:ke.pillListContainer,"data-aia-pill-list-container":"",children:(0,X.jsx)(Ke,{pills:c,activePillIndex:0,activeSelected:we,onSelectPill:h,loading:xe})})]}),Z===null?null:Z===void 0?(0,X.jsx)(St,{disabled:!Fe,onClick:Xe}):(0,X.jsx)("span",{"data-aia-submit":"",className:ke.submitSlot,onClick:S=>{Fe&&(S.stopPropagation(),Xe())},children:Z})]})]})});0&&(module.exports={AIAutocomplete,AIAutocompleteDropdown,DATE_RANGE_META_END,DATE_RANGE_META_START,WEEKDAY_LABELS,buildSubmitResult,cellDay,cellIso,dateCellMarks,formatDate,formatDateRange,isoDate,monthLabel,parseDate,parseLooseDate,parseLooseDateRange,selectedRangeFor,useAIAutocomplete,visibleDateRange,withSkippedParams});
|
|
1612
1597
|
//# sourceMappingURL=index.js.map
|