@ihabdevteam/core 0.442.0 → 0.444.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 +38 -0
- package/dist/components.cjs.js +195 -190
- package/dist/components.esm.css +2 -2
- package/dist/hooks.cjs.js +5 -5
- package/dist/i18n.cjs.js +3 -3
- package/dist/ihabdevteam-core.cjs.js +191 -186
- package/dist/ihabdevteam-core.d.ts +346 -1
- package/dist/packages/core/src/components/DatePicker.css +8 -0
- package/dist/packages/core/src/components/DatePicker.js +13 -1
- package/dist/packages/core/src/components/ErrorBoundary.d.ts +55 -0
- package/dist/packages/core/src/components/ErrorBoundary.js +52 -0
- package/dist/packages/core/src/components/FolderAddPopup.d.ts +25 -0
- package/dist/packages/core/src/components/FolderAddPopup.js +21 -0
- package/dist/packages/core/src/components/FolderList.css +18 -0
- package/dist/packages/core/src/components/FolderList.d.ts +28 -0
- package/dist/packages/core/src/components/FolderList.js +23 -0
- package/dist/packages/core/src/components/KeepScreenAwake.d.ts +9 -0
- package/dist/packages/core/src/components/KeepScreenAwake.js +12 -0
- package/dist/packages/core/src/components/MarkIcon.css +12 -0
- package/dist/packages/core/src/components/MarkIcon.d.ts +20 -0
- package/dist/packages/core/src/components/MarkIcon.js +18 -0
- package/dist/packages/core/src/components/PagePopup.d.ts +52 -0
- package/dist/packages/core/src/components/PagePopup.js +77 -0
- package/dist/packages/core/src/components/Popup/Popup.css +14 -0
- package/dist/packages/core/src/components/Popup/Popup.d.ts +9 -0
- package/dist/packages/core/src/components/Popup/Popup.js +23 -4
- package/dist/packages/core/src/components/ScoreMarkCounts.css +9 -0
- package/dist/packages/core/src/components/ScoreMarkCounts.d.ts +19 -0
- package/dist/packages/core/src/components/ScoreMarkCounts.js +16 -0
- package/dist/packages/core/src/components/TextField.css +20 -0
- package/dist/packages/core/src/components/TextField.d.ts +17 -0
- package/dist/packages/core/src/components/TextField.js +19 -4
- package/dist/packages/core/src/components/Training/TrainingBlockGrid.js +25 -1
- package/dist/packages/core/src/components.d.ts +14 -0
- package/dist/packages/core/src/components.js +9 -0
- package/dist/packages/core/src/hooks/useBackClosable.d.ts +8 -0
- package/dist/packages/core/src/hooks/useBackClosable.js +97 -0
- package/dist/packages/core/src/hooks/useClosingDelay.d.ts +12 -0
- package/dist/packages/core/src/hooks/useClosingDelay.js +30 -0
- package/dist/packages/core/src/hooks/useOnline.d.ts +9 -0
- package/dist/packages/core/src/hooks/useOnline.js +23 -0
- package/dist/packages/core/src/hooks/useOutsideClose.d.ts +11 -0
- package/dist/packages/core/src/hooks/useOutsideClose.js +23 -0
- package/dist/packages/core/src/hooks/useSaveOnHide.d.ts +14 -0
- package/dist/packages/core/src/hooks/useSaveOnHide.js +32 -0
- package/dist/packages/core/src/hooks/useScreenWakeLock.d.ts +12 -0
- package/dist/packages/core/src/hooks/useScreenWakeLock.js +53 -0
- package/dist/packages/core/src/hooks.d.ts +6 -0
- package/dist/packages/core/src/hooks.js +7 -0
- package/dist/packages/core/src/i18n/locales/en.json +10 -3
- package/dist/packages/core/src/i18n/locales/ko.json +10 -3
- package/dist/packages/core/src/utils/jamoSpeech.d.ts +19 -0
- package/dist/packages/core/src/utils/jamoSpeech.js +53 -0
- package/dist/packages/core/src/utils/kstDateTime.d.ts +21 -0
- package/dist/packages/core/src/utils/kstDateTime.js +38 -0
- package/dist/packages/core/src/utils/lucideIconSet.js +2 -0
- package/dist/packages/core/src/utils/popupTiming.d.ts +7 -0
- package/dist/packages/core/src/utils/popupTiming.js +7 -0
- package/dist/packages/core/src/utils/wordTrainingGenerators.d.ts +1 -6
- package/dist/packages/core/src/utils/wordTrainingGenerators.js +3 -45
- 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 +171 -166
- package/package.json +1 -1
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { useTranslation } from 'react-i18next';
|
|
4
|
+
import ConfirmPopup from './Popup/ConfirmPopup';
|
|
5
|
+
import TextField from './TextField';
|
|
6
|
+
/**
|
|
7
|
+
* **폴더 추가 창**(말귀 청 (438) ㉴ — 말귀 앱에서 옮겨 왔다, 2026-11-14). `FolderHead` · `FolderGrid` · `FolderList` 와 한 벌이다.
|
|
8
|
+
*
|
|
9
|
+
* 작은 확인 창, 제목 아래 부제, 이름표 없는 입력칸 하나, 취소 · 추가.
|
|
10
|
+
* · **못 만들 이름이면 「추가」 가 꺼진다**(`canAdd`).
|
|
11
|
+
* · **닫는 길을 넘겨준다**(`onAdd(close)`) — 되면 그때 닫는다. 이름이 틀렸을 때 열린 채로 남아야 고쳐 넣는다.
|
|
12
|
+
* · **한글을 조합하는 중의 Enter 로는 안 만든다** — 조합 확정 Enter 는 `TextField.onEnter` 가 가린다.
|
|
13
|
+
* · 글 넷은 코어 사전(`folder.add.*` · `common.add`)이다.
|
|
14
|
+
* @public
|
|
15
|
+
*/
|
|
16
|
+
export default function FolderAddPopup({ value, onChange, canAdd, error, onAdd, onClose, maxLength }) {
|
|
17
|
+
const { t } = useTranslation();
|
|
18
|
+
const placeholder = t('folder.add.placeholder', '폴더 이름');
|
|
19
|
+
return (_jsx(ConfirmPopup, { title: t('folder.add.title', '폴더 추가'), subtitle: t('folder.add.sub', '새 폴더 이름을 입력하세요.'), confirmLabel: t('common.add', '추가'), confirmDisabled: !canAdd, closeOnConfirm: false, onConfirm: close => onAdd(close), onClose: onClose, children: _jsx(TextField, { autoFocus: true, value: value, onChange: onChange, placeholder: placeholder, ariaLabel: placeholder, maxLength: maxLength, size: 48, fullWidth: true, error: error, onEnter: () => { if (canAdd)
|
|
20
|
+
onAdd(onClose); } }) }));
|
|
21
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/* **폴더로 볼 때 지금 자리의 목록**(말귀 청 (438) ㉴) — 말귀 앱의 `training-folder-list` 를 그대로 옮겼다.
|
|
2
|
+
카드는 제 폭(360 · 작은 것 120)을 쥐고 있어 드는 만큼 나란히 선다. 한 줄의 카드는 키를 맞춘다. */
|
|
3
|
+
.folder-list {
|
|
4
|
+
display: flex;
|
|
5
|
+
flex-wrap: wrap;
|
|
6
|
+
align-items: stretch;
|
|
7
|
+
gap: var(--spacing-s);
|
|
8
|
+
border-radius: var(--radius-m);
|
|
9
|
+
}
|
|
10
|
+
/* 카드가 자리보다 넓으면 줄어들 수 있게(폰) — 안 주면 360 이 버틴다 */
|
|
11
|
+
.folder-list > * { min-width: 0; }
|
|
12
|
+
.folder-list--over { box-shadow: 0 0 0 2px var(--color-main-a10); }
|
|
13
|
+
.folder-list__empty {
|
|
14
|
+
margin: 0;
|
|
15
|
+
padding: var(--spacing-xl) var(--spacing-m);
|
|
16
|
+
text-align: center;
|
|
17
|
+
color: var(--color-gray);
|
|
18
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { HTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
import './FolderList.css';
|
|
3
|
+
/** @public */
|
|
4
|
+
export interface FolderListProps<T> {
|
|
5
|
+
/** 그릴 줄 — **이미 세운 차례대로** 준다. 정렬은 부르는 쪽이 한다(정렬 열쇠는 화면마다 다르다) */
|
|
6
|
+
rows: T[];
|
|
7
|
+
/** 줄 하나를 그린다 — 두 번째 인자는 그 줄의 자리(0부터) */
|
|
8
|
+
rowRender: (row: T, slot: number) => ReactNode;
|
|
9
|
+
/** 비었을 때의 말 — 안 주면 비었을 때 아무것도 안 선다(맨 위처럼 폴더만 서면 되는 자리) */
|
|
10
|
+
emptySpeech?: string;
|
|
11
|
+
/** 끌어다 놓는 손(`useCardDragToGroup` 의 받는 쪽 등) — 목록 칸(비었으면 빈 말)에 그대로 얹는다 */
|
|
12
|
+
dropProps?: HTMLAttributes<HTMLElement> | Record<string, unknown>;
|
|
13
|
+
/** 끈 것이 이 위에 있다 — 테두리 빛을 켠다 */
|
|
14
|
+
dropOver?: boolean;
|
|
15
|
+
className?: string;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* **폴더로 볼 때 지금 자리의 목록**(말귀 청 (438) ㉴ — 말귀 앱에서 옮겨 왔다, 2026-11-14).
|
|
19
|
+
*
|
|
20
|
+
* 맨 위면 그룹 없는 것, 폴더 안이면 그 폴더의 카드가 쪽 바탕에 바로 선다. 카드는 제 폭을 쥐고 있어 드는 만큼
|
|
21
|
+
* 나란히 서고, 한 줄의 카드는 키를 맞춘다. **끌어다 놓는 자리는 남는다** — 맨 위의 목록은 '그룹 없음' 으로
|
|
22
|
+
* 되돌리는 자리다. `FolderHead` · `FolderGrid` 와 한 벌이다.
|
|
23
|
+
*
|
|
24
|
+
* 앱 사본과 다른 것 하나: **정렬을 안 한다.** 앱 사본은 앱의 정렬 셈을 불렀다 — 세운 줄을 받으면 앱에 기대는
|
|
25
|
+
* 것이 없다.
|
|
26
|
+
* @public
|
|
27
|
+
*/
|
|
28
|
+
export default function FolderList<T>({ rows, rowRender, emptySpeech, dropProps, dropOver, className }: FolderListProps<T>): import("react").JSX.Element | null;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { cx } from '../utils/cx';
|
|
4
|
+
import './FolderList.css';
|
|
5
|
+
/**
|
|
6
|
+
* **폴더로 볼 때 지금 자리의 목록**(말귀 청 (438) ㉴ — 말귀 앱에서 옮겨 왔다, 2026-11-14).
|
|
7
|
+
*
|
|
8
|
+
* 맨 위면 그룹 없는 것, 폴더 안이면 그 폴더의 카드가 쪽 바탕에 바로 선다. 카드는 제 폭을 쥐고 있어 드는 만큼
|
|
9
|
+
* 나란히 서고, 한 줄의 카드는 키를 맞춘다. **끌어다 놓는 자리는 남는다** — 맨 위의 목록은 '그룹 없음' 으로
|
|
10
|
+
* 되돌리는 자리다. `FolderHead` · `FolderGrid` 와 한 벌이다.
|
|
11
|
+
*
|
|
12
|
+
* 앱 사본과 다른 것 하나: **정렬을 안 한다.** 앱 사본은 앱의 정렬 셈을 불렀다 — 세운 줄을 받으면 앱에 기대는
|
|
13
|
+
* 것이 없다.
|
|
14
|
+
* @public
|
|
15
|
+
*/
|
|
16
|
+
export default function FolderList({ rows, rowRender, emptySpeech, dropProps, dropOver = false, className }) {
|
|
17
|
+
if (rows.length === 0) {
|
|
18
|
+
return emptySpeech
|
|
19
|
+
? _jsx("p", { className: cx('folder-list__empty body-3', className), ...dropProps, children: emptySpeech })
|
|
20
|
+
: null;
|
|
21
|
+
}
|
|
22
|
+
return (_jsx("div", { className: cx('folder-list', dropOver && 'folder-list--over', className), ...dropProps, children: rows.map((row, i) => rowRender(row, i)) }));
|
|
23
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* **감싼 것이 떠 있는 동안 폰 화면이 꺼지지 않게 한다** — 자리를 차지하지 않는다(말귀 청 (437) ㉲).
|
|
4
|
+
* 훈련 창을 띄우는 길목을 이것으로 감싼다. 켜고 끄는 조건이 따로 있으면 `useScreenWakeLock(active)` 를 바로 쓴다.
|
|
5
|
+
* @public
|
|
6
|
+
*/
|
|
7
|
+
export default function KeepScreenAwake({ children }: {
|
|
8
|
+
children: ReactNode;
|
|
9
|
+
}): import("react").JSX.Element;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { useScreenWakeLock } from '../hooks/useScreenWakeLock';
|
|
4
|
+
/**
|
|
5
|
+
* **감싼 것이 떠 있는 동안 폰 화면이 꺼지지 않게 한다** — 자리를 차지하지 않는다(말귀 청 (437) ㉲).
|
|
6
|
+
* 훈련 창을 띄우는 길목을 이것으로 감싼다. 켜고 끄는 조건이 따로 있으면 `useScreenWakeLock(active)` 를 바로 쓴다.
|
|
7
|
+
* @public
|
|
8
|
+
*/
|
|
9
|
+
export default function KeepScreenAwake({ children }) {
|
|
10
|
+
useScreenWakeLock(true);
|
|
11
|
+
return _jsx(_Fragment, { children: children });
|
|
12
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/* 평가 표시 — 원은 `CircleBadge` 가 그린다. 여기서 더하는 것은 **색 하나**뿐이다(말귀 청 (437) ㉱).
|
|
2
|
+
클래스는 단어표의 `MARK_VARIANT` 값(main · warn · danger)이다 — 표의 색과 같은 이름 · 같은 토큰. */
|
|
3
|
+
.mark-icon {
|
|
4
|
+
display: inline-flex;
|
|
5
|
+
flex: 0 0 auto;
|
|
6
|
+
vertical-align: middle;
|
|
7
|
+
}
|
|
8
|
+
.mark-icon__badge--main { background: var(--color-main); }
|
|
9
|
+
.mark-icon__badge--warn { background: var(--color-warn); }
|
|
10
|
+
.mark-icon__badge--danger { background: var(--color-error); }
|
|
11
|
+
/* 그림을 원의 정가운데로 — `Icon` 의 감싸개는 글줄 상자라 줄 높이만큼 위로 떴다(실측 0.75px) */
|
|
12
|
+
.mark-icon__badge .iconRenderer-icon { display: flex; }
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { type ScoreMark } from './Word/wordTableScoring';
|
|
2
|
+
import './MarkIcon.css';
|
|
3
|
+
/** @public */
|
|
4
|
+
export interface MarkIconProps {
|
|
5
|
+
mark: ScoreMark;
|
|
6
|
+
/**
|
|
7
|
+
* 낭독기에 읽힐 이름. **빈 글자면 그림으로만 두고 숨긴다** — 곁에서 같은 것을 이미 말하고 있는 자리가 있다
|
|
8
|
+
* (채점 창 바닥의 셈은 `role="status"` 한 줄이 통째로 읽는다). 이름 없는 `role="img"` 는 '그림' 이라고만 들린다.
|
|
9
|
+
*/
|
|
10
|
+
label: string;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* **평가 표시(○ △ ✕) — 단어표 칸에 찍히는 그 그림 그대로**(말귀 청 (437) ㉱ — 말귀 앱에서 옮겨 왔다, 2026-11-13).
|
|
14
|
+
*
|
|
15
|
+
* 원은 `CircleBadge`, 그림은 단어표가 쓰는 `MARK_ICON`, **색은 단어표의 `MARK_VARIANT` 를 그대로 따른다** — 앱 사본은 CSS 에
|
|
16
|
+
* 색 셋(○ main · △ warn · ✕ error)을 다시 적고 있어 표의 색이 바뀌면 갈릴 수 있었다. 여기서는 클래스가 `MARK_VARIANT` 의
|
|
17
|
+
* 값으로 정해지므로 표와 늘 같다. **모양과 색 둘 다로 가른다** — 색만으로 가르면 색을 잘 못 가리는 사람에게 셋이 같아진다.
|
|
18
|
+
* @public
|
|
19
|
+
*/
|
|
20
|
+
export default function MarkIcon({ mark, label }: MarkIconProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import CircleBadge from './CircleBadge';
|
|
4
|
+
import Icon from './Icon';
|
|
5
|
+
import { MARK_ICON, MARK_VARIANT } from './Word/wordTableScoring';
|
|
6
|
+
import './MarkIcon.css';
|
|
7
|
+
/**
|
|
8
|
+
* **평가 표시(○ △ ✕) — 단어표 칸에 찍히는 그 그림 그대로**(말귀 청 (437) ㉱ — 말귀 앱에서 옮겨 왔다, 2026-11-13).
|
|
9
|
+
*
|
|
10
|
+
* 원은 `CircleBadge`, 그림은 단어표가 쓰는 `MARK_ICON`, **색은 단어표의 `MARK_VARIANT` 를 그대로 따른다** — 앱 사본은 CSS 에
|
|
11
|
+
* 색 셋(○ main · △ warn · ✕ error)을 다시 적고 있어 표의 색이 바뀌면 갈릴 수 있었다. 여기서는 클래스가 `MARK_VARIANT` 의
|
|
12
|
+
* 값으로 정해지므로 표와 늘 같다. **모양과 색 둘 다로 가른다** — 색만으로 가르면 색을 잘 못 가리는 사람에게 셋이 같아진다.
|
|
13
|
+
* @public
|
|
14
|
+
*/
|
|
15
|
+
export default function MarkIcon({ mark, label }) {
|
|
16
|
+
const readable = label ? { role: 'img', 'aria-label': label } : { 'aria-hidden': true };
|
|
17
|
+
return (_jsx("span", { className: "mark-icon", ...readable, children: _jsx(CircleBadge, { size: 24, position: "inline", className: `mark-icon__badge mark-icon__badge--${MARK_VARIANT[mark]}`, children: _jsx(Icon, { icon: MARK_ICON[mark], size: 14 }) }) }));
|
|
18
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import './Training/TrainingPagePopup.css';
|
|
3
|
+
/** @public */
|
|
4
|
+
export interface PagePopupProps {
|
|
5
|
+
children?: ReactNode;
|
|
6
|
+
/** 위에 붙는 자리(제목 · 뒤로 단추 등) */
|
|
7
|
+
top?: ReactNode;
|
|
8
|
+
/** 아래에 붙는 자리(단추 · 걸음 표시 등) */
|
|
9
|
+
bottom?: ReactNode;
|
|
10
|
+
/** 본문 세로 맞춤 — `top`(기본, 위부터) · `center`(짧으면 가운데) */
|
|
11
|
+
mode?: 'top' | 'center';
|
|
12
|
+
/** 속 통의 폭 · 여백 제약을 푼다 — 안에 넣는 화면이 제 폭과 여백을 그대로 쓰는 쓰임(표 한 판을 꽉 채우는 창) */
|
|
13
|
+
contentFull?: boolean;
|
|
14
|
+
/** 닫히는 중 — `usePagePopupClose` 의 `closing` 을 넘긴다 */
|
|
15
|
+
closing?: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* 닫는 손 — 주면 **폰 '뒤로' 가 이 창을 닫는다**(말귀 청 (438) ㉯, 2026-11-14). 보통 `usePagePopupClose` 의
|
|
18
|
+
* `handleClose` 를 넘긴다. 이 껍데기는 닫기 단추를 그리지 않으므로(단추는 `top` 에 부르는 쪽이 넣는다) 뒤로에만 쓴다.
|
|
19
|
+
*/
|
|
20
|
+
onClose?: () => void;
|
|
21
|
+
/** 뒤로로 닫기 — 기본 true. `onClose` 가 있을 때만 건다. 길(route)로 띄운 창은 끈다. */
|
|
22
|
+
backClosable?: boolean;
|
|
23
|
+
/** 뒤로가 왔을 때 먼저 묻는다 — `false` 면 안 닫고 그대로 둔다(고치다 만 것을 확인 창으로 묻는 자리). `Popup` 과 같다. */
|
|
24
|
+
beforeClose?: () => boolean;
|
|
25
|
+
className?: string;
|
|
26
|
+
'aria-label'?: string;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* **훈련이 아닌 전체 화면 창의 껍데기**(말귀 청 (437) ㉰ — 말귀 앱에서 옮겨 왔다, 2026-11-13).
|
|
30
|
+
*
|
|
31
|
+
* 생김새는 `TrainingPagePopup` 과 같은 `page-popup` 이고, 걸음 넘기기 · 소음 · 결과는 없다 — 단어표 채점 창처럼 화면을 덮는
|
|
32
|
+
* 아무 창이나 담는다. 자리 셋(`top` · 본문 · `bottom`)만 쥐고 내용은 부르는 쪽이 넣는다. 닫힘은 `usePagePopupClose` 와 짝이다.
|
|
33
|
+
*
|
|
34
|
+
* · **열 때 판 안으로 초점을 옮기고, 닫힐 때 부른 자리로 되돌린다.** 부른 자리는 효과가 아니라 **그리는 중**에 적는다 —
|
|
35
|
+
* 자식의 `autoFocus` 는 커밋 중에 걸려, 효과에서 읽으면 부른 사람이 아니라 그 자식이 적힌다.
|
|
36
|
+
* · Tab 은 판 안을 돈다(`useFocusTrap`).
|
|
37
|
+
* @public
|
|
38
|
+
*/
|
|
39
|
+
export default function PagePopup({ children, top, bottom, mode, contentFull, closing, onClose, backClosable, beforeClose, className, 'aria-label': ariaLabel }: PagePopupProps): import("react").JSX.Element;
|
|
40
|
+
/**
|
|
41
|
+
* **전체 화면 창이 사라지는 동안의 뒷일** — `PagePopup` 의 짝(말귀 청 (437) ㉰).
|
|
42
|
+
*
|
|
43
|
+
* · **한 번만 닫힌다** — ESC · 닫기 단추 · 안쪽 '완료' 가 잇달아 들어와도 첫 번째만 먹는다(타이머가 여럿 걸려 `onClose` 가 두 번 불리지 않게).
|
|
44
|
+
* · **다 사라진 뒤에 떼어 낸다** — `closing` 을 켜고 `PAGE_POPUP_CLOSE_MS` 기다렸다가 `onClose`. **움직임 줄이기면 0** 이다.
|
|
45
|
+
* · **`onClose` 가 던지면 풀린다** — 안 풀면 닫기 가드가 걸린 채 남아 다시는 못 닫는다(`TrainingPagePopup` 과 같은 고침 — 앱 사본엔 둘 다 없었다).
|
|
46
|
+
* · 떠 있는 동안 뒤 화면 스크롤을 잠근다. 화면을 떠나면 타이머를 끈다.
|
|
47
|
+
* @public
|
|
48
|
+
*/
|
|
49
|
+
export declare function usePagePopupClose(onClose: () => void): {
|
|
50
|
+
closing: boolean;
|
|
51
|
+
handleClose: () => void;
|
|
52
|
+
};
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useCallback, useEffect, useRef, useState } from 'react';
|
|
4
|
+
import { cx } from '../utils/cx';
|
|
5
|
+
import { useFocusTrap, FOCUSABLE_SELECTOR } from '../hooks/useFocusTrap';
|
|
6
|
+
import { lockBodyScrollWithPadding } from '../hooks/bodyScrollLock';
|
|
7
|
+
import { prefersReducedMotion } from '../hooks/usePrefersReducedMotion';
|
|
8
|
+
import { useBackClosable } from '../hooks/useBackClosable';
|
|
9
|
+
import { PAGE_POPUP_CLOSE_MS } from './Training/pagePopupTiming';
|
|
10
|
+
import './Training/TrainingPagePopup.css';
|
|
11
|
+
/**
|
|
12
|
+
* **훈련이 아닌 전체 화면 창의 껍데기**(말귀 청 (437) ㉰ — 말귀 앱에서 옮겨 왔다, 2026-11-13).
|
|
13
|
+
*
|
|
14
|
+
* 생김새는 `TrainingPagePopup` 과 같은 `page-popup` 이고, 걸음 넘기기 · 소음 · 결과는 없다 — 단어표 채점 창처럼 화면을 덮는
|
|
15
|
+
* 아무 창이나 담는다. 자리 셋(`top` · 본문 · `bottom`)만 쥐고 내용은 부르는 쪽이 넣는다. 닫힘은 `usePagePopupClose` 와 짝이다.
|
|
16
|
+
*
|
|
17
|
+
* · **열 때 판 안으로 초점을 옮기고, 닫힐 때 부른 자리로 되돌린다.** 부른 자리는 효과가 아니라 **그리는 중**에 적는다 —
|
|
18
|
+
* 자식의 `autoFocus` 는 커밋 중에 걸려, 효과에서 읽으면 부른 사람이 아니라 그 자식이 적힌다.
|
|
19
|
+
* · Tab 은 판 안을 돈다(`useFocusTrap`).
|
|
20
|
+
* @public
|
|
21
|
+
*/
|
|
22
|
+
export default function PagePopup({ children, top, bottom, mode = 'top', contentFull = false, closing = false, onClose, backClosable = true, beforeClose, className, 'aria-label': ariaLabel }) {
|
|
23
|
+
useBackClosable(!!onClose && backClosable && !closing, () => {
|
|
24
|
+
if (beforeClose && beforeClose() === false)
|
|
25
|
+
return false;
|
|
26
|
+
onClose?.();
|
|
27
|
+
});
|
|
28
|
+
const panelRef = useRef(null);
|
|
29
|
+
const previouslyFocusedRef = useRef(typeof document === 'undefined' ? null : document.activeElement);
|
|
30
|
+
useEffect(() => {
|
|
31
|
+
const previouslyFocused = previouslyFocusedRef.current;
|
|
32
|
+
const panel = panelRef.current;
|
|
33
|
+
if (panel && !panel.contains(document.activeElement)) {
|
|
34
|
+
const first = panel.querySelector(FOCUSABLE_SELECTOR);
|
|
35
|
+
(first ?? panel).focus();
|
|
36
|
+
}
|
|
37
|
+
return () => { previouslyFocused?.focus?.(); };
|
|
38
|
+
}, []);
|
|
39
|
+
useFocusTrap(panelRef);
|
|
40
|
+
return (_jsx("div", { className: cx('page-popup', closing && 'page-popup--closing', className), role: "dialog", "aria-modal": "true", "aria-label": ariaLabel, children: _jsxs("div", { className: "page-popup__panel", ref: panelRef, tabIndex: -1, children: [top && _jsx("div", { className: "page-popup__top", children: top }), _jsx("div", { className: "page-popup__scroll", children: _jsx("div", { className: cx('page-popup__content', mode === 'center' ? 'page-popup__content--center' : 'page-popup__content--top', contentFull && 'page-popup__content--full'), children: children }) }), bottom && _jsx("div", { className: "page-popup__bottom", children: bottom })] }) }));
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* **전체 화면 창이 사라지는 동안의 뒷일** — `PagePopup` 의 짝(말귀 청 (437) ㉰).
|
|
44
|
+
*
|
|
45
|
+
* · **한 번만 닫힌다** — ESC · 닫기 단추 · 안쪽 '완료' 가 잇달아 들어와도 첫 번째만 먹는다(타이머가 여럿 걸려 `onClose` 가 두 번 불리지 않게).
|
|
46
|
+
* · **다 사라진 뒤에 떼어 낸다** — `closing` 을 켜고 `PAGE_POPUP_CLOSE_MS` 기다렸다가 `onClose`. **움직임 줄이기면 0** 이다.
|
|
47
|
+
* · **`onClose` 가 던지면 풀린다** — 안 풀면 닫기 가드가 걸린 채 남아 다시는 못 닫는다(`TrainingPagePopup` 과 같은 고침 — 앱 사본엔 둘 다 없었다).
|
|
48
|
+
* · 떠 있는 동안 뒤 화면 스크롤을 잠근다. 화면을 떠나면 타이머를 끈다.
|
|
49
|
+
* @public
|
|
50
|
+
*/
|
|
51
|
+
export function usePagePopupClose(onClose) {
|
|
52
|
+
const [closing, setClosing] = useState(false);
|
|
53
|
+
const closingRef = useRef(false);
|
|
54
|
+
const timerRef = useRef(null);
|
|
55
|
+
const handleClose = useCallback(() => {
|
|
56
|
+
if (closingRef.current)
|
|
57
|
+
return;
|
|
58
|
+
closingRef.current = true;
|
|
59
|
+
setClosing(true);
|
|
60
|
+
timerRef.current = setTimeout(() => {
|
|
61
|
+
timerRef.current = null;
|
|
62
|
+
/* 던지면 가드를 풀고 남긴다 — `TrainingPagePopup` 의 scheduleClose 와 같다(다시 던지면 타이머 밖이라 아무도 못 잡는다) */
|
|
63
|
+
try {
|
|
64
|
+
onClose();
|
|
65
|
+
}
|
|
66
|
+
catch (e) {
|
|
67
|
+
closingRef.current = false;
|
|
68
|
+
setClosing(false);
|
|
69
|
+
console.error(e);
|
|
70
|
+
}
|
|
71
|
+
}, prefersReducedMotion() ? 0 : PAGE_POPUP_CLOSE_MS);
|
|
72
|
+
}, [onClose]);
|
|
73
|
+
useEffect(() => lockBodyScrollWithPadding(), []);
|
|
74
|
+
useEffect(() => () => { if (timerRef.current)
|
|
75
|
+
clearTimeout(timerRef.current); }, []);
|
|
76
|
+
return { closing, handleClose };
|
|
77
|
+
}
|
|
@@ -285,3 +285,17 @@
|
|
|
285
285
|
margin-bottom: 20px;
|
|
286
286
|
}
|
|
287
287
|
.confirm-popup__top > * { max-width: 100%; }
|
|
288
|
+
|
|
289
|
+
/* ── 닫기(✕)의 닿는 자리는 44×44(말귀 청 (438) ㉱, 2026-11-14) ──
|
|
290
|
+
보이는 단추는 40 그대로 두고, 손가락이 닿는 자리만 둘레로 넓힌다(WCAG 2.5.5 · Apple HIG 44pt).
|
|
291
|
+
단추 밖에 서는 투명한 덧자리라 생김새와 자리 셈은 안 바뀐다. */
|
|
292
|
+
.popup-close-btn { position: relative; }
|
|
293
|
+
.popup-close-btn::after {
|
|
294
|
+
content: '';
|
|
295
|
+
position: absolute;
|
|
296
|
+
left: 50%;
|
|
297
|
+
top: 50%;
|
|
298
|
+
width: 44px;
|
|
299
|
+
height: 44px;
|
|
300
|
+
transform: translate(-50%, -50%);
|
|
301
|
+
}
|
|
@@ -125,6 +125,15 @@ export interface PopupProps {
|
|
|
125
125
|
* 바깥을 잘못 눌러 입력이 날아가면 안 되는 창은 `beforeClose` 로 묻거나 이것을 끈다.
|
|
126
126
|
*/
|
|
127
127
|
closeOnBackdrop?: boolean;
|
|
128
|
+
/**
|
|
129
|
+
* **폰 '뒤로' 로 닫는다.** 기본 true(말귀 청 (438) ㉯, 2026-11-14).
|
|
130
|
+
*
|
|
131
|
+
* 열릴 때 역사 칸 하나를 쌓고, 뒤로가 오면 **맨 위 창 하나만** 닫는다(`useBackClosable`). 닫기는
|
|
132
|
+
* X · ESC 와 같은 길이라 `closeDisabled` · `beforeClose` 가 막으면 안 닫히고 칸이 도로 쌓인다.
|
|
133
|
+
* ESC 와 같은 조건(`inline` 이 아니고 `onClose` 가 있을 때)에서만 건다. 길(route)로 띄운 창처럼
|
|
134
|
+
* 뒤로가 이미 제 뜻을 갖는 자리는 끈다.
|
|
135
|
+
*/
|
|
136
|
+
backClosable?: boolean;
|
|
128
137
|
className?: string;
|
|
129
138
|
/**
|
|
130
139
|
* 다이얼로그 접근명 — 제목을 그리지 않는 팝업(`title` 이 없거나 useTitle=false)에서 쓴다.
|
|
@@ -6,17 +6,19 @@ import { useTranslation } from "react-i18next";
|
|
|
6
6
|
import Button from "../Button";
|
|
7
7
|
import SegmentedControl from "../SegmentedControl";
|
|
8
8
|
import { pushEsc } from "../../hooks/escStack";
|
|
9
|
+
import { useBackClosable } from "../../hooks/useBackClosable";
|
|
9
10
|
import { lockBodyScroll } from "../../hooks/bodyScrollLock";
|
|
10
11
|
import "./Popup.css";
|
|
11
12
|
import { useFocusTrap, FOCUSABLE_SELECTOR } from '../../hooks/useFocusTrap';
|
|
12
13
|
import { rememberFocusReturn, resolveFocusReturn } from '../../hooks/focusReturn';
|
|
13
14
|
import { usePrefersReducedMotion } from '../../hooks/usePrefersReducedMotion';
|
|
14
|
-
|
|
15
|
+
import { POPUP_CLOSE_MS } from '../../utils/popupTiming';
|
|
16
|
+
const ANIM_MS = POPUP_CLOSE_MS; // 닫힘 시간은 한 곳(popupTiming.ts) — 앱도 그 수를 받아 쓴다(청 (437) ㉳ⓑ)
|
|
15
17
|
// 패널 안에서 Tab 순환 대상으로 삼을 요소들 — disabled/tabindex="-1"은 제외.
|
|
16
18
|
/** @public */
|
|
17
19
|
export default function Popup(props) {
|
|
18
20
|
const { t } = useTranslation();
|
|
19
|
-
const { title, subtitle, headerActions, headerSegment, children, buttons, footer, footerStart, footerEnd, footerNote, footerNoteDivider = false, footerClassName = "", footerLayout = 'center', onClose, closeDisabled = false, beforeClose, closeOnBackdrop = true, className = "", ariaLabel, useTitle = true, inline = false, size, layer = 'modal', height, fillBody = false, resetScrollKey } = props || {};
|
|
21
|
+
const { title, subtitle, headerActions, headerSegment, children, buttons, footer, footerStart, footerEnd, footerNote, footerNoteDivider = false, footerClassName = "", footerLayout = 'center', onClose, closeDisabled = false, beforeClose, closeOnBackdrop = true, backClosable = true, className = "", ariaLabel, useTitle = true, inline = false, size, layer = 'modal', height, fillBody = false, resetScrollKey } = props || {};
|
|
20
22
|
const [closing, setClosing] = useState(false);
|
|
21
23
|
// 닫힘 애니메이션 중(260ms)엔 버튼이 시각적으로만 흐려질 뿐 클릭은 계속 가능해,
|
|
22
24
|
// 그 사이 같은 버튼을 연타하면 cb(확인/완료 콜백)가 여러 번 예약되어 중복 실행된다.
|
|
@@ -196,6 +198,23 @@ export default function Popup(props) {
|
|
|
196
198
|
return;
|
|
197
199
|
return pushEsc(() => closeRef.current());
|
|
198
200
|
}, [escEnabled]);
|
|
201
|
+
/* 폰 뒤로 — 맨 위 창 하나만 닫는다. 막히면(closeDisabled·beforeClose) false 를 돌려 칸을 도로 쌓게 한다(㉯) */
|
|
202
|
+
const beforeCloseRef = useRef(beforeClose);
|
|
203
|
+
useEffect(() => { beforeCloseRef.current = beforeClose; });
|
|
204
|
+
const closeDisabledRef = useRef(closeDisabled);
|
|
205
|
+
useEffect(() => { closeDisabledRef.current = closeDisabled; });
|
|
206
|
+
/* 묻는 것은 여기서 한 번만 — closeWithAnimation 을 부르면 beforeClose 가 두 번 불려 확인 창이 둘 뜬다 */
|
|
207
|
+
const closeNowRef = useRef(() => animateThen(onClose, true));
|
|
208
|
+
useEffect(() => { closeNowRef.current = () => animateThen(onClose, true); });
|
|
209
|
+
useBackClosable(escEnabled && backClosable, () => {
|
|
210
|
+
if (closeDisabledRef.current)
|
|
211
|
+
return false;
|
|
212
|
+
const ask = beforeCloseRef.current;
|
|
213
|
+
if (ask && ask() === false)
|
|
214
|
+
return false;
|
|
215
|
+
closeNowRef.current();
|
|
216
|
+
return true;
|
|
217
|
+
});
|
|
199
218
|
/* 바탕 누르기 — **누른 곳과 뗀 곳이 둘 다 바탕일 때만** 닫는다.
|
|
200
219
|
click 의 target 만 보면 패널 안에서 글자를 긁어 고르다 바깥에서 놓았을 때도
|
|
201
220
|
바탕에서 click 이 떨어져 창이 닫힌다(브라우저는 공통 조상에 click 을 쏜다).
|
|
@@ -223,9 +242,9 @@ export default function Popup(props) {
|
|
|
223
242
|
e.preventDefault(); }, children: _jsxs("div", { ref: panelRef, className: `popup-panel${size ? ` popup-panel--${size}` : ''}${height != null ? ' popup-panel--has-height' : ''}${fillBody ? ' popup-panel--fill-body' : ''}`,
|
|
224
243
|
/* 높이는 **CSS 변수로** 넘긴다 — 인라인 height 로 박으면 앱의 미디어 규칙(좁은 화면만 다른 높이)이 못 이겼다.
|
|
225
244
|
max-height(CSS)가 height 보다 이기므로 화면보다 크게 줘도 화면에 맞춰진다 */
|
|
226
|
-
style: height != null ? { '--popup-height': typeof height === 'number' ? `${height}px` : height } : undefined, tabIndex: -1, role: inline ? undefined : 'dialog', "aria-modal": inline ? undefined : true, "aria-labelledby": !inline && useTitle && title ? titleId : undefined, "aria-label": !inline && !(useTitle && title) ? (ariaLabel ?? (typeof title === 'string' ? title : undefined)) : undefined, children: [!useTitle && (headerActions || onClose) ? (_jsxs("div", { className: "popup-close-float", children: [headerActions, onClose && _jsx(Button, { htmlType: "button", size: 40, type: "dot", icon: "x", variant: "transparent-gray", useBorder: false, onClick: closeWithAnimation, disabled: closeDisabled, ariaLabel: t('common.close', '닫기') })] })) : (title || headerActions || onClose) ? (_jsxs("div", { className: `popup-header${subtitle ? ' popup-header--with-subtitle' : ''}`, children: [_jsxs("div", { className: "popup-header-main", children: [title
|
|
245
|
+
style: height != null ? { '--popup-height': typeof height === 'number' ? `${height}px` : height } : undefined, tabIndex: -1, role: inline ? undefined : 'dialog', "aria-modal": inline ? undefined : true, "aria-labelledby": !inline && useTitle && title ? titleId : undefined, "aria-label": !inline && !(useTitle && title) ? (ariaLabel ?? (typeof title === 'string' ? title : undefined)) : undefined, children: [!useTitle && (headerActions || onClose) ? (_jsxs("div", { className: "popup-close-float", children: [headerActions, onClose && _jsx(Button, { htmlType: "button", size: 40, type: "dot", icon: "x", variant: "transparent-gray", useBorder: false, className: "popup-close-btn", onClick: closeWithAnimation, disabled: closeDisabled, ariaLabel: t('common.close', '닫기') })] })) : (title || headerActions || onClose) ? (_jsxs("div", { className: `popup-header${subtitle ? ' popup-header--with-subtitle' : ''}`, children: [_jsxs("div", { className: "popup-header-main", children: [title
|
|
227
246
|
? _jsx("h2", { id: titleId, className: "popup-title popup-title--left h2", children: title })
|
|
228
|
-
: _jsx("span", { id: titleId, className: "popup-title popup-title--left h2" }), subtitle && _jsx("span", { className: "popup-subtitle body-3", children: subtitle })] }), _jsxs("div", { className: "popup-header-aside", children: [headerSegment && (_jsx("div", { className: "popup-header-segment", children: _jsx(SegmentedControl, { size: 40, ariaLabel: headerSegment.ariaLabel, options: headerSegment.options.map(o => ({ key: o.key, label: o.label, disabled: o.disabled })), value: headerSegment.value, onChange: headerSegment.onChange }) })), _jsxs("div", { className: "popup-header-actions", children: [headerActions, onClose && (_jsx(Button, { htmlType: "button", size: 40, type: "dot", icon: "x", variant: "transparent-gray", useBorder: false, onClick: closeWithAnimation, disabled: closeDisabled, ariaLabel: t('common.close', '닫기') }))] })] })] })) : null, _jsx("div", { className: "popup-content", ref: contentRef, tabIndex: contentScrollable ? 0 : undefined, children: _jsx("div", { className: "popup-content__inner", children: typeof children === 'function' ? children({ animateThen, closeWithAnimation }) : children }) }), footerNote != null && footerNote !== false && (
|
|
247
|
+
: _jsx("span", { id: titleId, className: "popup-title popup-title--left h2" }), subtitle && _jsx("span", { className: "popup-subtitle body-3", children: subtitle })] }), _jsxs("div", { className: "popup-header-aside", children: [headerSegment && (_jsx("div", { className: "popup-header-segment", children: _jsx(SegmentedControl, { size: 40, ariaLabel: headerSegment.ariaLabel, options: headerSegment.options.map(o => ({ key: o.key, label: o.label, disabled: o.disabled })), value: headerSegment.value, onChange: headerSegment.onChange }) })), _jsxs("div", { className: "popup-header-actions", children: [headerActions, onClose && (_jsx(Button, { htmlType: "button", size: 40, type: "dot", icon: "x", variant: "transparent-gray", useBorder: false, className: "popup-close-btn", onClick: closeWithAnimation, disabled: closeDisabled, ariaLabel: t('common.close', '닫기') }))] })] })] })) : null, _jsx("div", { className: "popup-content", ref: contentRef, tabIndex: contentScrollable ? 0 : undefined, children: _jsx("div", { className: "popup-content__inner", children: typeof children === 'function' ? children({ animateThen, closeWithAnimation }) : children }) }), footerNote != null && footerNote !== false && (
|
|
229
248
|
/* 바닥 줄 위의 안내 띠 — 바닥 줄과 따로 선다((108)). `role="note"` 로 낭독기에 "참고" 로 읽힌다. */
|
|
230
249
|
_jsx("div", { className: `popup-footer-note caption-1${footerNoteDivider ? ' popup-footer-note--divider' : ''}`, role: "note", children: footerNote })), (footerStart || footerEnd) ? (
|
|
231
250
|
/* 왼쪽·오른쪽 덩이 — 빈 덩이도 그린다(자리를 지켜야 오른쪽이 끝에 선다).
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/* 매긴 셈 한 묶음(말귀 청 (437) ㉱) — 셋을 한 묶음으로, 사이를 넓히면 저마다 떠서 '셋 중 하나' 로 안 읽힌다 */
|
|
2
|
+
.score-mark-counts { display: flex; align-items: center; gap: 12px; }
|
|
3
|
+
.score-mark-counts__one { display: flex; align-items: center; gap: 5px; }
|
|
4
|
+
.score-mark-counts__num {
|
|
5
|
+
font-size: 15px;
|
|
6
|
+
font-weight: 600;
|
|
7
|
+
color: var(--color-black);
|
|
8
|
+
font-variant-numeric: tabular-nums;
|
|
9
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { ScoreMark } from './Word/wordTableScoring';
|
|
2
|
+
import './ScoreMarkCounts.css';
|
|
3
|
+
/** @public */
|
|
4
|
+
export interface ScoreMarkCountsProps {
|
|
5
|
+
o: number;
|
|
6
|
+
triangle: number;
|
|
7
|
+
x: number;
|
|
8
|
+
/** 낭독기에 읽힐 이름 — **곁에 셈을 읽는 줄이 없을 때만** 준다. 안 주면 셋 다 그림으로만 선다 */
|
|
9
|
+
label?: (mark: ScoreMark, count: number) => string;
|
|
10
|
+
className?: string;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* **매긴 셈 한 묶음 — ○ n · △ n · ✕ n**(말귀 청 (437) ㉱ — 말귀 앱에서 옮겨 왔다, 2026-11-13).
|
|
14
|
+
*
|
|
15
|
+
* · **셋을 늘 함께 세운다. 0 도 세운다** — 빠지면 `○ 2 · ✕ 1` 이 되어 △ 를 안 매긴 것인지 △ 가 없는 표인지 가릴 수 없다.
|
|
16
|
+
* · **들리는 말은 여기서 안 낸다** — 쓰는 자리마다 곁에 `role="status"` 한 줄이 셈을 통째로 읽는다. 곁에 그런 줄이 없으면 `label` 을 준다.
|
|
17
|
+
* @public
|
|
18
|
+
*/
|
|
19
|
+
export default function ScoreMarkCounts({ o, triangle, x, label, className }: ScoreMarkCountsProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { cx } from '../utils/cx';
|
|
4
|
+
import MarkIcon from './MarkIcon';
|
|
5
|
+
import './ScoreMarkCounts.css';
|
|
6
|
+
/**
|
|
7
|
+
* **매긴 셈 한 묶음 — ○ n · △ n · ✕ n**(말귀 청 (437) ㉱ — 말귀 앱에서 옮겨 왔다, 2026-11-13).
|
|
8
|
+
*
|
|
9
|
+
* · **셋을 늘 함께 세운다. 0 도 세운다** — 빠지면 `○ 2 · ✕ 1` 이 되어 △ 를 안 매긴 것인지 △ 가 없는 표인지 가릴 수 없다.
|
|
10
|
+
* · **들리는 말은 여기서 안 낸다** — 쓰는 자리마다 곁에 `role="status"` 한 줄이 셈을 통째로 읽는다. 곁에 그런 줄이 없으면 `label` 을 준다.
|
|
11
|
+
* @public
|
|
12
|
+
*/
|
|
13
|
+
export default function ScoreMarkCounts({ o, triangle, x, label, className }) {
|
|
14
|
+
const three = [['o', o], ['triangle', triangle], ['x', x]];
|
|
15
|
+
return (_jsx("span", { className: cx('score-mark-counts', className), children: three.map(([mark, count]) => (_jsxs("span", { className: "score-mark-counts__one", children: [_jsx(MarkIcon, { mark: mark, label: label ? label(mark, count) : '' }), _jsx("span", { className: "score-mark-counts__num", children: count })] }, mark))) }));
|
|
16
|
+
}
|
|
@@ -341,3 +341,23 @@
|
|
|
341
341
|
white-space: nowrap;
|
|
342
342
|
border: 0;
|
|
343
343
|
}
|
|
344
|
+
|
|
345
|
+
/* ── 폰 · 태블릿에서 입력 글자는 16px 밑으로 안 내려간다(말귀 청 (438) ㉮, 2026-11-14) ──
|
|
346
|
+
iOS Safari 는 초점 받은 입력칸 글자가 16px 아래면 **화면을 확대한다** — 칸을 누를 때마다 줌인되고
|
|
347
|
+
아래 단추가 밀려 나간다. 토큰이 1023px 아래에서 body-2 를 15px 로, 작은 칸(`--s32`)은 위에서 14px 로
|
|
348
|
+
둔다. 토큰은 그대로 두고(본문 글자는 안 바뀐다) **입력 요소만** 올린다. `max()` 라 글자 크게 보기
|
|
349
|
+
(`data-font-scale`, 18px↑)는 그대로다. 디스플레이형은 제 크기(22·28px)가 있어 뺀다.
|
|
350
|
+
말귀 앱 · 어드민이 `App.css` 에서 같은 규칙으로 덮고 있었다(지킴이 `mobileInputNoZoom`). */
|
|
351
|
+
@media (max-width: 1023px) {
|
|
352
|
+
.text-field:not(.text-field--display) .text-field__input.body-2 {
|
|
353
|
+
font-size: max(16px, var(--text-body-2-size));
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
/* 비밀번호 보기 단추(㉱) — 지우기 단추와 같은 배치 */
|
|
358
|
+
.text-field__reveal {
|
|
359
|
+
flex-shrink: 0;
|
|
360
|
+
margin-right: 10px;
|
|
361
|
+
}
|
|
362
|
+
/* 지우기와 보기가 나란하면 사이만 좁힌다 */
|
|
363
|
+
.text-field__clear + .text-field__reveal { margin-left: -6px; }
|
|
@@ -101,6 +101,23 @@ export interface TextFieldProps {
|
|
|
101
101
|
/** 모바일 키패드 종류 힌트 */
|
|
102
102
|
inputMode?: 'none' | 'text' | 'decimal' | 'numeric' | 'tel' | 'search' | 'email' | 'url';
|
|
103
103
|
autoComplete?: string;
|
|
104
|
+
/**
|
|
105
|
+
* 첫 글자 대문자 바꾸기(모바일 키보드) — `<input>` 에 그대로 넘긴다(말귀 청 (438) ㉰, 2026-11-14).
|
|
106
|
+
*
|
|
107
|
+
* **안 주면 칸의 쓰임을 보고 정한다** — `type` 이 `email`·`tel`·`password`·`url` 이거나
|
|
108
|
+
* `autoComplete` 가 `username`·`email`·`one-time-code` 면 `'none'`, 그 밖은 브라우저 기본.
|
|
109
|
+
* iOS 가 로그인 아이디 첫 글자를 대문자로 바꿔 '아이디가 틀렸다' 가 났다.
|
|
110
|
+
*/
|
|
111
|
+
autoCapitalize?: 'none' | 'off' | 'sentences' | 'words' | 'characters' | 'on';
|
|
112
|
+
/** 자동 고침(iOS) — 기본은 `autoCapitalize` 와 같은 칸에서 `'off'`. 그 밖은 브라우저 기본. */
|
|
113
|
+
autoCorrect?: 'on' | 'off';
|
|
114
|
+
/**
|
|
115
|
+
* 비밀번호 보기/숨기기 단추(말귀 청 (438) ㉱) — `type="password"` 일 때만 선다. 기본 거짓.
|
|
116
|
+
*
|
|
117
|
+
* 단추는 지우기 단추 뒤, `rightIcon` 앞에 **나란히** 선다(겹치지 않는다). 보일 때도 값은
|
|
118
|
+
* HTML 속성에 안 박힌다 — 비밀번호 칸의 평문 보호(아래 `isPasswordControlled`)는 **원래 `type`** 을 본다.
|
|
119
|
+
*/
|
|
120
|
+
revealable?: boolean;
|
|
104
121
|
className?: string;
|
|
105
122
|
onFocus?: (e: FocusEvent<HTMLInputElement | HTMLTextAreaElement>) => void;
|
|
106
123
|
onBlur?: (e: FocusEvent<HTMLInputElement | HTMLTextAreaElement>) => void;
|
|
@@ -20,7 +20,7 @@ export default function TextField(props) {
|
|
|
20
20
|
조작기가 40이다(세그먼트 단추·줄 옆 `Button`). 글자 칸만 48이라 수를 받는 줄이
|
|
21
21
|
토글 줄보다 눈에 띄게 깊었다(실측: 그 줄 80px ↔ 토글 줄 56px → 72px 로 좁혀짐).
|
|
22
22
|
48이 맞는 자리는 그 자리에 `size={48}` 을 적는다. */
|
|
23
|
-
size: sizeProp, variant = 'input', fullWidth = false, newline = false, multiline = false, rows = 3, leftIcon, rightIcon, clearable = false, list, showCount = true, className = '', onFocus, onBlur, onKeyDown, onEnter, inputMode, autoComplete, autoFocus, suggestions: suggestionsProp, filterSuggestions, onSelectSuggestion, autoActiveFirst, openOnFocus = false, } = props;
|
|
23
|
+
size: sizeProp, variant = 'input', fullWidth = false, newline = false, multiline = false, rows = 3, leftIcon, rightIcon, clearable = false, list, showCount = true, className = '', onFocus, onBlur, onKeyDown, onEnter, inputMode, autoComplete, autoCapitalize: autoCapitalizeProp, autoCorrect: autoCorrectProp, revealable = false, autoFocus, suggestions: suggestionsProp, filterSuggestions, onSelectSuggestion, autoActiveFirst, openOnFocus = false, } = props;
|
|
24
24
|
// 안 주면 가장 가까운 판 · 표의 값(청 (419)) — 그 밖이면 공용 수 `CONTROL_SIZE`(40)
|
|
25
25
|
const inheritedSize = useControlSize();
|
|
26
26
|
const size = sizeProp ?? inheritedSize ?? CONTROL_SIZE;
|
|
@@ -146,6 +146,15 @@ export default function TextField(props) {
|
|
|
146
146
|
const placeholderGhost = ghostText
|
|
147
147
|
? `${ghostText}${ghostHint ?? t('wordTable.save.autoFillHint', ' (Tab 또는 space 입력시 자동 입력)')}`
|
|
148
148
|
: placeholder;
|
|
149
|
+
/* 아이디 · 이메일 · 인증번호 칸은 글자를 손대지 않는다(㉰) — 안 주었을 때만 */
|
|
150
|
+
const isVerbatimField = type === 'email' || type === 'tel' || type === 'password' || type === 'url'
|
|
151
|
+
|| autoComplete === 'username' || autoComplete === 'email' || autoComplete === 'one-time-code';
|
|
152
|
+
const autoCapitalize = autoCapitalizeProp ?? (isVerbatimField ? 'none' : undefined);
|
|
153
|
+
const autoCorrect = autoCorrectProp ?? (isVerbatimField ? 'off' : undefined);
|
|
154
|
+
/* 비밀번호 보기(㉱) — 그리는 type 만 바꾼다. 평문 보호는 원래 `type` 을 본다(아래) */
|
|
155
|
+
const canReveal = revealable && type === 'password' && !newline && !multiline;
|
|
156
|
+
const [revealed, setRevealed] = useState(false);
|
|
157
|
+
const inputType = canReveal && revealed ? 'text' : type;
|
|
149
158
|
const isControlled = value !== undefined;
|
|
150
159
|
/* 비밀번호는 value 를 React 에 넘기지 않는다 — 위 useEffect 주석 참고 */
|
|
151
160
|
const isPasswordControlled = isControlled && type === 'password';
|
|
@@ -187,7 +196,7 @@ export default function TextField(props) {
|
|
|
187
196
|
}, [value, innerLen, newline]);
|
|
188
197
|
const isOver = maxLength != null && len > maxLength;
|
|
189
198
|
const iconSize = size === 32 ? 16 : 20;
|
|
190
|
-
const cls = cx('text-field', `text-field--s${size}`, variant === 'display' ? 'text-field--display' : '', fullWidth ? 'text-field--full-width' : '', disabled ? 'text-field--disabled' : '', readOnly ? 'text-field--readonly' : '', error ? 'text-field--error' : '', leftIcon ? 'text-field--has-left-icon' : '', (rightIcon || clearable) ? 'text-field--has-right-icon' : '', className);
|
|
199
|
+
const cls = cx('text-field', `text-field--s${size}`, variant === 'display' ? 'text-field--display' : '', fullWidth ? 'text-field--full-width' : '', disabled ? 'text-field--disabled' : '', readOnly ? 'text-field--readonly' : '', error ? 'text-field--error' : '', leftIcon ? 'text-field--has-left-icon' : '', (rightIcon || clearable || canReveal) ? 'text-field--has-right-icon' : '', className);
|
|
191
200
|
const sharedInputProps = {
|
|
192
201
|
id: inputId,
|
|
193
202
|
// controlled면 value, uncontrolled면 defaultValue (IME 조합 충돌 회피)
|
|
@@ -206,6 +215,8 @@ export default function TextField(props) {
|
|
|
206
215
|
list,
|
|
207
216
|
inputMode,
|
|
208
217
|
autoComplete,
|
|
218
|
+
autoCapitalize,
|
|
219
|
+
autoCorrect,
|
|
209
220
|
'aria-label': !label && ariaLabel ? ariaLabel : undefined,
|
|
210
221
|
'aria-required': required,
|
|
211
222
|
'aria-invalid': !!error,
|
|
@@ -299,7 +310,7 @@ export default function TextField(props) {
|
|
|
299
310
|
// 고정 영역 textarea — rows 로 높이 미리 확보
|
|
300
311
|
return (_jsx("textarea", { ...sharedInputProps, className: "text-field__input text-field__input--textarea body-2", rows: rows }));
|
|
301
312
|
}
|
|
302
|
-
return (_jsx("input", { ...sharedInputProps, type:
|
|
313
|
+
return (_jsx("input", { ...sharedInputProps, type: inputType, className: "text-field__input body-2" }));
|
|
303
314
|
};
|
|
304
315
|
// variant="display"는 값과 placeholder 글자 크기가 크게 달라 네이티브 ::placeholder로는
|
|
305
316
|
// 세로 중앙을 못 맞춘다. 전용 오버레이 div를 flex로 정중앙 정렬하고,
|
|
@@ -321,7 +332,11 @@ export default function TextField(props) {
|
|
|
321
332
|
setInnerLen(0);
|
|
322
333
|
}
|
|
323
334
|
onChange?.('');
|
|
324
|
-
}, tabIndex: -1 })),
|
|
335
|
+
}, tabIndex: -1 })), canReveal && (_jsx(Button, { size: 24, type: "dot", icon: revealed ? 'eye-off' : 'eye', variant: "transparent-gray", useBorder: false, className: "text-field__reveal",
|
|
336
|
+
/* 이름은 하나로 두고 눌림만 바꾼다 — 이름과 눌림을 같이 바꾸면 낭독기가 "숨기기, 눌림" 처럼 거꾸로 읽는다 */
|
|
337
|
+
ariaLabel: t('textField.showPassword', '비밀번호 보기'), "aria-pressed": revealed, htmlType: "button", disabled: disabled,
|
|
338
|
+
/* 누를 때 초점이 칸을 안 떠나게(지우기 단추와 같다) — 치던 자리가 그대로 남는다 */
|
|
339
|
+
onMouseDown: (e) => { e.preventDefault(); }, onClick: () => setRevealed(v => !v) })), rightIcon && !showClear && (_jsx("span", { className: "text-field__icon text-field__icon--right", children: _jsx(Icon, { icon: rightIcon, label: "", className: "", svgClassName: "text-field__icon-svg", size: iconSize }) }))] }), !!suggestions && (_jsx("span", { className: "text-field__status", role: "status", "aria-live": "polite", children: combobox.open && (value ?? '').length > 0 && combobox.filtered.length === 0
|
|
325
340
|
? t('common.noMatches', '맞는 항목이 없습니다')
|
|
326
341
|
: '' })), listOpen && (typeof document === 'undefined' ? null : createPortal(_jsx("ul", { id: combobox.listId, className: "text-field__suggestions", role: "listbox", style: listStyle ?? { position: 'fixed', visibility: 'hidden' }, "data-tooltip-ignore": true, children: combobox.filtered.map((s, i) => (_jsx("li", { id: `${combobox.listId}-option-${i}`, role: "option", "aria-selected": i === combobox.activeIdx, className: `text-field__suggestion body-2${i === combobox.activeIdx ? ' is-active' : ''}`,
|
|
327
342
|
// 선택은 click 에서 한다. onMouseDown 만 두면 마우스로는 눌리지만 스크린리더가
|
|
@@ -49,9 +49,33 @@ export default function TrainingBlockGrid({ gap = 10, count, className, children
|
|
|
49
49
|
measure();
|
|
50
50
|
if (typeof ResizeObserver === 'undefined')
|
|
51
51
|
return;
|
|
52
|
+
/* **자기만 보면 묶인 뒤에 못 깬다**(말귀 청 (439), 2026-11-14). `--measured` 의 `max-width` 로 스스로 묶인 뒤에는
|
|
53
|
+
부모가 넓어져도 이 상자는 그대로라 다시 안 잰다 — ① 내용에 맞춰 줄어드는 부모 안에서 먼저 재면 타일 셋이
|
|
54
|
+
둘+하나로 접혀 410 에 묶이고 창이 660 이 돼도 그대로였다. ② 폰을 돌려 카드가 293 → 190 이 돼도 그리드는 1열에
|
|
55
|
+
머물렀다. 그래서 **첫 카드**와 **위로 세 칸까지의 조상**도 보고, 창 크기 바뀜(돌리기)에도 잰다. 잰 값이 같으면
|
|
56
|
+
상태를 안 바꾸므로(위 `prev`) 더 봐도 다시 그리지 않는다. */
|
|
52
57
|
const ro = new ResizeObserver(measure);
|
|
53
58
|
ro.observe(el);
|
|
54
|
-
|
|
59
|
+
const first = el.firstElementChild;
|
|
60
|
+
if (first)
|
|
61
|
+
ro.observe(first);
|
|
62
|
+
let up = el.parentElement;
|
|
63
|
+
for (let i = 0; i < 3 && up && up !== document.body; i++, up = up.parentElement)
|
|
64
|
+
ro.observe(up);
|
|
65
|
+
/* 창 크기 바뀜은 잦다 — 틀에 한 번으로 모은다 */
|
|
66
|
+
let rafId = null;
|
|
67
|
+
const onResize = () => {
|
|
68
|
+
if (rafId !== null)
|
|
69
|
+
return;
|
|
70
|
+
rafId = requestAnimationFrame(() => { rafId = null; measure(); });
|
|
71
|
+
};
|
|
72
|
+
window.addEventListener('resize', onResize);
|
|
73
|
+
return () => {
|
|
74
|
+
ro.disconnect();
|
|
75
|
+
window.removeEventListener('resize', onResize);
|
|
76
|
+
if (rafId !== null)
|
|
77
|
+
cancelAnimationFrame(rafId);
|
|
78
|
+
};
|
|
55
79
|
}, [itemCount, gap]);
|
|
56
80
|
const cardWidth = measured.card > 0 ? measured.card : 0;
|
|
57
81
|
const perRow = cardWidth > 0 ? columnsFitting(measured.width, cardWidth, gap) : 0;
|