@webority/ui-elements 0.186.0 → 0.187.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (83) hide show
  1. package/dist/WuiNavigationMenu-BvYLbEmA.js +1 -0
  2. package/dist/WuiSelect-C1NNAsFQ.js +1 -0
  3. package/dist/{chips-DxSWAJDI.js → chips-DtDYq3XM.js} +1 -1
  4. package/dist/{country-T7AfpJpN.js → country-BySxiqti.js} +1 -1
  5. package/dist/elements/navigation-menu.js +1 -1
  6. package/dist/elements/select.js +1 -1
  7. package/dist/{recents-B9efQ1Au.js → recents-Da5C5_lV.js} +1 -1
  8. package/dist/search-BAgNDqG2.js +1 -0
  9. package/dist/search.g-chn0itlW.js +1 -0
  10. package/dist/text/en.json +3 -0
  11. package/dist/text.js +1 -1
  12. package/dist/ui-elements/calendar-views.global.js +1 -1
  13. package/dist/ui-elements/carousel.global.js +1 -1
  14. package/dist/ui-elements/code-block.global.js +1 -1
  15. package/dist/ui-elements/command-palette.global.js +1 -1
  16. package/dist/ui-elements/comment-thread.global.js +1 -1
  17. package/dist/ui-elements/consent-banner.global.js +1 -1
  18. package/dist/ui-elements/context-menu.global.js +1 -1
  19. package/dist/ui-elements/dashboard-grid.global.js +1 -1
  20. package/dist/ui-elements/data-table.global.js +1 -1
  21. package/dist/ui-elements/date-range.global.js +1 -1
  22. package/dist/ui-elements/date-time.global.js +1 -1
  23. package/dist/ui-elements/datepicker.global.js +1 -1
  24. package/dist/ui-elements/dock.global.js +1 -1
  25. package/dist/ui-elements/drawer.global.js +1 -1
  26. package/dist/ui-elements/dropdown.global.js +1 -1
  27. package/dist/ui-elements/entry-grid.global.js +1 -1
  28. package/dist/ui-elements/gantt.global.js +1 -1
  29. package/dist/ui-elements/glyphs.global.js +1 -1
  30. package/dist/ui-elements/hover-card.global.js +1 -1
  31. package/dist/ui-elements/image-crop.global.js +1 -1
  32. package/dist/ui-elements/inline-edit.global.js +1 -1
  33. package/dist/ui-elements/kanban.global.js +1 -1
  34. package/dist/ui-elements/lead-popup.global.js +1 -1
  35. package/dist/ui-elements/lightbox.global.js +1 -1
  36. package/dist/ui-elements/markdown.global.js +1 -1
  37. package/dist/ui-elements/mini-calendar.global.js +1 -1
  38. package/dist/ui-elements/navigation-menu.global.js +1 -1
  39. package/dist/ui-elements/notification-center.global.js +1 -1
  40. package/dist/ui-elements/offline-banner.global.js +1 -1
  41. package/dist/ui-elements/onboarding-checklist.global.js +1 -1
  42. package/dist/ui-elements/org-tree.global.js +1 -1
  43. package/dist/ui-elements/otp.global.js +1 -1
  44. package/dist/ui-elements/overflow.global.js +1 -1
  45. package/dist/ui-elements/phone.global.js +1 -1
  46. package/dist/ui-elements/popover.global.js +1 -1
  47. package/dist/ui-elements/rating.global.js +1 -1
  48. package/dist/ui-elements/record-pager.global.js +1 -1
  49. package/dist/ui-elements/relative-time.global.js +1 -1
  50. package/dist/ui-elements/saved-views.global.js +1 -1
  51. package/dist/ui-elements/select-chips.global.js +1 -1
  52. package/dist/ui-elements/select-recents.global.js +1 -1
  53. package/dist/ui-elements/select-search.global.js +1 -1
  54. package/dist/ui-elements/select-window.global.js +1 -1
  55. package/dist/ui-elements/server.global.js +1 -1
  56. package/dist/ui-elements/shell.global.js +1 -1
  57. package/dist/ui-elements/shortcuts.global.js +1 -1
  58. package/dist/ui-elements/show-more.global.js +1 -1
  59. package/dist/ui-elements/slider.global.js +1 -1
  60. package/dist/ui-elements/sortable.global.js +1 -1
  61. package/dist/ui-elements/status-icon.global.js +1 -1
  62. package/dist/ui-elements/table-export.global.js +1 -1
  63. package/dist/ui-elements/timepicker.global.js +1 -1
  64. package/dist/ui-elements/tour.global.js +1 -1
  65. package/dist/ui-elements/tree-picker.global.js +1 -1
  66. package/dist/ui-elements/tree.global.js +1 -1
  67. package/dist/ui-elements/truncate.global.js +1 -1
  68. package/dist/ui-elements/whats-new.global.js +1 -1
  69. package/dist/ui-elements/wizard.global.js +1 -1
  70. package/dist/ui-elements.global.js +1 -1
  71. package/dist/ui-elements.js +1 -1
  72. package/package.json +5 -5
  73. package/types/WuiNavigationMenu.d.ts +9 -1
  74. package/types/WuiSelect.d.ts +9 -9
  75. package/types/select/list.d.ts +5 -2
  76. package/types/select/part.d.ts +17 -5
  77. package/types/select/search.d.ts +1 -1
  78. package/types/text/web/filePicker.g.d.ts +2 -0
  79. package/types/text/web/select.g.d.ts +1 -0
  80. package/dist/WuiNavigationMenu-KdW7yuLn.js +0 -1
  81. package/dist/WuiSelect-B0CT2utp.js +0 -1
  82. package/dist/search-DLRWJomU.js +0 -1
  83. package/dist/search.g-B5d1s59A.js +0 -1
@@ -1 +1 @@
1
- import{n as e}from"./elementBase-Cxeyx0tU.js";import{n as ee}from"./filterPopover-DskHFNLi.js";import{t}from"./kanban-Dayig7ic.js";import{n}from"./statusIcons-Cd3GJcBR.js";import{t as r}from"./WuiCalendarViews-Dg9yRY1I.js";import{t as i}from"./WuiCarousel-B0yPDH5I.js";import{t as te}from"./WuiCodeBlock-BWYZ1S70.js";import{t as a}from"./WuiCommandPalette-CpmlKjzH.js";import{t as o}from"./WuiCommentThread-Cp7AVHvt.js";import{t as s}from"./WuiConsentBanner-nTua-kEd.js";import{t as c}from"./WuiContextMenu-oKlQvt3V.js";import{r as l}from"./WuiDashboardGrid-DFpX8Vx0.js";import{t as u}from"./WuiDataTable-CSgcwxU5.js";import{t as d}from"./WuiDatePicker-CRqjwyf2.js";import{t as f}from"./WuiDateRange-BBm_Q69p.js";import{t as p}from"./WuiDateTime-Vimu6grS.js";import{t as m}from"./WuiDock-2LGlbEFx.js";import{t as h}from"./WuiDrawer-BsY0fs_u.js";import{t as g}from"./WuiDropdown-6g074v1T.js";import{t as _}from"./WuiEntryGrid-Z69-1YBh.js";import{t as v}from"./WuiGantt-DvmVKJX2.js";import{t as y}from"./WuiHoverCard-DhJcIIM1.js";import{t as b}from"./WuiImageCrop-UakcSM2k.js";import{t as x}from"./WuiInlineEdit-JT83k3Nk.js";import{t as S}from"./WuiLeadPopup-DaYZ2zCJ.js";import{t as C}from"./WuiLightbox-DpHJAMO3.js";import{t as w}from"./WuiMarkdown-DRtGPxQX.js";import{r as T}from"./WuiMentionInput-DPCCSQRZ.js";import{t as E}from"./WuiMiniCalendar-BhUTIGwe.js";import{t as D}from"./WuiModal-DQbVJGUo.js";import{t as O}from"./WuiNavigationMenu-KdW7yuLn.js";import{t as k}from"./WuiNotificationCenter-D5bBM8Lp.js";import{t as A}from"./WuiOfflineBanner-DGTFCtyM.js";import{t as j}from"./WuiOnboardingChecklist-C-nllg2h.js";import{t as M}from"./WuiOrgTree-DWSk_LHd.js";import{t as N}from"./WuiOtp-Cc0formv.js";import{t as P}from"./WuiOverflow-fZKqdsr-.js";import{t as F}from"./WuiPhone-B5ZLabTY.js";import{t as I}from"./WuiPopover-BvWKRNQY.js";import{t as L}from"./WuiRating-DIQfif9x.js";import{t as R}from"./WuiRecordPager-BXoe4KfU.js";import{t as z}from"./WuiRelativeTime-CSg9vzfk.js";import{t as B}from"./WuiSavedViews-CH7IvwgZ.js";import{t as V}from"./WuiSelect-B0CT2utp.js";import{t as H}from"./WuiShortcuts-CRCctX82.js";import{t as U}from"./WuiShowMore-BoYCrYYf.js";import{t as W}from"./WuiSlider-CK7_l_R5.js";import{t as G}from"./WuiSortable-x8Mg0tOv.js";import{t as K}from"./WuiTimePicker-BKFPf8Fn.js";import{t as q}from"./WuiTour-BgpMa8J5.js";import{t as J}from"./WuiTree-Db83Uztv.js";import{t as Y}from"./WuiTreePicker-DLddmEgG.js";import{t as X}from"./WuiTruncate-BB4i8wHE.js";import{n as Z,t as ne}from"./WuiWhatsNew-Dm4Yl68x.js";import{n as Q,t as $}from"./WuiWizardStep-BBkw94dD.js";import{c as re,f as ie,l as ae,m as oe,p as se,s as ce,u as le}from"./formatters-DTW53DjY.js";import{_ as ue,r as de}from"./themeTransition-C5nAlClG.js";import{t as fe}from"./drawerDiscard-CBUOklnA.js";import{n as pe}from"./shortcutKeys-BMTWgV2g.js";function me(){ee(),e(`wui-select`,V),e(`wui-saved-views`,B),e(`wui-phone`,F),e(`wui-datepicker`,d),e(`wui-mini-calendar`,E),e(`wui-date-range`,f),e(`wui-date-time`,p),e(`wui-dock`,m),e(`wui-image-crop`,b),e(`wui-kanban`,t),e(`wui-dashboard-grid`,l),e(`wui-lead-popup`,S),e(`wui-inline-edit`,x),e(`wui-consent-banner`,s),e(`wui-slider`,W),e(`wui-sortable`,G),e(`wui-timepicker`,K),e(`wui-tour`,q),e(`wui-tree`,J),e(`wui-tree-picker`,Y),e(`wui-org-tree`,M),e(`wui-command-palette`,a),e(`wui-context-menu`,c),e(`wui-otp`,N),e(`wui-status-icon`,n),e(`wui-shortcuts`,H),e(`wui-record-pager`,R),e(`wui-carousel`,i),e(`wui-code-block`,te),e(`wui-markdown`,w),e(`wui-modal`,D),e(`wui-data-table`,u),e(`wui-drawer`,h),e(`wui-dropdown`,g),e(`wui-entry-grid`,_),e(`wui-gantt`,v),e(`wui-hover-card`,y),e(`wui-lightbox`,C),e(`wui-navigation-menu`,O),e(`wui-notification-center`,k),e(`wui-onboarding-checklist`,j),e(`wui-overflow`,P),e(`wui-popover`,I),e(`wui-rating`,L),e(`wui-relative-time`,z),e(`wui-show-more`,U),e(`wui-calendar-views`,r),e(`wui-truncate`,X),e(`wui-whats-new`,Z),e(`wui-offline-banner`,A),e(`wui-mention-input`,T),e(`wui-comment-thread`,o),e(`wui-wizard-step`,$),e(`wui-wizard`,Q)}me();export{fe as DISCARD_EVENT,ue as ROW_DROP_EVENT,pe as SHORTCUT_EVENT,de as THEME_CHANGE_EVENT,ne as WHATS_NEW_READ_EVENT,r as WuiCalendarViews,i as WuiCarousel,te as WuiCodeBlock,a as WuiCommandPalette,o as WuiCommentThread,s as WuiConsentBanner,c as WuiContextMenu,l as WuiDashboardGrid,u as WuiDataTable,d as WuiDatePicker,f as WuiDateRange,p as WuiDateTime,m as WuiDock,h as WuiDrawer,g as WuiDropdown,_ as WuiEntryGrid,v as WuiGantt,y as WuiHoverCard,b as WuiImageCrop,x as WuiInlineEdit,t as WuiKanban,S as WuiLeadPopup,C as WuiLightbox,w as WuiMarkdown,T as WuiMentionInput,E as WuiMiniCalendar,D as WuiModal,O as WuiNavigationMenu,k as WuiNotificationCenter,A as WuiOfflineBanner,j as WuiOnboardingChecklist,M as WuiOrgTree,N as WuiOtp,P as WuiOverflow,F as WuiPhone,I as WuiPopover,L as WuiRating,R as WuiRecordPager,z as WuiRelativeTime,B as WuiSavedViews,V as WuiSelect,H as WuiShortcuts,U as WuiShowMore,W as WuiSlider,G as WuiSortable,n as WuiStatusIcon,K as WuiTimePicker,q as WuiTour,J as WuiTree,Y as WuiTreePicker,X as WuiTruncate,Z as WuiWhatsNew,Q as WuiWizard,$ as WuiWizardStep,me as defineWeborityElements,ce as formatCompact,re as formatCurrency,ae as formatDate,le as formatDateTime,ie as formatNumber,se as formatPercent,oe as formatValue};
1
+ import{n as e}from"./elementBase-Cxeyx0tU.js";import{n as ee}from"./filterPopover-DskHFNLi.js";import{t}from"./kanban-Dayig7ic.js";import{n}from"./statusIcons-Cd3GJcBR.js";import{t as r}from"./WuiCalendarViews-Dg9yRY1I.js";import{t as i}from"./WuiCarousel-B0yPDH5I.js";import{t as te}from"./WuiCodeBlock-BWYZ1S70.js";import{t as a}from"./WuiCommandPalette-CpmlKjzH.js";import{t as o}from"./WuiCommentThread-Cp7AVHvt.js";import{t as s}from"./WuiConsentBanner-nTua-kEd.js";import{t as c}from"./WuiContextMenu-oKlQvt3V.js";import{r as l}from"./WuiDashboardGrid-DFpX8Vx0.js";import{t as u}from"./WuiDataTable-CSgcwxU5.js";import{t as d}from"./WuiDatePicker-CRqjwyf2.js";import{t as f}from"./WuiDateRange-BBm_Q69p.js";import{t as p}from"./WuiDateTime-Vimu6grS.js";import{t as m}from"./WuiDock-2LGlbEFx.js";import{t as h}from"./WuiDrawer-BsY0fs_u.js";import{t as g}from"./WuiDropdown-6g074v1T.js";import{t as _}from"./WuiEntryGrid-Z69-1YBh.js";import{t as v}from"./WuiGantt-DvmVKJX2.js";import{t as y}from"./WuiHoverCard-DhJcIIM1.js";import{t as b}from"./WuiImageCrop-UakcSM2k.js";import{t as x}from"./WuiInlineEdit-JT83k3Nk.js";import{t as S}from"./WuiLeadPopup-DaYZ2zCJ.js";import{t as C}from"./WuiLightbox-DpHJAMO3.js";import{t as w}from"./WuiMarkdown-DRtGPxQX.js";import{r as T}from"./WuiMentionInput-DPCCSQRZ.js";import{t as E}from"./WuiMiniCalendar-BhUTIGwe.js";import{t as D}from"./WuiModal-DQbVJGUo.js";import{t as O}from"./WuiNavigationMenu-BvYLbEmA.js";import{t as k}from"./WuiNotificationCenter-D5bBM8Lp.js";import{t as A}from"./WuiOfflineBanner-DGTFCtyM.js";import{t as j}from"./WuiOnboardingChecklist-C-nllg2h.js";import{t as M}from"./WuiOrgTree-DWSk_LHd.js";import{t as N}from"./WuiOtp-Cc0formv.js";import{t as P}from"./WuiOverflow-fZKqdsr-.js";import{t as F}from"./WuiPhone-B5ZLabTY.js";import{t as I}from"./WuiPopover-BvWKRNQY.js";import{t as L}from"./WuiRating-DIQfif9x.js";import{t as R}from"./WuiRecordPager-BXoe4KfU.js";import{t as z}from"./WuiRelativeTime-CSg9vzfk.js";import{t as B}from"./WuiSavedViews-CH7IvwgZ.js";import{t as V}from"./WuiSelect-C1NNAsFQ.js";import{t as H}from"./WuiShortcuts-CRCctX82.js";import{t as U}from"./WuiShowMore-BoYCrYYf.js";import{t as W}from"./WuiSlider-CK7_l_R5.js";import{t as G}from"./WuiSortable-x8Mg0tOv.js";import{t as K}from"./WuiTimePicker-BKFPf8Fn.js";import{t as q}from"./WuiTour-BgpMa8J5.js";import{t as J}from"./WuiTree-Db83Uztv.js";import{t as Y}from"./WuiTreePicker-DLddmEgG.js";import{t as X}from"./WuiTruncate-BB4i8wHE.js";import{n as Z,t as ne}from"./WuiWhatsNew-Dm4Yl68x.js";import{n as Q,t as $}from"./WuiWizardStep-BBkw94dD.js";import{c as re,f as ie,l as ae,m as oe,p as se,s as ce,u as le}from"./formatters-DTW53DjY.js";import{_ as ue,r as de}from"./themeTransition-C5nAlClG.js";import{t as fe}from"./drawerDiscard-CBUOklnA.js";import{n as pe}from"./shortcutKeys-BMTWgV2g.js";function me(){ee(),e(`wui-select`,V),e(`wui-saved-views`,B),e(`wui-phone`,F),e(`wui-datepicker`,d),e(`wui-mini-calendar`,E),e(`wui-date-range`,f),e(`wui-date-time`,p),e(`wui-dock`,m),e(`wui-image-crop`,b),e(`wui-kanban`,t),e(`wui-dashboard-grid`,l),e(`wui-lead-popup`,S),e(`wui-inline-edit`,x),e(`wui-consent-banner`,s),e(`wui-slider`,W),e(`wui-sortable`,G),e(`wui-timepicker`,K),e(`wui-tour`,q),e(`wui-tree`,J),e(`wui-tree-picker`,Y),e(`wui-org-tree`,M),e(`wui-command-palette`,a),e(`wui-context-menu`,c),e(`wui-otp`,N),e(`wui-status-icon`,n),e(`wui-shortcuts`,H),e(`wui-record-pager`,R),e(`wui-carousel`,i),e(`wui-code-block`,te),e(`wui-markdown`,w),e(`wui-modal`,D),e(`wui-data-table`,u),e(`wui-drawer`,h),e(`wui-dropdown`,g),e(`wui-entry-grid`,_),e(`wui-gantt`,v),e(`wui-hover-card`,y),e(`wui-lightbox`,C),e(`wui-navigation-menu`,O),e(`wui-notification-center`,k),e(`wui-onboarding-checklist`,j),e(`wui-overflow`,P),e(`wui-popover`,I),e(`wui-rating`,L),e(`wui-relative-time`,z),e(`wui-show-more`,U),e(`wui-calendar-views`,r),e(`wui-truncate`,X),e(`wui-whats-new`,Z),e(`wui-offline-banner`,A),e(`wui-mention-input`,T),e(`wui-comment-thread`,o),e(`wui-wizard-step`,$),e(`wui-wizard`,Q)}me();export{fe as DISCARD_EVENT,ue as ROW_DROP_EVENT,pe as SHORTCUT_EVENT,de as THEME_CHANGE_EVENT,ne as WHATS_NEW_READ_EVENT,r as WuiCalendarViews,i as WuiCarousel,te as WuiCodeBlock,a as WuiCommandPalette,o as WuiCommentThread,s as WuiConsentBanner,c as WuiContextMenu,l as WuiDashboardGrid,u as WuiDataTable,d as WuiDatePicker,f as WuiDateRange,p as WuiDateTime,m as WuiDock,h as WuiDrawer,g as WuiDropdown,_ as WuiEntryGrid,v as WuiGantt,y as WuiHoverCard,b as WuiImageCrop,x as WuiInlineEdit,t as WuiKanban,S as WuiLeadPopup,C as WuiLightbox,w as WuiMarkdown,T as WuiMentionInput,E as WuiMiniCalendar,D as WuiModal,O as WuiNavigationMenu,k as WuiNotificationCenter,A as WuiOfflineBanner,j as WuiOnboardingChecklist,M as WuiOrgTree,N as WuiOtp,P as WuiOverflow,F as WuiPhone,I as WuiPopover,L as WuiRating,R as WuiRecordPager,z as WuiRelativeTime,B as WuiSavedViews,V as WuiSelect,H as WuiShortcuts,U as WuiShowMore,W as WuiSlider,G as WuiSortable,n as WuiStatusIcon,K as WuiTimePicker,q as WuiTour,J as WuiTree,Y as WuiTreePicker,X as WuiTruncate,Z as WuiWhatsNew,Q as WuiWizard,$ as WuiWizardStep,me as defineWeborityElements,ce as formatCompact,re as formatCurrency,ae as formatDate,le as formatDateTime,ie as formatNumber,se as formatPercent,oe as formatValue};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webority/ui-elements",
3
- "version": "0.186.0",
3
+ "version": "0.187.0",
4
4
  "description": "Webority framework-agnostic UI custom elements (<wui-*>): the single implementation of the interactive components, styled by @webority/theme. Used natively in Razor and wrapped by @webority/ui-react.",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "type": "module",
@@ -295,10 +295,10 @@
295
295
  "@tiptap/starter-kit": "3.31.4",
296
296
  "@types/node": "25.6.0",
297
297
  "@vitest/coverage-v8": "5.1.0",
298
- "@webority/biome-config": "0.186.0",
299
- "@webority/markdown-core": "0.186.0",
300
- "@webority/theme": "0.186.0",
301
- "@webority/web-core": "0.186.0",
298
+ "@webority/biome-config": "0.187.0",
299
+ "@webority/markdown-core": "0.187.0",
300
+ "@webority/theme": "0.187.0",
301
+ "@webority/web-core": "0.187.0",
302
302
  "echarts": "6.1.0",
303
303
  "jsdom": "30.1.1",
304
304
  "libphonenumber-js": "^1.13.9",
@@ -16,7 +16,13 @@
16
16
  * </wui-navigation-menu>
17
17
  *
18
18
  * A panel is a popover="auto" placed under its button. Below the md tier (max-width 767.98px) it is
19
- * not a popover: it stays in the page flow and is marked `data-open`. It opens on a click, Enter or
19
+ * not a popover: it stays in the page flow and is marked `data-open`.
20
+ *
21
+ * With `orientation="vertical"` (a menu inside a drawer or a side rail) the entries stack at every
22
+ * width and each panel opens in the page flow like an accordion: it stays open when focus or a press
23
+ * leaves it, and closes from its button, Escape or a chosen link. Down and Up move through the
24
+ * entries and the links of an open panel in reading order and wrap; Home and End go to the first and
25
+ * last; Left and Right do nothing. It opens on a click, Enter or
20
26
  * Space on its button, and on Down from it; never on hover. Tab moves through the page's links as
21
27
  * usual, with the open panel's links after its button.
22
28
  * - One panel is open at a time. Opening one closes the other.
@@ -50,6 +56,7 @@ export declare class WuiNavigationMenu extends ElementBase {
50
56
  close(restoreFocus?: boolean): void;
51
57
  _items(): HTMLElement[];
52
58
  _openItem(): HTMLElement | null;
59
+ _vertical(): boolean;
53
60
  _isOpen(panel: HTMLElement): boolean;
54
61
  _isTrigger(el: Element | null | undefined): boolean;
55
62
  _entries(): HTMLElement[];
@@ -59,6 +66,7 @@ export declare class WuiNavigationMenu extends ElementBase {
59
66
  _emit(trigger: HTMLElement, open: boolean): void;
60
67
  _handleClick(e: MouseEvent): void;
61
68
  _handleKeyDown(e: KeyboardEvent): void;
69
+ _verticalKey(e: KeyboardEvent, control: HTMLElement): void;
62
70
  _linkKey(e: KeyboardEvent, link: HTMLElement): void;
63
71
  _teardown(): void;
64
72
  }
@@ -2,7 +2,7 @@ import { type AnchorOptions } from "./anchorOverlay.ts";
2
2
  import { ElementBase } from "./elementBase.ts";
3
3
  import type { ListboxKeyNav } from "./listboxKeyNav.ts";
4
4
  import type { SelectOption } from "./select/option.ts";
5
- import type { SelectHost, SelectPart } from "./select/part.ts";
5
+ import type { SelectHost, SelectLoader, SelectPart, SelectStatus } from "./select/part.ts";
6
6
  export declare class WuiSelect extends ElementBase {
7
7
  static formAssociated: boolean;
8
8
  _internals: Pick<ElementInternals, "setValidity"> | null;
@@ -10,7 +10,7 @@ export declare class WuiSelect extends ElementBase {
10
10
  _optionsProp: SelectOption[] | null;
11
11
  _partOptions: SelectOption[] | null;
12
12
  _known: Map<string, SelectOption>;
13
- _loadOptionsFn: LoadOptions | null;
13
+ _loadOptionsFn: SelectLoader | null;
14
14
  _validateFn: ((value: string) => unknown) | null;
15
15
  _declared: DeclaredOption[] | undefined;
16
16
  _query: string;
@@ -21,7 +21,8 @@ export declare class WuiSelect extends ElementBase {
21
21
  _windowLoad: Promise<void> | null;
22
22
  _windowFailed: boolean;
23
23
  _scrollFrame: number | null;
24
- _status: "idle" | "loading" | "empty" | "hint";
24
+ _endFrame: number | null;
25
+ _status: SelectStatus;
25
26
  _error: string;
26
27
  _nav: ListboxKeyNav | null;
27
28
  _parts: SelectPart[] | null;
@@ -52,21 +53,23 @@ export declare class WuiSelect extends ElementBase {
52
53
  set value(v: unknown);
53
54
  get options(): SelectOption[];
54
55
  set options(arr: unknown);
55
- get loadOptions(): LoadOptions | null;
56
- set loadOptions(fn: LoadOptions | null | undefined);
56
+ get loadOptions(): SelectLoader | null;
57
+ set loadOptions(fn: SelectLoader | null | undefined);
57
58
  get validate(): ((value: string) => unknown) | null;
58
59
  set validate(fn: ((value: string) => unknown) | null | undefined);
59
60
  commit(value: string | string[], meta?: {
60
61
  isCustom?: boolean;
61
62
  }): void;
62
63
  setPartOptions(list: SelectOption[]): void;
63
- setStatus(status: "idle" | "loading" | "empty" | "hint"): void;
64
+ setStatus(status: SelectStatus): void;
64
65
  setError(message: string | null | undefined): void;
65
66
  openMenu(): void;
66
67
  closeMenu({ focusControl }?: {
67
68
  focusControl?: boolean;
68
69
  }): void;
69
70
  renderList(): void;
71
+ _watchListEnd(): void;
72
+ _checkListEnd(): void;
70
73
  render(): void;
71
74
  _accessibleName(): string;
72
75
  _snapshotDeclared(): void;
@@ -128,9 +131,6 @@ export declare class WuiSelect extends ElementBase {
128
131
  _remountParts(): void;
129
132
  _carry(): Carry;
130
133
  }
131
- type LoadOptions = (query: string, opts: {
132
- signal: AbortSignal;
133
- }) => Promise<SelectOption[]>;
134
134
  type DeclaredOption = SelectOption & {
135
135
  selected: boolean;
136
136
  };
@@ -1,4 +1,5 @@
1
1
  import type { SelectOption } from "./option.ts";
2
+ import type { SelectStatus } from "./part.ts";
2
3
  export type ActionRow = {
3
4
  position: "top" | "bottom";
4
5
  label: string;
@@ -50,7 +51,8 @@ export declare function clearOptions(listEl: HTMLElement): void;
50
51
  /**
51
52
  * Draws the listbox. Rows are filtered by `query`; a part that owns filtering passes "" and its own rows.
52
53
  * The empty row shows when no option row or action row is drawn, or when status is "empty"; the loading
53
- * row replaces it while status is "loading", and the hint row replaces it while status is "hint".
54
+ * row replaces it while status is "loading", and the hint row replaces it while status is "hint". While status is
55
+ * "more" the rows stay drawn and the loading-more row follows them.
54
56
  * `recents` draws a heading, its rows and a divider above the full list.
55
57
  * A list of more than SELECT_WINDOW_THRESHOLD option rows draws only the rows near the scroll position, between
56
58
  * two spacers, once its window is registered; until then it draws every row. Either way each row keeps its
@@ -61,9 +63,10 @@ export declare function clearOptions(listEl: HTMLElement): void;
61
63
  export declare function renderOptions(listEl: HTMLElement, options: SelectOption[], view?: {
62
64
  selected?: string[] | undefined;
63
65
  query?: string | undefined;
64
- status?: "idle" | "loading" | "empty" | "hint" | undefined;
66
+ status?: SelectStatus | undefined;
65
67
  emptyText?: string | undefined;
66
68
  searchingText?: string | undefined;
69
+ loadingMoreText?: string | undefined;
67
70
  hintText?: string | undefined;
68
71
  actionRow?: ActionRow[] | undefined;
69
72
  recents?: Recents | undefined;
@@ -13,6 +13,18 @@ export interface SelectRefs {
13
13
  /** the inline draft input in tag mode (.wui-select-draft), or null; created by the chips part */
14
14
  input: HTMLInputElement | null;
15
15
  }
16
+ /** One page of a paged loader's answer: the page's options, and whether a later page exists. */
17
+ export interface SelectOptionPage {
18
+ options: SelectOption[];
19
+ hasMore: boolean;
20
+ }
21
+ /** A script-side loader: page counts from 1, and an array answer is the only page. */
22
+ export type SelectLoader = (query: string, opts: {
23
+ signal: AbortSignal;
24
+ page: number;
25
+ }) => Promise<SelectOption[] | SelectOptionPage>;
26
+ /** The row under the list: loading (the first page), more (a later page), the empty row, the hint row, or none. */
27
+ export type SelectStatus = "idle" | "loading" | "more" | "empty" | "hint";
16
28
  /** What the host offers a part. Every member is on the WuiSelect instance itself. */
17
29
  export interface SelectHost {
18
30
  /** "single" | "multiple" | "search" | "tag" | "country" */
@@ -26,9 +38,7 @@ export interface SelectHost {
26
38
  /** the search or draft text changed: runs the query through the parts, then redraws the list */
27
39
  _onQueryChange: (query: string) => void;
28
40
  /** a script-side loader (search and tag suggestions), or null */
29
- loadOptions: ((query: string, opts: {
30
- signal: AbortSignal;
31
- }) => Promise<SelectOption[]>) | null;
41
+ loadOptions: SelectLoader | null;
32
42
  /**
33
43
  * a script-side check for custom entries, run after `pattern`: true accepts, a non-empty string
34
44
  * refuses with that message, anything else refuses with `invalid-message`
@@ -41,10 +51,10 @@ export interface SelectHost {
41
51
  /** replaces the option list a part supplies (search results, the country dataset); re-renders the list; never closes the menu */
42
52
  setPartOptions: (list: SelectOption[]) => void;
43
53
  /**
44
- * shows the loading row (searching-text), the empty row (empty-text), the hint row (hint-text,
54
+ * shows the loading row (searching-text), the loading-more row under the rows, the empty row (empty-text), the hint row (hint-text,
45
55
  * default "Type to search…", shown while the query is shorter than min-chars), or none
46
56
  */
47
- setStatus: (status: "idle" | "loading" | "empty" | "hint") => void;
57
+ setStatus: (status: SelectStatus) => void;
48
58
  renderList: () => void;
49
59
  openMenu: () => void;
50
60
  closeMenu: (opts?: {
@@ -90,6 +100,8 @@ export interface SelectPart {
90
100
  } | null;
91
101
  /** the menu opened (search: min-chars 0 loads the first page; a query cut off by a disconnect re-runs) */
92
102
  onOpen?: () => void;
103
+ /** the open list was scrolled near its end, or drawn too short to scroll (search: loads the next page) */
104
+ onListEnd?: () => void;
93
105
  /** focus left the control; true when the part handled it (allow-custom commits a valid draft) */
94
106
  onBlur?: () => boolean;
95
107
  /**
@@ -1,5 +1,5 @@
1
1
  import type { SelectPart } from "./part.ts";
2
- export type SearchPart = SelectPart & Required<Pick<SelectPart, "onQuery" | "onOpen" | "onBlur" | "onPick" | "actionRow" | "renderValue">> & {
2
+ export type SearchPart = SelectPart & Required<Pick<SelectPart, "onQuery" | "onOpen" | "onListEnd" | "onBlur" | "onPick" | "actionRow" | "renderValue">> & {
3
3
  onOptions: () => void;
4
4
  };
5
5
  export default function createSearchPart(): SearchPart;
@@ -13,6 +13,8 @@ export type FilePickerText = {
13
13
  readonly maxSizeText: string;
14
14
  readonly optionalLabel: string;
15
15
  readonly previewAltText: string;
16
+ readonly previewError: string;
17
+ readonly previewRetry: string;
16
18
  readonly removeFileLabel: string;
17
19
  readonly removeNamedText: string;
18
20
  readonly selectedPreviewText: string;
@@ -13,6 +13,7 @@ export type SelectText = {
13
13
  readonly helpLabel: string;
14
14
  readonly hintText: string;
15
15
  readonly invalidMessage: string;
16
+ readonly loadingMoreText: string;
16
17
  readonly optionalLabel: string;
17
18
  readonly partLoadMessage: string;
18
19
  readonly placeholder: string;
@@ -1 +0,0 @@
1
- import{i as e}from"./dom-DMQu--xV.js";import{t}from"./elementBase-Cxeyx0tU.js";import{a as n,l as r,s as i}from"./nativeOverlay-BHD2QV02.js";import{n as a,t as o}from"./rtl-g7G8Bsib.js";var s=`.wui-nav-menu-link`,c=`(max-width: 767.98px)`,l=`data-open`,u=e=>e instanceof Element?e:e instanceof Node?e.parentElement:null,d=e=>[...e].filter(e=>e instanceof HTMLElement),f=e=>{let t=e.children[0];if(!(t instanceof HTMLElement))throw Error(`Navigation entry has no control.`);return t},p=e=>{let t=e.children[1];return t instanceof HTMLElement?t:null},m=(e,t,n)=>{let r=e[t];if(r===void 0)throw Error(n);return r},h=class extends t{constructor(){super(),this._onClick=e=>this._handleClick(e),this._onKeyDown=e=>this._handleKeyDown(e),this._onFocusOut=e=>{let t=this._openItem(),n=e.relatedTarget;t&&n instanceof Node&&!t.contains(n)&&this._set(t,!1)},this._onPointerDown=()=>{this._pressedOpen=this._openItem()},this._onModeChange=()=>{let e=this._openItem();e&&this._set(e,!1)},this._onOutsidePress=e=>{let t=this._openItem();t&&!e.composedPath().includes(t)&&this._set(t,!1)},this._pressedOpen=null,this._media=null}connectedCallback(){this._teardown(),this.addEventListener(`click`,this._onClick),this.addEventListener(`keydown`,this._onKeyDown),this.addEventListener(`focusout`,this._onFocusOut),this.addEventListener(`pointerdown`,this._onPointerDown,!0),this._media=window.matchMedia(c),this._media.addEventListener(`change`,this._onModeChange)}disconnectedCallback(){this._teardown()}open(e){let t=this._items().find(t=>{let n=t.children[0];return n instanceof HTMLElement&&this._isTrigger(n)&&n.dataset.key===e});t&&this._set(t,!0)}close(e=!1){let t=this._openItem();t&&(this._set(t,!1),e&&f(t).focus({preventScroll:!0}))}_items(){return d(this.querySelectorAll(`.wui-nav-menu-item`))}_openItem(){return this._items().find(e=>{let t=p(e);return t!==null&&this._isOpen(t)})??null}_isOpen(e){return e.hasAttribute(l)||i(e)}_isTrigger(e){return!!e?.classList.contains(`wui-nav-menu-trigger`)}_entries(){return this._items().map(f)}_links(e){let t=p(e);return t?d(t.querySelectorAll(s)):[]}_set(e,t){let a=p(e);if(!a)return;let o=f(e);if(t){let t=this._openItem();if(t&&t!==e&&this._set(t,!1),this._isOpen(a))return;o.setAttribute(`aria-expanded`,`true`),window.matchMedia(c).matches?(a.setAttribute(l,``),document.addEventListener(`pointerdown`,this._onOutsidePress,!0)):r(o,a,{mode:`auto`,below:!0,flipAlign:!0,onClosed:()=>this._settle(e)}),this._emit(o,!0)}else a.removeAttribute(l),document.removeEventListener(`pointerdown`,this._onOutsidePress,!0),i(a)&&n(a),this._settle(e)}_settle(e){let t=f(e);t.getAttribute(`aria-expanded`)!==`false`&&(t.setAttribute(`aria-expanded`,`false`),this._emit(t,!1))}_emit(e,t){this.dispatchEvent(new CustomEvent(`wui-navigation-menu:toggle`,{bubbles:!0,detail:{key:e.dataset.key??null,open:t}}))}_handleClick(t){let n=this._pressedOpen;this._pressedOpen=null;let r=u(t.target),i=r?.closest(`.wui-nav-menu-trigger`);if(i&&this.contains(i)){let t=e(i.parentElement,`Navigation trigger has no entry.`),r=e(p(t),`Navigation entry has no panel.`),a=n===t||this._isOpen(r);this._set(t,!a);return}let a=r?.closest(s);a&&this.contains(a)&&this.close()}_handleKeyDown(t){if(this._pressedOpen=null,t.altKey||t.ctrlKey||t.metaKey)return;let n=u(t.target)?.closest(`.wui-nav-menu-trigger, .wui-nav-menu-toplink, .wui-nav-menu-link`);if(!(n instanceof HTMLElement)||!this.contains(n))return;let r=this._openItem();if(t.key===`Escape`){if(!r||!p(r)?.hasAttribute(l))return;t.preventDefault(),t.stopPropagation();let e=r.contains(n);this._set(r,!1),e&&f(r).focus({preventScroll:!0});return}if(n.matches(s)){this._linkKey(t,n);return}let i=this._entries(),c=i.indexOf(n),d=a(t.key,o(this));if(d===`ArrowRight`||d===`ArrowLeft`||d===`Home`||d===`End`){t.preventDefault();let e=d===`Home`?0:d===`End`?i.length-1:(c+(d===`ArrowRight`?1:-1)+i.length)%i.length;r&&this._set(r,!1),m(i,e,`Navigation has no entry to focus.`).focus({preventScroll:!0})}else if(t.key===`ArrowDown`&&this._isTrigger(n)){t.preventDefault();let r=e(n.parentElement,`Navigation trigger has no entry.`);this._set(r,!0),m(this._links(r),0,`Navigation panel has no link to focus.`).focus({preventScroll:!0})}}_linkKey(t,n){let r=e(n.closest(`.wui-nav-menu-item`),`Navigation link has no entry.`),i=this._links(r),a=i.indexOf(n);t.key===`ArrowDown`||t.key===`ArrowUp`?(t.preventDefault(),m(i,(a+(t.key===`ArrowDown`?1:-1)+i.length)%i.length,`Navigation panel has no link to focus.`).focus({preventScroll:!0})):t.key===`Home`?(t.preventDefault(),m(i,0,`Navigation panel has no link to focus.`).focus({preventScroll:!0})):t.key===`End`&&(t.preventDefault(),m(i,i.length-1,`Navigation panel has no link to focus.`).focus({preventScroll:!0}))}_teardown(){for(let e of this._items()){let t=p(e);if(!t)continue;let r=t.hasAttribute(l);t.removeAttribute(l),n(t),r&&this._settle(e)}this._media?.removeEventListener(`change`,this._onModeChange),this._media=null,document.removeEventListener(`pointerdown`,this._onOutsidePress,!0),this.removeEventListener(`click`,this._onClick),this.removeEventListener(`keydown`,this._onKeyDown),this.removeEventListener(`focusout`,this._onFocusOut),this.removeEventListener(`pointerdown`,this._onPointerDown,!0)}};export{h as t};
@@ -1 +0,0 @@
1
- import{t as e}from"./anchorOverlay-daGdh_91.js";import{t}from"./avatarNode-BaEvz5Xr.js";import{n}from"./devWarn-DXdRWZs3.js";import{i as r,r as i}from"./dom-DMQu--xV.js";import{t as a}from"./elementBase-Cxeyx0tU.js";import{r as o,t as s}from"./fieldState-D-zQcXUS.js";import{n as c,t as l}from"./formMirror-9IpSgeZb.js";import{n as u}from"./loader-X2uBXCDm.js";import{t as d}from"./iconGlyphs.g-a9FtjPXh.js";import{n as f}from"./imeSafeEnter-DeO_3lXy.js";import{n as p,t as m}from"./listboxKeyNav-CNso9shL.js";import{a as h,l as g,s as _}from"./nativeOverlay-BHD2QV02.js";import{i as v,n as y,t as b}from"./optionLabel-wbpl8OTJ.js";import{r as x}from"./textStore-DBplASiZ.js";import{n as S,r as C,t as w}from"./search.g-B5d1s59A.js";import{t as T}from"./hasOwn-CJsplJ62.js";import{n as E,r as D,t as O}from"./window-BZWK3rQk.js";var k=()=>x(`select`,C);function A(e,t){let n=String(t??``).trim().toLowerCase();return n?e.filter(e=>[y(e),e.description,e.meta].some(e=>String(e??``).toLowerCase().includes(n))):e}var j=/* @__PURE__ */ new WeakMap,M=e=>e?{"data-index":String(e.index),"aria-setsize":String(e.size),"aria-posinset":String(e.index+1)}:{},N=e=>e.map(e=>e instanceof Element?e.outerHTML:e.textContent??``).join(``),P;function F(e){P=e}function I(e){P?.clear(e),j.delete(e),e.replaceChildren()}function L(e,t,n={}){let{selected:r=[],query:a=``,status:o=`idle`,emptyText:s=k().emptyText,searchingText:c=k().searchingText,hintText:l=k().hintText,actionRow:u=[],recents:d=null}=n,f=new Set(r.map(String)),p=A(t,a),m=e.id,h=u.filter(e=>e.position===`top`),g=u.filter(e=>e.position===`bottom`),_=d?.options.length?d.options:[],v=h.length+_.length+p.length+g.length,y=p.length>300,b=P,x=y&&b!==void 0,S=e=>x?{index:e,size:v}:void 0,C=0,w=e=>{let t=C++;return i(`button`,{type:`button`,role:`option`,id:R(m,t),class:`wui-select-option wui-select-add`,"data-value":String(e.value??``),"data-custom":`true`,"aria-selected":`false`,...M(S(t))},e.label)},T=e=>{let t=C++;return V(e,R(m,t),f.has(String(e.value)),S(t))},E=h.map(w),D=_.length&&d?[i(`div`,{class:`wui-select-group`},d.label),..._.map(T),i(`div`,{class:`wui-select-sep`,"aria-hidden":`true`})]:[],O=C,F=[];if(x)C+=p.length;else{let e=``;for(let t of p)t.group&&t.group!==e&&F.push(i(`div`,{class:`wui-select-group`},t.group)),e=t.group??``,F.push(T(t))}let I=g.map(w),L=[];if(o===`loading`?L=[i(`div`,{class:`wui-select-loading`},i(`span`,{class:`wui-select-spinner spinner-border spinner-border-sm`,role:`status`,"aria-hidden":`true`}),c)]:o===`hint`?L=[i(`div`,{class:`wui-select-hint`},l)]:(o===`empty`||p.length===0&&u.length===0)&&(L=[i(`div`,{class:`wui-select-empty`},s)]),x&&b){let n=[...E,...D],r=[...I,...L];return b.render(e,{options:t,query:a,rows:p,pre:n,post:r,preSig:N(n),postSig:N(r),picked:f,top:h,recent:_,bottom:g,bodyBase:O,total:v}),{rows:v,windowed:!0,long:y}}b?.clear(e);let z=[...E,...D,...F,...I,...L],B=N(z);return j.get(e)===B||(j.set(e,B),e.replaceChildren(...z)),{rows:C,windowed:!1,long:y}}var R=(e,t)=>`${e}-opt-${t}`,z=e=>[...e.querySelectorAll(`.wui-select-option`)];function B(e){return P?P.refresh(e):!1}function ee(e,t){return P?P.reveal(e,t):z(e)[t]??null}function te(e,t){if(P)return P.indexOfValue(e,t);let n=new Set(t.map(String));return z(e).findIndex(e=>n.has(e.dataset.value??``))}function ne(e,t){return P?P.indexByPrefix(e,t):z(e).findIndex(e=>(e.textContent??``).trim().toLowerCase().startsWith(t))}function V(e,n,r,a){let o=!!e.disabled,s={id:n,role:`option`,"data-value":String(e.value??``),"aria-selected":String(r),"aria-disabled":o?`true`:void 0,title:o&&e.disabledHint?e.disabledHint:void 0,...M(a)},c=i(`span`,{class:`wui-select-check`,"aria-hidden":`true`},d(`check`));if(!e.description&&!e.meta)return i(`button`,{type:`button`,class:`wui-select-option${r?` selected`:``}`,...s},t(e),i(`span`,{class:`wui-select-opt-name`},...b(e)),c);let l=e.description?i(`span`,{class:`wui-select-opt-desc`},e.description):null,u=e.meta?i(`span`,{class:`wui-select-opt-meta`},e.meta):null;return i(`div`,{class:`wui-select-option wui-select-option-rich${r?` selected`:``}`,...s},t(e),i(`span`,{class:`wui-select-option-text`},i(`span`,{class:`wui-opt-label`},...b(e)),l),u,c)}var re=Object.freeze([`single`,`multiple`,`search`,`tag`,`country`]),H=e=>e===`multiple`||e===`tag`,ie={recents:()=>import(`./recents-B9efQ1Au.js`),chips:()=>import(`./chips-DxSWAJDI.js`),search:()=>import(`./search-DLRWJomU.js`),country:()=>import(`./country-T7AfpJpN.js`)};function ae(e){let t=T(ie,e)?ie[e]:void 0;return t?t():Promise.reject(/* @__PURE__ */ Error(`Unknown <wui-select> part: ${e}.`))}var U=e=>typeof e.loadOptions==`function`||!!e.getAttribute(`source`)||e.hasAttribute(`remote`),oe=300,W=`<div class="wui-select-spacer" aria-hidden="true"></div>`,G=()=>i(`div`,{class:`wui-select-spacer`,"aria-hidden":`true`}),K=/* @__PURE__ */ new WeakMap;function se(e,t,n,r){let i=K.get(e);if(i&&i.options===t&&i.query===n&&i.count===r.length)return i;let a=[],o=new Int32Array(r.length),s=``;r.forEach((e,t)=>{e.group&&e.group!==s&&a.push({kind:`group`,label:e.group}),s=e.group??``,o[t]=a.length,a.push({kind:`option`,option:e,ord:t})});let c={options:t,query:n,count:r.length,entries:a,optionEntry:o,heights:O(a.length),estimated:!1,bodyTop:0,start:0,end:0,pre:[],post:[],preSig:``,postSig:``,picked:/* @__PURE__ */ new Set,top:[],recent:[],bottom:[],bodyBase:0,total:0};return K.set(e,c),e.scrollTop=0,c}var q=e=>e.clientHeight||oe,J=(e,t)=>D(t.heights,{scrollTop:Math.max(0,e.scrollTop-t.bodyTop),viewport:q(e)});function ce(e,t,n,r){let a=[];for(let o=n;o<r;o++){let n=e.entries[o];if(n){if(n.kind===`group`)a.push(i(`div`,{class:`wui-select-group`,"data-entry":o},n.label));else{let r=e.bodyBase+n.ord;a.push(V(n.option,R(t,r),e.picked.has(String(n.option.value)),{index:r,size:e.total}))}}}return a}function le(e,t){let[n,r]=e.querySelectorAll(`.wui-select-spacer`);n&&r&&(n.style.flex=r.style.flex=`none`,n.style.height=`${t.heights.offsetOf(t.start)}px`,r.style.height=`${t.heights.total()-t.heights.offsetOf(t.end)}px`)}function ue(e,t){let{start:n,end:r}=J(e,t);t.start=n,t.end=r;let i=ce(t,e.id,n,r),a=t.preSig+W+N(i)+W+t.postSig,o=e.scrollTop;j.get(e)!==a&&(j.set(e,a),e.replaceChildren(...t.pre,G(),...i,G(),...t.post)),le(e,t),e.scrollTop!==o&&(e.scrollTop=o)}function de(e,t){let n={changed:!1,delta:0};if(!e.clientHeight)return n;let{heights:r}=t,i=e.querySelector(`.wui-select-spacer`),a=[],o=!0,s=!1;if(i){let n=i.getBoundingClientRect().top-e.getBoundingClientRect().top+e.scrollTop;Math.abs(n-t.bodyTop)>.5&&(t.bodyTop=n,s=!0)}let c=r.indexAt(Math.max(0,e.scrollTop-t.bodyTop)),l=r.offsetOf(c),u=0;for(let n of e.querySelectorAll(`.wui-select-option[data-index], .wui-select-group[data-entry]`)){let e=n.getBoundingClientRect().height;if(n.dataset.entry!==void 0)a.push([Number(n.dataset.entry),e]);else{let r=Number(n.dataset.index)-t.bodyBase,i=r>=0?t.optionEntry[r]:void 0;if(i===void 0)continue;o&&(u=e),o=!1,a.push([i,e])}}if(!t.estimated&&u>0){let e=r.estimate;r.setEstimate(u),t.estimated=!0,r.estimate!==e&&(s=!0)}for(let[e,t]of a)r.set(e,t)&&(s=!0);return s?{changed:s,delta:r.offsetOf(c)-l}:n}function Y(e,t){ue(e,t);for(let n=0;n<2;n++){let{changed:n,delta:r}=de(e,t);if(!n)return;le(e,t),r&&(e.scrollTop+=r),ue(e,t)}}function fe(e,t){let n=se(e,t.options,t.query,t.rows);Object.assign(n,{pre:t.pre,post:t.post,preSig:t.preSig,postSig:t.postSig,picked:t.picked,top:t.top,recent:t.recent,bottom:t.bottom,bodyBase:t.bodyBase,total:t.total}),Y(e,n)}function pe(e){let t=K.get(e);if(!t)return!1;let{start:n,end:r}=J(e,t);return n===t.start&&r===t.end?!1:(Y(e,t),!0)}function me(e,t){let n=K.get(e);if(!n||t<0||t>=n.total)return null;let r=t-n.bodyBase,i=r>=0?n.optionEntry[r]:void 0,a=()=>e.querySelector(`[data-index="${t}"]`);if(i===void 0)return a();for(let t=0;t<2;t++){let t={scrollTop:e.scrollTop-n.bodyTop,viewport:q(e)},r=n.bodyTop+E(n.heights,i,t);if(Math.abs(r-e.scrollTop)>.5)e.scrollTop=r;else if(a())break;Y(e,n)}return a()}function he(e,t){if(t<0||t>=e.total)return;if(t<e.top.length)return e.top[t];let n=t-e.top.length;if(n<e.recent.length)return e.recent[n];let r=t-e.bodyBase;if(r<e.count){let t=e.entries[e.optionEntry[r]??-1];return t?.kind===`option`?t.option:void 0}return e.bottom[r-e.count]}var ge=e=>e&&!(`position`in e)?e:void 0;function _e(e,t){let n=K.get(e);if(!n||t.length===0)return-1;let r=new Set(t.map(String));for(let e=0;e<n.total;e++){let t=ge(he(n,e));if(t&&r.has(String(t.value)))return e}return-1}var ve=e=>`position`in e?e.label:`${e.initials??``}${y(e)}${e.description??``}${e.meta??``}`;function ye(e,t){let n=K.get(e);if(!n)return-1;for(let e=0;e<n.total;e++){let r=he(n,e);if(r&&ve(r).trim().toLowerCase().startsWith(t))return e}return-1}F({render:fe,refresh:pe,reveal:me,indexOfValue:_e,indexByPrefix:ye,clear(e){K.delete(e)}});function be(){return Promise.resolve()}var X=()=>x(`select`,C),xe=()=>x(`search`,w),Se=()=>x(`field`,S),Ce=class extends a{static formAssociated=!0;_internals;_value;_optionsProp;_partOptions;_known;_loadOptionsFn;_validateFn;_declared;_query;_ownsFilter;_active;_rows;_windowed;_windowLoad;_windowFailed;_scrollFrame;_status;_error;_nav;_parts;_partSig;_partsMounted;_partToken;_rendered;_searchShown;_defaultValue;_warnedMode;_warnedDensity;_hoverTimer;_hoverOpened;_onHoverOver;_onHoverOut;_panelShown;_pressOpen;static get observedAttributes(){return/* @__PURE__ */ `class.mode.value.placeholder.search-placeholder.empty-text.searchable.clearable.disabled.readonly.loading.required.size.density.icon.prefix.open.open-on-hover.lazy-options.aria-label.aria-describedby.aria-invalid.min-chars.debounce.source.remote.allow-custom.add-label.searching-text.hint-text.value-label.value-avatar.value-initials.max-tags.allow-duplicates.separators.pattern.invalid-message.create-label.collapse-chips.selected-text.clear-all-label.countries.suggested.suggested-label.all-countries-label.recents-key.recents-limit.recents-label`.split(`.`)}constructor(){super();try{this._internals=this.attachInternals()}catch{this._internals=null}this._value=``,this._optionsProp=null,this._partOptions=null,this._known=/* @__PURE__ */ new Map,this._loadOptionsFn=null,this._validateFn=null,this._declared=void 0,this._query=``,this._ownsFilter=!1,this._active=-1,this._rows=0,this._windowed=!1,this._windowLoad=null,this._windowFailed=!1,this._scrollFrame=null,this._status=`idle`,this._error=``,this._nav=null,this._parts=null,this._partSig=``,this._partsMounted=!1,this._partToken=0,this._rendered=!1,this._searchShown=!1,this._defaultValue=void 0,this._warnedMode=null,this._hoverTimer=null,this._hoverOpened=!1,this._panelShown=!1,this._pressOpen=null,this._onHoverOver=e=>{e.pointerType===`mouse`&&this._hoverZone(e.target)&&(this._clearHover(),!this._menuOpen()&&this._hoverEligible()&&(this._hoverTimer=setTimeout(()=>{this._hoverTimer=null,!this._menuOpen()&&this._hoverEligible()&&(this._open({focus:!1}),this._hoverOpened=!0)},De)))},this._onHoverOut=e=>{e.pointerType===`mouse`&&this._hoverZone(e.target)&&!this._hoverZone(e.relatedTarget)&&(this._clearHover(),this._menuOpen()&&this.hasAttribute(`open-on-hover`)&&(this._hoverTimer=setTimeout(()=>{this._hoverTimer=null,this._close()},Oe)))}}connectedCallback(){this.addEventListener(`pointerover`,this._onHoverOver),this.addEventListener(`pointerout`,this._onHoverOut),this._rendered||this.render(),this._ensureParts(),this._mountParts()}disconnectedCallback(){this.removeEventListener(`pointerover`,this._onHoverOver),this.removeEventListener(`pointerout`,this._onHoverOut),this._clearHover(),this._dropMenu(),this._teardown(),this._teardownParts()}attributeChangedCallback(e,t,n){e===`class`?this._syncUnderline():e===`value`?(this._value=Z(n,H(this.mode)),this._applyValue()):e===`aria-invalid`?this._syncInvalid():e===`open`?this._rendered&&(this.hasAttribute(`open`)?this._open({focus:!1}):this._close({force:!0})):e===`open-on-hover`?this.hasAttribute(`open-on-hover`)||this._clearHover():e!==`lazy-options`&&(e===`mode`&&(this._value=Z(this._value,H(this.mode)),this._partOptions=null,this._known.clear(),this._ensureParts()),(e===`source`||e===`remote`||e===`recents-key`)&&this._ensureParts(),Me.has(e)?this._rendered&&(this._drawValue(),this.renderList()):je.has(e)?this._remountParts():this._rendered&&this.render())}formResetCallback(){if(this.value=this._defaultValue??``,!this._rendered)return;let e=this._refs();e.input&&(e.input.value=``,e.input.removeAttribute(`aria-invalid`)),e.search&&(e.search.value=``),this.setError(``),this._query!==``&&this._onQueryChange(``)}get mode(){let e=this.getAttribute(`mode`);return e===null?`single`:Te(e)?e:(e!==this._warnedMode&&(this._warnedMode=e,n(`<wui-select> mode "${e}" is not one of ${re.join(`, `)}; it is treated as "single".`)),`single`)}_checkDensity(){let e=this.getAttribute(`density`);e===null||Ee.includes(e)||e===this._warnedDensity||(this._warnedDensity=e,n(`<wui-select> density "${e}" is not one of ${Ee.join(`, `)}; it is treated as "comfortable".`))}set mode(e){this.setAttribute(`mode`,String(e))}get value(){return Array.isArray(this._value)?this._value.slice():this._value}set value(e){this._value=Z(e,H(this.mode)),this._applyValue()}get options(){return this._readOptions()}set options(e){this._optionsProp=Array.isArray(e)?e:null,this.mode!==`country`&&(this._partOptions=null);for(let e of this._activePartsList())e.onOptions?.();if(this._rendered){if(this.mode===`single`&&this.getAttribute(`searchable`)===null&&this._autoSearch()!==this._searchShown){this.render();return}this._drawValue(),this.renderList()}}get loadOptions(){return this._loadOptionsFn}set loadOptions(e){this._loadOptionsFn=typeof e==`function`?e:null,this._ensureParts()}get validate(){return this._validateFn}set validate(e){this._validateFn=typeof e==`function`?e:null}commit(e,t={}){this.value=e,this.dispatchEvent(new CustomEvent(`change`,{bubbles:!0,detail:{isCustom:!!t.isCustom}}))}setPartOptions(e){this._partOptions=Array.isArray(e)?e:null,this._drawValue(),this.renderList()}setStatus(e){this._status=e,this.renderList()}setError(e){this._error=e?String(e):``,this._syncError()}openMenu(){s(this)||this._open({focus:!1})}closeMenu({focusControl:e=!1}={}){this._close(),e&&this._refs().control?.focus()}renderList(){let e=this._refs();if(!e.list)return;let t=this._ownsFilter?``:this._query,n=this._actionRows(),r=this._recents();if(this.hasAttribute(`lazy-options`)&&!this._menuOpen()){this._rows=A(this._listOptions(),t).length+n.length+(r?.options.length??0),this._windowed=!1,I(e.list),this._anchorMenu();return}let i=L(e.list,this._listOptions(),{selected:this._selectedValues(),query:t,status:this._status,emptyText:this.getAttribute(`empty-text`)||X().emptyText,searchingText:this.getAttribute(`searching-text`)||X().searchingText,hintText:this.getAttribute(`hint-text`)||void 0,actionRow:n,recents:r});this._rows=i.rows,this._windowed=i.windowed,i.long&&!i.windowed&&!this._windowFailed&&this._loadWindow(),this._active>=this._rowCount()&&(this._active=-1),this._active>=0&&this._setActive(this._active,{reveal:!1}),this._anchorMenu()}render(){this._dropMenu();let e=this._carry();this._teardownParts(),this._snapshotDeclared();let t=this.mode;this._checkDensity();let n=H(t),r=t===`tag`,a=n&&(r||this.hasAttribute(`allow-custom`));this._value=Z(this._value,n),this._defaultValue===void 0&&n&&this._value.length===0&&(this._value=this._declaredSelected()),n||this._preselect(),this._defaultValue===void 0&&(this._defaultValue=Z(this._value,n));let s=this.getAttribute(`size`),c=s===`sm`?` wui-select-sm`:s===`lg`?` wui-select-lg`:s===`xl`?` wui-select-xl`:``,l=this.getAttribute(`icon`),u=this.getAttribute(`prefix`),f=this.hasAttribute(`clearable`),p=this.hasAttribute(`disabled`);if(!this.id){let e=crypto.getRandomValues(/* @__PURE__ */ new Uint8Array(8));this.id=`wui-select-${Array.from(e,e=>e.toString(16).padStart(2,`0`)).join(``)}`}let m=`${this.id}-listbox`,h=`${this.id}-entry-error`,g=this.getAttribute(`aria-describedby`)?.trim(),_=g?`${g} ${h}`:h,v=this.hasAttribute(`aria-invalid`)||!!this._error,y=this.hasAttribute(`required`)&&!a,b=this._accessibleName(),x=a?{}:{role:`combobox`,"aria-haspopup":`listbox`,"aria-expanded":`false`,"aria-controls":m},S={"aria-label":b,"aria-describedby":_,"aria-invalid":v?`true`:void 0,"aria-required":y?`true`:void 0},C=n?i(`div`,{class:`input wui-select-control wui-select-multi`,...x,...S,"aria-disabled":p?`true`:void 0,tabindex:!p&&!r?`0`:void 0}):i(`button`,{type:`button`,class:`input wui-select-control`,...x,...S,disabled:p||void 0}),w=[l?d(l,{className:`wui-select-icon`}):null,u?i(`span`,{class:`wui-select-prefix`},u):null,i(`span`,{class:`wui-select-value`,"data-label":!0}),f?i(`span`,{class:`wui-select-reset`,role:`button`,"aria-label":X().clearSelectionLabel,hidden:!0},d(`x`)):null,d(`chevron-down`,{className:`wui-select-caret`})];C.append(...w.filter(e=>e!==null));let T=this.getAttribute(`searchable`),E=T===null?t===`multiple`||t===`country`||this._autoSearch():T!==`false`,D=t===`search`||E&&!a;this._searchShown=D;let O=this.getAttribute(`search-placeholder`)||(t===`country`?X().countrySearchPlaceholder:xe().placeholder),k=D?i(`div`,{class:`wui-select-search`},d(`search`),i(`input`,{class:`wui-select-input`,placeholder:O,"aria-label":O,"aria-autocomplete":`list`}),i(`button`,{type:`button`,class:`wui-select-clear`,"aria-label":xe().clearLabel,hidden:!0},d(`x`))):null,A=i(`div`,{class:`wui-select-options`,role:`listbox`,id:m,tabindex:`-1`,"aria-multiselectable":n?`true`:void 0}),j=i(`div`,{class:`wui-select-menu wui-select-menu-fixed`,popover:`auto`},k,A),M=i(`div`,{class:`field-error wui-select-error`,id:h,"aria-live":`polite`,hidden:!this._error||void 0},this._error||null);this.replaceChildren(i(`div`,{class:`wui-select${c}`},C,j),M),this._rendered=!0,this._syncMirror(),this._syncValidity(),this._drawValue(),this._syncReset(),this.renderList(),this._wire(),o(this,this.querySelector(`.wui-select-control`)),this._syncUnderline(),this._mountParts(e)}_accessibleName(){return this.getAttribute(`aria-label`)||this.getAttribute(`placeholder`)||X().fallbackName}_snapshotDeclared(){if(this._declared)return;let e=[...this.querySelectorAll(`:scope > wui-option`)];e.length&&(this._declared=e.map(e=>{let t=document.createDocumentFragment();for(let n of e.childNodes)t.append(n.cloneNode(!0));let n={value:e.getAttribute(`value`)??$(e).trim(),label:t.textContent??``,selected:e.hasAttribute(`selected`)};for(let[t,r]of Ne){let i=e.getAttribute(t);i&&(n[r]=i)}return e.hasAttribute(`disabled`)&&(n.disabled=!0),v(n,t)}))}_readOptions(){return this.mode===`country`?this._partOptions||[]:this._partOptions?this._partOptions:this._optionsProp?this._optionsProp:(this._snapshotDeclared(),this._declared||[])}_listOptions(){let e=this._readOptions(),t=this.getAttribute(`value-label`);if(this.mode!==`search`||!t||this._value===``)return e;let n=String(this._value);return e.some(e=>String(e.value)===n)?e:[...e,{value:n,label:t}]}_declaredSelected(){return this._optionsProp?[]:(this._declared??[]).filter(e=>e.selected).map(e=>String(e.value))}_preselect(){let e=this._readOptions(),t=this._value!==``&&e.find(e=>String(e.value)===this._value)||e.find(e=>`selected`in e&&!!e.selected);t&&(this._value=String(t.value))}_optionFor(e){let t=String(e),n=this._readOptions().find(e=>String(e.value)===t);return n?(this._known.set(t,n),n):this._known.get(t)}_placeholder(){return this.getAttribute(`placeholder`)||Ae()[this.mode]}_hasValue(){return Array.isArray(this._value)?this._value.length>0:this._value!==``}_selectedValues(){return Array.isArray(this._value)?this._value:this._value===``?this._listOptions().some(e=>String(e.value)===``)?[``]:[]:[this._value]}_applyValue(){this._syncMirror(),this._syncValidity(),this._rendered&&(this._drawValue(),this._syncReset(),this.renderList())}_syncMirror(){H(this.mode)?c(this,this._selectedValues()):l(this,this._value)}_drawValue(){let e=this._refs();if(!e.value)return;let t=H(this.mode),n=t?void 0:this._optionFor(this._value);if(this._syncTitle(n),this._syncValueAvatar(),this._activePartsList().some(e=>e.renderValue?.()===!0))return;if(t){e.value.classList.remove(`wui-select-placeholder`),e.value.textContent=``;return}e.value.classList.toggle(`wui-select-placeholder`,!n);let r=this._placeholder();e.value.replaceChildren(...n?b(n):r?[r]:[])}_syncTitle(e){let t=this.querySelector(`.wui-select-control`);if(!t)return;let n=e&&!this.hasAttribute(`title`)?y(e).trim():``;n?t.setAttribute(`title`,n):t.removeAttribute(`title`)}_syncValueAvatar(){let e=this.querySelector(`.wui-select-control`);if(!e)return;e.querySelector(`:scope > .wui-select-value-avatar`)?.remove();let n=!H(this.mode)&&this._hasValue()?t({avatar:this.getAttribute(`value-avatar`),initials:this.getAttribute(`value-initials`)},`avatar-xs`):null;e.classList.toggle(`wui-has-value-avatar`,!!n),n&&e.prepend(i(`span`,{class:`wui-select-value-avatar`,"aria-hidden":`true`},n))}_syncValidity(){let e=this._internals;if(typeof e?.setValidity==`function`){if(this.hasAttribute(`required`)&&!this._hasValue()){let t=this.querySelector(`.wui-select-control`);e.setValidity({valueMissing:!0},Se().requiredFieldMessage,t instanceof HTMLElement?t:void 0)}else e.setValidity({})}}_syncReset(){let e=Q(this,`.wui-select-reset`,HTMLElement);e&&(e.hidden=!(this.hasAttribute(`clearable`)&&this._hasValue()&&!s(this)))}_syncUnderline(){this.querySelector(`.wui-select-control`)?.classList.toggle(`wui-input-underline`,this.classList.contains(`wui-input-underline`))}_syncInvalid(){let e=this.querySelector(`.wui-select-control`);e&&(this.hasAttribute(`aria-invalid`)||this._error?e.setAttribute(`aria-invalid`,`true`):e.removeAttribute(`aria-invalid`))}_syncError(){let e=Q(this,`.wui-select-error`,HTMLElement);e&&(e.textContent=this._error,e.hidden=!this._error),this._syncInvalid()}_refs(){return{control:Q(this,`.wui-select-control`,HTMLElement),value:Q(this,`.wui-select-value`,HTMLElement),menu:Q(this,`.wui-select-menu`,HTMLElement),list:Q(this,`.wui-select-options`,HTMLElement),search:Q(this,`.wui-select-search input`,HTMLInputElement),input:Q(this,`.wui-select-draft`,HTMLInputElement)}}_menuOpen(){let e=Q(this,`.wui-select-menu`,HTMLElement);return e!==null&&_(e)}_hoverZone(e){if(!(e instanceof Element))return!1;let t=e.closest(`.wui-select-control, .wui-select-menu`);return t!==null&&this.contains(t)}_hoverEligible(){if(!this.hasAttribute(`open-on-hover`)||s(this)||this.mode===`tag`)return!1;let e=this._refs();return e.search===null&&e.input===null}_clearHover(){this._hoverTimer!==null&&clearTimeout(this._hoverTimer),this._hoverTimer=null}_autoSearch(){return this.mode===`single`&&this.getAttribute(`searchable`)===null&&this._readOptions().length>ke}_visible(){let e=this._refs();return e.list?Re(e.list,`.wui-select-option`):[]}_rowCount(){return this._windowed?this._rows:this._visible().length}_rowEl(e){if(!this._windowed)return this._visible()[e];let t=this._refs().list?.querySelector(`[data-index="${e}"]`);return t instanceof HTMLElement?t:void 0}_setActive(e,{reveal:t=!0}={}){let n=this._refs();if(!n.list||!n.control)return;this._active=e;let r=null;e>=0&&e<this._rowCount()&&(r=this._rowEl(e)??(this._windowed&&t?ee(n.list,e):null)),p(n.list,r),r?(t&&r.scrollIntoView({block:`nearest`}),n.control.setAttribute(`aria-activedescendant`,r.id)):n.control.removeAttribute(`aria-activedescendant`)}_onListScroll(){this._scrollFrame=null;let e=this._refs().list;e&&B(e)&&this._active>=0&&this._setActive(this._active,{reveal:!1})}_actionRows(){let e=[];for(let t of this._activePartsList()){let n=t.actionRow?.(this._query);n&&e.push(n)}return e}_recents(){if(this._query.trim()!==``)return null;for(let e of this._activePartsList()){let t=e.recents?.(this._listOptions());if(t)return t}return null}_menuPlacement(e,t){let n=this.hasAttribute(`open`)?{below:!0}:{};if(this.getAttribute(`density`)!==`compact`)return{matchWidth:!0,...n};let r=e.getBoundingClientRect();return t.style.width=`max-content`,t.style.minWidth=`${r.width}px`,t.style.maxWidth=`280px`,n}_anchorMenu(){let t=this._refs();t.control&&t.menu&&this._menuOpen()&&e(t.control,t.menu,this._menuPlacement(t.control,t.menu))}_showMenu(e,t){g(e,t,{...this._menuPlacement(e,t),mode:`auto`,keepOffscreen:this.hasAttribute(`open`),onClosed:()=>this._onPanelClosed()}),this._panelShown=!0}_onPanelClosed(){if(!this._panelShown)return;this._panelShown=!1;let e=this._refs();e.control&&(e.control.setAttribute(`aria-expanded`,`false`),this._setActive(-1),this._nav?.clearTypeahead(),this.dispatchEvent(new CustomEvent(`wui-select:close`,{bubbles:!0})))}_open({focus:e=!0}={}){let t=this._refs();if(!t.menu||!t.control)return;let n=this._menuOpen();this._hoverOpened=!1,t.control.setAttribute(`aria-expanded`,`true`),this._query=t.input?t.input.value:``,this._ownsFilter=this._ownsFilter&&this._query!==``;let r=Q(this,`.wui-select-search .wui-select-clear`,HTMLElement);if(r&&(r.hidden=!0),t.search&&(t.search.value=``),n||this._showMenu(t.control,t.menu),this.renderList(),e&&(t.search?.focus(),this._setActive(this._windowed&&t.list?te(t.list,this._selectedValues()):this._visible().findIndex(e=>e.classList.contains(`selected`)))),!n){this.dispatchEvent(new CustomEvent(`wui-select:open`,{bubbles:!0}));for(let e of this._activePartsList())e.onOpen?.()}}_close({force:e=!1}={}){if(!e&&this.hasAttribute(`open`))return;let t=this._refs();if(!t.menu||!t.control)return;this._hoverOpened=!1;let n=t.menu.contains(document.activeElement);_(t.menu)&&h(t.menu),this._onPanelClosed(),n&&t.control.focus()}_onQueryChange(e){this._query=e,this._setActive(-1);let t=Q(this,`.wui-select-search .wui-select-clear`,HTMLElement);t&&(t.hidden=!e);let n=!1;for(let t of this._activePartsList())t.onQuery?.(e)===!0&&(n=!0);this._ownsFilter=n,this.renderList()}_pick(e){if(e.getAttribute(`aria-disabled`)===`true`)return;let t=e.dataset.custom===`true`,n=e.dataset.value??``,r=t?{value:n,label:$(e).trim()}:this._listOptions().find(e=>String(e.value)===n)??{value:n,label:n},i=this._activePartsList().some(e=>e.onPick?.(r,{isCustom:t})===!0);H(this.mode)||(i||this.commit(n,{isCustom:t}),this._close(),this._refs().control?.focus())}_draftOpens(){return this.mode===`multiple`?this.hasAttribute(`allow-custom`):this.mode===`tag`&&U(this)}_onKeyDown(e){if(!s(this)){for(let t of this._activePartsList())if(t.onKey?.(e)===!0)return;if(!this._menuOpen()){if(e.target instanceof HTMLInputElement){if(e.key!==`ArrowDown`||!this._draftOpens())return;this._open({focus:!1})}else{(e.key===`ArrowDown`||f(e)||e.key===` `)&&(e.preventDefault(),this._open({focus:!0}));return}}r(this._nav,`Listbox keys are not wired.`).handler(e)}}_wire(){this._teardown();let e=this._refs(),t=e.control,n=e.list;if(!t||!e.menu||!n)return;let i=r(Q(this,`.wui-select`,HTMLElement),`The select wrapper is missing.`),a=Q(this,`.wui-select-search .wui-select-clear`,HTMLElement),o=Q(this,`.wui-select-reset`,HTMLElement);this._nav=m({getVisibleOptions:()=>this._visible(),getActive:()=>this._active,setActive:e=>this._setActive(e),getCount:()=>this._rowCount(),getOptionAt:e=>this._rowEl(e),findByPrefix:e=>this._windowed?ne(n,e):this._visible().findIndex(t=>t.textContent.trim().toLowerCase().startsWith(e)),onEnter:(e,t)=>{if(e)this._pick(e);else if(this._query.trim()!==``){let e=t.find(e=>e.dataset.custom===`true`);if(e)this._pick(e);else if(t.length===1){let e=t[0];e&&this._pick(e)}}},onEscape:e=>{e.preventDefault(),this._nav?.clearTypeahead(),this._close(),t.focus()}}),i.addEventListener(`keydown`,e=>this._onKeyDown(e)),i.addEventListener(`input`,e=>{let t=e.target;if(!(t instanceof HTMLInputElement)||!t.matches(`.wui-select-input, .wui-select-draft`))return;this._onQueryChange(t.value);let n=t.matches(`.wui-select-draft`),r=this._rows>0||this._actionRows().length>0;n&&r&&!this._menuOpen()&&!s(this)&&this._draftOpens()&&this._open({focus:!1})}),i.addEventListener(`focusout`,e=>{let t=e.relatedTarget;t instanceof Node&&this.contains(t)||!this._activePartsList().some(e=>e.onBlur?.()===!0)&&t&&this._close()}),a?.addEventListener(`click`,()=>{let t=r(e.search,`The search input is missing.`);t.value=``,this._onQueryChange(``),t.focus()}),t.addEventListener(`pointerdown`,()=>{this._pressOpen=this._menuOpen()}),t.addEventListener(`click`,e=>{if(e.target instanceof Element&&e.target.closest(`[data-remove]`))return;if(this.mode===`tag`){if(s(this))return;this._refs().input?.focus(),!this._menuOpen()&&this._draftOpens()&&this._open({focus:!1});return}if(e.target instanceof HTMLInputElement){!this._menuOpen()&&!s(this)&&this._open({focus:!1});return}let t=e.detail>0&&this._pressOpen!==null?this._pressOpen:this._menuOpen();this._pressOpen=null,this._clearHover(),this._hoverOpened&&t?(this._hoverOpened=!1,this._open({focus:!0})):t?this._close():s(this)||this._open({focus:!0})}),o?.addEventListener(`click`,e=>{e.stopPropagation(),this.commit(H(this.mode)?[]:``),this._close(),t.focus()}),n.addEventListener(`click`,n=>{let r=Le(n).closest(`.wui-select-option`);if(r instanceof HTMLElement&&(this._pick(r),H(this.mode))){let n=this.querySelector(`.wui-select-draft`);(e.search??(n instanceof HTMLElement?n:t)).focus()}}),n.addEventListener(`mousedown`,e=>{H(this.mode)&&e.target instanceof Element&&e.target.closest(`.wui-select-option`)&&e.preventDefault()}),n.addEventListener(`mousemove`,e=>{let t=Le(e).closest(`.wui-select-option`);t instanceof HTMLElement&&!t.classList.contains(`is-active`)&&this._setActive(this._windowed?Number(t.dataset.index):this._visible().indexOf(t),{reveal:!1})}),n.addEventListener(`scroll`,()=>{this._windowed&&this._scrollFrame===null&&(this._scrollFrame=requestAnimationFrame(()=>this._onListScroll()))},{passive:!0}),n.addEventListener(`mouseleave`,()=>this._setActive(-1)),n.addEventListener(`error`,e=>{let t=e.target;t instanceof Element&&t.classList.contains(`avatar-img`)&&t.remove()},!0),this.hasAttribute(`open`)&&this._open({focus:!1})}_teardown(){this._nav?.clearTypeahead(),this._scrollFrame!==null&&cancelAnimationFrame(this._scrollFrame),this._scrollFrame=null}_dropMenu(){let e=Q(this,`.wui-select-menu`,HTMLElement);e&&h(e)}_activePartsList(){return this._partsMounted?r(this._parts,`The mounted parts are missing.`):[]}_ensureParts(){if(!this.isConnected)return;(this.hasAttribute(`source`)||this.hasAttribute(`remote`)||this.hasAttribute(`recents-key`)||this._loadOptionsFn!==null)&&this._loadWindow();let e=Fe(this,this.mode),t=e.join(`,`);if(t===this._partSig)return;this._teardownParts(),this._parts=null,this._partSig=t;let n=++this._partToken;Promise.all(e.map(e=>ze(this,e))).then(e=>{n===this._partToken&&(this._parts=e.filter(e=>e!==null),this._mountParts())})}_loadWindow(){this._windowLoad===null&&(this._windowLoad=be().then(()=>this.renderList(),()=>{this._windowFailed=!0,document.dispatchEvent(new CustomEvent(u,{bubbles:!0,composed:!0,detail:{chunk:`select-window`}})),this.setError(X().partLoadMessage)}))}_mountParts(e={draft:``,query:``}){if(!this._parts||this._partsMounted||!this._rendered||!this.isConnected)return;this._partsMounted=!0;let t=we(this._refs());for(let n of this._parts)n.mount(this,t,{carry:e});this._drawValue(),this.renderList()}_teardownParts(){let e=this._activePartsList();this._partsMounted=!1;for(let t of e)t.teardown()}_remountParts(){if(!this._partsMounted)return;let e=this._carry();this._teardownParts(),this._mountParts(e)}_carry(){let e=this._refs();return{draft:e.input?.value??``,query:e.search?.value??``}}},we=e=>{let{control:t,value:n,menu:i,list:a}=e;return{control:r(t,`control missing`),value:r(n,`value missing`),menu:r(i,`menu missing`),list:r(a,`list missing`),search:e.search,input:e.input}},Te=e=>re.includes(e),Ee=[`comfortable`,`compact`],De=150,Oe=250,ke=10,Ae=()=>{let e=X();return{single:e.placeholder,search:e.placeholder,multiple:e.placeholder,tag:e.tagPlaceholder,country:e.countryPlaceholder}},je=/* @__PURE__ */ new Set([`countries`,`suggested`,`suggested-label`,`all-countries-label`,`max-tags`,`pattern`,`collapse-chips`,`source`,`remote`,`min-chars`]),Me=/* @__PURE__ */ new Set([`separators`,`allow-duplicates`,`invalid-message`,`create-label`,`add-label`,`selected-text`,`clear-all-label`,`value-label`,`value-avatar`,`value-initials`,`hint-text`,`recents-key`,`recents-limit`,`recents-label`]),Ne=[[`icon`,`icon`],[`description`,`description`],[`meta`,`meta`],[`group`,`group`],[`avatar`,`avatar`],[`initials`,`initials`],[`disabled-hint`,`disabledHint`]],Z=(e,t)=>t?Array.isArray(e)?e.map(String):e==null||e===``?[]:String(e).split(`,`).map(e=>e.trim()).filter(Boolean):Array.isArray(e)?e.length?String(e[0]):``:e==null?``:String(e),Pe=(e,t)=>t===`multiple`?U(e)?[`chips`,`search`]:[`chips`]:t===`search`?[`search`]:t===`country`?[`country`]:t===`tag`?U(e)?[`chips`,`search`]:[`chips`]:[],Fe=(e,t)=>e.hasAttribute(`recents-key`)?[`recents`,...Pe(e,t)]:Pe(e,t),Ie=e=>typeof e==`object`&&!!e&&`default`in e&&typeof e.default==`function`,Le=e=>{if(e.target instanceof Element)return e.target;throw Error(`The event target is not an element.`)},Q=(e,t,n)=>{let r=e.querySelector(t);return r instanceof n?r:null},Re=(e,t)=>[...e.querySelectorAll(t)].filter(e=>e instanceof HTMLElement),$=e=>{let t=e.textContent;if(t===null)throw Error(`The element has no text.`);return t},ze=(e,t)=>ae(t).then(e=>{if(!Ie(e))throw Error(`The part ${t} has no default export.`);return e.default()}).catch(()=>(document.dispatchEvent(new CustomEvent(u,{bubbles:!0,composed:!0,detail:{chunk:t}})),e.setError(X().partLoadMessage),null));export{U as n,A as r,Ce as t};
@@ -1 +0,0 @@
1
- import{n as e}from"./devWarn-DXdRWZs3.js";import{n as t}from"./optionLabel-wbpl8OTJ.js";import{r as n}from"./textStore-DBplASiZ.js";import{r}from"./search.g-B5d1s59A.js";import{t as i}from"./customRule-BpwcjVLb.js";import{n as a}from"./WuiSelect-B0CT2utp.js";var o=()=>n(`select`,r),s=(e,n)=>{let r=n.toLowerCase(),i=e.getAttribute(`value-label`);return i&&String(e.value??``)!==``&&i.toLowerCase()===r?!0:e.options.some(e=>t(e).toLowerCase()===r||String(e.value??``).toLowerCase()===r)},c=e=>{if(e.querySelector(`.wui-select-spacer`))return null;let t=[...e.querySelectorAll(`.wui-select-option`)].filter(e=>e.dataset.custom!==`true`&&e.getAttribute(`aria-disabled`)!==`true`);return t.length===1?t[0]?.dataset.value??null:null};function l(){let t,n,r=0,l,u=null,d=null,f=``,p=null,m=!1,h=()=>a(t),g=()=>typeof t.loadOptions!=`function`&&!t.getAttribute(`source`),_=(e,n,r)=>{let i=t.getAttribute(e);if(i==null||i.trim()===``)return n;let a=Number(i);return r(a)?a:n},v=()=>_(`min-chars`,1,e=>Number.isInteger(e)&&e>=0),y=()=>_(`debounce`,250,e=>Number.isFinite(e)&&e>=0),b=()=>{u?.abort(),u=null};function x(e,n){if(typeof t.loadOptions==`function`)return t.loadOptions(e,{signal:n});let r=t.getAttribute(`source`);if(r===null)throw Error(`search source attribute missing`);let i=`${r}${r.includes(`?`)?`&`:`?`}q=${encodeURIComponent(e)}`;return fetch(i,{signal:n,credentials:`same-origin`,headers:{Accept:`application/json`}}).then(e=>{if(!e.ok)throw Error(`search request failed with status ${e.status}`);return e.json()})}function S(n,r,i){r?(e(`wui-select: search failed`,i),t.setPartOptions([]),t.setStatus(`empty`)):(t.setPartOptions(n),t.setStatus(n.length?`idle`:`empty`))}async function C(e,t,n){let i=[],a=!1,o=null;try{if(i=await x(e,n),!Array.isArray(i))throw TypeError(`search results must be an array`)}catch(e){a=!0,o=e??/* @__PURE__ */ Error(`search failed`)}finally{t===r&&(u=null,S(i,a,o))}}function w(e){let n=r;b(),g()?(m=!0,t.setStatus(`loading`)):(u=new AbortController,t.setStatus(`loading`),C(e,n,u.signal))}let T=(e,n)=>t.dispatchEvent(new CustomEvent(`search`,{bubbles:!0,detail:{query:e,seq:n}}));function E(e){r+=1,b(),clearTimeout(l),l=void 0,e.trim().length<v()?(t.setPartOptions([]),t.setStatus(`hint`)):(T(e,r),w(e))}return{mount(e,r,i={}){t=e,n=r;let a=n.search?.value??``;n.search&&i.carry?.query&&a===``&&(n.search.value=i.carry.query),a.trim()!==``&&t._onQueryChange(a)},onQuery(e){if(r+=1,b(),clearTimeout(l),l=void 0,f=e,p=null,m=!1,!h())return!1;if(e.trim().length<v())return t.setPartOptions([]),t.setStatus(`hint`),!0;let n=r;return l=setTimeout(()=>{l=void 0,T(e,n),w(e)},y()),!0},onOpen(){if(h()){if(p!==null){let e=p;p=null,E(e)}else v()===0&&t._query.trim()===``&&E(``)}},onOptions(){m&&(m=!1,t.setStatus(t.options.length?`idle`:`empty`))},onBlur(){if(t.mode!==`search`)return!1;let e=(n.search?.value??``).trim();if(!e||e===String(t.value))return!1;if(t.hasAttribute(`allow-custom`)&&!s(t,e)){let n=i(t,e);return n?(t.setError(n),!1):(t.commit(e,{isCustom:!0}),!0)}let r=c(n.list);return r===null||r===String(t.value)?!1:(t.commit(r,{isCustom:!1}),t.closeMenu(),!0)},actionRow(e){if(d=null,t.mode!==`search`||!t.hasAttribute(`allow-custom`))return null;let n=e.trim();return!n||s(t,n)?null:(d={position:`bottom`,label:(t.getAttribute(`add-label`)??o().addLabel).replaceAll(`{query}`,n),value:n},d)},onPick(e){if(!d||e.value!==d.value||e.label!==d.label)return!1;let n=d.value;return d=null,t.commit(n,{isCustom:!0}),!0},renderValue(){let e=t.value;if(t.mode!==`search`||!e||t.options.some(t=>String(t.value)===String(e)))return!1;let r=t.getAttribute(`value-label`);return r?(n.value.classList.remove(`wui-select-placeholder`),n.value.textContent=r,!0):!1},teardown(){(l!==void 0||u!==null||m)&&(p=f),m=!1,r+=1,clearTimeout(l),l=void 0,b(),d=null}}}export{l as default};
@@ -1 +0,0 @@
1
- var e={addLabel:`Add '{query}'`,addTagsLabel:`Add tags`,allCountriesLabel:`All countries`,clearAllLabel:`Clear all`,clearSelectionLabel:`Clear selection`,countryPlaceholder:`Select country`,countrySearchPlaceholder:`Search countries…`,createLabel:`Create '{text}'`,defaultSearchPlaceholder:`Search {labelText}…`,emptyText:`No matches`,fallbackName:`Select`,helpLabel:`More information`,hintText:`Type to search…`,invalidMessage:`That option is not available.`,optionalLabel:`(optional)`,partLoadMessage:`This control could not load. Reload the page.`,placeholder:`Select…`,recentsLabel:`Recent`,removeText:`Remove {text}`,searchingText:`Searching…`,selectedText:`{count} selected`,suggestedLabel:`Suggested`,tagPlaceholder:`Add…`},t={requiredFieldMessage:`Please fill in this field.`},n={clearLabel:`Clear search`,placeholder:`Search…`,searchLabel:`Search`};export{t as n,e as r,n as t};