@ihabdevteam/core 0.440.0 → 0.441.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/CHANGELOG.md +12 -0
- package/dist/components.cjs.js +178 -178
- package/dist/components.esm.css +1 -1
- package/dist/hooks.cjs.js +5 -5
- package/dist/i18n.cjs.js +1 -1
- package/dist/ihabdevteam-core.cjs.js +187 -187
- package/dist/ihabdevteam-core.d.ts +154 -2
- package/dist/packages/core/src/components/CardSection.css +26 -0
- package/dist/packages/core/src/components/CardSection.d.ts +32 -0
- package/dist/packages/core/src/components/CardSection.js +23 -0
- package/dist/packages/core/src/components/FolderGrid.js +9 -17
- package/dist/packages/core/src/components/FolderSearchSections.d.ts +25 -0
- package/dist/packages/core/src/components/FolderSearchSections.js +18 -0
- package/dist/packages/core/src/components.d.ts +4 -0
- package/dist/packages/core/src/components.js +3 -0
- package/dist/packages/core/src/hooks/useCardDragToGroup.d.ts +33 -0
- package/dist/packages/core/src/hooks/useCardDragToGroup.js +52 -0
- package/dist/packages/core/src/hooks/useFolderBrowse.d.ts +30 -0
- package/dist/packages/core/src/hooks/useFolderBrowse.js +38 -0
- package/dist/packages/core/src/hooks.d.ts +2 -0
- package/dist/packages/core/src/hooks.js +3 -0
- package/dist/packages/core/src/utils/folderMenu.d.ts +27 -0
- package/dist/packages/core/src/utils/folderMenu.js +19 -0
- package/dist/packages/core/src/utils.d.ts +2 -0
- package/dist/packages/core/src/utils.js +1 -0
- package/dist/packages/core/src/version.d.ts +1 -1
- package/dist/packages/core/src/version.js +1 -1
- package/dist/utils.cjs.js +164 -164
- package/package.json +1 -1
|
@@ -2,7 +2,7 @@ import { ComponentType } from 'react';
|
|
|
2
2
|
import { Context } from 'react';
|
|
3
3
|
import { CSSProperties } from 'react';
|
|
4
4
|
import { Dispatch } from 'react';
|
|
5
|
-
import
|
|
5
|
+
import { DragEvent as DragEvent_2 } from 'react';
|
|
6
6
|
import type { ElementType } from 'react';
|
|
7
7
|
import { FC } from 'react';
|
|
8
8
|
import { FocusEvent as FocusEvent_2 } from 'react';
|
|
@@ -1256,6 +1256,37 @@ export declare const CAPABILITY: Record<WordTrainingTypeKey, {
|
|
|
1256
1256
|
group: WordTrainingGroup;
|
|
1257
1257
|
}>;
|
|
1258
1258
|
|
|
1259
|
+
/**
|
|
1260
|
+
* **카드를 끌어 묶음(폴더)에 놓는다** — HTML5 끌어 놓기를 한 벌로 쥔다(말귀 청 (437) ㉮ — 말귀 앱에서 옮겨 왔다, 2026-11-13).
|
|
1261
|
+
*
|
|
1262
|
+
* 카드 요소에는 `cardProps(payload)` 를, 놓일 자리(폴더 칸 등)에는 `groupProps(key)` 를 얹는다. 실제로 옮기는 일은
|
|
1263
|
+
* `onDrop(payload, key)` 에 맡긴다(열쇠 → 묶음 찾기는 부르는 쪽 몫). `dragging` · `draggingId` · `dragOverKey` 로 그리는 꼴을 바꾼다.
|
|
1264
|
+
*
|
|
1265
|
+
* · 기본은 `T = string`(카드 id 가 곧 짐)이다. 여러 종류를 한 화면에서 다루면 `T` 를 객체로 두고 `getId` 로 id 를 뽑고,
|
|
1266
|
+
* `groupProps` 의 `accept` 로 자리마다 받을 짐을 가린다.
|
|
1267
|
+
* · 강조(`dragOverKey`)는 `onDragEnter` 와 `onDragOver` 양쪽에서 건다 — 자리가 `onDragEnter` 를 안 넘기는 조각이어도 선다.
|
|
1268
|
+
* · 자식으로 옮겨 가며 나는 `dragleave` 는 버린다 — `relatedTarget` 이 자리 **밖**일 때만 강조를 끈다.
|
|
1269
|
+
*
|
|
1270
|
+
* `FolderGrid` 의 폴더 칸 끌기도 이 훅으로 선다(전에는 같은 상태를 제 안에서 다시 지었다).
|
|
1271
|
+
* @public
|
|
1272
|
+
*/
|
|
1273
|
+
export declare interface CardDragToGroup<T> {
|
|
1274
|
+
dragging: T | null;
|
|
1275
|
+
draggingId: string | null;
|
|
1276
|
+
dragOverKey: string | null;
|
|
1277
|
+
cardProps: (payload: T) => {
|
|
1278
|
+
draggable: true;
|
|
1279
|
+
onDragStart: (e: DragEvent_2<HTMLElement>) => void;
|
|
1280
|
+
onDragEnd: () => void;
|
|
1281
|
+
};
|
|
1282
|
+
groupProps: (groupKey: string, accept?: (payload: T) => boolean) => {
|
|
1283
|
+
onDragOver: (e: DragEvent_2<HTMLElement>) => void;
|
|
1284
|
+
onDragEnter: () => void;
|
|
1285
|
+
onDragLeave: (e: DragEvent_2<HTMLElement>) => void;
|
|
1286
|
+
onDrop: (e: DragEvent_2<HTMLElement>) => void;
|
|
1287
|
+
};
|
|
1288
|
+
}
|
|
1289
|
+
|
|
1259
1290
|
/** @public */
|
|
1260
1291
|
declare function CardOrderStep({ _stepIndex, _totalSteps, ...rest }: StepWrapperProps): JSX.Element;
|
|
1261
1292
|
|
|
@@ -1266,6 +1297,38 @@ declare function CardOrderStep({ _stepIndex, _totalSteps, ...rest }: StepWrapper
|
|
|
1266
1297
|
*/
|
|
1267
1298
|
export declare function cardQuestionTitle(typeKey: string | undefined, item: Record<string, unknown>, parts: string[]): string;
|
|
1268
1299
|
|
|
1300
|
+
/**
|
|
1301
|
+
* **카드가 서는 자리** — 회색 그룹 칸 없이 카드가 쪽 바탕에 바로 선다(말귀 청 (437) ㉮ — 말귀 앱에서 옮겨 왔다, 2026-11-13).
|
|
1302
|
+
*
|
|
1303
|
+
* 전에는 목록마다 `TrainingCardGroup`(회색 칸 + 제목 + 수)이 감쌌다. 말귀 사장님 지시로 그 칸을 걷었다(*"숙제관리, 고객별 숙제
|
|
1304
|
+
* 페이지, 등등 그룹 ui 를 사용하고 있는곳이 많아. 모두 정리해주고"*) — 목록이 하나뿐인 자리에서는 칸의 제목과 수가 위의 탭 ·
|
|
1305
|
+
* 도구줄과 **같은 말을 한 번 더** 했고, 화면마다 칸이 있고 없고가 갈려 같은 카드가 다르게 보였다.
|
|
1306
|
+
*
|
|
1307
|
+
* · **목록이 하나뿐이면 제목을 안 준다** — 무엇의 목록인지는 탭과 도구줄이 이미 말한다.
|
|
1308
|
+
* · **여러 묶음을 한 화면에 나눠 세울 때만 제목을 준다**(진행 중 / 완료 · 훈련 종류별 · 폴더별) — 가르는 것이 정보인 자리다.
|
|
1309
|
+
* 제목은 가벼운 한 줄(이름 + 수)이고 칸을 두르지 않는다.
|
|
1310
|
+
* · 비었을 때의 말(`emptyContent`)은 **목록 자리에** 선다 — 못 받음 · 못 찾음 · 아직 없음을 갈라 말하던 것 그대로.
|
|
1311
|
+
* @public
|
|
1312
|
+
*/
|
|
1313
|
+
export declare function CardSection({ title, count, titleLevel, actions, empty, emptyContent, className, children }: CardSectionProps): JSX.Element;
|
|
1314
|
+
|
|
1315
|
+
/** @public */
|
|
1316
|
+
export declare interface CardSectionProps {
|
|
1317
|
+
/** 묶음의 이름 — 한 화면에 묶음이 여럿일 때만 준다 */
|
|
1318
|
+
title?: ReactNode;
|
|
1319
|
+
/** 그 묶음의 수(쪽에 선 수가 아니라 전부) */
|
|
1320
|
+
count?: number;
|
|
1321
|
+
/** 제목의 머리글 급 — 쪽에 바로 서면 2, 창 안이면 3 */
|
|
1322
|
+
titleLevel?: 2 | 3 | 4;
|
|
1323
|
+
/** 제목 줄 오른쪽에 설 것 */
|
|
1324
|
+
actions?: ReactNode;
|
|
1325
|
+
/** 비었나 — 참이면 목록 대신 `emptyContent` 가 목록 자리에 선다 */
|
|
1326
|
+
empty?: boolean;
|
|
1327
|
+
emptyContent?: ReactNode;
|
|
1328
|
+
className?: string;
|
|
1329
|
+
children?: ReactNode;
|
|
1330
|
+
}
|
|
1331
|
+
|
|
1269
1332
|
/** @public */
|
|
1270
1333
|
export declare function CardStep({ _stepIndex, _totalSteps, ...rest }: StepWrapperProps): JSX.Element;
|
|
1271
1334
|
|
|
@@ -2162,7 +2225,7 @@ export declare function copyText(text: string): Promise<boolean>;
|
|
|
2162
2225
|
*
|
|
2163
2226
|
* 값은 손으로 적고 `test/coreVersion.test.ts` 가 package.json 과 어긋나면 운다.
|
|
2164
2227
|
*/
|
|
2165
|
-
export declare const CORE_VERSION = "0.
|
|
2228
|
+
export declare const CORE_VERSION = "0.441.0";
|
|
2166
2229
|
|
|
2167
2230
|
/** @public */
|
|
2168
2231
|
declare const coreDefault: Record<string, unknown>;
|
|
@@ -3207,6 +3270,35 @@ export declare const folderJoin: (parent: string | null, name: string) => string
|
|
|
3207
3270
|
/** @public 화면에 보일 이름 — 길의 마지막 마디 */
|
|
3208
3271
|
export declare function folderLeaf(path: string): string;
|
|
3209
3272
|
|
|
3273
|
+
/** @public 폴더 메뉴의 줄을 정해진 차례 · 아이콘으로 짓는다 */
|
|
3274
|
+
export declare function folderMenuItems(lines: {
|
|
3275
|
+
/** 이 자리에 하나 더 만든다(무엇을 만드는지는 화면 몫) */
|
|
3276
|
+
add: FolderMenuLine;
|
|
3277
|
+
addFolder: FolderMenuLine;
|
|
3278
|
+
rename?: FolderMenuLine;
|
|
3279
|
+
remove?: FolderMenuLine;
|
|
3280
|
+
}): {
|
|
3281
|
+
label: string;
|
|
3282
|
+
icon: string;
|
|
3283
|
+
onClick: () => void;
|
|
3284
|
+
closeOnSelect: true;
|
|
3285
|
+
}[];
|
|
3286
|
+
|
|
3287
|
+
/**
|
|
3288
|
+
* **폴더 메뉴의 줄** — 길의 「이름 ▾」 와 폴더 칸의 ⋯ 가 여는 메뉴(말귀 청 (437) ㉮ — 말귀 앱에서 옮겨 왔다, 2026-11-13).
|
|
3289
|
+
*
|
|
3290
|
+
* 화면마다 차례와 아이콘이 갈리면 안 되는 자리다: **더하기 → 폴더 추가 → (이름 바꾸기) → 폴더 삭제**. 구분선은 없고, 줄을 고르면 닫힌다.
|
|
3291
|
+
* 이름표는 부르는 쪽이 준다(무엇을 '더하는지' 는 화면마다 다르다 — 단어표 · 훈련 …).
|
|
3292
|
+
* · 맨 위의 메뉴는 `rename` · `remove` 를 안 준다(지울 폴더가 없다).
|
|
3293
|
+
* · 이름 바꾸기는 그 일이 있는 화면만 준다.
|
|
3294
|
+
* 돌려준 줄은 `FolderHead` 의 `folderMenu` · `rootMenu`, `FolderGrid` 의 `menuItems` 에 그대로 넘긴다.
|
|
3295
|
+
*/
|
|
3296
|
+
/** @public 메뉴 한 줄 — 이름표와 할 일 */
|
|
3297
|
+
export declare interface FolderMenuLine {
|
|
3298
|
+
label: string;
|
|
3299
|
+
onClick: () => void;
|
|
3300
|
+
}
|
|
3301
|
+
|
|
3210
3302
|
/**
|
|
3211
3303
|
* 폴더 `from` 을 `toParent` 안으로 **옮겼을 때** `path` 의 새 길(사장님 지시 2026-11-13 "드래드 해서 다른 폴더에 넣거나 뺄 수
|
|
3212
3304
|
* 있도록"). `path` 가 `from` 그 자체나 그 아래면 앞머리를 갈아 돌려주고, 상관없는 길이면 `undefined`.
|
|
@@ -3227,6 +3319,32 @@ export declare function folderMoveVerdict(from: string, into: string | null, exi
|
|
|
3227
3319
|
/** @public 한 층 위 폴더의 길 — 맨 위 폴더면 `null`(맨 위) */
|
|
3228
3320
|
export declare function folderParent(path: string): string | null;
|
|
3229
3321
|
|
|
3322
|
+
/**
|
|
3323
|
+
* **찾은 것을 폴더마다 나눠 세운다** — 찾는 중의 목록(말귀 청 (437) ㉮ — 말귀 앱에서 옮겨 왔다, 2026-11-13).
|
|
3324
|
+
*
|
|
3325
|
+
* 찾는 중에는 폴더를 가리지 않고 **전부에서** 찾는다(`useFolderBrowse`). 찾은 것이 여러 폴더에 걸치므로 어느 폴더의 것인지가
|
|
3326
|
+
* 보여야 한다 — 폴더마다 가벼운 제목 한 줄(길 · 수)을 두고 그 아래 카드를 세운다(`CardSection`). 회색 그룹 칸은 두르지 않는다.
|
|
3327
|
+
* 폴더를 다루는 일(이름 고치기 · 지우기 · 끌어 놓기)은 여기 없다 — 찾는 중에 하는 일이 아니고, 폴더 메뉴에 있다.
|
|
3328
|
+
*
|
|
3329
|
+
* · **빈 폴더는 안 세운다** — 찾은 것이 없는 폴더의 제목만 줄줄이 서면 찾은 것이 묻힌다.
|
|
3330
|
+
* · 폴더 안의 폴더는 길(`앙/하위`)을 `앙 › 하위` 로 이어 보인다.
|
|
3331
|
+
* · 폴더 없는 것은 `noneLabel` 아래에 선다.
|
|
3332
|
+
* @public
|
|
3333
|
+
*/
|
|
3334
|
+
export declare function FolderSearchSections<T>({ bundles, noneKey, noneLabel, titleLevel, rowRender }: FolderSearchSectionsProps<T>): JSX.Element;
|
|
3335
|
+
|
|
3336
|
+
/** @public */
|
|
3337
|
+
export declare interface FolderSearchSectionsProps<T> {
|
|
3338
|
+
/** 폴더마다의 찾은 것 — `[폴더의 길(없으면 noneKey), 그 줄들]`. 차례는 받은 그대로 */
|
|
3339
|
+
bundles: readonly (readonly [string, readonly T[]])[];
|
|
3340
|
+
/** 폴더 없는 것을 가리키는 열쇠 */
|
|
3341
|
+
noneKey: string;
|
|
3342
|
+
/** 폴더 없는 것의 이름 */
|
|
3343
|
+
noneLabel: string;
|
|
3344
|
+
titleLevel?: 2 | 3 | 4;
|
|
3345
|
+
rowRender: (row: T, slot: number) => ReactNode;
|
|
3346
|
+
}
|
|
3347
|
+
|
|
3230
3348
|
/** @public 맨 위에서 그 폴더까지의 길 — 층마다 `{ path, label }`(길 · 보일 이름) */
|
|
3231
3349
|
export declare function folderTrail(path: string): {
|
|
3232
3350
|
path: string;
|
|
@@ -11373,6 +11491,9 @@ export declare interface UseCalendarMonthResult {
|
|
|
11373
11491
|
setViewYM: (y: number, m: number) => void;
|
|
11374
11492
|
}
|
|
11375
11493
|
|
|
11494
|
+
/** @public */
|
|
11495
|
+
export declare function useCardDragToGroup<T = string>(onDrop: (payload: T, groupKey: string) => void, getId?: (payload: T) => string): CardDragToGroup<T>;
|
|
11496
|
+
|
|
11376
11497
|
/**
|
|
11377
11498
|
* TextField의 `suggestions` 옵션이 쓰는 자동완성 콤보박스 상태/키보드 로직.
|
|
11378
11499
|
* 순수 입력(값 관리)과 분리해서, 자동완성이 필요 없는 TextField 사용처는
|
|
@@ -11564,6 +11685,37 @@ export declare interface UseFitScaleResult {
|
|
|
11564
11685
|
offset: number;
|
|
11565
11686
|
}
|
|
11566
11687
|
|
|
11688
|
+
/**
|
|
11689
|
+
* **폴더로 보는 화면의 자리** — 지금 어느 폴더 안에 있나, 찾는 중인가, 새 폴더는 어디에 서나(말귀 청 (437) ㉮ — 말귀 앱에서 옮겨 왔다).
|
|
11690
|
+
*
|
|
11691
|
+
* 말귀의 나의 단어표 · 나의 단어훈련 · 나의 문장훈련이 이 규칙을 한 벌씩 들고 있다가 앱에서 한 벌로 모았고, 코어 `FolderHead` 식구로 옮겼다.
|
|
11692
|
+
* 화면마다 같아야 하는 규칙이다:
|
|
11693
|
+
*
|
|
11694
|
+
* · **목록에 없는 폴더는 안 연 것으로 친다** — 들어가 있던 폴더를 지웠거나 보기(갈래)를 바꿔 그 폴더가 없으면 맨 위로 돌아온다.
|
|
11695
|
+
* · **찾는 중에는 폴더를 가리지 않는다** — 그때 새 폴더는 맨 위에 선다(길이 안 보이는데 안 보이는 폴더 안에 만들면 안 된다).
|
|
11696
|
+
* · 폴더를 열면 **첫 쪽으로** 돌아간다(`onOpen`) — 3쪽을 보다가 폴더에 들어가면 그 폴더의 3쪽(대개 빈 화면)이 선다.
|
|
11697
|
+
* · 들어가 있던 폴더가 옮겨지거나 이름이 바뀌면 **그 새 길로 따라간다** — 안 따라가면 맨 위로 튕긴다.
|
|
11698
|
+
* @public
|
|
11699
|
+
*/
|
|
11700
|
+
export declare function useFolderBrowse({ paths, search, onOpen }: {
|
|
11701
|
+
/** 있는 폴더 전부의 길(중간 폴더까지 채운 것 — `withAncestors`) */
|
|
11702
|
+
paths: readonly string[];
|
|
11703
|
+
/** 찾는 말 — 비어 있지 않으면 찾는 중이다 */
|
|
11704
|
+
search: string;
|
|
11705
|
+
/** 폴더를 열거나 맨 위로 갈 때 함께 할 일 — 쪽을 첫 쪽으로 돌린다 */
|
|
11706
|
+
onOpen?: () => void;
|
|
11707
|
+
}): {
|
|
11708
|
+
opened: string | null;
|
|
11709
|
+
searching: boolean;
|
|
11710
|
+
open: (path: string | null) => void;
|
|
11711
|
+
reset: () => void;
|
|
11712
|
+
followMove: (from: string, into: string | null) => void;
|
|
11713
|
+
followRename: (from: string, to: string) => void;
|
|
11714
|
+
newFolderParent: string | null;
|
|
11715
|
+
/** 새 폴더가 설 자리에 이미 있는 이름들 — 같은 이름을 또 못 짓게 견준다 */
|
|
11716
|
+
siblingNames: string[];
|
|
11717
|
+
};
|
|
11718
|
+
|
|
11567
11719
|
/** @public */
|
|
11568
11720
|
export declare function useFontScale({ storageKey, baseFont, minScale, maxScale, step, lineHeightRatio, }?: UseFontScaleOptions): {
|
|
11569
11721
|
scale: number;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/* **카드가 서는 자리**(`CardSection`) — 회색 그룹 칸 없이 카드가 쪽 바탕에 바로 선다(말귀 청 (437) ㉮).
|
|
2
|
+
카드는 제 폭(360 · 작은 것 120)을 쥐고 있어 드는 만큼 나란히 선다. 한 줄의 카드는 키를 맞춘다. */
|
|
3
|
+
.card-section { display: flex; flex-direction: column; gap: var(--spacing-s); min-width: 0; }
|
|
4
|
+
/* 묶음이 여럿이면 묶음 사이를 넉넉히 띄운다 — 칸이 없으니 간격이 가름이다 */
|
|
5
|
+
.card-section + .card-section { margin-top: var(--spacing-l); }
|
|
6
|
+
|
|
7
|
+
/* 제목 줄 — 이름 · 수 · (오른쪽에) 단추. 칸을 두르지 않는 가벼운 한 줄이다 */
|
|
8
|
+
.card-section__head { display: flex; align-items: center; gap: var(--spacing-xs); min-height: 32px; }
|
|
9
|
+
.card-section__title { margin: 0; color: var(--color-text-primary); }
|
|
10
|
+
.card-section__count { color: var(--color-main-ink, var(--color-main)); }
|
|
11
|
+
.card-section__actions { margin-left: auto; display: inline-flex; align-items: center; gap: var(--spacing-xs); }
|
|
12
|
+
|
|
13
|
+
.card-section__list {
|
|
14
|
+
display: flex;
|
|
15
|
+
flex-wrap: wrap;
|
|
16
|
+
align-items: stretch;
|
|
17
|
+
gap: var(--spacing-s);
|
|
18
|
+
}
|
|
19
|
+
/* 카드가 자리보다 넓으면 줄어들 수 있게(폰) — 안 주면 360 이 버틴다 */
|
|
20
|
+
.card-section__list > * { min-width: 0; }
|
|
21
|
+
|
|
22
|
+
.card-section__empty {
|
|
23
|
+
padding: var(--spacing-xl) var(--spacing-m);
|
|
24
|
+
text-align: center;
|
|
25
|
+
color: var(--color-gray);
|
|
26
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import './CardSection.css';
|
|
3
|
+
/** @public */
|
|
4
|
+
export interface CardSectionProps {
|
|
5
|
+
/** 묶음의 이름 — 한 화면에 묶음이 여럿일 때만 준다 */
|
|
6
|
+
title?: ReactNode;
|
|
7
|
+
/** 그 묶음의 수(쪽에 선 수가 아니라 전부) */
|
|
8
|
+
count?: number;
|
|
9
|
+
/** 제목의 머리글 급 — 쪽에 바로 서면 2, 창 안이면 3 */
|
|
10
|
+
titleLevel?: 2 | 3 | 4;
|
|
11
|
+
/** 제목 줄 오른쪽에 설 것 */
|
|
12
|
+
actions?: ReactNode;
|
|
13
|
+
/** 비었나 — 참이면 목록 대신 `emptyContent` 가 목록 자리에 선다 */
|
|
14
|
+
empty?: boolean;
|
|
15
|
+
emptyContent?: ReactNode;
|
|
16
|
+
className?: string;
|
|
17
|
+
children?: ReactNode;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* **카드가 서는 자리** — 회색 그룹 칸 없이 카드가 쪽 바탕에 바로 선다(말귀 청 (437) ㉮ — 말귀 앱에서 옮겨 왔다, 2026-11-13).
|
|
21
|
+
*
|
|
22
|
+
* 전에는 목록마다 `TrainingCardGroup`(회색 칸 + 제목 + 수)이 감쌌다. 말귀 사장님 지시로 그 칸을 걷었다(*"숙제관리, 고객별 숙제
|
|
23
|
+
* 페이지, 등등 그룹 ui 를 사용하고 있는곳이 많아. 모두 정리해주고"*) — 목록이 하나뿐인 자리에서는 칸의 제목과 수가 위의 탭 ·
|
|
24
|
+
* 도구줄과 **같은 말을 한 번 더** 했고, 화면마다 칸이 있고 없고가 갈려 같은 카드가 다르게 보였다.
|
|
25
|
+
*
|
|
26
|
+
* · **목록이 하나뿐이면 제목을 안 준다** — 무엇의 목록인지는 탭과 도구줄이 이미 말한다.
|
|
27
|
+
* · **여러 묶음을 한 화면에 나눠 세울 때만 제목을 준다**(진행 중 / 완료 · 훈련 종류별 · 폴더별) — 가르는 것이 정보인 자리다.
|
|
28
|
+
* 제목은 가벼운 한 줄(이름 + 수)이고 칸을 두르지 않는다.
|
|
29
|
+
* · 비었을 때의 말(`emptyContent`)은 **목록 자리에** 선다 — 못 받음 · 못 찾음 · 아직 없음을 갈라 말하던 것 그대로.
|
|
30
|
+
* @public
|
|
31
|
+
*/
|
|
32
|
+
export default function CardSection({ title, count, titleLevel, actions, empty, emptyContent, className, children }: CardSectionProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { cx } from '../utils/cx';
|
|
4
|
+
import './CardSection.css';
|
|
5
|
+
/**
|
|
6
|
+
* **카드가 서는 자리** — 회색 그룹 칸 없이 카드가 쪽 바탕에 바로 선다(말귀 청 (437) ㉮ — 말귀 앱에서 옮겨 왔다, 2026-11-13).
|
|
7
|
+
*
|
|
8
|
+
* 전에는 목록마다 `TrainingCardGroup`(회색 칸 + 제목 + 수)이 감쌌다. 말귀 사장님 지시로 그 칸을 걷었다(*"숙제관리, 고객별 숙제
|
|
9
|
+
* 페이지, 등등 그룹 ui 를 사용하고 있는곳이 많아. 모두 정리해주고"*) — 목록이 하나뿐인 자리에서는 칸의 제목과 수가 위의 탭 ·
|
|
10
|
+
* 도구줄과 **같은 말을 한 번 더** 했고, 화면마다 칸이 있고 없고가 갈려 같은 카드가 다르게 보였다.
|
|
11
|
+
*
|
|
12
|
+
* · **목록이 하나뿐이면 제목을 안 준다** — 무엇의 목록인지는 탭과 도구줄이 이미 말한다.
|
|
13
|
+
* · **여러 묶음을 한 화면에 나눠 세울 때만 제목을 준다**(진행 중 / 완료 · 훈련 종류별 · 폴더별) — 가르는 것이 정보인 자리다.
|
|
14
|
+
* 제목은 가벼운 한 줄(이름 + 수)이고 칸을 두르지 않는다.
|
|
15
|
+
* · 비었을 때의 말(`emptyContent`)은 **목록 자리에** 선다 — 못 받음 · 못 찾음 · 아직 없음을 갈라 말하던 것 그대로.
|
|
16
|
+
* @public
|
|
17
|
+
*/
|
|
18
|
+
export default function CardSection({ title, count, titleLevel = 3, actions, empty = false, emptyContent, className, children }) {
|
|
19
|
+
const Heading = `h${titleLevel}`;
|
|
20
|
+
return (_jsxs("section", { className: cx('card-section', className), children: [title != null && (_jsxs("header", { className: "card-section__head", children: [_jsx(Heading, { className: "card-section__title h5b", children: title }), count != null && _jsx("span", { className: "card-section__count body-3b", children: count }), actions != null && _jsx("span", { className: "card-section__actions", children: actions })] })), empty
|
|
21
|
+
? _jsx("div", { className: "card-section__empty body-3", children: emptyContent })
|
|
22
|
+
: _jsx("div", { className: "card-section__list", children: children })] }));
|
|
23
|
+
}
|
|
@@ -5,6 +5,7 @@ import { useTranslation } from 'react-i18next';
|
|
|
5
5
|
import Button from './Button';
|
|
6
6
|
import Tooltip from './Tooltip/Tooltip';
|
|
7
7
|
import MenuTooltip from './Tooltip/MenuTooltip';
|
|
8
|
+
import { useCardDragToGroup } from '../hooks/useCardDragToGroup';
|
|
8
9
|
import './FolderGrid.css';
|
|
9
10
|
/**
|
|
10
11
|
* **폴더 칸의 격자** — 폴더 하나가 단추 하나(아이콘 · 이름 · 든 수)이고, 누르면 그 안으로 들어간다(말귀 청 (435)).
|
|
@@ -22,31 +23,22 @@ export default function FolderGrid({ folders, onOpen, dropProps, dropOver, menuI
|
|
|
22
23
|
const { t } = useTranslation();
|
|
23
24
|
/** 메뉴가 열린 폴더와 그 단추 */
|
|
24
25
|
const [menu, setMenu] = useState(null);
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
const
|
|
26
|
+
/* **폴더 칸 끌기는 끌기 훅 한 벌로**(말귀 청 (437) ㉮, 2026-11-13) — 전에는 끄는 중 · 위에 떠 있나 · `relatedTarget` 나감 판정을
|
|
27
|
+
여기서 다시 지었다. 카드 끌기(화면이 `dropProps` 로 주는 손)와는 따로 쥔다 — 폴더를 끄는 동안에는 폴더가 놓일 자리만 산다. */
|
|
28
|
+
const folderDrag = useCardDragToGroup((from, into) => onMove?.(from, into));
|
|
29
|
+
const draggingFolder = folderDrag.dragging;
|
|
28
30
|
/** 그 칸의 끌기 손 — 폴더를 끄는 중이면 폴더가 놓일 자리, 아니면 카드가 놓일 자리(화면이 준 손) */
|
|
29
31
|
const cellDrag = (name) => {
|
|
30
|
-
const grab = onMove ? {
|
|
31
|
-
draggable: true,
|
|
32
|
-
onDragStart: (e) => { e.dataTransfer.effectAllowed = 'move'; e.dataTransfer.setData('text/plain', name); setDraggingFolder(name); },
|
|
33
|
-
onDragEnd: () => { setDraggingFolder(null); setFolderOver(null); },
|
|
34
|
-
} : {};
|
|
32
|
+
const grab = onMove ? folderDrag.cardProps(name) : {};
|
|
35
33
|
if (draggingFolder === null)
|
|
36
34
|
return { ...dropProps?.(name), ...grab };
|
|
37
35
|
if (!onMove || draggingFolder === name)
|
|
38
36
|
return grab;
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
onDragOver: (e) => { e.preventDefault(); e.dataTransfer.dropEffect = 'move'; if (folderOver !== name)
|
|
42
|
-
setFolderOver(name); },
|
|
43
|
-
onDragLeave: (e) => { if (!e.currentTarget.contains(e.relatedTarget))
|
|
44
|
-
setFolderOver(now => (now === name ? null : now)); },
|
|
45
|
-
onDrop: (e) => { e.preventDefault(); const from = draggingFolder; setDraggingFolder(null); setFolderOver(null); onMove(from, name); },
|
|
46
|
-
};
|
|
37
|
+
/* 제 자신에게는 안 놓인다 — 위에서 걸렀다 */
|
|
38
|
+
return { ...grab, ...folderDrag.groupProps(name) };
|
|
47
39
|
};
|
|
48
40
|
/** 그 칸 위에 무엇이 떠 있나 — 카드든 폴더든 같은 꼴로 말한다 */
|
|
49
|
-
const isOver = (name) => (draggingFolder === null ? dropOver === name :
|
|
41
|
+
const isOver = (name) => (draggingFolder === null ? dropOver === name : folderDrag.dragOverKey === name);
|
|
50
42
|
/* 열린 채 ⋯ 를 다시 누르면 닫힌다 — 그 누름은 메뉴에게 '바깥 누름' 이라 메뉴가 먼저 닫히는데, 이어서 이 손이 도로 열면
|
|
51
43
|
닫을 길이 없다. 방금 닫힌 그 폴더면 다시 열지 않는다. */
|
|
52
44
|
const justClosed = useRef(null);
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
/** @public */
|
|
3
|
+
export interface FolderSearchSectionsProps<T> {
|
|
4
|
+
/** 폴더마다의 찾은 것 — `[폴더의 길(없으면 noneKey), 그 줄들]`. 차례는 받은 그대로 */
|
|
5
|
+
bundles: readonly (readonly [string, readonly T[]])[];
|
|
6
|
+
/** 폴더 없는 것을 가리키는 열쇠 */
|
|
7
|
+
noneKey: string;
|
|
8
|
+
/** 폴더 없는 것의 이름 */
|
|
9
|
+
noneLabel: string;
|
|
10
|
+
titleLevel?: 2 | 3 | 4;
|
|
11
|
+
rowRender: (row: T, slot: number) => ReactNode;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* **찾은 것을 폴더마다 나눠 세운다** — 찾는 중의 목록(말귀 청 (437) ㉮ — 말귀 앱에서 옮겨 왔다, 2026-11-13).
|
|
15
|
+
*
|
|
16
|
+
* 찾는 중에는 폴더를 가리지 않고 **전부에서** 찾는다(`useFolderBrowse`). 찾은 것이 여러 폴더에 걸치므로 어느 폴더의 것인지가
|
|
17
|
+
* 보여야 한다 — 폴더마다 가벼운 제목 한 줄(길 · 수)을 두고 그 아래 카드를 세운다(`CardSection`). 회색 그룹 칸은 두르지 않는다.
|
|
18
|
+
* 폴더를 다루는 일(이름 고치기 · 지우기 · 끌어 놓기)은 여기 없다 — 찾는 중에 하는 일이 아니고, 폴더 메뉴에 있다.
|
|
19
|
+
*
|
|
20
|
+
* · **빈 폴더는 안 세운다** — 찾은 것이 없는 폴더의 제목만 줄줄이 서면 찾은 것이 묻힌다.
|
|
21
|
+
* · 폴더 안의 폴더는 길(`앙/하위`)을 `앙 › 하위` 로 이어 보인다.
|
|
22
|
+
* · 폴더 없는 것은 `noneLabel` 아래에 선다.
|
|
23
|
+
* @public
|
|
24
|
+
*/
|
|
25
|
+
export default function FolderSearchSections<T>({ bundles, noneKey, noneLabel, titleLevel, rowRender }: FolderSearchSectionsProps<T>): import("react").JSX.Element;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
+
import CardSection from './CardSection';
|
|
4
|
+
/**
|
|
5
|
+
* **찾은 것을 폴더마다 나눠 세운다** — 찾는 중의 목록(말귀 청 (437) ㉮ — 말귀 앱에서 옮겨 왔다, 2026-11-13).
|
|
6
|
+
*
|
|
7
|
+
* 찾는 중에는 폴더를 가리지 않고 **전부에서** 찾는다(`useFolderBrowse`). 찾은 것이 여러 폴더에 걸치므로 어느 폴더의 것인지가
|
|
8
|
+
* 보여야 한다 — 폴더마다 가벼운 제목 한 줄(길 · 수)을 두고 그 아래 카드를 세운다(`CardSection`). 회색 그룹 칸은 두르지 않는다.
|
|
9
|
+
* 폴더를 다루는 일(이름 고치기 · 지우기 · 끌어 놓기)은 여기 없다 — 찾는 중에 하는 일이 아니고, 폴더 메뉴에 있다.
|
|
10
|
+
*
|
|
11
|
+
* · **빈 폴더는 안 세운다** — 찾은 것이 없는 폴더의 제목만 줄줄이 서면 찾은 것이 묻힌다.
|
|
12
|
+
* · 폴더 안의 폴더는 길(`앙/하위`)을 `앙 › 하위` 로 이어 보인다.
|
|
13
|
+
* · 폴더 없는 것은 `noneLabel` 아래에 선다.
|
|
14
|
+
* @public
|
|
15
|
+
*/
|
|
16
|
+
export default function FolderSearchSections({ bundles, noneKey, noneLabel, titleLevel = 2, rowRender }) {
|
|
17
|
+
return (_jsx(_Fragment, { children: bundles.filter(([, rows]) => rows.length > 0).map(([folder, rows]) => (_jsx(CardSection, { titleLevel: titleLevel, title: folder === noneKey ? noneLabel : folder.split('/').join(' › '), count: rows.length, children: rows.map((row, i) => rowRender(row, i)) }, folder))) }));
|
|
18
|
+
}
|
|
@@ -107,6 +107,10 @@ export { default as FolderHead } from './components/FolderHead';
|
|
|
107
107
|
export type { FolderHeadProps } from './components/FolderHead';
|
|
108
108
|
export { default as FolderGrid } from './components/FolderGrid';
|
|
109
109
|
export type { FolderGridProps, FolderEntry } from './components/FolderGrid';
|
|
110
|
+
export { default as CardSection } from './components/CardSection';
|
|
111
|
+
export type { CardSectionProps } from './components/CardSection';
|
|
112
|
+
export { default as FolderSearchSections } from './components/FolderSearchSections';
|
|
113
|
+
export type { FolderSearchSectionsProps } from './components/FolderSearchSections';
|
|
110
114
|
export { default as FolderTreeButton } from './components/FolderTreeButton';
|
|
111
115
|
export type { FolderTreeButtonProps } from './components/FolderTreeButton';
|
|
112
116
|
export { default as FolderTreeTooltip } from './components/Tooltip/FolderTreeTooltip';
|
|
@@ -74,6 +74,9 @@ export { default as Breadcrumb } from './components/Breadcrumb';
|
|
|
74
74
|
/* 폴더로 보는 화면 — 구조 단추 · 길 · 폴더 칸(말귀 청 (435), 2026-11-13). 길 셈은 `utils` 의 `folder*` 다 */
|
|
75
75
|
export { default as FolderHead } from './components/FolderHead';
|
|
76
76
|
export { default as FolderGrid } from './components/FolderGrid';
|
|
77
|
+
/* 폴더 화면의 남은 조각(말귀 청 (437) ㉮, 2026-11-13) — 카드가 서는 자리 · 찾는 중 폴더마다 나눠 세우기 */
|
|
78
|
+
export { default as CardSection } from './components/CardSection';
|
|
79
|
+
export { default as FolderSearchSections } from './components/FolderSearchSections';
|
|
77
80
|
export { default as FolderTreeButton } from './components/FolderTreeButton';
|
|
78
81
|
export { default as FolderTreeTooltip } from './components/Tooltip/FolderTreeTooltip';
|
|
79
82
|
export { default as Rating } from './components/Rating';
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { type DragEvent } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* **카드를 끌어 묶음(폴더)에 놓는다** — HTML5 끌어 놓기를 한 벌로 쥔다(말귀 청 (437) ㉮ — 말귀 앱에서 옮겨 왔다, 2026-11-13).
|
|
4
|
+
*
|
|
5
|
+
* 카드 요소에는 `cardProps(payload)` 를, 놓일 자리(폴더 칸 등)에는 `groupProps(key)` 를 얹는다. 실제로 옮기는 일은
|
|
6
|
+
* `onDrop(payload, key)` 에 맡긴다(열쇠 → 묶음 찾기는 부르는 쪽 몫). `dragging` · `draggingId` · `dragOverKey` 로 그리는 꼴을 바꾼다.
|
|
7
|
+
*
|
|
8
|
+
* · 기본은 `T = string`(카드 id 가 곧 짐)이다. 여러 종류를 한 화면에서 다루면 `T` 를 객체로 두고 `getId` 로 id 를 뽑고,
|
|
9
|
+
* `groupProps` 의 `accept` 로 자리마다 받을 짐을 가린다.
|
|
10
|
+
* · 강조(`dragOverKey`)는 `onDragEnter` 와 `onDragOver` 양쪽에서 건다 — 자리가 `onDragEnter` 를 안 넘기는 조각이어도 선다.
|
|
11
|
+
* · 자식으로 옮겨 가며 나는 `dragleave` 는 버린다 — `relatedTarget` 이 자리 **밖**일 때만 강조를 끈다.
|
|
12
|
+
*
|
|
13
|
+
* `FolderGrid` 의 폴더 칸 끌기도 이 훅으로 선다(전에는 같은 상태를 제 안에서 다시 지었다).
|
|
14
|
+
* @public
|
|
15
|
+
*/
|
|
16
|
+
export interface CardDragToGroup<T> {
|
|
17
|
+
dragging: T | null;
|
|
18
|
+
draggingId: string | null;
|
|
19
|
+
dragOverKey: string | null;
|
|
20
|
+
cardProps: (payload: T) => {
|
|
21
|
+
draggable: true;
|
|
22
|
+
onDragStart: (e: DragEvent<HTMLElement>) => void;
|
|
23
|
+
onDragEnd: () => void;
|
|
24
|
+
};
|
|
25
|
+
groupProps: (groupKey: string, accept?: (payload: T) => boolean) => {
|
|
26
|
+
onDragOver: (e: DragEvent<HTMLElement>) => void;
|
|
27
|
+
onDragEnter: () => void;
|
|
28
|
+
onDragLeave: (e: DragEvent<HTMLElement>) => void;
|
|
29
|
+
onDrop: (e: DragEvent<HTMLElement>) => void;
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
/** @public */
|
|
33
|
+
export declare function useCardDragToGroup<T = string>(onDrop: (payload: T, groupKey: string) => void, getId?: (payload: T) => string): CardDragToGroup<T>;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { useCallback, useState } from 'react';
|
|
3
|
+
const defaultGetId = (p) => String(p);
|
|
4
|
+
/** @public */
|
|
5
|
+
export function useCardDragToGroup(onDrop, getId = defaultGetId) {
|
|
6
|
+
const [dragging, setDragging] = useState(null);
|
|
7
|
+
const [dragOverKey, setDragOverKey] = useState(null);
|
|
8
|
+
const cardProps = useCallback((payload) => ({
|
|
9
|
+
draggable: true,
|
|
10
|
+
onDragStart: (e) => {
|
|
11
|
+
setDragging(payload);
|
|
12
|
+
e.dataTransfer.effectAllowed = 'move';
|
|
13
|
+
e.dataTransfer.setData('text/plain', getId(payload));
|
|
14
|
+
},
|
|
15
|
+
onDragEnd: () => { setDragging(null); setDragOverKey(null); },
|
|
16
|
+
}), [getId]);
|
|
17
|
+
const groupProps = useCallback((groupKey, accept) => {
|
|
18
|
+
/* 지금 끄는 짐을 이 자리가 받나(`accept` 를 안 주면 다 받는다) */
|
|
19
|
+
const active = dragging != null && (!accept || accept(dragging));
|
|
20
|
+
return {
|
|
21
|
+
onDragOver: (e) => {
|
|
22
|
+
if (!active)
|
|
23
|
+
return;
|
|
24
|
+
e.preventDefault();
|
|
25
|
+
e.dataTransfer.dropEffect = 'move';
|
|
26
|
+
setDragOverKey(groupKey);
|
|
27
|
+
},
|
|
28
|
+
onDragEnter: () => { if (active)
|
|
29
|
+
setDragOverKey(groupKey); },
|
|
30
|
+
onDragLeave: (e) => {
|
|
31
|
+
if (active && !e.currentTarget.contains(e.relatedTarget))
|
|
32
|
+
setDragOverKey(now => (now === groupKey ? null : now));
|
|
33
|
+
},
|
|
34
|
+
onDrop: (e) => {
|
|
35
|
+
if (!active || dragging == null)
|
|
36
|
+
return;
|
|
37
|
+
e.preventDefault();
|
|
38
|
+
const payload = dragging;
|
|
39
|
+
setDragOverKey(null);
|
|
40
|
+
setDragging(null);
|
|
41
|
+
onDrop(payload, groupKey);
|
|
42
|
+
},
|
|
43
|
+
};
|
|
44
|
+
}, [dragging, onDrop]);
|
|
45
|
+
return {
|
|
46
|
+
dragging,
|
|
47
|
+
draggingId: dragging == null ? null : getId(dragging),
|
|
48
|
+
dragOverKey,
|
|
49
|
+
cardProps,
|
|
50
|
+
groupProps,
|
|
51
|
+
};
|
|
52
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* **폴더로 보는 화면의 자리** — 지금 어느 폴더 안에 있나, 찾는 중인가, 새 폴더는 어디에 서나(말귀 청 (437) ㉮ — 말귀 앱에서 옮겨 왔다).
|
|
3
|
+
*
|
|
4
|
+
* 말귀의 나의 단어표 · 나의 단어훈련 · 나의 문장훈련이 이 규칙을 한 벌씩 들고 있다가 앱에서 한 벌로 모았고, 코어 `FolderHead` 식구로 옮겼다.
|
|
5
|
+
* 화면마다 같아야 하는 규칙이다:
|
|
6
|
+
*
|
|
7
|
+
* · **목록에 없는 폴더는 안 연 것으로 친다** — 들어가 있던 폴더를 지웠거나 보기(갈래)를 바꿔 그 폴더가 없으면 맨 위로 돌아온다.
|
|
8
|
+
* · **찾는 중에는 폴더를 가리지 않는다** — 그때 새 폴더는 맨 위에 선다(길이 안 보이는데 안 보이는 폴더 안에 만들면 안 된다).
|
|
9
|
+
* · 폴더를 열면 **첫 쪽으로** 돌아간다(`onOpen`) — 3쪽을 보다가 폴더에 들어가면 그 폴더의 3쪽(대개 빈 화면)이 선다.
|
|
10
|
+
* · 들어가 있던 폴더가 옮겨지거나 이름이 바뀌면 **그 새 길로 따라간다** — 안 따라가면 맨 위로 튕긴다.
|
|
11
|
+
* @public
|
|
12
|
+
*/
|
|
13
|
+
export declare function useFolderBrowse({ paths, search, onOpen }: {
|
|
14
|
+
/** 있는 폴더 전부의 길(중간 폴더까지 채운 것 — `withAncestors`) */
|
|
15
|
+
paths: readonly string[];
|
|
16
|
+
/** 찾는 말 — 비어 있지 않으면 찾는 중이다 */
|
|
17
|
+
search: string;
|
|
18
|
+
/** 폴더를 열거나 맨 위로 갈 때 함께 할 일 — 쪽을 첫 쪽으로 돌린다 */
|
|
19
|
+
onOpen?: () => void;
|
|
20
|
+
}): {
|
|
21
|
+
opened: string | null;
|
|
22
|
+
searching: boolean;
|
|
23
|
+
open: (path: string | null) => void;
|
|
24
|
+
reset: () => void;
|
|
25
|
+
followMove: (from: string, into: string | null) => void;
|
|
26
|
+
followRename: (from: string, to: string) => void;
|
|
27
|
+
newFolderParent: string | null;
|
|
28
|
+
/** 새 폴더가 설 자리에 이미 있는 이름들 — 같은 이름을 또 못 짓게 견준다 */
|
|
29
|
+
siblingNames: string[];
|
|
30
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { useCallback, useState } from 'react';
|
|
3
|
+
import { folderChildren, folderLeaf, folderMoved } from '../utils/folderPath';
|
|
4
|
+
/**
|
|
5
|
+
* **폴더로 보는 화면의 자리** — 지금 어느 폴더 안에 있나, 찾는 중인가, 새 폴더는 어디에 서나(말귀 청 (437) ㉮ — 말귀 앱에서 옮겨 왔다).
|
|
6
|
+
*
|
|
7
|
+
* 말귀의 나의 단어표 · 나의 단어훈련 · 나의 문장훈련이 이 규칙을 한 벌씩 들고 있다가 앱에서 한 벌로 모았고, 코어 `FolderHead` 식구로 옮겼다.
|
|
8
|
+
* 화면마다 같아야 하는 규칙이다:
|
|
9
|
+
*
|
|
10
|
+
* · **목록에 없는 폴더는 안 연 것으로 친다** — 들어가 있던 폴더를 지웠거나 보기(갈래)를 바꿔 그 폴더가 없으면 맨 위로 돌아온다.
|
|
11
|
+
* · **찾는 중에는 폴더를 가리지 않는다** — 그때 새 폴더는 맨 위에 선다(길이 안 보이는데 안 보이는 폴더 안에 만들면 안 된다).
|
|
12
|
+
* · 폴더를 열면 **첫 쪽으로** 돌아간다(`onOpen`) — 3쪽을 보다가 폴더에 들어가면 그 폴더의 3쪽(대개 빈 화면)이 선다.
|
|
13
|
+
* · 들어가 있던 폴더가 옮겨지거나 이름이 바뀌면 **그 새 길로 따라간다** — 안 따라가면 맨 위로 튕긴다.
|
|
14
|
+
* @public
|
|
15
|
+
*/
|
|
16
|
+
export function useFolderBrowse({ paths, search, onOpen }) {
|
|
17
|
+
const [pick, setPick] = useState(null);
|
|
18
|
+
const opened = pick && paths.includes(pick) ? pick : null;
|
|
19
|
+
const searching = search.trim() !== '';
|
|
20
|
+
const open = useCallback((path) => { setPick(path); onOpen?.(); }, [onOpen]);
|
|
21
|
+
/** 폴더 `from` 이 `into` 안으로 옮겨졌다 — 그 안에 들어가 있었으면 새 길로 따라간다 */
|
|
22
|
+
const followMove = useCallback((from, into) => {
|
|
23
|
+
setPick(now => folderMoved(now, from, into) ?? now);
|
|
24
|
+
}, []);
|
|
25
|
+
/** 폴더 `from` 의 길이 `to` 로 바뀌었다(이름 바꾸기) — 그 안에 들어가 있었으면 새 길로 따라간다 */
|
|
26
|
+
const followRename = useCallback((from, to) => {
|
|
27
|
+
setPick(now => (now === from ? to : now?.startsWith(`${from}/`) ? to + now.slice(from.length) : now));
|
|
28
|
+
}, []);
|
|
29
|
+
/** 맨 위로 — 보기(갈래)를 바꿀 때 */
|
|
30
|
+
const reset = useCallback(() => setPick(null), []);
|
|
31
|
+
/** 새 폴더가 설 자리 — 찾는 중에는 맨 위 */
|
|
32
|
+
const newFolderParent = searching ? null : opened;
|
|
33
|
+
return {
|
|
34
|
+
opened, searching, open, reset, followMove, followRename, newFolderParent,
|
|
35
|
+
/** 새 폴더가 설 자리에 이미 있는 이름들 — 같은 이름을 또 못 짓게 견준다 */
|
|
36
|
+
siblingNames: folderChildren(paths, newFolderParent).map(folderLeaf),
|
|
37
|
+
};
|
|
38
|
+
}
|
|
@@ -33,3 +33,5 @@ export type { UseAnchoredMenuOptions, UseAnchoredMenuResult } from './hooks/useA
|
|
|
33
33
|
export { useSoundCompassExam } from './hooks/useSoundCompassExam';
|
|
34
34
|
export type { SoundCompassMode, SoundCompassPhase, SoundCompassExam, UseSoundCompassExamOptions } from './hooks/useSoundCompassExam';
|
|
35
35
|
export { useInlineSvg } from './hooks/useInlineSvg';
|
|
36
|
+
export * from './hooks/useFolderBrowse';
|
|
37
|
+
export * from './hooks/useCardDragToGroup';
|
|
@@ -37,3 +37,6 @@ export { useAnchoredMenu } from './hooks/useAnchoredMenu';
|
|
|
37
37
|
export { useSoundCompassExam } from './hooks/useSoundCompassExam';
|
|
38
38
|
/* SVG 글자를 얻는다 — 속에 넣어 칠하려는 쪽이 쓴다(`BrandLogo` 의 `textColor`). */
|
|
39
39
|
export { useInlineSvg } from './hooks/useInlineSvg';
|
|
40
|
+
/* 폴더 화면(말귀 청 (437) ㉮, 2026-11-13) — 지금 연 폴더 · 카드를 끌어 폴더에 놓기 */
|
|
41
|
+
export * from './hooks/useFolderBrowse';
|
|
42
|
+
export * from './hooks/useCardDragToGroup';
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* **폴더 메뉴의 줄** — 길의 「이름 ▾」 와 폴더 칸의 ⋯ 가 여는 메뉴(말귀 청 (437) ㉮ — 말귀 앱에서 옮겨 왔다, 2026-11-13).
|
|
3
|
+
*
|
|
4
|
+
* 화면마다 차례와 아이콘이 갈리면 안 되는 자리다: **더하기 → 폴더 추가 → (이름 바꾸기) → 폴더 삭제**. 구분선은 없고, 줄을 고르면 닫힌다.
|
|
5
|
+
* 이름표는 부르는 쪽이 준다(무엇을 '더하는지' 는 화면마다 다르다 — 단어표 · 훈련 …).
|
|
6
|
+
* · 맨 위의 메뉴는 `rename` · `remove` 를 안 준다(지울 폴더가 없다).
|
|
7
|
+
* · 이름 바꾸기는 그 일이 있는 화면만 준다.
|
|
8
|
+
* 돌려준 줄은 `FolderHead` 의 `folderMenu` · `rootMenu`, `FolderGrid` 의 `menuItems` 에 그대로 넘긴다.
|
|
9
|
+
*/
|
|
10
|
+
/** @public 메뉴 한 줄 — 이름표와 할 일 */
|
|
11
|
+
export interface FolderMenuLine {
|
|
12
|
+
label: string;
|
|
13
|
+
onClick: () => void;
|
|
14
|
+
}
|
|
15
|
+
/** @public 폴더 메뉴의 줄을 정해진 차례 · 아이콘으로 짓는다 */
|
|
16
|
+
export declare function folderMenuItems(lines: {
|
|
17
|
+
/** 이 자리에 하나 더 만든다(무엇을 만드는지는 화면 몫) */
|
|
18
|
+
add: FolderMenuLine;
|
|
19
|
+
addFolder: FolderMenuLine;
|
|
20
|
+
rename?: FolderMenuLine;
|
|
21
|
+
remove?: FolderMenuLine;
|
|
22
|
+
}): {
|
|
23
|
+
label: string;
|
|
24
|
+
icon: string;
|
|
25
|
+
onClick: () => void;
|
|
26
|
+
closeOnSelect: true;
|
|
27
|
+
}[];
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* **폴더 메뉴의 줄** — 길의 「이름 ▾」 와 폴더 칸의 ⋯ 가 여는 메뉴(말귀 청 (437) ㉮ — 말귀 앱에서 옮겨 왔다, 2026-11-13).
|
|
3
|
+
*
|
|
4
|
+
* 화면마다 차례와 아이콘이 갈리면 안 되는 자리다: **더하기 → 폴더 추가 → (이름 바꾸기) → 폴더 삭제**. 구분선은 없고, 줄을 고르면 닫힌다.
|
|
5
|
+
* 이름표는 부르는 쪽이 준다(무엇을 '더하는지' 는 화면마다 다르다 — 단어표 · 훈련 …).
|
|
6
|
+
* · 맨 위의 메뉴는 `rename` · `remove` 를 안 준다(지울 폴더가 없다).
|
|
7
|
+
* · 이름 바꾸기는 그 일이 있는 화면만 준다.
|
|
8
|
+
* 돌려준 줄은 `FolderHead` 의 `folderMenu` · `rootMenu`, `FolderGrid` 의 `menuItems` 에 그대로 넘긴다.
|
|
9
|
+
*/
|
|
10
|
+
/** @public 폴더 메뉴의 줄을 정해진 차례 · 아이콘으로 짓는다 */
|
|
11
|
+
export function folderMenuItems(lines) {
|
|
12
|
+
const row = (line, icon) => ({ ...line, icon, closeOnSelect: true });
|
|
13
|
+
return [
|
|
14
|
+
row(lines.add, 'plus'),
|
|
15
|
+
row(lines.addFolder, 'folder-plus'),
|
|
16
|
+
...(lines.rename ? [row(lines.rename, 'edit-2')] : []),
|
|
17
|
+
...(lines.remove ? [row(lines.remove, 'trash-2')] : []),
|
|
18
|
+
];
|
|
19
|
+
}
|