@moontra/moonui-pro 2.13.0 → 2.14.1
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/index.d.ts +51 -1
- package/dist/index.mjs +217 -63
- package/package.json +1 -1
- package/src/components/kanban/kanban.tsx +425 -215
- package/src/components/kanban/types.ts +57 -0
package/dist/index.d.ts
CHANGED
|
@@ -1120,9 +1120,59 @@ interface KanbanProps {
|
|
|
1120
1120
|
disabled?: boolean;
|
|
1121
1121
|
labels?: KanbanLabel[];
|
|
1122
1122
|
users?: KanbanAssignee[];
|
|
1123
|
+
renderCard?: (card: KanbanCard, column: KanbanColumn, provided: any) => React.ReactNode;
|
|
1124
|
+
renderCardPreview?: (card: KanbanCard) => React.ReactNode;
|
|
1125
|
+
renderCardBadge?: (card: KanbanCard) => React.ReactNode;
|
|
1126
|
+
renderCardActions?: (card: KanbanCard) => React.ReactNode;
|
|
1127
|
+
cardCompactMode?: boolean;
|
|
1128
|
+
cardShowCoverImage?: boolean;
|
|
1129
|
+
cardShowAssignees?: boolean;
|
|
1130
|
+
cardShowLabels?: boolean;
|
|
1131
|
+
cardShowProgress?: boolean;
|
|
1132
|
+
cardDateFormat?: string;
|
|
1133
|
+
cardMaxAssigneesToShow?: number;
|
|
1134
|
+
renderAddCardButton?: (columnId: string) => React.ReactNode;
|
|
1135
|
+
renderAddCardForm?: (columnId: string, onAdd: (card: Partial<KanbanCard>) => void, onCancel: () => void) => React.ReactNode;
|
|
1136
|
+
addCardButtonText?: string | ((columnId: string) => string);
|
|
1137
|
+
addCardPosition?: 'top' | 'bottom';
|
|
1138
|
+
allowQuickAdd?: boolean;
|
|
1139
|
+
quickAddFields?: ('title' | 'description' | 'assignee' | 'priority')[];
|
|
1140
|
+
validateCard?: (card: Partial<KanbanCard>) => {
|
|
1141
|
+
valid: boolean;
|
|
1142
|
+
errors?: string[];
|
|
1143
|
+
};
|
|
1144
|
+
onBeforeCardAdd?: (card: Partial<KanbanCard>) => Partial<KanbanCard> | false;
|
|
1145
|
+
renderColumnHeader?: (column: KanbanColumn) => React.ReactNode;
|
|
1146
|
+
renderColumnFooter?: (column: KanbanColumn) => React.ReactNode;
|
|
1147
|
+
renderEmptyColumn?: (column: KanbanColumn) => React.ReactNode;
|
|
1148
|
+
columnMenuActions?: Array<{
|
|
1149
|
+
label: string;
|
|
1150
|
+
icon?: React.ReactNode;
|
|
1151
|
+
action: (column: KanbanColumn) => void;
|
|
1152
|
+
visible?: (column: KanbanColumn) => boolean;
|
|
1153
|
+
}>;
|
|
1154
|
+
allowColumnReorder?: boolean;
|
|
1155
|
+
columnColorOptions?: string[];
|
|
1156
|
+
columnDefaultColor?: string;
|
|
1157
|
+
dragDisabled?: boolean | ((card: KanbanCard) => boolean);
|
|
1158
|
+
dropDisabled?: boolean | ((column: KanbanColumn) => boolean);
|
|
1159
|
+
dragPreview?: 'card' | 'compact' | 'custom';
|
|
1160
|
+
renderDragPreview?: (card: KanbanCard) => React.ReactNode;
|
|
1161
|
+
canDrop?: (card: KanbanCard, targetColumn: KanbanColumn, position: number) => boolean;
|
|
1162
|
+
onDragStart?: (card: KanbanCard, column: KanbanColumn) => void;
|
|
1163
|
+
onDragEnd?: (card: KanbanCard, column: KanbanColumn) => void;
|
|
1164
|
+
theme?: 'default' | 'compact' | 'modern' | 'minimal';
|
|
1165
|
+
cardVariant?: 'default' | 'bordered' | 'elevated' | 'flat';
|
|
1166
|
+
enableAnimations?: boolean;
|
|
1167
|
+
animationDuration?: number;
|
|
1168
|
+
columnWidth?: number | 'auto';
|
|
1169
|
+
columnGap?: number;
|
|
1170
|
+
cardGap?: number;
|
|
1171
|
+
showTooltips?: boolean;
|
|
1172
|
+
tooltipDelay?: number;
|
|
1123
1173
|
}
|
|
1124
1174
|
|
|
1125
|
-
declare function Kanban({ columns: initialColumns, onCardMove, onCardClick, onCardEdit, onCardDelete, onCardUpdate, onAddCard, onAddColumn, onColumnUpdate, onColumnDelete, onBulkAction, onExport, className, showAddColumn, showCardDetails, showFilters, showSearch, enableKeyboardShortcuts, cardTemplates, columnTemplates, filters, defaultFilter, loading, disabled, labels, users }: KanbanProps): react_jsx_runtime.JSX.Element;
|
|
1175
|
+
declare function Kanban({ columns: initialColumns, onCardMove, onCardClick, onCardEdit, onCardDelete, onCardUpdate, onAddCard, onAddColumn, onColumnUpdate, onColumnDelete, onBulkAction, onExport, className, showAddColumn, showCardDetails, showFilters, showSearch, enableKeyboardShortcuts, cardTemplates, columnTemplates, filters, defaultFilter, loading, disabled, labels, users, renderCard, renderCardPreview, renderCardBadge, renderCardActions, cardCompactMode, cardShowCoverImage, cardShowAssignees, cardShowLabels, cardShowProgress, cardDateFormat, cardMaxAssigneesToShow, renderAddCardButton, renderAddCardForm, addCardButtonText, addCardPosition, allowQuickAdd, quickAddFields, validateCard, onBeforeCardAdd, renderColumnHeader, renderColumnFooter, renderEmptyColumn, columnMenuActions, allowColumnReorder, columnColorOptions, columnDefaultColor, dragDisabled, dropDisabled, dragPreview, renderDragPreview, canDrop, onDragStart, onDragEnd, theme, cardVariant, enableAnimations, animationDuration, columnWidth, columnGap, cardGap, showTooltips, tooltipDelay }: KanbanProps): react_jsx_runtime.JSX.Element;
|
|
1126
1176
|
|
|
1127
1177
|
interface AIConfig {
|
|
1128
1178
|
provider?: 'openai' | 'claude' | 'gemini' | 'cohere';
|
package/dist/index.mjs
CHANGED
|
@@ -12183,29 +12183,51 @@ var useAutoScroll = () => {
|
|
|
12183
12183
|
};
|
|
12184
12184
|
var KanbanCardComponent = ({
|
|
12185
12185
|
card,
|
|
12186
|
+
column,
|
|
12186
12187
|
isDragging,
|
|
12187
12188
|
onEdit,
|
|
12188
12189
|
onDelete,
|
|
12189
12190
|
onClick,
|
|
12190
12191
|
showDetails,
|
|
12191
|
-
disabled
|
|
12192
|
+
disabled,
|
|
12193
|
+
renderCard,
|
|
12194
|
+
renderCardPreview,
|
|
12195
|
+
renderCardBadge,
|
|
12196
|
+
renderCardActions,
|
|
12197
|
+
cardCompactMode,
|
|
12198
|
+
cardShowCoverImage,
|
|
12199
|
+
cardShowAssignees,
|
|
12200
|
+
cardShowLabels,
|
|
12201
|
+
cardShowProgress,
|
|
12202
|
+
cardDateFormat,
|
|
12203
|
+
cardMaxAssigneesToShow,
|
|
12204
|
+
provided,
|
|
12205
|
+
enableAnimations,
|
|
12206
|
+
animationDuration,
|
|
12207
|
+
cardVariant
|
|
12192
12208
|
}) => {
|
|
12193
12209
|
const [isEditingTitle, setIsEditingTitle] = useState(false);
|
|
12194
12210
|
const [title, setTitle] = useState(card.title);
|
|
12195
12211
|
const dragControls = useDragControls();
|
|
12212
|
+
const animationsEnabled = enableAnimations ?? true;
|
|
12213
|
+
const animDuration = animationDuration ?? 0.2;
|
|
12214
|
+
const variant = cardVariant ?? "default";
|
|
12196
12215
|
const completedChecklistItems = card.checklist?.items.filter((item) => item.completed).length || 0;
|
|
12197
12216
|
const totalChecklistItems = card.checklist?.items.length || 0;
|
|
12198
12217
|
const checklistProgress = totalChecklistItems > 0 ? completedChecklistItems / totalChecklistItems * 100 : 0;
|
|
12218
|
+
if (renderCard) {
|
|
12219
|
+
return renderCard(card, column, provided || {});
|
|
12220
|
+
}
|
|
12199
12221
|
return /* @__PURE__ */ jsx(
|
|
12200
12222
|
motion.div,
|
|
12201
12223
|
{
|
|
12202
12224
|
layout: true,
|
|
12203
|
-
initial: { opacity: 0, y: 20 },
|
|
12225
|
+
initial: { opacity: animationsEnabled ? 0 : 1, y: animationsEnabled ? 20 : 0 },
|
|
12204
12226
|
animate: { opacity: 1, y: 0 },
|
|
12205
|
-
exit: { opacity: 0, y: -20 },
|
|
12206
|
-
whileHover: { scale: 1.02 },
|
|
12207
|
-
whileDrag: { scale: 1.05, rotate: 3 },
|
|
12208
|
-
transition: { duration: 0
|
|
12227
|
+
exit: { opacity: animationsEnabled ? 0 : 1, y: animationsEnabled ? -20 : 0 },
|
|
12228
|
+
whileHover: animationsEnabled ? { scale: 1.02 } : {},
|
|
12229
|
+
whileDrag: animationsEnabled ? { scale: 1.05, rotate: 3 } : {},
|
|
12230
|
+
transition: { duration: animationsEnabled ? animDuration : 0 },
|
|
12209
12231
|
className: cn(
|
|
12210
12232
|
"relative group cursor-pointer select-none",
|
|
12211
12233
|
isDragging && "z-50"
|
|
@@ -12214,7 +12236,11 @@ var KanbanCardComponent = ({
|
|
|
12214
12236
|
MoonUICardPro,
|
|
12215
12237
|
{
|
|
12216
12238
|
className: cn(
|
|
12217
|
-
"border
|
|
12239
|
+
"border transition-all duration-200",
|
|
12240
|
+
variant === "bordered" && "border-2",
|
|
12241
|
+
variant === "elevated" && "shadow-lg hover:shadow-xl",
|
|
12242
|
+
variant === "flat" && "border-0 bg-muted/30",
|
|
12243
|
+
variant === "default" && "hover:shadow-md",
|
|
12218
12244
|
isDragging && "shadow-2xl ring-2 ring-primary ring-offset-2",
|
|
12219
12245
|
disabled && "cursor-not-allowed opacity-50"
|
|
12220
12246
|
),
|
|
@@ -12227,7 +12253,7 @@ var KanbanCardComponent = ({
|
|
|
12227
12253
|
onPointerDown: (e) => dragControls.start(e)
|
|
12228
12254
|
}
|
|
12229
12255
|
),
|
|
12230
|
-
card.coverImage && /* @__PURE__ */ jsxs("div", { className: "relative h-32 -mx-px -mt-px rounded-t-lg overflow-hidden", children: [
|
|
12256
|
+
cardShowCoverImage && card.coverImage && /* @__PURE__ */ jsxs("div", { className: "relative h-32 -mx-px -mt-px rounded-t-lg overflow-hidden", children: [
|
|
12231
12257
|
/* @__PURE__ */ jsx(
|
|
12232
12258
|
"img",
|
|
12233
12259
|
{
|
|
@@ -12239,7 +12265,7 @@ var KanbanCardComponent = ({
|
|
|
12239
12265
|
/* @__PURE__ */ jsx("div", { className: "absolute inset-0 bg-gradient-to-t from-black/50 to-transparent" })
|
|
12240
12266
|
] }),
|
|
12241
12267
|
/* @__PURE__ */ jsxs(MoonUICardContentPro, { className: "p-3", children: [
|
|
12242
|
-
card.labels && card.labels.length > 0 && /* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-1 mb-2", children: card.labels.map((label) => /* @__PURE__ */ jsx(
|
|
12268
|
+
cardShowLabels && card.labels && card.labels.length > 0 && /* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-1 mb-2", children: card.labels.map((label) => /* @__PURE__ */ jsx(
|
|
12243
12269
|
"div",
|
|
12244
12270
|
{
|
|
12245
12271
|
className: "h-2 w-12 rounded-full",
|
|
@@ -12269,7 +12295,7 @@ var KanbanCardComponent = ({
|
|
|
12269
12295
|
onClick: (e) => e.stopPropagation()
|
|
12270
12296
|
}
|
|
12271
12297
|
) : /* @__PURE__ */ jsx("h4", { className: "font-medium text-sm line-clamp-2", children: card.title }) }),
|
|
12272
|
-
/* @__PURE__ */ jsx("div", { className: "flex items-center gap-1 opacity-0 group-hover:opacity-100 transition-opacity", children: /* @__PURE__ */ jsxs(MoonUIDropdownMenuPro, { children: [
|
|
12298
|
+
renderCardActions ? /* @__PURE__ */ jsx("div", { className: "opacity-0 group-hover:opacity-100 transition-opacity", children: renderCardActions(card) }) : /* @__PURE__ */ jsx("div", { className: "flex items-center gap-1 opacity-0 group-hover:opacity-100 transition-opacity", children: /* @__PURE__ */ jsxs(MoonUIDropdownMenuPro, { children: [
|
|
12273
12299
|
/* @__PURE__ */ jsx(MoonUIDropdownMenuTriggerPro, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
12274
12300
|
MoonUIButtonPro,
|
|
12275
12301
|
{
|
|
@@ -12312,8 +12338,8 @@ var KanbanCardComponent = ({
|
|
|
12312
12338
|
] })
|
|
12313
12339
|
] }) })
|
|
12314
12340
|
] }),
|
|
12315
|
-
card.description && /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground mb-3 line-clamp-2", children: card.description }),
|
|
12316
|
-
(card.progress !== void 0 || card.checklist) && /* @__PURE__ */ jsxs("div", { className: "mb-3", children: [
|
|
12341
|
+
!cardCompactMode && card.description && /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground mb-3 line-clamp-2", children: card.description }),
|
|
12342
|
+
cardShowProgress && (card.progress !== void 0 || card.checklist) && /* @__PURE__ */ jsxs("div", { className: "mb-3", children: [
|
|
12317
12343
|
/* @__PURE__ */ jsxs("div", { className: "flex justify-between text-xs text-muted-foreground mb-1", children: [
|
|
12318
12344
|
/* @__PURE__ */ jsx("span", { children: "Progress" }),
|
|
12319
12345
|
/* @__PURE__ */ jsxs("span", { children: [
|
|
@@ -12323,7 +12349,7 @@ var KanbanCardComponent = ({
|
|
|
12323
12349
|
] }),
|
|
12324
12350
|
/* @__PURE__ */ jsx(MoonUIProgressPro, { value: card.progress || checklistProgress, className: "h-1" })
|
|
12325
12351
|
] }),
|
|
12326
|
-
card.tags && card.tags.length > 0 && /* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-1 mb-3", children: card.tags.map((tag, index2) => /* @__PURE__ */ jsx(MoonUIBadgePro, { variant: "secondary", className: "text-xs px-1.5 py-0", children: tag }, index2)) }),
|
|
12352
|
+
!cardCompactMode && card.tags && card.tags.length > 0 && /* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-1 mb-3", children: card.tags.map((tag, index2) => /* @__PURE__ */ jsx(MoonUIBadgePro, { variant: "secondary", className: "text-xs px-1.5 py-0", children: tag }, index2)) }),
|
|
12327
12353
|
showDetails && /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between text-xs", children: [
|
|
12328
12354
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
12329
12355
|
card.priority && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1", children: [
|
|
@@ -12335,7 +12361,7 @@ var KanbanCardComponent = ({
|
|
|
12335
12361
|
isOverdue(card.dueDate) && "text-destructive"
|
|
12336
12362
|
), children: [
|
|
12337
12363
|
/* @__PURE__ */ jsx(Calendar$1, { className: "h-3 w-3" }),
|
|
12338
|
-
/* @__PURE__ */ jsx("span", { children: formatDate(card.dueDate) })
|
|
12364
|
+
/* @__PURE__ */ jsx("span", { children: cardDateFormat ? format(card.dueDate, cardDateFormat) : formatDate(card.dueDate) })
|
|
12339
12365
|
] }),
|
|
12340
12366
|
card.checklist && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1", children: [
|
|
12341
12367
|
/* @__PURE__ */ jsx(CheckSquare, { className: "h-3 w-3" }),
|
|
@@ -12355,7 +12381,7 @@ var KanbanCardComponent = ({
|
|
|
12355
12381
|
/* @__PURE__ */ jsx(Paperclip, { className: "h-3 w-3" }),
|
|
12356
12382
|
/* @__PURE__ */ jsx("span", { children: card.attachments.length })
|
|
12357
12383
|
] }),
|
|
12358
|
-
card.assignees && card.assignees.length > 0 && /* @__PURE__ */ jsx(MoonUIAvatarGroupPro, { max:
|
|
12384
|
+
cardShowAssignees && card.assignees && card.assignees.length > 0 && /* @__PURE__ */ jsx(MoonUIAvatarGroupPro, { max: cardMaxAssigneesToShow, size: "xs", children: card.assignees.map((assignee) => /* @__PURE__ */ jsxs(MoonUIAvatarPro, { className: "h-5 w-5", children: [
|
|
12359
12385
|
/* @__PURE__ */ jsx(MoonUIAvatarImagePro, { src: assignee.avatar }),
|
|
12360
12386
|
/* @__PURE__ */ jsx(MoonUIAvatarFallbackPro, { className: "text-xs", children: getInitials3(assignee.name) })
|
|
12361
12387
|
] }, assignee.id)) })
|
|
@@ -12394,7 +12420,54 @@ function Kanban({
|
|
|
12394
12420
|
loading = false,
|
|
12395
12421
|
disabled = false,
|
|
12396
12422
|
labels = [],
|
|
12397
|
-
users = []
|
|
12423
|
+
users = [],
|
|
12424
|
+
// Card Render Customization
|
|
12425
|
+
renderCard,
|
|
12426
|
+
renderCardPreview,
|
|
12427
|
+
renderCardBadge,
|
|
12428
|
+
renderCardActions,
|
|
12429
|
+
cardCompactMode = false,
|
|
12430
|
+
cardShowCoverImage = true,
|
|
12431
|
+
cardShowAssignees = true,
|
|
12432
|
+
cardShowLabels = true,
|
|
12433
|
+
cardShowProgress = true,
|
|
12434
|
+
cardDateFormat,
|
|
12435
|
+
cardMaxAssigneesToShow = 3,
|
|
12436
|
+
// Add Card Customization
|
|
12437
|
+
renderAddCardButton,
|
|
12438
|
+
renderAddCardForm,
|
|
12439
|
+
addCardButtonText,
|
|
12440
|
+
addCardPosition = "bottom",
|
|
12441
|
+
allowQuickAdd = true,
|
|
12442
|
+
quickAddFields = ["title"],
|
|
12443
|
+
validateCard,
|
|
12444
|
+
onBeforeCardAdd,
|
|
12445
|
+
// Column Customization
|
|
12446
|
+
renderColumnHeader,
|
|
12447
|
+
renderColumnFooter,
|
|
12448
|
+
renderEmptyColumn,
|
|
12449
|
+
columnMenuActions,
|
|
12450
|
+
allowColumnReorder = true,
|
|
12451
|
+
columnColorOptions,
|
|
12452
|
+
columnDefaultColor = "#6B7280",
|
|
12453
|
+
// Drag & Drop Enhancement
|
|
12454
|
+
dragDisabled = false,
|
|
12455
|
+
dropDisabled = false,
|
|
12456
|
+
dragPreview = "card",
|
|
12457
|
+
renderDragPreview,
|
|
12458
|
+
canDrop,
|
|
12459
|
+
onDragStart,
|
|
12460
|
+
onDragEnd,
|
|
12461
|
+
// UI/UX Customization
|
|
12462
|
+
theme = "default",
|
|
12463
|
+
cardVariant = "default",
|
|
12464
|
+
enableAnimations = true,
|
|
12465
|
+
animationDuration = 0.2,
|
|
12466
|
+
columnWidth,
|
|
12467
|
+
columnGap = 24,
|
|
12468
|
+
cardGap = 12,
|
|
12469
|
+
showTooltips = true,
|
|
12470
|
+
tooltipDelay = 500
|
|
12398
12471
|
}) {
|
|
12399
12472
|
const { hasProAccess, isLoading } = useSubscription();
|
|
12400
12473
|
if (!isLoading && !hasProAccess) {
|
|
@@ -12430,6 +12503,9 @@ function Kanban({
|
|
|
12430
12503
|
const [selectedColor, setSelectedColor] = useState("#6B7280");
|
|
12431
12504
|
const { scrollRef, startAutoScroll, stopAutoScroll } = useAutoScroll();
|
|
12432
12505
|
const { toast: toast3 } = useToast();
|
|
12506
|
+
useEffect(() => {
|
|
12507
|
+
setColumns(initialColumns);
|
|
12508
|
+
}, [initialColumns]);
|
|
12433
12509
|
const filteredColumns = useMemo(() => {
|
|
12434
12510
|
if (!searchQuery && !activeFilter)
|
|
12435
12511
|
return columns;
|
|
@@ -12485,11 +12561,24 @@ function Kanban({
|
|
|
12485
12561
|
const handleDragStart = (card, columnId) => {
|
|
12486
12562
|
if (disabled)
|
|
12487
12563
|
return;
|
|
12564
|
+
if (typeof dragDisabled === "function" && dragDisabled(card))
|
|
12565
|
+
return;
|
|
12566
|
+
if (dragDisabled === true)
|
|
12567
|
+
return;
|
|
12488
12568
|
setDraggedCard(card.id);
|
|
12569
|
+
const column = columns.find((col) => col.id === columnId);
|
|
12570
|
+
if (column && onDragStart) {
|
|
12571
|
+
onDragStart(card, column);
|
|
12572
|
+
}
|
|
12489
12573
|
};
|
|
12490
12574
|
const handleDragOver = (e, columnId) => {
|
|
12491
12575
|
if (disabled)
|
|
12492
12576
|
return;
|
|
12577
|
+
const column = columns.find((col) => col.id === columnId);
|
|
12578
|
+
if (column && typeof dropDisabled === "function" && dropDisabled(column))
|
|
12579
|
+
return;
|
|
12580
|
+
if (dropDisabled === true)
|
|
12581
|
+
return;
|
|
12493
12582
|
e.preventDefault();
|
|
12494
12583
|
setDraggedOverColumn(columnId);
|
|
12495
12584
|
const container = scrollRef.current;
|
|
@@ -12506,14 +12595,26 @@ function Kanban({
|
|
|
12506
12595
|
}
|
|
12507
12596
|
};
|
|
12508
12597
|
const handleDragEnd = () => {
|
|
12598
|
+
if (draggedCard) {
|
|
12599
|
+
const card = columns.flatMap((col) => col.cards).find((c2) => c2.id === draggedCard);
|
|
12600
|
+
const column = columns.find((col) => col.cards.some((c2) => c2.id === draggedCard));
|
|
12601
|
+
if (card && column && onDragEnd) {
|
|
12602
|
+
onDragEnd(card, column);
|
|
12603
|
+
}
|
|
12604
|
+
}
|
|
12509
12605
|
setDraggedCard(null);
|
|
12510
12606
|
setDraggedOverColumn(null);
|
|
12511
12607
|
stopAutoScroll();
|
|
12512
12608
|
};
|
|
12513
12609
|
const handleDrop = (e, targetColumnId, targetIndex) => {
|
|
12514
|
-
if (disabled || !draggedCard
|
|
12610
|
+
if (disabled || !draggedCard)
|
|
12515
12611
|
return;
|
|
12516
12612
|
e.preventDefault();
|
|
12613
|
+
const targetColumn = columns.find((col) => col.id === targetColumnId);
|
|
12614
|
+
const draggedCardObj = columns.flatMap((col) => col.cards).find((card) => card.id === draggedCard);
|
|
12615
|
+
if (targetColumn && draggedCardObj && canDrop && !canDrop(draggedCardObj, targetColumn, targetIndex)) {
|
|
12616
|
+
return;
|
|
12617
|
+
}
|
|
12517
12618
|
let sourceColumnId = null;
|
|
12518
12619
|
let sourceCard = null;
|
|
12519
12620
|
for (const column of columns) {
|
|
@@ -12525,7 +12626,27 @@ function Kanban({
|
|
|
12525
12626
|
}
|
|
12526
12627
|
}
|
|
12527
12628
|
if (sourceColumnId && sourceCard) {
|
|
12528
|
-
|
|
12629
|
+
const newColumns = columns.map((col) => {
|
|
12630
|
+
if (col.id === sourceColumnId) {
|
|
12631
|
+
return {
|
|
12632
|
+
...col,
|
|
12633
|
+
cards: col.cards.filter((c2) => c2.id !== draggedCard)
|
|
12634
|
+
};
|
|
12635
|
+
}
|
|
12636
|
+
if (col.id === targetColumnId) {
|
|
12637
|
+
const newCards = [...col.cards];
|
|
12638
|
+
newCards.splice(targetIndex, 0, sourceCard);
|
|
12639
|
+
return {
|
|
12640
|
+
...col,
|
|
12641
|
+
cards: newCards
|
|
12642
|
+
};
|
|
12643
|
+
}
|
|
12644
|
+
return col;
|
|
12645
|
+
});
|
|
12646
|
+
setColumns(newColumns);
|
|
12647
|
+
if (onCardMove) {
|
|
12648
|
+
onCardMove(draggedCard, sourceColumnId, targetColumnId, targetIndex);
|
|
12649
|
+
}
|
|
12529
12650
|
}
|
|
12530
12651
|
handleDragEnd();
|
|
12531
12652
|
};
|
|
@@ -12607,10 +12728,9 @@ function Kanban({
|
|
|
12607
12728
|
}
|
|
12608
12729
|
};
|
|
12609
12730
|
const handleCardClick = (card) => {
|
|
12731
|
+
setSelectedCard(card);
|
|
12610
12732
|
if (onCardClick) {
|
|
12611
12733
|
onCardClick(card);
|
|
12612
|
-
} else {
|
|
12613
|
-
setSelectedCard(card);
|
|
12614
12734
|
}
|
|
12615
12735
|
};
|
|
12616
12736
|
const handleCardUpdate = (updatedCard) => {
|
|
@@ -12621,11 +12741,7 @@ function Kanban({
|
|
|
12621
12741
|
})));
|
|
12622
12742
|
};
|
|
12623
12743
|
const handleAddCard = (columnId, newCard) => {
|
|
12624
|
-
|
|
12625
|
-
onAddCard(columnId, newCard);
|
|
12626
|
-
} else {
|
|
12627
|
-
setAddCardColumnId(columnId);
|
|
12628
|
-
}
|
|
12744
|
+
setAddCardColumnId(columnId);
|
|
12629
12745
|
};
|
|
12630
12746
|
const handleAddNewCard = (card) => {
|
|
12631
12747
|
if (!addCardColumnId)
|
|
@@ -12645,7 +12761,9 @@ function Kanban({
|
|
|
12645
12761
|
}
|
|
12646
12762
|
return col;
|
|
12647
12763
|
}));
|
|
12648
|
-
onAddCard
|
|
12764
|
+
if (onAddCard) {
|
|
12765
|
+
onAddCard(addCardColumnId, newCard);
|
|
12766
|
+
}
|
|
12649
12767
|
toast3({
|
|
12650
12768
|
title: "Card added",
|
|
12651
12769
|
description: `"${newCard.title}" has been added`
|
|
@@ -12691,11 +12809,11 @@ function Kanban({
|
|
|
12691
12809
|
description: "Column color has been changed"
|
|
12692
12810
|
});
|
|
12693
12811
|
};
|
|
12694
|
-
const handleExport = (
|
|
12812
|
+
const handleExport = (format6) => {
|
|
12695
12813
|
if (onExport) {
|
|
12696
|
-
onExport(
|
|
12814
|
+
onExport(format6);
|
|
12697
12815
|
} else {
|
|
12698
|
-
if (
|
|
12816
|
+
if (format6 === "json") {
|
|
12699
12817
|
const data = JSON.stringify(columns, null, 2);
|
|
12700
12818
|
const blob = new Blob([data], { type: "application/json" });
|
|
12701
12819
|
const url = URL.createObjectURL(blob);
|
|
@@ -12710,7 +12828,7 @@ function Kanban({
|
|
|
12710
12828
|
title: "Board exported",
|
|
12711
12829
|
description: "Board exported as JSON file"
|
|
12712
12830
|
});
|
|
12713
|
-
} else if (
|
|
12831
|
+
} else if (format6 === "csv") {
|
|
12714
12832
|
let csv = "Column,Card Title,Description,Priority,Assignees,Due Date,Tags\n";
|
|
12715
12833
|
columns.forEach((column) => {
|
|
12716
12834
|
column.cards.forEach((card) => {
|
|
@@ -12853,7 +12971,8 @@ function Kanban({
|
|
|
12853
12971
|
"div",
|
|
12854
12972
|
{
|
|
12855
12973
|
ref: scrollRef,
|
|
12856
|
-
className: "flex
|
|
12974
|
+
className: "flex overflow-x-auto pb-4",
|
|
12975
|
+
style: { gap: `${columnGap}px` },
|
|
12857
12976
|
onDragOver: (e) => e.preventDefault(),
|
|
12858
12977
|
children: [
|
|
12859
12978
|
/* @__PURE__ */ jsx(AnimatePresence, { mode: "sync", children: filteredColumns.map((column) => {
|
|
@@ -12862,14 +12981,19 @@ function Kanban({
|
|
|
12862
12981
|
return /* @__PURE__ */ jsx(
|
|
12863
12982
|
motion.div,
|
|
12864
12983
|
{
|
|
12865
|
-
layout:
|
|
12866
|
-
initial: { opacity: 0, x: -20 },
|
|
12984
|
+
layout: enableAnimations,
|
|
12985
|
+
initial: { opacity: enableAnimations ? 0 : 1, x: enableAnimations ? -20 : 0 },
|
|
12867
12986
|
animate: { opacity: 1, x: 0 },
|
|
12868
|
-
exit: { opacity: 0, x: 20 },
|
|
12987
|
+
exit: { opacity: enableAnimations ? 0 : 1, x: enableAnimations ? 20 : 0 },
|
|
12869
12988
|
className: cn(
|
|
12870
|
-
"flex-shrink-0
|
|
12989
|
+
"flex-shrink-0 transition-all",
|
|
12871
12990
|
isDraggedOver && "scale-105"
|
|
12872
12991
|
),
|
|
12992
|
+
style: {
|
|
12993
|
+
width: columnWidth === "auto" ? "auto" : (columnWidth || 320) + "px",
|
|
12994
|
+
minWidth: columnWidth === "auto" ? "300px" : void 0,
|
|
12995
|
+
transitionDuration: enableAnimations ? `${animationDuration}s` : "0s"
|
|
12996
|
+
},
|
|
12873
12997
|
onDragOver: (e) => handleDragOver(e, column.id),
|
|
12874
12998
|
onDragLeave: () => setDraggedOverColumn(null),
|
|
12875
12999
|
onDrop: (e) => handleDrop(e, column.id, column.cards.length),
|
|
@@ -12878,7 +13002,7 @@ function Kanban({
|
|
|
12878
13002
|
isDraggedOver && "ring-2 ring-primary ring-offset-2 bg-primary/5",
|
|
12879
13003
|
column.collapsed && "opacity-60"
|
|
12880
13004
|
), children: [
|
|
12881
|
-
/* @__PURE__ */
|
|
13005
|
+
/* @__PURE__ */ jsx(MoonUICardHeaderPro, { className: "pb-3", children: renderColumnHeader ? renderColumnHeader(column) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
12882
13006
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
|
|
12883
13007
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
12884
13008
|
column.color && /* @__PURE__ */ jsx(
|
|
@@ -12915,7 +13039,21 @@ function Kanban({
|
|
|
12915
13039
|
] }),
|
|
12916
13040
|
/* @__PURE__ */ jsxs(MoonUIDropdownMenuPro, { children: [
|
|
12917
13041
|
/* @__PURE__ */ jsx(MoonUIDropdownMenuTriggerPro, { asChild: true, children: /* @__PURE__ */ jsx(MoonUIButtonPro, { variant: "ghost", size: "sm", className: "h-6 w-6 p-0", children: /* @__PURE__ */ jsx(MoreHorizontal, { className: "h-4 w-4" }) }) }),
|
|
12918
|
-
/* @__PURE__ */
|
|
13042
|
+
/* @__PURE__ */ jsx(MoonUIDropdownMenuContentPro, { align: "end", children: columnMenuActions ? columnMenuActions.map((action, index2) => {
|
|
13043
|
+
if (action.visible && !action.visible(column))
|
|
13044
|
+
return null;
|
|
13045
|
+
return /* @__PURE__ */ jsxs(
|
|
13046
|
+
MoonUIDropdownMenuItemPro,
|
|
13047
|
+
{
|
|
13048
|
+
onClick: () => action.action(column),
|
|
13049
|
+
children: [
|
|
13050
|
+
action.icon || null,
|
|
13051
|
+
action.label
|
|
13052
|
+
]
|
|
13053
|
+
},
|
|
13054
|
+
index2
|
|
13055
|
+
);
|
|
13056
|
+
}) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
12919
13057
|
/* @__PURE__ */ jsxs(MoonUIDropdownMenuItemPro, { onClick: () => handleColumnAction(column, "rename"), children: [
|
|
12920
13058
|
/* @__PURE__ */ jsx(Edit, { className: "mr-2 h-4 w-4" }),
|
|
12921
13059
|
"Rename"
|
|
@@ -12967,7 +13105,7 @@ function Kanban({
|
|
|
12967
13105
|
]
|
|
12968
13106
|
}
|
|
12969
13107
|
)
|
|
12970
|
-
] })
|
|
13108
|
+
] }) })
|
|
12971
13109
|
] })
|
|
12972
13110
|
] }),
|
|
12973
13111
|
column.limit && /* @__PURE__ */ jsx(MoonUICardDescriptionPro, { className: cn(
|
|
@@ -12981,12 +13119,12 @@ function Kanban({
|
|
|
12981
13119
|
column.limit,
|
|
12982
13120
|
")"
|
|
12983
13121
|
] }) : `WIP limit: ${column.cards.length}/${column.limit}` })
|
|
12984
|
-
] }),
|
|
12985
|
-
!column.collapsed && /* @__PURE__ */ jsxs(MoonUICardContentPro, { className: "space-y-3", children: [
|
|
12986
|
-
/* @__PURE__ */ jsx(ScrollArea, { className: "h-[calc(100vh-300px)]", children: /* @__PURE__ */ jsx(AnimatePresence, { mode: "popLayout", children: column.cards.sort((a, b) => a.position - b.position).map((card, index2) => /* @__PURE__ */ jsx(
|
|
13122
|
+
] }) }),
|
|
13123
|
+
!column.collapsed && /* @__PURE__ */ jsxs(MoonUICardContentPro, { className: "space-y-3", style: { gap: `${cardGap}px` }, children: [
|
|
13124
|
+
/* @__PURE__ */ jsx(ScrollArea, { className: "h-[calc(100vh-300px)]", children: column.cards.length === 0 && renderEmptyColumn ? renderEmptyColumn(column) : /* @__PURE__ */ jsx(AnimatePresence, { mode: enableAnimations ? "popLayout" : void 0, children: column.cards.sort((a, b) => a.position - b.position).map((card, index2) => /* @__PURE__ */ jsx(
|
|
12987
13125
|
"div",
|
|
12988
13126
|
{
|
|
12989
|
-
draggable: !disabled,
|
|
13127
|
+
draggable: !disabled && (typeof dragDisabled === "function" ? !dragDisabled(card) : !dragDisabled),
|
|
12990
13128
|
onDragStart: () => handleDragStart(card, column.id),
|
|
12991
13129
|
onDragEnd: handleDragEnd,
|
|
12992
13130
|
onDrop: (e) => {
|
|
@@ -12999,6 +13137,7 @@ function Kanban({
|
|
|
12999
13137
|
KanbanCardComponent,
|
|
13000
13138
|
{
|
|
13001
13139
|
card,
|
|
13140
|
+
column,
|
|
13002
13141
|
isDragging: draggedCard === card.id,
|
|
13003
13142
|
onEdit: (e) => {
|
|
13004
13143
|
e.stopPropagation();
|
|
@@ -13010,13 +13149,27 @@ function Kanban({
|
|
|
13010
13149
|
},
|
|
13011
13150
|
onClick: () => handleCardClick(card),
|
|
13012
13151
|
showDetails: showCardDetails,
|
|
13013
|
-
disabled
|
|
13152
|
+
disabled,
|
|
13153
|
+
renderCard,
|
|
13154
|
+
renderCardPreview,
|
|
13155
|
+
renderCardBadge,
|
|
13156
|
+
renderCardActions,
|
|
13157
|
+
cardCompactMode,
|
|
13158
|
+
cardShowCoverImage,
|
|
13159
|
+
cardShowAssignees,
|
|
13160
|
+
cardShowLabels,
|
|
13161
|
+
cardShowProgress,
|
|
13162
|
+
cardDateFormat,
|
|
13163
|
+
cardMaxAssigneesToShow,
|
|
13164
|
+
enableAnimations,
|
|
13165
|
+
animationDuration,
|
|
13166
|
+
cardVariant
|
|
13014
13167
|
}
|
|
13015
13168
|
)
|
|
13016
13169
|
},
|
|
13017
13170
|
card.id
|
|
13018
13171
|
)) }) }),
|
|
13019
|
-
onAddCard && !column.locked && !isOverLimit && /* @__PURE__ */ jsxs(MoonUIDropdownMenuPro, { children: [
|
|
13172
|
+
onAddCard && !column.locked && !isOverLimit && (renderAddCardButton ? renderAddCardButton(column.id) : /* @__PURE__ */ jsxs(MoonUIDropdownMenuPro, { children: [
|
|
13020
13173
|
/* @__PURE__ */ jsx(MoonUIDropdownMenuTriggerPro, { asChild: true, children: /* @__PURE__ */ jsxs(
|
|
13021
13174
|
MoonUIButtonPro,
|
|
13022
13175
|
{
|
|
@@ -13026,7 +13179,7 @@ function Kanban({
|
|
|
13026
13179
|
disabled,
|
|
13027
13180
|
children: [
|
|
13028
13181
|
/* @__PURE__ */ jsx(Plus, { className: "h-4 w-4 mr-2" }),
|
|
13029
|
-
"Add card"
|
|
13182
|
+
typeof addCardButtonText === "function" ? addCardButtonText(column.id) : addCardButtonText || "Add card"
|
|
13030
13183
|
]
|
|
13031
13184
|
}
|
|
13032
13185
|
) }),
|
|
@@ -13040,7 +13193,7 @@ function Kanban({
|
|
|
13040
13193
|
cardTemplates.map((template, index2) => /* @__PURE__ */ jsxs(
|
|
13041
13194
|
MoonUIDropdownMenuItemPro,
|
|
13042
13195
|
{
|
|
13043
|
-
onClick: () => handleAddCard(column.id
|
|
13196
|
+
onClick: () => handleAddCard(column.id),
|
|
13044
13197
|
children: [
|
|
13045
13198
|
/* @__PURE__ */ jsx(Star, { className: "mr-2 h-4 w-4" }),
|
|
13046
13199
|
template.title || `Template ${index2 + 1}`
|
|
@@ -13049,7 +13202,8 @@ function Kanban({
|
|
|
13049
13202
|
index2
|
|
13050
13203
|
))
|
|
13051
13204
|
] })
|
|
13052
|
-
] })
|
|
13205
|
+
] })),
|
|
13206
|
+
renderColumnFooter && renderColumnFooter(column)
|
|
13053
13207
|
] })
|
|
13054
13208
|
] })
|
|
13055
13209
|
},
|
|
@@ -55056,9 +55210,9 @@ function AdvancedChart({
|
|
|
55056
55210
|
toggleSeriesVisibility(entry.dataKey);
|
|
55057
55211
|
}
|
|
55058
55212
|
};
|
|
55059
|
-
const handleExport = (
|
|
55213
|
+
const handleExport = (format6) => {
|
|
55060
55214
|
if (onExport) {
|
|
55061
|
-
onExport(
|
|
55215
|
+
onExport(format6);
|
|
55062
55216
|
}
|
|
55063
55217
|
};
|
|
55064
55218
|
const handleZoom = (direction) => {
|
|
@@ -59254,7 +59408,7 @@ var OptimizedImageInternal = ({
|
|
|
59254
59408
|
width,
|
|
59255
59409
|
height,
|
|
59256
59410
|
quality = 75,
|
|
59257
|
-
format:
|
|
59411
|
+
format: format6 = "auto",
|
|
59258
59412
|
lazy = true,
|
|
59259
59413
|
blur: blur2 = true,
|
|
59260
59414
|
priority = false,
|
|
@@ -59293,7 +59447,7 @@ var OptimizedImageInternal = ({
|
|
|
59293
59447
|
params.set("f", options.format);
|
|
59294
59448
|
return optimizedUrl;
|
|
59295
59449
|
};
|
|
59296
|
-
const optimizedSrc = getOptimizedSrc(src, { width, height, quality, format:
|
|
59450
|
+
const optimizedSrc = getOptimizedSrc(src, { width, height, quality, format: format6 });
|
|
59297
59451
|
const handleImageLoad = () => {
|
|
59298
59452
|
setIsLoaded(true);
|
|
59299
59453
|
setIsLoading(false);
|
|
@@ -59457,7 +59611,7 @@ var OptimizedImageInternal = ({
|
|
|
59457
59611
|
] }),
|
|
59458
59612
|
/* @__PURE__ */ jsxs("div", { children: [
|
|
59459
59613
|
"Format: ",
|
|
59460
|
-
|
|
59614
|
+
format6
|
|
59461
59615
|
] })
|
|
59462
59616
|
]
|
|
59463
59617
|
}
|
|
@@ -62337,11 +62491,11 @@ function downloadFile(content, filename, mimeType) {
|
|
|
62337
62491
|
URL.revokeObjectURL(url);
|
|
62338
62492
|
}
|
|
62339
62493
|
async function exportData(data, options) {
|
|
62340
|
-
const { format:
|
|
62494
|
+
const { format: format6, filename = "data-export", columns, includeHeaders = true } = options;
|
|
62341
62495
|
let content;
|
|
62342
62496
|
let mimeType;
|
|
62343
62497
|
let extension;
|
|
62344
|
-
switch (
|
|
62498
|
+
switch (format6) {
|
|
62345
62499
|
case "csv":
|
|
62346
62500
|
content = dataToCSV(data, columns, includeHeaders);
|
|
62347
62501
|
mimeType = "text/csv;charset=utf-8;";
|
|
@@ -62355,7 +62509,7 @@ async function exportData(data, options) {
|
|
|
62355
62509
|
case "xlsx":
|
|
62356
62510
|
throw new Error("XLSX export requires additional dependencies. Use CSV format instead.");
|
|
62357
62511
|
default:
|
|
62358
|
-
throw new Error(`Unsupported export format: ${
|
|
62512
|
+
throw new Error(`Unsupported export format: ${format6}`);
|
|
62359
62513
|
}
|
|
62360
62514
|
const finalFilename = `${filename}-${( new Date()).toISOString().split("T")[0]}.${extension}`;
|
|
62361
62515
|
downloadFile(content, finalFilename, mimeType);
|
|
@@ -62838,11 +62992,11 @@ function DataTable({
|
|
|
62838
62992
|
rowSelection: features.rowSelection !== false || selectable,
|
|
62839
62993
|
export: features.export !== false || exportable
|
|
62840
62994
|
});
|
|
62841
|
-
const handleExport = async (
|
|
62995
|
+
const handleExport = async (format6) => {
|
|
62842
62996
|
const selectedRows = table.getFilteredSelectedRowModel().rows;
|
|
62843
62997
|
const dataToExport = selectedRows.length > 0 ? selectedRows.map((row) => row.original) : table.getFilteredRowModel().rows.map((row) => row.original);
|
|
62844
62998
|
if (typeof exportable === "object" && exportable.onExport) {
|
|
62845
|
-
exportable.onExport(dataToExport,
|
|
62999
|
+
exportable.onExport(dataToExport, format6);
|
|
62846
63000
|
return;
|
|
62847
63001
|
}
|
|
62848
63002
|
if (onExport) {
|
|
@@ -62852,7 +63006,7 @@ function DataTable({
|
|
|
62852
63006
|
const filename = typeof exportable === "object" && exportable.filename ? exportable.filename : "data-export";
|
|
62853
63007
|
const visibleColumns = getVisibleColumns(columns, columnVisibility);
|
|
62854
63008
|
await exportData(dataToExport, {
|
|
62855
|
-
format:
|
|
63009
|
+
format: format6,
|
|
62856
63010
|
filename,
|
|
62857
63011
|
columns: visibleColumns,
|
|
62858
63012
|
includeHeaders: true
|
|
@@ -64784,18 +64938,18 @@ var countries = [
|
|
|
64784
64938
|
{ code: "NO", name: "Norway", dialCode: "+47", flag: "\u{1F1F3}\u{1F1F4}", format: "xxx xx xxx" },
|
|
64785
64939
|
{ code: "FI", name: "Finland", dialCode: "+358", flag: "\u{1F1EB}\u{1F1EE}", format: "xx xxxxxxx" }
|
|
64786
64940
|
];
|
|
64787
|
-
function formatPhoneNumber(number,
|
|
64788
|
-
if (!number || !
|
|
64941
|
+
function formatPhoneNumber(number, format6) {
|
|
64942
|
+
if (!number || !format6)
|
|
64789
64943
|
return "";
|
|
64790
64944
|
const cleaned = number.replace(/\D/g, "");
|
|
64791
64945
|
let formatted = "";
|
|
64792
64946
|
let digitIndex = 0;
|
|
64793
|
-
for (let i = 0; i <
|
|
64794
|
-
if (
|
|
64947
|
+
for (let i = 0; i < format6.length && digitIndex < cleaned.length; i++) {
|
|
64948
|
+
if (format6[i] === "x") {
|
|
64795
64949
|
formatted += cleaned[digitIndex];
|
|
64796
64950
|
digitIndex++;
|
|
64797
64951
|
} else {
|
|
64798
|
-
formatted +=
|
|
64952
|
+
formatted += format6[i];
|
|
64799
64953
|
}
|
|
64800
64954
|
}
|
|
64801
64955
|
return formatted;
|