one-design-next 0.0.74 → 0.0.76

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.
@@ -1,5 +1,4 @@
1
1
  import type { IconName } from '../icon';
2
- import type { ArtifactFileIconType } from './icons';
3
2
  /** 点击产物时的预期行为类型。 */
4
3
  export type ArtifactActionKind = 'preview' | 'download';
5
4
  export interface ArtifactAction {
@@ -9,9 +8,5 @@ export interface ArtifactAction {
9
8
  /** hover 时展示的操作 Icon */
10
9
  icon: IconName;
11
10
  }
12
- /**
13
- * 按文件类型给出点击预期:
14
- * - html / md / csv / file → 预览(arrow-right)
15
- * - pdf / xlsx / docx / pptx → 下载(arrow-down-to-line)
16
- */
17
- export declare function getArtifactAction(fileType: ArtifactFileIconType): ArtifactAction;
11
+ /** 根据 actionKind 返回对应的 ArtifactAction(label + icon)。 */
12
+ export declare function getArtifactActionFromKind(kind: ArtifactActionKind): ArtifactAction;
@@ -1,25 +1,15 @@
1
1
  /** 点击产物时的预期行为类型。 */
2
2
 
3
- /**
4
- * 按文件类型给出点击预期:
5
- * - html / md / csv / file → 预览(arrow-right)
6
- * - pdf / xlsx / docx / pptx → 下载(arrow-down-to-line)
7
- */
8
- export function getArtifactAction(fileType) {
9
- switch (fileType) {
10
- case 'html':
11
- case 'md':
12
- case 'csv':
13
- case 'file':
3
+ /** 根据 actionKind 返回对应的 ArtifactAction(label + icon)。 */
4
+ export function getArtifactActionFromKind(kind) {
5
+ switch (kind) {
6
+ case 'preview':
14
7
  return {
15
8
  kind: 'preview',
16
9
  label: '预览详情',
17
10
  icon: 'arrow-right'
18
11
  };
19
- case 'pdf':
20
- case 'xlsx':
21
- case 'docx':
22
- case 'pptx':
12
+ case 'download':
23
13
  return {
24
14
  kind: 'download',
25
15
  label: '下载导出',
@@ -1,7 +1,8 @@
1
1
  import { type CSSProperties } from 'react';
2
+ import { type ArtifactActionKind } from './actions';
2
3
  import { type ArtifactFileIconType } from './icons';
3
4
  import './style';
4
- export { getArtifactAction, type ArtifactAction, type ArtifactActionKind, } from './actions';
5
+ export { getArtifactActionFromKind, type ArtifactAction, type ArtifactActionKind, } from './actions';
5
6
  export { ARTIFACT_FILE_GLOW_COLORS, getArtifactGlowColor } from './glow';
6
7
  export { ARTIFACT_DEDICATED_FILE_ICON_TYPES, ARTIFACT_FILE_ICON_MEDIUM_SIZE, ARTIFACT_FILE_ICON_MEDIUM_VIEWBOX, ARTIFACT_FILE_ICON_SMALL_SIZE, ARTIFACT_FILE_ICON_SMALL_VIEWBOX, ARTIFACT_FILE_ICON_TYPES, ArtifactFileIcon, artifactFileIcons, artifactFileIconsMedium, artifactFileIconsSmall, getArtifactFileIconUrl, } from './icons';
7
8
  export type { ArtifactFileIconProps, ArtifactFileIconSize, ArtifactFileIconType, } from './icons';
@@ -14,6 +15,8 @@ export type ArtifactSize = 'medium' | 'small';
14
15
  export interface ArtifactProps {
15
16
  /** 文件名 / 产物标题 */
16
17
  title: string;
18
+ /** 点击产物时的行为:`'preview'` 预览 或 `'download'` 下载,由调用方决定。 */
19
+ actionKind: ArtifactActionKind;
17
20
  /**
18
21
  * 文件类型图标。
19
22
  * 不传时从 `title` 扩展名推断;无专属 Icon 时回退 `file`(浅灰通用 File Icon)。
@@ -39,7 +42,7 @@ export interface ArtifactProps {
39
42
  * - medium / Card:左 Icon + 右标题 / 大小·日期;可点 hover 时 Icon 后退缩小、文案左移遮罩,右侧浮出操作预期
40
43
  * - small / Small:无底色/描边;hover 用 HoverFill 叠灰底(不展示预览/下载操作预期)
41
44
  */
42
- export declare function Artifact({ title, fileType, fileSize, date, size, status, onOpen, className, style, }: ArtifactProps): import("react").JSX.Element;
45
+ export declare function Artifact({ title, actionKind, fileType, fileSize, date, size, status, onOpen, className, style, }: ArtifactProps): import("react").JSX.Element;
43
46
  export declare namespace Artifact {
44
47
  var displayName: string;
45
48
  }
@@ -6,11 +6,11 @@ import { useCallback, useRef, useState } from 'react';
6
6
  import HoverFill from "../hover-fill";
7
7
  import Icon from "../icon";
8
8
  import Tooltip from "../tooltip";
9
- import { getArtifactAction } from "./actions";
9
+ import { getArtifactActionFromKind } from "./actions";
10
10
  import { getArtifactGlowColor } from "./glow";
11
11
  import { ARTIFACT_DEDICATED_FILE_ICON_TYPES, ArtifactFileIcon } from "./icons";
12
12
  import "./style";
13
- export { getArtifactAction } from "./actions";
13
+ export { getArtifactActionFromKind } from "./actions";
14
14
  export { ARTIFACT_FILE_GLOW_COLORS, getArtifactGlowColor } from "./glow";
15
15
  export { ARTIFACT_DEDICATED_FILE_ICON_TYPES, ARTIFACT_FILE_ICON_MEDIUM_SIZE, ARTIFACT_FILE_ICON_MEDIUM_VIEWBOX, ARTIFACT_FILE_ICON_SMALL_SIZE, ARTIFACT_FILE_ICON_SMALL_VIEWBOX, ARTIFACT_FILE_ICON_TYPES, ArtifactFileIcon, artifactFileIcons, artifactFileIconsMedium, artifactFileIconsSmall, getArtifactFileIconUrl } from "./icons";
16
16
 
@@ -77,6 +77,7 @@ function ArtifactActionCue(_ref) {
77
77
  */
78
78
  export function Artifact(_ref2) {
79
79
  var title = _ref2.title,
80
+ actionKind = _ref2.actionKind,
80
81
  fileType = _ref2.fileType,
81
82
  fileSize = _ref2.fileSize,
82
83
  date = _ref2.date,
@@ -91,7 +92,7 @@ export function Artifact(_ref2) {
91
92
  var isInteractive = !!onOpen && !isGenerating;
92
93
  var resolvedType = fileType !== null && fileType !== void 0 ? fileType : inferFileType(title);
93
94
  var iconSize = size;
94
- var action = getArtifactAction(resolvedType);
95
+ var action = getArtifactActionFromKind(actionKind);
95
96
  var _splitTitleParts = splitTitleParts(title),
96
97
  titleHead = _splitTitleParts.head,
97
98
  titleTail = _splitTitleParts.tail,
@@ -524,8 +524,8 @@ export declare const svgData: {
524
524
  readonly content: "<g fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"> <rect width=\"18\" height=\"18\" x=\"3\" y=\"3\" rx=\"2\" /> </g>";
525
525
  };
526
526
  readonly 'square-filled': {
527
- readonly viewBox: "0 0 17 16";
528
- readonly content: "<path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M5.125 1C2.91586 1 1.125 2.79086 1.125 5V11C1.125 13.2091 2.91586 15 5.125 15H11.125C13.3341 15 15.125 13.2091 15.125 11V5C15.125 2.79086 13.3341 1 11.125 1H5.125ZM5.30465 6.36681C5.8683 5.38918 6.92066 4.73314 8.1252 4.73314C9.6001 4.73314 10.8459 5.71711 11.2462 7.06647H10.9535C10.8049 7.06647 10.7162 7.23263 10.7987 7.35668L11.6913 8.70016C11.765 8.81099 11.9273 8.81099 12.001 8.70016L12.8936 7.35668C12.9761 7.23263 12.8874 7.06647 12.7388 7.06647H12.2075C11.7845 5.19608 10.1174 3.7998 8.1252 3.7998C6.57517 3.7998 5.22252 4.6453 4.49943 5.89947C4.3708 6.12256 4.44679 6.40803 4.66914 6.53709C4.8915 6.66614 5.17602 6.5899 5.30465 6.36681ZM5.29693 8.93314H5.00419C5.40445 10.2825 6.65029 11.2665 8.1252 11.2665C9.32973 11.2665 10.3821 10.6104 10.9457 9.6328C11.0744 9.4097 11.3589 9.33347 11.5813 9.46252C11.8036 9.59157 11.8796 9.87705 11.751 10.1001C11.0279 11.3543 9.67522 12.1998 8.1252 12.1998C6.13301 12.1998 4.46586 10.8035 4.04285 8.93314H3.51156C3.36296 8.93314 3.27433 8.76698 3.35675 8.64293L4.24944 7.29945C4.32308 7.18861 4.4854 7.18861 4.55904 7.29945L5.45173 8.64293C5.53415 8.76698 5.44552 8.93314 5.29693 8.93314ZM9.98336 7.02766C10.176 7.19818 10.1943 7.49309 10.0244 7.68634L8.92999 8.93079C8.8417 9.03119 8.71468 9.0887 8.58123 9.0887C8.44778 9.0887 8.32076 9.03119 8.23246 8.93079L7.51978 8.12039L6.94955 8.89848C6.79738 9.10612 6.50625 9.15068 6.2993 8.998C6.09234 8.84532 6.04793 8.55323 6.2001 8.34558L7.1121 7.10114C7.19544 6.98742 7.3256 6.91766 7.46615 6.91138C7.60669 6.90511 7.74251 6.96299 7.83559 7.06883L8.58123 7.91669L9.32686 7.06883C9.49682 6.87557 9.79074 6.85714 9.98336 7.02766Z\" fill=\"currentColor\"/>";
527
+ readonly viewBox: "0 0 24 24";
528
+ readonly content: "<rect width=\"16\" height=\"16\" x=\"4\" y=\"4\" rx=\"2\" fill=\"currentColor\"/>";
529
529
  };
530
530
  readonly star: {
531
531
  readonly viewBox: "0 0 17 16";