@luscii-healthtech/web-ui 2.5.1 → 2.5.2
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/dist/components/List/List.d.ts +1 -0
- package/dist/components/List/List.types.d.ts +0 -3
- package/dist/web-ui.cjs.development.js +33 -26
- package/dist/web-ui.cjs.development.js.map +1 -1
- package/dist/web-ui.cjs.production.min.js +1 -1
- package/dist/web-ui.cjs.production.min.js.map +1 -1
- package/dist/web-ui.esm.js +33 -26
- package/dist/web-ui.esm.js.map +1 -1
- package/package.json +2 -1
- package/src/components/List/List.scss +23 -0
- package/src/components/List/List.tsx +10 -6
- package/src/components/List/List.types.ts +0 -4
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "2.5.
|
|
2
|
+
"version": "2.5.2",
|
|
3
3
|
"license": "MIT",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"typings": "dist/index.d.ts",
|
|
@@ -103,6 +103,7 @@
|
|
|
103
103
|
"@fontsource/roboto": "^4.5.7",
|
|
104
104
|
"@hookform/error-message": "^2.0.0",
|
|
105
105
|
"@reach/router": "^1.3.4",
|
|
106
|
+
"@types/react-dragula": "^1.1.0",
|
|
106
107
|
"@typescript-eslint/eslint-plugin": "^5.29.0",
|
|
107
108
|
"classnames": "^2.3.1",
|
|
108
109
|
"clipboard": "^2.0.11",
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
li {
|
|
2
|
+
&.gu-mirror {
|
|
3
|
+
@apply shadow-xl m-0 fixed z-9999;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
&.gu-hide {
|
|
7
|
+
@apply hidden;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
&.gu-unselectable {
|
|
11
|
+
@apply select-none;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
&.gu-transit {
|
|
15
|
+
@apply bg-blue-50;
|
|
16
|
+
@apply outline-dropTarget;
|
|
17
|
+
filter: none;
|
|
18
|
+
@apply opacity-100 rounded-none border-none; // TODO we only need these to override them in cVitals-Web
|
|
19
|
+
}
|
|
20
|
+
&.gu-transit > * {
|
|
21
|
+
@apply invisible;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -10,10 +10,11 @@ import {
|
|
|
10
10
|
ListProps,
|
|
11
11
|
ListItemProps,
|
|
12
12
|
OnAssetLoadErrorPayload,
|
|
13
|
-
Dragula,
|
|
14
13
|
} from "./List.types";
|
|
15
14
|
import { ListSkeleton } from "./ListSkeleton";
|
|
16
15
|
|
|
16
|
+
import "./List.scss";
|
|
17
|
+
|
|
17
18
|
export { ListProps, ListItemProps, OnAssetLoadErrorPayload };
|
|
18
19
|
|
|
19
20
|
export const List = ({
|
|
@@ -27,19 +28,19 @@ export const List = ({
|
|
|
27
28
|
isLoading,
|
|
28
29
|
}: ListProps): JSX.Element => {
|
|
29
30
|
const listRef = useRef<HTMLUListElement | null>(null);
|
|
30
|
-
const dragulaRef = useRef<
|
|
31
|
+
const dragulaRef = useRef<dragula.Drake | null>(null);
|
|
31
32
|
const hasHeader = !!(title || headerButton);
|
|
32
33
|
|
|
33
34
|
useEffect(() => {
|
|
34
35
|
dragulaRef.current?.destroy?.();
|
|
35
|
-
if (onDragEnd && items.length) {
|
|
36
|
+
if (listRef.current && onDragEnd && items.length) {
|
|
36
37
|
dragulaRef.current = setupDragging();
|
|
37
38
|
}
|
|
38
39
|
|
|
39
40
|
return () => {
|
|
40
41
|
dragulaRef.current?.destroy?.();
|
|
41
42
|
};
|
|
42
|
-
}, [items]);
|
|
43
|
+
}, [items, listRef]);
|
|
43
44
|
|
|
44
45
|
const handleDragEnd = (element: HTMLElement) => {
|
|
45
46
|
const draggedItemId = element.dataset["id"];
|
|
@@ -61,11 +62,14 @@ export const List = ({
|
|
|
61
62
|
}
|
|
62
63
|
};
|
|
63
64
|
|
|
64
|
-
const setupDragging = ():
|
|
65
|
+
const setupDragging = (): dragula.Drake | null => {
|
|
66
|
+
if (!listRef.current) {
|
|
67
|
+
return null;
|
|
68
|
+
}
|
|
65
69
|
const dragulaInstance = dragula([listRef.current], {
|
|
66
70
|
revertOnSpill: true,
|
|
67
71
|
});
|
|
68
|
-
dragulaInstance.on("dragend", handleDragEnd);
|
|
72
|
+
dragulaInstance.on("dragend", handleDragEnd as (Element) => void);
|
|
69
73
|
|
|
70
74
|
return dragulaInstance;
|
|
71
75
|
};
|