@magicx-eng/ai-autocomplete-react 0.13.0 → 0.14.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 +35 -16
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +200 -275
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +200 -275
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var Qe=Object.defineProperty;var
|
|
1
|
+
"use strict";var Qe=Object.defineProperty;var Nt=Object.getOwnPropertyDescriptor;var zt=Object.getOwnPropertyNames;var Ot=Object.prototype.hasOwnProperty;var Bt=(e,o)=>{for(var t in o)Qe(e,t,{get:o[t],enumerable:!0})},Ft=(e,o,t,i)=>{if(o&&typeof o=="object"||typeof o=="function")for(let r of zt(o))!Ot.call(e,r)&&r!==t&&Qe(e,r,{get:()=>o[r],enumerable:!(i=Nt(o,r))||i.enumerable});return e};var Gt=e=>Ft(Qe({},"__esModule",{value:!0}),e);var Jt={};Bt(Jt,{AIAutocomplete:()=>St,AIAutocompleteDropdown:()=>We,WEEKDAY_LABELS:()=>C.WEEKDAY_LABELS,buildSubmitResult:()=>C.buildSubmitResult,cellDay:()=>C.cellDay,cellIso:()=>C.cellIso,formatDate:()=>C.formatDate,isoDate:()=>C.isoDate,monthLabel:()=>C.monthLabel,parseDate:()=>C.parseDate,parseLooseDate:()=>C.parseLooseDate,useAIAutocomplete:()=>qe,withSkippedParams:()=>C.withSkippedParams});module.exports=Gt(Jt);var C=require("@magicx-eng/ai-autocomplete-vanilla");var T=require("react");if(typeof document<"u"&&!document.getElementById("ac-style-67791514")){let e=document.createElement("style");e.id="ac-style-67791514",e.textContent=`.AIAutocomplete-module_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
|
|
@@ -133,12 +133,26 @@
|
|
|
133
133
|
color: inherit;
|
|
134
134
|
}
|
|
135
135
|
|
|
136
|
-
/* Placeholder via ::before so it doesn't enter the editable DOM.
|
|
136
|
+
/* Placeholder via ::before so it doesn't enter the editable DOM. The text is
|
|
137
|
+
typed in one character at a time by the core's typewriter (the attribute
|
|
138
|
+
holds the typed prefix); the only fade is the outgoing phrase when the
|
|
139
|
+
placeholder changes \u2014 its duration mirrors PLACEHOLDER_FADE_OUT_MS. */
|
|
137
140
|
.AIAutocomplete-module_input_IW-P-[data-aia-empty="true"][data-placeholder]::before {
|
|
138
141
|
content: attr(data-placeholder);
|
|
139
142
|
color: var(--aia-color-text-muted, #c1c4cb);
|
|
140
143
|
opacity: 0.7;
|
|
141
144
|
pointer-events: none;
|
|
145
|
+
transition: opacity var(--aia-placeholder-fade, 120ms) ease-out;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
.AIAutocomplete-module_input_IW-P-[data-aia-placeholder-leaving]::before {
|
|
149
|
+
opacity: 0;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
@media (prefers-reduced-motion: reduce) {
|
|
153
|
+
.AIAutocomplete-module_input_IW-P-[data-aia-empty="true"][data-placeholder]::before {
|
|
154
|
+
transition-duration: 0s;
|
|
155
|
+
}
|
|
142
156
|
}
|
|
143
157
|
|
|
144
158
|
/* Empty inline contentEditables have no inline box for the caret to render
|
|
@@ -179,7 +193,7 @@
|
|
|
179
193
|
opacity: 0;
|
|
180
194
|
}
|
|
181
195
|
}
|
|
182
|
-
`,document.head.appendChild(e)}var
|
|
196
|
+
`,document.head.appendChild(e)}var Pe={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 Ke=require("@magicx-eng/ai-autocomplete-vanilla"),Z=require("react");if(typeof document<"u"&&!document.getElementById("ac-style-0ae03977")){let e=document.createElement("style");e.id="ac-style-0ae03977",e.textContent=`/*
|
|
183
197
|
* Built-in appearance defaults \u2014 zero specificity via :where().
|
|
184
198
|
* Consumer CSS always wins without !important.
|
|
185
199
|
*
|
|
@@ -241,8 +255,8 @@
|
|
|
241
255
|
--aia-border: rgba(17, 24, 39, 0.14); /* subtle slate hairline (off-palette) */
|
|
242
256
|
/* Elevation for the input container (.inputWrapper). */
|
|
243
257
|
--aia-shadow:
|
|
244
|
-
inset 0 1px 0 rgba(255, 255, 255, 0.9), 0 1px 2px rgba(16, 24, 40, 0.
|
|
245
|
-
0 8px 24px rgba(16, 24, 40, 0.
|
|
258
|
+
inset 0 1px 0 rgba(255, 255, 255, 0.9), 0 1px 2px rgba(16, 24, 40, 0.05),
|
|
259
|
+
0 8px 24px rgba(16, 24, 40, 0.08);
|
|
246
260
|
/* Half-strength stroke: neutral-900 (was #e5e7eb \u2014 snapped to palette,
|
|
247
261
|
\u03942) at 50% alpha over the surface, so the hairline lands exactly
|
|
248
262
|
halfway between its old value and the white behind it. */
|
|
@@ -284,7 +298,6 @@
|
|
|
284
298
|
--aia-skeleton-bg: var(--aia-primitive-neutral-750-a25);
|
|
285
299
|
|
|
286
300
|
--aia-streak-rgb: 99, 102, 241; /* off shared palette (indigo effect) */
|
|
287
|
-
--aia-streak-glass-bg: rgba(99, 102, 241, 0.1);
|
|
288
301
|
|
|
289
302
|
--aia-footer-hint-color: var(--aia-primitive-neutral-500);
|
|
290
303
|
--aia-footer-brand-color: var(--aia-primitive-neutral-700);
|
|
@@ -298,8 +311,8 @@
|
|
|
298
311
|
/* Elevation for the input container (.inputWrapper) \u2014 tuned for dark surfaces:
|
|
299
312
|
a faint top highlight + deeper ambient shadows. */
|
|
300
313
|
--aia-shadow:
|
|
301
|
-
inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 1px 2px rgba(0, 0, 0, 0.
|
|
302
|
-
0 8px 24px rgba(0, 0, 0, 0.
|
|
314
|
+
inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 1px 2px rgba(0, 0, 0, 0.2),
|
|
315
|
+
0 8px 24px rgba(0, 0, 0, 0.25);
|
|
303
316
|
/* Half-strength stroke \u2014 neutral-400 (was #484848 \u2014 snapped to palette,
|
|
304
317
|
\u03942) at 50% alpha; see the light-mode note above. */
|
|
305
318
|
--aia-dropdown-border: var(--aia-primitive-neutral-400-a50);
|
|
@@ -339,7 +352,6 @@
|
|
|
339
352
|
--aia-skeleton-bg: var(--aia-primitive-neutral-150);
|
|
340
353
|
|
|
341
354
|
--aia-streak-rgb: 255, 255, 255;
|
|
342
|
-
--aia-streak-glass-bg: rgba(255, 255, 255, 0.1);
|
|
343
355
|
|
|
344
356
|
--aia-footer-hint-color: var(--aia-primitive-neutral-700);
|
|
345
357
|
--aia-footer-brand-color: var(--aia-primitive-neutral-500);
|
|
@@ -457,6 +469,9 @@
|
|
|
457
469
|
--aia-grid-scroll-top: var(--aia-footer-band);
|
|
458
470
|
--aia-grid-overlap-top: calc(-1 * (var(--aia-footer-band) + 8px));
|
|
459
471
|
--aia-footer-fade-inset: 0 0 calc(-1 * var(--aia-footer-fade-lead));
|
|
472
|
+
/* The unfold flips with the stack: the collapsed sliver sits at the panel's
|
|
473
|
+
bottom edge (against the input) and expands upward out of it. */
|
|
474
|
+
transform-origin: 50% 100%;
|
|
460
475
|
top: auto;
|
|
461
476
|
bottom: 100%;
|
|
462
477
|
margin-top: 0;
|
|
@@ -493,7 +508,7 @@
|
|
|
493
508
|
bottom edge \u2014 the side the option rows scroll under. */
|
|
494
509
|
:where(.magicx-aia[data-options-position="above"]) [data-aia-dropdown] [data-aia-footer],
|
|
495
510
|
[data-aia-dropdown][data-options-position="above"] [data-aia-footer] {
|
|
496
|
-
padding: 0
|
|
511
|
+
padding: 0 0 var(--aia-footer-gap, 8px) 8px;
|
|
497
512
|
}
|
|
498
513
|
|
|
499
514
|
/* ...and the fade runs the other way, out of the footer and down into the list. */
|
|
@@ -509,6 +524,21 @@
|
|
|
509
524
|
animation-duration: 0s !important;
|
|
510
525
|
transition-duration: 0s !important;
|
|
511
526
|
}
|
|
527
|
+
|
|
528
|
+
/* Desktop footer is opaque: the option list clips at the footer's edge instead
|
|
529
|
+
of showing through it \u2014 the scroll cue lives in the last visible row's own
|
|
530
|
+
text instead (the option scroll-hint rule). Mobile keeps the fade. Declared
|
|
531
|
+
last, and carrying the unwrapped above-position selector some copies use
|
|
532
|
+
(so it ties that rule's higher specificity and wins on cascade order);
|
|
533
|
+
the glass surface still hides this pseudo-element entirely. */
|
|
534
|
+
@media (min-width: 769px) {
|
|
535
|
+
[data-aia-dropdown] [data-aia-footer]::before,
|
|
536
|
+
[data-aia-dropdown][data-options-position="above"] [data-aia-footer]::before,
|
|
537
|
+
:where(.magicx-aia[data-options-position="above"]) [data-aia-dropdown] [data-aia-footer]::before {
|
|
538
|
+
inset: 0;
|
|
539
|
+
background: var(--aia-surface, #ffffff);
|
|
540
|
+
}
|
|
541
|
+
}
|
|
512
542
|
`,document.head.appendChild(e)}if(typeof document<"u"&&!document.getElementById("ac-style-3819c762")){let e=document.createElement("style");e.id="ac-style-3819c762",e.textContent=`.AIAutocompleteDropdown-module_dropdown_yz2KC {
|
|
513
543
|
position: absolute;
|
|
514
544
|
left: 0;
|
|
@@ -526,7 +556,17 @@
|
|
|
526
556
|
z-index: 10;
|
|
527
557
|
opacity: 0;
|
|
528
558
|
pointer-events: none;
|
|
529
|
-
|
|
559
|
+
/* Closed, the panel rests as a near-zero-height sliver at the input's edge
|
|
560
|
+
(scaleY only \u2014 full width), so opening unfolds it top-to-bottom out of the
|
|
561
|
+
input. The origin flips to the bottom edge for optionsPosition="above" \u2014
|
|
562
|
+
see appearance.css. The transform "transition" on THIS side is a delayed
|
|
563
|
+
snap: while closing, the panel holds its full size for the whole 400ms
|
|
564
|
+
fade and only then collapses, ready for the next open. */
|
|
565
|
+
transform-origin: 50% 0;
|
|
566
|
+
transform: scaleY(var(--aia-dropdown-reveal-scale, 0.02));
|
|
567
|
+
transition:
|
|
568
|
+
opacity 400ms cubic-bezier(0.4, 0, 0.2, 1),
|
|
569
|
+
transform 0s 400ms;
|
|
530
570
|
/* Solid surface is the default (matches the Figma components). Opt into the
|
|
531
571
|
frosted-glass look with data-aia-surface="glass". */
|
|
532
572
|
background: var(--aia-surface, #ffffff);
|
|
@@ -535,6 +575,14 @@
|
|
|
535
575
|
box-shadow: var(--aia-dropdown-shadow, 0 8px 12px rgba(0, 0, 0, 0.05));
|
|
536
576
|
}
|
|
537
577
|
|
|
578
|
+
/* A calendar has nothing wide to read, so the whole panel narrows with it \u2014
|
|
579
|
+
the option grid's 544px cap leaves a month floating in empty panel. The
|
|
580
|
+
:has() argument is the datepicker's data attribute, which all three packages
|
|
581
|
+
emit identically; only the panel class differs per copy. */
|
|
582
|
+
.AIAutocompleteDropdown-module_dropdown_yz2KC:has([data-aia-datepicker]) {
|
|
583
|
+
max-width: var(--aia-date-panel-width, 312px);
|
|
584
|
+
}
|
|
585
|
+
|
|
538
586
|
.AIAutocompleteDropdown-module_dropdown_yz2KC[data-aia-surface="glass"] {
|
|
539
587
|
background: transparent;
|
|
540
588
|
border-color: transparent;
|
|
@@ -552,9 +600,76 @@
|
|
|
552
600
|
backdrop-filter: blur(30px);
|
|
553
601
|
}
|
|
554
602
|
|
|
603
|
+
/* Opening: the panel unfolds top-to-bottom out of the input with a single
|
|
604
|
+
spring settle while the option rows cascade in on top of it. Closing keeps
|
|
605
|
+
the longer fade so a populated panel dissolves as one (the base rule above
|
|
606
|
+
delays the transform snap until that fade has finished). */
|
|
555
607
|
.AIAutocompleteDropdown-module_visible_QCoXj {
|
|
556
608
|
opacity: 1;
|
|
557
609
|
pointer-events: auto;
|
|
610
|
+
transform: scaleY(1);
|
|
611
|
+
/* Spring: the easing overshoots full height by a few percent and settles
|
|
612
|
+
once (P1y = 1.28 \u2014 one spring, no bounce). Opacity resolves almost
|
|
613
|
+
immediately so the unfold, not a fade, is what reads. */
|
|
614
|
+
transition:
|
|
615
|
+
opacity 100ms cubic-bezier(0.4, 0, 0.2, 1),
|
|
616
|
+
transform 320ms cubic-bezier(0.22, 1.28, 0.36, 1);
|
|
617
|
+
}
|
|
618
|
+
|
|
619
|
+
/* "More below" scroll arrow \u2014 see the core's render/scrollArrow.ts. A round
|
|
620
|
+
disc at the bottom-centre of the option list, shown while the list can still
|
|
621
|
+
scroll down. It rests just above the grid's reserved band
|
|
622
|
+
(--aia-scroll-arrow-bottom is measured and set inline by the controller so it
|
|
623
|
+
tracks the grid's bottom edge in every layout) and hides by sliding down past
|
|
624
|
+
the dropdown's lower edge, where the dropdown's overflow clips it \u2014 so it
|
|
625
|
+
emerges from behind the footer. z-index 2 puts it over the option rows and
|
|
626
|
+
under the footer (z-index 3). Declarations mirror vanilla's
|
|
627
|
+
.magicx-aia-scroll-arrow and Angular's copy \u2014 change all three in the same
|
|
628
|
+
commit. */
|
|
629
|
+
.AIAutocompleteDropdown-module_scrollArrow_uUzV0 {
|
|
630
|
+
position: absolute;
|
|
631
|
+
left: 50%;
|
|
632
|
+
bottom: var(--aia-scroll-arrow-bottom, 8px);
|
|
633
|
+
z-index: 2;
|
|
634
|
+
display: inline-flex;
|
|
635
|
+
align-items: center;
|
|
636
|
+
justify-content: center;
|
|
637
|
+
width: 32px;
|
|
638
|
+
height: 32px;
|
|
639
|
+
margin: 0 0 0 -16px;
|
|
640
|
+
padding: 0;
|
|
641
|
+
border: 1px solid
|
|
642
|
+
var(--aia-scroll-arrow-border, var(--aia-dropdown-border, rgba(231, 231, 231, 0.5)));
|
|
643
|
+
border-radius: 50%;
|
|
644
|
+
background: var(--aia-scroll-arrow-bg, var(--aia-surface, #ffffff));
|
|
645
|
+
color: var(
|
|
646
|
+
--aia-scroll-arrow-color,
|
|
647
|
+
var(--aia-option-color, var(--aia-color-text-muted, #c1c4cb))
|
|
648
|
+
);
|
|
649
|
+
box-shadow: var(--aia-scroll-arrow-shadow, 0 2px 8px rgba(0, 0, 0, 0.12));
|
|
650
|
+
cursor: pointer;
|
|
651
|
+
pointer-events: none;
|
|
652
|
+
transform: translateY(calc(100% + var(--aia-scroll-arrow-bottom, 8px) + 4px));
|
|
653
|
+
transition: transform 180ms cubic-bezier(0.4, 0, 0.2, 1);
|
|
654
|
+
}
|
|
655
|
+
|
|
656
|
+
.AIAutocompleteDropdown-module_scrollArrow_uUzV0[data-aia-visible] {
|
|
657
|
+
pointer-events: auto;
|
|
658
|
+
transform: translateY(0);
|
|
659
|
+
}
|
|
660
|
+
|
|
661
|
+
.AIAutocompleteDropdown-module_scrollArrow_uUzV0:hover {
|
|
662
|
+
color: var(
|
|
663
|
+
--aia-scroll-arrow-color-hover,
|
|
664
|
+
var(--aia-option-color-selected, var(--aia-color-text-default, #fff))
|
|
665
|
+
);
|
|
666
|
+
}
|
|
667
|
+
|
|
668
|
+
@media (prefers-reduced-motion: reduce) {
|
|
669
|
+
.AIAutocompleteDropdown-module_scrollArrow_uUzV0,
|
|
670
|
+
.AIAutocompleteDropdown-module_dropdown_yz2KC {
|
|
671
|
+
transition-duration: 0s;
|
|
672
|
+
}
|
|
558
673
|
}
|
|
559
674
|
|
|
560
675
|
/* The dropdown container owns the 10px/8px edge padding and the 8px section
|
|
@@ -665,7 +780,7 @@
|
|
|
665
780
|
opacity: 0.25;
|
|
666
781
|
}
|
|
667
782
|
}
|
|
668
|
-
`,document.head.appendChild(e)}var
|
|
783
|
+
`,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 F=require("@magicx-eng/ai-autocomplete-vanilla"),st=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) ---
|
|
669
784
|
|
|
670
785
|
One of three hand-maintained copies (vanilla styles.css, this file, Angular's
|
|
671
786
|
date-grid.component.css). Only the class-naming layer differs \u2014 the
|
|
@@ -683,7 +798,10 @@
|
|
|
683
798
|
display: flex;
|
|
684
799
|
flex-direction: column;
|
|
685
800
|
gap: 4px;
|
|
686
|
-
|
|
801
|
+
/* Bottom-heavier trim than the top: the compression the compact calendar
|
|
802
|
+
asks for comes out of the bottom edge and the space between cells, never
|
|
803
|
+
the header area or the side gutters. */
|
|
804
|
+
padding: 4px 2px 4px;
|
|
687
805
|
}
|
|
688
806
|
|
|
689
807
|
.DateGrid-module_header_z4LRk {
|
|
@@ -761,9 +879,9 @@
|
|
|
761
879
|
min-width: 0;
|
|
762
880
|
/* Keeps a month readable in a narrow dropdown without letting a 6-row month
|
|
763
881
|
grow the panel past the options grid it replaces. */
|
|
764
|
-
height: var(--aia-date-row-height,
|
|
882
|
+
height: var(--aia-date-row-height, 28px);
|
|
765
883
|
font-family: inherit;
|
|
766
|
-
font-size: var(--aia-date-cell-font-size,
|
|
884
|
+
font-size: var(--aia-date-cell-font-size, 13px);
|
|
767
885
|
font-weight: 450;
|
|
768
886
|
line-height: 20px;
|
|
769
887
|
color: var(--aia-option-color, var(--aia-color-text-muted, #c1c4cb));
|
|
@@ -775,9 +893,9 @@
|
|
|
775
893
|
display: flex;
|
|
776
894
|
align-items: center;
|
|
777
895
|
justify-content: center;
|
|
778
|
-
width: var(--aia-date-cell-size,
|
|
779
|
-
height: var(--aia-date-cell-size,
|
|
780
|
-
border-radius:
|
|
896
|
+
width: var(--aia-date-cell-size, 26px);
|
|
897
|
+
height: var(--aia-date-cell-size, 26px);
|
|
898
|
+
border-radius: 6px;
|
|
781
899
|
}
|
|
782
900
|
|
|
783
901
|
.DateGrid-module_day_cB3u9 {
|
|
@@ -788,6 +906,12 @@
|
|
|
788
906
|
cursor: default;
|
|
789
907
|
}
|
|
790
908
|
|
|
909
|
+
/* A day before today: dimmed so the month visibly starts at today, but still
|
|
910
|
+
fully interactive \u2014 hover and click behave like any other day. */
|
|
911
|
+
.DateGrid-module_past_CEZsj {
|
|
912
|
+
opacity: 0.35;
|
|
913
|
+
}
|
|
914
|
+
|
|
791
915
|
.DateGrid-module_day_cB3u9:hover .DateGrid-module_number_aoT01,
|
|
792
916
|
.DateGrid-module_highlighted_YIdtK .DateGrid-module_number_aoT01 {
|
|
793
917
|
color: var(--aia-option-color-selected, var(--aia-color-text-default, #fff));
|
|
@@ -812,7 +936,7 @@
|
|
|
812
936
|
opacity: 0.8;
|
|
813
937
|
background: rgba(var(--aia-streak-rgb, 255, 255, 255), 0.06);
|
|
814
938
|
}
|
|
815
|
-
`,document.head.appendChild(e)}var
|
|
939
|
+
`,document.head.appendChild(e)}var E={datepicker:"DateGrid-module_datepicker_6RrTs",header:"DateGrid-module_header_z4LRk",month:"DateGrid-module_month_urB2T",nav:"DateGrid-module_nav_ap4AN",weekdays:"DateGrid-module_weekdays_3EA3q",grid:"DateGrid-module_grid_mQCgw",weekday:"DateGrid-module_weekday_3lF4B",cell:"DateGrid-module_cell_59k0y",number:"DateGrid-module_number_aoT01",day:"DateGrid-module_day_cB3u9",blank:"DateGrid-module_blank_ivgRC",past:"DateGrid-module_past_CEZsj",highlighted:"DateGrid-module_highlighted_YIdtK",today:"DateGrid-module_today_iI3ME",selected:"DateGrid-module_selected_28KDn",pressed:"DateGrid-module_pressed_bEyyN"};var B=require("react/jsx-runtime"),Ht=["sunday","monday","tuesday","wednesday","thursday","friday","saturday"];function lt({options:e,activeIndex:o,listboxId:t,view:i,selectedIso:r,onSelect:a,onHighlight:s,onPreviousMonth:g,onNextMonth:b}){let v=(0,F.isoDate)(new Date);return(0,B.jsxs)("div",{className:E.datepicker,"data-aia-datepicker":"",children:[(0,B.jsxs)("div",{className:E.header,children:[(0,B.jsx)("button",{type:"button",tabIndex:-1,className:E.nav,"data-aia-date-prev":"","aria-label":"Previous month",onMouseDown:m=>m.preventDefault(),onClick:g,children:"\u2039"}),(0,B.jsx)("span",{className:E.month,"data-aia-date-month":"","aria-live":"polite",children:(0,F.monthLabel)(i)}),(0,B.jsx)("button",{type:"button",tabIndex:-1,className:E.nav,"data-aia-date-next":"","aria-label":"Next month",onMouseDown:m=>m.preventDefault(),onClick:b,children:"\u203A"})]}),(0,B.jsx)("div",{className:E.weekdays,"aria-hidden":"true",children:F.WEEKDAY_LABELS.map((m,y)=>(0,B.jsx)("span",{className:E.weekday,children:m},Ht[y]))}),(0,B.jsx)("div",{className:E.grid,"data-aia-date-grid":"",children:e.map((m,y)=>(0,B.jsx)(Kt,{option:m,id:`${t}-option-${y}`,index:y,isHighlighted:y===o&&m.is_tappable,isToday:(0,F.cellIso)(m)===v,isPast:(0,F.cellIso)(m)!=null&&(0,F.cellIso)(m)<v,isSelected:r!=null&&(0,F.cellIso)(m)===r,onSelect:a,onHighlight:s},(0,F.cellIso)(m)??`pad-${y}`))})]})}function Kt({option:e,id:o,index:t,isHighlighted:i,isToday:r,isPast:a,isSelected:s,onSelect:g,onHighlight:b}){let[v,m]=(0,st.useState)(!1),y=(0,F.cellDay)(e);if(y==null)return(0,B.jsx)("div",{id:o,role:"option","data-aia-option":"","data-aia-date-cell":"","aria-hidden":"true","aria-selected":!1,tabIndex:-1,className:`${E.cell} ${E.blank}`});let I=()=>{m(!0),g(e),setTimeout(()=>m(!1),500)},w=[E.cell,E.day,a?E.past:"",i?E.highlighted:"",r?E.today:"",s?E.selected:"",v?E.pressed:""].filter(Boolean).join(" ");return(0,B.jsx)("div",{id:o,role:"option","data-aia-option":"","data-aia-date-cell":"","aria-selected":i,"aria-label":e.text,tabIndex:0,className:w,onClick:I,onKeyDown:f=>{(f.key==="Enter"||f.key===" ")&&(f.preventDefault(),I())},onMouseEnter:()=>b(t),children:(0,B.jsx)("span",{className:E.number,children:y})})}var Ce=require("@magicx-eng/ai-autocomplete-vanilla"),Fe=require("react");if(typeof document<"u"&&!document.getElementById("ac-style-5259a217")){let e=document.createElement("style");e.id="ac-style-5259a217",e.textContent=`@layer layout {
|
|
816
940
|
.aia-cluster {
|
|
817
941
|
display: flex;
|
|
818
942
|
flex-wrap: wrap;
|
|
@@ -854,7 +978,7 @@
|
|
|
854
978
|
justify-content: space-around;
|
|
855
979
|
}
|
|
856
980
|
}
|
|
857
|
-
`,document.head.appendChild(e)}var
|
|
981
|
+
`,document.head.appendChild(e)}var Xe=require("react/jsx-runtime");function Le({gap:e,align:o="center",justify:t="start",noWrap:i=!1,inline:r=!1,className:a,children:s,...g}){let b=e?{"--aia-cluster-gap":e}:void 0,v={className:a?`aia-cluster ${a}`:"aia-cluster","data-align":o,"data-justify":t,"data-nowrap":i||void 0,"data-inline":r||void 0,style:b,...g};return r?(0,Xe.jsx)("span",{...v,children:s}):(0,Xe.jsx)("div",{...v,children:s})}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
|
|
858
982
|
dropdown's rounded edges. The top inset (--aia-footer-gap) adds breathing
|
|
859
983
|
room above the hint/branding row so the footer doesn't butt against the last
|
|
860
984
|
option row \u2014 additive to the dropdown's 8px section gap. */
|
|
@@ -862,7 +986,11 @@
|
|
|
862
986
|
display: flex;
|
|
863
987
|
flex-direction: column;
|
|
864
988
|
gap: 8px;
|
|
865
|
-
|
|
989
|
+
/* No right inset: the brand pill's own padding (below) supplies it, so the
|
|
990
|
+
badge sits as far from the right edge as it does from the bottom \u2014 12px
|
|
991
|
+
both ways (dropdown padding 10 + pill 2 down, dropdown padding 8 + pill 4
|
|
992
|
+
across). */
|
|
993
|
+
padding: var(--aia-footer-gap, 8px) 0 0 8px;
|
|
866
994
|
/* The fade itself lives in appearance.css, on the footer's background.
|
|
867
995
|
Paints above the rows it covers: option content sits at z-index 2 (see
|
|
868
996
|
SuggestionItem.module.css) in this same stacking context, so anything
|
|
@@ -923,7 +1051,7 @@
|
|
|
923
1051
|
.DropdownFooter-module_brandLink_r4f3R {
|
|
924
1052
|
background: var(--aia-footer-brand-pill-bg, var(--aia-surface, #ffffff));
|
|
925
1053
|
border-radius: 999px;
|
|
926
|
-
padding: 2px
|
|
1054
|
+
padding: 2px 4px;
|
|
927
1055
|
gap: 4px;
|
|
928
1056
|
}
|
|
929
1057
|
|
|
@@ -984,7 +1112,7 @@
|
|
|
984
1112
|
justify-content: flex-end;
|
|
985
1113
|
}
|
|
986
1114
|
}
|
|
987
|
-
`,document.head.appendChild(e)}var
|
|
1115
|
+
`,document.head.appendChild(e)}var he={footer:"DropdownFooter-module_footer_qQQ7x",hintGroup:"DropdownFooter-module_hintGroup_ZzbPf",brandLink:"DropdownFooter-module_brandLink_r4f3R",key:"DropdownFooter-module_key_Bz1H-",hint:"DropdownFooter-module_hint_GKEOH",brand:"DropdownFooter-module_brand_Al-lR",badge:"DropdownFooter-module_badge_Fk9vg",row:"DropdownFooter-module_row_BgZ6Q"};var ne=require("react/jsx-runtime");function dt({isOptionHighlighted:e=!1,isInputEmpty:o=!1}){let{key:t,hint:i}=(0,Ce.getFooterHint)(e,o),[r,a]=(0,Fe.useState)(Ce.ATTRIBUTION_URL);return(0,Fe.useEffect)(()=>{a((0,Ce.buildAttributionUrl)())},[]),(0,ne.jsx)("footer",{className:he.footer,"data-aia-footer":"",children:(0,ne.jsxs)(Le,{justify:"between",noWrap:!0,className:he.row,children:[(0,ne.jsxs)(Le,{gap:"5px",className:he.hintGroup,children:[(0,ne.jsx)("kbd",{className:he.key,children:t}),(0,ne.jsx)("span",{className:he.hint,children:i})]}),(0,ne.jsxs)("a",{className:he.brandLink,href:r,target:"_blank",rel:"noopener noreferrer",children:[(0,ne.jsx)("span",{className:he.brand,children:"AI"}),(0,ne.jsx)("span",{className:he.badge,children:"Autocomplete"})]})]})})}if(typeof document<"u"&&!document.getElementById("ac-style-199d0432")){let e=document.createElement("style");e.id="ac-style-199d0432",e.textContent=`/* ParamPill (Figma "ParamPill") \u2014 unfilled suggestion pill: transparent fill,
|
|
988
1116
|
no outline. ~28px via 6px padding + 14px text + the 1px border (border-box).
|
|
989
1117
|
The border is kept as a 1px transparent line so the box stays the same size
|
|
990
1118
|
as it was when the outline was dashed. */
|
|
@@ -1041,7 +1169,7 @@
|
|
|
1041
1169
|
opacity: 0;
|
|
1042
1170
|
}
|
|
1043
1171
|
}
|
|
1044
|
-
`,document.head.appendChild(e)}var
|
|
1172
|
+
`,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 pt=require("react/jsx-runtime"),Ze={selected:1,first:.7,next:.4,last:.2};function ct({label:e,state:o,rounded:t,loading:i,onClick:r}){let a=[_e.pill,t?_e.rounded:"",i?_e.skeleton:""].filter(Boolean).join(" ");return(0,pt.jsx)("button",{type:"button","data-aia-pill":"","data-aia-loading":i?"":void 0,tabIndex:-1,contentEditable:!1,suppressContentEditableWarning:!0,className:a,style:{opacity:Ze[o]},onMouseDown:s=>s.preventDefault(),onClick:i?void 0:r,disabled:i,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 {
|
|
1045
1173
|
position: relative;
|
|
1046
1174
|
z-index: 1;
|
|
1047
1175
|
pointer-events: auto;
|
|
@@ -1051,7 +1179,7 @@
|
|
|
1051
1179
|
align-items: center;
|
|
1052
1180
|
vertical-align: middle;
|
|
1053
1181
|
}
|
|
1054
|
-
`,document.head.appendChild(e)}var
|
|
1182
|
+
`,document.head.appendChild(e)}var Je={list:"PillList-module_list_qvLqO"};var Me=require("react/jsx-runtime"),Wt=[125,69];function ut(e){return e===0?"first":e===1?"next":"last"}function Ge({pills:e,activePillIndex:o,onSelectPill:t,activeSelected:i,rounded:r,loading:a}){return a&&e.length===0?(0,Me.jsx)("span",{className:Je.list,"data-aia-pill-list-loading":"",children:Wt.map((s,g)=>(0,Me.jsx)("span",{"data-aia-pill-skeleton":"",className:`${_e.pill} ${r?_e.rounded:""} ${_e.skeleton}`,style:{width:s,opacity:Ze[ut(g)]}},`skel-${s}`))}):(0,Me.jsx)("span",{className:Je.list,"data-aia-pill-list-loading":a?"":void 0,children:e.map((s,g)=>{let b=!!i&&g===o;return(0,Me.jsx)(ct,{label:s.text,state:b?"selected":ut(g),selected:b,rounded:r,loading:a,onClick:()=>t(g)},`${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
|
|
1055
1183
|
(packages/vanilla/src/styles.css). Same tokens, same defaults, so a consumer
|
|
1056
1184
|
theming one package sees the same result in the other.
|
|
1057
1185
|
|
|
@@ -1218,7 +1346,7 @@
|
|
|
1218
1346
|
var(--aia-option-color-selected, var(--aia-color-text-default, #fff))
|
|
1219
1347
|
);
|
|
1220
1348
|
}
|
|
1221
|
-
`,document.head.appendChild(e)}var
|
|
1349
|
+
`,document.head.appendChild(e)}var X={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 K=require("react/jsx-runtime");function mt({products:e,listboxId:o,onSelect:t,onFocusChange:i,focusable:r=!0}){if(e.length===0)return null;let a=`${o}-products-label`;return(0,K.jsxs)("section",{className:X.section,"data-aia-products":"",role:"group","aria-labelledby":a,children:[(0,K.jsx)("div",{className:X.label,id:a,children:"Products"}),(0,K.jsx)("div",{className:X.row,"data-aia-products-row":"",children:e.map((s,g)=>(0,K.jsx)(Ut,{product:s,id:`${o}-product-${g}`,onSelect:t,onFocusChange:i,focusable:r},s.id))})]})}function Ut({product:e,id:o,onSelect:t,onFocusChange:i,focusable:r}){let a=s=>{s.metaKey||s.ctrlKey||s.shiftKey||s.altKey||s.button!==0||(s.preventDefault(),t(e))};return(0,K.jsxs)("a",{id:o,className:X.card,"data-aia-product":"",role:"option","aria-selected":!1,href:e.url,tabIndex:r?0:-1,onClick:a,onKeyDown:s=>{s.key!=="Enter"&&s.key!==" "||(s.preventDefault(),t(e))},onFocus:()=>i?.(!0),onBlur:s=>{s.relatedTarget?.closest("[data-aia-dropdown]")||i?.(!1)},children:[(0,K.jsx)("span",{className:X.media,"data-aia-product-placeholder":e.imageUrl?void 0:"",children:e.imageUrl?(0,K.jsx)("img",{className:X.image,src:e.imageUrl,alt:"",loading:"lazy",decoding:"async"}):null}),(0,K.jsxs)("span",{className:X.body,children:[e.vendor?(0,K.jsx)("span",{className:X.vendor,children:e.vendor}):null,(0,K.jsx)("span",{className:X.title,children:e.title}),e.price?(0,K.jsx)("span",{className:X.price,children:e.price}):null]})]})}var W=require("@magicx-eng/ai-autocomplete-vanilla"),fe=require("react");var ht=require("@magicx-eng/ai-autocomplete-vanilla"),He=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 {
|
|
1222
1350
|
.aia-grid {
|
|
1223
1351
|
display: grid;
|
|
1224
1352
|
grid-template-columns: repeat(
|
|
@@ -1253,7 +1381,7 @@
|
|
|
1253
1381
|
border-radius: 3px;
|
|
1254
1382
|
}
|
|
1255
1383
|
}
|
|
1256
|
-
`,document.head.appendChild(e)}var gt=require("react/jsx-runtime");function
|
|
1384
|
+
`,document.head.appendChild(e)}var gt=require("react/jsx-runtime");function ft({min:e="16rem",max:o,gap:t,scroll:i=!1,maxHeight:r,scrollResetKey:a,cols:s,template:g,innerRef:b,className:v,children:m,...y}){let I=(0,He.useRef)(null);(0,He.useLayoutEffect)(()=>{if(a===void 0)return;let f=I.current;f&&(f.scrollTop=0)},[a]);let w={"--aia-grid-min":e};return o&&(w["--aia-grid-max"]=o),t&&(w["--aia-grid-gap"]=t),r&&(w["--aia-grid-max-height"]=r),s&&(w.gridTemplateColumns=(0,ht.optionsGridTemplateColumns)(s)),g&&(w.gridTemplateColumns=g),(0,gt.jsx)("div",{ref:f=>{I.current=f,b?.(f)},className:v?`aia-grid ${v}`:"aia-grid","data-scroll":i||void 0,style:w,...y,children:m})}var bt=require("@magicx-eng/ai-autocomplete-vanilla"),Ie=require("react");if(typeof document<"u"&&!document.getElementById("ac-style-82820da7")){let e=document.createElement("style");e.id="ac-style-82820da7",e.textContent=`.SuggestionItem-module_item_d4vpD {
|
|
1257
1385
|
position: relative;
|
|
1258
1386
|
overflow: visible;
|
|
1259
1387
|
display: flex;
|
|
@@ -1271,7 +1399,14 @@
|
|
|
1271
1399
|
SuggestionItem selection. The 9px/10px inset is the item's own padding. */
|
|
1272
1400
|
border-radius: 8px;
|
|
1273
1401
|
padding: 8px 10px;
|
|
1274
|
-
|
|
1402
|
+
/* Entrance: fade in while rising into place, each row a beat after the one
|
|
1403
|
+
before it (--aia-option-enter-delay is set inline per row from the core's
|
|
1404
|
+
optionEnterDelayMs). The durations and distance mirror OPTION_ENTER_* in
|
|
1405
|
+
the core's derive/optionsEntrance.ts \u2014 change both together. */
|
|
1406
|
+
animation:
|
|
1407
|
+
SuggestionItem-module_fadeIn_I8u35 150ms ease-out both,
|
|
1408
|
+
SuggestionItem-module_riseIn_etXZT 280ms cubic-bezier(0.25, 0.46, 0.45, 0.94) both;
|
|
1409
|
+
animation-delay: var(--aia-option-enter-delay, 0ms);
|
|
1275
1410
|
}
|
|
1276
1411
|
|
|
1277
1412
|
@keyframes SuggestionItem-module_fadeIn_I8u35 {
|
|
@@ -1280,6 +1415,19 @@
|
|
|
1280
1415
|
}
|
|
1281
1416
|
}
|
|
1282
1417
|
|
|
1418
|
+
@keyframes SuggestionItem-module_riseIn_etXZT {
|
|
1419
|
+
from {
|
|
1420
|
+
transform: translateY(16px);
|
|
1421
|
+
}
|
|
1422
|
+
}
|
|
1423
|
+
|
|
1424
|
+
@media (prefers-reduced-motion: reduce) {
|
|
1425
|
+
.SuggestionItem-module_item_d4vpD {
|
|
1426
|
+
animation-duration: 0s;
|
|
1427
|
+
animation-delay: 0s;
|
|
1428
|
+
}
|
|
1429
|
+
}
|
|
1430
|
+
|
|
1283
1431
|
.SuggestionItem-module_content_T-Qba {
|
|
1284
1432
|
position: relative;
|
|
1285
1433
|
z-index: 2;
|
|
@@ -1309,263 +1457,40 @@
|
|
|
1309
1457
|
opacity: 0.5;
|
|
1310
1458
|
}
|
|
1311
1459
|
|
|
1460
|
+
/* Press feedback: the picked option's text compresses down while every other
|
|
1461
|
+
option steps back in opacity \u2014 no fill, no glow, the hierarchy carries it. */
|
|
1312
1462
|
.SuggestionItem-module_pressed_98o-r {
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
background: rgba(var(--aia-streak-rgb, 255, 255, 255), 0.06);
|
|
1316
|
-
animation:
|
|
1317
|
-
SuggestionItem-module_glassFade_oyiSj 500ms ease forwards,
|
|
1318
|
-
SuggestionItem-module_tapDown_G3WGz 500ms ease forwards;
|
|
1319
|
-
}
|
|
1320
|
-
|
|
1321
|
-
@keyframes SuggestionItem-module_tapDown_G3WGz {
|
|
1322
|
-
0% {
|
|
1323
|
-
transform: scale(1);
|
|
1324
|
-
}
|
|
1325
|
-
30% {
|
|
1326
|
-
transform: scale(0.97);
|
|
1327
|
-
}
|
|
1328
|
-
100% {
|
|
1329
|
-
transform: scale(1);
|
|
1330
|
-
}
|
|
1331
|
-
}
|
|
1332
|
-
|
|
1333
|
-
@keyframes SuggestionItem-module_glassFade_oyiSj {
|
|
1334
|
-
0% {
|
|
1335
|
-
background: var(--aia-streak-glass-bg, rgba(255, 255, 255, 0.1));
|
|
1336
|
-
}
|
|
1337
|
-
100% {
|
|
1338
|
-
background: transparent;
|
|
1339
|
-
}
|
|
1340
|
-
}
|
|
1341
|
-
|
|
1342
|
-
/* Border streaks \u2014 horizontal segments */
|
|
1343
|
-
|
|
1344
|
-
.SuggestionItem-module_streaks_d9PEB {
|
|
1345
|
-
position: absolute;
|
|
1346
|
-
inset: 0;
|
|
1347
|
-
z-index: 1;
|
|
1348
|
-
pointer-events: none;
|
|
1349
|
-
border-radius: inherit;
|
|
1350
|
-
overflow: hidden;
|
|
1351
|
-
}
|
|
1352
|
-
|
|
1353
|
-
/* Bottom horizontal: 40% from right \u2192 right corner */
|
|
1354
|
-
.SuggestionItem-module_streaks_d9PEB::before {
|
|
1355
|
-
content: "";
|
|
1356
|
-
position: absolute;
|
|
1357
|
-
bottom: -3px;
|
|
1358
|
-
left: 60%;
|
|
1359
|
-
width: 0;
|
|
1360
|
-
height: 6px;
|
|
1361
|
-
opacity: 0;
|
|
1362
|
-
background: radial-gradient(
|
|
1363
|
-
ellipse at center,
|
|
1364
|
-
rgba(var(--aia-streak-rgb, 255, 255, 255), 0.5) 0%,
|
|
1365
|
-
rgba(var(--aia-streak-rgb, 255, 255, 255), 0.2) 40%,
|
|
1366
|
-
transparent 70%
|
|
1367
|
-
);
|
|
1368
|
-
box-shadow: 0 0 12px 4px rgba(var(--aia-streak-rgb, 255, 255, 255), 0.2);
|
|
1369
|
-
filter: blur(1px);
|
|
1370
|
-
border-radius: 50%;
|
|
1371
|
-
}
|
|
1372
|
-
|
|
1373
|
-
/* Top horizontal: 40% from left \u2192 left corner */
|
|
1374
|
-
.SuggestionItem-module_streaks_d9PEB::after {
|
|
1375
|
-
content: "";
|
|
1376
|
-
position: absolute;
|
|
1377
|
-
top: -3px;
|
|
1378
|
-
right: 60%;
|
|
1379
|
-
width: 0;
|
|
1380
|
-
height: 6px;
|
|
1381
|
-
opacity: 0;
|
|
1382
|
-
background: radial-gradient(
|
|
1383
|
-
ellipse at center,
|
|
1384
|
-
rgba(var(--aia-streak-rgb, 255, 255, 255), 0.5) 0%,
|
|
1385
|
-
rgba(var(--aia-streak-rgb, 255, 255, 255), 0.2) 40%,
|
|
1386
|
-
transparent 70%
|
|
1387
|
-
);
|
|
1388
|
-
box-shadow: 0 0 12px 4px rgba(var(--aia-streak-rgb, 255, 255, 255), 0.2);
|
|
1389
|
-
filter: blur(1px);
|
|
1390
|
-
border-radius: 50%;
|
|
1391
|
-
}
|
|
1392
|
-
|
|
1393
|
-
/* Border streaks \u2014 vertical segments */
|
|
1394
|
-
|
|
1395
|
-
.SuggestionItem-module_streaksVert_ERlV1 {
|
|
1396
|
-
position: absolute;
|
|
1397
|
-
inset: 0;
|
|
1398
|
-
z-index: 1;
|
|
1399
|
-
pointer-events: none;
|
|
1400
|
-
border-radius: inherit;
|
|
1401
|
-
overflow: hidden;
|
|
1402
|
-
}
|
|
1403
|
-
|
|
1404
|
-
/* Right vertical: bottom-right corner \u2192 up */
|
|
1405
|
-
.SuggestionItem-module_streaksVert_ERlV1::before {
|
|
1406
|
-
content: "";
|
|
1407
|
-
position: absolute;
|
|
1408
|
-
bottom: 0;
|
|
1409
|
-
right: -3px;
|
|
1410
|
-
width: 6px;
|
|
1411
|
-
height: 0;
|
|
1412
|
-
opacity: 0;
|
|
1413
|
-
background: radial-gradient(
|
|
1414
|
-
ellipse at center,
|
|
1415
|
-
rgba(var(--aia-streak-rgb, 255, 255, 255), 0.4) 0%,
|
|
1416
|
-
rgba(var(--aia-streak-rgb, 255, 255, 255), 0.15) 40%,
|
|
1417
|
-
transparent 70%
|
|
1418
|
-
);
|
|
1419
|
-
box-shadow: 0 0 12px 4px rgba(var(--aia-streak-rgb, 255, 255, 255), 0.15);
|
|
1420
|
-
filter: blur(1px);
|
|
1421
|
-
border-radius: 50%;
|
|
1422
|
-
}
|
|
1423
|
-
|
|
1424
|
-
/* Left vertical: top-left corner \u2192 down */
|
|
1425
|
-
.SuggestionItem-module_streaksVert_ERlV1::after {
|
|
1426
|
-
content: "";
|
|
1427
|
-
position: absolute;
|
|
1428
|
-
top: 0;
|
|
1429
|
-
left: -3px;
|
|
1430
|
-
width: 6px;
|
|
1431
|
-
height: 0;
|
|
1432
|
-
opacity: 0;
|
|
1433
|
-
background: radial-gradient(
|
|
1434
|
-
ellipse at center,
|
|
1435
|
-
rgba(var(--aia-streak-rgb, 255, 255, 255), 0.4) 0%,
|
|
1436
|
-
rgba(var(--aia-streak-rgb, 255, 255, 255), 0.15) 40%,
|
|
1437
|
-
transparent 70%
|
|
1438
|
-
);
|
|
1439
|
-
box-shadow: 0 0 12px 4px rgba(var(--aia-streak-rgb, 255, 255, 255), 0.15);
|
|
1440
|
-
filter: blur(1px);
|
|
1441
|
-
border-radius: 50%;
|
|
1442
|
-
}
|
|
1443
|
-
|
|
1444
|
-
.SuggestionItem-module_pressed_98o-r .SuggestionItem-module_streaks_d9PEB::before {
|
|
1445
|
-
animation: SuggestionItem-module_streakHorizRight_aboGz 500ms cubic-bezier(0.4, 0, 0.2, 1) forwards;
|
|
1446
|
-
}
|
|
1447
|
-
|
|
1448
|
-
.SuggestionItem-module_pressed_98o-r .SuggestionItem-module_streaks_d9PEB::after {
|
|
1449
|
-
animation: SuggestionItem-module_streakHorizLeft_BreWJ 500ms cubic-bezier(0.4, 0, 0.2, 1) forwards;
|
|
1450
|
-
}
|
|
1451
|
-
|
|
1452
|
-
.SuggestionItem-module_pressed_98o-r .SuggestionItem-module_streaksVert_ERlV1::before {
|
|
1453
|
-
animation: SuggestionItem-module_streakVertUp_to1GD 300ms cubic-bezier(0.3, 0, 0.2, 1) 200ms forwards;
|
|
1454
|
-
}
|
|
1455
|
-
|
|
1456
|
-
.SuggestionItem-module_pressed_98o-r .SuggestionItem-module_streaksVert_ERlV1::after {
|
|
1457
|
-
animation: SuggestionItem-module_streakVertDown_OrcLh 300ms cubic-bezier(0.3, 0, 0.2, 1) 200ms forwards;
|
|
1463
|
+
color: var(--aia-option-color-selected, var(--aia-color-text-default, #fff));
|
|
1464
|
+
animation: SuggestionItem-module_pressCompress_ICV3q 500ms ease forwards;
|
|
1458
1465
|
}
|
|
1459
1466
|
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
width: 0;
|
|
1464
|
-
height: 4px;
|
|
1465
|
-
opacity: 0;
|
|
1466
|
-
filter: blur(1px);
|
|
1467
|
-
box-shadow: 0 0 8px 3px rgba(var(--aia-streak-rgb, 255, 255, 255), 0.3);
|
|
1468
|
-
}
|
|
1469
|
-
15% {
|
|
1470
|
-
height: 4px;
|
|
1471
|
-
opacity: 1;
|
|
1472
|
-
filter: blur(1px);
|
|
1473
|
-
box-shadow: 0 0 10px 4px rgba(var(--aia-streak-rgb, 255, 255, 255), 0.3);
|
|
1474
|
-
}
|
|
1475
|
-
80% {
|
|
1476
|
-
width: 50%;
|
|
1477
|
-
height: 10px;
|
|
1478
|
-
opacity: 0.8;
|
|
1479
|
-
filter: blur(3px);
|
|
1480
|
-
box-shadow: 0 0 16px 6px rgba(var(--aia-streak-rgb, 255, 255, 255), 0.1);
|
|
1481
|
-
}
|
|
1482
|
-
100% {
|
|
1483
|
-
width: 50%;
|
|
1484
|
-
height: 12px;
|
|
1485
|
-
opacity: 0;
|
|
1486
|
-
filter: blur(5px);
|
|
1487
|
-
box-shadow: 0 0 20px 8px rgba(var(--aia-streak-rgb, 255, 255, 255), 0.03);
|
|
1488
|
-
}
|
|
1467
|
+
[role="listbox"]:has(.SuggestionItem-module_pressed_98o-r) .SuggestionItem-module_item_d4vpD:not(.SuggestionItem-module_pressed_98o-r) {
|
|
1468
|
+
opacity: 0.35;
|
|
1469
|
+
transition: opacity 150ms ease;
|
|
1489
1470
|
}
|
|
1490
1471
|
|
|
1491
|
-
|
|
1492
|
-
@keyframes SuggestionItem-module_streakHorizLeft_BreWJ {
|
|
1472
|
+
@keyframes SuggestionItem-module_pressCompress_ICV3q {
|
|
1493
1473
|
0% {
|
|
1494
|
-
|
|
1495
|
-
height: 4px;
|
|
1496
|
-
opacity: 0;
|
|
1497
|
-
filter: blur(1px);
|
|
1498
|
-
box-shadow: 0 0 8px 3px rgba(var(--aia-streak-rgb, 255, 255, 255), 0.3);
|
|
1499
|
-
}
|
|
1500
|
-
15% {
|
|
1501
|
-
height: 4px;
|
|
1502
|
-
opacity: 1;
|
|
1503
|
-
filter: blur(1px);
|
|
1504
|
-
box-shadow: 0 0 10px 4px rgba(var(--aia-streak-rgb, 255, 255, 255), 0.3);
|
|
1505
|
-
}
|
|
1506
|
-
80% {
|
|
1507
|
-
width: 50%;
|
|
1508
|
-
height: 10px;
|
|
1509
|
-
opacity: 0.8;
|
|
1510
|
-
filter: blur(3px);
|
|
1511
|
-
box-shadow: 0 0 16px 6px rgba(var(--aia-streak-rgb, 255, 255, 255), 0.1);
|
|
1512
|
-
}
|
|
1513
|
-
100% {
|
|
1514
|
-
width: 50%;
|
|
1515
|
-
height: 12px;
|
|
1516
|
-
opacity: 0;
|
|
1517
|
-
filter: blur(5px);
|
|
1518
|
-
box-shadow: 0 0 20px 8px rgba(var(--aia-streak-rgb, 255, 255, 255), 0.03);
|
|
1474
|
+
transform: scale(1);
|
|
1519
1475
|
}
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
/* Vertical segments start matching horizontal state at 200ms handoff */
|
|
1523
|
-
@keyframes SuggestionItem-module_streakVertUp_to1GD {
|
|
1524
|
-
0% {
|
|
1525
|
-
height: 0;
|
|
1526
|
-
width: 6px;
|
|
1527
|
-
opacity: 0.9;
|
|
1528
|
-
filter: blur(1.8px);
|
|
1529
|
-
box-shadow: 0 0 12px 5px rgba(var(--aia-streak-rgb, 255, 255, 255), 0.25);
|
|
1476
|
+
25% {
|
|
1477
|
+
transform: scale(0.93);
|
|
1530
1478
|
}
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
width: 10px;
|
|
1534
|
-
opacity: 0.4;
|
|
1535
|
-
filter: blur(3px);
|
|
1536
|
-
box-shadow: 0 0 18px 8px rgba(var(--aia-streak-rgb, 255, 255, 255), 0.06);
|
|
1479
|
+
60% {
|
|
1480
|
+
transform: scale(0.93);
|
|
1537
1481
|
}
|
|
1538
1482
|
100% {
|
|
1539
|
-
|
|
1540
|
-
width: 14px;
|
|
1541
|
-
opacity: 0;
|
|
1542
|
-
filter: blur(5px);
|
|
1543
|
-
box-shadow: 0 0 24px 10px rgba(var(--aia-streak-rgb, 255, 255, 255), 0.02);
|
|
1483
|
+
transform: scale(1);
|
|
1544
1484
|
}
|
|
1545
1485
|
}
|
|
1546
1486
|
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
}
|
|
1555
|
-
75% {
|
|
1556
|
-
height: 100%;
|
|
1557
|
-
width: 10px;
|
|
1558
|
-
opacity: 0.4;
|
|
1559
|
-
filter: blur(3px);
|
|
1560
|
-
box-shadow: 0 0 18px 8px rgba(var(--aia-streak-rgb, 255, 255, 255), 0.06);
|
|
1561
|
-
}
|
|
1562
|
-
100% {
|
|
1563
|
-
height: 100%;
|
|
1564
|
-
width: 14px;
|
|
1565
|
-
opacity: 0;
|
|
1566
|
-
filter: blur(5px);
|
|
1567
|
-
box-shadow: 0 0 24px 10px rgba(var(--aia-streak-rgb, 255, 255, 255), 0.02);
|
|
1568
|
-
}
|
|
1487
|
+
/* Scroll hint \u2014 the last visible row of a scrollable web grid fades toward its
|
|
1488
|
+
bottom edge, signalling more options below (the desktop footer is opaque, so
|
|
1489
|
+
rows no longer dissolve through it). A mask instead of a color so any themed
|
|
1490
|
+
option color fades the same way. */
|
|
1491
|
+
.SuggestionItem-module_scrollHint_xKXPt .SuggestionItem-module_content_T-Qba {
|
|
1492
|
+
-webkit-mask-image: linear-gradient(to bottom, rgb(0 0 0), rgb(0 0 0 / 0.6));
|
|
1493
|
+
mask-image: linear-gradient(to bottom, rgb(0 0 0), rgb(0 0 0 / 0.6));
|
|
1569
1494
|
}
|
|
1570
1495
|
|
|
1571
1496
|
/* Loading state \u2014 preserve the row's exact dimensions. The content stays an
|
|
@@ -1603,7 +1528,7 @@
|
|
|
1603
1528
|
filter: brightness(0.55);
|
|
1604
1529
|
}
|
|
1605
1530
|
}
|
|
1606
|
-
`,document.head.appendChild(e)}var
|
|
1531
|
+
`,document.head.appendChild(e)}var re={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 vt({option:e,isHighlighted:o,onSelect:t,onHighlight:i,id:r,loading:a,scrollHint:s,enterDelayMs:g=0}){let[b]=(0,Ie.useState)(g),[v,m]=(0,Ie.useState)(!1),y=(0,Ie.useRef)(void 0);(0,Ie.useEffect)(()=>()=>clearTimeout(y.current),[]);let I=()=>{a||!e.is_tappable||v||(m(!0),t(e),clearTimeout(y.current),y.current=setTimeout(()=>m(!1),500))},w=[re.item,o&&!a?re.highlighted:"",e.is_tappable?re.tappable:re.nonTappable,v?re.pressed:"",s?re.scrollHint:""].filter(Boolean).join(" ");return(0,De.jsx)("div",{id:r,role:"option","data-aia-option":"","data-aia-loading":a?"":void 0,"aria-selected":o,className:w,style:{[bt.OPTION_ENTER_DELAY_VAR]:`${b}ms`},tabIndex:a||!e.is_tappable?-1:0,onClick:I,onKeyDown:f=>{!a&&e.is_tappable&&(f.key==="Enter"||f.key===" ")&&(f.preventDefault(),I())},onMouseEnter:!a&&e.is_tappable?i:void 0,children:(0,De.jsxs)("span",{className:re.content,children:[(0,De.jsx)("span",{className:re.text,children:e.icon?`${e.icon} ${e.text}`:e.text}),e.tag&&(0,De.jsx)("span",{className:re.tag,children:e.tag})]})})}var et=require("react/jsx-runtime");function qt(){let[e,o]=(0,fe.useState)(W.isOptionsGridMobileViewport);return(0,fe.useEffect)(()=>{if(typeof window>"u"||!window.matchMedia)return;let t=window.matchMedia(W.OPTIONS_GRID_MOBILE_QUERY),i=()=>o(t.matches);return i(),t.addEventListener("change",i),()=>t.removeEventListener("change",i)},[]),e}function wt({options:e,activeIndex:o,onSelect:t,onHighlight:i,listboxId:r,loading:a,groupKey:s="",optionsPosition:g="below"}){let b=qt(),v=(0,fe.useRef)(null),[m,y]=(0,fe.useState)(null);(0,fe.useLayoutEffect)(()=>{let w=v.current,L=w&&!a&&(0,W.needsOptionsGridMeasurement)(e.length,b)?(0,W.measureOptionsGrid)(w):null;y(L?(0,W.planOptionsGrid)(e.length,b,L.rowWidths,L.gridWidth):null)},[e,b,a]);let I=m??(0,W.planOptionsGrid)(e.length,b,null,null);return(0,et.jsx)(ft,{min:"250px",max:"1fr",gap:"0",scroll:!0,scrollResetKey:s,template:I.template,maxHeight:I.maxHeight,innerRef:w=>{v.current=w},"data-aia-group":s,children:e.map((w,f)=>(0,et.jsx)(vt,{option:w,isHighlighted:f===o,onSelect:t,onHighlight:()=>i(f),id:`${r}-option-${f}`,loading:a,scrollHint:!a&&I.scrollHintIndices.includes(f),enterDelayMs:a?0:(0,W.optionEnterDelayMs)(f,I.cols,e.length,g)},`${s}\0${w.text}`))})}if(typeof document<"u"&&!document.getElementById("ac-style-8414cd5f")){let e=document.createElement("style");e.id="ac-style-8414cd5f",e.textContent=`@layer layout {
|
|
1607
1532
|
.aia-stack {
|
|
1608
1533
|
display: flex;
|
|
1609
1534
|
flex-direction: column;
|
|
@@ -1620,7 +1545,7 @@
|
|
|
1620
1545
|
}
|
|
1621
1546
|
/* data-align="stretch" is the flex default \u2014 no rule needed. */
|
|
1622
1547
|
}
|
|
1623
|
-
`,document.head.appendChild(e)}var
|
|
1548
|
+
`,document.head.appendChild(e)}var yt=require("react/jsx-runtime");function xt({space:e,align:o="stretch",className:t,children:i,...r}){let a=e?{"--aia-stack-space":e}:void 0;return(0,yt.jsx)("div",{className:t?`aia-stack ${t}`:"aia-stack","data-align":o,style:a,...r,children:i})}var M=require("react/jsx-runtime"),$t=[159,119,164],jt=()=>{},_t=()=>{};function Vt(e){let o=()=>typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-color-scheme: dark)").matches,[t,i]=(0,Z.useState)(o);if((0,Z.useEffect)(()=>{if(e!=="auto"||typeof window>"u"||typeof window.matchMedia!="function")return;let r=window.matchMedia("(prefers-color-scheme: dark)"),a=()=>i(r.matches);return r.addEventListener("change",a),()=>r.removeEventListener("change",a)},[e]),e!==void 0)return e==="auto"?t?"dark":"light":e}function Yt(e,o){let t=(0,Z.useRef)(null);(0,Z.useEffect)(()=>{let i=e.current,r=o.current;if(!i||!r)return;let a=i.querySelector(".aia-grid[data-scroll]");if(t.current&&t.current.grid!==a&&(t.current.controller.destroy(),t.current=null),a&&!t.current){t.current={grid:a,controller:(0,Ke.attachScrollArrow)({dropdown:i,grid:a,button:r})};return}t.current?.controller.update()}),(0,Z.useEffect)(()=>()=>{t.current?.controller.destroy(),t.current=null},[])}function We({suggestions:e,activeIndex:o,onSelect:t,onHighlight:i,isOpen:r,id:a,className:s,pills:g,onPillClick:b,showPills:v=!0,onSkip:m,showSkipButton:y=!0,skipDisabled:I=!1,activeSelected:w=!1,isLoading:f=!1,isInputEmpty:L=!1,products:$,onProductSelect:se,onProductFocusChange:ge,formatType:G="options",dateView:S=null,selectedDateIso:ee=null,onPreviousMonth:h,onNextMonth:be,optionsPosition:te="below",mode:le}){let N=Vt(le),ve=N!==void 0,ae=(0,Z.useRef)(null),oe=(0,Z.useRef)(null);Yt(ae,oe);let de=e[0]?.options??[],H=!!(g&&g.length>0&&b),ce=!!($&&$.length>0),q=r&&(de.length>0||v&&H||f||ce),j={suggestions:e,activeIndex:o,pills:g,showPills:v,showSkipButton:y,skipDisabled:I,activeSelected:w,isLoading:f,isInputEmpty:L,products:$,formatType:G,dateView:S,selectedDateIso:ee},V=(0,Z.useRef)(j);q&&(V.current=j);let p=q?j:V.current,Y=p.suggestions[0],l=Y?.options??[],u=p.activeIndex>=0&&!!l[p.activeIndex]?.is_tappable,n=!!(p.pills&&p.pills.length>0&&b),k=p.showPills&&n,_=p.showPills&&!n&&p.isLoading,D=k||_,d=n&&p.showSkipButton&&!p.isInputEmpty&&!!m,Q=p.pills?.[0]?.text,ie=p.formatType==="date"&&p.dateView!=null,pe=l.length>0&&!ie,ke=l.length>0&&ie,we=p.isLoading&&!pe&&!ke,Ae=p.products??[];return(0,M.jsxs)("div",{ref:ae,id:a,role:"listbox","data-aia-dropdown":"","data-options-position":te,"data-mode":N,"data-aia-loading":p.isLoading?"":void 0,"data-aia-has-products":Ae.length>0?"":void 0,className:`${ve?"magicx-aia ":""}${me.dropdown} ${q?me.visible:""} ${s??""}`,onMouseDown:O=>O.preventDefault(),children:[(0,M.jsxs)(xt,{space:"8px",children:[(D||d)&&(0,M.jsxs)(Le,{noWrap:!0,className:me.pillBar,"data-aia-pillbar":"",children:[D&&(0,M.jsx)("span",{className:me.pillScroll,"data-aia-pill-scroll":"",children:(0,M.jsx)(Ge,{pills:p.pills??[],activePillIndex:0,activeSelected:p.activeSelected,onSelectPill:b??(()=>{}),rounded:!0,loading:p.isLoading})}),d&&(0,M.jsx)("button",{type:"button",tabIndex:-1,className:me.skip,"data-aia-skip":"",disabled:p.isLoading||p.skipDisabled,"aria-label":Q?`Skip ${Q}`:"Skip",onClick:m,children:"skip"})]}),pe&&(0,M.jsx)(wt,{options:l,activeIndex:p.activeIndex,onSelect:t,onHighlight:i,listboxId:a,loading:p.isLoading,groupKey:Y?`${Y.type} ${Y.text}`:"",optionsPosition:te}),ke&&p.dateView&&(0,M.jsx)(lt,{options:l,activeIndex:p.activeIndex,listboxId:a,view:p.dateView,selectedIso:p.selectedDateIso??null,onSelect:t,onHighlight:i,onPreviousMonth:h??_t,onNextMonth:be??_t}),we&&(0,M.jsx)("div",{className:me.skeletonBars,"data-aia-skeleton-bars":"",children:$t.map(O=>(0,M.jsx)("span",{className:me.skeletonBar,style:{width:O}},`bar-${O}`))}),(0,M.jsx)(mt,{products:Ae,listboxId:a,onSelect:se??jt,onFocusChange:ge,focusable:q}),(0,M.jsx)(dt,{isOptionHighlighted:u,isInputEmpty:p.isInputEmpty})]}),(0,M.jsx)("button",{ref:oe,type:"button",tabIndex:-1,className:me.scrollArrow,"data-aia-scroll-arrow":"","aria-label":Ke.SCROLL_ARROW_LABEL,"aria-hidden":"true",children:(0,M.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,M.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 {
|
|
1624
1549
|
flex-shrink: 0;
|
|
1625
1550
|
width: 32px;
|
|
1626
1551
|
height: 32px;
|
|
@@ -1655,5 +1580,5 @@
|
|
|
1655
1580
|
);
|
|
1656
1581
|
cursor: default;
|
|
1657
1582
|
}
|
|
1658
|
-
`,document.head.appendChild(e)}var yt={submitButton:"SubmitButton-module_submitButton_otz7H"};var He=require("react/jsx-runtime");function kt({disabled:e,onClick:a}){return(0,He.jsx)("button",{type:"button","data-aia-submit":"",className:yt.submitButton,disabled:e,onClick:t=>{t.stopPropagation(),a()},"aria-label":"Submit",children:(0,He.jsx)("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",role:"img","aria-label":"Submit",children:(0,He.jsx)("path",{d:"M9 14V4M9 4L4 9M9 4L14 9",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})}var Ke=require("@magicx-eng/ai-autocomplete-vanilla"),k=require("react");var et=require("react");function _t(e){let a=(0,et.useRef)(e);a.current=e;let t=(0,et.useRef)(null);t.current===null&&(t.current={fetch:(n,r)=>{let s=a.current;return s?s.fetch(n,r):Promise.reject(new Error("products config removed"))},transform:n=>a.current?.transform(n)??[],get limit(){return a.current?.limit}});let i=e!==void 0;return{config:i?t.current:void 0,enabled:i}}var $t={text:"",completedParams:[],identifiedParams:[],skippedParams:[],pendingSpan:null,suggestions:[],products:[],activeDropdownIndex:-1,newParamId:null,isLoading:!0,isReady:!1,error:null,segments:[],actionableSuggestions:[],filteredOptions:[],activeFormatType:"options",dateView:null,placeholderText:"",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};function We({onSubmit:e,onError:a,optionOverrides:t,maskCompletedText:i,apiConfig:n,additionalContext:r,columns:s=2,dropdownTrigger:g,optionsPosition:b,closeDropdownOnBlur:v,showNonTappableOptions:m,showSkipButton:f,onFocus:z,onBlur:G,value:N,completedParams:O,onChange:V,onParamsChange:ae,products:ce,onProductSelect:F,source:P,setCursor:X}){let u=(0,k.useRef)(null),[ue,oe]=(0,k.useState)(null),ie=(0,k.useRef)(e);ie.current=e;let E=(0,k.useRef)(a);E.current=a;let me=(0,k.useRef)(V);me.current=V;let re=(0,k.useRef)(ae);re.current=ae;let ne=(0,k.useRef)(z);ne.current=z;let se=(0,k.useRef)(G);se.current=G;let T=(0,k.useRef)(X);T.current=X;let q=(0,k.useRef)(F);q.current=F;let Z=_t(ce);(0,k.useEffect)(()=>{if(typeof document>"u")return;let p=new Ke.AIAutocomplete(document.createElement("div"),{renderMode:"headless",apiConfig:n,additionalContext:r,optionOverrides:t,maskCompletedText:i,columns:s,dropdownTrigger:g,optionsPosition:b,closeDropdownOnBlur:v,showNonTappableOptions:m,source:P,value:N,completedParams:O,onSubmit:(...D)=>ie.current?.(...D),onError:(...D)=>E.current?.(...D),onChange:(...D)=>me.current?.(...D),onParamsChange:(...D)=>re.current?.(...D),onFocus:()=>ne.current?.(),onBlur:()=>se.current?.(),onProductSelect:D=>q.current?.(D),setCursor:D=>T.current?.(D),products:Z.config});u.current=p,oe(p.getState());let L=p.subscribe(D=>oe(D));return()=>{L(),p.destroy(),u.current===p&&(u.current=null)}},[]),(0,k.useEffect)(()=>{N!==void 0&&u.current?.setValue(N)},[N]),(0,k.useEffect)(()=>{O!==void 0&&u.current?.setCompletedParams(O)},[O]);let h=JSON.stringify(n??null),H;try{H=JSON.stringify(r??null)}catch{H="[unstringifiable]"}let R=(0,k.useRef)(t),he=(0,k.useRef)(0);if(t!==R.current){let p=R.current,L=t,D=Object.keys(p??{}),_e=Object.keys(L??{});(D.length!==_e.length||_e.some(fe=>!p?.[fe]||L[fe]!==p[fe]))&&he.current++,R.current=t}(0,k.useEffect)(()=>{u.current?.update({apiConfig:n,additionalContext:r,optionOverrides:t,dropdownTrigger:g,optionsPosition:b,closeDropdownOnBlur:v,showNonTappableOptions:m})},[h,H,he.current,g,b,v,m]);let l=(0,k.useRef)(!1);(0,k.useEffect)(()=>{if(!l.current){l.current=!0;return}u.current?.update({products:Z.config})},[Z.enabled]);let c=(0,k.useRef)(null);c.current===null&&(c.current={handleTextChange:p=>u.current?.handleTextChange(p),handleKeyDown:p=>{let L="nativeEvent"in p?p.nativeEvent:p;u.current?.handleKeyDown(L)},setFocused:p=>u.current?.setFocused(p),startEditingParam:p=>u.current?.startEditingParam(p),exitEditMode:()=>u.current?.exitEditMode(),handleCaretAfterInput:p=>u.current?.handleCaretAfterInput(p),handleCaretMove:p=>u.current?.handleCaretMove(p),replaceEditingRange:p=>u.current?.replaceEditingRange(p)??!1,setActivePill:p=>u.current?.setActivePill(p),skipActivePill:()=>u.current?.skipActivePill(),removeLastParam:()=>u.current?.removeLastParam(),clearNewParamId:()=>u.current?.clearNewParamId(),reset:()=>u.current?.reset(),selectOption:p=>u.current?.selectOption(p),selectProduct:p=>u.current?.selectProduct(p),setActiveDropdownIndex:p=>u.current?.setActiveDropdownIndex(p),showPreviousMonth:()=>u.current?.showPreviousMonth(),showNextMonth:()=>u.current?.showNextMonth(),handleFocus:()=>u.current?.setFocused(!0),handleBlur:()=>u.current?.setFocused(!1)});let o=c.current,y=(0,k.useCallback)(p=>{let L=p.target.value,_e=L.length>0&&!p.nativeEvent?.isComposing&&L[0]!==L[0].toUpperCase()?L[0].toUpperCase()+L.slice(1):L;u.current?.handleTextChange(_e)},[]),x=(0,k.useCallback)(p=>{u.current?.handleKeyDown(p.nativeEvent)},[]),S=u.current,d=ue??$t,$=N!==void 0?N:d.text,ee=O!==void 0?O:d.completedParams,ge=d.actionableSuggestions,ye=ge[0],j=S?.listboxId??"",Ve=d.activeDropdownIndex>=0&&S?`${j}-option-${d.activeDropdownIndex}`:void 0,le=d.editingParam,de=d.editingIdentified,Ce=le?{type:le.suggestionType,text:le.suggestionPlaceholder,required:!0,options:le.options}:de?{type:de.type,text:de.type,required:!0,options:[]}:null,Re=Ce??ye,qe=Ce?[Ce]:ge,Le=!S||d.isLoading&&!d.editingParam&&!d.inSelectionAnimation;return{completedParams:ee,skippedParams:d.skippedParams,suggestionPills:ge,setActivePill:o.setActivePill,skipActivePill:o.skipActivePill,removeLastParam:o.removeLastParam,segments:d.segments,newParamId:d.newParamId,clearNewParamId:o.clearNewParamId,suggestions:d.suggestions,activeIndex:d.activeDropdownIndex,isReady:d.isReady,isLoading:Le,isFocused:d.isFocused,isDropdownOpen:d.isDropdownOpen,isActivePillSelected:d.isActivePillSelected,placeholderText:d.placeholderText,listboxId:j,error:d.error,products:d.products,selectProduct:o.selectProduct,handleTextChange:o.handleTextChange,handleKeyDown:o.handleKeyDown,setFocused:o.setFocused,editingParam:le,editingIdentified:de,editingAnchor:d.editingAnchor,caretOffset:d.caretOffset,startEditingParam:o.startEditingParam,exitEditMode:o.exitEditMode,handleCaretAfterInput:o.handleCaretAfterInput,handleCaretMove:o.handleCaretMove,replaceEditingRange:o.replaceEditingRange,inputProps:{value:$,placeholder:d.placeholderText||void 0,onChange:y,onKeyDown:x,onFocus:o.handleFocus,onBlur:o.handleBlur,role:"combobox","aria-expanded":d.isDropdownOpen,"aria-activedescendant":Ve,"aria-autocomplete":"list","aria-controls":j},reset:o.reset,dropdownProps:{suggestions:Re?[{...Re,options:d.filteredOptions}]:[],activeIndex:d.activeDropdownIndex,onSelect:o.selectOption,onHighlight:o.setActiveDropdownIndex,isOpen:d.isDropdownOpen,id:j,pills:qe,activeSelected:d.isActivePillSelected,onPillClick:o.setActivePill,onSkip:o.skipActivePill,showSkipButton:(f??!0)&&!le&&!de,skipDisabled:d.inSelectionAnimation,isLoading:Le,isInputEmpty:$.trim().length===0,products:d.products,onProductSelect:o.selectProduct,onProductFocusChange:o.setFocused,formatType:d.activeFormatType,dateView:d.dateView,selectedDateIso:de?de.iso:(0,Ke.selectedIsoFromText)(le?.text),onPreviousMonth:o.showPreviousMonth,onNextMonth:o.showNextMonth,optionsPosition:b??"below"}}}var W=require("@magicx-eng/ai-autocomplete-vanilla"),w=require("react"),Ue;function jt(){if(Ue!==void 0)return Ue;if(typeof document>"u")return!1;let e=document.createElement("div");return e.setAttribute("contenteditable","plaintext-only"),Ue=e.contentEditable==="plaintext-only",Ue}function Pt(e){let{segments:a,newParamId:t,editingParam:i,editingIdentified:n,editingAnchor:r,caretOffset:s,placeholderText:g,isFocused:b,isDropdownOpen:v,listboxId:m,activeDescendantId:f,autoFocus:z,handleTextChange:G,handleKeyDown:N,handleCaretAfterInput:O,handleCaretMove:V,startEditingParam:ae,replaceEditingRange:ce,setFocused:F}=e,P=(0,w.useRef)(null),X=(0,w.useRef)(!1),u=(0,w.useRef)(""),ue=(0,w.useRef)(""),oe=(0,w.useRef)(null),ie=(0,w.useRef)(0);oe.current=s,(0,w.useEffect)(()=>{if(!z)return;let l=P.current;if(!l)return;document.activeElement===l?F(!0):l.focus();let c=l.ownerDocument??document,o=c.getSelection(),y=o&&o.rangeCount>0&&l.contains(o.anchorNode);if(o&&!y){let x=c.createRange();x.selectNodeContents(l),x.collapse(!0),o.removeAllRanges(),o.addRange(x)}},[z,F]),(0,w.useEffect)(()=>{let l=P.current;if(!l)return;let c=l.ownerDocument??document,o=()=>{let y=c.getSelection();if(!y||y.rangeCount===0||!y.anchorNode||!l.contains(y.anchorNode))return;let x=y.anchorNode,S=x.nodeType===Node.ELEMENT_NODE?x:x.parentElement,$=(y.isCollapsed?S?.closest("strong[data-param-id]"):null)?.dataset.paramId??null,ee=i?.id??n?.id??null;if($&&$!==ee){ae($);return}performance.now()-ie.current<50||V((0,W.getCursorOffset)(l))};return c.addEventListener("selectionchange",o),()=>c.removeEventListener("selectionchange",o)},[i,n,ae,V]),(0,w.useLayoutEffect)(()=>{let l=P.current;l&&(0,W.renderEditableContent)({input:l,segments:a,newParamId:t,editingParamId:i?.id??null,placeholderText:g??"",isFocused:b})},[a,t,i,g,b]),(0,w.useLayoutEffect)(()=>{let l=u.current,c=t??"";if(u.current=c,!c||c===l)return;let o=P.current;if(!o)return;o.focus();let y=oe.current??(0,W.plainTextLength)(o);(0,W.setCursorOffset)(o,y)},[t]),(0,w.useLayoutEffect)(()=>{let l=ue.current,c=i?.id??"";if(ue.current=c,!c||c===l||r==null)return;let o=P.current;o&&(0,W.setCursorOffset)(o,r)},[i,r]);let E=(0,w.useCallback)(()=>{if(X.current)return;let l=P.current;if(!l)return;let c=(0,W.extractPlainText)(l),y=c.length>0&&c[0]!==c[0].toUpperCase()?c[0].toUpperCase()+c.slice(1):c;G(y)},[G]),me=(0,w.useCallback)(()=>{ie.current=performance.now(),E();let l=P.current;l&&O((0,W.getCursorOffset)(l))},[E,O]);(0,w.useEffect)(()=>{let l=P.current;if(!l)return;let c=o=>{let y=o,x=y.inputType;if(x==="insertParagraph"||x==="insertLineBreak"||x==="insertFromDrop"){o.preventDefault();return}if(x.startsWith("insert")||x.startsWith("delete")){let S=x.startsWith("delete")?"":y.data??"";ce(S)&&o.preventDefault()}};return l.addEventListener("beforeinput",c),()=>l.removeEventListener("beforeinput",c)},[ce]);let re=(0,w.useCallback)(()=>{X.current=!0},[]),ne=(0,w.useCallback)(()=>{X.current=!1,E()},[E]),se=(0,w.useCallback)(l=>{l.preventDefault();let c=P.current;if(!c)return;let o=(l.clipboardData.getData("text/plain")??"").replace(/\r?\n/g," ");if(!o)return;let y=c.ownerDocument??document,x=y.getSelection();if(!x||x.rangeCount===0)return;let S=x.getRangeAt(0);if(!c.contains(S.startContainer))return;S.deleteContents();let d=y.createTextNode(o);S.insertNode(d),S.setStartAfter(d),S.collapse(!0),x.removeAllRanges(),x.addRange(S),E()},[E]),T=(0,w.useCallback)(l=>N(l),[N]),q=(0,w.useCallback)(()=>F(!0),[F]),Z=(0,w.useCallback)(()=>F(!1),[F]),h=(0,w.useCallback)(()=>P.current?.focus(),[]),H=(0,w.useCallback)(()=>P.current?.blur(),[]),R=(0,w.useCallback)(()=>{let l=P.current;return l?(0,W.extractPlainText)(l):""},[]),he=jt()?"plaintext-only":"true";return{inputRef:P,editorProps:{ref:P,contentEditable:he,suppressContentEditableWarning:!0,tabIndex:0,role:"combobox","aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":m,"aria-expanded":v,"aria-activedescendant":f,spellCheck:!0,enterKeyHint:"send",onInput:me,onKeyDown:T,onCompositionStart:re,onCompositionEnd:ne,onPaste:se,onFocus:q,onBlur:Z},getPlainText:R,focus:h,blur:H}}var J=require("react/jsx-runtime");function Qt(e){return e!=="auto"?e:typeof window>"u"||window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}var It=(0,A.forwardRef)(function({onSubmit:a,onError:t,optionOverrides:i,maskCompletedText:n,className:r,apiConfig:s,additionalContext:g,columns:b,pillPlacement:v="dropdown",mode:m="auto",optionsPosition:f="below",animations:z=!0,dropdownTrigger:G,closeDropdownOnBlur:N,showNonTappableOptions:O,showSkipButton:V,autoFocus:ae=!0,onFocus:ce,onBlur:F,value:P,completedParams:X,onChange:u,onParamsChange:ue,products:oe,onProductSelect:ie,submitButton:E},me){let re=(0,A.useRef)(null),ne=(0,A.useRef)(null),se=(0,A.useRef)(()=>{}),T=(0,A.useRef)(null),q=(0,A.useRef)(null);(0,A.useEffect)(()=>{let _=re.current;if(_)return T.current?T.current.setMode(m):T.current=new De.ModeController(_,m),()=>{T.current?.destroy(),T.current=null}},[m]);let Z=(0,A.useCallback)(_=>{let be=q.current?.current;be&&(be.focus(),(0,De.setCursorOffset)(be,_))},[]),{completedParams:h,skippedParams:H,suggestionPills:R,setActivePill:he,skipActivePill:l,segments:c,newParamId:o,clearNewParamId:y,placeholderText:x,isFocused:S,isDropdownOpen:d,isActivePillSelected:$,isLoading:ee,activeIndex:ge,listboxId:ye,handleTextChange:j,handleKeyDown:Ve,setFocused:le,editingParam:de,editingIdentified:Ce,editingAnchor:Re,caretOffset:qe,startEditingParam:Le,handleCaretAfterInput:p,handleCaretMove:L,replaceEditingRange:D,dropdownProps:_e,reset:fe}=We({onSubmit:_=>se.current(_),onError:t,optionOverrides:i,maskCompletedText:n,apiConfig:s,additionalContext:g,columns:b,dropdownTrigger:G,optionsPosition:f,closeDropdownOnBlur:N,showNonTappableOptions:O,showSkipButton:V,onFocus:ce,onBlur:F,value:P,completedParams:X,onChange:u,onParamsChange:ue,products:oe,onProductSelect:ie,source:"full-sdk",setCursor:Z});(0,A.useEffect)(()=>{if(!o)return;let _=window.setTimeout(()=>y(),650);return()=>window.clearTimeout(_)},[o,y]);let St=ge>=0?`${ye}-option-${ge}`:void 0,{inputRef:$e,editorProps:At,focus:ze,blur:tt,getPlainText:at}=Pt({segments:c,newParamId:o,editingParam:de,editingIdentified:Ce,editingAnchor:Re,caretOffset:qe,placeholderText:x,isFocused:S,isDropdownOpen:d,listboxId:ye,activeDescendantId:St,autoFocus:ae,handleTextChange:j,handleKeyDown:Ve,handleCaretAfterInput:p,handleCaretMove:L,startEditingParam:Le,replaceEditingRange:D,setFocused:le});q.current=$e,(0,A.useLayoutEffect)(()=>{let _=ne.current,be=$e.current;if(!_||!be)return;let ot=()=>{let rt=_.firstElementChild;if(!rt)return;let Tt=rt.getBoundingClientRect(),Rt=be.getBoundingClientRect();Tt.top>=Rt.bottom-2?_.setAttribute("data-aia-pill-wrapped",""):_.removeAttribute("data-aia-pill-wrapped")};ot();let it=new ResizeObserver(ot);return it.observe(be),()=>it.disconnect()},[c,R.length,ee,$e]),(0,A.useImperativeHandle)(me,()=>({focus:ze,blur:tt,reset:fe,setMode:_=>T.current?.setMode(_),skipActivePill:l}),[ze,tt,fe,l]);let Ne=!!c.length||h.length>0,je=(0,A.useCallback)(()=>{if(!Ne)return;let _=at();a((0,De.buildSubmitResult)(_,h,H)),fe()},[Ne,h,H,a,fe,at]);se.current=je;let Dt=(0,A.useCallback)(_=>{_.target?.closest("[data-aia-pill]")||ze()},[ze]),Ct=v==="inline",Et=v==="dropdown";return(0,J.jsxs)("div",{ref:re,className:`magicx-aia ${ke.container} ${r??""}`,"data-pill-placement":v,"data-options-position":f,"data-animations":z?"on":"off","data-mode":Qt(m),children:[(0,J.jsx)(Fe,{..._e,showPills:Et}),(0,J.jsxs)("div",{className:ke.inputWrapper,onClick:Dt,children:[(0,J.jsxs)("div",{className:ke.editorArea,"data-aia-editor":"",children:[(0,J.jsx)("div",{...At,className:ke.input,"data-aia-input":""}),Ct&&(ee||R.length>0)&&(0,J.jsx)("span",{ref:ne,className:ke.pillListContainer,"data-aia-pill-list-container":"",children:(0,J.jsx)(Be,{pills:R,activePillIndex:0,activeSelected:$,onSelectPill:he,loading:ee})})]}),E===null?null:E===void 0?(0,J.jsx)(kt,{disabled:!Ne,onClick:je}):(0,J.jsx)("span",{"data-aia-submit":"",className:ke.submitSlot,onClick:_=>{Ne&&(_.stopPropagation(),je())},children:E})]})]})});0&&(module.exports={AIAutocomplete,AIAutocompleteDropdown,WEEKDAY_LABELS,buildSubmitResult,cellDay,cellIso,formatDate,isoDate,monthLabel,parseDate,parseLooseDate,useAIAutocomplete,withSkippedParams});
|
|
1583
|
+
`,document.head.appendChild(e)}var kt={submitButton:"SubmitButton-module_submitButton_otz7H"};var Ue=require("react/jsx-runtime");function Pt({disabled:e,onClick:o}){return(0,Ue.jsx)("button",{type:"button","data-aia-submit":"",className:kt.submitButton,disabled:e,onClick:t=>{t.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"),P=require("react");var tt=require("react");function It(e){let o=(0,tt.useRef)(e);o.current=e;let t=(0,tt.useRef)(null);t.current===null&&(t.current={fetch:(r,a)=>{let s=o.current;return s?s.fetch(r,a):Promise.reject(new Error("products config removed"))},transform:r=>o.current?.transform(r)??[],get limit(){return o.current?.limit}});let i=e!==void 0;return{config:i?t.current:void 0,enabled:i}}var Qt={text:"",completedParams:[],identifiedParams:[],skippedParams:[],pendingSpan:null,suggestions:[],products:[],activeDropdownIndex:-1,newParamId:null,isLoading:!0,isReady:!1,error:null,segments:[],actionableSuggestions:[],filteredOptions:[],activeFormatType:"options",dateView:null,placeholderText:"",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};function qe({onSubmit:e,onError:o,optionOverrides:t,maskCompletedText:i,apiConfig:r,additionalContext:a,columns:s=2,dropdownTrigger:g,optionsPosition:b,closeDropdownOnBlur:v,showNonTappableOptions:m,showSkipButton:y,onFocus:I,onBlur:w,value:f,completedParams:L,onChange:$,onParamsChange:se,products:ge,onProductSelect:G,source:S,setCursor:ee}){let h=(0,P.useRef)(null),[be,te]=(0,P.useState)(null),le=(0,P.useRef)(e);le.current=e;let N=(0,P.useRef)(o);N.current=o;let ve=(0,P.useRef)($);ve.current=$;let ae=(0,P.useRef)(se);ae.current=se;let oe=(0,P.useRef)(I);oe.current=I;let de=(0,P.useRef)(w);de.current=w;let H=(0,P.useRef)(ee);H.current=ee;let ce=(0,P.useRef)(G);ce.current=G;let q=It(ge);(0,P.useEffect)(()=>{if(typeof document>"u")return;let c=new Ee.AIAutocomplete(document.createElement("div"),{renderMode:"headless",apiConfig:r,additionalContext:a,optionOverrides:t,maskCompletedText:i,columns:s,dropdownTrigger:g,optionsPosition:b,closeDropdownOnBlur:v,showNonTappableOptions:m,source:S,value:f,completedParams:L,onSubmit:(...R)=>le.current?.(...R),onError:(...R)=>N.current?.(...R),onChange:(...R)=>ve.current?.(...R),onParamsChange:(...R)=>ae.current?.(...R),onFocus:()=>oe.current?.(),onBlur:()=>de.current?.(),onProductSelect:R=>ce.current?.(R),setCursor:R=>H.current?.(R),products:q.config});h.current=c,te(c.getState());let z=c.subscribe(R=>te(R));return()=>{z(),c.destroy(),h.current===c&&(h.current=null)}},[]),(0,P.useEffect)(()=>{f!==void 0&&h.current?.setValue(f)},[f]),(0,P.useEffect)(()=>{L!==void 0&&h.current?.setCompletedParams(L)},[L]);let j=JSON.stringify(r??null),V;try{V=JSON.stringify(a??null)}catch{V="[unstringifiable]"}let p=(0,P.useRef)(t),Y=(0,P.useRef)(0);if(t!==p.current){let c=p.current,z=t,R=Object.keys(c??{}),Se=Object.keys(z??{});(R.length!==Se.length||Se.some(xe=>!c?.[xe]||z[xe]!==c[xe]))&&Y.current++,p.current=t}(0,P.useEffect)(()=>{h.current?.update({apiConfig:r,additionalContext:a,optionOverrides:t,dropdownTrigger:g,optionsPosition:b,closeDropdownOnBlur:v,showNonTappableOptions:m})},[j,V,Y.current,g,b,v,m]);let l=(0,P.useRef)(!1);(0,P.useEffect)(()=>{if(!l.current){l.current=!0;return}h.current?.update({products:q.config})},[q.enabled]);let u=(0,P.useRef)(null);u.current===null&&(u.current={handleTextChange:c=>h.current?.handleTextChange(c),handleKeyDown:c=>{let z="nativeEvent"in c?c.nativeEvent:c;h.current?.handleKeyDown(z)},setFocused:c=>h.current?.setFocused(c),startEditingParam:c=>h.current?.startEditingParam(c),exitEditMode:()=>h.current?.exitEditMode(),handleCaretAfterInput:c=>h.current?.handleCaretAfterInput(c),handleCaretMove:c=>h.current?.handleCaretMove(c),replaceEditingRange:c=>h.current?.replaceEditingRange(c)??!1,setActivePill:c=>h.current?.setActivePill(c),skipActivePill:()=>h.current?.skipActivePill(),removeLastParam:()=>h.current?.removeLastParam(),clearNewParamId:()=>h.current?.clearNewParamId(),reset:()=>h.current?.reset(),selectOption:c=>h.current?.selectOption(c),selectProduct:c=>h.current?.selectProduct(c),setActiveDropdownIndex:c=>h.current?.setActiveDropdownIndex(c),showPreviousMonth:()=>h.current?.showPreviousMonth(),showNextMonth:()=>h.current?.showNextMonth(),handleFocus:()=>h.current?.setFocused(!0),handleBlur:()=>h.current?.setFocused(!1)});let n=u.current,k=(0,P.useCallback)(c=>{let z=c.target.value,Se=z.length>0&&!c.nativeEvent?.isComposing&&z[0]!==z[0].toUpperCase()?z[0].toUpperCase()+z.slice(1):z;h.current?.handleTextChange(Se)},[]),_=(0,P.useCallback)(c=>{h.current?.handleKeyDown(c.nativeEvent)},[]),D=h.current,d=be??Qt,Q=f!==void 0?f:d.text,ie=L!==void 0?L:d.completedParams,pe=d.actionableSuggestions,ke=pe[0],we=D?.listboxId??"",Ae=d.activeDropdownIndex>=0&&D?`${we}-option-${d.activeDropdownIndex}`:void 0,O=d.editingParam,ue=d.editingIdentified,Re=O?{type:O.suggestionType,text:O.suggestionPlaceholder,required:!0,options:O.options}:ue?{type:ue.type,text:(0,Ee.identifiedParamLabel)(ue.type),required:!0,options:[]}:null,Ne=Re??ke,je=Re?[Re]:pe,ze=!D||d.isLoading&&!d.editingParam&&!d.inSelectionAnimation;return{completedParams:ie,skippedParams:d.skippedParams,suggestionPills:pe,setActivePill:n.setActivePill,skipActivePill:n.skipActivePill,removeLastParam:n.removeLastParam,segments:d.segments,newParamId:d.newParamId,clearNewParamId:n.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:we,error:d.error,products:d.products,selectProduct:n.selectProduct,handleTextChange:n.handleTextChange,handleKeyDown:n.handleKeyDown,setFocused:n.setFocused,editingParam:O,editingIdentified:ue,editingAnchor:d.editingAnchor,caretOffset:d.caretOffset,startEditingParam:n.startEditingParam,exitEditMode:n.exitEditMode,handleCaretAfterInput:n.handleCaretAfterInput,handleCaretMove:n.handleCaretMove,replaceEditingRange:n.replaceEditingRange,inputProps:{value:Q,placeholder:d.placeholderText||void 0,onChange:k,onKeyDown:_,onFocus:n.handleFocus,onBlur:n.handleBlur,role:"combobox","aria-expanded":d.isDropdownOpen,"aria-activedescendant":Ae,"aria-autocomplete":"list","aria-controls":we},reset:n.reset,dropdownProps:{suggestions:Ne?[{...Ne,options:d.filteredOptions}]:[],activeIndex:d.activeDropdownIndex,onSelect:n.selectOption,onHighlight:n.setActiveDropdownIndex,isOpen:d.isDropdownOpen,id:we,pills:je,activeSelected:d.isActivePillSelected,onPillClick:n.setActivePill,onSkip:n.skipActivePill,showSkipButton:(y??!0)&&!O&&!ue,skipDisabled:d.inSelectionAnimation,isLoading:ze,isInputEmpty:Q.trim().length===0,products:d.products,onProductSelect:n.selectProduct,onProductFocusChange:n.setFocused,formatType:d.activeFormatType,dateView:d.dateView,selectedDateIso:ue?ue.iso:(0,Ee.selectedIsoFromText)(O?.text),onPreviousMonth:n.showPreviousMonth,onNextMonth:n.showNextMonth,optionsPosition:b??"below"}}}var U=require("@magicx-eng/ai-autocomplete-vanilla"),x=require("react"),$e;function Xt(){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 At(e){let{segments:o,newParamId:t,editingParam:i,editingIdentified:r,editingAnchor:a,caretOffset:s,placeholderText:g,isFocused:b,isDropdownOpen:v,listboxId:m,activeDescendantId:y,autoFocus:I,handleTextChange:w,handleKeyDown:f,handleCaretAfterInput:L,handleCaretMove:$,startEditingParam:se,replaceEditingRange:ge,setFocused:G}=e,S=(0,x.useRef)(null),ee=(0,x.useRef)(!1),h=(0,x.useRef)(""),be=(0,x.useRef)(""),te=(0,x.useRef)(null),le=(0,x.useRef)(0);te.current=s,(0,x.useEffect)(()=>{if(!I)return;let l=S.current;if(!l)return;document.activeElement===l?G(!0):l.focus();let u=l.ownerDocument??document,n=u.getSelection(),k=n&&n.rangeCount>0&&l.contains(n.anchorNode);if(n&&!k){let _=u.createRange();_.selectNodeContents(l),_.collapse(!0),n.removeAllRanges(),n.addRange(_)}},[I,G]),(0,x.useEffect)(()=>{let l=S.current;if(!l)return;let u=l.ownerDocument??document,n=()=>{let k=u.getSelection();if(!k||k.rangeCount===0||!k.anchorNode||!l.contains(k.anchorNode))return;let _=k.anchorNode,D=_.nodeType===Node.ELEMENT_NODE?_:_.parentElement,Q=(k.isCollapsed?D?.closest("strong[data-param-id]"):null)?.dataset.paramId??null,ie=i?.id??r?.id??null;if(Q&&Q!==ie){se(Q);return}performance.now()-le.current<50||$((0,U.getCursorOffset)(l))};return u.addEventListener("selectionchange",n),()=>u.removeEventListener("selectionchange",n)},[i,r,se,$]),(0,x.useLayoutEffect)(()=>{let l=S.current;l&&(0,U.renderEditableContent)({input:l,segments:o,newParamId:t,editingParamId:i?.id??null,placeholderText:g??"",isFocused:b})},[o,t,i,g,b]),(0,x.useLayoutEffect)(()=>{let l=h.current,u=t??"";if(h.current=u,!u||u===l)return;let n=S.current;if(!n)return;n.focus();let k=te.current??(0,U.plainTextLength)(n);(0,U.setCursorOffset)(n,k)},[t]),(0,x.useLayoutEffect)(()=>{let l=be.current,u=i?.id??"";if(be.current=u,!u||u===l||a==null)return;let n=S.current;n&&(0,U.setCursorOffset)(n,a)},[i,a]);let N=(0,x.useCallback)(()=>{if(ee.current)return;let l=S.current;if(!l)return;let u=(0,U.extractPlainText)(l),k=u.length>0&&u[0]!==u[0].toUpperCase()?u[0].toUpperCase()+u.slice(1):u;w(k)},[w]),ve=(0,x.useCallback)(()=>{le.current=performance.now(),N();let l=S.current;l&&L((0,U.getCursorOffset)(l))},[N,L]);(0,x.useEffect)(()=>{let l=S.current;if(!l)return;let u=n=>{let k=n,_=k.inputType;if(_==="insertParagraph"||_==="insertLineBreak"||_==="insertFromDrop"){n.preventDefault();return}if(_.startsWith("insert")||_.startsWith("delete")){let D=_.startsWith("delete")?"":k.data??"";ge(D)&&n.preventDefault()}};return l.addEventListener("beforeinput",u),()=>l.removeEventListener("beforeinput",u)},[ge]);let ae=(0,x.useCallback)(()=>{ee.current=!0},[]),oe=(0,x.useCallback)(()=>{ee.current=!1,N()},[N]),de=(0,x.useCallback)(l=>{l.preventDefault();let u=S.current;if(!u)return;let n=(l.clipboardData.getData("text/plain")??"").replace(/\r?\n/g," ");if(!n)return;let k=u.ownerDocument??document,_=k.getSelection();if(!_||_.rangeCount===0)return;let D=_.getRangeAt(0);if(!u.contains(D.startContainer))return;D.deleteContents();let d=k.createTextNode(n);D.insertNode(d),D.setStartAfter(d),D.collapse(!0),_.removeAllRanges(),_.addRange(D),N()},[N]),H=(0,x.useCallback)(l=>f(l),[f]),ce=(0,x.useCallback)(()=>G(!0),[G]),q=(0,x.useCallback)(()=>G(!1),[G]),j=(0,x.useCallback)(()=>S.current?.focus(),[]),V=(0,x.useCallback)(()=>S.current?.blur(),[]),p=(0,x.useCallback)(()=>{let l=S.current;return l?(0,U.extractPlainText)(l):""},[]),Y=Xt()?"plaintext-only":"true";return{inputRef:S,editorProps:{ref:S,contentEditable:Y,suppressContentEditableWarning:!0,tabIndex:0,role:"combobox","aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":m,"aria-expanded":v,"aria-activedescendant":y,spellCheck:!0,enterKeyHint:"send",onInput:ve,onKeyDown:H,onCompositionStart:ae,onCompositionEnd:oe,onPaste:de,onFocus:ce,onBlur:q},getPlainText:p,focus:j,blur:V}}var J=require("react/jsx-runtime");function Zt(e){return e!=="auto"?e:typeof window>"u"||window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}var St=(0,T.forwardRef)(function({onSubmit:o,onError:t,optionOverrides:i,maskCompletedText:r,className:a,apiConfig:s,additionalContext:g,columns:b,pillPlacement:v="dropdown",mode:m="auto",optionsPosition:y="below",animations:I=!0,dropdownTrigger:w,closeDropdownOnBlur:f,showNonTappableOptions:L,showSkipButton:$,autoFocus:se=!0,onFocus:ge,onBlur:G,value:S,completedParams:ee,onChange:h,onParamsChange:be,products:te,onProductSelect:le,submitButton:N},ve){let ae=(0,T.useRef)(null),oe=(0,T.useRef)(null),de=(0,T.useRef)(()=>{}),H=(0,T.useRef)(null),ce=(0,T.useRef)(null);(0,T.useEffect)(()=>{let A=ae.current;if(A)return H.current?H.current.setMode(m):H.current=new Te.ModeController(A,m),()=>{H.current?.destroy(),H.current=null}},[m]);let q=(0,T.useCallback)(A=>{let ye=ce.current?.current;ye&&(ye.focus(),(0,Te.setCursorOffset)(ye,A))},[]),{completedParams:j,skippedParams:V,suggestionPills:p,setActivePill:Y,skipActivePill:l,segments:u,newParamId:n,clearNewParamId:k,placeholderText:_,isFocused:D,isDropdownOpen:d,isActivePillSelected:Q,isLoading:ie,activeIndex:pe,listboxId:ke,handleTextChange:we,handleKeyDown:Ae,setFocused:O,editingParam:ue,editingIdentified:Re,editingAnchor:Ne,caretOffset:je,startEditingParam:ze,handleCaretAfterInput:c,handleCaretMove:z,replaceEditingRange:R,dropdownProps:Se,reset:xe}=qe({onSubmit:A=>de.current(A),onError:t,optionOverrides:i,maskCompletedText:r,apiConfig:s,additionalContext:g,columns:b,dropdownTrigger:w,optionsPosition:y,closeDropdownOnBlur:f,showNonTappableOptions:L,showSkipButton:$,onFocus:ge,onBlur:G,value:S,completedParams:ee,onChange:h,onParamsChange:be,products:te,onProductSelect:le,source:"full-sdk",setCursor:q});(0,T.useEffect)(()=>{if(!n)return;let A=window.setTimeout(()=>k(),650);return()=>window.clearTimeout(A)},[n,k]);let Ct=pe>=0?`${ke}-option-${pe}`:void 0,{inputRef:Ve,editorProps:Dt,focus:Oe,blur:at,getPlainText:ot}=At({segments:u,newParamId:n,editingParam:ue,editingIdentified:Re,editingAnchor:Ne,caretOffset:je,placeholderText:_,isFocused:D,isDropdownOpen:d,listboxId:ke,activeDescendantId:Ct,autoFocus:se,handleTextChange:we,handleKeyDown:Ae,handleCaretAfterInput:c,handleCaretMove:z,startEditingParam:ze,replaceEditingRange:R,setFocused:O});ce.current=Ve,(0,T.useLayoutEffect)(()=>{let A=oe.current,ye=Ve.current;if(!A||!ye)return;let it=()=>{let rt=A.firstElementChild;if(!rt)return;let Lt=rt.getBoundingClientRect(),Mt=ye.getBoundingClientRect();Lt.top>=Mt.bottom-2?A.setAttribute("data-aia-pill-wrapped",""):A.removeAttribute("data-aia-pill-wrapped")};it();let nt=new ResizeObserver(it);return nt.observe(ye),()=>nt.disconnect()},[u,p.length,ie,Ve]),(0,T.useImperativeHandle)(ve,()=>({focus:Oe,blur:at,reset:xe,setMode:A=>H.current?.setMode(A),skipActivePill:l}),[Oe,at,xe,l]);let Be=!!u.length||j.length>0,Ye=(0,T.useCallback)(()=>{if(!Be)return;let A=ot();o((0,Te.buildSubmitResult)(A,j,V)),xe()},[Be,j,V,o,xe,ot]);de.current=Ye;let Et=(0,T.useCallback)(A=>{A.target?.closest("[data-aia-pill]")||Oe()},[Oe]),Tt=v==="inline",Rt=v==="dropdown";return(0,J.jsxs)("div",{ref:ae,className:`magicx-aia ${Pe.container} ${a??""}`,"data-pill-placement":v,"data-options-position":y,"data-animations":I?"on":"off","data-mode":Zt(m),children:[(0,J.jsx)(We,{...Se,showPills:Rt}),(0,J.jsxs)("div",{className:Pe.inputWrapper,onClick:Et,children:[(0,J.jsxs)("div",{className:Pe.editorArea,"data-aia-editor":"",children:[(0,J.jsx)("div",{...Dt,className:Pe.input,"data-aia-input":""}),Tt&&(ie||p.length>0)&&(0,J.jsx)("span",{ref:oe,className:Pe.pillListContainer,"data-aia-pill-list-container":"",children:(0,J.jsx)(Ge,{pills:p,activePillIndex:0,activeSelected:Q,onSelectPill:Y,loading:ie})})]}),N===null?null:N===void 0?(0,J.jsx)(Pt,{disabled:!Be,onClick:Ye}):(0,J.jsx)("span",{"data-aia-submit":"",className:Pe.submitSlot,onClick:A=>{Be&&(A.stopPropagation(),Ye())},children:N})]})]})});0&&(module.exports={AIAutocomplete,AIAutocompleteDropdown,WEEKDAY_LABELS,buildSubmitResult,cellDay,cellIso,formatDate,isoDate,monthLabel,parseDate,parseLooseDate,useAIAutocomplete,withSkippedParams});
|
|
1659
1584
|
//# sourceMappingURL=index.js.map
|