@revolist/ui 4.0.1-rc → 4.0.3-rc

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 (288) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +345 -262
  3. package/_chunks/calendar-xpZ0v3xf.js +258 -0
  4. package/_chunks/chart-frame-Cmc7xU1i.js +130 -0
  5. package/_chunks/choice-chips-CHQTUdLs.js +110 -0
  6. package/_chunks/clock-BOhPNlW3.js +4 -0
  7. package/_chunks/{color-palette-BmZ7kH9R.js → color-palette-D8vyPfld.js} +41 -41
  8. package/_chunks/color-picker-CudqPYZo.js +138 -0
  9. package/_chunks/component-C_T2VN5u.js +863 -0
  10. package/_chunks/{component-metadata-BENbgTjU.js → component-metadata-BMOOmqx5.js} +0 -4
  11. package/_chunks/control-AHKXD5Eu.js +93 -0
  12. package/_chunks/{control-tooltip-BCNzQCXE.js → control-tooltip-uscKfAnV.js} +29 -29
  13. package/_chunks/{controller-CmLo-Ajc.js → controller-hRBm_Lfz.js} +15 -15
  14. package/_chunks/{controls-NEL5tDaz.js → controls-DsNi8V8I.js} +229 -214
  15. package/_chunks/{date-control-CYCkb1aQ.js → date-control-DrVFX13g.js} +21 -21
  16. package/_chunks/date-time-qIhp5vaX.js +768 -0
  17. package/_chunks/{delete-button-DnpmDNEJ.js → delete-button-CW9vjLnk.js} +7 -7
  18. package/_chunks/dialog.parts-CKGkC5zP.js +134 -0
  19. package/_chunks/duration-CL68Em0o.js +272 -0
  20. package/_chunks/editor-commit-Bq3wSgvr.js +12 -0
  21. package/_chunks/{editor-popup-B7fu_A_T.js → editor-popup-WDdtVDNA.js} +8 -8
  22. package/_chunks/field-context-D57PnBbH.js +5 -0
  23. package/_chunks/framework-mount--RTLIqE-.js +54 -0
  24. package/_chunks/history-controls-B3u3INEK.js +27 -0
  25. package/_chunks/hooks.module-CG3gN83z.js +157 -0
  26. package/_chunks/jsxRuntime.module-F6UFnpT-.js +30 -0
  27. package/_chunks/mount-DQ1cpppK.js +257 -0
  28. package/_chunks/native-control-C_yok8_-.js +605 -0
  29. package/_chunks/native.view-ByyZ1CT5.js +32 -0
  30. package/_chunks/{number-input-NnH57J4j.js → number-input-BKwA5FnM.js} +89 -89
  31. package/_chunks/picker-h1P5RUgp.js +122 -0
  32. package/_chunks/popup-CT2uD3go.js +367 -0
  33. package/_chunks/preact.module-BBM36DnO.js +290 -0
  34. package/_chunks/{rating-choice-CWAsNQNS.js → rating-choice-DZgmaic0.js} +10 -10
  35. package/_chunks/render-m5eMMwFR.js +83 -0
  36. package/_chunks/reorder-list-CSlqAGHw.js +59 -0
  37. package/_chunks/request-trail-DSlFix6i.js +618 -0
  38. package/_chunks/rich-text-CH7gIqOS.js +636 -0
  39. package/_chunks/rotate-right-Iha5ScJ1.js +4 -0
  40. package/_form.scss +1 -1
  41. package/_vendor/preact/LICENSE +21 -0
  42. package/_vendor/preact/compat/src/index.d.ts +353 -0
  43. package/_vendor/preact/compat/src/suspense-list.d.ts +16 -0
  44. package/_vendor/preact/compat/src/suspense.d.ts +19 -0
  45. package/_vendor/preact/hooks/src/index.d.ts +145 -0
  46. package/_vendor/preact/src/dom.d.ts +2548 -0
  47. package/_vendor/preact/src/index.d.ts +373 -0
  48. package/_vendor/preact/src/jsx.d.ts +2958 -0
  49. package/activity-message.d.ts +1 -1
  50. package/activity-message.js +16 -16
  51. package/ai/_chat.scss +195 -0
  52. package/ai/_style.scss +105 -34
  53. package/ai/chat.d.ts +63 -0
  54. package/ai/components.d.ts +20 -4
  55. package/ai/index.d.ts +2 -0
  56. package/ai/index.js +3 -3
  57. package/ai/mount.d.ts +30 -1
  58. package/ai/prompt-history.d.ts +13 -0
  59. package/ai/request-trail.d.ts +1 -1
  60. package/ai/transcript.d.ts +25 -0
  61. package/ai/translation-context.d.ts +1 -1
  62. package/ai/translations.d.ts +1 -1
  63. package/alert.d.ts +2 -2
  64. package/angular/angular.js +0 -3
  65. package/assignee/field.d.ts +2 -2
  66. package/assignee/index.js +86 -87
  67. package/assignee/layout.d.ts +2 -2
  68. package/assignee/picker.d.ts +1 -1
  69. package/avatar/index.js +25 -25
  70. package/avatar/index.view.d.ts +1 -1
  71. package/brush-range/component.d.ts +1 -1
  72. package/brush-range/component.js +30 -30
  73. package/buttons/delete-button.d.ts +2 -1
  74. package/buttons/delete-button.js +1 -1
  75. package/buttons/remove-button.d.ts +1 -1
  76. package/buttons/remove-button.js +3 -3
  77. package/buttons/svg-button.d.ts +2 -1
  78. package/buttons/svg-button.js +35 -35
  79. package/calendar/_calendar.scss +7 -2
  80. package/calendar/calendar.d.ts +1 -1
  81. package/calendar/calendar.js +1 -1
  82. package/calendar/caption.d.ts +1 -1
  83. package/calendar/day.d.ts +1 -1
  84. package/calendar/day.js +4 -4
  85. package/calendar/header.d.ts +1 -1
  86. package/calendar/header.js +35 -35
  87. package/calendar/index.js +2 -2
  88. package/calendar/month-grid.d.ts +1 -1
  89. package/calendar/month-grid.js +37 -37
  90. package/calendar/picker.d.ts +1 -1
  91. package/calendar/types.d.ts +1 -1
  92. package/calendar/year-grid.d.ts +1 -1
  93. package/calendar/year-grid.js +12 -12
  94. package/checkbox/index.d.ts +2 -2
  95. package/checkbox/index.js +9 -9
  96. package/choice-chips/index.d.ts +1 -1
  97. package/choice-chips/index.js +1 -1
  98. package/color-palette/color-palette.d.ts +1 -1
  99. package/color-palette/color-palette.js +1 -1
  100. package/color-palette/color-picker.d.ts +1 -1
  101. package/color-palette/color-picker.js +2 -2
  102. package/component-catalog.d.ts +34 -23
  103. package/control-attributes.js +7 -7
  104. package/control-presentation.js +18 -18
  105. package/controls.d.ts +12 -10
  106. package/controls.js +3 -3
  107. package/core/editor-commit.d.ts +1 -1
  108. package/core/editor-popup.d.ts +1 -1
  109. package/core/editor-popup.js +1 -1
  110. package/date-time/date-control.d.ts +1 -1
  111. package/date-time/field.d.ts +2 -2
  112. package/date-time/index.js +1 -1
  113. package/date-time/picker.d.ts +1 -1
  114. package/date-time/style.scss +4 -4
  115. package/date-time/time-control.d.ts +1 -1
  116. package/date-time/time-selection.d.ts +1 -1
  117. package/date-time/types.d.ts +1 -1
  118. package/dialog/dialog-action-footer.view.d.ts +1 -1
  119. package/dialog/dialog.dom.js +52 -52
  120. package/dialog/dialog.parts.d.ts +18 -18
  121. package/dialog/dialog.parts.js +1 -1
  122. package/dialog/dialog.preact.d.ts +1 -1
  123. package/dialog/dialog.preact.js +6 -6
  124. package/distribution-chart/area-chart.d.ts +1 -1
  125. package/distribution-chart/area-chart.js +25 -25
  126. package/distribution-chart/bar-chart.d.ts +6 -3
  127. package/distribution-chart/bar-chart.js +10 -6
  128. package/distribution-chart/chart-frame.d.ts +3 -2
  129. package/distribution-chart/index.d.ts +1 -1
  130. package/distribution-chart/index.js +6 -6
  131. package/distribution-chart/line-chart.d.ts +1 -1
  132. package/distribution-chart/line-chart.js +9 -9
  133. package/distribution-chart/types.d.ts +1 -1
  134. package/dropdown/content.d.ts +3 -2
  135. package/dropdown/content.js +1 -141
  136. package/dropdown/control.d.ts +14 -0
  137. package/dropdown/control.js +1 -0
  138. package/dropdown/control.view.d.ts +6 -0
  139. package/dropdown/dropdown.service.d.ts +1 -1
  140. package/dropdown/dropdown.service.js +9 -9
  141. package/dropdown/dropdown.types.d.ts +4 -0
  142. package/dropdown/editor-dropdown.style.scss +37 -9
  143. package/dropdown/index.d.ts +1 -1
  144. package/dropdown/index.js +3 -4
  145. package/dropdown/lookup-field.d.ts +1 -1
  146. package/dropdown/lookup-field.js +41 -41
  147. package/dropdown/popup.d.ts +1 -1
  148. package/dropdown/popup.js +1 -140
  149. package/duration/controls.d.ts +1 -1
  150. package/duration/index.d.ts +2 -2
  151. package/duration/index.js +1 -1
  152. package/duration/style.scss +1 -1
  153. package/editor-actions.d.ts +1 -1
  154. package/editor-actions.js +21 -20
  155. package/editor-layout/index.d.ts +1 -1
  156. package/editor-layout/index.js +27 -27
  157. package/field-configurator.d.ts +1 -1
  158. package/field-configurator.js +93 -93
  159. package/field-reorder.hook.js +32 -32
  160. package/fieldset.d.ts +3 -0
  161. package/filter/filters/slider/preact.js +3 -3
  162. package/filter/filters/slider/single.d.ts +1 -1
  163. package/filter/filters/slider/single.js +23 -23
  164. package/filter-badge.d.ts +1 -1
  165. package/filter-badge.js +23 -22
  166. package/filter-controls.d.ts +1 -1
  167. package/filter-controls.js +30 -30
  168. package/form-controls/field-context.d.ts +5 -0
  169. package/form-controls/index.js +16 -21
  170. package/form-controls/index.view.d.ts +2 -4
  171. package/form-controls/presentation.d.ts +1 -1
  172. package/form-controls/presentation.js +59 -51
  173. package/formatting/comparison-preview.d.ts +1 -1
  174. package/formatting/control-tooltip.d.ts +1 -1
  175. package/formatting/icon-controls.d.ts +1 -1
  176. package/formatting/index.js +105 -100
  177. package/formatting/inspector-section.d.ts +1 -1
  178. package/formatting/typography-controls.d.ts +1 -1
  179. package/framework-mount.d.ts +1 -1
  180. package/framework.js +215 -207
  181. package/history-controls.d.ts +14 -0
  182. package/history-controls.js +1 -0
  183. package/icons/icon.d.ts +1 -1
  184. package/icons/icon.js +1 -1
  185. package/legend.d.ts +1 -1
  186. package/legend.js +12 -12
  187. package/masked-input/index.d.ts +1 -1
  188. package/masked-input/index.js +109 -109
  189. package/native-control.d.ts +14 -12
  190. package/native-control.js +3 -26
  191. package/native-styles.css +1 -1
  192. package/native.js +40 -39
  193. package/number-input/index.d.ts +1 -1
  194. package/number-input/index.js +1 -1
  195. package/package.json +18 -14
  196. package/pagination.d.ts +3 -0
  197. package/pagination.js +43 -33
  198. package/pdf-viewer/component.d.ts +1 -1
  199. package/pdf-viewer/controller.js +1 -1
  200. package/pdf-viewer/header.d.ts +1 -1
  201. package/pdf-viewer/index.js +13 -13
  202. package/pdf-viewer/search-bar.d.ts +1 -1
  203. package/pdf-viewer/status.d.ts +1 -1
  204. package/pdf-viewer/style.scss +3 -4
  205. package/pdf-viewer/toolbar.d.ts +1 -1
  206. package/pickers.d.ts +1 -1
  207. package/preact-mount.d.ts +1 -1
  208. package/preact-mount.js +1 -1
  209. package/preact.d.ts +2 -0
  210. package/preact.js +62 -62
  211. package/rating-choice.d.ts +1 -1
  212. package/rating-choice.js +1 -1
  213. package/react-adapter.d.ts +1 -1
  214. package/react-control.d.ts +0 -1
  215. package/react-control.js +2 -2
  216. package/react.d.ts +13 -3
  217. package/react.js +71 -88
  218. package/reorder-list.d.ts +1 -1
  219. package/reorder-list.js +1 -1
  220. package/resource-picker/resource-picker-avatar.d.ts +1 -1
  221. package/resource-picker/resource-picker-avatar.js +14 -14
  222. package/resource-picker/resource-picker-option.d.ts +1 -1
  223. package/resource-picker/resource-picker-option.js +28 -28
  224. package/resource-picker/resource-picker-popup.d.ts +1 -1
  225. package/resource-picker/resource-picker-popup.js +3 -3
  226. package/resource-picker/resource-picker.d.ts +1 -1
  227. package/resource-picker/resource-picker.js +88 -88
  228. package/resource-picker/resource-picker.scss +6 -3
  229. package/rich-text/engine.d.ts +16 -19
  230. package/rich-text/index.d.ts +7 -7
  231. package/rich-text/index.js +1 -1
  232. package/rich-text/model.d.ts +4 -3
  233. package/rich-text/render-model.d.ts +4 -5
  234. package/rich-text/style.scss +3 -12
  235. package/rich-text/toolbar.d.ts +7 -7
  236. package/rich-text/translations.d.ts +3 -15
  237. package/search-input/index.js +12 -12
  238. package/segmented-switch/index.d.ts +1 -1
  239. package/segmented-switch/index.js +1 -1
  240. package/select.d.ts +20 -0
  241. package/select.js +1 -0
  242. package/status-feedback/exit-snapshot.js +4 -4
  243. package/status-feedback/index.js +2 -2
  244. package/status-feedback/popover.js +10 -10
  245. package/status-feedback/render.d.ts +2 -2
  246. package/status-feedback/render.js +3 -44
  247. package/status-feedback/status-feedback.scss +7 -0
  248. package/status-feedback/types.d.ts +4 -0
  249. package/status-feedback/use-auto-dismiss.d.ts +3 -0
  250. package/styles/_compositions.scss +3 -1
  251. package/styles/_control.scss +12 -4
  252. package/styles/_primitives.scss +9 -8
  253. package/styles.css +1 -1
  254. package/surfaces.js +49 -49
  255. package/svelte/UiComponent.server.js +1 -48
  256. package/svelte/UiComponent.svelte +0 -21
  257. package/svelte.js +33 -68
  258. package/switch/index.js +15 -15
  259. package/time-grid.d.ts +1 -1
  260. package/time-grid.js +58 -58
  261. package/timeline-track/component.d.ts +5 -1
  262. package/timeline-track/index.js +91 -74
  263. package/timeline-track/model.d.ts +9 -0
  264. package/timeline-track/model.js +10 -1
  265. package/ui.css +1 -1
  266. package/vue-adapter.d.ts +1 -1
  267. package/vue.d.ts +138 -119
  268. package/vue.js +150 -174
  269. package/_chunks/calendar-BsDxCYhI.js +0 -248
  270. package/_chunks/chart-frame-BvxbmEU9.js +0 -126
  271. package/_chunks/choice-chips-0HfOnK_4.js +0 -110
  272. package/_chunks/color-picker-BRv-__AM.js +0 -138
  273. package/_chunks/component-D4PH5UZT.js +0 -859
  274. package/_chunks/date-time-DjucJmbc.js +0 -769
  275. package/_chunks/dialog.parts-Dt3KinUz.js +0 -134
  276. package/_chunks/dropdown-CkGQBm1Q.js +0 -357
  277. package/_chunks/duration-BCaktcvz.js +0 -270
  278. package/_chunks/editor-commit-D6Rf5rGz.js +0 -12
  279. package/_chunks/framework-mount-BKIOsvY-.js +0 -54
  280. package/_chunks/mount-0-8opf1j.js +0 -90
  281. package/_chunks/native.view-8q_nwQ7x.js +0 -32
  282. package/_chunks/picker-oazJ7sO_.js +0 -121
  283. package/_chunks/reorder-list-BV3kZXso.js +0 -59
  284. package/_chunks/request-trail-D0oVzdRd.js +0 -347
  285. package/_chunks/rich-text-2Rla349o.js +0 -477
  286. package/react-native-select.d.ts +0 -6
  287. package/rich-text/syntax.d.ts +0 -2
  288. package/vue-native-select.d.ts +0 -9
@@ -1,134 +0,0 @@
1
- import { createPreactElement as e, releasePreactElement as t } from "../preact-mount.js";
2
- import { ButtonControl as n, Input as r } from "../native-control.js";
3
- import { t as i } from "./xmark-DD_PBvZI.js";
4
- import { h as a } from "preact";
5
- import { Fragment as o, jsx as s, jsxs as c } from "preact/jsx-runtime";
6
- import { forwardRef as l } from "preact/compat";
7
- //#region src/dialog/dialog-action-footer.view.tsx
8
- function u({ cancel: e = {}, save: t = {}, deleteAction: r = !1, reset: i = !1, start: a, end: o, children: l, actionsClass: u = "", class: d = "", ...f }) {
9
- let p = (e, t, r, i = "", a = "button") => {
10
- if (t === !1) return null;
11
- let { label: o = r, class: c = "", ...l } = t;
12
- return /* @__PURE__ */ s(n, {
13
- type: a,
14
- ...l,
15
- class: `rv-btn ${i} ${c}`,
16
- "data-dialog-action": e,
17
- children: o
18
- });
19
- };
20
- return /* @__PURE__ */ c("footer", {
21
- ...f,
22
- class: `rv-dialog__footer rv-dialog__action-footer ${d}`,
23
- children: [l, /* @__PURE__ */ c("div", {
24
- class: "rv-dialog__action-panel",
25
- children: [/* @__PURE__ */ c("div", {
26
- class: "rv-dialog__action-start",
27
- children: [
28
- a,
29
- p("delete", r, "Delete", "rv-btn-danger-outline"),
30
- p("reset", i, "Reset")
31
- ]
32
- }), /* @__PURE__ */ c("div", {
33
- class: `rv-dialog__actions ${u}`,
34
- children: [
35
- o,
36
- p("cancel", e, "Cancel"),
37
- p("save", t, "Save", "rv-btn-primary", "submit")
38
- ]
39
- })]
40
- })]
41
- });
42
- }
43
- function d(e, t) {
44
- return /* @__PURE__ */ s(u, { ...t });
45
- }
46
- function f(n, r) {
47
- let i = e(n.ownerDocument, /* @__PURE__ */ s(u, { ...r }));
48
- return n.append(i), { destroy() {
49
- t(i);
50
- } };
51
- }
52
- //#endregion
53
- //#region src/dialog/dialog.parts.tsx
54
- var p = l(({ class: e = "", ...t }, n) => /* @__PURE__ */ s("header", {
55
- ...t,
56
- ref: n,
57
- class: `rv-dialog__header ${e}`
58
- }));
59
- function m({ class: e = "", ...t }) {
60
- return /* @__PURE__ */ s("form", {
61
- ...t,
62
- class: `rv-dialog__surface ${e}`
63
- });
64
- }
65
- var h = l(({ class: e = "", ...t }, n) => /* @__PURE__ */ s("div", {
66
- ...t,
67
- ref: n,
68
- class: `rv-dialog__body ${e}`
69
- })), g = l(({ class: e = "", ...t }, n) => /* @__PURE__ */ s("footer", {
70
- ...t,
71
- ref: n,
72
- class: `rv-dialog__footer ${e}`
73
- })), _ = l(({ class: e = "", ...t }, n) => /* @__PURE__ */ s("div", {
74
- ...t,
75
- ref: n,
76
- class: `rv-dialog__actions ${e}`
77
- }));
78
- function v({ class: e = "", iconClass: t = "", ...r }) {
79
- return /* @__PURE__ */ s(n, {
80
- ...r,
81
- unstyled: !0,
82
- type: "button",
83
- class: `rv-dialog__close ${e}`,
84
- children: /* @__PURE__ */ s("span", {
85
- class: `rv-dialog__close-icon ${t}`,
86
- "aria-hidden": "true",
87
- dangerouslySetInnerHTML: { __html: i }
88
- })
89
- });
90
- }
91
- var y = l(({ class: e = "", ...t }, n) => /* @__PURE__ */ s(r, {
92
- ...t,
93
- ref: n,
94
- class: `rv-dialog__title-input ${e}`
95
- })), b = l(({ titleId: e, title: t, name: n, description: r, inputLabel: i, titleHidden: a, headingClass: l = "", kickerClass: u = "", titleClass: d = "", inputProps: f, closeLabel: m, closeProps: h, onClose: g, class: _ = "", ...b }, x) => /* @__PURE__ */ c(p, {
96
- ...b,
97
- ref: x,
98
- class: `rv-dialog__header--editable ${_}`,
99
- children: [/* @__PURE__ */ c("div", {
100
- class: `rv-dialog__heading ${l}`,
101
- children: [
102
- !a && n && /* @__PURE__ */ s("span", {
103
- class: `rv-dialog__kicker ${u}`,
104
- children: n
105
- }),
106
- !a && (f === !1 ? /* @__PURE__ */ s("h3", {
107
- id: e,
108
- class: `rv-dialog__title ${d}`,
109
- children: t
110
- }) : /* @__PURE__ */ c(o, { children: [/* @__PURE__ */ s("h3", {
111
- id: e,
112
- class: `rv-dialog__sr-only ${d}`,
113
- children: t
114
- }), /* @__PURE__ */ s(y, {
115
- "aria-label": i,
116
- value: t,
117
- ...f
118
- })] })),
119
- r && /* @__PURE__ */ s("div", {
120
- class: "rv-dialog__description",
121
- children: r
122
- })
123
- ]
124
- }), g && /* @__PURE__ */ s(v, {
125
- ...h,
126
- "aria-label": m,
127
- onClick: g
128
- })]
129
- }));
130
- function x(e) {
131
- return d(a, e);
132
- }
133
- //#endregion
134
- export { g as a, y as c, f as d, d as f, v as i, b as l, _ as n, m as o, h as r, p as s, x as t, u };
@@ -1,357 +0,0 @@
1
- import { t as e } from "./chevron-down-GbplLa6s.js";
2
- import { RemoveButton as t } from "../buttons/remove-button.js";
3
- import { DropdownPopup as n } from "../dropdown/popup.js";
4
- import { DropdownPopupContent as r } from "../dropdown/content.js";
5
- import { h as i, render as a } from "preact";
6
- import { useEffect as o, useLayoutEffect as s, useMemo as c, useRef as l, useState as u } from "preact/hooks";
7
- import { jsx as d, jsxs as f } from "preact/jsx-runtime";
8
- //#region src/dropdown/remote.ts
9
- var p = {
10
- loading: "Loading…",
11
- empty: "No results found",
12
- error: "Unable to load options.",
13
- retry: "Retry",
14
- loadMore: "Load more",
15
- unavailable: (e) => `Unavailable (${String(e)})`
16
- }, m = class {
17
- source;
18
- context;
19
- changed;
20
- text;
21
- settings;
22
- cache = /* @__PURE__ */ new Map();
23
- ids = [];
24
- items = [];
25
- query = "";
26
- cursor;
27
- seen = /* @__PURE__ */ new Set();
28
- searchAbort;
29
- resolveAbort;
30
- timer;
31
- generation = 0;
32
- resolution = 0;
33
- disposed = !1;
34
- loading = !1;
35
- searchFailed = !1;
36
- failedCursor;
37
- resolveFailed = !1;
38
- opened = !1;
39
- constructor(e, t, n, r = p, i = {}) {
40
- this.source = e, this.context = t, this.changed = n, this.text = r, this.settings = i;
41
- }
42
- remember(e) {
43
- for (let t of e) {
44
- if (typeof t.value != "string" && (typeof t.value != "number" || !Number.isFinite(t.value))) throw TypeError("Remote dropdown values must be finite numeric or string IDs.");
45
- this.cache.set(t.value, t);
46
- }
47
- }
48
- emit() {
49
- this.disposed || this.changed({
50
- items: [...this.items],
51
- selected: this.ids.map((e) => this.cache.get(e) ?? {
52
- value: e,
53
- label: this.text.unavailable(e),
54
- unresolved: !0
55
- }),
56
- loading: this.loading,
57
- error: this.searchFailed || this.resolveFailed,
58
- hasMore: this.cursor !== void 0
59
- });
60
- }
61
- setSelected(e, t = []) {
62
- this.remember(t), this.ids = [...new Set(e)], this.resolveAbort?.abort();
63
- let n = ++this.resolution, r = this.ids.filter((e) => !this.cache.has(e));
64
- if (this.resolveFailed = !1, this.emit(), !r.length || this.disposed) return;
65
- let i = this.resolveAbort = new AbortController();
66
- Promise.resolve().then(() => this.source.resolve({
67
- ids: r,
68
- signal: i.signal,
69
- context: this.context
70
- })).then((e) => {
71
- this.disposed || i.signal.aborted || n !== this.resolution || (this.remember(e), this.emit());
72
- }).catch(() => {
73
- this.disposed || i.signal.aborted || n !== this.resolution || (this.resolveFailed = !0, this.emit());
74
- });
75
- }
76
- search(e, t = !1) {
77
- this.disposed || (this.opened = !0, this.query = e, this.searchAbort?.abort(), clearTimeout(this.timer), ++this.generation, this.items = [], this.cursor = void 0, this.seen.clear(), this.loading = !0, this.searchFailed = !1, this.emit(), t ? this.page(void 0, this.generation) : this.timer = setTimeout(() => void this.page(void 0, this.generation), this.settings.debounceMs ?? 200));
78
- }
79
- async page(e, t) {
80
- if (this.disposed || t !== this.generation || this.seen.has(e)) return;
81
- this.seen.add(e), this.loading = !0, this.searchFailed = !1, this.emit();
82
- let n = this.searchAbort = new AbortController();
83
- try {
84
- let r = await this.source.search({
85
- query: this.query,
86
- cursor: e,
87
- pageSize: this.settings.pageSize ?? 50,
88
- signal: n.signal,
89
- context: this.context
90
- });
91
- if (this.disposed || n.signal.aborted || t !== this.generation) return;
92
- this.remember(r.items);
93
- let i = new Map(this.items.map((e) => [e.value, e]));
94
- r.items.forEach((e) => i.set(e.value, e)), this.items = [...i.values()], this.cursor = r.nextCursor ?? void 0, this.seen.has(this.cursor) && (this.cursor = void 0);
95
- } catch {
96
- if (this.disposed || n.signal.aborted || t !== this.generation) return;
97
- this.seen.delete(e), this.failedCursor = e, this.searchFailed = !0;
98
- } finally {
99
- !this.disposed && !n.signal.aborted && t === this.generation && (this.loading = !1, this.emit());
100
- }
101
- }
102
- loadMore() {
103
- !this.loading && !this.searchFailed && this.cursor !== void 0 && this.page(this.cursor, this.generation);
104
- }
105
- retry() {
106
- this.resolveFailed && this.setSelected(this.ids), this.searchFailed && this.opened && this.page(this.failedCursor, this.generation);
107
- }
108
- close() {
109
- this.opened = !1, this.searchAbort?.abort(), clearTimeout(this.timer), ++this.generation, this.loading = !1, this.emit();
110
- }
111
- destroy() {
112
- this.disposed = !0, this.close(), this.resolveAbort?.abort(), ++this.resolution;
113
- }
114
- };
115
- //#endregion
116
- //#region src/dropdown/remote-hook.ts
117
- function ee(e) {
118
- let t = c(() => ({
119
- ...p,
120
- ...e.remoteText
121
- }), [e.remoteText]), [n, r] = u({
122
- items: [],
123
- selected: [],
124
- loading: !1,
125
- error: !1,
126
- hasMore: !1
127
- }), i = l(), a = e.value === null || e.value === void 0 ? [] : Array.isArray(e.value) ? e.value : [e.value], d = JSON.stringify(a);
128
- return s(() => {
129
- if (!e.dataSource || e.disabled) {
130
- r({
131
- items: [],
132
- selected: [],
133
- loading: !1,
134
- error: !1,
135
- hasMore: !1
136
- });
137
- return;
138
- }
139
- let n = new m(e.dataSource, e.dataContext, r, t);
140
- return i.current = n, () => {
141
- n.destroy(), i.current === n && (i.current = void 0);
142
- };
143
- }, [
144
- e.dataSource,
145
- e.dataContext,
146
- e.disabled,
147
- t
148
- ]), s(() => {
149
- i.current?.setSelected(a, e.source);
150
- }, [
151
- d,
152
- e.source,
153
- e.dataSource,
154
- e.dataContext,
155
- e.disabled,
156
- t
157
- ]), o(() => {
158
- e.open ? i.current?.search(e.initialQuery, !0) : i.current?.close();
159
- }, [
160
- e.open,
161
- e.dataSource,
162
- e.dataContext,
163
- e.disabled,
164
- e.initialQuery,
165
- t
166
- ]), {
167
- ...n,
168
- text: t,
169
- search: (e) => i.current?.search(e),
170
- loadMore: () => i.current?.loadMore(),
171
- retry: () => i.current?.retry()
172
- };
173
- }
174
- //#endregion
175
- //#region src/dropdown/index.tsx
176
- var te = ({ options: e, className: t, renderValue: n }) => /* @__PURE__ */ d("span", {
177
- className: `selected-value ${t}`,
178
- children: n ? n(i, e[0]) : e[0].label
179
- }), ne = ({ options: e, removeOption: n, className: r, renderValue: a, disabled: o, removeLabel: s }) => /* @__PURE__ */ d("div", {
180
- className: `selected-values ${r}`,
181
- children: e.map((e, r) => /* @__PURE__ */ f("span", {
182
- className: "selected-tag",
183
- children: [a ? a(i, e) : e.label, !o && !e.disabled && /* @__PURE__ */ d(t, {
184
- compact: !0,
185
- onClick: (t) => {
186
- t.stopPropagation(), n(e);
187
- },
188
- locale: {
189
- title: s?.(e.label) ?? `Remove ${e.label}`,
190
- ariaLabel: s?.(e.label) ?? `Remove ${e.label}`
191
- }
192
- })]
193
- }, r))
194
- }), h = ({ className: t }) => /* @__PURE__ */ d("span", {
195
- className: `dropdown-arrow ${t}`,
196
- "aria-hidden": "true",
197
- dangerouslySetInnerHTML: { __html: e }
198
- }), re = ({ placeholder: e, className: t }) => [/* @__PURE__ */ d("span", {
199
- className: `placeholder px-2 ${t}`,
200
- children: e
201
- }), /* @__PURE__ */ d(h, { className: "mr-2" })];
202
- function g({ source: e, dataSource: t, dataContext: a, remoteText: s, value: p, onChange: m, placeholder: g = "Select an option", disabled: _ = !1, name: v, id: y, className: ie = "", style: b, config: x = {}, renderContent: S, renderOption: ae, renderValue: C, renderPlaceholder: w, renderSelectedValue: T, renderNoResults: oe, onClose: E, beforeOutsideClose: D, environment: O }) {
203
- let { search: k = !1, searchPlaceholder: A = "Search...", closeOnClickOutside: j = !0, autoOpen: M = !1, multiSelect: N = !1, portalTarget: P, ariaLabel: F, ariaLabelledBy: I, ariaDescribedBy: L, popupClassName: R, maxHeight: se } = x, z = l(null), B = P ?? (x.topLayer ? z.current?.closest("revo-grid") : void 0) ?? (typeof document < "u" ? document.body : null), V = c(() => y || `dropdown-${Math.random().toString(36).substring(2, 9)}`, [y]), H = `${V}-listbox`, ce = `${V}-search`, U = `${V}-menu`, [W, G] = u(M && !_), [le, K] = u(!_ && (M || !!x.autoFocus)), q = l(M), J = x.theme ?? "default";
204
- o(() => {
205
- M && !q.current && !_ && (K(!0), G(!0)), q.current = M;
206
- }, [M, _]), o(() => {
207
- _ && W && (G(!1), E?.(!1));
208
- }, [_, W]);
209
- let Y = ee({
210
- dataSource: t,
211
- dataContext: a,
212
- remoteText: s,
213
- value: p,
214
- disabled: _,
215
- source: e,
216
- open: W,
217
- initialQuery: x.initialSearch ?? ""
218
- }), X = t ? [...new Map([...Y.selected, ...Y.items].map((e) => [e.value, e])).values()] : e, Z = c(() => {
219
- if (p === void 0) return [];
220
- if (N && Array.isArray(p)) return X.filter((e) => p.some((t) => JSON.stringify(t) === JSON.stringify(e.value)));
221
- {
222
- let e = X.find((e) => JSON.stringify(e.value) === JSON.stringify(p));
223
- return e ? [e] : [];
224
- }
225
- }, [
226
- p,
227
- X,
228
- N
229
- ]), Q = () => {
230
- _ || G((e) => {
231
- let t = !e;
232
- return t && K(!0), t;
233
- });
234
- }, $ = (e = !1) => {
235
- G((t) => (t && E?.(e), !1));
236
- };
237
- o(() => {
238
- if (!W) return;
239
- let e = z.current;
240
- if (e) return O?.onOpen?.(e, $);
241
- }, [W]);
242
- let ue = (e) => {
243
- if (!(_ || e.disabled)) {
244
- if (N) {
245
- let t = Z.some((t) => JSON.stringify(t.value) === JSON.stringify(e.value)), n;
246
- n = t ? Z.filter((t) => JSON.stringify(t.value) !== JSON.stringify(e.value)) : [...Z, e], m && m(n.map((e) => e.value));
247
- } else m && m(e.value), $();
248
- }
249
- };
250
- return o(() => {
251
- if (!j || !W) return;
252
- let e = B?.ownerDocument ?? z.current?.ownerDocument ?? (typeof document < "u" ? document : void 0);
253
- if (!e) return;
254
- let t = (t) => {
255
- let n = e.getElementById(U), r = t.target;
256
- if (n && r && !n.contains(r) && z.current && !z.current.contains(r)) {
257
- if (D?.() === !1) {
258
- t.preventDefault(), t.stopImmediatePropagation();
259
- return;
260
- }
261
- $();
262
- }
263
- }, n = !!D;
264
- return e.addEventListener("pointerdown", t, n), () => {
265
- e.removeEventListener("pointerdown", t, n);
266
- };
267
- }, [
268
- j,
269
- W,
270
- U,
271
- B,
272
- D
273
- ]), /* @__PURE__ */ f("div", {
274
- className: `dropdown-container ${ie} ${_ ? "disabled" : ""}`,
275
- style: b,
276
- children: [
277
- /* @__PURE__ */ d("div", {
278
- ref: z,
279
- className: `dropdown-trigger ${W ? "open" : ""}`,
280
- role: "combobox",
281
- "aria-haspopup": S ? "dialog" : "listbox",
282
- "aria-expanded": W && !_,
283
- "aria-disabled": _,
284
- "aria-owns": H,
285
- "aria-controls": H,
286
- "aria-label": F,
287
- "aria-labelledby": I,
288
- "aria-describedby": L,
289
- tabIndex: _ ? -1 : 0,
290
- onClick: _ ? void 0 : Q,
291
- onKeyDown: (e) => {
292
- _ || e.target !== e.currentTarget || (W && e.key === "Escape" ? (e.preventDefault(), e.stopPropagation(), $()) : !W && (e.key === "Enter" || e.key === " " || e.key === "ArrowDown") && (e.preventDefault(), e.stopPropagation(), Q()));
293
- },
294
- children: (() => {
295
- let e = [h({})];
296
- return T ? T(i, Z, e) : Z.length > 0 ? N ? [/* @__PURE__ */ d(ne, {
297
- options: Z,
298
- removeOption: ue,
299
- renderValue: C,
300
- disabled: _,
301
- removeLabel: x.removeLabel
302
- }), /* @__PURE__ */ d(h, { className: "mr-2" })] : [/* @__PURE__ */ d(te, {
303
- options: Z,
304
- renderValue: C
305
- }), /* @__PURE__ */ d(h, { className: "mr-2" })] : w ? w(i, g, e) : /* @__PURE__ */ d(re, { placeholder: g });
306
- })()
307
- }),
308
- W && !_ && /* @__PURE__ */ d(n, {
309
- onPointerRelease: O?.onPointerRelease,
310
- topLayer: x.topLayer,
311
- triggerRef: z,
312
- portalTarget: B,
313
- theme: J,
314
- dropdownMenuId: U,
315
- popupClassName: R,
316
- maxHeight: se,
317
- children: S ? S({
318
- id: H,
319
- close: $
320
- }) : /* @__PURE__ */ d(r, {
321
- options: t ? Y.items : X,
322
- selectedValues: t ? Y.selected : void 0,
323
- remote: t ? Y : void 0,
324
- value: p,
325
- onChange: (e) => {
326
- _ || m?.(e);
327
- },
328
- config: {
329
- ...x,
330
- autoFocus: x.autoFocus || le
331
- },
332
- multiSelect: N,
333
- search: !!t || k,
334
- searchPlaceholder: A,
335
- listboxId: H,
336
- searchId: ce,
337
- renderOption: ae,
338
- renderNoResults: oe,
339
- onClose: $,
340
- theme: J
341
- })
342
- }),
343
- v && /* @__PURE__ */ d("input", {
344
- type: "hidden",
345
- name: v,
346
- value: JSON.stringify(N ? Z.map((e) => e.value) : Z[0]?.value || "")
347
- })
348
- ]
349
- });
350
- }
351
- var _ = (e, t) => {
352
- a(/* @__PURE__ */ d(g, { ...t }), e);
353
- }, v = (e) => {
354
- a(null, e);
355
- };
356
- //#endregion
357
- export { _ as n, v as r, g as t };