@tbox.cn/app-agent-ui-kit 1.0.0-alpha.17 → 1.0.0-alpha.19

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/README.md CHANGED
@@ -48,7 +48,7 @@ import { BottomSheet } from '@tbox.cn/app-agent-ui-kit/bottom-sheet';
48
48
  </BottomSheet>
49
49
  ```
50
50
 
51
- 支持 `className` 定制内容区,默认最大高度为视口的 65%,长内容在弹层内部滚动。`preloadBottomSheet()` 保留为已废弃的空操作(弹层不再有第三方运行时需要预热)。
51
+ 支持 `className` 定制内容区,默认最大高度为视口的 65%;`size="large"` 固定为视口的 86%,用于活动详情等长内容,支持动态视口高度。长内容在弹层内部滚动。`preloadBottomSheet()` 保留为已废弃的空操作(弹层不再有第三方运行时需要预热)。
52
52
 
53
53
  ### 大图预览
54
54
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tbox.cn/app-agent-ui-kit",
3
- "version": "1.0.0-alpha.17",
3
+ "version": "1.0.0-alpha.19",
4
4
  "type": "module",
5
5
  "description": "Agent 对话壳 UI 组件包(源码发布,单一模板统一化 W2-1):ChatPage/壳组件族/主题 tokens。",
6
6
  "exports": {
@@ -44,8 +44,8 @@
44
44
  "remark-gfm": "4.0.1",
45
45
  "yet-another-react-lightbox": "3.33.1",
46
46
  "zustand": "4.5.7",
47
- "@tbox.cn/app-agent-sdk-client": "1.0.0-alpha.17",
48
- "@tbox.cn/app-contracts": "1.0.0-alpha.17"
47
+ "@tbox.cn/app-agent-sdk-client": "1.0.0-alpha.19",
48
+ "@tbox.cn/app-contracts": "1.0.0-alpha.19"
49
49
  },
50
50
  "peerDependencies": {
51
51
  "react": "18.3.1",
@@ -2,7 +2,7 @@ import { createLogger } from '@tbox.cn/app-agent-sdk-client';
2
2
 
3
3
  const debugLogger = createLogger('DebugButton');
4
4
 
5
- import { Bug } from '@phosphor-icons/react';
5
+ import { BugIcon as Bug } from '@phosphor-icons/react/Bug';
6
6
 
7
7
  /**
8
8
  * 调试按钮:点击把本轮 requestId / conversationId / messageId / messageCreatedAt
@@ -2,7 +2,10 @@ import { useEffect, useState, useSyncExternalStore } from 'react';
2
2
  import { createLogger } from '@tbox.cn/app-agent-sdk-client';
3
3
 
4
4
  const ttsActionLogger = createLogger('tts');
5
- import { Copy, SpeakerHigh, ThumbsDown, ThumbsUp } from '@phosphor-icons/react';
5
+ import { CopyIcon as Copy } from '@phosphor-icons/react/Copy';
6
+ import { SpeakerHighIcon as SpeakerHigh } from '@phosphor-icons/react/SpeakerHigh';
7
+ import { ThumbsDownIcon as ThumbsDown } from '@phosphor-icons/react/ThumbsDown';
8
+ import { ThumbsUpIcon as ThumbsUp } from '@phosphor-icons/react/ThumbsUp';
6
9
  import { useChatStore } from '../../store-context';
7
10
  import { useChatConfigStore } from '../../chat-config';
8
11
  import { useFeedbackAdapter, useRefreshSession, useTTSAdapter } from '@tbox.cn/app-agent-sdk-client';
@@ -28,6 +28,17 @@ async function renderSheet(open: boolean, onClose = vi.fn()) {
28
28
  }
29
29
 
30
30
  describe('BottomSheet', () => {
31
+ it('大尺寸固定 86% 视口并保留内部滚动,默认尺寸仍最高 65%', async () => {
32
+ await renderSheet(true);
33
+ expect(document.querySelector('[role="dialog"]')?.classList.contains('max-h-[65vh]')).toBe(true);
34
+ await act(async () => root!.render(<BottomSheet open title="活动详情" onClose={vi.fn()} size="large"><p>活动内容</p></BottomSheet>));
35
+ const panel = document.querySelector('[role="dialog"]')!;
36
+ expect(panel.classList.contains('h-[86vh]')).toBe(true);
37
+ expect(panel.classList.contains('supports-[height:100dvh]:h-[86dvh]')).toBe(true);
38
+ expect(panel.classList.contains('max-h-[65vh]')).toBe(false);
39
+ expect(panel.querySelector('.tbox-bottom-sheet__body')?.classList.contains('overflow-y-auto')).toBe(true);
40
+ });
41
+
31
42
  it('关闭态不挂载内容;打开通过 portal 展示命名对话框和业务内容', async () => {
32
43
  await renderSheet(false);
33
44
  expect(document.querySelector('[role="dialog"]')).toBeNull();
@@ -9,6 +9,8 @@ export interface BottomSheetProps {
9
9
  children: ReactNode;
10
10
  /** 内容容器的业务样式;弹层外壳由组件统一管理。 */
11
11
  className?: string;
12
+ /** large 与门店详情同高;默认按内容撑开,最高 65% 视口。 */
13
+ size?: 'default' | 'large';
12
14
  /**
13
15
  * `default` = 标题栏 + 关闭按钮;
14
16
  * `card` = 只留拖拽条与悬浮关闭按钮,让内容里的卡片标题成为唯一主标题(避免「抽屉大标题 + 卡内标题」双头)。
@@ -24,7 +26,7 @@ export interface BottomSheetProps {
24
26
  export async function preloadBottomSheet(): Promise<void> {}
25
27
 
26
28
  /** 受控底部弹层:业务只提供内容与开关,不自行处理遮罩、滚动和焦点。 */
27
- export function BottomSheet({ open, title, onClose, children, className, variant = 'default' }: BottomSheetProps) {
29
+ export function BottomSheet({ open, title, onClose, children, className, variant = 'default', size = 'default' }: BottomSheetProps) {
28
30
  const titleId = useId();
29
31
  const closeRef = useRef<HTMLButtonElement>(null);
30
32
  const cardMode = variant === 'card';
@@ -38,7 +40,12 @@ export function BottomSheet({ open, title, onClose, children, className, variant
38
40
  initialFocus={closeRef}
39
41
  exitMs={200}
40
42
  rootClassName="tbox-bottom-sheet-root group"
41
- panelClassName="tbox-bottom-sheet tbox-bottom-sheet__panel flex max-h-[65vh] w-full max-w-content flex-col overflow-hidden rounded-t-[14px] bg-card text-foreground supports-[height:100dvh]:max-h-[65dvh] animate-[tbox-sheet-in_200ms_ease-out] group-data-[state=closed]:animate-[tbox-sheet-out_200ms_ease-in_both] motion-reduce:animate-none"
43
+ panelClassName={[
44
+ 'tbox-bottom-sheet tbox-bottom-sheet__panel flex w-full max-w-content flex-col overflow-hidden rounded-t-[14px] bg-card text-foreground animate-[tbox-sheet-in_200ms_ease-out] group-data-[state=closed]:animate-[tbox-sheet-out_200ms_ease-in_both] motion-reduce:animate-none',
45
+ size === 'large'
46
+ ? 'h-[86vh] max-h-[86vh] supports-[height:100dvh]:h-[86dvh] supports-[height:100dvh]:max-h-[86dvh]'
47
+ : 'max-h-[65vh] supports-[height:100dvh]:max-h-[65dvh]',
48
+ ].join(' ')}
42
49
  maskClassName="bg-scrim animate-[tbox-fade-in_200ms_ease-out] group-data-[state=closed]:animate-[tbox-fade-out_200ms_ease-in_both] motion-reduce:animate-none"
43
50
  >
44
51
  {cardMode ? (
@@ -1,5 +1,9 @@
1
1
  import { useCallback, useEffect, useState } from 'react';
2
- import { X, Warning, Prohibit, Plus, VideoCamera } from '@phosphor-icons/react';
2
+ import { XIcon as X } from '@phosphor-icons/react/X';
3
+ import { WarningIcon as Warning } from '@phosphor-icons/react/Warning';
4
+ import { ProhibitIcon as Prohibit } from '@phosphor-icons/react/Prohibit';
5
+ import { PlusIcon as Plus } from '@phosphor-icons/react/Plus';
6
+ import { VideoCameraIcon as VideoCamera } from '@phosphor-icons/react/VideoCamera';
3
7
  import { previewImages } from '../../utils/imagePreview';
4
8
  import { toast } from '../../utils/toast';
5
9
  import type { MediaItem } from '../../types';
@@ -1,7 +1,7 @@
1
1
  import { useMemo } from 'react';
2
2
  import ReactMarkdown from 'react-markdown';
3
3
  import remarkGfm from 'remark-gfm';
4
- import { Copy } from '@phosphor-icons/react';
4
+ import { CopyIcon as Copy } from '@phosphor-icons/react/Copy';
5
5
  import { previewImages } from '../../utils/imagePreview';
6
6
  import type { ChatMessage } from '../../types';
7
7
  import ReasoningBlock from '../../components/ReasoningBlock';
@@ -1,5 +1,8 @@
1
1
  import { useId, useMemo, useState } from 'react';
2
- import { CaretDown, Check, Copy, X } from '@phosphor-icons/react';
2
+ import { CaretDownIcon as CaretDown } from '@phosphor-icons/react/CaretDown';
3
+ import { CheckIcon as Check } from '@phosphor-icons/react/Check';
4
+ import { CopyIcon as Copy } from '@phosphor-icons/react/Copy';
5
+ import { XIcon as X } from '@phosphor-icons/react/X';
3
6
  import type { ToolCallInfo } from '../../types';
4
7
  import { formatCompactToolIo } from '../../utils/tool-call-display';
5
8
  import { buildSummaryText, deriveSummary, deriveToolCallItem, prettyDetailText } from './detail';
package/src/icons.ts CHANGED
@@ -1,39 +1,38 @@
1
1
  /**
2
- * 图标入口:应用侧不再直接依赖 `@phosphor-icons/react`。
2
+ * 图标兼容入口:卡片与空态常用的一组,含义稳定、体积可控。
3
3
  *
4
- * 只再导出卡片与空态常用的一组,含义稳定、体积可控;需要新图标时在此增补,
5
- * 应用侧 `import { IconName } from '@tbox.cn/app-agent-ui-kit/icons'`。
4
+ * 主路径是按单个导入 `import { BellIcon } from '@phosphor-icons/react/Bell'`(名字带
5
+ * `Icon` 后缀;从包根导入会把全部 1512 个图标拉进构建与类型检查,lint 报错)。
6
+ * 本入口只作兼容消费面,新代码优先用主路径;清单见 docs/agent/kit.md 图标节。
6
7
  */
7
- export {
8
- ArrowRight,
9
- ArrowsClockwise,
10
- Calendar,
11
- CaretDown,
12
- CaretRight,
13
- Check,
14
- CheckCircle,
15
- Clock,
16
- Coins,
17
- Copy,
18
- CreditCard,
19
- CurrencyCny,
20
- Gift,
21
- Info,
22
- MapPin,
23
- MapTrifold,
24
- Plus,
25
- QrCode,
26
- Receipt,
27
- SealCheck,
28
- ShareNetwork,
29
- Sparkle,
30
- Star,
31
- Storefront,
32
- Ticket,
33
- Trash,
34
- User,
35
- UserCircle,
36
- Warning,
37
- WarningCircle,
38
- X,
39
- } from '@phosphor-icons/react';
8
+ export { ArrowRightIcon as ArrowRight } from '@phosphor-icons/react/ArrowRight';
9
+ export { ArrowsClockwiseIcon as ArrowsClockwise } from '@phosphor-icons/react/ArrowsClockwise';
10
+ export { CalendarIcon as Calendar } from '@phosphor-icons/react/Calendar';
11
+ export { CaretDownIcon as CaretDown } from '@phosphor-icons/react/CaretDown';
12
+ export { CaretRightIcon as CaretRight } from '@phosphor-icons/react/CaretRight';
13
+ export { CheckIcon as Check } from '@phosphor-icons/react/Check';
14
+ export { CheckCircleIcon as CheckCircle } from '@phosphor-icons/react/CheckCircle';
15
+ export { ClockIcon as Clock } from '@phosphor-icons/react/Clock';
16
+ export { CoinsIcon as Coins } from '@phosphor-icons/react/Coins';
17
+ export { CopyIcon as Copy } from '@phosphor-icons/react/Copy';
18
+ export { CreditCardIcon as CreditCard } from '@phosphor-icons/react/CreditCard';
19
+ export { CurrencyCnyIcon as CurrencyCny } from '@phosphor-icons/react/CurrencyCny';
20
+ export { GiftIcon as Gift } from '@phosphor-icons/react/Gift';
21
+ export { InfoIcon as Info } from '@phosphor-icons/react/Info';
22
+ export { MapPinIcon as MapPin } from '@phosphor-icons/react/MapPin';
23
+ export { MapTrifoldIcon as MapTrifold } from '@phosphor-icons/react/MapTrifold';
24
+ export { PlusIcon as Plus } from '@phosphor-icons/react/Plus';
25
+ export { QrCodeIcon as QrCode } from '@phosphor-icons/react/QrCode';
26
+ export { ReceiptIcon as Receipt } from '@phosphor-icons/react/Receipt';
27
+ export { SealCheckIcon as SealCheck } from '@phosphor-icons/react/SealCheck';
28
+ export { ShareNetworkIcon as ShareNetwork } from '@phosphor-icons/react/ShareNetwork';
29
+ export { SparkleIcon as Sparkle } from '@phosphor-icons/react/Sparkle';
30
+ export { StarIcon as Star } from '@phosphor-icons/react/Star';
31
+ export { StorefrontIcon as Storefront } from '@phosphor-icons/react/Storefront';
32
+ export { TicketIcon as Ticket } from '@phosphor-icons/react/Ticket';
33
+ export { TrashIcon as Trash } from '@phosphor-icons/react/Trash';
34
+ export { UserIcon as User } from '@phosphor-icons/react/User';
35
+ export { UserCircleIcon as UserCircle } from '@phosphor-icons/react/UserCircle';
36
+ export { WarningIcon as Warning } from '@phosphor-icons/react/Warning';
37
+ export { WarningCircleIcon as WarningCircle } from '@phosphor-icons/react/WarningCircle';
38
+ export { XIcon as X } from '@phosphor-icons/react/X';