@loword/loword-design-system 0.6.0 → 0.7.0

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.
@@ -32,6 +32,11 @@ export interface LDFileUploadAttachmentListProps {
32
32
  labelPlaceholder?: string;
33
33
  /** 파일 카드에 업로드 시각 라벨을 표시합니다. */
34
34
  isExistUploadedAt?: boolean;
35
+ /**
36
+ * 손잡이를 끌어 순서를 바꿀 수 있게 합니다. 서버가 첨부 순서를 저장하는 화면에서만 켭니다.
37
+ * @default false
38
+ */
39
+ sortable?: boolean;
35
40
  className?: string;
36
41
  }
37
42
  export type LDFileUploadDescriptionProps = HTMLAttributes<HTMLParagraphElement>;
@@ -46,7 +51,7 @@ declare const LDFileUpload: {
46
51
  Root: ({ className, classNames, children, ...props }: LDFileUploadRootProps) => import("react/jsx-runtime").JSX.Element;
47
52
  Input: ({ type, label, icon, options, className, ...props }: LDFileUploadInputProps) => import("react/jsx-runtime").JSX.Element | null;
48
53
  CardList: ({ type, isExistUploadedAt, className, }: LDFileUploadCardListProps) => import("react/jsx-runtime").JSX.Element;
49
- AttachmentList: ({ placeholder, labelPlaceholder, isExistUploadedAt, className, }: LDFileUploadAttachmentListProps) => import("react/jsx-runtime").JSX.Element;
54
+ AttachmentList: ({ placeholder, labelPlaceholder, isExistUploadedAt, sortable, className, }: LDFileUploadAttachmentListProps) => import("react/jsx-runtime").JSX.Element;
50
55
  Description: ({ className, ...props }: LDFileUploadDescriptionProps) => import("react/jsx-runtime").JSX.Element;
51
56
  };
52
57
  export default LDFileUpload;
@@ -1 +1 @@
1
- {"version":3,"file":"LDFileUpload.d.ts","sourceRoot":"","sources":["../../../src/components/LDFileUpload/LDFileUpload.tsx"],"names":[],"mappings":"AA8BA,OAAO,EAEL,KAAK,cAAc,EACnB,KAAK,SAAS,EAGf,MAAM,OAAO,CAAC;AAEf,OAAiB,EAAE,KAAK,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAE9E,OAAuB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DAAmD;IACnD,OAAO,CAAC,EAAE,iBAAiB,CAAC;CAC7B;AA6FD,MAAM,WAAW,yBAAyB;IACxC,IAAI,CAAC,EAAE,SAAS,GAAG,OAAO,CAAC;IAC3B,wDAAwD;IACxD,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AA8UD,MAAM,WAAW,+BAA+B;IAC9C,4BAA4B;IAC5B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,4BAA4B;IAC5B,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,+BAA+B;IAC/B,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAoGD,MAAM,MAAM,4BAA4B,GAAG,cAAc,CAAC,oBAAoB,CAAC,CAAC;AA6BhF,MAAM,WAAW,iBACf,SACE,IAAI,CACF,qBAAqB,EACrB,UAAU,GAAG,YAAY,GAAG,cAAc,GAAG,MAAM,uBAAuB,CAC3E,EACD,uBAAuB;IACzB,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,4BAA4B;IAC5B,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B;AAED,kCAAkC;AAClC,QAAA,MAAM,YAAY;qFAMf,iBAAiB;0DA1mBjB,qBAAqB;iEAmCrB,sBAAsB;wDA+FtB,yBAAyB;iGAgWzB,+BAA+B;2CA2FY,4BAA4B;CA2DzE,CAAC;AAQF,eAAe,YAAY,CAAC"}
@@ -201,23 +201,23 @@ const LinkRow = ({ link, index, linkNumber, placeholder, labelPlaceholder, handl
201
201
  * 드래그로 순서를 바꾸는 항목 래퍼.
202
202
  * 파일 카드는 누르면 교체 창이 열리고 링크 행에는 입력칸이 있어, 카드 전체가 아니라 손잡이로만 끈다.
203
203
  */
204
- const SortableAttachment = ({ id, name, children, }) => {
204
+ const SortableAttachment = ({ id, name, sortable, children, }) => {
205
205
  const { locked } = useFileUploadContext();
206
- const { setNodeRef, setActivatorNodeRef, attributes, listeners, transform, transition, isDragging, isSorting, } = useSortable({ id, disabled: locked });
206
+ const { setNodeRef, setActivatorNodeRef, attributes, listeners, transform, transition, isDragging, isSorting, } = useSortable({ id, disabled: locked || !sortable });
207
207
  return (_jsx("div", { ref: setNodeRef, className: cn(isDragging && 'relative z-10 opacity-80'), style: {
208
208
  transform: CSS.Transform.toString(transform),
209
209
  // 인덱스를 id로 쓰므로 놓는 순간 같은 노드에 다른 항목이 들어간다. 그때 transition이 돌면
210
210
  // 이전 자리에서 미끄러져 오는 것처럼 보이므로, 끄는 동안(isSorting)에만 애니메이션한다.
211
211
  transition: isSorting && !isDragging ? transition : undefined,
212
- }, children: children(_jsx("button", { type: "button", ref: setActivatorNodeRef, ...attributes, ...listeners, "aria-label": `${name} 순서 변경`, disabled: locked,
212
+ }, children: children(sortable && (_jsx("button", { type: "button", ref: setActivatorNodeRef, ...attributes, ...listeners, "aria-label": `${name} 순서 변경`, disabled: locked,
213
213
  // 손잡이 클릭이 카드로 올라가면 파일이 열린다
214
- onClick: (event) => event.stopPropagation(), className: "shrink-0 cursor-grab touch-none text-lb300 active:cursor-grabbing disabled:cursor-not-allowed", children: _jsx(GripVertical, { className: "size-5" }) })) }));
214
+ onClick: (event) => event.stopPropagation(), className: "shrink-0 cursor-grab touch-none text-lb300 active:cursor-grabbing disabled:cursor-not-allowed", children: _jsx(GripVertical, { className: "size-5" }) }))) }));
215
215
  };
216
216
  /**
217
- * 파일과 링크가 섞인 첨부 목록입니다. 손잡이를 끌어 순서를 바꿉니다.
217
+ * 파일과 링크가 섞인 첨부 목록입니다. `sortable`을 켜면 손잡이를 끌어 순서를 바꿉니다.
218
218
  * Root에 `attachmentList`·`setAttachmentList`를 넘겨야 합니다.
219
219
  */
220
- const AttachmentList = ({ placeholder = '링크를 입력해주세요', labelPlaceholder = '링크 이름', isExistUploadedAt = true, className, }) => {
220
+ const AttachmentList = ({ placeholder = '링크를 입력해주세요', labelPlaceholder = '링크 이름', isExistUploadedAt = true, sortable = false, className, }) => {
221
221
  const { attachmentList, moveAttachment } = useFileUploadContext();
222
222
  const classNames = useContext(StyleContext);
223
223
  // SSR에서 dnd-kit 접근성 id가 서버·클라이언트로 어긋나지 않게 고정한다.
@@ -235,12 +235,12 @@ const AttachmentList = ({ placeholder = '링크를 입력해주세요', labelPla
235
235
  return (_jsx(DndContext, { id: dndId, sensors: sensors, collisionDetection: closestCenter, modifiers: [restrictToVerticalAxis], onDragEnd: handleDragEnd, children: _jsx(SortableContext, { items: ids, strategy: verticalListSortingStrategy, children: _jsx("div", { className: cn('flex w-full flex-col gap-sm', className, classNames.cardList), children: attachmentList.map((item, index) => {
236
236
  const id = String(index);
237
237
  if (item.type === 'file') {
238
- return (_jsx(SortableAttachment, { id: id, name: item.file.fileName, children: (handle) => (_jsx(FileCard, { file: item.file, index: index, isExistUploadedAt: isExistUploadedAt, handle: handle })) }, id));
238
+ return (_jsx(SortableAttachment, { id: id, name: item.file.fileName, sortable: sortable, children: (handle) => (_jsx(FileCard, { file: item.file, index: index, isExistUploadedAt: isExistUploadedAt, handle: handle })) }, id));
239
239
  }
240
240
  const linkNumber = attachmentList
241
241
  .slice(0, index + 1)
242
242
  .filter((other) => other.type === 'link').length;
243
- return (_jsx(SortableAttachment, { id: id, name: `링크 ${linkNumber}`, children: (handle) => (_jsx(LinkRow, { link: item, index: index, linkNumber: linkNumber, placeholder: placeholder, labelPlaceholder: labelPlaceholder, handle: handle })) }, id));
243
+ return (_jsx(SortableAttachment, { id: id, name: `링크 ${linkNumber}`, sortable: sortable, children: (handle) => (_jsx(LinkRow, { link: item, index: index, linkNumber: linkNumber, placeholder: placeholder, labelPlaceholder: labelPlaceholder, handle: handle })) }, id));
244
244
  }) }) }) }));
245
245
  };
246
246
  /** 업로드 제한 조건을 안내합니다. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@loword/loword-design-system",
3
- "version": "0.6.0",
3
+ "version": "0.7.0",
4
4
  "description": "로워드 디자인 시스템 컴포넌트 패키지(Tailwind v4)",
5
5
  "keywords": [
6
6
  "react",