@mhmo91/schmancy 0.10.41 → 0.10.43
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/custom-elements.json +291 -179
- package/dist/SchmancyElement-CeKrBW2j.cjs +2 -0
- package/dist/SchmancyElement-CeKrBW2j.cjs.map +1 -0
- package/dist/SchmancyElement-Ob9yGkiG.js +286 -0
- package/dist/SchmancyElement-Ob9yGkiG.js.map +1 -0
- package/dist/agent/schmancy.agent.js +4057 -4082
- package/dist/agent/schmancy.agent.js.map +1 -1
- package/dist/agent/schmancy.manifest.json +225 -94
- package/dist/animation-CCOIW4wJ.cjs.map +1 -1
- package/dist/animation-DCznELuT.js.map +1 -1
- package/dist/area-CbajcnmJ.cjs +21 -0
- package/dist/area-CbajcnmJ.cjs.map +1 -0
- package/dist/{area-BiM7V2ns.js → area-MxLAyWgV.js} +22 -22
- package/dist/area-MxLAyWgV.js.map +1 -0
- package/dist/area.cjs +1 -1
- package/dist/area.js +1 -1
- package/dist/{audio-CxO_j__6.js → audio-B_0PGwYC.js} +1 -1
- package/dist/audio-B_0PGwYC.js.map +1 -0
- package/dist/{audio-xXFfMPCS.cjs → audio-CpwrIaw-.cjs} +1 -1
- package/dist/audio-CpwrIaw-.cjs.map +1 -0
- package/dist/audio.cjs +1 -1
- package/dist/audio.js +2 -2
- package/dist/autocomplete-CILzaDB7.cjs +115 -0
- package/dist/autocomplete-CILzaDB7.cjs.map +1 -0
- package/dist/{autocomplete-DUBY9RtH.js → autocomplete-DV9RxCun.js} +113 -113
- package/dist/autocomplete-DV9RxCun.js.map +1 -0
- package/dist/autocomplete.cjs +1 -1
- package/dist/autocomplete.js +1 -1
- package/dist/avatar.cjs +1 -1
- package/dist/avatar.cjs.map +1 -1
- package/dist/avatar.js +4 -4
- package/dist/avatar.js.map +1 -1
- package/dist/badge.cjs +1 -1
- package/dist/badge.js +1 -1
- package/dist/{boat-ScvAima3.js → boat-DoZGgQ0P.js} +6 -8
- package/dist/{boat-ScvAima3.js.map → boat-DoZGgQ0P.js.map} +1 -1
- package/dist/{boat-BIYaPAHp.cjs → boat-sg0cWO8a.cjs} +3 -5
- package/dist/{boat-BIYaPAHp.cjs.map → boat-sg0cWO8a.cjs.map} +1 -1
- package/dist/boat.cjs +1 -1
- package/dist/boat.js +1 -1
- package/dist/breadcrumb.cjs +32 -31
- package/dist/breadcrumb.cjs.map +1 -1
- package/dist/breadcrumb.js +33 -32
- package/dist/breadcrumb.js.map +1 -1
- package/dist/busy-Brs-TDh9.cjs +133 -0
- package/dist/busy-Brs-TDh9.cjs.map +1 -0
- package/dist/busy-g4LoQmhB.js +172 -0
- package/dist/busy-g4LoQmhB.js.map +1 -0
- package/dist/busy.cjs +1 -1
- package/dist/busy.js +1 -1
- package/dist/{button-BTpxQ1Kd.cjs → button-Cml67Y_d.cjs} +41 -32
- package/dist/button-Cml67Y_d.cjs.map +1 -0
- package/dist/{button-D7QHfYf4.js → button-DWANpZfD.js} +43 -34
- package/dist/button-DWANpZfD.js.map +1 -0
- package/dist/button.cjs +40 -33
- package/dist/button.cjs.map +1 -1
- package/dist/button.js +42 -35
- package/dist/button.js.map +1 -1
- package/dist/calendar-2dJrw9pR.cjs +58 -0
- package/dist/calendar-2dJrw9pR.cjs.map +1 -0
- package/dist/calendar-kCe5LaBa.js +434 -0
- package/dist/calendar-kCe5LaBa.js.map +1 -0
- package/dist/calendar.cjs +1 -0
- package/dist/calendar.js +2 -0
- package/dist/{card-DCdtJ5Dy.js → card-CS_hYJbz.js} +136 -136
- package/dist/card-CS_hYJbz.js.map +1 -0
- package/dist/card-d0KhTnx5.cjs +177 -0
- package/dist/card-d0KhTnx5.cjs.map +1 -0
- package/dist/card.cjs +1 -1
- package/dist/card.js +1 -1
- package/dist/{checkbox-DVtyPk7l.js → checkbox-Bjp7kWuE.js} +2 -2
- package/dist/{checkbox-DVtyPk7l.js.map → checkbox-Bjp7kWuE.js.map} +1 -1
- package/dist/{checkbox-CYGOVPP-.cjs → checkbox-DZ2Wrz7Y.cjs} +1 -1
- package/dist/{checkbox-CYGOVPP-.cjs.map → checkbox-DZ2Wrz7Y.cjs.map} +1 -1
- package/dist/checkbox.cjs +1 -1
- package/dist/checkbox.js +1 -1
- package/dist/{chips-DVes-BSz.cjs → chips-BHBVkxsa.cjs} +142 -153
- package/dist/chips-BHBVkxsa.cjs.map +1 -0
- package/dist/{chips-C5bpgWyf.js → chips-DACeW7YL.js} +127 -138
- package/dist/chips-DACeW7YL.js.map +1 -0
- package/dist/chips.cjs +1 -1
- package/dist/chips.js +2 -2
- package/dist/connectivity.cjs +54 -38
- package/dist/connectivity.cjs.map +1 -1
- package/dist/connectivity.js +56 -40
- package/dist/connectivity.js.map +1 -1
- package/dist/content-drawer.cjs +1 -1
- package/dist/content-drawer.js +1 -1
- package/dist/cursor-glow-Ah7VXSj7.js.map +1 -1
- package/dist/cursor-glow-Bulq-38P.cjs.map +1 -1
- package/dist/date-range-CVAWMdar.cjs +138 -0
- package/dist/date-range-CVAWMdar.cjs.map +1 -0
- package/dist/date-range-D2NZU5Yg.js +433 -0
- package/dist/date-range-D2NZU5Yg.js.map +1 -0
- package/dist/{date-range-inline-Dx4Reboo.cjs → date-range-inline-CGM0SPK9.cjs} +2 -4
- package/dist/date-range-inline-CGM0SPK9.cjs.map +1 -0
- package/dist/{date-range-inline-DPqY9YYf.js → date-range-inline-D6Ozerzw.js} +3 -5
- package/dist/date-range-inline-D6Ozerzw.js.map +1 -0
- package/dist/date-range-inline.cjs +1 -1
- package/dist/date-range-inline.js +1 -1
- package/dist/date-range.cjs +1 -1
- package/dist/date-range.js +2 -2
- package/dist/dayjs.min-CvRZTfam.cjs +1 -0
- package/dist/dayjs.min-CvRZTfam.cjs.map +1 -0
- package/dist/dayjs.min-DnELezPs.js +296 -0
- package/dist/dayjs.min-DnELezPs.js.map +1 -0
- package/dist/delay.cjs +1 -1
- package/dist/delay.js +3 -3
- package/dist/{details-BnleHmYe.js → details-Ct1_GwKr.js} +104 -92
- package/dist/details-Ct1_GwKr.js.map +1 -0
- package/dist/{details-Bx2jSJxG.cjs → details-D4fVOaj4.cjs} +109 -97
- package/dist/details-D4fVOaj4.cjs.map +1 -0
- package/dist/details.cjs +1 -1
- package/dist/details.js +1 -1
- package/dist/{directives-CYf2fAdA.cjs → directives-B2VxfwRL.cjs} +1 -1
- package/dist/directives-B2VxfwRL.cjs.map +1 -0
- package/dist/{directives-d1rEbW1A.js → directives-Dj8jlv-Q.js} +3 -3
- package/dist/directives-Dj8jlv-Q.js.map +1 -0
- package/dist/directives.cjs +1 -1
- package/dist/directives.js +2 -2
- package/dist/discovery.service-CIa3Eeuk.cjs.map +1 -1
- package/dist/discovery.service-DZFxtRwW.js.map +1 -1
- package/dist/divider-B3v33OnX.cjs +57 -0
- package/dist/divider-B3v33OnX.cjs.map +1 -0
- package/dist/divider-BJHW3q11.js +89 -0
- package/dist/divider-BJHW3q11.js.map +1 -0
- package/dist/divider.cjs +1 -1
- package/dist/divider.js +1 -1
- package/dist/dropdown.cjs +40 -40
- package/dist/dropdown.cjs.map +1 -1
- package/dist/dropdown.js +41 -41
- package/dist/dropdown.js.map +1 -1
- package/dist/{expand-DNrWuG_-.js → expand-BT8mOu8Q.js} +103 -97
- package/dist/expand-BT8mOu8Q.js.map +1 -0
- package/dist/expand-D0YdR9nR.cjs +147 -0
- package/dist/expand-D0YdR9nR.cjs.map +1 -0
- package/dist/expand.cjs +1 -1
- package/dist/expand.js +1 -1
- package/dist/fab.cjs +1 -1
- package/dist/fab.cjs.map +1 -1
- package/dist/fab.js +2 -2
- package/dist/fab.js.map +1 -1
- package/dist/{float-V7VQKTb8.cjs → float-BPQlDyai.cjs} +1 -1
- package/dist/{float-V7VQKTb8.cjs.map → float-BPQlDyai.cjs.map} +1 -1
- package/dist/{float-C_CMle0q.js → float-BQcxj3i_.js} +2 -2
- package/dist/{float-C_CMle0q.js.map → float-BQcxj3i_.js.map} +1 -1
- package/dist/float.cjs +1 -1
- package/dist/float.js +1 -1
- package/dist/{form-DaaAQd2A.cjs → form-CoWFnClb.cjs} +8 -13
- package/dist/form-CoWFnClb.cjs.map +1 -0
- package/dist/{form-CMgYSZ3y.js → form-hC2LvCHX.js} +10 -15
- package/dist/form-hC2LvCHX.js.map +1 -0
- package/dist/form.cjs +12 -13
- package/dist/form.cjs.map +1 -1
- package/dist/form.js +23 -24
- package/dist/form.js.map +1 -1
- package/dist/gravity-6pL6CfIr.cjs.map +1 -1
- package/dist/gravity-sVK3zGBF.js.map +1 -1
- package/dist/handover/agent-runtime-followups.md +1 -1
- package/dist/handover/agent-runtime-v1.md +3 -3
- package/dist/{hashContent-iRZJJWtE.cjs.map → hashContent--s09Ed_g.cjs.map} +1 -1
- package/dist/{hashContent-BqU6v1Xr.js.map → hashContent-CAvrQ56N.js.map} +1 -1
- package/dist/icons-BeGKDZ-k.cjs +22 -0
- package/dist/icons-BeGKDZ-k.cjs.map +1 -0
- package/dist/{icons-mbpHO_73.js → icons-DEJnIxml.js} +20 -22
- package/dist/icons-DEJnIxml.js.map +1 -0
- package/dist/icons.cjs +1 -1
- package/dist/icons.js +1 -1
- package/dist/{iframe-88SN5JPu.cjs → iframe-BkSukM9C.cjs} +9 -9
- package/dist/iframe-BkSukM9C.cjs.map +1 -0
- package/dist/{iframe-U3P1DnQv.js → iframe-V3S-bwEY.js} +10 -10
- package/dist/iframe-V3S-bwEY.js.map +1 -0
- package/dist/iframe.cjs +1 -1
- package/dist/iframe.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +61 -60
- package/dist/{input-CPWvGjE4.js → input-CPFCSQld.js} +3 -10
- package/dist/input-CPFCSQld.js.map +1 -0
- package/dist/{input-BY4Korc5.cjs → input-DSfwfhhj.cjs} +2 -9
- package/dist/input-DSfwfhhj.cjs.map +1 -0
- package/dist/input-chip-BUuFJUky.cjs +129 -0
- package/dist/input-chip-BUuFJUky.cjs.map +1 -0
- package/dist/{input-chip-CCZ3i3Sf.js → input-chip-C3a1fwKB.js} +87 -104
- package/dist/input-chip-C3a1fwKB.js.map +1 -0
- package/dist/input.cjs +1 -1
- package/dist/input.js +1 -1
- package/dist/json.cjs +5 -1
- package/dist/json.cjs.map +1 -1
- package/dist/json.js +8 -4
- package/dist/json.js.map +1 -1
- package/dist/kbd.cjs +28 -28
- package/dist/kbd.cjs.map +1 -1
- package/dist/kbd.js +29 -29
- package/dist/kbd.js.map +1 -1
- package/dist/{layout-BhfC26Ks.cjs → layout-CdyHy_oX.cjs} +1 -1
- package/dist/layout-CdyHy_oX.cjs.map +1 -0
- package/dist/{layout-DC0Npqu7.js → layout-k6fOkpif.js} +1 -1
- package/dist/layout-k6fOkpif.js.map +1 -0
- package/dist/layout.cjs +26 -26
- package/dist/layout.cjs.map +1 -1
- package/dist/layout.js +27 -27
- package/dist/layout.js.map +1 -1
- package/dist/lazy-BaAiIUru.js.map +1 -1
- package/dist/lazy-C-7a4FAe.cjs.map +1 -1
- package/dist/{lightbox-BSwWvDQc.js → lightbox-DIG0VLOK.js} +8 -14
- package/dist/lightbox-DIG0VLOK.js.map +1 -0
- package/dist/{lightbox-KrZQH9w9.cjs → lightbox-E5rgd-hu.cjs} +7 -13
- package/dist/lightbox-E5rgd-hu.cjs.map +1 -0
- package/dist/lightbox.cjs +1 -1
- package/dist/lightbox.js +1 -1
- package/dist/list-BRz0rDSH.cjs +47 -0
- package/dist/list-BRz0rDSH.cjs.map +1 -0
- package/dist/{list-BwGtAAfi.js → list-NrOYDPBo.js} +48 -34
- package/dist/list-NrOYDPBo.js.map +1 -0
- package/dist/list.cjs +1 -1
- package/dist/list.js +1 -1
- package/dist/magnetic-DKtc4umC.cjs.map +1 -1
- package/dist/magnetic-DaOOv5Dz.js.map +1 -1
- package/dist/{menu-DX8d96x-.js → menu-B1Ei9SVj.js} +12 -12
- package/dist/menu-B1Ei9SVj.js.map +1 -0
- package/dist/{menu-jT_yAk5V.cjs → menu-Duvl66Nl.cjs} +10 -10
- package/dist/menu-Duvl66Nl.cjs.map +1 -0
- package/dist/menu.cjs +1 -1
- package/dist/menu.js +1 -1
- package/dist/{mixins-XGVIOvKt.cjs → mixins-Cjn20BQH.cjs} +42 -170
- package/dist/mixins-Cjn20BQH.cjs.map +1 -0
- package/dist/{mixins-COeG4DiX.js → mixins-q4KAL8Xr.js} +43 -177
- package/dist/mixins-q4KAL8Xr.js.map +1 -0
- package/dist/mixins.cjs +1 -1
- package/dist/mixins.js +2 -2
- package/dist/nav-drawer.cjs +1 -1
- package/dist/nav-drawer.js +1 -1
- package/dist/navigation-bar.cjs +1 -1
- package/dist/navigation-bar.js +1 -1
- package/dist/navigation-rail.cjs +2 -4
- package/dist/navigation-rail.cjs.map +1 -1
- package/dist/navigation-rail.js +3 -5
- package/dist/navigation-rail.js.map +1 -1
- package/dist/{notification-CAJVpLne.js → notification-COhUhUCr.js} +5 -7
- package/dist/notification-COhUhUCr.js.map +1 -0
- package/dist/{notification-DO3VXceY.cjs → notification-DsdA_MJe.cjs} +2 -4
- package/dist/notification-DsdA_MJe.cjs.map +1 -0
- package/dist/notification.cjs +1 -1
- package/dist/notification.js +1 -1
- package/dist/{option-JISY0wZJ.js → option-BIzgTbXz.js} +20 -20
- package/dist/option-BIzgTbXz.js.map +1 -0
- package/dist/option-C5hhqR2z.cjs +43 -0
- package/dist/option-C5hhqR2z.cjs.map +1 -0
- package/dist/option.cjs +1 -1
- package/dist/option.js +1 -1
- package/dist/{overlay-B1jVf-ge.cjs → overlay-BzgF8P7i.cjs} +48 -41
- package/dist/overlay-BzgF8P7i.cjs.map +1 -0
- package/dist/{overlay-CT-tMHDX.js → overlay-LoRRemny.js} +52 -45
- package/dist/overlay-LoRRemny.js.map +1 -0
- package/dist/overlay-stack-Bdr9lOqi.cjs.map +1 -1
- package/dist/overlay-stack-D2rgxQLh.js.map +1 -1
- package/dist/overlay.cjs +1 -1
- package/dist/{overlay.confirm-body-Dn-Zgogx.js → overlay.confirm-body-D0b1MoCw.js} +30 -45
- package/dist/overlay.confirm-body-D0b1MoCw.js.map +1 -0
- package/dist/{overlay.confirm-body-mYDYoJL8.cjs → overlay.confirm-body-DCneq73Z.cjs} +22 -37
- package/dist/overlay.confirm-body-DCneq73Z.cjs.map +1 -0
- package/dist/overlay.js +3 -3
- package/dist/{overlay.service-yqTOyLlr.js → overlay.service-BuUeti6X.js} +2 -2
- package/dist/overlay.service-BuUeti6X.js.map +1 -0
- package/dist/{overlay.service-BQmva9GY.cjs → overlay.service-MMTiW2T3.cjs} +1 -1
- package/dist/overlay.service-MMTiW2T3.cjs.map +1 -0
- package/dist/{progress-CGWozq_n.js → progress-D7n3SKAO.js} +50 -50
- package/dist/progress-D7n3SKAO.js.map +1 -0
- package/dist/progress-DsCnFsH5.cjs +51 -0
- package/dist/progress-DsCnFsH5.cjs.map +1 -0
- package/dist/progress.cjs +1 -1
- package/dist/progress.js +1 -1
- package/dist/{radio-group-DoSX5D2V.cjs → radio-group-CaAjg9UV.cjs} +1 -1
- package/dist/radio-group-CaAjg9UV.cjs.map +1 -0
- package/dist/{radio-group-CXkq6qAF.js → radio-group-Drpl6Pl8.js} +2 -2
- package/dist/radio-group-Drpl6Pl8.js.map +1 -0
- package/dist/radio-group.cjs +1 -1
- package/dist/radio-group.js +1 -1
- package/dist/range.cjs +4 -2
- package/dist/range.cjs.map +1 -1
- package/dist/range.js +5 -3
- package/dist/range.js.map +1 -1
- package/dist/reduced-motion-D-L12p7G.js.map +1 -1
- package/dist/reduced-motion-Ds-HjMzn.cjs.map +1 -1
- package/dist/{rxjs-utils-Csnks202.cjs.map → rxjs-utils-4P2v57ke.cjs.map} +1 -1
- package/dist/{rxjs-utils-d-ivVN84.js.map → rxjs-utils-JMFdgQSl.js.map} +1 -1
- package/dist/rxjs-utils.cjs +1 -1
- package/dist/rxjs-utils.js +1 -1
- package/dist/search-DPKoC-dT.cjs.map +1 -1
- package/dist/search-MvIBA93K.js.map +1 -1
- package/dist/{select-CU90i50_.js → select-CTXkrrVZ.js} +13 -13
- package/dist/select-CTXkrrVZ.js.map +1 -0
- package/dist/select-DcLcpPCh.cjs +56 -0
- package/dist/select-DcLcpPCh.cjs.map +1 -0
- package/dist/select.cjs +1 -1
- package/dist/select.js +1 -1
- package/dist/skeleton.cjs +37 -33
- package/dist/skeleton.cjs.map +1 -1
- package/dist/skeleton.js +38 -34
- package/dist/skeleton.js.map +1 -1
- package/dist/skills/schmancy/surface.md +79 -39
- package/dist/skills/surface.md +79 -39
- package/dist/slider.cjs +31 -31
- package/dist/slider.cjs.map +1 -1
- package/dist/slider.js +32 -32
- package/dist/slider.js.map +1 -1
- package/dist/{sound.service-m8WjOhjn.js → sound.service-AJwuk3yr.js} +1 -1
- package/dist/sound.service-AJwuk3yr.js.map +1 -0
- package/dist/{sound.service-Qhr8nCeG.cjs → sound.service-CVsxhQkX.cjs} +1 -1
- package/dist/sound.service-CVsxhQkX.cjs.map +1 -0
- package/dist/{splash-screen-Cs3dbPN3.js → splash-screen-DANfqvlo.js} +23 -26
- package/dist/splash-screen-DANfqvlo.js.map +1 -0
- package/dist/splash-screen-K74cgU6S.cjs +38 -0
- package/dist/splash-screen-K74cgU6S.cjs.map +1 -0
- package/dist/splash-screen.cjs +1 -1
- package/dist/splash-screen.js +1 -1
- package/dist/{src-CCVbLLgC.js → src-DAtcPmCb.js} +295 -389
- package/dist/src-DAtcPmCb.js.map +1 -0
- package/dist/src-DuRvYagm.cjs +237 -0
- package/dist/src-DuRvYagm.cjs.map +1 -0
- package/dist/{state--x58-AuK.cjs → state-BWQiqN6I.cjs} +1 -1
- package/dist/state-BWQiqN6I.cjs.map +1 -0
- package/dist/{state-QSwQ61sA.js → state-DBA_gzJO.js} +1 -1
- package/dist/state-DBA_gzJO.js.map +1 -0
- package/dist/state.cjs +1 -1
- package/dist/state.js +2 -2
- package/dist/steps.cjs +20 -12
- package/dist/steps.cjs.map +1 -1
- package/dist/steps.js +21 -13
- package/dist/steps.js.map +1 -1
- package/dist/surface-COBvWWFb.cjs +7 -0
- package/dist/surface-COBvWWFb.cjs.map +1 -0
- package/dist/{surface-cqMsHJHM.js → surface-DXk1X1tL.js} +9 -9
- package/dist/surface-DXk1X1tL.js.map +1 -0
- package/dist/surface.cjs +1 -1
- package/dist/surface.js +1 -1
- package/dist/switch.cjs +13 -4
- package/dist/switch.cjs.map +1 -1
- package/dist/switch.js +14 -5
- package/dist/switch.js.map +1 -1
- package/dist/table.cjs +4 -10
- package/dist/table.cjs.map +1 -1
- package/dist/table.js +5 -11
- package/dist/table.js.map +1 -1
- package/dist/{tabs-Ib0Mh__1.js → tabs-BYhFWnsx.js} +7 -7
- package/dist/tabs-BYhFWnsx.js.map +1 -0
- package/dist/{tabs-Dk9UDWpq.cjs → tabs-CJwB0fr0.cjs} +6 -6
- package/dist/tabs-CJwB0fr0.cjs.map +1 -0
- package/dist/tabs.cjs +1 -1
- package/dist/tabs.js +1 -1
- package/dist/teleport.cjs +1 -1
- package/dist/teleport.js +1 -1
- package/dist/{textarea-CcRsw08B.js → textarea-BjDx1w2g.js} +37 -41
- package/dist/textarea-BjDx1w2g.js.map +1 -0
- package/dist/{textarea-Cntd9tfV.cjs → textarea-CGgznhd6.cjs} +36 -40
- package/dist/textarea-CGgznhd6.cjs.map +1 -0
- package/dist/textarea.cjs +1 -1
- package/dist/textarea.js +1 -1
- package/dist/{theme-wwFbvp5e.cjs → theme-BVul7lHS.cjs} +6 -6
- package/dist/{theme-wwFbvp5e.cjs.map → theme-BVul7lHS.cjs.map} +1 -1
- package/dist/{theme-CKYXG0le.js → theme-Dvm5J8nh.js} +11 -11
- package/dist/{theme-CKYXG0le.js.map → theme-Dvm5J8nh.js.map} +1 -1
- package/dist/{theme-button-iLqT56KA.js → theme-button-Bko5ohFP.js} +2 -2
- package/dist/{theme-button-iLqT56KA.js.map → theme-button-Bko5ohFP.js.map} +1 -1
- package/dist/{theme-button-DE9Lrl7m.cjs → theme-button-YLY7zR1c.cjs} +1 -1
- package/dist/{theme-button-DE9Lrl7m.cjs.map → theme-button-YLY7zR1c.cjs.map} +1 -1
- package/dist/theme-button.cjs +1 -1
- package/dist/theme-button.js +1 -1
- package/dist/theme.cjs +1 -1
- package/dist/{theme.interface-CSt7JUBD.cjs.map → theme.interface-B-qxDsZQ.cjs.map} +1 -1
- package/dist/{theme.interface-odQEpZZH.js.map → theme.interface-B7caS5cg.js.map} +1 -1
- package/dist/theme.js +4 -4
- package/dist/{theme.service-5RjyR7Sy.js → theme.service-D94nm7Bf.js} +1 -1
- package/dist/theme.service-D94nm7Bf.js.map +1 -0
- package/dist/{theme.service-DA6KY52G.cjs → theme.service-h2fXQq7x.cjs} +1 -1
- package/dist/theme.service-h2fXQq7x.cjs.map +1 -0
- package/dist/tooltip.cjs.map +1 -1
- package/dist/tooltip.js.map +1 -1
- package/dist/tree.cjs +14 -14
- package/dist/tree.cjs.map +1 -1
- package/dist/tree.js +15 -15
- package/dist/tree.js.map +1 -1
- package/dist/types.cjs +1 -1
- package/dist/types.cjs.map +1 -1
- package/dist/types.js +19 -2
- package/dist/types.js.map +1 -1
- package/dist/typewriter.cjs.map +1 -1
- package/dist/typewriter.js.map +1 -1
- package/dist/typography-ByF2k5yW.js +358 -0
- package/dist/typography-ByF2k5yW.js.map +1 -0
- package/dist/typography-Cfav17it.cjs +282 -0
- package/dist/typography-Cfav17it.cjs.map +1 -0
- package/dist/typography.cjs +1 -1
- package/dist/typography.js +1 -1
- package/dist/utils-DIXndz6Q.cjs.map +1 -0
- package/dist/utils-dSPH7Oh9.js.map +1 -0
- package/dist/utils.cjs +1 -1
- package/dist/utils.js +1 -1
- package/dist/visually-hidden.cjs +13 -13
- package/dist/visually-hidden.cjs.map +1 -1
- package/dist/visually-hidden.js +14 -14
- package/dist/visually-hidden.js.map +1 -1
- package/dist/window-Br1OmpL-.cjs +67 -0
- package/dist/window-Br1OmpL-.cjs.map +1 -0
- package/dist/{window-Db5ZYY6t.js → window-CCmN4but.js} +28 -20
- package/dist/window-CCmN4but.js.map +1 -0
- package/dist/window.cjs +1 -1
- package/dist/window.js +1 -1
- package/package.json +1 -1
- package/skills/schmancy/surface.md +79 -39
- package/src/area/area.component.ts +249 -163
- package/src/area/area.service.test.ts +994 -1006
- package/src/area/area.service.ts +76 -72
- package/src/area/index.ts +7 -7
- package/src/area/lazy.ts +39 -42
- package/src/area/route.component.ts +54 -52
- package/src/area/router.types.ts +7 -7
- package/src/audio/emotional-sounds.ts +880 -801
- package/src/audio/sound.service.ts +26 -5
- package/src/avatar/avatar.ts +4 -4
- package/src/badge/badge.ts +60 -209
- package/src/badge/index.ts +1 -1
- package/src/boat/boat.ts +2 -4
- package/src/breadcrumb/breadcrumb.ts +37 -32
- package/src/busy/busy.ts +15 -12
- package/src/busy/index.ts +2 -2
- package/src/busy/spinner.ts +132 -119
- package/src/button/button.test.ts +5 -1
- package/src/button/button.ts +113 -72
- package/src/button/icon-button.ts +64 -46
- package/src/button/index.ts +2 -2
- package/src/calendar/calendar.test.ts +504 -0
- package/src/calendar/calendar.ts +587 -0
- package/src/calendar/index.ts +2 -0
- package/src/card/actions.ts +11 -9
- package/src/card/card.ts +79 -77
- package/src/card/content.ts +8 -6
- package/src/card/index.ts +4 -4
- package/src/card/media.ts +50 -50
- package/src/chips/assist-chip.ts +1 -1
- package/src/chips/chips.ts +1 -1
- package/src/chips/filter-chip.ts +1 -1
- package/src/chips/index.ts +1 -1
- package/src/chips/input-chip.ts +1 -1
- package/src/chips/suggestion-chip.ts +1 -1
- package/src/connectivity/connectivity-status.ts +91 -65
- package/src/content-drawer/drawer.service.ts +47 -36
- package/src/content-drawer/drawer.ts +31 -18
- package/src/content-drawer/index.ts +5 -5
- package/src/content-drawer/main.ts +9 -7
- package/src/content-drawer/sheet.ts +8 -6
- package/src/date-range-inline/date-range-inline.ts +523 -522
- package/src/date-range-inline/index.ts +2 -2
- package/src/delay/index.ts +1 -1
- package/src/details/details.ts +119 -105
- package/src/details/index.ts +1 -1
- package/src/directives/ai-badge.ts +1 -5
- package/src/directives/animate-text.ts +43 -31
- package/src/directives/art/effects/howl.ts +1 -4
- package/src/directives/art/effects/samwa.ts +11 -5
- package/src/directives/art/effects/snow.ts +1 -2
- package/src/directives/battery.ts +21 -12
- package/src/directives/confirm-click.ts +9 -17
- package/src/directives/cursor-glow.ts +1 -1
- package/src/directives/cycle-text.ts +7 -21
- package/src/directives/drag.ts +50 -45
- package/src/directives/fyi.ts +1 -6
- package/src/directives/gravity.ts +10 -8
- package/src/directives/hummingbird.ts +256 -107
- package/src/directives/index.ts +29 -29
- package/src/directives/intersect.ts +11 -11
- package/src/directives/layout.ts +25 -36
- package/src/directives/liquid.ts +4 -10
- package/src/directives/living-border.ts +7 -5
- package/src/directives/long-press.ts +2 -1
- package/src/directives/magnetic.ts +7 -6
- package/src/directives/nebula.ts +34 -28
- package/src/directives/overflow-within.ts +18 -20
- package/src/directives/reduced-motion.ts +9 -9
- package/src/directives/reveal.ts +193 -195
- package/src/directives/ripple.ts +9 -7
- package/src/directives/urgent.ts +3 -1
- package/src/directives/working-snake.ts +1 -1
- package/src/discovery/discovery.service.ts +198 -210
- package/src/discovery/index.ts +1 -1
- package/src/divider/divider.ts +49 -47
- package/src/divider/index.ts +1 -1
- package/src/dropdown/dropdown-content.ts +42 -40
- package/src/dropdown/index.ts +2 -2
- package/src/expand/expand-root.component.ts +70 -61
- package/src/expand/expand.component.ts +48 -43
- package/src/fab/fab.test.ts +1 -2
- package/src/fab/fab.ts +2 -4
- package/src/form/fields/autocomplete/autocomplete.scss +6 -2
- package/src/form/fields/autocomplete/autocomplete.ts +712 -724
- package/src/form/fields/autocomplete/index.ts +1 -1
- package/src/form/fields/checkbox/checkbox.ts +1 -4
- package/src/form/fields/chips/assist-chip.ts +69 -72
- package/src/form/fields/chips/chips.ts +14 -15
- package/src/form/fields/chips/filter-chip.ts +36 -32
- package/src/form/fields/chips/index.ts +5 -5
- package/src/form/fields/chips/input-chip.ts +130 -142
- package/src/form/fields/chips/suggestion-chip.ts +69 -72
- package/src/form/fields/date-range/date-range-dialog.ts +141 -194
- package/src/form/fields/date-range/date-range-helpers.ts +63 -64
- package/src/form/fields/date-range/date-range.test.ts +359 -122
- package/src/form/fields/date-range/date-range.ts +319 -395
- package/src/form/fields/date-range/index.ts +2 -2
- package/src/form/fields/input/index.ts +8 -8
- package/src/form/fields/input/input.scss +30 -26
- package/src/form/fields/input/input.test.ts +4 -1
- package/src/form/fields/input/input.ts +4 -20
- package/src/form/fields/radio-group/index.ts +2 -2
- package/src/form/fields/radio-group/radio-button.ts +8 -8
- package/src/form/fields/radio-group/radio-group.ts +4 -1
- package/src/form/fields/range/range.ts +3 -1
- package/src/form/fields/select/index.ts +2 -2
- package/src/form/fields/select/select.ts +51 -45
- package/src/form/fields/switch/switch.ts +13 -7
- package/src/form/fields/textarea/index.ts +1 -1
- package/src/form/fields/textarea/textarea.ts +44 -49
- package/src/form/form-summary.ts +15 -14
- package/src/form/form.test.ts +0 -1
- package/src/form/form.ts +11 -23
- package/src/icons/icon.ts +25 -25
- package/src/icons/index.ts +1 -1
- package/src/iframe/iframe.ts +11 -9
- package/src/index.ts +1 -0
- package/src/json/json.ts +9 -2
- package/src/kbd/kbd.ts +30 -28
- package/src/layout/scroll/index.ts +1 -1
- package/src/layout/scroll/scroll.ts +54 -54
- package/src/lightbox/lightbox-service.ts +27 -18
- package/src/lightbox/lightbox.directive.ts +2 -1
- package/src/lightbox/lightbox.ts +21 -38
- package/src/list/index.ts +3 -3
- package/src/list/list-item.ts +32 -26
- package/src/list/list.ts +13 -8
- package/src/menu/index.ts +2 -2
- package/src/menu/menu-item.ts +7 -5
- package/src/menu/menu.ts +8 -6
- package/src/nav-drawer/appbar.ts +9 -7
- package/src/nav-drawer/content.ts +10 -8
- package/src/nav-drawer/drawer.ts +29 -25
- package/src/nav-drawer/index.ts +6 -6
- package/src/navigation-bar/index.ts +2 -2
- package/src/navigation-bar/navigation-bar-item.ts +127 -118
- package/src/navigation-bar/navigation-bar.ts +103 -91
- package/src/navigation-rail/index.ts +2 -2
- package/src/navigation-rail/navigation-rail.ts +21 -22
- package/src/notification/index.ts +6 -6
- package/src/notification/notification-service.ts +1 -2
- package/src/notification/notification.scss +5 -1
- package/src/notification/notification.ts +1 -3
- package/src/notification/notify.ts +204 -207
- package/src/option/index.ts +1 -1
- package/src/option/option.ts +26 -25
- package/src/overlay/overlay.animations.ts +4 -14
- package/src/overlay/overlay.component.ts +110 -131
- package/src/overlay/overlay.confirm-body.ts +26 -48
- package/src/overlay/overlay.gestures.ts +8 -10
- package/src/overlay/overlay.layout.ts +1 -4
- package/src/overlay/overlay.positioning.ts +4 -15
- package/src/overlay/overlay.service.ts +9 -24
- package/src/overlay/overlay.stack.test.ts +4 -1
- package/src/overlay/overlay.stack.ts +4 -4
- package/src/overlay/overlay.types.ts +11 -20
- package/src/progress/index.ts +1 -1
- package/src/progress/progress.ts +135 -133
- package/src/rxjs-utils/index.ts +6 -6
- package/src/rxjs-utils/waitForElement.ts +20 -20
- package/src/rxjs-utils/waitForElementAll.ts +21 -21
- package/src/rxjs-utils/waitForElements.ts +27 -27
- package/src/rxjs-utils/waitForElementsAll.ts +27 -29
- package/src/rxjs-utils/waitUntil.ts +7 -12
- package/src/skeleton/skeleton.ts +39 -33
- package/src/slider/index.ts +2 -2
- package/src/slider/slide.ts +14 -12
- package/src/slider/slider.ts +24 -22
- package/src/splash-screen/index.ts +1 -1
- package/src/splash-screen/splash-screen.ts +26 -27
- package/src/state/active-host.ts +4 -5
- package/src/state/index.ts +34 -53
- package/src/state/persist.ts +14 -11
- package/src/state/schmancy-context.ts +88 -88
- package/src/state/state.test-d.ts +3 -13
- package/src/state/state.test.ts +1 -4
- package/src/steps/index.ts +3 -3
- package/src/steps/schmancy-step.ts +41 -31
- package/src/steps/schmancy-steps.ts +7 -5
- package/src/surface/index.ts +1 -1
- package/src/surface/surface.styles.ts +55 -191
- package/src/surface/surface.ts +18 -16
- package/src/table/index.ts +2 -2
- package/src/table/row.ts +1 -4
- package/src/table/table.ts +2 -5
- package/src/tabs/index.ts +2 -2
- package/src/tabs/tabs-group.ts +8 -6
- package/src/teleport/index.ts +2 -2
- package/src/test-utils/a11y.ts +1 -3
- package/src/theme/index.ts +17 -17
- package/src/theme/theme-audio-player.ts +18 -16
- package/src/theme/theme-controller-boat.ts +1 -1
- package/src/theme/theme-controller.ts +36 -32
- package/src/theme/theme.component.ts +5 -9
- package/src/theme/theme.events.ts +1 -1
- package/src/theme/theme.format.ts +7 -7
- package/src/theme/theme.service.ts +453 -468
- package/src/theme/theme.style.css +78 -23
- package/src/theme-button/index.ts +1 -1
- package/src/tooltip/tooltip.directive.ts +1 -1
- package/src/tree/index.ts +1 -1
- package/src/tree/tree.ts +24 -16
- package/src/types/surface.ts +38 -44
- package/src/typewriter/typewriter.directive.ts +30 -39
- package/src/typography/typography.ts +289 -269
- package/src/utils/animation.ts +2 -8
- package/src/utils/index.ts +6 -6
- package/src/utils/number.ts +480 -517
- package/src/utils/overlay-stack.ts +1 -3
- package/src/utils/search.ts +5 -9
- package/src/visually-hidden/visually-hidden.ts +15 -13
- package/src/window/window-manager.ts +6 -1
- package/src/window/window-position.ts +7 -5
- package/src/window/window.ts +146 -114
- package/types/mixins/surface.mixin.d.ts +8 -14
- package/types/src/badge/badge.d.ts +15 -48
- package/types/src/calendar/calendar.d.ts +108 -0
- package/types/src/calendar/calendar.test.d.ts +1 -0
- package/types/src/calendar/index.d.ts +2 -0
- package/types/src/directives/cursor-glow.d.ts +1 -1
- package/types/src/directives/hummingbird.d.ts +3 -3
- package/types/src/form/fields/date-range/date-range-dialog.d.ts +24 -28
- package/types/src/form/fields/date-range/date-range.d.ts +35 -66
- package/types/src/form/fields/date-range/date-range.test.d.ts +1 -0
- package/types/src/form/fields/date-range/index.d.ts +1 -1
- package/types/src/index.d.ts +1 -0
- package/types/src/surface/surface.d.ts +9 -7
- package/types/src/surface/surface.styles.d.ts +15 -20
- package/types/src/types/surface.d.ts +17 -22
- package/types/src/utils/number.d.ts +1 -1
- package/types/src/window/window.d.ts +0 -1
- package/dist/SchmancyElement-D9WA9FP9.cjs +0 -2
- package/dist/SchmancyElement-D9WA9FP9.cjs.map +0 -1
- package/dist/SchmancyElement-OWgz9ePG.js +0 -286
- package/dist/SchmancyElement-OWgz9ePG.js.map +0 -1
- package/dist/area-BiM7V2ns.js.map +0 -1
- package/dist/area-C7XjCoet.cjs +0 -21
- package/dist/area-C7XjCoet.cjs.map +0 -1
- package/dist/audio-CxO_j__6.js.map +0 -1
- package/dist/audio-xXFfMPCS.cjs.map +0 -1
- package/dist/autocomplete-DD7Hd59N.cjs +0 -115
- package/dist/autocomplete-DD7Hd59N.cjs.map +0 -1
- package/dist/autocomplete-DUBY9RtH.js.map +0 -1
- package/dist/busy-BjsO3y2A.js +0 -173
- package/dist/busy-BjsO3y2A.js.map +0 -1
- package/dist/busy-UbCGkTAi.cjs +0 -134
- package/dist/busy-UbCGkTAi.cjs.map +0 -1
- package/dist/button-BTpxQ1Kd.cjs.map +0 -1
- package/dist/button-D7QHfYf4.js.map +0 -1
- package/dist/card-DCdtJ5Dy.js.map +0 -1
- package/dist/card-rprhCYIC.cjs +0 -177
- package/dist/card-rprhCYIC.cjs.map +0 -1
- package/dist/chips-C5bpgWyf.js.map +0 -1
- package/dist/chips-DVes-BSz.cjs.map +0 -1
- package/dist/date-range-DDUuBlJ6.cjs +0 -142
- package/dist/date-range-DDUuBlJ6.cjs.map +0 -1
- package/dist/date-range-IPlbrhwW.js +0 -966
- package/dist/date-range-IPlbrhwW.js.map +0 -1
- package/dist/date-range-inline-DPqY9YYf.js.map +0 -1
- package/dist/date-range-inline-Dx4Reboo.cjs.map +0 -1
- package/dist/details-BnleHmYe.js.map +0 -1
- package/dist/details-Bx2jSJxG.cjs.map +0 -1
- package/dist/directives-CYf2fAdA.cjs.map +0 -1
- package/dist/directives-d1rEbW1A.js.map +0 -1
- package/dist/divider-CimQJVr3.cjs +0 -57
- package/dist/divider-CimQJVr3.cjs.map +0 -1
- package/dist/divider-Cr-rx3vA.js +0 -89
- package/dist/divider-Cr-rx3vA.js.map +0 -1
- package/dist/expand-DNrWuG_-.js.map +0 -1
- package/dist/expand-_cp8oBjp.cjs +0 -141
- package/dist/expand-_cp8oBjp.cjs.map +0 -1
- package/dist/form-CMgYSZ3y.js.map +0 -1
- package/dist/form-DaaAQd2A.cjs.map +0 -1
- package/dist/icons-C2RkSXjP.cjs +0 -24
- package/dist/icons-C2RkSXjP.cjs.map +0 -1
- package/dist/icons-mbpHO_73.js.map +0 -1
- package/dist/iframe-88SN5JPu.cjs.map +0 -1
- package/dist/iframe-U3P1DnQv.js.map +0 -1
- package/dist/input-BY4Korc5.cjs.map +0 -1
- package/dist/input-CPWvGjE4.js.map +0 -1
- package/dist/input-chip-CCZ3i3Sf.js.map +0 -1
- package/dist/input-chip-kytMdbaM.cjs +0 -146
- package/dist/input-chip-kytMdbaM.cjs.map +0 -1
- package/dist/layout-BhfC26Ks.cjs.map +0 -1
- package/dist/layout-DC0Npqu7.js.map +0 -1
- package/dist/lightbox-BSwWvDQc.js.map +0 -1
- package/dist/lightbox-KrZQH9w9.cjs.map +0 -1
- package/dist/list-BwGtAAfi.js.map +0 -1
- package/dist/list-DIs02A3d.cjs +0 -40
- package/dist/list-DIs02A3d.cjs.map +0 -1
- package/dist/menu-DX8d96x-.js.map +0 -1
- package/dist/menu-jT_yAk5V.cjs.map +0 -1
- package/dist/mixins-COeG4DiX.js.map +0 -1
- package/dist/mixins-XGVIOvKt.cjs.map +0 -1
- package/dist/notification-CAJVpLne.js.map +0 -1
- package/dist/notification-DO3VXceY.cjs.map +0 -1
- package/dist/option-BNo1Zs-l.cjs +0 -43
- package/dist/option-BNo1Zs-l.cjs.map +0 -1
- package/dist/option-JISY0wZJ.js.map +0 -1
- package/dist/overlay-B1jVf-ge.cjs.map +0 -1
- package/dist/overlay-CT-tMHDX.js.map +0 -1
- package/dist/overlay.confirm-body-Dn-Zgogx.js.map +0 -1
- package/dist/overlay.confirm-body-mYDYoJL8.cjs.map +0 -1
- package/dist/overlay.service-BQmva9GY.cjs.map +0 -1
- package/dist/overlay.service-yqTOyLlr.js.map +0 -1
- package/dist/progress-CGWozq_n.js.map +0 -1
- package/dist/progress-DOVJhsR0.cjs +0 -51
- package/dist/progress-DOVJhsR0.cjs.map +0 -1
- package/dist/radio-group-CXkq6qAF.js.map +0 -1
- package/dist/radio-group-DoSX5D2V.cjs.map +0 -1
- package/dist/select-CObZenqg.cjs +0 -56
- package/dist/select-CObZenqg.cjs.map +0 -1
- package/dist/select-CU90i50_.js.map +0 -1
- package/dist/sound.service-Qhr8nCeG.cjs.map +0 -1
- package/dist/sound.service-m8WjOhjn.js.map +0 -1
- package/dist/splash-screen-Ca6Ew8p6.cjs +0 -41
- package/dist/splash-screen-Ca6Ew8p6.cjs.map +0 -1
- package/dist/splash-screen-Cs3dbPN3.js.map +0 -1
- package/dist/src-CCVbLLgC.js.map +0 -1
- package/dist/src-CpftzdZV.cjs +0 -264
- package/dist/src-CpftzdZV.cjs.map +0 -1
- package/dist/state--x58-AuK.cjs.map +0 -1
- package/dist/state-QSwQ61sA.js.map +0 -1
- package/dist/surface-bTjOiq8n.cjs +0 -7
- package/dist/surface-bTjOiq8n.cjs.map +0 -1
- package/dist/surface-cqMsHJHM.js.map +0 -1
- package/dist/tabs-Dk9UDWpq.cjs.map +0 -1
- package/dist/tabs-Ib0Mh__1.js.map +0 -1
- package/dist/textarea-CcRsw08B.js.map +0 -1
- package/dist/textarea-Cntd9tfV.cjs.map +0 -1
- package/dist/theme.service-5RjyR7Sy.js.map +0 -1
- package/dist/theme.service-DA6KY52G.cjs.map +0 -1
- package/dist/typography-DeEYdMhW.js +0 -358
- package/dist/typography-DeEYdMhW.js.map +0 -1
- package/dist/typography-Tm7wSaB2.cjs +0 -282
- package/dist/typography-Tm7wSaB2.cjs.map +0 -1
- package/dist/utils-DTa3QHxk.cjs.map +0 -1
- package/dist/utils-H8wNknWC.js.map +0 -1
- package/dist/window-Db5ZYY6t.js.map +0 -1
- package/dist/window-oQqx5xqQ.cjs +0 -59
- package/dist/window-oQqx5xqQ.cjs.map +0 -1
- package/src/form/fields/date-range/date-range-presets.ts +0 -220
- package/src/form/fields/date-range/date-utils.ts +0 -58
- package/types/src/form/fields/date-range/date-range-presets.d.ts +0 -18
- package/types/src/form/fields/date-range/date-utils.d.ts +0 -15
- /package/dist/{hashContent-iRZJJWtE.cjs → hashContent--s09Ed_g.cjs} +0 -0
- /package/dist/{hashContent-BqU6v1Xr.js → hashContent-CAvrQ56N.js} +0 -0
- /package/dist/{rxjs-utils-Csnks202.cjs → rxjs-utils-4P2v57ke.cjs} +0 -0
- /package/dist/{rxjs-utils-d-ivVN84.js → rxjs-utils-JMFdgQSl.js} +0 -0
- /package/dist/{theme.interface-CSt7JUBD.cjs → theme.interface-B-qxDsZQ.cjs} +0 -0
- /package/dist/{theme.interface-odQEpZZH.js → theme.interface-B7caS5cg.js} +0 -0
- /package/dist/{utils-DTa3QHxk.cjs → utils-DIXndz6Q.cjs} +0 -0
- /package/dist/{utils-H8wNknWC.js → utils-dSPH7Oh9.js} +0 -0
|
@@ -8,18 +8,8 @@ import { ifDefined } from 'lit/directives/if-defined.js'
|
|
|
8
8
|
import { createRef, ref } from 'lit/directives/ref.js'
|
|
9
9
|
import { repeat } from 'lit/directives/repeat.js'
|
|
10
10
|
import { when } from 'lit/directives/when.js'
|
|
11
|
-
import {
|
|
12
|
-
|
|
13
|
-
combineLatest,
|
|
14
|
-
fromEvent,
|
|
15
|
-
timer
|
|
16
|
-
} from 'rxjs'
|
|
17
|
-
import {
|
|
18
|
-
debounceTime,
|
|
19
|
-
distinctUntilChanged,
|
|
20
|
-
takeUntil,
|
|
21
|
-
tap
|
|
22
|
-
} from 'rxjs/operators'
|
|
11
|
+
import { BehaviorSubject, combineLatest, fromEvent, timer } from 'rxjs'
|
|
12
|
+
import { debounceTime, distinctUntilChanged, takeUntil, tap } from 'rxjs/operators'
|
|
23
13
|
import style from './autocomplete.scss?inline'
|
|
24
14
|
|
|
25
15
|
// Import the similarity function (or include it inline)
|
|
@@ -28,13 +18,13 @@ import { similarity } from '../../../utils/search'
|
|
|
28
18
|
import '../../../chips/input-chip'
|
|
29
19
|
|
|
30
20
|
export type SchmancyAutocompleteChangeEvent = CustomEvent<{
|
|
31
|
-
|
|
32
|
-
|
|
21
|
+
value: string | string[]
|
|
22
|
+
values?: string[]
|
|
33
23
|
}>
|
|
34
24
|
|
|
35
25
|
interface FilteredOption {
|
|
36
|
-
|
|
37
|
-
|
|
26
|
+
option: SchmancyOption
|
|
27
|
+
score: number
|
|
38
28
|
}
|
|
39
29
|
|
|
40
30
|
/**
|
|
@@ -50,715 +40,713 @@ interface FilteredOption {
|
|
|
50
40
|
*/
|
|
51
41
|
@customElement('schmancy-autocomplete')
|
|
52
42
|
export default class SchmancyAutocomplete extends SchmancyFormField(unsafeCSS(style)) {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
43
|
+
// `formAssociated`, `internals`, `attachInternals`, `name`, `label`,
|
|
44
|
+
// `required`, `disabled`, `error`, `validationMessage`, `hint`, `id`,
|
|
45
|
+
// `validateOn`, `touched/dirty/submitted`, `markTouched/markSubmitted`,
|
|
46
|
+
// `setCustomValidity`, `formDisabledCallback`, FIELD_CONNECT_EVENT dispatch
|
|
47
|
+
// — all from the mixin.
|
|
48
|
+
|
|
49
|
+
/** Override mixin's resetForm with autocomplete-specific subject reset. */
|
|
50
|
+
override resetForm(): void {
|
|
51
|
+
if (this.multi) {
|
|
52
|
+
this.selectedValues$.next([])
|
|
53
|
+
} else {
|
|
54
|
+
this.selectedValue$.next('')
|
|
55
|
+
}
|
|
56
|
+
this.inputValue = ''
|
|
57
|
+
this.inputValue$.next('')
|
|
58
|
+
super.resetForm()
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
// Track whether value/values have been explicitly set
|
|
62
|
+
valueSet: boolean = false
|
|
63
|
+
valuesSet: boolean = false
|
|
64
|
+
|
|
65
|
+
// Autocomplete-specific properties only — `name`, `label`, `required`,
|
|
66
|
+
// `error`, `validationMessage` come from the mixin.
|
|
67
|
+
@property({ type: String }) placeholder = ''
|
|
68
|
+
@property({ type: String }) maxHeight = '300px'
|
|
69
|
+
@property({ type: Boolean }) multi = false
|
|
70
|
+
@property({ type: String }) description = ''
|
|
71
|
+
@property({ type: String, reflect: true }) size: InputSize = 'md'
|
|
72
|
+
@property({ type: String }) autocomplete = 'off'
|
|
73
|
+
@property({ type: Number }) debounceMs = 200
|
|
74
|
+
@property({ type: Number }) similarityThreshold = 0.3 // Minimum similarity score to show option
|
|
75
|
+
|
|
76
|
+
private readonly a11yId = `schmancy-autocomplete-${Math.random().toString(36).slice(2, 10)}`
|
|
77
|
+
|
|
78
|
+
// Values property for multi-select mode
|
|
79
|
+
@property({ type: Array })
|
|
80
|
+
get values() {
|
|
81
|
+
return [...this.selectedValues$.value]
|
|
82
|
+
}
|
|
83
|
+
set values(vals: string[]) {
|
|
84
|
+
this.valuesSet = true
|
|
85
|
+
this.selectedValues$.next(Array.isArray(vals) ? [...vals] : [])
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
// Value property — narrowed override of the mixin's wide value union.
|
|
89
|
+
@property({ type: String, reflect: true })
|
|
90
|
+
override get value(): string {
|
|
91
|
+
return this.multi ? this.selectedValues$.value.join(',') : this.selectedValue$.value
|
|
92
|
+
}
|
|
93
|
+
override set value(val: string) {
|
|
94
|
+
this.valueSet = true
|
|
95
|
+
if (this.multi) {
|
|
96
|
+
const newValues = val
|
|
97
|
+
? val
|
|
98
|
+
.split(',')
|
|
99
|
+
.map(v => v.trim())
|
|
100
|
+
.filter(Boolean)
|
|
101
|
+
: []
|
|
102
|
+
const currentValues = this.selectedValues$.value
|
|
103
|
+
// Only update if values actually changed
|
|
104
|
+
if (JSON.stringify(newValues) !== JSON.stringify(currentValues)) {
|
|
105
|
+
this.selectedValues$.next(newValues)
|
|
106
|
+
}
|
|
107
|
+
} else {
|
|
108
|
+
// Only update if value actually changed
|
|
109
|
+
if (val !== this.selectedValue$.value) {
|
|
110
|
+
this.selectedValue$.next(val)
|
|
111
|
+
// Update the input display when value is set
|
|
112
|
+
this.updateInputDisplay()
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
// State
|
|
118
|
+
@state() private open = false
|
|
119
|
+
@state() private inputValue = ''
|
|
120
|
+
@state() private visibleOptionsCount = 0
|
|
121
|
+
@state() private hasResults = true
|
|
122
|
+
|
|
123
|
+
// DOM references
|
|
124
|
+
@query('#options') listbox!: HTMLUListElement
|
|
125
|
+
@query('sch-input') input!: SchmancyInput
|
|
126
|
+
@queryAssignedElements({ flatten: true }) private options!: SchmancyOption[]
|
|
127
|
+
private inputElementRef = createRef<HTMLInputElement>()
|
|
128
|
+
|
|
129
|
+
// RxJS Subjects - only what we actually need
|
|
130
|
+
private selectedValue$ = new BehaviorSubject<string>('')
|
|
131
|
+
private selectedValues$ = new BehaviorSubject<string[]>([])
|
|
132
|
+
private inputValue$ = new BehaviorSubject<string>('')
|
|
133
|
+
|
|
134
|
+
override connectedCallback() {
|
|
135
|
+
// FIELD_CONNECT_EVENT is dispatched by the mixin's connectedCallback.
|
|
136
|
+
super.connectedCallback()
|
|
137
|
+
this.setupAutocompleteLogic()
|
|
138
|
+
this.setupDocumentClickHandler()
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
private setupAutocompleteLogic() {
|
|
142
|
+
// Sync selection state
|
|
143
|
+
combineLatest([this.selectedValue$, this.selectedValues$])
|
|
144
|
+
.pipe(
|
|
145
|
+
tap(([selectedValue, selectedValues]) => {
|
|
146
|
+
this.updateOptionSelection(selectedValue, selectedValues)
|
|
147
|
+
// Keep ElementInternals form value in sync with selection (single and multi).
|
|
148
|
+
const formValue = this.multi ? selectedValues.join(',') : selectedValue
|
|
149
|
+
this.internals?.setFormValue(formValue || null)
|
|
150
|
+
if (this.required) {
|
|
151
|
+
const missing = this.multi ? selectedValues.length === 0 : !selectedValue
|
|
152
|
+
this.internals?.setValidity(
|
|
153
|
+
missing ? { valueMissing: true } : {},
|
|
154
|
+
missing ? this.validationMessage || 'Please select an option.' : undefined,
|
|
155
|
+
)
|
|
156
|
+
}
|
|
157
|
+
}),
|
|
158
|
+
takeUntil(this.disconnecting),
|
|
159
|
+
)
|
|
160
|
+
.subscribe()
|
|
161
|
+
|
|
162
|
+
// Filter options based on input
|
|
163
|
+
this.inputValue$
|
|
164
|
+
.pipe(
|
|
165
|
+
distinctUntilChanged(),
|
|
166
|
+
debounceTime(this.debounceMs),
|
|
167
|
+
tap(searchTerm => {
|
|
168
|
+
if (this.open) {
|
|
169
|
+
this.filterOptions(searchTerm)
|
|
170
|
+
}
|
|
171
|
+
}),
|
|
172
|
+
takeUntil(this.disconnecting),
|
|
173
|
+
)
|
|
174
|
+
.subscribe()
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
private setupOptionHandlers() {
|
|
178
|
+
this.options.forEach((option, index) => {
|
|
179
|
+
option.setAttribute('role', 'option')
|
|
180
|
+
option.tabIndex = -1
|
|
181
|
+
if (!option.id) {
|
|
182
|
+
option.id = `${this.id}-option-${index}`
|
|
183
|
+
}
|
|
184
|
+
// Idempotent: slotchange may fire repeatedly for the same option nodes,
|
|
185
|
+
// and addEventListener doesn't replace prior handlers like onfoo= did.
|
|
186
|
+
if (option.dataset.schmancyAutocompleteHandlers === 'attached') return
|
|
187
|
+
option.dataset.schmancyAutocompleteHandlers = 'attached'
|
|
188
|
+
|
|
189
|
+
// Prevent blur handler from interfering with option selection
|
|
190
|
+
fromEvent<MouseEvent>(option, 'mousedown')
|
|
191
|
+
.pipe(takeUntil(this.disconnecting))
|
|
192
|
+
.subscribe(e => e.preventDefault())
|
|
193
|
+
|
|
194
|
+
// Handle the actual selection
|
|
195
|
+
fromEvent<MouseEvent>(option, 'click')
|
|
196
|
+
.pipe(takeUntil(this.disconnecting))
|
|
197
|
+
.subscribe(e => {
|
|
198
|
+
e.stopPropagation()
|
|
199
|
+
this.selectOption(option)
|
|
200
|
+
})
|
|
201
|
+
})
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
private updateOptionSelection(selectedValue: string, selectedValues: string[]) {
|
|
205
|
+
this.options.forEach(option => {
|
|
206
|
+
option.selected = this.multi ? selectedValues.includes(option.value) : option.value === selectedValue
|
|
207
|
+
option.setAttribute('aria-selected', String(option.selected))
|
|
208
|
+
})
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
private filterOptions(searchTerm: string) {
|
|
212
|
+
const term = searchTerm.trim()
|
|
213
|
+
|
|
214
|
+
if (!term) {
|
|
215
|
+
// Show all options if no search term
|
|
216
|
+
this.options.forEach(option => {
|
|
217
|
+
option.hidden = false
|
|
218
|
+
option.style.order = '0'
|
|
219
|
+
})
|
|
220
|
+
this.visibleOptionsCount = this.options.length
|
|
221
|
+
this.hasResults = true
|
|
222
|
+
} else {
|
|
223
|
+
// Calculate similarity scores for all options
|
|
224
|
+
const scoredOptions: FilteredOption[] = this.options.map(option => {
|
|
225
|
+
const optionLabel = option.label || option.textContent || ''
|
|
226
|
+
const optionValue = option.value
|
|
227
|
+
|
|
228
|
+
const labelScore = similarity(term, optionLabel)
|
|
229
|
+
const valueScore = similarity(term, optionValue)
|
|
230
|
+
const score = Math.max(labelScore * 1.1, valueScore)
|
|
231
|
+
|
|
232
|
+
return { option, score }
|
|
233
|
+
})
|
|
234
|
+
|
|
235
|
+
// Sort by score (highest first)
|
|
236
|
+
scoredOptions.sort((a, b) => b.score - a.score)
|
|
237
|
+
|
|
238
|
+
// Apply visibility and ordering
|
|
239
|
+
let visibleCount = 0
|
|
240
|
+
scoredOptions.forEach((item, index) => {
|
|
241
|
+
const { option, score } = item
|
|
242
|
+
|
|
243
|
+
if (score < this.similarityThreshold) {
|
|
244
|
+
option.hidden = true
|
|
245
|
+
} else {
|
|
246
|
+
option.hidden = false
|
|
247
|
+
visibleCount++
|
|
248
|
+
option.style.order = String(index)
|
|
249
|
+
}
|
|
250
|
+
})
|
|
251
|
+
|
|
252
|
+
this.visibleOptionsCount = visibleCount
|
|
253
|
+
this.hasResults = visibleCount > 0
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
this.announceToScreenReader(
|
|
257
|
+
this.visibleOptionsCount > 0
|
|
258
|
+
? `${this.visibleOptionsCount} option${this.visibleOptionsCount === 1 ? '' : 's'} available.`
|
|
259
|
+
: 'No results found.',
|
|
260
|
+
)
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
private openDropdown() {
|
|
264
|
+
this.open = true
|
|
265
|
+
// Reset filters based on current input value when dropdown opens
|
|
266
|
+
this.filterOptions(this.inputValue)
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
private selectOption(option: SchmancyOption) {
|
|
270
|
+
if (this.multi) {
|
|
271
|
+
const currentValues = this.selectedValues$.value
|
|
272
|
+
const index = currentValues.indexOf(option.value)
|
|
273
|
+
const newValues = index > -1 ? currentValues.filter(v => v !== option.value) : [...currentValues, option.value]
|
|
274
|
+
|
|
275
|
+
this.selectedValues$.next(newValues)
|
|
276
|
+
this.announceToScreenReader(
|
|
277
|
+
newValues.length > 0 ? `Selected: ${this.getSelectedLabels().join(', ')}` : 'No options selected',
|
|
278
|
+
)
|
|
279
|
+
this.fireChangeEvent()
|
|
280
|
+
} else {
|
|
281
|
+
// Update value first
|
|
282
|
+
this.selectedValue$.next(option.value)
|
|
283
|
+
|
|
284
|
+
// Close dropdown IMMEDIATELY to prevent blur handler from firing
|
|
285
|
+
this.open = false
|
|
286
|
+
|
|
287
|
+
// Now fire event with the NEW value
|
|
288
|
+
this.fireChangeEvent()
|
|
289
|
+
|
|
290
|
+
// Update UI
|
|
291
|
+
this.inputValue = option.label || option.textContent || ''
|
|
292
|
+
this.inputValue$.next(this.inputValue)
|
|
293
|
+
|
|
294
|
+
this.announceToScreenReader(`Selected: ${option.label || option.textContent}`)
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
private setupDocumentClickHandler() {
|
|
299
|
+
fromEvent<MouseEvent>(document, 'click')
|
|
300
|
+
.pipe(takeUntil(this.disconnecting))
|
|
301
|
+
.subscribe(e => {
|
|
302
|
+
if (!this.open) return
|
|
303
|
+
const path = e.composedPath()
|
|
304
|
+
if (!path.includes(this) && !this.options.some(opt => path.includes(opt))) {
|
|
305
|
+
this.open = false
|
|
306
|
+
this.updateInputDisplay()
|
|
307
|
+
}
|
|
308
|
+
})
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
private updateInputDisplay() {
|
|
312
|
+
// For multi-select, we don't update input display since chips show the selections
|
|
313
|
+
if (this.multi) return
|
|
314
|
+
|
|
315
|
+
const selectedValue = this.selectedValue$.value
|
|
316
|
+
const option = this.options.find(opt => opt.value === selectedValue)
|
|
317
|
+
this.inputValue = option ? option.label || option.textContent || '' : ''
|
|
318
|
+
this.inputValue$.next(this.inputValue)
|
|
319
|
+
|
|
320
|
+
if (this.inputElementRef.value) {
|
|
321
|
+
this.inputElementRef.value.value = this.inputValue
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
private getSelectedLabels(): string[] {
|
|
326
|
+
return this.options
|
|
327
|
+
.filter(option =>
|
|
328
|
+
this.multi ? this.selectedValues$.value.includes(option.value) : option.value === this.selectedValue$.value,
|
|
329
|
+
)
|
|
330
|
+
.map(option => option.label || option.textContent || '')
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
private announceToScreenReader(message: string) {
|
|
334
|
+
const liveRegion = this.shadowRoot?.querySelector('#live-status')
|
|
335
|
+
if (liveRegion) {
|
|
336
|
+
liveRegion.textContent = message
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
private fireChangeEvent() {
|
|
341
|
+
const detail: SchmancyAutocompleteChangeEvent['detail'] = {
|
|
342
|
+
value: this.value,
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
if (this.multi) {
|
|
346
|
+
detail.values = [...this.selectedValues$.value]
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
this.dispatchEvent(
|
|
350
|
+
new CustomEvent<SchmancyAutocompleteChangeEvent['detail']>('change', {
|
|
351
|
+
detail,
|
|
352
|
+
bubbles: true,
|
|
353
|
+
composed: true,
|
|
354
|
+
}),
|
|
355
|
+
)
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
public checkValidity(): boolean {
|
|
359
|
+
if (!this.required) return true
|
|
360
|
+
return this.multi ? this.selectedValues$.value.length > 0 : Boolean(this.selectedValue$.value)
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
public reportValidity(): boolean {
|
|
364
|
+
if (this.inputElementRef.value) {
|
|
365
|
+
return this.inputElementRef.value.reportValidity()
|
|
366
|
+
}
|
|
367
|
+
return this.checkValidity()
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
firstUpdated() {
|
|
371
|
+
this.setupOptionHandlers()
|
|
372
|
+
|
|
373
|
+
// Sync initial value with display after options are available
|
|
374
|
+
this.updateInputDisplay()
|
|
375
|
+
|
|
376
|
+
// Update options when slot changes
|
|
377
|
+
const slot = this.shadowRoot?.querySelector('slot')
|
|
378
|
+
slot?.addEventListener('slotchange', () => {
|
|
379
|
+
this.setupOptionHandlers()
|
|
380
|
+
this.updateOptionSelection(this.selectedValue$.value, this.selectedValues$.value)
|
|
381
|
+
})
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
private handleChipRemove(value: string) {
|
|
385
|
+
const currentValues = this.selectedValues$.value
|
|
386
|
+
const newValues = currentValues.filter(v => v !== value)
|
|
387
|
+
this.selectedValues$.next(newValues)
|
|
388
|
+
this.fireChangeEvent()
|
|
389
|
+
this.announceToScreenReader(`Removed: ${this.getChipLabel(value)}`)
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
private getChipLabel(value: string): string {
|
|
393
|
+
const option = this.options.find(opt => opt.value === value)
|
|
394
|
+
return option ? option.label || option.textContent || value : value
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
private focusTextInput() {
|
|
398
|
+
if (this.inputElementRef.value) {
|
|
399
|
+
this.inputElementRef.value.focus()
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
render() {
|
|
404
|
+
const descriptionId = `${this.id}-desc`
|
|
405
|
+
|
|
406
|
+
// Get size-based styling to match Schmancy input
|
|
407
|
+
const getSizeStyles = () => {
|
|
408
|
+
switch (this.size) {
|
|
409
|
+
case 'sm':
|
|
410
|
+
return {
|
|
411
|
+
height: 'min-h-[40px]',
|
|
412
|
+
padding: 'px-2',
|
|
413
|
+
fontSize: 'text-sm', // 14px
|
|
414
|
+
labelSize: 'text-sm',
|
|
415
|
+
}
|
|
416
|
+
case 'lg':
|
|
417
|
+
return {
|
|
418
|
+
height: 'min-h-[60px]',
|
|
419
|
+
padding: 'px-5',
|
|
420
|
+
fontSize: 'text-lg', // 18px
|
|
421
|
+
labelSize: 'text-lg',
|
|
422
|
+
}
|
|
423
|
+
case 'md':
|
|
424
|
+
default:
|
|
425
|
+
return {
|
|
426
|
+
height: 'min-h-[50px]',
|
|
427
|
+
padding: 'px-4',
|
|
428
|
+
fontSize: 'text-base', // 16px
|
|
429
|
+
labelSize: 'text-base',
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
const { height, padding, fontSize, labelSize } = getSizeStyles()
|
|
435
|
+
|
|
436
|
+
return html`
|
|
437
|
+
<div class="relative">
|
|
438
|
+
<!-- Screen reader live region -->
|
|
439
|
+
<div id="live-status" role="status" aria-live="polite" class="sr-only"></div>
|
|
440
|
+
|
|
441
|
+
<!-- Description -->
|
|
442
|
+
${this.description ? html`<div id="${descriptionId}" class="sr-only">${this.description}</div>` : ''}
|
|
443
|
+
|
|
444
|
+
<!-- Custom input wrapper for Gmail-style chip input -->
|
|
445
|
+
<slot name="trigger">
|
|
446
|
+
${when(
|
|
447
|
+
this.multi,
|
|
448
|
+
() => html`
|
|
449
|
+
<!-- Custom multi-select input with inline chips -->
|
|
450
|
+
<div class="relative">
|
|
451
|
+
${when(
|
|
452
|
+
this.label,
|
|
453
|
+
() => html`
|
|
454
|
+
<label
|
|
455
|
+
class="${classMap({
|
|
456
|
+
'block mb-1 font-medium': true,
|
|
457
|
+
'text-primary-default': !this.error,
|
|
458
|
+
'text-error-default': this.error,
|
|
459
|
+
[labelSize]: true,
|
|
460
|
+
})}"
|
|
461
|
+
>
|
|
462
|
+
${this.label}${this.required ? html`<span class="text-error-default ml-1">*</span>` : ''}
|
|
463
|
+
</label>
|
|
464
|
+
`,
|
|
465
|
+
)}
|
|
466
|
+
<div
|
|
467
|
+
class="${classMap({
|
|
468
|
+
'flex flex-wrap items-center gap-1': true,
|
|
469
|
+
[height]: true,
|
|
470
|
+
[padding]: true,
|
|
471
|
+
'block w-full min-w-0 rounded-[8px] border-0': true,
|
|
472
|
+
'bg-surface-highest text-surface-on': true,
|
|
473
|
+
'ring-0 ring-inset focus-within:ring-1 focus-within:ring-inset': true,
|
|
474
|
+
'ring-secondary-default focus-within:ring-secondary-default': !this.error,
|
|
475
|
+
'ring-error-default focus-within:ring-error-default': this.error,
|
|
476
|
+
'cursor-text transition-colors duration-200': true,
|
|
477
|
+
})}"
|
|
478
|
+
@click=${() => this.focusTextInput()}
|
|
479
|
+
role="combobox"
|
|
480
|
+
aria-autocomplete="list"
|
|
481
|
+
aria-haspopup="listbox"
|
|
482
|
+
aria-controls="options"
|
|
483
|
+
aria-expanded=${this.open}
|
|
484
|
+
>
|
|
485
|
+
<!-- Render chips inline -->
|
|
486
|
+
${repeat(
|
|
487
|
+
this.selectedValues$.value,
|
|
488
|
+
value => value,
|
|
489
|
+
value => html`
|
|
490
|
+
<schmancy-input-chip
|
|
491
|
+
.value=${value}
|
|
492
|
+
@remove=${(e: CustomEvent) => this.handleChipRemove(e.detail.value)}
|
|
493
|
+
class="shrink-0 my-0.5"
|
|
494
|
+
>
|
|
495
|
+
${this.getChipLabel(value)}
|
|
496
|
+
</schmancy-input-chip>
|
|
497
|
+
`,
|
|
498
|
+
)}
|
|
499
|
+
|
|
500
|
+
<!-- Text input for typing -->
|
|
501
|
+
<input
|
|
502
|
+
${ref(this.inputElementRef)}
|
|
503
|
+
id="autocomplete-input"
|
|
504
|
+
type="text"
|
|
505
|
+
class="flex-1 min-w-[120px] py-1 bg-transparent border-none outline-none ${fontSize} font-medium text-surface-on placeholder:text-muted"
|
|
506
|
+
name=${this.name || this.label?.toLowerCase().replace(/\s+/g, '-') || ''}
|
|
507
|
+
.placeholder=${this.selectedValues$.value.length > 0 ? 'Add more...' : this.placeholder}
|
|
508
|
+
.value=${this.inputValue}
|
|
509
|
+
.autocomplete=${this.autocomplete}
|
|
510
|
+
aria-invalid=${this.error ? 'true' : 'false'}
|
|
511
|
+
aria-required=${this.required ? 'true' : 'false'}
|
|
512
|
+
aria-describedby=${this.error && this.validationMessage ? `${this.a11yId}-err` : nothing}
|
|
513
|
+
aria-label=${!this.label && this.placeholder ? this.placeholder : nothing}
|
|
514
|
+
@input=${(e: Event) => {
|
|
515
|
+
const value = (e.target as HTMLInputElement).value
|
|
516
|
+
this.inputValue = value
|
|
517
|
+
this.inputValue$.next(value)
|
|
518
|
+
}}
|
|
519
|
+
@focus=${(e: FocusEvent) => {
|
|
520
|
+
e.stopPropagation()
|
|
521
|
+
// Clear input on focus for new searches
|
|
522
|
+
this.inputValue = ''
|
|
523
|
+
this.inputValue$.next('')
|
|
524
|
+
this.openDropdown()
|
|
525
|
+
}}
|
|
526
|
+
@keydown=${(e: KeyboardEvent) => {
|
|
527
|
+
this.handleKeyDown(e)
|
|
528
|
+
}}
|
|
529
|
+
@blur=${() => {
|
|
530
|
+
this.handleAutoSelectOnBlur()
|
|
531
|
+
}}
|
|
532
|
+
/>
|
|
533
|
+
</div>
|
|
534
|
+
|
|
535
|
+
<!-- Validation message -->
|
|
536
|
+
${when(
|
|
537
|
+
this.error && this.validationMessage,
|
|
538
|
+
() => html`
|
|
539
|
+
<div id="${this.a11yId}-err" class="mt-1 text-sm text-error-default" role="alert">
|
|
540
|
+
${this.validationMessage}
|
|
541
|
+
</div>
|
|
542
|
+
`,
|
|
543
|
+
)}
|
|
544
|
+
</div>
|
|
545
|
+
`,
|
|
546
|
+
() => html`
|
|
547
|
+
<!-- Regular single-select input -->
|
|
548
|
+
<schmancy-input
|
|
549
|
+
.size=${this.size}
|
|
550
|
+
${ref(this.inputElementRef)}
|
|
551
|
+
id="autocomplete-input"
|
|
552
|
+
class="w-full"
|
|
553
|
+
.name=${this.name || this.label?.toLowerCase().replace(/\s+/g, '-') || ''}
|
|
554
|
+
.label=${this.label}
|
|
555
|
+
.placeholder=${this.placeholder}
|
|
556
|
+
.required=${this.required}
|
|
557
|
+
.value=${this.inputValue}
|
|
558
|
+
type="text"
|
|
559
|
+
autocomplete=${this.autocomplete}
|
|
560
|
+
clickable
|
|
561
|
+
role="combobox"
|
|
562
|
+
aria-autocomplete="list"
|
|
563
|
+
aria-haspopup="listbox"
|
|
564
|
+
aria-controls="options"
|
|
565
|
+
aria-expanded=${this.open}
|
|
566
|
+
aria-describedby=${ifDefined(this.description ? descriptionId : undefined)}
|
|
567
|
+
@input=${(e: Event) => {
|
|
568
|
+
const value = (e.target as HTMLInputElement).value
|
|
569
|
+
this.inputValue = value
|
|
570
|
+
this.inputValue$.next(value)
|
|
571
|
+
}}
|
|
572
|
+
@focus=${(e: FocusEvent) => {
|
|
573
|
+
e.stopPropagation()
|
|
574
|
+
this.openDropdown()
|
|
575
|
+
}}
|
|
576
|
+
@click=${(e: MouseEvent) => {
|
|
577
|
+
e.stopPropagation()
|
|
578
|
+
this.openDropdown()
|
|
579
|
+
}}
|
|
580
|
+
@keydown=${(e: KeyboardEvent) => {
|
|
581
|
+
this.handleKeyDown(e)
|
|
582
|
+
}}
|
|
583
|
+
@blur=${() => {
|
|
584
|
+
this.handleAutoSelectOnBlur()
|
|
585
|
+
}}
|
|
586
|
+
>
|
|
587
|
+
</schmancy-input>
|
|
588
|
+
`,
|
|
589
|
+
)}
|
|
590
|
+
</slot>
|
|
591
|
+
|
|
592
|
+
<!-- Options dropdown -->
|
|
593
|
+
<ul
|
|
594
|
+
id="options"
|
|
595
|
+
class=${classMap({
|
|
596
|
+
absolute: true,
|
|
597
|
+
'z-[1000]': true,
|
|
598
|
+
'mt-1': true,
|
|
599
|
+
'w-full': true,
|
|
600
|
+
'rounded-md': true,
|
|
601
|
+
'shadow-md': true,
|
|
602
|
+
'overflow-auto': true,
|
|
603
|
+
'min-w-full': true,
|
|
604
|
+
'bg-surface-low': true,
|
|
605
|
+
flex: true,
|
|
606
|
+
'flex-col': true, // Enable flexbox for ordering
|
|
607
|
+
})}
|
|
608
|
+
role="listbox"
|
|
609
|
+
aria-multiselectable=${this.multi ? 'true' : 'false'}
|
|
610
|
+
aria-label=${`${this.label || 'Options'} dropdown`}
|
|
611
|
+
?hidden=${!this.open}
|
|
612
|
+
style="max-height: ${this.maxHeight}; display: ${this.open ? 'flex' : 'none'};"
|
|
613
|
+
@slotchange=${() => {
|
|
614
|
+
this.setupOptionHandlers()
|
|
615
|
+
}}
|
|
616
|
+
>
|
|
617
|
+
<slot></slot>
|
|
618
|
+
${!this.hasResults ? html` <li class="px-3 py-2 text-sm text-muted">No results found</li> ` : ''}
|
|
619
|
+
</ul>
|
|
620
|
+
</div>
|
|
621
|
+
`
|
|
622
|
+
}
|
|
623
|
+
|
|
624
|
+
private handleAutoSelectOnBlur() {
|
|
625
|
+
// Only auto-select in single-select mode and when dropdown is open with a search term
|
|
626
|
+
if (this.multi || !this.open || !this.inputValue.trim()) {
|
|
627
|
+
return
|
|
628
|
+
}
|
|
629
|
+
|
|
630
|
+
const searchTerm = this.inputValue.trim()
|
|
631
|
+
|
|
632
|
+
// Find the best matching option using the same similarity logic as filtering
|
|
633
|
+
let bestMatch: SchmancyOption | null = null
|
|
634
|
+
let bestScore = 0
|
|
635
|
+
|
|
636
|
+
this.options.forEach(option => {
|
|
637
|
+
// Skip hidden options
|
|
638
|
+
if (option.hidden) return
|
|
639
|
+
|
|
640
|
+
// Get text to search in (prioritize label, then textContent, then value)
|
|
641
|
+
const optionLabel = option.label || option.textContent || ''
|
|
642
|
+
const optionValue = option.value
|
|
643
|
+
|
|
644
|
+
// Calculate similarity scores for both label and value
|
|
645
|
+
const labelScore = similarity(searchTerm, optionLabel)
|
|
646
|
+
const valueScore = similarity(searchTerm, optionValue)
|
|
647
|
+
|
|
648
|
+
// Use the higher score (prioritizing label matches)
|
|
649
|
+
const score = Math.max(labelScore * 1.1, valueScore) // Slight boost for label matches
|
|
650
|
+
|
|
651
|
+
// Keep track of best match that meets threshold
|
|
652
|
+
if (score > bestScore && score >= this.similarityThreshold) {
|
|
653
|
+
bestScore = score
|
|
654
|
+
bestMatch = option
|
|
655
|
+
}
|
|
656
|
+
})
|
|
657
|
+
|
|
658
|
+
// Auto-select the best match if found
|
|
659
|
+
if (bestMatch) {
|
|
660
|
+
// Silently update the selected value without firing change event
|
|
661
|
+
this.selectedValue$.next(bestMatch.value)
|
|
662
|
+
this.inputValue = bestMatch.label || bestMatch.textContent || ''
|
|
663
|
+
this.inputValue$.next(this.inputValue)
|
|
664
|
+
this.open = false
|
|
665
|
+
}
|
|
666
|
+
}
|
|
667
|
+
|
|
668
|
+
private handleKeyDown(event: KeyboardEvent) {
|
|
669
|
+
const isOpen = this.open
|
|
670
|
+
const selectedValues = this.selectedValues$.value
|
|
671
|
+
|
|
672
|
+
// Handle backspace to remove last chip in multi-select when input is empty
|
|
673
|
+
if (this.multi && event.key === 'Backspace' && !this.inputValue && selectedValues.length > 0 && !isOpen) {
|
|
674
|
+
event.preventDefault()
|
|
675
|
+
const lastValue = selectedValues[selectedValues.length - 1]
|
|
676
|
+
this.handleChipRemove(lastValue)
|
|
677
|
+
return
|
|
678
|
+
}
|
|
679
|
+
|
|
680
|
+
if (!isOpen && (event.key === 'ArrowDown' || event.key === 'Enter')) {
|
|
681
|
+
event.preventDefault()
|
|
682
|
+
this.openDropdown()
|
|
683
|
+
|
|
684
|
+
timer(10)
|
|
685
|
+
.pipe(takeUntil(this.disconnecting))
|
|
686
|
+
.subscribe(() => {
|
|
687
|
+
const firstVisible = this.options.find(opt => !opt.hidden)
|
|
688
|
+
firstVisible?.focus()
|
|
689
|
+
})
|
|
690
|
+
return
|
|
691
|
+
}
|
|
692
|
+
|
|
693
|
+
if (!isOpen) return
|
|
694
|
+
|
|
695
|
+
const visibleOptions = this.options
|
|
696
|
+
.filter(opt => !opt.hidden)
|
|
697
|
+
.toSorted((a, b) => parseInt(a.style.order || '0') - parseInt(b.style.order || '0'))
|
|
698
|
+
|
|
699
|
+
const focusedOption = visibleOptions.find(opt => opt === document.activeElement)
|
|
700
|
+
const currentIndex = focusedOption ? visibleOptions.indexOf(focusedOption) : -1
|
|
701
|
+
|
|
702
|
+
switch (event.key) {
|
|
703
|
+
case 'Escape':
|
|
704
|
+
event.preventDefault()
|
|
705
|
+
this.open = false
|
|
706
|
+
this.updateInputDisplay()
|
|
707
|
+
this.inputElementRef.value?.focus()
|
|
708
|
+
break
|
|
709
|
+
|
|
710
|
+
case 'Tab':
|
|
711
|
+
this.open = false
|
|
712
|
+
this.updateInputDisplay()
|
|
713
|
+
break
|
|
714
|
+
|
|
715
|
+
case 'ArrowDown':
|
|
716
|
+
event.preventDefault()
|
|
717
|
+
const nextIndex = currentIndex < visibleOptions.length - 1 ? currentIndex + 1 : 0
|
|
718
|
+
visibleOptions[nextIndex]?.focus()
|
|
719
|
+
break
|
|
720
|
+
|
|
721
|
+
case 'ArrowUp':
|
|
722
|
+
event.preventDefault()
|
|
723
|
+
const prevIndex = currentIndex > 0 ? currentIndex - 1 : visibleOptions.length - 1
|
|
724
|
+
visibleOptions[prevIndex]?.focus()
|
|
725
|
+
break
|
|
726
|
+
|
|
727
|
+
case 'Home':
|
|
728
|
+
event.preventDefault()
|
|
729
|
+
visibleOptions[0]?.focus()
|
|
730
|
+
break
|
|
731
|
+
|
|
732
|
+
case 'End':
|
|
733
|
+
event.preventDefault()
|
|
734
|
+
visibleOptions[visibleOptions.length - 1]?.focus()
|
|
735
|
+
break
|
|
736
|
+
|
|
737
|
+
case 'Enter':
|
|
738
|
+
case ' ':
|
|
739
|
+
if (focusedOption) {
|
|
740
|
+
event.preventDefault()
|
|
741
|
+
this.selectOption(focusedOption)
|
|
742
|
+
}
|
|
743
|
+
break
|
|
744
|
+
}
|
|
745
|
+
}
|
|
756
746
|
}
|
|
757
747
|
|
|
758
|
-
|
|
759
|
-
|
|
760
748
|
declare global {
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
749
|
+
interface HTMLElementTagNameMap {
|
|
750
|
+
'schmancy-autocomplete': SchmancyAutocomplete
|
|
751
|
+
}
|
|
764
752
|
}
|