pmg-ui-kit 0.0.35 → 0.0.37
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/icons/InfoIcon.d.ts +8 -0
- package/dist/icons/InfoIcon.js +2 -0
- package/dist/icons/TrashIcon.d.ts +4 -4
- package/dist/icons/TrashIcon.js +2 -2
- package/dist/ui/atoms/InputTypeFileWithListing.js +1 -1
- package/dist/ui/atoms/Modal.d.ts +1 -1
- package/dist/ui/atoms/Modal.js +1 -1
- package/dist/ui/components/DragAndDropList.d.ts +12 -0
- package/dist/ui/components/DragAndDropList.js +42 -0
- package/package.json +1 -1
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
export const InfoIcon = ({ onClick, width = 24, height = 24, color = "currentColor" }) => (_jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", width: width, height: height, viewBox: "0 0 24 24", fill: "none", stroke: color, strokeWidth: 2, strokeLinecap: "round", strokeLinejoin: "round", onClick: onClick, className: "icon icon-tabler icons-tabler-outline icon-tabler-info-square", children: [_jsx("path", { stroke: "none", d: "M0 0h24v24H0z", fill: "none" }), _jsx("path", { d: "M12 9h.01" }), _jsx("path", { d: "M3 5a2 2 0 0 1 2 -2h14a2 2 0 0 1 2 2v14a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2v-14z" }), _jsx("path", { d: "M11 12h1v4h1" })] }));
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
type TrashIconProps = {
|
|
2
2
|
onClick?: () => void;
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
width?: number;
|
|
4
|
+
height?: number;
|
|
5
|
+
color?: string;
|
|
6
6
|
};
|
|
7
|
-
export declare const TrashIcon: ({
|
|
7
|
+
export declare const TrashIcon: ({ onClick, width, height, color }: TrashIconProps) => import("react/jsx-runtime").JSX.Element;
|
|
8
8
|
export {};
|
package/dist/icons/TrashIcon.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
export const TrashIcon = ({
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
export const TrashIcon = ({ onClick, width = 24, height = 24, color = "currentColor" }) => (_jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", width: width, height: height, viewBox: "0 0 24 24", fill: "none", stroke: color, strokeWidth: 2, strokeLinecap: "round", strokeLinejoin: "round", onClick: onClick, className: "icon icon-tabler icons-tabler-outline icon-tabler-trash", children: [_jsx("path", { stroke: "none", d: "M0 0h24v24H0z", fill: "none" }), _jsx("path", { d: "M4 7l16 0" }), _jsx("path", { d: "M10 11l0 6" }), _jsx("path", { d: "M14 11l0 6" }), _jsx("path", { d: "M5 7l1 12a2 2 0 0 0 2 2h8a2 2 0 0 0 2 -2l1 -12" }), _jsx("path", { d: "M9 7v-3a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v3" })] }));
|
|
@@ -19,6 +19,6 @@ export const InputTypeFileWithListing = ({ accept, className, handleChangeFilesL
|
|
|
19
19
|
_jsx("button", { onClick: () => {
|
|
20
20
|
setFilesList(filesList.filter((f) => f !== file));
|
|
21
21
|
handleChangeFilesList(filesList);
|
|
22
|
-
}, children: _jsx(TrashIcon, {
|
|
22
|
+
}, children: _jsx(TrashIcon, { color: "red" }) }, index),
|
|
23
23
|
]), globalTableCellsClassNames: "!py-2", tableCellsListClassNames: ["", "text-right"], hideColumnNames: true }))] }));
|
|
24
24
|
};
|
package/dist/ui/atoms/Modal.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ type ModalProps = {
|
|
|
10
10
|
cancelBtnLabel?: string;
|
|
11
11
|
cancelBtnClassname?: string;
|
|
12
12
|
hideButtons?: boolean;
|
|
13
|
-
size?: "xs" | "sm" | "md" | "lg" | "xl";
|
|
13
|
+
size?: "xs" | "sm" | "md" | "lg" | "xl" | "2xl" | "3xl" | "4xl" | "5xl" | "6xl" | "7xl";
|
|
14
14
|
};
|
|
15
15
|
export declare const Modal: ({ show, handleOnClose, handleOnAccept, header, content, okBtnLabel, okBtnClassname, cancelBtnLabel, cancelBtnClassname, hideButtons, size }: ModalProps) => import("react/jsx-runtime").JSX.Element;
|
|
16
16
|
export {};
|
package/dist/ui/atoms/Modal.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Modal as FlowbiteModal } from "flowbite-react";
|
|
3
3
|
import { Button } from "./Button";
|
|
4
|
-
export const Modal = ({ show, handleOnClose, handleOnAccept, header, content, okBtnLabel = "Ok", okBtnClassname, cancelBtnLabel = "Cancel", cancelBtnClassname, hideButtons = false, size = "
|
|
4
|
+
export const Modal = ({ show, handleOnClose, handleOnAccept, header, content, okBtnLabel = "Ok", okBtnClassname, cancelBtnLabel = "Cancel", cancelBtnClassname, hideButtons = false, size = "xl" }) => {
|
|
5
5
|
return (_jsxs(FlowbiteModal, { show: show, onClose: () => handleOnClose(), size: size, children: [_jsx(FlowbiteModal.Header, { children: header }), _jsx(FlowbiteModal.Body, { children: content }), !hideButtons &&
|
|
6
6
|
_jsxs(FlowbiteModal.Footer, { className: "flex justify-between", children: [_jsx(Button, { type: "b-primary", className: okBtnClassname, onClick: () => handleOnAccept(), text: okBtnLabel }), _jsx(Button, { type: "b-default", className: cancelBtnClassname, onClick: () => handleOnClose(), text: cancelBtnLabel })] })] }));
|
|
7
7
|
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
interface DragAndDropItem {
|
|
3
|
+
id: string;
|
|
4
|
+
content: ReactNode;
|
|
5
|
+
}
|
|
6
|
+
interface DragAndDropListProps {
|
|
7
|
+
items: DragAndDropItem[];
|
|
8
|
+
onItemsChange: (newItems: DragAndDropItem[]) => void;
|
|
9
|
+
className?: string;
|
|
10
|
+
}
|
|
11
|
+
export declare const DragAndDropList: ({ items, onItemsChange, className }: DragAndDropListProps) => import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from 'react';
|
|
3
|
+
export const DragAndDropList = ({ items, onItemsChange, className = "" }) => {
|
|
4
|
+
const [draggedItem, setDraggedItem] = useState(null);
|
|
5
|
+
const [dragOverIndex, setDragOverIndex] = useState(null);
|
|
6
|
+
const handleDragStart = (e, itemId) => {
|
|
7
|
+
setDraggedItem(itemId);
|
|
8
|
+
e.dataTransfer.effectAllowed = 'move';
|
|
9
|
+
};
|
|
10
|
+
const handleDragEnd = () => {
|
|
11
|
+
setDraggedItem(null);
|
|
12
|
+
setDragOverIndex(null);
|
|
13
|
+
};
|
|
14
|
+
const handleDragOver = (e, index) => {
|
|
15
|
+
e.preventDefault();
|
|
16
|
+
e.dataTransfer.dropEffect = 'move';
|
|
17
|
+
setDragOverIndex(index);
|
|
18
|
+
};
|
|
19
|
+
const handleDragLeave = () => {
|
|
20
|
+
setDragOverIndex(null);
|
|
21
|
+
};
|
|
22
|
+
const handleDrop = (e, dropIndex) => {
|
|
23
|
+
e.preventDefault();
|
|
24
|
+
if (!draggedItem)
|
|
25
|
+
return;
|
|
26
|
+
const draggedIndex = items.findIndex(item => item.id === draggedItem);
|
|
27
|
+
if (draggedIndex === -1 || draggedIndex === dropIndex)
|
|
28
|
+
return;
|
|
29
|
+
const newItems = [...items];
|
|
30
|
+
const [removed] = newItems.splice(draggedIndex, 1);
|
|
31
|
+
newItems.splice(dropIndex, 0, removed);
|
|
32
|
+
onItemsChange(newItems);
|
|
33
|
+
setDragOverIndex(null);
|
|
34
|
+
};
|
|
35
|
+
return (_jsx("div", { className: `space-y-2 ${className}`, children: items.map((item, index) => (_jsx("div", { draggable: true, onDragStart: (e) => handleDragStart(e, item.id), onDragEnd: handleDragEnd, onDragOver: (e) => handleDragOver(e, index), onDragLeave: handleDragLeave, onDrop: (e) => handleDrop(e, index), className: `
|
|
36
|
+
p-4 border-2 border-dashed border-gray-300 rounded-lg cursor-move
|
|
37
|
+
transition-all duration-200 bg-white
|
|
38
|
+
${draggedItem === item.id ? 'opacity-60 bg-gray-100 border-gray-400 shadow-lg scale-105' : ''}
|
|
39
|
+
${dragOverIndex === index ? 'border-blue-500 bg-blue-50 scale-102' : ''}
|
|
40
|
+
hover:border-gray-400 hover:shadow-md
|
|
41
|
+
`, children: _jsxs("div", { className: "flex items-center gap-3", children: [_jsx("div", { className: "text-gray-400 cursor-grab active:cursor-grabbing", children: _jsxs("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "currentColor", children: [_jsx("circle", { cx: "3", cy: "3", r: "1" }), _jsx("circle", { cx: "3", cy: "8", r: "1" }), _jsx("circle", { cx: "3", cy: "13", r: "1" }), _jsx("circle", { cx: "8", cy: "3", r: "1" }), _jsx("circle", { cx: "8", cy: "8", r: "1" }), _jsx("circle", { cx: "8", cy: "13", r: "1" })] }) }), _jsx("div", { className: "flex-1", children: item.content })] }) }, item.id))) }));
|
|
42
|
+
};
|