@loword/loword-design-system 0.2.0 → 0.2.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.
|
@@ -19,8 +19,8 @@ export interface TableRowProps {
|
|
|
19
19
|
export declare const PlainRow: ({ selected, className, onClick, children, }: TableRowProps) => import("react/jsx-runtime").JSX.Element;
|
|
20
20
|
/** 드래그가 켜져 있을 때의 행 */
|
|
21
21
|
export declare const SortableRow: ({ rowId, selected, className, onClick, children, }: TableRowProps) => import("react/jsx-runtime").JSX.Element;
|
|
22
|
-
export declare const LDRowDragHandle: ({
|
|
23
|
-
rowId: string;
|
|
22
|
+
export declare const LDRowDragHandle: ({ className, }: {
|
|
24
23
|
className?: string;
|
|
25
|
-
|
|
24
|
+
rowId?: string;
|
|
25
|
+
}) => import("react/jsx-runtime").JSX.Element | null;
|
|
26
26
|
//# sourceMappingURL=TableRowDnd.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TableRowDnd.d.ts","sourceRoot":"","sources":["../../../src/components/LDTable/TableRowDnd.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"TableRowDnd.d.ts","sourceRoot":"","sources":["../../../src/components/LDTable/TableRowDnd.tsx"],"names":[],"mappings":"AAGA,OAAO,EAOL,KAAK,gBAAgB,EAGtB,MAAM,eAAe,CAAC;AAWvB,OAAO,EAAiB,KAAK,SAAS,EAAuB,MAAM,OAAO,CAAC;AAM3E,eAAO,MAAM,cAAc,GAAI,6BAG5B;IACD,YAAY,EAAE,CAAC,QAAQ,EAAE,gBAAgB,EAAE,MAAM,EAAE,gBAAgB,KAAK,IAAI,CAAC;IAC7E,QAAQ,EAAE,SAAS,CAAC;CACrB,4CAwBA,CAAC;AAIF,eAAO,MAAM,mBAAmB,GAAI,uBAGjC;IACD,MAAM,EAAE,gBAAgB,EAAE,CAAC;IAC3B,QAAQ,EAAE,SAAS,CAAC;CACrB,4CAIA,CAAC;AAIF,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED,6DAA6D;AAC7D,eAAO,MAAM,QAAQ,GAAI,6CAKtB,aAAa,4CAIf,CAAC;AAaF,sBAAsB;AACtB,eAAO,MAAM,WAAW,GAAI,oDAMzB,aAAa,4CAgCf,CAAC;AAIF,eAAO,MAAM,eAAe,GAAI,gBAE7B;IACD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,mDAyBA,CAAC"}
|
|
@@ -5,6 +5,7 @@ import { restrictToVerticalAxis } from '@dnd-kit/modifiers';
|
|
|
5
5
|
import { SortableContext, sortableKeyboardCoordinates, useSortable, verticalListSortingStrategy, } from '@dnd-kit/sortable';
|
|
6
6
|
import { CSS } from '@dnd-kit/utilities';
|
|
7
7
|
import { GripVertical } from 'lucide-react';
|
|
8
|
+
import { createContext, useContext, useMemo } from 'react';
|
|
8
9
|
import LDTable from '../../components/LDTable/LDTable.js';
|
|
9
10
|
import cn from '../../utils/cn.js';
|
|
10
11
|
// ── DndContext ──
|
|
@@ -23,18 +24,21 @@ export const RowDndProvider = ({ onRowDragEnd, children, }) => {
|
|
|
23
24
|
export const RowSortableProvider = ({ rowIds, children, }) => (_jsx(SortableContext, { items: rowIds, strategy: verticalListSortingStrategy, children: children }));
|
|
24
25
|
/** 드래그가 꺼져 있을 때의 행. `SortableRow`와 prop 모양을 맞춰 교체 가능하게 둔다 */
|
|
25
26
|
export const PlainRow = ({ selected, className, onClick, children, }) => (_jsx(LDTable.Row, { selected: selected, className: className, onClick: onClick, children: children }));
|
|
27
|
+
const RowDragHandleContext = createContext(null);
|
|
26
28
|
/** 드래그가 켜져 있을 때의 행 */
|
|
27
29
|
export const SortableRow = ({ rowId, selected, className, onClick, children, }) => {
|
|
28
|
-
const { setNodeRef, transform, transition, isDragging } = useSortable({
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
}, children: children }));
|
|
30
|
+
const { setNodeRef, setActivatorNodeRef, attributes, listeners, transform, transition, isDragging, } = useSortable({ id: rowId });
|
|
31
|
+
const handleContext = useMemo(() => ({ setActivatorNodeRef, attributes, listeners, isDragging }), [setActivatorNodeRef, attributes, listeners, isDragging]);
|
|
32
|
+
return (_jsx(RowDragHandleContext, { value: handleContext, children: _jsx(LDTable.Row, { ref: setNodeRef, selected: selected, className: cn(isDragging && 'relative z-10 opacity-80', className), onClick: onClick, style: {
|
|
33
|
+
transform: CSS.Transform.toString(transform),
|
|
34
|
+
transition: isDragging ? 'none' : transition,
|
|
35
|
+
}, children: children }) }));
|
|
35
36
|
};
|
|
36
37
|
// ── Handle ──
|
|
37
|
-
export const LDRowDragHandle = ({
|
|
38
|
-
const
|
|
39
|
-
|
|
38
|
+
export const LDRowDragHandle = ({ className, }) => {
|
|
39
|
+
const context = useContext(RowDragHandleContext);
|
|
40
|
+
if (!context)
|
|
41
|
+
return null;
|
|
42
|
+
const { setActivatorNodeRef, attributes, listeners, isDragging } = context;
|
|
43
|
+
return (_jsx("button", { ref: setActivatorNodeRef, type: "button", "aria-label": "\uC21C\uC11C \uBCC0\uACBD", onClick: (e) => e.stopPropagation(), className: cn('flex size-6 touch-none items-center justify-center', 'text-neutral400 ld-transition hover:text-neutral700', isDragging ? 'cursor-grabbing' : 'cursor-grab', className), ...attributes, ...listeners, children: _jsx(GripVertical, { size: 16 }) }));
|
|
40
44
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@loword/loword-design-system",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"description": "로워드 디자인 시스템 컴포넌트 패키지(Tailwind v4)",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -48,10 +48,6 @@
|
|
|
48
48
|
},
|
|
49
49
|
"license": "MIT",
|
|
50
50
|
"peerDependencies": {
|
|
51
|
-
"@dnd-kit/core": "^6.3.1",
|
|
52
|
-
"@dnd-kit/modifiers": "^9.0.0",
|
|
53
|
-
"@dnd-kit/sortable": "^10.0.0",
|
|
54
|
-
"@dnd-kit/utilities": "^3.2.2",
|
|
55
51
|
"@radix-ui/react-accordion": "^1.2.16",
|
|
56
52
|
"@radix-ui/react-dialog": "^1.1.15",
|
|
57
53
|
"@radix-ui/react-popover": "^1.1.15",
|
|
@@ -92,18 +88,6 @@
|
|
|
92
88
|
"next": {
|
|
93
89
|
"optional": true
|
|
94
90
|
},
|
|
95
|
-
"@dnd-kit/core": {
|
|
96
|
-
"optional": true
|
|
97
|
-
},
|
|
98
|
-
"@dnd-kit/modifiers": {
|
|
99
|
-
"optional": true
|
|
100
|
-
},
|
|
101
|
-
"@dnd-kit/sortable": {
|
|
102
|
-
"optional": true
|
|
103
|
-
},
|
|
104
|
-
"@dnd-kit/utilities": {
|
|
105
|
-
"optional": true
|
|
106
|
-
},
|
|
107
91
|
"@radix-ui/react-accordion": {
|
|
108
92
|
"optional": true
|
|
109
93
|
},
|
|
@@ -202,10 +186,6 @@
|
|
|
202
186
|
}
|
|
203
187
|
},
|
|
204
188
|
"devDependencies": {
|
|
205
|
-
"@dnd-kit/core": "^6.3.1",
|
|
206
|
-
"@dnd-kit/modifiers": "^9.0.0",
|
|
207
|
-
"@dnd-kit/sortable": "^10.0.0",
|
|
208
|
-
"@dnd-kit/utilities": "^3.2.2",
|
|
209
189
|
"@eslint/js": "^9.31.0",
|
|
210
190
|
"@hookform/resolvers": "^5.4.0",
|
|
211
191
|
"@radix-ui/react-accordion": "^1.2.16",
|
|
@@ -277,6 +257,10 @@
|
|
|
277
257
|
"zod": "^4.4.3"
|
|
278
258
|
},
|
|
279
259
|
"dependencies": {
|
|
260
|
+
"@dnd-kit/core": "^6.3.1",
|
|
261
|
+
"@dnd-kit/modifiers": "^9.0.0",
|
|
262
|
+
"@dnd-kit/sortable": "^10.0.0",
|
|
263
|
+
"@dnd-kit/utilities": "^3.2.2",
|
|
280
264
|
"clsx": "^2.1.1",
|
|
281
265
|
"lucide-react": "^0.536.0",
|
|
282
266
|
"react-hook-form": "^7.62.0",
|