@ihabdevteam/core 0.414.0 → 0.416.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 +360 -0
- package/dist/components.cjs.js +40 -40
- package/dist/components.esm.css +2 -2
- package/dist/hooks.cjs.js +3 -3
- package/dist/i18n.cjs.js +3 -3
- package/dist/ihabdevteam-core.cjs.js +181 -181
- package/dist/ihabdevteam-core.d.ts +33 -3
- package/dist/packages/core/src/components/BarChart.css +41 -13
- package/dist/packages/core/src/components/BarChart.d.ts +1 -1
- package/dist/packages/core/src/components/BarChart.js +52 -15
- package/dist/packages/core/src/components/ChartSection.css +149 -37
- package/dist/packages/core/src/components/ChartSection.d.ts +23 -1
- package/dist/packages/core/src/components/ChartSection.js +48 -7
- package/dist/packages/core/src/components/Header.css +3 -1
- package/dist/packages/core/src/components/RingChart.js +2 -2
- package/dist/packages/core/src/components/SideNav.css +44 -15
- package/dist/packages/core/src/components/SideNav.js +1 -1
- package/dist/packages/core/src/components/Word/WordSearchResultBlock.css +9 -0
- package/dist/packages/core/src/components/Word/WordSearchResultBlock.js +6 -1
- package/dist/packages/core/src/components/barChartData.d.ts +23 -0
- package/dist/packages/core/src/components/barChartData.js +30 -0
- package/dist/packages/core/src/components/barChartTypes.d.ts +8 -0
- package/dist/packages/core/src/components/useBarChartControl.js +17 -13
- package/dist/packages/core/src/hooks/useWideCardSpans.d.ts +28 -0
- package/dist/packages/core/src/hooks/useWideCardSpans.js +85 -0
- package/dist/packages/core/src/i18n/locales/en.json +2 -1
- package/dist/packages/core/src/i18n/locales/ko.json +1 -0
- package/dist/packages/core/src/utils/date.d.ts +12 -0
- package/dist/packages/core/src/utils/date.js +18 -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 +3 -3
- package/package.json +1 -1
|
@@ -34,6 +34,12 @@ export interface ChartTotalProps {
|
|
|
34
34
|
* 작은 카드만 CSS 로 크기를 덮어 맞췄는데, 그러면 **마크업에 적힌 단계가 아무 일도 안
|
|
35
35
|
* 한다** — 글자를 고쳐도 화면이 안 바뀐다(사장님이 2026-11-02 에 짚으셨다). 단계를 한
|
|
36
36
|
* 군데서 정하고, 부르는 쪽은 "작은 카드인가" 만 넘긴다.
|
|
37
|
+
*
|
|
38
|
+
* **큰 수의 이름은 이것 하나다**(사장님 지시 2026-11-02 — "하나는 sub-row고 하나는
|
|
39
|
+
* section-content 네 하나로 통일해"). 수 칸만 `__value`·`__value-row` 라는 제 이름을
|
|
40
|
+
* 따로 쓰고 있었다 — 같은 자리의 같은 수인데 규칙을 두 벌씩 써야 했고, 그날도 차트 쪽
|
|
41
|
+
* 한 자리를 빠뜨려 큰 수의 윗여백이 그 카드만 안 들었다. 이제 **그리는 자리 다섯**
|
|
42
|
+
* (수 칸 · 차트 카드 · 막대 합계 셋 · 고리 퍼센트)이 다 이 함수를 부른다.
|
|
37
43
|
* @public
|
|
38
44
|
*/
|
|
39
45
|
export declare const chartTotalNumClass: (small?: boolean) => string;
|
|
@@ -185,6 +191,12 @@ export interface ChartSectionProps {
|
|
|
185
191
|
totalNum?: ReactNode;
|
|
186
192
|
/** 수 뒤 단위(`%` 등) — `totalNum` 과 함께 쓴다 */
|
|
187
193
|
totalUnit?: ReactNode;
|
|
194
|
+
/** 값이 **수가 아니라 빈 것을 이르는 말**일 때(`없음` 등) — 글자를 `lightGray` 로 낮춘다
|
|
195
|
+
* (사장님 지시 2026-11-02 "없음은 lightGray 로").
|
|
196
|
+
*
|
|
197
|
+
* **코어는 그 글자를 못 알아본다** — `totalNum` 은 아무 노드나 받으므로 `없음`·`None`·`—` 이
|
|
198
|
+
* 수인지 말인지 가릴 길이 없다. 그래서 **부르는 쪽이 말해 준다.** */
|
|
199
|
+
totalMuted?: boolean;
|
|
188
200
|
/** 수 앞 설명 한 줄 — 색을 입힌 대비 수치 등은 노드로 넘긴다(앱 규칙) */
|
|
189
201
|
totalLabel?: ReactNode;
|
|
190
202
|
/** 카드에 포인터가 닿을 때(키보드는 초점이 들어올 때) 뜨는 설명 — `StatChart tooltip` 과 같은 뜻.
|
|
@@ -192,6 +204,16 @@ export interface ChartSectionProps {
|
|
|
192
204
|
tooltip?: string;
|
|
193
205
|
/** 총계(ChartTotal) + 범례(ChartLegend)를 담는 서브로우 */
|
|
194
206
|
subRow?: ReactNode;
|
|
207
|
+
/** **범례 — 서브로우 밖의 제 자리**(사장님 지시 2026-11-02 "legend 를 sub row 에서 분리해서
|
|
208
|
+
* 배치해줘. 상대적으로 위로 올라가있는걸 조정 못하겠어"). 서브로우 안에 수와 나란히 세우면
|
|
209
|
+
* 수의 줄상자에 매여 **범례만 따로 올리고 내릴 손잡이가 없다.** 여기 주면 카드 오른쪽에
|
|
210
|
+
* 따로 서고, 세로 자리는 `--legend-offset`(px, 기본 0 = 큰 수 줄의 윗선) 하나로 움직인다. */
|
|
211
|
+
legend?: ReactNode;
|
|
212
|
+
/** **카드 키를 박는다** — 속이 그 키에 **스스로 맞출 때만** 켠다(`BarChart fitHeight` 가 켠다).
|
|
213
|
+
* 2026-11-02 에 이것을 `inGrid` 에 묶었더니 격자에 선 **모든** 차트 카드가 260 으로 박혀,
|
|
214
|
+
* 속을 안 맞추는 고객 통계의 차트 여덟이 x축 둘째 줄을 카드 밖으로 흘렸다(사장님 "아따
|
|
215
|
+
* 여기 죄다 깨졌네"). 격자에 섰다는 것과 속을 맞춘다는 것은 다른 말이다. */
|
|
216
|
+
fitBody?: boolean;
|
|
195
217
|
/** 서브로우에 선 것들의 **세로 맞춤** — `'start'`(기본) · `'center'` · `'end'`.
|
|
196
218
|
*
|
|
197
219
|
* 기본이 `'start'` 인 것은 **범례** 때문이다. 수(설명 한 줄 + 큰 수, 두 줄)와 범례가 함께 서면
|
|
@@ -218,4 +240,4 @@ export interface ChartSectionProps {
|
|
|
218
240
|
* 공유하도록 두 컴포넌트가 내부적으로 사용한다.
|
|
219
241
|
* @public
|
|
220
242
|
*/
|
|
221
|
-
export default function ChartSection({ type, title, titleClassName, titleLevel, icon, disc, headRight, headFloat, headSegment, headMenuItems, collapseBelow, onClick, ariaLabel, tooltip, totalNum, totalUnit, totalLabel, change, changeType, size, bodyAlign, subRow, subRowAlign, className, inGrid, children }: ChartSectionProps): import("react").JSX.Element;
|
|
243
|
+
export default function ChartSection({ type, title, titleClassName, titleLevel, icon, disc, headRight, headFloat, headSegment, headMenuItems, collapseBelow, onClick, ariaLabel, tooltip, totalNum, totalUnit, totalMuted, totalLabel, change, changeType, size, bodyAlign, subRow, legend, subRowAlign, className, inGrid, fitBody, children }: ChartSectionProps): import("react").JSX.Element;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
3
|
import './ChartSection.css';
|
|
4
|
-
import { useCallback, useEffect, useId, useRef, useState } from 'react';
|
|
4
|
+
import { useCallback, useEffect, useId, useRef, useState, useLayoutEffect } from 'react';
|
|
5
5
|
import { useTranslation } from 'react-i18next';
|
|
6
6
|
import Icon from './Icon';
|
|
7
7
|
import SectionHeadFloat from './SectionHeadFloat';
|
|
@@ -34,6 +34,12 @@ export function ChartLegend({ items, className }) {
|
|
|
34
34
|
* 작은 카드만 CSS 로 크기를 덮어 맞췄는데, 그러면 **마크업에 적힌 단계가 아무 일도 안
|
|
35
35
|
* 한다** — 글자를 고쳐도 화면이 안 바뀐다(사장님이 2026-11-02 에 짚으셨다). 단계를 한
|
|
36
36
|
* 군데서 정하고, 부르는 쪽은 "작은 카드인가" 만 넘긴다.
|
|
37
|
+
*
|
|
38
|
+
* **큰 수의 이름은 이것 하나다**(사장님 지시 2026-11-02 — "하나는 sub-row고 하나는
|
|
39
|
+
* section-content 네 하나로 통일해"). 수 칸만 `__value`·`__value-row` 라는 제 이름을
|
|
40
|
+
* 따로 쓰고 있었다 — 같은 자리의 같은 수인데 규칙을 두 벌씩 써야 했고, 그날도 차트 쪽
|
|
41
|
+
* 한 자리를 빠뜨려 큰 수의 윗여백이 그 카드만 안 들었다. 이제 **그리는 자리 다섯**
|
|
42
|
+
* (수 칸 · 차트 카드 · 막대 합계 셋 · 고리 퍼센트)이 다 이 함수를 부른다.
|
|
37
43
|
* @public
|
|
38
44
|
*/
|
|
39
45
|
export const chartTotalNumClass = (small) => `chart-section__total__num ${small ? 'h1' : 'h0'}`;
|
|
@@ -80,7 +86,7 @@ const CARD_SIZE_CLASS = {
|
|
|
80
86
|
* 공유하도록 두 컴포넌트가 내부적으로 사용한다.
|
|
81
87
|
* @public
|
|
82
88
|
*/
|
|
83
|
-
export default function ChartSection({ type = 'chart', title, titleClassName, titleLevel, icon, disc, headRight, headFloat, headSegment, headMenuItems, collapseBelow = 420, onClick, ariaLabel, tooltip, totalNum, totalUnit, totalLabel, change, changeType, size, bodyAlign = 'bottom', subRow, subRowAlign = 'start', className, inGrid = false, children }) {
|
|
89
|
+
export default function ChartSection({ type = 'chart', title, titleClassName, titleLevel, icon, disc, headRight, headFloat, headSegment, headMenuItems, collapseBelow = 420, onClick, ariaLabel, tooltip, totalNum, totalUnit, totalMuted = false, totalLabel, change, changeType, size, bodyAlign = 'bottom', subRow, legend, subRowAlign = 'start', className, inGrid = false, fitBody = false, children }) {
|
|
84
90
|
const isStat = type === 'stat';
|
|
85
91
|
/** 안 주면 갈래가 정한다 — 수 칸은 `small`, 차트 카드는 `large`(밑바탕) */
|
|
86
92
|
const cardSize = size ?? (isStat ? 'small' : 'large');
|
|
@@ -171,6 +177,31 @@ export default function ChartSection({ type = 'chart', title, titleClassName, ti
|
|
|
171
177
|
const totalRow = (totalNum != null || totalLabel) ? (_jsxs(ChartTotal, { label: totalLabel, children: [totalNum != null && _jsx("span", { className: withLegacy(chartTotalNumClass(isCompact)), children: totalNum }), totalUnit && _jsx("span", { className: withLegacy("chart-section__total__unit body-3"), children: totalUnit })] })) : null;
|
|
172
178
|
/* 머리 오른쪽에는 **고르개와 `headRight` 만** 남는다 — 고르개가 먼저, 상세보기 단추가 오른쪽 끝(사용자 지시 2026-09-17) */
|
|
173
179
|
const headRightNode = (rightNode || headSegment) ? (_jsxs("div", { className: withLegacy("chart-section__head-right"), children: [headSegment && (collapsed ? (_jsx(Button, { htmlType: "button", size: CHART_HEAD_SIZE, type: "dot", icon: "ellipsis", ariaLabel: headSegment.ariaLabel ?? t('common.more', '더보기'), showTooltipInfo: headSegment.ariaLabel ?? t('common.more', '더보기'), "aria-haspopup": "menu", "aria-expanded": !!menuRect, onClick: openMenu })) : (_jsx(SegmentedControl, { size: CHART_HEAD_SIZE, ariaLabel: headSegment.ariaLabel, options: headSegment.options.map(o => ({ key: o.key, label: o.label, disabled: o.disabled })), value: headSegment.value, onChange: headSegment.onChange }))), rightNode] })) : null;
|
|
180
|
+
/* **범례가 큰 수 줄보다 길면 그만큼 줄을 넓힌다**(사장님 지시 2026-11-03 "legend 이 선 위로").
|
|
181
|
+
범례는 서브로우 밖에 띄워 세우므로 줄 키에 안 든다 — 계열이 셋이 되자 55px 이 되어 **첫 눈금선을
|
|
182
|
+
10px 넘었다**(실측 2026-11-03: 범례 바닥 113 · 눈금선 103). 위로 키우면 머리의 고르개와 겹치니,
|
|
183
|
+
**아래가 밀리는 쪽**이 맞다 — 잰 키를 카드에 적어 두면 CSS 가 서브로우의 최소 키로 쓰고,
|
|
184
|
+
판은 `fitHeight` 가 남은 자리를 다시 재어 저절로 줄어든다. */
|
|
185
|
+
const legendRef = useRef(null);
|
|
186
|
+
const [legendHeight, setLegendHeight] = useState(null);
|
|
187
|
+
useLayoutEffect(() => {
|
|
188
|
+
const node = legendRef.current;
|
|
189
|
+
if (!node) {
|
|
190
|
+
setLegendHeight(null);
|
|
191
|
+
return;
|
|
192
|
+
}
|
|
193
|
+
const measure = () => {
|
|
194
|
+
const h = node.getBoundingClientRect().height;
|
|
195
|
+
setLegendHeight(prev => (prev != null && Math.abs(prev - h) < 1 ? prev : h));
|
|
196
|
+
};
|
|
197
|
+
measure();
|
|
198
|
+
/* 흉내 판(jsdom)에는 `ResizeObserver` 가 없다 — 없으면 한 번 잰 것으로 둔다 */
|
|
199
|
+
if (typeof ResizeObserver === 'undefined')
|
|
200
|
+
return;
|
|
201
|
+
const observer = new ResizeObserver(measure);
|
|
202
|
+
observer.observe(node);
|
|
203
|
+
return () => observer.disconnect();
|
|
204
|
+
}, [legend]);
|
|
174
205
|
const titleId = useId();
|
|
175
206
|
const TitleTag = resolvedTitleLevel ? `h${resolvedTitleLevel}` : 'div';
|
|
176
207
|
/* ── `stat` 갈래 ──────────────────────────────────────────────
|
|
@@ -192,16 +223,26 @@ export default function ChartSection({ type = 'chart', title, titleClassName, ti
|
|
|
192
223
|
height: tipRect.height,
|
|
193
224
|
}, text: tooltip })) : null;
|
|
194
225
|
if (isStat) {
|
|
195
|
-
return (_jsxs("div", { ref: secRef, className: withLegacy(['chart-section', 'chart-section--stat', typeof cardSize === 'string' && CARD_SIZE_CLASS[cardSize], onClick && 'chart-section--clickable', className].filter(Boolean).join(' ')), style: minHeight === undefined ? undefined : { minHeight }, onClick: onClick ? onCardClick : undefined, onKeyDown: onClick ? onCardKeyDown : undefined, onPointerEnter: tooltip ? showTip : undefined, onPointerLeave: tooltip ? closeTip : undefined,
|
|
226
|
+
return (_jsxs("div", { ref: secRef, className: withLegacy(['chart-section', 'chart-section--stat', inGrid && 'chart-section--grid', bodyAlign === 'center' && 'chart-section--body-center', typeof cardSize === 'string' && CARD_SIZE_CLASS[cardSize], onClick && 'chart-section--clickable', className].filter(Boolean).join(' ')), style: minHeight === undefined ? undefined : { minHeight }, onClick: onClick ? onCardClick : undefined, onKeyDown: onClick ? onCardKeyDown : undefined, onPointerEnter: tooltip ? showTip : undefined, onPointerLeave: tooltip ? closeTip : undefined,
|
|
196
227
|
// hover 전용이면 키보드로는 툴팁 내용을 볼 수 없다
|
|
197
|
-
onFocus: tooltip ? showTip : undefined, onBlur: tooltip ? closeTip : undefined, role: onClick ? 'button' : undefined, tabIndex: onClick ? 0 : undefined, "aria-label": onClick ? (ariaLabel ?? [typeof title === 'string' ? title : undefined, totalNum, changeText].filter(v => v !== undefined && v !== null && v !== '').join(' ')) : undefined, "aria-labelledby": !onClick && title != null ? titleId : undefined, children: [tooltipNode, _jsxs("div", { className: withLegacy("chart-section__head"), children: [_jsx(TitleTag, { id: titleId, className: withLegacy(['chart-section__title', resolvedTitleClass].filter(Boolean).join(' ')), children: title }), icon && (_jsx("span", { className: withLegacy("chart-section__head-icon"), children: _jsx(Icon, { icon: icon, className: withLegacy("chart-section__head-icon-inner") }) }))] }), _jsxs("div", { className: withLegacy(
|
|
228
|
+
onFocus: tooltip ? showTip : undefined, onBlur: tooltip ? closeTip : undefined, role: onClick ? 'button' : undefined, tabIndex: onClick ? 0 : undefined, "aria-label": onClick ? (ariaLabel ?? [typeof title === 'string' ? title : undefined, totalNum, changeText].filter(v => v !== undefined && v !== null && v !== '').join(' ')) : undefined, "aria-labelledby": !onClick && title != null ? titleId : undefined, children: [tooltipNode, _jsxs("div", { className: withLegacy("chart-section__head"), children: [_jsx(TitleTag, { id: titleId, className: withLegacy(['chart-section__title', resolvedTitleClass].filter(Boolean).join(' ')), children: title }), icon && (_jsx("span", { className: withLegacy("chart-section__head-icon"), children: _jsx(Icon, { icon: icon, className: withLegacy("chart-section__head-icon-inner") }) }))] }), _jsxs(_Fragment, { children: [_jsxs("div", { className: withLegacy("chart-section__sub-row"), children: [_jsxs(ChartTotal, { children: [_jsx("span", { className: withLegacy([chartTotalNumClass(true), totalMuted && 'chart-section__total__num--muted'].filter(Boolean).join(' ')), children: totalNum }), totalUnit && _jsx("span", { className: withLegacy("chart-section__total__unit body-3"), children: totalUnit })] }), changeText && (_jsx("div", { className: withLegacy(`chart-section__change chart-section__change--${resolvedChangeType ?? 'neutral'} caption-1`), children: changeText }))] }), children && _jsx("div", { className: withLegacy("chart-section__body"), children: children })] })] }));
|
|
198
229
|
}
|
|
199
|
-
return (_jsxs("section", { ref: secRef, className: withLegacy(['chart-section', inGrid && 'chart-section--grid', typeof cardSize === 'string' && CARD_SIZE_CLASS[cardSize], onClick && 'chart-section--clickable', className].filter(Boolean).join(' ')),
|
|
230
|
+
return (_jsxs("section", { ref: secRef, className: withLegacy(['chart-section', inGrid && 'chart-section--grid', fitBody && 'chart-section--fit', typeof cardSize === 'string' && CARD_SIZE_CLASS[cardSize], onClick && 'chart-section--clickable', className].filter(Boolean).join(' ')),
|
|
231
|
+
/* **속이 제 키에 맞추는 카드는 키를 박는다**(사장님 지시 2026-11-02 "높이 260 으로
|
|
232
|
+
고정시키고 그 안에 그래프가 맞춰지도록 해"). `min-height` 만 두면 속이 한 눈금 자라는
|
|
233
|
+
날 카드가 따라 자라고, 두 줄을 차지하는 카드 곁의 바닥이 어긋난다 — 그날 x축이 두
|
|
234
|
+
줄로 돌아가며 260 이 270 이 됐다. 속은 `BarChart fitHeight` 가 맞춘다.
|
|
235
|
+
**`inGrid` 가 아니라 `fitBody` 를 본다** — 격자에 섰어도 속을 안 맞추는 카드를 박으면
|
|
236
|
+
x축이 카드 밖으로 흐른다(고객 통계 여덟, 같은 날). */
|
|
237
|
+
style: {
|
|
238
|
+
...(minHeight === undefined ? null : (fitBody ? { minHeight, height: minHeight } : { minHeight })),
|
|
239
|
+
...(legendHeight == null ? null : { ['--legend-h']: `${legendHeight}px` }),
|
|
240
|
+
}, onClick: onClick ? onCardClick : undefined, onKeyDown: onClick ? onCardKeyDown : undefined, onPointerEnter: tooltip ? showTip : undefined, onPointerLeave: tooltip ? closeTip : undefined, onFocus: tooltip ? showTip : undefined, onBlur: tooltip ? closeTip : undefined, role: onClick ? 'button' : undefined, tabIndex: onClick ? 0 : undefined, "aria-label": onClick ? (ariaLabel ?? (typeof title === 'string' ? title : undefined)) : undefined, "aria-labelledby": !onClick && title != null ? titleId : undefined, children: [tooltip && tipRect && (_jsx(TooltipInfo, { anchorRect: {
|
|
200
241
|
left: tipRect.left,
|
|
201
242
|
top: tipRect.top + 21,
|
|
202
243
|
right: tipRect.right,
|
|
203
244
|
bottom: tipRect.bottom,
|
|
204
245
|
width: tipRect.width,
|
|
205
246
|
height: tipRect.height,
|
|
206
|
-
}, text: tooltip })), headFloat && _jsx(SectionHeadFloat, { children: headFloat }), _jsxs("div", { className: withLegacy("chart-section__head"), children: [_jsxs("div", { className: withLegacy("chart-section__title-row"), children: [icon && _jsx(Icon, { icon: icon, label: typeof title === 'string' ? title : undefined, className: withLegacy("chart-section__icon") }), _jsx(TitleTag, { id: titleId, className: withLegacy(['chart-section__title', resolvedTitleClass].filter(Boolean).join(' ')), children: title })] }), headRightNode, disc && _jsx("div", { className: withLegacy("chart-section__disc body-3"), children: disc })] }), (totalRow || subRow) && (_jsxs("div", { className: withLegacy(['chart-section__sub-row', subRowAlign !== 'start' && `chart-section__sub-row--${subRowAlign}`].filter(Boolean).join(' ')), children: [totalRow, subRow] })), children, menuRect && (_jsx(Tooltip, { anchorRect: menuRect, onClose: closeMenu, ariaLabel: headSegment?.ariaLabel ?? t('tooltip.menu', '메뉴'), children: _jsx(MenuTooltip, { columns: [{ items: menuItems }], onClose: closeMenu, size: "small" }) }))] }));
|
|
247
|
+
}, text: tooltip })), headFloat && _jsx(SectionHeadFloat, { children: headFloat }), _jsxs("div", { className: withLegacy("chart-section__head"), children: [_jsxs("div", { className: withLegacy("chart-section__title-row"), children: [icon && _jsx(Icon, { icon: icon, label: typeof title === 'string' ? title : undefined, className: withLegacy("chart-section__icon") }), _jsx(TitleTag, { id: titleId, className: withLegacy(['chart-section__title', resolvedTitleClass].filter(Boolean).join(' ')), children: title })] }), headRightNode, disc && _jsx("div", { className: withLegacy("chart-section__disc body-3"), children: disc })] }), (totalRow || subRow) && (_jsxs("div", { className: withLegacy(['chart-section__sub-row', subRowAlign !== 'start' && `chart-section__sub-row--${subRowAlign}`].filter(Boolean).join(' ')), children: [totalRow, subRow] })), legend && _jsx("div", { ref: legendRef, className: withLegacy("chart-section__legend-slot"), children: legend }), children, menuRect && (_jsx(Tooltip, { anchorRect: menuRect, onClose: closeMenu, ariaLabel: headSegment?.ariaLabel ?? t('tooltip.menu', '메뉴'), children: _jsx(MenuTooltip, { columns: [{ items: menuItems }], onClose: closeMenu, size: "small" }) }))] }));
|
|
207
248
|
}
|
|
@@ -226,10 +226,12 @@
|
|
|
226
226
|
펼치면(`:hover`·`:focus-within`) 이 아래가 통째로 안 걸리고 넓은 화면 규칙이 그대로
|
|
227
227
|
산다. 못 박아 접어 둔 레일은 호버해도 안 펼쳐지므로 늘 걸린다 — 그래서 선택자가
|
|
228
228
|
둘씩이다. */
|
|
229
|
+
/* 좌우 여백은 **값 하나(`--rail-pad`)로** 정한다(2026-11-03) — 목록이 그 값만큼 밖으로 폈다가
|
|
230
|
+
안으로 되돌리므로, 여기서 패딩을 직접 적으면 둘이 어긋난다. 변수만 바꾼다. */
|
|
229
231
|
.header:not(:hover):not(:focus-within) .side-nav__menu,
|
|
230
232
|
.header--force-collapsed .side-nav__menu {
|
|
231
233
|
/* 좌우는 여백만으로 같다(실측 8px 기준: 좌 9 / 우 9, 항목 52) */
|
|
232
|
-
|
|
234
|
+
--rail-pad: var(--spacing-xs);
|
|
233
235
|
}
|
|
234
236
|
|
|
235
237
|
.header:not(:hover):not(:focus-within) .side-nav__item,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import { jsx as _jsx, jsxs as _jsxs
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import './RingChart.css';
|
|
4
4
|
import { useTranslation } from 'react-i18next';
|
|
5
5
|
import Loader from './Loader';
|
|
@@ -71,7 +71,7 @@ export default function RingChart({ titleKey, titleLevel, headRight, icon, showT
|
|
|
71
71
|
const sectionClassName = className || undefined;
|
|
72
72
|
// 수 칸(ChartSection type="stat")과 같은 아이콘 규칙 — headRight 자리에 렌더(둘 중 하나만 사용)
|
|
73
73
|
const iconNode = icon && (_jsx("span", { className: withLegacy("chart-section__head-icon"), children: _jsx(Icon, { icon: icon, className: withLegacy("chart-section__head-icon-inner") }) }));
|
|
74
|
-
return (_jsx(ChartSection, { className: sectionClassName, size: sectionSize, inGrid: inGrid, onClick: onClick, ariaLabel: ariaLabel, tooltip: tooltip, title: t(titleKey), titleLevel: titleLevel, headRight: iconNode || (isSmall ? undefined : headRight),
|
|
74
|
+
return (_jsx(ChartSection, { className: sectionClassName, size: sectionSize, inGrid: inGrid, onClick: onClick, ariaLabel: ariaLabel, tooltip: tooltip, title: t(titleKey), titleLevel: titleLevel, headRight: iconNode || (isSmall ? undefined : headRight), legend: legend && _jsx(ChartLegend, { items: legend }), subRow: showTotal && (_jsxs(ChartTotal, { label: !isSmall && totalLabelKey ? t(totalLabelKey) : undefined, children: [_jsx("span", { className: withLegacy(chartTotalNumClass(isSmall)), children: pct }), _jsx("span", { className: withLegacy("chart-section__total__unit body-3"), children: "%" })] })), children: loading ? (
|
|
75
75
|
/* 링도 같은 병이 있었다 — 기다림 상자 186px, 그려진 링은 지름(medium 120px)이다.
|
|
76
76
|
**그려질 링과 같은 자리·같은 지름**의 뼈대를 세우고 그 안에서 기다린다
|
|
77
77
|
(BarChart 와 같은 결, 사용자 지시 2026-09-17 "뼈대 먼저, 그 안에서 로딩"). */
|
|
@@ -47,8 +47,16 @@
|
|
|
47
47
|
|
|
48
48
|
잃는 것은 **"더 있다" 는 신호**다. 메뉴가 길어 잘릴 때 막대가 알려 주던 것이 없어진다 —
|
|
49
49
|
항목이 화면을 넘는 일이 드문 자리라 가운데 맞춤을 택했다(사장님 지시 2026-09-25). */
|
|
50
|
-
|
|
51
|
-
|
|
50
|
+
/* **좌우 여백은 여기 있다 — 목록과 발치가 함께 쓴다.** 값은 `--rail-pad` 한 군데서 정한다
|
|
51
|
+
(접힌 레일은 `Header.css` 가 그 변수만 바꾼다 — 그러면 아래 목록의 음수 여백도 따라온다).
|
|
52
|
+
|
|
53
|
+
같은 날 이 여백을 목록으로 **내렸다가 되돌렸다.** 내리면 떠 있는 막대는 제자리를 찾는데
|
|
54
|
+
**발치가 여백을 잃어** 단추 다섯이 메뉴 항목과 11px 어긋나고(항목 13 · 단추 2), 알림 배지가
|
|
55
|
+
`left: -6px` 이라 화면 밖(−4)으로 나갔다(말귀_2 실측 2026-11-03, 폭 1440 · 청 (366)).
|
|
56
|
+
그래서 여백은 여기 두고, **구르는 목록만** 음수 여백으로 그 밖으로 빼낸다(아래). */
|
|
57
|
+
--rail-pad: calc(var(--spacing-s) - 1px);
|
|
58
|
+
padding-left: var(--rail-pad);
|
|
59
|
+
padding-right: var(--rail-pad);
|
|
52
60
|
scrollbar-width: none;
|
|
53
61
|
/* **막대가 끝나는 자리를 내용에 맞춘다.** 스크롤바는 이 통의 위아래 끝까지 그려지는데,
|
|
54
62
|
발치가 제 안쪽에 아래 여백 12px 을 두고 있어 **내용은 12 위에서 끝나고 막대만 바닥까지**
|
|
@@ -63,14 +71,14 @@
|
|
|
63
71
|
border-left: 1px solid transparent;
|
|
64
72
|
border-right: 1px solid transparent;
|
|
65
73
|
background-clip: padding-box;
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
-webkit-overflow-scrolling: touch;
|
|
74
|
+
/* **구르는 것은 목록뿐이다**(사장님 지시 2026-11-03) — 전에는 여기가 통이라 발치까지 함께
|
|
75
|
+
굴러, 칸이 하나 늘자 `설정`·`계정` 이 아래로 잘렸다. 통은 아래 `__menu-list` 가 맡는다. */
|
|
76
|
+
overflow: hidden;
|
|
70
77
|
}
|
|
71
78
|
|
|
72
79
|
/* 표준 속성을 모르는 옛 WebKit 몫 — 접힌 레일과 같은 처리 */
|
|
73
|
-
.side-nav__menu::-webkit-scrollbar
|
|
80
|
+
.side-nav__menu::-webkit-scrollbar,
|
|
81
|
+
.side-nav__menu-list::-webkit-scrollbar { display: none; }
|
|
74
82
|
|
|
75
83
|
/* ── 떠 있는 스크롤 막대 ───────────────────────────────────
|
|
76
84
|
네이티브 막대는 **폭을 정할 수 없고**(전역 `scrollbar-width: thin` 이 이기므로 4px 을 적어도
|
|
@@ -89,8 +97,8 @@
|
|
|
89
97
|
pointer-events: none;
|
|
90
98
|
/* **통의 안쪽 여백 바깥까지 편다.** 안 펴면 이 겹이 내용 폭에서 끝나, 막대가 항목 위에
|
|
91
99
|
얹힌다. 여백만큼 음수로 밀어 두면 막대를 그 **여백 안**에 앉힐 수 있다. */
|
|
92
|
-
margin-left: calc(-1 *
|
|
93
|
-
margin-right: calc(-1 *
|
|
100
|
+
margin-left: calc(-1 * var(--rail-pad));
|
|
101
|
+
margin-right: calc(-1 * var(--rail-pad));
|
|
94
102
|
}
|
|
95
103
|
.side-nav__scroll-thumb {
|
|
96
104
|
position: absolute;
|
|
@@ -115,28 +123,49 @@
|
|
|
115
123
|
.side-nav__scroll-thumb::before {
|
|
116
124
|
content: '';
|
|
117
125
|
position: absolute;
|
|
118
|
-
/* 여백(11) 안에서 좌우로 더 집는다 — 보이는 막대는 6px
|
|
119
|
-
|
|
126
|
+
/* 여백(11) 안에서 좌우로 더 집는다 — 보이는 막대는 6px 그대로.
|
|
127
|
+
**오른쪽은 1px 뿐이다** — 통(`__menu-list`)의 오른쪽 여백이 거기서 끝난다. 전에는 양쪽 4 라
|
|
128
|
+
오른쪽 3px 이 통 밖으로 나가 가로 넘침으로 잡혔다(실측 2026-11-03, 폭 1440: `scrollWidth`
|
|
129
|
+
208 · `clientWidth` 194 중 3). 그만큼을 **왼쪽으로 옮겨** 잡는 폭(18)은 되레 넓혔다. */
|
|
130
|
+
inset: 0 -1px 0 -11px;
|
|
120
131
|
}
|
|
121
132
|
.side-nav__scroll-thumb:hover,
|
|
122
133
|
.side-nav__scroll-thumb:active {
|
|
123
134
|
background: var(--color-lightGray);
|
|
124
135
|
}
|
|
125
136
|
|
|
126
|
-
/* ── list:
|
|
137
|
+
/* ── list: **구르는 통**(2026-11-03) — 발치는 밖에 남아 늘 보인다 ─────────────── */
|
|
127
138
|
.side-nav__menu-list {
|
|
128
139
|
display: flex;
|
|
129
140
|
flex-direction: column;
|
|
130
141
|
gap: 4px;
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
142
|
+
/* 남으면 늘어나 발치를 아래로 밀고, 모자라면 **제가 줄어 구른다**(`min-height: 0` 이 없으면
|
|
143
|
+
flex 자식이 제 속보다 안 줄어 통이 안 생긴다). 2026-11-03 전에는 `1 0 auto` 라 안 줄었고,
|
|
144
|
+
넘친 만큼이 부모(통)에서 굴러 **발치까지 함께 내려갔다.** */
|
|
145
|
+
flex: 1 1 auto;
|
|
146
|
+
min-height: 0;
|
|
147
|
+
overflow-y: auto;
|
|
148
|
+
overflow-x: hidden;
|
|
149
|
+
overscroll-behavior: contain;
|
|
150
|
+
-webkit-overflow-scrolling: touch;
|
|
151
|
+
/* 네이티브 막대는 안 쓴다 — 위 `__scroll-thumb` 를 직접 그린다(까닭은 그 글에) */
|
|
152
|
+
scrollbar-width: none;
|
|
134
153
|
/* 예전엔 padding: 4px 16px + margin: 0 -16px 였는데 좌우가 정확히 상쇄돼
|
|
135
154
|
항목 위치에는 아무 영향이 없고, 폭만 228px로 부풀어 부모(220px)를 넘었다
|
|
136
155
|
(overflow-x: hidden에 잘려 보이지 않았을 뿐).
|
|
137
156
|
**위 여백 4px 은 통 바깥(margin-top)으로 옮겼다** — 안에 두면 막대가 첫 단추보다 그만큼
|
|
138
157
|
위에서 시작한다(2026-09-25). 아래 4px 은 발치와의 사이라 그대로 둔다. */
|
|
139
158
|
padding: 0 0 4px;
|
|
159
|
+
/* **통은 여백 밖까지 펴고, 여백은 제가 다시 둔다**(2026-11-03). 떠 있는 막대는 음수 여백으로
|
|
160
|
+
**통의 여백 안**에 앉는데, 통이 여백 안쪽에서 끝나면 막대가 통 밖으로 나가 잘린다(실측: 막대
|
|
161
|
+
211~217 · 통은 207 에서 끝 — 통째로 안 보이고 못 잡혔다).
|
|
162
|
+
그렇다고 여백을 통으로 **옮기면** 발치가 그것을 잃는다(위 글). 그래서 **둘 다 한다** —
|
|
163
|
+
밖으로 폈다가(`margin`) 안으로 되돌린다(`padding`). 항목 자리는 그대로고(좌우 틈 12/12),
|
|
164
|
+
막대가 앉을 11px 이 통 **안**에 생긴다. 두 수는 늘 같아야 하므로 한 변수를 쓴다. */
|
|
165
|
+
margin-left: calc(-1 * var(--rail-pad));
|
|
166
|
+
margin-right: calc(-1 * var(--rail-pad));
|
|
167
|
+
padding-left: var(--rail-pad);
|
|
168
|
+
padding-right: var(--rail-pad);
|
|
140
169
|
}
|
|
141
170
|
|
|
142
171
|
/* ── footer: 항상 list 아래에 위치, 줄어들지 않음 ─────────────────────────── */
|
|
@@ -134,7 +134,7 @@ export default function SideNav(props) {
|
|
|
134
134
|
if (e.currentTarget.hasPointerCapture(e.pointerId))
|
|
135
135
|
e.currentTarget.releasePointerCapture(e.pointerId);
|
|
136
136
|
}, []);
|
|
137
|
-
return (_jsxs("nav", {
|
|
137
|
+
return (_jsxs("nav", { "aria-label": t('nav.mainMenu', '메인 메뉴'), className: "side-nav__menu", children: [_jsxs("div", { ref: containerRef, className: "side-nav__menu-list", children: [thumb && (_jsx("div", { className: "side-nav__scroll", "aria-hidden": "true", children: _jsx("div", { className: "side-nav__scroll-thumb", style: { top: thumb.top, height: thumb.height }, onPointerDown: onThumbDown, onPointerMove: onThumbMove, onPointerUp: onThumbUp, onPointerCancel: onThumbUp }) })), (items || [])
|
|
138
138
|
.filter((it) => !it.section && (it.key || it.label))
|
|
139
139
|
.map((it, idx) => (_jsxs(React.Fragment, { children: [it.divider && _jsx("div", { className: "side-nav__separator" }), _jsx(SideNavButton, { item: it, active: !!it.key && it.key === activeKey, state: it.disabled ? 'disabled' : undefined, onClick: (_key, btnEl, fromPointer) => {
|
|
140
140
|
if (it.disabled)
|
|
@@ -82,6 +82,15 @@
|
|
|
82
82
|
gap: var(--spacing-xs);
|
|
83
83
|
}
|
|
84
84
|
|
|
85
|
+
/* **다음 칸까지 쓴 카드는 그 칸을 채운다**(사장님 지시 2026-11-02 — "가로가 길면 다음 칸
|
|
86
|
+
까지 사용하도록 해야지?"). 칸을 넓히는 것은 `useWideCardSpans` 가 재서 하고, 넓은 칸에
|
|
87
|
+
`data-wide` 를 찍는다. 채우지 않으면 단추가 제 글 폭에 머물러 **오른쪽이 빈다**
|
|
88
|
+
(실측 2026-11-02: 칸 408 · 단추 262 · 빈 틈 146). `min-width` 는 인라인으로 200 이
|
|
89
|
+
박혀 있어 `width` 로 덮는다. */
|
|
90
|
+
.word-search-result-block__items > [data-wide] > button {
|
|
91
|
+
width: 100%;
|
|
92
|
+
}
|
|
93
|
+
|
|
85
94
|
/* 묶음 버튼 라벨(단어·발음)은 단어 중간에서 개행되지 않게 — 각 단어는 한 줄 유지. */
|
|
86
95
|
.word-search-result-block__items .button__label-text,
|
|
87
96
|
.word-search-result-block__items .button__sub-label-text {
|
|
@@ -3,6 +3,7 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
3
3
|
import { cx } from '../../utils/cx';
|
|
4
4
|
import { compareKorean } from '../../utils/textSort';
|
|
5
5
|
import { useEscToClose } from '../../hooks/useEscToClose';
|
|
6
|
+
import { useWideCardSpans } from '../../hooks/useWideCardSpans';
|
|
6
7
|
import { useState, useCallback, useMemo, useEffect, useId } from 'react';
|
|
7
8
|
import { useTranslation } from 'react-i18next';
|
|
8
9
|
import './WordSearchResultBlock.css';
|
|
@@ -177,6 +178,10 @@ export default function WordSearchResultBlock({ titleIcon, resultCount, resultUn
|
|
|
177
178
|
const discNode = disc ?? discLabel;
|
|
178
179
|
/* 상자 안에 **머리 한 줄만** 남는가 — 결과도 없고 빈 말도 안 세우는 그 꼴이다 */
|
|
179
180
|
const noResults = groups ? groups.length === 0 : items.length === 0;
|
|
181
|
+
/* **칸보다 넓은 묶음은 다음 칸까지 쓴다**(사장님 지시 2026-11-02 — "가로가 길면 다음 칸
|
|
182
|
+
까지 사용하도록 해야지?"). 재서 `grid-column` 을 적는 일이라 고리가 든다 — 까닭은
|
|
183
|
+
`useWideCardSpans` 에 적었다. 목록·쪽·정렬이 바뀌면 다시 잰다. */
|
|
184
|
+
const cardSpans = useWideCardSpans([groups, pagedItems, sortKey, pageSize, page]);
|
|
180
185
|
const isHeadOnly = noResults && !showEmptyText && !emptyHint;
|
|
181
186
|
return (
|
|
182
187
|
/* 제목·부제·조작부가 **상자 안** 에 선다(사용자 지시 2026-09-29) — 전에는 `Section` 의 머리가
|
|
@@ -187,7 +192,7 @@ export default function WordSearchResultBlock({ titleIcon, resultCount, resultUn
|
|
|
187
192
|
과 아주 같은 h4 로 맞췄는데, 그러니 결과 덩이의 머리가 그 위 판 제목들(`검색 옵션` ·
|
|
188
193
|
`단어 검색 설정`)과 같은 급이 되어 **무엇이 무엇의 머리인지 안 보였다.** 거르개 판은
|
|
189
194
|
결과를 고르는 도구고 이 덩이는 그 결과라, 나란한 것이 아니라 아래 딸린 것이다. */
|
|
190
|
-
_jsxs(Section, { type: sectionType, className: cx('word-search-result-block', className), children: [_jsxs("div", { className: cx('word-search-result-block__inner', isHeadOnly && 'word-search-result-block__inner--head-only'), children: [(titleLabel || toolbar || discNode) && (_jsxs("div", { className: "word-search-result-block__head", children: [_jsxs("div", { className: "word-search-result-block__head-main", children: [titleIcon && _jsx(Icon, { icon: titleIcon, className: "word-search-result-block__head-icon" }), titleLabel && _jsx("span", { className: "word-search-result-block__title h3", children: titleLabel })] }), toolbar && _jsx("div", { className: "word-search-result-block__head-actions", children: toolbar }), discNode && _jsx("div", { className: "word-search-result-block__head-disc body-3", children: discNode })] })), noResults && (showEmptyText || emptyHint) && (_jsxs("div", { className: "word-search-result-block__empty-wrap", children: [showEmptyText && _jsx("p", { className: "word-search-result-block__empty body-3", children: t('wordSearch.emptyResult', '검색 결과가 없습니다.') }), emptyHint && _jsx("p", { className: "word-search-result-block__empty-hint body-3", children: emptyHint })] })), groups ? ((pagedGroups ?? []).map((group) => (
|
|
195
|
+
_jsxs(Section, { type: sectionType, className: cx('word-search-result-block', className), children: [_jsxs("div", { ref: cardSpans, className: cx('word-search-result-block__inner', isHeadOnly && 'word-search-result-block__inner--head-only'), children: [(titleLabel || toolbar || discNode) && (_jsxs("div", { className: "word-search-result-block__head", children: [_jsxs("div", { className: "word-search-result-block__head-main", children: [titleIcon && _jsx(Icon, { icon: titleIcon, className: "word-search-result-block__head-icon" }), titleLabel && _jsx("span", { className: "word-search-result-block__title h3", children: titleLabel })] }), toolbar && _jsx("div", { className: "word-search-result-block__head-actions", children: toolbar }), discNode && _jsx("div", { className: "word-search-result-block__head-disc body-3", children: discNode })] })), noResults && (showEmptyText || emptyHint) && (_jsxs("div", { className: "word-search-result-block__empty-wrap", children: [showEmptyText && _jsx("p", { className: "word-search-result-block__empty body-3", children: t('wordSearch.emptyResult', '검색 결과가 없습니다.') }), emptyHint && _jsx("p", { className: "word-search-result-block__empty-hint body-3", children: emptyHint })] })), groups ? ((pagedGroups ?? []).map((group) => (
|
|
191
196
|
/* **묶음 이름을 머리로 그린다**(말귀 청 (308), 2026-10-19).
|
|
192
197
|
`pagedGroups` 가 `label` 을 들고 왔는데 **그리는 자리에서 안 썼다** — 받은 이름이
|
|
193
198
|
`key` 로만 쓰이고 사라져, 보는 사람은 어느 자리가 갈린 쌍인지 모른 채 한 덩어리로
|
|
@@ -81,3 +81,26 @@ export declare function monthOptionsNow(): {
|
|
|
81
81
|
* @public
|
|
82
82
|
*/
|
|
83
83
|
export declare function weekLabel(t: TFunction, week: number): string;
|
|
84
|
+
/**
|
|
85
|
+
* **차트 카드 머리에 들어가는 짧은 주 이름표** — 영어 `Week 4` 대신 `W4`. @public
|
|
86
|
+
*
|
|
87
|
+
* `weekLabel` 과 **갈라 둔 까닭**: 긴 꼴을 쓰는 자리가 셋인데(차트 막대 밑글 · 고르개 ·
|
|
88
|
+
* 회원앱 `periodLabel`) 그중 **고르개만** 폭이 모자란다. `calendar.weekLabel` 을 통째로
|
|
89
|
+
* 줄이면 나머지 둘의 글까지 바뀐다 — 그래서 `yearMonthCompact` 가 `yearMonth` 의 짧은
|
|
90
|
+
* 짝인 것과 **같은 꼴로** 짝을 하나 둔다. 글귀는 여전히 사전이 쥔다.
|
|
91
|
+
*
|
|
92
|
+
* **왜 짧아야 하나**(실측 2026-11-03 · 카드 540 · 속 폭 500 · 글자 16px):
|
|
93
|
+
* `Sep 2026 Week 4` 는 상자가 **180** 이 되어 제목에 **96** 만 남고, 그러면 실제 영어 제목
|
|
94
|
+
* 셋(`Training Details` 105 · `Homework Detail` 117 · `Homework Completed` 153)에서
|
|
95
|
+
* **머리가 두 줄로 접힌다**(키 32 → 59). 그 카드는 머리가 한 줄이어야 260 을 지킨다.
|
|
96
|
+
* `W4` 로 줄이면 상자 **151** · 제목 **125** 로 넷이 한 줄에 선다.
|
|
97
|
+
*
|
|
98
|
+
* **한국어는 긴 꼴과 같은 값을 적는다** — `첫째주` 가 이미 짧아 줄일 것이 없다
|
|
99
|
+
* (`2026.10 다섯째주` 116 · 상자 166 · 제목 110, 한 줄). 안 적고 아래 물러섬에 맡기려
|
|
100
|
+
* 했는데 **사전 짝 못이 막았다**(`i18nLocaleParity` — *"en 에 있는 열쇠는 ko 에도 있다,
|
|
101
|
+
* 한쪽만 지우면 고아가 남는다"*). 그 못이 옳다 — 짝이 없는 열쇠는 번역을 빠뜨린 것과
|
|
102
|
+
* 일부러 안 적은 것이 **글자로 안 갈린다.** 그래서 같은 값을 적어 둔다.
|
|
103
|
+
*
|
|
104
|
+
* 아래 물러섬은 **두 말 밖**을 위해 남긴다 — 짧은 꼴이 없는 말이 들어오면 긴 꼴로 선다.
|
|
105
|
+
*/
|
|
106
|
+
export declare function weekLabelCompact(t: TFunction, week: number): string;
|
|
@@ -204,3 +204,33 @@ export function weekLabel(t, week) {
|
|
|
204
204
|
숫자 그대로(`'1'`…)여서 `Week {{ord}}` 가 같은 변수로 맞는다. */
|
|
205
205
|
return t('calendar.weekLabel', { ord: ord ?? String(week + 1) });
|
|
206
206
|
}
|
|
207
|
+
/**
|
|
208
|
+
* **차트 카드 머리에 들어가는 짧은 주 이름표** — 영어 `Week 4` 대신 `W4`. @public
|
|
209
|
+
*
|
|
210
|
+
* `weekLabel` 과 **갈라 둔 까닭**: 긴 꼴을 쓰는 자리가 셋인데(차트 막대 밑글 · 고르개 ·
|
|
211
|
+
* 회원앱 `periodLabel`) 그중 **고르개만** 폭이 모자란다. `calendar.weekLabel` 을 통째로
|
|
212
|
+
* 줄이면 나머지 둘의 글까지 바뀐다 — 그래서 `yearMonthCompact` 가 `yearMonth` 의 짧은
|
|
213
|
+
* 짝인 것과 **같은 꼴로** 짝을 하나 둔다. 글귀는 여전히 사전이 쥔다.
|
|
214
|
+
*
|
|
215
|
+
* **왜 짧아야 하나**(실측 2026-11-03 · 카드 540 · 속 폭 500 · 글자 16px):
|
|
216
|
+
* `Sep 2026 Week 4` 는 상자가 **180** 이 되어 제목에 **96** 만 남고, 그러면 실제 영어 제목
|
|
217
|
+
* 셋(`Training Details` 105 · `Homework Detail` 117 · `Homework Completed` 153)에서
|
|
218
|
+
* **머리가 두 줄로 접힌다**(키 32 → 59). 그 카드는 머리가 한 줄이어야 260 을 지킨다.
|
|
219
|
+
* `W4` 로 줄이면 상자 **151** · 제목 **125** 로 넷이 한 줄에 선다.
|
|
220
|
+
*
|
|
221
|
+
* **한국어는 긴 꼴과 같은 값을 적는다** — `첫째주` 가 이미 짧아 줄일 것이 없다
|
|
222
|
+
* (`2026.10 다섯째주` 116 · 상자 166 · 제목 110, 한 줄). 안 적고 아래 물러섬에 맡기려
|
|
223
|
+
* 했는데 **사전 짝 못이 막았다**(`i18nLocaleParity` — *"en 에 있는 열쇠는 ko 에도 있다,
|
|
224
|
+
* 한쪽만 지우면 고아가 남는다"*). 그 못이 옳다 — 짝이 없는 열쇠는 번역을 빠뜨린 것과
|
|
225
|
+
* 일부러 안 적은 것이 **글자로 안 갈린다.** 그래서 같은 값을 적어 둔다.
|
|
226
|
+
*
|
|
227
|
+
* 아래 물러섬은 **두 말 밖**을 위해 남긴다 — 짧은 꼴이 없는 말이 들어오면 긴 꼴로 선다.
|
|
228
|
+
*/
|
|
229
|
+
export function weekLabelCompact(t, week) {
|
|
230
|
+
const ords = t('calendar.weekOrdinal', { returnObjects: true, defaultValue: [] });
|
|
231
|
+
const ord = Array.isArray(ords) && typeof ords[week] === 'string' ? ords[week] : null;
|
|
232
|
+
const value = ord ?? String(week + 1);
|
|
233
|
+
/* 짧은 꼴이 없으면 **빈 글자**가 오고(`defaultValue: ''`), 그때 긴 꼴로 간다 —
|
|
234
|
+
`exists()` 없이 "사전에 있나" 를 가르는 이 저장소의 결이다(`yearMonthLabel` 참고). */
|
|
235
|
+
return t('calendar.weekLabelCompact', { ord: value, defaultValue: '' }) || weekLabel(t, week);
|
|
236
|
+
}
|
|
@@ -71,6 +71,14 @@ export interface BarChartProps {
|
|
|
71
71
|
* 모든 차트의 막대 셈을 흔들 일이 아니다.
|
|
72
72
|
*/
|
|
73
73
|
canvasHeight?: number;
|
|
74
|
+
/** **카드에 남은 자리에 판을 맞춘다** — 카드 키가 박혀 있는 자리(사장님 지시 2026-11-02
|
|
75
|
+
* "높이 260 으로 고정시키고 그 안에 그래프가 맞춰지도록 해").
|
|
76
|
+
*
|
|
77
|
+
* `canvasHeight` 는 **손으로 맞춘 수**라, 머리·x축이 한 눈금만 달라져도 카드가 그만큼
|
|
78
|
+
* 넘치거나 모자랐다(2026-11-02 에 x축이 두 줄로 돌아가며 260 이 270 이 됐다 — 격자에서
|
|
79
|
+
* 곁 카드의 바닥이 어긋났다). 이것을 켜면 **그린 뒤 남은 키를 재서** 쓰므로 그 손질이
|
|
80
|
+
* 필요 없다. 카드가 제 키를 고정하고 있어야 뜻이 있다(`inGrid` 격자 카드). */
|
|
81
|
+
fitHeight?: boolean;
|
|
74
82
|
/** 섹션 제목 i18n 키 */
|
|
75
83
|
titleKey: string;
|
|
76
84
|
/** 제목을 머리글 몇 급으로 그릴지 — 그대로 `ChartSection` 에 넘긴다(말귀 요청 (60)③, 2026-10-02).
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { useState, useEffect, useMemo, useCallback } from 'react';
|
|
3
3
|
import { useTranslation } from 'react-i18next';
|
|
4
|
-
import { firstMondayOfMonth, todayWeekValue, monthOptionsNow,
|
|
5
|
-
import { yearMonthLabel } from '../utils/date';
|
|
4
|
+
import { firstMondayOfMonth, todayWeekValue, monthOptionsNow, weekLabelCompact } from './barChartData';
|
|
5
|
+
import { yearMonthLabel, formatYearMonthShort } from '../utils/date';
|
|
6
6
|
import { weekValueOf } from './barChartMonthKey';
|
|
7
7
|
/**
|
|
8
8
|
* BarChart 기간 상태/옵션/네비게이션을 캡슐화한 훅.
|
|
@@ -26,13 +26,6 @@ export function useBarChartControl(data) {
|
|
|
26
26
|
}
|
|
27
27
|
return opts;
|
|
28
28
|
}, [DATA_MONTH_OPTIONS]);
|
|
29
|
-
/* **짧은 연월** — `2026년 11월` 이 아니라 `2026.11`(사장님 지시 2026-11-02 —
|
|
30
|
-
"2026.11 첫째주 로 글씨 줄이고"). 고르개가 **차트 카드 머리에 다른 조절칸 셋과 한 줄로
|
|
31
|
-
서는데**, 긴 꼴로는 그 줄이 카드 폭을 넘어 제목이 아랫줄로 접혔다(실측 2026-11-02,
|
|
32
|
-
카드 540: 조절칸 416 + 제목 113 > 속 폭 502).
|
|
33
|
-
|
|
34
|
-
`yearMonthLabel`(Intl) 은 **그대로 둔다** — 달력 머리줄(`Calendar`)이 쓰는 자리라
|
|
35
|
-
거기까지 줄이면 달력이 달을 읽기 어려워진다. 짧은 꼴은 사전이 쥔다. */
|
|
36
29
|
/**
|
|
37
30
|
* **짧은 연월** — `2026년 11월` 이 아니라 `2026.11`(사장님 지시 2026-11-02 —
|
|
38
31
|
* "2026.11 첫째주 로 글씨 줄이고"). 고르개가 차트 카드 머리에 다른 조절칸 셋과 한 줄로
|
|
@@ -40,16 +33,27 @@ export function useBarChartControl(data) {
|
|
|
40
33
|
* 조절칸 416 + 제목 113 > 속 폭 502).
|
|
41
34
|
*
|
|
42
35
|
* **어느 꼴로 적을지는 사전이 고른다** — 코드가 말을 보고 가르지 않는다(`langBranchInDict`).
|
|
43
|
-
* 숫자(`year`·`month`)와 Intl 이 지은
|
|
44
|
-
* 숫자를, 영어 사전은
|
|
45
|
-
* `yearMonthEverySite`)
|
|
36
|
+
* 숫자(`year`·`month`)와 Intl 이 지은 두 꼴(`full`·`short`)을 **다 넘기고**, 한국어 사전은
|
|
37
|
+
* 숫자를, 영어 사전은 **줄인 꼴**을 쓴다. 영어에 **달 이름이 보여야 하는 것은 그대로**이고
|
|
38
|
+
* (`yearMonthEverySite`) `Sep` 도 달 이름이다 — 줄인 것은 이름이 아니라 길이다.
|
|
39
|
+
*
|
|
40
|
+
* **영어가 긴 꼴을 쓰던 동안 이름표가 잘렸다**(청 (365), 실측 2026-11-03). 카드 540 ·
|
|
41
|
+
* 글자 16px 에서 이름표 칸은 **100**인데 `September 2026 Week 4` 는 **179** 가 필요해
|
|
42
|
+
* `September …` 로 끊겼다 — **주 수가 통째로 사라지는** 자리다. 상자를 글에 맞춰 늘리면
|
|
43
|
+
* 229 가 되어 **머리가 두 줄로 접힌다**(32 → 63). 줄인 꼴은 가장 긴 `May 2026 Week 4` 가
|
|
44
|
+
* **130**(상자 180)이라 한 줄에 선다. `yearMonthLabel`(긴 꼴)은 그대로 둔다 — 달력
|
|
45
|
+
* 머리줄이 쓰는 자리다.
|
|
46
46
|
*/
|
|
47
47
|
const yearMonthShort = useCallback((year, month) => t('calendar.yearMonthCompact', {
|
|
48
48
|
year, month,
|
|
49
49
|
full: yearMonthLabel(t, i18n.language, year, month),
|
|
50
|
+
short: formatYearMonthShort(year, month, i18n.language),
|
|
50
51
|
defaultValue: '{{full}}',
|
|
51
52
|
}), [t, i18n.language]);
|
|
52
|
-
|
|
53
|
+
/* **주 이름표도 짧은 꼴을 쓴다**(`weekLabelCompact`, 영어 `W4`) — 긴 꼴이면 상자가 180 이
|
|
54
|
+
되어 제목에 96 만 남고 실제 영어 제목 셋에서 머리가 두 줄로 접힌다(청 (365) 실측). 막대
|
|
55
|
+
밑글과 회원앱 `periodLabel` 은 긴 꼴을 그대로 쓴다 — 모자란 것은 이 자리의 폭뿐이다. */
|
|
56
|
+
const weekOptionLabel = useCallback((o) => `${yearMonthShort(o.year, o.month)} ${weekLabelCompact(t, o.week)}`, [t, yearMonthShort]);
|
|
53
57
|
const monthOptions = useMemo(() => DATA_MONTH_OPTIONS.map(o => ({
|
|
54
58
|
value: o.value, label: yearMonthShort(o.year, o.month),
|
|
55
59
|
})), [yearMonthShort, DATA_MONTH_OPTIONS]);
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* **칸보다 넓은 카드는 다음 칸까지 쓴다**(사장님 지시 2026-11-02 — *"가로가 길면 다음 칸
|
|
3
|
+
* 까지 사용하도록 해야지?"*).
|
|
4
|
+
*
|
|
5
|
+
* 낱말 묶음 격자는 **200px 고정 열**인데(`repeat(auto-fill, 200px)`), 그 안의 단추는
|
|
6
|
+
* 글 길이만큼 넓어진다(`min-width: 200px` 이고 넘침을 안 감춘다). 그래서 긴 묶음이 들면
|
|
7
|
+
* **단추가 제 칸을 넘어 옆 칸 위로 삐져나가고, 옆 카드가 그 위에 그려져 잘린 것처럼 보인다.**
|
|
8
|
+
*
|
|
9
|
+
* **아무 자도 그걸 못 잡는다** — `scrollWidth` 는 격자가 아니라 제 상자를 재니 멀쩡하고
|
|
10
|
+
* (실측 2026-11-02: 단추 `scrollWidth` 260 = `clientWidth` 260, 넘침 0으로 읽힌다),
|
|
11
|
+
* `overflow` 는 `visible` 이라 구르지도 잘리지도 않는다. 눈으로만 잡히던 자리다.
|
|
12
|
+
*
|
|
13
|
+
* 실측(2026-11-02 · 폭 1420 · 50묶음) — 열 200 × 6 · 틈 8. `가운뎃손가락 다리미질하다
|
|
14
|
+
* 콘트라베이스` 한 묶음이 **단추 262px** 라 62px 이 옆 칸을 덮었다. 두 칸이면 408px 이라 든다.
|
|
15
|
+
*
|
|
16
|
+
* ## 왜 CSS 로 못 하나
|
|
17
|
+
*
|
|
18
|
+
* 격자는 **칸 수를 글 길이로 못 정한다.** `max-content` 로 열을 잡으면 **가장 긴 묶음의 폭이
|
|
19
|
+
* 모든 열에 퍼져** 짧은 묶음 사이가 휑해지고(이 파일 CSS 머리말에 그 자취가 있다),
|
|
20
|
+
* `1fr` 로 늘리면 단추가 열을 못 채워 같은 일이 난다. 그래서 **재서 칸 수를 적는다.**
|
|
21
|
+
*
|
|
22
|
+
* 그리기 **직후에** 잰다(`useLayoutEffect`) — 효과가 늦으면 한 틱 동안 덮인 채 보인다.
|
|
23
|
+
* 폭이 바뀌면 열 수가 달라지므로 `ResizeObserver` 로 다시 잰다.
|
|
24
|
+
*
|
|
25
|
+
* @param deps 다시 재야 하는 때(묶음 목록·쪽·정렬이 바뀔 때).
|
|
26
|
+
* @returns 격자들을 **감싸는** 자리에 다는 자리표(격자 자체가 아니다 — 여럿일 수 있다).
|
|
27
|
+
*/
|
|
28
|
+
export declare function useWideCardSpans(deps?: readonly unknown[]): import("react").RefObject<HTMLDivElement | null>;
|