@webority/ui-elements 0.179.0 → 0.180.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 (249) hide show
  1. package/README.md +10 -0
  2. package/THIRD-PARTY-NOTICES.txt +3 -3
  3. package/dist/WuiCalendarViews-Dg9yRY1I.js +1 -0
  4. package/dist/{WuiCommandPalette-u1XD5WMv.js → WuiCommandPalette-CpmlKjzH.js} +2 -2
  5. package/dist/{WuiCommentThread-e5t7HceL.js → WuiCommentThread-Cp7AVHvt.js} +1 -1
  6. package/dist/WuiDashboardGrid-DFpX8Vx0.js +1 -0
  7. package/dist/WuiDataTable-CSgcwxU5.js +1 -0
  8. package/dist/WuiDatePicker-CRqjwyf2.js +1 -0
  9. package/dist/WuiDateRange-BBm_Q69p.js +1 -0
  10. package/dist/WuiEntryGrid-Z69-1YBh.js +3 -0
  11. package/dist/WuiGantt-DvmVKJX2.js +1 -0
  12. package/dist/WuiInlineEdit-JT83k3Nk.js +1 -0
  13. package/dist/WuiMentionInput-DPCCSQRZ.js +1 -0
  14. package/dist/WuiMiniCalendar-BhUTIGwe.js +1 -0
  15. package/dist/WuiNotificationCenter-D5bBM8Lp.js +1 -0
  16. package/dist/WuiOfflineBanner-DGTFCtyM.js +1 -0
  17. package/dist/{WuiPhone--w-taM5Q.js → WuiPhone-B5ZLabTY.js} +1 -1
  18. package/dist/{WuiSavedViews-BR6ZHd9Y.js → WuiSavedViews-CH7IvwgZ.js} +1 -1
  19. package/dist/WuiSelect-DIW_WXH7.js +1 -0
  20. package/dist/WuiTimePicker-BKFPf8Fn.js +1 -0
  21. package/dist/{WuiTree-BjtuCasB.js → WuiTree-Db83Uztv.js} +1 -1
  22. package/dist/WuiWizardStep-BBkw94dD.js +1 -0
  23. package/dist/{chips-BdpsN50B.js → chips-paLEDoxn.js} +1 -1
  24. package/dist/commandPalette.g-DP-Zl8SU.js +1 -0
  25. package/dist/dashboardGrid.g-vkCZGw6G.js +1 -0
  26. package/dist/{dataTable-VB3nBucm.js → dataTable-C0q14bkP.js} +1 -1
  27. package/dist/{dataTable.g-DazoWWps.js → dataTable.g-1PsmN1Nj.js} +1 -1
  28. package/dist/drawerDiscard-D_LMpaFv.js +1 -0
  29. package/dist/elements/calendar-views.js +1 -0
  30. package/dist/elements/command-palette.js +1 -1
  31. package/dist/elements/comment-thread.js +1 -1
  32. package/dist/elements/dashboard-grid.js +1 -0
  33. package/dist/elements/data-table.js +1 -1
  34. package/dist/elements/date-range.js +1 -1
  35. package/dist/elements/datepicker.js +1 -1
  36. package/dist/elements/entry-grid.js +1 -1
  37. package/dist/elements/gantt.js +1 -1
  38. package/dist/elements/inline-edit.js +1 -1
  39. package/dist/elements/kanban.js +1 -1
  40. package/dist/elements/mention-input.js +1 -1
  41. package/dist/elements/mini-calendar.js +1 -0
  42. package/dist/elements/notification-center.js +1 -1
  43. package/dist/elements/offline-banner.js +1 -0
  44. package/dist/elements/phone.js +1 -1
  45. package/dist/elements/saved-views.js +1 -1
  46. package/dist/elements/select.js +1 -1
  47. package/dist/elements/timepicker.js +1 -1
  48. package/dist/elements/tree.js +1 -1
  49. package/dist/elements/wizard.js +1 -1
  50. package/dist/gantt.g-CWvMXwBR.js +1 -0
  51. package/dist/helpers.js +1 -1
  52. package/dist/initials-DKg3IeUa.js +1 -0
  53. package/dist/inlineEdit.g-DKIhYoPF.js +1 -0
  54. package/dist/{kanban-jQCTLG3Q.js → kanban-Dayig7ic.js} +1 -1
  55. package/dist/loader-DUCcKxjq.js +1 -0
  56. package/dist/{notificationCentre.g-UsAurkUz.js → notificationCentre.g-Cees-vKg.js} +1 -1
  57. package/dist/{notificationDays-wMr8rZko.js → notificationDays-B1R0RFAY.js} +1 -1
  58. package/dist/refreshAfter-DhYgWXmQ.js +1 -0
  59. package/dist/{search-Dl07KqWw.js → search-C46tnoPd.js} +1 -1
  60. package/dist/server.js +1 -1
  61. package/dist/shell.g-BhC11Oe3.js +1 -0
  62. package/dist/tableSelect-juA3KcQh.js +1 -0
  63. package/dist/tableSelect.g-DwI5_9Nw.js +1 -0
  64. package/dist/testing.js +1 -0
  65. package/dist/text/en.json +119 -10
  66. package/dist/text.js +1 -1
  67. package/dist/themeTransition-C5nAlClG.js +1 -0
  68. package/dist/toast.g-CJ8c0BNZ.js +1 -0
  69. package/dist/ui-calendar.global.js +1 -1
  70. package/dist/ui-calendar.js +1 -1
  71. package/dist/ui-chart.global.js +15 -15
  72. package/dist/ui-chart.js +2 -2
  73. package/dist/ui-elements/calendar-views.global.js +1 -0
  74. package/dist/ui-elements/carousel.global.js +1 -1
  75. package/dist/ui-elements/code-block.global.js +1 -1
  76. package/dist/ui-elements/command-palette.global.js +2 -2
  77. package/dist/ui-elements/comment-thread.global.js +1 -1
  78. package/dist/ui-elements/consent-banner.global.js +1 -1
  79. package/dist/ui-elements/context-menu.global.js +1 -1
  80. package/dist/ui-elements/dashboard-grid.global.js +1 -0
  81. package/dist/ui-elements/data-table.global.js +1 -1
  82. package/dist/ui-elements/date-range.global.js +1 -1
  83. package/dist/ui-elements/date-time.global.js +1 -1
  84. package/dist/ui-elements/datepicker.global.js +1 -1
  85. package/dist/ui-elements/dock.global.js +1 -1
  86. package/dist/ui-elements/drawer.global.js +1 -1
  87. package/dist/ui-elements/dropdown.global.js +1 -1
  88. package/dist/ui-elements/entry-grid.global.js +2 -2
  89. package/dist/ui-elements/gantt.global.js +1 -1
  90. package/dist/ui-elements/glyphs.global.js +1 -1
  91. package/dist/ui-elements/hover-card.global.js +1 -1
  92. package/dist/ui-elements/image-crop.global.js +1 -1
  93. package/dist/ui-elements/inline-edit.global.js +1 -1
  94. package/dist/ui-elements/kanban.global.js +1 -1
  95. package/dist/ui-elements/lead-popup.global.js +1 -1
  96. package/dist/ui-elements/lightbox.global.js +1 -1
  97. package/dist/ui-elements/markdown.global.js +1 -1
  98. package/dist/ui-elements/mini-calendar.global.js +1 -0
  99. package/dist/ui-elements/navigation-menu.global.js +1 -1
  100. package/dist/ui-elements/notification-center.global.js +1 -1
  101. package/dist/ui-elements/offline-banner.global.js +1 -0
  102. package/dist/ui-elements/onboarding-checklist.global.js +1 -1
  103. package/dist/ui-elements/org-tree.global.js +1 -1
  104. package/dist/ui-elements/otp.global.js +1 -1
  105. package/dist/ui-elements/overflow.global.js +1 -1
  106. package/dist/ui-elements/phone.global.js +1 -1
  107. package/dist/ui-elements/popover.global.js +1 -1
  108. package/dist/ui-elements/rating.global.js +1 -1
  109. package/dist/ui-elements/record-pager.global.js +1 -1
  110. package/dist/ui-elements/relative-time.global.js +1 -1
  111. package/dist/ui-elements/saved-views.global.js +1 -1
  112. package/dist/ui-elements/select-chips.global.js +1 -1
  113. package/dist/ui-elements/select-recents.global.js +1 -1
  114. package/dist/ui-elements/select-search.global.js +1 -1
  115. package/dist/ui-elements/select-window.global.js +1 -1
  116. package/dist/ui-elements/server.global.js +1 -0
  117. package/dist/ui-elements/shell.global.js +1 -0
  118. package/dist/ui-elements/shortcuts.global.js +1 -1
  119. package/dist/ui-elements/show-more.global.js +1 -1
  120. package/dist/ui-elements/slider.global.js +1 -1
  121. package/dist/ui-elements/sortable.global.js +1 -1
  122. package/dist/ui-elements/status-icon.global.js +1 -1
  123. package/dist/ui-elements/table-export.global.js +1 -1
  124. package/dist/ui-elements/timepicker.global.js +1 -1
  125. package/dist/ui-elements/tour.global.js +1 -1
  126. package/dist/ui-elements/tree-picker.global.js +1 -1
  127. package/dist/ui-elements/tree.global.js +1 -1
  128. package/dist/ui-elements/truncate.global.js +1 -1
  129. package/dist/ui-elements/whats-new.global.js +1 -1
  130. package/dist/ui-elements/wizard.global.js +1 -1
  131. package/dist/ui-elements.global.js +1 -1
  132. package/dist/ui-elements.js +1 -1
  133. package/dist/ui-file-viewer.global.js +1 -1
  134. package/dist/ui-file-viewer.js +1 -1
  135. package/dist/wizard.g-UKG1dMs_.js +1 -0
  136. package/dist/wuiHttp-8CYWEbRz.js +1 -0
  137. package/package.json +25 -5
  138. package/types/WuiCalendar.d.ts +9 -1
  139. package/types/WuiCalendarViews.d.ts +34 -0
  140. package/types/WuiDashboardGrid.d.ts +35 -0
  141. package/types/WuiDataTable.d.ts +1 -0
  142. package/types/WuiEntryGrid.d.ts +4 -0
  143. package/types/WuiFileViewer.d.ts +7 -0
  144. package/types/WuiGantt.d.ts +6 -1
  145. package/types/WuiInlineEdit.d.ts +2 -1
  146. package/types/WuiMiniCalendar.d.ts +27 -0
  147. package/types/WuiNotificationCenter.d.ts +1 -0
  148. package/types/WuiOfflineBanner.d.ts +35 -0
  149. package/types/WuiSelect.d.ts +1 -0
  150. package/types/WuiTimePicker.d.ts +1 -0
  151. package/types/WuiWizard.d.ts +13 -0
  152. package/types/calendarAdapter.d.ts +9 -0
  153. package/types/calendarModel.d.ts +11 -0
  154. package/types/chartSpec.d.ts +3 -0
  155. package/types/dataTable.d.ts +10 -1
  156. package/types/elements/calendar-views.d.ts +2 -0
  157. package/types/elements/dashboard-grid.d.ts +1 -0
  158. package/types/elements/mini-calendar.d.ts +2 -0
  159. package/types/elements/offline-banner.d.ts +2 -0
  160. package/types/ganttLayout.d.ts +41 -7
  161. package/types/ganttTypes.d.ts +15 -0
  162. package/types/global/chunkChecks.d.ts +1 -0
  163. package/types/global/chunks.d.ts +4 -0
  164. package/types/global/core.d.ts +3 -2
  165. package/types/global/glyphs.d.ts +2 -0
  166. package/types/global/loader.d.ts +9 -2
  167. package/types/global/parts/server.d.ts +1 -0
  168. package/types/global/parts/shell.d.ts +1 -0
  169. package/types/global/server.d.ts +18 -0
  170. package/types/global/serverGuard.d.ts +2 -0
  171. package/types/global/shared.d.ts +22 -0
  172. package/types/global/tableExport.d.ts +2 -0
  173. package/types/globals.d.ts +8 -0
  174. package/types/helpers.d.ts +2 -1
  175. package/types/index.d.ts +5 -1
  176. package/types/razor-js/modules/api.d.ts +10 -5
  177. package/types/razor-js/modules/serverBridge.d.ts +1 -0
  178. package/types/razor-js/modules/stickyStack.d.ts +1 -0
  179. package/types/razor-js/webority-ui.d.ts +4 -1
  180. package/types/select/list.d.ts +2 -0
  181. package/types/server/behaviours.d.ts +6 -0
  182. package/types/server/core.d.ts +10 -0
  183. package/types/server/flash.d.ts +16 -0
  184. package/types/server/flashToasts.d.ts +2 -0
  185. package/types/server/index.d.ts +2 -10
  186. package/types/server/postError.d.ts +17 -0
  187. package/types/server/refreshAfter.d.ts +45 -0
  188. package/types/server/regions.d.ts +5 -0
  189. package/types/server/serverActions.d.ts +18 -10
  190. package/types/server/serverMessage.d.ts +5 -0
  191. package/types/server/serverTable.d.ts +0 -2
  192. package/types/server/serverTableRegistry.d.ts +7 -0
  193. package/types/server/shellParts.d.ts +1 -3
  194. package/types/server/shellRegistry.d.ts +7 -0
  195. package/types/server/toastAction.d.ts +7 -3
  196. package/types/server/wuiHost.d.ts +1 -0
  197. package/types/server/wuiHttp.d.ts +9 -2
  198. package/types/stickyStack.d.ts +6 -0
  199. package/types/tableSelect.d.ts +10 -0
  200. package/types/testing.d.ts +4 -0
  201. package/types/text/web/agenda.g.d.ts +7 -0
  202. package/types/text/web/asyncBlock.g.d.ts +3 -0
  203. package/types/text/web/calendar.g.d.ts +2 -0
  204. package/types/text/web/catalogue.g.d.ts +20 -0
  205. package/types/text/web/changeList.g.d.ts +5 -0
  206. package/types/text/web/chart.g.d.ts +1 -0
  207. package/types/text/web/commandPalette.g.d.ts +1 -0
  208. package/types/text/web/dashboardGrid.g.d.ts +18 -0
  209. package/types/text/web/dashboardHeader.g.d.ts +6 -0
  210. package/types/text/web/dataTable.g.d.ts +4 -0
  211. package/types/text/web/entryGrid.g.d.ts +2 -0
  212. package/types/text/web/formActions.g.d.ts +9 -0
  213. package/types/text/web/gantt.g.d.ts +2 -0
  214. package/types/text/web/index.g.d.ts +10 -0
  215. package/types/text/web/kpiTile.g.d.ts +1 -0
  216. package/types/text/web/miniCalendar.g.d.ts +4 -0
  217. package/types/text/web/notificationCentre.g.d.ts +4 -0
  218. package/types/text/web/offlineBanner.g.d.ts +8 -0
  219. package/types/text/web/queueBundle.g.d.ts +11 -0
  220. package/types/text/web/resultBlock.g.d.ts +6 -0
  221. package/types/text/web/routeError.g.d.ts +14 -0
  222. package/types/text/web/settingRow.g.d.ts +10 -0
  223. package/types/text/web/shell.g.d.ts +0 -7
  224. package/types/text/web/tableSelect.g.d.ts +1 -0
  225. package/types/text/web/unsavedChanges.g.d.ts +1 -0
  226. package/types/text/web/wizard.g.d.ts +6 -0
  227. package/types/toastTypes.d.ts +1 -1
  228. package/dist/WuiDataTable-Ble3hl5L.js +0 -1
  229. package/dist/WuiDatePicker-3D33rzH4.js +0 -1
  230. package/dist/WuiDateRange-BnEJ2WpL.js +0 -1
  231. package/dist/WuiEntryGrid-DkW0tIDy.js +0 -3
  232. package/dist/WuiGantt-BqNhYIr6.js +0 -1
  233. package/dist/WuiInlineEdit-D7AuEv1R.js +0 -1
  234. package/dist/WuiMentionInput-DPpEVL2s.js +0 -1
  235. package/dist/WuiNotificationCenter-DuvGrqwr.js +0 -1
  236. package/dist/WuiSelect-CNff3FNi.js +0 -1
  237. package/dist/WuiTimePicker-DYLFaWDc.js +0 -1
  238. package/dist/WuiWizardStep-gFtuUzsL.js +0 -1
  239. package/dist/commandPalette.g-DFWnCufa.js +0 -1
  240. package/dist/drawerDiscard-APy8TZxi.js +0 -1
  241. package/dist/gantt.g-TdTxeruW.js +0 -1
  242. package/dist/initials-Qb6ITcri.js +0 -1
  243. package/dist/inlineEdit.g-DLDVospu.js +0 -1
  244. package/dist/loader-A38-PdcB.js +0 -1
  245. package/dist/shell.g-C2Ht5xl2.js +0 -1
  246. package/dist/tableSelect.g-Bmd-ExRE.js +0 -1
  247. package/dist/themeTransition-TF0BqM20.js +0 -1
  248. package/dist/wizard.g-DOZSBUc5.js +0 -1
  249. package/dist/wuiHttp-Cw7V8u2w.js +0 -1
@@ -1,4 +1,5 @@
1
1
  export * from "./accountSwitcher.g.ts";
2
+ export * from "./agenda.g.ts";
2
3
  export * from "./alert.g.ts";
3
4
  export * from "./asyncBlock.g.ts";
4
5
  export * from "./avatar.g.ts";
@@ -8,6 +9,7 @@ export * from "./breadcrumbs.g.ts";
8
9
  export * from "./calendar.g.ts";
9
10
  export * from "./card.g.ts";
10
11
  export * from "./carousel.g.ts";
12
+ export * from "./changeList.g.ts";
11
13
  export * from "./chart.g.ts";
12
14
  export * from "./chartCard.g.ts";
13
15
  export * from "./check.g.ts";
@@ -28,6 +30,8 @@ export * from "./consentBanner.g.ts";
28
30
  export * from "./contextMenu.g.ts";
29
31
  export * from "./copyButton.g.ts";
30
32
  export * from "./customRule.g.ts";
33
+ export * from "./dashboardGrid.g.ts";
34
+ export * from "./dashboardHeader.g.ts";
31
35
  export * from "./dataTable.g.ts";
32
36
  export * from "./datePicker.g.ts";
33
37
  export * from "./dateRangePicker.g.ts";
@@ -45,6 +49,7 @@ export * from "./fileValidation.g.ts";
45
49
  export * from "./fileViewer.g.ts";
46
50
  export * from "./filterBar.g.ts";
47
51
  export * from "./floatingDock.g.ts";
52
+ export * from "./formActions.g.ts";
48
53
  export * from "./formatters.g.ts";
49
54
  export * from "./formulaSteps.g.ts";
50
55
  export * from "./gantt.g.ts";
@@ -65,6 +70,7 @@ export * from "./leadPopup.g.ts";
65
70
  export * from "./lightbox.g.ts";
66
71
  export * from "./loadMore.g.ts";
67
72
  export * from "./mentionInput.g.ts";
73
+ export * from "./miniCalendar.g.ts";
68
74
  export * from "./modal.g.ts";
69
75
  export * from "./modalCardRenderer.g.ts";
70
76
  export * from "./modalContent.g.ts";
@@ -72,6 +78,7 @@ export * from "./modalForm.g.ts";
72
78
  export * from "./navigationMenu.g.ts";
73
79
  export * from "./notificationCentre.g.ts";
74
80
  export * from "./numberInput.g.ts";
81
+ export * from "./offlineBanner.g.ts";
75
82
  export * from "./onboardingChecklist.g.ts";
76
83
  export * from "./orgTree.g.ts";
77
84
  export * from "./otpInput.g.ts";
@@ -85,12 +92,14 @@ export * from "./phoneNumberInput.g.ts";
85
92
  export * from "./pricingCard.g.ts";
86
93
  export * from "./qrCode.g.ts";
87
94
  export * from "./queryBuilder.g.ts";
95
+ export * from "./queueBundle.g.ts";
88
96
  export * from "./radio.g.ts";
89
97
  export * from "./radioGroup.g.ts";
90
98
  export * from "./rating.g.ts";
91
99
  export * from "./recordPager.g.ts";
92
100
  export * from "./relativeTime.g.ts";
93
101
  export * from "./repeater.g.ts";
102
+ export * from "./resultBlock.g.ts";
94
103
  export * from "./richText.g.ts";
95
104
  export * from "./routeError.g.ts";
96
105
  export * from "./rowActions.g.ts";
@@ -101,6 +110,7 @@ export * from "./search.g.ts";
101
110
  export * from "./sectionLeadCapture.g.ts";
102
111
  export * from "./segmented.g.ts";
103
112
  export * from "./select.g.ts";
113
+ export * from "./settingRow.g.ts";
104
114
  export * from "./shell.g.ts";
105
115
  export * from "./shortcutKeys.g.ts";
106
116
  export * from "./showMore.g.ts";
@@ -1,4 +1,5 @@
1
1
  export type KpiTileText = {
2
+ readonly noData: string;
2
3
  readonly periodLabel: string;
3
4
  };
4
5
  export declare const KPI_TILE_TEXT: KpiTileText;
@@ -0,0 +1,4 @@
1
+ export type MiniCalendarText = {
2
+ readonly label: string;
3
+ };
4
+ export declare const MINI_CALENDAR_TEXT: MiniCalendarText;
@@ -3,12 +3,16 @@ export type NotificationCentreText = {
3
3
  readonly allReadText: string;
4
4
  readonly archivedLabel: string;
5
5
  readonly clientMessage: string;
6
+ readonly earlierLabel: string;
6
7
  readonly emptyText: string;
8
+ readonly errorText: string;
7
9
  readonly forbiddenMessage: string;
8
10
  readonly label: string;
11
+ readonly loadingText: string;
9
12
  readonly markAllLabel: string;
10
13
  readonly networkMessage: string;
11
14
  readonly noneUnreadText: string;
15
+ readonly retryLabel: string;
12
16
  readonly scrollTabsBackwardLabel: string;
13
17
  readonly scrollTabsForwardLabel: string;
14
18
  readonly serverMessage: string;
@@ -0,0 +1,8 @@
1
+ export type OfflineBannerText = {
2
+ readonly backOnlineText: string;
3
+ readonly checkAgainLabel: string;
4
+ readonly loadedAtText: string;
5
+ readonly loadedText: string;
6
+ readonly offlineText: string;
7
+ };
8
+ export declare const OFFLINE_BANNER_TEXT: OfflineBannerText;
@@ -0,0 +1,11 @@
1
+ export type QueueBundleText = {
2
+ readonly allApprovedLabel: string;
3
+ readonly approveLabel: string;
4
+ readonly approveMoreLabel: string;
5
+ readonly checkListLabel: string;
6
+ readonly runningLabel: string;
7
+ readonly statusBusyLabel: string;
8
+ readonly statusDoneLabel: string;
9
+ readonly statusFailedLabel: string;
10
+ };
11
+ export declare const QUEUE_BUNDLE_TEXT: QueueBundleText;
@@ -0,0 +1,6 @@
1
+ export type ResultBlockText = {
2
+ readonly copiedLabel: string;
3
+ readonly copyLabel: string;
4
+ readonly referenceLabel: string;
5
+ };
6
+ export declare const RESULT_BLOCK_TEXT: ResultBlockText;
@@ -1,11 +1,25 @@
1
1
  export type RouteErrorText = {
2
+ readonly checkAgainLabel: string;
3
+ readonly copyReferenceLabel: string;
2
4
  readonly errorText: string;
3
5
  readonly errorTitle: string;
6
+ readonly forbiddenText: string;
7
+ readonly forbiddenTitle: string;
4
8
  readonly homeLabel: string;
9
+ readonly maintenanceBackBy: string;
10
+ readonly maintenanceText: string;
11
+ readonly maintenanceTitle: string;
5
12
  readonly notFoundText: string;
6
13
  readonly notFoundTitle: string;
14
+ readonly offlineText: string;
15
+ readonly offlineTitle: string;
16
+ readonly referenceLabel: string;
7
17
  readonly reloadLabel: string;
18
+ readonly requestAccessLabel: string;
8
19
  readonly retryLabel: string;
20
+ readonly signInLabel: string;
21
+ readonly signedOutText: string;
22
+ readonly signedOutTitle: string;
9
23
  readonly staleText: string;
10
24
  readonly staleTitle: string;
11
25
  };
@@ -0,0 +1,10 @@
1
+ export type SettingRowText = {
2
+ readonly cancel: string;
3
+ readonly confirmHint: string;
4
+ readonly confirmWordLabel: string;
5
+ readonly edit: string;
6
+ readonly keepEditing: string;
7
+ readonly save: string;
8
+ readonly was: string;
9
+ };
10
+ export declare const SETTING_ROW_TEXT: SettingRowText;
@@ -4,15 +4,12 @@ export type ShellText = {
4
4
  readonly emptyText: string;
5
5
  readonly expandNavLabel: string;
6
6
  readonly label: string;
7
- readonly loadingNotificationsText: string;
8
7
  readonly logoutLabel: string;
9
- readonly markAllReadLabel: string;
10
8
  readonly moreLabel: string;
11
9
  readonly navLabel: string;
12
10
  readonly newLabel: string;
13
11
  readonly noResultsForText: string;
14
12
  readonly noResultsText: string;
15
- readonly noUnreadText: string;
16
13
  readonly notificationsLoadErrorMessage: string;
17
14
  readonly openNavLabel: string;
18
15
  readonly placeholder: string;
@@ -28,9 +25,5 @@ export type ShellText = {
28
25
  readonly skipLabel: string;
29
26
  readonly tabBarLabel: string;
30
27
  readonly togglePagesLabel: string;
31
- readonly unreadBellLabel: string;
32
- readonly unreadLabel: string;
33
- readonly unreadNotificationsText: string;
34
- readonly viewAllLabel: string;
35
28
  };
36
29
  export declare const SHELL_TEXT: ShellText;
@@ -1,5 +1,6 @@
1
1
  export type TableSelectText = {
2
2
  readonly selectAllLabel: string;
3
+ readonly selectGroupLabel: string;
3
4
  readonly selectRowLabel: string;
4
5
  };
5
6
  export declare const TABLE_SELECT_TEXT: TableSelectText;
@@ -1,4 +1,5 @@
1
1
  export type UnsavedChangesText = {
2
+ readonly keepLabel: string;
2
3
  readonly leaveLabel: string;
3
4
  readonly message: string;
4
5
  readonly title: string;
@@ -3,9 +3,15 @@ export type WizardText = {
3
3
  readonly backLabel: string;
4
4
  readonly closeLabel: string;
5
5
  readonly doneLabel: string;
6
+ readonly errorCountText: string;
6
7
  readonly errorLabel: string;
7
8
  readonly finishLabel: string;
8
9
  readonly label: string;
10
+ readonly leaveDiscardLabel: string;
11
+ readonly leaveKeepLabel: string;
12
+ readonly leaveMessage: string;
13
+ readonly leaveSaveLabel: string;
14
+ readonly leaveTitle: string;
9
15
  readonly nextLabel: string;
10
16
  readonly pendingLabel: string;
11
17
  readonly skipLabel: string;
@@ -9,7 +9,7 @@ export interface ToastOptions {
9
9
  title?: string;
10
10
  action?: {
11
11
  label?: string;
12
- onClick?: () => void;
12
+ onClick?: (button: HTMLButtonElement) => void;
13
13
  };
14
14
  id?: string;
15
15
  /** Nodes drawn as the message, instead of `message` text. */
@@ -1 +0,0 @@
1
- import{C as e,D as t,E as n,F as r,I as i,P as a,_ as o,g as s,h as c,m as l,r as u,s as d,t as f,w as p,x as m}from"./dataTable-VB3nBucm.js";import{t as h}from"./dom-DMQu--xV.js";import{t as g}from"./elementBase-Cxeyx0tU.js";import{n as _}from"./imeSafeEnter-DeO_3lXy.js";import{t as v}from"./svgNodes-CyPS2oFH.js";function y(){return import(`./tableExport-D1OdFVQj.js`).then(e=>e.r)}var b=`.wui-col-resize`,x=`.wui-group-row, .wui-virtual-spacer`,S=`.wui-select-cell, .wui-expand-cell`;function C(){return v({class:`wui-icon`,"data-icon":`chevron-down`,"data-wui":`AppIcon`,width:16,height:16,viewBox:`0 0 24 24`,fill:`none`,"aria-hidden":`true`},[[`path`,{stroke:`currentColor`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-miterlimit":`10`,"stroke-width":`1.5`,d:`M19.92 8.95l-6.52 6.52c-.77.77-2.03.77-2.8 0L4.08 8.95`}]])}function w(e){if(e==null)throw TypeError(`Missing DOM node`);return e}function T(e,t){if(e instanceof t)return e;throw TypeError(`Missing DOM node`)}var E=e=>{let t=h(e,b);return t instanceof HTMLElement?t:null},D=e=>e.hasAttribute(`data-wui-skeleton`)||!!e.querySelector(`:scope > td > .skeleton`),O=class extends g{_frame;_headDirty;_rowsDirty;_frozenSig;_natural;_widths;_collapsed;_groupOrder;_items;_range;_drag;_userSized;_swallowClick;_mo;_ro;_fonts;_onPointerDown;_onKeyDown;_onClick;_onDblClick;_onScroll;_onFonts;_top=null;_bottom=null;_rowHeight=0;constructor(){super(),this._frame=0,this._headDirty=!0,this._rowsDirty=!0,this._frozenSig=null,this._natural=[],this._widths={},this._collapsed=/* @__PURE__ */ new Set,this._groupOrder=[],this._items=[],this._range=null,this._drag=null,this._userSized=!1,this._swallowClick=!1,this._mo=null,this._ro=null,this._fonts=null,this._onPointerDown=e=>this._startDrag(e),this._onKeyDown=e=>this._key(e),this._onClick=e=>this._click(e),this._onDblClick=e=>{let t=E(e.target);t&&this.contains(t)&&this._reset(t.closest(`th`))},this._onScroll=()=>{this.hasAttribute(`virtual`)&&this._schedule()},this._onFonts=()=>{this._userSized||this._drag||this._frozenSig===null||!this.hasAttribute(`resizable`)||(this._frozenSig=null,this._schedule())}}connectedCallback(){this._widths=n(this.getAttribute(`view-key`)),this.addEventListener(`pointerdown`,this._onPointerDown,!0),this.addEventListener(`keydown`,this._onKeyDown,!0),this.addEventListener(`click`,this._onClick,!0),this.addEventListener(`dblclick`,this._onDblClick),this.addEventListener(`scroll`,this._onScroll,{passive:!0}),this._fonts=this.ownerDocument.fonts??null,this._fonts?.addEventListener(`loadingdone`,this._onFonts),typeof MutationObserver<`u`&&(this._mo=new MutationObserver(e=>this._mutated(e)),this._mo.observe(this,{childList:!0,subtree:!0})),typeof ResizeObserver<`u`&&(this._ro=new ResizeObserver(()=>this._schedule()),this._ro.observe(this)),this._headDirty=!0,this._rowsDirty=!0,this._schedule()}disconnectedCallback(){this.removeEventListener(`pointerdown`,this._onPointerDown,!0),this.removeEventListener(`keydown`,this._onKeyDown,!0),this.removeEventListener(`click`,this._onClick,!0),this.removeEventListener(`dblclick`,this._onDblClick),this.removeEventListener(`scroll`,this._onScroll),this._fonts?.removeEventListener(`loadingdone`,this._onFonts),this._fonts=null,this._mo?.disconnect(),this._ro?.disconnect(),this._mo=null,this._ro=null,this._frame&&cancelAnimationFrame(this._frame),this._frame=0,this._drag=null}refresh(){this._headDirty=!0,this._rowsDirty=!0,this._run()}get _table(){let e=this.querySelector(`:scope > table`);return e instanceof HTMLTableElement?e:null}_headCells(e){let t=e.tHead?.rows[0];return t?[...t.cells]:[]}_schedule(){this._frame||=requestAnimationFrame(()=>{this._frame=0,this._run()})}_mutated(e){for(let t of e){let e=t.target instanceof Element?t.target:t.target.parentElement;e&&((e.closest(`thead`)||e===this._table||e===this)&&(this._headDirty=!0),(e.closest(`tbody, tfoot`)||e===this._table||e===this)&&(this._rowsDirty=!0))}this._schedule()}_run(){let e=this._table;if(!e)return;let t=this._headDirty,n=this._rowsDirty;this._headDirty=!1,this._rowsDirty=!1,n&&this.hasAttribute(`group-by`)&&this._group(e),this._pins(e,t||n),this.hasAttribute(`resizable`)&&(t&&this._handles(e),this._layout(e)),this.hasAttribute(`virtual`)&&this._virtual(e,t||n),this._mo?.takeRecords()}_pins(t,n){let r=this._headCells(t),i=r.map(e=>{let t=e.dataset.pin;return t===`start`||t===`end`?t:e.matches(S)?`lead`:null});if(!i.some(e=>e===`start`||e===`end`))return;let a=p(i);a.forEach((e,t)=>{e&&this._ro?.observe(w(r[t]))});let o=e=>w(r[e]).getBoundingClientRect().width,s=0;a.forEach((n,r)=>{n?.side===`start`&&(this._setVar(t,e(`start`,n.ordinal),s),s+=o(r))}),s=0;for(let n=a.length-1;n>=0;n--){let r=a[n];r?.side===`end`&&(this._setVar(t,e(`end`,r.ordinal),s),s+=o(n))}if(n)for(let e of t.rows)e.matches(`${x}, .wui-row-expanded`)||e.cells.length!==r.length||a.forEach((t,n)=>{if(!t)return;let r=w(e.cells[n]);r.classList.contains(`wui-pin-${t.side}`)||r.classList.add(`wui-pin-${t.side}`),t.edge&&!r.classList.contains(`wui-pin-${t.side}-edge`)&&r.classList.add(`wui-pin-${t.side}-edge`);let i=m(t.side,t.ordinal);r.style.getPropertyValue(`--wui-pin-at`)!==i&&r.style.setProperty(u,i)})}_setVar(e,t,n){let r=`${Math.round(n*100)/100}px`;e.style.getPropertyValue(t)!==r&&e.style.setProperty(t,r)}_resizable(e){return e.map((t,n)=>n<e.length-1&&!t.matches(S))}_handles(e){let n=this._headCells(e),r=this._resizable(n);n.forEach((e,n)=>{if(!r[n]||e.querySelector(b))return;let i=e.ownerDocument.createElement(`span`);i.className=`wui-col-resize`,i.setAttribute(`role`,`separator`),i.setAttribute(`aria-orientation`,`vertical`),i.setAttribute(`aria-valuemin`,`48`),i.setAttribute(`aria-valuemax`,String(f)),i.setAttribute(`tabindex`,`0`);let a=(e.textContent??``).trim();i.setAttribute(`aria-label`,t(a)),a&&!e.hasAttribute(`aria-label`)&&e.setAttribute(`aria-label`,a),e.classList.add(`wui-col-resizable`),e.appendChild(i)})}_hasRows(e){for(let t of e.tBodies)for(let e of t.rows)if(!e.matches(x)&&!D(e))return!0;return!1}_signature(e){return e.map(e=>e.dataset.key||(e.textContent??``).trim()).join(``)}_layout(e){let t=this._headCells(e),n=this._signature(t);t.length&&n!==this._frozenSig&&(this._hasRows(e)?this._freeze(e,t,n):this._applyRemembered(t))}_applyRemembered(e){for(let t of e){let e=t.dataset.key&&this._widths[t.dataset.key];e&&(t.style.width=`${e}px`);let n=t.querySelector(b);n&&this._handleValue(n,l(e||t.getBoundingClientRect().width))}}_freeze(e,t,n){e.style.tableLayout=``,e.style.width=``,e.removeAttribute(`data-wui-fixed`);for(let e of t)e.hasAttribute(`data-wui-width`)&&(e.style.width=``,e.removeAttribute(`data-wui-width`));this._natural=t.map(e=>e.getBoundingClientRect().width),t.forEach((e,n)=>{if(n===t.length-1||e.matches(S))return;let r=e.dataset.key&&this._widths[e.dataset.key];this._setWidth(e,r||this._natural[n])}),e.style.tableLayout=`fixed`,e.setAttribute(`data-wui-fixed`,``),this._frozenSig=n,this._fitTable(e,t)}_setWidth(e,t){let n=l(t);e.style.width=`${n}px`,e.setAttribute(`data-wui-width`,``);let r=e.querySelector(b);return r&&this._handleValue(r,n),n}_handleValue(e,t){e.setAttribute(`aria-valuenow`,String(t)),e.setAttribute(`aria-valuetext`,r(t))}_fitTable(e,t){let n=t.length-1,r=this._natural[n]||0;for(let e=0;e<n;e++)r+=Number.parseFloat(w(t[e]).style.width)||this._natural[e]||0;e.style.width=`max(100%, ${Math.round(r)}px)`}_ensureFrozen(e){let t=this._headCells(e),n=this._signature(t);return n!==this._frozenSig&&this._freeze(e,t,n),t}_resizeTo(e,t,n){let r=this._table;if(!r)return;let i=this._ensureFrozen(r);this._userSized=!0,this._setWidth(e,t),this._fitTable(r,i),n&&this._remember(e),this._pins(r,!1)}_remember(e){let t=e.dataset.key;t&&(this._widths={...this._widths,[t]:Number.parseFloat(e.style.width)},i(this.getAttribute(`view-key`),this._widths))}_reset(e){let t=this._table;if(!e||!t)return;let n=this._ensureFrozen(t);this._userSized=!0;let r=e.dataset.key;if(r&&r in this._widths){let{[r]:e,...t}=this._widths;this._widths=t,i(this.getAttribute(`view-key`),this._widths)}this._setWidth(e,this._natural[n.indexOf(e)]||0),this._fitTable(t,n),this._pins(t,!1)}_rtl(){return getComputedStyle(this).direction===`rtl`}_startDrag(e){let t=E(e.target);if(!t||!this.contains(t)||e.button!==0)return;e.preventDefault(),e.stopPropagation();let n=t.closest(`th`),r=this._table;if(!n||!r)return;this._ensureFrozen(r);let i={th:n,x:e.clientX,from:n.getBoundingClientRect().width,dir:this._rtl()?-1:1,moved:!1};this._drag=i,t.setPointerCapture?.(e.pointerId),t.classList.add(`is-dragging`);let a=e=>{let t=(e.clientX-i.x)*i.dir;Math.abs(t)>1&&(i.moved=!0),this._resizeTo(n,i.from+t,!1)},o=e=>{t.removeEventListener(`pointermove`,a),t.removeEventListener(`pointerup`,o),t.removeEventListener(`pointercancel`,o),t.classList.remove(`is-dragging`),this._drag=null,e.type===`pointercancel`?this._resizeTo(n,i.from,!1):i.moved&&this._remember(n),this._swallowClick=!0,setTimeout(()=>{this._swallowClick=!1},0)};t.addEventListener(`pointermove`,a),t.addEventListener(`pointerup`,o),t.addEventListener(`pointercancel`,o)}_key(e){let t=E(e.target);if(!t||!this.contains(t))return;let n=t.closest(`th`);if(_(e)||e.key===` `){e.preventDefault(),e.stopPropagation();return}if(e.key===`Home`){e.preventDefault(),e.stopPropagation(),this._reset(n);return}if(e.key!==`ArrowLeft`&&e.key!==`ArrowRight`)return;e.preventDefault(),e.stopPropagation();let r=this._table;if(!r)return;this._ensureFrozen(r);let i=w(n),a=e.shiftKey?50:10,o=e.key===`ArrowRight`!==this._rtl(),s=Number.parseFloat(i.style.width)||i.getBoundingClientRect().width;this._resizeTo(i,s+(o?a:-a),!0)}_click(e){let t=e.target instanceof Element&&e.target.closest(b)!==null;if(this._swallowClick||t){e.stopPropagation(),(t||this._swallowClick)&&e.preventDefault(),this._swallowClick=!1;return}let n=h(e.target,`[data-wui-table-export], [data-wui-density]`);if(n&&this.contains(n)){e.preventDefault(),n.hasAttribute(`data-wui-density`)?this._setDensity(n.getAttribute(`data-wui-density`)??``):this._export(n.getAttribute(`data-wui-table-export`)??``);return}if(!this.hasAttribute(`group-by`))return;let r=h(e.target,`.wui-group-toggle`)?.closest(`.wui-group-row`);if(!(r instanceof HTMLTableRowElement)||!this.contains(r))return;let i=r.dataset.groupKey;this._collapsed.has(i)?this._collapsed.delete(i):this._collapsed.add(i),this._showGroup(r,!this._collapsed.has(i));let a=this._table;a&&this.hasAttribute(`virtual`)&&(this._virtual(a,!0),this._mo?.takeRecords())}async _export(e){if(e!==`csv`&&e!==`xlsx`)return;let t=this.querySelector(`:scope > table`);if(!(t instanceof HTMLTableElement))return;let n=Array.from(t.tBodies[0]?.rows??[]).filter(e=>!e.hidden&&!e.matches(`.wui-group-row, .wui-virtual-spacer, .wui-row-expanded`)&&!D(e)),r=/* @__PURE__ */ new Set;for(let e of n)for(let[t,n]of Array.from(e.cells).entries())(n.matches(S)||n.querySelector(`.u-row-actions`))&&r.add(t);let i=e=>Array.from(e).filter((e,t)=>!r.has(t)).map(e=>{let t=e.cloneNode(!0);if(!(t instanceof Element))return``;for(let e of t.querySelectorAll(`.visually-hidden, .wui-col-resize, .infotip`))e.remove();return(t.textContent??``).replace(/\s+/g,` `).trim()}),a=i(t.tHead?.rows[0]?.cells??[]),o=n.map(e=>i(e.cells)),s=this.getAttribute(`export-name`)??`table`,{downloadTable:c,tableCsv:l,tableXlsx:u}=await y();e===`csv`?c([l(a,o)],`text/csv;charset=utf-8`,`${s}.csv`):c([u(a,o)],`application/vnd.openxmlformats-officedocument.spreadsheetml.sheet`,`${s}.xlsx`)}_setDensity(e){let t=this.querySelector(`:scope > table`);if(t instanceof HTMLTableElement){t.classList.remove(`wui-table-cozy`,`wui-table-compact`),(e===`cozy`||e===`compact`)&&t.classList.add(`wui-table-${e}`);for(let t of this.querySelectorAll(`[data-wui-density]`))t.setAttribute(`aria-pressed`,String(t.getAttribute(`data-wui-density`)===e))}}_group(e){let t=this.getAttribute(`group-by`),n=this._headCells(e),r=n.findIndex(e=>e.dataset.key===t);if(r<0)throw Error(`<wui-data-table group-by="${t}"> needs a header cell with data-key="${t}".`);let i=e.tBodies[0];if(!i)return;let a=[...i.rows].filter(e=>!e.matches(x));if(a.some(D))return;let l=this.ownerDocument,u=/* @__PURE__ */ new Map;for(let e of i.querySelectorAll(`:scope > tr.wui-group-row`))e instanceof HTMLTableRowElement&&u.set(e.dataset.groupKey,e);let d=this.closest(`[data-wui-server]`)?[]:this._groupOrder,f=s(a,e=>e.dataset.group??e.cells[r]?.textContent?.trim()??``,d);this._groupOrder=f.map(e=>e.key);let p=l.createDocumentFragment(),m=f.map(e=>{let t=u.get(e.key)??this._groupRow(l,e.key);return u.delete(e.key),T(t.querySelector(`.wui-group-cell`),HTMLTableCellElement).colSpan=n.length,T(t.querySelector(`.wui-group-count`),HTMLElement).textContent=c(e.items.length),T(t.querySelector(`.wui-group-rows`),HTMLElement).textContent=`, ${o(e.items.length)}`,p.append(t,...e.items),[t,e.key]});for(let e of u.values())e.remove();i.insertBefore(p,this._bottom?.parentNode===i?this._bottom:null);for(let[e,t]of m)this._showGroup(e,!this._collapsed.has(t))}_groupRow(e,t){let n=e.createElement(`tr`);n.className=`wui-group-row`,n.dataset.groupKey=t;let r=e.createElement(`th`);r.className=`wui-group-cell`,r.scope=`rowgroup`;let i=e.createElement(`button`);i.type=`button`,i.className=`wui-group-toggle`,i.replaceChildren(C());let a=e.createElement(`span`);a.className=`wui-group-label`,a.textContent=t;let o=e.createElement(`span`);o.className=`wui-group-count`,o.setAttribute(`aria-hidden`,`true`);let s=e.createElement(`span`);return s.className=`visually-hidden wui-group-rows`,i.append(a,o,s),r.append(i),n.append(r),n}_showGroup(e,t){if(e){e.querySelector(`.wui-group-toggle`)?.setAttribute(`aria-expanded`,String(t));for(let n=e.nextElementSibling;n&&!n.matches(x);n=n.nextElementSibling)n instanceof HTMLElement&&(n.hidden=!t)}}_spacer(e,t){if(t?.parentNode===e)return t;let n=e.ownerDocument,r=n.createElement(`tr`);return r.className=`wui-virtual-spacer`,r.setAttribute(`aria-hidden`,`true`),r.append(n.createElement(`td`)),r}_virtual(e,t){let n=e.tBodies[0];if(!n)return;if(t){this._top=this._spacer(n,this._top),this._bottom=this._spacer(n,this._bottom),n.firstElementChild!==this._top&&n.insertBefore(this._top,n.firstChild),n.lastElementChild!==this._bottom&&n.append(this._bottom);let t=Math.max(1,this._headCells(e).length);w(this._top.cells[0]).colSpan=t,w(this._bottom.cells[0]).colSpan=t,this._items=[...n.rows].filter(e=>!e.classList.contains(`wui-virtual-spacer`)&&!e.hidden),this._range=null,e.setAttribute(`aria-rowcount`,String(this._items.length+1)),e.tHead?.rows[0]?.setAttribute(`aria-rowindex`,`1`),this._items.forEach((e,t)=>{e.setAttribute(`aria-rowindex`,String(t+2))}),this._rowHeight>0||(this._rowHeight=this._measureRow(e))}let r=e.tHead?.getBoundingClientRect().height||0,i=a({scrollTop:this.scrollTop-r,viewport:this.clientHeight,rowHeight:this._rowHeight,count:this._items.length}),o=this._range;if(o&&o.start===i.start&&o.end===i.end)return;let s=o?Math.min(o.start,i.start):0,c=o?Math.max(o.end,i.end):this._items.length;for(let e=s;e<c;e++){let t=e<i.start||e>=i.end,n=w(this._items[e]);n.classList.contains(`wui-virtual-off`)!==t&&n.classList.toggle(`wui-virtual-off`,t)}this._range=i;let l=w(this._top),u=w(this._bottom);l.hidden=i.before===0,u.hidden=i.after===0,w(l.cells[0]).style.height=`${i.before}px`,w(u.cells[0]).style.height=`${i.after}px`}_measureRow(e){let t=this._items.find(e=>!e.classList.contains(`wui-group-row`)&&!e.classList.contains(`wui-virtual-off`))?.getBoundingClientRect().height??0;return t>0?t:e.classList.contains(`wui-table-compact`)?d.compact:e.classList.contains(`wui-table-cozy`)?d.cozy:d.comfortable}};export{O as t};
@@ -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-CT99RyhR.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-DTW53DjY.js";import{t as b}from"./formMirror-9IpSgeZb.js";import{t as x}from"./iconGlyphs.g-a9FtjPXh.js";import{a as S,l as C,s as w}from"./nativeOverlay-BHD2QV02.js";import{n as T,t as E}from"./rtl-g7G8Bsib.js";import{r as D}from"./textStore-DBplASiZ.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:`input datepicker-trigger${r}${t?` has-value`:``}`,"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),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-CT99RyhR.js";import{n as o}from"./devWarn-DXdRWZs3.js";import{r as s,t as c}from"./textStore-DBplASiZ.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-DTW53DjY.js";import{t as y}from"./iconGlyphs.g-a9FtjPXh.js";import{a as b,l as x,s as S}from"./nativeOverlay-BHD2QV02.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:`input daterange-trigger${n}${a?``:` has-value`}`,"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)}_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,3 +0,0 @@
1
- import{t as e}from"./dom-DMQu--xV.js";import{t}from"./elementBase-Cxeyx0tU.js";var n=`tbody > tr.wui-entry-grid-row[data-row-key]`,r=`input, select, textarea, button, [tabindex]:not([tabindex="-1"])`,i=class extends t{_onKeyDown;_onFocusIn;_onClick;_pendingCell=null;_ready=!1;_onPointerDown=t=>{if(t.button!==0)return;let n=this._ownRow(t.target),r=n?.dataset.rowKey;if(!n||r===void 0||r===this.getAttribute(`active-row`))return;let i=e(t.target,`td`),a=i?Array.from(n.children).indexOf(i):-1;this._pendingCell=a>=0?a:null,this._emit(`active`,{rowKey:r})};_onPaste=t=>{let n=this._ownRow(t.target),r=n?.dataset.rowKey,i=e(t.target,`td[data-column-key]`)?.getAttribute(`data-column-key`);if(!n||r===void 0||!i)return;let a=t.clipboardData?.getData(`text/plain`)??``;if(!/[\t\r\n]/.test(a))return;let o=a.replace(/\r\n/g,`
2
- `).split(`
3
- `);o[o.length-1]===``&&o.pop(),t.preventDefault(),this._emit(`paste`,{rowKey:r,columnKey:i,rows:o.map(e=>e.split(` `))})};constructor(){super(),this._onKeyDown=e=>this._keyDown(e),this._onFocusIn=e=>this._focusIn(e),this._onClick=t=>{this._owns(e(t.target,`.wui-entry-grid-add`))&&this._emit(`add`,{});let n=e(t.target,`thead th[data-sortable]`),r=n?.getAttribute(`data-column-key`);this._owns(n)&&r&&this._emit(`sort`,{columnKey:r})}}static get observedAttributes(){return[`active-row`]}connectedCallback(){this.addEventListener(`keydown`,this._onKeyDown),this.addEventListener(`focusin`,this._onFocusIn),this.addEventListener(`click`,this._onClick),this.addEventListener(`pointerdown`,this._onPointerDown),this.addEventListener(`paste`,this._onPaste),this._ready=!0}disconnectedCallback(){this._ready=!1,this.removeEventListener(`keydown`,this._onKeyDown),this.removeEventListener(`focusin`,this._onFocusIn),this.removeEventListener(`click`,this._onClick),this.removeEventListener(`pointerdown`,this._onPointerDown),this.removeEventListener(`paste`,this._onPaste)}attributeChangedCallback(e,t,n){t!==n&&this._ready&&queueMicrotask(()=>this._focusActiveRow())}_owns(t){return e(t,`wui-entry-grid`)===this}_rows(){return[...this.querySelectorAll(n)].filter(e=>e instanceof HTMLElement&&this._owns(e))}_ownRow(t){let r=e(t,n);return r instanceof HTMLElement&&this._owns(r)?r:null}_emit(e,t){this.dispatchEvent(new CustomEvent(`wui-entry-grid:${e}`,{detail:t,bubbles:!0,composed:!0}))}_focusActiveRow(){let e=this.getAttribute(`active-row`),t=this._pendingCell;if(this._pendingCell=null,!this.isConnected||!e)return;let n=this._rows().find(t=>t.dataset.rowKey===e);n&&!n.contains(this.ownerDocument.activeElement)&&((t===null?void 0:n.children[t])?.querySelector(r)??n.querySelector(r))?.focus()}_keyDown(t){if(t.defaultPrevented||t.isComposing||t.keyCode===229)return;let n=e(t.target,`thead th[data-sortable]`),r=n?.getAttribute(`data-column-key`);if(this._owns(n)&&r&&(t.key===`Enter`||t.key===` `)){t.preventDefault(),this._emit(`sort`,{columnKey:r});return}let i=this._ownRow(t.target),a=i?.dataset.rowKey;if(!i||a===void 0)return;let o=t.target instanceof Element?t.target:null,s=t.ctrlKey||t.metaKey;if(t.ctrlKey&&t.key===`Delete`||t.metaKey&&t.key===`Backspace`){if(!this.hasAttribute(`removable`))return;t.preventDefault(),this._emit(`remove`,{rowKey:a})}else if(t.key===`Enter`){if(s||t.shiftKey||t.altKey||o?.closest(`textarea, button`)||o?.getAttribute(`aria-expanded`)===`true`)return;t.preventDefault(),this._emit(`commit`,{rowKey:a,move:`next`})}else if(s&&t.key.toLowerCase()===`s`)t.preventDefault(),this._emit(`commit`,{rowKey:a,move:`stay`});else if(t.key===`Escape`){if(o?.getAttribute(`aria-expanded`)===`true`)return;t.preventDefault(),this._emit(`discard`,{rowKey:a})}else if(s&&(t.key===`ArrowUp`||t.key===`ArrowDown`)){t.preventDefault();let n=this._rows(),r=n[n.indexOf(i)+(t.key===`ArrowUp`?-1:1)]?.dataset.rowKey;if(r!==void 0){let n=e(t.target,`td`),a=n?Array.from(i.children).indexOf(n):-1;this._pendingCell=a>=0?a:null,this._emit(`active`,{rowKey:r})}}}_focusIn(t){let n=this._ownRow(t.target),r=n?.dataset.rowKey;n&&r!==void 0&&(t.target instanceof HTMLInputElement&&e(t.target,`td[data-kind="number"]`)&&t.target.select(),r!==this.getAttribute(`active-row`)&&this._emit(`active`,{rowKey:r}))}};export{i as t};
@@ -1 +0,0 @@
1
- import{n as e}from"./buttonClass-C8BRtTk8.js";import{t}from"./devWarn-DXdRWZs3.js";import{i as n,r}from"./dom-DMQu--xV.js";import{t as i}from"./elementBase-Cxeyx0tU.js";import{a,c as o,d as s,f as c,i as l,l as u,m as d,n as f,o as p,p as m,s as h,t as g,u as _}from"./initials-Qb6ITcri.js";import{t as v}from"./avatarNode-BaEvz5Xr.js";import{t as y}from"./iconGlyphs.g-a9FtjPXh.js";import{n as b,r as x,t as S}from"./textStore-DBplASiZ.js";import{t as C}from"./hasOwn-CJsplJ62.js";import{a as w,l as T}from"./nativeOverlay-BHD2QV02.js";import{n as E,t as D}from"./rtl-g7G8Bsib.js";import{t as O}from"./gantt.g-TdTxeruW.js";var k=`data-wui-gantt-pick`,A=e=>`${e}px`,j=(e,t,n)=>{let i=r(`div`,{class:`wui-gantt-table-cell`},n);return i.setAttribute(`role`,t),i.dataset.col=e,i};function M(e){let t=e.text,n=r(`div`,{class:`wui-gantt-table`});n.setAttribute(`role`,`table`),n.setAttribute(`aria-label`,e.title);let i=r(`div`);i.setAttribute(`role`,`rowgroup`);let a=r(`div`,{class:`wui-gantt-table-row`});a.dataset.kind=`head`,a.setAttribute(`role`,`row`),a.style.height=A(e.headHeight),a.append(j(`name`,`columnheader`,t.tableName),j(`owner`,`columnheader`,t.detailsOwner),j(`start`,`columnheader`,t.tableStart),j(`end`,`columnheader`,t.tableEnd),j(`done`,`columnheader`,t.detailsDone)),i.append(a);let o=r(`div`);o.setAttribute(`role`,`rowgroup`);for(let n of e.rows){if(n.height===0)continue;let i=n.row;if(n.kind===`group`){let i=n.group;if(!i)continue;let a=r(`div`,{class:`wui-gantt-table-row`});a.dataset.kind=`group`,a.dataset.wuiGanttGroup=i.name,a.setAttribute(`role`,`row`),a.style.height=A(n.height);let s=r(`div`,{class:`wui-gantt-table-cell wui-gantt-table-group`});s.setAttribute(`role`,`rowheader`);let c=r(`button`,{class:`wui-gantt-group-toggle`});c.type=`button`,c.setAttribute(`aria-expanded`,String(!i.folded)),c.setAttribute(`aria-label`,S(i.folded?t.unfoldLabel:t.foldLabel,{group:i.name})),c.setAttribute(e.focusAttr,`group:${i.name}`);let l=y(i.folded?`chevron-right`:`chevron-down`,{size:16});c.replaceChildren(...l?[l]:[]),s.append(c,r(`span`,null,i.name),r(`span`,null,b(t,`groupSummary`,i.count,{percent:i.percent}))),a.append(s),o.append(a);continue}let a=r(`div`,{class:`wui-gantt-table-row`});a.dataset.kind=i.end===void 0?`milestone`:`bar`,a.dataset.wuiGanttKey=i.key,a.dataset.wuiGanttPick=i.key,i.key===e.selected&&(a.dataset.selected=`true`),a.setAttribute(`role`,`row`),a.style.height=A(n.height);let s=j(`name`,`rowheader`,i.name);s.title=i.name;let c=j(`owner`,`cell`,``);i.owner&&(c.title=i.owner,c.replaceChildren(...[v({initials:g(i.owner)},`avatar-xs`)].filter(e=>e!==null)),c.append(r(`span`,{class:`visually-hidden`},i.owner)));let l=j(`start`,`cell`,i.start===void 0?``:p(u(i.start))),d=j(`end`,`cell`,i.end===void 0?``:p(u(i.end))),f=j(`done`,`cell`,i.end===void 0?``:`${i.progress??0}%`);a.append(s,c,l,d,f),o.append(a)}let s=e.skeleton;for(let e=0;s&&e<s.rows;e+=1){let e=r(`div`,{class:`wui-gantt-table-row`});e.dataset.kind=`skeleton`,e.setAttribute(`role`,`row`),e.setAttribute(`aria-hidden`,`true`),e.style.height=A(s.rowHeight);let t=r(`span`,{class:`wui-gantt-skeleton`});t.style.height=A(s.barHeight),e.append(t),o.append(e)}return n.append(i,o),n}var N=()=>x(`gantt`,O),P=`wui-gantt:zoom-change`,F=`wui-gantt:from-change`,I=`wui-gantt:fold-change`,L=`wui-gantt:select`,R=`wui-gantt:add-task`,z=`wui-gantt:retry`,B=`data-wui-gantt-focus`,V=`bar:`,H=`http://www.w3.org/2000/svg`,U=[`day`,`week`,`month`],W=3,G=16,K=300,q=[`ArrowUp`,`ArrowDown`,`ArrowLeft`,`ArrowRight`,`Home`,`End`,`Escape`,`Enter`,` `],J=0,Y=e=>`${e}px`;function X(e){return typeof e==`object`&&!!e&&`rows`in e&&Array.isArray(e.rows)&&`title`in e&&typeof e.title==`string`}function Z(e){let t=N();switch(e){case`done`:return t.statusDone;case`inProgress`:return t.statusInProgress;case`atRisk`:return t.statusAtRisk;case`notStarted`:return t.statusNotStarted;default:throw RangeError(`Unknown gantt status ${String(e)}.`)}}var Q=e=>e.progress??0,$=e=>e.status??`notStarted`,ee=(e,t)=>(e??[]).join(`\0`)===(t??[]).join(`\0`),te=class extends i{uid;_spec=null;_prev=null;_zoom=`week`;_fromMs=null;_folded=/* @__PURE__ */ new Set;_selected=null;_controlled=!1;_awaitingSpec=!1;_connected=!1;_focusAfter=null;_resolved=null;_specRows=[];_card=null;_onClick;_onKeyDown;_onChange;constructor(){super(),J+=1,this.uid=`wui-gantt-${J}`,this._onClick=e=>this._handleClick(e),this._onKeyDown=e=>this._handleKeyDown(e),this._onChange=e=>this._handleChange(e)}get spec(){return this._spec}set spec(e){this._spec=e??null,this._connected&&this._draw()}connectedCallback(){if(C(this,`spec`)){let e=this.spec;delete this.spec,this._spec=e??null}this._spec??=this._readScript(),this._spec==null&&!this.querySelector(`:scope > script[type='application/json']`)&&(this._awaitingSpec=!0,queueMicrotask(()=>{this._awaitingSpec=!1,this._connected&&this._draw()})),this.classList.add(`wui-gantt`),this.addEventListener(`click`,this._onClick),this.addEventListener(`keydown`,this._onKeyDown),this.addEventListener(`change`,this._onChange),this._connected=!0,this._draw()}disconnectedCallback(){this.removeEventListener(`click`,this._onClick),this.removeEventListener(`keydown`,this._onKeyDown),this.removeEventListener(`change`,this._onChange),this._card&&=(w(this._card),this._card.remove(),null),this._connected=!1}_readScript(){let e=this.querySelector(`:scope > script[type="application/json"]`);if(!(e instanceof HTMLScriptElement))return null;try{return JSON.parse(String(e.textContent))}catch(e){return t(`[@webority/ui-elements] <wui-gantt> could not read its JSON spec:`,e instanceof Error?e.message:void 0),null}}_seed(e){let t=this._prev;this._controlled=e.controlled===!0;let n=e=>this._controlled||t===null||e;n(t?.zoom!==e.zoom)&&(this._zoom=e.zoom??`week`),n(t?.from!==e.from)&&(this._fromMs=e.from?u(e.from):null),n(!ee(t?.folded,e.folded))&&(this._folded=new Set(e.folded??[])),n(t?.selected!==e.selected)&&(this._selected=e.selected??null),this._prev=e}_emit(e,t){this.dispatchEvent(new CustomEvent(e,{detail:t,bubbles:!0,composed:!0}))}_setZoom(e){this._emit(P,{zoom:e}),this._controlled?this._syncRadios():(this._zoom=e,this._fromMs=this._fromMs===null?null:s(e,this._fromMs),this._draw())}_setFrom(e){this._emit(F,{from:h(e)}),this._controlled||(this._fromMs=e,this._draw())}_setFolded(e){let t=new Set(this._folded);t.delete(e)||t.add(e),this._emit(I,{folded:[...t]}),this._controlled||(this._folded=t,this._draw())}_setSelected(e){this._emit(L,{key:e}),this._focusAfter=`${V}${e??this._selected??``}`,this._controlled||(this._selected=e),this._draw()}_syncRadios(){for(let e of this.querySelectorAll(`.segmented-input`))e.checked=e.value===this._zoom}_handleChange(e){let t=e.target;if(!(t instanceof HTMLInputElement)||!t.matches(`.wui-gantt-scale .segmented-input`))return;let n=U.find(e=>e===t.value);n&&this._setZoom(n)}_handleClick(e){let t=e.target;if(!(t instanceof Element))return;let n=t.closest(`[${B}]`);if(n instanceof HTMLElement&&this.contains(n)){this._activate(n.getAttribute(B)??``,n);return}let r=t.closest(`[${k}]`);if(!(r instanceof HTMLElement)||!this.contains(r))return;let i=r.getAttribute(`data-wui-gantt-pick`)??``;this._setSelected(i===this._selected?null:i)}_activate(e,t){let n=this._resolved;if(e.startsWith(V)){let t=e.slice(4);this._setSelected(t===this._selected?null:t)}else e.startsWith(`group:`)?this._setFolded(e.slice(6)):e===`close`?this._setSelected(null):e===`add`?this._emit(R):e===`retry`?this._emit(z):n&&e===`nav:earlier`?this._setFrom(_(n.zoom,n.fromMs,-1)):n&&e===`nav:later`?this._setFrom(_(n.zoom,n.fromMs,1)):n&&e===`nav:today`?this._setFrom(d(n.zoom,n.todayMs)):e.startsWith(`zoom:`)&&t.click()}_bars(){return[...this.querySelectorAll(`.wui-gantt-lane [${B}^="${V}"]`)].filter(e=>e instanceof HTMLElement)}_focusBar(e){if(e){for(let t of this._bars())t.tabIndex=t===e?0:-1;e.focus()}}_barByKey(e){return e===void 0?void 0:this._bars().find(t=>t.dataset.wuiGanttKey===e)}_handleKeyDown(e){if(e.ctrlKey||e.metaKey||e.altKey||!q.includes(e.key))return;if(e.key===`Escape`){if(this._selected===null)return;e.preventDefault(),this._setSelected(null);return}let t=e.target;if(!(t instanceof HTMLElement)||!t.getAttribute(B)?.startsWith(V))return;let n=this._bars(),r=n.indexOf(t),i=t.dataset.wuiGanttKey,a=this._specRows.find(e=>e.key===i);switch(e.preventDefault(),E(e.key,D(this))){case`ArrowDown`:this._focusBar(n[r+1]);break;case`ArrowUp`:this._focusBar(n[r-1]);break;case`Home`:this._focusBar(n[0]);break;case`End`:this._focusBar(n[n.length-1]);break;case`ArrowLeft`:this._focusBar((a?.dependsOn??[]).map(e=>this._barByKey(e)).find(e=>e));break;case`ArrowRight`:this._focusBar(this._specRows.filter(e=>e.dependsOn?.includes(i??``)).map(e=>this._barByKey(e.key)).find(e=>e));break;default:this._activate(t.getAttribute(B)??``,t)}}_focusToken(){let e=document.activeElement;return e instanceof HTMLElement&&this.contains(e)?e.getAttribute(B):null}_draw(){if(this._card&&=(w(this._card),this._card.remove(),null),this._spec==null&&this._awaitingSpec)return;let e=this._focusAfter??this._focusToken();this._focusAfter=null;let r;try{r=this._compose()}catch(e){t(`[@webority/ui-elements] <wui-gantt> could not draw its spec:`,e instanceof Error?e.message:void 0),this._resolved=null,this._specRows=[],this._card=null,this.dataset.state=`error`,this.removeAttribute(`aria-busy`),r=[this._stateBlock(`error`,N().errorText)]}if(this.replaceChildren(...r),this._card){let e=n(this._barByKey(this._selected??void 0),`selected gantt bar`);this.append(this._card),T(e,this._card,{mode:`manual`,side:`auto`,align:`start`,flipAlign:!0,gap:4,keepOffscreen:!0})}if(this._placeThumb(),e===null)return;let i=[...this.querySelectorAll(`[${B}]`)].find(t=>t.getAttribute(B)===e);i instanceof HTMLElement&&(e.startsWith(V)?this._focusBar(i):i.focus())}_compose(){let e=this._spec;if(!X(e))throw TypeError("<wui-gantt> has no spec: set the `spec` property or add a JSON script child.");this._seed(e),m(e);let t=e.layout??`table`,n=l[t],i=N(),p=u(e.today??c()),h=this._zoom,g=s(h,this._fromMs??d(h,p)),_={layout:t,zoom:h,fromMs:g,todayMs:p};this._resolved=_,this._specRows=e.rows;let v=e.rows.some(e=>e.start!==void 0),y=(e.state??`ready`)===`ready`&&!v?`empty`:e.state??`ready`;this.dataset.state=y,this.dataset.zoom=h,this.dataset.layout=t,y===`loading`?this.setAttribute(`aria-busy`,`true`):this.removeAttribute(`aria-busy`);let b=y===`ready`?o({...e,folded:[...this._folded],selected:this._selected},_):null,x=b?.axis??a(t,h,g),S=r(`div`,{class:`wui-gantt-lane`});S.style.width=Y(x.width),b?this._fillLane(S,e,b):y===`loading`&&(S.style.height=Y(W*n.rowH));let C=[];y===`loading`&&C.push(this._fillSkeleton(S,e,n)),y===`empty`&&C.push(this._emptyBlock(e)),y===`error`&&C.push(this._stateBlock(`error`,e.errorText||i.errorText));let w=this._head(x),T=r(`div`,{class:`wui-gantt-plot`});T.append(w,S);let E=r(`div`,{class:`wui-gantt-scroller`});if(t===`table`){let t=M({title:e.title,rows:b?.rows??[],headHeight:2*f.tierH,selected:this._selected,text:i,focusAttr:B,skeleton:y===`loading`?{rows:W,rowHeight:n.rowH,barHeight:n.barH}:void 0});E.append(t,T)}else E.append(T);return[this._toolbar(e,y===`ready`),E,...C,this._legend(t)]}_toolbar(e,t){let n=r(`div`,{class:`wui-gantt-toolbar`});return t&&n.append(r(`p`,{class:`wui-gantt-count`},this._countText(e.rows))),n.append(this._scale(),this._nav()),n}_countText(e){let t=N(),n=e.filter(e=>e.start!==void 0),r=n.filter(e=>e.end===void 0).length,i=1/0,a=-1/0;for(let e of n)i=Math.min(i,u(e.start??``)),a=Math.max(a,u(e.end??e.start??``));return[b(t,`summaryTasks`,n.length-r),b(t,`summaryMilestones`,r),S(t.summaryRange,{from:p(i),to:p(a)})].join(`, `)}_scale(){let e=N(),t=r(`div`,{class:`segmented segmented-sm wui-gantt-scale`});t.setAttribute(`role`,`radiogroup`),t.setAttribute(`aria-label`,e.scaleLabel),t.append(Object.assign(r(`span`,{class:`segmented-thumb`}),{ariaHidden:`true`}));let n={day:e.dayLabel,week:e.weekLabel,month:e.monthLabel};for(let e of U){let i=r(`label`,{class:`segmented-option`}),a=r(`input`,{class:`segmented-input`});a.type=`radio`,a.name=`${this.uid}-scale`,a.value=e,a.checked=e===this._zoom,a.setAttribute(B,`zoom:${e}`),i.append(a,n[e]),t.append(i)}return t}_placeThumb(){let e=this.querySelector(`.wui-gantt-scale`),t=e?.querySelector(`.segmented-thumb`),n=e?.querySelector(`.segmented-option:has(.segmented-input:checked)`);e instanceof HTMLElement&&t instanceof HTMLElement&&n instanceof HTMLElement&&e.offsetWidth&&(t.style.width=Y(n.offsetWidth),t.style.transform=`translateX(${n.offsetLeft}px)`,t.style.opacity=`1`)}_nav(){let t=N(),n=r(`div`,{class:`wui-gantt-nav`}),i=(t,n,i)=>{let a=r(`button`,{class:e(`neutral`,`soft`,`sm`)});a.type=`button`,a.setAttribute(`aria-label`,n),a.setAttribute(B,t);let o=y(i,{size:16});return a.replaceChildren(...o?[o]:[]),a},a=r(`button`,{class:e(`neutral`,`soft`,`sm`)},t.todayLabel);return a.type=`button`,a.setAttribute(B,`nav:today`),n.append(i(`nav:earlier`,t.earlierLabel,`chevron-left`),i(`nav:later`,t.laterLabel,`chevron-right`),a),n}_head(e){let t=r(`div`,{class:`wui-gantt-head`});t.style.width=Y(e.width),t.setAttribute(`aria-hidden`,`true`);let n=(e,t)=>{let n=r(`div`,{class:`wui-gantt-tier ${t}`});for(let t of e){let e=r(`div`,{class:t.weekend?`wui-gantt-cell wui-gantt-cell-weekend`:`wui-gantt-cell`});e.style.left=Y(t.x),e.style.width=Y(t.w),t.sub&&e.append(r(`small`,null,t.sub)),e.append(t.label),n.append(e)}return n};return t.append(n(e.top,`wui-gantt-tier-top`),n(e.bottom,`wui-gantt-tier-bottom`)),t}_legend(e){let t=N(),n=r(`div`,{class:`wui-gantt-legend`});n.setAttribute(`role`,`list`),n.setAttribute(`aria-label`,t.legendLabel);let i=(e,t)=>{let i=r(`span`,null);i.setAttribute(`role`,`listitem`),i.append(e,t),n.append(i)};for(let e of[`done`,`inProgress`,`atRisk`,`notStarted`]){let t=r(`span`,{class:`wui-gantt-swatch`});t.dataset.status=e,i(t,Z(e))}let a=r(`span`,{class:`wui-gantt-swatch`});if(a.dataset.kind=`milestone`,i(a,t.milestoneLabel),e===`table`){let e=r(`span`,{class:`wui-gantt-legend-note`},t.legendRemaining);e.setAttribute(`role`,`listitem`),n.append(e)}return n}_stateBlock(t,n){let i=N(),a=r(`div`,{class:`wui-gantt-state`});if(t===`error`){a.setAttribute(`role`,`alert`),a.append(r(`p`,null,n));let t=r(`button`,{class:e(`neutral`,`soft`,`sm`)},i.retryLabel);t.type=`button`,t.setAttribute(B,`retry`),a.append(t)}else a.append(r(`p`,null,n));return a}_emptyBlock(t){let n=N(),i=r(`div`,{class:`wui-gantt-state`});if(i.append(r(`p`,{class:`fw-semibold`},n.emptyTitle),r(`p`,null,t.emptyText||n.emptyText)),t.addTask){let t=r(`button`,{class:e(`primary`,`solid`,`sm`)},n.addTaskLabel);t.type=`button`,t.setAttribute(B,`add`),i.append(t)}return i}_fillSkeleton(e,t,n){let i=r(`div`,{class:`visually-hidden`},t.loadingText||N().loadingText);i.setAttribute(`role`,`status`);for(let t=0;t<W;t+=1){let i=r(`div`,{class:`wui-gantt-skeleton`});i.style.top=Y(t*n.rowH+n.barTop),i.style.left=Y(40+t*60),i.style.width=Y(240),i.style.height=Y(n.barH),i.setAttribute(`aria-hidden`,`true`),e.append(i)}return i}_fillLane(e,t,n){let i=N(),{axis:a}=n,o=n.layout===`table`;e.style.height=Y(n.height),e.setAttribute(`role`,`list`),e.setAttribute(`aria-label`,t.title);let s=r(`p`,{class:`visually-hidden`},o?i.helpTextTable:i.helpText);s.id=`${this.uid}-help`,e.setAttribute(`aria-describedby`,s.id);let c=(e,t,n,i,a)=>{let o=r(`div`,{class:e});return o.setAttribute(`aria-hidden`,`true`),o.style.left=Y(t),o.style.top=Y(n),o.style.width=Y(i),o.style.height=Y(a),o},l=[s];for(let e of n.rows){if(e.height===0)continue;let t=c(`wui-gantt-row`,0,e.top,a.width,e.height);o&&e.kind!==`group`&&e.row.key===this._selected&&(t.dataset.selected=`true`),l.push(t)}for(let e of a.weekendX)l.push(c(`wui-gantt-weekend`,e,0,a.ppd,n.height));for(let e of a.gridX)l.push(c(`wui-gantt-grid`,e,0,1,n.height));if(n.today.inWindow){l.push(c(`wui-gantt-today`,n.today.x-1,0,2,n.height));let e=r(`div`,{class:`wui-gantt-today-flag rounded-pill`},i.todayLabel);e.style.left=Y(n.today.x),l.push(e)}let u=new Map(t.rows.map(e=>[e.key,e]));for(let e of n.rows){if(e.hidden)continue;let t=r(`div`,{class:`wui-gantt-item`});t.setAttribute(`role`,`listitem`),t.style.display=`contents`,e.kind===`group`?this._drawGroup(t,e,n):e.kind===`milestone`?this._drawMilestone(t,e,u,n):this._drawBar(t,e,u,n),l.push(t)}l.push(this._deps(n)),this._card=o?null:this._details(n,u),e.append(...l);let d=e.querySelector(`[${B}^="${V}"]`);d instanceof HTMLElement&&(d.tabIndex=0)}_names(e,t){return(e.dependsOn??[]).map(e=>t.get(e)?.name??e).join(`, `)}_barSentence(e,t){let n=N(),r=this._names(e,t);if(e.end===void 0){let t=p(u(e.start??``));return r?S(n.milestoneBarLabel,{name:e.name,date:t,names:r}):`${e.name}, ${t}, ${n.milestoneLabel.toLowerCase()}`}let i=S(n.barLabel,{name:e.name,start:p(u(e.start??``)),end:p(u(e.end)),percent:Q(e),status:Z($(e)).toLowerCase()});return r?S(n.barLabelAfter,{label:i,names:r}):i}_focusable(e,t,n,i){let a=r(`button`,{class:t});a.type=`button`;let o=this._barSentence(e,n);return a.setAttribute(`aria-label`,o),a.title=o,a.tabIndex=-1,a.dataset.status=$(e),a.dataset.wuiGanttKey=e.key,a.setAttribute(B,`${V}${e.key}`),i?a.setAttribute(`aria-pressed`,String(this._selected===e.key)):a.setAttribute(`aria-expanded`,String(this._selected===e.key)),this._selected===e.key&&(a.dataset.selected=`true`),a}_afterLabel(e,t,n,i){let a=r(`span`,{class:`wui-gantt-label wui-gantt-label-surface`},e);return a.style.left=Y(t),a.style.top=Y(n),a.style.height=Y(i),a}_drawBar(e,t,n,i){let{row:a}=t,{geometry:o}=i,s=i.layout===`table`,c=this._focusable(a,`wui-gantt-bar rounded-2`,n,s),l=t.top+o.barTop;c.style.left=Y(t.x),c.style.width=Y(t.w),c.style.top=Y(l),c.style.height=Y(o.barH);let u=Q(a),d=r(`span`,{class:`wui-gantt-bar-progress`});if(d.style.width=`${u}%`,c.append(d),e.append(c),s)return;let f=`${a.name} ${u}%`;t.place===`inside`?c.append(r(`span`,{class:`wui-gantt-bar-label`},f)):e.append(this._afterLabel(f,t.x+t.w+G,l,o.barH))}_drawMilestone(e,t,n,r){let{row:i}=t,{geometry:a}=r,o=r.layout===`table`,s=f.milestone/2,c=t.top+(a.rowH-f.milestone)/2,l=this._focusable(i,`wui-gantt-milestone`,n,o);if(l.style.left=Y(t.x-s),l.style.top=Y(c),l.style.width=Y(f.milestone),l.style.height=Y(f.milestone),e.append(l),o)return;let d=this._afterLabel(`${i.name}, ${p(u(i.start??``))}`,t.x+f.milestone,t.top+a.barTop,a.barH);t.flip&&(d.style.left=``,d.style.right=Y(r.axis.width-(t.x-f.milestone))),e.append(d)}_drawGroup(e,t,n){let i=N(),a=t.group;if(!a)return;if(n.layout===`lanes`){let n=r(`div`,{class:`wui-gantt-group wui-gantt-label wui-gantt-label-surface`});n.dataset.wuiGanttGroup=a.name,n.style.left=Y(8),n.style.top=Y(t.top+6);let o=r(`button`,{class:`wui-gantt-group-toggle`});o.type=`button`,o.setAttribute(`aria-expanded`,String(!a.folded)),o.setAttribute(`aria-label`,S(a.folded?i.unfoldLabel:i.foldLabel,{group:a.name})),o.setAttribute(B,`group:${a.name}`);let s=y(a.folded?`chevron-right`:`chevron-down`,{size:16});o.replaceChildren(...s?[s]:[]),n.append(o,r(`span`,null,a.name),r(`span`,null,b(i,`groupSummary`,a.count,{percent:a.percent}))),e.append(n)}let o=r(`div`,{class:`wui-gantt-group-summary`});o.dataset.wuiGanttGroup=a.name,o.style.left=Y(t.x),o.style.width=Y(t.w),o.style.top=Y(t.top+n.geometry.groupBarTop),o.style.height=Y(f.groupBarH),e.append(o)}_deps(e){let t=document.createElementNS(H,`svg`);t.setAttribute(`class`,`wui-gantt-deps`),t.setAttribute(`aria-hidden`,`true`),t.setAttribute(`width`,String(e.axis.width)),t.setAttribute(`height`,String(e.height));for(let n of e.arrows){let e=document.createElementNS(H,`path`);e.setAttribute(`d`,n.d),e.setAttribute(`fill`,`none`);let r=document.createElementNS(H,`polygon`);r.setAttribute(`points`,n.head),e.dataset.from=n.fromKey,e.dataset.to=n.toKey,t.append(e,r)}return t}_details(t,n){let i=this._selected,a=i===null?void 0:t.rows.find(e=>e.row.key===i&&e.kind!==`group`&&!e.hidden);if(!a)return null;let o=N(),{row:s}=a,c=r(`div`,{class:`wui-gantt-details`});c.setAttribute(`role`,`group`),c.setAttribute(`aria-label`,s.name),c.style.width=Y(K);let l=r(`dl`),d=(e,t)=>{l.append(r(`dt`,null,e),r(`dd`,null,t))},f=p(u(s.start??``));s.owner&&d(o.detailsOwner,s.owner),d(o.detailsDates,s.end===void 0?f:S(o.detailsRange,{start:f,end:p(u(s.end))})),s.end!==void 0&&d(o.detailsDone,`${Q(s)}%, ${Z($(s))}`);let m=this._names(s,n);m&&d(o.detailsStartsAfter,m);let h=r(`button`,{class:e(`neutral`,`ghost`,`sm`)},o.detailsCloseLabel);return h.type=`button`,h.setAttribute(B,`close`),c.append(r(`h3`,{class:`h6`},s.name),l,h),c}};export{te as t};
@@ -1 +0,0 @@
1
- import{i as e}from"./calendarMath-CT99RyhR.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-DTW53DjY.js";import{n as o}from"./imeSafeEnter-DeO_3lXy.js";import{n as s,t as c}from"./inlineEditText-DRBhMnam.js";import{m as l}from"./wuiHttp-Cw7V8u2w.js";import{r as u,t as d}from"./textStore-DBplASiZ.js";import{n as f,t as p}from"./inlineEdit.g-DLDVospu.js";import{t as m}from"./httpFailure.g-DjZzGxPj.js";var h=()=>u(`inlineEdit`,p),g=()=>u(`asyncBlock`,f),_=e=>typeof e==`object`&&!!e&&`value`in e&&typeof e.value==`string`&&`label`in e&&typeof e.label==`string`;async function v(e){let t=await l(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(_))throw Error(`Options must be a JSON array of { value, label } strings.`);return r.filter(_)}var y=e=>s.some(t=>t===e),b=`[data-wui-display]`,x=`[data-wui-value]`,S=`[data-wui-editor]`,C=`[data-wui-control]`,w=`[data-wui-error]`,T=`[data-wui-live]`,E=`[aria-expanded="true"]`,D=/* @__PURE__ */ new Set([`select`,`date`]),O=e=>{let t=(typeof e==`object`||typeof e==`function`)&&e!==null&&`message`in e?e.message:void 0;return typeof t==`string`&&t?t:h().serverMessage},k=e=>e instanceof HTMLElement&&typeof(`value`in e?e.value:void 0)==`string`,A=(e,t)=>{let n=e?.querySelector(t)??null;return n instanceof HTMLElement?n:null},j=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=A(this,b),t=A(this,S),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:g().loadingLabel}]}),this._optionsLoading=v(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=A(this,w);if(!e)return;let t=g(),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(b)?.contains(t)&&this.edit()}_onKeyCapture(){this._popupOpen=!!(this._editing&&this.querySelector(S)?.querySelector(E))}_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`||D.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||!D.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(d(h().savedText,{label:o})),this._fire(`wui:inline-edit:saved`,{value:e,previous:t})):(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(d(h().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:O(e)}}}let n=this.getAttribute(`action`);if(!n)return{ok:!0};let r=new URLSearchParams({[this.getAttribute(`name`)||`value`]:e}),i=await l(n,{method:`POST`,body:r});if(i.ok)return{ok:!0,text:i.html.trim()};let a={forbidden:h().forbiddenMessage,networkCheck:u(`httpFailure`,m).networkCheckText,client:h().clientMessage,validation:h().validationMessage,server:h().serverMessage,network:h().networkMessage};return{ok:!1,kind:i.kind,message:i.message||a[i.kind]||h().serverMessage}}_close(){let e=A(this,b),t=A(this,S),n=this.contains(document.activeElement);this._editing=!1,this.removeAttribute(`data-wui-editing`),t&&(t.hidden=!0),e&&(e.hidden=!1),A(t,E)?.click(),n&&e?.focus()}_focusControl(e){if(!D.has(this._type())){e.focus(),e.select?.();return}let t=A(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(x);return e?{nodes:[...e.childNodes].map(e=>e.cloneNode(!0)),empty:e.hasAttribute(`data-wui-empty`)}:null}_restoreShown(e){let t=this.querySelector(x);t&&(t.replaceChildren(...e.nodes),t.toggleAttribute(`data-wui-empty`,e.empty))}_showText(e,t){let n=this.querySelector(x);n&&(n.textContent=e,n.toggleAttribute(`data-wui-empty`,t))}_setError(e){let t=A(this,w),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(T);t&&e&&(t.textContent=``,t.textContent=e)}_fire(e,t){this.dispatchEvent(new CustomEvent(e,{bubbles:!0,detail:t}))}_control(){let e=this.querySelector(C);return k(e)?e:null}_value(){return this.getAttribute(`value`)??``}_type(){let e=this.getAttribute(`type`);return y(e)?e:`text`}_grouping(){let e=this.getAttribute(`grouping`)??`none`;if(!n(e))throw Error(t(e));return e}};export{j 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-DTW53DjY.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-BHD2QV02.js";import{t as h}from"./serverHtml-BC6tAyAl.js";import{m as g}from"./wuiHttp-Cw7V8u2w.js";import{n as _,r as v,t as y}from"./textStore-DBplASiZ.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,n){n.readOnly=t(e)||e.hasAttribute(`loading`)}function M(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`),j(e,n),A(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 N=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`,`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)||M(this);let e=this._requireControl(),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`?(j(this,r),n!==null&&this._close(),this._syncState()):e===`loading`?(j(this,r),this._syncState(),this._query!==null&&this._renderMenu()):e===`size`?A(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,N as r,S as t};
@@ -1 +0,0 @@
1
- import{i as e}from"./dom-DMQu--xV.js";import{t}from"./elementBase-Cxeyx0tU.js";import{t as n}from"./isDrawn-BbF4phmB.js";import{a as r,l as i,m as a,s as o}from"./nativeOverlay-BHD2QV02.js";import{o as s,r as c,s as l}from"./notificationDays-wMr8rZko.js";import{m as u}from"./wuiHttp-Cw7V8u2w.js";import{r as d}from"./textStore-DBplASiZ.js";import{t as f}from"./httpFailure.g-DjZzGxPj.js";import{t as p}from"./notificationCentre.g-UsAurkUz.js";var m=()=>d(`notificationCentre`,p),h=`.wui-notification-center-trigger`,g=`.wui-notification-center-panel`,_=`.wui-notification-center-count`,v=`.wui-notification-center-live`,y=`.wui-notification-center-markall`,b=`.wui-notification-center-item`,x=`wui-notification-center-item-read`,S=`.wui-notification-center-unread-label`,C=`.app-tabs`,w=`.wui-notification-center-tabs [role='tablist']`,T=`.wui-notification-center-tabs [role='tab']`,E=`.wui-notification-center-empty`,D=`(max-width: 767.98px)`,O={ArrowDown:1,ArrowUp:-1,Home:`first`,End:`last`},k=e=>!!e,A=()=>({forbidden:m().forbiddenMessage,networkCheck:d(`httpFailure`,f).networkCheckText,client:m().clientMessage,validation:m().clientMessage,server:m().serverMessage,network:m().networkMessage}),j=(e,t)=>{let n=e.querySelector(t);return n instanceof HTMLElement?n:null},M=(e,t)=>[...e.querySelectorAll(t)].filter(e=>e instanceof HTMLElement),N=class extends t{constructor(){super(),this._unread=0,this._busy=!1,this._sheet=!1,this._awaitChildren=null,this._onClick=e=>this._click(e),this._onKeyDown=e=>this._key(e),this._onToggle=e=>{e.type===`toggle`&&`newState`in e&&e.newState===`closed`&&this._closedByBrowser()},this._onFocusOut=e=>{let t=e.relatedTarget;t instanceof Node&&!this.contains(t)&&this.close()}}static get observedAttributes(){return[`open`]}connectedCallback(){this._unread=this._initialUnread(),this.addEventListener(`click`,this._onClick),this.addEventListener(`keydown`,this._onKeyDown),this.addEventListener(`focusout`,this._onFocusOut),this.addEventListener(`toggle`,this._onToggle,!0),this.isOpen&&(j(this,g)===null||j(this,h)===null)?(this._awaitChildren=new MutationObserver(()=>this._finishAwaitedOpen()),this._awaitChildren.observe(this,{childList:!0})):(this._syncOpen(),this.isOpen&&this._showPanel())}disconnectedCallback(){this._disarmAwait(),this.removeEventListener(`click`,this._onClick),this.removeEventListener(`keydown`,this._onKeyDown),this.removeEventListener(`focusout`,this._onFocusOut),this.removeEventListener(`toggle`,this._onToggle,!0);let e=j(this,g);e&&r(e)}attributeChangedCallback(e,t,n){e===`open`&&t!==n&&(this._awaitChildren?n===null&&this._disarmAwait():this.isConnected&&(n===null?this._hidePanel():this._showPanel()))}_finishAwaitedOpen(){j(this,g)!==null&&j(this,h)!==null&&(this._disarmAwait(),this._syncOpen(),this._showPanel())}_disarmAwait(){this._awaitChildren?.disconnect(),this._awaitChildren=null}_showPanel(){let t=e(j(this,g),`<wui-notification-center> needs its panel to open.`),n=e(j(this,h),`<wui-notification-center> needs its trigger to open.`);o(t)||(this._sheet=window.matchMedia(D).matches,this._sheet?a(t,!0):i(n,t,{mode:`auto`,onClosed:()=>this._closedByBrowser()}),o(t)&&this._layoutTabs())}_hidePanel(){let e=j(this,g);e&&o(e)&&(this._sheet?a(e,!1):r(e))}_closedByBrowser(){if(!this.isConnected||!this.hasAttribute(`open`))return;let e=j(this,g);this.close({restoreFocus:e?.contains(this.ownerDocument.activeElement)??!1})}get isOpen(){return this.hasAttribute(`open`)}open(){this.isOpen||(e(j(this,g),`<wui-notification-center> needs its panel to open.`),e(j(this,h),`<wui-notification-center> needs its trigger to open.`),this.setAttribute(`open`,``),this._syncOpen(),j(this,g)?.focus(),this._announceToggle())}close({restoreFocus:e=!1}={}){this.isOpen&&(this.removeAttribute(`open`),this._syncOpen(),e&&j(this,h)?.focus(),this._announceToggle())}toggle(){this.isOpen?this.close():this.open()}_announceToggle(){this.dispatchEvent(new CustomEvent(`wui:notification-center:toggle`,{bubbles:!0,detail:{open:this.isOpen}}))}_syncOpen(){this.querySelector(h)?.setAttribute(`aria-expanded`,this.isOpen?`true`:`false`)}_initialUnread(){let e=Number.parseInt(this.getAttribute(`unread`)??``,10);return Number.isInteger(e)&&e>=0?e:this.querySelectorAll(`${b}:not(.${x}):not([data-archived="true"])`).length}_click(e){let t=e.target;if(!(t instanceof Element))return;let n=t.closest(T);if(n instanceof HTMLElement&&this.contains(n)){if(this.hasAttribute(`controlled`))return;this._pickTab(n);return}let r=t.closest(`${h}, ${y}, ${b}`);r instanceof HTMLElement&&this.contains(r)&&(r.matches(h)?this.toggle():this.hasAttribute(`controlled`)||(r.matches(y)?this._markAll():this._markItem(r)))}_key(e){if(!this.isOpen)return;let t=e.target;if(!(t instanceof Element))throw Error(`Keyboard event target is not an element.`);if(!this.querySelector(g)?.contains(t)||t.closest(C))return;let r=O[e.key];if(r===void 0)return;let i=M(this,b).filter(n);if(i.length===0)return;let a=t.closest(b),o=a instanceof HTMLElement?i.indexOf(a):-1,s;s=r===`first`?0:r===`last`?i.length-1:o===-1?r===1?0:i.length-1:Math.min(i.length-1,Math.max(0,o+r)),e.preventDefault(),i[s]?.focus()}_markItem(e){e.classList.contains(x)||(this._applyRead(e),e.dataset.archived!==`true`&&(this._unread=Math.max(0,this._unread-1)),this._render(),this._say(l(this._unread)),this._emitRead([e.dataset.id].filter(k),!1))}async _markAll(){if(this._busy)return;let e=M(this,`${b}:not(.${x})`);if(e.length===0&&this._unread===0)return;let t=e.map(e=>e.dataset.id).filter(k),n=this.getAttribute(`read-action`);if(n){this._setBusy(!0);let e=new URLSearchParams;for(let n of t)e.append(`ids`,n);let r=await u(n,{method:`POST`,body:e});if(this._setBusy(!1),!r.ok){if(r.kind===`session`||r.kind===`aborted`)return;let e=r.kind,t=r.message||A()[e]||m().serverMessage;this._say(t),this.dispatchEvent(new CustomEvent(`wui:notification-center:failed`,{bubbles:!0,detail:{kind:e,message:t}}));return}}for(let t of e)this._applyRead(t);this._unread=0,this._render(),this._say(m().allReadText),this._emitRead(t,!0)}_pickTab(e){let t=e.closest(w);if(t instanceof HTMLElement){for(let n of M(t,T)){let t=n===e;n.classList.toggle(`active`,t),n.setAttribute(`aria-selected`,t?`true`:`false`),n.setAttribute(`tabindex`,t?`0`:`-1`)}this._layoutTabs(),this._filterItems(e.dataset.key)}}_layoutTabs(){for(let e of M(this,w)){let t=j(e,`.app-tab.active`);t&&(e.style.setProperty(`--wui-tab-x`,`${t.offsetLeft}px`),e.style.setProperty(`--wui-tab-w`,`${t.offsetWidth}px`)),e.setAttribute(`data-wui-tabs`,``)}}_filterItems(e){let t=!1;for(let n of M(this,b)){let r=n.dataset.archived===`true`,i=n.classList.contains(x),a=e===`archived`?r:!r&&(e!==`unread`||!i);a&&(t=!0);let o=n.closest(`li`);o&&(o.hidden=!a)}for(let e of M(this,`.wui-notification-center-list section`))e.hidden=[...e.querySelectorAll(`li`)].every(e=>e.hidden);let n=j(this,E);n&&(n.hidden=t)}_applyRead(e){e.classList.add(x),e.querySelector(S)?.remove()}_setBusy(e){this._busy=e;let t=this.querySelector(y);t instanceof HTMLButtonElement&&(t.disabled=e||this._unread===0,e?t.setAttribute(`aria-busy`,`true`):t.removeAttribute(`aria-busy`))}_render(){let e=j(this,_);e&&(e.textContent=c(this._unread),e.hidden=this._unread===0),this.querySelector(h)?.setAttribute(`aria-label`,s(this.getAttribute(`label`)||m().label,this._unread));let t=this.querySelector(y);t instanceof HTMLButtonElement&&(t.disabled=this._unread===0)}_say(e){let t=this.querySelector(v);t&&(t.textContent=e)}_emitRead(e,t){this.dispatchEvent(new CustomEvent(`wui:notification-center:read`,{bubbles:!0,detail:{ids:e,all:t}}))}};export{N as t};
@@ -1 +0,0 @@
1
- import{t as e}from"./anchorOverlay-daGdh_91.js";import{t}from"./avatarNode-BaEvz5Xr.js";import{n}from"./devWarn-DXdRWZs3.js";import{i as r,r as i}from"./dom-DMQu--xV.js";import{t as a}from"./elementBase-Cxeyx0tU.js";import{r as o,t as s}from"./fieldState-D-zQcXUS.js";import{n as c,t as l}from"./formMirror-9IpSgeZb.js";import{n as u}from"./loader-A38-PdcB.js";import{t as d}from"./iconGlyphs.g-a9FtjPXh.js";import{n as f}from"./imeSafeEnter-DeO_3lXy.js";import{n as p,t as m}from"./listboxKeyNav-CNso9shL.js";import{a as h,l as g,s as _}from"./nativeOverlay-BHD2QV02.js";import{i as v,n as y,t as b}from"./optionLabel-wbpl8OTJ.js";import{r as x}from"./textStore-DBplASiZ.js";import{n as S,r as C,t as w}from"./search.g-B5d1s59A.js";import{t as T}from"./hasOwn-CJsplJ62.js";import{n as E,r as D,t as O}from"./window-BZWK3rQk.js";var k=()=>x(`select`,C);function A(e,t){let n=String(t??``).trim().toLowerCase();return n?e.filter(e=>[y(e),e.description,e.meta].some(e=>String(e??``).toLowerCase().includes(n))):e}var j=/* @__PURE__ */ new WeakMap,M=e=>e?{"data-index":String(e.index),"aria-setsize":String(e.size),"aria-posinset":String(e.index+1)}:{},N=e=>e.map(e=>e instanceof Element?e.outerHTML:e.textContent??``).join(``),P;function F(e){P=e}function I(e){P?.clear(e),j.delete(e),e.replaceChildren()}function L(e,t,n={}){let{selected:r=[],query:a=``,status:o=`idle`,emptyText:s=k().emptyText,searchingText:c=k().searchingText,hintText:l=k().hintText,actionRow:u=[],recents:d=null}=n,f=new Set(r.map(String)),p=A(t,a),m=e.id,h=u.filter(e=>e.position===`top`),g=u.filter(e=>e.position===`bottom`),_=d?.options.length?d.options:[],v=h.length+_.length+p.length+g.length,y=p.length>300,b=P,x=y&&b!==void 0,S=e=>x?{index:e,size:v}:void 0,C=0,w=e=>{let t=C++;return i(`button`,{type:`button`,role:`option`,id:R(m,t),class:`wui-select-option wui-select-add`,"data-value":String(e.value??``),"data-custom":`true`,"aria-selected":`false`,...M(S(t))},e.label)},T=e=>{let t=C++;return V(e,R(m,t),f.has(String(e.value)),S(t))},E=h.map(w),D=_.length&&d?[i(`div`,{class:`wui-select-group`},d.label),..._.map(T),i(`div`,{class:`wui-select-sep`,"aria-hidden":`true`})]:[],O=C,F=[];if(x)C+=p.length;else{let e=``;for(let t of p)t.group&&t.group!==e&&F.push(i(`div`,{class:`wui-select-group`},t.group)),e=t.group??``,F.push(T(t))}let I=g.map(w),L=[];if(o===`loading`?L=[i(`div`,{class:`wui-select-loading`},i(`span`,{class:`wui-select-spinner spinner-border spinner-border-sm`,role:`status`,"aria-hidden":`true`}),c)]:o===`hint`?L=[i(`div`,{class:`wui-select-hint`},l)]:(o===`empty`||p.length===0&&u.length===0)&&(L=[i(`div`,{class:`wui-select-empty`},s)]),x&&b){let n=[...E,...D],r=[...I,...L];return b.render(e,{options:t,query:a,rows:p,pre:n,post:r,preSig:N(n),postSig:N(r),picked:f,top:h,recent:_,bottom:g,bodyBase:O,total:v}),{rows:v,windowed:!0,long:y}}b?.clear(e);let z=[...E,...D,...F,...I,...L],B=N(z);return j.get(e)===B||(j.set(e,B),e.replaceChildren(...z)),{rows:C,windowed:!1,long:y}}var R=(e,t)=>`${e}-opt-${t}`,z=e=>[...e.querySelectorAll(`.wui-select-option`)];function B(e){return P?P.refresh(e):!1}function ee(e,t){return P?P.reveal(e,t):z(e)[t]??null}function te(e,t){if(P)return P.indexOfValue(e,t);let n=new Set(t.map(String));return z(e).findIndex(e=>n.has(e.dataset.value??``))}function ne(e,t){return P?P.indexByPrefix(e,t):z(e).findIndex(e=>(e.textContent??``).trim().toLowerCase().startsWith(t))}function V(e,n,r,a){let o=!!e.disabled,s={id:n,role:`option`,"data-value":String(e.value??``),"aria-selected":String(r),"aria-disabled":o?`true`:void 0,title:o&&e.disabledHint?e.disabledHint:void 0,...M(a)},c=i(`span`,{class:`wui-select-check`,"aria-hidden":`true`},d(`check`));if(!e.description&&!e.meta)return i(`button`,{type:`button`,class:`wui-select-option${r?` selected`:``}`,...s},t(e),i(`span`,{class:`wui-select-opt-name`},...b(e)),c);let l=e.description?i(`span`,{class:`wui-select-opt-desc`},e.description):null,u=e.meta?i(`span`,{class:`wui-select-opt-meta`},e.meta):null;return i(`div`,{class:`wui-select-option wui-select-option-rich${r?` selected`:``}`,...s},t(e),i(`span`,{class:`wui-select-option-text`},i(`span`,{class:`wui-opt-label`},...b(e)),l),u,c)}var re=Object.freeze([`single`,`multiple`,`search`,`tag`,`country`]),H=e=>e===`multiple`||e===`tag`,ie={recents:()=>import(`./recents-B9efQ1Au.js`),chips:()=>import(`./chips-BdpsN50B.js`),search:()=>import(`./search-Dl07KqWw.js`),country:()=>import(`./country-T7AfpJpN.js`)};function ae(e){let t=T(ie,e)?ie[e]:void 0;return t?t():Promise.reject(/* @__PURE__ */ Error(`Unknown <wui-select> part: ${e}.`))}var U=e=>typeof e.loadOptions==`function`||!!e.getAttribute(`source`)||e.hasAttribute(`remote`),oe=300,W=`<div class="wui-select-spacer" aria-hidden="true"></div>`,G=()=>i(`div`,{class:`wui-select-spacer`,"aria-hidden":`true`}),K=/* @__PURE__ */ new WeakMap;function se(e,t,n,r){let i=K.get(e);if(i&&i.options===t&&i.query===n&&i.count===r.length)return i;let a=[],o=new Int32Array(r.length),s=``;r.forEach((e,t)=>{e.group&&e.group!==s&&a.push({kind:`group`,label:e.group}),s=e.group??``,o[t]=a.length,a.push({kind:`option`,option:e,ord:t})});let c={options:t,query:n,count:r.length,entries:a,optionEntry:o,heights:O(a.length),estimated:!1,bodyTop:0,start:0,end:0,pre:[],post:[],preSig:``,postSig:``,picked:/* @__PURE__ */ new Set,top:[],recent:[],bottom:[],bodyBase:0,total:0};return K.set(e,c),e.scrollTop=0,c}var q=e=>e.clientHeight||oe,J=(e,t)=>D(t.heights,{scrollTop:Math.max(0,e.scrollTop-t.bodyTop),viewport:q(e)});function ce(e,t,n,r){let a=[];for(let o=n;o<r;o++){let n=e.entries[o];if(n){if(n.kind===`group`)a.push(i(`div`,{class:`wui-select-group`,"data-entry":o},n.label));else{let r=e.bodyBase+n.ord;a.push(V(n.option,R(t,r),e.picked.has(String(n.option.value)),{index:r,size:e.total}))}}}return a}function le(e,t){let[n,r]=e.querySelectorAll(`.wui-select-spacer`);n&&r&&(n.style.flex=r.style.flex=`none`,n.style.height=`${t.heights.offsetOf(t.start)}px`,r.style.height=`${t.heights.total()-t.heights.offsetOf(t.end)}px`)}function ue(e,t){let{start:n,end:r}=J(e,t);t.start=n,t.end=r;let i=ce(t,e.id,n,r),a=t.preSig+W+N(i)+W+t.postSig,o=e.scrollTop;j.get(e)!==a&&(j.set(e,a),e.replaceChildren(...t.pre,G(),...i,G(),...t.post)),le(e,t),e.scrollTop!==o&&(e.scrollTop=o)}function de(e,t){let n={changed:!1,delta:0};if(!e.clientHeight)return n;let{heights:r}=t,i=e.querySelector(`.wui-select-spacer`),a=[],o=!0,s=!1;if(i){let n=i.getBoundingClientRect().top-e.getBoundingClientRect().top+e.scrollTop;Math.abs(n-t.bodyTop)>.5&&(t.bodyTop=n,s=!0)}let c=r.indexAt(Math.max(0,e.scrollTop-t.bodyTop)),l=r.offsetOf(c),u=0;for(let n of e.querySelectorAll(`.wui-select-option[data-index], .wui-select-group[data-entry]`)){let e=n.getBoundingClientRect().height;if(n.dataset.entry!==void 0)a.push([Number(n.dataset.entry),e]);else{let r=Number(n.dataset.index)-t.bodyBase,i=r>=0?t.optionEntry[r]:void 0;if(i===void 0)continue;o&&(u=e),o=!1,a.push([i,e])}}if(!t.estimated&&u>0){let e=r.estimate;r.setEstimate(u),t.estimated=!0,r.estimate!==e&&(s=!0)}for(let[e,t]of a)r.set(e,t)&&(s=!0);return s?{changed:s,delta:r.offsetOf(c)-l}:n}function Y(e,t){ue(e,t);for(let n=0;n<2;n++){let{changed:n,delta:r}=de(e,t);if(!n)return;le(e,t),r&&(e.scrollTop+=r),ue(e,t)}}function fe(e,t){let n=se(e,t.options,t.query,t.rows);Object.assign(n,{pre:t.pre,post:t.post,preSig:t.preSig,postSig:t.postSig,picked:t.picked,top:t.top,recent:t.recent,bottom:t.bottom,bodyBase:t.bodyBase,total:t.total}),Y(e,n)}function pe(e){let t=K.get(e);if(!t)return!1;let{start:n,end:r}=J(e,t);return n===t.start&&r===t.end?!1:(Y(e,t),!0)}function me(e,t){let n=K.get(e);if(!n||t<0||t>=n.total)return null;let r=t-n.bodyBase,i=r>=0?n.optionEntry[r]:void 0,a=()=>e.querySelector(`[data-index="${t}"]`);if(i===void 0)return a();for(let t=0;t<2;t++){let t={scrollTop:e.scrollTop-n.bodyTop,viewport:q(e)},r=n.bodyTop+E(n.heights,i,t);if(Math.abs(r-e.scrollTop)>.5)e.scrollTop=r;else if(a())break;Y(e,n)}return a()}function he(e,t){if(t<0||t>=e.total)return;if(t<e.top.length)return e.top[t];let n=t-e.top.length;if(n<e.recent.length)return e.recent[n];let r=t-e.bodyBase;if(r<e.count){let t=e.entries[e.optionEntry[r]??-1];return t?.kind===`option`?t.option:void 0}return e.bottom[r-e.count]}var ge=e=>e&&!(`position`in e)?e:void 0;function _e(e,t){let n=K.get(e);if(!n||t.length===0)return-1;let r=new Set(t.map(String));for(let e=0;e<n.total;e++){let t=ge(he(n,e));if(t&&r.has(String(t.value)))return e}return-1}var ve=e=>`position`in e?e.label:`${e.initials??``}${y(e)}${e.description??``}${e.meta??``}`;function ye(e,t){let n=K.get(e);if(!n)return-1;for(let e=0;e<n.total;e++){let r=he(n,e);if(r&&ve(r).trim().toLowerCase().startsWith(t))return e}return-1}F({render:fe,refresh:pe,reveal:me,indexOfValue:_e,indexByPrefix:ye,clear(e){K.delete(e)}});function be(){return Promise.resolve()}var X=()=>x(`select`,C),xe=()=>x(`search`,w),Se=()=>x(`field`,S),Ce=class extends a{static formAssociated=!0;_internals;_value;_optionsProp;_partOptions;_known;_loadOptionsFn;_validateFn;_declared;_query;_ownsFilter;_active;_rows;_windowed;_windowLoad;_windowFailed;_scrollFrame;_status;_error;_nav;_parts;_partSig;_partsMounted;_partToken;_rendered;_searchShown;_defaultValue;_warnedMode;_warnedDensity;_hoverTimer;_hoverOpened;_onHoverOver;_onHoverOut;_panelShown;_pressOpen;static get observedAttributes(){return/* @__PURE__ */ `mode.value.placeholder.search-placeholder.empty-text.searchable.clearable.disabled.readonly.loading.required.size.density.icon.prefix.open.open-on-hover.lazy-options.aria-label.aria-describedby.aria-invalid.min-chars.debounce.source.remote.allow-custom.add-label.searching-text.hint-text.value-label.value-avatar.value-initials.max-tags.allow-duplicates.separators.pattern.invalid-message.create-label.collapse-chips.selected-text.clear-all-label.countries.suggested.suggested-label.all-countries-label.recents-key.recents-limit.recents-label`.split(`.`)}constructor(){super();try{this._internals=this.attachInternals()}catch{this._internals=null}this._value=``,this._optionsProp=null,this._partOptions=null,this._known=/* @__PURE__ */ new Map,this._loadOptionsFn=null,this._validateFn=null,this._declared=void 0,this._query=``,this._ownsFilter=!1,this._active=-1,this._rows=0,this._windowed=!1,this._windowLoad=null,this._windowFailed=!1,this._scrollFrame=null,this._status=`idle`,this._error=``,this._nav=null,this._parts=null,this._partSig=``,this._partsMounted=!1,this._partToken=0,this._rendered=!1,this._searchShown=!1,this._defaultValue=void 0,this._warnedMode=null,this._hoverTimer=null,this._hoverOpened=!1,this._panelShown=!1,this._pressOpen=null,this._onHoverOver=e=>{e.pointerType===`mouse`&&this._hoverZone(e.target)&&(this._clearHover(),!this._menuOpen()&&this._hoverEligible()&&(this._hoverTimer=setTimeout(()=>{this._hoverTimer=null,!this._menuOpen()&&this._hoverEligible()&&(this._open({focus:!1}),this._hoverOpened=!0)},De)))},this._onHoverOut=e=>{e.pointerType===`mouse`&&this._hoverZone(e.target)&&!this._hoverZone(e.relatedTarget)&&(this._clearHover(),this._menuOpen()&&this.hasAttribute(`open-on-hover`)&&(this._hoverTimer=setTimeout(()=>{this._hoverTimer=null,this._close()},Oe)))}}connectedCallback(){this.addEventListener(`pointerover`,this._onHoverOver),this.addEventListener(`pointerout`,this._onHoverOut),this._rendered||this.render(),this._ensureParts(),this._mountParts()}disconnectedCallback(){this.removeEventListener(`pointerover`,this._onHoverOver),this.removeEventListener(`pointerout`,this._onHoverOut),this._clearHover(),this._dropMenu(),this._teardown(),this._teardownParts()}attributeChangedCallback(e,t,n){e===`value`?(this._value=Z(n,H(this.mode)),this._applyValue()):e===`aria-invalid`?this._syncInvalid():e===`open`?this._rendered&&(this.hasAttribute(`open`)?this._open({focus:!1}):this._close({force:!0})):e===`open-on-hover`?this.hasAttribute(`open-on-hover`)||this._clearHover():e!==`lazy-options`&&(e===`mode`&&(this._value=Z(this._value,H(this.mode)),this._partOptions=null,this._known.clear(),this._ensureParts()),(e===`source`||e===`remote`||e===`recents-key`)&&this._ensureParts(),Me.has(e)?this._rendered&&(this._drawValue(),this.renderList()):je.has(e)?this._remountParts():this._rendered&&this.render())}formResetCallback(){if(this.value=this._defaultValue??``,!this._rendered)return;let e=this._refs();e.input&&(e.input.value=``,e.input.removeAttribute(`aria-invalid`)),e.search&&(e.search.value=``),this.setError(``),this._query!==``&&this._onQueryChange(``)}get mode(){let e=this.getAttribute(`mode`);return e===null?`single`:Te(e)?e:(e!==this._warnedMode&&(this._warnedMode=e,n(`<wui-select> mode "${e}" is not one of ${re.join(`, `)}; it is treated as "single".`)),`single`)}_checkDensity(){let e=this.getAttribute(`density`);e===null||Ee.includes(e)||e===this._warnedDensity||(this._warnedDensity=e,n(`<wui-select> density "${e}" is not one of ${Ee.join(`, `)}; it is treated as "comfortable".`))}set mode(e){this.setAttribute(`mode`,String(e))}get value(){return Array.isArray(this._value)?this._value.slice():this._value}set value(e){this._value=Z(e,H(this.mode)),this._applyValue()}get options(){return this._readOptions()}set options(e){this._optionsProp=Array.isArray(e)?e:null,this.mode!==`country`&&(this._partOptions=null);for(let e of this._activePartsList())e.onOptions?.();if(this._rendered){if(this.mode===`single`&&this.getAttribute(`searchable`)===null&&this._autoSearch()!==this._searchShown){this.render();return}this._drawValue(),this.renderList()}}get loadOptions(){return this._loadOptionsFn}set loadOptions(e){this._loadOptionsFn=typeof e==`function`?e:null,this._ensureParts()}get validate(){return this._validateFn}set validate(e){this._validateFn=typeof e==`function`?e:null}commit(e,t={}){this.value=e,this.dispatchEvent(new CustomEvent(`change`,{bubbles:!0,detail:{isCustom:!!t.isCustom}}))}setPartOptions(e){this._partOptions=Array.isArray(e)?e:null,this._drawValue(),this.renderList()}setStatus(e){this._status=e,this.renderList()}setError(e){this._error=e?String(e):``,this._syncError()}openMenu(){s(this)||this._open({focus:!1})}closeMenu({focusControl:e=!1}={}){this._close(),e&&this._refs().control?.focus()}renderList(){let e=this._refs();if(!e.list)return;let t=this._ownsFilter?``:this._query,n=this._actionRows(),r=this._recents();if(this.hasAttribute(`lazy-options`)&&!this._menuOpen()){this._rows=A(this._listOptions(),t).length+n.length+(r?.options.length??0),this._windowed=!1,I(e.list),this._anchorMenu();return}let i=L(e.list,this._listOptions(),{selected:this._selectedValues(),query:t,status:this._status,emptyText:this.getAttribute(`empty-text`)||X().emptyText,searchingText:this.getAttribute(`searching-text`)||X().searchingText,hintText:this.getAttribute(`hint-text`)||void 0,actionRow:n,recents:r});this._rows=i.rows,this._windowed=i.windowed,i.long&&!i.windowed&&!this._windowFailed&&this._loadWindow(),this._active>=this._rowCount()&&(this._active=-1),this._active>=0&&this._setActive(this._active,{reveal:!1}),this._anchorMenu()}render(){this._dropMenu();let e=this._carry();this._teardownParts(),this._snapshotDeclared();let t=this.mode;this._checkDensity();let n=H(t),r=t===`tag`,a=n&&(r||this.hasAttribute(`allow-custom`));this._value=Z(this._value,n),this._defaultValue===void 0&&n&&this._value.length===0&&(this._value=this._declaredSelected()),n||this._preselect(),this._defaultValue===void 0&&(this._defaultValue=Z(this._value,n));let s=this.getAttribute(`size`),c=s===`sm`?` wui-select-sm`:s===`lg`?` wui-select-lg`:s===`xl`?` wui-select-xl`:``,l=this.getAttribute(`icon`),u=this.getAttribute(`prefix`),f=this.hasAttribute(`clearable`),p=this.hasAttribute(`disabled`);if(!this.id){let e=crypto.getRandomValues(/* @__PURE__ */ new Uint8Array(8));this.id=`wui-select-${Array.from(e,e=>e.toString(16).padStart(2,`0`)).join(``)}`}let m=`${this.id}-listbox`,h=`${this.id}-entry-error`,g=this.getAttribute(`aria-describedby`)?.trim(),_=g?`${g} ${h}`:h,v=this.hasAttribute(`aria-invalid`)||!!this._error,y=this.hasAttribute(`required`)&&!a,b=this._accessibleName(),x=a?{}:{role:`combobox`,"aria-haspopup":`listbox`,"aria-expanded":`false`,"aria-controls":m},S={"aria-label":b,"aria-describedby":_,"aria-invalid":v?`true`:void 0,"aria-required":y?`true`:void 0},C=n?i(`div`,{class:`input wui-select-control wui-select-multi`,...x,...S,"aria-disabled":p?`true`:void 0,tabindex:!p&&!r?`0`:void 0}):i(`button`,{type:`button`,class:`input wui-select-control`,...x,...S,disabled:p||void 0}),w=[l?d(l,{className:`wui-select-icon`}):null,u?i(`span`,{class:`wui-select-prefix`},u):null,i(`span`,{class:`wui-select-value`,"data-label":!0}),f?i(`span`,{class:`wui-select-reset`,role:`button`,"aria-label":X().clearSelectionLabel,hidden:!0},d(`x`)):null,d(`chevron-down`,{className:`wui-select-caret`})];C.append(...w.filter(e=>e!==null));let T=this.getAttribute(`searchable`),E=T===null?t===`multiple`||t===`country`||this._autoSearch():T!==`false`,D=t===`search`||E&&!a;this._searchShown=D;let O=this.getAttribute(`search-placeholder`)||(t===`country`?X().countrySearchPlaceholder:xe().placeholder),k=D?i(`div`,{class:`wui-select-search`},d(`search`),i(`input`,{class:`wui-select-input`,placeholder:O,"aria-label":O,"aria-autocomplete":`list`}),i(`button`,{type:`button`,class:`wui-select-clear`,"aria-label":xe().clearLabel,hidden:!0},d(`x`))):null,A=i(`div`,{class:`wui-select-options`,role:`listbox`,id:m,tabindex:`-1`,"aria-multiselectable":n?`true`:void 0}),j=i(`div`,{class:`wui-select-menu wui-select-menu-fixed`,popover:`auto`},k,A),M=i(`div`,{class:`field-error wui-select-error`,id:h,"aria-live":`polite`,hidden:!this._error||void 0},this._error||null);this.replaceChildren(i(`div`,{class:`wui-select${c}`},C,j),M),this._rendered=!0,this._syncMirror(),this._syncValidity(),this._drawValue(),this._syncReset(),this.renderList(),this._wire(),o(this,this.querySelector(`.wui-select-control`)),this._mountParts(e)}_accessibleName(){return this.getAttribute(`aria-label`)||this.getAttribute(`placeholder`)||X().fallbackName}_snapshotDeclared(){if(this._declared)return;let e=[...this.querySelectorAll(`:scope > wui-option`)];e.length&&(this._declared=e.map(e=>{let t=document.createDocumentFragment();for(let n of e.childNodes)t.append(n.cloneNode(!0));let n={value:e.getAttribute(`value`)??$(e).trim(),label:t.textContent??``,selected:e.hasAttribute(`selected`)};for(let[t,r]of Ne){let i=e.getAttribute(t);i&&(n[r]=i)}return e.hasAttribute(`disabled`)&&(n.disabled=!0),v(n,t)}))}_readOptions(){return this.mode===`country`?this._partOptions||[]:this._partOptions?this._partOptions:this._optionsProp?this._optionsProp:(this._snapshotDeclared(),this._declared||[])}_listOptions(){let e=this._readOptions(),t=this.getAttribute(`value-label`);if(this.mode!==`search`||!t||this._value===``)return e;let n=String(this._value);return e.some(e=>String(e.value)===n)?e:[...e,{value:n,label:t}]}_declaredSelected(){return this._optionsProp?[]:(this._declared??[]).filter(e=>e.selected).map(e=>String(e.value))}_preselect(){let e=this._readOptions(),t=this._value!==``&&e.find(e=>String(e.value)===this._value)||e.find(e=>`selected`in e&&!!e.selected);t&&(this._value=String(t.value))}_optionFor(e){let t=String(e),n=this._readOptions().find(e=>String(e.value)===t);return n?(this._known.set(t,n),n):this._known.get(t)}_placeholder(){return this.getAttribute(`placeholder`)||Ae()[this.mode]}_hasValue(){return Array.isArray(this._value)?this._value.length>0:this._value!==``}_selectedValues(){return Array.isArray(this._value)?this._value:this._value===``?this._listOptions().some(e=>String(e.value)===``)?[``]:[]:[this._value]}_applyValue(){this._syncMirror(),this._syncValidity(),this._rendered&&(this._drawValue(),this._syncReset(),this.renderList())}_syncMirror(){H(this.mode)?c(this,this._selectedValues()):l(this,this._value)}_drawValue(){let e=this._refs();if(!e.value)return;let t=H(this.mode),n=t?void 0:this._optionFor(this._value);if(this._syncTitle(n),this._syncValueAvatar(),this._activePartsList().some(e=>e.renderValue?.()===!0))return;if(t){e.value.classList.remove(`wui-select-placeholder`),e.value.textContent=``;return}e.value.classList.toggle(`wui-select-placeholder`,!n);let r=this._placeholder();e.value.replaceChildren(...n?b(n):r?[r]:[])}_syncTitle(e){let t=this.querySelector(`.wui-select-control`);if(!t)return;let n=e&&!this.hasAttribute(`title`)?y(e).trim():``;n?t.setAttribute(`title`,n):t.removeAttribute(`title`)}_syncValueAvatar(){let e=this.querySelector(`.wui-select-control`);if(!e)return;e.querySelector(`:scope > .wui-select-value-avatar`)?.remove();let n=!H(this.mode)&&this._hasValue()?t({avatar:this.getAttribute(`value-avatar`),initials:this.getAttribute(`value-initials`)},`avatar-xs`):null;e.classList.toggle(`wui-has-value-avatar`,!!n),n&&e.prepend(i(`span`,{class:`wui-select-value-avatar`,"aria-hidden":`true`},n))}_syncValidity(){let e=this._internals;if(typeof e?.setValidity==`function`){if(this.hasAttribute(`required`)&&!this._hasValue()){let t=this.querySelector(`.wui-select-control`);e.setValidity({valueMissing:!0},Se().requiredFieldMessage,t instanceof HTMLElement?t:void 0)}else e.setValidity({})}}_syncReset(){let e=Q(this,`.wui-select-reset`,HTMLElement);e&&(e.hidden=!(this.hasAttribute(`clearable`)&&this._hasValue()&&!s(this)))}_syncInvalid(){let e=this.querySelector(`.wui-select-control`);e&&(this.hasAttribute(`aria-invalid`)||this._error?e.setAttribute(`aria-invalid`,`true`):e.removeAttribute(`aria-invalid`))}_syncError(){let e=Q(this,`.wui-select-error`,HTMLElement);e&&(e.textContent=this._error,e.hidden=!this._error),this._syncInvalid()}_refs(){return{control:Q(this,`.wui-select-control`,HTMLElement),value:Q(this,`.wui-select-value`,HTMLElement),menu:Q(this,`.wui-select-menu`,HTMLElement),list:Q(this,`.wui-select-options`,HTMLElement),search:Q(this,`.wui-select-search input`,HTMLInputElement),input:Q(this,`.wui-select-draft`,HTMLInputElement)}}_menuOpen(){let e=Q(this,`.wui-select-menu`,HTMLElement);return e!==null&&_(e)}_hoverZone(e){if(!(e instanceof Element))return!1;let t=e.closest(`.wui-select-control, .wui-select-menu`);return t!==null&&this.contains(t)}_hoverEligible(){if(!this.hasAttribute(`open-on-hover`)||s(this)||this.mode===`tag`)return!1;let e=this._refs();return e.search===null&&e.input===null}_clearHover(){this._hoverTimer!==null&&clearTimeout(this._hoverTimer),this._hoverTimer=null}_autoSearch(){return this.mode===`single`&&this.getAttribute(`searchable`)===null&&this._readOptions().length>ke}_visible(){let e=this._refs();return e.list?Re(e.list,`.wui-select-option`):[]}_rowCount(){return this._windowed?this._rows:this._visible().length}_rowEl(e){if(!this._windowed)return this._visible()[e];let t=this._refs().list?.querySelector(`[data-index="${e}"]`);return t instanceof HTMLElement?t:void 0}_setActive(e,{reveal:t=!0}={}){let n=this._refs();if(!n.list||!n.control)return;this._active=e;let r=null;e>=0&&e<this._rowCount()&&(r=this._rowEl(e)??(this._windowed&&t?ee(n.list,e):null)),p(n.list,r),r?(t&&r.scrollIntoView({block:`nearest`}),n.control.setAttribute(`aria-activedescendant`,r.id)):n.control.removeAttribute(`aria-activedescendant`)}_onListScroll(){this._scrollFrame=null;let e=this._refs().list;e&&B(e)&&this._active>=0&&this._setActive(this._active,{reveal:!1})}_actionRows(){let e=[];for(let t of this._activePartsList()){let n=t.actionRow?.(this._query);n&&e.push(n)}return e}_recents(){if(this._query.trim()!==``)return null;for(let e of this._activePartsList()){let t=e.recents?.(this._listOptions());if(t)return t}return null}_menuPlacement(e,t){let n=this.hasAttribute(`open`)?{below:!0}:{};if(this.getAttribute(`density`)!==`compact`)return{matchWidth:!0,...n};let r=e.getBoundingClientRect();return t.style.width=`max-content`,t.style.minWidth=`${r.width}px`,t.style.maxWidth=`280px`,n}_anchorMenu(){let t=this._refs();t.control&&t.menu&&this._menuOpen()&&e(t.control,t.menu,this._menuPlacement(t.control,t.menu))}_showMenu(e,t){g(e,t,{...this._menuPlacement(e,t),mode:`auto`,keepOffscreen:this.hasAttribute(`open`),onClosed:()=>this._onPanelClosed()}),this._panelShown=!0}_onPanelClosed(){if(!this._panelShown)return;this._panelShown=!1;let e=this._refs();e.control&&(e.control.setAttribute(`aria-expanded`,`false`),this._setActive(-1),this._nav?.clearTypeahead(),this.dispatchEvent(new CustomEvent(`wui-select:close`,{bubbles:!0})))}_open({focus:e=!0}={}){let t=this._refs();if(!t.menu||!t.control)return;let n=this._menuOpen();this._hoverOpened=!1,t.control.setAttribute(`aria-expanded`,`true`),this._query=t.input?t.input.value:``,this._ownsFilter=this._ownsFilter&&this._query!==``;let r=Q(this,`.wui-select-search .wui-select-clear`,HTMLElement);if(r&&(r.hidden=!0),t.search&&(t.search.value=``),n||this._showMenu(t.control,t.menu),this.renderList(),e&&(t.search?.focus(),this._setActive(this._windowed&&t.list?te(t.list,this._selectedValues()):this._visible().findIndex(e=>e.classList.contains(`selected`)))),!n){this.dispatchEvent(new CustomEvent(`wui-select:open`,{bubbles:!0}));for(let e of this._activePartsList())e.onOpen?.()}}_close({force:e=!1}={}){if(!e&&this.hasAttribute(`open`))return;let t=this._refs();if(!t.menu||!t.control)return;this._hoverOpened=!1;let n=t.menu.contains(document.activeElement);_(t.menu)&&h(t.menu),this._onPanelClosed(),n&&t.control.focus()}_onQueryChange(e){this._query=e,this._setActive(-1);let t=Q(this,`.wui-select-search .wui-select-clear`,HTMLElement);t&&(t.hidden=!e);let n=!1;for(let t of this._activePartsList())t.onQuery?.(e)===!0&&(n=!0);this._ownsFilter=n,this.renderList()}_pick(e){if(e.getAttribute(`aria-disabled`)===`true`)return;let t=e.dataset.custom===`true`,n=e.dataset.value??``,r=t?{value:n,label:$(e).trim()}:this._listOptions().find(e=>String(e.value)===n)??{value:n,label:n},i=this._activePartsList().some(e=>e.onPick?.(r,{isCustom:t})===!0);H(this.mode)||(i||this.commit(n,{isCustom:t}),this._close(),this._refs().control?.focus())}_draftOpens(){return this.mode===`multiple`?this.hasAttribute(`allow-custom`):this.mode===`tag`&&U(this)}_onKeyDown(e){if(!s(this)){for(let t of this._activePartsList())if(t.onKey?.(e)===!0)return;if(!this._menuOpen()){if(e.target instanceof HTMLInputElement){if(e.key!==`ArrowDown`||!this._draftOpens())return;this._open({focus:!1})}else{(e.key===`ArrowDown`||f(e)||e.key===` `)&&(e.preventDefault(),this._open({focus:!0}));return}}r(this._nav,`Listbox keys are not wired.`).handler(e)}}_wire(){this._teardown();let e=this._refs(),t=e.control,n=e.list;if(!t||!e.menu||!n)return;let i=r(Q(this,`.wui-select`,HTMLElement),`The select wrapper is missing.`),a=Q(this,`.wui-select-search .wui-select-clear`,HTMLElement),o=Q(this,`.wui-select-reset`,HTMLElement);this._nav=m({getVisibleOptions:()=>this._visible(),getActive:()=>this._active,setActive:e=>this._setActive(e),getCount:()=>this._rowCount(),getOptionAt:e=>this._rowEl(e),findByPrefix:e=>this._windowed?ne(n,e):this._visible().findIndex(t=>t.textContent.trim().toLowerCase().startsWith(e)),onEnter:(e,t)=>{if(e)this._pick(e);else if(this._query.trim()!==``){let e=t.find(e=>e.dataset.custom===`true`);if(e)this._pick(e);else if(t.length===1){let e=t[0];e&&this._pick(e)}}},onEscape:e=>{e.preventDefault(),this._nav?.clearTypeahead(),this._close(),t.focus()}}),i.addEventListener(`keydown`,e=>this._onKeyDown(e)),i.addEventListener(`input`,e=>{let t=e.target;if(!(t instanceof HTMLInputElement)||!t.matches(`.wui-select-input, .wui-select-draft`))return;this._onQueryChange(t.value);let n=t.matches(`.wui-select-draft`),r=this._rows>0||this._actionRows().length>0;n&&r&&!this._menuOpen()&&!s(this)&&this._draftOpens()&&this._open({focus:!1})}),i.addEventListener(`focusout`,e=>{let t=e.relatedTarget;t instanceof Node&&this.contains(t)||!this._activePartsList().some(e=>e.onBlur?.()===!0)&&t&&this._close()}),a?.addEventListener(`click`,()=>{let t=r(e.search,`The search input is missing.`);t.value=``,this._onQueryChange(``),t.focus()}),t.addEventListener(`pointerdown`,()=>{this._pressOpen=this._menuOpen()}),t.addEventListener(`click`,e=>{if(e.target instanceof Element&&e.target.closest(`[data-remove]`))return;if(this.mode===`tag`){if(s(this))return;this._refs().input?.focus(),!this._menuOpen()&&this._draftOpens()&&this._open({focus:!1});return}if(e.target instanceof HTMLInputElement){!this._menuOpen()&&!s(this)&&this._open({focus:!1});return}let t=e.detail>0&&this._pressOpen!==null?this._pressOpen:this._menuOpen();this._pressOpen=null,this._clearHover(),this._hoverOpened&&t?(this._hoverOpened=!1,this._open({focus:!0})):t?this._close():s(this)||this._open({focus:!0})}),o?.addEventListener(`click`,e=>{e.stopPropagation(),this.commit(H(this.mode)?[]:``),this._close(),t.focus()}),n.addEventListener(`click`,n=>{let r=Le(n).closest(`.wui-select-option`);if(r instanceof HTMLElement&&(this._pick(r),H(this.mode))){let n=this.querySelector(`.wui-select-draft`);(e.search??(n instanceof HTMLElement?n:t)).focus()}}),n.addEventListener(`mousedown`,e=>{H(this.mode)&&e.target instanceof Element&&e.target.closest(`.wui-select-option`)&&e.preventDefault()}),n.addEventListener(`mousemove`,e=>{let t=Le(e).closest(`.wui-select-option`);t instanceof HTMLElement&&!t.classList.contains(`is-active`)&&this._setActive(this._windowed?Number(t.dataset.index):this._visible().indexOf(t),{reveal:!1})}),n.addEventListener(`scroll`,()=>{this._windowed&&this._scrollFrame===null&&(this._scrollFrame=requestAnimationFrame(()=>this._onListScroll()))},{passive:!0}),n.addEventListener(`mouseleave`,()=>this._setActive(-1)),n.addEventListener(`error`,e=>{let t=e.target;t instanceof Element&&t.classList.contains(`avatar-img`)&&t.remove()},!0),this.hasAttribute(`open`)&&this._open({focus:!1})}_teardown(){this._nav?.clearTypeahead(),this._scrollFrame!==null&&cancelAnimationFrame(this._scrollFrame),this._scrollFrame=null}_dropMenu(){let e=Q(this,`.wui-select-menu`,HTMLElement);e&&h(e)}_activePartsList(){return this._partsMounted?r(this._parts,`The mounted parts are missing.`):[]}_ensureParts(){if(!this.isConnected)return;(this.hasAttribute(`source`)||this.hasAttribute(`remote`)||this.hasAttribute(`recents-key`)||this._loadOptionsFn!==null)&&this._loadWindow();let e=Fe(this,this.mode),t=e.join(`,`);if(t===this._partSig)return;this._teardownParts(),this._parts=null,this._partSig=t;let n=++this._partToken;Promise.all(e.map(e=>ze(this,e))).then(e=>{n===this._partToken&&(this._parts=e.filter(e=>e!==null),this._mountParts())})}_loadWindow(){this._windowLoad===null&&(this._windowLoad=be().then(()=>this.renderList(),()=>{this._windowFailed=!0,document.dispatchEvent(new CustomEvent(u,{bubbles:!0,composed:!0,detail:{chunk:`select-window`}})),this.setError(X().partLoadMessage)}))}_mountParts(e={draft:``,query:``}){if(!this._parts||this._partsMounted||!this._rendered||!this.isConnected)return;this._partsMounted=!0;let t=we(this._refs());for(let n of this._parts)n.mount(this,t,{carry:e});this._drawValue(),this.renderList()}_teardownParts(){let e=this._activePartsList();this._partsMounted=!1;for(let t of e)t.teardown()}_remountParts(){if(!this._partsMounted)return;let e=this._carry();this._teardownParts(),this._mountParts(e)}_carry(){let e=this._refs();return{draft:e.input?.value??``,query:e.search?.value??``}}},we=e=>{let{control:t,value:n,menu:i,list:a}=e;return{control:r(t,`control missing`),value:r(n,`value missing`),menu:r(i,`menu missing`),list:r(a,`list missing`),search:e.search,input:e.input}},Te=e=>re.includes(e),Ee=[`comfortable`,`compact`],De=150,Oe=250,ke=10,Ae=()=>{let e=X();return{single:e.placeholder,search:e.placeholder,multiple:e.placeholder,tag:e.tagPlaceholder,country:e.countryPlaceholder}},je=/* @__PURE__ */ new Set([`countries`,`suggested`,`suggested-label`,`all-countries-label`,`max-tags`,`pattern`,`collapse-chips`,`source`,`remote`,`min-chars`]),Me=/* @__PURE__ */ new Set([`separators`,`allow-duplicates`,`invalid-message`,`create-label`,`add-label`,`selected-text`,`clear-all-label`,`value-label`,`value-avatar`,`value-initials`,`hint-text`,`recents-key`,`recents-limit`,`recents-label`]),Ne=[[`icon`,`icon`],[`description`,`description`],[`meta`,`meta`],[`group`,`group`],[`avatar`,`avatar`],[`initials`,`initials`],[`disabled-hint`,`disabledHint`]],Z=(e,t)=>t?Array.isArray(e)?e.map(String):e==null||e===``?[]:String(e).split(`,`).map(e=>e.trim()).filter(Boolean):Array.isArray(e)?e.length?String(e[0]):``:e==null?``:String(e),Pe=(e,t)=>t===`multiple`?U(e)?[`chips`,`search`]:[`chips`]:t===`search`?[`search`]:t===`country`?[`country`]:t===`tag`?U(e)?[`chips`,`search`]:[`chips`]:[],Fe=(e,t)=>e.hasAttribute(`recents-key`)?[`recents`,...Pe(e,t)]:Pe(e,t),Ie=e=>typeof e==`object`&&!!e&&`default`in e&&typeof e.default==`function`,Le=e=>{if(e.target instanceof Element)return e.target;throw Error(`The event target is not an element.`)},Q=(e,t,n)=>{let r=e.querySelector(t);return r instanceof n?r:null},Re=(e,t)=>[...e.querySelectorAll(t)].filter(e=>e instanceof HTMLElement),$=e=>{let t=e.textContent;if(t===null)throw Error(`The element has no text.`);return t},ze=(e,t)=>ae(t).then(e=>{if(!Ie(e))throw Error(`The part ${t} has no default export.`);return e.default()}).catch(()=>(document.dispatchEvent(new CustomEvent(u,{bubbles:!0,composed:!0,detail:{chunk:t}})),e.setError(X().partLoadMessage),null));export{U as n,A as r,Ce as t};