motile-ui 0.9.6 → 1.0.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.
package/README.md CHANGED
@@ -9,6 +9,7 @@
9
9
  [![npm downloads](https://img.shields.io/npm/dm/motile-ui.svg?style=flat-square)](https://www.npmjs.com/package/motile-ui)
10
10
  [![license](https://img.shields.io/npm/l/motile-ui.svg?style=flat-square)](https://github.com/Innopers/motile-ui/blob/main/LICENSE)
11
11
  [![TypeScript](https://img.shields.io/badge/TypeScript-Ready-blue?style=flat-square)](https://www.typescriptlang.org/)
12
+ [![Website](https://img.shields.io/badge/Website-motile--ui.site-green?style=flat-square)](https://www.motile-ui.site/)
12
13
 
13
14
  <br/>
14
15
 
@@ -24,7 +24,7 @@ interface PopoverRootProps {
24
24
  children: React.ReactNode;
25
25
  /**
26
26
  * Popover 위치
27
- * @default 'bottom'
27
+ * @default 'top'
28
28
  * @type {'top' | 'bottom' | 'left' | 'right'}
29
29
  */
30
30
  position?: Placement;
@@ -10,7 +10,7 @@
10
10
  * **동작 원리**
11
11
  * 1. 모달이 열릴 때 `window.history.pushState()`로 더미 히스토리 항목 추가
12
12
  * 2. 브라우저 뒤로가기 시 `popstate` 이벤트가 발생하면 모달 닫기
13
- * 3. 다른 방법(버튼 클릭, ESC, 외부 클릭 등)으로 닫을 때는 `history.back()`으로 더미 히스토리 제거
13
+ * 3. 다른 방법(버튼 클릭, ESC, 외부 클릭 등)으로 닫을 때는 히스토리 길이를 비교하여 정리
14
14
  *
15
15
  * **상태 관리**
16
16
  * - `useState`를 사용하여 히스토리 기반 닫기 여부를 추적
@@ -19,8 +19,15 @@
19
19
  *
20
20
  * **히스토리 정리**
21
21
  * - 뒤로가기로 닫을 때: 브라우저가 자동으로 히스토리 pop (history.back() 불필요)
22
- * - ESC/외부 클릭으로 닫을 때: `history.back()` 호출하여 더미 히스토리 제거
23
- * - 더미 히스토리가 남지 않아 사용자 경험 개선
22
+ * - ESC/외부 클릭으로 닫을 때:
23
+ * - Sheet 내부에서 페이지 이동이 없었으면 `history.back()` 호출하여 더미 히스토리 제거
24
+ * - Sheet 내부에서 페이지 이동이 있었으면 더미 히스토리를 유지 (navigation 우선)
25
+ * - 더미 히스토리가 불필요하게 남지 않아 사용자 경험 개선
26
+ *
27
+ * **Navigation 감지**
28
+ * - Sheet이 열릴 때 히스토리 길이 저장
29
+ * - Sheet이 닫힐 때 히스토리 길이 비교로 내부 navigation 여부 판단
30
+ * - React Router, Next.js Router 등 모든 라우팅 라이브러리와 호환
24
31
  *
25
32
  * @limitation
26
33
  * - 모달 열린 상태에서 새로고침 시 히스토리에 더미 state가 남음
@@ -47,4 +54,4 @@ export interface UseHistoryCloseProps {
47
54
  */
48
55
  onClose: () => void;
49
56
  }
50
- export declare function useHistoryClose({ onClose, isOpen, }: UseHistoryCloseProps): boolean;
57
+ export declare function useHistoryClose({ onClose, isOpen }: UseHistoryCloseProps): boolean;