@ihabdevteam/core 0.481.0 → 0.483.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.
@@ -1402,12 +1402,14 @@ declare interface ChartHeadSegment {
1402
1402
  /** 지금 고른 칸의 열쇠 */
1403
1403
  value: string;
1404
1404
  onChange: (key: string) => void;
1405
- /** 칸들. `icon` 은 접힌 메뉴에서만 쓰인다(고르개는 글자만). */
1405
+ /** 칸들. `icon` 은 접힌 메뉴에서만 쓰인다(고르개는 글자만). `disabledReason` 은 펼친 고르개에서 꺼진 칸에 올리면
1406
+ * 뜬다(`SegmentedOption.disabledReason`, 청 (477)) — 접힌 '⋯' 메뉴에는 아직 안 선다. */
1406
1407
  options: {
1407
1408
  key: string;
1408
1409
  label: string;
1409
1410
  icon?: string;
1410
1411
  disabled?: boolean;
1412
+ disabledReason?: string;
1411
1413
  }[];
1412
1414
  /** 고르개·메뉴의 이름(낭독기) */
1413
1415
  ariaLabel?: string;
@@ -2279,7 +2281,7 @@ export declare function copyText(text: string): Promise<boolean>;
2279
2281
  *
2280
2282
  * 값은 손으로 적고 `test/coreVersion.test.ts` 가 package.json 과 어긋나면 운다.
2281
2283
  */
2282
- export declare const CORE_VERSION = "0.481.0";
2284
+ export declare const CORE_VERSION = "0.483.0";
2283
2285
 
2284
2286
  /** @public */
2285
2287
  declare const coreDefault: Record<string, unknown>;
@@ -6347,10 +6349,8 @@ declare type PanelRowProps = PanelRowToggle | PanelRowSegmented | PanelRowDropdo
6347
6349
 
6348
6350
  export declare type PanelRowSegmented = Base & {
6349
6351
  variant: 'segmented';
6350
- options: {
6351
- key: string;
6352
- label: string;
6353
- }[];
6352
+ /** `SegmentedOption` 그대로 — `disabled` · `disabledReason`(청 (477)) · `count` 도 받는다 */
6353
+ options: SegmentedOption[];
6354
6354
  value: string;
6355
6355
  onChange: (v: string) => void;
6356
6356
  size?: 32 | 40 | 48;
@@ -7145,11 +7145,9 @@ export declare interface PopupProps {
7145
7145
  headerSegment?: {
7146
7146
  value: string;
7147
7147
  onChange: (key: string) => void;
7148
- options: {
7149
- key: string;
7150
- label: string;
7151
- disabled?: boolean;
7152
- }[];
7148
+ /** `SegmentedOption` 그대로 — 골라 넘기지 않는다. 셋(key·label·disabled)만 골라 넘겨 `disabledReason`(청 (477))이
7149
+ * 창 머리에서만 떨어졌다(말귀 실측 2026-11-20, 숙제 상세 창). 칸 꼴이 늘면 여기도 저절로 따라간다. */
7150
+ options: SegmentedOption[];
7153
7151
  ariaLabel?: string;
7154
7152
  };
7155
7153
  /** 커스텀 footer 래퍼에 추가할 클래스 (정렬·간격 override용) */
@@ -10877,6 +10875,18 @@ export declare interface TrainingBlockProps {
10877
10875
  onMore?: (item: TrainingItem, e: MouseEvent_2) => void;
10878
10876
  /** 섹션 타입: 기본 page, 팝업 페이지 pagePopup, 팝업 내 popup */
10879
10877
  sectionType?: 'page' | 'pagePopup' | 'popup';
10878
+ /**
10879
+ * **자료를 기다리는 중** — 항목이 아직 없는 동안 카드 자리만큼 빈 칸을 세워 묶음의 키를 잡는다(말귀 청 (478)).
10880
+ *
10881
+ * 안 주면 항목이 빈 동안 머리만 서 있다가 자료가 오면 묶음이 몇 배로 자라 아래 묶음을 밀었다(말귀 실측: 폰 390,
10882
+ * 묶음 셋이 87px → 380px 남짓, layout-shift 0.21). 빈 칸은 **카드와 같은 클래스**(`training-block-button` · 크기 꼴)를
10883
+ * 써서 크기를 CSS 한 곳에서 받는다 — 카드 크기가 바뀌어도 따라간다.
10884
+ *
10885
+ * 항목이 하나라도 오면 빈 칸 대신 항목을 그린다(이 값이 아직 true 여도).
10886
+ */
10887
+ loading?: boolean;
10888
+ /** `loading` 동안 세울 빈 칸 수. 기본 4 — 넓은 창에서 한 줄, 폰(두 열)에서 두 줄. 올 항목 수를 알면 그 수를 준다(20 까지). */
10889
+ placeholderCount?: number;
10880
10890
  }
10881
10891
 
10882
10892
  /** @public */
@@ -50,12 +50,14 @@ export interface ChartHeadSegment {
50
50
  /** 지금 고른 칸의 열쇠 */
51
51
  value: string;
52
52
  onChange: (key: string) => void;
53
- /** 칸들. `icon` 은 접힌 메뉴에서만 쓰인다(고르개는 글자만). */
53
+ /** 칸들. `icon` 은 접힌 메뉴에서만 쓰인다(고르개는 글자만). `disabledReason` 은 펼친 고르개에서 꺼진 칸에 올리면
54
+ * 뜬다(`SegmentedOption.disabledReason`, 청 (477)) — 접힌 '⋯' 메뉴에는 아직 안 선다. */
54
55
  options: {
55
56
  key: string;
56
57
  label: string;
57
58
  icon?: string;
58
59
  disabled?: boolean;
60
+ disabledReason?: string;
59
61
  }[];
60
62
  /** 고르개·메뉴의 이름(낭독기) */
61
63
  ariaLabel?: string;
@@ -226,7 +226,7 @@ export default function ChartSection({ type = 'chart', title, titleClassName, ti
226
226
  0.176.0 까지는 머리 오른쪽에 한 줄로 섰다 — 사용자가 차트 카드의 그 꼴로 정했다(2026-09-17). */
227
227
  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;
228
228
  /* 머리 오른쪽에는 **고르개와 `headRight` 만** 남는다 — 고르개가 먼저, 상세보기 단추가 오른쪽 끝(사용자 지시 2026-09-17) */
229
- 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;
229
+ 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, disabledReason: o.disabledReason })), value: headSegment.value, onChange: headSegment.onChange }))), rightNode] })) : null;
230
230
  /* **범례가 큰 수 줄보다 길면 그만큼 줄을 넓힌다**(사장님 지시 2026-11-03 "legend 이 선 위로").
231
231
  범례는 서브로우 밖에 띄워 세우므로 줄 키에 안 든다 — 계열이 셋이 되자 55px 이 되어 **첫 눈금선을
232
232
  10px 넘었다**(실측 2026-11-03: 범례 바닥 113 · 눈금선 103). 위로 키우면 머리의 고르개와 겹치니,
@@ -1,4 +1,5 @@
1
1
  import type { ReactNode, KeyboardEvent } from 'react';
2
+ import { type SegmentedOption } from './SegmentedControl';
2
3
  import type { DeviceEntry, DeviceSide } from './HearingDeviceInfo';
3
4
  import './Panel.css';
4
5
  /**
@@ -29,10 +30,8 @@ export type PanelRowToggle = Base & {
29
30
  };
30
31
  export type PanelRowSegmented = Base & {
31
32
  variant: 'segmented';
32
- options: {
33
- key: string;
34
- label: string;
35
- }[];
33
+ /** `SegmentedOption` 그대로 — `disabled` · `disabledReason`(청 (477)) · `count` 도 받는다 */
34
+ options: SegmentedOption[];
36
35
  value: string;
37
36
  onChange: (v: string) => void;
38
37
  size?: 32 | 40 | 48;
@@ -1,5 +1,6 @@
1
1
  import { type ReactNode } from "react";
2
2
  import { type ButtonVariant } from "../Button";
3
+ import { type SegmentedOption } from "../SegmentedControl";
3
4
  import "./Popup.css";
4
5
  /** @public */
5
6
  export type PopupOptions = {
@@ -43,11 +44,9 @@ export interface PopupProps {
43
44
  headerSegment?: {
44
45
  value: string;
45
46
  onChange: (key: string) => void;
46
- options: {
47
- key: string;
48
- label: string;
49
- disabled?: boolean;
50
- }[];
47
+ /** `SegmentedOption` 그대로 — 골라 넘기지 않는다. 셋(key·label·disabled)만 골라 넘겨 `disabledReason`(청 (477))이
48
+ * 창 머리에서만 떨어졌다(말귀 실측 2026-11-20, 숙제 상세 창). 칸 꼴이 늘면 여기도 저절로 따라간다. */
49
+ options: SegmentedOption[];
51
50
  ariaLabel?: string;
52
51
  };
53
52
  /** 커스텀 footer 래퍼에 추가할 클래스 (정렬·간격 override용) */
@@ -262,7 +262,7 @@ export default function Popup(props) {
262
262
  max-height(CSS)가 height 보다 이기므로 화면보다 크게 줘도 화면에 맞춰진다 */
263
263
  style: hasHeight && height !== 'full' ? { '--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
264
264
  ? _jsx("h2", { id: titleId, className: "popup-title popup-title--left h2", children: title })
265
- : _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, "data-more-below": moreBelow && !(footerStart || footerEnd || (buttons && buttons.length > 0) || footer) ? '' : undefined, children: _jsx("div", { className: "popup-content__inner", children: typeof children === 'function' ? children({ animateThen, closeWithAnimation }) : children }) }), (footerStart || footerEnd) ? (
265
+ : _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, 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, "data-more-below": moreBelow && !(footerStart || footerEnd || (buttons && buttons.length > 0) || footer) ? '' : undefined, children: _jsx("div", { className: "popup-content__inner", children: typeof children === 'function' ? children({ animateThen, closeWithAnimation }) : children }) }), (footerStart || footerEnd) ? (
266
266
  /* 왼쪽·오른쪽 덩이 — 빈 덩이도 그린다(자리를 지켜야 오른쪽이 끝에 선다).
267
267
  `footerLayout` 은 보지 않는다: 이 줄 자체가 배치다. */
268
268
  _jsxs("div", { className: `popup-footer popup-footer--bar${footerClassName ? ` ${footerClassName}` : ''}`, children: [_jsx("div", { className: "popup-footer__start", children: typeof footerStart === 'function' ? footerStart({ animateThen, closeWithAnimation }) : footerStart }), _jsx("div", { className: "popup-footer__end", children: typeof footerEnd === 'function' ? footerEnd({ animateThen, closeWithAnimation }) : footerEnd })] })) : buttons?.length ? (_jsx("div", { className: `popup-footer popup-footer--buttons${footerLayout !== 'center' ? ` popup-footer--${footerLayout}` : ''}`, children: buttons.map((btn, i) => (_jsx(Button, { htmlType: "button", size: 48, variant: btn.variant ?? 'default', label: btn.label, disabled: btn.disabled, onClick: () => btn.onClick?.({ animateThen, closeWithAnimation }) }, i))) })) : footer ? (_jsx("div", { className: `popup-footer${footerLayout !== 'center' ? ` popup-footer--${footerLayout}` : ''}${footerClassName ? ` ${footerClassName}` : ''}`, children: typeof footer === 'function' ? footer({ animateThen, closeWithAnimation }) : footer })) : null] }) }));
@@ -45,6 +45,18 @@ export interface TrainingBlockProps {
45
45
  onMore?: (item: TrainingItem, e: MouseEvent) => void;
46
46
  /** 섹션 타입: 기본 page, 팝업 페이지 pagePopup, 팝업 내 popup */
47
47
  sectionType?: 'page' | 'pagePopup' | 'popup';
48
+ /**
49
+ * **자료를 기다리는 중** — 항목이 아직 없는 동안 카드 자리만큼 빈 칸을 세워 묶음의 키를 잡는다(말귀 청 (478)).
50
+ *
51
+ * 안 주면 항목이 빈 동안 머리만 서 있다가 자료가 오면 묶음이 몇 배로 자라 아래 묶음을 밀었다(말귀 실측: 폰 390,
52
+ * 묶음 셋이 87px → 380px 남짓, layout-shift 0.21). 빈 칸은 **카드와 같은 클래스**(`training-block-button` · 크기 꼴)를
53
+ * 써서 크기를 CSS 한 곳에서 받는다 — 카드 크기가 바뀌어도 따라간다.
54
+ *
55
+ * 항목이 하나라도 오면 빈 칸 대신 항목을 그린다(이 값이 아직 true 여도).
56
+ */
57
+ loading?: boolean;
58
+ /** `loading` 동안 세울 빈 칸 수. 기본 4 — 넓은 창에서 한 줄, 폰(두 열)에서 두 줄. 올 항목 수를 알면 그 수를 준다(20 까지). */
59
+ placeholderCount?: number;
48
60
  }
49
61
  /** @public */
50
62
  export default function TrainingBlock(props: TrainingBlockProps): import("react").JSX.Element;
@@ -12,7 +12,7 @@ const BTN_COUNT_MAX = 20;
12
12
  /** @public */
13
13
  export default function TrainingBlock(props) {
14
14
  const { t } = useTranslation();
15
- const { type, trainingDatas, depth, renderPopup, completedIds, selectedIds, onItemComplete, size, useDescriptionTooltip, onRemove, onMore, sectionType = 'page' } = props || {};
15
+ const { type, trainingDatas, depth, renderPopup, completedIds, selectedIds, onItemComplete, size, useDescriptionTooltip, onRemove, onMore, sectionType = 'page', loading = false, placeholderCount = 4 } = props || {};
16
16
  const [, setDataTick] = useState(0);
17
17
  const explicitlyProvided = typeof trainingDatas !== 'undefined';
18
18
  const itemsAll = explicitlyProvided ? (Array.isArray(trainingDatas) ? trainingDatas : []) : [];
@@ -48,15 +48,19 @@ export default function TrainingBlock(props) {
48
48
  return;
49
49
  listRef.current?.querySelectorAll('.training-block-button')[firstNew]?.focus();
50
50
  }, [visible]);
51
- return (_jsxs(Section, { type: sectionType, title: type?.label, icon: type?.icon, disc: type?.desc, className: "training-block", children: [_jsx("div", { className: "training-list", ref: listRef, children: (itemsAll || []).slice(0, visible).map((item, idx) => {
52
- const itemForBtn = item;
53
- const depthForBtn = depthLabel;
54
- return (_jsx(TrainingBlockButton, { index: idx, type: type, trainingData: itemForBtn, depth: depthForBtn, renderPopup: renderPopup, completedIds: completedIds, selectedIds: selectedIds, size: size, useDescriptionTooltip: useDescriptionTooltip, onRemove: typeof onRemove === 'function' && selectedIds != null && itemForBtn?.id != null && selectedIds.has(String(itemForBtn.id))
55
- ? () => onRemove(itemForBtn)
56
- : undefined, onComplete: typeof onItemComplete === 'function' && itemForBtn?.id != null
57
- ? () => onItemComplete(String(itemForBtn.id))
58
- : undefined, onMore: typeof onMore === 'function'
59
- ? (e) => onMore(itemForBtn, e)
60
- : undefined }, itemForBtn?.id != null ? `${type?.key || 't'}-${String(itemForBtn.id)}` : `${type?.key || 't'}-${idx}`));
61
- }) }), total > BTN_COUNT_MAX && visible < total && (_jsx("div", { className: "training-block__more", children: _jsx(Button, { htmlType: "button", size: 48, type: "bar", icon: "plus", onClick: loadMore, ariaLabel: t('common.loadMore', '더보기'), label: t('common.loadMore', '더보기'), variant: "main" }) }))] }));
51
+ /* 기다리는 동안의 빈 칸 — 카드와 같은 크기 클래스를 단다(크기는 TrainingBlockButton.css 한 곳이 정한다) */
52
+ const showPlaceholders = loading && total === 0;
53
+ const placeholderN = showPlaceholders ? Math.max(0, Math.min(BTN_COUNT_MAX, Math.floor(placeholderCount))) : 0;
54
+ const sizeClass = size === 'small' ? ' training-block-button--small' : size === 'list' ? ' training-block-button--list' : '';
55
+ return (_jsxs(Section, { type: sectionType, title: type?.label, icon: type?.icon, disc: type?.desc, className: "training-block", children: [_jsxs("div", { className: "training-list", ref: listRef, "aria-busy": showPlaceholders ? true : undefined, children: [Array.from({ length: placeholderN }, (_, i) => (_jsx("div", { className: `training-block-button training-block-button--placeholder${sizeClass}`, "aria-hidden": "true" }, `placeholder-${i}`))), (itemsAll || []).slice(0, visible).map((item, idx) => {
56
+ const itemForBtn = item;
57
+ const depthForBtn = depthLabel;
58
+ return (_jsx(TrainingBlockButton, { index: idx, type: type, trainingData: itemForBtn, depth: depthForBtn, renderPopup: renderPopup, completedIds: completedIds, selectedIds: selectedIds, size: size, useDescriptionTooltip: useDescriptionTooltip, onRemove: typeof onRemove === 'function' && selectedIds != null && itemForBtn?.id != null && selectedIds.has(String(itemForBtn.id))
59
+ ? () => onRemove(itemForBtn)
60
+ : undefined, onComplete: typeof onItemComplete === 'function' && itemForBtn?.id != null
61
+ ? () => onItemComplete(String(itemForBtn.id))
62
+ : undefined, onMore: typeof onMore === 'function'
63
+ ? (e) => onMore(itemForBtn, e)
64
+ : undefined }, itemForBtn?.id != null ? `${type?.key || 't'}-${String(itemForBtn.id)}` : `${type?.key || 't'}-${idx}`));
65
+ })] }), total > BTN_COUNT_MAX && visible < total && (_jsx("div", { className: "training-block__more", children: _jsx(Button, { htmlType: "button", size: 48, type: "bar", icon: "plus", onClick: loadMore, ariaLabel: t('common.loadMore', '더보기'), label: t('common.loadMore', '더보기'), variant: "main" }) }))] }));
62
66
  }
@@ -482,3 +482,18 @@
482
482
  min-height: 170px;
483
483
  }
484
484
  }
485
+
486
+ /* ── 기다리는 동안의 빈 칸(`TrainingBlock loading`, 말귀 청 (478)) ──
487
+ 크기는 위 `.training-block-button`(과 크기 꼴)에서 그대로 받는다 — 여기에 200/190/170 을 다시 적지 않는다.
488
+ 누를 수 없고 그림자·테두리 없이 옅은 바탕만 선다. */
489
+ .training-block-button--placeholder {
490
+ cursor: default;
491
+ pointer-events: none;
492
+ background: var(--color-darkWhite);
493
+ border-color: transparent;
494
+ box-shadow: none;
495
+ }
496
+ .training-block-button--placeholder:hover {
497
+ border-color: transparent;
498
+ box-shadow: none;
499
+ }
@@ -46,4 +46,4 @@
46
46
  *
47
47
  * 값은 손으로 적고 `test/coreVersion.test.ts` 가 package.json 과 어긋나면 운다.
48
48
  */
49
- export declare const CORE_VERSION = "0.481.0";
49
+ export declare const CORE_VERSION = "0.483.0";
@@ -46,4 +46,4 @@
46
46
  *
47
47
  * 값은 손으로 적고 `test/coreVersion.test.ts` 가 package.json 과 어긋나면 운다.
48
48
  */
49
- export const CORE_VERSION = '0.481.0';
49
+ export const CORE_VERSION = '0.483.0';