@oneb/ui-vue 0.3.32 → 0.4.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 (226) hide show
  1. package/dist/ChevronLeftIcon-7505e081.cjs +1 -0
  2. package/dist/ChevronLeftIcon-bb9adb5b.js +20 -0
  3. package/dist/ChevronRightIcon-2992cf0d.cjs +1 -0
  4. package/dist/ChevronRightIcon-b0585768.js +20 -0
  5. package/dist/ChevronUpIcon-64a673e1.cjs +1 -0
  6. package/dist/{ChevronRightIcon-4549a26b.js → ChevronUpIcon-c43f27a9.js} +2 -19
  7. package/dist/MagnifyingGlassIcon-adf871ba.cjs +1 -0
  8. package/dist/MagnifyingGlassIcon-ca213d3d.js +20 -0
  9. package/dist/OneDropdownAuto.vue_vue_type_script_setup_true_lang-2c508e8a.js +79 -0
  10. package/dist/OneDropdownAuto.vue_vue_type_script_setup_true_lang-bf923b04.cjs +1 -0
  11. package/dist/OneFormInput.vue_vue_type_script_setup_true_lang-b89117e7.js +521 -0
  12. package/dist/OneFormInput.vue_vue_type_script_setup_true_lang-f6f7cd96.cjs +1 -0
  13. package/dist/OneHelpMenu-6ec63535.cjs +1 -0
  14. package/dist/{OneHelpMenu-73817f8a.js → OneHelpMenu-d5182c78.js} +118 -213
  15. package/dist/OneMarkdown.vue_vue_type_script_setup_true_lang-05266fc3.cjs +1 -0
  16. package/dist/OneMarkdown.vue_vue_type_script_setup_true_lang-bb2219c7.js +18 -0
  17. package/dist/OneModal-02a9a173.js +189 -0
  18. package/dist/OneModal-0e92c039.cjs +1 -0
  19. package/dist/OneTooltip.vue_vue_type_script_setup_true_lang-c492c128.js +25 -0
  20. package/dist/OneTooltip.vue_vue_type_script_setup_true_lang-e83a81ea.cjs +1 -0
  21. package/dist/SpinnerIcon-01be39fe.cjs +1 -0
  22. package/dist/{SpinnerIcon-74648c98.js → SpinnerIcon-516264ba.js} +5 -6
  23. package/dist/button/index.cjs +1 -1
  24. package/dist/button/index.d.ts +1 -1
  25. package/dist/button/index.js +3 -4
  26. package/dist/checkbox/checkbox.d.ts +5 -0
  27. package/dist/checkbox/index.cjs +1 -1
  28. package/dist/checkbox/index.js +40 -34
  29. package/dist/chips/OneChips.vue.d.ts +2 -0
  30. package/dist/chips/chips.d.ts +25 -0
  31. package/dist/chips/index.cjs +1 -0
  32. package/dist/chips/index.d.ts +3 -0
  33. package/dist/chips/index.js +62 -0
  34. package/dist/clipboard-494e1513.cjs +1 -0
  35. package/dist/clipboard-733b79a1.js +22 -0
  36. package/dist/common/OneDetailsList.vue.d.ts +2 -0
  37. package/dist/common/OneDetailsRow.vue.d.ts +2 -0
  38. package/dist/common/index.cjs +1 -1
  39. package/dist/common/index.d.ts +2 -0
  40. package/dist/common/index.js +68 -16
  41. package/dist/composables/index.cjs +1 -0
  42. package/dist/composables/index.d.ts +18 -0
  43. package/dist/composables/index.js +91 -0
  44. package/dist/composables/useAsyncMethod.d.ts +17 -0
  45. package/dist/composables/useAsyncSelect.d.ts +26 -0
  46. package/dist/composables/useConfirm.d.ts +27 -0
  47. package/dist/composables/useCursorList.d.ts +42 -0
  48. package/dist/composables/useDebouncedRef.d.ts +6 -0
  49. package/dist/composables/useFileUpload.d.ts +21 -0
  50. package/dist/composables/useFormSubmit.d.ts +23 -0
  51. package/dist/composables/useIsMobile.d.ts +8 -0
  52. package/dist/confirm/OneConfirmHost.vue.d.ts +2 -0
  53. package/dist/confirm/confirm.d.ts +10 -0
  54. package/dist/confirm/index.cjs +1 -0
  55. package/dist/confirm/index.d.ts +5 -0
  56. package/dist/confirm/index.js +59 -0
  57. package/dist/cursorList/OneCursorList.vue.d.ts +2 -0
  58. package/dist/cursorList/index.cjs +1 -0
  59. package/dist/cursorList/index.d.ts +3 -0
  60. package/dist/cursorList/index.js +78 -0
  61. package/dist/dataTable/index.cjs +1 -1
  62. package/dist/dataTable/index.js +256 -301
  63. package/dist/dateTime/OneDateTime.vue.d.ts +2 -0
  64. package/dist/dateTime/dateTime.d.ts +43 -0
  65. package/dist/dateTime/index.cjs +1 -0
  66. package/dist/dateTime/index.d.ts +3 -0
  67. package/dist/dateTime/index.js +66 -0
  68. package/dist/dropdown/index.cjs +1 -1
  69. package/dist/dropdown/index.js +302 -376
  70. package/dist/dropdown-5cb64ab7.cjs +1 -0
  71. package/dist/dropdown-c81fb945.js +101 -0
  72. package/dist/entityPicker/index.cjs +1 -1
  73. package/dist/entityPicker/index.js +57 -57
  74. package/dist/entityPicker/useEntityModal.d.ts +7 -3
  75. package/dist/errorsPage/OneCrashScreen.vue.d.ts +2 -0
  76. package/dist/errorsPage/OneErrorHero.vue.d.ts +2 -0
  77. package/dist/errorsPage/OneNotFoundPage.vue.d.ts +2 -0
  78. package/dist/errorsPage/OneServerErrorPage.vue.d.ts +2 -0
  79. package/dist/errorsPage/OneSnakeGame.vue.d.ts +2 -0
  80. package/dist/errorsPage/createAppErrorHandler.d.ts +24 -0
  81. package/dist/errorsPage/errorsType.d.ts +5 -0
  82. package/dist/errorsPage/index.cjs +1 -1
  83. package/dist/errorsPage/index.d.ts +8 -0
  84. package/dist/errorsPage/index.js +557 -28
  85. package/dist/errorsPage/useCrashState.d.ts +10 -0
  86. package/dist/fileUpload/OneDropzone.vue.d.ts +2 -0
  87. package/dist/fileUpload/OneFileUpload.vue.d.ts +2 -0
  88. package/dist/fileUpload/fileUpload.d.ts +17 -0
  89. package/dist/fileUpload/index.cjs +1 -0
  90. package/dist/fileUpload/index.d.ts +6 -0
  91. package/dist/fileUpload/index.js +228 -0
  92. package/dist/filterBuilder/OneFilterBuilder.vue.d.ts +2 -0
  93. package/dist/filterBuilder/OneFilterGroup.vue.d.ts +2 -0
  94. package/dist/filterBuilder/OneFilterRule.vue.d.ts +2 -0
  95. package/dist/filterBuilder/filterBuilder.d.ts +17 -0
  96. package/dist/filterBuilder/index.cjs +1 -0
  97. package/dist/filterBuilder/index.d.ts +5 -0
  98. package/dist/filterBuilder/index.js +257 -0
  99. package/dist/form/form.d.ts +1 -1
  100. package/dist/form/index.cjs +1 -1
  101. package/dist/form/index.js +66 -574
  102. package/dist/i18n/index.cjs +1 -1
  103. package/dist/i18n/index.js +99 -15
  104. package/dist/index.cjs +1 -1
  105. package/dist/index.d.ts +18 -0
  106. package/dist/index.js +242 -104
  107. package/dist/indicators/OneStatCard.vue.d.ts +2 -0
  108. package/dist/indicators/index.cjs +1 -1
  109. package/dist/indicators/index.d.ts +1 -0
  110. package/dist/indicators/index.js +66 -29
  111. package/dist/label/index.cjs +1 -1
  112. package/dist/label/index.js +5 -5
  113. package/dist/layout/OneAuthLayout.vue.d.ts +2 -0
  114. package/dist/layout/OneBackButton.vue.d.ts +2 -0
  115. package/dist/layout/OneBreadcrumbs.vue.d.ts +2 -0
  116. package/dist/layout/OneEmptyLayout.vue.d.ts +6 -0
  117. package/dist/layout/OneGridLayout.vue.d.ts +2 -0
  118. package/dist/layout/index.cjs +1 -1
  119. package/dist/layout/index.d.ts +6 -1
  120. package/dist/layout/index.js +1057 -765
  121. package/dist/layout/layout.d.ts +11 -0
  122. package/dist/modal/OneModalHost.vue.d.ts +2 -0
  123. package/dist/modal/index.cjs +1 -1
  124. package/dist/modal/index.d.ts +3 -0
  125. package/dist/modal/index.js +84 -27
  126. package/dist/modal/modal.d.ts +9 -0
  127. package/dist/modal/useModalStack.d.ts +20 -0
  128. package/dist/notifications/OneNotificationItem.vue.d.ts +2 -0
  129. package/dist/notifications/OneNotificationsBell.vue.d.ts +2 -0
  130. package/dist/notifications/OneNotificationsPanel.vue.d.ts +2 -0
  131. package/dist/notifications/index.cjs +1 -0
  132. package/dist/notifications/index.d.ts +7 -0
  133. package/dist/notifications/index.js +477 -0
  134. package/dist/notifications/notifications.d.ts +53 -0
  135. package/dist/notifications/useNotifyfeed.d.ts +32 -0
  136. package/dist/periodPicker/index.cjs +1 -1
  137. package/dist/periodPicker/index.js +126 -139
  138. package/dist/popover/OnePopover.vue.d.ts +2 -0
  139. package/dist/popover/index.cjs +1 -0
  140. package/dist/popover/index.d.ts +3 -0
  141. package/dist/popover/index.js +102 -0
  142. package/dist/popover/popover.d.ts +31 -0
  143. package/dist/progress/OneProgress.vue.d.ts +2 -0
  144. package/dist/progress/index.cjs +1 -0
  145. package/dist/progress/index.d.ts +3 -0
  146. package/dist/progress/index.js +74 -0
  147. package/dist/progress/progress.d.ts +32 -0
  148. package/dist/searchInput/OneSearchInput.vue.d.ts +2 -0
  149. package/dist/searchInput/index.cjs +1 -0
  150. package/dist/searchInput/index.d.ts +3 -0
  151. package/dist/searchInput/index.js +103 -0
  152. package/dist/searchInput/searchInput.d.ts +39 -0
  153. package/dist/settings/OneSettingsLayout.vue.d.ts +2 -0
  154. package/dist/settings/OneSettingsRow.vue.d.ts +2 -0
  155. package/dist/settings/OneSettingsSection.vue.d.ts +2 -0
  156. package/dist/settings/index.cjs +1 -0
  157. package/dist/settings/index.d.ts +4 -0
  158. package/dist/settings/index.js +116 -0
  159. package/dist/spinner/OneSpinner.vue.d.ts +2 -0
  160. package/dist/spinner/index.cjs +1 -0
  161. package/dist/spinner/index.d.ts +3 -0
  162. package/dist/spinner/index.js +30 -0
  163. package/dist/spinner/spinner.d.ts +10 -0
  164. package/dist/stageBadge/index.cjs +1 -1
  165. package/dist/stageBadge/index.js +18 -16
  166. package/dist/stepper/OneStepper.vue.d.ts +2 -0
  167. package/dist/stepper/index.cjs +1 -0
  168. package/dist/stepper/index.d.ts +3 -0
  169. package/dist/stepper/index.js +53 -0
  170. package/dist/stepper/stepper.d.ts +24 -0
  171. package/dist/style.css +1 -1
  172. package/dist/switch/index.cjs +1 -1
  173. package/dist/switch/index.js +3 -4
  174. package/dist/tabs/OneTab.vue.d.ts +2 -0
  175. package/dist/tabs/OneTabs.vue.d.ts +2 -0
  176. package/dist/tabs/index.cjs +1 -0
  177. package/dist/tabs/index.d.ts +4 -0
  178. package/dist/tabs/index.js +64 -0
  179. package/dist/tabs/tabs.d.ts +7 -0
  180. package/dist/toast/OneMascotToast.vue.d.ts +2 -0
  181. package/dist/toast/RabbitIcon.vue.d.ts +2 -0
  182. package/dist/toast/index.cjs +1 -1
  183. package/dist/toast/index.d.ts +4 -0
  184. package/dist/toast/index.js +139 -74
  185. package/dist/toast/useMascotToast.d.ts +12 -0
  186. package/dist/tooltip/OneTooltip.vue.d.ts +2 -0
  187. package/dist/tooltip/index.cjs +2 -2
  188. package/dist/tooltip/index.d.ts +1 -0
  189. package/dist/tooltip/index.js +33 -30
  190. package/dist/useConfirm-6344b49d.cjs +1 -0
  191. package/dist/useConfirm-74e99a5c.js +23 -0
  192. package/dist/useCursorList-5c1b57aa.js +62 -0
  193. package/dist/useCursorList-e1cb41e7.cjs +1 -0
  194. package/dist/useElementWidth-b36a7ce9.js +40 -0
  195. package/dist/useElementWidth-b3e53f48.cjs +1 -0
  196. package/dist/useFileUpload-228dbc07.js +24 -0
  197. package/dist/useFileUpload-f47622bb.cjs +1 -0
  198. package/dist/useIsMobile-7b1f08cf.cjs +1 -0
  199. package/dist/useIsMobile-98fc0cf9.js +7 -0
  200. package/dist/useMediaQuery-1d87df02.cjs +1 -0
  201. package/dist/useMediaQuery-77a19b18.js +37 -0
  202. package/dist/useModal-6a5d870b.js +30 -0
  203. package/dist/useModal-aa6f4a57.cjs +1 -0
  204. package/dist/userList/OneUserInviteModal.vue.d.ts +2 -0
  205. package/dist/userList/OneUserList.vue.d.ts +2 -0
  206. package/dist/userList/OneUserListItem.vue.d.ts +2 -0
  207. package/dist/userList/index.cjs +1 -0
  208. package/dist/userList/index.d.ts +4 -0
  209. package/dist/userList/index.js +559 -0
  210. package/dist/utils/clipboard.d.ts +6 -0
  211. package/dist/utils/format.d.ts +17 -0
  212. package/dist/utils/index.cjs +1 -0
  213. package/dist/utils/index.d.ts +4 -0
  214. package/dist/utils/index.js +125 -0
  215. package/dist/utils/string.d.ts +25 -0
  216. package/dist/utils/versionChecker.d.ts +26 -0
  217. package/package.json +215 -24
  218. package/dist/ChevronRightIcon-7a2f0c20.cjs +0 -1
  219. package/dist/OneHelpMenu-c6e88d8f.cjs +0 -1
  220. package/dist/OneMarkdown.vue_vue_type_style_index_0_lang-0ea8fbf8.cjs +0 -1
  221. package/dist/OneMarkdown.vue_vue_type_style_index_0_lang-4ed993c7.js +0 -1
  222. package/dist/SpinnerIcon-ccb6f3fc.cjs +0 -1
  223. package/dist/SpinnerIcon.vue_vue_type_style_index_0_lang-0ea8fbf8.cjs +0 -1
  224. package/dist/SpinnerIcon.vue_vue_type_style_index_0_lang-4ed993c7.js +0 -1
  225. package/dist/useModal-0c73777f.cjs +0 -1
  226. package/dist/useModal-7fe9444b.js +0 -194
@@ -0,0 +1,477 @@
1
+ import { openBlock as o, createElementBlock as l, createElementVNode as n, defineComponent as N, ref as E, watch as z, onMounted as L, onBeforeUnmount as I, normalizeClass as p, createBlock as $, resolveDynamicComponent as V, unref as c, toDisplayString as b, computed as M, createVNode as v, renderSlot as C, createCommentVNode as x, Fragment as S, withCtx as B, renderList as j, createSlots as H, mergeProps as U, reactive as F } from "vue";
2
+ import k from "dayjs";
3
+ import { r as P } from "../ChevronLeftIcon-bb9adb5b.js";
4
+ import { r as W } from "../XMarkIcon-51ef0691.js";
5
+ import { OneButton as q } from "../button/index.js";
6
+ import { OneSkeleton as D } from "../skeleton/index.js";
7
+ import { OneTabs as G, OneTab as A } from "../tabs/index.js";
8
+ import { useOnebI18n as J } from "../i18n/index.js";
9
+ import { r as K } from "../ChevronRightIcon-b0585768.js";
10
+ import { _ as Q } from "../OneAvatar.vue_vue_type_script_setup_true_lang-08ab80dd.js";
11
+ import { OneDateTime as R } from "../dateTime/index.js";
12
+ import "../SpinnerIcon-516264ba.js";
13
+ import "../_plugin-vue_export-helper-dad06003.js";
14
+ import "dayjs/plugin/relativeTime";
15
+ import "dayjs/plugin/utc";
16
+ import "dayjs/plugin/timezone";
17
+ function X(t, e) {
18
+ return o(), l("svg", {
19
+ xmlns: "http://www.w3.org/2000/svg",
20
+ fill: "none",
21
+ viewBox: "0 0 24 24",
22
+ "stroke-width": "1.8",
23
+ stroke: "currentColor",
24
+ "aria-hidden": "true"
25
+ }, [
26
+ n("path", {
27
+ "stroke-linecap": "round",
28
+ "stroke-linejoin": "round",
29
+ d: "M14.857 17.082a23.848 23.848 0 005.454-1.31A8.967 8.967 0 0118 9.75v-.7V9A6 6 0 006 9v.75a8.967 8.967 0 01-2.312 6.022c1.733.64 3.56 1.085 5.455 1.31m5.714 0a24.255 24.255 0 01-5.714 0m5.714 0a3 3 0 11-5.714 0M3.124 7.5A8.969 8.969 0 015.292 3m13.416 0a8.969 8.969 0 012.168 4.5"
30
+ })
31
+ ]);
32
+ }
33
+ function Y(t, e) {
34
+ return o(), l("svg", {
35
+ xmlns: "http://www.w3.org/2000/svg",
36
+ fill: "none",
37
+ viewBox: "0 0 24 24",
38
+ "stroke-width": "1.8",
39
+ stroke: "currentColor",
40
+ "aria-hidden": "true"
41
+ }, [
42
+ n("path", {
43
+ "stroke-linecap": "round",
44
+ "stroke-linejoin": "round",
45
+ d: "M14.857 17.082a23.848 23.848 0 005.454-1.31A8.967 8.967 0 0118 9.75v-.7V9A6 6 0 006 9v.75a8.967 8.967 0 01-2.312 6.022c1.733.64 3.56 1.085 5.455 1.31m5.714 0a24.255 24.255 0 01-5.714 0m5.714 0a3 3 0 11-5.714 0"
46
+ })
47
+ ]);
48
+ }
49
+ function Z(t, e) {
50
+ return o(), l("svg", {
51
+ xmlns: "http://www.w3.org/2000/svg",
52
+ fill: "none",
53
+ viewBox: "0 0 24 24",
54
+ "stroke-width": "1.8",
55
+ stroke: "currentColor",
56
+ "aria-hidden": "true"
57
+ }, [
58
+ n("path", {
59
+ "stroke-linecap": "round",
60
+ "stroke-linejoin": "round",
61
+ d: "M19.5 14.25v-2.625a3.375 3.375 0 00-3.375-3.375h-1.5A1.125 1.125 0 0113.5 7.125v-1.5a3.375 3.375 0 00-3.375-3.375H8.25m2.25 0H5.625c-.621 0-1.125.504-1.125 1.125v17.25c0 .621.504 1.125 1.125 1.125h12.75c.621 0 1.125-.504 1.125-1.125V11.25a9 9 0 00-9-9z"
62
+ })
63
+ ]);
64
+ }
65
+ function ee(t, e) {
66
+ return o(), l("svg", {
67
+ xmlns: "http://www.w3.org/2000/svg",
68
+ fill: "none",
69
+ viewBox: "0 0 24 24",
70
+ "stroke-width": "1.8",
71
+ stroke: "currentColor",
72
+ "aria-hidden": "true"
73
+ }, [
74
+ n("path", {
75
+ "stroke-linecap": "round",
76
+ "stroke-linejoin": "round",
77
+ d: "M12 3c2.755 0 5.455.232 8.083.678.533.09.917.556.917 1.096v1.044a2.25 2.25 0 01-.659 1.591l-5.432 5.432a2.25 2.25 0 00-.659 1.591v2.927a2.25 2.25 0 01-1.244 2.013L9.75 21v-6.568a2.25 2.25 0 00-.659-1.591L3.659 7.409A2.25 2.25 0 013 5.818V4.774c0-.54.384-1.006.917-1.096A48.32 48.32 0 0112 3z"
78
+ })
79
+ ]);
80
+ }
81
+ const Fe = /* @__PURE__ */ N({
82
+ __name: "OneNotificationsBell",
83
+ props: {
84
+ feed: {
85
+ type: Object,
86
+ required: !0
87
+ },
88
+ /** Poll interval while the window is focused; 0 disables polling. */
89
+ pollMs: {
90
+ type: Number,
91
+ default: 15e3
92
+ }
93
+ },
94
+ setup(t) {
95
+ const e = t, r = E(null);
96
+ let m, h;
97
+ z(
98
+ () => e.feed.state.unread_total,
99
+ () => {
100
+ var s;
101
+ clearTimeout(h), (s = r.value) == null || s.style.setProperty("transform", "scale(1.5)"), h = setTimeout(() => {
102
+ var u;
103
+ (u = r.value) == null || u.style.setProperty("transform", "scale(1)");
104
+ }, 500);
105
+ }
106
+ );
107
+ const d = () => {
108
+ clearInterval(m), e.feed.getUpdates(), e.pollMs > 0 && (m = setInterval(e.feed.getUpdates, e.pollMs));
109
+ }, f = () => d(), g = () => clearInterval(m);
110
+ return L(() => {
111
+ d(), window.addEventListener("focus", f), window.addEventListener("blur", g);
112
+ }), I(() => {
113
+ clearTimeout(h), clearInterval(m), window.removeEventListener("focus", f), window.removeEventListener("blur", g);
114
+ }), (s, u) => (o(), l("button", {
115
+ class: p(["p-2.5 rounded-md relative z-10 hover:bg-secondary-10 text-secondary-base hover:text-blue-600", [t.feed.state.show_widget ? "!bg-blue-100 !text-blue-600" : ""]]),
116
+ "data-test": "notifications-bell",
117
+ onClick: u[0] || (u[0] = (w) => t.feed.toggleWidget())
118
+ }, [
119
+ (o(), $(V(t.feed.state.unread_total ? c(X) : c(Y)), { class: "w-6 h-6" })),
120
+ n("span", {
121
+ ref_key: "counterEl",
122
+ ref: r,
123
+ class: p(["absolute top-1 right-1 text-[8px] bg-blue-700 text-white px-1 rounded-full transition min-w-4 h-4 flex items-center justify-center font-bold", [t.feed.state.unread_total ? "opacity-100" : "opacity-0"]]),
124
+ "data-test": "unread-badge"
125
+ }, b(t.feed.state.unread_total > 99 ? "99+" : t.feed.state.unread_total), 3)
126
+ ], 2));
127
+ }
128
+ }), te = {
129
+ blue: { bg: "bg-blue-50", text: "text-blue-500" },
130
+ orange: { bg: "bg-orange-50", text: "text-orange-500" },
131
+ green: { bg: "bg-green-50", text: "text-green-500" },
132
+ red: { bg: "bg-red-50", text: "text-red-500" },
133
+ purple: { bg: "bg-purple-50", text: "text-purple-500" },
134
+ gray: { bg: "bg-gray-100", text: "text-gray-500" },
135
+ indigo: { bg: "bg-indigo-50", text: "text-indigo-500" },
136
+ amber: { bg: "bg-amber-50", text: "text-amber-500" }
137
+ }, se = { class: "pt-6 flex-shrink-0" }, ae = { class: "relative w-10 h-10 flex-shrink-0" }, ne = { class: "flex-grow min-w-0 space-y-1" }, oe = { class: "flex items-center gap-1.5 text-xs" }, re = { class: "font-medium text-gray-900" }, le = { class: "group text-gray-500" }, ie = ["innerHTML"], de = /* @__PURE__ */ N({
138
+ __name: "OneNotificationItem",
139
+ props: {
140
+ message: {
141
+ type: Object,
142
+ required: !0
143
+ },
144
+ /** App-specific message-type -> icon/tint map. */
145
+ typeResolver: {
146
+ type: Function,
147
+ default: void 0
148
+ },
149
+ /** Marks the row clickable and enables the `open` event + chevron. */
150
+ clickable: {
151
+ type: Boolean,
152
+ default: !1
153
+ },
154
+ /** Fallback actor name (system messages), e.g. "Finance". */
155
+ appName: {
156
+ type: String,
157
+ default: ""
158
+ }
159
+ },
160
+ emits: ["seen", "open"],
161
+ setup(t, { emit: e }) {
162
+ const r = t, m = e, h = M(() => {
163
+ var g;
164
+ return ((g = r.typeResolver) == null ? void 0 : g.call(r, r.message)) ?? {};
165
+ }), d = M(() => te[h.value.tint ?? "gray"]), f = () => {
166
+ r.clickable && m("open", r.message);
167
+ };
168
+ return (g, s) => {
169
+ var u, w, _;
170
+ return o(), l("div", {
171
+ class: "flex items-start gap-2 px-2 pb-2",
172
+ onMouseenter: s[0] || (s[0] = (i) => m("seen", t.message))
173
+ }, [
174
+ n("div", se, [
175
+ n("div", {
176
+ class: p(["w-2 h-2 rounded-full", t.message.is_seen ? "bg-gray-300" : "bg-blue-600"]),
177
+ "data-test": "read-dot"
178
+ }, null, 2)
179
+ ]),
180
+ n("div", {
181
+ class: p(["flex-grow min-w-0 flex items-start gap-3 bg-white rounded-lg border border-gray-100 p-3 hover:bg-gray-50 select-none transition-colors", { "cursor-pointer": t.clickable }]),
182
+ "data-test": "notification-body",
183
+ onClick: f
184
+ }, [
185
+ n("div", ae, [
186
+ v(c(Q), {
187
+ src: (u = t.message.actor) == null ? void 0 : u.photo_url,
188
+ text: ((w = t.message.actor) == null ? void 0 : w.name) ?? t.appName,
189
+ rounded: !0,
190
+ size: "40"
191
+ }, null, 8, ["src", "text"]),
192
+ n("div", {
193
+ class: p(["absolute -bottom-0.5 -right-0.5 w-5 h-5 rounded-full ring-2 ring-white flex items-center justify-center", d.value.bg])
194
+ }, [
195
+ (o(), $(V(h.value.icon ?? c(Z)), {
196
+ class: p(["w-3 h-3", d.value.text])
197
+ }, null, 8, ["class"]))
198
+ ], 2)
199
+ ]),
200
+ n("div", ne, [
201
+ n("div", oe, [
202
+ n("span", re, b(((_ = t.message.actor) == null ? void 0 : _.name) || t.appName), 1),
203
+ s[1] || (s[1] = n("span", { class: "text-gray-400" }, "·", -1)),
204
+ n("span", le, [
205
+ v(c(R), {
206
+ class: "group-hover:hidden",
207
+ value: t.message.created_at,
208
+ mode: "relative"
209
+ }, null, 8, ["value"]),
210
+ v(c(R), {
211
+ class: "hidden group-hover:inline",
212
+ value: t.message.created_at,
213
+ "with-time": ""
214
+ }, null, 8, ["value"])
215
+ ])
216
+ ]),
217
+ n("div", {
218
+ class: "font-thin text-sm",
219
+ innerHTML: t.message.body
220
+ }, null, 8, ie),
221
+ C(g.$slots, "extra", { message: t.message })
222
+ ]),
223
+ t.clickable ? (o(), $(c(K), {
224
+ key: 0,
225
+ class: "w-4 h-4 text-gray-400 flex-shrink-0 mt-3 ml-auto"
226
+ })) : x("", !0)
227
+ ], 2)
228
+ ], 32);
229
+ };
230
+ }
231
+ }), ce = { class: "flex flex-col bg-gray-50 rounded-xl border overflow-hidden" }, ue = {
232
+ key: 0,
233
+ class: "flex gap-3 items-center px-3 py-1 bg-gray-50 border-b"
234
+ }, me = { class: "font-medium !text-[16px]" }, fe = {
235
+ key: 1,
236
+ class: "flex items-center justify-between px-4 py-3"
237
+ }, ge = { class: "flex items-baseline gap-1.5" }, ve = { class: "text-base font-semibold" }, he = {
238
+ key: 0,
239
+ class: "text-base font-semibold text-blue-600",
240
+ "data-test": "unread-count"
241
+ }, ye = { class: "flex items-center gap-1" }, be = ["title"], xe = {
242
+ key: 0,
243
+ class: "px-3 pt-1"
244
+ }, pe = {
245
+ key: 1,
246
+ class: "p-6 text-center"
247
+ }, we = { class: "text-sm text-gray-500" }, ke = { class: "px-4 py-1 text-xs font-medium text-gray-400 uppercase" }, _e = {
248
+ key: 2,
249
+ class: "p-4 space-y-2"
250
+ }, $e = {
251
+ key: 2,
252
+ class: "border-t bg-gray-50 px-4 py-2 space-y-1"
253
+ }, Me = { class: "text-xs text-gray-500" }, Pe = /* @__PURE__ */ N({
254
+ __name: "OneNotificationsPanel",
255
+ props: {
256
+ feed: {
257
+ type: Object,
258
+ required: !0
259
+ },
260
+ typeResolver: {
261
+ type: Function,
262
+ default: void 0
263
+ },
264
+ clickableMessages: {
265
+ type: Boolean,
266
+ default: !1
267
+ },
268
+ appName: {
269
+ type: String,
270
+ default: ""
271
+ },
272
+ t: {
273
+ type: Function,
274
+ default: void 0
275
+ }
276
+ },
277
+ emits: ["open"],
278
+ setup(t, { emit: e }) {
279
+ const r = t, m = e, h = J(), d = M(() => r.t ?? h), f = E(!1);
280
+ r.feed.reload(!1);
281
+ const g = (i) => {
282
+ const a = typeof i.created_at == "number" ? k.unix(i.created_at) : k(i.created_at);
283
+ return a.isSame(k(), "day") ? "today" : a.isSame(k().subtract(1, "day"), "day") ? "yesterday" : a.isAfter(k().subtract(7, "day")) ? "week" : "earlier";
284
+ }, s = M(() => {
285
+ const i = {
286
+ today: [],
287
+ yesterday: [],
288
+ week: [],
289
+ earlier: []
290
+ };
291
+ return r.feed.state.messages.items.forEach((a) => i[g(a)].push(a)), Object.keys(i).filter((a) => i[a].length > 0).map((a) => ({ key: a, items: i[a] }));
292
+ });
293
+ let u;
294
+ const w = (i) => {
295
+ r.feed.markSeen(i), clearTimeout(u), u = setTimeout(() => r.feed.sendReadState(), 1500);
296
+ }, _ = (i) => {
297
+ const a = i.target;
298
+ r.feed.state.messages.has_more && !r.feed.state.messages.loading && a.scrollTop + a.clientHeight >= a.scrollHeight - 100 && r.feed.loadMessages();
299
+ };
300
+ return L(() => {
301
+ }), I(() => {
302
+ clearTimeout(u), r.feed.sendReadState();
303
+ }), (i, a) => (o(), l("div", ce, [
304
+ f.value ? (o(), l("div", ue, [
305
+ v(c(q), {
306
+ label: d.value("ui.back"),
307
+ size: "lg",
308
+ variant: "touch",
309
+ icon: c(P),
310
+ "data-test": "settings-back",
311
+ onClick: a[0] || (a[0] = (y) => f.value = !1)
312
+ }, null, 8, ["label", "icon"]),
313
+ n("span", me, b(d.value("ui.notifyfeed.settings")), 1)
314
+ ])) : (o(), l("div", fe, [
315
+ n("div", ge, [
316
+ n("span", ve, b(d.value("ui.notifyfeed.notifications")), 1),
317
+ t.feed.state.unread_total ? (o(), l("span", he, " +" + b(t.feed.state.unread_total), 1)) : x("", !0)
318
+ ]),
319
+ n("div", ye, [
320
+ i.$slots.settings ? (o(), l("button", {
321
+ key: 0,
322
+ class: "p-1.5 rounded-full hover:bg-gray-100 text-gray-500 hover:text-gray-700 transition-colors",
323
+ title: d.value("ui.notifyfeed.settings"),
324
+ "data-test": "open-settings",
325
+ onClick: a[1] || (a[1] = (y) => f.value = !0)
326
+ }, [
327
+ v(c(ee), { class: "w-5 h-5" })
328
+ ], 8, be)) : x("", !0),
329
+ n("button", {
330
+ class: "p-1.5 rounded-full hover:bg-gray-100 text-gray-500 hover:text-gray-700 transition-colors",
331
+ "data-test": "close-panel",
332
+ onClick: a[2] || (a[2] = (y) => t.feed.closeWidget())
333
+ }, [
334
+ v(c(W), { class: "w-5 h-5" })
335
+ ])
336
+ ])
337
+ ])),
338
+ n("div", {
339
+ class: "flex-grow min-h-0 overflow-y-auto",
340
+ onScroll: _
341
+ }, [
342
+ f.value ? C(i.$slots, "settings", {
343
+ key: 0,
344
+ close: () => f.value = !1
345
+ }) : (o(), l(S, { key: 1 }, [
346
+ t.feed.state.messages.has_archive || t.feed.state.show_archive ? (o(), l("div", xe, [
347
+ v(c(G), {
348
+ "model-value": t.feed.state.show_archive ? "archive" : "main",
349
+ "onUpdate:modelValue": a[3] || (a[3] = (y) => t.feed.reload(y === "archive"))
350
+ }, {
351
+ default: B(() => [
352
+ v(c(A), {
353
+ value: "main",
354
+ label: d.value("ui.notifyfeed.tab_main")
355
+ }, null, 8, ["label"]),
356
+ v(c(A), {
357
+ value: "archive",
358
+ label: d.value("ui.notifyfeed.tab_archive")
359
+ }, null, 8, ["label"])
360
+ ]),
361
+ _: 1
362
+ }, 8, ["model-value"])
363
+ ])) : x("", !0),
364
+ s.value.length === 0 && !t.feed.state.messages.loading ? (o(), l("div", pe, [
365
+ n("p", we, b(d.value("ui.notifyfeed.empty")), 1)
366
+ ])) : x("", !0),
367
+ (o(!0), l(S, null, j(s.value, (y) => (o(), l("div", {
368
+ key: y.key,
369
+ class: "pt-2"
370
+ }, [
371
+ n("div", ke, b(d.value(`ui.notifyfeed.group_${y.key}`)), 1),
372
+ (o(!0), l(S, null, j(y.items, (T) => (o(), $(de, {
373
+ key: T.id,
374
+ message: T,
375
+ "type-resolver": t.typeResolver,
376
+ clickable: t.clickableMessages,
377
+ "app-name": t.appName,
378
+ onSeen: w,
379
+ onOpen: a[4] || (a[4] = (O) => m("open", O))
380
+ }, H({ _: 2 }, [
381
+ i.$slots.extra ? {
382
+ name: "extra",
383
+ fn: B((O) => [
384
+ C(i.$slots, "extra", U({ ref_for: !0 }, O))
385
+ ]),
386
+ key: "0"
387
+ } : void 0
388
+ ]), 1032, ["message", "type-resolver", "clickable", "app-name"]))), 128))
389
+ ]))), 128)),
390
+ t.feed.state.messages.loading ? (o(), l("div", _e, [
391
+ v(c(D), {
392
+ count: 3,
393
+ height: "h-14"
394
+ })
395
+ ])) : x("", !0)
396
+ ], 64))
397
+ ], 32),
398
+ f.value ? x("", !0) : (o(), l("div", $e, [
399
+ n("div", Me, b(d.value("ui.notifyfeed.archive_hint")), 1),
400
+ n("button", {
401
+ class: "text-sm text-blue-600 hover:text-blue-700 font-medium",
402
+ "data-test": "read-all",
403
+ onClick: a[5] || (a[5] = (y) => t.feed.onReadAll())
404
+ }, b(d.value("ui.notifyfeed.mark_all")), 1)
405
+ ]))
406
+ ]));
407
+ }
408
+ });
409
+ function We(t) {
410
+ const e = F({
411
+ unread_total: 0,
412
+ show_widget: !1,
413
+ show_archive: !1,
414
+ update_cursor: null,
415
+ messages: {
416
+ items: [],
417
+ has_more: !1,
418
+ cursor: null,
419
+ loading: !1,
420
+ has_archive: !1
421
+ },
422
+ read_ids: []
423
+ }), r = () => {
424
+ t.getUpdates({ cursor: e.update_cursor }).then((s) => {
425
+ e.update_cursor = s.cursor ?? null, e.unread_total = Math.max(0, s.unread_total - e.read_ids.length);
426
+ }).catch(() => {
427
+ });
428
+ }, m = () => {
429
+ e.messages.loading || (e.messages.loading = !0, t.getMessages({ cursor: e.messages.cursor, archive: e.show_archive }).then((s) => {
430
+ e.messages.cursor == null ? e.messages.items = s.items : e.messages.items = [...e.messages.items, ...s.items], e.messages.has_more = s.has_more, e.messages.cursor = s.cursor, e.messages.has_archive = s.has_archive ?? !1;
431
+ }).catch(() => {
432
+ }).finally(() => {
433
+ e.messages.loading = !1;
434
+ }));
435
+ };
436
+ return {
437
+ state: e,
438
+ getUpdates: r,
439
+ loadMessages: m,
440
+ reload: (s = !1) => {
441
+ e.show_archive = s, e.messages.cursor = null, m();
442
+ },
443
+ markSeen: (s) => {
444
+ s.is_seen || e.read_ids.includes(s.id) || (s.is_seen = !0, e.read_ids.push(s.id), e.unread_total = Math.max(0, e.unread_total - 1));
445
+ },
446
+ sendReadState: () => {
447
+ if (e.read_ids.length === 0)
448
+ return;
449
+ const s = [...e.read_ids];
450
+ t.readMessages({ message_ids: s }).then(() => {
451
+ e.read_ids = e.read_ids.filter((u) => !s.includes(u));
452
+ }).catch(() => {
453
+ });
454
+ },
455
+ onReadAll: () => {
456
+ t.readMessages({ all: !0 }).then(() => {
457
+ e.read_ids = [], e.unread_total = 0, e.messages.items.forEach((s) => {
458
+ s.is_seen = !0;
459
+ });
460
+ }).catch(() => {
461
+ });
462
+ },
463
+ toggleWidget: () => {
464
+ e.show_widget = !e.show_widget;
465
+ },
466
+ closeWidget: () => {
467
+ e.show_widget = !1;
468
+ }
469
+ };
470
+ }
471
+ export {
472
+ de as OneNotificationItem,
473
+ Fe as OneNotificationsBell,
474
+ Pe as OneNotificationsPanel,
475
+ te as notifyTintClasses,
476
+ We as useNotifyfeed
477
+ };
@@ -0,0 +1,53 @@
1
+ import type { Component } from 'vue';
2
+ export interface NotifyActor {
3
+ name?: string;
4
+ photo_url?: string | null;
5
+ }
6
+ export interface NotifyMessage {
7
+ id: string | number;
8
+ /** HTML body (rendered with v-html, as in finance/invoice/voicecall). */
9
+ body: string;
10
+ created_at: string | number;
11
+ is_seen: boolean;
12
+ type?: string | number;
13
+ actor?: NotifyActor | null;
14
+ data?: Record<string, unknown>;
15
+ }
16
+ export interface NotifyfeedPage {
17
+ items: NotifyMessage[];
18
+ has_more: boolean;
19
+ cursor: string | null;
20
+ has_archive?: boolean;
21
+ }
22
+ /**
23
+ * Backend contract of the notifyfeed module — method names mirror the rpc
24
+ * calls that are already identical across finance/invoice/voicecall
25
+ * (GetNotifyfeedUpdates / GetNotifyfeedMessages / ReadNotifyfeedMessages).
26
+ */
27
+ export interface NotifyfeedTransport {
28
+ getUpdates(query: {
29
+ cursor?: string | null;
30
+ }): Promise<{
31
+ unread_total: number;
32
+ cursor?: string | null;
33
+ }>;
34
+ getMessages(query: {
35
+ cursor?: string | null;
36
+ archive?: boolean;
37
+ }): Promise<NotifyfeedPage>;
38
+ readMessages(query: {
39
+ message_ids?: (string | number)[];
40
+ all?: boolean;
41
+ }): Promise<unknown>;
42
+ }
43
+ export type NotifyTint = 'blue' | 'orange' | 'green' | 'red' | 'purple' | 'gray' | 'indigo' | 'amber';
44
+ export interface NotifyTypeMeta {
45
+ icon?: Component;
46
+ tint?: NotifyTint;
47
+ }
48
+ /** Maps a message to its icon/tint; app-specific (finance had ~12 types). */
49
+ export type NotifyTypeResolver = (message: NotifyMessage) => NotifyTypeMeta;
50
+ export declare const notifyTintClasses: Record<NotifyTint, {
51
+ bg: string;
52
+ text: string;
53
+ }>;
@@ -0,0 +1,32 @@
1
+ import type { NotifyfeedTransport, NotifyMessage } from './notifications';
2
+ export interface NotifyfeedState {
3
+ unread_total: number;
4
+ show_widget: boolean;
5
+ show_archive: boolean;
6
+ update_cursor: string | null;
7
+ messages: {
8
+ items: NotifyMessage[];
9
+ has_more: boolean;
10
+ cursor: string | null;
11
+ loading: boolean;
12
+ has_archive: boolean;
13
+ };
14
+ read_ids: (string | number)[];
15
+ }
16
+ export interface UseNotifyfeedReturn {
17
+ state: NotifyfeedState;
18
+ getUpdates: () => void;
19
+ loadMessages: () => void;
20
+ reload: (archive?: boolean) => void;
21
+ markSeen: (message: NotifyMessage) => void;
22
+ sendReadState: () => void;
23
+ onReadAll: () => void;
24
+ toggleWidget: () => void;
25
+ closeWidget: () => void;
26
+ }
27
+ /**
28
+ * Notifyfeed store, ported from finance useNotifyfeedState (the richest of
29
+ * the three copies) as a factory: the backend is injected via `transport`
30
+ * instead of a hardwired rpc client, so each app plugs its own.
31
+ */
32
+ export declare function useNotifyfeed(transport: NotifyfeedTransport): UseNotifyfeedReturn;