@moontra/moonui-pro 2.0.11 → 2.0.12

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 (2) hide show
  1. package/dist/index.mjs +78 -1
  2. package/package.json +1 -1
package/dist/index.mjs CHANGED
@@ -14,6 +14,7 @@ import { useSyncExternalStoreWithSelector } from 'use-sync-external-store/shim/w
14
14
  import * as TooltipPrimitive from '@radix-ui/react-tooltip';
15
15
  import { cn as cn$1 } from '@moontra/moonui';
16
16
  import { ResponsiveContainer, ScatterChart, CartesianGrid, XAxis, YAxis, Tooltip as Tooltip$1, Legend, Scatter, PieChart, Pie, Cell, AreaChart, Area, ReferenceLine, Brush, BarChart, Bar, LineChart, Line, ReferenceArea } from 'recharts';
17
+ import { DragDropContext, Droppable, Draggable } from '@hello-pangea/dnd';
17
18
 
18
19
  /**
19
20
  * @moontra/moonui-pro v2.0.9
@@ -54997,5 +54998,81 @@ function Dashboard({
54997
54998
  ] })
54998
54999
  ] });
54999
55000
  }
55001
+ function DraggableList({
55002
+ items,
55003
+ onReorder,
55004
+ renderItem,
55005
+ keyExtractor,
55006
+ direction = "vertical",
55007
+ className,
55008
+ droppableId = "draggable-list",
55009
+ disabled = false
55010
+ }) {
55011
+ const handleDragEnd = (result) => {
55012
+ if (!result.destination || disabled) {
55013
+ return;
55014
+ }
55015
+ const sourceIndex = result.source.index;
55016
+ const destinationIndex = result.destination.index;
55017
+ if (sourceIndex === destinationIndex) {
55018
+ return;
55019
+ }
55020
+ const newItems = Array.from(items);
55021
+ const [reorderedItem] = newItems.splice(sourceIndex, 1);
55022
+ newItems.splice(destinationIndex, 0, reorderedItem);
55023
+ onReorder(newItems);
55024
+ };
55025
+ return /* @__PURE__ */ jsx(DragDropContext, { onDragEnd: handleDragEnd, children: /* @__PURE__ */ jsx(
55026
+ Droppable,
55027
+ {
55028
+ droppableId,
55029
+ direction,
55030
+ isDropDisabled: disabled,
55031
+ children: (provided, snapshot) => /* @__PURE__ */ jsxs(
55032
+ "div",
55033
+ {
55034
+ ...provided.droppableProps,
55035
+ ref: provided.innerRef,
55036
+ className: cn$1(
55037
+ "space-y-2",
55038
+ direction === "horizontal" && "flex space-y-0 space-x-2",
55039
+ snapshot.isDraggingOver && "bg-muted/50 rounded-lg",
55040
+ className
55041
+ ),
55042
+ children: [
55043
+ items.map((item, index2) => /* @__PURE__ */ jsx(
55044
+ Draggable,
55045
+ {
55046
+ draggableId: keyExtractor(item),
55047
+ index: index2,
55048
+ isDragDisabled: disabled,
55049
+ children: (provided2, snapshot2) => /* @__PURE__ */ jsx(
55050
+ "div",
55051
+ {
55052
+ ref: provided2.innerRef,
55053
+ ...provided2.draggableProps,
55054
+ ...provided2.dragHandleProps,
55055
+ className: cn$1(
55056
+ "transition-all duration-200",
55057
+ snapshot2.isDragging && "rotate-2 scale-105 shadow-lg z-50",
55058
+ disabled && "cursor-not-allowed opacity-50"
55059
+ ),
55060
+ style: {
55061
+ ...provided2.draggableProps.style,
55062
+ transform: snapshot2.isDragging ? provided2.draggableProps.style?.transform : "none"
55063
+ },
55064
+ children: renderItem(item, index2)
55065
+ }
55066
+ )
55067
+ },
55068
+ keyExtractor(item)
55069
+ )),
55070
+ provided.placeholder
55071
+ ]
55072
+ }
55073
+ )
55074
+ }
55075
+ ) });
55076
+ }
55000
55077
 
55001
- export { AdvancedChart, Calendar2 as Calendar, Dashboard, Kanban, MemoryAnalytics, MemoryEfficientData, RichTextEditor, SelectableVirtualList, SwipeableCard, Timeline, VirtualList, useStreamingData, useVirtualList };
55078
+ export { AdvancedChart, Calendar2 as Calendar, Dashboard, DraggableList, Kanban, MemoryAnalytics, MemoryEfficientData, RichTextEditor, SelectableVirtualList, SwipeableCard, Timeline, VirtualList, useStreamingData, useVirtualList };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moontra/moonui-pro",
3
- "version": "2.0.11",
3
+ "version": "2.0.12",
4
4
  "description": "Premium React components for MoonUI - Advanced UI library with 50+ pro components including performance, interactive, and gesture components",
5
5
  "type": "module",
6
6
  "main": "dist/index.mjs",