From 052f0b83c17a7addf799cfe7f3b9ec5eb729ca41 Mon Sep 17 00:00:00 2001 From: mohiit1502 Date: Thu, 13 Nov 2025 16:08:04 +0530 Subject: [PATCH] Removed wrapper span from Draggable --- package.json | 2 +- src/Draggable.tsx | 36 ++++++++---------------------------- 2 files changed, 9 insertions(+), 29 deletions(-) diff --git a/package.json b/package.json index ee2d4ac..96939d1 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@armco/shared-components", "description": "React Component Lib of independent components that can be utilised by sophisticated ones in @armco/components", - "version": "0.0.59", + "version": "0.0.60", "type": "module", "author": "Armco (@restruct-corporate-advantage)", "types": "build/types/index.d.ts", diff --git a/src/Draggable.tsx b/src/Draggable.tsx index 5aab00e..5f051b1 100755 --- a/src/Draggable.tsx +++ b/src/Draggable.tsx @@ -10,16 +10,10 @@ import React, { } from "react" import { useDrag } from "react-dnd" import { getEmptyImage } from "react-dnd-html5-backend" -import { ArDndItemTypes } from "./enums" import { BaseProps } from "@armco/types" +import { ArDndItemTypes } from "./enums" import "./Draggable.component.scss" -const dummyChildren = ( -
-) - export interface DraggableProps extends BaseProps { itemType?: ArDndItemTypes | string @@ -102,7 +96,6 @@ const Draggable = forwardRef((props: DraggableProps, ref) => { return styleObj as { [key: string]: string } } - const isDOMElement = typeof (firstChild as any)?.type === "string" const mergedStyle = { ...toPlainStyle(childStyles), ...toPlainStyle(style), @@ -110,26 +103,13 @@ const Draggable = forwardRef((props: DraggableProps, ref) => { opacity: isDragging ? 0.5 : 1, } as React.CSSProperties - if (isDOMElement) { - return cloneElement(firstChild as ReactElement, { - ref: dragRef, - style: mergedStyle, - className: `ar-Draggable ${childClasses || ""}`.trim(), - ...(restProps || {}), - }) - } else { - const spanRef: Ref = dragRef as Ref - return ( - - {firstChild} - - ) - } + return cloneElement(firstChild as ReactElement, { + ref: dragRef, + style: mergedStyle, + className: `ar-Draggable ${childClasses || ""}`.trim(), + ...(restProps || {}), + }) + }) export default Draggable