pmg-ui-kit 0.0.39 → 0.0.41

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.
@@ -0,0 +1,8 @@
1
+ type SaveIconProps = {
2
+ onClick?: () => void;
3
+ width?: number;
4
+ height?: number;
5
+ color?: string;
6
+ };
7
+ export declare const SaveIcon: ({ onClick, width, height, color }: SaveIconProps) => import("react/jsx-runtime").JSX.Element;
8
+ export {};
@@ -0,0 +1,2 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ export const SaveIcon = ({ 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-device-floppy", children: [_jsx("path", { stroke: "none", d: "M0 0h24v24H0z", fill: "none" }), _jsx("path", { d: "M6 4h10l4 4v10a2 2 0 0 1 -2 2h-12a2 2 0 0 1 -2 -2v-12a2 2 0 0 1 2 -2" }), _jsx("path", { d: "M12 14m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0" }), _jsx("path", { d: "M14 4l0 4l-6 0l0 -4" })] }));
package/dist/index.d.ts CHANGED
@@ -18,6 +18,8 @@ export * from './ui/atoms/Subheader';
18
18
  export * from './ui/atoms/Text';
19
19
  export * from './ui/atoms/Textarea';
20
20
  export * from './ui/atoms/Tooltip';
21
+ export * from './ui/components/Accordion';
22
+ export * from './ui/components/DragAndDropList';
21
23
  export * from './ui/components/Form';
22
24
  export * from './ui/components/FormElementContainer';
23
25
  export * from './ui/components/FormElementInputWithLink';
@@ -56,5 +58,6 @@ export * from './icons/PercentageIcon';
56
58
  export * from './icons/PlusIcon';
57
59
  export * from './icons/RefreshIcon';
58
60
  export * from './icons/SaveDiscIcon';
61
+ export * from './icons/SaveIcon';
59
62
  export * from './icons/TrashIcon';
60
63
  export * from './icons/UserPlusIcon';
package/dist/index.js CHANGED
@@ -18,6 +18,8 @@ export * from './ui/atoms/Subheader';
18
18
  export * from './ui/atoms/Text';
19
19
  export * from './ui/atoms/Textarea';
20
20
  export * from './ui/atoms/Tooltip';
21
+ export * from './ui/components/Accordion';
22
+ export * from './ui/components/DragAndDropList';
21
23
  export * from './ui/components/Form';
22
24
  export * from './ui/components/FormElementContainer';
23
25
  export * from './ui/components/FormElementInputWithLink';
@@ -56,5 +58,6 @@ export * from './icons/PercentageIcon';
56
58
  export * from './icons/PlusIcon';
57
59
  export * from './icons/RefreshIcon';
58
60
  export * from './icons/SaveDiscIcon';
61
+ export * from './icons/SaveIcon';
59
62
  export * from './icons/TrashIcon';
60
63
  export * from './icons/UserPlusIcon';
@@ -0,0 +1,9 @@
1
+ import { type ReactNode } from "react";
2
+ interface AccordionProps {
3
+ title: ReactNode;
4
+ content: ReactNode;
5
+ defaultOpen?: boolean;
6
+ className?: string;
7
+ }
8
+ export declare const Accordion: ({ title, content, defaultOpen, className }: AccordionProps) => import("react/jsx-runtime").JSX.Element;
9
+ export {};
@@ -0,0 +1,21 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useEffect, useRef, useState } from "react";
3
+ export const Accordion = ({ title, content, defaultOpen, className }) => {
4
+ const [isOpen, setIsOpen] = useState(defaultOpen);
5
+ const [contentHeight, setContentHeight] = useState(defaultOpen ? undefined : 0);
6
+ const contentRef = useRef(null);
7
+ useEffect(() => {
8
+ if (contentRef.current) {
9
+ if (isOpen) {
10
+ setContentHeight(contentRef.current.scrollHeight);
11
+ }
12
+ else {
13
+ setContentHeight(0);
14
+ }
15
+ }
16
+ }, [isOpen]);
17
+ const toggleAccordion = () => {
18
+ setIsOpen(!isOpen);
19
+ };
20
+ return (_jsxs("div", { className: `border border-gray-200 rounded-lg bg-white ${className}`, children: [_jsxs("div", { className: "flex items-center justify-between p-2 cursor-pointer hover:bg-gray-50 transition-colors", onClick: toggleAccordion, children: [_jsx("div", { className: "flex-1", children: title }), _jsx("div", { className: "ml-6", children: _jsx("div", { className: `text-gray-500 transition-transform duration-200 ${isOpen ? 'rotate-180' : ''}`, children: _jsx("svg", { width: "20", height: "20", viewBox: "0 0 16 16", fill: "currentColor", children: _jsx("path", { d: "M4 6l4 4 4-4H4z" }) }) }) })] }), _jsx("div", { className: "overflow-hidden transition-all duration-300 ease-in-out", style: { height: contentHeight }, children: _jsx("div", { ref: contentRef, className: "p-4 pt-0 border-t border-gray-100", children: content }) })] }));
21
+ };
@@ -1,12 +1,11 @@
1
- import { ReactNode } from 'react';
2
- interface DragAndDropItem {
1
+ import { type ReactNode } from 'react';
2
+ export interface DragAndDropItem {
3
3
  id: string;
4
4
  content: ReactNode;
5
5
  }
6
- interface DragAndDropListProps {
6
+ export interface DragAndDropListProps {
7
7
  items: DragAndDropItem[];
8
8
  onItemsChange: (newItems: DragAndDropItem[]) => void;
9
9
  className?: string;
10
10
  }
11
11
  export declare const DragAndDropList: ({ items, onItemsChange, className }: DragAndDropListProps) => import("react/jsx-runtime").JSX.Element;
12
- export {};
@@ -1,5 +1,6 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useState } from 'react';
3
+ import { GripVerticalIcon } from '../../icons/GripVerticalIcon';
3
4
  export const DragAndDropList = ({ items, onItemsChange, className = "" }) => {
4
5
  const [draggedItem, setDraggedItem] = useState(null);
5
6
  const [dragOverIndex, setDragOverIndex] = useState(null);
@@ -33,10 +34,10 @@ export const DragAndDropList = ({ items, onItemsChange, className = "" }) => {
33
34
  setDragOverIndex(null);
34
35
  };
35
36
  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
+ p-2 border-2 border-dashed border-pmg-blue rounded-lg cursor-move
37
38
  transition-all duration-200 bg-white
38
- ${draggedItem === item.id ? 'opacity-60 bg-gray-100 border-gray-400 shadow-lg scale-105' : ''}
39
+ ${draggedItem === item.id ? 'opacity-60 bg-blue-100 border-blue-400 shadow-lg scale-105' : ''}
39
40
  ${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))) }));
41
+ hover:border-blue-400 hover:shadow-md
42
+ `, children: _jsxs("div", { className: "flex items-center gap-3", children: [_jsx("div", { className: "text-gray-400 cursor-grab active:cursor-grabbing", children: _jsx(GripVerticalIcon, {}) }), _jsx("div", { className: "flex-1", children: item.content })] }) }, item.id))) }));
42
43
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pmg-ui-kit",
3
- "version": "0.0.39",
3
+ "version": "0.0.41",
4
4
  "description": "Components library for PMG projects",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",