@hkyhy/marsun-components-core 0.1.32 → 0.1.34

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.
Files changed (53) hide show
  1. package/dist/components/AgentHub/Report/Detail/ReportMetaStrip/index.d.ts +19 -0
  2. package/dist/components/AgentHub/Report/Detail/ReportMetaStrip/index.js +46 -0
  3. package/dist/components/AgentHub/Report/Detail/ReportMetaStrip/index.js.map +1 -0
  4. package/dist/components/AgentHub/Report/Detail/ReportMetaStrip/style.module.scss.js +12 -0
  5. package/dist/components/AgentHub/Report/Detail/ReportMetaStrip/style.module.scss.js.map +1 -0
  6. package/dist/components/AgentHub/Report/Detail/ReportTemplate/index.d.ts +18 -0
  7. package/dist/components/AgentHub/Report/Detail/ReportTemplate/index.js +98 -0
  8. package/dist/components/AgentHub/Report/Detail/ReportTemplate/index.js.map +1 -0
  9. package/dist/components/AgentHub/Report/Detail/ReportTemplate/style.module.scss.js +14 -0
  10. package/dist/components/AgentHub/Report/Detail/ReportTemplate/style.module.scss.js.map +1 -0
  11. package/dist/components/AgentHub/Report/Detail/index.d.ts +4 -0
  12. package/dist/components/AgentHub/Report/index.d.ts +1 -0
  13. package/dist/components/Form/FormDataSync.d.ts +11 -0
  14. package/dist/components/Form/FormDataSync.js +20 -0
  15. package/dist/components/Form/FormDataSync.js.map +1 -0
  16. package/dist/components/Form/index.d.ts +3 -1
  17. package/dist/components/Form/kneFormInfo.d.ts +1 -0
  18. package/dist/components/Form/kneFormInfo.js +12 -11
  19. package/dist/components/Form/kneFormInfo.js.map +1 -1
  20. package/dist/components/Icons/index.d.ts +3 -1
  21. package/dist/components/Icons/index.js +165 -159
  22. package/dist/components/Icons/index.js.map +1 -1
  23. package/dist/components/InteractiveBlock/InteractiveBlock.d.ts +34 -0
  24. package/dist/components/InteractiveBlock/InteractiveBlock.js +174 -0
  25. package/dist/components/InteractiveBlock/InteractiveBlock.js.map +1 -0
  26. package/dist/components/InteractiveBlock/index.d.ts +3 -0
  27. package/dist/components/InteractiveBlock/style.module.scss.js +20 -0
  28. package/dist/components/InteractiveBlock/style.module.scss.js.map +1 -0
  29. package/dist/components/Layout/ContentCard/index.d.ts +14 -0
  30. package/dist/components/Layout/ContentCard/index.js +20 -0
  31. package/dist/components/Layout/ContentCard/index.js.map +1 -0
  32. package/dist/components/Layout/ContentCard/style.module.scss.js +9 -0
  33. package/dist/components/Layout/ContentCard/style.module.scss.js.map +1 -0
  34. package/dist/components/Layout/index.d.ts +2 -0
  35. package/dist/components/Modal/Modal/index.d.ts +6 -0
  36. package/dist/components/Modal/Modal/index.js +120 -0
  37. package/dist/components/Modal/Modal/index.js.map +1 -0
  38. package/dist/components/Modal/Modal/style.module.scss.js +17 -0
  39. package/dist/components/Modal/Modal/style.module.scss.js.map +1 -0
  40. package/dist/components/Modal/ModalTypes.d.ts +26 -0
  41. package/dist/components/Modal/StepModal/index.js +43 -41
  42. package/dist/components/Modal/StepModal/index.js.map +1 -1
  43. package/dist/components/Modal/index.d.ts +3 -0
  44. package/dist/components/Modal/utils/resolveModalSize.d.ts +22 -0
  45. package/dist/components/Modal/utils/resolveModalSize.js +28 -0
  46. package/dist/components/Modal/utils/resolveModalSize.js.map +1 -0
  47. package/dist/components/index.d.ts +1 -0
  48. package/dist/index.d.ts +2 -0
  49. package/dist/index.js +403 -383
  50. package/dist/index.js.map +1 -1
  51. package/dist/marsun-components-core.css +1 -1
  52. package/dist/styles/global.css +1 -1
  53. package/package.json +1 -1
@@ -0,0 +1,174 @@
1
+ import { jsx as i, jsxs as l, Fragment as g } from "react/jsx-runtime";
2
+ import w from "@kne/button-group";
3
+ import t from "classnames";
4
+ import { Info as x } from "../Icons/index.js";
5
+ import n from "./style.module.scss.js";
6
+ import D from "../Tag/SemanticTag.js";
7
+ import P from "../TooltipInfo/TooltipInfo.js";
8
+ const M = ({
9
+ title: p,
10
+ info: a,
11
+ subtitle: o,
12
+ description: s,
13
+ tags: r,
14
+ tagsPlacement: d = "inline",
15
+ actions: h,
16
+ surface: m = "plain",
17
+ selected: u,
18
+ onClick: c,
19
+ className: v
20
+ }) => {
21
+ const b = (h ?? []).filter((e) => !e.hidden), y = !!(o || r != null && r.length), N = b.map((e) => ({
22
+ type: "link",
23
+ key: e.key,
24
+ icon: e.icon,
25
+ children: e.label,
26
+ onClick: e.onClick
27
+ })), f = r != null && r.length ? /* @__PURE__ */ i(
28
+ "div",
29
+ {
30
+ className: t(
31
+ "marsun-interactive-block-tags",
32
+ n["marsun-interactive-block-tags"]
33
+ ),
34
+ children: r.map((e) => /* @__PURE__ */ i(D, { color: e.color, children: e.label }, e.label))
35
+ }
36
+ ) : null, k = /* @__PURE__ */ l(g, { children: [
37
+ /* @__PURE__ */ l(
38
+ "div",
39
+ {
40
+ className: t(
41
+ "marsun-interactive-block-header",
42
+ n["marsun-interactive-block-header"]
43
+ ),
44
+ children: [
45
+ /* @__PURE__ */ l(
46
+ "div",
47
+ {
48
+ className: t(
49
+ "marsun-interactive-block-title-group",
50
+ n["marsun-interactive-block-title-group"]
51
+ ),
52
+ children: [
53
+ /* @__PURE__ */ i(
54
+ "p",
55
+ {
56
+ className: t(
57
+ "marsun-interactive-block-title",
58
+ n["marsun-interactive-block-title"]
59
+ ),
60
+ children: p
61
+ }
62
+ ),
63
+ a != null && a.length ? /* @__PURE__ */ i(
64
+ P,
65
+ {
66
+ content: a,
67
+ placement: "topLeft",
68
+ overlayStyle: { minWidth: 220, maxWidth: 360 },
69
+ overlayClassName: "marsun-interactive-block-info-tooltip",
70
+ children: /* @__PURE__ */ i(
71
+ "span",
72
+ {
73
+ className: t(
74
+ "marsun-interactive-block-info-trigger",
75
+ n["marsun-interactive-block-info-trigger"]
76
+ ),
77
+ onClick: (e) => e.stopPropagation(),
78
+ onMouseDown: (e) => e.stopPropagation(),
79
+ onKeyDown: (e) => e.stopPropagation(),
80
+ children: /* @__PURE__ */ i(x, { size: 16, "aria-hidden": !0 })
81
+ }
82
+ )
83
+ }
84
+ ) : null
85
+ ]
86
+ }
87
+ ),
88
+ b.length ? /* @__PURE__ */ i(
89
+ "div",
90
+ {
91
+ className: t(
92
+ "marsun-interactive-block-actions",
93
+ n["marsun-interactive-block-actions"]
94
+ ),
95
+ onClick: (e) => e.stopPropagation(),
96
+ onKeyDown: (e) => e.stopPropagation(),
97
+ role: "presentation",
98
+ children: /* @__PURE__ */ i(w, { moreType: "link", list: N })
99
+ }
100
+ ) : null
101
+ ]
102
+ }
103
+ ),
104
+ y ? /* @__PURE__ */ l(
105
+ "div",
106
+ {
107
+ className: t(
108
+ "marsun-interactive-block-meta",
109
+ n["marsun-interactive-block-meta"],
110
+ d === "below" && n["marsun-interactive-block-meta--below"]
111
+ ),
112
+ children: [
113
+ o ? /* @__PURE__ */ i(
114
+ "p",
115
+ {
116
+ className: t(
117
+ "marsun-interactive-block-subtitle",
118
+ n["marsun-interactive-block-subtitle"]
119
+ ),
120
+ children: o
121
+ }
122
+ ) : null,
123
+ f
124
+ ]
125
+ }
126
+ ) : null,
127
+ s ? /* @__PURE__ */ i(
128
+ "p",
129
+ {
130
+ className: t(
131
+ "marsun-interactive-block-description",
132
+ n["marsun-interactive-block-description"]
133
+ ),
134
+ children: s
135
+ }
136
+ ) : null
137
+ ] });
138
+ return c ? /* @__PURE__ */ i(
139
+ "div",
140
+ {
141
+ role: "button",
142
+ tabIndex: 0,
143
+ className: t(
144
+ "marsun-interactive-block",
145
+ n["marsun-interactive-block"],
146
+ n["marsun-interactive-block--clickable"],
147
+ m === "inset" && n["marsun-interactive-block--inset"],
148
+ u && n["marsun-interactive-block--selected"],
149
+ v
150
+ ),
151
+ onClick: c,
152
+ onKeyDown: (e) => {
153
+ (e.key === "Enter" || e.key === " ") && (e.preventDefault(), c());
154
+ },
155
+ children: k
156
+ }
157
+ ) : /* @__PURE__ */ i(
158
+ "div",
159
+ {
160
+ className: t(
161
+ "marsun-interactive-block",
162
+ n["marsun-interactive-block"],
163
+ m === "inset" && n["marsun-interactive-block--inset"],
164
+ u && n["marsun-interactive-block--selected"],
165
+ v
166
+ ),
167
+ children: k
168
+ }
169
+ );
170
+ };
171
+ export {
172
+ M as default
173
+ };
174
+ //# sourceMappingURL=InteractiveBlock.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"InteractiveBlock.js","sources":["../../../src/components/InteractiveBlock/InteractiveBlock.tsx"],"sourcesContent":["import ButtonGroup from '@kne/button-group';\nimport classNames from 'classnames';\nimport type { ReactNode } from 'react';\nimport type { DescriptionItem } from '../Descriptions/CommonDescriptions';\nimport { Info } from '../Icons';\nimport { SemanticTag } from '../Tag';\nimport { TooltipInfo } from '../TooltipInfo';\nimport styles from './style.module.scss';\n\nexport type InteractiveBlockTag = {\n label: string;\n color: string;\n};\n\nexport type InteractiveBlockAction = {\n key: string;\n label: string;\n icon?: ReactNode;\n onClick?: () => void;\n hidden?: boolean;\n};\n\nexport type InteractiveBlockTagsPlacement = 'inline' | 'below';\n\nexport type InteractiveBlockSurface = 'plain' | 'inset';\n\nexport type InteractiveBlockProps = {\n title: ReactNode;\n info?: DescriptionItem[];\n subtitle?: ReactNode;\n description?: ReactNode;\n tags?: InteractiveBlockTag[];\n tagsPlacement?: InteractiveBlockTagsPlacement;\n actions?: InteractiveBlockAction[];\n /** 列表表面:inset 对齐归档检索灰底项 */\n surface?: InteractiveBlockSurface;\n selected?: boolean;\n onClick?: () => void;\n className?: string;\n};\n\n/**\n * 带操作性的展示块:title → Info+TooltipInfo → actions;tags 紧贴 subtitle。\n */\nconst InteractiveBlock: React.FC<InteractiveBlockProps> = ({\n title,\n info,\n subtitle,\n description,\n tags,\n tagsPlacement = 'inline',\n actions,\n surface = 'plain',\n selected,\n onClick,\n className,\n}) => {\n const visibleActions = (actions ?? []).filter((a) => !a.hidden);\n const hasMeta = Boolean(subtitle || tags?.length);\n\n const actionList = visibleActions.map((action) => ({\n type: 'link' as const,\n key: action.key,\n icon: action.icon,\n children: action.label,\n onClick: action.onClick,\n }));\n\n const tagsNode = tags?.length ? (\n <div\n className={classNames(\n 'marsun-interactive-block-tags',\n styles['marsun-interactive-block-tags'],\n )}\n >\n {tags.map((tag) => (\n <SemanticTag key={tag.label} color={tag.color}>\n {tag.label}\n </SemanticTag>\n ))}\n </div>\n ) : null;\n\n const body = (\n <>\n <div\n className={classNames(\n 'marsun-interactive-block-header',\n styles['marsun-interactive-block-header'],\n )}\n >\n <div\n className={classNames(\n 'marsun-interactive-block-title-group',\n styles['marsun-interactive-block-title-group'],\n )}\n >\n <p\n className={classNames(\n 'marsun-interactive-block-title',\n styles['marsun-interactive-block-title'],\n )}\n >\n {title}\n </p>\n {info?.length ? (\n <TooltipInfo\n content={info}\n placement=\"topLeft\"\n overlayStyle={{ minWidth: 220, maxWidth: 360 }}\n overlayClassName=\"marsun-interactive-block-info-tooltip\"\n >\n <span\n className={classNames(\n 'marsun-interactive-block-info-trigger',\n styles['marsun-interactive-block-info-trigger'],\n )}\n onClick={(e) => e.stopPropagation()}\n onMouseDown={(e) => e.stopPropagation()}\n onKeyDown={(e) => e.stopPropagation()}\n >\n <Info size={16} aria-hidden />\n </span>\n </TooltipInfo>\n ) : null}\n </div>\n {visibleActions.length ? (\n <div\n className={classNames(\n 'marsun-interactive-block-actions',\n styles['marsun-interactive-block-actions'],\n )}\n onClick={(e) => e.stopPropagation()}\n onKeyDown={(e) => e.stopPropagation()}\n role=\"presentation\"\n >\n <ButtonGroup moreType=\"link\" list={actionList} />\n </div>\n ) : null}\n </div>\n {hasMeta ? (\n <div\n className={classNames(\n 'marsun-interactive-block-meta',\n styles['marsun-interactive-block-meta'],\n tagsPlacement === 'below' && styles['marsun-interactive-block-meta--below'],\n )}\n >\n {subtitle ? (\n <p\n className={classNames(\n 'marsun-interactive-block-subtitle',\n styles['marsun-interactive-block-subtitle'],\n )}\n >\n {subtitle}\n </p>\n ) : null}\n {tagsNode}\n </div>\n ) : null}\n {description ? (\n <p\n className={classNames(\n 'marsun-interactive-block-description',\n styles['marsun-interactive-block-description'],\n )}\n >\n {description}\n </p>\n ) : null}\n </>\n );\n\n if (onClick) {\n return (\n <div\n role=\"button\"\n tabIndex={0}\n className={classNames(\n 'marsun-interactive-block',\n styles['marsun-interactive-block'],\n styles['marsun-interactive-block--clickable'],\n surface === 'inset' && styles['marsun-interactive-block--inset'],\n selected && styles['marsun-interactive-block--selected'],\n className,\n )}\n onClick={onClick}\n onKeyDown={(e) => {\n if (e.key === 'Enter' || e.key === ' ') {\n e.preventDefault();\n onClick();\n }\n }}\n >\n {body}\n </div>\n );\n }\n\n return (\n <div\n className={classNames(\n 'marsun-interactive-block',\n styles['marsun-interactive-block'],\n surface === 'inset' && styles['marsun-interactive-block--inset'],\n selected && styles['marsun-interactive-block--selected'],\n className,\n )}\n >\n {body}\n </div>\n );\n};\n\nexport default InteractiveBlock;\n"],"names":["InteractiveBlock","title","info","subtitle","description","tags","tagsPlacement","actions","surface","selected","onClick","className","visibleActions","a","hasMeta","actionList","action","tagsNode","jsx","classNames","styles","tag","SemanticTag","body","jsxs","Fragment","TooltipInfo","Info","ButtonGroup"],"mappings":";;;;;;;AA4CA,MAAMA,IAAoD,CAAC;AAAA,EACzD,OAAAC;AAAA,EACA,MAAAC;AAAA,EACA,UAAAC;AAAA,EACA,aAAAC;AAAA,EACA,MAAAC;AAAA,EACA,eAAAC,IAAgB;AAAA,EAChB,SAAAC;AAAA,EACA,SAAAC,IAAU;AAAA,EACV,UAAAC;AAAA,EACA,SAAAC;AAAA,EACA,WAAAC;AACF,MAAM;AACJ,QAAMC,KAAkBL,KAAW,CAAA,GAAI,OAAO,CAACM,MAAM,CAACA,EAAE,MAAM,GACxDC,IAAU,GAAQX,KAAYE,KAAA,QAAAA,EAAM,SAEpCU,IAAaH,EAAe,IAAI,CAACI,OAAY;AAAA,IACjD,MAAM;AAAA,IACN,KAAKA,EAAO;AAAA,IACZ,MAAMA,EAAO;AAAA,IACb,UAAUA,EAAO;AAAA,IACjB,SAASA,EAAO;AAAA,EAAA,EAChB,GAEIC,IAAWZ,KAAA,QAAAA,EA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AO,0BAA0B;AAAA,QACjCA,EAAO,qCAAqC;AAAA,QAC5CZ,MAAY,WAAWY,EAAO,iCAAiC;AAAA,QAC/DX,KAAYW,EAAO,oCAAoC;AAAA,QACvDT;AAAA,MAAA;AAAA,MAEF,SAAAD;AAAA,MACA,WAAW,CAAC,MAAM;AAChB,SAAI,EAAE,QAAQ,WAAW,EAAE,QAAQ,SACjC,EAAE,eAAA,GACFA,EAAA;AAAA,MAEJ;AAAA,MAEC,UAAAa;AAAA,IAAA;AAAA,EAAA,IAML,gBAAAL;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,WAAWC;AAAA,QACT;AAAA,QACAC,EAAO,0BAA0B;AAAA,QACjCZ,MAAY,WAAWY,EAAO,iCAAiC;AAAA,QAC/DX,KAAYW,EAAO,oCAAoC;AAAA,QACvDT;AAAA,MAAA;AAAA,MAGD,UAAAY;AAAA,IAAA;AAAA,EAAA;AAGP;"}
@@ -0,0 +1,3 @@
1
+ export { default } from './InteractiveBlock';
2
+ export { default as InteractiveBlock } from './InteractiveBlock';
3
+ export type { InteractiveBlockAction, InteractiveBlockProps, InteractiveBlockSurface, InteractiveBlockTag, InteractiveBlockTagsPlacement, } from './InteractiveBlock';
@@ -0,0 +1,20 @@
1
+ const e = {
2
+ "marsun-interactive-block": "_marsun-interactive-block_jc90o_1",
3
+ "marsun-interactive-block--clickable": "_marsun-interactive-block--clickable_jc90o_12",
4
+ "marsun-interactive-block--inset": "_marsun-interactive-block--inset_jc90o_15",
5
+ "marsun-interactive-block--selected": "_marsun-interactive-block--selected_jc90o_24",
6
+ "marsun-interactive-block-title": "_marsun-interactive-block-title_jc90o_28",
7
+ "marsun-interactive-block-header": "_marsun-interactive-block-header_jc90o_48",
8
+ "marsun-interactive-block-title-group": "_marsun-interactive-block-title-group_jc90o_55",
9
+ "marsun-interactive-block-info-trigger": "_marsun-interactive-block-info-trigger_jc90o_74",
10
+ "marsun-interactive-block-actions": "_marsun-interactive-block-actions_jc90o_84",
11
+ "marsun-interactive-block-meta": "_marsun-interactive-block-meta_jc90o_101",
12
+ "marsun-interactive-block-meta--below": "_marsun-interactive-block-meta--below_jc90o_108",
13
+ "marsun-interactive-block-subtitle": "_marsun-interactive-block-subtitle_jc90o_113",
14
+ "marsun-interactive-block-tags": "_marsun-interactive-block-tags_jc90o_120",
15
+ "marsun-interactive-block-description": "_marsun-interactive-block-description_jc90o_126"
16
+ };
17
+ export {
18
+ e as default
19
+ };
20
+ //# sourceMappingURL=style.module.scss.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"style.module.scss.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;"}
@@ -0,0 +1,14 @@
1
+ import { ReactNode } from 'react';
2
+ export type ContentCardProps = {
3
+ children: ReactNode;
4
+ className?: string;
5
+ /** 去掉内边距(适合嵌套 Tabs / Table) */
6
+ noPadding?: boolean;
7
+ /** 无 border / shadow / radius,用于模块 workarea 扁平容器 */
8
+ flat?: boolean;
9
+ };
10
+ /**
11
+ * 主内容卡片容器。模块 workarea 扁平布局传 `flat`(可加 `noPadding`)。
12
+ */
13
+ declare const ContentCard: React.FC<ContentCardProps>;
14
+ export default ContentCard;
@@ -0,0 +1,20 @@
1
+ import { jsx as s } from "react/jsx-runtime";
2
+ import c from "classnames";
3
+ import t from "./style.module.scss.js";
4
+ const f = ({ children: n, className: a, noPadding: r, flat: o }) => /* @__PURE__ */ s(
5
+ "section",
6
+ {
7
+ className: c(
8
+ "marsun-content-card",
9
+ t["marsun-content-card"],
10
+ r && t["marsun-content-card--no-padding"],
11
+ o && t["marsun-content-card--flat"],
12
+ a
13
+ ),
14
+ children: n
15
+ }
16
+ );
17
+ export {
18
+ f as default
19
+ };
20
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../../../../src/components/Layout/ContentCard/index.tsx"],"sourcesContent":["import classNames from 'classnames';\nimport type { ReactNode } from 'react';\nimport styles from './style.module.scss';\n\nexport type ContentCardProps = {\n children: ReactNode;\n className?: string;\n /** 去掉内边距(适合嵌套 Tabs / Table) */\n noPadding?: boolean;\n /** 无 border / shadow / radius,用于模块 workarea 扁平容器 */\n flat?: boolean;\n};\n\n/**\n * 主内容卡片容器。模块 workarea 扁平布局传 `flat`(可加 `noPadding`)。\n */\nconst ContentCard: React.FC<ContentCardProps> = ({ children, className, noPadding, flat }) => (\n <section\n className={classNames(\n 'marsun-content-card',\n styles['marsun-content-card'],\n noPadding && styles['marsun-content-card--no-padding'],\n flat && styles['marsun-content-card--flat'],\n className,\n )}\n >\n {children}\n </section>\n);\n\nexport default ContentCard;\n"],"names":["ContentCard","children","className","noPadding","flat","jsx","classNames","styles"],"mappings":";;;AAgBA,MAAMA,IAA0C,CAAC,EAAE,UAAAC,GAAU,WAAAC,GAAW,WAAAC,GAAW,MAAAC,QACjF,gBAAAC;AAAA,EAAC;AAAA,EAAA;AAAA,IACC,WAAWC;AAAA,MACT;AAAA,MACAC,EAAO,qBAAqB;AAAA,MAC5BJ,KAAaI,EAAO,iCAAiC;AAAA,MACrDH,KAAQG,EAAO,2BAA2B;AAAA,MAC1CL;AAAA,IAAA;AAAA,IAGD,UAAAD;AAAA,EAAA;AACH;"}
@@ -0,0 +1,9 @@
1
+ const n = {
2
+ "marsun-content-card": "_marsun-content-card_kuu48_1",
3
+ "marsun-content-card--no-padding": "_marsun-content-card--no-padding_kuu48_9",
4
+ "marsun-content-card--flat": "_marsun-content-card--flat_kuu48_14"
5
+ };
6
+ export {
7
+ n as default
8
+ };
9
+ //# sourceMappingURL=style.module.scss.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"style.module.scss.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;"}
@@ -8,3 +8,5 @@ export { default as ModulePageShell } from './ModulePageShell';
8
8
  export type { ModulePageShellProps } from './ModulePageShell';
9
9
  export { AgentAppShell } from './AgentAppShell';
10
10
  export type { AgentAppShellProps } from './AgentAppShell';
11
+ export { default as ContentCard } from './ContentCard';
12
+ export type { ContentCardProps } from './ContentCard';
@@ -0,0 +1,6 @@
1
+ import { MarsunModalProps } from '../ModalTypes';
2
+ /**
3
+ * 通用居中 Modal:必填标题、可选 info/description、标题 Action(ButtonGroup)、S/M/L 宽度(只可缩小)、固定 body 高。
4
+ */
5
+ declare const Modal: React.FC<MarsunModalProps>;
6
+ export default Modal;
@@ -0,0 +1,120 @@
1
+ import { jsxs as p, jsx as t } from "react/jsx-runtime";
2
+ import I from "@kne/button-group";
3
+ import { Modal as z } from "antd";
4
+ import e from "classnames";
5
+ import { useMemo as h, useState as B, useEffect as T } from "react";
6
+ import { Info as V } from "../../Icons/index.js";
7
+ import { resolveModalWidth as _, resolveModalSizeAnchor as j, MODAL_SIZE_BODY_HEIGHT as C } from "../utils/resolveModalSize.js";
8
+ import r from "./style.module.scss.js";
9
+ import D from "../../TooltipInfo/TooltipInfo.js";
10
+ import G from "../../VirtualScrollbar/VirtualScrollbar/index.js";
11
+ function O() {
12
+ const [i, m] = B(() => typeof window < "u" ? window.innerWidth : 1200);
13
+ return T(() => {
14
+ const o = () => m(window.innerWidth);
15
+ return window.addEventListener("resize", o), () => window.removeEventListener("resize", o);
16
+ }, []), i;
17
+ }
18
+ const Q = ({
19
+ open: i,
20
+ onCancel: m,
21
+ title: o,
22
+ info: a,
23
+ description: f,
24
+ actions: w,
25
+ footer: y = null,
26
+ size: l,
27
+ width: s,
28
+ children: v,
29
+ className: N,
30
+ destroyOnHidden: M = !0,
31
+ maskClosable: W = !1,
32
+ scrollable: b = !1,
33
+ closable: x = !0
34
+ }) => {
35
+ const n = O(), E = h(
36
+ () => _({ size: l, width: s, viewportWidth: n }),
37
+ [l, s, n]
38
+ ), L = h(
39
+ () => j({ size: l, width: s, viewportWidth: n }),
40
+ [l, s, n]
41
+ ), g = C[L], d = h(() => {
42
+ const u = (w ?? []).filter((H) => !H.hidden), c = u[0];
43
+ return !c || c.type != null ? u : [{ ...c, type: "primary" }, ...u.slice(1)];
44
+ }, [w]), S = /* @__PURE__ */ p("div", { className: e("marsun-modal-title-wrap", r["marsun-modal-title-wrap"]), children: [
45
+ /* @__PURE__ */ p("div", { className: e("marsun-modal-title-row", r["marsun-modal-title-row"]), children: [
46
+ /* @__PURE__ */ p("div", { className: e("marsun-modal-title-group", r["marsun-modal-title-group"]), children: [
47
+ /* @__PURE__ */ t("div", { className: e("marsun-modal-title", r["marsun-modal-title"]), children: o }),
48
+ a != null && a.length ? /* @__PURE__ */ t(
49
+ D,
50
+ {
51
+ content: a,
52
+ placement: "topLeft",
53
+ overlayStyle: { minWidth: 220, maxWidth: 360 },
54
+ overlayClassName: "marsun-modal-info-tooltip",
55
+ children: /* @__PURE__ */ t(
56
+ "span",
57
+ {
58
+ className: e(
59
+ "marsun-modal-info-trigger",
60
+ r["marsun-modal-info-trigger"]
61
+ ),
62
+ children: /* @__PURE__ */ t(V, { size: 16, "aria-hidden": !0 })
63
+ }
64
+ )
65
+ }
66
+ ) : null
67
+ ] }),
68
+ d.length > 0 ? /* @__PURE__ */ t(
69
+ "div",
70
+ {
71
+ className: e(
72
+ "marsun-modal-title-actions",
73
+ r["marsun-modal-title-actions"]
74
+ ),
75
+ children: /* @__PURE__ */ t(I, { list: d, showLength: Math.max(d.length, 2) })
76
+ }
77
+ ) : null
78
+ ] }),
79
+ f ? /* @__PURE__ */ t("div", { className: e("marsun-modal-description", r["marsun-modal-description"]), children: f }) : null
80
+ ] }), A = b ? /* @__PURE__ */ t(
81
+ G,
82
+ {
83
+ wrapperClassName: e(
84
+ "marsun-modal-scroll-wrapper",
85
+ r["marsun-modal-scroll-wrapper"]
86
+ ),
87
+ className: e("marsun-modal-scroll", r["marsun-modal-scroll"]),
88
+ children: v
89
+ }
90
+ ) : /* @__PURE__ */ t("div", { className: e("marsun-modal-body-inner", r["marsun-modal-body-inner"]), children: v });
91
+ return /* @__PURE__ */ t(
92
+ z,
93
+ {
94
+ open: i,
95
+ onCancel: m,
96
+ title: S,
97
+ footer: y,
98
+ width: E,
99
+ centered: !0,
100
+ closable: x,
101
+ maskClosable: W,
102
+ destroyOnHidden: M,
103
+ className: e("marsun-modal", r["marsun-modal"], N),
104
+ styles: {
105
+ body: {
106
+ height: g,
107
+ maxHeight: g,
108
+ overflow: "hidden",
109
+ paddingTop: 12,
110
+ paddingBottom: 12
111
+ }
112
+ },
113
+ children: A
114
+ }
115
+ );
116
+ };
117
+ export {
118
+ Q as default
119
+ };
120
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../../../../src/components/Modal/Modal/index.tsx"],"sourcesContent":["import ButtonGroup from '@kne/button-group';\nimport { Modal as AntModal } from 'antd';\nimport classNames from 'classnames';\nimport { useEffect, useMemo, useState, type ReactNode } from 'react';\nimport { Info } from '../../Icons';\nimport { TooltipInfo } from '../../TooltipInfo';\nimport { VirtualScrollbar } from '../../VirtualScrollbar';\nimport type { MarsunModalProps } from '../ModalTypes';\nimport {\n MODAL_SIZE_BODY_HEIGHT,\n resolveModalSizeAnchor,\n resolveModalWidth,\n} from '../utils/resolveModalSize';\nimport styles from './style.module.scss';\n\nfunction useViewportWidth(): number {\n const [vw, setVw] = useState(() => (typeof window !== 'undefined' ? window.innerWidth : 1200));\n\n useEffect(() => {\n const onResize = () => setVw(window.innerWidth);\n window.addEventListener('resize', onResize);\n return () => window.removeEventListener('resize', onResize);\n }, []);\n\n return vw;\n}\n\n/**\n * 通用居中 Modal:必填标题、可选 info/description、标题 Action(ButtonGroup)、S/M/L 宽度(只可缩小)、固定 body 高。\n */\nconst Modal: React.FC<MarsunModalProps> = ({\n open,\n onCancel,\n title,\n info,\n description,\n actions,\n footer = null,\n size,\n width,\n children,\n className,\n destroyOnHidden = true,\n maskClosable = false,\n scrollable = false,\n closable = true,\n}) => {\n const viewportWidth = useViewportWidth();\n const effectiveWidth = useMemo(\n () => resolveModalWidth({ size, width, viewportWidth }),\n [size, width, viewportWidth],\n );\n const sizeAnchor = useMemo(\n () => resolveModalSizeAnchor({ size, width, viewportWidth }),\n [size, width, viewportWidth],\n );\n const bodyHeight = MODAL_SIZE_BODY_HEIGHT[sizeAnchor];\n\n const visibleActions = useMemo(() => {\n const list = (actions ?? []).filter((a) => !a.hidden);\n const first = list[0];\n if (!first || first.type != null) return list;\n return [{ ...first, type: 'primary' as const }, ...list.slice(1)];\n }, [actions]);\n\n const titleNode = (\n <div className={classNames('marsun-modal-title-wrap', styles['marsun-modal-title-wrap'])}>\n <div className={classNames('marsun-modal-title-row', styles['marsun-modal-title-row'])}>\n <div className={classNames('marsun-modal-title-group', styles['marsun-modal-title-group'])}>\n <div className={classNames('marsun-modal-title', styles['marsun-modal-title'])}>\n {title}\n </div>\n {info?.length ? (\n <TooltipInfo\n content={info}\n placement=\"topLeft\"\n overlayStyle={{ minWidth: 220, maxWidth: 360 }}\n overlayClassName=\"marsun-modal-info-tooltip\"\n >\n <span\n className={classNames(\n 'marsun-modal-info-trigger',\n styles['marsun-modal-info-trigger'],\n )}\n >\n <Info size={16} aria-hidden />\n </span>\n </TooltipInfo>\n ) : null}\n </div>\n {visibleActions.length > 0 ? (\n <div\n className={classNames(\n 'marsun-modal-title-actions',\n styles['marsun-modal-title-actions'],\n )}\n >\n <ButtonGroup list={visibleActions} showLength={Math.max(visibleActions.length, 2)} />\n </div>\n ) : null}\n </div>\n {description ? (\n <div className={classNames('marsun-modal-description', styles['marsun-modal-description'])}>\n {description}\n </div>\n ) : null}\n </div>\n );\n\n const body: ReactNode = scrollable ? (\n <VirtualScrollbar\n wrapperClassName={classNames(\n 'marsun-modal-scroll-wrapper',\n styles['marsun-modal-scroll-wrapper'],\n )}\n className={classNames('marsun-modal-scroll', styles['marsun-modal-scroll'])}\n >\n {children}\n </VirtualScrollbar>\n ) : (\n <div className={classNames('marsun-modal-body-inner', styles['marsun-modal-body-inner'])}>\n {children}\n </div>\n );\n\n return (\n <AntModal\n open={open}\n onCancel={onCancel}\n title={titleNode}\n footer={footer}\n width={effectiveWidth}\n centered\n closable={closable}\n maskClosable={maskClosable}\n destroyOnHidden={destroyOnHidden}\n className={classNames('marsun-modal', styles['marsun-modal'], className)}\n styles={{\n body: {\n height: bodyHeight,\n maxHeight: bodyHeight,\n overflow: 'hidden',\n paddingTop: 12,\n paddingBottom: 12,\n },\n }}\n >\n {body}\n </AntModal>\n );\n};\n\nexport default Modal;\n"],"names":["useViewportWidth","vw","setVw","useState","useEffect","onResize","Modal","open","onCancel","title","info","description","actions","footer","size","width","children","className","destroyOnHidden","maskClosable","scrollable","closable","viewportWidth","effectiveWidth","useMemo","resolveModalWidth","sizeAnchor","resolveModalSizeAnchor","bodyHeight","MODAL_SIZE_BODY_HEIGHT","visibleActions","list","a","first","titleNode","classNames","styles","jsxs","jsx","TooltipInfo","Info","ButtonGroup","body","VirtualScrollbar","AntModal"],"mappings":";;;;;;;;;;AAeA,SAASA,IAA2B;AAClC,QAAM,CAACC,GAAIC,CAAK,IAAIC,EAAS,MAAO,OAAO,SAAW,MAAc,OAAO,aAAa,IAAK;AAE7F,SAAAC,EAAU,MAAM;AACd,UAAMC,IAAW,MAAMH,EAAM,OAAO,UAAU;AAC9C,kBAAO,iBAAiB,UAAUG,CAAQ,GACnC,MAAM,OAAO,oBAAoB,UAAUA,CAAQ;AAAA,EAC5D,GAAG,CAAA,CAAE,GAEEJ;AACT;AAKA,MAAMK,IAAoC,CAAC;AAAA,EACzC,MAAAC;AAAA,EACA,UAAAC;AAAA,EACA,OAAAC;AAAA,EACA,MAAAC;AAAA,EACA,aAAAC;AAAA,EACA,SAAAC;AAAA,EACA,QAAAC,IAAS;AAAA,EACT,MAAAC;AAAA,EACA,OAAAC;AAAA,EACA,UAAAC;AAAA,EACA,WAAAC;AAAA,EACA,iBAAAC,IAAkB;AAAA,EAClB,cAAAC,IAAe;AAAA,EACf,YAAAC,IAAa;AAAA,EACb,UAAAC,IAAW;AACb,MAAM;AACJ,QAAMC,IAAgBtB,EAAA,GAChBuB,IAAiBC;AAAA,IACrB,MAAMC,EAAkB,EAAE,MA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AAAA,UACX,UAAU;AAAA,UACV,YAAY;AAAA,UACZ,eAAe;AAAA,QAAA;AAAA,MACjB;AAAA,MAGD,UAAAc;AAAA,IAAA;AAAA,EAAA;AAGP;"}
@@ -0,0 +1,17 @@
1
+ const a = {
2
+ "marsun-modal": "_marsun-modal_1ggfn_1",
3
+ "marsun-modal-title-wrap": "_marsun-modal-title-wrap_1ggfn_23",
4
+ "marsun-modal-title-row": "_marsun-modal-title-row_1ggfn_30",
5
+ "marsun-modal-title-group": "_marsun-modal-title-group_1ggfn_41",
6
+ "marsun-modal-title": "_marsun-modal-title_1ggfn_23",
7
+ "marsun-modal-info-trigger": "_marsun-modal-info-trigger_1ggfn_56",
8
+ "marsun-modal-title-actions": "_marsun-modal-title-actions_1ggfn_66",
9
+ "marsun-modal-description": "_marsun-modal-description_1ggfn_71",
10
+ "marsun-modal-scroll-wrapper": "_marsun-modal-scroll-wrapper_1ggfn_81",
11
+ "marsun-modal-scroll": "_marsun-modal-scroll_1ggfn_81",
12
+ "marsun-modal-body-inner": "_marsun-modal-body-inner_1ggfn_96"
13
+ };
14
+ export {
15
+ a as default
16
+ };
17
+ //# sourceMappingURL=style.module.scss.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"style.module.scss.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;"}
@@ -0,0 +1,26 @@
1
+ import { ReactNode } from 'react';
2
+ import { DescriptionItem } from '../Descriptions/CommonDescriptions';
3
+ import { ModalSize } from './utils/resolveModalSize';
4
+ export type MarsunModalProps = {
5
+ open: boolean;
6
+ onCancel: () => void;
7
+ /** 弹窗标题(必填) */
8
+ title: ReactNode;
9
+ /** 标题旁 Info + TooltipInfo(对齐 InteractiveBlock) */
10
+ info?: DescriptionItem[];
11
+ /** 标题行下方说明文案 */
12
+ description?: ReactNode;
13
+ /** 标题右侧操作,ButtonGroup listArray */
14
+ actions?: Record<string, unknown>[];
15
+ footer?: ReactNode | null;
16
+ size?: ModalSize;
17
+ /** 显式默认宽,优先于 size 作为锚点 */
18
+ width?: number;
19
+ children: ReactNode;
20
+ className?: string;
21
+ destroyOnHidden?: boolean;
22
+ maskClosable?: boolean;
23
+ /** body 内单层 VirtualScrollbar */
24
+ scrollable?: boolean;
25
+ closable?: boolean;
26
+ };
@@ -1,56 +1,58 @@
1
- import { jsxs as k, jsx as d } from "react/jsx-runtime";
2
- import { ChevronLeft as M } from "../../Icons/index.js";
3
- import { Modal as j, Steps as F, Button as c } from "antd";
4
- import { useMemo as I, useCallback as n } from "react";
1
+ import { jsxs as n, jsx as d } from "react/jsx-runtime";
2
+ import { ChevronLeft as I } from "../../Icons/index.js";
3
+ import { Modal as W, Steps as z, Button as c } from "antd";
4
+ import { useMemo as F, useCallback as k } from "react";
5
+ import { resolveModalWidth as L } from "../utils/resolveModalSize.js";
5
6
  import f from "./style.module.scss.js";
6
- import a from "classnames";
7
- const y = (m) => {
8
- if (m !== void 0)
9
- return typeof m == "function" ? m() : m;
10
- }, H = ({
11
- title: m,
12
- steps: r,
13
- current: e,
14
- open: x,
7
+ import e from "classnames";
8
+ const y = (t) => {
9
+ if (t !== void 0)
10
+ return typeof t == "function" ? t() : t;
11
+ }, K = ({
12
+ title: t,
13
+ steps: i,
14
+ current: a,
15
+ open: v,
15
16
  onCancel: s,
16
- width: N = 600,
17
+ width: x = 600,
17
18
  showSteps: u = !0,
18
- maskClosable: v = !1,
19
- className: w,
19
+ maskClosable: w = !1,
20
+ className: N,
20
21
  onStepChange: l
21
22
  }) => {
22
- const i = I(() => r.findIndex((t) => t.key === e), [r, e]), o = r[i], E = n(() => {
23
- i > 0 && (l == null || l(r[i - 1].key));
24
- }, [i, r, l]), b = n(async () => {
23
+ const r = F(() => i.findIndex((m) => m.key === a), [i, a]), o = i[r], E = k(() => {
24
+ r > 0 && (l == null || l(i[r - 1].key));
25
+ }, [r, i, l]), M = k(async () => {
25
26
  if (!(o != null && o.beforeEnter)) {
26
- i < r.length - 1 && (l == null || l(r[i + 1].key));
27
+ r < i.length - 1 && (l == null || l(i[r + 1].key));
27
28
  return;
28
29
  }
29
- await o.beforeEnter() && i < r.length - 1 && (l == null || l(r[i + 1].key));
30
- }, [o, i, r, l]), B = m ?? (o == null ? void 0 : o.title) ?? "";
31
- return /* @__PURE__ */ k(
32
- j,
30
+ await o.beforeEnter() && r < i.length - 1 && (l == null || l(i[r + 1].key));
31
+ }, [o, r, i, l]), b = t ?? (o == null ? void 0 : o.title) ?? "", B = () => (o == null ? void 0 : o.footer) !== void 0 ? y(o.footer) : /* @__PURE__ */ n("div", { className: e("step-modal-root", f["step-modal-root"]), children: [
32
+ r > 0 && (o == null ? void 0 : o.allowBack) !== !1 && /* @__PURE__ */ d(c, { icon: /* @__PURE__ */ d(I, {}), onClick: E, children: "上一步" }),
33
+ /* @__PURE__ */ d("div", { className: e("step-modal-container", f["step-modal-container"]) }),
34
+ /* @__PURE__ */ d(c, { onClick: s, children: "取消" }),
35
+ r < i.length - 1 && /* @__PURE__ */ d(c, { type: "primary", onClick: M, children: "下一步" })
36
+ ] }), j = L({ width: x });
37
+ return /* @__PURE__ */ n(
38
+ W,
33
39
  {
34
- title: B,
35
- open: x,
40
+ title: b,
41
+ open: v,
36
42
  onCancel: s,
37
- width: N,
38
- footer: (o == null ? void 0 : o.footer) !== void 0 ? y(o.footer) : /* @__PURE__ */ k("div", { className: a("step-modal-root", f["step-modal-root"]), children: [
39
- i > 0 && (o == null ? void 0 : o.allowBack) !== !1 && /* @__PURE__ */ d(c, { icon: /* @__PURE__ */ d(M, {}), onClick: E, children: "上一步" }),
40
- /* @__PURE__ */ d("div", { className: a("step-modal-container", f["step-modal-container"]) }),
41
- /* @__PURE__ */ d(c, { onClick: s, children: "取消" }),
42
- i < r.length - 1 && /* @__PURE__ */ d(c, { type: "primary", onClick: b, children: "下一步" })
43
- ] }),
44
- maskClosable: v,
45
- className: w,
43
+ width: j,
44
+ centered: !0,
45
+ footer: B(),
46
+ maskClosable: w,
47
+ className: N,
46
48
  children: [
47
- u && r.length > 1 && /* @__PURE__ */ d(
48
- F,
49
+ u && i.length > 1 && /* @__PURE__ */ d(
50
+ z,
49
51
  {
50
- current: i,
52
+ current: r,
51
53
  size: "small",
52
- className: a("step-modal-wrapper", f["step-modal-wrapper"]),
53
- items: r.map((t) => ({ title: t.title, description: t.description }))
54
+ className: e("step-modal-wrapper", f["step-modal-wrapper"]),
55
+ items: i.map((m) => ({ title: m.title, description: m.description }))
54
56
  }
55
57
  ),
56
58
  y(o == null ? void 0 : o.content)
@@ -59,6 +61,6 @@ const y = (m) => {
59
61
  );
60
62
  };
61
63
  export {
62
- H as default
64
+ K as default
63
65
  };
64
66
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../../src/components/Modal/StepModal/index.tsx"],"sourcesContent":["import { ChevronLeft } from '@/components/Icons';\nimport { Button, Modal, Steps } from 'antd';\nimport React, { useCallback, useMemo } from 'react';\nimport type { StepModalProps } from '../StepModalTypes';\nimport styles from './style.module.scss';\nimport classNames from 'classnames';\n\n/** 解析可能是函数的 content / footer */\nconst resolve = (val: React.ReactNode | (() => React.ReactNode) | undefined) => {\n if (val === undefined) return undefined;\n return typeof val === 'function' ? val() : val;\n};\n\n/**\n * 步骤式弹窗\n *\n * 将多步骤流程封装在同一个 Modal 中,自动管理步骤导航、标题切换和底部按钮。\n *\n * 用法:\n * ```tsx\n * const [current, setCurrent] = useState('select');\n * <StepModal\n * open={open}\n * current={current}\n * onCancel={onCancel}\n * steps={[\n * { key: 'select', title: '选择文件', content: <SelectStep /> },\n * { key: 'uploading', title: '上传文件', content: <UploadingStep /> },\n * { key: 'result', title: '上传结果', content: <ResultStep /> },\n * ]}\n * onStepChange={setCurrent}\n * />\n * ```\n */\nconst StepModal: React.FC<StepModalProps> = ({\n title,\n steps,\n current,\n open,\n onCancel,\n width = 600,\n showSteps = true,\n maskClosable = false,\n className,\n onStepChange,\n}) => {\n const currentIndex = useMemo(() => steps.findIndex((s) => s.key === current), [steps, current]);\n const currentStep = steps[currentIndex];\n\n const goBack = useCallback(() => {\n if (currentIndex > 0) {\n onStepChange?.(steps[currentIndex - 1]!.key);\n }\n }, [currentIndex, steps, onStepChange]);\n\n const goNext = useCallback(async () => {\n if (!currentStep?.beforeEnter) {\n if (currentIndex < steps.length - 1) {\n onStepChange?.(steps[currentIndex + 1]!.key);\n }\n return;\n }\n const canEnter = await currentStep.beforeEnter();\n if (canEnter && currentIndex < steps.length - 1) {\n onStepChange?.(steps[currentIndex + 1]!.key);\n }\n }, [currentStep, currentIndex, steps, onStepChange]);\n\n // 自动从标题推导\n const modalTitle = title ?? currentStep?.title ?? '';\n\n // 底部按钮:优先使用步骤自定义 footer,否则自动渲染\"取消/上一步/下一步\"\n const renderFooter = () => {\n if (currentStep?.footer !== undefined) return resolve(currentStep.footer);\n\n return (\n <div className={classNames('step-modal-root', styles['step-modal-root'])}>\n {currentIndex > 0 && currentStep?.allowBack !== false && (\n <Button icon={<ChevronLeft />} onClick={goBack}>\n 上一步\n </Button>\n )}\n <div className={classNames('step-modal-container', styles['step-modal-container'])} />\n <Button onClick={onCancel}>取消</Button>\n {currentIndex < steps.length - 1 && (\n <Button type=\"primary\" onClick={goNext}>\n 下一步\n </Button>\n )}\n </div>\n );\n };\n\n return (\n <Modal\n title={modalTitle}\n open={open}\n onCancel={onCancel}\n width={width}\n footer={renderFooter()}\n maskClosable={maskClosable}\n className={className}\n >\n {showSteps && steps.length > 1 && (\n <Steps\n current={currentIndex}\n size=\"small\"\n className={classNames('step-modal-wrapper', styles['step-modal-wrapper'])}\n items={steps.map((s) => ({ title: s.title, description: s.description }))}\n />\n )}\n {resolve(currentStep?.content)}\n </Modal>\n );\n};\n\nexport default StepModal;\n"],"names":["resolve","val","StepModal","title","steps","current","open","onCancel","width","showSteps","maskClosable","className","onStepChange","currentIndex","useMemo","s","currentStep","goBack","useCallback","goNext","modalTitle","jsxs","Modal","classNames","styles","jsx","Button","ChevronLeft","Steps"],"mappings":";;;;;;A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tE,gBAAAK,EAAC,SAAI,WAAWE,EAAW,mBAAmBC,EAAO,iBAAiB,CAAC,GACpE,UAAA;AAAA,QAAAX,IAAe,MAAKG,KAAA,gBAAAA,EAAa,eAAc,MAC9C,gBAAAS,EAACC,GAAA,EAAO,MAAM,gBAAAD,EAACE,GAAA,CAAA,CAAY,GAAI,SAASV,GAAQ,UAAA,OAEhD;AAAA,QAEF,gBAAAQ,EAAC,SAAI,WAAWF,EAAW,wBAAwBC,EAAO,sBAAsB,CAAC,GAAG;AAAA,QACpF,gBAAAC,EAACC,GAAA,EAAO,SAASnB,GAAU,UAAA,MAAE;AAAA,QAC5BM,IAAeT,EAAM,SAAS,KAC7B,gBAAAqB,EAACC,KAAO,MAAK,WAAU,SAASP,GAAQ,UAAA,MAAA,CAExC;AAAA,MAAA,GAEJ;AAAA,MAWA,cAAAT;AAAA,MACA,WAAAC;AAAA,MAEC,UAAA;AAAA,QAAAF,KAAaL,EAAM,SAAS,KAC3B,gBAAAqB;AAAA,UAACG;AAAA,UAAA;AAAA,YACC,SAASf;AAAA,YACT,MAAK;AAAA,YACL,WAAWU,EAAW,sBAAsBC,EAAO,oBAAoB,CAAC;AAAA,YACxE,OAAOpB,EAAM,IAAI,CAACW,OAAO,EAAE,OAAOA,EAAE,OAAO,aAAaA,EAAE,YAAA,EAAc;AAAA,UAAA;AAAA,QAAA;AAAA,QAG3Ef,EAAQgB,KAAA,gBAAAA,EAAa,OAAO;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGnC;"}
1
+ {"version":3,"file":"index.js","sources":["../../../../src/components/Modal/StepModal/index.tsx"],"sourcesContent":["import { ChevronLeft } from '@/components/Icons';\nimport { Button, Modal, Steps } from 'antd';\nimport React, { useCallback, useMemo } from 'react';\nimport type { StepModalProps } from '../StepModalTypes';\nimport { resolveModalWidth } from '../utils/resolveModalSize';\nimport styles from './style.module.scss';\nimport classNames from 'classnames';\n\n/** 解析可能是函数的 content / footer */\nconst resolve = (val: React.ReactNode | (() => React.ReactNode) | undefined) => {\n if (val === undefined) return undefined;\n return typeof val === 'function' ? val() : val;\n};\n\n/**\n * 步骤式弹窗\n *\n * 将多步骤流程封装在同一个 Modal 中,自动管理步骤导航、标题切换和底部按钮。\n *\n * 用法:\n * ```tsx\n * const [current, setCurrent] = useState('select');\n * <StepModal\n * open={open}\n * current={current}\n * onCancel={onCancel}\n * steps={[\n * { key: 'select', title: '选择文件', content: <SelectStep /> },\n * { key: 'uploading', title: '上传文件', content: <UploadingStep /> },\n * { key: 'result', title: '上传结果', content: <ResultStep /> },\n * ]}\n * onStepChange={setCurrent}\n * />\n * ```\n */\nconst StepModal: React.FC<StepModalProps> = ({\n title,\n steps,\n current,\n open,\n onCancel,\n width = 600,\n showSteps = true,\n maskClosable = false,\n className,\n onStepChange,\n}) => {\n const currentIndex = useMemo(() => steps.findIndex((s) => s.key === current), [steps, current]);\n const currentStep = steps[currentIndex];\n\n const goBack = useCallback(() => {\n if (currentIndex > 0) {\n onStepChange?.(steps[currentIndex - 1]!.key);\n }\n }, [currentIndex, steps, onStepChange]);\n\n const goNext = useCallback(async () => {\n if (!currentStep?.beforeEnter) {\n if (currentIndex < steps.length - 1) {\n onStepChange?.(steps[currentIndex + 1]!.key);\n }\n return;\n }\n const canEnter = await currentStep.beforeEnter();\n if (canEnter && currentIndex < steps.length - 1) {\n onStepChange?.(steps[currentIndex + 1]!.key);\n }\n }, [currentStep, currentIndex, steps, onStepChange]);\n\n // 自动从标题推导\n const modalTitle = title ?? currentStep?.title ?? '';\n\n // 底部按钮:优先使用步骤自定义 footer,否则自动渲染\"取消/上一步/下一步\"\n const renderFooter = () => {\n if (currentStep?.footer !== undefined) return resolve(currentStep.footer);\n\n return (\n <div className={classNames('step-modal-root', styles['step-modal-root'])}>\n {currentIndex > 0 && currentStep?.allowBack !== false && (\n <Button icon={<ChevronLeft />} onClick={goBack}>\n 上一步\n </Button>\n )}\n <div className={classNames('step-modal-container', styles['step-modal-container'])} />\n <Button onClick={onCancel}>取消</Button>\n {currentIndex < steps.length - 1 && (\n <Button type=\"primary\" onClick={goNext}>\n 下一步\n </Button>\n )}\n </div>\n );\n };\n\n const effectiveWidth = resolveModalWidth({ width });\n\n return (\n <Modal\n title={modalTitle}\n open={open}\n onCancel={onCancel}\n width={effectiveWidth}\n centered\n footer={renderFooter()}\n maskClosable={maskClosable}\n className={className}\n >\n {showSteps && steps.length > 1 && (\n <Steps\n current={currentIndex}\n size=\"small\"\n className={classNames('step-modal-wrapper', styles['step-modal-wrapper'])}\n items={steps.map((s) => ({ title: s.title, description: s.description }))}\n />\n )}\n {resolve(currentStep?.content)}\n </Modal>\n );\n};\n\nexport default StepModal;\n"],"names":["resolve","val","StepModal","title","steps","current","open","onCancel","width","showSteps","maskClosable","className","onStepChange","currentIndex","useMemo","s","currentStep","goBack","useCallback","goNext","modalTitle","renderFooter","jsxs","classNames","styles","jsx","Button","ChevronLeft","effectiveWidth","resolveModalWidth","Modal","Steps"],"mappings":";;;;;;;AASA,MAAMA,IAAU,CAACC,MAA+D;AAC9E,MAAIA,MAAQ;AACZ,WAAO,OAAOA,KAAQ,aAAaA,EAAA,IAAQA;AAC7C,GAuBMC,IAAsC,CAAC;AAAA,EAC3C,OAAAC;AAAA,EACA,OAAAC;AAAA,EACA,SAAAC;AAAA,EACA,MAAAC;AAAA,EACA,UAAAC;AAAA,EACA,OAAAC,IAAQ;AAAA,EACR,WAAAC,IAAY;AAAA,EACZ,cAAAC,IAAe;AAAA,EACf,WAAAC;AAAA,EACA,cAAAC;AACF,MAAM;AACJ,QAAMC,IAAeC,EAAQ,MAAMV,EAAM,UAAU,CAACW,MAAMA,EAAE,QAAQV,CAAO,GAAG,CAACD,GAAOC,CAAO,CAAC,GACxFW,IAAcZ,EAAMS,CAAY,GAEhCI,IAASC,EAAY,MAAM;AAC/B,IAAIL,IAAe,MACjBD,KAAA,QAAAA,EAAeR,EAAMS,IAAe,CAAC,EAAG;AAAA,EAE5C,GAAG,CAACA,GAAcT,GAAOQ,C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AC;AAAA,MAEC,UAAA;AAAA,QAAAF,KAAaL,EAAM,SAAS,KAC3B,gBAAAqB;AAAA,UAACM;AAAA,UAAA;AAAA,YACC,SAASlB;AAAA,YACT,MAAK;AAAA,YACL,WAAWU,EAAW,sBAAsBC,EAAO,oBAAoB,CAAC;AAAA,YACxE,OAAOpB,EAAM,IAAI,CAACW,OAAO,EAAE,OAAOA,EAAE,OAAO,aAAaA,EAAE,YAAA,EAAc;AAAA,UAAA;AAAA,QAAA;AAAA,QAG3Ef,EAAQgB,KAAA,gBAAAA,EAAa,OAAO;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGnC;"}
@@ -1,2 +1,5 @@
1
+ export { default as Modal } from './Modal';
2
+ export type { MarsunModalProps } from './ModalTypes';
1
3
  export { default as StepModal } from './StepModal';
2
4
  export type { StepItem, StepModalProps } from './StepModalTypes';
5
+ export { MODAL_SIZE_BODY_HEIGHT, MODAL_SIZE_WIDTH, resolveModalSizeAnchor, resolveModalWidth, type ModalSize, type ResolveModalWidthOptions, } from './utils/resolveModalSize';