@coveord/plasma-mantine 56.18.0 → 56.20.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 (218) hide show
  1. package/.turbo/turbo-build.log +4 -4
  2. package/.turbo/turbo-test.log +113 -113
  3. package/dist/.tsbuildinfo +1 -1
  4. package/dist/cjs/components/Checkbox/Checkbox.d.ts.map +1 -1
  5. package/dist/cjs/components/Checkbox/Checkbox.js +1 -0
  6. package/dist/cjs/components/Checkbox/Checkbox.js.map +1 -1
  7. package/dist/cjs/components/CodeEditor/CodeEditor.d.ts.map +1 -1
  8. package/dist/cjs/components/CodeEditor/CodeEditor.js +2 -1
  9. package/dist/cjs/components/CodeEditor/CodeEditor.js.map +1 -1
  10. package/dist/cjs/components/Collection/Collection.d.ts +75 -12
  11. package/dist/cjs/components/Collection/Collection.d.ts.map +1 -1
  12. package/dist/cjs/components/Collection/Collection.js +94 -38
  13. package/dist/cjs/components/Collection/Collection.js.map +1 -1
  14. package/dist/cjs/components/Collection/Collection.module.css +13 -1
  15. package/dist/cjs/components/Collection/CollectionAddButton.d.ts +25 -0
  16. package/dist/cjs/components/Collection/CollectionAddButton.d.ts.map +1 -0
  17. package/dist/cjs/components/Collection/CollectionAddButton.js +33 -0
  18. package/dist/cjs/components/Collection/CollectionAddButton.js.map +1 -0
  19. package/dist/cjs/components/Collection/CollectionColumn.types.d.ts +72 -0
  20. package/dist/cjs/components/Collection/CollectionColumn.types.d.ts.map +1 -0
  21. package/dist/cjs/components/Collection/CollectionColumn.types.js +6 -0
  22. package/dist/cjs/components/Collection/CollectionColumn.types.js.map +1 -0
  23. package/dist/cjs/components/Collection/CollectionContext.d.ts +5 -0
  24. package/dist/cjs/components/Collection/CollectionContext.d.ts.map +1 -1
  25. package/dist/cjs/components/Collection/CollectionContext.js.map +1 -1
  26. package/dist/cjs/components/Collection/CollectionItem.d.ts +2 -2
  27. package/dist/cjs/components/Collection/CollectionItem.d.ts.map +1 -1
  28. package/dist/cjs/components/Collection/CollectionItem.js +18 -38
  29. package/dist/cjs/components/Collection/CollectionItem.js.map +1 -1
  30. package/dist/cjs/components/Collection/layouts/CollectionLayout.types.d.ts +46 -0
  31. package/dist/cjs/components/Collection/layouts/CollectionLayout.types.d.ts.map +1 -0
  32. package/dist/cjs/components/Collection/layouts/CollectionLayout.types.js +6 -0
  33. package/dist/cjs/components/Collection/layouts/CollectionLayout.types.js.map +1 -0
  34. package/dist/cjs/components/Collection/layouts/CollectionLayouts.d.ts +26 -0
  35. package/dist/cjs/components/Collection/layouts/CollectionLayouts.d.ts.map +1 -0
  36. package/dist/cjs/components/Collection/layouts/CollectionLayouts.js +29 -0
  37. package/dist/cjs/components/Collection/layouts/CollectionLayouts.js.map +1 -0
  38. package/dist/cjs/components/Collection/layouts/horizontal-layout/HorizontalLayout.d.ts +12 -0
  39. package/dist/cjs/components/Collection/layouts/horizontal-layout/HorizontalLayout.d.ts.map +1 -0
  40. package/dist/cjs/components/Collection/layouts/horizontal-layout/HorizontalLayout.js +24 -0
  41. package/dist/cjs/components/Collection/layouts/horizontal-layout/HorizontalLayout.js.map +1 -0
  42. package/dist/cjs/components/Collection/layouts/horizontal-layout/HorizontalLayout.module.css +37 -0
  43. package/dist/cjs/components/Collection/layouts/horizontal-layout/HorizontalLayoutBody.d.ts +6 -0
  44. package/dist/cjs/components/Collection/layouts/horizontal-layout/HorizontalLayoutBody.d.ts.map +1 -0
  45. package/dist/cjs/components/Collection/layouts/horizontal-layout/HorizontalLayoutBody.js +78 -0
  46. package/dist/cjs/components/Collection/layouts/horizontal-layout/HorizontalLayoutBody.js.map +1 -0
  47. package/dist/cjs/components/Collection/layouts/horizontal-layout/HorizontalLayoutHeader.d.ts +6 -0
  48. package/dist/cjs/components/Collection/layouts/horizontal-layout/HorizontalLayoutHeader.d.ts.map +1 -0
  49. package/dist/cjs/components/Collection/layouts/horizontal-layout/HorizontalLayoutHeader.js +56 -0
  50. package/dist/cjs/components/Collection/layouts/horizontal-layout/HorizontalLayoutHeader.js.map +1 -0
  51. package/dist/cjs/components/Collection/layouts/shared/DragHandle.d.ts +12 -0
  52. package/dist/cjs/components/Collection/layouts/shared/DragHandle.d.ts.map +1 -0
  53. package/dist/cjs/components/Collection/layouts/shared/DragHandle.js +28 -0
  54. package/dist/cjs/components/Collection/layouts/shared/DragHandle.js.map +1 -0
  55. package/dist/cjs/components/Collection/layouts/shared/RemoveButton.d.ts +11 -0
  56. package/dist/cjs/components/Collection/layouts/shared/RemoveButton.d.ts.map +1 -0
  57. package/dist/cjs/components/Collection/layouts/shared/RemoveButton.js +39 -0
  58. package/dist/cjs/components/Collection/layouts/shared/RemoveButton.js.map +1 -0
  59. package/dist/cjs/components/Collection/layouts/shared/columnUtils.d.ts +8 -0
  60. package/dist/cjs/components/Collection/layouts/shared/columnUtils.d.ts.map +1 -0
  61. package/dist/cjs/components/Collection/layouts/shared/columnUtils.js +24 -0
  62. package/dist/cjs/components/Collection/layouts/shared/columnUtils.js.map +1 -0
  63. package/dist/cjs/components/Collection/layouts/shared/headerUtils.d.ts +8 -0
  64. package/dist/cjs/components/Collection/layouts/shared/headerUtils.d.ts.map +1 -0
  65. package/dist/cjs/components/Collection/layouts/shared/headerUtils.js +21 -0
  66. package/dist/cjs/components/Collection/layouts/shared/headerUtils.js.map +1 -0
  67. package/dist/cjs/components/Collection/layouts/shared/itemRenderer.d.ts +78 -0
  68. package/dist/cjs/components/Collection/layouts/shared/itemRenderer.d.ts.map +1 -0
  69. package/dist/cjs/components/Collection/layouts/shared/itemRenderer.js +160 -0
  70. package/dist/cjs/components/Collection/layouts/shared/itemRenderer.js.map +1 -0
  71. package/dist/cjs/components/Collection/layouts/shared/layoutConstants.d.ts +38 -0
  72. package/dist/cjs/components/Collection/layouts/shared/layoutConstants.d.ts.map +1 -0
  73. package/dist/cjs/components/Collection/layouts/shared/layoutConstants.js +31 -0
  74. package/dist/cjs/components/Collection/layouts/shared/layoutConstants.js.map +1 -0
  75. package/dist/cjs/components/Collection/layouts/vertical-layout/VerticalLayout.d.ts +12 -0
  76. package/dist/cjs/components/Collection/layouts/vertical-layout/VerticalLayout.d.ts.map +1 -0
  77. package/dist/cjs/components/Collection/layouts/vertical-layout/VerticalLayout.js +24 -0
  78. package/dist/cjs/components/Collection/layouts/vertical-layout/VerticalLayout.js.map +1 -0
  79. package/dist/cjs/components/Collection/layouts/vertical-layout/VerticalLayout.module.css +35 -0
  80. package/dist/cjs/components/Collection/layouts/vertical-layout/VerticalLayoutBody.d.ts +6 -0
  81. package/dist/cjs/components/Collection/layouts/vertical-layout/VerticalLayoutBody.d.ts.map +1 -0
  82. package/dist/cjs/components/Collection/layouts/vertical-layout/VerticalLayoutBody.js +134 -0
  83. package/dist/cjs/components/Collection/layouts/vertical-layout/VerticalLayoutBody.js.map +1 -0
  84. package/dist/cjs/components/Collection/layouts/vertical-layout/VerticalLayoutHeader.d.ts +10 -0
  85. package/dist/cjs/components/Collection/layouts/vertical-layout/VerticalLayoutHeader.d.ts.map +1 -0
  86. package/dist/cjs/components/Collection/layouts/vertical-layout/VerticalLayoutHeader.js +15 -0
  87. package/dist/cjs/components/Collection/layouts/vertical-layout/VerticalLayoutHeader.js.map +1 -0
  88. package/dist/cjs/components/CopyToClipboard/CopyToClipboard.js +1 -0
  89. package/dist/cjs/components/CopyToClipboard/CopyToClipboard.js.map +1 -1
  90. package/dist/cjs/hooks/useParentHeight.d.ts.map +1 -1
  91. package/dist/cjs/hooks/useParentHeight.js +6 -4
  92. package/dist/cjs/hooks/useParentHeight.js.map +1 -1
  93. package/dist/cjs/index.d.ts +2 -0
  94. package/dist/cjs/index.d.ts.map +1 -1
  95. package/dist/cjs/index.js.map +1 -1
  96. package/dist/esm/components/Checkbox/Checkbox.d.ts.map +1 -1
  97. package/dist/esm/components/Checkbox/Checkbox.js +1 -0
  98. package/dist/esm/components/Checkbox/Checkbox.js.map +1 -1
  99. package/dist/esm/components/CodeEditor/CodeEditor.d.ts.map +1 -1
  100. package/dist/esm/components/CodeEditor/CodeEditor.js +2 -1
  101. package/dist/esm/components/CodeEditor/CodeEditor.js.map +1 -1
  102. package/dist/esm/components/Collection/Collection.d.ts +75 -12
  103. package/dist/esm/components/Collection/Collection.d.ts.map +1 -1
  104. package/dist/esm/components/Collection/Collection.js +87 -32
  105. package/dist/esm/components/Collection/Collection.js.map +1 -1
  106. package/dist/esm/components/Collection/Collection.module.css +13 -1
  107. package/dist/esm/components/Collection/CollectionAddButton.d.ts +25 -0
  108. package/dist/esm/components/Collection/CollectionAddButton.d.ts.map +1 -0
  109. package/dist/esm/components/Collection/CollectionAddButton.js +19 -0
  110. package/dist/esm/components/Collection/CollectionAddButton.js.map +1 -0
  111. package/dist/esm/components/Collection/CollectionColumn.types.d.ts +72 -0
  112. package/dist/esm/components/Collection/CollectionColumn.types.d.ts.map +1 -0
  113. package/dist/esm/components/Collection/CollectionColumn.types.js +5 -0
  114. package/dist/esm/components/Collection/CollectionColumn.types.js.map +1 -0
  115. package/dist/esm/components/Collection/CollectionContext.d.ts +5 -0
  116. package/dist/esm/components/Collection/CollectionContext.d.ts.map +1 -1
  117. package/dist/esm/components/Collection/CollectionContext.js.map +1 -1
  118. package/dist/esm/components/Collection/CollectionItem.d.ts +2 -2
  119. package/dist/esm/components/Collection/CollectionItem.d.ts.map +1 -1
  120. package/dist/esm/components/Collection/CollectionItem.js +15 -34
  121. package/dist/esm/components/Collection/CollectionItem.js.map +1 -1
  122. package/dist/esm/components/Collection/layouts/CollectionLayout.types.d.ts +46 -0
  123. package/dist/esm/components/Collection/layouts/CollectionLayout.types.d.ts.map +1 -0
  124. package/dist/esm/components/Collection/layouts/CollectionLayout.types.js +6 -0
  125. package/dist/esm/components/Collection/layouts/CollectionLayout.types.js.map +1 -0
  126. package/dist/esm/components/Collection/layouts/CollectionLayouts.d.ts +26 -0
  127. package/dist/esm/components/Collection/layouts/CollectionLayouts.d.ts.map +1 -0
  128. package/dist/esm/components/Collection/layouts/CollectionLayouts.js +10 -0
  129. package/dist/esm/components/Collection/layouts/CollectionLayouts.js.map +1 -0
  130. package/dist/esm/components/Collection/layouts/horizontal-layout/HorizontalLayout.d.ts +12 -0
  131. package/dist/esm/components/Collection/layouts/horizontal-layout/HorizontalLayout.d.ts.map +1 -0
  132. package/dist/esm/components/Collection/layouts/horizontal-layout/HorizontalLayout.js +11 -0
  133. package/dist/esm/components/Collection/layouts/horizontal-layout/HorizontalLayout.js.map +1 -0
  134. package/dist/esm/components/Collection/layouts/horizontal-layout/HorizontalLayout.module.css +37 -0
  135. package/dist/esm/components/Collection/layouts/horizontal-layout/HorizontalLayoutBody.d.ts +6 -0
  136. package/dist/esm/components/Collection/layouts/horizontal-layout/HorizontalLayoutBody.d.ts.map +1 -0
  137. package/dist/esm/components/Collection/layouts/horizontal-layout/HorizontalLayoutBody.js +49 -0
  138. package/dist/esm/components/Collection/layouts/horizontal-layout/HorizontalLayoutBody.js.map +1 -0
  139. package/dist/esm/components/Collection/layouts/horizontal-layout/HorizontalLayoutHeader.d.ts +6 -0
  140. package/dist/esm/components/Collection/layouts/horizontal-layout/HorizontalLayoutHeader.d.ts.map +1 -0
  141. package/dist/esm/components/Collection/layouts/horizontal-layout/HorizontalLayoutHeader.js +36 -0
  142. package/dist/esm/components/Collection/layouts/horizontal-layout/HorizontalLayoutHeader.js.map +1 -0
  143. package/dist/esm/components/Collection/layouts/shared/DragHandle.d.ts +12 -0
  144. package/dist/esm/components/Collection/layouts/shared/DragHandle.d.ts.map +1 -0
  145. package/dist/esm/components/Collection/layouts/shared/DragHandle.js +20 -0
  146. package/dist/esm/components/Collection/layouts/shared/DragHandle.js.map +1 -0
  147. package/dist/esm/components/Collection/layouts/shared/RemoveButton.d.ts +11 -0
  148. package/dist/esm/components/Collection/layouts/shared/RemoveButton.d.ts.map +1 -0
  149. package/dist/esm/components/Collection/layouts/shared/RemoveButton.js +30 -0
  150. package/dist/esm/components/Collection/layouts/shared/RemoveButton.js.map +1 -0
  151. package/dist/esm/components/Collection/layouts/shared/columnUtils.d.ts +8 -0
  152. package/dist/esm/components/Collection/layouts/shared/columnUtils.d.ts.map +1 -0
  153. package/dist/esm/components/Collection/layouts/shared/columnUtils.js +17 -0
  154. package/dist/esm/components/Collection/layouts/shared/columnUtils.js.map +1 -0
  155. package/dist/esm/components/Collection/layouts/shared/headerUtils.d.ts +8 -0
  156. package/dist/esm/components/Collection/layouts/shared/headerUtils.d.ts.map +1 -0
  157. package/dist/esm/components/Collection/layouts/shared/headerUtils.js +14 -0
  158. package/dist/esm/components/Collection/layouts/shared/headerUtils.js.map +1 -0
  159. package/dist/esm/components/Collection/layouts/shared/itemRenderer.d.ts +78 -0
  160. package/dist/esm/components/Collection/layouts/shared/itemRenderer.d.ts.map +1 -0
  161. package/dist/esm/components/Collection/layouts/shared/itemRenderer.js +150 -0
  162. package/dist/esm/components/Collection/layouts/shared/itemRenderer.js.map +1 -0
  163. package/dist/esm/components/Collection/layouts/shared/layoutConstants.d.ts +38 -0
  164. package/dist/esm/components/Collection/layouts/shared/layoutConstants.d.ts.map +1 -0
  165. package/dist/esm/components/Collection/layouts/shared/layoutConstants.js +18 -0
  166. package/dist/esm/components/Collection/layouts/shared/layoutConstants.js.map +1 -0
  167. package/dist/esm/components/Collection/layouts/vertical-layout/VerticalLayout.d.ts +12 -0
  168. package/dist/esm/components/Collection/layouts/vertical-layout/VerticalLayout.d.ts.map +1 -0
  169. package/dist/esm/components/Collection/layouts/vertical-layout/VerticalLayout.js +11 -0
  170. package/dist/esm/components/Collection/layouts/vertical-layout/VerticalLayout.js.map +1 -0
  171. package/dist/esm/components/Collection/layouts/vertical-layout/VerticalLayout.module.css +35 -0
  172. package/dist/esm/components/Collection/layouts/vertical-layout/VerticalLayoutBody.d.ts +6 -0
  173. package/dist/esm/components/Collection/layouts/vertical-layout/VerticalLayoutBody.d.ts.map +1 -0
  174. package/dist/esm/components/Collection/layouts/vertical-layout/VerticalLayoutBody.js +103 -0
  175. package/dist/esm/components/Collection/layouts/vertical-layout/VerticalLayoutBody.js.map +1 -0
  176. package/dist/esm/components/Collection/layouts/vertical-layout/VerticalLayoutHeader.d.ts +10 -0
  177. package/dist/esm/components/Collection/layouts/vertical-layout/VerticalLayoutHeader.d.ts.map +1 -0
  178. package/dist/esm/components/Collection/layouts/vertical-layout/VerticalLayoutHeader.js +6 -0
  179. package/dist/esm/components/Collection/layouts/vertical-layout/VerticalLayoutHeader.js.map +1 -0
  180. package/dist/esm/components/CopyToClipboard/CopyToClipboard.js +1 -0
  181. package/dist/esm/components/CopyToClipboard/CopyToClipboard.js.map +1 -1
  182. package/dist/esm/hooks/useParentHeight.d.ts.map +1 -1
  183. package/dist/esm/hooks/useParentHeight.js +5 -4
  184. package/dist/esm/hooks/useParentHeight.js.map +1 -1
  185. package/dist/esm/index.d.ts +2 -0
  186. package/dist/esm/index.d.ts.map +1 -1
  187. package/dist/esm/index.js.map +1 -1
  188. package/package.json +3 -3
  189. package/src/components/Checkbox/Checkbox.ts +1 -0
  190. package/src/components/CodeEditor/CodeEditor.tsx +2 -8
  191. package/src/components/CodeEditor/__tests__/CodeEditor.spec.tsx +18 -0
  192. package/src/components/Collection/Collection.module.css +13 -1
  193. package/src/components/Collection/Collection.tsx +149 -50
  194. package/src/components/Collection/CollectionAddButton.tsx +42 -0
  195. package/src/components/Collection/CollectionColumn.types.ts +79 -0
  196. package/src/components/Collection/CollectionContext.ts +5 -0
  197. package/src/components/Collection/CollectionItem.tsx +10 -21
  198. package/src/components/Collection/__tests__/CollectionWithColumns.spec.tsx +560 -0
  199. package/src/components/Collection/layouts/CollectionLayout.types.ts +56 -0
  200. package/src/components/Collection/layouts/CollectionLayouts.tsx +15 -0
  201. package/src/components/Collection/layouts/horizontal-layout/HorizontalLayout.module.css +37 -0
  202. package/src/components/Collection/layouts/horizontal-layout/HorizontalLayout.tsx +9 -0
  203. package/src/components/Collection/layouts/horizontal-layout/HorizontalLayoutBody.tsx +68 -0
  204. package/src/components/Collection/layouts/horizontal-layout/HorizontalLayoutHeader.tsx +33 -0
  205. package/src/components/Collection/layouts/shared/DragHandle.tsx +22 -0
  206. package/src/components/Collection/layouts/shared/RemoveButton.tsx +30 -0
  207. package/src/components/Collection/layouts/shared/columnUtils.ts +20 -0
  208. package/src/components/Collection/layouts/shared/headerUtils.ts +14 -0
  209. package/src/components/Collection/layouts/shared/itemRenderer.tsx +242 -0
  210. package/src/components/Collection/layouts/shared/layoutConstants.ts +51 -0
  211. package/src/components/Collection/layouts/vertical-layout/VerticalLayout.module.css +35 -0
  212. package/src/components/Collection/layouts/vertical-layout/VerticalLayout.tsx +9 -0
  213. package/src/components/Collection/layouts/vertical-layout/VerticalLayoutBody.tsx +120 -0
  214. package/src/components/Collection/layouts/vertical-layout/VerticalLayoutHeader.tsx +8 -0
  215. package/src/components/CopyToClipboard/CopyToClipboard.tsx +2 -0
  216. package/src/hooks/__tests__/useParentHeight.spec.tsx +150 -0
  217. package/src/hooks/useParentHeight.ts +6 -3
  218. package/src/index.ts +11 -0
@@ -0,0 +1,72 @@
1
+ import { ReactNode } from 'react';
2
+ /**
3
+ * Context provided to header render functions
4
+ */
5
+ export interface CollectionHeaderContext {
6
+ /** Column index */
7
+ index: number;
8
+ }
9
+ /**
10
+ * Context provided to cell render functions.
11
+ *
12
+ * Use `context.disabled` and `context.readOnly` to pass the collection's state to your form inputs:
13
+ * @example
14
+ * ```tsx
15
+ * cell: (item, index, context) => (
16
+ * <TextInput
17
+ * {...form.getInputProps(`items.${index}.name`)}
18
+ * disabled={context.disabled}
19
+ * readOnly={context.readOnly}
20
+ * />
21
+ * )
22
+ * ```
23
+ */
24
+ export interface CollectionCellContext<T = unknown> {
25
+ /** Whether the item can be removed */
26
+ removable?: boolean;
27
+ /** Whether the collection is draggable */
28
+ draggable?: boolean;
29
+ /**
30
+ * Whether the collection is disabled.
31
+ * Pass this to your form inputs: `disabled={context.disabled}`
32
+ */
33
+ disabled?: boolean;
34
+ /**
35
+ * Whether the collection is read-only.
36
+ * Pass this to your form inputs: `readOnly={context.readOnly}`
37
+ */
38
+ readOnly?: boolean;
39
+ /** Callback to remove the item */
40
+ onRemove?: () => void;
41
+ }
42
+ /**
43
+ * Column definition for Collection component
44
+ */
45
+ export interface CollectionColumnDef<T = unknown> {
46
+ /**
47
+ * Column header content
48
+ * Can be a ReactNode or a function that receives header context
49
+ */
50
+ header?: ReactNode | ((context: CollectionHeaderContext) => ReactNode);
51
+ /**
52
+ * Cell render function
53
+ * @param item The current item's data
54
+ * @param index The current item's index
55
+ * @param context Additional context for rendering
56
+ */
57
+ cell: (item: T, index: number, context: CollectionCellContext<T>) => ReactNode;
58
+ /**
59
+ * Minimum column size
60
+ */
61
+ minSize?: string | number;
62
+ /**
63
+ * Maximum column size
64
+ */
65
+ maxSize?: string | number;
66
+ /**
67
+ * Unique identifier for the column
68
+ * Auto-generated if not provided
69
+ */
70
+ id?: string;
71
+ }
72
+ //# sourceMappingURL=CollectionColumn.types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CollectionColumn.types.d.ts","sourceRoot":"","sources":["../../../../src/components/Collection/CollectionColumn.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAC,MAAM,OAAO,CAAC;AAEhC;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACpC,mBAAmB;IACnB,KAAK,EAAE,MAAM,CAAC;CACjB;AAED;;;;;;;;;;;;;;GAcG;AAEH,MAAM,WAAW,qBAAqB,CAAC,CAAC,GAAG,OAAO;IAC9C,sCAAsC;IACtC,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,0CAA0C;IAC1C,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,kCAAkC;IAClC,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;CACzB;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB,CAAC,CAAC,GAAG,OAAO;IAC5C;;;OAGG;IACH,MAAM,CAAC,EAAE,SAAS,GAAG,CAAC,CAAC,OAAO,EAAE,uBAAuB,KAAK,SAAS,CAAC,CAAC;IAEvE;;;;;OAKG;IACH,IAAI,EAAE,CAAC,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,qBAAqB,CAAC,CAAC,CAAC,KAAK,SAAS,CAAC;IAE/E;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAE1B;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAE1B;;;OAGG;IACH,EAAE,CAAC,EAAE,MAAM,CAAC;CACf"}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Column definition for Collection component
3
+ */ export { };
4
+
5
+ //# sourceMappingURL=CollectionColumn.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/components/Collection/CollectionColumn.types.ts"],"sourcesContent":["import {ReactNode} from 'react';\n\n/**\n * Context provided to header render functions\n */\nexport interface CollectionHeaderContext {\n /** Column index */\n index: number;\n}\n\n/**\n * Context provided to cell render functions.\n *\n * Use `context.disabled` and `context.readOnly` to pass the collection's state to your form inputs:\n * @example\n * ```tsx\n * cell: (item, index, context) => (\n * <TextInput\n * {...form.getInputProps(`items.${index}.name`)}\n * disabled={context.disabled}\n * readOnly={context.readOnly}\n * />\n * )\n * ```\n */\n// eslint-disable-next-line unused-imports/no-unused-vars\nexport interface CollectionCellContext<T = unknown> {\n /** Whether the item can be removed */\n removable?: boolean;\n /** Whether the collection is draggable */\n draggable?: boolean;\n /**\n * Whether the collection is disabled.\n * Pass this to your form inputs: `disabled={context.disabled}`\n */\n disabled?: boolean;\n /**\n * Whether the collection is read-only.\n * Pass this to your form inputs: `readOnly={context.readOnly}`\n */\n readOnly?: boolean;\n /** Callback to remove the item */\n onRemove?: () => void;\n}\n\n/**\n * Column definition for Collection component\n */\nexport interface CollectionColumnDef<T = unknown> {\n /**\n * Column header content\n * Can be a ReactNode or a function that receives header context\n */\n header?: ReactNode | ((context: CollectionHeaderContext) => ReactNode);\n\n /**\n * Cell render function\n * @param item The current item's data\n * @param index The current item's index\n * @param context Additional context for rendering\n */\n cell: (item: T, index: number, context: CollectionCellContext<T>) => ReactNode;\n\n /**\n * Minimum column size\n */\n minSize?: string | number;\n\n /**\n * Maximum column size\n */\n maxSize?: string | number;\n\n /**\n * Unique identifier for the column\n * Auto-generated if not provided\n */\n id?: string;\n}\n"],"names":[],"mappings":"AA6CA;;CAEC,GACD,WA8BC"}
@@ -1,7 +1,12 @@
1
1
  import { type GetStylesApi } from '@mantine/core';
2
2
  import type { CollectionFactory } from './Collection.js';
3
+ import type { CollectionColumnDef } from './CollectionColumn.types.js';
3
4
  interface CollectionContextType {
4
5
  getStyles: GetStylesApi<CollectionFactory>;
6
+ /**
7
+ * Column definitions for the collection (only present when using column-based layout)
8
+ */
9
+ columns?: Array<CollectionColumnDef<unknown>>;
5
10
  }
6
11
  export declare const CollectionProvider: ({ children, value }: {
7
12
  value: CollectionContextType;
@@ -1 +1 @@
1
- {"version":3,"file":"CollectionContext.d.ts","sourceRoot":"","sources":["../../../../src/components/Collection/CollectionContext.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,KAAK,YAAY,EAAC,MAAM,eAAe,CAAC;AACnE,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,iBAAiB,CAAC;AAEvD,UAAU,qBAAqB;IAC3B,SAAS,EAAE,YAAY,CAAC,iBAAiB,CAAC,CAAC;CAC9C;AAED,eAAO,MAAO,kBAAkB;;;+CAAE,oBAAoB,6BAErD,CAAC"}
1
+ {"version":3,"file":"CollectionContext.d.ts","sourceRoot":"","sources":["../../../../src/components/Collection/CollectionContext.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,KAAK,YAAY,EAAC,MAAM,eAAe,CAAC;AACnE,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,iBAAiB,CAAC;AACvD,OAAO,KAAK,EAAC,mBAAmB,EAAC,MAAM,6BAA6B,CAAC;AAErE,UAAU,qBAAqB;IAC3B,SAAS,EAAE,YAAY,CAAC,iBAAiB,CAAC,CAAC;IAC3C;;OAEG;IACH,OAAO,CAAC,EAAE,KAAK,CAAC,mBAAmB,CAAC,OAAO,CAAC,CAAC,CAAC;CACjD;AAED,eAAO,MAAO,kBAAkB;;;+CAAE,oBAAoB,6BAErD,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/Collection/CollectionContext.ts"],"sourcesContent":["import {createSafeContext, type GetStylesApi} from '@mantine/core';\nimport type {CollectionFactory} from './Collection.js';\n\ninterface CollectionContextType {\n getStyles: GetStylesApi<CollectionFactory>;\n}\n\nexport const [CollectionProvider, useCollectionContext] = createSafeContext<CollectionContextType>(\n 'Collection component was not found in tree',\n);\n"],"names":["createSafeContext","CollectionProvider","useCollectionContext"],"mappings":"AAAA,SAAQA,iBAAiB,QAA0B,gBAAgB;AAOnE,OAAO,MAAM,CAACC,oBAAoBC,qBAAqB,GAAGF,kBACtD,8CACF"}
1
+ {"version":3,"sources":["../../../../src/components/Collection/CollectionContext.ts"],"sourcesContent":["import {createSafeContext, type GetStylesApi} from '@mantine/core';\nimport type {CollectionFactory} from './Collection.js';\nimport type {CollectionColumnDef} from './CollectionColumn.types.js';\n\ninterface CollectionContextType {\n getStyles: GetStylesApi<CollectionFactory>;\n /**\n * Column definitions for the collection (only present when using column-based layout)\n */\n columns?: Array<CollectionColumnDef<unknown>>;\n}\n\nexport const [CollectionProvider, useCollectionContext] = createSafeContext<CollectionContextType>(\n 'Collection component was not found in tree',\n);\n"],"names":["createSafeContext","CollectionProvider","useCollectionContext"],"mappings":"AAAA,SAAQA,iBAAiB,QAA0B,gBAAgB;AAYnE,OAAO,MAAM,CAACC,oBAAoBC,qBAAqB,GAAGF,kBACtD,8CACF"}
@@ -1,12 +1,12 @@
1
1
  import { GroupProps } from '@mantine/core';
2
- import { FunctionComponent, PropsWithChildren } from 'react';
2
+ import { FunctionComponent, type MouseEventHandler, PropsWithChildren } from 'react';
3
3
  interface CollectionItemProps extends CollectionItemSharedProps {
4
4
  draggable?: boolean;
5
5
  disabled: boolean;
6
6
  }
7
7
  interface CollectionItemSharedProps extends GroupProps {
8
8
  id: string;
9
- onRemove?: React.MouseEventHandler<HTMLButtonElement>;
9
+ onRemove?: MouseEventHandler<HTMLButtonElement>;
10
10
  removable?: boolean;
11
11
  }
12
12
  export declare const CollectionItem: FunctionComponent<PropsWithChildren<CollectionItemProps>>;
@@ -1 +1 @@
1
- {"version":3,"file":"CollectionItem.d.ts","sourceRoot":"","sources":["../../../../src/components/Collection/CollectionItem.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAQ,UAAU,EAAW,MAAM,eAAe,CAAC;AAC1D,OAAO,EAAC,iBAAiB,EAAE,iBAAiB,EAAC,MAAM,OAAO,CAAC;AAK3D,UAAU,mBAAoB,SAAQ,yBAAyB;IAC3D,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,QAAQ,EAAE,OAAO,CAAC;CACrB;AAED,UAAU,yBAA0B,SAAQ,UAAU;IAClD,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,CAAC,EAAE,KAAK,CAAC,iBAAiB,CAAC,iBAAiB,CAAC,CAAC;IACtD,SAAS,CAAC,EAAE,OAAO,CAAC;CACvB;AAoHD,eAAO,MAAM,cAAc,EAAE,iBAAiB,CAAC,iBAAiB,CAAC,mBAAmB,CAAC,CAYpF,CAAC"}
1
+ {"version":3,"file":"CollectionItem.d.ts","sourceRoot":"","sources":["../../../../src/components/Collection/CollectionItem.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAQ,UAAU,EAAW,MAAM,eAAe,CAAC;AAC1D,OAAO,EAAC,iBAAiB,EAAE,KAAK,iBAAiB,EAAE,iBAAiB,EAAC,MAAM,OAAO,CAAC;AAMnF,UAAU,mBAAoB,SAAQ,yBAAyB;IAC3D,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,QAAQ,EAAE,OAAO,CAAC;CACrB;AAED,UAAU,yBAA0B,SAAQ,UAAU;IAClD,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,CAAC,EAAE,iBAAiB,CAAC,iBAAiB,CAAC,CAAC;IAChD,SAAS,CAAC,EAAE,OAAO,CAAC;CACvB;AAyGD,eAAO,MAAM,cAAc,EAAE,iBAAiB,CAAC,iBAAiB,CAAC,mBAAmB,CAAC,CAYpF,CAAC"}
@@ -1,36 +1,18 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { DragAndDropSize24Px, IconTrash } from '@coveord/plasma-react-icons';
3
2
  import { useSortable } from '@dnd-kit/sortable';
4
3
  import { CSS } from '@dnd-kit/utilities';
5
4
  import { Group, useProps } from '@mantine/core';
6
- import { ActionIcon } from '../ActionIcon/ActionIcon.js';
7
5
  import { useCollectionContext } from './CollectionContext.js';
6
+ import { DragHandle } from './layouts/shared/DragHandle.js';
7
+ import { RemoveButton } from './layouts/shared/RemoveButton.js';
8
8
  const defaultProps = {
9
9
  removable: true,
10
10
  gap: 'sm'
11
11
  };
12
- const RemoveButton = ({ onClick })=>/*#__PURE__*/ _jsx(ActionIcon.Quaternary, {
13
- style: {
14
- alignSelf: 'center'
15
- },
16
- onClick: onClick,
17
- children: /*#__PURE__*/ _jsx(IconTrash, {
18
- "aria-label": "Remove",
19
- size: 16
20
- })
21
- });
22
- const RemoveButtonPlaceholder = ()=>/*#__PURE__*/ _jsx("div", {
23
- style: {
24
- width: 28
25
- }
26
- });
27
12
  const StaticCollectionItem = (props)=>{
28
13
  const { children, removable, onRemove, id, // Style props
29
14
  style, className, classNames, styles, ...others } = useProps('CollectionItem', defaultProps, props);
30
15
  const ctx = useCollectionContext();
31
- const removeButton = removable && onRemove ? /*#__PURE__*/ _jsx(RemoveButton, {
32
- onClick: onRemove
33
- }) : /*#__PURE__*/ _jsx(RemoveButtonPlaceholder, {});
34
16
  return /*#__PURE__*/ _jsxs(Group, {
35
17
  "data-testid": `item-${id}`,
36
18
  ...ctx.getStyles('item', {
@@ -42,13 +24,16 @@ const StaticCollectionItem = (props)=>{
42
24
  ...others,
43
25
  children: [
44
26
  children,
45
- removeButton
27
+ /*#__PURE__*/ _jsx(RemoveButton, {
28
+ removable: removable,
29
+ onRemove: onRemove
30
+ })
46
31
  ]
47
32
  });
48
33
  };
49
34
  const DisabledCollectionItem = (props)=>{
50
35
  const ctx = useCollectionContext();
51
- const { children, id, // Style props
36
+ const { children, id, removable: _removable, onRemove: _onRemove, // Style props
52
37
  style, className, classNames, styles, ...others } = useProps('CollectionItem', defaultProps, props);
53
38
  return /*#__PURE__*/ _jsx(Group, {
54
39
  "data-testid": `item-${id}`,
@@ -66,9 +51,6 @@ const DraggableCollectionItem = (props)=>{
66
51
  const ctx = useCollectionContext();
67
52
  const { children, removable, onRemove, id, // Style props
68
53
  className, classNames, styles, ...others } = useProps('CollectionItem', defaultProps, props);
69
- const removeButton = removable && onRemove ? /*#__PURE__*/ _jsx(RemoveButton, {
70
- onClick: onRemove
71
- }) : null;
72
54
  const { attributes, listeners, setNodeRef, transform, transition, isDragging, setActivatorNodeRef } = useSortable({
73
55
  id
74
56
  });
@@ -87,17 +69,16 @@ const DraggableCollectionItem = (props)=>{
87
69
  "data-isdragging": isDragging,
88
70
  ...others,
89
71
  children: [
90
- /*#__PURE__*/ _jsx("div", {
91
- ref: setActivatorNodeRef,
92
- ...listeners,
93
- ...attributes,
94
- ...ctx.getStyles('dragHandle'),
95
- children: /*#__PURE__*/ _jsx(DragAndDropSize24Px, {
96
- height: 16
97
- })
72
+ /*#__PURE__*/ _jsx(DragHandle, {
73
+ setActivatorNodeRef: setActivatorNodeRef,
74
+ listeners: listeners,
75
+ attributes: attributes
98
76
  }),
99
77
  children,
100
- removeButton
78
+ /*#__PURE__*/ _jsx(RemoveButton, {
79
+ removable: removable,
80
+ onRemove: onRemove
81
+ })
101
82
  ]
102
83
  });
103
84
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/Collection/CollectionItem.tsx"],"sourcesContent":["import {DragAndDropSize24Px, IconTrash} from '@coveord/plasma-react-icons';\nimport {useSortable} from '@dnd-kit/sortable';\nimport {CSS} from '@dnd-kit/utilities';\nimport {Group, GroupProps, useProps} from '@mantine/core';\nimport {FunctionComponent, PropsWithChildren} from 'react';\n\nimport {ActionIcon} from '../ActionIcon/ActionIcon.js';\nimport {useCollectionContext} from './CollectionContext.js';\n\ninterface CollectionItemProps extends CollectionItemSharedProps {\n draggable?: boolean;\n disabled: boolean;\n}\n\ninterface CollectionItemSharedProps extends GroupProps {\n id: string;\n onRemove?: React.MouseEventHandler<HTMLButtonElement>;\n removable?: boolean;\n}\n\nconst defaultProps: Partial<CollectionItemSharedProps> = {\n removable: true,\n gap: 'sm',\n};\n\nconst RemoveButton: FunctionComponent<{\n onClick: React.MouseEventHandler<HTMLButtonElement>;\n}> = ({onClick}) => (\n <ActionIcon.Quaternary style={{alignSelf: 'center'}} onClick={onClick}>\n <IconTrash aria-label=\"Remove\" size={16} />\n </ActionIcon.Quaternary>\n);\n\nconst RemoveButtonPlaceholder = () => <div style={{width: 28}} />;\n\nconst StaticCollectionItem: FunctionComponent<PropsWithChildren<CollectionItemSharedProps>> = (props) => {\n const {\n children,\n removable,\n onRemove,\n id,\n\n // Style props\n style,\n className,\n classNames,\n styles,\n ...others\n } = useProps('CollectionItem', defaultProps, props);\n const ctx = useCollectionContext();\n const removeButton = removable && onRemove ? <RemoveButton onClick={onRemove} /> : <RemoveButtonPlaceholder />;\n\n return (\n <Group\n data-testid={`item-${id}`}\n {...ctx.getStyles('item', {style, className, classNames, styles})}\n {...others}\n >\n {children}\n {removeButton}\n </Group>\n );\n};\n\nconst DisabledCollectionItem: FunctionComponent<PropsWithChildren<CollectionItemSharedProps>> = (props) => {\n const ctx = useCollectionContext();\n const {\n children,\n id,\n\n // Style props\n style,\n className,\n classNames,\n styles,\n ...others\n } = useProps('CollectionItem', defaultProps, props);\n return (\n <Group\n data-testid={`item-${id}`}\n {...ctx.getStyles('item', {style, className, classNames, styles})}\n {...others}\n >\n {children}\n </Group>\n );\n};\n\nconst DraggableCollectionItem: FunctionComponent<PropsWithChildren<CollectionItemSharedProps>> = (props) => {\n const ctx = useCollectionContext();\n const {\n children,\n removable,\n onRemove,\n id,\n\n // Style props\n className,\n classNames,\n styles,\n ...others\n } = useProps('CollectionItem', defaultProps, props);\n const removeButton = removable && onRemove ? <RemoveButton onClick={onRemove} /> : null;\n const {attributes, listeners, setNodeRef, transform, transition, isDragging, setActivatorNodeRef} = useSortable({\n id,\n });\n\n return (\n <Group\n data-testid={`item-${id}`}\n ref={setNodeRef}\n {...ctx.getStyles('item', {\n style: transform\n ? {\n transform: CSS.Transform.toString(transform),\n transition,\n }\n : undefined,\n className,\n classNames,\n styles,\n })}\n data-isdragging={isDragging}\n {...others}\n >\n <div ref={setActivatorNodeRef} {...listeners} {...attributes} {...ctx.getStyles('dragHandle')}>\n <DragAndDropSize24Px height={16} />\n </div>\n {children}\n {removeButton}\n </Group>\n );\n};\n\nexport const CollectionItem: FunctionComponent<PropsWithChildren<CollectionItemProps>> = ({\n draggable,\n disabled,\n ...otherProps\n}) => {\n if (disabled) {\n return <DisabledCollectionItem {...otherProps} />;\n }\n if (draggable) {\n return <DraggableCollectionItem {...otherProps} />;\n }\n return <StaticCollectionItem {...otherProps} />;\n};\n"],"names":["DragAndDropSize24Px","IconTrash","useSortable","CSS","Group","useProps","ActionIcon","useCollectionContext","defaultProps","removable","gap","RemoveButton","onClick","Quaternary","style","alignSelf","aria-label","size","RemoveButtonPlaceholder","div","width","StaticCollectionItem","props","children","onRemove","id","className","classNames","styles","others","ctx","removeButton","data-testid","getStyles","DisabledCollectionItem","DraggableCollectionItem","attributes","listeners","setNodeRef","transform","transition","isDragging","setActivatorNodeRef","ref","Transform","toString","undefined","data-isdragging","height","CollectionItem","draggable","disabled","otherProps"],"mappings":";AAAA,SAAQA,mBAAmB,EAAEC,SAAS,QAAO,8BAA8B;AAC3E,SAAQC,WAAW,QAAO,oBAAoB;AAC9C,SAAQC,GAAG,QAAO,qBAAqB;AACvC,SAAQC,KAAK,EAAcC,QAAQ,QAAO,gBAAgB;AAG1D,SAAQC,UAAU,QAAO,8BAA8B;AACvD,SAAQC,oBAAoB,QAAO,yBAAyB;AAa5D,MAAMC,eAAmD;IACrDC,WAAW;IACXC,KAAK;AACT;AAEA,MAAMC,eAED,CAAC,EAACC,OAAO,EAAC,iBACX,KAACN,WAAWO,UAAU;QAACC,OAAO;YAACC,WAAW;QAAQ;QAAGH,SAASA;kBAC1D,cAAA,KAACX;YAAUe,cAAW;YAASC,MAAM;;;AAI7C,MAAMC,0BAA0B,kBAAM,KAACC;QAAIL,OAAO;YAACM,OAAO;QAAE;;AAE5D,MAAMC,uBAAwF,CAACC;IAC3F,MAAM,EACFC,QAAQ,EACRd,SAAS,EACTe,QAAQ,EACRC,EAAE,EAEF,cAAc;IACdX,KAAK,EACLY,SAAS,EACTC,UAAU,EACVC,MAAM,EACN,GAAGC,QACN,GAAGxB,SAAS,kBAAkBG,cAAcc;IAC7C,MAAMQ,MAAMvB;IACZ,MAAMwB,eAAetB,aAAae,yBAAW,KAACb;QAAaC,SAASY;uBAAe,KAACN;IAEpF,qBACI,MAACd;QACG4B,eAAa,CAAC,KAAK,EAAEP,IAAI;QACxB,GAAGK,IAAIG,SAAS,CAAC,QAAQ;YAACnB;YAAOY;YAAWC;YAAYC;QAAM,EAAE;QAChE,GAAGC,MAAM;;YAETN;YACAQ;;;AAGb;AAEA,MAAMG,yBAA0F,CAACZ;IAC7F,MAAMQ,MAAMvB;IACZ,MAAM,EACFgB,QAAQ,EACRE,EAAE,EAEF,cAAc;IACdX,KAAK,EACLY,SAAS,EACTC,UAAU,EACVC,MAAM,EACN,GAAGC,QACN,GAAGxB,SAAS,kBAAkBG,cAAcc;IAC7C,qBACI,KAAClB;QACG4B,eAAa,CAAC,KAAK,EAAEP,IAAI;QACxB,GAAGK,IAAIG,SAAS,CAAC,QAAQ;YAACnB;YAAOY;YAAWC;YAAYC;QAAM,EAAE;QAChE,GAAGC,MAAM;kBAETN;;AAGb;AAEA,MAAMY,0BAA2F,CAACb;IAC9F,MAAMQ,MAAMvB;IACZ,MAAM,EACFgB,QAAQ,EACRd,SAAS,EACTe,QAAQ,EACRC,EAAE,EAEF,cAAc;IACdC,SAAS,EACTC,UAAU,EACVC,MAAM,EACN,GAAGC,QACN,GAAGxB,SAAS,kBAAkBG,cAAcc;IAC7C,MAAMS,eAAetB,aAAae,yBAAW,KAACb;QAAaC,SAASY;SAAe;IACnF,MAAM,EAACY,UAAU,EAAEC,SAAS,EAAEC,UAAU,EAAEC,SAAS,EAAEC,UAAU,EAAEC,UAAU,EAAEC,mBAAmB,EAAC,GAAGxC,YAAY;QAC5GuB;IACJ;IAEA,qBACI,MAACrB;QACG4B,eAAa,CAAC,KAAK,EAAEP,IAAI;QACzBkB,KAAKL;QACJ,GAAGR,IAAIG,SAAS,CAAC,QAAQ;YACtBnB,OAAOyB,YACD;gBACIA,WAAWpC,IAAIyC,SAAS,CAACC,QAAQ,CAACN;gBAClCC;YACJ,IACAM;YACNpB;YACAC;YACAC;QACJ,EAAE;QACFmB,mBAAiBN;QAChB,GAAGZ,MAAM;;0BAEV,KAACV;gBAAIwB,KAAKD;gBAAsB,GAAGL,SAAS;gBAAG,GAAGD,UAAU;gBAAG,GAAGN,IAAIG,SAAS,CAAC,aAAa;0BACzF,cAAA,KAACjC;oBAAoBgD,QAAQ;;;YAEhCzB;YACAQ;;;AAGb;AAEA,OAAO,MAAMkB,iBAA4E,CAAC,EACtFC,SAAS,EACTC,QAAQ,EACR,GAAGC,YACN;IACG,IAAID,UAAU;QACV,qBAAO,KAACjB;YAAwB,GAAGkB,UAAU;;IACjD;IACA,IAAIF,WAAW;QACX,qBAAO,KAACf;YAAyB,GAAGiB,UAAU;;IAClD;IACA,qBAAO,KAAC/B;QAAsB,GAAG+B,UAAU;;AAC/C,EAAE"}
1
+ {"version":3,"sources":["../../../../src/components/Collection/CollectionItem.tsx"],"sourcesContent":["import {useSortable} from '@dnd-kit/sortable';\nimport {CSS} from '@dnd-kit/utilities';\nimport {Group, GroupProps, useProps} from '@mantine/core';\nimport {FunctionComponent, type MouseEventHandler, PropsWithChildren} from 'react';\n\nimport {useCollectionContext} from './CollectionContext.js';\nimport {DragHandle} from './layouts/shared/DragHandle.js';\nimport {RemoveButton} from './layouts/shared/RemoveButton.js';\n\ninterface CollectionItemProps extends CollectionItemSharedProps {\n draggable?: boolean;\n disabled: boolean;\n}\n\ninterface CollectionItemSharedProps extends GroupProps {\n id: string;\n onRemove?: MouseEventHandler<HTMLButtonElement>;\n removable?: boolean;\n}\n\nconst defaultProps: Partial<CollectionItemSharedProps> = {\n removable: true,\n gap: 'sm',\n};\n\nconst StaticCollectionItem: FunctionComponent<PropsWithChildren<CollectionItemSharedProps>> = (props) => {\n const {\n children,\n removable,\n onRemove,\n id,\n\n // Style props\n style,\n className,\n classNames,\n styles,\n ...others\n } = useProps('CollectionItem', defaultProps, props);\n const ctx = useCollectionContext();\n\n return (\n <Group\n data-testid={`item-${id}`}\n {...ctx.getStyles('item', {style, className, classNames, styles})}\n {...others}\n >\n {children}\n <RemoveButton removable={removable} onRemove={onRemove} />\n </Group>\n );\n};\n\nconst DisabledCollectionItem: FunctionComponent<PropsWithChildren<CollectionItemSharedProps>> = (props) => {\n const ctx = useCollectionContext();\n const {\n children,\n id,\n removable: _removable,\n onRemove: _onRemove,\n\n // Style props\n style,\n className,\n classNames,\n styles,\n ...others\n } = useProps('CollectionItem', defaultProps, props);\n return (\n <Group\n data-testid={`item-${id}`}\n {...ctx.getStyles('item', {style, className, classNames, styles})}\n {...others}\n >\n {children}\n </Group>\n );\n};\n\nconst DraggableCollectionItem: FunctionComponent<PropsWithChildren<CollectionItemSharedProps>> = (props) => {\n const ctx = useCollectionContext();\n const {\n children,\n removable,\n onRemove,\n id,\n\n // Style props\n className,\n classNames,\n styles,\n ...others\n } = useProps('CollectionItem', defaultProps, props);\n\n const {attributes, listeners, setNodeRef, transform, transition, isDragging, setActivatorNodeRef} = useSortable({\n id,\n });\n\n return (\n <Group\n data-testid={`item-${id}`}\n ref={setNodeRef}\n {...ctx.getStyles('item', {\n style: transform\n ? {\n transform: CSS.Transform.toString(transform),\n transition,\n }\n : undefined,\n className,\n classNames,\n styles,\n })}\n data-isdragging={isDragging}\n {...others}\n >\n <DragHandle setActivatorNodeRef={setActivatorNodeRef} listeners={listeners} attributes={attributes} />\n {children}\n <RemoveButton removable={removable} onRemove={onRemove} />\n </Group>\n );\n};\n\nexport const CollectionItem: FunctionComponent<PropsWithChildren<CollectionItemProps>> = ({\n draggable,\n disabled,\n ...otherProps\n}) => {\n if (disabled) {\n return <DisabledCollectionItem {...otherProps} />;\n }\n if (draggable) {\n return <DraggableCollectionItem {...otherProps} />;\n }\n return <StaticCollectionItem {...otherProps} />;\n};\n"],"names":["useSortable","CSS","Group","useProps","useCollectionContext","DragHandle","RemoveButton","defaultProps","removable","gap","StaticCollectionItem","props","children","onRemove","id","style","className","classNames","styles","others","ctx","data-testid","getStyles","DisabledCollectionItem","_removable","_onRemove","DraggableCollectionItem","attributes","listeners","setNodeRef","transform","transition","isDragging","setActivatorNodeRef","ref","Transform","toString","undefined","data-isdragging","CollectionItem","draggable","disabled","otherProps"],"mappings":";AAAA,SAAQA,WAAW,QAAO,oBAAoB;AAC9C,SAAQC,GAAG,QAAO,qBAAqB;AACvC,SAAQC,KAAK,EAAcC,QAAQ,QAAO,gBAAgB;AAG1D,SAAQC,oBAAoB,QAAO,yBAAyB;AAC5D,SAAQC,UAAU,QAAO,iCAAiC;AAC1D,SAAQC,YAAY,QAAO,mCAAmC;AAa9D,MAAMC,eAAmD;IACrDC,WAAW;IACXC,KAAK;AACT;AAEA,MAAMC,uBAAwF,CAACC;IAC3F,MAAM,EACFC,QAAQ,EACRJ,SAAS,EACTK,QAAQ,EACRC,EAAE,EAEF,cAAc;IACdC,KAAK,EACLC,SAAS,EACTC,UAAU,EACVC,MAAM,EACN,GAAGC,QACN,GAAGhB,SAAS,kBAAkBI,cAAcI;IAC7C,MAAMS,MAAMhB;IAEZ,qBACI,MAACF;QACGmB,eAAa,CAAC,KAAK,EAAEP,IAAI;QACxB,GAAGM,IAAIE,SAAS,CAAC,QAAQ;YAACP;YAAOC;YAAWC;YAAYC;QAAM,EAAE;QAChE,GAAGC,MAAM;;YAETP;0BACD,KAACN;gBAAaE,WAAWA;gBAAWK,UAAUA;;;;AAG1D;AAEA,MAAMU,yBAA0F,CAACZ;IAC7F,MAAMS,MAAMhB;IACZ,MAAM,EACFQ,QAAQ,EACRE,EAAE,EACFN,WAAWgB,UAAU,EACrBX,UAAUY,SAAS,EAEnB,cAAc;IACdV,KAAK,EACLC,SAAS,EACTC,UAAU,EACVC,MAAM,EACN,GAAGC,QACN,GAAGhB,SAAS,kBAAkBI,cAAcI;IAC7C,qBACI,KAACT;QACGmB,eAAa,CAAC,KAAK,EAAEP,IAAI;QACxB,GAAGM,IAAIE,SAAS,CAAC,QAAQ;YAACP;YAAOC;YAAWC;YAAYC;QAAM,EAAE;QAChE,GAAGC,MAAM;kBAETP;;AAGb;AAEA,MAAMc,0BAA2F,CAACf;IAC9F,MAAMS,MAAMhB;IACZ,MAAM,EACFQ,QAAQ,EACRJ,SAAS,EACTK,QAAQ,EACRC,EAAE,EAEF,cAAc;IACdE,SAAS,EACTC,UAAU,EACVC,MAAM,EACN,GAAGC,QACN,GAAGhB,SAAS,kBAAkBI,cAAcI;IAE7C,MAAM,EAACgB,UAAU,EAAEC,SAAS,EAAEC,UAAU,EAAEC,SAAS,EAAEC,UAAU,EAAEC,UAAU,EAAEC,mBAAmB,EAAC,GAAGjC,YAAY;QAC5Gc;IACJ;IAEA,qBACI,MAACZ;QACGmB,eAAa,CAAC,KAAK,EAAEP,IAAI;QACzBoB,KAAKL;QACJ,GAAGT,IAAIE,SAAS,CAAC,QAAQ;YACtBP,OAAOe,YACD;gBACIA,WAAW7B,IAAIkC,SAAS,CAACC,QAAQ,CAACN;gBAClCC;YACJ,IACAM;YACNrB;YACAC;YACAC;QACJ,EAAE;QACFoB,mBAAiBN;QAChB,GAAGb,MAAM;;0BAEV,KAACd;gBAAW4B,qBAAqBA;gBAAqBL,WAAWA;gBAAWD,YAAYA;;YACvFf;0BACD,KAACN;gBAAaE,WAAWA;gBAAWK,UAAUA;;;;AAG1D;AAEA,OAAO,MAAM0B,iBAA4E,CAAC,EACtFC,SAAS,EACTC,QAAQ,EACR,GAAGC,YACN;IACG,IAAID,UAAU;QACV,qBAAO,KAAClB;YAAwB,GAAGmB,UAAU;;IACjD;IACA,IAAIF,WAAW;QACX,qBAAO,KAACd;YAAyB,GAAGgB,UAAU;;IAClD;IACA,qBAAO,KAAChC;QAAsB,GAAGgC,UAAU;;AAC/C,EAAE"}
@@ -0,0 +1,46 @@
1
+ import type { MantineSpacing } from '@mantine/core';
2
+ import { ReactElement, ReactNode } from 'react';
3
+ /**
4
+ * Props passed to layout Header component
5
+ */
6
+ export interface CollectionLayoutHeaderProps {
7
+ /** Whether drag and drop is enabled */
8
+ draggable?: boolean;
9
+ /** Whether items are removable */
10
+ removable?: boolean;
11
+ }
12
+ /**
13
+ * Props passed to layout Body component
14
+ */
15
+ export interface CollectionLayoutBodyProps<T = unknown> {
16
+ /** Items to render */
17
+ items: T[];
18
+ /** Callback to remove an item */
19
+ onRemove?: (index: number) => void;
20
+ /** Whether items are removable */
21
+ removable?: boolean;
22
+ /** Whether drag and drop is enabled */
23
+ draggable?: boolean;
24
+ /** Whether the collection is disabled */
25
+ disabled?: boolean;
26
+ /** Function to get unique ID for each item */
27
+ getItemId?: (item: T, index: number) => string;
28
+ /** Gap between items */
29
+ gap?: MantineSpacing;
30
+ }
31
+ /**
32
+ * Collection Layout interface
33
+ * Follows the same pattern as Table's RowLayout
34
+ */
35
+ export interface CollectionLayout {
36
+ (props: {
37
+ children: ReactNode;
38
+ }): ReactElement;
39
+ /** Layout display name */
40
+ displayName: string;
41
+ /** Header component - renders column headers */
42
+ Header: (props: CollectionLayoutHeaderProps) => ReactElement | null;
43
+ /** Body component - renders rows/items */
44
+ Body: <TData>(props: CollectionLayoutBodyProps<TData>) => ReactElement;
45
+ }
46
+ //# sourceMappingURL=CollectionLayout.types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CollectionLayout.types.d.ts","sourceRoot":"","sources":["../../../../../src/components/Collection/layouts/CollectionLayout.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,eAAe,CAAC;AAClD,OAAO,EAAC,YAAY,EAAE,SAAS,EAAC,MAAM,OAAO,CAAC;AAE9C;;GAEG;AACH,MAAM,WAAW,2BAA2B;IACxC,uCAAuC;IACvC,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB,kCAAkC;IAClC,SAAS,CAAC,EAAE,OAAO,CAAC;CACvB;AAED;;GAEG;AACH,MAAM,WAAW,yBAAyB,CAAC,CAAC,GAAG,OAAO;IAClD,sBAAsB;IACtB,KAAK,EAAE,CAAC,EAAE,CAAC;IAEX,iCAAiC;IACjC,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAEnC,kCAAkC;IAClC,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB,uCAAuC;IACvC,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB,yCAAyC;IACzC,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB,8CAA8C;IAC9C,SAAS,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC;IAE/C,wBAAwB;IACxB,GAAG,CAAC,EAAE,cAAc,CAAC;CACxB;AAED;;;GAGG;AACH,MAAM,WAAW,gBAAgB;IAC7B,CAAC,KAAK,EAAE;QAAC,QAAQ,EAAE,SAAS,CAAA;KAAC,GAAG,YAAY,CAAC;IAE7C,0BAA0B;IAC1B,WAAW,EAAE,MAAM,CAAC;IAEpB,gDAAgD;IAChD,MAAM,EAAE,CAAC,KAAK,EAAE,2BAA2B,KAAK,YAAY,GAAG,IAAI,CAAC;IAEpE,0CAA0C;IAC1C,IAAI,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,yBAAyB,CAAC,KAAK,CAAC,KAAK,YAAY,CAAC;CAC1E"}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Collection Layout interface
3
+ * Follows the same pattern as Table's RowLayout
4
+ */ export { };
5
+
6
+ //# sourceMappingURL=CollectionLayout.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../src/components/Collection/layouts/CollectionLayout.types.ts"],"sourcesContent":["import type {MantineSpacing} from '@mantine/core';\nimport {ReactElement, ReactNode} from 'react';\n\n/**\n * Props passed to layout Header component\n */\nexport interface CollectionLayoutHeaderProps {\n /** Whether drag and drop is enabled */\n draggable?: boolean;\n\n /** Whether items are removable */\n removable?: boolean;\n}\n\n/**\n * Props passed to layout Body component\n */\nexport interface CollectionLayoutBodyProps<T = unknown> {\n /** Items to render */\n items: T[];\n\n /** Callback to remove an item */\n onRemove?: (index: number) => void;\n\n /** Whether items are removable */\n removable?: boolean;\n\n /** Whether drag and drop is enabled */\n draggable?: boolean;\n\n /** Whether the collection is disabled */\n disabled?: boolean;\n\n /** Function to get unique ID for each item */\n getItemId?: (item: T, index: number) => string;\n\n /** Gap between items */\n gap?: MantineSpacing;\n}\n\n/**\n * Collection Layout interface\n * Follows the same pattern as Table's RowLayout\n */\nexport interface CollectionLayout {\n (props: {children: ReactNode}): ReactElement;\n\n /** Layout display name */\n displayName: string;\n\n /** Header component - renders column headers */\n Header: (props: CollectionLayoutHeaderProps) => ReactElement | null;\n\n /** Body component - renders rows/items */\n Body: <TData>(props: CollectionLayoutBodyProps<TData>) => ReactElement;\n}\n"],"names":[],"mappings":"AAwCA;;;CAGC,GACD,WAWC"}
@@ -0,0 +1,26 @@
1
+ export declare const CollectionLayouts: {
2
+ readonly Horizontal: {
3
+ ({ children }: import("./shared/layoutConstants.js").LayoutProps): import("react/jsx-runtime").JSX.Element;
4
+ Body: <T>(props: import("./shared/layoutConstants.js").LayoutBodyProps<T> & {
5
+ ref?: import("react").ForwardedRef<HTMLDivElement>;
6
+ }) => import("react/jsx-runtime").JSX.Element;
7
+ Header: (props: import("./shared/layoutConstants.js").LayoutHeaderProps & {
8
+ ref?: import("react").ForwardedRef<HTMLDivElement>;
9
+ }) => import("react/jsx-runtime").JSX.Element;
10
+ displayName: string;
11
+ };
12
+ readonly Vertical: {
13
+ ({ children }: import("./shared/layoutConstants.js").LayoutProps): import("react/jsx-runtime").JSX.Element;
14
+ Body: <T>(props: import("./shared/layoutConstants.js").LayoutBodyProps<T> & {
15
+ ref?: import("react").ForwardedRef<HTMLDivElement>;
16
+ }) => import("react/jsx-runtime").JSX.Element;
17
+ Header: (_props: import("./shared/layoutConstants.js").LayoutHeaderProps & {
18
+ ref?: import("react").ForwardedRef<HTMLDivElement>;
19
+ }) => null;
20
+ displayName: string;
21
+ };
22
+ };
23
+ export { HorizontalLayout } from './horizontal-layout/HorizontalLayout.js';
24
+ export { VerticalLayout } from './vertical-layout/VerticalLayout.js';
25
+ export type { CollectionLayout, CollectionLayoutBodyProps, CollectionLayoutHeaderProps, } from './CollectionLayout.types.js';
26
+ //# sourceMappingURL=CollectionLayouts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CollectionLayouts.d.ts","sourceRoot":"","sources":["../../../../../src/components/Collection/layouts/CollectionLayouts.tsx"],"names":[],"mappings":"AAGA,eAAO,MAAM,iBAAiB;;;;eAY2xB,CAAC;;;eAA5xB,CAAC;;;;;;;eAAgyF,CAAC;;;eANh0F,CAAC;;;;CAHS,CAAC;AAEX,OAAO,EAAC,gBAAgB,EAAC,MAAM,yCAAyC,CAAC;AACzE,OAAO,EAAC,cAAc,EAAC,MAAM,qCAAqC,CAAC;AACnE,YAAY,EACR,gBAAgB,EAChB,yBAAyB,EACzB,2BAA2B,GAC9B,MAAM,6BAA6B,CAAC"}
@@ -0,0 +1,10 @@
1
+ import { HorizontalLayout } from './horizontal-layout/HorizontalLayout.js';
2
+ import { VerticalLayout } from './vertical-layout/VerticalLayout.js';
3
+ export const CollectionLayouts = {
4
+ Horizontal: HorizontalLayout,
5
+ Vertical: VerticalLayout
6
+ };
7
+ export { HorizontalLayout } from './horizontal-layout/HorizontalLayout.js';
8
+ export { VerticalLayout } from './vertical-layout/VerticalLayout.js';
9
+
10
+ //# sourceMappingURL=CollectionLayouts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../src/components/Collection/layouts/CollectionLayouts.tsx"],"sourcesContent":["import {HorizontalLayout} from './horizontal-layout/HorizontalLayout.js';\nimport {VerticalLayout} from './vertical-layout/VerticalLayout.js';\n\nexport const CollectionLayouts = {\n Horizontal: HorizontalLayout,\n Vertical: VerticalLayout,\n} as const;\n\nexport {HorizontalLayout} from './horizontal-layout/HorizontalLayout.js';\nexport {VerticalLayout} from './vertical-layout/VerticalLayout.js';\nexport type {\n CollectionLayout,\n CollectionLayoutBodyProps,\n CollectionLayoutHeaderProps,\n} from './CollectionLayout.types.js';\n"],"names":["HorizontalLayout","VerticalLayout","CollectionLayouts","Horizontal","Vertical"],"mappings":"AAAA,SAAQA,gBAAgB,QAAO,0CAA0C;AACzE,SAAQC,cAAc,QAAO,sCAAsC;AAEnE,OAAO,MAAMC,oBAAoB;IAC7BC,YAAYH;IACZI,UAAUH;AACd,EAAW;AAEX,SAAQD,gBAAgB,QAAO,0CAA0C;AACzE,SAAQC,cAAc,QAAO,sCAAsC"}
@@ -0,0 +1,12 @@
1
+ import { LayoutProps } from '../shared/layoutConstants.js';
2
+ export declare const HorizontalLayout: {
3
+ ({ children }: LayoutProps): import("react/jsx-runtime").JSX.Element;
4
+ Body: <T>(props: import("../shared/layoutConstants.js").LayoutBodyProps<T> & {
5
+ ref?: import("react").ForwardedRef<HTMLDivElement>;
6
+ }) => import("react/jsx-runtime").JSX.Element;
7
+ Header: (props: import("../shared/layoutConstants.js").LayoutHeaderProps & {
8
+ ref?: import("react").ForwardedRef<HTMLDivElement>;
9
+ }) => import("react/jsx-runtime").JSX.Element;
10
+ displayName: string;
11
+ };
12
+ //# sourceMappingURL=HorizontalLayout.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HorizontalLayout.d.ts","sourceRoot":"","sources":["../../../../../../src/components/Collection/layouts/horizontal-layout/HorizontalLayout.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAC,WAAW,EAAC,MAAM,8BAA8B,CAAC;AAIzD,eAAO,MAAM,gBAAgB;mBAAgB,WAAW;;WAK63B,CAAC;;;WAA5xB,CAAC;;;CAL/E,CAAC"}
@@ -0,0 +1,11 @@
1
+ import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { HorizontalLayoutBody } from './HorizontalLayoutBody.js';
3
+ import { HorizontalLayoutHeader } from './HorizontalLayoutHeader.js';
4
+ export const HorizontalLayout = ({ children })=>/*#__PURE__*/ _jsx(_Fragment, {
5
+ children: children
6
+ });
7
+ HorizontalLayout.Body = HorizontalLayoutBody;
8
+ HorizontalLayout.Header = HorizontalLayoutHeader;
9
+ HorizontalLayout.displayName = 'Horizontal';
10
+
11
+ //# sourceMappingURL=HorizontalLayout.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../src/components/Collection/layouts/horizontal-layout/HorizontalLayout.tsx"],"sourcesContent":["import {LayoutProps} from '../shared/layoutConstants.js';\nimport {HorizontalLayoutBody} from './HorizontalLayoutBody.js';\nimport {HorizontalLayoutHeader} from './HorizontalLayoutHeader.js';\n\nexport const HorizontalLayout = ({children}: LayoutProps) => <>{children}</>;\n\nHorizontalLayout.Body = HorizontalLayoutBody;\nHorizontalLayout.Header = HorizontalLayoutHeader;\nHorizontalLayout.displayName = 'Horizontal';\n"],"names":["HorizontalLayoutBody","HorizontalLayoutHeader","HorizontalLayout","children","Body","Header","displayName"],"mappings":";AACA,SAAQA,oBAAoB,QAAO,4BAA4B;AAC/D,SAAQC,sBAAsB,QAAO,8BAA8B;AAEnE,OAAO,MAAMC,mBAAmB,CAAC,EAACC,QAAQ,EAAc,iBAAK;kBAAGA;OAAa;AAE7ED,iBAAiBE,IAAI,GAAGJ;AACxBE,iBAAiBG,MAAM,GAAGJ;AAC1BC,iBAAiBI,WAAW,GAAG"}
@@ -0,0 +1,37 @@
1
+ .headerRow {
2
+ display: flex;
3
+ gap: var(--mantine-spacing-sm);
4
+ padding-bottom: var(--mantine-spacing-xs);
5
+ align-items: center;
6
+ }
7
+
8
+ .headerCell {
9
+ flex: 1;
10
+ font-weight: var(--coveo-fw-bold);
11
+ text-align: left;
12
+ }
13
+
14
+ .dragHandleHeader {
15
+ width: var(--mantine-spacing-sm);
16
+ flex-shrink: 0;
17
+ }
18
+
19
+ .removeButtonHeader {
20
+ width: calc(var(--mantine-spacing-md) + var(--mantine-spacing-sm));
21
+ flex-shrink: 0;
22
+ }
23
+
24
+ .row {
25
+ display: flex;
26
+ gap: var(--mantine-spacing-sm);
27
+ align-items: center;
28
+ background: var(--mantine-color-body);
29
+ }
30
+
31
+ .row[data-isdragging='true'] {
32
+ z-index: 1;
33
+ }
34
+
35
+ .cell {
36
+ flex: 1;
37
+ }
@@ -0,0 +1,6 @@
1
+ import { ForwardedRef } from 'react';
2
+ import { LayoutBodyProps } from '../shared/layoutConstants.js';
3
+ export declare const HorizontalLayoutBody: <T>(props: LayoutBodyProps<T> & {
4
+ ref?: ForwardedRef<HTMLDivElement>;
5
+ }) => import("react/jsx-runtime").JSX.Element;
6
+ //# sourceMappingURL=HorizontalLayoutBody.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HorizontalLayoutBody.d.ts","sourceRoot":"","sources":["../../../../../../src/components/Collection/layouts/horizontal-layout/HorizontalLayoutBody.tsx"],"names":[],"mappings":"AACA,OAAO,EAAC,YAAY,EAAU,MAAM,OAAO,CAAC;AAI5C,OAAO,EAA4B,eAAe,EAAC,MAAM,8BAA8B,CAAC;AA8BxF,eAAO,MAAM,oBAAoB,GAAI,CAAC,EAAG,OAAO,eAAe,CAAC,CAAC,CAAC,GAAG;IAAC,GAAG,CAAC,EAAE,YAAY,CAAC,cAAc,CAAC,CAAA;CAAC,4CAgCxG,CAAC"}
@@ -0,0 +1,49 @@
1
+ import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { Box, Stack, useProps } from '@mantine/core';
3
+ import { useMemo } from 'react';
4
+ import { useCollectionContext } from '../../CollectionContext.js';
5
+ import { getColumnSizeStyles } from '../shared/columnUtils.js';
6
+ import { createItemRenderers, mapItemsToComponents } from '../shared/itemRenderer.js';
7
+ import { LAYOUT_BODY_DEFAULT_PROPS } from '../shared/layoutConstants.js';
8
+ import classes from './HorizontalLayout.module.css';
9
+ const defaultProps = LAYOUT_BODY_DEFAULT_PROPS;
10
+ /**
11
+ * Horizontal layout specific content renderer - renders cells in a row
12
+ */ const renderHorizontalContent = (item, index, columns, cellContext, layoutClasses)=>/*#__PURE__*/ _jsx(_Fragment, {
13
+ children: columns.map((column, colIndex)=>{
14
+ const columnId = column.id ?? `column-${colIndex}`;
15
+ return /*#__PURE__*/ _jsx(Box, {
16
+ className: layoutClasses.cell,
17
+ style: getColumnSizeStyles(column),
18
+ children: column.cell(item, index, cellContext)
19
+ }, columnId);
20
+ })
21
+ });
22
+ // Create renderers once - they are stable component references
23
+ const horizontalRenderers = createItemRenderers();
24
+ export const HorizontalLayoutBody = (props)=>{
25
+ const collectionCtx = useCollectionContext();
26
+ const { items, onRemove, removable, draggable, disabled, readOnly, getItemId, gap, ref, ...others } = useProps('HorizontalLayoutBody', defaultProps, props);
27
+ const config = useMemo(()=>({
28
+ renderContent: renderHorizontalContent,
29
+ containerSelector: 'row',
30
+ inlineControls: true
31
+ }), []);
32
+ const rows = mapItemsToComponents(items, horizontalRenderers, config, classes, {
33
+ getItemId,
34
+ onRemove,
35
+ removable,
36
+ draggable,
37
+ disabled,
38
+ readOnly,
39
+ columns: collectionCtx.columns
40
+ });
41
+ return /*#__PURE__*/ _jsx(Stack, {
42
+ ref: ref,
43
+ gap: gap,
44
+ ...others,
45
+ children: rows
46
+ });
47
+ };
48
+
49
+ //# sourceMappingURL=HorizontalLayoutBody.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../src/components/Collection/layouts/horizontal-layout/HorizontalLayoutBody.tsx"],"sourcesContent":["import {Box, Stack, useProps} from '@mantine/core';\nimport {ForwardedRef, useMemo} from 'react';\nimport {useCollectionContext} from '../../CollectionContext.js';\nimport {getColumnSizeStyles} from '../shared/columnUtils.js';\nimport {createItemRenderers, ItemContentRenderer, LayoutClasses, mapItemsToComponents} from '../shared/itemRenderer.js';\nimport {LAYOUT_BODY_DEFAULT_PROPS, LayoutBodyProps} from '../shared/layoutConstants.js';\nimport classes from './HorizontalLayout.module.css';\n\nconst defaultProps: Partial<LayoutBodyProps> = LAYOUT_BODY_DEFAULT_PROPS;\n\n/**\n * Horizontal layout specific content renderer - renders cells in a row\n */\nconst renderHorizontalContent: ItemContentRenderer<unknown> = (\n item,\n index,\n columns,\n cellContext,\n layoutClasses: LayoutClasses,\n) => (\n <>\n {columns.map((column, colIndex) => {\n const columnId = column.id ?? `column-${colIndex}`;\n return (\n <Box key={columnId} className={layoutClasses.cell} style={getColumnSizeStyles(column)}>\n {column.cell(item, index, cellContext)}\n </Box>\n );\n })}\n </>\n);\n\n// Create renderers once - they are stable component references\nconst horizontalRenderers = createItemRenderers<unknown>();\n\nexport const HorizontalLayoutBody = <T,>(props: LayoutBodyProps<T> & {ref?: ForwardedRef<HTMLDivElement>}) => {\n const collectionCtx = useCollectionContext();\n const {items, onRemove, removable, draggable, disabled, readOnly, getItemId, gap, ref, ...others} = useProps(\n 'HorizontalLayoutBody',\n defaultProps as LayoutBodyProps<T>,\n props,\n );\n\n const config = useMemo(\n () => ({\n renderContent: renderHorizontalContent,\n containerSelector: 'row',\n inlineControls: true,\n }),\n [],\n );\n\n const rows = mapItemsToComponents(items, horizontalRenderers, config, classes as LayoutClasses, {\n getItemId,\n onRemove,\n removable,\n draggable,\n disabled,\n readOnly,\n columns: collectionCtx.columns,\n });\n\n return (\n <Stack ref={ref} gap={gap} {...others}>\n {rows}\n </Stack>\n );\n};\n"],"names":["Box","Stack","useProps","useMemo","useCollectionContext","getColumnSizeStyles","createItemRenderers","mapItemsToComponents","LAYOUT_BODY_DEFAULT_PROPS","classes","defaultProps","renderHorizontalContent","item","index","columns","cellContext","layoutClasses","map","column","colIndex","columnId","id","className","cell","style","horizontalRenderers","HorizontalLayoutBody","props","collectionCtx","items","onRemove","removable","draggable","disabled","readOnly","getItemId","gap","ref","others","config","renderContent","containerSelector","inlineControls","rows"],"mappings":";AAAA,SAAQA,GAAG,EAAEC,KAAK,EAAEC,QAAQ,QAAO,gBAAgB;AACnD,SAAsBC,OAAO,QAAO,QAAQ;AAC5C,SAAQC,oBAAoB,QAAO,6BAA6B;AAChE,SAAQC,mBAAmB,QAAO,2BAA2B;AAC7D,SAAQC,mBAAmB,EAAsCC,oBAAoB,QAAO,4BAA4B;AACxH,SAAQC,yBAAyB,QAAwB,+BAA+B;AACxF,OAAOC,aAAa,gCAAgC;AAEpD,MAAMC,eAAyCF;AAE/C;;CAEC,GACD,MAAMG,0BAAwD,CAC1DC,MACAC,OACAC,SACAC,aACAC,8BAEA;kBACKF,QAAQG,GAAG,CAAC,CAACC,QAAQC;YAClB,MAAMC,WAAWF,OAAOG,EAAE,IAAI,CAAC,OAAO,EAAEF,UAAU;YAClD,qBACI,KAACnB;gBAAmBsB,WAAWN,cAAcO,IAAI;gBAAEC,OAAOnB,oBAAoBa;0BACzEA,OAAOK,IAAI,CAACX,MAAMC,OAAOE;eADpBK;QAIlB;;AAIR,+DAA+D;AAC/D,MAAMK,sBAAsBnB;AAE5B,OAAO,MAAMoB,uBAAuB,CAAKC;IACrC,MAAMC,gBAAgBxB;IACtB,MAAM,EAACyB,KAAK,EAAEC,QAAQ,EAAEC,SAAS,EAAEC,SAAS,EAAEC,QAAQ,EAAEC,QAAQ,EAAEC,SAAS,EAAEC,GAAG,EAAEC,GAAG,EAAE,GAAGC,QAAO,GAAGpC,SAChG,wBACAQ,cACAiB;IAGJ,MAAMY,SAASpC,QACX,IAAO,CAAA;YACHqC,eAAe7B;YACf8B,mBAAmB;YACnBC,gBAAgB;QACpB,CAAA,GACA,EAAE;IAGN,MAAMC,OAAOpC,qBAAqBsB,OAAOJ,qBAAqBc,QAAQ9B,SAA0B;QAC5F0B;QACAL;QACAC;QACAC;QACAC;QACAC;QACApB,SAASc,cAAcd,OAAO;IAClC;IAEA,qBACI,KAACb;QAAMoC,KAAKA;QAAKD,KAAKA;QAAM,GAAGE,MAAM;kBAChCK;;AAGb,EAAE"}
@@ -0,0 +1,6 @@
1
+ import { ForwardedRef } from 'react';
2
+ import { LayoutHeaderProps } from '../shared/layoutConstants.js';
3
+ export declare const HorizontalLayoutHeader: (props: LayoutHeaderProps & {
4
+ ref?: ForwardedRef<HTMLDivElement>;
5
+ }) => import("react/jsx-runtime").JSX.Element;
6
+ //# sourceMappingURL=HorizontalLayoutHeader.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HorizontalLayoutHeader.d.ts","sourceRoot":"","sources":["../../../../../../src/components/Collection/layouts/horizontal-layout/HorizontalLayoutHeader.tsx"],"names":[],"mappings":"AACA,OAAO,EAAC,YAAY,EAAC,MAAM,OAAO,CAAC;AAInC,OAAO,EAA8B,iBAAiB,EAAC,MAAM,8BAA8B,CAAC;AAK5F,eAAO,MAAM,sBAAsB,GAAI,OAAO,iBAAiB,GAAG;IAAC,GAAG,CAAC,EAAE,YAAY,CAAC,cAAc,CAAC,CAAA;CAAC,4CAsBrG,CAAC"}
@@ -0,0 +1,36 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Box, useProps } from '@mantine/core';
3
+ import { useCollectionContext } from '../../CollectionContext.js';
4
+ import { getColumnSizeStyles } from '../shared/columnUtils.js';
5
+ import { renderColumnHeader } from '../shared/headerUtils.js';
6
+ import { LAYOUT_HEADER_DEFAULT_PROPS } from '../shared/layoutConstants.js';
7
+ import classes from './HorizontalLayout.module.css';
8
+ const defaultProps = LAYOUT_HEADER_DEFAULT_PROPS;
9
+ export const HorizontalLayoutHeader = (props)=>{
10
+ const collectionCtx = useCollectionContext();
11
+ const { draggable, removable, style, ref, ...others } = useProps('HorizontalLayoutHeader', defaultProps, props);
12
+ return /*#__PURE__*/ _jsxs(Box, {
13
+ ref: ref,
14
+ className: classes.headerRow,
15
+ style: style,
16
+ ...others,
17
+ children: [
18
+ draggable && /*#__PURE__*/ _jsx("div", {
19
+ className: classes.dragHandleHeader
20
+ }),
21
+ collectionCtx.columns.map((column, index)=>{
22
+ const columnId = column.id ?? `column-${index}`;
23
+ return /*#__PURE__*/ _jsx(Box, {
24
+ className: classes.headerCell,
25
+ style: getColumnSizeStyles(column),
26
+ children: renderColumnHeader(column.header, index)
27
+ }, columnId);
28
+ }),
29
+ removable && /*#__PURE__*/ _jsx("div", {
30
+ className: classes.removeButtonHeader
31
+ })
32
+ ]
33
+ });
34
+ };
35
+
36
+ //# sourceMappingURL=HorizontalLayoutHeader.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../src/components/Collection/layouts/horizontal-layout/HorizontalLayoutHeader.tsx"],"sourcesContent":["import {Box, useProps} from '@mantine/core';\nimport {ForwardedRef} from 'react';\nimport {useCollectionContext} from '../../CollectionContext.js';\nimport {getColumnSizeStyles} from '../shared/columnUtils.js';\nimport {renderColumnHeader} from '../shared/headerUtils.js';\nimport {LAYOUT_HEADER_DEFAULT_PROPS, LayoutHeaderProps} from '../shared/layoutConstants.js';\nimport classes from './HorizontalLayout.module.css';\n\nconst defaultProps: Partial<LayoutHeaderProps> = LAYOUT_HEADER_DEFAULT_PROPS;\n\nexport const HorizontalLayoutHeader = (props: LayoutHeaderProps & {ref?: ForwardedRef<HTMLDivElement>}) => {\n const collectionCtx = useCollectionContext();\n const {draggable, removable, style, ref, ...others} = useProps(\n 'HorizontalLayoutHeader',\n defaultProps as LayoutHeaderProps,\n props,\n );\n\n return (\n <Box ref={ref} className={classes.headerRow} style={style} {...others}>\n {draggable && <div className={classes.dragHandleHeader} />}\n {collectionCtx.columns.map((column, index) => {\n const columnId = column.id ?? `column-${index}`;\n return (\n <Box key={columnId} className={classes.headerCell} style={getColumnSizeStyles(column)}>\n {renderColumnHeader(column.header, index)}\n </Box>\n );\n })}\n {removable && <div className={classes.removeButtonHeader} />}\n </Box>\n );\n};\n"],"names":["Box","useProps","useCollectionContext","getColumnSizeStyles","renderColumnHeader","LAYOUT_HEADER_DEFAULT_PROPS","classes","defaultProps","HorizontalLayoutHeader","props","collectionCtx","draggable","removable","style","ref","others","className","headerRow","div","dragHandleHeader","columns","map","column","index","columnId","id","headerCell","header","removeButtonHeader"],"mappings":";AAAA,SAAQA,GAAG,EAAEC,QAAQ,QAAO,gBAAgB;AAE5C,SAAQC,oBAAoB,QAAO,6BAA6B;AAChE,SAAQC,mBAAmB,QAAO,2BAA2B;AAC7D,SAAQC,kBAAkB,QAAO,2BAA2B;AAC5D,SAAQC,2BAA2B,QAA0B,+BAA+B;AAC5F,OAAOC,aAAa,gCAAgC;AAEpD,MAAMC,eAA2CF;AAEjD,OAAO,MAAMG,yBAAyB,CAACC;IACnC,MAAMC,gBAAgBR;IACtB,MAAM,EAACS,SAAS,EAAEC,SAAS,EAAEC,KAAK,EAAEC,GAAG,EAAE,GAAGC,QAAO,GAAGd,SAClD,0BACAM,cACAE;IAGJ,qBACI,MAACT;QAAIc,KAAKA;QAAKE,WAAWV,QAAQW,SAAS;QAAEJ,OAAOA;QAAQ,GAAGE,MAAM;;YAChEJ,2BAAa,KAACO;gBAAIF,WAAWV,QAAQa,gBAAgB;;YACrDT,cAAcU,OAAO,CAACC,GAAG,CAAC,CAACC,QAAQC;gBAChC,MAAMC,WAAWF,OAAOG,EAAE,IAAI,CAAC,OAAO,EAAEF,OAAO;gBAC/C,qBACI,KAACvB;oBAAmBgB,WAAWV,QAAQoB,UAAU;oBAAEb,OAAOV,oBAAoBmB;8BACzElB,mBAAmBkB,OAAOK,MAAM,EAAEJ;mBAD7BC;YAIlB;YACCZ,2BAAa,KAACM;gBAAIF,WAAWV,QAAQsB,kBAAkB;;;;AAGpE,EAAE"}
@@ -0,0 +1,12 @@
1
+ import type { FunctionComponent } from 'react';
2
+ export interface DragHandleProps {
3
+ setActivatorNodeRef: (element: HTMLElement | null) => void;
4
+ listeners: any;
5
+ attributes: any;
6
+ }
7
+ /**
8
+ * Shared drag handle component used by both horizontal and vertical layouts.
9
+ * Renders the drag icon with proper event handlers for drag and drop functionality.
10
+ */
11
+ export declare const DragHandle: FunctionComponent<DragHandleProps>;
12
+ //# sourceMappingURL=DragHandle.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DragHandle.d.ts","sourceRoot":"","sources":["../../../../../../src/components/Collection/layouts/shared/DragHandle.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,OAAO,CAAC;AAG7C,MAAM,WAAW,eAAe;IAC5B,mBAAmB,EAAE,CAAC,OAAO,EAAE,WAAW,GAAG,IAAI,KAAK,IAAI,CAAC;IAC3D,SAAS,EAAE,GAAG,CAAC;IACf,UAAU,EAAE,GAAG,CAAC;CACnB;AAED;;;GAGG;AACH,eAAO,MAAM,UAAU,EAAE,iBAAiB,CAAC,eAAe,CAOzD,CAAC"}