@loword/loword-design-system 0.7.7 → 0.7.8

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.
@@ -1 +1 @@
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"}
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,EAEL,KAAK,SAAS,EAIf,MAAM,OAAO,CAAC;AAMf,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,4CA4BA,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,11 +5,14 @@ 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
+ import { createContext, useContext, useId, useMemo, } from 'react';
9
9
  import LDTable from '../../components/LDTable/LDTable.js';
10
10
  import cn from '../../utils/cn.js';
11
11
  // ── DndContext ──
12
12
  export const RowDndProvider = ({ onRowDragEnd, children, }) => {
13
+ // id 를 안 넘기면 dnd-kit 이 모듈 전역 카운터로 aria-describedby 를 매겨
14
+ // SSR 과 하이드레이션 값이 어긋난다. useId 는 양쪽이 같다.
15
+ const id = useId();
13
16
  const sensors = useSensors(useSensor(MouseSensor), useSensor(TouchSensor), useSensor(KeyboardSensor, {
14
17
  coordinateGetter: sortableKeyboardCoordinates,
15
18
  }));
@@ -18,7 +21,7 @@ export const RowDndProvider = ({ onRowDragEnd, children, }) => {
18
21
  return;
19
22
  onRowDragEnd(active.id, over.id);
20
23
  };
21
- return (_jsx(DndContext, { collisionDetection: closestCenter, modifiers: [restrictToVerticalAxis], onDragEnd: handleDragEnd, sensors: sensors, children: children }));
24
+ return (_jsx(DndContext, { id: id, collisionDetection: closestCenter, modifiers: [restrictToVerticalAxis], onDragEnd: handleDragEnd, sensors: sensors, children: children }));
22
25
  };
23
26
  // ── SortableContext ──
24
27
  export const RowSortableProvider = ({ rowIds, children, }) => (_jsx(SortableContext, { items: rowIds, strategy: verticalListSortingStrategy, children: children }));
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=TableRowDnd.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TableRowDnd.test.d.ts","sourceRoot":"","sources":["../../../src/components/LDTable/TableRowDnd.test.tsx"],"names":[],"mappings":""}
@@ -0,0 +1,29 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { act } from 'react';
3
+ import { hydrateRoot } from 'react-dom/client';
4
+ import { renderToString } from 'react-dom/server';
5
+ import { describe, expect, it, vi } from 'vitest';
6
+ import { LDRowDragHandle, RowDndProvider, RowSortableProvider, SortableRow, } from '../../components/LDTable/TableRowDnd.js';
7
+ const ROW_IDS = ['a', 'b'];
8
+ const DraggableRows = () => (_jsx(RowDndProvider, { onRowDragEnd: () => { }, children: _jsx(RowSortableProvider, { rowIds: ROW_IDS, children: _jsx("table", { children: _jsx("tbody", { children: ROW_IDS.map((id) => (_jsx(SortableRow, { rowId: id, children: _jsx("td", { children: _jsx(LDRowDragHandle, {}) }) }, id))) }) }) }) }));
9
+ describe('<RowDndProvider />', () => {
10
+ it('SSR 마크업을 하이드레이션해도 드래그 핸들 aria-describedby 가 어긋나지 않는다', async () => {
11
+ const container = document.createElement('div');
12
+ container.innerHTML = renderToString(_jsx(DraggableRows, {}));
13
+ document.body.append(container);
14
+ const reactGlobal = globalThis;
15
+ reactGlobal.IS_REACT_ACT_ENVIRONMENT = true;
16
+ // 속성 불일치는 onRecoverableError 가 아니라 console.error 로만 알린다.
17
+ const consoleError = vi
18
+ .spyOn(console, 'error')
19
+ .mockImplementation(() => { });
20
+ const root = await act(async () => hydrateRoot(container, _jsx(DraggableRows, {})));
21
+ expect(consoleError).not.toHaveBeenCalled();
22
+ consoleError.mockRestore();
23
+ expect(container
24
+ .querySelector('button[aria-label="순서 변경"]')
25
+ ?.getAttribute('aria-describedby')).toBeTruthy();
26
+ act(() => root.unmount());
27
+ container.remove();
28
+ });
29
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@loword/loword-design-system",
3
- "version": "0.7.7",
3
+ "version": "0.7.8",
4
4
  "description": "로워드 디자인 시스템 컴포넌트 패키지(Tailwind v4)",
5
5
  "keywords": [
6
6
  "react",