@coveord/plasma-mantine 56.18.0 → 56.20.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +4 -4
- package/.turbo/turbo-test.log +118 -115
- package/dist/.tsbuildinfo +1 -1
- package/dist/cjs/components/Collection/Collection.d.ts +75 -12
- package/dist/cjs/components/Collection/Collection.d.ts.map +1 -1
- package/dist/cjs/components/Collection/Collection.js +94 -38
- package/dist/cjs/components/Collection/Collection.js.map +1 -1
- package/dist/cjs/components/Collection/Collection.module.css +13 -1
- package/dist/cjs/components/Collection/CollectionAddButton.d.ts +25 -0
- package/dist/cjs/components/Collection/CollectionAddButton.d.ts.map +1 -0
- package/dist/cjs/components/Collection/CollectionAddButton.js +33 -0
- package/dist/cjs/components/Collection/CollectionAddButton.js.map +1 -0
- package/dist/cjs/components/Collection/CollectionColumn.types.d.ts +72 -0
- package/dist/cjs/components/Collection/CollectionColumn.types.d.ts.map +1 -0
- package/dist/cjs/components/Collection/CollectionColumn.types.js +6 -0
- package/dist/cjs/components/Collection/CollectionColumn.types.js.map +1 -0
- package/dist/cjs/components/Collection/CollectionContext.d.ts +5 -0
- package/dist/cjs/components/Collection/CollectionContext.d.ts.map +1 -1
- package/dist/cjs/components/Collection/CollectionContext.js.map +1 -1
- package/dist/cjs/components/Collection/CollectionItem.d.ts +2 -2
- package/dist/cjs/components/Collection/CollectionItem.d.ts.map +1 -1
- package/dist/cjs/components/Collection/CollectionItem.js +18 -38
- package/dist/cjs/components/Collection/CollectionItem.js.map +1 -1
- package/dist/cjs/components/Collection/layouts/CollectionLayout.types.d.ts +46 -0
- package/dist/cjs/components/Collection/layouts/CollectionLayout.types.d.ts.map +1 -0
- package/dist/cjs/components/Collection/layouts/CollectionLayout.types.js +6 -0
- package/dist/cjs/components/Collection/layouts/CollectionLayout.types.js.map +1 -0
- package/dist/cjs/components/Collection/layouts/CollectionLayouts.d.ts +26 -0
- package/dist/cjs/components/Collection/layouts/CollectionLayouts.d.ts.map +1 -0
- package/dist/cjs/components/Collection/layouts/CollectionLayouts.js +29 -0
- package/dist/cjs/components/Collection/layouts/CollectionLayouts.js.map +1 -0
- package/dist/cjs/components/Collection/layouts/horizontal-layout/HorizontalLayout.d.ts +12 -0
- package/dist/cjs/components/Collection/layouts/horizontal-layout/HorizontalLayout.d.ts.map +1 -0
- package/dist/cjs/components/Collection/layouts/horizontal-layout/HorizontalLayout.js +24 -0
- package/dist/cjs/components/Collection/layouts/horizontal-layout/HorizontalLayout.js.map +1 -0
- package/dist/cjs/components/Collection/layouts/horizontal-layout/HorizontalLayout.module.css +37 -0
- package/dist/cjs/components/Collection/layouts/horizontal-layout/HorizontalLayoutBody.d.ts +6 -0
- package/dist/cjs/components/Collection/layouts/horizontal-layout/HorizontalLayoutBody.d.ts.map +1 -0
- package/dist/cjs/components/Collection/layouts/horizontal-layout/HorizontalLayoutBody.js +78 -0
- package/dist/cjs/components/Collection/layouts/horizontal-layout/HorizontalLayoutBody.js.map +1 -0
- package/dist/cjs/components/Collection/layouts/horizontal-layout/HorizontalLayoutHeader.d.ts +6 -0
- package/dist/cjs/components/Collection/layouts/horizontal-layout/HorizontalLayoutHeader.d.ts.map +1 -0
- package/dist/cjs/components/Collection/layouts/horizontal-layout/HorizontalLayoutHeader.js +56 -0
- package/dist/cjs/components/Collection/layouts/horizontal-layout/HorizontalLayoutHeader.js.map +1 -0
- package/dist/cjs/components/Collection/layouts/shared/DragHandle.d.ts +12 -0
- package/dist/cjs/components/Collection/layouts/shared/DragHandle.d.ts.map +1 -0
- package/dist/cjs/components/Collection/layouts/shared/DragHandle.js +28 -0
- package/dist/cjs/components/Collection/layouts/shared/DragHandle.js.map +1 -0
- package/dist/cjs/components/Collection/layouts/shared/RemoveButton.d.ts +11 -0
- package/dist/cjs/components/Collection/layouts/shared/RemoveButton.d.ts.map +1 -0
- package/dist/cjs/components/Collection/layouts/shared/RemoveButton.js +39 -0
- package/dist/cjs/components/Collection/layouts/shared/RemoveButton.js.map +1 -0
- package/dist/cjs/components/Collection/layouts/shared/columnUtils.d.ts +8 -0
- package/dist/cjs/components/Collection/layouts/shared/columnUtils.d.ts.map +1 -0
- package/dist/cjs/components/Collection/layouts/shared/columnUtils.js +24 -0
- package/dist/cjs/components/Collection/layouts/shared/columnUtils.js.map +1 -0
- package/dist/cjs/components/Collection/layouts/shared/headerUtils.d.ts +8 -0
- package/dist/cjs/components/Collection/layouts/shared/headerUtils.d.ts.map +1 -0
- package/dist/cjs/components/Collection/layouts/shared/headerUtils.js +21 -0
- package/dist/cjs/components/Collection/layouts/shared/headerUtils.js.map +1 -0
- package/dist/cjs/components/Collection/layouts/shared/itemRenderer.d.ts +78 -0
- package/dist/cjs/components/Collection/layouts/shared/itemRenderer.d.ts.map +1 -0
- package/dist/cjs/components/Collection/layouts/shared/itemRenderer.js +160 -0
- package/dist/cjs/components/Collection/layouts/shared/itemRenderer.js.map +1 -0
- package/dist/cjs/components/Collection/layouts/shared/layoutConstants.d.ts +38 -0
- package/dist/cjs/components/Collection/layouts/shared/layoutConstants.d.ts.map +1 -0
- package/dist/cjs/components/Collection/layouts/shared/layoutConstants.js +31 -0
- package/dist/cjs/components/Collection/layouts/shared/layoutConstants.js.map +1 -0
- package/dist/cjs/components/Collection/layouts/vertical-layout/VerticalLayout.d.ts +12 -0
- package/dist/cjs/components/Collection/layouts/vertical-layout/VerticalLayout.d.ts.map +1 -0
- package/dist/cjs/components/Collection/layouts/vertical-layout/VerticalLayout.js +24 -0
- package/dist/cjs/components/Collection/layouts/vertical-layout/VerticalLayout.js.map +1 -0
- package/dist/cjs/components/Collection/layouts/vertical-layout/VerticalLayout.module.css +35 -0
- package/dist/cjs/components/Collection/layouts/vertical-layout/VerticalLayoutBody.d.ts +6 -0
- package/dist/cjs/components/Collection/layouts/vertical-layout/VerticalLayoutBody.d.ts.map +1 -0
- package/dist/cjs/components/Collection/layouts/vertical-layout/VerticalLayoutBody.js +134 -0
- package/dist/cjs/components/Collection/layouts/vertical-layout/VerticalLayoutBody.js.map +1 -0
- package/dist/cjs/components/Collection/layouts/vertical-layout/VerticalLayoutHeader.d.ts +10 -0
- package/dist/cjs/components/Collection/layouts/vertical-layout/VerticalLayoutHeader.d.ts.map +1 -0
- package/dist/cjs/components/Collection/layouts/vertical-layout/VerticalLayoutHeader.js +15 -0
- package/dist/cjs/components/Collection/layouts/vertical-layout/VerticalLayoutHeader.js.map +1 -0
- package/dist/cjs/index.d.ts +2 -0
- package/dist/cjs/index.d.ts.map +1 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/components/Collection/Collection.d.ts +75 -12
- package/dist/esm/components/Collection/Collection.d.ts.map +1 -1
- package/dist/esm/components/Collection/Collection.js +87 -32
- package/dist/esm/components/Collection/Collection.js.map +1 -1
- package/dist/esm/components/Collection/Collection.module.css +13 -1
- package/dist/esm/components/Collection/CollectionAddButton.d.ts +25 -0
- package/dist/esm/components/Collection/CollectionAddButton.d.ts.map +1 -0
- package/dist/esm/components/Collection/CollectionAddButton.js +19 -0
- package/dist/esm/components/Collection/CollectionAddButton.js.map +1 -0
- package/dist/esm/components/Collection/CollectionColumn.types.d.ts +72 -0
- package/dist/esm/components/Collection/CollectionColumn.types.d.ts.map +1 -0
- package/dist/esm/components/Collection/CollectionColumn.types.js +5 -0
- package/dist/esm/components/Collection/CollectionColumn.types.js.map +1 -0
- package/dist/esm/components/Collection/CollectionContext.d.ts +5 -0
- package/dist/esm/components/Collection/CollectionContext.d.ts.map +1 -1
- package/dist/esm/components/Collection/CollectionContext.js.map +1 -1
- package/dist/esm/components/Collection/CollectionItem.d.ts +2 -2
- package/dist/esm/components/Collection/CollectionItem.d.ts.map +1 -1
- package/dist/esm/components/Collection/CollectionItem.js +15 -34
- package/dist/esm/components/Collection/CollectionItem.js.map +1 -1
- package/dist/esm/components/Collection/layouts/CollectionLayout.types.d.ts +46 -0
- package/dist/esm/components/Collection/layouts/CollectionLayout.types.d.ts.map +1 -0
- package/dist/esm/components/Collection/layouts/CollectionLayout.types.js +6 -0
- package/dist/esm/components/Collection/layouts/CollectionLayout.types.js.map +1 -0
- package/dist/esm/components/Collection/layouts/CollectionLayouts.d.ts +26 -0
- package/dist/esm/components/Collection/layouts/CollectionLayouts.d.ts.map +1 -0
- package/dist/esm/components/Collection/layouts/CollectionLayouts.js +10 -0
- package/dist/esm/components/Collection/layouts/CollectionLayouts.js.map +1 -0
- package/dist/esm/components/Collection/layouts/horizontal-layout/HorizontalLayout.d.ts +12 -0
- package/dist/esm/components/Collection/layouts/horizontal-layout/HorizontalLayout.d.ts.map +1 -0
- package/dist/esm/components/Collection/layouts/horizontal-layout/HorizontalLayout.js +11 -0
- package/dist/esm/components/Collection/layouts/horizontal-layout/HorizontalLayout.js.map +1 -0
- package/dist/esm/components/Collection/layouts/horizontal-layout/HorizontalLayout.module.css +37 -0
- package/dist/esm/components/Collection/layouts/horizontal-layout/HorizontalLayoutBody.d.ts +6 -0
- package/dist/esm/components/Collection/layouts/horizontal-layout/HorizontalLayoutBody.d.ts.map +1 -0
- package/dist/esm/components/Collection/layouts/horizontal-layout/HorizontalLayoutBody.js +49 -0
- package/dist/esm/components/Collection/layouts/horizontal-layout/HorizontalLayoutBody.js.map +1 -0
- package/dist/esm/components/Collection/layouts/horizontal-layout/HorizontalLayoutHeader.d.ts +6 -0
- package/dist/esm/components/Collection/layouts/horizontal-layout/HorizontalLayoutHeader.d.ts.map +1 -0
- package/dist/esm/components/Collection/layouts/horizontal-layout/HorizontalLayoutHeader.js +36 -0
- package/dist/esm/components/Collection/layouts/horizontal-layout/HorizontalLayoutHeader.js.map +1 -0
- package/dist/esm/components/Collection/layouts/shared/DragHandle.d.ts +12 -0
- package/dist/esm/components/Collection/layouts/shared/DragHandle.d.ts.map +1 -0
- package/dist/esm/components/Collection/layouts/shared/DragHandle.js +20 -0
- package/dist/esm/components/Collection/layouts/shared/DragHandle.js.map +1 -0
- package/dist/esm/components/Collection/layouts/shared/RemoveButton.d.ts +11 -0
- package/dist/esm/components/Collection/layouts/shared/RemoveButton.d.ts.map +1 -0
- package/dist/esm/components/Collection/layouts/shared/RemoveButton.js +30 -0
- package/dist/esm/components/Collection/layouts/shared/RemoveButton.js.map +1 -0
- package/dist/esm/components/Collection/layouts/shared/columnUtils.d.ts +8 -0
- package/dist/esm/components/Collection/layouts/shared/columnUtils.d.ts.map +1 -0
- package/dist/esm/components/Collection/layouts/shared/columnUtils.js +17 -0
- package/dist/esm/components/Collection/layouts/shared/columnUtils.js.map +1 -0
- package/dist/esm/components/Collection/layouts/shared/headerUtils.d.ts +8 -0
- package/dist/esm/components/Collection/layouts/shared/headerUtils.d.ts.map +1 -0
- package/dist/esm/components/Collection/layouts/shared/headerUtils.js +14 -0
- package/dist/esm/components/Collection/layouts/shared/headerUtils.js.map +1 -0
- package/dist/esm/components/Collection/layouts/shared/itemRenderer.d.ts +78 -0
- package/dist/esm/components/Collection/layouts/shared/itemRenderer.d.ts.map +1 -0
- package/dist/esm/components/Collection/layouts/shared/itemRenderer.js +150 -0
- package/dist/esm/components/Collection/layouts/shared/itemRenderer.js.map +1 -0
- package/dist/esm/components/Collection/layouts/shared/layoutConstants.d.ts +38 -0
- package/dist/esm/components/Collection/layouts/shared/layoutConstants.d.ts.map +1 -0
- package/dist/esm/components/Collection/layouts/shared/layoutConstants.js +18 -0
- package/dist/esm/components/Collection/layouts/shared/layoutConstants.js.map +1 -0
- package/dist/esm/components/Collection/layouts/vertical-layout/VerticalLayout.d.ts +12 -0
- package/dist/esm/components/Collection/layouts/vertical-layout/VerticalLayout.d.ts.map +1 -0
- package/dist/esm/components/Collection/layouts/vertical-layout/VerticalLayout.js +11 -0
- package/dist/esm/components/Collection/layouts/vertical-layout/VerticalLayout.js.map +1 -0
- package/dist/esm/components/Collection/layouts/vertical-layout/VerticalLayout.module.css +35 -0
- package/dist/esm/components/Collection/layouts/vertical-layout/VerticalLayoutBody.d.ts +6 -0
- package/dist/esm/components/Collection/layouts/vertical-layout/VerticalLayoutBody.d.ts.map +1 -0
- package/dist/esm/components/Collection/layouts/vertical-layout/VerticalLayoutBody.js +103 -0
- package/dist/esm/components/Collection/layouts/vertical-layout/VerticalLayoutBody.js.map +1 -0
- package/dist/esm/components/Collection/layouts/vertical-layout/VerticalLayoutHeader.d.ts +10 -0
- package/dist/esm/components/Collection/layouts/vertical-layout/VerticalLayoutHeader.d.ts.map +1 -0
- package/dist/esm/components/Collection/layouts/vertical-layout/VerticalLayoutHeader.js +6 -0
- package/dist/esm/components/Collection/layouts/vertical-layout/VerticalLayoutHeader.js.map +1 -0
- package/dist/esm/index.d.ts +2 -0
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js.map +1 -1
- package/package.json +3 -3
- package/src/components/Collection/Collection.module.css +13 -1
- package/src/components/Collection/Collection.tsx +149 -50
- package/src/components/Collection/CollectionAddButton.tsx +42 -0
- package/src/components/Collection/CollectionColumn.types.ts +79 -0
- package/src/components/Collection/CollectionContext.ts +5 -0
- package/src/components/Collection/CollectionItem.tsx +10 -21
- package/src/components/Collection/__tests__/CollectionWithColumns.spec.tsx +560 -0
- package/src/components/Collection/layouts/CollectionLayout.types.ts +56 -0
- package/src/components/Collection/layouts/CollectionLayouts.tsx +15 -0
- package/src/components/Collection/layouts/horizontal-layout/HorizontalLayout.module.css +37 -0
- package/src/components/Collection/layouts/horizontal-layout/HorizontalLayout.tsx +9 -0
- package/src/components/Collection/layouts/horizontal-layout/HorizontalLayoutBody.tsx +68 -0
- package/src/components/Collection/layouts/horizontal-layout/HorizontalLayoutHeader.tsx +33 -0
- package/src/components/Collection/layouts/shared/DragHandle.tsx +22 -0
- package/src/components/Collection/layouts/shared/RemoveButton.tsx +30 -0
- package/src/components/Collection/layouts/shared/columnUtils.ts +20 -0
- package/src/components/Collection/layouts/shared/headerUtils.ts +14 -0
- package/src/components/Collection/layouts/shared/itemRenderer.tsx +242 -0
- package/src/components/Collection/layouts/shared/layoutConstants.ts +51 -0
- package/src/components/Collection/layouts/vertical-layout/VerticalLayout.module.css +35 -0
- package/src/components/Collection/layouts/vertical-layout/VerticalLayout.tsx +9 -0
- package/src/components/Collection/layouts/vertical-layout/VerticalLayoutBody.tsx +120 -0
- package/src/components/Collection/layouts/vertical-layout/VerticalLayoutHeader.tsx +8 -0
- package/src/index.ts +11 -0
|
@@ -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":["CollectionProvider","useCollectionContext","createSafeContext"],"mappings":";;;;;;;;;;;
|
|
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":["CollectionProvider","useCollectionContext","createSafeContext"],"mappings":";;;;;;;;;;;QAYcA;eAAAA;;QAAoBC;eAAAA;;;;oBAZiB;IAYOC,wCAAAA,IAAAA,uBAAiB,EACvE;AADG,IAAOF,qBAA4CE,uBAAxBD,uBAAwBC"}
|
|
@@ -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?:
|
|
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":"
|
|
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"}
|
|
@@ -12,36 +12,16 @@ var _object_spread = require("@swc/helpers/_/_object_spread");
|
|
|
12
12
|
var _object_spread_props = require("@swc/helpers/_/_object_spread_props");
|
|
13
13
|
var _object_without_properties = require("@swc/helpers/_/_object_without_properties");
|
|
14
14
|
var _jsxruntime = require("react/jsx-runtime");
|
|
15
|
-
var _plasmareacticons = require("@coveord/plasma-react-icons");
|
|
16
15
|
var _sortable = require("@dnd-kit/sortable");
|
|
17
16
|
var _utilities = require("@dnd-kit/utilities");
|
|
18
17
|
var _core = require("@mantine/core");
|
|
19
|
-
var _ActionIcon = require("../ActionIcon/ActionIcon.js");
|
|
20
18
|
var _CollectionContext = require("./CollectionContext.js");
|
|
19
|
+
var _DragHandle = require("./layouts/shared/DragHandle.js");
|
|
20
|
+
var _RemoveButton = require("./layouts/shared/RemoveButton.js");
|
|
21
21
|
var defaultProps = {
|
|
22
22
|
removable: true,
|
|
23
23
|
gap: 'sm'
|
|
24
24
|
};
|
|
25
|
-
var RemoveButton = function(param) {
|
|
26
|
-
var onClick = param.onClick;
|
|
27
|
-
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_ActionIcon.ActionIcon.Quaternary, {
|
|
28
|
-
style: {
|
|
29
|
-
alignSelf: 'center'
|
|
30
|
-
},
|
|
31
|
-
onClick: onClick,
|
|
32
|
-
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_plasmareacticons.IconTrash, {
|
|
33
|
-
"aria-label": "Remove",
|
|
34
|
-
size: 16
|
|
35
|
-
})
|
|
36
|
-
});
|
|
37
|
-
};
|
|
38
|
-
var RemoveButtonPlaceholder = function() {
|
|
39
|
-
return /*#__PURE__*/ (0, _jsxruntime.jsx)("div", {
|
|
40
|
-
style: {
|
|
41
|
-
width: 28
|
|
42
|
-
}
|
|
43
|
-
});
|
|
44
|
-
};
|
|
45
25
|
var StaticCollectionItem = function(props) {
|
|
46
26
|
var _useProps = (0, _core.useProps)('CollectionItem', defaultProps, props), children = _useProps.children, removable = _useProps.removable, onRemove = _useProps.onRemove, id = _useProps.id, // Style props
|
|
47
27
|
style = _useProps.style, className = _useProps.className, classNames = _useProps.classNames, styles = _useProps.styles, others = _object_without_properties._(_useProps, [
|
|
@@ -55,9 +35,6 @@ var StaticCollectionItem = function(props) {
|
|
|
55
35
|
"styles"
|
|
56
36
|
]);
|
|
57
37
|
var ctx = (0, _CollectionContext.useCollectionContext)();
|
|
58
|
-
var removeButton = removable && onRemove ? /*#__PURE__*/ (0, _jsxruntime.jsx)(RemoveButton, {
|
|
59
|
-
onClick: onRemove
|
|
60
|
-
}) : /*#__PURE__*/ (0, _jsxruntime.jsx)(RemoveButtonPlaceholder, {});
|
|
61
38
|
return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_core.Group, _object_spread_props._(_object_spread._({
|
|
62
39
|
"data-testid": "item-".concat(id)
|
|
63
40
|
}, ctx.getStyles('item', {
|
|
@@ -68,16 +45,21 @@ var StaticCollectionItem = function(props) {
|
|
|
68
45
|
}), others), {
|
|
69
46
|
children: [
|
|
70
47
|
children,
|
|
71
|
-
|
|
48
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_RemoveButton.RemoveButton, {
|
|
49
|
+
removable: removable,
|
|
50
|
+
onRemove: onRemove
|
|
51
|
+
})
|
|
72
52
|
]
|
|
73
53
|
}));
|
|
74
54
|
};
|
|
75
55
|
var DisabledCollectionItem = function(props) {
|
|
76
56
|
var ctx = (0, _CollectionContext.useCollectionContext)();
|
|
77
|
-
var _useProps = (0, _core.useProps)('CollectionItem', defaultProps, props), children = _useProps.children, id = _useProps.id, // Style props
|
|
57
|
+
var _useProps = (0, _core.useProps)('CollectionItem', defaultProps, props), children = _useProps.children, id = _useProps.id, _removable = _useProps.removable, _onRemove = _useProps.onRemove, // Style props
|
|
78
58
|
style = _useProps.style, className = _useProps.className, classNames = _useProps.classNames, styles = _useProps.styles, others = _object_without_properties._(_useProps, [
|
|
79
59
|
"children",
|
|
80
60
|
"id",
|
|
61
|
+
"removable",
|
|
62
|
+
"onRemove",
|
|
81
63
|
"style",
|
|
82
64
|
"className",
|
|
83
65
|
"classNames",
|
|
@@ -106,9 +88,6 @@ var DraggableCollectionItem = function(props) {
|
|
|
106
88
|
"classNames",
|
|
107
89
|
"styles"
|
|
108
90
|
]);
|
|
109
|
-
var removeButton = removable && onRemove ? /*#__PURE__*/ (0, _jsxruntime.jsx)(RemoveButton, {
|
|
110
|
-
onClick: onRemove
|
|
111
|
-
}) : null;
|
|
112
91
|
var _useSortable = (0, _sortable.useSortable)({
|
|
113
92
|
id: id
|
|
114
93
|
}), attributes = _useSortable.attributes, listeners = _useSortable.listeners, setNodeRef = _useSortable.setNodeRef, transform = _useSortable.transform, transition = _useSortable.transition, isDragging = _useSortable.isDragging, setActivatorNodeRef = _useSortable.setActivatorNodeRef;
|
|
@@ -127,15 +106,16 @@ var DraggableCollectionItem = function(props) {
|
|
|
127
106
|
"data-isdragging": isDragging
|
|
128
107
|
}), others), {
|
|
129
108
|
children: [
|
|
130
|
-
/*#__PURE__*/ (0, _jsxruntime.jsx)(
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
})
|
|
136
|
-
})),
|
|
109
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_DragHandle.DragHandle, {
|
|
110
|
+
setActivatorNodeRef: setActivatorNodeRef,
|
|
111
|
+
listeners: listeners,
|
|
112
|
+
attributes: attributes
|
|
113
|
+
}),
|
|
137
114
|
children,
|
|
138
|
-
|
|
115
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_RemoveButton.RemoveButton, {
|
|
116
|
+
removable: removable,
|
|
117
|
+
onRemove: onRemove
|
|
118
|
+
})
|
|
139
119
|
]
|
|
140
120
|
}));
|
|
141
121
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/Collection/CollectionItem.tsx"],"sourcesContent":["import {
|
|
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":["CollectionItem","defaultProps","removable","gap","StaticCollectionItem","props","useProps","children","onRemove","id","style","className","classNames","styles","others","ctx","useCollectionContext","Group","data-testid","getStyles","RemoveButton","DisabledCollectionItem","_removable","_onRemove","DraggableCollectionItem","useSortable","attributes","listeners","setNodeRef","transform","transition","isDragging","setActivatorNodeRef","ref","CSS","Transform","toString","undefined","data-isdragging","DragHandle","draggable","disabled","otherProps"],"mappings":";;;;+BA2HaA;;;eAAAA;;;;;;;wBA3Ha;yBACR;oBACwB;iCAGP;0BACV;4BACE;AAa3B,IAAMC,eAAmD;IACrDC,WAAW;IACXC,KAAK;AACT;AAEA,IAAMC,uBAAwF,SAACC;IAC3F,IAYIC,YAAAA,IAAAA,cAAQ,EAAC,kBAAkBL,cAAcI,QAXzCE,WAWAD,UAXAC,UACAL,YAUAI,UAVAJ,WACAM,WASAF,UATAE,UACAC,KAQAH,UARAG,IAEA,cAAc;IACdC,QAKAJ,UALAI,OACAC,YAIAL,UAJAK,WACAC,aAGAN,UAHAM,YACAC,SAEAP,UAFAO,QACGC,sCACHR;QAXAC;QACAL;QACAM;QACAC;QAGAC;QACAC;QACAC;QACAC;;IAGJ,IAAME,MAAMC,IAAAA,uCAAoB;IAEhC,qBACI,sBAACC,WAAK;QACFC,eAAa,AAAC,QAAU,OAAHT;OACjBM,IAAII,SAAS,CAAC,QAAQ;QAACT,OAAAA;QAAOC,WAAAA;QAAWC,YAAAA;QAAYC,QAAAA;IAAM,IAC3DC;;YAEHP;0BACD,qBAACa,0BAAY;gBAAClB,WAAWA;gBAAWM,UAAUA;;;;AAG1D;AAEA,IAAMa,yBAA0F,SAAChB;IAC7F,IAAMU,MAAMC,IAAAA,uCAAoB;IAChC,IAYIV,YAAAA,IAAAA,cAAQ,EAAC,kBAAkBL,cAAcI,QAXzCE,WAWAD,UAXAC,UACAE,KAUAH,UAVAG,IACAP,AAAWoB,aASXhB,UATAJ,WACAM,AAAUe,YAQVjB,UARAE,UAEA,cAAc;IACdE,QAKAJ,UALAI,OACAC,YAIAL,UAJAK,WACAC,aAGAN,UAHAM,YACAC,SAEAP,UAFAO,QACGC,sCACHR;QAXAC;QACAE;QACAP;QACAM;QAGAE;QACAC;QACAC;QACAC;;IAGJ,qBACI,qBAACI,WAAK;QACFC,eAAa,AAAC,QAAU,OAAHT;OACjBM,IAAII,SAAS,CAAC,QAAQ;QAACT,OAAAA;QAAOC,WAAAA;QAAWC,YAAAA;QAAYC,QAAAA;IAAM,IAC3DC;kBAEHP;;AAGb;AAEA,IAAMiB,0BAA2F,SAACnB;IAC9F,IAAMU,MAAMC,IAAAA,uCAAoB;IAChC,IAWIV,YAAAA,IAAAA,cAAQ,EAAC,kBAAkBL,cAAcI,QAVzCE,WAUAD,UAVAC,UACAL,YASAI,UATAJ,WACAM,WAQAF,UARAE,UACAC,KAOAH,UAPAG,IAEA,cAAc;IACdE,YAIAL,UAJAK,WACAC,aAGAN,UAHAM,YACAC,SAEAP,UAFAO,QACGC,sCACHR;QAVAC;QACAL;QACAM;QACAC;QAGAE;QACAC;QACAC;;IAIJ,IAAoGY,eAAAA,IAAAA,qBAAW,EAAC;QAC5GhB,IAAAA;IACJ,IAFOiB,aAA6FD,aAA7FC,YAAYC,YAAiFF,aAAjFE,WAAWC,aAAsEH,aAAtEG,YAAYC,YAA0DJ,aAA1DI,WAAWC,aAA+CL,aAA/CK,YAAYC,aAAmCN,aAAnCM,YAAYC,sBAAuBP,aAAvBO;IAI7E,qBACI,sBAACf,WAAK;QACFC,eAAa,AAAC,QAAU,OAAHT;QACrBwB,KAAKL;OACDb,IAAII,SAAS,CAAC,QAAQ;QACtBT,OAAOmB,YACD;YACIA,WAAWK,cAAG,CAACC,SAAS,CAACC,QAAQ,CAACP;YAClCC,YAAAA;QACJ,IACAO;QACN1B,WAAAA;QACAC,YAAAA;QACAC,QAAAA;IACJ;QACAyB,mBAAiBP;QACbjB;;0BAEJ,qBAACyB,sBAAU;gBAACP,qBAAqBA;gBAAqBL,WAAWA;gBAAWD,YAAYA;;YACvFnB;0BACD,qBAACa,0BAAY;gBAAClB,WAAWA;gBAAWM,UAAUA;;;;AAG1D;AAEO,IAAMR,iBAA4E;QACrFwC,mBAAAA,WACAC,kBAAAA,UACGC;QAFHF;QACAC;;IAGA,IAAIA,UAAU;QACV,qBAAO,qBAACpB,6CAA2BqB;IACvC;IACA,IAAIF,WAAW;QACX,qBAAO,qBAAChB,8CAA4BkB;IACxC;IACA,qBAAO,qBAACtC,2CAAyBsC;AACrC"}
|
|
@@ -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 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../src/components/Collection/layouts/CollectionLayout.types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export declare const CollectionLayouts: {
|
|
2
|
+
readonly Horizontal: {
|
|
3
|
+
({ children }: import("./shared/layoutConstants.js").LayoutProps): import("react/jsx-runtime.js").JSX.Element;
|
|
4
|
+
Body: <T>(props: import("./shared/layoutConstants.js").LayoutBodyProps<T> & {
|
|
5
|
+
ref?: import("react").ForwardedRef<HTMLDivElement>;
|
|
6
|
+
}) => import("react/jsx-runtime.js").JSX.Element;
|
|
7
|
+
Header: (props: import("./shared/layoutConstants.js").LayoutHeaderProps & {
|
|
8
|
+
ref?: import("react").ForwardedRef<HTMLDivElement>;
|
|
9
|
+
}) => import("react/jsx-runtime.js").JSX.Element;
|
|
10
|
+
displayName: string;
|
|
11
|
+
};
|
|
12
|
+
readonly Vertical: {
|
|
13
|
+
({ children }: import("./shared/layoutConstants.js").LayoutProps): import("react/jsx-runtime.js").JSX.Element;
|
|
14
|
+
Body: <T>(props: import("./shared/layoutConstants.js").LayoutBodyProps<T> & {
|
|
15
|
+
ref?: import("react").ForwardedRef<HTMLDivElement>;
|
|
16
|
+
}) => import("react/jsx-runtime.js").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,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
function _export(target, all) {
|
|
6
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: Object.getOwnPropertyDescriptor(all, name).get
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
_export(exports, {
|
|
12
|
+
get CollectionLayouts () {
|
|
13
|
+
return CollectionLayouts;
|
|
14
|
+
},
|
|
15
|
+
get HorizontalLayout () {
|
|
16
|
+
return _HorizontalLayout.HorizontalLayout;
|
|
17
|
+
},
|
|
18
|
+
get VerticalLayout () {
|
|
19
|
+
return _VerticalLayout.VerticalLayout;
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
var _HorizontalLayout = require("./horizontal-layout/HorizontalLayout.js");
|
|
23
|
+
var _VerticalLayout = require("./vertical-layout/VerticalLayout.js");
|
|
24
|
+
var CollectionLayouts = {
|
|
25
|
+
Horizontal: _HorizontalLayout.HorizontalLayout,
|
|
26
|
+
Vertical: _VerticalLayout.VerticalLayout
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
//# 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":["CollectionLayouts","HorizontalLayout","VerticalLayout","Horizontal","Vertical"],"mappings":";;;;;;;;;;;QAGaA;eAAAA;;QAKLC;eAAAA,kCAAgB;;QAChBC;eAAAA,8BAAc;;;gCATS;8BACF;AAEtB,IAAMF,oBAAoB;IAC7BG,YAAYF,kCAAgB;IAC5BG,UAAUF,8BAAc;AAC5B"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { LayoutProps } from '../shared/layoutConstants.js';
|
|
2
|
+
export declare const HorizontalLayout: {
|
|
3
|
+
({ children }: LayoutProps): import("react/jsx-runtime.js").JSX.Element;
|
|
4
|
+
Body: <T>(props: import("../shared/layoutConstants.js").LayoutBodyProps<T> & {
|
|
5
|
+
ref?: import("react").ForwardedRef<HTMLDivElement>;
|
|
6
|
+
}) => import("react/jsx-runtime.js").JSX.Element;
|
|
7
|
+
Header: (props: import("../shared/layoutConstants.js").LayoutHeaderProps & {
|
|
8
|
+
ref?: import("react").ForwardedRef<HTMLDivElement>;
|
|
9
|
+
}) => import("react/jsx-runtime.js").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,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "HorizontalLayout", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return HorizontalLayout;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
var _jsxruntime = require("react/jsx-runtime");
|
|
12
|
+
var _HorizontalLayoutBody = require("./HorizontalLayoutBody.js");
|
|
13
|
+
var _HorizontalLayoutHeader = require("./HorizontalLayoutHeader.js");
|
|
14
|
+
var HorizontalLayout = function(param) {
|
|
15
|
+
var children = param.children;
|
|
16
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_jsxruntime.Fragment, {
|
|
17
|
+
children: children
|
|
18
|
+
});
|
|
19
|
+
};
|
|
20
|
+
HorizontalLayout.Body = _HorizontalLayoutBody.HorizontalLayoutBody;
|
|
21
|
+
HorizontalLayout.Header = _HorizontalLayoutHeader.HorizontalLayoutHeader;
|
|
22
|
+
HorizontalLayout.displayName = 'Horizontal';
|
|
23
|
+
|
|
24
|
+
//# 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":["HorizontalLayout","children","Body","HorizontalLayoutBody","Header","HorizontalLayoutHeader","displayName"],"mappings":";;;;+BAIaA;;;eAAAA;;;;oCAHsB;sCACE;AAE9B,IAAMA,mBAAmB;QAAEC,iBAAAA;yBAA2B;kBAAGA;;;AAEhED,iBAAiBE,IAAI,GAAGC,0CAAoB;AAC5CH,iBAAiBI,MAAM,GAAGC,8CAAsB;AAChDL,iBAAiBM,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.js").JSX.Element;
|
|
6
|
+
//# sourceMappingURL=HorizontalLayoutBody.d.ts.map
|
package/dist/cjs/components/Collection/layouts/horizontal-layout/HorizontalLayoutBody.d.ts.map
ADDED
|
@@ -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,+CAgCxG,CAAC"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "HorizontalLayoutBody", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return HorizontalLayoutBody;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
var _interop_require_default = require("@swc/helpers/_/_interop_require_default");
|
|
12
|
+
var _object_spread = require("@swc/helpers/_/_object_spread");
|
|
13
|
+
var _object_spread_props = require("@swc/helpers/_/_object_spread_props");
|
|
14
|
+
var _object_without_properties = require("@swc/helpers/_/_object_without_properties");
|
|
15
|
+
var _jsxruntime = require("react/jsx-runtime");
|
|
16
|
+
var _core = require("@mantine/core");
|
|
17
|
+
var _react = require("react");
|
|
18
|
+
var _CollectionContext = require("../../CollectionContext.js");
|
|
19
|
+
var _columnUtils = require("../shared/columnUtils.js");
|
|
20
|
+
var _itemRenderer = require("../shared/itemRenderer.js");
|
|
21
|
+
var _layoutConstants = require("../shared/layoutConstants.js");
|
|
22
|
+
var _HorizontalLayoutmodulecss = /*#__PURE__*/ _interop_require_default._(require("./HorizontalLayout.module.css"));
|
|
23
|
+
var defaultProps = _layoutConstants.LAYOUT_BODY_DEFAULT_PROPS;
|
|
24
|
+
/**
|
|
25
|
+
* Horizontal layout specific content renderer - renders cells in a row
|
|
26
|
+
*/ var renderHorizontalContent = function(item, index, columns, cellContext, layoutClasses) {
|
|
27
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_jsxruntime.Fragment, {
|
|
28
|
+
children: columns.map(function(column, colIndex) {
|
|
29
|
+
var _column_id;
|
|
30
|
+
var columnId = (_column_id = column.id) !== null && _column_id !== void 0 ? _column_id : "column-".concat(colIndex);
|
|
31
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_core.Box, {
|
|
32
|
+
className: layoutClasses.cell,
|
|
33
|
+
style: (0, _columnUtils.getColumnSizeStyles)(column),
|
|
34
|
+
children: column.cell(item, index, cellContext)
|
|
35
|
+
}, columnId);
|
|
36
|
+
})
|
|
37
|
+
});
|
|
38
|
+
};
|
|
39
|
+
// Create renderers once - they are stable component references
|
|
40
|
+
var horizontalRenderers = (0, _itemRenderer.createItemRenderers)();
|
|
41
|
+
var HorizontalLayoutBody = function(props) {
|
|
42
|
+
var collectionCtx = (0, _CollectionContext.useCollectionContext)();
|
|
43
|
+
var _useProps = (0, _core.useProps)('HorizontalLayoutBody', defaultProps, props), items = _useProps.items, onRemove = _useProps.onRemove, removable = _useProps.removable, draggable = _useProps.draggable, disabled = _useProps.disabled, readOnly = _useProps.readOnly, getItemId = _useProps.getItemId, gap = _useProps.gap, ref = _useProps.ref, others = _object_without_properties._(_useProps, [
|
|
44
|
+
"items",
|
|
45
|
+
"onRemove",
|
|
46
|
+
"removable",
|
|
47
|
+
"draggable",
|
|
48
|
+
"disabled",
|
|
49
|
+
"readOnly",
|
|
50
|
+
"getItemId",
|
|
51
|
+
"gap",
|
|
52
|
+
"ref"
|
|
53
|
+
]);
|
|
54
|
+
var config = (0, _react.useMemo)(function() {
|
|
55
|
+
return {
|
|
56
|
+
renderContent: renderHorizontalContent,
|
|
57
|
+
containerSelector: 'row',
|
|
58
|
+
inlineControls: true
|
|
59
|
+
};
|
|
60
|
+
}, []);
|
|
61
|
+
var rows = (0, _itemRenderer.mapItemsToComponents)(items, horizontalRenderers, config, _HorizontalLayoutmodulecss.default, {
|
|
62
|
+
getItemId: getItemId,
|
|
63
|
+
onRemove: onRemove,
|
|
64
|
+
removable: removable,
|
|
65
|
+
draggable: draggable,
|
|
66
|
+
disabled: disabled,
|
|
67
|
+
readOnly: readOnly,
|
|
68
|
+
columns: collectionCtx.columns
|
|
69
|
+
});
|
|
70
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_core.Stack, _object_spread_props._(_object_spread._({
|
|
71
|
+
ref: ref,
|
|
72
|
+
gap: gap
|
|
73
|
+
}, others), {
|
|
74
|
+
children: rows
|
|
75
|
+
}));
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
//# 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":["HorizontalLayoutBody","defaultProps","LAYOUT_BODY_DEFAULT_PROPS","renderHorizontalContent","item","index","columns","cellContext","layoutClasses","map","column","colIndex","columnId","id","Box","className","cell","style","getColumnSizeStyles","horizontalRenderers","createItemRenderers","props","collectionCtx","useCollectionContext","useProps","items","onRemove","removable","draggable","disabled","readOnly","getItemId","gap","ref","others","config","useMemo","renderContent","containerSelector","inlineControls","rows","mapItemsToComponents","classes","Stack"],"mappings":";;;;+BAmCaA;;;eAAAA;;;;;;;;oBAnCsB;qBACC;iCACD;2BACD;4BAC0D;+BACnC;kFACrC;AAEpB,IAAMC,eAAyCC,0CAAyB;AAExE;;CAEC,GACD,IAAMC,0BAAwD,SAC1DC,MACAC,OACAC,SACAC,aACAC;yBAEA;kBACKF,QAAQG,GAAG,CAAC,SAACC,QAAQC;gBACDD;YAAjB,IAAME,WAAWF,CAAAA,aAAAA,OAAOG,EAAE,cAATH,wBAAAA,aAAa,AAAC,UAAkB,OAATC;YACxC,qBACI,qBAACG,SAAG;gBAAgBC,WAAWP,cAAcQ,IAAI;gBAAEC,OAAOC,IAAAA,gCAAmB,EAACR;0BACzEA,OAAOM,IAAI,CAACZ,MAAMC,OAAOE;eADpBK;QAIlB;;;AAIR,+DAA+D;AAC/D,IAAMO,sBAAsBC,IAAAA,iCAAmB;AAExC,IAAMpB,uBAAuB,SAAKqB;IACrC,IAAMC,gBAAgBC,IAAAA,uCAAoB;IAC1C,IAAoGC,YAAAA,IAAAA,cAAQ,EACxG,wBACAvB,cACAoB,QAHGI,QAA6FD,UAA7FC,OAAOC,WAAsFF,UAAtFE,UAAUC,YAA4EH,UAA5EG,WAAWC,YAAiEJ,UAAjEI,WAAWC,WAAsDL,UAAtDK,UAAUC,WAA4CN,UAA5CM,UAAUC,YAAkCP,UAAlCO,WAAWC,MAAuBR,UAAvBQ,KAAKC,MAAkBT,UAAlBS,KAAQC,sCAAUV;QAA7FC;QAAOC;QAAUC;QAAWC;QAAWC;QAAUC;QAAUC;QAAWC;QAAKC;;IAMlF,IAAME,SAASC,IAAAA,cAAO,EAClB;eAAO;YACHC,eAAelC;YACfmC,mBAAmB;YACnBC,gBAAgB;QACpB;OACA,EAAE;IAGN,IAAMC,OAAOC,IAAAA,kCAAoB,EAAChB,OAAON,qBAAqBgB,QAAQO,kCAAO,EAAmB;QAC5FX,WAAAA;QACAL,UAAAA;QACAC,WAAAA;QACAC,WAAAA;QACAC,UAAAA;QACAC,UAAAA;QACAxB,SAASgB,cAAchB,OAAO;IAClC;IAEA,qBACI,qBAACqC,WAAK;QAACV,KAAKA;QAAKD,KAAKA;OAASE;kBAC1BM;;AAGb"}
|
|
@@ -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.js").JSX.Element;
|
|
6
|
+
//# sourceMappingURL=HorizontalLayoutHeader.d.ts.map
|
package/dist/cjs/components/Collection/layouts/horizontal-layout/HorizontalLayoutHeader.d.ts.map
ADDED
|
@@ -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,+CAsBrG,CAAC"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "HorizontalLayoutHeader", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return HorizontalLayoutHeader;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
var _interop_require_default = require("@swc/helpers/_/_interop_require_default");
|
|
12
|
+
var _object_spread = require("@swc/helpers/_/_object_spread");
|
|
13
|
+
var _object_spread_props = require("@swc/helpers/_/_object_spread_props");
|
|
14
|
+
var _object_without_properties = require("@swc/helpers/_/_object_without_properties");
|
|
15
|
+
var _jsxruntime = require("react/jsx-runtime");
|
|
16
|
+
var _core = require("@mantine/core");
|
|
17
|
+
var _CollectionContext = require("../../CollectionContext.js");
|
|
18
|
+
var _columnUtils = require("../shared/columnUtils.js");
|
|
19
|
+
var _headerUtils = require("../shared/headerUtils.js");
|
|
20
|
+
var _layoutConstants = require("../shared/layoutConstants.js");
|
|
21
|
+
var _HorizontalLayoutmodulecss = /*#__PURE__*/ _interop_require_default._(require("./HorizontalLayout.module.css"));
|
|
22
|
+
var defaultProps = _layoutConstants.LAYOUT_HEADER_DEFAULT_PROPS;
|
|
23
|
+
var HorizontalLayoutHeader = function(props) {
|
|
24
|
+
var collectionCtx = (0, _CollectionContext.useCollectionContext)();
|
|
25
|
+
var _useProps = (0, _core.useProps)('HorizontalLayoutHeader', defaultProps, props), draggable = _useProps.draggable, removable = _useProps.removable, style = _useProps.style, ref = _useProps.ref, others = _object_without_properties._(_useProps, [
|
|
26
|
+
"draggable",
|
|
27
|
+
"removable",
|
|
28
|
+
"style",
|
|
29
|
+
"ref"
|
|
30
|
+
]);
|
|
31
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_core.Box, _object_spread_props._(_object_spread._({
|
|
32
|
+
ref: ref,
|
|
33
|
+
className: _HorizontalLayoutmodulecss.default.headerRow,
|
|
34
|
+
style: style
|
|
35
|
+
}, others), {
|
|
36
|
+
children: [
|
|
37
|
+
draggable && /*#__PURE__*/ (0, _jsxruntime.jsx)("div", {
|
|
38
|
+
className: _HorizontalLayoutmodulecss.default.dragHandleHeader
|
|
39
|
+
}),
|
|
40
|
+
collectionCtx.columns.map(function(column, index) {
|
|
41
|
+
var _column_id;
|
|
42
|
+
var columnId = (_column_id = column.id) !== null && _column_id !== void 0 ? _column_id : "column-".concat(index);
|
|
43
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_core.Box, {
|
|
44
|
+
className: _HorizontalLayoutmodulecss.default.headerCell,
|
|
45
|
+
style: (0, _columnUtils.getColumnSizeStyles)(column),
|
|
46
|
+
children: (0, _headerUtils.renderColumnHeader)(column.header, index)
|
|
47
|
+
}, columnId);
|
|
48
|
+
}),
|
|
49
|
+
removable && /*#__PURE__*/ (0, _jsxruntime.jsx)("div", {
|
|
50
|
+
className: _HorizontalLayoutmodulecss.default.removeButtonHeader
|
|
51
|
+
})
|
|
52
|
+
]
|
|
53
|
+
}));
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
//# sourceMappingURL=HorizontalLayoutHeader.js.map
|
package/dist/cjs/components/Collection/layouts/horizontal-layout/HorizontalLayoutHeader.js.map
ADDED
|
@@ -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":["HorizontalLayoutHeader","defaultProps","LAYOUT_HEADER_DEFAULT_PROPS","props","collectionCtx","useCollectionContext","useProps","draggable","removable","style","ref","others","Box","className","classes","headerRow","div","dragHandleHeader","columns","map","column","index","columnId","id","headerCell","getColumnSizeStyles","renderColumnHeader","header","removeButtonHeader"],"mappings":";;;;+BAUaA;;;eAAAA;;;;;;;;oBAVe;iCAEO;2BACD;2BACD;+BAC4B;kFACzC;AAEpB,IAAMC,eAA2CC,4CAA2B;AAErE,IAAMF,yBAAyB,SAACG;IACnC,IAAMC,gBAAgBC,IAAAA,uCAAoB;IAC1C,IAAsDC,YAAAA,IAAAA,cAAQ,EAC1D,0BACAL,cACAE,QAHGI,YAA+CD,UAA/CC,WAAWC,YAAoCF,UAApCE,WAAWC,QAAyBH,UAAzBG,OAAOC,MAAkBJ,UAAlBI,KAAQC,sCAAUL;QAA/CC;QAAWC;QAAWC;QAAOC;;IAMpC,qBACI,sBAACE,SAAG;QAACF,KAAKA;QAAKG,WAAWC,kCAAO,CAACC,SAAS;QAAEN,OAAOA;OAAWE;;YAC1DJ,2BAAa,qBAACS;gBAAIH,WAAWC,kCAAO,CAACG,gBAAgB;;YACrDb,cAAcc,OAAO,CAACC,GAAG,CAAC,SAACC,QAAQC;oBACfD;gBAAjB,IAAME,WAAWF,CAAAA,aAAAA,OAAOG,EAAE,cAATH,wBAAAA,aAAa,AAAC,UAAe,OAANC;gBACxC,qBACI,qBAACT,SAAG;oBAAgBC,WAAWC,kCAAO,CAACU,UAAU;oBAAEf,OAAOgB,IAAAA,gCAAmB,EAACL;8BACzEM,IAAAA,+BAAkB,EAACN,OAAOO,MAAM,EAAEN;mBAD7BC;YAIlB;YACCd,2BAAa,qBAACQ;gBAAIH,WAAWC,kCAAO,CAACc,kBAAkB;;;;AAGpE"}
|
|
@@ -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"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "DragHandle", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return DragHandle;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
var _object_spread = require("@swc/helpers/_/_object_spread");
|
|
12
|
+
var _object_spread_props = require("@swc/helpers/_/_object_spread_props");
|
|
13
|
+
var _jsxruntime = require("react/jsx-runtime");
|
|
14
|
+
var _plasmareacticons = require("@coveord/plasma-react-icons");
|
|
15
|
+
var _CollectionContext = require("../../CollectionContext.js");
|
|
16
|
+
var DragHandle = function(param) {
|
|
17
|
+
var setActivatorNodeRef = param.setActivatorNodeRef, listeners = param.listeners, attributes = param.attributes;
|
|
18
|
+
var getStyles = (0, _CollectionContext.useCollectionContext)().getStyles;
|
|
19
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsx)("div", _object_spread_props._(_object_spread._({
|
|
20
|
+
ref: setActivatorNodeRef
|
|
21
|
+
}, listeners, attributes, getStyles('dragHandle')), {
|
|
22
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_plasmareacticons.DragAndDropSize16Px, {
|
|
23
|
+
height: 16
|
|
24
|
+
})
|
|
25
|
+
}));
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
//# sourceMappingURL=DragHandle.js.map
|