@namroodinc/liquid-editorial 0.13.5 → 0.15.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 (275) hide show
  1. package/README.md +2 -2
  2. package/UPGRADING.md +94 -0
  3. package/dist/chunks/{Avatar-BY0dAItT.cjs → Avatar-BZGFSE6C.cjs} +2 -2
  4. package/dist/chunks/{Avatar-BY0dAItT.cjs.map → Avatar-BZGFSE6C.cjs.map} +1 -1
  5. package/dist/chunks/{Avatar-UjhjcHh5.js → Avatar-C4W-g8nU.js} +2 -2
  6. package/dist/chunks/{Avatar-UjhjcHh5.js.map → Avatar-C4W-g8nU.js.map} +1 -1
  7. package/dist/chunks/{Board-DUX76d2R.js → Board-Cbi5FMW-.js} +2 -2
  8. package/dist/chunks/{Board-DUX76d2R.js.map → Board-Cbi5FMW-.js.map} +1 -1
  9. package/dist/chunks/{Board-CQ1GTuRB.cjs → Board-_agEjTy8.cjs} +2 -2
  10. package/dist/chunks/{Board-CQ1GTuRB.cjs.map → Board-_agEjTy8.cjs.map} +1 -1
  11. package/dist/chunks/{CollectionView-CIJdNwcq.cjs → CollectionView-BfX2Lxre.cjs} +2 -2
  12. package/dist/chunks/{CollectionView-CIJdNwcq.cjs.map → CollectionView-BfX2Lxre.cjs.map} +1 -1
  13. package/dist/chunks/{CollectionView-JRNdXHti.js → CollectionView-DPJGtSP5.js} +2 -2
  14. package/dist/chunks/{CollectionView-JRNdXHti.js.map → CollectionView-DPJGtSP5.js.map} +1 -1
  15. package/dist/chunks/{ColourField-DFvRASVe.cjs → ColourField-BVGnW8Wh.cjs} +2 -2
  16. package/dist/chunks/{ColourField-DFvRASVe.cjs.map → ColourField-BVGnW8Wh.cjs.map} +1 -1
  17. package/dist/chunks/{ColourField-BG5oGj9f.js → ColourField-BcuARZY4.js} +6 -6
  18. package/dist/chunks/{ColourField-BG5oGj9f.js.map → ColourField-BcuARZY4.js.map} +1 -1
  19. package/dist/chunks/{DatePicker-LqaePc57.js → DatePicker-VQUsbYdo.js} +3 -3
  20. package/dist/chunks/{DatePicker-LqaePc57.js.map → DatePicker-VQUsbYdo.js.map} +1 -1
  21. package/dist/chunks/{DatePicker-ClOqS6oH.cjs → DatePicker-zA0bWVBp.cjs} +2 -2
  22. package/dist/chunks/{DatePicker-ClOqS6oH.cjs.map → DatePicker-zA0bWVBp.cjs.map} +1 -1
  23. package/dist/chunks/{Drawer-Ck5XKT_V.js → Drawer-2cf0SaG4.js} +3 -3
  24. package/dist/chunks/{Drawer-Ck5XKT_V.js.map → Drawer-2cf0SaG4.js.map} +1 -1
  25. package/dist/chunks/{Drawer-DdIH9jpe.cjs → Drawer-BzvSfkCL.cjs} +2 -2
  26. package/dist/chunks/{Drawer-DdIH9jpe.cjs.map → Drawer-BzvSfkCL.cjs.map} +1 -1
  27. package/dist/chunks/EntryPicker-BGWxiLJ_.js +877 -0
  28. package/dist/chunks/EntryPicker-BGWxiLJ_.js.map +1 -0
  29. package/dist/chunks/EntryPicker-wVjzdlAO.cjs +2 -0
  30. package/dist/chunks/EntryPicker-wVjzdlAO.cjs.map +1 -0
  31. package/dist/chunks/FormEditor-BHVJG23r.js +30 -0
  32. package/dist/chunks/FormEditor-BHVJG23r.js.map +1 -0
  33. package/dist/chunks/FormEditor-DjUz7qQo.cjs +2 -0
  34. package/dist/chunks/FormEditor-DjUz7qQo.cjs.map +1 -0
  35. package/dist/chunks/Icon-QLZH31JA.cjs +2 -0
  36. package/dist/chunks/Icon-QLZH31JA.cjs.map +1 -0
  37. package/dist/chunks/Icon-kLLQC54Z.js +107 -0
  38. package/dist/chunks/Icon-kLLQC54Z.js.map +1 -0
  39. package/dist/chunks/{Message-d6lqiMQ6.js → Message-DM6pTq7N.js} +2 -2
  40. package/dist/chunks/{Message-d6lqiMQ6.js.map → Message-DM6pTq7N.js.map} +1 -1
  41. package/dist/chunks/{Message-yhdaBpaz.cjs → Message-yZJDVzb8.cjs} +2 -2
  42. package/dist/chunks/{Message-yhdaBpaz.cjs.map → Message-yZJDVzb8.cjs.map} +1 -1
  43. package/dist/chunks/RichTextEditor-BgfeOrEe.cjs +2 -0
  44. package/dist/chunks/RichTextEditor-BgfeOrEe.cjs.map +1 -0
  45. package/dist/chunks/RichTextEditor-CS2ED0HP.js +2702 -0
  46. package/dist/chunks/RichTextEditor-CS2ED0HP.js.map +1 -0
  47. package/dist/chunks/dialogLabel-Dx-WEEzI.cjs +2 -0
  48. package/dist/chunks/dialogLabel-Dx-WEEzI.cjs.map +1 -0
  49. package/dist/chunks/dialogLabel-nB1gwKz0.js +157 -0
  50. package/dist/chunks/dialogLabel-nB1gwKz0.js.map +1 -0
  51. package/dist/chunks/overlayLayer-CPd3zj_u.cjs +2 -0
  52. package/dist/chunks/overlayLayer-CPd3zj_u.cjs.map +1 -0
  53. package/dist/chunks/overlayLayer-Dv1vmfaI.js +199 -0
  54. package/dist/chunks/overlayLayer-Dv1vmfaI.js.map +1 -0
  55. package/dist/chunks/{useTooltip-DnJEFBLg.js → useTooltip-COyAcujL.js} +2 -2
  56. package/dist/chunks/{useTooltip-DnJEFBLg.js.map → useTooltip-COyAcujL.js.map} +1 -1
  57. package/dist/chunks/{useTooltip-C7ON4nkV.cjs → useTooltip-nEDN0ObI.cjs} +2 -2
  58. package/dist/chunks/{useTooltip-C7ON4nkV.cjs.map → useTooltip-nEDN0ObI.cjs.map} +1 -1
  59. package/dist/components/AppShell/index.cjs +1 -1
  60. package/dist/components/AppShell/index.js +1 -1
  61. package/dist/components/AssetCard/index.cjs +1 -1
  62. package/dist/components/AssetCard/index.js +1 -1
  63. package/dist/components/AssetGrid/index.cjs +1 -1
  64. package/dist/components/AssetGrid/index.js +1 -1
  65. package/dist/components/Avatar/index.cjs +1 -1
  66. package/dist/components/Avatar/index.js +1 -1
  67. package/dist/components/Banner/index.cjs +1 -1
  68. package/dist/components/Banner/index.js +1 -1
  69. package/dist/components/Board/index.cjs +1 -1
  70. package/dist/components/Board/index.js +1 -1
  71. package/dist/components/Button/index.cjs +1 -1
  72. package/dist/components/Button/index.js +1 -1
  73. package/dist/components/Choice/index.cjs +1 -1
  74. package/dist/components/Choice/index.cjs.map +1 -1
  75. package/dist/components/Choice/index.js +5 -5
  76. package/dist/components/CollectionView/index.cjs +1 -1
  77. package/dist/components/CollectionView/index.js +1 -1
  78. package/dist/components/ColourField/index.cjs +1 -1
  79. package/dist/components/ColourField/index.js +1 -1
  80. package/dist/components/DatePicker/index.cjs +1 -1
  81. package/dist/components/DatePicker/index.js +1 -1
  82. package/dist/components/Drawer/index.cjs +1 -1
  83. package/dist/components/Drawer/index.js +1 -1
  84. package/dist/components/EditLayout/index.cjs +1 -1
  85. package/dist/components/EditLayout/index.cjs.map +1 -1
  86. package/dist/components/EditLayout/index.js +6 -7
  87. package/dist/components/EditLayout/index.js.map +1 -1
  88. package/dist/components/EntryPicker/dialog.d.cts +11 -1
  89. package/dist/components/EntryPicker/dialog.d.cts.map +1 -1
  90. package/dist/components/EntryPicker/dialog.d.ts +11 -1
  91. package/dist/components/EntryPicker/dialog.d.ts.map +1 -1
  92. package/dist/components/EntryPicker/index.cjs +1 -1
  93. package/dist/components/EntryPicker/index.js +1 -1
  94. package/dist/components/EntryPicker/style.css +1 -1
  95. package/dist/components/EntryPicker/use-picker-data.d.cts +1 -1
  96. package/dist/components/EntryPicker/use-picker-data.d.cts.map +1 -1
  97. package/dist/components/EntryPicker/use-picker-data.d.ts +1 -1
  98. package/dist/components/EntryPicker/use-picker-data.d.ts.map +1 -1
  99. package/dist/components/EntryPicker/use-picker-session.d.cts +4 -1
  100. package/dist/components/EntryPicker/use-picker-session.d.cts.map +1 -1
  101. package/dist/components/EntryPicker/use-picker-session.d.ts +4 -1
  102. package/dist/components/EntryPicker/use-picker-session.d.ts.map +1 -1
  103. package/dist/components/EntryPicker/use-selected-items.d.cts +2 -0
  104. package/dist/components/EntryPicker/use-selected-items.d.cts.map +1 -1
  105. package/dist/components/EntryPicker/use-selected-items.d.ts +2 -0
  106. package/dist/components/EntryPicker/use-selected-items.d.ts.map +1 -1
  107. package/dist/components/FormEditor/README.md +197 -28
  108. package/dist/components/FormEditor/control.d.cts +11 -2
  109. package/dist/components/FormEditor/control.d.cts.map +1 -1
  110. package/dist/components/FormEditor/control.d.ts +11 -2
  111. package/dist/components/FormEditor/control.d.ts.map +1 -1
  112. package/dist/components/FormEditor/form.d.cts +33 -0
  113. package/dist/components/FormEditor/form.d.cts.map +1 -0
  114. package/dist/components/FormEditor/form.d.ts +33 -0
  115. package/dist/components/FormEditor/form.d.ts.map +1 -0
  116. package/dist/components/FormEditor/index.cjs +1 -1
  117. package/dist/components/FormEditor/index.d.cts +3 -27
  118. package/dist/components/FormEditor/index.d.cts.map +1 -1
  119. package/dist/components/FormEditor/index.d.ts +3 -27
  120. package/dist/components/FormEditor/index.d.ts.map +1 -1
  121. package/dist/components/FormEditor/index.js +3 -3
  122. package/dist/components/FormEditor/model.d.cts +2 -0
  123. package/dist/components/FormEditor/model.d.cts.map +1 -1
  124. package/dist/components/FormEditor/model.d.ts +2 -0
  125. package/dist/components/FormEditor/model.d.ts.map +1 -1
  126. package/dist/components/FormEditor/rich-text-control.d.cts +4 -0
  127. package/dist/components/FormEditor/rich-text-control.d.cts.map +1 -0
  128. package/dist/components/FormEditor/rich-text-control.d.ts +4 -0
  129. package/dist/components/FormEditor/rich-text-control.d.ts.map +1 -0
  130. package/dist/components/Icon/icons.d.cts +16 -0
  131. package/dist/components/Icon/icons.d.cts.map +1 -1
  132. package/dist/components/Icon/icons.d.ts +16 -0
  133. package/dist/components/Icon/icons.d.ts.map +1 -1
  134. package/dist/components/Icon/index.cjs +1 -1
  135. package/dist/components/Icon/index.js +1 -1
  136. package/dist/components/ImageCropper/index.cjs +1 -1
  137. package/dist/components/ImageCropper/index.cjs.map +1 -1
  138. package/dist/components/ImageCropper/index.js +6 -6
  139. package/dist/components/Menu/index.cjs +1 -1
  140. package/dist/components/Menu/index.cjs.map +1 -1
  141. package/dist/components/Menu/index.d.cts +3 -2
  142. package/dist/components/Menu/index.d.cts.map +1 -1
  143. package/dist/components/Menu/index.d.ts +3 -2
  144. package/dist/components/Menu/index.d.ts.map +1 -1
  145. package/dist/components/Menu/index.js +65 -52
  146. package/dist/components/Menu/index.js.map +1 -1
  147. package/dist/components/Modal/index.cjs +1 -1
  148. package/dist/components/Modal/index.js +2 -2
  149. package/dist/components/Popover/index.cjs +1 -1
  150. package/dist/components/Popover/index.cjs.map +1 -1
  151. package/dist/components/Popover/index.d.cts.map +1 -1
  152. package/dist/components/Popover/index.d.ts.map +1 -1
  153. package/dist/components/Popover/index.js +67 -64
  154. package/dist/components/Popover/index.js.map +1 -1
  155. package/dist/components/RichTextEditor/content-block-frame.d.cts +32 -0
  156. package/dist/components/RichTextEditor/content-block-frame.d.cts.map +1 -0
  157. package/dist/components/RichTextEditor/content-block-frame.d.ts +32 -0
  158. package/dist/components/RichTextEditor/content-block-frame.d.ts.map +1 -0
  159. package/dist/components/RichTextEditor/content-block-view.d.cts +3 -0
  160. package/dist/components/RichTextEditor/content-block-view.d.cts.map +1 -0
  161. package/dist/components/RichTextEditor/content-block-view.d.ts +3 -0
  162. package/dist/components/RichTextEditor/content-block-view.d.ts.map +1 -0
  163. package/dist/components/RichTextEditor/content-block.d.cts +24 -0
  164. package/dist/components/RichTextEditor/content-block.d.cts.map +1 -0
  165. package/dist/components/RichTextEditor/content-block.d.ts +24 -0
  166. package/dist/components/RichTextEditor/content-block.d.ts.map +1 -0
  167. package/dist/components/RichTextEditor/document.d.cts +15 -8
  168. package/dist/components/RichTextEditor/document.d.cts.map +1 -1
  169. package/dist/components/RichTextEditor/document.d.ts +15 -8
  170. package/dist/components/RichTextEditor/document.d.ts.map +1 -1
  171. package/dist/components/RichTextEditor/embed-context.d.cts +5 -0
  172. package/dist/components/RichTextEditor/embed-context.d.cts.map +1 -1
  173. package/dist/components/RichTextEditor/embed-context.d.ts +5 -0
  174. package/dist/components/RichTextEditor/embed-context.d.ts.map +1 -1
  175. package/dist/components/RichTextEditor/embed-types.d.cts +6 -4
  176. package/dist/components/RichTextEditor/embed-types.d.cts.map +1 -1
  177. package/dist/components/RichTextEditor/embed-types.d.ts +6 -4
  178. package/dist/components/RichTextEditor/embed-types.d.ts.map +1 -1
  179. package/dist/components/RichTextEditor/index.cjs +1 -1
  180. package/dist/components/RichTextEditor/index.d.cts +9 -1
  181. package/dist/components/RichTextEditor/index.d.cts.map +1 -1
  182. package/dist/components/RichTextEditor/index.d.ts +9 -1
  183. package/dist/components/RichTextEditor/index.d.ts.map +1 -1
  184. package/dist/components/RichTextEditor/index.js +1 -2
  185. package/dist/components/RichTextEditor/style.css +161 -86
  186. package/dist/components/RichTextEditor/table-actions.d.cts +11 -0
  187. package/dist/components/RichTextEditor/table-actions.d.cts.map +1 -0
  188. package/dist/components/RichTextEditor/table-actions.d.ts +11 -0
  189. package/dist/components/RichTextEditor/table-actions.d.ts.map +1 -0
  190. package/dist/components/RichTextEditor/table-bands.d.cts +19 -0
  191. package/dist/components/RichTextEditor/table-bands.d.cts.map +1 -0
  192. package/dist/components/RichTextEditor/table-bands.d.ts +19 -0
  193. package/dist/components/RichTextEditor/table-bands.d.ts.map +1 -0
  194. package/dist/components/RichTextEditor/table-view.d.cts +4 -0
  195. package/dist/components/RichTextEditor/table-view.d.cts.map +1 -0
  196. package/dist/components/RichTextEditor/table-view.d.ts +4 -0
  197. package/dist/components/RichTextEditor/table-view.d.ts.map +1 -0
  198. package/dist/components/RichTextEditor/tables.d.cts +7 -0
  199. package/dist/components/RichTextEditor/tables.d.cts.map +1 -0
  200. package/dist/components/RichTextEditor/tables.d.ts +7 -0
  201. package/dist/components/RichTextEditor/tables.d.ts.map +1 -0
  202. package/dist/components/RichTextEditor/use-embeds.d.cts.map +1 -1
  203. package/dist/components/RichTextEditor/use-embeds.d.ts.map +1 -1
  204. package/dist/components/SearchField/index.cjs +1 -1
  205. package/dist/components/SearchField/index.js +1 -1
  206. package/dist/components/Select/index.cjs +1 -1
  207. package/dist/components/Select/index.js +2 -2
  208. package/dist/components/SelectionCard/index.cjs +1 -1
  209. package/dist/components/SelectionCard/index.cjs.map +1 -1
  210. package/dist/components/SelectionCard/index.js +4 -4
  211. package/dist/components/SelectionCard/index.js.map +1 -1
  212. package/dist/components/SideNav/index.cjs +1 -1
  213. package/dist/components/SideNav/index.js +1 -1
  214. package/dist/components/SortableList/index.cjs +1 -1
  215. package/dist/components/SortableList/index.js +1 -1
  216. package/dist/components/Stepper/index.cjs +1 -1
  217. package/dist/components/Stepper/index.js +1 -1
  218. package/dist/components/SubNav/index.cjs +1 -1
  219. package/dist/components/SubNav/index.js +1 -1
  220. package/dist/components/Switch/style.css +2 -6
  221. package/dist/components/Table/index.cjs +1 -1
  222. package/dist/components/Table/index.js +1 -1
  223. package/dist/components/Time/index.cjs +1 -1
  224. package/dist/components/Time/index.js +1 -1
  225. package/dist/components/Toast/index.cjs +1 -1
  226. package/dist/components/Toast/index.js +1 -1
  227. package/dist/components/TopNav/index.cjs +1 -1
  228. package/dist/components/TopNav/index.js +1 -1
  229. package/dist/index.cjs +1 -1
  230. package/dist/index.d.cts +1 -1
  231. package/dist/index.d.cts.map +1 -1
  232. package/dist/index.d.ts +1 -1
  233. package/dist/index.d.ts.map +1 -1
  234. package/dist/index.js +28 -28
  235. package/dist/internal/dialogFocus.d.cts +6 -1
  236. package/dist/internal/dialogFocus.d.cts.map +1 -1
  237. package/dist/internal/dialogFocus.d.ts +6 -1
  238. package/dist/internal/dialogFocus.d.ts.map +1 -1
  239. package/package.json +8 -6
  240. package/dist/chunks/EntryPicker-B4dAsObz.cjs +0 -2
  241. package/dist/chunks/EntryPicker-B4dAsObz.cjs.map +0 -1
  242. package/dist/chunks/EntryPicker-DDXHytMN.js +0 -160
  243. package/dist/chunks/EntryPicker-DDXHytMN.js.map +0 -1
  244. package/dist/chunks/FormEditor-BGzE-rqk.cjs +0 -2
  245. package/dist/chunks/FormEditor-BGzE-rqk.cjs.map +0 -1
  246. package/dist/chunks/FormEditor-ChH4e5sB.js +0 -693
  247. package/dist/chunks/FormEditor-ChH4e5sB.js.map +0 -1
  248. package/dist/chunks/Icon-3ucBRgrd.cjs +0 -2
  249. package/dist/chunks/Icon-3ucBRgrd.cjs.map +0 -1
  250. package/dist/chunks/Icon-dPXyBYe5.js +0 -91
  251. package/dist/chunks/Icon-dPXyBYe5.js.map +0 -1
  252. package/dist/chunks/RichTextEditor-BFblqw8m.js +0 -1144
  253. package/dist/chunks/RichTextEditor-BFblqw8m.js.map +0 -1
  254. package/dist/chunks/RichTextEditor-DU9CVeRD.cjs +0 -2
  255. package/dist/chunks/RichTextEditor-DU9CVeRD.cjs.map +0 -1
  256. package/dist/chunks/dialogLabel-DT7rCr3_.js +0 -176
  257. package/dist/chunks/dialogLabel-DT7rCr3_.js.map +0 -1
  258. package/dist/chunks/dialogLabel-_-MTckE_.cjs +0 -2
  259. package/dist/chunks/dialogLabel-_-MTckE_.cjs.map +0 -1
  260. package/dist/chunks/overlayLayer-iGhuAByk.cjs +0 -2
  261. package/dist/chunks/overlayLayer-iGhuAByk.cjs.map +0 -1
  262. package/dist/chunks/overlayLayer-lU4iWSjO.js +0 -162
  263. package/dist/chunks/overlayLayer-lU4iWSjO.js.map +0 -1
  264. package/dist/chunks/use-picker-session-BSpOwnQ-.js +0 -712
  265. package/dist/chunks/use-picker-session-BSpOwnQ-.js.map +0 -1
  266. package/dist/chunks/use-picker-session-ouqHBmVA.cjs +0 -2
  267. package/dist/chunks/use-picker-session-ouqHBmVA.cjs.map +0 -1
  268. package/dist/components/RichTextEditor/storyblock-view.d.cts +0 -3
  269. package/dist/components/RichTextEditor/storyblock-view.d.cts.map +0 -1
  270. package/dist/components/RichTextEditor/storyblock-view.d.ts +0 -3
  271. package/dist/components/RichTextEditor/storyblock-view.d.ts.map +0 -1
  272. package/dist/components/RichTextEditor/storyblock.d.cts +0 -19
  273. package/dist/components/RichTextEditor/storyblock.d.cts.map +0 -1
  274. package/dist/components/RichTextEditor/storyblock.d.ts +0 -19
  275. package/dist/components/RichTextEditor/storyblock.d.ts.map +0 -1
@@ -0,0 +1,877 @@
1
+ import { t as e } from "./Icon-kLLQC54Z.js";
2
+ import { Button as t } from "../components/Button/index.js";
3
+ import { b as n, h as r, u as i } from "./overlayLayer-Dv1vmfaI.js";
4
+ import { Badge as a } from "../components/Badge/index.js";
5
+ import { r as o } from "./limit-s9zfxIMC.js";
6
+ import { LimitReading as s } from "../components/LimitReading/index.js";
7
+ import { Modal as c } from "../components/Modal/index.js";
8
+ import { n as l, r as u, t as d } from "./LoadState-B056EPu7.js";
9
+ import { Stack as f } from "../components/Grid/index.js";
10
+ import { SearchField as p } from "../components/SearchField/index.js";
11
+ import { t as m } from "./style-7Z_xRlQx.js";
12
+ import { Checkbox as h } from "../components/Choice/index.js";
13
+ import { SortableList as g, SortableListItem as _ } from "../components/SortableList/index.js";
14
+ import { useEffect as v, useId as y, useMemo as b, useRef as x, useState as S } from "react";
15
+ import { Fragment as C, jsx as w, jsxs as T } from "react/jsx-runtime";
16
+ //#region src/components/EntryPicker/item.tsx
17
+ function E(e) {
18
+ return e.isDisabled ? e.disabledReason : void 0;
19
+ }
20
+ function D(e) {
21
+ return e.tone === "removed";
22
+ }
23
+ function O(e) {
24
+ return D(e) ? void 0 : E(e);
25
+ }
26
+ function k({ item: t, reasonId: n }) {
27
+ let r = E(t);
28
+ return /* @__PURE__ */ T(C, { children: [/* @__PURE__ */ w("span", {
29
+ className: "ds-entry__thumb",
30
+ children: t.imageUrl ? /* @__PURE__ */ w("img", {
31
+ src: t.imageUrl,
32
+ alt: "",
33
+ loading: "lazy"
34
+ }) : /* @__PURE__ */ w(e, {
35
+ name: "file-text",
36
+ size: 20
37
+ })
38
+ }), /* @__PURE__ */ T("span", {
39
+ className: "ds-entry__body",
40
+ children: [
41
+ /* @__PURE__ */ w("span", {
42
+ className: "ds-entry__title",
43
+ "data-unavailable": t.isUnavailable || void 0,
44
+ children: t.title
45
+ }),
46
+ t.metadata != null && /* @__PURE__ */ w("span", {
47
+ className: "ds-entry__meta",
48
+ children: t.metadata
49
+ }),
50
+ r && /* @__PURE__ */ T("span", {
51
+ id: n,
52
+ className: "ds-entry__reason",
53
+ children: [
54
+ /* @__PURE__ */ w(a, {
55
+ shape: "tag",
56
+ size: "sm",
57
+ children: r.label
58
+ }),
59
+ " ",
60
+ /* @__PURE__ */ w("span", { children: r.description })
61
+ ]
62
+ })
63
+ ]
64
+ })] });
65
+ }
66
+ function A({ item: e, reasonId: t }) {
67
+ return D(e) ? /* @__PURE__ */ T("span", {
68
+ className: "ds-entry__removed",
69
+ children: [
70
+ /* @__PURE__ */ w("strong", { children: e.title }),
71
+ " ",
72
+ e.metadata ?? /* @__PURE__ */ w("code", { children: e.id })
73
+ ]
74
+ }) : /* @__PURE__ */ w(k, {
75
+ item: e,
76
+ reasonId: t
77
+ });
78
+ }
79
+ function j({ item: e }) {
80
+ return D(e) ? /* @__PURE__ */ w(a, {
81
+ shape: "tag",
82
+ children: e.removedLabel ?? "Removed on save"
83
+ }) : null;
84
+ }
85
+ function M({ item: e, onEdit: n, isDisabled: r }) {
86
+ return !n || e.isUnavailable || e.isDisabled ? null : /* @__PURE__ */ w(t, {
87
+ variant: "simple",
88
+ size: "sm",
89
+ isIconOnly: !0,
90
+ iconStart: "pencil",
91
+ "aria-label": `Edit ${e.title}`,
92
+ isDisabled: r,
93
+ onClick: () => n(e)
94
+ });
95
+ }
96
+ //#endregion
97
+ //#region src/components/EntryPicker/chosen.ts
98
+ function N(e, t, n) {
99
+ return {
100
+ id: e,
101
+ title: t,
102
+ metadata: n,
103
+ isUnavailable: !0
104
+ };
105
+ }
106
+ function P({ selected: e, items: t, pageItems: n, known: r, failures: i, hasResolver: a, itemLabel: o }) {
107
+ let s = new Map(t.map((e) => [e.id, e])), c = new Map(n.map((e) => [e.id, e]));
108
+ return e.map((e) => (s.get(e) ?? (r.has(e) ? r.get(e) : c.get(e))) || (r.has(e) ? N(e, `${`${o.charAt(0).toUpperCase()}${o.slice(1)}`} no longer available`, "Replace or clear this selection.") : a ? N(e, i.has(e) ? `Couldn't load ${o}` : "Loading…") : {
109
+ id: e,
110
+ title: e
111
+ }));
112
+ }
113
+ //#endregion
114
+ //#region src/components/EntryPicker/use-selected-items.ts
115
+ function F(e) {
116
+ return e instanceof Error ? e : null;
117
+ }
118
+ function I(e, t) {
119
+ if (!t.some((t) => e.has(t))) return e;
120
+ let n = new Map(e);
121
+ for (let e of t) n.delete(e);
122
+ return n;
123
+ }
124
+ function L(e, t, n) {
125
+ let r = n ? t.flatMap((t) => {
126
+ let r = n(t);
127
+ return r?.item.id === t && e.seeds.get(t) !== r ? [r] : [];
128
+ }) : [];
129
+ if (r.length === 0) return e;
130
+ let i = r.filter((t) => Object.is(t.revision, e.refreshKey)), a = r.filter((t) => !Object.is(t.revision, e.refreshKey) && !e.known.has(t.item.id) && !e.stale.has(t.item.id)), o = (e) => e.map((e) => [e.item.id, e.item]);
131
+ return {
132
+ ...e,
133
+ seeds: new Map([...e.seeds, ...r.map((e) => [e.item.id, e])]),
134
+ known: i.length ? new Map([...e.known, ...o(i)]) : e.known,
135
+ stale: a.length ? new Map([...e.stale, ...o(a)]) : e.stale,
136
+ failures: I(e.failures, i.map((e) => e.item.id))
137
+ };
138
+ }
139
+ function R(e, t) {
140
+ return e !== t && (e.length !== t.length || t.some((t) => !e.includes(t)));
141
+ }
142
+ function z(e, t, n, r) {
143
+ let i = e;
144
+ if (Object.is(i.refreshKey, n) || (i = {
145
+ ...i,
146
+ refreshKey: n,
147
+ known: /* @__PURE__ */ new Map(),
148
+ stale: new Map([...i.stale, ...i.known]),
149
+ failures: /* @__PURE__ */ new Map()
150
+ }), R(i.selected, t)) {
151
+ let e = i.selected.filter((e) => !t.includes(e));
152
+ i = {
153
+ ...i,
154
+ selected: t,
155
+ known: I(i.known, e),
156
+ stale: I(i.stale, e),
157
+ failures: I(i.failures, e),
158
+ seeds: I(i.seeds, e)
159
+ };
160
+ }
161
+ return L(i, t, r);
162
+ }
163
+ function B(e, t, n, r, a) {
164
+ let o = i(n), s = i(e), [c, l] = S(() => L({
165
+ refreshKey: r,
166
+ selected: e,
167
+ known: /* @__PURE__ */ new Map(),
168
+ stale: /* @__PURE__ */ new Map(),
169
+ failures: /* @__PURE__ */ new Map(),
170
+ seeds: /* @__PURE__ */ new Map()
171
+ }, e, a)), u = z(c, e, r, a);
172
+ u !== c && l(u);
173
+ let { known: d, stale: f, failures: p } = u, m = b(() => f.size === 0 ? d : new Map([...f, ...d]), [f, d]), h = (e, t, n = s.current) => {
174
+ let r = e.filter((e) => e !== void 0 && n.includes(e.id)).map((e) => [e.id, e]);
175
+ r.length !== 0 && l((e) => {
176
+ if (Object.is(e.refreshKey, t)) return {
177
+ ...e,
178
+ known: new Map([...e.known, ...r])
179
+ };
180
+ let n = r.filter(([t]) => !e.known.has(t) && !e.stale.has(t));
181
+ return n.length === 0 ? e : {
182
+ ...e,
183
+ stale: new Map([...e.stale, ...n])
184
+ };
185
+ });
186
+ }, g = new Set(t.map((e) => e.id)), _ = n ? e.filter((e) => !g.has(e) && !d.has(e) && !p.has(e)) : [], y = JSON.stringify(_), C = x({
187
+ refreshKey: r,
188
+ tokens: /* @__PURE__ */ new Map()
189
+ });
190
+ v(() => {
191
+ let e = o.current;
192
+ if (!e) return;
193
+ let t = JSON.parse(y);
194
+ Object.is(C.current.refreshKey, r) || (C.current = {
195
+ refreshKey: r,
196
+ tokens: /* @__PURE__ */ new Map()
197
+ });
198
+ let { tokens: n } = C.current;
199
+ for (let e of n.keys()) t.includes(e) || n.delete(e);
200
+ for (let i of t.filter((e) => !n.has(e))) {
201
+ let t = Symbol(i);
202
+ n.set(i, t);
203
+ let a = (e) => {
204
+ C.current.tokens.get(i) === t && (C.current.tokens.delete(i), l((t) => Object.is(t.refreshKey, r) && t.selected.includes(i) ? e(t) : t));
205
+ };
206
+ Promise.resolve().then(() => e(i)).then((e) => a((t) => t.known.has(i) ? t : {
207
+ ...t,
208
+ known: new Map(t.known).set(i, e ?? null)
209
+ }), (e) => a((t) => ({
210
+ ...t,
211
+ failures: new Map(t.failures).set(i, F(e))
212
+ })));
213
+ }
214
+ }, [
215
+ y,
216
+ r,
217
+ o
218
+ ]);
219
+ let w = e.filter((e) => p.has(e) && !d.has(e));
220
+ return {
221
+ known: m,
222
+ current: d,
223
+ failures: p,
224
+ remember: h,
225
+ status: _.length > 0 ? "loading" : w.length > 0 ? "error" : "ready",
226
+ error: w.length > 0 ? p.get(w[0]) ?? null : null,
227
+ retry: () => l((e) => ({
228
+ ...e,
229
+ failures: I(e.failures, w)
230
+ }))
231
+ };
232
+ }
233
+ //#endregion
234
+ //#region src/components/EntryPicker/feedback.tsx
235
+ function V(e, t, n, r) {
236
+ let i = l(t, n, r);
237
+ return t !== "error" && i.state !== "pending" ? null : /* @__PURE__ */ w(u, {
238
+ title: e,
239
+ error: i.error,
240
+ onRetry: i.retry,
241
+ retryState: i.state
242
+ });
243
+ }
244
+ function H({ query: e, itemLabel: t, itemsLabel: n, canCreate: r }) {
245
+ let i = e.trim();
246
+ return /* @__PURE__ */ T("div", {
247
+ className: "ds-entry-picker__no-results",
248
+ children: [/* @__PURE__ */ w("p", { children: i ? `No ${n} match “${i}”` : `No ${n} yet` }), i && /* @__PURE__ */ T("p", { children: ["Try a different search.", r ? ` Or create the ${t} you need.` : ""] })]
249
+ });
250
+ }
251
+ function U(e, t) {
252
+ let r = e.closest(".ds-entry-picker__scroll") ?? e.parentElement, i = Array.from(r?.querySelectorAll(".ds-entry-picker__result") ?? []);
253
+ for (let e of [...i.slice(t), ...i.slice(0, t).reverse()]) {
254
+ let t = n(e)[0];
255
+ if (t) return t;
256
+ }
257
+ }
258
+ function W(e) {
259
+ let t = x(null), i = x(null), { more: a, offset: o } = e;
260
+ return v(() => {
261
+ let e = i.current, o = t.current;
262
+ e !== null && a.status !== "loading" && (i.current = null, o && r(document.activeElement) && (a.status === "error" ? n(o)[0] : U(o, e))?.focus());
263
+ }, [a.status, o]), {
264
+ pagingRef: t,
265
+ load: () => {
266
+ i.current = t.current?.contains(document.activeElement) ? o : null, a.load();
267
+ }
268
+ };
269
+ }
270
+ function G(e, t) {
271
+ let i = x(t);
272
+ v(() => {
273
+ if (i.current === t) return;
274
+ i.current = t;
275
+ let a = e.current;
276
+ a && r(document.activeElement) && (n(a)[0] ?? U(a, Infinity))?.focus();
277
+ }, [e, t]);
278
+ }
279
+ function K({ count: e, total: n, isRemote: r, pageSize: i, remote: a, itemsLabel: o }) {
280
+ let { more: s } = a, { pagingRef: c, load: l } = W(a), u = V(`Couldn't load more ${o}`, s.status, s.error, l);
281
+ return G(c, u ? "failure" : r && a.hasMore ? "more" : "none"), n === 0 ? null : /* @__PURE__ */ T("div", {
282
+ ref: c,
283
+ className: "ds-entry-picker__paging",
284
+ children: [u ?? (r && a.hasMore && /* @__PURE__ */ T(t, {
285
+ isPending: s.status === "loading",
286
+ isFocusableWhenDisabled: !0,
287
+ isDisabled: !s.isAvailable,
288
+ onClick: l,
289
+ children: [
290
+ "Load ",
291
+ Math.min(i, n - a.offset),
292
+ " more"
293
+ ]
294
+ })), /* @__PURE__ */ w("span", { children: e < n ? `Showing ${e} of ${n}` : `All ${e} shown` })]
295
+ });
296
+ }
297
+ //#endregion
298
+ //#region src/components/EntryPicker/blocked.ts
299
+ function q(e, t, { isDisabled: n, searching: r, atMax: i }) {
300
+ if (n || r) return "inactive";
301
+ if (e.isDisabled) return "restricted";
302
+ if (!t && i) return "full";
303
+ }
304
+ //#endregion
305
+ //#region src/components/EntryPicker/results.tsx
306
+ function J({ items: e, selected: t, block: n, onToggle: r, onEdit: i }) {
307
+ let a = y(), o = `${a}-full`;
308
+ return /* @__PURE__ */ T(C, { children: [/* @__PURE__ */ w("span", {
309
+ id: o,
310
+ hidden: !0,
311
+ children: "The selection is full. Remove one to choose another."
312
+ }), /* @__PURE__ */ w("ul", {
313
+ className: "ds-entry-picker__results",
314
+ "data-searching": n.searching || void 0,
315
+ children: e.map((e, s) => {
316
+ let c = t.includes(e.id), l = q(e, c, n), u = E(e) ? `${a}-reason-${s}` : void 0;
317
+ return /* @__PURE__ */ T("li", {
318
+ className: "ds-entry-picker__result ds-field-surface",
319
+ "data-selected": c || void 0,
320
+ "data-blocked": l ? !0 : void 0,
321
+ onClick: (t) => {
322
+ let n = t.target instanceof Element ? t.target.closest("button, input, label, a, select, textarea, summary, [tabindex]") : null;
323
+ (!n || !t.currentTarget.contains(n)) && r(e.id);
324
+ },
325
+ children: [
326
+ /* @__PURE__ */ w(h, {
327
+ checked: c,
328
+ "aria-checked": c,
329
+ "aria-label": `Select ${e.title}`,
330
+ "aria-describedby": l === "full" ? o : u,
331
+ disabled: !!l,
332
+ isFocusableWhenDisabled: l !== "inactive",
333
+ onChange: () => r(e.id)
334
+ }),
335
+ /* @__PURE__ */ w("span", {
336
+ className: "ds-entry",
337
+ children: /* @__PURE__ */ w(k, {
338
+ item: e,
339
+ reasonId: u
340
+ })
341
+ }),
342
+ /* @__PURE__ */ w(M, {
343
+ item: e,
344
+ onEdit: i,
345
+ isDisabled: l === "inactive"
346
+ })
347
+ ]
348
+ }, e.id);
349
+ })
350
+ })] });
351
+ }
352
+ //#endregion
353
+ //#region src/components/EntryPicker/use-picker-scroll.ts
354
+ function Y() {
355
+ let e = x(null), [t, n] = S(!1);
356
+ return {
357
+ ref: e,
358
+ scrolled: t,
359
+ toTop: () => {
360
+ n(!1), e.current && (e.current.scrollTop = 0);
361
+ },
362
+ onScroll: (e) => {
363
+ n(e.currentTarget.scrollTop > 0);
364
+ }
365
+ };
366
+ }
367
+ //#endregion
368
+ //#region src/components/EntryPicker/dialog.tsx
369
+ function X(e, t) {
370
+ return e && t ? /* @__PURE__ */ T(f, {
371
+ gap: "sm",
372
+ children: [e, t]
373
+ }) : e || t;
374
+ }
375
+ function Z({ isOpen: e, onClose: n, query: r, onQuery: i, selected: a, results: o, cap: l, block: u, isRemote: f, pageSize: p, remote: m, onToggle: h, onEdit: g, confirm: _, selectionNotice: v, selectionFailure: y, isCreateDisabled: b, itemLabel: x, itemsLabel: S, addLabel: E, onCreate: D, isCreating: O, dialogTitle: k, dialogDescription: A, isDialogHidden: j }) {
376
+ let M = V(`Couldn't refresh ${S}`, m.refresh.status, m.refresh.error, m.refresh.retry);
377
+ return /* @__PURE__ */ w(c, {
378
+ isOpen: e,
379
+ isHidden: j,
380
+ onClose: n,
381
+ title: k ?? E,
382
+ description: A ?? l.description,
383
+ className: "ds-entry-picker__dialog",
384
+ footer: /* @__PURE__ */ T(C, { children: [/* @__PURE__ */ T("span", {
385
+ className: "ds-entry-picker__selection",
386
+ role: "status",
387
+ children: [l.reading ? /* @__PURE__ */ w(s, {
388
+ ...l.reading,
389
+ size: "lg"
390
+ }) : `${a.length} selected`, v && `. ${v}`]
391
+ }), /* @__PURE__ */ w(t, {
392
+ variant: "primary",
393
+ isDisabled: _?.isDisabled,
394
+ onClick: _?.onClick ?? n,
395
+ children: _?.label ?? "Done"
396
+ })] }),
397
+ children: /* @__PURE__ */ w(ee, {
398
+ query: r,
399
+ onQuery: i,
400
+ itemsLabel: S,
401
+ isSearching: m.loading,
402
+ action: D && /* @__PURE__ */ w(t, {
403
+ variant: "primary",
404
+ isPending: O,
405
+ isFocusableWhenDisabled: !0,
406
+ iconStart: "plus",
407
+ isDisabled: u.isDisabled || l.atMax || b,
408
+ onClick: D,
409
+ children: `New ${x}`
410
+ }),
411
+ banner: X(M, y),
412
+ isBusy: m.loading || m.more.status === "loading" || m.refresh.status === "loading",
413
+ children: /* @__PURE__ */ T(d, {
414
+ status: m.status,
415
+ errorTitle: `Couldn't load ${S}`,
416
+ error: m.error,
417
+ onRetry: m.retry,
418
+ children: [
419
+ /* @__PURE__ */ w(J, {
420
+ items: o,
421
+ selected: a,
422
+ block: u,
423
+ onToggle: h,
424
+ onEdit: g
425
+ }),
426
+ !m.searching && o.length === 0 && /* @__PURE__ */ w(H, {
427
+ query: r,
428
+ itemLabel: x,
429
+ itemsLabel: S,
430
+ canCreate: !!D
431
+ }),
432
+ /* @__PURE__ */ w(K, {
433
+ count: o.length,
434
+ total: f ? m.total : o.length,
435
+ isRemote: f,
436
+ pageSize: p,
437
+ remote: m,
438
+ itemsLabel: S
439
+ })
440
+ ]
441
+ })
442
+ })
443
+ });
444
+ }
445
+ function ee({ query: e, onQuery: t, itemsLabel: n, isSearching: r, action: i, banner: a, isBusy: o, children: s }) {
446
+ let { ref: c, scrolled: l, onScroll: u, toTop: d } = Y(), f = (e) => {
447
+ d(), t(e);
448
+ };
449
+ return /* @__PURE__ */ T(C, { children: [
450
+ /* @__PURE__ */ T("div", {
451
+ className: "ds-entry-picker__search ds-field-surface",
452
+ "data-scrolled": l || void 0,
453
+ children: [/* @__PURE__ */ w(p, {
454
+ "aria-label": `Search ${n}`,
455
+ value: e,
456
+ isBusy: r,
457
+ placeholder: `Search ${n}`,
458
+ onChange: (e) => f(e.target.value),
459
+ onClear: () => f("")
460
+ }), i]
461
+ }),
462
+ a && /* @__PURE__ */ w("div", {
463
+ className: "ds-entry-picker__refresh",
464
+ children: a
465
+ }),
466
+ /* @__PURE__ */ w("div", {
467
+ className: "ds-entry-picker__scroll",
468
+ ref: c,
469
+ onScroll: u,
470
+ "aria-busy": o,
471
+ children: s
472
+ })
473
+ ] });
474
+ }
475
+ //#endregion
476
+ //#region src/components/EntryPicker/limit.ts
477
+ function te(e, t) {
478
+ return e === "single" || t === 1;
479
+ }
480
+ function ne(e, t, n) {
481
+ return te(e, n) ? {
482
+ count: t,
483
+ max: 1,
484
+ tone: "neutral"
485
+ } : e === "multiple" && n !== void 0 ? {
486
+ count: t,
487
+ max: n
488
+ } : void 0;
489
+ }
490
+ function re(e, t, n) {
491
+ return te(e, n) ? void 0 : t;
492
+ }
493
+ function ie(e, t, n, { itemLabel: r, itemsLabel: i }) {
494
+ let a = ne(e, t, n), s = e === "multiple" && a && Number.isFinite(a.max) ? a.max : void 0, c = `Choose as many ${i} as you need.`;
495
+ return e === "single" || s === 1 ? c = `Choose one ${r}.` : s !== void 0 && (c = `Choose up to ${s} ${i}.`), {
496
+ limit: a,
497
+ atMax: s !== void 0 && t >= s,
498
+ description: c,
499
+ reading: e === "multiple" && o(a) ? a : void 0
500
+ };
501
+ }
502
+ //#endregion
503
+ //#region src/components/EntryPicker/use-picker-data.ts
504
+ var ae = 250;
505
+ function oe(e) {
506
+ return Array.from(new Map(e.map((e) => [e.id, e])).values());
507
+ }
508
+ var se = {
509
+ items: [],
510
+ offset: 0,
511
+ total: 0
512
+ }, Q = {
513
+ ...se,
514
+ key: null,
515
+ revision: void 0,
516
+ status: "ready",
517
+ error: null
518
+ };
519
+ function ce(e, t) {
520
+ let n = e?.status === "error" && t;
521
+ return {
522
+ status: e?.status === "loading" ? "loading" : n ? "error" : "ready",
523
+ error: n ? e.error ?? null : null,
524
+ isAvailable: t
525
+ };
526
+ }
527
+ function $(e, t) {
528
+ return {
529
+ items: oe([...e.items, ...t.items]),
530
+ offset: e.offset + t.items.length,
531
+ total: t.items.length === 0 ? Math.min(t.total, e.offset) : t.total
532
+ };
533
+ }
534
+ function le(e, t, n, r) {
535
+ return e.key !== t || e.offset !== n ? e : {
536
+ ...e,
537
+ ...$(e, r)
538
+ };
539
+ }
540
+ async function ue(e, t, n, r, i) {
541
+ let a = Math.max(1, Math.ceil(r / n)), o = await Promise.all(Array.from({ length: a }, (r, i) => e({
542
+ offset: i * n,
543
+ limit: n
544
+ }, { query: t }))), s = se;
545
+ for (let [e, t] of o.entries()) {
546
+ if (s.offset !== e * n) break;
547
+ s = $(s, t);
548
+ }
549
+ for (; s.offset < r && s.offset < s.total && i();) s = $(s, await e({
550
+ offset: s.offset,
551
+ limit: n
552
+ }, { query: t }));
553
+ return s;
554
+ }
555
+ function de(e, t, n, r) {
556
+ let i = e !== null && t.key === e, a = i && Object.is(t.revision, n), o = e !== null && !a && (!i || t.status === "error"), s = o && t.key !== null && t.status === "ready", c = o && !s ? "loading" : t.status === "error" ? "error" : "ready", l = t.status === "ready" && t.offset < t.total, u = i && !a && t.status === "ready", d = u && r?.key === e && Object.is(r.revision, n);
557
+ return {
558
+ loading: o,
559
+ searching: s,
560
+ status: c,
561
+ hasMore: l,
562
+ refresh: u ? d ? "error" : "loading" : "ready",
563
+ refreshFailed: d
564
+ };
565
+ }
566
+ function fe(e, t, n, r, a, o) {
567
+ let s = i(e), c = i(a), l = i(o), [u, d] = S(0), [f, p] = S(Q), [m, h] = S(null), [g, _] = S(null), [y, b] = S(r);
568
+ y !== r && (b(r), r || (p(Q), h(null), _(null), d((e) => e + 1)));
569
+ let C = n.trim(), w = e && r ? JSON.stringify([
570
+ C,
571
+ t,
572
+ u
573
+ ]) : null, T = i(f), E = x(null), D = x(C), { loading: O, searching: k, status: A, hasMore: j, refresh: M, refreshFailed: N } = de(w, f, o, g), P = !O && M === "ready", I = O ? "load" : M === "loading" ? "refresh" : null;
574
+ v(() => {
575
+ if (w === null) return;
576
+ let e = I === "load" && C !== D.current ? ae : 0;
577
+ if (D.current = C, I === null) return;
578
+ let n = I === "refresh" ? T.current.offset + (E.current ? t : 0) : 0, r = !0, i = window.setTimeout(() => {
579
+ let e = s.current;
580
+ e && ue(e, C, t, n, () => r).then((e) => {
581
+ r && (E.current = null, p({
582
+ ...e,
583
+ key: w,
584
+ revision: o,
585
+ status: "ready",
586
+ error: null
587
+ }), h(null), _(null), c.current?.(e.items, o));
588
+ }, (e) => {
589
+ r && (I === "refresh" ? _({
590
+ key: w,
591
+ revision: o,
592
+ error: F(e)
593
+ }) : (E.current = null, p({
594
+ ...Q,
595
+ key: w,
596
+ revision: o,
597
+ status: "error",
598
+ error: F(e)
599
+ }), h(null)));
600
+ });
601
+ }, e);
602
+ return () => {
603
+ r = !1, window.clearTimeout(i);
604
+ };
605
+ }, [
606
+ w,
607
+ I,
608
+ o,
609
+ C,
610
+ t,
611
+ s,
612
+ c,
613
+ T
614
+ ]);
615
+ let L = () => {
616
+ let e = s.current, n = f.key, { offset: r } = f;
617
+ if (!e || n === null || !P || !j || E.current) return;
618
+ let i = Symbol("load more"), a = o;
619
+ E.current = i, h({
620
+ token: i,
621
+ status: "loading",
622
+ error: null
623
+ });
624
+ let u = () => E.current === i && T.current.key === n && T.current.offset === r && Object.is(l.current, a), d = (e) => {
625
+ E.current === i && (E.current = null), h((t) => t?.token === i ? e : t);
626
+ };
627
+ Promise.resolve().then(() => e({
628
+ offset: r,
629
+ limit: t
630
+ }, { query: C })).then((e) => {
631
+ u() && (p((t) => le(t, n, r, e)), c.current?.(e.items, a)), d(null);
632
+ }, (e) => d(u() ? {
633
+ token: i,
634
+ status: "error",
635
+ error: F(e)
636
+ } : null));
637
+ };
638
+ return {
639
+ items: f.items,
640
+ total: f.total,
641
+ offset: f.offset,
642
+ hasMore: j,
643
+ pageRevision: f.revision,
644
+ loading: O,
645
+ searching: k,
646
+ status: A,
647
+ error: f.error,
648
+ retry: () => d((e) => e + 1),
649
+ more: {
650
+ ...ce(m, P),
651
+ load: L
652
+ },
653
+ refresh: {
654
+ status: M,
655
+ error: N ? g?.error ?? null : null,
656
+ retry: () => _(null)
657
+ }
658
+ };
659
+ }
660
+ //#endregion
661
+ //#region src/components/EntryPicker/use-picker-session.ts
662
+ var pe = [];
663
+ function me(e, t) {
664
+ return !!(e.isDisabled || t?.(e));
665
+ }
666
+ function he(e, t) {
667
+ return t ? e.map((e) => {
668
+ let n = e.isDisabled ? void 0 : t(e);
669
+ return n ? {
670
+ ...e,
671
+ isDisabled: !0,
672
+ disabledReason: n
673
+ } : e;
674
+ }) : e;
675
+ }
676
+ function ge(e, t, n, { isOpen: r, isDisabled: i, itemLabel: a, itemsLabel: o, close: s, recheckSelection: c, restrict: l }) {
677
+ let [u, d] = S(""), { resolveItem: f, refreshKey: p, loadPage: m, pageSize: h = 10, mode: g = "multiple", max: _, onEditItem: v } = n, y = !!m, x = c && y && !!f, C = B(e, x ? pe : t, f, p), w = fe(m, h, u, r, x ? (e, t) => C.remember(e.filter((e) => me(e, l)), t) : C.remember, p), T = b(() => {
678
+ let e = u.trim().toLowerCase();
679
+ return y ? pe : t.filter((t) => !e || [t.title, ...t.keywords ?? []].join(" ").toLowerCase().includes(e));
680
+ }, [
681
+ y,
682
+ t,
683
+ u
684
+ ]), E = y ? w.items : T, D = b(() => he(E, l), [E, l]), O = ie(g, e.length, _, {
685
+ itemLabel: a,
686
+ itemsLabel: o
687
+ }), k = {
688
+ isDisabled: i,
689
+ searching: w.searching,
690
+ atMax: O.atMax
691
+ }, A = v ? (e) => {
692
+ v(e) === !1 && s();
693
+ } : void 0;
694
+ return {
695
+ selection: C,
696
+ remote: w,
697
+ isRemote: y,
698
+ results: D,
699
+ cap: O,
700
+ block: k,
701
+ editItem: A,
702
+ revision: y ? w.pageRevision : p,
703
+ choice: (t) => {
704
+ let n = D.find((e) => e.id === t);
705
+ return n && !q(n, e.includes(t), k) ? n : void 0;
706
+ },
707
+ dialog: {
708
+ query: u,
709
+ onQuery: d,
710
+ selected: e,
711
+ results: D,
712
+ cap: O,
713
+ block: k,
714
+ isRemote: y,
715
+ pageSize: h,
716
+ remote: w,
717
+ onEdit: A,
718
+ itemLabel: a,
719
+ itemsLabel: o
720
+ }
721
+ };
722
+ }
723
+ //#endregion
724
+ //#region src/components/EntryPicker/selected-items.tsx
725
+ function _e({ items: e, selected: n, onChange: r, onEdit: i, isDisabled: a, canReorder: o, emptyLabel: s }) {
726
+ let c = y(), l = (e, t) => O(e) ? `${c}-reason-${t}` : void 0, u = (e, o) => /* @__PURE__ */ T("span", {
727
+ className: "ds-entry-picker__item-actions",
728
+ children: [
729
+ /* @__PURE__ */ w(j, { item: e }),
730
+ /* @__PURE__ */ w(M, {
731
+ item: e,
732
+ onEdit: e.tone === "removed" ? void 0 : i,
733
+ isDisabled: a
734
+ }),
735
+ /* @__PURE__ */ w(t, {
736
+ variant: "simple",
737
+ size: "sm",
738
+ isIconOnly: !0,
739
+ iconStart: "x",
740
+ "aria-label": `Remove ${e.title}`,
741
+ "aria-describedby": o,
742
+ isDisabled: a,
743
+ onClick: () => r(n.filter((t) => t !== e.id))
744
+ })
745
+ ]
746
+ });
747
+ return e.length === 0 ? /* @__PURE__ */ w("p", {
748
+ className: "ds-entry-picker__empty",
749
+ children: s
750
+ }) : o ? /* @__PURE__ */ w(g, {
751
+ items: n,
752
+ onReorder: r,
753
+ isDisabled: a,
754
+ children: e.map((e, t) => /* @__PURE__ */ w(_, {
755
+ id: e.id,
756
+ label: e.title,
757
+ "data-tone": e.tone,
758
+ handleDescribedBy: l(e, t),
759
+ action: u(e, l(e, t)),
760
+ children: /* @__PURE__ */ w("div", {
761
+ className: "ds-entry",
762
+ children: /* @__PURE__ */ w(A, {
763
+ item: e,
764
+ reasonId: l(e, t)
765
+ })
766
+ })
767
+ }, e.id))
768
+ }) : /* @__PURE__ */ w("ul", {
769
+ className: "ds-entry-picker__list",
770
+ children: e.map((e, t) => /* @__PURE__ */ T("li", {
771
+ className: "ds-entry-picker__row ds-field-surface",
772
+ "data-tone": e.tone,
773
+ children: [/* @__PURE__ */ w("div", {
774
+ className: "ds-entry",
775
+ children: /* @__PURE__ */ w(A, {
776
+ item: e,
777
+ reasonId: l(e, t)
778
+ })
779
+ }), u(e, l(e, t))]
780
+ }, e.id))
781
+ });
782
+ }
783
+ //#endregion
784
+ //#region src/components/EntryPicker/index.tsx
785
+ var ve = [];
786
+ function ye({ items: e = ve, value: n, defaultValue: r = [], onValueChange: i, mode: a = "multiple", max: o, label: s = "Entries", emptyLabel: c = "Nothing selected yet.", addLabel: l = "Choose entries", itemLabel: u = "entry", itemsLabel: d = "entries", isReorderable: f = !0, isDisabled: p = !1, loadPage: h, pageSize: g = 10, resolveItem: _, onEditItem: v, onCreate: y, isCreating: x = !1, refreshKey: C, dialogTitle: E, dialogDescription: D, isDialogHidden: O = !1, className: k, ...A }) {
787
+ let [j, M] = S(r), N = n ?? j, [F, I] = S(!1), L = ge(N, e, {
788
+ resolveItem: _,
789
+ refreshKey: C,
790
+ loadPage: h,
791
+ pageSize: g,
792
+ mode: a,
793
+ max: o,
794
+ onEditItem: v
795
+ }, {
796
+ isOpen: F,
797
+ isDisabled: p,
798
+ itemLabel: u,
799
+ itemsLabel: d,
800
+ close: () => I(!1)
801
+ }), { selection: R, remote: z, cap: B, editItem: H } = L, U = V(`Couldn't load selected ${d}`, R.status, R.error, R.retry), W = (e) => {
802
+ p || (n === void 0 && M(e), i?.(e));
803
+ }, G = (e, t) => {
804
+ R.remember([t], L.revision, e), W(e);
805
+ }, K = (e) => {
806
+ let t = L.choice(e);
807
+ t && (a === "single" ? (G(N[0] === e ? [] : [e], t), I(!1)) : N.includes(e) ? W(N.filter((t) => t !== e)) : G([...N, e], t));
808
+ }, { known: q, failures: J } = R, Y = !!_, X = b(() => P({
809
+ selected: N,
810
+ items: e,
811
+ pageItems: z.items,
812
+ known: q,
813
+ failures: J,
814
+ hasResolver: Y,
815
+ itemLabel: u
816
+ }), [
817
+ N,
818
+ e,
819
+ z.items,
820
+ q,
821
+ J,
822
+ Y,
823
+ u
824
+ ]);
825
+ return /* @__PURE__ */ T(m, {
826
+ ...A,
827
+ className: ["ds-entry-picker", k].filter(Boolean).join(" "),
828
+ label: s,
829
+ count: re(a, N.length, o),
830
+ limit: A.limit === void 0 ? B.limit : A.limit,
831
+ children: [
832
+ /* @__PURE__ */ w(_e, {
833
+ items: X,
834
+ selected: N,
835
+ onChange: W,
836
+ onEdit: H,
837
+ isDisabled: p,
838
+ canReorder: f && a === "multiple" && X.length > 1,
839
+ emptyLabel: c
840
+ }),
841
+ U,
842
+ /* @__PURE__ */ T("div", {
843
+ className: "ds-entry-picker__actions",
844
+ children: [/* @__PURE__ */ w(t, {
845
+ variant: "neutral",
846
+ size: "sm",
847
+ iconStart: "plus",
848
+ isDisabled: p,
849
+ onClick: () => I(!0),
850
+ children: l
851
+ }), N.length > 0 && /* @__PURE__ */ w(t, {
852
+ variant: "simple",
853
+ size: "sm",
854
+ isDisabled: p,
855
+ onClick: () => W([]),
856
+ children: "Clear"
857
+ })]
858
+ }),
859
+ /* @__PURE__ */ w(Z, {
860
+ ...L.dialog,
861
+ isOpen: F,
862
+ onClose: () => I(!1),
863
+ onToggle: K,
864
+ addLabel: l,
865
+ onCreate: y,
866
+ isCreating: x,
867
+ dialogTitle: E,
868
+ dialogDescription: D,
869
+ isDialogHidden: O
870
+ })
871
+ ]
872
+ });
873
+ }
874
+ //#endregion
875
+ export { Z as a, P as c, ne as i, k as l, ge as n, V as o, re as r, B as s, ye as t };
876
+
877
+ //# sourceMappingURL=EntryPicker-BGWxiLJ_.js.map