@t3q-ui/design-system 1.61.5 → 1.63.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 +20 -0
- package/dist/chunk-DWF6AFPQ.js +409 -0
- package/dist/chunk-DWF6AFPQ.js.map +1 -0
- package/dist/{chunk-AUPWLUH4.cjs → chunk-ESAMXUUJ.cjs} +2269 -1131
- package/dist/chunk-ESAMXUUJ.cjs.map +1 -0
- package/dist/{chunk-SRHKL4LJ.js → chunk-GZZXYYDY.js} +2187 -1051
- package/dist/chunk-GZZXYYDY.js.map +1 -0
- package/dist/chunk-OQOBPYZT.cjs +443 -0
- package/dist/chunk-OQOBPYZT.cjs.map +1 -0
- package/dist/{index-DYwapUZv.d.cts → index-DoIChamr.d.cts} +178 -2
- package/dist/{index-DYwapUZv.d.ts → index-DoIChamr.d.ts} +178 -2
- package/dist/index.cjs +1146 -1799
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +12 -0
- package/dist/index.css.map +1 -1
- package/dist/index.d.cts +61 -12
- package/dist/index.d.ts +61 -12
- package/dist/index.js +584 -1264
- package/dist/index.js.map +1 -1
- package/dist/markdown/index.cjs +412 -0
- package/dist/markdown/index.cjs.map +1 -0
- package/dist/markdown/index.d.cts +24 -0
- package/dist/markdown/index.d.ts +24 -0
- package/dist/markdown/index.js +405 -0
- package/dist/markdown/index.js.map +1 -0
- package/dist/patterns/index.cjs +586 -69
- package/dist/patterns/index.cjs.map +1 -1
- package/dist/patterns/index.d.cts +120 -3
- package/dist/patterns/index.d.ts +120 -3
- package/dist/patterns/index.js +520 -5
- package/dist/patterns/index.js.map +1 -1
- package/dist/styles.css +23 -0
- package/mcp/manifests/components.json +2695 -113
- package/package.json +19 -2
- package/skills/tds/SKILL.md +5 -4
- package/skills/tds/examples/chat-page.tsx +313 -0
- package/skills/tds/examples/detail-page.tsx +5 -4
- package/skills/tds/reference/components.md +245 -17
- package/skills/tds/rules.md +1 -1
- package/dist/chunk-AUPWLUH4.cjs.map +0 -1
- package/dist/chunk-SRHKL4LJ.js.map +0 -1
package/dist/patterns/index.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { ChatMessage, Skeleton, EmptyBoxIllustration, Button, LucideIcon, ToggleGroup, ToggleGroupItem, PageHeader, Alert, AlertDescription, AgGridTable, getSortedColumnState, Pagination, Panel, Form, FormSectionLevelContext, FormFooter, Card, Drawer, DrawerContent, DrawerHeader, DrawerTitle, DrawerDescription, DrawerBody, DrawerFooter, Dialog, DialogContent, DialogHeader, DialogTitle, DialogDescription, DialogFooter, ChatHistory, TwoLineCellRenderer, ChatComposer, DropdownMenu, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator } from '../chunk-GZZXYYDY.js';
|
|
2
|
+
import { cn, TablePagination, IconButton } from '../chunk-DWF6AFPQ.js';
|
|
3
|
+
import { memo, useRef, useEffect, useMemo, useId, useState, useCallback, useLayoutEffect, isValidElement } from 'react';
|
|
4
|
+
import { RotateCcw, X, PanelLeft, TriangleAlert, ArrowDown, Ellipsis } from 'lucide-react';
|
|
5
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
5
6
|
|
|
6
7
|
// src/patterns/listPageRules.ts
|
|
7
8
|
function resolvePrimaryField(primaryField, hasRowClick) {
|
|
@@ -864,7 +865,521 @@ function DashboardPanel({
|
|
|
864
865
|
body
|
|
865
866
|
] });
|
|
866
867
|
}
|
|
868
|
+
var useIsoLayoutEffect = typeof window === "undefined" ? useEffect : useLayoutEffect;
|
|
869
|
+
var isEmpty = (content) => content == null || content === "" || content === false;
|
|
870
|
+
var MessageRow = memo(function MessageRow2({
|
|
871
|
+
item,
|
|
872
|
+
streaming,
|
|
873
|
+
canRegenerate,
|
|
874
|
+
onRegenerate,
|
|
875
|
+
onFeedback,
|
|
876
|
+
headingLevel
|
|
877
|
+
}) {
|
|
878
|
+
const regenerate = onRegenerate ? () => onRegenerate(item.id) : void 0;
|
|
879
|
+
return /* @__PURE__ */ jsx(
|
|
880
|
+
ChatMessage,
|
|
881
|
+
{
|
|
882
|
+
from: item.role,
|
|
883
|
+
headingLevel,
|
|
884
|
+
pending: streaming && isEmpty(item.content),
|
|
885
|
+
streaming,
|
|
886
|
+
error: item.error,
|
|
887
|
+
onRetry: item.error ? regenerate : void 0,
|
|
888
|
+
attachments: item.attachments,
|
|
889
|
+
sources: item.sources,
|
|
890
|
+
meta: item.meta,
|
|
891
|
+
actions: item.actions,
|
|
892
|
+
copyText: item.copyText,
|
|
893
|
+
onRegenerate: canRegenerate && !item.error ? regenerate : void 0,
|
|
894
|
+
onFeedback: onFeedback ? (value) => onFeedback(item.id, value) : void 0,
|
|
895
|
+
feedback: item.feedback,
|
|
896
|
+
children: item.content
|
|
897
|
+
}
|
|
898
|
+
);
|
|
899
|
+
});
|
|
900
|
+
var STATUS = {
|
|
901
|
+
generating: "\uC751\uB2F5\uC744 \uC0DD\uC131\uD558\uACE0 \uC788\uC2B5\uB2C8\uB2E4",
|
|
902
|
+
done: "\uC751\uB2F5\uC774 \uC644\uB8CC\uB418\uC5C8\uC2B5\uB2C8\uB2E4",
|
|
903
|
+
stopped: "\uC751\uB2F5 \uC0DD\uC131\uC744 \uC911\uC9C0\uD588\uC2B5\uB2C8\uB2E4",
|
|
904
|
+
failed: "\uC751\uB2F5\uC744 \uC0DD\uC131\uD558\uC9C0 \uBABB\uD588\uC2B5\uB2C8\uB2E4"
|
|
905
|
+
};
|
|
906
|
+
function ChatHeader({
|
|
907
|
+
title,
|
|
908
|
+
level,
|
|
909
|
+
historyToggle,
|
|
910
|
+
status,
|
|
911
|
+
titleRight,
|
|
912
|
+
actions
|
|
913
|
+
}) {
|
|
914
|
+
if (title == null && !historyToggle && !titleRight && !actions) return null;
|
|
915
|
+
const Heading = level === 1 ? "h1" : "h2";
|
|
916
|
+
return /* @__PURE__ */ jsxs("header", { className: "flex shrink-0 items-center justify-between gap-[12px] border-b border-sys-divider-subtler bg-sys-background px-[16px] py-[8px]", children: [
|
|
917
|
+
/* @__PURE__ */ jsxs("div", { className: "flex min-w-0 items-center gap-[8px]", children: [
|
|
918
|
+
title != null ? /* @__PURE__ */ jsx(
|
|
919
|
+
Heading,
|
|
920
|
+
{
|
|
921
|
+
className: cn("truncate text-sys-text-main", level === 1 ? "text-h4" : "text-h5"),
|
|
922
|
+
children: title
|
|
923
|
+
}
|
|
924
|
+
) : null,
|
|
925
|
+
status ? /* @__PURE__ */ jsx("div", { className: "flex shrink-0 items-center", children: status }) : null,
|
|
926
|
+
historyToggle
|
|
927
|
+
] }),
|
|
928
|
+
titleRight || actions ? /* @__PURE__ */ jsxs("div", { className: "flex shrink-0 items-center gap-[8px]", children: [
|
|
929
|
+
titleRight,
|
|
930
|
+
actions
|
|
931
|
+
] }) : null
|
|
932
|
+
] });
|
|
933
|
+
}
|
|
934
|
+
function ChatConversation({
|
|
935
|
+
variant,
|
|
936
|
+
label,
|
|
937
|
+
messages,
|
|
938
|
+
streaming = false,
|
|
939
|
+
onSend,
|
|
940
|
+
onStop,
|
|
941
|
+
onRegenerate,
|
|
942
|
+
onFeedback,
|
|
943
|
+
welcome,
|
|
944
|
+
note,
|
|
945
|
+
loading = false,
|
|
946
|
+
error,
|
|
947
|
+
onRetry,
|
|
948
|
+
...composerProps
|
|
949
|
+
}) {
|
|
950
|
+
const logRef = useRef(null);
|
|
951
|
+
const endRef = useRef(null);
|
|
952
|
+
const composerRef = useRef(null);
|
|
953
|
+
const atBottomRef = useRef(true);
|
|
954
|
+
const [atBottom, setAtBottom] = useState(true);
|
|
955
|
+
const sentRef = useRef(false);
|
|
956
|
+
const [ownHeight, setOwnHeight] = useState(true);
|
|
957
|
+
const contentRef = useRef(null);
|
|
958
|
+
const last = messages[messages.length - 1];
|
|
959
|
+
const waiting = streaming && (last == null || last.role === "user");
|
|
960
|
+
const lastFailed = Boolean(last?.error);
|
|
961
|
+
const empty = messages.length === 0 && !waiting;
|
|
962
|
+
const headingLevel = variant === "page" ? 2 : 3;
|
|
963
|
+
const [announce, setAnnounce] = useState("");
|
|
964
|
+
const [stopped, setStopped] = useState(false);
|
|
965
|
+
const [prevStreaming, setPrevStreaming] = useState(streaming);
|
|
966
|
+
if (prevStreaming !== streaming) {
|
|
967
|
+
setPrevStreaming(streaming);
|
|
968
|
+
setAnnounce(
|
|
969
|
+
streaming ? STATUS.generating : stopped ? STATUS.stopped : lastFailed ? STATUS.failed : STATUS.done
|
|
970
|
+
);
|
|
971
|
+
if (streaming) setStopped(false);
|
|
972
|
+
}
|
|
973
|
+
useEffect(() => {
|
|
974
|
+
const log = logRef.current;
|
|
975
|
+
if (!log || typeof ResizeObserver === "undefined") return;
|
|
976
|
+
const ro = new ResizeObserver(() => {
|
|
977
|
+
const content = contentRef.current;
|
|
978
|
+
setOwnHeight(
|
|
979
|
+
log.scrollHeight > log.clientHeight + 1 || content != null && log.clientHeight > content.offsetHeight + 1
|
|
980
|
+
);
|
|
981
|
+
});
|
|
982
|
+
ro.observe(log);
|
|
983
|
+
if (contentRef.current) ro.observe(contentRef.current);
|
|
984
|
+
return () => ro.disconnect();
|
|
985
|
+
}, [empty, loading, error]);
|
|
986
|
+
useEffect(() => {
|
|
987
|
+
const el = endRef.current;
|
|
988
|
+
const log = logRef.current;
|
|
989
|
+
if (!el || !log || typeof IntersectionObserver === "undefined") return;
|
|
990
|
+
const io = new IntersectionObserver(
|
|
991
|
+
(entries) => {
|
|
992
|
+
const visible = entries[entries.length - 1]?.isIntersecting ?? true;
|
|
993
|
+
atBottomRef.current = visible;
|
|
994
|
+
setAtBottom(visible);
|
|
995
|
+
},
|
|
996
|
+
{ root: ownHeight ? log : null }
|
|
997
|
+
);
|
|
998
|
+
io.observe(el);
|
|
999
|
+
return () => io.disconnect();
|
|
1000
|
+
}, [empty, loading, error, ownHeight]);
|
|
1001
|
+
const scrollToEnd = useCallback((moveDocument) => {
|
|
1002
|
+
const log = logRef.current;
|
|
1003
|
+
if (!log) return;
|
|
1004
|
+
if (log.scrollHeight > log.clientHeight + 1) log.scrollTop = log.scrollHeight;
|
|
1005
|
+
else if (moveDocument) endRef.current?.scrollIntoView({ block: "nearest" });
|
|
1006
|
+
}, []);
|
|
1007
|
+
useEffect(() => {
|
|
1008
|
+
const content = contentRef.current;
|
|
1009
|
+
const log = logRef.current;
|
|
1010
|
+
if (!content || !log || typeof ResizeObserver === "undefined") return;
|
|
1011
|
+
const ro = new ResizeObserver(() => {
|
|
1012
|
+
if (atBottomRef.current) scrollToEnd(sentRef.current);
|
|
1013
|
+
});
|
|
1014
|
+
ro.observe(content);
|
|
1015
|
+
ro.observe(log);
|
|
1016
|
+
return () => ro.disconnect();
|
|
1017
|
+
}, [empty, loading, error, scrollToEnd]);
|
|
1018
|
+
const dockRef = useRef(null);
|
|
1019
|
+
const dockTopRef = useRef(null);
|
|
1020
|
+
const centered = empty && variant === "page";
|
|
1021
|
+
useIsoLayoutEffect(() => {
|
|
1022
|
+
const el = dockRef.current;
|
|
1023
|
+
const from = dockTopRef.current;
|
|
1024
|
+
if (!el || from == null || typeof el.animate !== "function") return;
|
|
1025
|
+
if (window.matchMedia?.("(prefers-reduced-motion: reduce)").matches) return;
|
|
1026
|
+
const delta = from - el.getBoundingClientRect().top;
|
|
1027
|
+
if (Math.abs(delta) < 1) return;
|
|
1028
|
+
el.animate([{ transform: `translateY(${delta}px)` }, { transform: "translateY(0)" }], {
|
|
1029
|
+
// 0.15초 — 보내자마자 입력창이 제자리를 찾게 짧게(디자이너 지정 2026-11-18). 기록 바·옆 패널은 0.3초
|
|
1030
|
+
duration: 150,
|
|
1031
|
+
easing: "ease-in-out"
|
|
1032
|
+
});
|
|
1033
|
+
}, [centered]);
|
|
1034
|
+
useIsoLayoutEffect(() => {
|
|
1035
|
+
dockTopRef.current = dockRef.current?.getBoundingClientRect().top ?? null;
|
|
1036
|
+
});
|
|
1037
|
+
const send = (text) => {
|
|
1038
|
+
dockTopRef.current = dockRef.current?.getBoundingClientRect().top ?? dockTopRef.current;
|
|
1039
|
+
atBottomRef.current = true;
|
|
1040
|
+
sentRef.current = true;
|
|
1041
|
+
onSend(text);
|
|
1042
|
+
};
|
|
1043
|
+
const stop = onStop ? () => {
|
|
1044
|
+
setStopped(true);
|
|
1045
|
+
onStop();
|
|
1046
|
+
} : void 0;
|
|
1047
|
+
const composer = /* @__PURE__ */ jsx(
|
|
1048
|
+
ChatComposer,
|
|
1049
|
+
{
|
|
1050
|
+
ref: composerRef,
|
|
1051
|
+
...composerProps,
|
|
1052
|
+
onSubmit: send,
|
|
1053
|
+
streaming,
|
|
1054
|
+
onStop: stop
|
|
1055
|
+
}
|
|
1056
|
+
);
|
|
1057
|
+
const noteLine = note ? /* @__PURE__ */ jsx("p", { className: "m-0 text-center text-small-regular-h text-sys-text-subtler", children: note }) : null;
|
|
1058
|
+
const suggestions = welcome?.suggestions?.length ? /* @__PURE__ */ jsx("ul", { className: "m-0 flex list-none flex-wrap justify-center gap-[8px] p-0", children: welcome.suggestions.map((text) => /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx(
|
|
1059
|
+
Button,
|
|
1060
|
+
{
|
|
1061
|
+
type: "button",
|
|
1062
|
+
variant: "secondaryOutline",
|
|
1063
|
+
shape: "rounded",
|
|
1064
|
+
weight: "medium",
|
|
1065
|
+
disabled: composerProps.disabled || streaming,
|
|
1066
|
+
onClick: () => send(text),
|
|
1067
|
+
children: text
|
|
1068
|
+
}
|
|
1069
|
+
) }, text)) }) : null;
|
|
1070
|
+
const greeting = welcome ? /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center gap-[8px] text-center", children: [
|
|
1071
|
+
/* @__PURE__ */ jsx("p", { className: "m-0 text-h2 text-primary30", children: welcome.title }),
|
|
1072
|
+
welcome.description ? /* @__PURE__ */ jsx("p", { className: "m-0 break-keep text-base-regular text-sys-text-subtle wrap-break-word", children: welcome.description }) : null
|
|
1073
|
+
] }) : null;
|
|
1074
|
+
const status = /* @__PURE__ */ jsx("div", { role: "status", "aria-live": "polite", "aria-atomic": "true", className: "sr-only", children: announce });
|
|
1075
|
+
if (loading || error) {
|
|
1076
|
+
return /* @__PURE__ */ jsxs("div", { className: "flex min-h-0 flex-1 flex-col", children: [
|
|
1077
|
+
/* @__PURE__ */ jsx("div", { className: "flex min-h-0 flex-1 items-center justify-center px-[24px] py-[32px]", children: loading ? /* @__PURE__ */ jsx(LoadingState, { className: "w-full max-w-[768px]", lines: 4 }) : /* @__PURE__ */ jsx(ErrorState, { title: "\uB300\uD654\uB97C \uBD88\uB7EC\uC624\uC9C0 \uBABB\uD588\uC2B5\uB2C8\uB2E4", description: error, onRetry }) }),
|
|
1078
|
+
status
|
|
1079
|
+
] });
|
|
1080
|
+
}
|
|
1081
|
+
return /* @__PURE__ */ jsxs(
|
|
1082
|
+
"div",
|
|
1083
|
+
{
|
|
1084
|
+
className: cn(
|
|
1085
|
+
"flex min-h-0 flex-1 flex-col",
|
|
1086
|
+
// 바탕 그라데이션 층이 이 상자 밖으로 내려가지 않게 쌓임 맥락을 만든다
|
|
1087
|
+
empty && "relative isolate",
|
|
1088
|
+
centered && "justify-center py-[32px]"
|
|
1089
|
+
),
|
|
1090
|
+
children: [
|
|
1091
|
+
empty ? (
|
|
1092
|
+
// 빈 대화의 바탕 — PageHeader 와 같은 그라데이션 토큰을 절반 세기로(더 은은하게). 라이트·다크 모두 토큰을 따른다.
|
|
1093
|
+
// 첫 메시지를 보내면 사라진다(대화 중에는 글 읽기에 방해가 되지 않게 흰 바탕)
|
|
1094
|
+
/* @__PURE__ */ jsx(
|
|
1095
|
+
"div",
|
|
1096
|
+
{
|
|
1097
|
+
"aria-hidden": true,
|
|
1098
|
+
className: "pointer-events-none absolute inset-0 -z-10 bg-[image:var(--color-page-header-bg)] opacity-50"
|
|
1099
|
+
}
|
|
1100
|
+
)
|
|
1101
|
+
) : null,
|
|
1102
|
+
/* @__PURE__ */ jsxs(
|
|
1103
|
+
"div",
|
|
1104
|
+
{
|
|
1105
|
+
ref: logRef,
|
|
1106
|
+
role: "log",
|
|
1107
|
+
"aria-label": label,
|
|
1108
|
+
"aria-live": "off",
|
|
1109
|
+
tabIndex: empty ? void 0 : 0,
|
|
1110
|
+
className: cn(
|
|
1111
|
+
"outline-none focus-visible:ring-[2px] focus-visible:ring-inset focus-visible:ring-sys-focus-ring-main",
|
|
1112
|
+
centered ? "shrink-0" : "min-h-0 flex-1 overflow-y-auto"
|
|
1113
|
+
),
|
|
1114
|
+
children: [
|
|
1115
|
+
empty ? /* @__PURE__ */ jsxs(
|
|
1116
|
+
"div",
|
|
1117
|
+
{
|
|
1118
|
+
className: cn(
|
|
1119
|
+
"flex flex-col items-center justify-center gap-[24px] px-[24px]",
|
|
1120
|
+
centered ? "pb-[24px]" : "min-h-full py-[32px]"
|
|
1121
|
+
),
|
|
1122
|
+
children: [
|
|
1123
|
+
greeting,
|
|
1124
|
+
suggestions
|
|
1125
|
+
]
|
|
1126
|
+
}
|
|
1127
|
+
) : /* @__PURE__ */ jsxs(
|
|
1128
|
+
"div",
|
|
1129
|
+
{
|
|
1130
|
+
ref: contentRef,
|
|
1131
|
+
className: "mx-auto flex w-full max-w-[768px] flex-col gap-[24px] px-[24px] pt-[24px] pb-[32px]",
|
|
1132
|
+
children: [
|
|
1133
|
+
messages.map((item, i) => {
|
|
1134
|
+
const isLast = i === messages.length - 1;
|
|
1135
|
+
return /* @__PURE__ */ jsx(
|
|
1136
|
+
MessageRow,
|
|
1137
|
+
{
|
|
1138
|
+
item,
|
|
1139
|
+
streaming: streaming && isLast && item.role === "assistant",
|
|
1140
|
+
canRegenerate: isLast && item.role === "assistant" && !streaming,
|
|
1141
|
+
onRegenerate,
|
|
1142
|
+
onFeedback,
|
|
1143
|
+
headingLevel
|
|
1144
|
+
},
|
|
1145
|
+
item.id
|
|
1146
|
+
);
|
|
1147
|
+
}),
|
|
1148
|
+
waiting ? /* @__PURE__ */ jsx(ChatMessage, { from: "assistant", pending: true, headingLevel }) : null
|
|
1149
|
+
]
|
|
1150
|
+
}
|
|
1151
|
+
),
|
|
1152
|
+
/* @__PURE__ */ jsx("div", { ref: endRef, "aria-hidden": true, className: "pointer-events-none -mt-[32px] h-[32px]" })
|
|
1153
|
+
]
|
|
1154
|
+
}
|
|
1155
|
+
),
|
|
1156
|
+
/* @__PURE__ */ jsx(
|
|
1157
|
+
"div",
|
|
1158
|
+
{
|
|
1159
|
+
ref: dockRef,
|
|
1160
|
+
className: cn(
|
|
1161
|
+
"shrink-0 px-[24px]",
|
|
1162
|
+
// 대화 중에는 아래로 지나가는 메시지를 가린다. 빈 대화는 지나갈 것이 없어 바탕 그라데이션이 비치게 둔다
|
|
1163
|
+
!empty && "bg-sys-background",
|
|
1164
|
+
// sticky 는 부모 높이가 없을 때만 — 높이가 있으면 입력창은 이미 맨 아래다. 늘 걸어 두면 잘라 내는(overflow) 조상이
|
|
1165
|
+
// 대화보다 낮을 때(축소 미리보기 등) 그 조상 바닥에 맞춰 입력창이 위로 끌려 올라간다
|
|
1166
|
+
!centered && "pb-[16px]",
|
|
1167
|
+
!centered && !ownHeight && "sticky bottom-0"
|
|
1168
|
+
),
|
|
1169
|
+
children: /* @__PURE__ */ jsxs("div", { className: "relative mx-auto flex w-full max-w-[768px] flex-col gap-[8px]", children: [
|
|
1170
|
+
!atBottom && !empty ? /* @__PURE__ */ jsx(
|
|
1171
|
+
IconButton,
|
|
1172
|
+
{
|
|
1173
|
+
variant: "outline",
|
|
1174
|
+
shape: "rounded",
|
|
1175
|
+
"aria-label": "\uB9E8 \uC544\uB798\uB85C \uC774\uB3D9",
|
|
1176
|
+
className: "absolute -top-[12px] left-1/2 -translate-x-1/2 -translate-y-full bg-sys-background shadow-gray-small",
|
|
1177
|
+
onClick: () => {
|
|
1178
|
+
atBottomRef.current = true;
|
|
1179
|
+
scrollToEnd(true);
|
|
1180
|
+
composerRef.current?.focus();
|
|
1181
|
+
},
|
|
1182
|
+
children: /* @__PURE__ */ jsx(ArrowDown, { size: 20 })
|
|
1183
|
+
}
|
|
1184
|
+
) : null,
|
|
1185
|
+
composer,
|
|
1186
|
+
noteLine
|
|
1187
|
+
] })
|
|
1188
|
+
}
|
|
1189
|
+
),
|
|
1190
|
+
status
|
|
1191
|
+
]
|
|
1192
|
+
}
|
|
1193
|
+
);
|
|
1194
|
+
}
|
|
1195
|
+
var SIDE_WIDTH = {
|
|
1196
|
+
small: "w-[360px]",
|
|
1197
|
+
medium: "w-[480px]"
|
|
1198
|
+
};
|
|
1199
|
+
var HISTORY_INLINE_MIN = 960;
|
|
1200
|
+
var SIDE_INLINE_MIN = 1280;
|
|
1201
|
+
function useWidth(ref) {
|
|
1202
|
+
const [width, setWidth] = useState(Number.POSITIVE_INFINITY);
|
|
1203
|
+
useEffect(() => {
|
|
1204
|
+
const el = ref.current;
|
|
1205
|
+
if (!el || typeof ResizeObserver === "undefined") return;
|
|
1206
|
+
const ro = new ResizeObserver(([entry]) => {
|
|
1207
|
+
if (entry) setWidth(entry.contentRect.width);
|
|
1208
|
+
});
|
|
1209
|
+
ro.observe(el);
|
|
1210
|
+
return () => ro.disconnect();
|
|
1211
|
+
}, [ref]);
|
|
1212
|
+
return width;
|
|
1213
|
+
}
|
|
1214
|
+
function ChatPage({
|
|
1215
|
+
title,
|
|
1216
|
+
status,
|
|
1217
|
+
titleRight,
|
|
1218
|
+
actions,
|
|
1219
|
+
history,
|
|
1220
|
+
sidePanel,
|
|
1221
|
+
...shell
|
|
1222
|
+
}) {
|
|
1223
|
+
const rootRef = useRef(null);
|
|
1224
|
+
const width = useWidth(rootRef);
|
|
1225
|
+
const historyInline = width >= HISTORY_INLINE_MIN;
|
|
1226
|
+
const sideInline = width >= SIDE_INLINE_MIN;
|
|
1227
|
+
const [collapsed, setCollapsed] = useState(false);
|
|
1228
|
+
const [drawerOpen, setDrawerOpen] = useState(false);
|
|
1229
|
+
const [lastSide, setLastSide] = useState(sidePanel);
|
|
1230
|
+
if (sidePanel && sidePanel !== lastSide) setLastSide(sidePanel);
|
|
1231
|
+
const side = sidePanel ?? lastSide;
|
|
1232
|
+
const sideOpen = Boolean(sidePanel);
|
|
1233
|
+
const toggle = history ? /* @__PURE__ */ jsx(
|
|
1234
|
+
IconButton,
|
|
1235
|
+
{
|
|
1236
|
+
variant: "secondaryLink",
|
|
1237
|
+
"aria-label": historyInline ? collapsed ? "\uB300\uD654 \uAE30\uB85D \uD3BC\uCE58\uAE30" : "\uB300\uD654 \uAE30\uB85D \uC811\uAE30" : "\uB300\uD654 \uAE30\uB85D \uC5F4\uAE30",
|
|
1238
|
+
"aria-expanded": historyInline ? !collapsed : drawerOpen,
|
|
1239
|
+
onClick: () => historyInline ? setCollapsed((v) => !v) : setDrawerOpen(true),
|
|
1240
|
+
children: /* @__PURE__ */ jsx(PanelLeft, { size: 20 })
|
|
1241
|
+
}
|
|
1242
|
+
) : null;
|
|
1243
|
+
return /* @__PURE__ */ jsxs("div", { ref: rootRef, className: "flex h-full min-h-0 w-full flex-col bg-sys-background", children: [
|
|
1244
|
+
/* @__PURE__ */ jsx(
|
|
1245
|
+
ChatHeader,
|
|
1246
|
+
{
|
|
1247
|
+
level: 1,
|
|
1248
|
+
title,
|
|
1249
|
+
historyToggle: toggle,
|
|
1250
|
+
status,
|
|
1251
|
+
titleRight,
|
|
1252
|
+
actions
|
|
1253
|
+
}
|
|
1254
|
+
),
|
|
1255
|
+
/* @__PURE__ */ jsxs("section", { "aria-label": title, className: "flex min-h-0 flex-1", children: [
|
|
1256
|
+
history && historyInline ? (
|
|
1257
|
+
// 접기·펴기는 바깥 폭만 280 ↔ 0 으로 움직이고 안쪽은 280 그대로 잘라 낸다 — 글자가 줄바꿈되며 출렁이지 않게.
|
|
1258
|
+
// 접힌 뒤에는 visibility:hidden 이라 Tab·스크린리더가 닿지 않는다(visibility 는 줄어드는 동안 보이다가 끝에 숨는다)
|
|
1259
|
+
/* @__PURE__ */ jsx(
|
|
1260
|
+
"div",
|
|
1261
|
+
{
|
|
1262
|
+
className: cn(
|
|
1263
|
+
"shrink-0 overflow-hidden transition-[width,visibility] duration-300 ease-in-out motion-reduce:transition-none",
|
|
1264
|
+
collapsed ? "invisible w-0" : "visible w-[280px]"
|
|
1265
|
+
),
|
|
1266
|
+
children: /* @__PURE__ */ jsx("div", { className: "flex h-full w-[280px] flex-col border-r border-sys-divider-subtler p-[12px]", children: /* @__PURE__ */ jsx(ChatHistory, { ...history, className: "flex-1" }) })
|
|
1267
|
+
}
|
|
1268
|
+
)
|
|
1269
|
+
) : null,
|
|
1270
|
+
/* @__PURE__ */ jsx("div", { className: "flex min-h-0 min-w-0 flex-1 flex-col", children: /* @__PURE__ */ jsx(ChatConversation, { variant: "page", label: `${title} \uB300\uD654`, ...shell }) }),
|
|
1271
|
+
sideInline ? (
|
|
1272
|
+
// 열고 닫기는 기록 바와 같은 방식 — 바깥 폭만 0 ↔ 패널 폭으로 움직인다
|
|
1273
|
+
/* @__PURE__ */ jsx(
|
|
1274
|
+
"div",
|
|
1275
|
+
{
|
|
1276
|
+
className: cn(
|
|
1277
|
+
"shrink-0 overflow-hidden transition-[width,visibility] duration-300 ease-in-out motion-reduce:transition-none",
|
|
1278
|
+
sideOpen ? cn("visible", SIDE_WIDTH[side?.width ?? "medium"]) : "invisible w-0"
|
|
1279
|
+
),
|
|
1280
|
+
onTransitionEnd: (e) => {
|
|
1281
|
+
if (e.target === e.currentTarget && e.propertyName === "width" && !sidePanel)
|
|
1282
|
+
setLastSide(void 0);
|
|
1283
|
+
},
|
|
1284
|
+
children: side ? (
|
|
1285
|
+
// <aside> 는 다른 landmark 안에 둘 수 없어(axe landmark-complementary-is-top-level) 이름 있는 section(Panel) — ListPage 의 detail 과 같다
|
|
1286
|
+
/* @__PURE__ */ jsx(
|
|
1287
|
+
Panel,
|
|
1288
|
+
{
|
|
1289
|
+
appearance: "none",
|
|
1290
|
+
padding: "large",
|
|
1291
|
+
title: side.title,
|
|
1292
|
+
description: side.description,
|
|
1293
|
+
titleRight: /* @__PURE__ */ jsx(
|
|
1294
|
+
IconButton,
|
|
1295
|
+
{
|
|
1296
|
+
type: "button",
|
|
1297
|
+
variant: "secondary",
|
|
1298
|
+
"aria-label": "\uB2EB\uAE30",
|
|
1299
|
+
onClick: side.onClose,
|
|
1300
|
+
children: /* @__PURE__ */ jsx(X, { size: 20 })
|
|
1301
|
+
}
|
|
1302
|
+
),
|
|
1303
|
+
footer: side.footer,
|
|
1304
|
+
className: cn(
|
|
1305
|
+
"h-full min-h-0 border-l border-sys-divider-subtler p-[24px]",
|
|
1306
|
+
SIDE_WIDTH[side.width ?? "medium"]
|
|
1307
|
+
),
|
|
1308
|
+
children: /* @__PURE__ */ jsx(
|
|
1309
|
+
"div",
|
|
1310
|
+
{
|
|
1311
|
+
tabIndex: 0,
|
|
1312
|
+
className: "-mx-[4px] min-h-0 flex-1 overflow-y-auto px-[4px] outline-none focus-visible:ring-[2px] focus-visible:ring-inset focus-visible:ring-sys-focus-ring-main",
|
|
1313
|
+
children: side.children
|
|
1314
|
+
}
|
|
1315
|
+
)
|
|
1316
|
+
}
|
|
1317
|
+
)
|
|
1318
|
+
) : null
|
|
1319
|
+
}
|
|
1320
|
+
)
|
|
1321
|
+
) : null
|
|
1322
|
+
] }),
|
|
1323
|
+
history && !historyInline ? /* @__PURE__ */ jsx(Drawer, { open: drawerOpen, onOpenChange: setDrawerOpen, children: /* @__PURE__ */ jsxs(DrawerContent, { side: "left", size: "small", children: [
|
|
1324
|
+
/* @__PURE__ */ jsx(DrawerHeader, { children: /* @__PURE__ */ jsx(DrawerTitle, { children: "\uB300\uD654 \uAE30\uB85D" }) }),
|
|
1325
|
+
/* @__PURE__ */ jsx("div", { className: "flex min-h-0 flex-1 flex-col px-[24px] pb-[24px]", children: /* @__PURE__ */ jsx(
|
|
1326
|
+
ChatHistory,
|
|
1327
|
+
{
|
|
1328
|
+
...history,
|
|
1329
|
+
className: "flex-1",
|
|
1330
|
+
onSelect: (id) => {
|
|
1331
|
+
history.onSelect(id);
|
|
1332
|
+
setDrawerOpen(false);
|
|
1333
|
+
},
|
|
1334
|
+
onNew: history.onNew ? () => {
|
|
1335
|
+
history.onNew?.();
|
|
1336
|
+
setDrawerOpen(false);
|
|
1337
|
+
} : void 0
|
|
1338
|
+
}
|
|
1339
|
+
) })
|
|
1340
|
+
] }) }) : null,
|
|
1341
|
+
sidePanel && !sideInline ? /* @__PURE__ */ jsx(Drawer, { open: true, onOpenChange: (open) => open ? void 0 : sidePanel.onClose(), children: /* @__PURE__ */ jsxs(DrawerContent, { side: "right", size: sidePanel.width ?? "medium", children: [
|
|
1342
|
+
/* @__PURE__ */ jsxs(DrawerHeader, { children: [
|
|
1343
|
+
/* @__PURE__ */ jsx(DrawerTitle, { children: sidePanel.title }),
|
|
1344
|
+
sidePanel.description ? /* @__PURE__ */ jsx(DrawerDescription, { children: sidePanel.description }) : null
|
|
1345
|
+
] }),
|
|
1346
|
+
/* @__PURE__ */ jsx(DrawerBody, { className: "px-[24px] pb-[24px]", children: sidePanel.children }),
|
|
1347
|
+
sidePanel.footer ? /* @__PURE__ */ jsx(DrawerFooter, { children: sidePanel.footer }) : null
|
|
1348
|
+
] }) }) : null
|
|
1349
|
+
] });
|
|
1350
|
+
}
|
|
1351
|
+
function ChatPanel({
|
|
1352
|
+
title,
|
|
1353
|
+
label = "AI \uB300\uD654",
|
|
1354
|
+
actions,
|
|
1355
|
+
onClose,
|
|
1356
|
+
className,
|
|
1357
|
+
...shell
|
|
1358
|
+
}) {
|
|
1359
|
+
const name = typeof title === "string" ? title : label;
|
|
1360
|
+
return /* @__PURE__ */ jsxs(
|
|
1361
|
+
"section",
|
|
1362
|
+
{
|
|
1363
|
+
"aria-label": name,
|
|
1364
|
+
className: cn("flex h-full min-h-0 w-full flex-col bg-sys-background", className),
|
|
1365
|
+
children: [
|
|
1366
|
+
/* @__PURE__ */ jsx(
|
|
1367
|
+
ChatHeader,
|
|
1368
|
+
{
|
|
1369
|
+
level: 2,
|
|
1370
|
+
title,
|
|
1371
|
+
actions: actions || onClose ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1372
|
+
actions,
|
|
1373
|
+
onClose ? /* @__PURE__ */ jsx(IconButton, { type: "button", variant: "secondary", "aria-label": "\uB2EB\uAE30", onClick: onClose, children: /* @__PURE__ */ jsx(X, { size: 20 }) }) : null
|
|
1374
|
+
] }) : null
|
|
1375
|
+
}
|
|
1376
|
+
),
|
|
1377
|
+
/* @__PURE__ */ jsx(ChatConversation, { variant: "panel", label: `${name} \uB300\uD654`, ...shell })
|
|
1378
|
+
]
|
|
1379
|
+
}
|
|
1380
|
+
);
|
|
1381
|
+
}
|
|
867
1382
|
|
|
868
|
-
export { DashboardLayout, DashboardPanel, DashboardSection, DetailPage, EmptyState, ErrorState, FormDialog, FormDrawer, FormPage, ListPage, LoadingState };
|
|
1383
|
+
export { ChatPage, ChatPanel, DashboardLayout, DashboardPanel, DashboardSection, DetailPage, EmptyState, ErrorState, FormDialog, FormDrawer, FormPage, ListPage, LoadingState };
|
|
869
1384
|
//# sourceMappingURL=index.js.map
|
|
870
1385
|
//# sourceMappingURL=index.js.map
|