@namroodinc/liquid-editorial 0.1.11 → 0.2.1

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 (333) hide show
  1. package/AGENTS.md +1 -1
  2. package/README.md +59 -16
  3. package/UPGRADING.md +108 -0
  4. package/dist/chunks/{Board-BLhB5_xx.cjs → Board-BUJ5CinL.cjs} +2 -2
  5. package/dist/chunks/Board-BUJ5CinL.cjs.map +1 -0
  6. package/dist/chunks/{Board-BTFSzn6c.js → Board-Cyrda2qG.js} +2 -2
  7. package/dist/chunks/Board-Cyrda2qG.js.map +1 -0
  8. package/dist/chunks/FormEditor-8bz3pOdP.cjs +2 -0
  9. package/dist/chunks/FormEditor-8bz3pOdP.cjs.map +1 -0
  10. package/dist/chunks/FormEditor-DuW8x78Y.js +330 -0
  11. package/dist/chunks/FormEditor-DuW8x78Y.js.map +1 -0
  12. package/dist/chunks/Icon-ByUB0L1a.js +78 -0
  13. package/dist/chunks/Icon-ByUB0L1a.js.map +1 -0
  14. package/dist/chunks/Icon-CW6qJcDy.cjs +2 -0
  15. package/dist/chunks/Icon-CW6qJcDy.cjs.map +1 -0
  16. package/dist/chunks/RichTextEditor-BxtlbjXj.cjs.map +1 -1
  17. package/dist/chunks/RichTextEditor-Dnx4i7bQ.js.map +1 -1
  18. package/dist/chunks/dialogStack-6yv3NXFD.js +43 -0
  19. package/dist/chunks/dialogStack-6yv3NXFD.js.map +1 -0
  20. package/dist/chunks/dialogStack-C9SLVu6Q.cjs +2 -0
  21. package/dist/chunks/dialogStack-C9SLVu6Q.cjs.map +1 -0
  22. package/dist/chunks/observeElementWidth-BCJM2FAw.cjs +2 -0
  23. package/dist/chunks/observeElementWidth-BCJM2FAw.cjs.map +1 -0
  24. package/dist/chunks/observeElementWidth-BlQOlW2t.js +12 -0
  25. package/dist/chunks/observeElementWidth-BlQOlW2t.js.map +1 -0
  26. package/dist/components/AppShell/index.cjs +1 -1
  27. package/dist/components/AppShell/index.cjs.map +1 -1
  28. package/dist/components/AppShell/index.d.cts +5 -1
  29. package/dist/components/AppShell/index.d.cts.map +1 -1
  30. package/dist/components/AppShell/index.d.ts +5 -1
  31. package/dist/components/AppShell/index.d.ts.map +1 -1
  32. package/dist/components/AppShell/index.js +53 -60
  33. package/dist/components/AppShell/index.js.map +1 -1
  34. package/dist/components/AppShell/style.css +48 -6
  35. package/dist/components/AssetCard/index.cjs +1 -1
  36. package/dist/components/AssetCard/index.cjs.map +1 -1
  37. package/dist/components/AssetCard/index.d.cts +1 -1
  38. package/dist/components/AssetCard/index.d.cts.map +1 -1
  39. package/dist/components/AssetCard/index.d.ts +1 -1
  40. package/dist/components/AssetCard/index.d.ts.map +1 -1
  41. package/dist/components/AssetCard/index.js +1 -1
  42. package/dist/components/AssetCard/index.js.map +1 -1
  43. package/dist/components/AssetCard/style.css +20 -9
  44. package/dist/components/AssetGrid/index.cjs +1 -1
  45. package/dist/components/AssetGrid/index.cjs.map +1 -1
  46. package/dist/components/AssetGrid/index.d.cts +1 -1
  47. package/dist/components/AssetGrid/index.d.cts.map +1 -1
  48. package/dist/components/AssetGrid/index.d.ts +1 -1
  49. package/dist/components/AssetGrid/index.d.ts.map +1 -1
  50. package/dist/components/AssetGrid/index.js +1 -1
  51. package/dist/components/AssetGrid/index.js.map +1 -1
  52. package/dist/components/Avatar/index.cjs.map +1 -1
  53. package/dist/components/Avatar/index.d.cts.map +1 -1
  54. package/dist/components/Avatar/index.d.ts.map +1 -1
  55. package/dist/components/Avatar/index.js.map +1 -1
  56. package/dist/components/Badge/index.cjs.map +1 -1
  57. package/dist/components/Badge/index.d.cts.map +1 -1
  58. package/dist/components/Badge/index.d.ts.map +1 -1
  59. package/dist/components/Badge/index.js.map +1 -1
  60. package/dist/components/Badge/style.css +2 -1
  61. package/dist/components/Board/index.cjs +1 -1
  62. package/dist/components/Board/index.d.cts.map +1 -1
  63. package/dist/components/Board/index.d.ts.map +1 -1
  64. package/dist/components/Board/index.js +1 -1
  65. package/dist/components/Board/keyboard.d.cts.map +1 -1
  66. package/dist/components/Board/keyboard.d.ts.map +1 -1
  67. package/dist/components/Board/moves.d.cts.map +1 -1
  68. package/dist/components/Board/moves.d.ts.map +1 -1
  69. package/dist/components/Board/style.css +12 -7
  70. package/dist/components/Button/index.cjs +1 -1
  71. package/dist/components/Button/index.cjs.map +1 -1
  72. package/dist/components/Button/index.d.cts.map +1 -1
  73. package/dist/components/Button/index.d.ts.map +1 -1
  74. package/dist/components/Button/index.js +1 -1
  75. package/dist/components/Button/index.js.map +1 -1
  76. package/dist/components/Button/style.css +1 -1
  77. package/dist/components/ButtonGroup/index.cjs.map +1 -1
  78. package/dist/components/ButtonGroup/index.d.cts.map +1 -1
  79. package/dist/components/ButtonGroup/index.d.ts.map +1 -1
  80. package/dist/components/ButtonGroup/index.js.map +1 -1
  81. package/dist/components/ButtonGroup/style.css +1 -0
  82. package/dist/components/Choice/index.cjs.map +1 -1
  83. package/dist/components/Choice/index.d.cts.map +1 -1
  84. package/dist/components/Choice/index.d.ts.map +1 -1
  85. package/dist/components/Choice/index.js.map +1 -1
  86. package/dist/components/Choice/style.css +1 -1
  87. package/dist/components/Container/style.css +1 -0
  88. package/dist/components/DatePicker/index.cjs +1 -1
  89. package/dist/components/DatePicker/index.cjs.map +1 -1
  90. package/dist/components/DatePicker/index.d.cts.map +1 -1
  91. package/dist/components/DatePicker/index.d.ts.map +1 -1
  92. package/dist/components/DatePicker/index.js +1 -1
  93. package/dist/components/DatePicker/index.js.map +1 -1
  94. package/dist/components/DatePicker/style.css +3 -1
  95. package/dist/components/Drawer/index.cjs +1 -1
  96. package/dist/components/Drawer/index.cjs.map +1 -1
  97. package/dist/components/Drawer/index.d.cts.map +1 -1
  98. package/dist/components/Drawer/index.d.ts.map +1 -1
  99. package/dist/components/Drawer/index.js +72 -70
  100. package/dist/components/Drawer/index.js.map +1 -1
  101. package/dist/components/Drawer/style.css +7 -2
  102. package/dist/components/EditLayout/index.cjs +2 -0
  103. package/dist/components/EditLayout/index.cjs.map +1 -0
  104. package/dist/components/EditLayout/index.d.cts +25 -0
  105. package/dist/components/EditLayout/index.d.cts.map +1 -0
  106. package/dist/components/EditLayout/index.d.ts +25 -0
  107. package/dist/components/EditLayout/index.d.ts.map +1 -0
  108. package/dist/components/EditLayout/index.js +239 -0
  109. package/dist/components/EditLayout/index.js.map +1 -0
  110. package/dist/components/EditLayout/style.css +226 -0
  111. package/dist/components/EntryPicker/index.cjs +1 -1
  112. package/dist/components/EntryPicker/index.cjs.map +1 -1
  113. package/dist/components/EntryPicker/index.d.cts +3 -1
  114. package/dist/components/EntryPicker/index.d.cts.map +1 -1
  115. package/dist/components/EntryPicker/index.d.ts +3 -1
  116. package/dist/components/EntryPicker/index.d.ts.map +1 -1
  117. package/dist/components/EntryPicker/index.js +46 -44
  118. package/dist/components/EntryPicker/index.js.map +1 -1
  119. package/dist/components/Field/index.cjs.map +1 -1
  120. package/dist/components/Field/index.d.cts.map +1 -1
  121. package/dist/components/Field/index.d.ts.map +1 -1
  122. package/dist/components/Field/index.js.map +1 -1
  123. package/dist/components/Field/style.css +1 -1
  124. package/dist/components/FieldAffix/index.cjs.map +1 -1
  125. package/dist/components/FieldAffix/index.d.cts.map +1 -1
  126. package/dist/components/FieldAffix/index.d.ts.map +1 -1
  127. package/dist/components/FieldAffix/index.js.map +1 -1
  128. package/dist/components/FormEditor/control.d.cts +15 -0
  129. package/dist/components/FormEditor/control.d.cts.map +1 -0
  130. package/dist/components/FormEditor/control.d.ts +15 -0
  131. package/dist/components/FormEditor/control.d.ts.map +1 -0
  132. package/dist/components/FormEditor/index.cjs +1 -0
  133. package/dist/components/FormEditor/index.d.cts +28 -0
  134. package/dist/components/FormEditor/index.d.cts.map +1 -0
  135. package/dist/components/FormEditor/index.d.ts +28 -0
  136. package/dist/components/FormEditor/index.d.ts.map +1 -0
  137. package/dist/components/FormEditor/index.js +2 -0
  138. package/dist/components/FormEditor/model.d.cts +86 -0
  139. package/dist/components/FormEditor/model.d.cts.map +1 -0
  140. package/dist/components/FormEditor/model.d.ts +86 -0
  141. package/dist/components/FormEditor/model.d.ts.map +1 -0
  142. package/dist/components/FormEditor/style.css +27 -0
  143. package/dist/components/Icon/icons.d.cts +1 -0
  144. package/dist/components/Icon/icons.d.cts.map +1 -1
  145. package/dist/components/Icon/icons.d.ts +1 -0
  146. package/dist/components/Icon/icons.d.ts.map +1 -1
  147. package/dist/components/Icon/index.cjs +1 -1
  148. package/dist/components/Icon/index.js +1 -1
  149. package/dist/components/Icon/style.css +1 -1
  150. package/dist/components/ImageCropper/index.cjs.map +1 -1
  151. package/dist/components/ImageCropper/index.d.cts +1 -1
  152. package/dist/components/ImageCropper/index.d.cts.map +1 -1
  153. package/dist/components/ImageCropper/index.d.ts +1 -1
  154. package/dist/components/ImageCropper/index.d.ts.map +1 -1
  155. package/dist/components/ImageCropper/index.js.map +1 -1
  156. package/dist/components/ImageCropper/style.css +28 -5
  157. package/dist/components/Menu/index.cjs.map +1 -1
  158. package/dist/components/Menu/index.d.cts.map +1 -1
  159. package/dist/components/Menu/index.d.ts.map +1 -1
  160. package/dist/components/Menu/index.js.map +1 -1
  161. package/dist/components/Menu/style.css +0 -1
  162. package/dist/components/Modal/index.cjs +1 -1
  163. package/dist/components/Modal/index.cjs.map +1 -1
  164. package/dist/components/Modal/index.d.cts.map +1 -1
  165. package/dist/components/Modal/index.d.ts.map +1 -1
  166. package/dist/components/Modal/index.js +47 -46
  167. package/dist/components/Modal/index.js.map +1 -1
  168. package/dist/components/Modal/style.css +2 -2
  169. package/dist/components/NumberField/index.cjs +1 -1
  170. package/dist/components/NumberField/index.cjs.map +1 -1
  171. package/dist/components/NumberField/index.d.cts +3 -0
  172. package/dist/components/NumberField/index.d.cts.map +1 -1
  173. package/dist/components/NumberField/index.d.ts +3 -0
  174. package/dist/components/NumberField/index.d.ts.map +1 -1
  175. package/dist/components/NumberField/index.js +20 -20
  176. package/dist/components/NumberField/index.js.map +1 -1
  177. package/dist/components/NumberField/style.css +4 -6
  178. package/dist/components/Pagination/index.cjs.map +1 -1
  179. package/dist/components/Pagination/index.d.cts.map +1 -1
  180. package/dist/components/Pagination/index.d.ts.map +1 -1
  181. package/dist/components/Pagination/index.js.map +1 -1
  182. package/dist/components/Popover/index.cjs.map +1 -1
  183. package/dist/components/Popover/index.d.cts.map +1 -1
  184. package/dist/components/Popover/index.d.ts.map +1 -1
  185. package/dist/components/Popover/index.js.map +1 -1
  186. package/dist/components/RichTextEditor/document.d.cts.map +1 -1
  187. package/dist/components/RichTextEditor/document.d.ts.map +1 -1
  188. package/dist/components/RichTextEditor/index.cjs +1 -1
  189. package/dist/components/RichTextEditor/index.d.cts.map +1 -1
  190. package/dist/components/RichTextEditor/index.d.ts.map +1 -1
  191. package/dist/components/RichTextEditor/index.js +0 -1
  192. package/dist/components/RichTextEditor/style.css +2 -2
  193. package/dist/components/SearchField/index.cjs +1 -1
  194. package/dist/components/SearchField/index.cjs.map +1 -1
  195. package/dist/components/SearchField/index.d.cts.map +1 -1
  196. package/dist/components/SearchField/index.d.ts.map +1 -1
  197. package/dist/components/SearchField/index.js +1 -1
  198. package/dist/components/SearchField/index.js.map +1 -1
  199. package/dist/components/SearchField/style.css +0 -1
  200. package/dist/components/Select/index.cjs +1 -1
  201. package/dist/components/Select/index.cjs.map +1 -1
  202. package/dist/components/Select/index.d.cts.map +1 -1
  203. package/dist/components/Select/index.d.ts.map +1 -1
  204. package/dist/components/Select/index.js +1 -1
  205. package/dist/components/Select/index.js.map +1 -1
  206. package/dist/components/SelectionCard/index.cjs.map +1 -1
  207. package/dist/components/SelectionCard/index.d.cts +1 -1
  208. package/dist/components/SelectionCard/index.d.cts.map +1 -1
  209. package/dist/components/SelectionCard/index.d.ts +1 -1
  210. package/dist/components/SelectionCard/index.d.ts.map +1 -1
  211. package/dist/components/SelectionCard/index.js.map +1 -1
  212. package/dist/components/SelectionCard/style.css +1 -5
  213. package/dist/components/SideNav/index.cjs +1 -1
  214. package/dist/components/SideNav/index.cjs.map +1 -1
  215. package/dist/components/SideNav/index.d.cts.map +1 -1
  216. package/dist/components/SideNav/index.d.ts.map +1 -1
  217. package/dist/components/SideNav/index.js +1 -1
  218. package/dist/components/SideNav/index.js.map +1 -1
  219. package/dist/components/SideNav/style.css +7 -2
  220. package/dist/components/Skeleton/index.cjs.map +1 -1
  221. package/dist/components/Skeleton/index.d.cts.map +1 -1
  222. package/dist/components/Skeleton/index.d.ts.map +1 -1
  223. package/dist/components/Skeleton/index.js.map +1 -1
  224. package/dist/components/Skeleton/style.css +2 -2
  225. package/dist/components/Slider/index.cjs.map +1 -1
  226. package/dist/components/Slider/index.d.cts.map +1 -1
  227. package/dist/components/Slider/index.d.ts.map +1 -1
  228. package/dist/components/Slider/index.js.map +1 -1
  229. package/dist/components/Slider/style.css +5 -16
  230. package/dist/components/SortableList/index.cjs +1 -1
  231. package/dist/components/SortableList/index.cjs.map +1 -1
  232. package/dist/components/SortableList/index.d.cts.map +1 -1
  233. package/dist/components/SortableList/index.d.ts.map +1 -1
  234. package/dist/components/SortableList/index.js +1 -1
  235. package/dist/components/SortableList/index.js.map +1 -1
  236. package/dist/components/SortableList/style.css +1 -1
  237. package/dist/components/Stepper/index.cjs +1 -1
  238. package/dist/components/Stepper/index.cjs.map +1 -1
  239. package/dist/components/Stepper/index.d.cts.map +1 -1
  240. package/dist/components/Stepper/index.d.ts.map +1 -1
  241. package/dist/components/Stepper/index.js +1 -1
  242. package/dist/components/Stepper/index.js.map +1 -1
  243. package/dist/components/Stepper/style.css +2 -2
  244. package/dist/components/SubNav/index.cjs +1 -1
  245. package/dist/components/SubNav/index.cjs.map +1 -1
  246. package/dist/components/SubNav/index.d.cts.map +1 -1
  247. package/dist/components/SubNav/index.d.ts.map +1 -1
  248. package/dist/components/SubNav/index.js +1 -1
  249. package/dist/components/SubNav/index.js.map +1 -1
  250. package/dist/components/Switch/index.cjs.map +1 -1
  251. package/dist/components/Switch/index.d.cts.map +1 -1
  252. package/dist/components/Switch/index.d.ts.map +1 -1
  253. package/dist/components/Switch/index.js.map +1 -1
  254. package/dist/components/Switch/style.css +2 -1
  255. package/dist/components/Table/index.cjs +1 -1
  256. package/dist/components/Table/index.cjs.map +1 -1
  257. package/dist/components/Table/index.d.cts.map +1 -1
  258. package/dist/components/Table/index.d.ts.map +1 -1
  259. package/dist/components/Table/index.js +1 -1
  260. package/dist/components/Table/index.js.map +1 -1
  261. package/dist/components/Table/style.css +1 -0
  262. package/dist/components/TagsInput/index.cjs.map +1 -1
  263. package/dist/components/TagsInput/index.d.cts.map +1 -1
  264. package/dist/components/TagsInput/index.d.ts.map +1 -1
  265. package/dist/components/TagsInput/index.js.map +1 -1
  266. package/dist/components/TagsInput/style.css +2 -1
  267. package/dist/components/TextField/index.cjs.map +1 -1
  268. package/dist/components/TextField/index.d.cts.map +1 -1
  269. package/dist/components/TextField/index.d.ts.map +1 -1
  270. package/dist/components/TextField/index.js.map +1 -1
  271. package/dist/components/Time/index.cjs.map +1 -1
  272. package/dist/components/Time/index.d.cts.map +1 -1
  273. package/dist/components/Time/index.d.ts.map +1 -1
  274. package/dist/components/Time/index.js.map +1 -1
  275. package/dist/components/Time/style.css +1 -2
  276. package/dist/components/Toast/index.cjs +1 -1
  277. package/dist/components/Toast/index.cjs.map +1 -1
  278. package/dist/components/Toast/index.d.cts.map +1 -1
  279. package/dist/components/Toast/index.d.ts.map +1 -1
  280. package/dist/components/Toast/index.js +1 -1
  281. package/dist/components/Toast/index.js.map +1 -1
  282. package/dist/components/Toast/style.css +1 -1
  283. package/dist/components/TopNav/index.cjs +1 -1
  284. package/dist/components/TopNav/index.cjs.map +1 -1
  285. package/dist/components/TopNav/index.d.cts.map +1 -1
  286. package/dist/components/TopNav/index.d.ts.map +1 -1
  287. package/dist/components/TopNav/index.js +1 -1
  288. package/dist/components/TopNav/index.js.map +1 -1
  289. package/dist/index.cjs +1 -1
  290. package/dist/index.d.cts +10 -8
  291. package/dist/index.d.cts.map +1 -1
  292. package/dist/index.d.ts +10 -8
  293. package/dist/index.d.ts.map +1 -1
  294. package/dist/index.js +22 -21
  295. package/dist/internal/dialogStack.d.cts +9 -0
  296. package/dist/internal/dialogStack.d.cts.map +1 -0
  297. package/dist/internal/dialogStack.d.ts +9 -0
  298. package/dist/internal/dialogStack.d.ts.map +1 -0
  299. package/dist/internal/lockBodyScroll.d.cts +7 -0
  300. package/dist/internal/lockBodyScroll.d.cts.map +1 -0
  301. package/dist/internal/lockBodyScroll.d.ts +7 -0
  302. package/dist/internal/lockBodyScroll.d.ts.map +1 -0
  303. package/dist/internal/observeElementWidth.d.cts +3 -0
  304. package/dist/internal/observeElementWidth.d.cts.map +1 -0
  305. package/dist/internal/observeElementWidth.d.ts +3 -0
  306. package/dist/internal/observeElementWidth.d.ts.map +1 -0
  307. package/dist/reset.css +29 -4
  308. package/dist/styles.css +20 -16
  309. package/dist/test/dragEvent.d.cts.map +1 -1
  310. package/dist/test/dragEvent.d.ts.map +1 -1
  311. package/dist/tokens.css +77 -40
  312. package/package.json +9 -2
  313. package/dist/chunks/Board-BLhB5_xx.cjs.map +0 -1
  314. package/dist/chunks/Board-BTFSzn6c.js.map +0 -1
  315. package/dist/chunks/EntryEditor-CcyYtH74.js +0 -191
  316. package/dist/chunks/EntryEditor-CcyYtH74.js.map +0 -1
  317. package/dist/chunks/EntryEditor-DIpc1iPF.cjs +0 -2
  318. package/dist/chunks/EntryEditor-DIpc1iPF.cjs.map +0 -1
  319. package/dist/chunks/Icon-CGY1FNXT.js +0 -77
  320. package/dist/chunks/Icon-CGY1FNXT.js.map +0 -1
  321. package/dist/chunks/Icon-CWsA1W83.cjs +0 -2
  322. package/dist/chunks/Icon-CWsA1W83.cjs.map +0 -1
  323. package/dist/components/EntryEditor/index.cjs +0 -1
  324. package/dist/components/EntryEditor/index.d.cts +0 -21
  325. package/dist/components/EntryEditor/index.d.cts.map +0 -1
  326. package/dist/components/EntryEditor/index.d.ts +0 -21
  327. package/dist/components/EntryEditor/index.d.ts.map +0 -1
  328. package/dist/components/EntryEditor/index.js +0 -6
  329. package/dist/components/EntryEditor/model.d.cts +0 -33
  330. package/dist/components/EntryEditor/model.d.cts.map +0 -1
  331. package/dist/components/EntryEditor/model.d.ts +0 -33
  332. package/dist/components/EntryEditor/model.d.ts.map +0 -1
  333. package/dist/components/EntryEditor/style.css +0 -8
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@namroodinc/liquid-editorial",
3
- "version": "0.1.11",
3
+ "version": "0.2.1",
4
4
  "description": "A bold, accessible React component library for editorial products.",
5
5
  "author": "Namrood Inc",
6
6
  "license": "MIT",
@@ -94,7 +94,11 @@
94
94
  "build:storybook": "storybook build",
95
95
  "build": "npm run clean && vite build && tsc -p tsconfig.build.json && node scripts/copy-declarations.mjs && node scripts/copy-css.mjs",
96
96
  "typecheck": "tsc --noEmit",
97
- "lint": "eslint .",
97
+ "lint": "npm run lint:js && npm run lint:css && npm run format:check",
98
+ "lint:js": "eslint .",
99
+ "lint:css": "stylelint \"src/**/*.css\"",
100
+ "format": "prettier . --write && stylelint \"src/**/*.css\" --fix",
101
+ "format:check": "prettier . --check",
98
102
  "test": "vitest run",
99
103
  "test:watch": "vitest",
100
104
  "test:coverage": "vitest run --coverage",
@@ -145,10 +149,13 @@
145
149
  "globals": "^16.5.0",
146
150
  "jest-axe": "^10.0.0",
147
151
  "jsdom": "^27.0.0",
152
+ "prettier": "^3.9.10",
148
153
  "publint": "^0.3.16",
149
154
  "react": "^19.2.0",
150
155
  "react-dom": "^19.2.0",
151
156
  "storybook": "^10.0.0",
157
+ "stylelint": "^17.16.0",
158
+ "stylelint-config-standard": "^40.0.0",
152
159
  "typescript": "^5.9.0",
153
160
  "typescript-eslint": "^8.46.2",
154
161
  "vite": "^8.0.16",
@@ -1 +0,0 @@
1
- {"version":3,"file":"Board-BLhB5_xx.cjs","names":["sortableKeyboardCoordinates","closestCorners","pointerWithin","createContext","forwardRef","useId","useState","useSensors","useSensor","PointerSensor","KeyboardSensor","useCallback","useMemo","DndContext","MeasuringStrategy","SortableContext","horizontalListSortingStrategy","DragOverlay","Icon","useContext","useDroppable","useSortable","mergeRefs","CSS","Button","verticalListSortingStrategy","require_Icon","require_components_Button_index","require_mergeRefs","react","react_jsx_runtime","_dnd_kit_core","_dnd_kit_sortable","_dnd_kit_utilities","columnMove","over","data","columnId","\"type\"","\"columnId\"","toIndex","columnIds","active","cardMove","fromColumnId","onCard","toColumnId","\"sortable\"","\"items\"","boardCoordinateGetter","args","event","containers","context","c","a","b","activeRect","rect","currentCoordinates","boardCollisionDetection","isColumn","type","container","scoped","within","rank","id","BoardContext","Board","rest","dndId","activeId","setActiveId","activeType","setActiveType","overColumnId","setOverColumnId","sensors","handleStart","handleOver","overData","reset","handleEnd","move","onColumnMove","onMove","value","board","className","renderDragOverlay","renderColumnDragOverlay","BoardColumn","setBodyRef","itemIds","setColumnRef","isDraggable","ref","transform","isDragging","title","attributes","listeners","count","action","BoardCard","setNodeRef","label"],"sources":["../../src/components/Board/moves.ts","../../src/components/Board/keyboard.ts","../../src/components/Board/index.tsx"],"sourcesContent":["import type { DragEndEvent } from \"@dnd-kit/core\";\nimport type { BoardColumnMove, BoardMove } from \".\";\n\nexport function columnMove({ active, over }: DragEndEvent, columnIds: string[]): BoardColumnMove | undefined {\n if (!over) return;\n const data = over.data.current ?? {};\n const columnId = data[\"type\"] === \"column\" ? String(over.id) : String(data[\"columnId\"] ?? \"\");\n const toIndex = columnIds.indexOf(columnId);\n if (toIndex < 0 || columnId === String(active.id)) return;\n return { columnId: String(active.id), toIndex };\n}\n\nexport function cardMove({ active, over }: DragEndEvent): BoardMove | undefined {\n if (!over) return;\n const fromColumnId = String(active.data.current?.[\"columnId\"] ?? \"\");\n const data = over.data.current ?? {};\n const onCard = data[\"type\"] === \"card\";\n const toColumnId = String(data[\"columnId\"] ?? (onCard ? \"\" : over.id));\n // A card occupies a precise slot; empty lane space appends to the lane.\n const toIndex = onCard\n ? (data[\"sortable\"] as { index: number } | undefined)?.index ?? 0\n : ((data[\"items\"] as string[] | undefined) ?? []).length;\n if (!toColumnId) return;\n if (fromColumnId === toColumnId && String(active.id) === String(over.id)) return;\n return { cardId: String(active.id), fromColumnId, toColumnId, toIndex };\n}\n","import type { KeyboardCoordinateGetter } from \"@dnd-kit/core\";\nimport { sortableKeyboardCoordinates } from \"@dnd-kit/sortable\";\n\n/**\n * Arrow up/down sorts inside a lane; left/right jumps lanes, which the stock\n * sortable getter does not do.\n */\nexport const boardCoordinateGetter: KeyboardCoordinateGetter = (event, args) => {\n const { currentCoordinates, context } = args;\n if (event.code === \"ArrowLeft\" || event.code === \"ArrowRight\") {\n const containers = context.droppableContainers\n .getEnabled()\n .filter((c) => c.data.current?.[\"type\"] === \"column-body\")\n .sort((a, b) => (a.rect.current?.left ?? 0) - (b.rect.current?.left ?? 0));\n const activeRect = context.active?.rect.current.translated;\n if (!activeRect) return undefined;\n const index = containers.findIndex(\n (c) => (c.rect.current?.left ?? 0) <= activeRect.left + 1 &&\n (c.rect.current?.right ?? 0) >= activeRect.left - 1,\n );\n const next = containers[index + (event.code === \"ArrowRight\" ? 1 : -1)];\n const rect = next?.rect.current;\n if (!rect) return undefined;\n event.preventDefault();\n return { x: rect.left + rect.width / 2 - activeRect.width / 2, y: currentCoordinates.y };\n }\n return sortableKeyboardCoordinates(event, args);\n};\n\n","import {\n createContext,\n forwardRef,\n useCallback,\n useContext,\n useId,\n useMemo,\n useState,\n type HTMLAttributes,\n type ReactNode,\n} from \"react\";\nimport {\n DndContext,\n DragOverlay,\n KeyboardSensor,\n PointerSensor,\n closestCorners,\n pointerWithin,\n MeasuringStrategy,\n\n useDroppable,\n useSensor,\n useSensors,\n type CollisionDetection,\n type DragEndEvent,\n type DragOverEvent,\n type DragStartEvent,\n} from \"@dnd-kit/core\";\nimport {\n SortableContext,\n horizontalListSortingStrategy,\n useSortable,\n verticalListSortingStrategy,\n} from \"@dnd-kit/sortable\";\nimport { CSS } from \"@dnd-kit/utilities\";\nimport { Button } from \"../Button\";\nimport { Icon } from \"../Icon\";\nimport { mergeRefs } from \"../../internal/mergeRefs\";\nimport { cardMove, columnMove } from \"./moves\";\nimport { boardCoordinateGetter } from \"./keyboard\";\nimport \"./style.css\";\n\nexport interface BoardMove {\n cardId: string;\n fromColumnId: string;\n toColumnId: string;\n /** Index the card lands on inside the destination column. */\n toIndex: number;\n}\n\nexport interface BoardColumnMove {\n columnId: string;\n toIndex: number;\n}\n\ninterface BoardContextValue {\n activeId: string | null;\n activeType: \"card\" | \"column\" | null;\n /** The lane the pointer is currently over, whatever it is actually over. */\n overColumnId: string | null;\n}\n\n/**\n * A lane's body sits inside the lane's frame, so a raw corner-distance\n * strategy lets the body steal the hit from the lane itself — most visibly at\n * the board ends, where the last lane then never shifts aside to open the\n * drop gap. Resolve by what is being dragged: a column only ever hits other\n * columns; a card hits the card under the pointer first, then the lane body\n * under it, then whatever is nearest.\n */\nconst boardCollisionDetection: CollisionDetection = (args) => {\n const isColumn = args.active.data.current?.[\"type\"] === \"column\";\n const containers = args.droppableContainers.filter((container) => {\n const type = container.data.current?.[\"type\"];\n return isColumn ? type === \"column\" : type !== \"column\";\n });\n const scoped = { ...args, droppableContainers: containers };\n if (isColumn) return closestCorners(scoped);\n const within = pointerWithin(scoped);\n if (within.length > 0) {\n const rank = (id: (typeof within)[number][\"id\"]) =>\n containers.find((c) => c.id === id)?.data.current?.[\"type\"] === \"card\" ? 0 : 1;\n return [...within].sort((a, b) => rank(a.id) - rank(b.id));\n }\n return closestCorners(scoped);\n};\n\nconst BoardContext = createContext<BoardContextValue>({\n activeId: null,\n activeType: null,\n overColumnId: null,\n});\n\nexport interface BoardProps extends Omit<HTMLAttributes<HTMLDivElement>, \"onDragEnd\"> {\n /** Column ids in render order. Required for columns to be re-orderable. */\n columnIds?: string[];\n /** Fired once a card is dropped somewhere new. Apply it to your own state. */\n onMove?: (move: BoardMove) => void;\n /** Fired once a column is dropped in a new position. */\n onColumnMove?: (move: BoardColumnMove) => void;\n /** Rendered inside the drag overlay while a card is in the air. */\n renderDragOverlay?: (cardId: string) => ReactNode;\n /** Rendered inside the drag overlay while a column is in the air. */\n renderColumnDragOverlay?: (columnId: string) => ReactNode;\n children?: ReactNode;\n}\n\n/**\n * A column board with pointer and keyboard dragging. The board owns the drag\n * mechanics only — the card data stays yours; react to `onMove`.\n */\nexport const Board = forwardRef<HTMLDivElement, BoardProps>(function Board(\n {\n columnIds,\n onMove,\n onColumnMove,\n renderDragOverlay,\n renderColumnDragOverlay,\n className,\n children,\n ...rest\n },\n ref,\n) {\n const dndId = useId();\n const [activeId, setActiveId] = useState<string | null>(null);\n const [activeType, setActiveType] = useState<\"card\" | \"column\" | null>(null);\n const [overColumnId, setOverColumnId] = useState<string | null>(null);\n const sensors = useSensors(\n useSensor(PointerSensor, { activationConstraint: { distance: 4 } }),\n useSensor(KeyboardSensor, { coordinateGetter: boardCoordinateGetter }),\n );\n\n const handleStart = useCallback((event: DragStartEvent) => {\n setActiveId(String(event.active.id));\n setActiveType(event.active.data.current?.[\"type\"] === \"column\" ? \"column\" : \"card\");\n }, []);\n\n /* Cards land on cards as often as on empty space, so the lane a drag is over\n * is always resolved back to a column id — one highlight, one meaning. */\n const handleOver = useCallback((event: DragOverEvent) => {\n const over = event.over;\n if (!over) {\n setOverColumnId(null);\n return;\n }\n const overData = over.data.current ?? {};\n const columnId =\n overData[\"type\"] === \"column\" ? String(over.id) : String(overData[\"columnId\"] ?? \"\");\n setOverColumnId(columnId || null);\n }, []);\n\n const reset = useCallback(() => {\n setActiveId(null);\n setActiveType(null);\n setOverColumnId(null);\n }, []);\n\n const handleEnd = useCallback(\n (event: DragEndEvent) => {\n const { active, over } = event;\n reset();\n if (!over) return;\n\n /* Columns reorder among themselves; a column never lands inside a lane. */\n if (active.data.current?.[\"type\"] === \"column\") {\n const move = columnMove(event, columnIds ?? []);\n if (move) onColumnMove?.(move);\n } else {\n const move = cardMove(event);\n if (move) onMove?.(move);\n }\n },\n [columnIds, onColumnMove, onMove, reset],\n );\n\n const value = useMemo(\n () => ({ activeId, activeType, overColumnId }),\n [activeId, activeType, overColumnId],\n );\n\n const board = (\n <div ref={ref} className={[\"ds-board\", className].filter(Boolean).join(\" \")} {...rest}>\n {children}\n </div>\n );\n\n return (\n <BoardContext.Provider value={value}>\n <DndContext\n id={`ds-board-${dndId}`}\n sensors={sensors}\n collisionDetection={boardCollisionDetection}\n /* Lanes scroll and change height mid-drag, so positions are re-read\n * continuously — without this the shift animation misfires. */\n measuring={{ droppable: { strategy: MeasuringStrategy.Always } }}\n\n onDragStart={handleStart}\n onDragOver={handleOver}\n onDragEnd={handleEnd}\n onDragCancel={reset}\n >\n {columnIds ? (\n <SortableContext items={columnIds} strategy={horizontalListSortingStrategy}>\n {board}\n </SortableContext>\n ) : (\n board\n )}\n <DragOverlay>\n {activeId && activeType === \"card\" ? (\n <div className=\"ds-board-card\" data-overlay>\n <span className=\"ds-board-card__handle\" aria-hidden=\"true\">\n <Icon name=\"grip-vertical\" />\n </span>\n <div className=\"ds-board-card__content\">{renderDragOverlay?.(activeId)}</div>\n </div>\n ) : null}\n {activeId && activeType === \"column\" ? (\n <div className=\"ds-board-column\" data-overlay>\n {renderColumnDragOverlay?.(activeId)}\n </div>\n ) : null}\n </DragOverlay>\n </DndContext>\n </BoardContext.Provider>\n );\n});\n\nexport interface BoardColumnProps extends HTMLAttributes<HTMLDivElement> {\n id: string;\n title: string;\n /** Card ids in render order — the sortable contract for this column. */\n itemIds: string[];\n /** Shown beside the title; defaults to the number of cards. */\n count?: number;\n /** A control in the column head, e.g. an add button or a menu. */\n action?: ReactNode;\n /** Set false to pin a lane in place. */\n isDraggable?: boolean;\n children?: ReactNode;\n}\n\n/**\n * One lane of the board. Heavy frame, hairline head rule, scrolling body, and\n * a grip on top of the head that drags the whole lane sideways.\n */\nexport const BoardColumn = forwardRef<HTMLElement, BoardColumnProps>(\n function BoardColumn(\n { id, title, itemIds, count, action, isDraggable = true, className, children, ...rest },\n ref,\n ) {\n const { activeType, overColumnId } = useContext(BoardContext);\n const { setNodeRef: setBodyRef } = useDroppable({\n id: `${id}::body`,\n data: { type: \"column-body\", columnId: id, items: itemIds },\n });\n const {\n attributes,\n listeners,\n setNodeRef: setColumnRef,\n transform,\n transition,\n isDragging,\n } = useSortable({\n id,\n disabled: !isDraggable,\n data: { type: \"column\", columnId: id, items: itemIds },\n });\n\n return (\n <section\n ref={mergeRefs(setColumnRef, ref)}\n style={{ transform: CSS.Translate.toString(transform), transition }}\n className={[\"ds-board-column\", className].filter(Boolean).join(\" \")}\n data-over={(activeType === \"card\" && overColumnId === id) || undefined}\n data-dragging={isDragging || undefined}\n\n aria-label={title}\n {...rest}\n >\n {isDraggable && (\n <Button\n variant=\"simple\"\n size=\"sm\"\n iconStart=\"grip-horizontal\"\n className=\"ds-board-column__grip\"\n aria-label={`Reorder ${title}`}\n {...attributes}\n {...listeners}\n />\n )}\n <header className=\"ds-board-column__head\">\n <span className=\"ds-board-column__title\">{title}</span>\n <span className=\"ds-board-column__count\">{count ?? itemIds.length}</span>\n {action && <span className=\"ds-board-column__action\">{action}</span>}\n </header>\n <div ref={setBodyRef} className=\"ds-board-column__body\">\n <SortableContext items={itemIds} strategy={verticalListSortingStrategy}>\n {children}\n </SortableContext>\n </div>\n </section>\n );\n },\n);\n\nexport interface BoardCardProps extends HTMLAttributes<HTMLDivElement> {\n id: string;\n columnId: string;\n /** Accessible name announced when the card is picked up. */\n label?: string;\n children?: ReactNode;\n}\n\n/**\n * A draggable card. The grip on the left is the handle, so the card body can\n * hold links and buttons; the grip is a real button for keyboard users:\n * space to pick up, arrows to move, space to drop.\n */\nexport const BoardCard = forwardRef<HTMLDivElement, BoardCardProps>(function BoardCard(\n { id, columnId, label, className, children, ...rest },\n ref,\n) {\n const { attributes, listeners, setNodeRef, transform, transition, isDragging } =\n useSortable({ id, data: { type: \"card\", columnId } });\n const { activeId } = useContext(BoardContext);\n\n return (\n <div\n ref={mergeRefs(setNodeRef, ref)}\n style={{ transform: CSS.Translate.toString(transform), transition }}\n className={[\"ds-board-card\", className].filter(Boolean).join(\" \")}\n data-dragging={isDragging || undefined}\n data-idle={activeId && activeId !== id ? \"\" : undefined}\n {...rest}\n >\n <Button\n variant=\"simple\"\n size=\"sm\"\n isIconOnly\n iconStart=\"grip-vertical\"\n className=\"ds-board-card__handle\"\n aria-label={label ? `Move ${label}` : \"Move card\"}\n {...attributes}\n {...listeners}\n />\n <div className=\"ds-board-card__content\">{children}</div>\n </div>\n );\n});\n"],"mappings":"A,yQAGA,SAAgBkC,EAAW,CAAE,SAAQ,QAAsB,EAAkD,CAC3G,GAAI,CAACC,EAAM,OACX,IAAMC,EAAOD,EAAK,KAAK,SAAW,CAAC,EAC7BE,EAAWD,EAAKE,OAAY,SAAW,OAAOH,EAAK,EAAE,EAAI,OAAOC,EAAKG,UAAe,EAAE,EACtFC,EAAUC,EAAU,QAAQJ,CAAQ,EAC1C,GAAI,IAAU,GAAKA,IAAa,OAAOK,EAAO,EAAE,GAChD,MAAO,CAAE,SAAU,OAAOA,EAAO,EAAE,EAAG,SAAQ,CAChD,CAEA,SAAgBC,EAAS,CAAE,SAAQ,QAA6C,CAC9E,GAAI,CAACR,EAAM,OACX,IAAMS,EAAe,OAAOF,EAAO,KAAK,SAAUH,UAAe,EAAE,EAC7DH,EAAOD,EAAK,KAAK,SAAW,CAAC,EAC7BU,EAAST,EAAKE,OAAY,OAC1BQ,EAAa,OAAOV,EAAKG,WAAgBM,EAAS,GAAKV,EAAK,GAAG,EAE/DK,EAAUK,EACXT,EAAKW,UAA+C,OAAS,GAC5DX,EAAKY,OAAqC,CAAC,EAAA,CAAG,OACpD,GAAKF,IACDF,IAAiBE,GAAc,OAAOJ,EAAO,EAAE,IAAM,OAAOP,EAAK,EAAE,GACvE,MAAO,CAAE,OAAQ,OAAOO,EAAO,EAAE,EAAG,eAAc,aAAY,SAAQ,CACxE,CClBA,IAAaO,GAAmD,EAAO,IAAS,CAC9E,GAAM,CAAE,qBAAoB,WAAYC,EACxC,GAA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E,CAAC,EAChD,CAAE,aAAA,EAAaF,EAAAA,WAAAA,CAAWiD,CAAY,EAE5C,OACE,EAAAtC,EAAA,KAAA,CAAC,MAAD,CACE,IAAKR,EAAAA,EAAUoF,EAAYT,CAAG,EAC9B,MAAO,CAAE,UAAW1E,EAAAA,IAAI,UAAU,SAAS2E,CAAS,EAAG,YAAW,EAClE,UAAW,CAAC,gBAAiBT,CAAS,CAAC,CAAC,OAAO,OAAO,CAAC,CAAC,KAAK,GAAG,EAChE,gBAAeU,GAAc,IAAA,GAC7B,YAAW3B,GAAYA,IAAaL,EAAK,GAAK,IAAA,GAC9C,GAAIG,EANN,SAAA,EAQE,EAAAxC,EAAA,IAAA,CAACN,EAAAA,OAAD,CACE,QAAQ,SACR,KAAK,KACL,WAAA,GACA,UAAU,gBACV,UAAU,wBACV,aAAYmF,EAAQ,QAAQA,IAAU,YACtC,GAAIN,EACJ,GAAIC,CACL,CAAA,GACD,EAAAxE,EAAA,IAAA,CAAC,MAAD,CAAK,UAAU,yBAA0B,UAAc,CAAA,CACpD,C,EAET,CAAC,E"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"Board-BTFSzn6c.js","names":["Icon","mergeRefs","columnMove","over","data","columnId","\"type\"","\"columnId\"","toIndex","columnIds","active","cardMove","fromColumnId","onCard","toColumnId","\"sortable\"","\"items\"","boardCoordinateGetter","args","event","containers","context","c","a","b","activeRect","rect","currentCoordinates","sortableKeyboardCoordinates","boardCollisionDetection","isColumn","type","container","scoped","closestCorners","within","pointerWithin","rank","id","BoardContext","createContext","Board","forwardRef","rest","dndId","useId","activeId","setActiveId","useState","activeType","setActiveType","overColumnId","setOverColumnId","sensors","useSensors","useSensor","PointerSensor","KeyboardSensor","handleStart","useCallback","handleOver","overData","reset","handleEnd","move","onColumnMove","onMove","value","useMemo","board","className","DndContext","MeasuringStrategy","SortableContext","horizontalListSortingStrategy","DragOverlay","renderDragOverlay","renderColumnDragOverlay","BoardColumn","useContext","setBodyRef","useDroppable","itemIds","setColumnRef","useSortable","isDraggable","ref","CSS","transform","isDragging","title","Button","attributes","listeners","count","action","verticalListSortingStrategy","BoardCard","setNodeRef","label"],"sources":["../../src/components/Board/moves.ts","../../src/components/Board/keyboard.ts","../../src/components/Board/index.tsx"],"sourcesContent":["import type { DragEndEvent } from \"@dnd-kit/core\";\nimport type { BoardColumnMove, BoardMove } from \".\";\n\nexport function columnMove({ active, over }: DragEndEvent, columnIds: string[]): BoardColumnMove | undefined {\n if (!over) return;\n const data = over.data.current ?? {};\n const columnId = data[\"type\"] === \"column\" ? String(over.id) : String(data[\"columnId\"] ?? \"\");\n const toIndex = columnIds.indexOf(columnId);\n if (toIndex < 0 || columnId === String(active.id)) return;\n return { columnId: String(active.id), toIndex };\n}\n\nexport function cardMove({ active, over }: DragEndEvent): BoardMove | undefined {\n if (!over) return;\n const fromColumnId = String(active.data.current?.[\"columnId\"] ?? \"\");\n const data = over.data.current ?? {};\n const onCard = data[\"type\"] === \"card\";\n const toColumnId = String(data[\"columnId\"] ?? (onCard ? \"\" : over.id));\n // A card occupies a precise slot; empty lane space appends to the lane.\n const toIndex = onCard\n ? (data[\"sortable\"] as { index: number } | undefined)?.index ?? 0\n : ((data[\"items\"] as string[] | undefined) ?? []).length;\n if (!toColumnId) return;\n if (fromColumnId === toColumnId && String(active.id) === String(over.id)) return;\n return { cardId: String(active.id), fromColumnId, toColumnId, toIndex };\n}\n","import type { KeyboardCoordinateGetter } from \"@dnd-kit/core\";\nimport { sortableKeyboardCoordinates } from \"@dnd-kit/sortable\";\n\n/**\n * Arrow up/down sorts inside a lane; left/right jumps lanes, which the stock\n * sortable getter does not do.\n */\nexport const boardCoordinateGetter: KeyboardCoordinateGetter = (event, args) => {\n const { currentCoordinates, context } = args;\n if (event.code === \"ArrowLeft\" || event.code === \"ArrowRight\") {\n const containers = context.droppableContainers\n .getEnabled()\n .filter((c) => c.data.current?.[\"type\"] === \"column-body\")\n .sort((a, b) => (a.rect.current?.left ?? 0) - (b.rect.current?.left ?? 0));\n const activeRect = context.active?.rect.current.translated;\n if (!activeRect) return undefined;\n const index = containers.findIndex(\n (c) => (c.rect.current?.left ?? 0) <= activeRect.left + 1 &&\n (c.rect.current?.right ?? 0) >= activeRect.left - 1,\n );\n const next = containers[index + (event.code === \"ArrowRight\" ? 1 : -1)];\n const rect = next?.rect.current;\n if (!rect) return undefined;\n event.preventDefault();\n return { x: rect.left + rect.width / 2 - activeRect.width / 2, y: currentCoordinates.y };\n }\n return sortableKeyboardCoordinates(event, args);\n};\n\n","import {\n createContext,\n forwardRef,\n useCallback,\n useContext,\n useId,\n useMemo,\n useState,\n type HTMLAttributes,\n type ReactNode,\n} from \"react\";\nimport {\n DndContext,\n DragOverlay,\n KeyboardSensor,\n PointerSensor,\n closestCorners,\n pointerWithin,\n MeasuringStrategy,\n\n useDroppable,\n useSensor,\n useSensors,\n type CollisionDetection,\n type DragEndEvent,\n type DragOverEvent,\n type DragStartEvent,\n} from \"@dnd-kit/core\";\nimport {\n SortableContext,\n horizontalListSortingStrategy,\n useSortable,\n verticalListSortingStrategy,\n} from \"@dnd-kit/sortable\";\nimport { CSS } from \"@dnd-kit/utilities\";\nimport { Button } from \"../Button\";\nimport { Icon } from \"../Icon\";\nimport { mergeRefs } from \"../../internal/mergeRefs\";\nimport { cardMove, columnMove } from \"./moves\";\nimport { boardCoordinateGetter } from \"./keyboard\";\nimport \"./style.css\";\n\nexport interface BoardMove {\n cardId: string;\n fromColumnId: string;\n toColumnId: string;\n /** Index the card lands on inside the destination column. */\n toIndex: number;\n}\n\nexport interface BoardColumnMove {\n columnId: string;\n toIndex: number;\n}\n\ninterface BoardContextValue {\n activeId: string | null;\n activeType: \"card\" | \"column\" | null;\n /** The lane the pointer is currently over, whatever it is actually over. */\n overColumnId: string | null;\n}\n\n/**\n * A lane's body sits inside the lane's frame, so a raw corner-distance\n * strategy lets the body steal the hit from the lane itself — most visibly at\n * the board ends, where the last lane then never shifts aside to open the\n * drop gap. Resolve by what is being dragged: a column only ever hits other\n * columns; a card hits the card under the pointer first, then the lane body\n * under it, then whatever is nearest.\n */\nconst boardCollisionDetection: CollisionDetection = (args) => {\n const isColumn = args.active.data.current?.[\"type\"] === \"column\";\n const containers = args.droppableContainers.filter((container) => {\n const type = container.data.current?.[\"type\"];\n return isColumn ? type === \"column\" : type !== \"column\";\n });\n const scoped = { ...args, droppableContainers: containers };\n if (isColumn) return closestCorners(scoped);\n const within = pointerWithin(scoped);\n if (within.length > 0) {\n const rank = (id: (typeof within)[number][\"id\"]) =>\n containers.find((c) => c.id === id)?.data.current?.[\"type\"] === \"card\" ? 0 : 1;\n return [...within].sort((a, b) => rank(a.id) - rank(b.id));\n }\n return closestCorners(scoped);\n};\n\nconst BoardContext = createContext<BoardContextValue>({\n activeId: null,\n activeType: null,\n overColumnId: null,\n});\n\nexport interface BoardProps extends Omit<HTMLAttributes<HTMLDivElement>, \"onDragEnd\"> {\n /** Column ids in render order. Required for columns to be re-orderable. */\n columnIds?: string[];\n /** Fired once a card is dropped somewhere new. Apply it to your own state. */\n onMove?: (move: BoardMove) => void;\n /** Fired once a column is dropped in a new position. */\n onColumnMove?: (move: BoardColumnMove) => void;\n /** Rendered inside the drag overlay while a card is in the air. */\n renderDragOverlay?: (cardId: string) => ReactNode;\n /** Rendered inside the drag overlay while a column is in the air. */\n renderColumnDragOverlay?: (columnId: string) => ReactNode;\n children?: ReactNode;\n}\n\n/**\n * A column board with pointer and keyboard dragging. The board owns the drag\n * mechanics only — the card data stays yours; react to `onMove`.\n */\nexport const Board = forwardRef<HTMLDivElement, BoardProps>(function Board(\n {\n columnIds,\n onMove,\n onColumnMove,\n renderDragOverlay,\n renderColumnDragOverlay,\n className,\n children,\n ...rest\n },\n ref,\n) {\n const dndId = useId();\n const [activeId, setActiveId] = useState<string | null>(null);\n const [activeType, setActiveType] = useState<\"card\" | \"column\" | null>(null);\n const [overColumnId, setOverColumnId] = useState<string | null>(null);\n const sensors = useSensors(\n useSensor(PointerSensor, { activationConstraint: { distance: 4 } }),\n useSensor(KeyboardSensor, { coordinateGetter: boardCoordinateGetter }),\n );\n\n const handleStart = useCallback((event: DragStartEvent) => {\n setActiveId(String(event.active.id));\n setActiveType(event.active.data.current?.[\"type\"] === \"column\" ? \"column\" : \"card\");\n }, []);\n\n /* Cards land on cards as often as on empty space, so the lane a drag is over\n * is always resolved back to a column id — one highlight, one meaning. */\n const handleOver = useCallback((event: DragOverEvent) => {\n const over = event.over;\n if (!over) {\n setOverColumnId(null);\n return;\n }\n const overData = over.data.current ?? {};\n const columnId =\n overData[\"type\"] === \"column\" ? String(over.id) : String(overData[\"columnId\"] ?? \"\");\n setOverColumnId(columnId || null);\n }, []);\n\n const reset = useCallback(() => {\n setActiveId(null);\n setActiveType(null);\n setOverColumnId(null);\n }, []);\n\n const handleEnd = useCallback(\n (event: DragEndEvent) => {\n const { active, over } = event;\n reset();\n if (!over) return;\n\n /* Columns reorder among themselves; a column never lands inside a lane. */\n if (active.data.current?.[\"type\"] === \"column\") {\n const move = columnMove(event, columnIds ?? []);\n if (move) onColumnMove?.(move);\n } else {\n const move = cardMove(event);\n if (move) onMove?.(move);\n }\n },\n [columnIds, onColumnMove, onMove, reset],\n );\n\n const value = useMemo(\n () => ({ activeId, activeType, overColumnId }),\n [activeId, activeType, overColumnId],\n );\n\n const board = (\n <div ref={ref} className={[\"ds-board\", className].filter(Boolean).join(\" \")} {...rest}>\n {children}\n </div>\n );\n\n return (\n <BoardContext.Provider value={value}>\n <DndContext\n id={`ds-board-${dndId}`}\n sensors={sensors}\n collisionDetection={boardCollisionDetection}\n /* Lanes scroll and change height mid-drag, so positions are re-read\n * continuously — without this the shift animation misfires. */\n measuring={{ droppable: { strategy: MeasuringStrategy.Always } }}\n\n onDragStart={handleStart}\n onDragOver={handleOver}\n onDragEnd={handleEnd}\n onDragCancel={reset}\n >\n {columnIds ? (\n <SortableContext items={columnIds} strategy={horizontalListSortingStrategy}>\n {board}\n </SortableContext>\n ) : (\n board\n )}\n <DragOverlay>\n {activeId && activeType === \"card\" ? (\n <div className=\"ds-board-card\" data-overlay>\n <span className=\"ds-board-card__handle\" aria-hidden=\"true\">\n <Icon name=\"grip-vertical\" />\n </span>\n <div className=\"ds-board-card__content\">{renderDragOverlay?.(activeId)}</div>\n </div>\n ) : null}\n {activeId && activeType === \"column\" ? (\n <div className=\"ds-board-column\" data-overlay>\n {renderColumnDragOverlay?.(activeId)}\n </div>\n ) : null}\n </DragOverlay>\n </DndContext>\n </BoardContext.Provider>\n );\n});\n\nexport interface BoardColumnProps extends HTMLAttributes<HTMLDivElement> {\n id: string;\n title: string;\n /** Card ids in render order — the sortable contract for this column. */\n itemIds: string[];\n /** Shown beside the title; defaults to the number of cards. */\n count?: number;\n /** A control in the column head, e.g. an add button or a menu. */\n action?: ReactNode;\n /** Set false to pin a lane in place. */\n isDraggable?: boolean;\n children?: ReactNode;\n}\n\n/**\n * One lane of the board. Heavy frame, hairline head rule, scrolling body, and\n * a grip on top of the head that drags the whole lane sideways.\n */\nexport const BoardColumn = forwardRef<HTMLElement, BoardColumnProps>(\n function BoardColumn(\n { id, title, itemIds, count, action, isDraggable = true, className, children, ...rest },\n ref,\n ) {\n const { activeType, overColumnId } = useContext(BoardContext);\n const { setNodeRef: setBodyRef } = useDroppable({\n id: `${id}::body`,\n data: { type: \"column-body\", columnId: id, items: itemIds },\n });\n const {\n attributes,\n listeners,\n setNodeRef: setColumnRef,\n transform,\n transition,\n isDragging,\n } = useSortable({\n id,\n disabled: !isDraggable,\n data: { type: \"column\", columnId: id, items: itemIds },\n });\n\n return (\n <section\n ref={mergeRefs(setColumnRef, ref)}\n style={{ transform: CSS.Translate.toString(transform), transition }}\n className={[\"ds-board-column\", className].filter(Boolean).join(\" \")}\n data-over={(activeType === \"card\" && overColumnId === id) || undefined}\n data-dragging={isDragging || undefined}\n\n aria-label={title}\n {...rest}\n >\n {isDraggable && (\n <Button\n variant=\"simple\"\n size=\"sm\"\n iconStart=\"grip-horizontal\"\n className=\"ds-board-column__grip\"\n aria-label={`Reorder ${title}`}\n {...attributes}\n {...listeners}\n />\n )}\n <header className=\"ds-board-column__head\">\n <span className=\"ds-board-column__title\">{title}</span>\n <span className=\"ds-board-column__count\">{count ?? itemIds.length}</span>\n {action && <span className=\"ds-board-column__action\">{action}</span>}\n </header>\n <div ref={setBodyRef} className=\"ds-board-column__body\">\n <SortableContext items={itemIds} strategy={verticalListSortingStrategy}>\n {children}\n </SortableContext>\n </div>\n </section>\n );\n },\n);\n\nexport interface BoardCardProps extends HTMLAttributes<HTMLDivElement> {\n id: string;\n columnId: string;\n /** Accessible name announced when the card is picked up. */\n label?: string;\n children?: ReactNode;\n}\n\n/**\n * A draggable card. The grip on the left is the handle, so the card body can\n * hold links and buttons; the grip is a real button for keyboard users:\n * space to pick up, arrows to move, space to drop.\n */\nexport const BoardCard = forwardRef<HTMLDivElement, BoardCardProps>(function BoardCard(\n { id, columnId, label, className, children, ...rest },\n ref,\n) {\n const { attributes, listeners, setNodeRef, transform, transition, isDragging } =\n useSortable({ id, data: { type: \"card\", columnId } });\n const { activeId } = useContext(BoardContext);\n\n return (\n <div\n ref={mergeRefs(setNodeRef, ref)}\n style={{ transform: CSS.Translate.toString(transform), transition }}\n className={[\"ds-board-card\", className].filter(Boolean).join(\" \")}\n data-dragging={isDragging || undefined}\n data-idle={activeId && activeId !== id ? \"\" : undefined}\n {...rest}\n >\n <Button\n variant=\"simple\"\n size=\"sm\"\n isIconOnly\n iconStart=\"grip-vertical\"\n className=\"ds-board-card__handle\"\n aria-label={label ? `Move ${label}` : \"Move card\"}\n {...attributes}\n {...listeners}\n />\n <div className=\"ds-board-card__content\">{children}</div>\n </div>\n );\n});\n"],"mappings":";;;;;;;;;AAGA,SAAgBE,EAAW,EAAE,WAAQ,WAAsB,GAAkD;CAC3G,IAAI,CAACC,GAAM;CACX,IAAMC,IAAOD,EAAK,KAAK,WAAW,CAAC,GAC7BE,IAAWD,EAAKE,SAAY,WAAW,OAAOH,EAAK,EAAE,IAAI,OAAOC,EAAK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AC,KAAK,GAAG;EAChE,iBAAemB,KAAc,KAAA;EAC7B,aAAW3C,KAAYA,MAAaR,IAAK,KAAK,KAAA;EAC9C,GAAIK;EANN,UAAA,CAQE,kBAACgD,GAAD;GACE,SAAQ;GACR,MAAK;GACL,YAAA;GACA,WAAU;GACV,WAAU;GACV,cAAYQ,IAAQ,QAAQA,MAAU;GACtC,GAAIP;GACJ,GAAIC;EACL,CAAA,GACD,kBAAC,OAAD;GAAK,WAAU;GAA0B;EAAc,CAAA,CACpD;;AAET,CAAC"}
@@ -1,191 +0,0 @@
1
- import { Field as e } from "../components/Field/index.js";
2
- import { TextArea as t, TextField as n } from "../components/TextField/index.js";
3
- import { n as r, r as i, t as a } from "./RichTextEditor-Dnx4i7bQ.js";
4
- import { EntryPicker as o } from "../components/EntryPicker/index.js";
5
- import { NumberField as s } from "../components/NumberField/index.js";
6
- import { Switch as c } from "../components/Switch/index.js";
7
- import { useState as l } from "react";
8
- import { jsx as u } from "react/jsx-runtime";
9
- //#region src/components/EntryEditor/model.ts
10
- var d = /* @__PURE__ */ new Set([
11
- "shortText",
12
- "longText",
13
- "richText",
14
- "number",
15
- "boolean",
16
- "dateTime",
17
- "asset",
18
- "reference"
19
- ]);
20
- function f(e) {
21
- let t = /* @__PURE__ */ new Set();
22
- for (let n of e.fields) {
23
- if (!n.id?.trim() || t.has(n.id)) throw Error("Content model field IDs must be nonempty and unique.");
24
- if (!d.has(n.type)) throw Error(`Unsupported content field type: ${n.type}`);
25
- t.add(n.id);
26
- }
27
- }
28
- function p(e) {
29
- if (typeof e != "string") return;
30
- let t = /^(\d{4}-\d{2}-\d{2}T\d{2}:\d{2})(?::(\d{2})(?:\.(\d{1,3}))?)?(?:Z|\+00:00)$/.exec(e);
31
- if (!t) return;
32
- let n = `${t[1]}:${t[2] ?? "00"}.${(t[3] ?? "").padEnd(3, "0")}Z`, r = new Date(n);
33
- if (Number.isFinite(r.getTime()) && r.toISOString() === n) return n;
34
- }
35
- function m(e, t) {
36
- return !!e && typeof e == "object" && t in e && typeof e[t] == "string" && e[t].trim().length > 0;
37
- }
38
- function h(e) {
39
- return !!e.text?.trim() || e.type === "horizontalRule" || !!e.content?.some(h);
40
- }
41
- function g(e) {
42
- return `${e.label} is required.`;
43
- }
44
- function _(e, t) {
45
- if (typeof t != "string") return "Enter text.";
46
- if (e.required && !t.trim()) return g(e);
47
- }
48
- function v(e, t) {
49
- let n = r(t);
50
- if (n) return n;
51
- if (e.required && !h(t)) return g(e);
52
- }
53
- function y(e, t) {
54
- let n = e.type === "asset" ? "assetId" : "entryId";
55
- if (!(e.multiple ? Array.isArray(t) && t.every((e) => m(e, n)) : m(t, n))) return e.multiple ? `Choose a list of ${e.type === "asset" ? "assets" : "entries"}.` : `Choose an ${e.type === "asset" ? "asset" : "entry"}.`;
56
- if (e.required && Array.isArray(t) && t.length === 0) return g(e);
57
- }
58
- var b = {
59
- shortText: _,
60
- longText: _,
61
- richText: v,
62
- number: (e, t) => typeof t == "number" && Number.isFinite(t) ? void 0 : "Enter a finite number.",
63
- boolean: (e, t) => typeof t == "boolean" ? void 0 : "Choose a boolean value.",
64
- dateTime: (e, t) => p(t) ? void 0 : "Enter a valid UTC date and time.",
65
- asset: y,
66
- reference: y
67
- };
68
- function x(e, t) {
69
- return f(e), Object.fromEntries(e.fields.flatMap((e) => {
70
- let n = Object.hasOwn(t, e.id) ? t[e.id] : void 0, r = n === void 0 ? e.required ? g(e) : void 0 : b[e.type](e, n);
71
- return r ? [[e.id, r]] : [];
72
- }));
73
- }
74
- //#endregion
75
- //#region src/components/EntryEditor/index.tsx
76
- function S(e, t) {
77
- let n = e.type === "asset" ? "assetId" : "entryId";
78
- return (Array.isArray(t) ? t : t === void 0 ? [] : [t]).flatMap((e) => {
79
- if (!e || typeof e != "object" || !(n in e)) return [];
80
- let t = e[n];
81
- return typeof t == "string" ? [t] : [];
82
- });
83
- }
84
- function C(e, t) {
85
- if (e.type === "asset") {
86
- let n = t.map((e) => ({ assetId: e }));
87
- return e.multiple ? n : n[0];
88
- }
89
- let n = t.map((e) => ({ entryId: e }));
90
- return e.multiple ? n : n[0];
91
- }
92
- function w({ field: e, stored: r, items: l, isDisabled: d, accessibility: { required: f, ...m }, onChange: h }) {
93
- switch (e.type) {
94
- case "shortText":
95
- case "longText": {
96
- let i = e.type === "shortText" ? n : t;
97
- return /* @__PURE__ */ u(i, {
98
- ...m,
99
- required: f,
100
- disabled: d,
101
- placeholder: e.placeholder,
102
- value: typeof r == "string" ? r : "",
103
- onChange: (e) => h(e.target.value)
104
- });
105
- }
106
- case "number": return /* @__PURE__ */ u(s, {
107
- ...m,
108
- required: f,
109
- isDisabled: d,
110
- placeholder: e.placeholder,
111
- step: "any",
112
- hasSteppers: !1,
113
- value: typeof r == "number" && Number.isFinite(r) ? r : "",
114
- onValueChange: (e) => {
115
- (e === "" || Number.isFinite(e)) && h(e === "" ? void 0 : e);
116
- }
117
- });
118
- case "boolean": return /* @__PURE__ */ u(c, {
119
- ...m,
120
- isDisabled: d,
121
- isSelected: r === !0,
122
- onSelectedChange: h
123
- });
124
- case "dateTime": return /* @__PURE__ */ u(n, {
125
- ...m,
126
- required: f,
127
- disabled: d,
128
- type: "datetime-local",
129
- step: "0.001",
130
- value: p(r)?.slice(0, -1) ?? "",
131
- onChange: (e) => h(p(`${e.target.value}Z`))
132
- });
133
- case "richText": return /* @__PURE__ */ u(a, {
134
- ...m,
135
- label: e.label,
136
- isRequired: f,
137
- isDisabled: d,
138
- placeholder: e.placeholder,
139
- format: "json",
140
- value: r === void 0 ? i : r,
141
- onChange: h
142
- });
143
- case "asset":
144
- case "reference": return /* @__PURE__ */ u("div", {
145
- ...m,
146
- role: "group",
147
- children: /* @__PURE__ */ u(o, {
148
- items: l,
149
- value: S(e, r),
150
- label: e.type === "asset" ? "Assets" : "Entries",
151
- addLabel: `Choose ${e.label}`,
152
- mode: e.multiple ? "multiple" : "single",
153
- isDisabled: d,
154
- onValueChange: (t) => h(C(e, t))
155
- })
156
- });
157
- }
158
- }
159
- function T({ model: t, value: n, defaultValue: r = {}, onValueChange: i, pickerItems: a = {}, errors: o = {}, isDisabled: s = !1, showAllErrors: c = !1, className: d, ...f }) {
160
- let [p, m] = l(r), [h, g] = l(() => /* @__PURE__ */ new Set()), _ = n ?? p, v = x(t, _), y = (e, t) => {
161
- if (s) return;
162
- let r = { ..._ };
163
- t === void 0 ? delete r[e] : r[e] = t, n === void 0 && m(r), g((t) => new Set(t).add(e)), i?.(r);
164
- };
165
- return /* @__PURE__ */ u("div", {
166
- className: ["ds-entry-editor", d].filter(Boolean).join(" "),
167
- ...f,
168
- children: t.fields.map((t) => {
169
- let n = Object.hasOwn(_, t.id) ? _[t.id] : void 0, r = t.type === "asset" || t.type === "reference", i = t.type === "dateTime" ? `${t.label} (UTC)` : t.label, l = o[t.id] ?? (c || h.has(t.id) ? v[t.id] : void 0);
170
- return /* @__PURE__ */ u(e, {
171
- label: i,
172
- hint: t.hint,
173
- error: l,
174
- isRequired: t.required,
175
- isGroup: r,
176
- children: (e) => /* @__PURE__ */ u(w, {
177
- field: t,
178
- stored: n,
179
- items: a[t.id] ?? [],
180
- isDisabled: s,
181
- accessibility: e,
182
- onChange: (e) => y(t.id, e)
183
- })
184
- }, t.id);
185
- })
186
- });
187
- }
188
- //#endregion
189
- export { x as n, T as t };
190
-
191
- //# sourceMappingURL=EntryEditor-CcyYtH74.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"EntryEditor-CcyYtH74.js","names":["documentError","emptyDocument","RichTextEditor","fieldTypes","assertModel","ids","field","model","parseUtcDateTime","value","match","canonical","date","isLink","key","hasRichText","node","requiredError","textError","richTextError","error","linkError","item","validators","validateEntryValues","values","selectedIds","link","id","pickerValue","links","EntryControl","accessibility","Control","TextField","TextArea","isDisabled","stored","onChange","event","NumberField","next","Switch","required","EntryPicker","EntryEditor","rest","internal","setInternal","useState","defaultValue","changed","setChanged","current","validation","commit","previous","onValueChange","className","isPicker","label","errors","showAllErrors","Field","pickerItems"],"sources":["../../src/components/EntryEditor/model.ts","../../src/components/EntryEditor/index.tsx"],"sourcesContent":["import type { JSONContent } from \"@tiptap/react\";\nimport { documentError } from \"../RichTextEditor/document\";\nimport type { RichTextDocument } from \"../RichTextEditor\";\n\ninterface ContentFieldBase {\n id: string;\n label: string;\n hint?: string;\n placeholder?: string;\n required?: boolean;\n}\n\nexport type ContentField = ContentFieldBase & (\n | { type: \"shortText\" | \"longText\" | \"richText\" | \"number\" | \"boolean\" | \"dateTime\"; multiple?: never }\n | { type: \"asset\" | \"reference\"; multiple?: boolean }\n);\n\nexport interface ContentModel {\n fields: readonly ContentField[];\n}\n\nexport interface AssetValue { assetId: string }\nexport interface ReferenceValue { entryId: string }\nexport type EntryFieldValue = string | number | boolean | RichTextDocument | AssetValue | ReferenceValue | AssetValue[] | ReferenceValue[];\nexport type EntryValues = Record<string, EntryFieldValue | undefined>;\nexport type EntryErrors = Partial<Record<string, string>>;\n\nconst fieldTypes = new Set([\"shortText\", \"longText\", \"richText\", \"number\", \"boolean\", \"dateTime\", \"asset\", \"reference\"]);\n\nfunction assertModel(model: ContentModel) {\n const ids = new Set<string>();\n for (const field of model.fields) {\n if (!field.id?.trim() || ids.has(field.id)) throw new Error(\"Content model field IDs must be nonempty and unique.\");\n if (!fieldTypes.has(field.type)) throw new Error(`Unsupported content field type: ${field.type}`);\n ids.add(field.id);\n }\n}\n\n/** Accept UTC ISO strings without rolling invalid dates into the next month. */\nexport function parseUtcDateTime(value: unknown): string | undefined {\n if (typeof value !== \"string\") return;\n const match = /^(\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2})(?::(\\d{2})(?:\\.(\\d{1,3}))?)?(?:Z|\\+00:00)$/.exec(value);\n if (!match) return;\n const canonical = `${match[1]}:${match[2] ?? \"00\"}.${(match[3] ?? \"\").padEnd(3, \"0\")}Z`;\n const date = new Date(canonical);\n if (Number.isFinite(date.getTime()) && date.toISOString() === canonical) return canonical;\n}\n\nfunction isLink(value: unknown, key: \"assetId\" | \"entryId\"): boolean {\n return !!value && typeof value === \"object\" && key in value &&\n typeof (value as Record<string, unknown>)[key] === \"string\" &&\n ((value as Record<string, string>)[key]).trim().length > 0;\n}\n\nfunction hasRichText(node: JSONContent): boolean {\n return !!node.text?.trim() || node.type === \"horizontalRule\" || !!node.content?.some(hasRichText);\n}\n\nfunction requiredError(field: ContentField): string {\n return `${field.label} is required.`;\n}\n\nfunction textError(field: ContentField, value: unknown): string | undefined {\n if (typeof value !== \"string\") return \"Enter text.\";\n if (field.required && !value.trim()) return requiredError(field);\n}\n\nfunction richTextError(field: ContentField, value: unknown): string | undefined {\n const error = documentError(value);\n if (error) return error;\n if (field.required && !hasRichText(value as RichTextDocument)) return requiredError(field);\n}\n\nfunction linkError(field: ContentField, value: unknown): string | undefined {\n const key = field.type === \"asset\" ? \"assetId\" : \"entryId\";\n const valid = field.multiple\n ? Array.isArray(value) && value.every((item) => isLink(item, key))\n : isLink(value, key);\n if (!valid) {\n return field.multiple\n ? `Choose a list of ${field.type === \"asset\" ? \"assets\" : \"entries\"}.`\n : `Choose an ${field.type === \"asset\" ? \"asset\" : \"entry\"}.`;\n }\n if (field.required && Array.isArray(value) && value.length === 0) return requiredError(field);\n}\n\nconst validators: Record<ContentField[\"type\"], (field: ContentField, value: unknown) => string | undefined> = {\n shortText: textError,\n longText: textError,\n richText: richTextError,\n number: (_field, value) => typeof value === \"number\" && Number.isFinite(value) ? undefined : \"Enter a finite number.\",\n boolean: (_field, value) => typeof value === \"boolean\" ? undefined : \"Choose a boolean value.\",\n dateTime: (_field, value) => parseUtcDateTime(value) ? undefined : \"Enter a valid UTC date and time.\",\n asset: linkError,\n reference: linkError,\n};\n\n/** Validate data loaded from JSON as well as values emitted by EntryEditor. */\nexport function validateEntryValues(model: ContentModel, values: Record<string, unknown>): EntryErrors {\n assertModel(model);\n return Object.fromEntries(model.fields.flatMap((field): [string, string][] => {\n const value = Object.hasOwn(values, field.id) ? values[field.id] : undefined;\n const error = value === undefined\n ? field.required ? requiredError(field) : undefined\n : validators[field.type](field, value);\n return error ? [[field.id, error]] : [];\n }));\n}\n","import { useState, type HTMLAttributes } from \"react\";\nimport { EntryPicker, type EntryItem } from \"../EntryPicker\";\nimport { Field, type FieldProps } from \"../Field\";\nimport { NumberField } from \"../NumberField\";\nimport { RichTextEditor, type RichTextDocument } from \"../RichTextEditor\";\nimport { emptyDocument } from \"../RichTextEditor/document\";\nimport { Switch } from \"../Switch\";\nimport { TextArea, TextField } from \"../TextField\";\nimport { parseUtcDateTime, validateEntryValues, type ContentField, type ContentModel, type EntryErrors, type EntryFieldValue, type EntryValues } from \"./model\";\nimport \"./style.css\";\n\nexport { validateEntryValues } from \"./model\";\nexport type { AssetValue, ContentField, ContentModel, EntryErrors, EntryFieldValue, EntryValues, ReferenceValue } from \"./model\";\n\nexport interface EntryEditorProps extends Omit<HTMLAttributes<HTMLDivElement>, \"defaultValue\" | \"onChange\"> {\n model: ContentModel;\n value?: EntryValues;\n defaultValue?: EntryValues;\n onValueChange?: (values: EntryValues) => void;\n /** Available assets or entries, keyed by content field ID. */\n pickerItems?: Record<string, EntryItem[]>;\n /** App-provided messages take precedence over built-in validation. */\n errors?: EntryErrors;\n isDisabled?: boolean;\n /** Reveal validation for untouched fields, for example after a submit attempt. */\n showAllErrors?: boolean;\n}\n\nfunction selectedIds(field: ContentField, value: EntryFieldValue | undefined): string[] {\n const key = field.type === \"asset\" ? \"assetId\" : \"entryId\";\n const links = Array.isArray(value) ? value : value === undefined ? [] : [value];\n return links.flatMap((link) => {\n if (!link || typeof link !== \"object\" || !(key in link)) return [];\n const id = (link as unknown as Record<string, unknown>)[key];\n return typeof id === \"string\" ? [id] : [];\n });\n}\n\nfunction pickerValue(field: ContentField, ids: string[]): EntryFieldValue | undefined {\n if (field.type === \"asset\") {\n const links = ids.map((assetId) => ({ assetId }));\n return field.multiple ? links : links[0];\n }\n const links = ids.map((entryId) => ({ entryId }));\n return field.multiple ? links : links[0];\n}\n\nfunction EntryControl({ field, stored, items, isDisabled, accessibility: { required, ...accessibility }, onChange }: {\n field: ContentField;\n stored: EntryFieldValue | undefined;\n items: EntryItem[];\n isDisabled: boolean;\n accessibility: Parameters<FieldProps[\"children\"]>[0];\n onChange: (value: EntryFieldValue | undefined) => void;\n}) {\n switch (field.type) {\n case \"shortText\":\n case \"longText\": {\n const Control = field.type === \"shortText\" ? TextField : TextArea;\n return <Control {...accessibility} required={required} disabled={isDisabled} placeholder={field.placeholder}\n value={typeof stored === \"string\" ? stored : \"\"} onChange={(event) => onChange(event.target.value)} />;\n }\n case \"number\":\n return <NumberField {...accessibility} required={required} isDisabled={isDisabled} placeholder={field.placeholder} step=\"any\"\n hasSteppers={false} value={typeof stored === \"number\" && Number.isFinite(stored) ? stored : \"\"}\n onValueChange={(next) => { if (next === \"\" || Number.isFinite(next)) onChange(next === \"\" ? undefined : next); }} />;\n case \"boolean\":\n return <Switch {...accessibility} isDisabled={isDisabled} isSelected={stored === true} onSelectedChange={onChange} />;\n case \"dateTime\":\n return <TextField {...accessibility} required={required} disabled={isDisabled} type=\"datetime-local\" step=\"0.001\"\n value={parseUtcDateTime(stored)?.slice(0, -1) ?? \"\"}\n onChange={(event) => onChange(parseUtcDateTime(`${event.target.value}Z`))} />;\n case \"richText\":\n return <RichTextEditor {...accessibility} label={field.label} isRequired={required} isDisabled={isDisabled}\n placeholder={field.placeholder} format=\"json\" value={stored === undefined ? emptyDocument : stored as RichTextDocument}\n onChange={onChange} />;\n case \"asset\":\n case \"reference\":\n return <div {...accessibility} role=\"group\">\n <EntryPicker items={items} value={selectedIds(field, stored)}\n label={field.type === \"asset\" ? \"Assets\" : \"Entries\"} addLabel={`Choose ${field.label}`}\n mode={field.multiple ? \"multiple\" : \"single\"} isDisabled={isDisabled}\n onValueChange={(ids) => onChange(pickerValue(field, ids))} />\n </div>;\n }\n}\n\n/** An ordered set of content inputs; submission and persistence belong to the app. */\nexport function EntryEditor({\n model,\n value,\n defaultValue = {},\n onValueChange,\n pickerItems = {},\n errors = {},\n isDisabled = false,\n showAllErrors = false,\n className,\n ...rest\n}: EntryEditorProps) {\n const [internal, setInternal] = useState<EntryValues>(defaultValue);\n const [changed, setChanged] = useState<Set<string>>(() => new Set());\n const current = value ?? internal;\n const validation = validateEntryValues(model, current);\n\n const commit = (id: string, next: EntryFieldValue | undefined) => {\n if (isDisabled) return;\n const values = { ...current };\n if (next === undefined) delete values[id];\n else values[id] = next;\n if (value === undefined) setInternal(values);\n setChanged((previous) => new Set(previous).add(id));\n onValueChange?.(values);\n };\n\n return (\n <div className={[\"ds-entry-editor\", className].filter(Boolean).join(\" \")} {...rest}>\n {model.fields.map((field) => {\n const stored = Object.hasOwn(current, field.id) ? current[field.id] : undefined;\n const isPicker = field.type === \"asset\" || field.type === \"reference\";\n const label = field.type === \"dateTime\" ? `${field.label} (UTC)` : field.label;\n const error = errors[field.id] ?? (showAllErrors || changed.has(field.id) ? validation[field.id] : undefined);\n return (\n <Field key={field.id} label={label} hint={field.hint} error={error} isRequired={field.required} isGroup={isPicker}>\n {(accessibility) => <EntryControl field={field} stored={stored} items={pickerItems[field.id] ?? []}\n isDisabled={isDisabled} accessibility={accessibility} onChange={(next) => commit(field.id, next)} />}\n </Field>\n );\n })}\n </div>\n );\n}\n"],"mappings":";;;;;;;;;AA2BA,IAAMG,oBAAa,IAAI,IAAI;CAAC;CAAa;CAAY;CAAY;CAAU;CAAW;CAAY;CAAS;AAAW,CAAC;AAEvH,SAASC,EAAY,GAAqB;CACxC,IAAMC,oBAAM,IAAI,IAAY;CAC5B,KAAK,IAAMC,KAASC,EAAM,QAAQ;EAChC,IAAI,CAACD,EAAM,IAAI,KAAK,KAAKD,EAAI,IAAIC,EAAM,EAAE,GAAG,MAAU,MAAM,sDAAsD;EAClH,IAAI,CAACH,EAAW,IAAIG,EAAM,IAAI,GAAG,MAAU,MAAM,mCAAmCA,EAAM,MAAM;EAChG,EAAI,IAAIA,EAAM,EAAE;CAClB;AACF;AAGA,SAAgBE,EAAiB,GAAoC;CACnE,IAA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E,CAAC,GAClD6B,IAAgBhC,CAAM;CACxB;CAEA,OACE,kBAAC,OAAD;EAAK,WAAW,CAAC,mBAAmBiC,CAAS,CAAC,CAAC,OAAO,OAAO,CAAC,CAAC,KAAK,GAAG;EAAG,GAAIZ;EAC3E,UAAAvC,EAAM,OAAO,KAAK,MAAU;GAC3B,IAAM8B,IAAS,OAAO,OAAOgB,GAAS/C,EAAM,EAAE,IAAI+C,EAAQ/C,EAAM,MAAM,KAAA,GAChEqD,IAAWrD,EAAM,SAAS,WAAWA,EAAM,SAAS,aACpDsD,IAAQtD,EAAM,SAAS,aAAa,GAAGA,EAAM,MAAM,UAAUA,EAAM,OACnEc,IAAQyC,EAAOvD,EAAM,QAAQwD,KAAiBX,EAAQ,IAAI7C,EAAM,EAAE,IAAIgD,EAAWhD,EAAM,MAAM,KAAA;GACnG,OACE,kBAACyD,GAAD;IAA6B;IAAO,MAAMzD,EAAM;IAAa;IAAO,YAAYA,EAAM;IAAU,SAASqD;IACrG,WAAA,MAAkB,kBAAC5B,GAAD;KAAqB;KAAe;KAAQ,OAAOiC,EAAY1D,EAAM,OAAO,CAAC;KACnF;KAA2B;KAAe,WAAW,MAASiD,EAAOjD,EAAM,IAAImC,CAAI;IAAI,CAAA;GAChG,GAHKnC,EAAM,EAGX;EAEX,CAAC;CACE,CAAA;AAET"}
@@ -1,2 +0,0 @@
1
- const e=require("../components/Field/index.cjs"),t=require("../components/TextField/index.cjs"),n=require("./RichTextEditor-BxtlbjXj.cjs"),r=require("../components/EntryPicker/index.cjs"),i=require("../components/NumberField/index.cjs"),a=require("../components/Switch/index.cjs");let o=require("react"),s=require("react/jsx-runtime");var c=new Set([`shortText`,`longText`,`richText`,`number`,`boolean`,`dateTime`,`asset`,`reference`]);function l(e){let t=new Set;for(let n of e.fields){if(!n.id?.trim()||t.has(n.id))throw Error(`Content model field IDs must be nonempty and unique.`);if(!c.has(n.type))throw Error(`Unsupported content field type: ${n.type}`);t.add(n.id)}}function u(e){if(typeof e!=`string`)return;let t=/^(\d{4}-\d{2}-\d{2}T\d{2}:\d{2})(?::(\d{2})(?:\.(\d{1,3}))?)?(?:Z|\+00:00)$/.exec(e);if(!t)return;let n=`${t[1]}:${t[2]??`00`}.${(t[3]??``).padEnd(3,`0`)}Z`,r=new Date(n);if(Number.isFinite(r.getTime())&&r.toISOString()===n)return n}function d(e,t){return!!e&&typeof e==`object`&&t in e&&typeof e[t]==`string`&&e[t].trim().length>0}function f(e){return!!e.text?.trim()||e.type===`horizontalRule`||!!e.content?.some(f)}function p(e){return`${e.label} is required.`}function m(e,t){if(typeof t!=`string`)return`Enter text.`;if(e.required&&!t.trim())return p(e)}function h(e,t){let r=n.n(t);if(r)return r;if(e.required&&!f(t))return p(e)}function g(e,t){let n=e.type===`asset`?`assetId`:`entryId`;if(!(e.multiple?Array.isArray(t)&&t.every(e=>d(e,n)):d(t,n)))return e.multiple?`Choose a list of ${e.type===`asset`?`assets`:`entries`}.`:`Choose an ${e.type===`asset`?`asset`:`entry`}.`;if(e.required&&Array.isArray(t)&&t.length===0)return p(e)}var _={shortText:m,longText:m,richText:h,number:(e,t)=>typeof t==`number`&&Number.isFinite(t)?void 0:`Enter a finite number.`,boolean:(e,t)=>typeof t==`boolean`?void 0:`Choose a boolean value.`,dateTime:(e,t)=>u(t)?void 0:`Enter a valid UTC date and time.`,asset:g,reference:g};function v(e,t){return l(e),Object.fromEntries(e.fields.flatMap(e=>{let n=Object.hasOwn(t,e.id)?t[e.id]:void 0,r=n===void 0?e.required?p(e):void 0:_[e.type](e,n);return r?[[e.id,r]]:[]}))}function y(e,t){let n=e.type===`asset`?`assetId`:`entryId`;return(Array.isArray(t)?t:t===void 0?[]:[t]).flatMap(e=>{if(!e||typeof e!=`object`||!(n in e))return[];let t=e[n];return typeof t==`string`?[t]:[]})}function b(e,t){if(e.type===`asset`){let n=t.map(e=>({assetId:e}));return e.multiple?n:n[0]}let n=t.map(e=>({entryId:e}));return e.multiple?n:n[0]}function x({field:e,stored:o,items:c,isDisabled:l,accessibility:{required:d,...f},onChange:p}){switch(e.type){case`shortText`:case`longText`:{let n=e.type===`shortText`?t.TextField:t.TextArea;return(0,s.jsx)(n,{...f,required:d,disabled:l,placeholder:e.placeholder,value:typeof o==`string`?o:``,onChange:e=>p(e.target.value)})}case`number`:return(0,s.jsx)(i.NumberField,{...f,required:d,isDisabled:l,placeholder:e.placeholder,step:`any`,hasSteppers:!1,value:typeof o==`number`&&Number.isFinite(o)?o:``,onValueChange:e=>{(e===``||Number.isFinite(e))&&p(e===``?void 0:e)}});case`boolean`:return(0,s.jsx)(a.Switch,{...f,isDisabled:l,isSelected:o===!0,onSelectedChange:p});case`dateTime`:return(0,s.jsx)(t.TextField,{...f,required:d,disabled:l,type:`datetime-local`,step:`0.001`,value:u(o)?.slice(0,-1)??``,onChange:e=>p(u(`${e.target.value}Z`))});case`richText`:return(0,s.jsx)(n.t,{...f,label:e.label,isRequired:d,isDisabled:l,placeholder:e.placeholder,format:`json`,value:o===void 0?n.r:o,onChange:p});case`asset`:case`reference`:return(0,s.jsx)(`div`,{...f,role:`group`,children:(0,s.jsx)(r.EntryPicker,{items:c,value:y(e,o),label:e.type===`asset`?`Assets`:`Entries`,addLabel:`Choose ${e.label}`,mode:e.multiple?`multiple`:`single`,isDisabled:l,onValueChange:t=>p(b(e,t))})})}}function S({model:t,value:n,defaultValue:r={},onValueChange:i,pickerItems:a={},errors:c={},isDisabled:l=!1,showAllErrors:u=!1,className:d,...f}){let[p,m]=(0,o.useState)(r),[h,g]=(0,o.useState)(()=>new Set),_=n??p,y=v(t,_),b=(e,t)=>{if(l)return;let r={..._};t===void 0?delete r[e]:r[e]=t,n===void 0&&m(r),g(t=>new Set(t).add(e)),i?.(r)};return(0,s.jsx)(`div`,{className:[`ds-entry-editor`,d].filter(Boolean).join(` `),...f,children:t.fields.map(t=>{let n=Object.hasOwn(_,t.id)?_[t.id]:void 0,r=t.type===`asset`||t.type===`reference`,i=t.type===`dateTime`?`${t.label} (UTC)`:t.label,o=c[t.id]??(u||h.has(t.id)?y[t.id]:void 0);return(0,s.jsx)(e.Field,{label:i,hint:t.hint,error:o,isRequired:t.required,isGroup:r,children:e=>(0,s.jsx)(x,{field:t,stored:n,items:a[t.id]??[],isDisabled:l,accessibility:e,onChange:e=>b(t.id,e)})},t.id)})})}Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return v}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return S}});
2
- //# sourceMappingURL=EntryEditor-DIpc1iPF.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"EntryEditor-DIpc1iPF.cjs","names":["documentError","TextField","TextArea","NumberField","Switch","RichTextEditor","emptyDocument","EntryPicker","useState","Field","require_components_Field_index","require_components_TextField_index","require_RichTextEditor","require_components_EntryPicker_index","require_components_NumberField_index","require_components_Switch_index","react","react_jsx_runtime","fieldTypes","assertModel","ids","field","model","parseUtcDateTime","value","match","canonical","date","isLink","key","hasRichText","node","requiredError","textError","richTextError","error","linkError","item","validators","validateEntryValues","values","selectedIds","link","id","pickerValue","links","EntryControl","accessibility","Control","isDisabled","stored","onChange","event","next","required","EntryEditor","rest","internal","setInternal","defaultValue","changed","setChanged","current","validation","commit","previous","onValueChange","className","isPicker","label","errors","showAllErrors","pickerItems"],"sources":["../../src/components/EntryEditor/model.ts","../../src/components/EntryEditor/index.tsx"],"sourcesContent":["import type { JSONContent } from \"@tiptap/react\";\nimport { documentError } from \"../RichTextEditor/document\";\nimport type { RichTextDocument } from \"../RichTextEditor\";\n\ninterface ContentFieldBase {\n id: string;\n label: string;\n hint?: string;\n placeholder?: string;\n required?: boolean;\n}\n\nexport type ContentField = ContentFieldBase & (\n | { type: \"shortText\" | \"longText\" | \"richText\" | \"number\" | \"boolean\" | \"dateTime\"; multiple?: never }\n | { type: \"asset\" | \"reference\"; multiple?: boolean }\n);\n\nexport interface ContentModel {\n fields: readonly ContentField[];\n}\n\nexport interface AssetValue { assetId: string }\nexport interface ReferenceValue { entryId: string }\nexport type EntryFieldValue = string | number | boolean | RichTextDocument | AssetValue | ReferenceValue | AssetValue[] | ReferenceValue[];\nexport type EntryValues = Record<string, EntryFieldValue | undefined>;\nexport type EntryErrors = Partial<Record<string, string>>;\n\nconst fieldTypes = new Set([\"shortText\", \"longText\", \"richText\", \"number\", \"boolean\", \"dateTime\", \"asset\", \"reference\"]);\n\nfunction assertModel(model: ContentModel) {\n const ids = new Set<string>();\n for (const field of model.fields) {\n if (!field.id?.trim() || ids.has(field.id)) throw new Error(\"Content model field IDs must be nonempty and unique.\");\n if (!fieldTypes.has(field.type)) throw new Error(`Unsupported content field type: ${field.type}`);\n ids.add(field.id);\n }\n}\n\n/** Accept UTC ISO strings without rolling invalid dates into the next month. */\nexport function parseUtcDateTime(value: unknown): string | undefined {\n if (typeof value !== \"string\") return;\n const match = /^(\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2})(?::(\\d{2})(?:\\.(\\d{1,3}))?)?(?:Z|\\+00:00)$/.exec(value);\n if (!match) return;\n const canonical = `${match[1]}:${match[2] ?? \"00\"}.${(match[3] ?? \"\").padEnd(3, \"0\")}Z`;\n const date = new Date(canonical);\n if (Number.isFinite(date.getTime()) && date.toISOString() === canonical) return canonical;\n}\n\nfunction isLink(value: unknown, key: \"assetId\" | \"entryId\"): boolean {\n return !!value && typeof value === \"object\" && key in value &&\n typeof (value as Record<string, unknown>)[key] === \"string\" &&\n ((value as Record<string, string>)[key]).trim().length > 0;\n}\n\nfunction hasRichText(node: JSONContent): boolean {\n return !!node.text?.trim() || node.type === \"horizontalRule\" || !!node.content?.some(hasRichText);\n}\n\nfunction requiredError(field: ContentField): string {\n return `${field.label} is required.`;\n}\n\nfunction textError(field: ContentField, value: unknown): string | undefined {\n if (typeof value !== \"string\") return \"Enter text.\";\n if (field.required && !value.trim()) return requiredError(field);\n}\n\nfunction richTextError(field: ContentField, value: unknown): string | undefined {\n const error = documentError(value);\n if (error) return error;\n if (field.required && !hasRichText(value as RichTextDocument)) return requiredError(field);\n}\n\nfunction linkError(field: ContentField, value: unknown): string | undefined {\n const key = field.type === \"asset\" ? \"assetId\" : \"entryId\";\n const valid = field.multiple\n ? Array.isArray(value) && value.every((item) => isLink(item, key))\n : isLink(value, key);\n if (!valid) {\n return field.multiple\n ? `Choose a list of ${field.type === \"asset\" ? \"assets\" : \"entries\"}.`\n : `Choose an ${field.type === \"asset\" ? \"asset\" : \"entry\"}.`;\n }\n if (field.required && Array.isArray(value) && value.length === 0) return requiredError(field);\n}\n\nconst validators: Record<ContentField[\"type\"], (field: ContentField, value: unknown) => string | undefined> = {\n shortText: textError,\n longText: textError,\n richText: richTextError,\n number: (_field, value) => typeof value === \"number\" && Number.isFinite(value) ? undefined : \"Enter a finite number.\",\n boolean: (_field, value) => typeof value === \"boolean\" ? undefined : \"Choose a boolean value.\",\n dateTime: (_field, value) => parseUtcDateTime(value) ? undefined : \"Enter a valid UTC date and time.\",\n asset: linkError,\n reference: linkError,\n};\n\n/** Validate data loaded from JSON as well as values emitted by EntryEditor. */\nexport function validateEntryValues(model: ContentModel, values: Record<string, unknown>): EntryErrors {\n assertModel(model);\n return Object.fromEntries(model.fields.flatMap((field): [string, string][] => {\n const value = Object.hasOwn(values, field.id) ? values[field.id] : undefined;\n const error = value === undefined\n ? field.required ? requiredError(field) : undefined\n : validators[field.type](field, value);\n return error ? [[field.id, error]] : [];\n }));\n}\n","import { useState, type HTMLAttributes } from \"react\";\nimport { EntryPicker, type EntryItem } from \"../EntryPicker\";\nimport { Field, type FieldProps } from \"../Field\";\nimport { NumberField } from \"../NumberField\";\nimport { RichTextEditor, type RichTextDocument } from \"../RichTextEditor\";\nimport { emptyDocument } from \"../RichTextEditor/document\";\nimport { Switch } from \"../Switch\";\nimport { TextArea, TextField } from \"../TextField\";\nimport { parseUtcDateTime, validateEntryValues, type ContentField, type ContentModel, type EntryErrors, type EntryFieldValue, type EntryValues } from \"./model\";\nimport \"./style.css\";\n\nexport { validateEntryValues } from \"./model\";\nexport type { AssetValue, ContentField, ContentModel, EntryErrors, EntryFieldValue, EntryValues, ReferenceValue } from \"./model\";\n\nexport interface EntryEditorProps extends Omit<HTMLAttributes<HTMLDivElement>, \"defaultValue\" | \"onChange\"> {\n model: ContentModel;\n value?: EntryValues;\n defaultValue?: EntryValues;\n onValueChange?: (values: EntryValues) => void;\n /** Available assets or entries, keyed by content field ID. */\n pickerItems?: Record<string, EntryItem[]>;\n /** App-provided messages take precedence over built-in validation. */\n errors?: EntryErrors;\n isDisabled?: boolean;\n /** Reveal validation for untouched fields, for example after a submit attempt. */\n showAllErrors?: boolean;\n}\n\nfunction selectedIds(field: ContentField, value: EntryFieldValue | undefined): string[] {\n const key = field.type === \"asset\" ? \"assetId\" : \"entryId\";\n const links = Array.isArray(value) ? value : value === undefined ? [] : [value];\n return links.flatMap((link) => {\n if (!link || typeof link !== \"object\" || !(key in link)) return [];\n const id = (link as unknown as Record<string, unknown>)[key];\n return typeof id === \"string\" ? [id] : [];\n });\n}\n\nfunction pickerValue(field: ContentField, ids: string[]): EntryFieldValue | undefined {\n if (field.type === \"asset\") {\n const links = ids.map((assetId) => ({ assetId }));\n return field.multiple ? links : links[0];\n }\n const links = ids.map((entryId) => ({ entryId }));\n return field.multiple ? links : links[0];\n}\n\nfunction EntryControl({ field, stored, items, isDisabled, accessibility: { required, ...accessibility }, onChange }: {\n field: ContentField;\n stored: EntryFieldValue | undefined;\n items: EntryItem[];\n isDisabled: boolean;\n accessibility: Parameters<FieldProps[\"children\"]>[0];\n onChange: (value: EntryFieldValue | undefined) => void;\n}) {\n switch (field.type) {\n case \"shortText\":\n case \"longText\": {\n const Control = field.type === \"shortText\" ? TextField : TextArea;\n return <Control {...accessibility} required={required} disabled={isDisabled} placeholder={field.placeholder}\n value={typeof stored === \"string\" ? stored : \"\"} onChange={(event) => onChange(event.target.value)} />;\n }\n case \"number\":\n return <NumberField {...accessibility} required={required} isDisabled={isDisabled} placeholder={field.placeholder} step=\"any\"\n hasSteppers={false} value={typeof stored === \"number\" && Number.isFinite(stored) ? stored : \"\"}\n onValueChange={(next) => { if (next === \"\" || Number.isFinite(next)) onChange(next === \"\" ? undefined : next); }} />;\n case \"boolean\":\n return <Switch {...accessibility} isDisabled={isDisabled} isSelected={stored === true} onSelectedChange={onChange} />;\n case \"dateTime\":\n return <TextField {...accessibility} required={required} disabled={isDisabled} type=\"datetime-local\" step=\"0.001\"\n value={parseUtcDateTime(stored)?.slice(0, -1) ?? \"\"}\n onChange={(event) => onChange(parseUtcDateTime(`${event.target.value}Z`))} />;\n case \"richText\":\n return <RichTextEditor {...accessibility} label={field.label} isRequired={required} isDisabled={isDisabled}\n placeholder={field.placeholder} format=\"json\" value={stored === undefined ? emptyDocument : stored as RichTextDocument}\n onChange={onChange} />;\n case \"asset\":\n case \"reference\":\n return <div {...accessibility} role=\"group\">\n <EntryPicker items={items} value={selectedIds(field, stored)}\n label={field.type === \"asset\" ? \"Assets\" : \"Entries\"} addLabel={`Choose ${field.label}`}\n mode={field.multiple ? \"multiple\" : \"single\"} isDisabled={isDisabled}\n onValueChange={(ids) => onChange(pickerValue(field, ids))} />\n </div>;\n }\n}\n\n/** An ordered set of content inputs; submission and persistence belong to the app. */\nexport function EntryEditor({\n model,\n value,\n defaultValue = {},\n onValueChange,\n pickerItems = {},\n errors = {},\n isDisabled = false,\n showAllErrors = false,\n className,\n ...rest\n}: EntryEditorProps) {\n const [internal, setInternal] = useState<EntryValues>(defaultValue);\n const [changed, setChanged] = useState<Set<string>>(() => new Set());\n const current = value ?? internal;\n const validation = validateEntryValues(model, current);\n\n const commit = (id: string, next: EntryFieldValue | undefined) => {\n if (isDisabled) return;\n const values = { ...current };\n if (next === undefined) delete values[id];\n else values[id] = next;\n if (value === undefined) setInternal(values);\n setChanged((previous) => new Set(previous).add(id));\n onValueChange?.(values);\n };\n\n return (\n <div className={[\"ds-entry-editor\", className].filter(Boolean).join(\" \")} {...rest}>\n {model.fields.map((field) => {\n const stored = Object.hasOwn(current, field.id) ? current[field.id] : undefined;\n const isPicker = field.type === \"asset\" || field.type === \"reference\";\n const label = field.type === \"dateTime\" ? `${field.label} (UTC)` : field.label;\n const error = errors[field.id] ?? (showAllErrors || changed.has(field.id) ? validation[field.id] : undefined);\n return (\n <Field key={field.id} label={label} hint={field.hint} error={error} isRequired={field.required} isGroup={isPicker}>\n {(accessibility) => <EntryControl field={field} stored={stored} items={pickerItems[field.id] ?? []}\n isDisabled={isDisabled} accessibility={accessibility} onChange={(next) => commit(field.id, next)} />}\n </Field>\n );\n })}\n </div>\n );\n}\n"],"mappings":"A,+UA2BA,IAAMkB,EAAa,IAAI,IAAI,CAAC,YAAa,WAAY,WAAY,SAAU,UAAW,WAAY,QAAS,WAAW,CAAC,EAEvH,SAASC,EAAY,EAAqB,CACxC,IAAMC,EAAM,IAAI,IAChB,IAAK,IAAMC,KAASC,EAAM,OAAQ,CAChC,GAAI,CAACD,EAAM,IAAI,KAAK,GAAKD,EAAI,IAAIC,EAAM,EAAE,EAAG,MAAU,MAAM,sDAAsD,EAClH,GAAI,CAACH,EAAW,IAAIG,EAAM,IAAI,EAAG,MAAU,MAAM,mCAAmCA,EAAM,MAAM,EAChGD,EAAI,IAAIC,EAAM,EAAE,CAClB,CACF,CAGA,SAAgBE,EAAiB,EAAoC,CACnE,GAAI,OAAOC,GAAU,SAAU,OAC/B,IAAMC,EAAQ,8EAA8E,KAAKD,CAAK,EACtG,GAAI,CAACC,EAAO,OACZ,IAAMC,EAAY,GAAGD,EAAM,GAAG,GAAGA,EAAM,IAAM,KAAK,IAAIA,EAAM,IAAM,GAAA,CAAI,OAAO,EAAG,GAAG,EAAE,GAC/EE,EAAO,IAAI,KAAKD,CAAS,EAC/B,GAAI,OAAO,SAASC,EAAK,QAAQ,CAAC,GAAKA,EAAK,YAAY,IAAMD,EAAW,OAAOA,CAClF,CAEA,SAASE,EAAO,EAAgB,EAAqC,CACnE,MAAO,CAAC,CAACJ,GAAS,OAAOA,GAAU,UAAYK,KAAOL,GACpD,OAAQA,EAAkCK,IAAS,UAC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M4B,EAAS,OAAO,OAAOY,EAASzC,EAAM,EAAE,EAAIyC,EAAQzC,EAAM,IAAM,IAAA,GAChE+C,EAAW/C,EAAM,OAAS,SAAWA,EAAM,OAAS,YACpDgD,EAAQhD,EAAM,OAAS,WAAa,GAAGA,EAAM,MAAM,QAAUA,EAAM,MACnEc,EAAQmC,EAAOjD,EAAM,MAAQkD,GAAiBX,EAAQ,IAAIvC,EAAM,EAAE,EAAI0C,EAAW1C,EAAM,IAAM,IAAA,IACnG,OACE,EAAAJ,EAAA,IAAA,CAACR,EAAAA,MAAD,CAA6B,QAAO,KAAMY,EAAM,KAAa,QAAO,WAAYA,EAAM,SAAU,QAAS+C,EACrG,SAAA,IAAkB,EAAAnD,EAAA,IAAA,CAAC6B,EAAD,CAAqB,QAAe,SAAQ,MAAO0B,EAAYnD,EAAM,KAAO,CAAC,EACnF,aAA2B,gBAAe,SAAW,GAAS2C,EAAO3C,EAAM,GAAIgC,CAAI,CAAI,CAAA,CAChG,EAHKhC,EAAM,EAGX,CAEX,CAAC,CACE,CAAA,CAET,C"}
@@ -1,77 +0,0 @@
1
- import { forwardRef as e } from "react";
2
- import { AlertTriangle as t, Archive as n, ArrowLeft as r, ArrowRight as i, Bell as a, Bold as o, Calendar as ee, Check as s, ChevronDown as c, ChevronLeft as l, ChevronRight as u, ChevronUp as d, ChevronsLeft as f, ChevronsRight as p, Clock as m, Code as h, Copy as g, Download as _, Eye as v, FileText as y, Filter as b, FolderClosed as x, Globe as S, GripHorizontal as C, GripVertical as w, Heading2 as T, Heading3 as E, Home as D, Image as O, Info as k, Italic as A, LayoutGrid as te, Link as j, Link2Off as M, List as N, ListOrdered as P, Loader2 as F, Menu as I, Minus as L, MoreHorizontal as R, Pencil as z, Plus as B, Quote as V, Redo2 as H, RotateCcw as U, RotateCw as W, Search as G, Settings as K, Strikethrough as q, Trash2 as J, Undo2 as Y, Upload as X, User as Z, Users as Q, X as ne } from "lucide-react";
3
- import { jsx as re } from "react/jsx-runtime";
4
- //#region src/components/Icon/icons.ts
5
- var $ = {
6
- "alert-triangle": t,
7
- archive: n,
8
- bold: o,
9
- code: h,
10
- "heading-2": T,
11
- "heading-3": E,
12
- italic: A,
13
- "link-off": M,
14
- list: N,
15
- "list-ordered": P,
16
- quote: V,
17
- redo: H,
18
- strikethrough: q,
19
- undo: Y,
20
- "arrow-left": r,
21
- "arrow-right": i,
22
- calendar: ee,
23
- check: s,
24
- "chevron-down": c,
25
- "chevron-left": l,
26
- "chevron-up": d,
27
- minus: L,
28
- "chevron-right": u,
29
- clock: m,
30
- copy: g,
31
- download: _,
32
- eye: v,
33
- filter: b,
34
- bell: a,
35
- "chevrons-left": f,
36
- "chevrons-right": p,
37
- "file-text": y,
38
- folder: x,
39
- globe: S,
40
- home: D,
41
- "layout-grid": te,
42
- menu: I,
43
- users: Q,
44
- "grip-horizontal": C,
45
- "grip-vertical": w,
46
- image: O,
47
- info: k,
48
- link: j,
49
- spinner: F,
50
- "more-horizontal": R,
51
- pencil: z,
52
- plus: B,
53
- "rotate-ccw": U,
54
- "rotate-cw": W,
55
- search: G,
56
- settings: K,
57
- trash: J,
58
- upload: X,
59
- user: Z,
60
- x: ne
61
- }, ie = Object.keys($), ae = e(function({ name: e, size: t = 16, className: n, ...r }, i) {
62
- let a = $[e];
63
- return /* @__PURE__ */ re(a, {
64
- ref: i,
65
- width: t,
66
- height: t,
67
- className: ["ds-icon", n].filter(Boolean).join(" "),
68
- role: r["aria-label"] ? "img" : void 0,
69
- "aria-hidden": !r["aria-label"] || void 0,
70
- focusable: "false",
71
- ...r
72
- });
73
- });
74
- //#endregion
75
- export { ie as n, $ as r, ae as t };
76
-
77
- //# sourceMappingURL=Icon-CGY1FNXT.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Icon-CGY1FNXT.js","names":["icons","AlertTriangle","Archive","Bold","Code","Heading2","Heading3","Italic","Link2Off","List","ListOrdered","Quote","Redo2","Strikethrough","Undo2","ArrowLeft","ArrowRight","Calendar","Check","ChevronDown","ChevronLeft","ChevronUp","Minus","ChevronRight","Clock","Copy","Download","Eye","Filter","Bell","ChevronsLeft","ChevronsRight","FileText","FolderClosed","Globe","Home","LayoutGrid","Menu","Users","GripHorizontal","GripVertical","Image","Info","Link","Loader2","MoreHorizontal","Pencil","Plus","RotateCcw","RotateCw","Search","Settings","Trash2","Upload","User","X","iconNames","Icon","forwardRef","rest","Glyph","name","size","className"],"sources":["../../src/components/Icon/icons.ts","../../src/components/Icon/index.tsx"],"sourcesContent":["import {\n AlertTriangle,\n Bold,\n Code,\n Heading2,\n Heading3,\n Italic,\n Link2Off,\n List,\n ListOrdered,\n Quote,\n Redo2,\n Strikethrough,\n Undo2,\n Archive,\n ArrowLeft,\n ArrowRight,\n Calendar,\n Check,\n ChevronDown,\n ChevronLeft,\n ChevronUp,\n Minus,\n ChevronRight,\n Clock,\n Copy,\n Download,\n Eye,\n Filter,\n Bell,\n ChevronsLeft,\n ChevronsRight,\n FileText,\n FolderClosed,\n Globe,\n Home,\n LayoutGrid,\n Menu,\n Users,\n GripHorizontal,\n GripVertical,\n Image,\n Info,\n Link,\n Loader2,\n MoreHorizontal,\n Pencil,\n Plus,\n RotateCcw,\n RotateCw,\n Search,\n Settings,\n Trash2,\n Upload,\n User,\n X,\n} from \"lucide-react\";\n\n/**\n * The finite icon set. Adding a glyph means adding a line here — a visible\n * decision rather than an import someone typed at a call site.\n */\nexport const icons = {\n \"alert-triangle\": AlertTriangle,\n archive: Archive,\n bold: Bold,\n code: Code,\n \"heading-2\": Heading2,\n \"heading-3\": Heading3,\n italic: Italic,\n \"link-off\": Link2Off,\n list: List,\n \"list-ordered\": ListOrdered,\n quote: Quote,\n redo: Redo2,\n strikethrough: Strikethrough,\n undo: Undo2,\n \"arrow-left\": ArrowLeft,\n \"arrow-right\": ArrowRight,\n calendar: Calendar,\n check: Check,\n \"chevron-down\": ChevronDown,\n \"chevron-left\": ChevronLeft,\n \"chevron-up\": ChevronUp,\n minus: Minus,\n \"chevron-right\": ChevronRight,\n clock: Clock,\n copy: Copy,\n download: Download,\n eye: Eye,\n filter: Filter,\n bell: Bell,\n \"chevrons-left\": ChevronsLeft,\n \"chevrons-right\": ChevronsRight,\n \"file-text\": FileText,\n folder: FolderClosed,\n globe: Globe,\n home: Home,\n \"layout-grid\": LayoutGrid,\n menu: Menu,\n users: Users,\n \"grip-horizontal\": GripHorizontal,\n \"grip-vertical\": GripVertical,\n image: Image,\n info: Info,\n link: Link,\n spinner: Loader2,\n \"more-horizontal\": MoreHorizontal,\n pencil: Pencil,\n plus: Plus,\n \"rotate-ccw\": RotateCcw,\n \"rotate-cw\": RotateCw,\n search: Search,\n settings: Settings,\n trash: Trash2,\n upload: Upload,\n user: User,\n x: X,\n} as const;\n\nexport type IconName = keyof typeof icons;\n\nexport const iconNames = Object.keys(icons) as IconName[];\n","import { forwardRef, type SVGProps } from \"react\";\nimport { icons, type IconName } from \"./icons\";\nimport \"./style.css\";\n\nexport type IconSize = 16 | 20 | 24;\n\nexport interface IconProps extends Omit<SVGProps<SVGSVGElement>, \"ref\"> {\n /** Glyph name from the curated set in `icons.ts`. */\n name: IconName;\n /** 16 inside controls, 20 standalone, 24 for empty states. No other sizes. */\n size?: IconSize;\n}\n\n/**\n * A glyph that clarifies an action or a status. Inherits `currentColor`, so it\n * takes its colour from the control it sits in — it never carries its own.\n */\nexport const Icon = forwardRef<SVGSVGElement, IconProps>(function Icon(\n { name, size = 16, className, ...rest },\n ref,\n) {\n const Glyph = icons[name];\n return (\n <Glyph\n ref={ref}\n width={size}\n height={size}\n className={[\"ds-icon\", className].filter(Boolean).join(\" \")}\n role={rest[\"aria-label\"] ? \"img\" : undefined}\n aria-hidden={rest[\"aria-label\"] ? undefined : true}\n focusable=\"false\"\n {...rest}\n />\n );\n});\n"],"mappings":";;;;AA8DA,IAAaA,IAAQ;CACnB,kBAAkBC;CAClB,SAASC;CACT,MAAMC;CACN,MAAMC;CACN,aAAaC;CACb,aAAaC;CACb,QAAQC;CACR,YAAYC;CACZ,MAAMC;CACN,gBAAgBC;CAChB,OAAOC;CACP,MAAMC;CACN,eAAeC;CACf,MAAMC;CACN,cAAcC;CACd,eAAeC;CACf,UAAUC;CACV,OAAOC;CACP,gBAAgBC;CAChB,gBAAgBC;CAChB,cAAcC;CACd,OAAOC;CACP,iBAAiBC;CACjB,OAAOC;CACP,MAAMC;CACN,UAAUC;CACV,KAAKC;CACL,QAAQC;CACR,MAAMC;CACN,iBAAiBC;CACjB,kBAAkBC;CAClB,aAAaC;CACb,QAAQC;CACR,OAAOC;CACP,MAAMC;CACN,eAAeC;CACf,MAAMC;CACN,OAAOC;CACP,mBAAmBC;CACnB,iBAAiBC;CACjB,OAAOC;CACP,MAAMC;CACN,MAAMC;CACN,SAASC;CACT,mBAAmBC;CACnB,QAAQC;CACR,MAAMC;CACN,cAAcC;CACd,aAAaC;CACb,QAAQC;CACR,UAAUC;CACV,OAAOC;CACP,QAAQC;CACR,MAAMC;CACN,GAAGC;AACL,GAIaC,KAAY,OAAO,KAAKxD,CAAK,GCzG7ByD,KAAOC,EAAqC,SACvD,EAAE,SAAM,UAAO,IAAI,cAAW,GAAGC,KACjC,GACA;CACA,IAAMC,IAAQ5D,EAAM6D;CACpB,OACE,mBAACD,GAAD;EACO;EACL,OAAOE;EACP,QAAQA;EACR,WAAW,CAAC,WAAWC,CAAS,CAAC,CAAC,OAAO,OAAO,CAAC,CAAC,KAAK,GAAG;EAC1D,MAAMJ,EAAK,gBAAgB,QAAQ,KAAA;EACnC,eAAa,GAAK,iBAAgB,KAAA;EAClC,WAAU;EACV,GAAIA;CACL,CAAA;AAEL,CAAC"}
@@ -1,2 +0,0 @@
1
- let e=require("react"),t=require("lucide-react"),n=require("react/jsx-runtime");var r={"alert-triangle":t.AlertTriangle,archive:t.Archive,bold:t.Bold,code:t.Code,"heading-2":t.Heading2,"heading-3":t.Heading3,italic:t.Italic,"link-off":t.Link2Off,list:t.List,"list-ordered":t.ListOrdered,quote:t.Quote,redo:t.Redo2,strikethrough:t.Strikethrough,undo:t.Undo2,"arrow-left":t.ArrowLeft,"arrow-right":t.ArrowRight,calendar:t.Calendar,check:t.Check,"chevron-down":t.ChevronDown,"chevron-left":t.ChevronLeft,"chevron-up":t.ChevronUp,minus:t.Minus,"chevron-right":t.ChevronRight,clock:t.Clock,copy:t.Copy,download:t.Download,eye:t.Eye,filter:t.Filter,bell:t.Bell,"chevrons-left":t.ChevronsLeft,"chevrons-right":t.ChevronsRight,"file-text":t.FileText,folder:t.FolderClosed,globe:t.Globe,home:t.Home,"layout-grid":t.LayoutGrid,menu:t.Menu,users:t.Users,"grip-horizontal":t.GripHorizontal,"grip-vertical":t.GripVertical,image:t.Image,info:t.Info,link:t.Link,spinner:t.Loader2,"more-horizontal":t.MoreHorizontal,pencil:t.Pencil,plus:t.Plus,"rotate-ccw":t.RotateCcw,"rotate-cw":t.RotateCw,search:t.Search,settings:t.Settings,trash:t.Trash2,upload:t.Upload,user:t.User,x:t.X},i=Object.keys(r),a=(0,e.forwardRef)(function({name:e,size:t=16,className:i,...a},o){let s=r[e];return(0,n.jsx)(s,{ref:o,width:t,height:t,className:[`ds-icon`,i].filter(Boolean).join(` `),role:a[`aria-label`]?`img`:void 0,"aria-hidden":!a[`aria-label`]||void 0,focusable:`false`,...a})});Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return i}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return r}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return a}});
2
- //# sourceMappingURL=Icon-CWsA1W83.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Icon-CWsA1W83.cjs","names":["AlertTriangle","Archive","Bold","Code","Heading2","Heading3","Italic","Link2Off","List","ListOrdered","Quote","Redo2","Strikethrough","Undo2","ArrowLeft","ArrowRight","Calendar","Check","ChevronDown","ChevronLeft","ChevronUp","Minus","ChevronRight","Clock","Copy","Download","Eye","Filter","Bell","ChevronsLeft","ChevronsRight","FileText","FolderClosed","Globe","Home","LayoutGrid","Menu","Users","GripHorizontal","GripVertical","Image","Info","Link","Loader2","MoreHorizontal","Pencil","Plus","RotateCcw","RotateCw","Search","Settings","Trash2","Upload","User","X","forwardRef","react","lucide_react","react_jsx_runtime","icons","iconNames","Icon","rest","Glyph","name","size","className"],"sources":["../../src/components/Icon/icons.ts","../../src/components/Icon/index.tsx"],"sourcesContent":["import {\n AlertTriangle,\n Bold,\n Code,\n Heading2,\n Heading3,\n Italic,\n Link2Off,\n List,\n ListOrdered,\n Quote,\n Redo2,\n Strikethrough,\n Undo2,\n Archive,\n ArrowLeft,\n ArrowRight,\n Calendar,\n Check,\n ChevronDown,\n ChevronLeft,\n ChevronUp,\n Minus,\n ChevronRight,\n Clock,\n Copy,\n Download,\n Eye,\n Filter,\n Bell,\n ChevronsLeft,\n ChevronsRight,\n FileText,\n FolderClosed,\n Globe,\n Home,\n LayoutGrid,\n Menu,\n Users,\n GripHorizontal,\n GripVertical,\n Image,\n Info,\n Link,\n Loader2,\n MoreHorizontal,\n Pencil,\n Plus,\n RotateCcw,\n RotateCw,\n Search,\n Settings,\n Trash2,\n Upload,\n User,\n X,\n} from \"lucide-react\";\n\n/**\n * The finite icon set. Adding a glyph means adding a line here — a visible\n * decision rather than an import someone typed at a call site.\n */\nexport const icons = {\n \"alert-triangle\": AlertTriangle,\n archive: Archive,\n bold: Bold,\n code: Code,\n \"heading-2\": Heading2,\n \"heading-3\": Heading3,\n italic: Italic,\n \"link-off\": Link2Off,\n list: List,\n \"list-ordered\": ListOrdered,\n quote: Quote,\n redo: Redo2,\n strikethrough: Strikethrough,\n undo: Undo2,\n \"arrow-left\": ArrowLeft,\n \"arrow-right\": ArrowRight,\n calendar: Calendar,\n check: Check,\n \"chevron-down\": ChevronDown,\n \"chevron-left\": ChevronLeft,\n \"chevron-up\": ChevronUp,\n minus: Minus,\n \"chevron-right\": ChevronRight,\n clock: Clock,\n copy: Copy,\n download: Download,\n eye: Eye,\n filter: Filter,\n bell: Bell,\n \"chevrons-left\": ChevronsLeft,\n \"chevrons-right\": ChevronsRight,\n \"file-text\": FileText,\n folder: FolderClosed,\n globe: Globe,\n home: Home,\n \"layout-grid\": LayoutGrid,\n menu: Menu,\n users: Users,\n \"grip-horizontal\": GripHorizontal,\n \"grip-vertical\": GripVertical,\n image: Image,\n info: Info,\n link: Link,\n spinner: Loader2,\n \"more-horizontal\": MoreHorizontal,\n pencil: Pencil,\n plus: Plus,\n \"rotate-ccw\": RotateCcw,\n \"rotate-cw\": RotateCw,\n search: Search,\n settings: Settings,\n trash: Trash2,\n upload: Upload,\n user: User,\n x: X,\n} as const;\n\nexport type IconName = keyof typeof icons;\n\nexport const iconNames = Object.keys(icons) as IconName[];\n","import { forwardRef, type SVGProps } from \"react\";\nimport { icons, type IconName } from \"./icons\";\nimport \"./style.css\";\n\nexport type IconSize = 16 | 20 | 24;\n\nexport interface IconProps extends Omit<SVGProps<SVGSVGElement>, \"ref\"> {\n /** Glyph name from the curated set in `icons.ts`. */\n name: IconName;\n /** 16 inside controls, 20 standalone, 24 for empty states. No other sizes. */\n size?: IconSize;\n}\n\n/**\n * A glyph that clarifies an action or a status. Inherits `currentColor`, so it\n * takes its colour from the control it sits in — it never carries its own.\n */\nexport const Icon = forwardRef<SVGSVGElement, IconProps>(function Icon(\n { name, size = 16, className, ...rest },\n ref,\n) {\n const Glyph = icons[name];\n return (\n <Glyph\n ref={ref}\n width={size}\n height={size}\n className={[\"ds-icon\", className].filter(Boolean).join(\" \")}\n role={rest[\"aria-label\"] ? \"img\" : undefined}\n aria-hidden={rest[\"aria-label\"] ? undefined : true}\n focusable=\"false\"\n {...rest}\n />\n );\n});\n"],"mappings":"A,gFA8DA,IAAa2D,EAAQ,CACnB,iBAAkB3D,EAAAA,cAClB,QAASC,EAAAA,QACT,KAAMC,EAAAA,KACN,KAAMC,EAAAA,KACN,YAAaC,EAAAA,SACb,YAAaC,EAAAA,SACb,OAAQC,EAAAA,OACR,WAAYC,EAAAA,SACZ,KAAMC,EAAAA,KACN,eAAgBC,E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cAAgB,MAAQ,IAAA,GACnC,cAAa,GAAK,eAAgB,IAAA,GAClC,UAAU,QACV,GAAIA,CACL,CAAA,CAEL,CAAC,E"}
@@ -1 +0,0 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require("../Field/index.cjs"),require("../TextField/index.cjs"),require("../EntryPicker/index.cjs"),require("../NumberField/index.cjs"),require("../Switch/index.cjs");const e=require("../../chunks/EntryEditor-DIpc1iPF.cjs");exports.EntryEditor=e.t,exports.validateEntryValues=e.n;
@@ -1,21 +0,0 @@
1
- import { type HTMLAttributes } from "react";
2
- import { type EntryItem } from "../EntryPicker/index.cjs";
3
- import { type ContentModel, type EntryErrors, type EntryValues } from "./model.cjs";
4
- export { validateEntryValues } from "./model.cjs";
5
- export type { AssetValue, ContentField, ContentModel, EntryErrors, EntryFieldValue, EntryValues, ReferenceValue } from "./model.cjs";
6
- export interface EntryEditorProps extends Omit<HTMLAttributes<HTMLDivElement>, "defaultValue" | "onChange"> {
7
- model: ContentModel;
8
- value?: EntryValues;
9
- defaultValue?: EntryValues;
10
- onValueChange?: (values: EntryValues) => void;
11
- /** Available assets or entries, keyed by content field ID. */
12
- pickerItems?: Record<string, EntryItem[]>;
13
- /** App-provided messages take precedence over built-in validation. */
14
- errors?: EntryErrors;
15
- isDisabled?: boolean;
16
- /** Reveal validation for untouched fields, for example after a submit attempt. */
17
- showAllErrors?: boolean;
18
- }
19
- /** An ordered set of content inputs; submission and persistence belong to the app. */
20
- export declare function EntryEditor({ model, value, defaultValue, onValueChange, pickerItems, errors, isDisabled, showAllErrors, className, ...rest }: EntryEditorProps): import("react").JSX.Element;
21
- //# sourceMappingURL=index.d.cts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../../../src/components/EntryEditor/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAY,KAAK,cAAc,EAAE,MAAM,OAAO,CAAC;AACtD,OAAO,EAAe,KAAK,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAO7D,OAAO,EAA4D,KAAK,YAAY,EAAE,KAAK,WAAW,EAAwB,KAAK,WAAW,EAAE,MAAM,SAAS,CAAC;AAChK,OAAO,aAAa,CAAC;AAErB,OAAO,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAC9C,YAAY,EAAE,UAAU,EAAE,YAAY,EAAE,YAAY,EAAE,WAAW,EAAE,eAAe,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAEjI,MAAM,WAAW,gBAAiB,SAAQ,IAAI,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC;IACzG,KAAK,EAAE,YAAY,CAAC;IACpB,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB,YAAY,CAAC,EAAE,WAAW,CAAC;IAC3B,aAAa,CAAC,EAAE,CAAC,MAAM,EAAE,WAAW,KAAK,IAAI,CAAC;IAC9C,8DAA8D;IAC9D,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,EAAE,CAAC,CAAC;IAC1C,sEAAsE;IACtE,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,kFAAkF;IAClF,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AA6DD,sFAAsF;AACtF,wBAAgB,WAAW,CAAC,EAC1B,KAAK,EACL,KAAK,EACL,YAAiB,EACjB,aAAa,EACb,WAAgB,EAChB,MAAW,EACX,UAAkB,EAClB,aAAqB,EACrB,SAAS,EACT,GAAG,IAAI,EACR,EAAE,gBAAgB,+BAgClB"}
@@ -1,21 +0,0 @@
1
- import { type HTMLAttributes } from "react";
2
- import { type EntryItem } from "../EntryPicker/index.js";
3
- import { type ContentModel, type EntryErrors, type EntryValues } from "./model.js";
4
- export { validateEntryValues } from "./model.js";
5
- export type { AssetValue, ContentField, ContentModel, EntryErrors, EntryFieldValue, EntryValues, ReferenceValue } from "./model.js";
6
- export interface EntryEditorProps extends Omit<HTMLAttributes<HTMLDivElement>, "defaultValue" | "onChange"> {
7
- model: ContentModel;
8
- value?: EntryValues;
9
- defaultValue?: EntryValues;
10
- onValueChange?: (values: EntryValues) => void;
11
- /** Available assets or entries, keyed by content field ID. */
12
- pickerItems?: Record<string, EntryItem[]>;
13
- /** App-provided messages take precedence over built-in validation. */
14
- errors?: EntryErrors;
15
- isDisabled?: boolean;
16
- /** Reveal validation for untouched fields, for example after a submit attempt. */
17
- showAllErrors?: boolean;
18
- }
19
- /** An ordered set of content inputs; submission and persistence belong to the app. */
20
- export declare function EntryEditor({ model, value, defaultValue, onValueChange, pickerItems, errors, isDisabled, showAllErrors, className, ...rest }: EntryEditorProps): import("react").JSX.Element;
21
- //# sourceMappingURL=index.d.ts.map