@webority/ui-elements 0.199.1 → 0.201.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 (217) hide show
  1. package/README.md +4 -3
  2. package/dist/{WuiCarousel-UTqrn7Nx.js → WuiCarousel-CHgYsQLy.js} +1 -1
  3. package/dist/{WuiCodeBlock-BnRpTBm_.js → WuiCodeBlock-DjNv0Jzb.js} +1 -1
  4. package/dist/{WuiCommandPalette-BSWDxEPw.js → WuiCommandPalette-18xqK2S3.js} +1 -1
  5. package/dist/{WuiCommentThread-BXd-Z7z1.js → WuiCommentThread-KZ3bibV8.js} +1 -1
  6. package/dist/{WuiConsentBanner-B8D2lE8q.js → WuiConsentBanner-DhFgz2Mn.js} +1 -1
  7. package/dist/{WuiDashboardGrid-5rXZvTsm.js → WuiDashboardGrid-Cr3qsN_T.js} +1 -1
  8. package/dist/{WuiDataTable-D_9TWU-r.js → WuiDataTable-08HFWRjn.js} +1 -1
  9. package/dist/WuiDatePicker-_S1KRPAW.js +1 -0
  10. package/dist/WuiDateRange-tlkzGlT4.js +1 -0
  11. package/dist/WuiDateTime-BM_hQc8Y.js +1 -0
  12. package/dist/{WuiDrawer-RmT2Wp9d.js → WuiDrawer-BSFyJN4i.js} +1 -1
  13. package/dist/{WuiGantt-B70jg1w5.js → WuiGantt-DThIgEVR.js} +1 -1
  14. package/dist/{WuiImageCrop-Cl97BHN4.js → WuiImageCrop-CPBoKzox.js} +1 -1
  15. package/dist/WuiInlineEdit-BKjUqAFD.js +1 -0
  16. package/dist/{WuiLeadPopup-tkt78XlW.js → WuiLeadPopup-CdGXuUdh.js} +1 -1
  17. package/dist/WuiLightbox-BbBHUwEH.js +1 -0
  18. package/dist/WuiMentionInput-CLf66bZv.js +1 -0
  19. package/dist/{WuiNotificationCenter-BSXqhz9M.js → WuiNotificationCenter-63IkQgw7.js} +1 -1
  20. package/dist/{WuiOrgTree-Be7gK2ls.js → WuiOrgTree-CTcLLmFi.js} +1 -1
  21. package/dist/{WuiOverflow-DCNivxjH.js → WuiOverflow-Czk6Er81.js} +1 -1
  22. package/dist/{WuiPhone-D7yYYLYr.js → WuiPhone-CdpOXNyu.js} +1 -1
  23. package/dist/{WuiRecordPager-DLO5IWE9.js → WuiRecordPager-ByLruWFG.js} +1 -1
  24. package/dist/{WuiRelativeTime-BGeb8bNG.js → WuiRelativeTime-3cYKtfSP.js} +1 -1
  25. package/dist/{WuiSavedViews-NAZArw5y.js → WuiSavedViews-CQjUtOHV.js} +1 -1
  26. package/dist/{WuiSelect-DALTYOKl.js → WuiSelect-Cbr_4yCe.js} +1 -1
  27. package/dist/{WuiShortcuts-Z8X5aSTz.js → WuiShortcuts-BdMGawiV.js} +1 -1
  28. package/dist/{WuiShowMore-B73_umah.js → WuiShowMore-CG1offsP.js} +1 -1
  29. package/dist/{WuiSlider-BjzqYCFt.js → WuiSlider-DuPqp8Ru.js} +1 -1
  30. package/dist/{WuiSortable-DjhJiH0o.js → WuiSortable-6HHTncRn.js} +1 -1
  31. package/dist/{WuiTimePicker-D0cM0pPe.js → WuiTimePicker-C6KHFFOx.js} +1 -1
  32. package/dist/{WuiTour-b7N5FTLM.js → WuiTour-CWy-OMxR.js} +1 -1
  33. package/dist/{WuiTree-Qno7SM6z.js → WuiTree-BsT2thnb.js} +1 -1
  34. package/dist/{WuiTreePicker-DWCLntLz.js → WuiTreePicker-D4Ep2n3T.js} +1 -1
  35. package/dist/{WuiWizardStep-D1Ea6_9L.js → WuiWizardStep-CPGBX4U8.js} +1 -1
  36. package/dist/{calendarMath-CeawKuZQ.js → calendarMath-D8B0i3XW.js} +1 -1
  37. package/dist/{chips-BzSOOCI-.js → chips-BMNFRLY4.js} +1 -1
  38. package/dist/{country-CX7Ok3Md.js → country-COqU5UPA.js} +1 -1
  39. package/dist/{customRule-vAOiOqYH.js → customRule-CYqAWNFg.js} +1 -1
  40. package/dist/{dataTable-D48Rwq1a.js → dataTable-CSP1x4ZA.js} +1 -1
  41. package/dist/{drawerDiscard-mFYviRfI.js → drawerDiscard-DO4bmfVZ.js} +1 -1
  42. package/dist/elements/carousel.js +1 -1
  43. package/dist/elements/code-block.js +1 -1
  44. package/dist/elements/command-palette.js +1 -1
  45. package/dist/elements/comment-thread.js +1 -1
  46. package/dist/elements/consent-banner.js +1 -1
  47. package/dist/elements/dashboard-grid.js +1 -1
  48. package/dist/elements/data-table.js +1 -1
  49. package/dist/elements/date-range.js +1 -1
  50. package/dist/elements/date-time.js +1 -1
  51. package/dist/elements/datepicker.js +1 -1
  52. package/dist/elements/drawer.js +1 -1
  53. package/dist/elements/filter-popover.js +1 -1
  54. package/dist/elements/gantt.js +1 -1
  55. package/dist/elements/image-crop.js +1 -1
  56. package/dist/elements/inline-edit.js +1 -1
  57. package/dist/elements/kanban.js +1 -1
  58. package/dist/elements/lead-popup.js +1 -1
  59. package/dist/elements/lightbox.js +1 -1
  60. package/dist/elements/mention-input.js +1 -1
  61. package/dist/elements/notification-center.js +1 -1
  62. package/dist/elements/org-tree.js +1 -1
  63. package/dist/elements/overflow.js +1 -1
  64. package/dist/elements/phone.js +1 -1
  65. package/dist/elements/record-pager.js +1 -1
  66. package/dist/elements/relative-time.js +1 -1
  67. package/dist/elements/saved-views.js +1 -1
  68. package/dist/elements/select.js +1 -1
  69. package/dist/elements/shortcuts.js +1 -1
  70. package/dist/elements/show-more.js +1 -1
  71. package/dist/elements/slider.js +1 -1
  72. package/dist/elements/sortable.js +1 -1
  73. package/dist/elements/timepicker.js +1 -1
  74. package/dist/elements/tour.js +1 -1
  75. package/dist/elements/tree-picker.js +1 -1
  76. package/dist/elements/tree.js +1 -1
  77. package/dist/elements/wizard.js +1 -1
  78. package/dist/{filterPopover-IndnqT7G.js → filterPopover-Cv9IsBG3.js} +1 -1
  79. package/dist/formatters-lNUhNemK.js +1 -0
  80. package/dist/helpers.js +1 -1
  81. package/dist/{initials-DKg3IeUa.js → initials-CYUX7uHC.js} +1 -1
  82. package/dist/inlineEditText-BjHkrr4q.js +1 -0
  83. package/dist/kanban-C_u1_ctX.js +1 -0
  84. package/dist/{kanbanModel-BQWAC9vs.js → kanbanModel-zqkEKM2x.js} +1 -1
  85. package/dist/{loader-sSdQNOg6.js → loader-AIIVAlsd.js} +1 -1
  86. package/dist/notificationDays-CO6i0_h3.js +1 -0
  87. package/dist/{recents-DTddcnaM.js → recents-C_0aUCxK.js} +1 -1
  88. package/dist/refreshAfter-C2bqZfb9.js +1 -0
  89. package/dist/relativeTime-CBiAE0E5.js +1 -0
  90. package/dist/{search-Is-q8GR6.js → search-DenTt9we.js} +1 -1
  91. package/dist/server.js +1 -1
  92. package/dist/{shortcutKeys-CoZBxKsS.js → shortcutKeys-DO6ZWyN6.js} +1 -1
  93. package/dist/{tableSelect-B2lLTEj1.js → tableSelect-BrQSoqzs.js} +1 -1
  94. package/dist/text.js +1 -1
  95. package/dist/textStore-Cs1SGBoI.js +1 -0
  96. package/dist/{themeTransition-DowOV08f.js → themeTransition-DBd5lF43.js} +1 -1
  97. package/dist/ui-calendar.global.js +1 -1
  98. package/dist/ui-calendar.js +1 -1
  99. package/dist/ui-chart.global.js +15 -15
  100. package/dist/ui-chart.js +15 -15
  101. package/dist/ui-elements/calendar-views.global.js +1 -1
  102. package/dist/ui-elements/carousel.global.js +1 -1
  103. package/dist/ui-elements/code-block.global.js +1 -1
  104. package/dist/ui-elements/command-palette.global.js +1 -1
  105. package/dist/ui-elements/comment-thread.global.js +1 -1
  106. package/dist/ui-elements/consent-banner.global.js +1 -1
  107. package/dist/ui-elements/context-menu.global.js +1 -1
  108. package/dist/ui-elements/dashboard-grid.global.js +1 -1
  109. package/dist/ui-elements/data-table.global.js +1 -1
  110. package/dist/ui-elements/date-range.global.js +1 -1
  111. package/dist/ui-elements/date-time.global.js +1 -1
  112. package/dist/ui-elements/datepicker.global.js +1 -1
  113. package/dist/ui-elements/dock.global.js +1 -1
  114. package/dist/ui-elements/drawer.global.js +1 -1
  115. package/dist/ui-elements/dropdown.global.js +1 -1
  116. package/dist/ui-elements/entry-grid.global.js +1 -1
  117. package/dist/ui-elements/gantt.global.js +1 -1
  118. package/dist/ui-elements/glyphs-a.global.js +1 -1
  119. package/dist/ui-elements/glyphs-b.global.js +1 -1
  120. package/dist/ui-elements/glyphs-c.global.js +1 -1
  121. package/dist/ui-elements/glyphs-d.global.js +1 -1
  122. package/dist/ui-elements/glyphs-e.global.js +1 -1
  123. package/dist/ui-elements/glyphs-f.global.js +1 -1
  124. package/dist/ui-elements/glyphs-g.global.js +1 -1
  125. package/dist/ui-elements/glyphs-h.global.js +1 -1
  126. package/dist/ui-elements/glyphs-i.global.js +1 -1
  127. package/dist/ui-elements/glyphs-j.global.js +1 -1
  128. package/dist/ui-elements/glyphs-k.global.js +1 -1
  129. package/dist/ui-elements/glyphs-l.global.js +1 -1
  130. package/dist/ui-elements/glyphs-m.global.js +1 -1
  131. package/dist/ui-elements/glyphs-n.global.js +1 -1
  132. package/dist/ui-elements/glyphs-o.global.js +1 -1
  133. package/dist/ui-elements/glyphs-p.global.js +1 -1
  134. package/dist/ui-elements/glyphs-q.global.js +1 -1
  135. package/dist/ui-elements/glyphs-r.global.js +1 -1
  136. package/dist/ui-elements/glyphs-s.global.js +1 -1
  137. package/dist/ui-elements/glyphs-t.global.js +1 -1
  138. package/dist/ui-elements/glyphs-u.global.js +1 -1
  139. package/dist/ui-elements/glyphs-v.global.js +1 -1
  140. package/dist/ui-elements/glyphs-w.global.js +1 -1
  141. package/dist/ui-elements/glyphs-x.global.js +1 -1
  142. package/dist/ui-elements/glyphs-z.global.js +1 -1
  143. package/dist/ui-elements/glyphs.global.js +1 -1
  144. package/dist/ui-elements/hover-card.global.js +1 -1
  145. package/dist/ui-elements/image-crop.global.js +1 -1
  146. package/dist/ui-elements/inline-edit.global.js +1 -1
  147. package/dist/ui-elements/kanban.global.js +1 -1
  148. package/dist/ui-elements/lead-popup.global.js +1 -1
  149. package/dist/ui-elements/lightbox.global.js +1 -1
  150. package/dist/ui-elements/markdown.global.js +1 -1
  151. package/dist/ui-elements/mini-calendar.global.js +1 -1
  152. package/dist/ui-elements/navigation-menu.global.js +1 -1
  153. package/dist/ui-elements/notification-center.global.js +1 -1
  154. package/dist/ui-elements/offline-banner.global.js +1 -1
  155. package/dist/ui-elements/onboarding-checklist.global.js +1 -1
  156. package/dist/ui-elements/org-tree.global.js +1 -1
  157. package/dist/ui-elements/otp.global.js +1 -1
  158. package/dist/ui-elements/overflow.global.js +1 -1
  159. package/dist/ui-elements/phone.global.js +1 -1
  160. package/dist/ui-elements/popover.global.js +1 -1
  161. package/dist/ui-elements/rating.global.js +1 -1
  162. package/dist/ui-elements/record-pager.global.js +1 -1
  163. package/dist/ui-elements/relative-time.global.js +1 -1
  164. package/dist/ui-elements/saved-views.global.js +1 -1
  165. package/dist/ui-elements/select-chips.global.js +1 -1
  166. package/dist/ui-elements/select-recents.global.js +1 -1
  167. package/dist/ui-elements/select-search.global.js +1 -1
  168. package/dist/ui-elements/select-window.global.js +1 -1
  169. package/dist/ui-elements/server.global.js +1 -1
  170. package/dist/ui-elements/shell.global.js +1 -1
  171. package/dist/ui-elements/shortcuts.global.js +1 -1
  172. package/dist/ui-elements/show-more.global.js +1 -1
  173. package/dist/ui-elements/slider.global.js +1 -1
  174. package/dist/ui-elements/sortable.global.js +1 -1
  175. package/dist/ui-elements/status-icon.global.js +1 -1
  176. package/dist/ui-elements/table-export.global.js +1 -1
  177. package/dist/ui-elements/timepicker.global.js +1 -1
  178. package/dist/ui-elements/tour.global.js +1 -1
  179. package/dist/ui-elements/tree-picker.global.js +1 -1
  180. package/dist/ui-elements/tree.global.js +1 -1
  181. package/dist/ui-elements/truncate.global.js +1 -1
  182. package/dist/ui-elements/whats-new.global.js +1 -1
  183. package/dist/ui-elements/wizard.global.js +1 -1
  184. package/dist/ui-elements.global.js +1 -1
  185. package/dist/ui-elements.js +1 -1
  186. package/dist/{zone-BR02ZkHF.js → zone-CIUYudtC.js} +1 -1
  187. package/dist/zone-VKarLPzU.js +1 -0
  188. package/package.json +5 -5
  189. package/types/WuiChart.d.ts +12 -6
  190. package/types/chart.d.ts +0 -1
  191. package/types/chartAdapter.d.ts +12 -3
  192. package/types/chartSpec.d.ts +2 -2
  193. package/types/global/core.d.ts +2 -3
  194. package/types/global/shared.d.ts +1 -1
  195. package/types/helpers.d.ts +1 -3
  196. package/types/index.d.ts +0 -1
  197. package/types/kanbanModel.d.ts +3 -2
  198. package/types/razor-js/modules/generatedScreens.d.ts +1 -0
  199. package/types/server/regionMorph.d.ts +1 -0
  200. package/types/server/regions.d.ts +1 -0
  201. package/types/zone.d.ts +0 -18
  202. package/dist/WuiDatePicker-BSAqNqdx.js +0 -1
  203. package/dist/WuiDateRange-ffla_FMG.js +0 -1
  204. package/dist/WuiDateTime-NTZCa0dZ.js +0 -1
  205. package/dist/WuiInlineEdit-D0a_5oAM.js +0 -1
  206. package/dist/WuiLightbox-BSEVtv2x.js +0 -1
  207. package/dist/WuiMentionInput-kUTy26hu.js +0 -1
  208. package/dist/formatters-CXMylefd.js +0 -1
  209. package/dist/formatters.g-BNAu1PMe.js +0 -1
  210. package/dist/inlineEditText-B35MKEul.js +0 -1
  211. package/dist/kanban-BkovNHsk.js +0 -1
  212. package/dist/notificationDays-CZxUShyr.js +0 -1
  213. package/dist/refreshAfter-DhYgWXmQ.js +0 -1
  214. package/dist/relativeTime-wpijOw5j.js +0 -1
  215. package/dist/textStore-Dh5iyZSR.js +0 -1
  216. package/types/currency.d.ts +0 -6
  217. package/types/formatters.d.ts +0 -138
@@ -1 +1 @@
1
- import{n as e}from"./elementBase-Cxeyx0tU.js";import{n as ee}from"./filterPopover-IndnqT7G.js";import{t}from"./kanban-BkovNHsk.js";import{n}from"./statusIcons-DISKRFbg.js";import{t as r}from"./WuiCalendarViews-Dg9yRY1I.js";import{t as i}from"./WuiCarousel-UTqrn7Nx.js";import{t as te}from"./WuiCodeBlock-BnRpTBm_.js";import{t as a}from"./WuiCommandPalette-BSWDxEPw.js";import{t as o}from"./WuiCommentThread-BXd-Z7z1.js";import{t as s}from"./WuiConsentBanner-B8D2lE8q.js";import{t as c}from"./WuiContextMenu-CEJS12YY.js";import{r as l}from"./WuiDashboardGrid-5rXZvTsm.js";import{t as u}from"./WuiDataTable-D_9TWU-r.js";import{t as d}from"./WuiDatePicker-BSAqNqdx.js";import{t as f}from"./WuiDateRange-ffla_FMG.js";import{t as p}from"./WuiDateTime-NTZCa0dZ.js";import{t as m}from"./WuiDock-2LGlbEFx.js";import{t as h}from"./WuiDrawer-RmT2Wp9d.js";import{t as g}from"./WuiDropdown-BRofo083.js";import{t as _}from"./WuiEntryGrid-Z69-1YBh.js";import{t as v}from"./WuiGantt-B70jg1w5.js";import{t as y}from"./WuiHoverCard-B_plKt-t.js";import{t as b}from"./WuiImageCrop-Cl97BHN4.js";import{t as x}from"./WuiInlineEdit-D0a_5oAM.js";import{t as S}from"./WuiLeadPopup-tkt78XlW.js";import{t as C}from"./WuiLightbox-BSEVtv2x.js";import{t as w}from"./WuiMarkdown-DRtGPxQX.js";import{r as T}from"./WuiMentionInput-kUTy26hu.js";import{t as E}from"./WuiMiniCalendar-BhUTIGwe.js";import{t as D}from"./WuiModal-LgGTsIpb.js";import{t as O}from"./WuiNavigationMenu-BebcHPiK.js";import{t as k}from"./WuiNotificationCenter-BSXqhz9M.js";import{t as A}from"./WuiOfflineBanner-DGTFCtyM.js";import{t as j}from"./WuiOnboardingChecklist-C-nllg2h.js";import{t as M}from"./WuiOrgTree-Be7gK2ls.js";import{t as N}from"./WuiOtp-Cc0formv.js";import{t as P}from"./WuiOverflow-DCNivxjH.js";import{t as F}from"./WuiPhone-D7yYYLYr.js";import{t as I}from"./WuiPopover-y07DZA1J.js";import{t as L}from"./WuiRating-DIQfif9x.js";import{t as R}from"./WuiRecordPager-DLO5IWE9.js";import{t as z}from"./WuiRelativeTime-BGeb8bNG.js";import{t as B}from"./WuiSavedViews-NAZArw5y.js";import{t as V}from"./WuiSelect-DALTYOKl.js";import{t as H}from"./WuiShortcuts-Z8X5aSTz.js";import{t as U}from"./WuiShowMore-B73_umah.js";import{t as W}from"./WuiSlider-BjzqYCFt.js";import{t as G}from"./WuiSortable-DjhJiH0o.js";import{t as K}from"./WuiTimePicker-D0cM0pPe.js";import{t as q}from"./WuiTour-b7N5FTLM.js";import{t as J}from"./WuiTree-Qno7SM6z.js";import{t as Y}from"./WuiTreePicker-DWCLntLz.js";import{t as X}from"./WuiTruncate-BB4i8wHE.js";import{n as Z,t as ne}from"./WuiWhatsNew-naVvdes5.js";import{n as Q,t as $}from"./WuiWizardStep-D1Ea6_9L.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-CXMylefd.js";import{_ as ue,r as de}from"./themeTransition-DowOV08f.js";import{t as fe}from"./drawerDiscard-mFYviRfI.js";import{n as pe}from"./shortcutKeys-CoZBxKsS.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-Cv9IsBG3.js";import{t}from"./kanban-C_u1_ctX.js";import{n}from"./statusIcons-DISKRFbg.js";import{t as r}from"./WuiCalendarViews-Dg9yRY1I.js";import{t as i}from"./WuiCarousel-CHgYsQLy.js";import{t as a}from"./WuiCodeBlock-DjNv0Jzb.js";import{t as o}from"./WuiCommandPalette-18xqK2S3.js";import{t as s}from"./WuiCommentThread-KZ3bibV8.js";import{t as c}from"./WuiConsentBanner-DhFgz2Mn.js";import{t as l}from"./WuiContextMenu-CEJS12YY.js";import{r as u}from"./WuiDashboardGrid-Cr3qsN_T.js";import{t as d}from"./WuiDataTable-08HFWRjn.js";import{t as f}from"./WuiDatePicker-_S1KRPAW.js";import{t as p}from"./WuiDateRange-tlkzGlT4.js";import{t as m}from"./WuiDateTime-BM_hQc8Y.js";import{t as h}from"./WuiDock-2LGlbEFx.js";import{t as g}from"./WuiDrawer-BSFyJN4i.js";import{t as _}from"./WuiDropdown-BRofo083.js";import{t as v}from"./WuiEntryGrid-Z69-1YBh.js";import{t as y}from"./WuiGantt-DThIgEVR.js";import{t as b}from"./WuiHoverCard-B_plKt-t.js";import{t as x}from"./WuiImageCrop-CPBoKzox.js";import{t as S}from"./WuiInlineEdit-BKjUqAFD.js";import{t as C}from"./WuiLeadPopup-CdGXuUdh.js";import{t as w}from"./WuiLightbox-BbBHUwEH.js";import{t as T}from"./WuiMarkdown-DRtGPxQX.js";import{r as E}from"./WuiMentionInput-CLf66bZv.js";import{t as D}from"./WuiMiniCalendar-BhUTIGwe.js";import{t as O}from"./WuiModal-LgGTsIpb.js";import{t as te}from"./WuiNavigationMenu-BebcHPiK.js";import{t as k}from"./WuiNotificationCenter-63IkQgw7.js";import{t as A}from"./WuiOfflineBanner-DGTFCtyM.js";import{t as j}from"./WuiOnboardingChecklist-C-nllg2h.js";import{t as M}from"./WuiOrgTree-CTcLLmFi.js";import{t as N}from"./WuiOtp-Cc0formv.js";import{t as P}from"./WuiOverflow-Czk6Er81.js";import{t as F}from"./WuiPhone-CdpOXNyu.js";import{t as I}from"./WuiPopover-y07DZA1J.js";import{t as L}from"./WuiRating-DIQfif9x.js";import{t as R}from"./WuiRecordPager-ByLruWFG.js";import{t as z}from"./WuiRelativeTime-3cYKtfSP.js";import{t as B}from"./WuiSavedViews-CQjUtOHV.js";import{t as V}from"./WuiSelect-Cbr_4yCe.js";import{t as H}from"./WuiShortcuts-BdMGawiV.js";import{t as U}from"./WuiShowMore-CG1offsP.js";import{t as W}from"./WuiSlider-DuPqp8Ru.js";import{t as G}from"./WuiSortable-6HHTncRn.js";import{t as K}from"./WuiTimePicker-C6KHFFOx.js";import{t as q}from"./WuiTour-CWy-OMxR.js";import{t as J}from"./WuiTree-BsT2thnb.js";import{t as Y}from"./WuiTreePicker-D4Ep2n3T.js";import{t as X}from"./WuiTruncate-BB4i8wHE.js";import{n as Z,t as ne}from"./WuiWhatsNew-naVvdes5.js";import{n as Q,t as $}from"./WuiWizardStep-CPGBX4U8.js";import{_ as re,r as ie}from"./themeTransition-DBd5lF43.js";import{t as ae}from"./drawerDiscard-DO4bmfVZ.js";import{n as oe}from"./shortcutKeys-DO6ZWyN6.js";function se(){ee(),e(`wui-select`,V),e(`wui-saved-views`,B),e(`wui-phone`,F),e(`wui-datepicker`,f),e(`wui-mini-calendar`,D),e(`wui-date-range`,p),e(`wui-date-time`,m),e(`wui-dock`,h),e(`wui-image-crop`,x),e(`wui-kanban`,t),e(`wui-dashboard-grid`,u),e(`wui-lead-popup`,C),e(`wui-inline-edit`,S),e(`wui-consent-banner`,c),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`,o),e(`wui-context-menu`,l),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`,a),e(`wui-markdown`,T),e(`wui-modal`,O),e(`wui-data-table`,d),e(`wui-drawer`,g),e(`wui-dropdown`,_),e(`wui-entry-grid`,v),e(`wui-gantt`,y),e(`wui-hover-card`,b),e(`wui-lightbox`,w),e(`wui-navigation-menu`,te),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`,E),e(`wui-comment-thread`,s),e(`wui-wizard-step`,$),e(`wui-wizard`,Q)}se();export{ae as DISCARD_EVENT,re as ROW_DROP_EVENT,oe as SHORTCUT_EVENT,ie as THEME_CHANGE_EVENT,ne as WHATS_NEW_READ_EVENT,r as WuiCalendarViews,i as WuiCarousel,a as WuiCodeBlock,o as WuiCommandPalette,s as WuiCommentThread,c as WuiConsentBanner,l as WuiContextMenu,u as WuiDashboardGrid,d as WuiDataTable,f as WuiDatePicker,p as WuiDateRange,m as WuiDateTime,h as WuiDock,g as WuiDrawer,_ as WuiDropdown,v as WuiEntryGrid,y as WuiGantt,b as WuiHoverCard,x as WuiImageCrop,S as WuiInlineEdit,t as WuiKanban,C as WuiLeadPopup,w as WuiLightbox,T as WuiMarkdown,E as WuiMentionInput,D as WuiMiniCalendar,O as WuiModal,te 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,se as defineWeborityElements};
@@ -1 +1 @@
1
- var e=`Asia/Kolkata`,t=198e5,n=/* @__PURE__ */ new Map;function r(e){let t=n.get(e);return t||(t=new Intl.DateTimeFormat(`en-US`,{timeZone:e,hourCycle:`h23`,year:`numeric`,month:`2-digit`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`,second:`2-digit`}),n.set(e,t)),t}function i(e){if(typeof e!=`string`||e===``)return!1;try{return r(e),!0}catch{return!1}}function a(n,i=e){if(i===`Asia/Kolkata`){let e=new Date(n+t);return{year:e.getUTCFullYear(),month:e.getUTCMonth(),day:e.getUTCDate(),hour:e.getUTCHours(),minute:e.getUTCMinutes(),second:e.getUTCSeconds()}}let a=Object.fromEntries(r(i).formatToParts(n).map(e=>[e.type,Number(e.value)]));return{year:Number(a.year),month:Number(a.month)-1,day:Number(a.day),hour:Number(a.hour)%24,minute:Number(a.minute),second:Number(a.second)}}function o(n,r=e){if(r===`Asia/Kolkata`)return t;let i=a(n,r),o=/* @__PURE__ */ new Date(0);return o.setUTCFullYear(i.year,i.month,i.day),o.setUTCHours(i.hour,i.minute,i.second,0),o.getTime()-Math.floor(n/1e3)*1e3}function s(t,n=e){let r=t-o(t,n);return r=t-o(r,n),r}var c=e=>e instanceof Date?e.getTime():e;function l(t,n=e){return new Date(t+o(t,n)).toISOString().slice(0,19)}function u(t=e,n=Date.now()){return l(c(n),t).slice(0,10)}export{s as a,l as i,i as n,o,u as r,a as s,e as t};
1
+ var e=`Asia/Kolkata`,t=198e5,n=/* @__PURE__ */ new Map;function r(e){let t=n.get(e);return t||(t=new Intl.DateTimeFormat(`en-US`,{timeZone:e,hourCycle:`h23`,year:`numeric`,month:`2-digit`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`,second:`2-digit`}),n.set(e,t)),t}function i(e){if(typeof e!=`string`||e===``)return!1;try{return r(e),!0}catch{return!1}}function a(n,i=e){if(i===`Asia/Kolkata`){let e=new Date(n+t);return{year:e.getUTCFullYear(),month:e.getUTCMonth(),day:e.getUTCDate(),hour:e.getUTCHours(),minute:e.getUTCMinutes(),second:e.getUTCSeconds()}}let a=Object.fromEntries(r(i).formatToParts(n).map(e=>[e.type,Number(e.value)]));return{year:Number(a.year),month:Number(a.month)-1,day:Number(a.day),hour:Number(a.hour)%24,minute:Number(a.minute),second:Number(a.second)}}function o(n,r=e){if(r===`Asia/Kolkata`)return t;let i=a(n,r),o=/* @__PURE__ */ new Date(0);return o.setUTCFullYear(i.year,i.month,i.day),o.setUTCHours(i.hour,i.minute,i.second,0),o.getTime()-Math.floor(n/1e3)*1e3}function s(t,n=e){let r=t-o(t,n);return r=t-o(r,n),r}export{s as a,o as i,e as n,i as r,a as t};
@@ -0,0 +1 @@
1
+ import{i as e,n as t}from"./zone-CIUYudtC.js";var n=e=>e instanceof Date?e.getTime():e;function r(n,r=t){return new Date(n+e(n,r)).toISOString().slice(0,19)}function i(e=t,i=Date.now()){return r(n(i),e).slice(0,10)}export{r as n,i as t};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webority/ui-elements",
3
- "version": "0.199.1",
3
+ "version": "0.201.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.199.1",
299
- "@webority/markdown-core": "0.199.1",
300
- "@webority/theme": "0.199.1",
301
- "@webority/web-core": "0.199.1",
298
+ "@webority/biome-config": "0.201.0",
299
+ "@webority/markdown-core": "0.201.0",
300
+ "@webority/theme": "0.201.0",
301
+ "@webority/web-core": "0.201.0",
302
302
  "echarts": "6.1.0",
303
303
  "jsdom": "30.1.1",
304
304
  "libphonenumber-js": "^1.13.9",
@@ -1,4 +1,5 @@
1
- import type { ChartTheme } from "./chartAdapter.ts";
1
+ import type { ChartHeading, ChartTheme } from "./chartAdapter.ts";
2
+ export type { ChartHeading } from "./chartAdapter.ts";
2
3
  import { mountChart } from "./chartAdapter.ts";
3
4
  import { type NormalizedSpec, type NormalizeResult } from "./chartSpec.ts";
4
5
  import { ElementBase } from "./elementBase.ts";
@@ -47,12 +48,18 @@ export declare class WuiChart extends ElementBase {
47
48
  attributeChangedCallback(_name: string, oldValue: string | null, newValue: string | null): void;
48
49
  /** The data as CSV text (every row; see chartSpec.toCsv). Empty when there is no drawable spec. */
49
50
  toCsv(): string;
50
- /** The chart as a PNG data URL at twice its size, on the surface colour. Empty without a drawable spec. */
51
- toPng(): string;
51
+ /**
52
+ * The chart as a PNG data URL at twice its size, on the surface colour, with `heading` (title and
53
+ * subtitle) drawn above it when given. Empty without a drawable spec.
54
+ */
55
+ toPng(heading?: ChartHeading): string;
52
56
  /** Download the CSV, named after the title unless `name` is given. */
53
57
  exportCsv(name?: string): void;
54
- /** Download the PNG, named after the title unless `name` is given. */
55
- exportPng(name?: string): void;
58
+ /**
59
+ * Download the PNG, named after the title unless `name` is given. The picture carries `heading`
60
+ * above the chart, or the spec's title when no heading is given, so the file says what it shows.
61
+ */
62
+ exportPng(name?: string, heading?: ChartHeading): void;
56
63
  _readScript(): unknown;
57
64
  _normalized(): NormalizeResult;
58
65
  _build(): void;
@@ -74,4 +81,3 @@ export declare class WuiChart extends ElementBase {
74
81
  _clearFocus(): void;
75
82
  _select(seriesIndex: number, dataIndex: number): void;
76
83
  }
77
- export {};
package/types/chart.d.ts CHANGED
@@ -1,4 +1,3 @@
1
1
  import { WuiChart } from "./WuiChart.ts";
2
2
  export { CHART_STATES, CHART_TYPES, CHART_VIEWS, MAX_SERIES, MAX_SLICES, normalizeSpec, RENDERERS, STACK_MODES, X_KINDS, } from "./chartSpec.ts";
3
- export { formatValue } from "./formatters.ts";
4
3
  export { WuiChart };
@@ -145,13 +145,22 @@ export declare function rowOf(spec: NormalizedSpec, p: ECElementEvent): {
145
145
  series: number;
146
146
  row: number;
147
147
  } | null;
148
+ /** A title and a subtitle drawn above an exported picture, so the image says what it shows. */
149
+ export interface ChartHeading {
150
+ title?: string | undefined;
151
+ subtitle?: string | undefined;
152
+ }
153
+ /** `text` cut with an ellipsis to fit `width` in the context's current font. */
154
+ export declare function fitHeadingText(measure: (text: string) => number, text: string, width: number): string;
148
155
  /**
149
156
  * A PNG of the chart as a data URL, drawn on a throwaway canvas at `pixelRatio` with the surface
150
- * colour behind it. The SVG renderer cannot hand out a PNG, and a canvas copy keeps the page's
151
- * web font, which an SVG drawn into an image would lose.
157
+ * colour behind it, and `heading` (title and subtitle) above the chart when given. The SVG renderer
158
+ * cannot hand out a PNG, and a canvas copy keeps the page's web font, which an SVG drawn into an
159
+ * image would lose.
152
160
  */
153
- export declare function renderPng(spec: NormalizedSpec, theme: ChartTheme, size: ChartSize, view: ChartHandleView, { pixelRatio }?: {
161
+ export declare function renderPng(spec: NormalizedSpec, theme: ChartTheme, size: ChartSize, view: ChartHandleView, { pixelRatio, heading }?: {
154
162
  pixelRatio?: number;
163
+ heading?: ChartHeading | undefined;
155
164
  }): string;
156
165
  /**
157
166
  * Start the engine in `container`. The handle is all the element ever calls: draw, point the
@@ -1,5 +1,5 @@
1
- import type { DatePattern, FormatStyle, FormatUnit } from "./formatters.ts";
2
- import { compactFormatOf, formatValue } from "./formatters.ts";
1
+ import type { DatePattern, FormatStyle, FormatUnit } from "@webority/markdown-core/format";
2
+ import { compactFormatOf, formatValue } from "@webority/markdown-core/format";
3
3
  export type ChartType = "line" | "area" | "column" | "bar" | "donut" | "heatmap" | "calendar" | "funnel" | "gauge" | "waterfall" | "treemap" | "sankey" | "scatter" | "bubble" | "multiples";
4
4
  export type StackMode = "none" | "stacked" | "percent";
5
5
  export type XKind = "category" | "time" | "value";
@@ -7,16 +7,15 @@ declare global {
7
7
  modules: typeof SHARED_MODULES;
8
8
  } | undefined;
9
9
  }
10
+ export { CURRENCIES, CURRENCY_SYMBOLS, currencyPrefix, DATE_PATTERNS, DEFAULT_CURRENCY, DURATION_UNITS, emptyValueLabel, FORMAT_STYLES, formatCompact, formatCurrency, formatDate, formatDateTime, formatDuration, formatNumber, formatPercent, formatValue, IST_TIME_ZONE, isCurrencyCode, isTimeZone, MONEY_UNITS, timeZoneLabel, toInstant, zoneOffsetMs, zoneParts, } from "@webority/markdown-core/format";
10
11
  export { AVATAR_ACCEPT, AVATAR_MAX_SIZE_MB, AVATAR_OUTPUT_SIZE, AVATAR_OUTPUT_TYPE, AVATAR_PREVIEW_SIZES, avatarCropOptions, avatarUnreadableMessage, isHeicFile, } from "../avatarPicker.ts";
11
12
  export { collapseSearch, initCollapsibleSearch, openSearch, SEARCH_OPEN_KEY } from "../collapsibleSearch.ts";
12
13
  export { COMMAND_SHORTCUT_ATTRIBUTE, initCommandShortcuts, isCommandChord } from "../commandShortcut.ts";
13
14
  export { COPY_FEEDBACK_MS, copyTextToClipboard } from "../copyText.ts";
14
- export { CURRENCY_SYMBOLS, currencyPrefix, DEFAULT_CURRENCY, isCurrencyCode } from "../currency.ts";
15
15
  export { COLUMN_MAX_WIDTH, COLUMN_MIN_WIDTH, clampColumnWidth, groupCount, groupItems, identityCell, measureRows, PIN_AT_VAR, PIN_SIDES, pinAtValue, pinClasses, pinOffsetVar, planPins, playRowMoves, RESIZE_STEP, RESIZE_STEP_LARGE, ROW_HEIGHTS, ROW_MOVE_LIMIT, ROW_MOVE_MS, ROW_SAVE_ATTR, ROW_SAVE_ERROR_CLASS, ROW_SAVE_STATES, readColumnWidths, rowLabel, rowOrderChanged, saveOutcomeText, setRowSaveState, settledRows, VIRTUAL_OVERSCAN, virtualRange, writeColumnWidths, } from "../dataTable.ts";
16
16
  export { acceptDroppedFiles, attachFileDrop } from "../fileDrop.ts";
17
17
  export { acceptLabel, DEFAULT_IMAGE_ACCEPT, DEFAULT_MAX_SIZE_MB, formatFileSize, isImageFile, isImageOnlyAccept, isPdfFile, matchesAccept, validateFile, } from "../fileValidation.ts";
18
18
  export { FILTER_POPOVER_MAX_CHIPS } from "../filterPopover.ts";
19
- export { CURRENCIES, DATE_PATTERNS, DURATION_UNITS, emptyValueLabel, FORMAT_STYLES, formatCompact, formatCurrency, formatDate, formatDateTime, formatDuration, formatNumber, formatPercent, formatValue, IST_TIME_ZONE, MONEY_UNITS, timeZoneLabel, toInstant, } from "../formatters.ts";
20
19
  export { attachInputMask, formatMasked, initInputMasks, isMaskPattern, MASK_INPUT_TYPES, MASK_NAMES, maskedPostValue, postedMasked, rawMasked, resolveMask, } from "../inputMask.ts";
21
20
  export { MENTION_ID_PATTERN, mentionedIds, mentionLabel, mentionTextFromValue, mentionValueFromText, parseMentionValue, } from "../mentionText.ts";
22
21
  export { groupNotificationsByDay, NOTIFICATION_COUNT_CAP, notificationCountText, notificationDayHeading, notificationTime, notificationTriggerLabel, notificationUnreadAnnouncement, } from "../notificationDays.ts";
@@ -34,7 +33,7 @@ export { addRowSelectCells, addSelectColumn, attachShiftRange, createGroupSelect
34
33
  export { fillText, pluralText, readText, setText } from "../text/textStore.ts";
35
34
  export { matchSegments } from "../textMatch.ts";
36
35
  export { applyTheme, DEFAULT_THEME_EFFECT, DEFAULT_THEME_STORAGE_KEY, nextTheme, readStoredTheme, resolveTheme, storeTheme, THEME_BOOT_SCRIPT_BODY, THEME_CHANGE_EVENT, THEME_EFFECT_DURATION, THEME_EFFECTS, THEME_MODES, THEME_SWITCHING_CLASS, themeBootScript, themeKeyframes, transitionTheme, watchSystemTheme, } from "../themeTransition.ts";
37
- export { isTimeZone, todayIn, wallClockOf, zoneOffsetMs, zoneParts } from "../zone.ts";
36
+ export { todayIn, wallClockOf } from "../zone.ts";
38
37
  export { glyphNode } from "./glyphs.ts";
39
38
  export { loadedServer, loadedShell, loadServer, loadShell, type ServerModules, type ShellModules } from "./server.ts";
40
39
  export { WuiSelect, whenElementsReady };
@@ -1,3 +1,4 @@
1
+ import * as formatters from "@webority/markdown-core/format";
1
2
  import * as anchorOverlay from "../anchorOverlay.ts";
2
3
  import * as avatarNode from "../avatarNode.ts";
3
4
  import * as buttonClass from "../buttonClass.ts";
@@ -9,7 +10,6 @@ import * as devWarn from "../devWarn.ts";
9
10
  import * as dom from "../dom.ts";
10
11
  import * as elementBase from "../elementBase.ts";
11
12
  import * as fieldState from "../fieldState.ts";
12
- import * as formatters from "../formatters.ts";
13
13
  import * as formMirror from "../formMirror.ts";
14
14
  import * as hasOwn from "../hasOwn.ts";
15
15
  import * as iconGlyphs from "../iconGlyphs.g.ts";
@@ -3,12 +3,10 @@ export { AVATAR_ACCEPT, AVATAR_MAX_SIZE_MB, AVATAR_OUTPUT_SIZE, AVATAR_OUTPUT_TY
3
3
  export { COMMAND_SHORTCUT_ATTRIBUTE, initCommandShortcuts, isApplePlatform, isCommandChord } from "./commandShortcut.ts";
4
4
  export { COMMENT_INTENTS, COMMENT_REACTIONS, type CommentIntent } from "./commentText.ts";
5
5
  export { COPY_FEEDBACK_MS, copyTextToClipboard } from "./copyText.ts";
6
- export { CURRENCY_SYMBOLS, currencyPrefix, DEFAULT_CURRENCY, isCurrencyCode } from "./currency.ts";
7
6
  export { COLUMN_MAX_WIDTH, COLUMN_MIN_WIDTH, clampColumnWidth, groupCount, groupItems, identityCell, measureRows, PIN_AT_VAR, PIN_SIDES, pinAtValue, pinClasses, pinOffsetVar, planPins, playRowMoves, RESIZE_STEP, RESIZE_STEP_LARGE, ROW_HEIGHTS, ROW_MOVE_LIMIT, ROW_MOVE_MS, ROW_SAVE_ATTR, ROW_SAVE_ERROR_CLASS, ROW_SAVE_STATES, readColumnWidths, rowLabel, rowOrderChanged, saveOutcomeText, setRowSaveState, settledRows, VIRTUAL_OVERSCAN, virtualRange, writeColumnWidths, } from "./dataTable.ts";
8
7
  export { isElementDefined, whenElementDefined } from "./elementRegistry.ts";
9
8
  export { acceptDroppedFiles, attachFileDrop } from "./fileDrop.ts";
10
9
  export { acceptLabel, DEFAULT_IMAGE_ACCEPT, DEFAULT_MAX_SIZE_MB, formatFileSize, isImageFile, isImageOnlyAccept, isPdfFile, matchesAccept, validateFile, } from "./fileValidation.ts";
11
- export { CURRENCIES, DATE_PATTERNS, DURATION_UNITS, emptyValueLabel, FORMAT_STYLES, formatCompact, formatCurrency, formatDate, formatDateTime, formatDuration, formatNumber, formatPercent, formatValue, IST_TIME_ZONE, MONEY_UNITS, timeZoneLabel, toInstant, } from "./formatters.ts";
12
10
  export { GanttError, validateGantt } from "./ganttLayout.ts";
13
11
  export type { GanttBar, GanttFoldChangeDetail, GanttFromChangeDetail, GanttHalf, GanttLayout, GanttRow, GanttSelectDetail, GanttSpec, GanttState, GanttStatus, GanttTone, GanttWeeks, GanttZoom, GanttZoomChangeDetail, } from "./ganttTypes.ts";
14
12
  export { glyphNode } from "./iconGlyphs.g.ts";
@@ -37,4 +35,4 @@ export { matchSegments } from "./textMatch.ts";
37
35
  export { applyTheme, DEFAULT_THEME_EFFECT, DEFAULT_THEME_STORAGE_KEY, nextTheme, readStoredTheme, resolveTheme, storeTheme, THEME_CHANGE_EVENT, THEME_EFFECT_DURATION, THEME_EFFECTS, THEME_MODES, THEME_SWITCHING_CLASS, themeBootScript, themeKeyframes, transitionTheme, watchSystemTheme, } from "./themeTransition.ts";
38
36
  export { showPinnedTooltips, TOOLTIP_ATTRIBUTE, TOOLTIP_CLASS_ATTRIBUTE, TOOLTIP_ID_ATTRIBUTE, TOOLTIP_OPEN_ATTRIBUTE, TOOLTIP_PLACEMENT_ATTRIBUTE, wireTooltips, } from "./tooltips.ts";
39
37
  export { createLocalSeenStore } from "./tourSeenStore.ts";
40
- export { isTimeZone, todayIn, wallClockOf, zoneOffsetMs, zoneParts } from "./zone.ts";
38
+ export { todayIn, wallClockOf } from "./zone.ts";
package/types/index.d.ts CHANGED
@@ -53,7 +53,6 @@ import { WuiWhatsNew } from "./WuiWhatsNew.ts";
53
53
  import { WuiWizard } from "./WuiWizard.ts";
54
54
  import { WuiWizardStep } from "./WuiWizardStep.ts";
55
55
  export declare function defineWeborityElements(): void;
56
- export { formatCompact, formatCurrency, formatDate, formatDateTime, formatNumber, formatPercent, formatValue, } from "./formatters.ts";
57
56
  export type * from "./ganttTypes.ts";
58
57
  export type { WuiElementTagMap } from "./globals.ts";
59
58
  export { ROW_DROP_EVENT } from "./rowDrop.ts";
@@ -1,3 +1,4 @@
1
+ import { type FormatStyle, type MoneyUnit } from "@webority/markdown-core/format";
1
2
  /** Column tones (the dot beside a column title). */
2
3
  export declare const KANBAN_TONES: readonly string[];
3
4
  /** Formats a column summary can be computed in: the sum of the visible cards' values. */
@@ -11,9 +12,9 @@ export declare const KANBAN_LONG_PRESS_MS = 400;
11
12
  /** How far a mouse or pen moves before a press becomes a drag. */
12
13
  export declare const KANBAN_DRAG_THRESHOLD_PX = 6;
13
14
  export interface SummaryFormat {
14
- style: string;
15
+ style: FormatStyle;
15
16
  currency?: string;
16
- unit?: string;
17
+ unit?: MoneyUnit;
17
18
  decimals?: number;
18
19
  }
19
20
  /**
@@ -0,0 +1 @@
1
+ export declare function initGeneratedScreens(): void;
@@ -0,0 +1 @@
1
+ export declare function morphChildren(target: Element, source: Element): void;
@@ -1,5 +1,6 @@
1
1
  export declare const REGION_SRC_ATTR: string;
2
2
  export declare const REGION_KEY_ATTR: string;
3
3
  export declare const REFRESH_ATTR: string;
4
+ export declare const SCREEN_REGION_ATTR: string;
4
5
  /** Re-fetches the regions on the page (every one, or those whose key is in `keys`); a failed answer keeps the content. */
5
6
  export declare function refreshRegions(keys?: "all" | readonly string[]): Promise<void>;
package/types/zone.d.ts CHANGED
@@ -1,21 +1,3 @@
1
- export declare const IST_TIME_ZONE: string;
2
- /** India Standard Time is UTC+05:30 all year (no daylight saving). */
3
- export declare const IST_OFFSET_MS: number;
4
- /** Whether `value` names a zone this engine knows. */
5
- export declare function isTimeZone(value: unknown): value is string;
6
- /** The wall-clock parts of an instant (epoch ms) in a zone: { year, month (0-11), day, hour, minute, second }. */
7
- export declare function zoneParts(instant: number, timeZone?: string): {
8
- year: number;
9
- month: number;
10
- day: number;
11
- hour: number;
12
- minute: number;
13
- second: number;
14
- };
15
- /** How far east of UTC the zone is at that instant, in ms (daylight saving included). */
16
- export declare function zoneOffsetMs(instant: number, timeZone?: string): number;
17
- /** The epoch ms for a wall-clock moment written as if it were UTC (`wallMs`), read in the zone. */
18
- export declare function wallToInstant(wallMs: number, timeZone?: string): number;
19
1
  /** An instant as the zone's wall clock, `YYYY-MM-DDTHH:mm:ss`. */
20
2
  export declare function wallClockOf(instant: number, timeZone?: string): string;
21
3
  /** Today in the zone, `YYYY-MM-DD`. `now` is a Date or epoch ms. */
@@ -1 +0,0 @@
1
- import{a as e,c as t,d as n,f as r,i,l as a,n as o,o as s,r as c,s as l,t as u,u as d}from"./calendarMath-CeawKuZQ.js";import{i as f,r as p}from"./dom-DMQu--xV.js";import{t as m}from"./elementBase-Cxeyx0tU.js";import{r as h,t as g}from"./fieldState-D-zQcXUS.js";import{_,b as v,g as y}from"./formatters-CXMylefd.js";import{t as b}from"./formMirror-9IpSgeZb.js";import{t as x}from"./iconGlyphs.g-DRNDTVOs.js";import{a as S,l as C,s as w}from"./nativeOverlay-MOABXAAh.js";import{n as T,t as E}from"./rtl-g7G8Bsib.js";import{r as D}from"./textStore-Dh5iyZSR.js";import{t as O}from"./datePicker.g-sGQE8c3n.js";var k=()=>D(`datePicker`,O),A=e=>e-(e%10+10)%10-1,j=class extends m{static formAssociated=!0;static get observedAttributes(){return[`value`,`min`,`max`,`placeholder`,`disabled`,`readonly`,`loading`,`first-day`,`disabled-weekdays`,`display-format`,`mode`,`size`,`aria-label`,`aria-describedby`,`aria-invalid`]}_internals;_value;_defaultValue;_rendered;_viewY;_viewM;_mode;_focus;_gridFocus;_slide;_viewNavigated;_openFn;_closeFn;_onKeyBound;_closingQuietly;get _open(){return f(this._openFn,`open missing`)}get _close(){return f(this._closeFn,`close missing`)}constructor(){super();try{this._internals=this.attachInternals()}catch{this._internals=null}this._value=``;let e=new Date(2e3,0,1);this._viewY=e.getFullYear(),this._viewM=e.getMonth(),this._mode=`days`,this._focus=null,this._gridFocus=null,this._slide=``}connectedCallback(){this._rendered||this.render()}disconnectedCallback(){this._dropPanel()}attributeChangedCallback(e,t,n){if(e===`aria-invalid`)this._syncInvalid();else if(this._rendered){if(e===`value`)this._value=n||``,this._syncFormValue(),this._syncTrigger();else if(e===`display-format`)this._syncTrigger();else if(e===`first-day`){let e=this.querySelector(`.datepicker-pop`);e instanceof HTMLDivElement&&w(e)&&this._renderView()}else this.render()}}_syncInvalid(){let e=this.querySelector(`.datepicker-trigger`);e instanceof HTMLButtonElement&&(this.hasAttribute(`aria-invalid`)?e.setAttribute(`aria-invalid`,`true`):e.removeAttribute(`aria-invalid`))}formResetCallback(){this.value=this._defaultValue||``}get value(){return this._value}set value(e){this._value=e||``,b(this,this._value),this._syncTrigger()}_firstDay(){return c(this)}_monthOnly(){return this.getAttribute(`mode`)===`month`}_yearOnly(){return this.getAttribute(`mode`)===`year`}_monthKey(e){return e&&this.hasAttribute(`value-as-date`)?e.slice(0,7):e}_monthStored(e){return this.hasAttribute(`value-as-date`)?`${e}-01`:e}_parts(e){if(this._yearOnly()){let t=a(e);return t?{y:t.y,m:0,d:1}:null}if(!this._monthOnly())return l(e);let n=t(this._monthKey(e));return n?{y:n.y,m:n.m,d:1}:null}_placeholder(){return this.getAttribute(`placeholder`)||(this._yearOnly()?k().yearPlaceholder:this._monthOnly()?k().monthPlaceholder:k().placeholder)}_label(t){let n=this.getAttribute(`display-format`);return this._yearOnly()?s(t,n):this._monthOnly()?e(this._monthKey(t)||``,n):i(t,n)}render(){this._dropPanel(),this._defaultValue===void 0&&(this._defaultValue=this.getAttribute(`value`)||``,this._value=this._defaultValue||this._value);let e=this._placeholder(),t=this._parts(this._value);t&&(this._viewY=t.y,this._viewM=t.m);let n=this.getAttribute(`size`),r=n===`sm`?` wui-input-sm`:n===`lg`?` wui-input-lg`:n===`xl`?` wui-input-xl`:``,i=this.getAttribute(`aria-label`),a=this.getAttribute(`aria-describedby`);this.replaceChildren(p(`div`,{class:`datepicker`},p(`button`,{type:`button`,class:`form-control datepicker-trigger${r}${t?` has-value`:``}${this.classList.contains(`wui-input-underline`)?` wui-input-underline`:``}`,"aria-haspopup":`dialog`,"aria-expanded":`false`,"aria-invalid":this.hasAttribute(`aria-invalid`)?`true`:void 0,disabled:this.hasAttribute(`disabled`)?!0:void 0,"aria-label":i,"aria-describedby":a},p(`span`,{"data-trigger-label":!0,class:t?``:`wui-select-placeholder`},t?this._label(this._value):e),x(`calendar-dots`)),p(`div`,{class:`datepicker-pop`,role:`dialog`,popover:`auto`}))),this._rendered=!0,h(this,this.querySelector(`.datepicker-trigger`)),b(this,this._value),this._wire()}_syncFormValue(){b(this,this._value)}_syncTrigger(){let e=this.querySelector(`.datepicker-trigger`),t=this.querySelector(`[data-trigger-label]`);if(!(t instanceof HTMLSpanElement))return;let n=this._parts(this._value);t.textContent=n?this._label(this._value):this._placeholder(),t.classList.toggle(`wui-select-placeholder`,!n),e?.classList.toggle(`has-value`,!!n),e?.classList.toggle(`wui-input-underline`,this.classList.contains(`wui-input-underline`)),h(this,e)}_limits(){if(this._yearOnly()){let e=a(this.getAttribute(`min`)),t=a(this.getAttribute(`max`)),n=e?e.y:-1/0,r=t?t.y:1/0;return{dayDisabled:()=>!0,monthDisabled:()=>!0,yearDisabled:e=>e<n||e>r}}if(this._monthOnly()){let e=t(this._monthKey(this.getAttribute(`min`))),n=t(this._monthKey(this.getAttribute(`max`))),r=e?e.y*12+e.m:-1/0,i=n?n.y*12+n.m:1/0,a=e?e.y:-1/0,o=n?n.y:1/0;return{dayDisabled:()=>!0,monthDisabled:(e,t)=>{let n=e*12+t;return n<r||n>i},yearDisabled:e=>e<a||e>o}}let e=l(this.getAttribute(`min`)),n=l(this.getAttribute(`max`)),r=e?new Date(e.y,e.m,e.d).getTime():-1/0,i=n?new Date(n.y,n.m,n.d).getTime():1/0,s=/* @__PURE__ */ new Set;for(let e of(this.getAttribute(`disabled-weekdays`)||``).split(`,`)){let t=e.trim();/^[0-6]$/.test(t)&&s.add(Number(t))}return{dayDisabled:(e,t,n)=>{let a=new Date(e,t,n),o=a.getTime();return o<r||o>i||s.has(a.getDay())},monthDisabled:(e,t)=>{let n=new Date(e,t,1).getTime();return new Date(e,t,o(e,t)).getTime()<r||n>i},yearDisabled:e=>{let t=new Date(e,0,1).getTime();return new Date(e,11,31).getTime()<r||t>i}}}_dropPanel(){let e=this.querySelector(`.datepicker-pop`);if(e instanceof HTMLDivElement){this._closingQuietly=!0;try{S(e)}finally{this._closingQuietly=!1}}}_renderView(){let e=this.querySelector(`.datepicker-pop`);e instanceof HTMLDivElement&&(this._mode===`months`?e.replaceChildren(...this._monthsNodes()):this._mode===`years`?e.replaceChildren(...this._yearsNodes()):e.replaceChildren(...this._daysNodes()),this._focusActive())}_daysNodes(){let e=this._firstDay(),t=(new Date(this._viewY,this._viewM,1).getDay()-e+7)%7,n=o(this._viewY,this._viewM),r=l(this._value),i=/* @__PURE__ */ new Date,{dayDisabled:a}=this._limits(),s=this._focus||r||{y:this._viewY,m:this._viewM,d:1},c=(e,t,n,o)=>{let c=d(e,t,n),l=r&&r.y===e&&r.m===t&&r.d===n,u=i.getFullYear()===e&&i.getMonth()===t&&i.getDate()===n,f=s.y===e&&s.m===t&&s.d===n,m=a(e,t,n),h=[`datepicker-day`,o?`is-outside`:``,u?`is-today`:``,l?`is-selected`:``].filter(Boolean).join(` `);return p(`button`,{type:`button`,class:h,"data-iso":c,role:`gridcell`,tabindex:f&&!m?`0`:`-1`,"aria-selected":l?`true`:void 0,disabled:m?!0:void 0,"aria-disabled":m?`true`:void 0},n)},f=[],m=u(this._viewY,this._viewM-1),h=o(m.y,m.m);for(let e=t-1;e>=0;e--)f.push(c(m.y,m.m,h-e,!0));for(let e=1;e<=n;e++)f.push(c(this._viewY,this._viewM,e,!1));let y=u(this._viewY,this._viewM+1),b=(7-(t+n)%7)%7;for(let e=1;e<=b;e++)f.push(c(y.y,y.m,e,!0));let S=a(i.getFullYear(),i.getMonth(),i.getDate()),C=g(this)?null:p(`button`,{type:`button`,class:`datepicker-link`,"data-clear":!0},k().clearLabel),w=Array.from({length:7},(t,n)=>p(`span`,null,v((n+e)%7,`min`)));return[p(`div`,{class:`datepicker-head`},p(`button`,{type:`button`,class:`datepicker-nav-btn`,"data-nav":`-1`,"aria-label":k().previousMonth},x(`chevron-left`)),p(`button`,{type:`button`,class:`datepicker-month`,"data-view":`months`,"aria-label":k().chooseMonthYearLabel},`${_(this._viewM)} ${this._viewY}`),p(`button`,{type:`button`,class:`datepicker-nav-btn`,"data-nav":`1`,"aria-label":k().nextMonth},x(`chevron-right`))),p(`div`,{class:`datepicker-weekdays`},...w),p(`div`,{class:`datepicker-grid${this._slide?` ${this._slide}`:``}`,role:`grid`},...f),p(`div`,{class:`datepicker-foot`},p(`button`,{type:`button`,class:`datepicker-link`,"data-today":!0,disabled:S?!0:void 0},k().todayLabel),C)]}_clearFoot(e){return!e||g(this)?[]:[p(`div`,{class:`datepicker-foot`},p(`button`,{type:`button`,class:`datepicker-link`,"data-clear":!0},k().clearLabel))]}_monthsNodes(){let e=this._parts(this._value),t=/* @__PURE__ */ new Date,{monthDisabled:n}=this._limits(),r=[];for(let i=0;i<12;i++){let a=e&&e.y===this._viewY&&e.m===i,o=t.getFullYear()===this._viewY&&t.getMonth()===i,s=n(this._viewY,i),c=[`datepicker-cell`,o?`is-today`:``,a?`is-selected`:``].filter(Boolean).join(` `);r.push(p(`button`,{type:`button`,class:c,"data-month":i,tabindex:this._monthOnly()?this._viewY*12+i===this._gridFocus&&!s?0:-1:void 0,disabled:s?!0:void 0},y(i)))}return[p(`div`,{class:`datepicker-head`},p(`button`,{type:`button`,class:`datepicker-nav-btn`,"data-nav-year":`-1`,"aria-label":k().previousYearLabel},x(`chevron-left`)),p(`button`,{type:`button`,class:`datepicker-month`,"data-view":`years`,"aria-label":k().chooseYearLabel},this._viewY),p(`button`,{type:`button`,class:`datepicker-nav-btn`,"data-nav-year":`1`,"aria-label":k().nextYearLabel},x(`chevron-right`))),p(`div`,{class:`datepicker-cells`},...r),...this._clearFoot(this._monthOnly())]}_yearsNodes(){let e=this._parts(this._value),t=(/* @__PURE__ */ new Date()).getFullYear(),{yearDisabled:n}=this._limits(),r=A(this._viewY),i=[];for(let a=0;a<12;a++){let o=r+a,s=e&&e.y===o,c=t===o,l=n(o),u=[`datepicker-cell`,c?`is-today`:``,s?`is-selected`:``].filter(Boolean).join(` `);i.push(p(`button`,{type:`button`,class:u,"data-year":o,tabindex:this._yearOnly()?o===this._gridFocus&&!l?0:-1:void 0,disabled:l?!0:void 0},o))}return[p(`div`,{class:`datepicker-head`},p(`button`,{type:`button`,class:`datepicker-nav-btn`,"data-nav-decade":`-1`,"aria-label":k().previousDecadeLabel},x(`chevron-left`)),p(`span`,{class:`datepicker-month`},`${r+1} to ${r+10}`),p(`button`,{type:`button`,class:`datepicker-nav-btn`,"data-nav-decade":`1`,"aria-label":k().nextDecadeLabel},x(`chevron-right`))),p(`div`,{class:`datepicker-cells`},...i),...this._clearFoot(this._yearOnly())]}_gridKind(){if(this._monthOnly()){let{monthDisabled:e}=this._limits(),t=e=>e-Math.floor(e/12)*12;return{view:`months`,attr:`month`,per:12,page:12,lo:e=>e*12,unit:(e,t)=>e*12+t,cell:t,disabled:n=>e(Math.floor(n/12),t(n)),iso:e=>this._monthStored(n(Math.floor(e/12),t(e)))}}if(this._yearOnly()){let{yearDisabled:e}=this._limits();return{view:`years`,attr:`year`,per:1,page:10,lo:A,unit:e=>e,cell:e=>e,disabled:e,iso:r}}return null}_gridFocusCell(e){let t=e.lo(this._viewY),n=e=>e!==null&&e>=t&&e<t+12,r=this._parts(this._value),i=/* @__PURE__ */ new Date,a=[r?e.unit(r.y,r.m):null,e.unit(i.getFullYear(),i.getMonth())];for(let t of a)if(n(t)&&!e.disabled(t))return t;for(let n=t;n<t+12;n++)if(!e.disabled(n))return n;return null}_syncGridFocus(){let e=this._gridKind();e&&(this._gridFocus=this._gridFocusCell(e))}_focusActive(){let e=this.querySelector(`.datepicker-pop`);if(!(e instanceof HTMLDivElement))return;let t=e.querySelector(`[tabindex="0"]`)||e.querySelector(`.is-selected`)||e.querySelector(`.datepicker-day:not(:disabled), .datepicker-cell:not(:disabled)`);t instanceof HTMLElement&&e.contains(document.activeElement)&&t.focus()}_setFocus(e,t,n,r){let{y:i,m:a}=u(e,t);this._focus={y:i,m:a,d:n};let o=i!==this._viewY||a!==this._viewM;this._viewY=i,this._viewM=a,this._slide=o&&r||``,this._renderView(),this._slide=``;let s=this.querySelector(`.datepicker-day[data-iso="${d(i,a,n)}"]`);s instanceof HTMLButtonElement&&s.focus()}_seek(e,t,n,r){let{dayDisabled:i}=this._limits(),a=new Date(e,t,n);for(let e=0;e<400;e++,a.setDate(a.getDate()+r))if(!i(a.getFullYear(),a.getMonth(),a.getDate()))return new Date(a);return null}_onGridKey(e,t){let n=(e,n)=>{for(let r=0;r<100*t.per;r++,e+=n)if(!t.disabled(e))return e;return null},r=(e,t)=>{let r=n(t>0?e:e+11,t);return r!==null&&r>=e&&r<e+12?r:null},i=e=>{this._viewY=Math.floor(e/t.per),this._gridFocus=e,this._renderView();let n=this.querySelector(`.datepicker-cell[data-${t.attr}="${t.cell(e)}"]`);n instanceof HTMLButtonElement&&n.focus()},a=r=>{e.preventDefault();let a=t.lo(this._viewY),o=n((this._gridFocus??(r<0?a+12:a-1))+r,r<0?-1:1);o!==null&&i(o)};switch(T(e.key,E(this))){case`ArrowLeft`:a(-1);break;case`ArrowRight`:a(1);break;case`ArrowUp`:a(-3);break;case`ArrowDown`:a(3);break;case`Home`:{e.preventDefault();let n=r(t.lo(this._viewY),1);n!==null&&i(n);break}case`End`:{e.preventDefault();let n=r(t.lo(this._viewY),-1);n!==null&&i(n);break}case`PageUp`:case`PageDown`:{e.preventDefault();let n=(this._gridFocus??t.lo(this._viewY))+(e.key===`PageUp`?-1:1)*t.page,a=t.disabled(n)?r(t.lo(Math.floor(n/t.per)),1):n;a!==null&&i(a);break}case`Enter`:case` `:{e.preventDefault();let n=this._gridFocus;n!==null&&!t.disabled(n)&&(this.value=t.iso(n),this.dispatchEvent(new Event(`change`,{bubbles:!0})),this._close());break}}}_onKey(e){let t=this._gridKind();if(t&&this._mode===t.view){this._onGridKey(e,t);return}if(this._mode!==`days`)return;let n=this._focus||l(this._value)||{y:this._viewY,m:this._viewM,d:1},r=(e,t,n,r,i)=>{let a=this._seek(e,t,n,r);a&&this._setFocus(a.getFullYear(),a.getMonth(),a.getDate(),i)},i=(t,i,a=t<0?-1:1)=>{e.preventDefault(),r(n.y,n.m,n.d+t,a,i)};switch(T(e.key,E(this))){case`ArrowLeft`:i(-1,`slide-prev`);break;case`ArrowRight`:i(1,`slide-next`);break;case`ArrowUp`:i(-7,`slide-prev`);break;case`ArrowDown`:i(7,`slide-next`);break;case`Home`:i(-((new Date(n.y,n.m,n.d).getDay()-this._firstDay()+7)%7),`slide-prev`,1);break;case`End`:i(6-(new Date(n.y,n.m,n.d).getDay()-this._firstDay()+7)%7,`slide-next`,-1);break;case`PageUp`:{e.preventDefault();let t=u(n.y,n.m-(e.shiftKey?12:1));r(t.y,t.m,Math.min(n.d,o(t.y,t.m)),-1,`slide-prev`);break}case`PageDown`:{e.preventDefault();let t=u(n.y,n.m+(e.shiftKey?12:1));r(t.y,t.m,Math.min(n.d,o(t.y,t.m)),1,`slide-next`);break}case`Enter`:case` `:e.preventDefault(),this._limits().dayDisabled(n.y,n.m,n.d)||(this.value=d(n.y,n.m,n.d),this.dispatchEvent(new Event(`change`,{bubbles:!0})),this._close());return}}_wire(){let e=this.querySelector(`.datepicker-trigger`),t=this.querySelector(`.datepicker-pop`),i=this.querySelector(`.datepicker`);if(!(e instanceof HTMLButtonElement)||!(t instanceof HTMLDivElement))return;let a=()=>w(t),o=()=>{i?.classList.remove(`open`),e.setAttribute(`aria-expanded`,`false`),this._closingQuietly||e.focus()};this._openFn=()=>{if(g(this))return;let n=/* @__PURE__ */ new Date,r=this._parts(this._value),s=this._gridKind();if(s)this._viewY=r?r.y:n.getFullYear(),this._mode=s.view,this._focus=null,this._gridFocus=this._gridFocusCell(s);else{(r||!this._viewNavigated)&&(this._viewY=n.getFullYear(),this._viewM=n.getMonth()),this._mode=`days`;let e=n.getFullYear()===this._viewY&&n.getMonth()===this._viewM,t=r&&r.y===this._viewY&&r.m===this._viewM;if(this._focus=t?r:{y:this._viewY,m:this._viewM,d:e?n.getDate():1},this._limits().dayDisabled(this._focus.y,this._focus.m,this._focus.d)){let e=this._focus,t=[1,-1].map(t=>this._seek(e.y,e.m,e.d,t)).find(t=>t&&t.getMonth()===e.m);t&&(this._focus={y:t.getFullYear(),m:t.getMonth(),d:t.getDate()})}}if(this._renderView(),C(e,t,{mode:`auto`,clampHeight:!0,onClosed:o}),!a())return;i?.classList.add(`open`),e.setAttribute(`aria-expanded`,`true`);let c=t.querySelector(`[tabindex="0"]`);c instanceof HTMLElement&&c.focus()},this._closeFn=()=>{S(t)},e.addEventListener(`click`,()=>a()?this._close():this._open()),t.addEventListener(`click`,e=>{let t=e.target;if(!(t instanceof Element))throw Error(`click target is not an element`);let i=t.closest(`[data-nav]`);if(i instanceof HTMLElement){this._viewNavigated=!0,this._slide=Number(i.dataset.nav)<0?`slide-prev`:`slide-next`;let e=u(this._viewY,this._viewM+Number(i.dataset.nav));this._viewY=e.y,this._viewM=e.m,this._focus={y:e.y,m:e.m,d:1},this._renderView(),this._slide=``;return}let a=t.closest(`[data-nav-year]`);if(a instanceof HTMLElement){this._viewY+=Number(a.dataset.navYear),this._syncGridFocus(),this._renderView();return}let o=t.closest(`[data-nav-decade]`);if(o instanceof HTMLElement){this._viewY+=Number(o.dataset.navDecade)*10,this._syncGridFocus(),this._renderView();return}let s=t.closest(`[data-view]`);if(s instanceof HTMLElement){this._mode=s.dataset.view,this._renderView();return}let c=t.closest(`[data-month]`);if(c instanceof HTMLButtonElement&&!c.disabled){if(this._monthOnly()){this.value=this._monthStored(n(this._viewY,Number(c.dataset.month))),this.dispatchEvent(new Event(`change`,{bubbles:!0})),this._close();return}this._viewNavigated=!0,this._viewM=Number(c.dataset.month),this._mode=`days`,this._focus={y:this._viewY,m:this._viewM,d:1},this._renderView();return}let l=t.closest(`[data-year]`);if(l instanceof HTMLButtonElement&&!l.disabled){if(this._yearOnly()){this.value=r(Number(l.dataset.year)),this.dispatchEvent(new Event(`change`,{bubbles:!0})),this._close();return}this._viewNavigated=!0,this._viewY=Number(l.dataset.year),this._mode=`months`,this._syncGridFocus(),this._renderView();return}if(t.closest(`[data-today]`)){let e=/* @__PURE__ */ new Date;if(this._limits().dayDisabled(e.getFullYear(),e.getMonth(),e.getDate()))return;this.value=d(e.getFullYear(),e.getMonth(),e.getDate()),this.dispatchEvent(new Event(`change`,{bubbles:!0})),this._close();return}if(t.closest(`[data-clear]`)){this.value=``,this.dispatchEvent(new Event(`change`,{bubbles:!0})),this._close();return}let f=t.closest(`.datepicker-day[data-iso]`);f instanceof HTMLButtonElement&&!f.disabled&&(this.value=f.dataset.iso,this.dispatchEvent(new Event(`change`,{bubbles:!0})),this._close())}),this._onKeyBound=e=>{a()&&this._onKey(e)},t.addEventListener(`keydown`,this._onKeyBound),this._syncFormValue()}};export{j as t};
@@ -1 +0,0 @@
1
- import{i as e,n as t,r as n,s as r,t as i,u as a}from"./calendarMath-CeawKuZQ.js";import{n as o}from"./devWarn-DXdRWZs3.js";import{r as s,t as c}from"./textStore-Dh5iyZSR.js";import{t as l}from"./dateRangePicker.g-Pnc37vgX.js";import{n as u,r as d,t as f}from"./zone-BR02ZkHF.js";import{r as p}from"./dom-DMQu--xV.js";import{t as m}from"./elementBase-Cxeyx0tU.js";import{r as h,t as g}from"./fieldState-D-zQcXUS.js";import{_,b as v}from"./formatters-CXMylefd.js";import{t as y}from"./iconGlyphs.g-DRNDTVOs.js";import{a as b,l as x,s as S}from"./nativeOverlay-MOABXAAh.js";var C=4,w=[`today`,`yesterday`,`last7Days`,`last30Days`,`thisMonth`,`lastMonth`,`thisFinancialYear`],T={today:`todayLabel`,yesterday:`yesterdayLabel`,last7Days:`last7DaysLabel`,last30Days:`last30DaysLabel`,thisMonth:`thisMonthLabel`,lastMonth:`lastMonthLabel`,thisFinancialYear:`thisFinancialYearLabel`},E=e=>String(e).padStart(2,`0`),D=e=>`${e.getUTCFullYear()}-${E(e.getUTCMonth()+1)}-${E(e.getUTCDate())}`;function O(e){return w.includes(e)}function k(e,t=/* @__PURE__ */ new Date,{timeZone:n=f,financialYearStart:i=C}={}){if(!O(e))return null;let a=r(d(n,t));if(!a)throw Error(`today missing`);let{y:o,m:c,d:u}=a,p=(e,t,n)=>D(new Date(Date.UTC(e,t,n))),m=s(`dateRangePicker`,l)[T[e]];switch(e){case`today`:return{label:m,start:p(o,c,u),end:p(o,c,u)};case`yesterday`:return{label:m,start:p(o,c,u-1),end:p(o,c,u-1)};case`last7Days`:return{label:m,start:p(o,c,u-6),end:p(o,c,u)};case`last30Days`:return{label:m,start:p(o,c,u-29),end:p(o,c,u)};case`thisMonth`:return{label:m,start:p(o,c,1),end:p(o,c+1,0)};case`lastMonth`:return{label:m,start:p(o,c-1,1),end:p(o,c,0)};case`thisFinancialYear`:{let e=i-1,t=c>=e?o:o-1;return{label:m,start:p(t,e,1),end:p(t+1,e,0)}}default:return null}}function A(e){o(`[@webority/ui-elements] <wui-date-range> presets: ${e}`)}function j(e){return typeof e==`object`&&!!e}function M(e,t=/* @__PURE__ */ new Date,n={}){let i=String(e??``).trim();if(!i)return[];let a;if(i.startsWith(`[`))try{a=JSON.parse(i)}catch{return A(`the attribute is not valid JSON`),[]}else a=i.split(`,`).map(e=>e.trim());let o=[];for(let e of a)if(typeof e==`string`){let r=k(e,t,n);r?o.push(r):A(`"${e}" is not one of ${w.join(`, `)}`)}else j(e)&&typeof e.label==`string`&&e.label&&typeof e.start==`string`&&typeof e.end==`string`&&r(e.start)&&r(e.end)?o.push({label:e.label,start:e.start,end:e.end}):A(`an item needs a label and ISO start and end dates, or a preset name`);return o}var N=()=>s(`dateRangePicker`,l);function P(e){if(!(e.target instanceof Element))throw Error(`Expected the event target to be an element.`);return e.target}function F(e,t){return[...e.querySelectorAll(t)].map(e=>{if(!(e instanceof HTMLElement))throw Error(`Expected every "${t}" to be an HTML element.`);return e})}var I=class extends m{static formAssociated=!0;_internals;_start;_end;_hover;_viewY;_viewM;get open(){return this.querySelector(`.daterange`)?.classList.contains(`open`)??!1}set open(e){e?!g(this)&&!this.open&&this._open?.():this.open&&this._close?.()}static get observedAttributes(){return[`start`,`end`,`min`,`max`,`placeholder`,`disabled`,`readonly`,`loading`,`first-day`,`size`,`aria-label`,`aria-describedby`,`name`,`start-name`,`end-name`,`presets`,`time-zone`,`financial-year-start`,`aria-invalid`]}constructor(){super();try{this._internals=this.attachInternals()}catch{this._internals=null}this._start=``,this._end=``,this._hover=``;let e=new Date(2e3,0,1);this._viewY=e.getFullYear(),this._viewM=e.getMonth()}connectedCallback(){this._rendered||this.render()}disconnectedCallback(){this._dropPanel()}attributeChangedCallback(e,t,n){e===`aria-invalid`?this._syncInvalid():this._rendered&&(e===`start`||e===`end`?(this._start=this.getAttribute(`start`)||``,this._end=this.getAttribute(`end`)||``,this._syncTrigger(),this._syncMirrors()):this.render())}_syncInvalid(){let e=this.querySelector(`.daterange-trigger`);e&&(this.hasAttribute(`aria-invalid`)?e.setAttribute(`aria-invalid`,`true`):e.removeAttribute(`aria-invalid`))}get value(){return{start:this._start,end:this._end}}set value(e){this._start=e?.start||``,this._end=e?.end||``,this._syncTrigger(),this._syncMirrors()}_firstDay(){return n(this)}_label(){let t=this.getAttribute(`placeholder`)||N().placeholder;return!this._start&&!this._end?{text:t,empty:!0}:{text:c(N().rangeText,{start:e(this._start)||N().startLabel,end:e(this._end)||N().endLabel}),empty:!1}}render(){this._dropPanel(),this._defaultStart===void 0&&(this._defaultStart=this.getAttribute(`start`)||``,this._defaultEnd=this.getAttribute(`end`)||``,this._start=this._defaultStart||this._start,this._end=this._defaultEnd||this._end);let e=r(this._start);e&&(this._viewY=e.y,this._viewM=e.m);let t=this.getAttribute(`size`),n=t===`sm`?` wui-input-sm`:t===`lg`?` wui-input-lg`:t===`xl`?` wui-input-xl`:``,{text:i,empty:a}=this._label(),o=this.getAttribute(`aria-label`),s=this.getAttribute(`aria-describedby`),c=p(`button`,{type:`button`,class:`form-control daterange-trigger${n}${a?``:` has-value`}${this.classList.contains(`wui-input-underline`)?` wui-input-underline`:``}`,"aria-haspopup":`dialog`,"aria-expanded":`false`,"aria-invalid":this.hasAttribute(`aria-invalid`)?`true`:null,disabled:this.hasAttribute(`disabled`),"aria-label":o||null,"aria-describedby":s||null},p(`span`,{"data-range-label":!0,class:a?`wui-select-placeholder`:``},i),y(`calendar`));this.replaceChildren(p(`div`,{class:`daterange`},c,p(`div`,{class:`daterange-pop`,role:`dialog`,popover:`auto`}))),h(this,this.querySelector(`.daterange-trigger`)),this._rendered=!0,this._syncMirrors(),this._wire()}formResetCallback(){this.value={start:this._defaultStart||``,end:this._defaultEnd||``}}_syncTrigger(){let e=this.querySelector(`.daterange-trigger`),t=this.querySelector(`[data-range-label]`);if(!t)return;let{text:n,empty:r}=this._label();t.textContent=n,t.classList.toggle(`wui-select-placeholder`,r),e?.classList.toggle(`has-value`,!r),e?.classList.toggle(`wui-input-underline`,this.classList.contains(`wui-input-underline`))}_syncMirrors(){let e=this.getAttribute(`start-name`),t=this.getAttribute(`end-name`);this._mirror(`start`,e,this._start),this._mirror(`end`,t,this._end)}_mirror(e,t,n){if(!t)return;let r=this.querySelector(`input[type="hidden"][data-range-mirror="${e}"]`),i;r instanceof HTMLInputElement?i=r:(i=document.createElement(`input`),i.type=`hidden`,i.setAttribute(`data-range-mirror`,e),this.appendChild(i)),i.name=t,i.value=n||``,i.disabled=this.hasAttribute(`disabled`)}_limits(){let e=r(this.getAttribute(`min`)),t=r(this.getAttribute(`max`)),n=e?new Date(e.y,e.m,e.d).getTime():-1/0,i=t?new Date(t.y,t.m,t.d).getTime():1/0;return(e,t,r)=>{let a=new Date(e,t,r).getTime();return a<n||a>i}}_monthHtml(e,n){let r=this._firstDay(),o=(new Date(e,n,1).getDay()-r+7)%7,s=t(e,n),c=this._limits(),l=Array.from({length:7},(e,t)=>p(`span`,null,v((t+r)%7,`min`))),u=(e,t,n,r)=>{let i=a(e,t,n),o=c(e,t,n),s=[`datepicker-day`,r?`is-outside`:``].filter(Boolean).join(` `);return p(`button`,{type:`button`,class:s,"data-iso":i,disabled:o},n)},d=[],f=i(e,n-1),m=t(f.y,f.m);for(let e=o-1;e>=0;e--)d.push(u(f.y,f.m,m-e,!0));for(let t=1;t<=s;t++)d.push(u(e,n,t,!1));let h=i(e,n+1),g=(7-(o+s)%7)%7;for(let e=1;e<=g;e++)d.push(u(h.y,h.m,e,!0));return p(`div`,{class:`daterange-cal`},p(`div`,{class:`datepicker-month-label`},`${_(n)} ${e}`),p(`div`,{class:`datepicker-weekdays`},...l),p(`div`,{class:`datepicker-grid`,role:`grid`},...d))}_presetOptions(){let e=this.getAttribute(`time-zone`),t=f;e!==null&&(u(e)?t=e:o(`[@webority/ui-elements] <wui-date-range> time-zone="${e}" is not a time zone this browser knows; India Standard Time is used.`));let n=this.getAttribute(`financial-year-start`),r=4;if(n!==null){let e=Number(n);Number.isInteger(e)&&e>=1&&e<=12?r=e:o(`[@webority/ui-elements] <wui-date-range> financial-year-start="${n}" must be a month number from 1 to 12; April (4) is used.`)}return{timeZone:t,financialYearStart:r}}_presetsHtml(){if(!this._presetList?.length)return null;let e=this._limits(),t=t=>{let n=r(t);if(!n)throw Error(`Expected a preset date, found "${t}".`);return e(n.y,n.m,n.d)},n=this._presetList.map((e,n)=>p(`button`,{type:`button`,class:`wui-daterange-preset`,"data-preset":n,disabled:t(e.start)||t(e.end)},e.label));return p(`div`,{class:`wui-daterange-presets`,role:`group`,"aria-label":N().quickRangesLabel},...n)}_renderView(){let e=this.querySelector(`.daterange-pop`);if(!e)return;let t=i(this._viewY,this._viewM+1),n=this._presetsHtml(),r=[p(`div`,{class:`daterange-head`},p(`button`,{type:`button`,class:`datepicker-nav-btn`,"data-nav":-1,"aria-label":N().previousMonthLabel},y(`chevron-left`)),p(`button`,{type:`button`,class:`datepicker-nav-btn`,"data-nav":1,"aria-label":N().nextMonthLabel},y(`chevron-right`))),p(`div`,{class:`daterange-cals`},this._monthHtml(this._viewY,this._viewM),this._monthHtml(t.y,t.m)),p(`div`,{class:`datepicker-foot`},p(`span`,{class:`daterange-hint`,"data-range-hint":!0}),p(`button`,{type:`button`,class:`datepicker-link`,"data-clear":!0},N().clearLabel))];e.classList.toggle(`wui-daterange-pop--presets`,n!==null),e.replaceChildren(...n?[n,p(`div`,{class:`wui-daterange-main`},...r)]:r),this._paint()}_paint(){let t=this.querySelector(`.daterange-pop`);if(!t)return;let n=this._start?new Date(this._start).getTime():null,r=this._end;n&&!this._end&&this._hover&&new Date(this._hover).getTime()>=n&&(r=this._hover);let i=r?new Date(r).getTime():null;for(let e of F(t,`.datepicker-day[data-iso]`)){let t=new Date(e.dataset.iso??``).getTime(),r=n!=null&&t===n,a=i!=null&&t===i,o=n!=null&&i!=null&&t>n&&t<i;e.classList.toggle(`is-range-start`,r),e.classList.toggle(`is-range-end`,a),e.classList.toggle(`in-range`,o)}F(t,`[data-preset]`).forEach(e=>{let t=this._presetList?.[Number(e.dataset.preset)],n=!!t&&t.start===this._start&&t.end===this._end;e.classList.toggle(`is-active`,n),e.setAttribute(`aria-pressed`,String(n))});let a=t.querySelector(`[data-range-hint]`);a&&(a.textContent=this._start?this._end?c(N().rangeText,{start:e(this._start),end:e(this._end)}):N().pickEndDateLabel:N().pickStartDateLabel)}_pick(e){!this._start||this._start&&this._end?(this._start=e,this._end=``,this._hover=``,this._syncTrigger(),this._syncMirrors(),this._paint()):new Date(e).getTime()<new Date(this._start).getTime()?(this._start=e,this._syncTrigger(),this._syncMirrors(),this._paint(),this.dispatchEvent(new Event(`change`,{bubbles:!0}))):(this._end=e,this._syncTrigger(),this._syncMirrors(),this._paint(),this.dispatchEvent(new Event(`change`,{bubbles:!0})),this._close())}_applyPreset({start:e,end:t}){this._start=e,this._end=t,this._hover=``,this._syncTrigger(),this._syncMirrors(),this._paint(),this.dispatchEvent(new Event(`change`,{bubbles:!0})),this._close()}_dropPanel(){let e=this.querySelector(`.daterange-pop`);e instanceof HTMLDivElement&&b(e)}_wire(){let e=this.querySelector(`.daterange-trigger`),t=this.querySelector(`.daterange-pop`),n=this.querySelector(`.daterange`);if(!(e instanceof HTMLButtonElement)||!(t instanceof HTMLDivElement))return;let a=()=>S(t),o=()=>{this._hover=``,n?.classList.remove(`open`),e.setAttribute(`aria-expanded`,`false`),this.dispatchEvent(new CustomEvent(`wui-date-range:openchange`,{bubbles:!0,detail:{open:!1}}))};this._open=()=>{let i=r(this._start);if(i)this._viewY=i.y,this._viewM=i.m;else{let e=/* @__PURE__ */ new Date;this._viewY=e.getFullYear(),this._viewM=e.getMonth()}this._presetList=M(this.getAttribute(`presets`),/* @__PURE__ */ new Date,this._presetOptions()),this._renderView(),x(e,t,{mode:`auto`,clampHeight:!0,onClosed:o}),a()&&(n?.classList.add(`open`),e.setAttribute(`aria-expanded`,`true`),this.dispatchEvent(new CustomEvent(`wui-date-range:openchange`,{bubbles:!0,detail:{open:!0}})))},this._close=()=>{b(t)},e.addEventListener(`click`,()=>{a()?this._close():g(this)||this._open()}),t.addEventListener(`click`,e=>{let t=P(e),n=t.closest(`[data-nav]`);if(n instanceof HTMLElement){let e=i(this._viewY,this._viewM+Number(n.dataset.nav));this._viewY=e.y,this._viewM=e.m,this._renderView();return}if(t.closest(`[data-clear]`)){this._start=``,this._end=``,this._hover=``,this._syncTrigger(),this._syncMirrors(),this._renderView(),this.dispatchEvent(new Event(`change`,{bubbles:!0}));return}let r=t.closest(`[data-preset]`);if(r instanceof HTMLButtonElement&&!r.disabled){let e=this._presetList?.[Number(r.dataset.preset)];e&&this._applyPreset(e);return}let a=t.closest(`.datepicker-day[data-iso]`);if(a instanceof HTMLButtonElement&&!a.disabled){let e=a.dataset.iso;e!==void 0&&this._pick(e)}}),t.addEventListener(`mouseover`,e=>{let t=P(e).closest(`.datepicker-day[data-iso]`),n=t instanceof HTMLButtonElement?t.dataset.iso:void 0;n!==void 0&&this._start&&!this._end&&(this._hover=n,this._paint())}),this._syncMirrors()}};export{I as t};
@@ -1 +0,0 @@
1
- import{t as e}from"./elementBase-Cxeyx0tU.js";import{t}from"./formMirror-9IpSgeZb.js";import{r as n}from"./textStore-Dh5iyZSR.js";import{t as r}from"./datePicker.g-sGQE8c3n.js";import{a as i,n as a,s as o,t as s}from"./zone-BR02ZkHF.js";var c=()=>n(`datePicker`,r),l=`data-wui-part`,u=[`disabled`,`readonly`,`required`],d=(e,t=2)=>String(e).padStart(t,`0`);function f(e,t){if(e===``)return{date:``,time:``};let n=Date.parse(e);if(Number.isNaN(n))throw Error(`<wui-date-time> "${e}" is not an ISO UTC date-time.`);let r=o(n,t);return{date:`${d(r.year,4)}-${d(r.month+1)}-${d(r.day)}`,time:`${d(r.hour)}:${d(r.minute)}`}}function p({date:e,time:t},n){if(e===``||t===``)return``;let[r=0,a=0,o=0]=e.split(`-`).map(Number),[s=0,c=0]=t.split(`:`).map(Number);return new Date(i(Date.UTC(r,a-1,o,s,c),n)).toISOString()}function m(e,t,n){e.getAttribute(t)!==n&&(n===null?e.removeAttribute(t):e.setAttribute(t,n))}function h(e){return`value`in e&&typeof e.value==`string`?e.value:``}var g=class extends e{static formAssociated=!0;_date=``;_time=``;_zone=s;_rendered=!1;_written=!1;_defaultValue=``;static get observedAttributes(){return[`value`,`min`,`max`,`zone`,`name`,`id`,`disabled`,`readonly`,`required`,`aria-label`,`aria-describedby`,`aria-invalid`,`time-label`,`date-placeholder`,`time-placeholder`]}constructor(){super(),this.addEventListener(`change`,e=>this._onPartChange(e))}connectedCallback(){this._rendered||this.render()}attributeChangedCallback(e,t,n){if(this._rendered){if(e===`value`)this._write(n??``);else if(e===`zone`){let e=this.value;this._zone=this._readZone(),this._setParts(e)}else if(e===`name`){this._syncMirror();return}this._syncChildren(),e===`disabled`&&this._syncMirror()}}formResetCallback(){this._setParts(this._defaultValue),this._syncChildren(),this._syncMirror()}get value(){return p({date:this._date,time:this._time},this._zone)}set value(e){this._zone=this._readZone(),this._written=!0,this._write(e||``),this._rendered&&(this._syncChildren(),this._syncMirror())}render(){this._zone=this._readZone(),this._defaultValue=this.getAttribute(`value`)??``,this._written||this._setParts(this._defaultValue);let e=document.createElement(`div`);e.className=`d-flex flex-wrap gap-2`;for(let[t,n]of[[`wui-datepicker`,`date`],[`wui-timepicker`,`time`]]){let r=document.createElement(t);r.setAttribute(l,n),e.append(r)}this.replaceChildren(e),this._rendered=!0,this._syncChildren(),this._syncMirror()}_readZone(){let e=this.getAttribute(`zone`)||`Asia/Kolkata`;if(!a(e))throw Error(`<wui-date-time> zone "${e}" is not an IANA time zone such as "${s}".`);return e}_setParts(e){let t=f(e,this._zone);this._date=t.date,this._time=t.time}_write(e){e!==this.value&&this._setParts(e)}_limit(e){let t=this.getAttribute(e);return t?f(t,this._zone).date:null}_child(e){let t=this.querySelector(`[${l}="${e}"]`);return t instanceof HTMLElement?t:null}_syncChildren(){let e=this._child(`date`),t=this._child(`time`);if(!e||!t)return;let n=this.getAttribute(`id`);m(e,`id`,n?`${n}-date`:null),m(e,`value`,this._date||null),m(e,`min`,this._limit(`min`)),m(e,`max`,this._limit(`max`)),m(e,`placeholder`,this.getAttribute(`date-placeholder`)),m(e,`aria-label`,this.getAttribute(`aria-label`)),m(e,`aria-describedby`,this.getAttribute(`aria-describedby`)),m(e,`aria-invalid`,this.getAttribute(`aria-invalid`)),m(t,`value`,this._time||null),m(t,`placeholder`,this.getAttribute(`time-placeholder`)),m(t,`aria-label`,this.getAttribute(`time-label`)||c().dateTimeLabel);for(let n of u)for(let r of[e,t])m(r,n,this.hasAttribute(n)?``:null)}_syncMirror(){t(this,this.value)}_onPartChange(e){if(e.target===this)return;e.stopImmediatePropagation();let t=e.target,n=t instanceof Element?t.getAttribute(l):null;if(!(t instanceof Element)||n!==`date`&&n!==`time`)return;let r=h(t);n===`date`?this._date=r:this._time=r,m(t,`value`,r||null),this._syncMirror(),this.dispatchEvent(new Event(`change`,{bubbles:!0}))}};export{g as t};
@@ -1 +0,0 @@
1
- import{i as e}from"./calendarMath-CeawKuZQ.js";import{n as t,r as n,t as r}from"./digitGrouping-CCPI3HK3.js";import{t as i}from"./elementBase-Cxeyx0tU.js";import{o as a}from"./formatters-CXMylefd.js";import{n as o}from"./imeSafeEnter-DeO_3lXy.js";import{n as s,t as c}from"./inlineEditText-B35MKEul.js";import{c as l,i as u}from"./refreshAfter-DhYgWXmQ.js";import{m as d}from"./wuiHttp-8CYWEbRz.js";import{r as f,t as p}from"./textStore-Dh5iyZSR.js";import{n as m,t as h}from"./inlineEdit.g-DKIhYoPF.js";import{t as g}from"./httpFailure.g-DjZzGxPj.js";var _=()=>f(`inlineEdit`,h),v=()=>f(`asyncBlock`,m),y=e=>typeof e==`object`&&!!e&&`value`in e&&typeof e.value==`string`&&`label`in e&&typeof e.label==`string`;async function b(e){let t=await d(new URL(e,window.location.href).href,{headers:{Accept:`application/json`}});if(!t.ok)throw Error(`Loading options answered ${t.kind}.`);let n=JSON.parse(t.html),r=Array.isArray(n)?n:[];if(!Array.isArray(n)||!r.every(y))throw Error(`Options must be a JSON array of { value, label } strings.`);return r.filter(y)}var x=e=>s.some(t=>t===e),S=`[data-wui-display]`,C=`[data-wui-value]`,w=`[data-wui-editor]`,T=`[data-wui-control]`,E=`[data-wui-error]`,D=`[data-wui-live]`,O=`[aria-expanded="true"]`,k=/* @__PURE__ */ new Set([`select`,`date`]),A=e=>{let t=(typeof e==`object`||typeof e==`function`)&&e!==null&&`message`in e?e.message:void 0;return typeof t==`string`&&t?t:_().serverMessage},j=e=>e instanceof HTMLElement&&typeof(`value`in e?e.value:void 0)==`string`,M=(e,t)=>{let n=e?.querySelector(t)??null;return n instanceof HTMLElement?n:null},N=class extends i{_wired;_editing;_busy;_draft;_pressed;_popupOpen;_savedTimer;_optionsLoaded;_optionsLoading;static get observedAttributes(){return[`disabled`]}constructor(){super(),this._wired=!1,this._editing=!1,this._busy=!1,this._draft=null,this._pressed=!1,this._popupOpen=!1,this._savedTimer=null,this._optionsLoaded=!1,this._optionsLoading=null,this._onClick=this._onClick.bind(this),this._onKeyCapture=this._onKeyCapture.bind(this),this._onKeyDown=this._onKeyDown.bind(this),this._onFocusOut=this._onFocusOut.bind(this),this._onPointerDown=this._onPointerDown.bind(this),this._onPointerUp=this._onPointerUp.bind(this),this._onChange=this._onChange.bind(this)}connectedCallback(){this._wired||(this._wired=!0,this._grouping(),this.addEventListener(`click`,this._onClick),this.addEventListener(`auxclick`,this._onClick),this.addEventListener(`keydown`,this._onKeyCapture,!0),this.addEventListener(`keydown`,this._onKeyDown),this.addEventListener(`focusout`,this._onFocusOut),this.addEventListener(`pointerdown`,this._onPointerDown),this.addEventListener(`change`,this._onChange))}disconnectedCallback(){clearTimeout(this._savedTimer??void 0),this._savedTimer=null,this._releasePress()}attributeChangedCallback(e){e===`disabled`&&this.hasAttribute(`disabled`)&&this.cancel()}edit(){if(this._editing||this._busy||this.hasAttribute(`disabled`))return;let e=M(this,S),t=M(this,w),n=this._control();e&&t&&n&&(this._editing=!0,this._setState(null),n.value=this._draft??this._value(),t.hidden=!1,this.setAttribute(`data-wui-editing`,``),this._needsLoad()&&this._loadOptions(),this._focusControl(n),e.hidden=!0)}cancel(){this._editing&&(this._draft=null,this._setError(null),this.getAttribute(`data-wui-state`)===`error`&&this._setState(null),this._close())}_needsLoad(){return this._type()===`select`&&this.hasAttribute(`load-url`)&&!this._optionsLoaded}_loadOptions(){let e=this.getAttribute(`load-url`),t=this._control();e&&t&&this._optionsLoading===null&&(this._setError(null),t.setAttribute(`disabled`,``),this.setAttribute(`aria-busy`,`true`),Object.assign(t,{options:[{value:``,label:v().loadingLabel}]}),this._optionsLoading=b(e).then(e=>{this._optionsLoading=null,this._optionsLoaded=!0,this._showRows(t,e)},()=>{this._optionsLoading=null,this._showLoadError()}))}_showRows(e,t){this.removeAttribute(`aria-busy`),e.removeAttribute(`disabled`),Object.assign(e,{options:t}),e.value=this._draft??this._value(),this._editing&&this._focusControl(e)}_showLoadError(){this.removeAttribute(`aria-busy`);let e=M(this,E);if(!e)return;let t=v(),n=document.createElement(`button`);n.type=`button`,n.setAttribute(`data-wui-retry`,``),n.textContent=t.retryLabel,n.addEventListener(`click`,()=>this._loadOptions()),e.replaceChildren(`${t.errorTitle} `,n),e.hidden=!1,this._announce(t.errorTitle)}_onClick(e){e.stopPropagation();let t=e.target instanceof Node?e.target:null;e.type===`click`&&!this._editing&&this.querySelector(S)?.contains(t)&&this.edit()}_onKeyCapture(){this._popupOpen=!!(this._editing&&this.querySelector(w)?.querySelector(O))}_onKeyDown(e){if(!this._editing){(o(e)||e.key===` `)&&e.stopPropagation();return}if(e.stopPropagation(),this._popupOpen)return;if(e.key===`Escape`){e.preventDefault(),this.cancel();return}let t=this._type();e.key!==`Enter`||k.has(t)||(t!==`textarea`||e.ctrlKey||e.metaKey)&&(e.preventDefault(),this._commit(this._control()?.value??``))}_onFocusOut(e){if(!this._editing||this._pressed)return;let t=e.relatedTarget instanceof Node?e.relatedTarget:null;t&&this.contains(t)||document.hasFocus()&&this._commit(this._control()?.value??``)}_onPointerDown(){this._editing&&(this._pressed=!0,document.addEventListener(`pointerup`,this._onPointerUp,!0),document.addEventListener(`pointercancel`,this._onPointerUp,!0))}_onPointerUp(){this._releasePress(),setTimeout(()=>{this._pressed=!1,this._editing&&!this.contains(document.activeElement)&&document.hasFocus()&&this._commit(this._control()?.value??``)},0)}_releasePress(){document.removeEventListener(`pointerup`,this._onPointerUp,!0),document.removeEventListener(`pointercancel`,this._onPointerUp,!0)}_onChange(e){if(!this._editing||!k.has(this._type()))return;let t=this._control();t&&e.target===t&&queueMicrotask(()=>this._commit(t.value))}async _commit(e){if(!this._editing||this._busy)return;if(this._optionsLoading!==null){this.cancel();return}let t=this._value();if(e===t){this.cancel();return}let n=typeof this.validate==`function`?this.validate(e):null;if(n){this._setError(n),this._announce(n);return}let r=this.hasAttribute(`controlled`);this._draft=null,this._setError(null),this._busy=!0,this._setState(`saving`),this.setAttribute(`aria-busy`,`true`);let i=r?null:this._readShown();r||this._showValue(e),this._close();let a=await this._persist(e,r);this._busy=!1,this.removeAttribute(`aria-busy`);let o=this.getAttribute(`label`)||``;a.ok?(this.setAttribute(`value`,e),!r&&a.text&&this._showText(a.text,!1),this._setState(`saved`),this._savedTimer=setTimeout(()=>this._setState(null),c),this._announce(p(_().savedText,{label:o})),this._fire(`wui:inline-edit:saved`,{value:e,previous:t}),a.result&&!u(this)&&await l(a.result,{origin:this})):(i&&this._restoreShown(i),a.kind===`session`||a.kind===`aborted`?this._setState(null):(this._draft=e,this._setState(`error`),this._setError(a.message),this._announce(p(_().notSavedText,{label:o,reason:a.message})),this._fire(`wui:inline-edit:failed`,{value:e,previous:t,kind:a.kind,message:a.message})))}async _persist(e,t){if(t){if(typeof this.save!=`function`)return{ok:!0};try{return await this.save(e),{ok:!0}}catch(e){return{ok:!1,kind:`server`,message:A(e)}}}let n=this.getAttribute(`action`);if(!n)return{ok:!0};let r=new URLSearchParams({[this.getAttribute(`name`)||`value`]:e}),i=await d(n,{method:`POST`,body:r});if(i.ok)return{ok:!0,text:i.data===null?i.html.trim():``,result:i};let a={forbidden:_().forbiddenMessage,networkCheck:f(`httpFailure`,g).networkCheckText,client:_().clientMessage,validation:_().validationMessage,server:_().serverMessage,network:_().networkMessage};return{ok:!1,kind:i.kind,message:i.message||a[i.kind]||_().serverMessage}}_close(){let e=M(this,S),t=M(this,w),n=this.contains(document.activeElement);this._editing=!1,this.removeAttribute(`data-wui-editing`),t&&(t.hidden=!0),e&&(e.hidden=!1),M(t,O)?.click(),n&&e?.focus()}_focusControl(e){if(!k.has(this._type())){e.focus(),e.select?.();return}let t=M(e,`button`);t&&(t.focus(),t.getAttribute(`aria-expanded`)!==`true`&&t.click())}_showValue(t){if(t===``){this._showText(this.getAttribute(`placeholder`)||a(),!0);return}let n=this._type(),i=t;if(n===`date`)i=e(t)||t;else if(n===`select`){let e=[...this._control()?.querySelectorAll(`[data-value]`)??[]].find(e=>e.getAttribute(`data-value`)===t);e&&(i=(e.textContent??``).trim())}else n===`number`&&this._grouping()===`indian`&&(i=r(t));this._showText(i,!1)}_readShown(){let e=this.querySelector(C);return e?{nodes:[...e.childNodes].map(e=>e.cloneNode(!0)),empty:e.hasAttribute(`data-wui-empty`)}:null}_restoreShown(e){let t=this.querySelector(C);t&&(t.replaceChildren(...e.nodes),t.toggleAttribute(`data-wui-empty`,e.empty))}_showText(e,t){let n=this.querySelector(C);n&&(n.textContent=e,n.toggleAttribute(`data-wui-empty`,t))}_setError(e){let t=M(this,E),n=this._control();t&&(t.textContent=e||``,t.hidden=!e),e?n?.setAttribute(`aria-invalid`,`true`):n?.removeAttribute(`aria-invalid`)}_setState(e){clearTimeout(this._savedTimer??void 0),this._savedTimer=null,e?this.setAttribute(`data-wui-state`,e):this.removeAttribute(`data-wui-state`)}_announce(e){let t=this.querySelector(D);t&&e&&(t.textContent=``,t.textContent=e)}_fire(e,t){this.dispatchEvent(new CustomEvent(e,{bubbles:!0,detail:t}))}_control(){let e=this.querySelector(T);return j(e)?e:null}_value(){return this.getAttribute(`value`)??``}_type(){let e=this.getAttribute(`type`);return x(e)?e:`text`}_grouping(){let e=this.getAttribute(`grouping`)??`none`;if(!n(e))throw Error(t(e));return e}};export{N as t};
@@ -1 +0,0 @@
1
- import{r as e}from"./dom-DMQu--xV.js";import{t}from"./elementBase-Cxeyx0tU.js";import{f as n}from"./formatters-CXMylefd.js";import{t as r}from"./iconGlyphs.g-DRNDTVOs.js";import{u as i}from"./nativeOverlay-MOABXAAh.js";import{n as a,t as o}from"./rtl-g7G8Bsib.js";import{r as s,t as c}from"./textStore-Dh5iyZSR.js";import{t as l}from"./lightbox.g-DDrycPou.js";var u=`a.wui-lightbox-item`,d=1,f=4,p=.5,m=2,h=50,g=6,_=300,v=300;function y(e){return Number.isFinite(e)?Math.min(f,Math.max(d,e)):d}function b(e,t,n,r){let i=(e,n)=>Math.max(0,(e*t-n)/2),a=i(r.width,n.width),o=i(r.height,n.height);return{x:Math.min(a,Math.max(-a,e.x)),y:Math.min(o,Math.max(-o,e.y))}}function x(e,t){return Math.abs(e)<h||Math.abs(e)<Math.abs(t)*1.5?0:e<0?1:-1}function S(e){let t=(String(e??``).split(/[?#]/)[0]??``).split(`/`).filter(Boolean).pop()??``;try{return decodeURIComponent(t)}catch{return t}}var C=()=>s(`lightbox`,l);function w(t,n,i){let a=e(`button`,{class:`u-action wui-lightbox-btn ${i}`,type:`button`,"aria-label":n,title:n});a.style.setProperty(`--wui-action-size`,`40px`);let o=r(t,{size:20});return a.replaceChildren(...o?[o]:[]),a}var T=class extends t{_ui;_index;_zoom;_pan;_pointers;_gesture;_lastTap;_returnTo;_release;_onClick;static get observedAttributes(){return[`open-index`]}constructor(){super(),this._ui=null,this._index=0,this._zoom=d,this._pan={x:0,y:0},this._pointers=/* @__PURE__ */ new Map,this._gesture=null,this._lastTap=-1/0,this._returnTo=null,this._release=null,this._onClick=e=>{if(e.defaultPrevented||e.button!==0||e.ctrlKey||e.metaKey||e.shiftKey||e.altKey)return;let t=e.target,n=t instanceof Element?t.closest(u):null;if(!(n instanceof HTMLAnchorElement)||!this.contains(n))return;let r=this._links().indexOf(n);r<0||(e.preventDefault(),this.open(r))}}get _view(){if(!this._ui)throw Error(`<wui-lightbox> viewer is not open.`);return this._ui}get download(){return this.hasAttribute(`download`)}set download(e){this.toggleAttribute(`download`,e===!0||e===``||e===`true`)}get label(){return this.getAttribute(`label`)||C().label}set label(e){this.setAttribute(`label`,String(e??``))}get layout(){return this.getAttribute(`layout`)===`single`?`single`:`gallery`}set layout(e){if(e===`single`)this.setAttribute(`layout`,`single`);else if(e===`gallery`||e===``)this.removeAttribute(`layout`);else throw Error(`<wui-lightbox> layout must be "gallery" or "single", received "${e}".`)}get isOpen(){return this._ui!==null}connectedCallback(){this.addEventListener(`click`,this._onClick),this._syncOpenIndex()}disconnectedCallback(){this.removeEventListener(`click`,this._onClick),this._teardown()}attributeChangedCallback(){this.isConnected&&this._syncOpenIndex()}_syncOpenIndex(){let e=this.getAttribute(`open-index`);e===null?this.close():this.open(Number(e))}_links(){return[...this.querySelectorAll(u)].filter(e=>e instanceof HTMLAnchorElement)}_items(){return this._links().map(e=>{let t=e.getAttribute(`href`)??``;return{link:e,src:t,alt:e.querySelector(`img`)?.getAttribute(`alt`)??``,caption:e.dataset.caption??``,name:e.dataset.name||S(t)}})}open(e=0){let t=this._items();if(!t.length)return!1;if(!this._ui){let t=document.activeElement;this._returnTo=t instanceof HTMLElement||t instanceof SVGElement?t:null,this._build(),this.dispatchEvent(new CustomEvent(`wui-lightbox:open`,{bubbles:!0,detail:{index:e}}))}return this._show(e,t),!0}close(){if(!this._ui)return;let e=this._index,t=this._links()[e]??this._returnTo;this._teardown(),t?.isConnected&&t.focus(),this._returnTo=null,this.dispatchEvent(new CustomEvent(`wui-lightbox:close`,{bubbles:!0,detail:{index:e}}))}_teardown(){this._ui&&(this._release?.(),this._release=null,this._ui.root.open&&this._ui.root.close(),this._ui.root.remove(),this._ui=null,this._pointers.clear(),this._gesture=null)}_build(){let t=e(`dialog`,{class:`wui-lightbox-overlay`,role:`dialog`,"aria-label":this.label,tabindex:`-1`}),n=e(`div`,{class:`wui-lightbox-bar`}),a=e(`span`,{class:`wui-lightbox-count`,"aria-live":`polite`}),o=e(`div`,{class:`wui-lightbox-tools`}),s=w(`zoom-out`,C().zoomOutLabel,`wui-lightbox-zoom-out`),c=w(`zoom-in`,C().zoomInLabel,`wui-lightbox-zoom-in`),l=e(`a`,{class:`u-action wui-lightbox-btn wui-lightbox-download`,"aria-label":C().downloadLabel,title:C().downloadLabel});l.style.setProperty(`--wui-action-size`,`40px`);let u=r(`download`,{size:20});l.replaceChildren(...u?[u]:[]),l.hidden=!this.download;let d=w(`x`,C().closeLabel,`wui-lightbox-close`);o.append(s,c,l,d),n.append(a,o);let f=e(`div`,{class:`wui-lightbox-stage`}),m=w(`chevron-left`,C().previousImageLabel,`wui-lightbox-nav wui-lightbox-prev`),h=w(`chevron-right`,C().nextImageLabel,`wui-lightbox-nav wui-lightbox-next`),g=e(`img`,{class:`wui-lightbox-image`,decoding:`async`,draggable:`false`,alt:``}),_=e(`p`,{class:`wui-lightbox-status`,role:`status`});f.append(g,_,m,h);let v=e(`p`,{class:`wui-lightbox-caption`});t.append(n,f,v);let y={root:t,count:a,zoomOut:s,zoomIn:c,download:l,close:d,stage:f,prev:m,next:h,image:g,status:_,caption:v};this._ui=y,d.addEventListener(`click`,()=>this.close()),m.addEventListener(`click`,()=>this.step(-1)),h.addEventListener(`click`,()=>this.step(1)),s.addEventListener(`click`,()=>this._setZoom(this._zoom-p)),c.addEventListener(`click`,()=>this._setZoom(this._zoom+p)),t.addEventListener(`keydown`,e=>this._onKeyDown(e)),f.addEventListener(`pointerdown`,e=>this._onPointerDown(e)),f.addEventListener(`pointermove`,e=>this._onPointerMove(e)),f.addEventListener(`pointerup`,e=>this._onPointerEnd(e,!0)),f.addEventListener(`pointercancel`,e=>this._onPointerEnd(e,!1)),f.addEventListener(`wheel`,e=>this._onWheel(e),{passive:!1}),g.addEventListener(`load`,()=>{this._ui===y&&(_.textContent=``,f.removeAttribute(`aria-busy`),g.hidden=!1,this._applyTransform())}),g.addEventListener(`error`,()=>{this._ui===y&&(f.removeAttribute(`aria-busy`),g.hidden=!0,_.textContent=C().imageFailedMessage)}),this.append(t),this._release=i(t,{escape:!0,backdrop:null,focus:`panel`,onRequestClose:()=>this.close()})}step(e){if(!this._ui||!e)return;let t=this._items();t.length<2||this._show((this._index+e+t.length)%t.length,t)}_show(e,t){let r=this._view,i=Math.min(t.length-1,Math.max(0,Math.trunc(Number(e))||0)),a=t[i];if(!a)throw Error(`<wui-lightbox> image missing.`);let o=i!==this._index||!r.image.getAttribute(`src`);if(this._index=i,this._zoom=d,this._pan={x:0,y:0},r.count.textContent=c(C().countText,{position:n(i+1,{decimals:0}),total:n(t.length,{decimals:0})}),r.caption.textContent=a.caption,r.caption.hidden=!a.caption,r.download.href=a.src,r.download.setAttribute(`download`,a.name),r.prev.hidden=r.next.hidden=t.length<2,r.stage.setAttribute(`aria-busy`,`true`),r.status.textContent=``,r.image.hidden=!1,r.image.alt=a.alt||a.caption,r.image.src=a.src,this._applyTransform(),this._syncZoomButtons(),t.length>1){let e=t[(i+1)%t.length],n=t[(i-1+t.length)%t.length];if(!e||!n)throw Error(`<wui-lightbox> neighbour image missing.`);for(let t of[e,n])new Image().src=t.src}o&&this.dispatchEvent(new CustomEvent(`wui-lightbox:change`,{bubbles:!0,detail:{index:i}}))}_syncZoomButtons(){let e=this._view;e.zoomOut.disabled=this._zoom<=d,e.zoomIn.disabled=this._zoom>=f;let t=document.activeElement;(t===e.zoomOut||t===e.zoomIn)&&t instanceof HTMLButtonElement&&t.disabled&&e.close.focus()}_setZoom(e){this._ui&&(this._zoom=y(e),this._pan=this._clampedPan(this._pan),this._applyTransform(),this._syncZoomButtons())}_clampedPan(e){let{stage:t,image:n}=this._view;return b(e,this._zoom,{width:t.clientWidth,height:t.clientHeight},{width:n.offsetWidth,height:n.offsetHeight})}_applyTransform(){let{image:e,stage:t}=this._view;e.style.transform=`translate(${this._pan.x}px, ${this._pan.y}px) scale(${this._zoom})`,t.classList.toggle(`wui-lightbox-zoomed`,this._zoom>d)}_onKeyDown(e){let t=a(e.key,o(this));if(t===`ArrowLeft`||t===`ArrowRight`)e.preventDefault(),this.step(t===`ArrowRight`?1:-1);else if(e.key===`Home`||e.key===`End`){e.preventDefault();let t=this._items();this._show(e.key===`Home`?0:t.length-1,t)}else e.key===`+`||e.key===`=`?(e.preventDefault(),this._setZoom(this._zoom+p)):e.key===`-`?(e.preventDefault(),this._setZoom(this._zoom-p)):e.key===`0`&&(e.preventDefault(),this._setZoom(d))}_onWheel(e){e.preventDefault(),this._setZoom(this._zoom*(e.deltaY<0?1.15:1/1.15))}_onPointerDown(e){let t=e.target;if(t instanceof Element&&t.closest(`.wui-lightbox-nav`))return;let n=this._view;if(n.stage.setPointerCapture?.(e.pointerId),this._pointers.set(e.pointerId,{x:e.clientX,y:e.clientY}),this._pointers.size===2){let e=[...this._pointers.values()],t=e[0],n=e[1];if(!t||!n)throw Error(`<wui-lightbox> pinch needs two pointers.`);this._gesture={kind:`pinch`,distance:Math.hypot(t.x-n.x,t.y-n.y)||1,zoom:this._zoom}}else this._pointers.size===1&&(this._gesture={kind:`drag`,startX:e.clientX,startY:e.clientY,startTime:e.timeStamp,pan:{...this._pan},onImage:e.target===n.image,moved:!1})}_onPointerMove(e){let t=this._gesture;if(t&&this._pointers.has(e.pointerId)){if(this._pointers.set(e.pointerId,{x:e.clientX,y:e.clientY}),t.kind===`pinch`&&this._pointers.size===2){let e=[...this._pointers.values()],n=e[0],r=e[1];if(!n||!r)throw Error(`<wui-lightbox> pinch needs two pointers.`);this._setZoom(t.zoom*Math.hypot(n.x-r.x,n.y-r.y)/t.distance)}else if(t.kind===`drag`){let n=e.clientX-t.startX,r=e.clientY-t.startY;Math.hypot(n,r)>g&&(t.moved=!0),this._zoom>d&&(this._pan=this._clampedPan({x:t.pan.x+n,y:t.pan.y+r}),this._view.stage.classList.add(`is-dragging`),this._applyTransform())}}}_onPointerEnd(e,t){let n=this._gesture;if(this._pointers.delete(e.pointerId),this._ui?.stage.classList.remove(`is-dragging`),!n)return;if(n.kind===`pinch`){this._pointers.size<2&&(this._gesture=null);return}if(this._gesture=null,!t)return;let r=e.clientX-n.startX,i=e.clientY-n.startY;n.moved?this._zoom===d&&this.step(x(r,i)):e.timeStamp-n.startTime>_||(n.onImage?e.timeStamp-this._lastTap<v?(this._lastTap=-1/0,this._setZoom(this._zoom>d?d:m)):this._lastTap=e.timeStamp:this.close())}};export{T as t};
@@ -1 +0,0 @@
1
- import{t as e}from"./elementBase-Cxeyx0tU.js";import{n as t,r as n,t as r}from"./fieldState-D-zQcXUS.js";import{f as i}from"./formatters-CXMylefd.js";import{t as a}from"./hasOwn-CJsplJ62.js";import{n as o}from"./imeSafeEnter-DeO_3lXy.js";import{n as s}from"./listboxKeyNav-CNso9shL.js";import{i as c,n as l,r as u,t as d}from"./mentionText-BJsw_opZ.js";import{a as f,l as p,s as m}from"./nativeOverlay-MOABXAAh.js";import{t as h}from"./serverHtml-BC6tAyAl.js";import{m as g}from"./wuiHttp-8CYWEbRz.js";import{n as _,r as v,t as y}from"./textStore-Dh5iyZSR.js";import{t as b}from"./mentionInput.g-DJo6d2Gm.js";var x=8,S=40,C=()=>v(`mentionInput`,b),w=`[data-wui-control]`,T=`[data-wui-field]`,E=`[data-wui-menu]`,D=`[data-wui-live]`,O=0,k=e=>!!(e&&d.test(String(e.value??``))&&l(e.label)!==``);function A(e,t){let n=e.getAttribute(`size`);t.classList.toggle(`wui-input-sm`,n===`sm`),t.classList.toggle(`wui-input-lg`,n===`lg`),t.classList.toggle(`wui-input-xl`,n===`xl`)}function j(e,t){t.classList.toggle(`wui-input-underline`,e.classList.contains(`wui-input-underline`))}function M(e,n){n.readOnly=t(e)||e.hasAttribute(`loading`)}function N(e){let t=e.ownerDocument;e.id||=`wui-mention-${++O}`;let n=t.createElement(`textarea`);n.id=`${e.id}-text`,n.className=`form-control wui-mention-input-text`,n.rows=Number(e.getAttribute(`rows`))>0?Number(e.getAttribute(`rows`)):3,n.setAttribute(`data-wui-control`,``),n.setAttribute(`aria-autocomplete`,`list`),n.setAttribute(`aria-controls`,`${e.id}-people`);let r=e.getAttribute(`label`);r&&n.setAttribute(`aria-label`,r);let i=e.getAttribute(`placeholder`);i&&(n.placeholder=i);for(let t of[`aria-describedby`,`aria-invalid`]){let r=e.getAttribute(t);r&&n.setAttribute(t,r)}n.disabled=e.hasAttribute(`disabled`),M(e,n),A(e,n),j(e,n),e.appendChild(n);let a=e.getAttribute(`name`);if(a){let n=t.createElement(`input`);n.type=`hidden`,n.name=a,n.value=e.getAttribute(`value`)??``,n.setAttribute(`data-wui-field`,``),e.appendChild(n)}let o=t.createElement(`div`);o.className=`wui-mention-menu`,o.id=`${e.id}-people`,o.setAttribute(`role`,`listbox`),o.setAttribute(`aria-label`,e.getAttribute(`people-label`)??C().listNameLabel),o.setAttribute(`data-wui-menu`,``),o.setAttribute(`popover`,`manual`),e.appendChild(o);let s=t.createElement(`span`);s.className=`visually-hidden`,s.setAttribute(`data-wui-live`,``),s.setAttribute(`aria-live`,`polite`),s.setAttribute(`aria-atomic`,`true`),e.appendChild(s)}var P=class extends e{_wired;_pendingValue;_text;_mentions;_peopleProp;_declared;_loading;_searchFailed;_query;_results;_active;_timer;_searchSeq;_lastSearch;_abort;_onMenuDown;static get observedAttributes(){return[`disabled`,`readonly`,`loading`,`size`,`class`,`aria-invalid`,`aria-describedby`]}constructor(){super(),this._wired=!1,this._text=``,this._mentions=[],this._peopleProp=null,this._declared=null,this._loading=!1,this._searchFailed=!1,this._query=null,this._results=[],this._active=-1,this._timer=void 0,this._searchSeq=0,this._abort=null,this._onInput=this._onInput.bind(this),this._onKeyDown=this._onKeyDown.bind(this),this._onCaret=this._onCaret.bind(this),this._onFocusOut=this._onFocusOut.bind(this),this._onMenuDown=e=>e.preventDefault(),this._onMenuClick=this._onMenuClick.bind(this)}connectedCallback(){for(let e of[`people`,`loading`,`searchFailed`,`value`])if(a(this,e)){let t=Reflect.get(this,e);Reflect.deleteProperty(this,e),Reflect.set(this,e,t)}if(this._wired)return;this._wired=!0,this.querySelector(w)||N(this);let e=this._requireControl();j(this,e);let t=this.querySelector(T)?.value??this.getAttribute(`value`)??``;this._pendingValue===void 0?this._load(t):this._load(this._pendingValue),this._pendingValue=void 0,this._syncState(),e.addEventListener(`input`,this._onInput),e.addEventListener(`keydown`,this._onKeyDown),e.addEventListener(`click`,this._onCaret),e.addEventListener(`keyup`,this._onCaret),this.addEventListener(`focusout`,this._onFocusOut);let n=this._requireMenu();n.addEventListener(`mousedown`,this._onMenuDown),n.addEventListener(`click`,this._onMenuClick),n.addEventListener(`mousemove`,e=>{let t=e.target instanceof Element?e.target.closest(`.wui-mention-option`):null;t&&Number(t.dataset.index)!==this._active&&this._setActive(Number(t.dataset.index),{reveal:!1})})}disconnectedCallback(){this._close(),clearTimeout(this._timer),this._abort?.abort()}attributeChangedCallback(e,t,n){let r=this._control();r&&(e===`disabled`?(r.disabled=n!==null,n!==null&&this._close()):e===`readonly`?(M(this,r),n!==null&&this._close(),this._syncState()):e===`loading`?(M(this,r),this._syncState(),this._query!==null&&this._renderMenu()):e===`size`?A(this,r):e===`class`?j(this,r):n===null?r.removeAttribute(e):r.setAttribute(e,n))}get value(){return c(this._text,this._mentions)}set value(e){let t=e==null?``:String(e);this._wired?t!==this.value&&this._load(t):this._pendingValue=t}get mentions(){let e=/* @__PURE__ */ new Set,t=[];for(let n of[...this._mentions].sort((e,t)=>e.start-t.start))e.has(n.id)||(e.add(n.id),t.push({id:n.id,label:n.label}));return t}get people(){return this._peopleProp?this._peopleProp:(this._declared||=[...this.querySelectorAll(`[data-wui-people] > wui-option`)].map(e=>({value:e.getAttribute(`value`)??``,label:(e.textContent??``).trim(),description:e.getAttribute(`data-description`)||void 0,src:e.getAttribute(`data-src`)||void 0})),this._declared)}set people(e){this._peopleProp=Array.isArray(e)?e.filter(k):[],this._searchFailed=!1,(this._isOpen()||this._query!==null)&&this._refresh()}get searchFailed(){return this._searchFailed}set searchFailed(e){this._searchFailed=!!e,this._query!==null&&this._renderMenu()}get loading(){return this._loading||this.hasAttribute(`loading`)}set loading(e){this._loading=!!e,this.toggleAttribute(`loading`,this._loading),this._query!==null&&this._renderMenu()}focus(e){this._control()?.focus(e)}clear(){this._load(``),this._emit()}_control(){return this.querySelector(w)}_menu(){return this.querySelector(E)}_requireControl(){let e=this._control();if(!e)throw Error(`<wui-mention-input> has no text box.`);return e}_requireMenu(){let e=this._menu();if(!e)throw Error(`<wui-mention-input> has no people list.`);return e}_load(e){let{text:t,mentions:n}=u(e);this._text=t,this._mentions=n;let r=this._control();r&&(r.defaultValue=t,r.value=t),this._syncField(),this._close()}_syncField(){let e=this.querySelector(T);e&&(e.value=this.value)}_emit(){this._syncField(),this.dispatchEvent(new CustomEvent(`change`,{bubbles:!0,detail:{value:this.value,mentions:this.mentions}}))}_onInput(){let e=this._requireControl(),t=e.value,n=this._text,r=t.length-n.length,i=Math.min(n.length,t.length),a=Math.max(0,Math.min(i,e.selectionEnd-Math.max(r,0))),o=0;for(;o<a&&n[o]===t[o];)o++;let s=0;for(;s<i-o&&n[n.length-1-s]===t[t.length-1-s];)s++;let c=n.length-s;this._mentions=this._mentions.filter(e=>e.end<=o||e.start>=c).map(e=>e.start>=c?{...e,start:e.start+r,end:e.end+r}:e),this._text=t,this._emit(),this._onCaret()}_onCaret(e){if(e instanceof KeyboardEvent&&e.type===`keyup`&&[`ArrowUp`,`ArrowDown`,`Enter`,`Tab`,`Escape`].includes(e.key))return;let t=this._queryAtCaret();t?this._query&&t.text===this._query.text&&t.start===this._query.start||(this._query=t,this._refresh()):this._close()}_queryAtCaret(){let e=this._control();if(!e||r(this)||e.selectionStart!==e.selectionEnd)return null;let t=e.selectionStart,n=this._text,i=n.lastIndexOf(`@`,t-1);if(i<0||i>0&&!/[\s([{"'“‘]/.test(n.charAt(i-1)))return null;let a=n.slice(i+1,t);return a.length>40||/[\n@]/.test(a)||/^\s/.test(a)||/\s{2}/.test(a)||this._mentions.some(e=>i>=e.start&&i<e.end)?null:{start:i,end:t,text:a}}_refresh(){if(!this._query)return;let e=this.hasAttribute(`remote`)||this.hasAttribute(`source`);if(e&&this._query.text.length<this._minChars()){this._results=[],this._close();return}e&&!this._answered(this._query.text)&&this._search(this._query.text);let t=this._query.text.toLowerCase(),n=e?this.people:this.people.filter(e=>l(e.label).toLowerCase().includes(t));this._results=n.slice(0,8),this._renderMenu()}_answered(e){return this._lastSearch===e}_minChars(){let e=this.getAttribute(`min-chars`),t=e==null||e===``?1:Number(e);return Number.isFinite(t)&&t>=0?t:1}_debounce(){let e=this.getAttribute(`debounce`),t=e==null||e===``?250:Number(e);return Number.isFinite(t)&&t>=0?t:250}_search(e){this._lastSearch=e,clearTimeout(this._timer);let t=++this._searchSeq;this._timer=setTimeout(()=>{let n=this.getAttribute(`source`);n?this._fetchPeople(n,e,t):this.dispatchEvent(new CustomEvent(`search`,{bubbles:!0,detail:{query:e,seq:t}}))},this._debounce())}async _fetchPeople(e,t,n){this._abort?.abort();let r=new AbortController;this._abort=r,this.loading=!0;let i=`${e}${e.includes(`?`)?`&`:`?`}q=${encodeURIComponent(t)}`,a=await g(i,{signal:r.signal});if(n!==this._searchSeq)return;if(this._abort=null,!a.ok){this._peopleProp=[],this._searchFailed=!0,this.loading=!1,this._refresh();return}this._searchFailed=!1;let o=h(a.html);this._peopleProp=[...o.querySelectorAll(`wui-option`)].map(e=>({value:e.getAttribute(`value`)??``,label:(e.textContent??``).trim(),description:e.getAttribute(`data-description`)||void 0,src:e.getAttribute(`data-src`)||void 0})).filter(k),this.loading=!1,this._refresh()}_isOpen(){let e=this._menu();return e!==null&&m(e)}_renderMenu(){let e=this._menu(),t=this._control();if(!e||!t||!this._query)return;this._syncState();let n=this.ownerDocument;if(e.replaceChildren(),this._results.forEach((t,r)=>{let i=n.createElement(`div`);if(i.className=`wui-mention-option`,i.id=`${e.id}-${r}`,i.setAttribute(`role`,`option`),i.setAttribute(`aria-selected`,`false`),i.dataset.index=String(r),t.src){let e=n.createElement(`img`);e.className=`wui-mention-option-photo`,e.src=t.src,e.alt=``,i.appendChild(e)}let a=n.createElement(`span`);a.className=`wui-mention-option-text`;let o=n.createElement(`span`);if(o.className=`wui-mention-option-label`,o.textContent=l(t.label),a.appendChild(o),t.description){let e=n.createElement(`span`);e.className=`wui-mention-option-description`,e.textContent=String(t.description),a.appendChild(e)}i.appendChild(a),e.appendChild(i)}),!this._results.length){let t=n.createElement(`div`);t.className=`wui-mention-empty`,t.textContent=this.loading?C().searchingLabel:this._searchFailed?C().searchFailedMessage:`${C().noMatchLabel} “${this._query.text}”`,e.appendChild(t)}p(t,e,{mode:`manual`}),this._setActive(this._results.length?0:-1),this.loading||this._announce(this._results.length?_(C(),`foundText`,this._results.length,{count:i(this._results.length,{decimals:0})}):this._searchFailed?C().searchFailedMessage:`${C().noMatchLabel}.`)}_syncState(){let e=this._control();e&&n(this,e)}_close(){this._query=null,this._lastSearch=void 0,clearTimeout(this._timer);let e=this._menu();if(e){let t=m(e);f(e),t&&e.replaceChildren()}this._active=-1,this._control()?.removeAttribute(`aria-activedescendant`)}_setActive(e,{reveal:t=!0}={}){let n=this._requireMenu(),r=[...n.querySelectorAll(`.wui-mention-option`)];this._active=e>=0&&e<r.length?e:-1;let i=this._active>=0?r[this._active]??null:null;for(let e of r)e.setAttribute(`aria-selected`,e===i?`true`:`false`);s(n,i),i?(t&&i.scrollIntoView?.({block:`nearest`}),this._requireControl().setAttribute(`aria-activedescendant`,i.id)):this._requireControl().removeAttribute(`aria-activedescendant`)}_onKeyDown(e){if(this._isOpen()&&this._query){if(e.key===`ArrowDown`||e.key===`ArrowUp`){e.preventDefault();let t=this._results.length;if(!t)return;let n=e.key===`ArrowDown`?1:-1;this._setActive((this._active+n+t)%t);return}if((o(e)||e.key===`Tab`)&&!e.shiftKey&&!e.ctrlKey&&!e.metaKey&&this._active>=0){e.preventDefault(),this._pick(this._results[this._active]);return}if(e.key===`Escape`){e.preventDefault(),e.stopPropagation(),this._close();return}}o(e)&&(e.ctrlKey||e.metaKey)?(e.preventDefault(),this.dispatchEvent(new CustomEvent(`wui:mention-input:submit`,{bubbles:!0,detail:{value:this.value}}))):e.key===`Backspace`&&this._removeWholeMention(e)}_removeWholeMention(e){let t=this._requireControl();if(t.selectionStart!==t.selectionEnd)return;let n=t.selectionStart,r=this._mentions.find(e=>e.end===n);r&&(e.preventDefault(),this._replace(r.start,r.end,``))}_onMenuClick(e){let t=e.target instanceof Element?e.target.closest(`.wui-mention-option`):null;t&&this._pick(this._results[Number(t.dataset.index)])}_pick(e){if(!e||!this._query)return;let t=l(e.label),{start:n,end:r}=this._query,i=this._text.slice(r),a=`@${t}${/^\s/.test(i)?``:` `}`;this._replace(n,r,a,{id:String(e.value),label:t}),this._announce(y(C().mentioned,{label:t}))}_replace(e,t,n,r){let i=this._requireControl(),a=n.length-(t-e);this._mentions=this._mentions.filter(n=>n.end<=e||n.start>=t).map(e=>e.start>=t?{...e,start:e.start+a,end:e.end+a}:e),r&&this._mentions.push({start:e,end:e+1+r.label.length,id:r.id,label:r.label}),this._text=this._text.slice(0,e)+n+this._text.slice(t),i.value=this._text;let o=e+n.length;i.setSelectionRange(o,o),this._close(),i.focus(),this._emit()}_onFocusOut(e){e.relatedTarget instanceof Node&&this.contains(e.relatedTarget)||this._close()}_announce(e){let t=this.querySelector(D);t&&(t.textContent=``,t.textContent=e)}};export{x as n,P as r,S as t};
@@ -1 +0,0 @@
1
- import{i as e}from"./dom-DMQu--xV.js";import{r as t}from"./textStore-Dh5iyZSR.js";import{t as n}from"./formatters.g-BNAu1PMe.js";import{a as r,s as i,t as a}from"./zone-BR02ZkHF.js";var o=`INR`,s=Object.freeze({INR:`₹`,USD:`$`,EUR:`€`,GBP:`£`,JPY:`¥`}),c=e=>typeof e==`string`&&/^[A-Z]{3}$/.test(e),l=(e=`INR`)=>s[e]??`${e} `,u=[`number`,`currency`,`percent`,`compact`,`duration`,`date`],d=[`INR`,`USD`,`EUR`,`GBP`],f=[`rupees`,`paise`],p=[`ms`,`s`,`min`,`h`],m=[`day`,`month`,`year`,`datetime`,`time`];function h(e){return f.some(t=>t===e)}var g=()=>t(`formatters`,n),_=()=>g().emptyValueLabel,v=`−`,y=[`janShortLabel`,`febShortLabel`,`marShortLabel`,`aprShortLabel`,`mayShortLabel`,`junShortLabel`,`julShortLabel`,`augShortLabel`,`sepShortLabel`,`octShortLabel`,`novShortLabel`,`decShortLabel`],b=[`januaryLabel`,`februaryLabel`,`marchLabel`,`aprilLabel`,`mayLabel`,`juneLabel`,`julyLabel`,`augustLabel`,`septemberLabel`,`octoberLabel`,`novemberLabel`,`decemberLabel`],x={short:[`sunShortLabel`,`monShortLabel`,`tueShortLabel`,`wedShortLabel`,`thuShortLabel`,`friShortLabel`,`satShortLabel`],long:[`sundayLabel`,`mondayLabel`,`tuesdayLabel`,`wednesdayLabel`,`thursdayLabel`,`fridayLabel`,`saturdayLabel`],min:[`sunMinLabel`,`monMinLabel`,`tueMinLabel`,`wedMinLabel`,`thuMinLabel`,`friMinLabel`,`satMinLabel`]},S=(t,n)=>g()[e(t[n],`no date name at index ${n}`)],C=e=>S(y,e),w=e=>S(b,e);function T(e,t){return S(x[t],e)}var E=(t,n)=>e(t[n],`no compact unit at index ${n}`),D=[[1e7,`Cr`],[1e5,`L`],[1e3,`K`]],O=[[1e9,`B`],[1e6,`M`],[1e3,`K`]],k=e=>!e||e===`INR`?`en-IN`:`en-US`,A=(e,t)=>typeof e==`number`&&Number.isInteger(e)&&e>=0&&e<=20?e:t,j=/* @__PURE__ */ new Map,M=(e,t=`en-IN`)=>{let n=`${t}:${e}`,r=j.get(n);return r||(r=new Intl.NumberFormat(t,{minimumFractionDigits:0,maximumFractionDigits:e}),j.set(n,r)),r},N=/* @__PURE__ */ new Map,P=(e,t=`en-IN`)=>{let n=`${t}:${e}`,r=N.get(n);return r||(r=new Intl.NumberFormat(t,{minimumFractionDigits:e,maximumFractionDigits:e}),N.set(n,r)),r},F=e=>typeof e==`number`&&Number.isFinite(e),I=e=>e<0&&!Object.is(Math.abs(e),0)?v:``;function L(e){if(!Number.isInteger(e))throw Error(`A paise amount must be a whole number, got ${e}`);let t=BigInt(Math.abs(e)).toString().padStart(3,`0`);return`${e<0?`-`:``}${t.slice(0,-2)}.${t.slice(-2)}`}var R=(e,t)=>t===`paise`?Number(L(e)):e,z=2,B=(e,t,n)=>{let r=Math.min(t,z),i=10n**BigInt(z-r),a=(BigInt(L(e).replace(`.`,``))+i/2n)/i,o=10n**BigInt(r),s=P(0,n).format(a/o);return t===0?s:`${s}.${(a%o).toString().padStart(r,`0`)}${`0`.repeat(t-r)}`};function V(e,{decimals:t}={}){if(!F(e))return _();let n=M(A(t,2)).format(Math.abs(e));return n===`0`?`0`:I(e)+n}function H(e,t){if(!t?.currency)throw TypeError(`[@webority/ui-elements] formatCurrency needs options.currency, an ISO 4217 code such as "INR".`);if(!F(e))return _();let{unit:n=`rupees`,decimals:r,currency:i}=t,a=A(r,0),o=k(i),s=n===`paise`?B(Math.abs(e),a,o):P(a,o).format(Math.abs(e));return(Number(s.replace(/,/g,``))===0?``:I(e))+l(i)+s}var U=e=>e>0&&e<.1?Math.min(20,1-Math.floor(Math.log10(e))):2;function W(e,{currency:t,unit:n=`rupees`}={}){if(!F(e))return _();let r=t?R(e,n):e,i=t?l(t):``,a=t?k(t):`en-IN`,o=a===`en-IN`?D:O,s=Math.abs(r),c=o.findIndex(([e])=>s>=e);if(c===-1){let e=M(U(s),a).format(s);if(e!==`1,000`)return(e===`0`?``:I(r))+i+e;c=o.length-1}let[u,d]=E(o,c),f=s/u,p=f>=100?0:f>=10?1:2,m=Number(f.toFixed(p));return m>=100&&c>0&&(--c,[u,d]=E(o,c),f=s/u,p=f>=100?0:f>=10?1:2,m=Number(f.toFixed(p))),`${I(r)}${i}${M(p,a).format(m)} ${d}`}function G(e,{decimals:t}={}){return F(e)?`${V(e*100,{decimals:A(t,1)})}%`:_()}var K={ms:1,s:1e3,min:6e4,h:36e5};function q(e,{unit:t=`s`}={}){if(!F(e))return _();let n=K[t]??1e3,r=Math.abs(e*n),i=I(e);if(Math.round(r)<1e3)return`${i}${M(0).format(r)} ms`;let a=r/1e3;if(a<10)return`${i}${M(1).format(a)}s`;let o=Math.round(a);if(o<60)return`${i}${o}s`;let s=e=>String(e).padStart(2,`0`),c=Math.floor(o/60);if(c<60)return`${i}${c}m ${s(o%60)}s`;let l=Math.floor(c/60);return`${i}${M(0).format(l)}h ${s(c%60)}m`}function J(e,t=a){if(e instanceof Date)return e.getTime();if(F(e))return e;if(typeof e!=`string`)return NaN;let n=/^(\d{4})-(\d{2})-(\d{2})$/.exec(e.trim());if(n){let[e,i,a]=[Number(n[1]),Number(n[2]),Number(n[3])],o=new Date(Date.UTC(2e3,i-1,a));return o.setUTCFullYear(e),o.getUTCFullYear()===e&&o.getUTCMonth()===i-1&&o.getUTCDate()===a?r(o.getTime(),t):NaN}return Date.parse(e)}function Y(e,t=a){let{year:n,month:r,day:o,hour:s,minute:c}=i(e,t);return{year:n,month:r,day:o,hour:s,minute:c}}function X(e,{pattern:t=`day`,timeZone:n=a}={}){let r=J(e,n);if(!Number.isFinite(r))return _();let i=Y(r,n),o=e=>String(e).padStart(2,`0`),s=`${o(i.day)}-${C(i.month)}-${i.year}`,c=`${o(i.hour)}:${o(i.minute)}`;switch(t){case`month`:return`${C(i.month)}-${i.year}`;case`year`:return String(i.year);case`datetime`:return`${s} ${c}`;case`time`:return c;default:return s}}function Z(e,t){if(e==null||e===``)return _();let n=t?.style;if(n===`date`)return X(e,t);if(typeof e!=`number`)return String(e);switch(n){case`currency`:return H(e,{...t,currency:t?.currency??``});case`percent`:return G(e,t);case`compact`:return W(e,t);case`duration`:return q(e,t);default:return V(e,t)}}function Q(e,{timeZone:t=a}={}){let n=J(e);if(!Number.isFinite(n))return _();let r=Object.fromEntries(ee(t).formatToParts(n).map(e=>[e.type,e.value])),i=r.dayPeriod;if(i===void 0)throw Error(`Intl returned no day period for a 12-hour clock`);return`${r.day}-${C(Number(r.month)-1)}-${r.year}, ${r.hour}:${r.minute} ${i.toUpperCase()}`}var $=/* @__PURE__ */ new Map;function ee(e){let t=$.get(e);return t||(t=new Intl.DateTimeFormat(`en-IN`,{day:`2-digit`,month:`numeric`,year:`numeric`,hour:`numeric`,minute:`2-digit`,hour12:!0,timeZone:e}),$.set(e,t)),t}function te(e=a){return new Intl.DateTimeFormat(`en-IN`,{timeZone:e,timeZoneName:`short`}).formatToParts(/* @__PURE__ */ new Date).find(e=>e.type===`timeZoneName`)?.value??e}export{l as C,o as S,w as _,f as a,T as b,H as c,q as d,V as f,C as g,h,u as i,X as l,Z as m,m as n,_ as o,G as p,p as r,W as s,d as t,Q as u,te as v,c as w,s as x,J as y};
@@ -1 +0,0 @@
1
- var e={aprShortLabel:`Apr`,aprilLabel:`April`,augShortLabel:`Aug`,augustLabel:`August`,decShortLabel:`Dec`,decemberLabel:`December`,emptyValueLabel:`-`,febShortLabel:`Feb`,februaryLabel:`February`,friMinLabel:`Fr`,friShortLabel:`Fri`,fridayLabel:`Friday`,janShortLabel:`Jan`,januaryLabel:`January`,julShortLabel:`Jul`,julyLabel:`July`,junShortLabel:`Jun`,juneLabel:`June`,marShortLabel:`Mar`,marchLabel:`March`,mayLabel:`May`,mayShortLabel:`May`,monMinLabel:`Mo`,monShortLabel:`Mon`,mondayLabel:`Monday`,novShortLabel:`Nov`,novemberLabel:`November`,octShortLabel:`Oct`,octoberLabel:`October`,satMinLabel:`Sa`,satShortLabel:`Sat`,saturdayLabel:`Saturday`,sepShortLabel:`Sep`,septemberLabel:`September`,sunMinLabel:`Su`,sunShortLabel:`Sun`,sundayLabel:`Sunday`,thuMinLabel:`Th`,thuShortLabel:`Thu`,thursdayLabel:`Thursday`,tueMinLabel:`Tu`,tueShortLabel:`Tue`,tuesdayLabel:`Tuesday`,wedMinLabel:`We`,wedShortLabel:`Wed`,wednesdayLabel:`Wednesday`};export{e as t};
@@ -1 +0,0 @@
1
- import{i as e}from"./calendarMath-CeawKuZQ.js";import{n as t,r as n,t as r}from"./digitGrouping-CCPI3HK3.js";import{o as i}from"./formatters-CXMylefd.js";var a=Object.freeze([`text`,`number`,`select`,`date`,`textarea`]),o=2e3;function s(a,{type:o=`text`,options:s,placeholder:c,grouping:l=`none`}={}){if(!n(l))throw Error(t(l));let u=a==null?``:String(a);if(u===``)return{text:c||i(),empty:!0};if(o===`date`)return{text:e(u)||u,empty:!1};if(o===`select`){let e=s?.find(e=>String(e.value)===u);return{text:typeof e?.label==`string`?e.label:u,empty:!1}}return o===`number`&&l===`indian`?{text:r(u),empty:!1}:{text:u,empty:!1}}export{a as n,s as r,o as t};
@@ -1 +0,0 @@
1
- import{n as e,t}from"./devWarn-DXdRWZs3.js";import{t as n}from"./elementBase-Cxeyx0tU.js";import{m as r}from"./formatters-CXMylefd.js";import{t as i}from"./hasOwn-CJsplJ62.js";import{c as a,d as o,f as s,m as c,p as l,s as u,u as d}from"./kanbanModel-BQWAC9vs.js";import{n as f,t as p}from"./rtl-g7G8Bsib.js";import{t as m}from"./serverHtml-BC6tAyAl.js";import{m as h}from"./wuiHttp-8CYWEbRz.js";import{n as g,r as _,t as v}from"./textStore-Dh5iyZSR.js";import{t as y}from"./httpFailure.g-DjZzGxPj.js";import{t as b}from"./kanban.g-dtKYyIpr.js";var x=()=>_(`kanban`,b),S=()=>({forbidden:x().forbiddenMessage,networkCheck:_(`httpFailure`,y).networkCheckText,client:x().clientMessage,validation:x().clientMessage,server:x().serverMessage,network:x().networkMessage}),C=`[data-wui-column]`,w=`[data-wui-body]`,T=`[data-wui-card]`,E=`[data-wui-count]`,D=`[data-wui-summary]`,ee=`[data-wui-empty]`,O=`[data-wui-drop-note]`,k=`[data-wui-live]`,A=`[data-wui-help]`,j=`[data-wui-switch]`,te=`[data-wui-scroller]`,M=`[data-wui-collapse]`,N=`[data-wui-more]`,P=`data-wui-visible-limit`,F=`data-wui-overflow`,ne=`input, select, textarea, [contenteditable=""], [contenteditable="true"], [data-wui-no-drag]`,I=`[data-wui-load-more]`,L=`data-wui-more-url`,R=`data-wui-total`,z=`data-wui-unloaded`,B=48,V=16,re=160,H=e=>e.getAttribute(`data-wui-column`),U=e=>e.getAttribute(`data-wui-card`),W=e=>e instanceof HTMLElement&&!!e.hidden||e.hasAttribute(`hidden`),G=e=>W(e)||e.hasAttribute(F),K=e=>e instanceof Element?e:null,q=e=>typeof e==`object`&&e&&`name`in e?e.name:void 0,J=e=>typeof e==`object`&&e&&`message`in e?e.message:void 0,Y=(e,t,n)=>{let r=e.querySelector(t);return r instanceof n?r:null},X=(e,t,n)=>[...e.querySelectorAll(t)].filter(e=>e instanceof n),Z=(e,t,n)=>{let r=e.closest(t);return r instanceof n?r:null},Q=()=>window.WUI??null,$=(e,t)=>{e&&Q()?.toast(e,{variant:t})},ie=class extends n{constructor(){super(),this._wired=!1,this._filter=null,this._expanded=/* @__PURE__ */ new Set,this._revealed=/* @__PURE__ */ new Set,this._press=null,this._drag=null,this._kbd=null,this._suppressClick=!1,this._observer=null,this._refreshQueued=!1,this._scrollTimer=0,this._onPointerMove=e=>this._pointerMove(e),this._onPointerUp=e=>this._pointerUp(e),this._onPointerCancel=()=>this._endPointer(!1),this._onDocKeyDown=e=>{e.key===`Escape`&&this._drag&&(e.preventDefault(),this._endPointer(!1))},this._onScroll=()=>{clearTimeout(this._scrollTimer),this._scrollTimer=setTimeout(()=>this._syncSwitcherFromScroll(),80)},this.addEventListener(`pointerdown`,e=>this._pointerDown(e)),this.addEventListener(`keydown`,e=>this._keyDown(e)),this.addEventListener(`click`,e=>this._click(e),!0),this.addEventListener(`scroll`,e=>{e.target instanceof Element&&this._loadOnScroll(e.target)},!0),this.addEventListener(`dragstart`,e=>{K(e.target)?.closest(T)&&e.preventDefault()}),this.addEventListener(`touchmove`,e=>{this._drag&&e.preventDefault()},{passive:!1})}_controlled(){return this.hasAttribute(`controlled`)}connectedCallback(){if(!this._wired){this._wired=!0,this._scroller()?.addEventListener(`scroll`,this._onScroll,{passive:!0}),this._restoreCollapsed();for(let e of this._allCards())this._prepareCard(e);if(typeof MutationObserver==`function`){this._observer=new MutationObserver(e=>{for(let t of e)for(let e of t.addedNodes)e instanceof HTMLElement&&e.matches(T)&&this._prepareCard(e);this._queueRefresh()});for(let e of this.querySelectorAll(w))this._observer.observe(e,{childList:!0})}this.refresh()}}disconnectedCallback(){this._endPointer(!1),this._observer?.disconnect(),this._observer=null,this._scroller()?.removeEventListener(`scroll`,this._onScroll),clearTimeout(this._scrollTimer),this._wired=!1}setFilter(e){if(e!=null&&typeof e!=`function`)throw TypeError(`wui-kanban setFilter: pass a function or null.`);if(this._filter=e,!e)for(let e of this._allCards())e.hidden=!1;this.refresh()}refresh(){if(this._controlled())return;this._refreshQueued=!1;let e=this._summaryFormat();for(let t of this._columns()){let n=H(t),i=o(t.getAttribute(P)),s=[],c=[];for(let e of this._cardsIn(t))this._filter&&(e.hidden=this._filter(e)===!1),W(e)?e.removeAttribute(F):(s.push(e),c.push(e.getAttribute(`data-wui-value`)));let u=this._expanded.has(n),d=a(s.map(U),i,u,this._revealed);for(let e of s)e.toggleAttribute(F,d.has(U(e)));let f=this._unloadedIn(t),p=String(s.length+f);for(let e of this._countsOf(t))e.textContent!==p&&(e.textContent=p);let m=Y(t,ee,HTMLElement);if(m&&(m.hidden=s.length>0),e){let n=t.querySelector(D);n&&(n.textContent=r(l(c),e))}let h=Y(t,N,HTMLElement);if(h){h.hidden=i==null||(u?s.length<=i:d.size===0),h.setAttribute(`aria-expanded`,u?`true`:`false`);let e=u?x().fewerLabel:v(x().moreText,{count:d.size});h.textContent!==e&&(h.textContent=e)}let g=Y(t,I,HTMLButtonElement);if(g&&(g.hidden=f<=0,!t.hasAttribute(`data-wui-loading`))){g.disabled=!1;let e=v(x().loadMoreText,{n:f});g.textContent!==e&&(g.textContent=e)}}}moveCard(e,t,n){let r=this._cardByKey(e);if(!r)throw Error(`wui-kanban moveCard: no card "${String(e)}" on this board.`);if(!this._columnByKey(t))throw Error(`wui-kanban moveCard: no column "${String(t)}" on this board.`);return this._commit(r,t,n)}_columns(){return X(this,C,HTMLElement)}_columnByKey(e){return this._columns().find(t=>H(t)===e)||null}_columnOf(e){return Z(e,C,HTMLElement)}_titleOf(e){return(e.querySelector(`.wui-kanban-title`)?.textContent||H(e)||``).replace(/\s+/g,` `).trim()}_bodyOf(e){return Y(e,w,HTMLElement)}_cardsIn(e){let t=this._bodyOf(e);return t?[...t.children].filter(e=>e instanceof HTMLElement&&e.matches(T)):[]}_visibleCardsIn(e){return this._cardsIn(e).filter(e=>!G(e))}_allCards(){return X(this,`${w} > ${T}`,HTMLElement)}_cardByKey(e){return this._allCards().find(t=>U(t)===e)||null}_countsOf(e){let t=H(e),n=[...this.querySelectorAll(j)].filter(e=>e.getAttribute(`data-wui-switch`)===t);return[...e.querySelectorAll(E),...n.flatMap(e=>[...e.querySelectorAll(E)])]}_scroller(){return Y(this,te,HTMLElement)}_summaryFormat(){let e=this.getAttribute(`summary-format`);return e?d(e,this.getAttribute(`summary-unit`)):null}_queueRefresh(){this._refreshQueued||(this._refreshQueued=!0,queueMicrotask(()=>{this._refreshQueued&&this.refresh()}))}_prepareCard(e){let t=this.querySelector(A);t?.id&&!e.hasAttribute(`aria-describedby`)&&e.setAttribute(`aria-describedby`,t.id),e.hasAttribute(`tabindex`)||(e.tabIndex=0)}_announce(e){let t=Y(this,k,HTMLElement);t&&e&&(t.textContent=``,t.textContent=e)}_fire(e,t,n=!1){return this.dispatchEvent(new CustomEvent(e,{bubbles:!0,cancelable:n,detail:t}))}_canLift(e){let t=u(e),n=this.hasAttribute(`readonly`);return n||e.hasAttribute(`data-wui-locked`)?(this._announce(v(x().lockedText,{card:t})),this._fire(`wui:kanban:locked`,{key:U(e),card:e,reason:n?`readonly`:`locked`},!0),!1):e.getAttribute(`aria-busy`)!==`true`||(this._announce(x().busyMessage),$(x().busyMessage,`info`),!1)}_check(e,t,n){if(t===n)return{ok:!1,source:!0,reason:null};let r=this._columnByKey(t),i=this._columnByKey(n),a=v(x().refusedText,{from:r?this._titleOf(r):String(t),to:i?this._titleOf(i):String(n)}),o=i?.getAttribute(`data-accept-from`),s=o?.split(/\s+/).filter(Boolean)??[];if(o!=null&&!s.includes(t))return{ok:!1,reason:a};if(typeof this.accept==`function`){let r=this.accept(e,t,n);if(r===!1)return{ok:!1,reason:a};if(typeof r==`string`&&r)return{ok:!1,reason:r}}return{ok:!0,reason:null}}_markTargets(e,t){let n=u(e),r=/* @__PURE__ */ new Map;for(let i of this._columns()){let a=H(i),o=this._check(e,t,a);r.set(a,o),i.setAttribute(`data-wui-drop`,o.source?`source`:o.ok?`ok`:`refused`);let s=Y(i,O,HTMLElement);s&&!o.source&&(s.textContent=o.ok?v(x().dropHereText,{card:n,column:this._titleOf(i)}):o.reason,s.hidden=!1)}return r}_clearTargets(){for(let e of this._columns()){e.removeAttribute(`data-wui-drop`),e.removeAttribute(`data-wui-over`),e.removeAttribute(`data-wui-target`);let t=Y(e,O,HTMLElement);t&&(t.hidden=!0,t.textContent=``)}}async _commit(e,t,n){let r=this._columnOf(e);if(!r)throw Error(`wui-kanban: the card is not inside a column.`);let i=H(r),a=this._columnByKey(t),o=u(e);if(i===t||!this._canLift(e))return!1;let s=this._check(e,i,t);if(!s.ok)return this._announce(s.reason),$(s.reason,`info`),!1;if(!a)throw Error(`wui-kanban: no column "${String(t)}" on this board.`);let c=this._cardsIn(a),l=Number.isInteger(n)?Math.max(0,Math.min(n??0,c.length)):c.length,d={key:U(e),card:e,from:i,to:t,index:l},f=e.contains(document.activeElement);if(this._controlled())return this._fire(`wui:kanban:move`,d),this._announce(v(x().movedText,{card:o,column:this._titleOf(a)})),f&&this._refocusSoon(d.key),!0;if(!this._fire(`wui:kanban:move`,d,!0))return!1;let p=a.hasAttribute(P)&&!this._revealed.has(d.key);p&&this._revealed.add(d.key);let m={parent:e.parentNode,next:e.nextSibling,column:r,revealed:p},g=this._bodyOf(a);if(!g)throw Error(`wui-kanban: the target column has no body.`);g.insertBefore(e,c[l]||null),f&&this._focusMoved(e),this.refresh();let _=a.getAttribute(`data-wui-step`);if(_)return this._runStep(e,d,m,_,a.getAttribute(`data-wui-step-size`));let y=this.getAttribute(`move-url`);if(!y)return this._announce(v(x().movedText,{card:o,column:this._titleOf(a)})),this._fire(`wui:kanban:moved`,{...d,result:null}),!0;this._lock(e,!0),this._announce(v(x().movingText,{card:o,column:this._titleOf(a)}));let b=new URLSearchParams({card:String(d.key),from:String(i),to:String(t),index:String(l)}),C=await h(y,{method:`POST`,body:b});if(this._lock(e,!1),C.kind===`session`)return!1;if(C.ok){let t=this._applyFragment(C.html)||e;return $(C.message,`success`),this._announce(v(x().movedText,{card:u(t),column:this._titleOf(a)})),this._fire(`wui:kanban:moved`,{...d,card:t,result:C}),!0}return this._rollback(e,m),C.kind!==`aborted`&&$(C.message||S()[C.kind]||x().serverMessage,`danger`),this._fire(`wui:kanban:failed`,{...d,kind:C.kind,status:C.status,message:C.message}),!1}async _runStep(e,t,n,r,i){let a=u(e),o=this._columnByKey(t.to),s=new URLSearchParams({card:String(t.key),from:String(t.from),to:String(t.to)}).toString(),c=r+(r.includes(`?`)?`&`:`?`)+s;this._lock(e,!0);let l;try{let t=window.WUI?.modal?.load;if(typeof t!=`function`)throw Error(`<wui-kanban> data-wui-step needs the Razor script webority-ui.js (WUI.modal.load).`);l=await(await t(c,{trigger:e,size:i||void 0})).closed}catch(r){return this._lock(e,!1),this._rollback(e,n),q(r)!==`AbortError`&&$(x().serverMessage,`danger`),this._fire(`wui:kanban:failed`,{...t,kind:`step`,status:0,message:J(r)??null}),!1}if(l?.status!==`success`)return this._lock(e,!1),this._rollback(e,n),this._announce(v(x().cancelledText,{card:a})),this._fire(`wui:kanban:failed`,{...t,kind:`dismissed`,status:0,message:null}),!1;let d=e,f=this.getAttribute(`card-url`);if(f){let n=await h(`${f}${f.includes(`?`)?`&`:`?`}${new URLSearchParams({card:String(t.key)})}`);n.ok&&(d=this._applyFragment(n.html)||e)}if(this._lock(d,!1),!o)throw Error(`wui-kanban: no column "${String(t.to)}" on this board.`);return this._announce(v(x().movedText,{card:u(d),column:this._titleOf(o)})),this._fire(`wui:kanban:moved`,{...t,card:d,result:l}),!0}_lock(e,t){t?(e.setAttribute(`aria-busy`,`true`),e.setAttribute(`data-wui-saving`,``)):(e.removeAttribute(`aria-busy`),e.removeAttribute(`data-wui-saving`))}_rollback(e,t){let n=e.contains(document.activeElement),r=t.next&&t.next.parentNode===t.parent?t.next:null;if(t.revealed&&this._revealed.delete(U(e)),!t.parent)throw Error(`wui-kanban: the card had no parent to go back to.`);t.parent.insertBefore(e,r),n&&e.focus(),this.refresh(),this._announce(v(x().rolledBackText,{card:u(e),column:this._titleOf(t.column)}))}_applyFragment(t){if(!t)return null;let n=m(t);for(let t of n.querySelectorAll(`script`))e(`[@webority/ui-elements] A kanban fragment carried a script tag; it was removed, not run.`),t.remove();let r=null;for(let e of X(n,T,HTMLElement)){if(e.closest(`template`))continue;let t=this._cardByKey(U(e));if(!t)continue;let n=t.contains(document.activeElement);t.dispatchEvent(new CustomEvent(`wui:teardown`,{bubbles:!0})),t.hidden&&(e.hidden=!0),t.replaceWith(e),this._prepareCard(e),n&&e.focus(),r??=e}for(let e of X(n,`template[data-wui-kanban-summary]`,HTMLTemplateElement))this._columnByKey(e.getAttribute(`data-wui-kanban-summary`))?.querySelector(D)?.replaceChildren(e.content.cloneNode(!0));return this.refresh(),Q()?.refresh(),r}_refocusSoon(e){let t=()=>{let t=this._cardByKey(e);t&&this._focusMoved(t)};typeof requestAnimationFrame==`function`?requestAnimationFrame(t):setTimeout(t,0)}_focusMoved(e){e.focus({preventScroll:!0}),e.scrollIntoView?.({block:`nearest`})}_pointerDown(e){if(e.button!==0||e.isPrimary===!1||this._drag||this._kbd)return;let t=K(e.target),n=t?Z(t,T,HTMLElement):null;if(!n||!this.contains(n)||t?.closest(ne))return;let r={card:n,id:e.pointerId,x:e.clientX,y:e.clientY,type:e.pointerType,timer:0};this._press=r,e.pointerType===`touch`&&(r.timer=setTimeout(()=>{this._press===r&&this._startDrag(r,r.x,r.y)},400)),window.addEventListener(`pointermove`,this._onPointerMove),window.addEventListener(`pointerup`,this._onPointerUp),window.addEventListener(`pointercancel`,this._onPointerCancel)}_pointerMove(e){let t=this._press;if(t&&e.pointerId===t.id){if(!this._drag){if(!(Math.hypot(e.clientX-t.x,e.clientY-t.y)>6))return;if(t.type===`touch`){this._endPointer(!1);return}if(this._startDrag(t,e.clientX,e.clientY),!this._drag)return}this._dragTo(e.clientX,e.clientY)}}_pointerUp(e){this._press&&e.pointerId===this._press.id&&this._endPointer(!!this._drag)}_startDrag(e,t,n){let r=e.card;if(!this._canLift(r)){this._endPointer(!1);return}let i=this._columnOf(r);if(!i)throw Error(`wui-kanban: the card is not inside a column.`);let a=H(i),o=r.getBoundingClientRect(),s=r.cloneNode(!0);if(!(s instanceof HTMLElement))return;let c=s;for(let e of[c,...c.querySelectorAll(`[id]`)])e.removeAttribute(`id`);c.removeAttribute(`data-wui-card`),c.removeAttribute(`tabindex`),c.setAttribute(`aria-hidden`,`true`),c.classList.add(`wui-kanban-ghost`),c.style.width=`${o.width}px`,this.appendChild(c),r.setAttribute(`data-wui-dragging`,``),this.setAttribute(`data-wui-dragging`,``),this._drag={card:r,from:a,ghost:c,dx:t-o.left,dy:n-o.top,x:t,y:n,over:null,verdicts:this._markTargets(r,a)},this._announce(v(x().liftedText,{card:u(r),column:this._titleOf(i)})),document.addEventListener(`keydown`,this._onDocKeyDown),this._dragTo(t,n)}_dragTo(e,t){let n=this._drag;if(!n)throw Error(`wui-kanban: no drag in progress.`);n.x=e,n.y=t,n.ghost.style.transform=`translate(${e-n.dx}px, ${t-n.dy}px)`;let r=this._columnAt(e,t);r!==n.over&&(n.over?.removeAttribute(`data-wui-over`),r?.setAttribute(`data-wui-over`,``),n.over=r),this._autoScroll(e,t,r)}_columnAt(e,t){for(let n of this._columns()){let r=n.getBoundingClientRect();if(e>=r.left&&e<=r.right&&t>=r.top&&t<=r.bottom)return n}return null}_indexAt(e,t){let n=this._visibleCardsIn(e).filter(e=>e!==this._drag?.card).find(e=>{let n=e.getBoundingClientRect();return t<n.top+n.height/2}),r=this._cardsIn(e).filter(e=>e!==this._drag?.card);return n?r.indexOf(n):r.length}_autoScroll(e,t,n){let r=this._scroller();if(r){let t=r.getBoundingClientRect();t.width>0&&(e<t.left+B?r.scrollBy?.({left:-16}):e>t.right-B&&r.scrollBy?.({left:V}))}if(n&&this._scrollColumn(n,t))return;let i=window.innerHeight||0;i>0&&(t<B?window.scrollBy?.({top:-16}):t>i-B&&window.scrollBy?.({top:V}))}_scrollColumn(e,t){let n=this._bodyOf(e);if(!n||e.hasAttribute(`data-collapsed`)||n.scrollHeight<=n.clientHeight)return!1;let r=n.getBoundingClientRect();return t<r.top+B&&n.scrollTop>0?(n.scrollBy?.({top:-16}),!0):t>r.bottom-B&&n.scrollTop+n.clientHeight<n.scrollHeight-1&&(n.scrollBy?.({top:V}),!0)}_endPointer(e){let t=this._press,n=this._drag;if(t&&clearTimeout(t.timer||void 0),this._press=null,this._drag=null,window.removeEventListener(`pointermove`,this._onPointerMove),window.removeEventListener(`pointerup`,this._onPointerUp),window.removeEventListener(`pointercancel`,this._onPointerCancel),document.removeEventListener(`keydown`,this._onDocKeyDown),!n)return;n.ghost.remove(),n.card.removeAttribute(`data-wui-dragging`),this.removeAttribute(`data-wui-dragging`),this._suppressClick=!0,setTimeout(()=>{this._suppressClick=!1},0);let r=n.over;if(this._clearTargets(),!e||!r){this._announce(v(x().cancelledText,{card:u(n.card)}));return}let i=H(r),a=n.verdicts.get(i);a?.source?this._announce(v(x().cancelledText,{card:u(n.card)})):a?.ok?this._commit(n.card,i,this._indexAt(r,n.y)):(this._announce(a?.reason),$(a?.reason,`info`))}_click(e){let t=K(e.target);if(this._suppressClick&&t?.closest(T)){e.preventDefault(),e.stopPropagation(),this._suppressClick=!1;return}let n=t?.closest(M);if(n&&this.contains(n)){let e=Z(n,C,HTMLElement);e&&this._setCollapsed(e,!e.hasAttribute(`data-collapsed`),!0);return}let r=t?.closest(I);if(r&&this.contains(r)){this._controlled()||this._loadMore(Z(r,C,HTMLElement));return}let i=t?.closest(N);if(i&&this.contains(i)){this._controlled()||this._toggleMore(Z(i,C,HTMLElement));return}let a=t?.closest(j);a&&this.contains(a)&&this._showColumn(a.getAttribute(`data-wui-switch`))}_keyDown(e){let t=this._kbd;if(t){this._liftedKey(e,t);return}let n=e.target instanceof HTMLElement?e.target:null;if(!n?.matches(T)||!this.contains(n))return;let r=this._columnOf(n),i=f(e.key,p(this));switch(i){case` `:case`Spacebar`:{if(e.preventDefault(),!this._canLift(n))return;if(!r)throw Error(`wui-kanban: the card is not inside a column.`);let t=H(r),i=this._columns();this._kbd={card:n,from:t,target:i.indexOf(r),verdicts:this._markTargets(n,t)},n.setAttribute(`data-wui-lifted`,``),this.setAttribute(`data-wui-dragging`,``),r.setAttribute(`data-wui-target`,``),this._announce(v(x().liftedText,{card:u(n),column:this._titleOf(r)}));return}case`ArrowDown`:case`ArrowUp`:{if(!r)throw Error(`wui-kanban: the card is not inside a column.`);let t=this._visibleCardsIn(r),i=t[t.indexOf(n)+(e.key===`ArrowDown`?1:-1)];i&&(e.preventDefault(),i.focus());return}case`ArrowLeft`:case`ArrowRight`:{let t=this._columns(),n=i===`ArrowRight`?1:-1;for(let i=(r?t.indexOf(r):-1)+n;i>=0&&i<t.length;i+=n){let n=t[i],r=n?this._visibleCardsIn(n)[0]:void 0;if(r&&n&&!n.hasAttribute(`data-collapsed`)){e.preventDefault(),r.focus();return}}return}}}_liftedKey(e,t){let n=this._columns(),r=f(e.key,p(this));switch(r){case`ArrowLeft`:case`ArrowRight`:{e.preventDefault();let i=t.target+(r===`ArrowRight`?1:-1);if(i<0||i>=n.length)return;n[t.target]?.removeAttribute(`data-wui-target`),t.target=i;let a=n[i];if(!a)return;a.setAttribute(`data-wui-target`,``),this._showColumn(H(a),!1);let o=t.verdicts.get(H(a));if(!o)throw Error(`wui-kanban: no verdict for the column.`);let s=this._titleOf(a);this._announce(o.source?v(x().overSourceText,{column:s}):o.ok?g(x(),`overText`,this._cardsIn(a).filter(e=>!W(e)).length,{column:s}):v(x().overRefusedText,{column:s,reason:o.reason??``}));return}case` `:case`Spacebar`:case`Enter`:{e.preventDefault();let r=n[t.target];if(!r)throw Error(`wui-kanban: the lifted card has no target column.`);let i=H(r),a=t.verdicts.get(i);if(!a)throw Error(`wui-kanban: no verdict for the column.`);if(!a.source&&!a.ok){this._announce(a.reason);return}this._endKeyboard(),a.source?this._announce(v(x().cancelledText,{card:u(t.card)})):this._commit(t.card,i);return}case`Escape`:case`Tab`:e.key===`Escape`&&e.preventDefault(),this._endKeyboard(),this._showColumn(t.from,!1),this._announce(v(x().cancelledText,{card:u(t.card)}));return}}_endKeyboard(){let e=this._kbd;this._kbd=null,e&&(e.card.removeAttribute(`data-wui-lifted`),this.removeAttribute(`data-wui-dragging`),this._clearTargets())}_restoreCollapsed(){let e=s(this.getAttribute(`board-id`));for(let t of this._columns()){let n=H(t);t.hasAttribute(`data-collapsible`)&&i(e,String(n))&&this._setCollapsed(t,e[String(n)],!1)}}_setCollapsed(e,t,n){let r=H(e);e.toggleAttribute(`data-collapsed`,t);let i=this._titleOf(e);for(let n of e.querySelectorAll(M))n.setAttribute(`aria-expanded`,t?`false`:`true`),n.setAttribute(`aria-label`,v(t?x().expandLabel:x().collapseLabel,{title:i}));n&&(c(this.getAttribute(`board-id`),r,t),this._fire(`wui:kanban:collapse`,{column:r,collapsed:t}))}_toggleMore(e){if(!e)return;let t=H(e);if(this._expanded.delete(t))for(let t of this._cardsIn(e))this._revealed.delete(U(t));else this._expanded.add(t);this.refresh()}_unloadedIn(e){return e.hasAttribute(L)?(e.hasAttribute(z)||e.setAttribute(z,String(Math.max(0,Number(e.getAttribute(R))-this._cardsIn(e).length))),Number(e.getAttribute(z))):0}async _loadMore(e){if(!e)throw Error(`wui-kanban: the load-more button is outside a column.`);let n=Number(e.getAttribute(z));if(e.hasAttribute(`data-wui-loading`)||!(n>0))return;e.setAttribute(`data-wui-loading`,``);let r=Y(e,I,HTMLButtonElement);r&&(r.disabled=!0,r.textContent=x().loadingLabel);let i=new URL(String(e.getAttribute(L)),document.baseURI);i.searchParams.set(`skip`,String(this._cardsIn(e).length));let a=0,o=!1;try{let t=await h(i.toString());if(t.ok){let r=m(t.html),i=this._bodyOf(e);for(let e of[...r.children])if(e.matches(T)&&!this._cardByKey(U(e))){if(!i)throw Error(`wui-kanban: the column has no body.`);i.append(e),a++}let s=t.response?.headers.get(`Wui-Kanban-Remaining`)??``;e.setAttribute(z,String(/^\d+$/.test(s)?Number(s):Math.max(0,n-a))),o=!0}}catch(e){t(`[@webority/ui-elements] A kanban column could not load its next cards.`,e)}e.removeAttribute(`data-wui-loading`),this.refresh(),o?this._fire(`wui:kanban:loaded`,{key:H(e),added:a}):$(x().loadFailedMessage,`danger`)}_loadOnScroll(e){if(this._controlled()||!e.matches(w))return;let t=Z(e,C,HTMLElement);t?.hasAttribute(L)&&e.scrollTop+e.clientHeight>=e.scrollHeight-re&&this._loadMore(t)}_isPhone(){return typeof matchMedia==`function`&&matchMedia(`(max-width: 767.98px)`).matches}_showColumn(e,t=!0){for(let t of this.querySelectorAll(j))t.getAttribute(`data-wui-switch`)===e?t.setAttribute(`aria-current`,`true`):t.removeAttribute(`aria-current`);let n=this._columnByKey(e),r=this._scroller();if(!n||!r||!t&&!this._isPhone())return;let i=typeof matchMedia==`function`&&matchMedia(`(prefers-reduced-motion: reduce)`).matches;r.scrollTo?.({left:n.offsetLeft-r.offsetLeft,behavior:i?`auto`:`smooth`})}_syncSwitcherFromScroll(){let e=this._scroller();if(!e||!this._isPhone())return;let t=e.clientWidth||1,n=this._columns()[Math.round(e.scrollLeft/t)];if(n)for(let e of this.querySelectorAll(j))e.getAttribute(`data-wui-switch`)===H(n)?e.setAttribute(`aria-current`,`true`):e.removeAttribute(`aria-current`)}};export{ie as t};
@@ -1 +0,0 @@
1
- import{l as e,y as t}from"./formatters-CXMylefd.js";import{n,r}from"./textStore-Dh5iyZSR.js";import{t as i}from"./notificationCentre.g-Cees-vKg.js";var a=99,o=864e5,s=()=>r(`notificationCentre`,i);function c(e){return e>99?`99+`:String(e)}function l(e,t){return t===0?e:`${e}, ${c(t)} ${s().unreadWordLabel}`}function u(e){return e===0?s().noneUnreadText:n(s(),`unreadAnnouncementText`,e,{unread:c(e)})}function d(t){return/^\d{4}-\d{2}-\d{2}$/.test(t)?``:e(t,{pattern:`time`})}function f(n,r=Date.now()){let i=e(n);return i===e(r)?s().todayLabel:i===e(t(r)-o)?s().yesterdayLabel:i}function p(n,r=Date.now()){let i=/* @__PURE__ */ new Map;for(let a of n){if(!Number.isFinite(t(a.at)))throw Error(`<AppNotificationCenter> item "${a.id}": at must be an ISO date-time with its zone (or a YYYY-MM-DD day), got ${String(a.at)}.`);let n=e(a.at),o=i.get(n);o||(o={key:n,heading:f(a.at,r),items:[]},i.set(n,o)),o.items.push(a)}return[...i.values()]}export{d as a,f as i,p as n,l as o,c as r,u as s,a as t};
@@ -1 +0,0 @@
1
- import{n as e,t}from"./devWarn-DXdRWZs3.js";import{h as n,m as r}from"./wuiHttp-8CYWEbRz.js";import{t as i}from"./serverHtml-BC6tAyAl.js";import{i as a}from"./dom-DMQu--xV.js";var o=Object.freeze([`success`,`info`,`warning`,`danger`]),s=e=>o.some(t=>t===e),c=`wui.flash`;function l(e,t,n){e&&window.sessionStorage.setItem(c,JSON.stringify({message:e,variant:t,action:n??null}))}var u=e=>{if(typeof e!=`object`||!e||!(`label`in e)||!(`url`in e)||!(`method`in e))throw TypeError(`stored flash action is not an action.`);let{label:t,url:r,method:i}=e;if(typeof t!=`string`||t===``||typeof r!=`string`||r===``||typeof i!=`string`||!n.includes(i))throw TypeError(`stored flash action is not an action.`);return{label:t,url:r,method:i}};function d(){let e=window.sessionStorage.getItem(c);if(e===null)return null;window.sessionStorage.removeItem(c);let t=JSON.parse(e);if(typeof t!=`object`||!t)throw TypeError(`stored flash is not an object.`);let n=`message`in t?t.message:void 0,r=`variant`in t?t.variant:void 0;if(typeof r!=`string`||!s(r))throw TypeError(`stored flash variant "${String(r)}" is not supported.`);if(typeof n!=`string`)throw TypeError(`stored flash message is not text.`);let i=`action`in t?t.action:null;return{message:n,variant:r,action:i===null?null:u(i)}}function f(){return a(window.WUI,`window.WUI is not defined: the Razor behaviour script did not load on this page.`)}var p=`data-wui-region-src`,m=`data-wui-region-key`,h=/* @__PURE__ */ new WeakSet,g=/* @__PURE__ */ new Map;async function _(e=`all`){if(e!==`all`&&e.length===0)return;let n=e===`all`?null:new Set(e),r=/* @__PURE__ */ new Map;for(let e of document.querySelectorAll(`[${p}]`)){if(!(e instanceof HTMLElement)||e.getAttribute(`data-wui-refresh`)===`none`)continue;let i=e.getAttribute(`data-wui-region-src`)??``,a=e.getAttribute(m);if(!a){h.has(e)||(h.add(e),t(/* @__PURE__ */ Error(`A [${p}] element needs ${m}: ${i}`)));continue}if(n&&!n.has(a))continue;let o=r.get(i)??[];o.push(e),r.set(i,o)}await Promise.all([...r].map(([e,t])=>v(e,t)))}async function v(t,n){let a=(g.get(t)??0)+1;g.set(t,a);let o=await r(t);if(g.get(t)!==a||o.kind===`aborted`||o.kind===`stale`||o.kind===`session`)return;if(!o.ok){e(`A region refresh failed; the region keeps its content.`,t,o.kind);return}let s=/* @__PURE__ */ new Map;for(let e of i(o.html).querySelectorAll(`[${m}]`)){if(!(e instanceof HTMLElement))continue;let t=e.getAttribute(m);t!==null&&!s.has(t)&&s.set(t,e)}for(let r of n){if(!r.isConnected)continue;let n=r.getAttribute(`data-wui-region-key`)??``,i=s.get(n);i?y(r,i):e(`A region refresh reply has no element for the region's key; the region keeps its content.`,t,n)}}function y(e,t){for(let t of Array.from(e.children))t.dispatchEvent(new CustomEvent(`wui:teardown`,{bubbles:!0}));e.replaceChildren(...Array.from(t.childNodes,e=>document.importNode(e,!0))),e.hidden=t.hidden;let n=t.getAttribute(`title`);n===null?e.removeAttribute(`title`):e.setAttribute(`title`,n);for(let t of Array.from(e.classList))t.startsWith(`tone-`)&&e.classList.remove(t);for(let n of Array.from(t.classList))n.startsWith(`tone-`)&&e.classList.add(n);f().refresh(e)}var b=/* @__PURE__ */ new WeakMap;function x(e,t){b.set(e,t)}function S(e){return b.has(e)}function C(e){let t=e instanceof Element?e.closest(`[data-wui-server]`):null;return t instanceof HTMLElement&&b.get(t)||null}var w=null;function T(e){return e?.getAttribute(`data-wui-refresh`)===`none`}function E(e){if(!e.ok)return null;let t=e.message,n=e.toastVariant||`success`,r=e.toastAction,i=e.refresh;return i===null?{tables:`all`,regions:`all`,reload:`auto`,message:t,variant:n,action:r}:{tables:i.tables,regions:i.regions,reload:i.reloadPage?`page`:`never`,message:t,variant:n,action:r}}var D={never:0,auto:1,page:2},O=(e,t)=>e===`all`||t===`all`?`all`:[.../* @__PURE__ */ new Set([...e,...t])];function k(e,t){return e===null?t:{tables:O(e.tables,t.tables),regions:O(e.regions,t.regions),reload:D[e.reload]>=D[t.reload]?e.reload:t.reload,message:t.message,variant:t.variant,action:t.action}}function A(e){return e.reload===`page`||e.reload===`auto`&&document.querySelector(`[data-wui-server]`)===null}function j(e){let t=E(e);return t!==null&&A(t)}function M(){let e=new URL(window.location.href);e.hash=``,window.location.assign(e.href)}function N(e){w=e}function P(e,t){return w?w(t,e):!1}function F(e){return e!==null&&e.tables!==`all`&&e.tables.length===0&&e.regions!==`all`&&e.regions.length===0&&e.reload===`never`}var I=e=>[e.querySelector(`.table-wrap`)?.id??``,e.id].filter(e=>e!==``),L=(t,n)=>{let r=[...document.querySelectorAll(`[data-wui-server]`)].filter(e=>e instanceof HTMLElement),i=r;if(t.tables!==`all`){let n=t.tables,a=new Set(r.flatMap(I));for(let t of n)a.has(t)||e(`A refresh names the table "${t}", which is not on this page.`);i=r.filter(e=>I(e).some(e=>n.includes(e)))}return i.filter(e=>(!n||e!==n&&!e.contains(n))&&!T(e))},R=async e=>{await C(e)?.reload({quiet:!0})};async function z(e,n={}){if(n.origin&&P(e,n.origin))return`held`;if(A(e)&&(e.reload===`page`||n.allowReload!==!1))return l(e.message,e.variant,e.action),M(),`reloaded`;let r=L(e,n.skip).map(e=>R(e).catch(t));return(e.regions===`all`||e.regions.length>0)&&r.push(_(e.regions).catch(t)),await Promise.all(r),`refreshed`}async function B(e,t={}){let n=E(e);return n===null?`none`:z(n,t)}async function V(){await z({tables:`all`,regions:`all`,reload:`never`,message:null,variant:`success`,action:null},{allowReload:!1})}export{d as S,f as _,k as a,s as b,B as c,j as d,N as f,_ as g,x as h,T as i,F as l,S as m,V as n,E as o,C as p,P as r,A as s,z as t,M as u,c as v,l as x,o as y};
@@ -1 +0,0 @@
1
- import{l as e,o as t,y as n}from"./formatters-CXMylefd.js";import{n as r,r as i}from"./textStore-Dh5iyZSR.js";import{t as a}from"./relativeTime.g-BH90tjJM.js";var o=6e4,s=60*o,c=24*s,l=7,u=()=>i(`relativeTime`,a),d={minute:`minutesAgoText`,hour:`hoursAgoText`,day:`daysAgoText`},f={minute:`inMinutesText`,hour:`inHoursText`,day:`inDaysText`};function p(i,a=Date.now()){let l=n(i);if(!Number.isFinite(l))return t();let p=a-l,m=Math.abs(p);if(m>=7*c)return e(l);if(m<o)return u().justNowText;let[h,g]=m<s?[Math.floor(m/o),`minute`]:m<c?[Math.floor(m/s),`hour`]:[Math.floor(m/c),`day`];return r(u(),(p>0?d:f)[g],h)}function m(r){let i=n(r);return Number.isFinite(i)?`${e(i,{pattern:`datetime`})} IST`:t()}export{p as n,m as r,l as t};
@@ -1 +0,0 @@
1
- var e=/\{([A-Za-z0-9_]+)\}/g,t=(e,t)=>Object.getOwnPropertyDescriptor(e,t)!==void 0,n,r=/* @__PURE__ */ new Map,i=0,a=/* @__PURE__ */ new Set,o=/* @__PURE__ */ new Map;function s(e){let t=/* @__PURE__ */ new Map,o,s=Object.entries(e);for(let[e,n]of s)if(n!==void 0){if(e===`locale`){if(typeof n!=`string`)throw RangeError(`Text locale must be a BCP 47 tag string.`);o=n}else{if(!_(n))throw RangeError(`Text ${e} must be an object of string keys.`);t.set(e,v(e,n))}}n=o,r=t,i+=1;for(let e of Array.from(a))e()}function c(e,t){let n=r.get(e);if(n===void 0)return t;let a=o.get(e);if(a!==void 0&&a.version===i&&a.english===t&&b(a.merged,t))return a.merged;let s=y(e,n,t);return o.set(e,{version:i,english:t,merged:s}),s}function l(e){return a.add(e),()=>{a.delete(e)}}function u(){return n??`en-IN`}var d=e=>e===1?`one`:`other`,f=e=>Math.trunc(Math.abs(e))===0||e===1?`one`:`other`,p={en:d,ta:d,te:d,ml:d,mr:d,ne:d,or:d,ur:d,hi:f,bn:f,gu:f,kn:f,as:f,pa:f};function m(e,n){let r=e.split(/[-_]/)[0]?.toLowerCase()??``,i=t(p,r)?p[r]:void 0;if(i===void 0)throw RangeError(`No plural rule for locale "${e}". Supported languages: ${Object.keys(p).join(`, `)}.`);return i(n)}function h(n,r){return n.replace(e,(e,n)=>t(r,n)?String(r[n]):e)}function g(e,n,r,i){let a=`${n}Other`;if(!t(e,a))throw RangeError(`Plural text ${n} has no ${a} key; every plural needs its Other form.`);let o=m(u(),r),s=`${n}${o.charAt(0).toUpperCase()}${o.slice(1)}`,c=e[t(e,s)?s:a];if(c===void 0)throw RangeError(`Plural text ${n} has no ${s} key.`);return h(c,{count:r,...i})}function _(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function v(e,t){let n={};for(let[r,i]of Object.entries(t)){if(typeof i!=`string`)throw RangeError(`Text ${e}.${r} must be a string.`);n[r]=i}return n}function y(e,n,r){let i={};for(let[a,o]of Object.entries(n)){let n=t(r,a)?r[a]:void 0;if(n===void 0)throw RangeError(`Text ${e}.${a} is not a key of the English text. Allowed keys: ${Object.keys(r).join(`, `)}.`);let s=x(n);for(let t of x(o))if(!s.includes(t))throw RangeError(`Text ${e}.${a} uses {${t}}, which the English text does not have. Allowed placeholders: ${s.length===0?`none`:s.map(e=>`{${e}}`).join(`, `)}.`);i[a]=o}return Object.assign({},r,i)}function b(e,n){let r=Object.keys(n);return Object.keys(e).length===r.length&&r.every(n=>t(e,n))}function x(t){return Array.from(t.matchAll(e),e=>e[1]??``)}export{l as a,s as i,g as n,u as o,c as r,h as t};
@@ -1,6 +0,0 @@
1
- export declare const DEFAULT_CURRENCY = "INR";
2
- export declare const CURRENCY_SYMBOLS: Readonly<Record<string, string>>;
3
- /** Whether `value` looks like an ISO 4217 code (three capital letters). */
4
- export declare const isCurrencyCode: (value: unknown) => boolean;
5
- /** What goes before an amount: the symbol, or the code and a space when there is no symbol. */
6
- export declare const currencyPrefix: (code?: string) => string;