@rockshin/tao-ui 0.0.32 → 0.0.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.
- package/component-manifest.json +55 -1
- package/dist/components/select/select.js +3 -1
- package/dist/components/steps/steps-icons.d.ts +11 -0
- package/dist/components/steps/steps-icons.js +111 -0
- package/dist/components/steps/steps.css +754 -0
- package/dist/components/steps/steps.d.ts +92 -0
- package/dist/components/steps/steps.js +473 -0
- package/dist/components/steps/use-display-steps.d.ts +24 -0
- package/dist/components/steps/use-display-steps.js +107 -0
- package/dist/components/table/table.css +24 -1
- package/dist/docs/component-docs.js +2 -0
- package/dist/docs/components/steps.doc.d.ts +18 -0
- package/dist/docs/components/steps.doc.js +55 -0
- package/dist/entries/steps.d.ts +3 -0
- package/dist/entries/steps.js +4 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/theme/theme.css +28 -0
- package/dist/theme/tokens.d.ts +2 -2
- package/dist/theme/tokens.js +29 -0
- package/llms.txt +14 -1
- package/package.json +1 -1
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { type CSSProperties, type Key, type MouseEvent, type ReactNode } from 'react';
|
|
2
|
+
import { type TaoSize } from '../../provider/tao-provider';
|
|
3
|
+
import { type SemanticClassNames, type SemanticStyles } from '../../utils/semantic';
|
|
4
|
+
import './steps.css';
|
|
5
|
+
export type StepsStatus = 'wait' | 'process' | 'finish' | 'error';
|
|
6
|
+
export type StepsType = 'default' | 'dot' | 'inline' | 'navigation' | 'panel';
|
|
7
|
+
export type StepsOrientation = 'horizontal' | 'vertical';
|
|
8
|
+
export type StepsTitlePlacement = 'horizontal' | 'vertical';
|
|
9
|
+
export type StepsVariant = 'filled' | 'outlined';
|
|
10
|
+
/** Steps renders at `small` or `medium` only — antd has no `large` step size. */
|
|
11
|
+
export type StepsSize = Exclude<TaoSize, 'large'>;
|
|
12
|
+
export type StepsSemanticPart = 'root' | 'item' | 'itemWrapper' | 'itemIcon' | 'itemSection' | 'itemHeader' | 'itemTitle' | 'itemSubtitle' | 'itemContent' | 'itemRail';
|
|
13
|
+
/** Per-step overrides — every part except the Steps-level `root`. */
|
|
14
|
+
export type StepsItemSemanticPart = Exclude<StepsSemanticPart, 'root'>;
|
|
15
|
+
export interface StepItem {
|
|
16
|
+
key?: Key;
|
|
17
|
+
/** Primary label. */
|
|
18
|
+
title?: ReactNode;
|
|
19
|
+
/** Secondary label shown next to (or under) the title. */
|
|
20
|
+
subTitle?: ReactNode;
|
|
21
|
+
/** Supporting copy shown under the header. */
|
|
22
|
+
content?: ReactNode;
|
|
23
|
+
/** Replaces the generated number / status glyph. */
|
|
24
|
+
icon?: ReactNode;
|
|
25
|
+
/** Overrides the status derived from `current`. */
|
|
26
|
+
status?: StepsStatus;
|
|
27
|
+
/** Blocks clicking and dims the step. */
|
|
28
|
+
disabled?: boolean;
|
|
29
|
+
/** Per-step click handler; runs in addition to `Steps` `onChange`. */
|
|
30
|
+
onClick?: (event: MouseEvent<HTMLElement>) => void;
|
|
31
|
+
className?: string;
|
|
32
|
+
style?: CSSProperties;
|
|
33
|
+
classNames?: SemanticClassNames<StepsItemSemanticPart>;
|
|
34
|
+
styles?: SemanticStyles<StepsItemSemanticPart>;
|
|
35
|
+
}
|
|
36
|
+
/** The icon container handed to `iconRender` through `info.components.Icon`. */
|
|
37
|
+
export type StepsIconComponent = (props: {
|
|
38
|
+
children?: ReactNode;
|
|
39
|
+
className?: string;
|
|
40
|
+
style?: CSSProperties;
|
|
41
|
+
}) => ReactNode;
|
|
42
|
+
export interface StepsIconRenderInfo {
|
|
43
|
+
/** Zero-based absolute step index (includes `initial`). */
|
|
44
|
+
index: number;
|
|
45
|
+
/** Whether this is the current step. */
|
|
46
|
+
active: boolean;
|
|
47
|
+
/** The resolved step, with `content` filled in. */
|
|
48
|
+
item: StepItem;
|
|
49
|
+
components: {
|
|
50
|
+
Icon: StepsIconComponent;
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
export type StepsIconRender = (originNode: ReactNode, info: StepsIconRenderInfo) => ReactNode;
|
|
54
|
+
export interface StepsProps {
|
|
55
|
+
/** Step data. */
|
|
56
|
+
items?: StepItem[];
|
|
57
|
+
/** Current step, counted from 0. Overridden per step by `items.status`. */
|
|
58
|
+
current?: number;
|
|
59
|
+
/** Numbering offset — the first step is numbered `initial + 1`. */
|
|
60
|
+
initial?: number;
|
|
61
|
+
/** Status of the `current` step; the others derive theirs from position. */
|
|
62
|
+
status?: StepsStatus;
|
|
63
|
+
/** Layout axis. */
|
|
64
|
+
orientation?: StepsOrientation;
|
|
65
|
+
/** Where the title sits relative to the icon. */
|
|
66
|
+
titlePlacement?: StepsTitlePlacement;
|
|
67
|
+
/** Collapse to `vertical` below 576px. */
|
|
68
|
+
responsive?: boolean;
|
|
69
|
+
/** Visual density. */
|
|
70
|
+
size?: StepsSize;
|
|
71
|
+
/** Style variant. */
|
|
72
|
+
variant?: StepsVariant;
|
|
73
|
+
/** Steps flavour. */
|
|
74
|
+
type?: StepsType;
|
|
75
|
+
/** Progress ring on the `process` icon; ignored by `type="inline"`. */
|
|
76
|
+
percent?: number;
|
|
77
|
+
/** Collapse to at most N steps (`>= 3`); hidden ranges become an ellipsis step. */
|
|
78
|
+
maxCount?: number;
|
|
79
|
+
/** Leading flex offset for `type="inline"`. */
|
|
80
|
+
offset?: number;
|
|
81
|
+
/** Truncate overflowing titles, subtitles, and content. */
|
|
82
|
+
ellipsis?: boolean;
|
|
83
|
+
/** Replace the icon node of every step. */
|
|
84
|
+
iconRender?: StepsIconRender;
|
|
85
|
+
/** Fires with the absolute step index when a non-current step is activated. */
|
|
86
|
+
onChange?: (current: number) => void;
|
|
87
|
+
className?: string;
|
|
88
|
+
style?: CSSProperties;
|
|
89
|
+
classNames?: SemanticClassNames<StepsSemanticPart>;
|
|
90
|
+
styles?: SemanticStyles<StepsSemanticPart>;
|
|
91
|
+
}
|
|
92
|
+
export declare function Steps({ items, current, initial, status, orientation, titlePlacement, responsive, size, variant, type, percent, maxCount, offset, ellipsis, iconRender, onChange, className, style, classNames, styles, }: StepsProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,473 @@
|
|
|
1
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { c } from "react-compiler-runtime";
|
|
3
|
+
import { createContext, useContext } from "react";
|
|
4
|
+
import { useTaoConfig } from "../../provider/tao-provider.js";
|
|
5
|
+
import { useBreakpoint } from "../../utils/breakpoint.js";
|
|
6
|
+
import { cx } from "../../utils/semantic.js";
|
|
7
|
+
import { Tooltip } from "../tooltip/tooltip.js";
|
|
8
|
+
import { PanelArrow, StepCheckIcon, StepCloseIcon } from "./steps-icons.js";
|
|
9
|
+
import { useDisplaySteps } from "./use-display-steps.js";
|
|
10
|
+
import "./steps.css";
|
|
11
|
+
const StepsSemanticContext = /*#__PURE__*/ createContext({});
|
|
12
|
+
const StepsItemSemanticContext = /*#__PURE__*/ createContext({});
|
|
13
|
+
function StepIcon(t0) {
|
|
14
|
+
const $ = c(12);
|
|
15
|
+
const { children, className, style } = t0;
|
|
16
|
+
const { classNames, styles } = useContext(StepsSemanticContext);
|
|
17
|
+
const item = useContext(StepsItemSemanticContext);
|
|
18
|
+
const t1 = classNames?.itemIcon;
|
|
19
|
+
const t2 = item.classNames?.itemIcon;
|
|
20
|
+
let t3;
|
|
21
|
+
if ($[0] !== className || $[1] !== t1 || $[2] !== t2) {
|
|
22
|
+
t3 = cx(t1, t2, className);
|
|
23
|
+
$[0] = className;
|
|
24
|
+
$[1] = t1;
|
|
25
|
+
$[2] = t2;
|
|
26
|
+
$[3] = t3;
|
|
27
|
+
} else t3 = $[3];
|
|
28
|
+
const t4 = styles?.itemIcon;
|
|
29
|
+
const t5 = item.styles?.itemIcon;
|
|
30
|
+
let t6;
|
|
31
|
+
if ($[4] !== style || $[5] !== t4 || $[6] !== t5) {
|
|
32
|
+
t6 = {
|
|
33
|
+
...t4,
|
|
34
|
+
...t5,
|
|
35
|
+
...style
|
|
36
|
+
};
|
|
37
|
+
$[4] = style;
|
|
38
|
+
$[5] = t4;
|
|
39
|
+
$[6] = t5;
|
|
40
|
+
$[7] = t6;
|
|
41
|
+
} else t6 = $[7];
|
|
42
|
+
let t7;
|
|
43
|
+
if ($[8] !== children || $[9] !== t3 || $[10] !== t6) {
|
|
44
|
+
t7 = /*#__PURE__*/ jsx("div", {
|
|
45
|
+
"data-tao-step-icon": "",
|
|
46
|
+
className: t3,
|
|
47
|
+
style: t6,
|
|
48
|
+
children: children
|
|
49
|
+
});
|
|
50
|
+
$[8] = children;
|
|
51
|
+
$[9] = t3;
|
|
52
|
+
$[10] = t6;
|
|
53
|
+
$[11] = t7;
|
|
54
|
+
} else t7 = $[11];
|
|
55
|
+
return t7;
|
|
56
|
+
}
|
|
57
|
+
function ProgressIcon(t0) {
|
|
58
|
+
const $ = c(9);
|
|
59
|
+
const { percent, children } = t0;
|
|
60
|
+
const dashArray = `calc(var(--tao-steps-progress-radius) * 2 * ${Math.PI * percent / 100}) 9999`;
|
|
61
|
+
let t1;
|
|
62
|
+
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
63
|
+
t1 = /*#__PURE__*/ jsx("circle", {
|
|
64
|
+
"data-tao-steps-progress-rail": ""
|
|
65
|
+
});
|
|
66
|
+
$[0] = t1;
|
|
67
|
+
} else t1 = $[0];
|
|
68
|
+
let t2;
|
|
69
|
+
if ($[1] !== dashArray) {
|
|
70
|
+
t2 = /*#__PURE__*/ jsx("circle", {
|
|
71
|
+
"data-tao-steps-progress-ptg": "",
|
|
72
|
+
strokeDasharray: dashArray,
|
|
73
|
+
transform: "rotate(-90 50 50)"
|
|
74
|
+
});
|
|
75
|
+
$[1] = dashArray;
|
|
76
|
+
$[2] = t2;
|
|
77
|
+
} else t2 = $[2];
|
|
78
|
+
let t3;
|
|
79
|
+
if ($[3] !== percent || $[4] !== t2) {
|
|
80
|
+
t3 = /*#__PURE__*/ jsxs("svg", {
|
|
81
|
+
"data-tao-steps-progress": "",
|
|
82
|
+
viewBox: "0 0 100 100",
|
|
83
|
+
width: "100%",
|
|
84
|
+
height: "100%",
|
|
85
|
+
role: "progressbar",
|
|
86
|
+
"aria-valuemin": 0,
|
|
87
|
+
"aria-valuemax": 100,
|
|
88
|
+
"aria-valuenow": percent,
|
|
89
|
+
children: [
|
|
90
|
+
t1,
|
|
91
|
+
t2
|
|
92
|
+
]
|
|
93
|
+
});
|
|
94
|
+
$[3] = percent;
|
|
95
|
+
$[4] = t2;
|
|
96
|
+
$[5] = t3;
|
|
97
|
+
} else t3 = $[5];
|
|
98
|
+
let t4;
|
|
99
|
+
if ($[6] !== children || $[7] !== t3) {
|
|
100
|
+
t4 = /*#__PURE__*/ jsxs(Fragment, {
|
|
101
|
+
children: [
|
|
102
|
+
t3,
|
|
103
|
+
children
|
|
104
|
+
]
|
|
105
|
+
});
|
|
106
|
+
$[6] = children;
|
|
107
|
+
$[7] = t3;
|
|
108
|
+
$[8] = t4;
|
|
109
|
+
} else t4 = $[8];
|
|
110
|
+
return t4;
|
|
111
|
+
}
|
|
112
|
+
function resolveStatuses(displaySteps, displayCurrent, currentStatus) {
|
|
113
|
+
return displaySteps.map((step, index)=>{
|
|
114
|
+
if (step.item.status) return step.item.status;
|
|
115
|
+
if (index === displayCurrent) return currentStatus;
|
|
116
|
+
return index < displayCurrent ? 'finish' : 'wait';
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
function Steps(t0) {
|
|
120
|
+
const $ = c(94);
|
|
121
|
+
const { items, current: t1, initial: t2, status: t3, orientation, titlePlacement, responsive: t4, size, variant: t5, type, percent, maxCount, offset: t6, ellipsis: t7, iconRender, onChange, className, style, classNames, styles } = t0;
|
|
122
|
+
const current = void 0 === t1 ? 0 : t1;
|
|
123
|
+
const initial = void 0 === t2 ? 0 : t2;
|
|
124
|
+
const status = void 0 === t3 ? "process" : t3;
|
|
125
|
+
const responsive = void 0 === t4 ? true : t4;
|
|
126
|
+
const variant = void 0 === t5 ? "filled" : t5;
|
|
127
|
+
const offset = void 0 === t6 ? 0 : t6;
|
|
128
|
+
const ellipsis = void 0 === t7 ? false : t7;
|
|
129
|
+
const { size: contextSize } = useTaoConfig();
|
|
130
|
+
const screens = useBreakpoint();
|
|
131
|
+
const resolvedSize = size ?? ("large" === contextSize ? "medium" : contextSize);
|
|
132
|
+
let t8;
|
|
133
|
+
if ($[0] !== items) {
|
|
134
|
+
t8 = items ?? [];
|
|
135
|
+
$[0] = items;
|
|
136
|
+
$[1] = t8;
|
|
137
|
+
} else t8 = $[1];
|
|
138
|
+
let t9;
|
|
139
|
+
if ($[2] !== t8) {
|
|
140
|
+
t9 = t8.filter(Boolean);
|
|
141
|
+
$[2] = t8;
|
|
142
|
+
$[3] = t9;
|
|
143
|
+
} else t9 = $[3];
|
|
144
|
+
const mergedItems = t9;
|
|
145
|
+
const mergedType = type ?? "default";
|
|
146
|
+
const isInline = "inline" === mergedType;
|
|
147
|
+
const isDot = "dot" === mergedType || isInline;
|
|
148
|
+
const isPanel = "panel" === mergedType;
|
|
149
|
+
const mergedOrientation = isPanel ? "horizontal" : "vertical" === orientation || responsive && true === screens.xs ? "vertical" : "horizontal";
|
|
150
|
+
const mergedTitlePlacement = isDot || "vertical" === mergedOrientation ? "vertical" === mergedOrientation ? "horizontal" : "vertical" : "navigation" === mergedType ? "horizontal" : titlePlacement ?? "horizontal";
|
|
151
|
+
const mergedPercent = isInline ? void 0 : percent;
|
|
152
|
+
const { canApplyMaxCount, displaySteps, displayCurrent } = useDisplaySteps(mergedItems, current, initial, maxCount);
|
|
153
|
+
let t10;
|
|
154
|
+
if ($[4] !== displayCurrent || $[5] !== displaySteps || $[6] !== status) {
|
|
155
|
+
t10 = resolveStatuses(displaySteps, displayCurrent, status);
|
|
156
|
+
$[4] = displayCurrent;
|
|
157
|
+
$[5] = displaySteps;
|
|
158
|
+
$[6] = status;
|
|
159
|
+
$[7] = t10;
|
|
160
|
+
} else t10 = $[7];
|
|
161
|
+
const statuses = t10;
|
|
162
|
+
let t11;
|
|
163
|
+
if ($[8] !== classNames || $[9] !== styles) {
|
|
164
|
+
t11 = {
|
|
165
|
+
classNames,
|
|
166
|
+
styles
|
|
167
|
+
};
|
|
168
|
+
$[8] = classNames;
|
|
169
|
+
$[9] = styles;
|
|
170
|
+
$[10] = t11;
|
|
171
|
+
} else t11 = $[10];
|
|
172
|
+
const semanticValue = t11;
|
|
173
|
+
let t12;
|
|
174
|
+
if ($[11] !== current || $[12] !== displaySteps || $[13] !== initial || $[14] !== onChange) {
|
|
175
|
+
t12 = (displayIndex)=>{
|
|
176
|
+
const target = displaySteps[displayIndex];
|
|
177
|
+
if (!onChange || !target || target.originIndex < 0) return;
|
|
178
|
+
const next = initial + target.originIndex;
|
|
179
|
+
if (next !== current) onChange(next);
|
|
180
|
+
};
|
|
181
|
+
$[11] = current;
|
|
182
|
+
$[12] = displaySteps;
|
|
183
|
+
$[13] = initial;
|
|
184
|
+
$[14] = onChange;
|
|
185
|
+
$[15] = t12;
|
|
186
|
+
} else t12 = $[15];
|
|
187
|
+
const handleStepClick = t12;
|
|
188
|
+
const t13 = String(isInline ? offset : 0);
|
|
189
|
+
const t14 = styles?.root;
|
|
190
|
+
let t15;
|
|
191
|
+
if ($[16] !== style || $[17] !== t13 || $[18] !== t14) {
|
|
192
|
+
t15 = {
|
|
193
|
+
"--tao-steps-items-offset": t13,
|
|
194
|
+
...t14,
|
|
195
|
+
...style
|
|
196
|
+
};
|
|
197
|
+
$[16] = style;
|
|
198
|
+
$[17] = t13;
|
|
199
|
+
$[18] = t14;
|
|
200
|
+
$[19] = t15;
|
|
201
|
+
} else t15 = $[19];
|
|
202
|
+
const rootStyle = t15;
|
|
203
|
+
const t16 = ellipsis || void 0;
|
|
204
|
+
const t17 = canApplyMaxCount || void 0;
|
|
205
|
+
const t18 = void 0 !== mergedPercent || void 0;
|
|
206
|
+
const t19 = classNames?.root;
|
|
207
|
+
let t20;
|
|
208
|
+
if ($[20] !== className || $[21] !== t19) {
|
|
209
|
+
t20 = cx(t19, className);
|
|
210
|
+
$[20] = className;
|
|
211
|
+
$[21] = t19;
|
|
212
|
+
$[22] = t20;
|
|
213
|
+
} else t20 = $[22];
|
|
214
|
+
let t21;
|
|
215
|
+
if ($[23] !== classNames?.item || $[24] !== classNames?.itemContent || $[25] !== classNames?.itemHeader || $[26] !== classNames?.itemRail || $[27] !== classNames?.itemSection || $[28] !== classNames?.itemSubtitle || $[29] !== classNames?.itemTitle || $[30] !== classNames?.itemWrapper || $[31] !== displayCurrent || $[32] !== displaySteps || $[33] !== handleStepClick || $[34] !== iconRender || $[35] !== initial || $[36] !== isDot || $[37] !== isInline || $[38] !== isPanel || $[39] !== mergedPercent || $[40] !== onChange || $[41] !== statuses || $[42] !== styles?.item || $[43] !== styles?.itemContent || $[44] !== styles?.itemHeader || $[45] !== styles?.itemRail || $[46] !== styles?.itemSection || $[47] !== styles?.itemSubtitle || $[48] !== styles?.itemTitle || $[49] !== styles?.itemWrapper) {
|
|
216
|
+
let t22;
|
|
217
|
+
if ($[51] !== classNames?.item || $[52] !== classNames?.itemContent || $[53] !== classNames?.itemHeader || $[54] !== classNames?.itemRail || $[55] !== classNames?.itemSection || $[56] !== classNames?.itemSubtitle || $[57] !== classNames?.itemTitle || $[58] !== classNames?.itemWrapper || $[59] !== displayCurrent || $[60] !== displaySteps.length || $[61] !== handleStepClick || $[62] !== iconRender || $[63] !== initial || $[64] !== isDot || $[65] !== isInline || $[66] !== isPanel || $[67] !== mergedPercent || $[68] !== onChange || $[69] !== statuses || $[70] !== styles?.item || $[71] !== styles?.itemContent || $[72] !== styles?.itemHeader || $[73] !== styles?.itemRail || $[74] !== styles?.itemSection || $[75] !== styles?.itemSubtitle || $[76] !== styles?.itemTitle || $[77] !== styles?.itemWrapper) {
|
|
218
|
+
t22 = (displayStep, displayIndex_0)=>{
|
|
219
|
+
const { item, originIndex, ellipsis: isEllipsisStep } = displayStep;
|
|
220
|
+
const stepStatus = statuses[displayIndex_0];
|
|
221
|
+
const nextStatus = statuses[displayIndex_0 + 1];
|
|
222
|
+
const isLast = displayIndex_0 === displaySteps.length - 1;
|
|
223
|
+
const active = displayIndex_0 === displayCurrent;
|
|
224
|
+
const stepIndex = originIndex >= 0 ? initial + originIndex : displayIndex_0;
|
|
225
|
+
const hasTitle = void 0 !== item.title && null !== item.title;
|
|
226
|
+
const hasSubTitle = void 0 !== item.subTitle && null !== item.subTitle;
|
|
227
|
+
const hasContent = void 0 !== item.content && null !== item.content;
|
|
228
|
+
const itemClassNames = item.classNames;
|
|
229
|
+
const itemStyles = item.styles;
|
|
230
|
+
const clickable = (!!onChange || !!item.onClick) && !item.disabled && !isEllipsisStep;
|
|
231
|
+
let iconContent;
|
|
232
|
+
if (isDot || item.icon) iconContent = item.icon;
|
|
233
|
+
else if ("finish" === stepStatus) iconContent = /*#__PURE__*/ jsx(StepCheckIcon, {});
|
|
234
|
+
else if ("error" === stepStatus) iconContent = /*#__PURE__*/ jsx(StepCloseIcon, {});
|
|
235
|
+
else {
|
|
236
|
+
let numberNode = /*#__PURE__*/ jsx("span", {
|
|
237
|
+
"data-tao-steps-icon-number": "",
|
|
238
|
+
children: stepIndex + 1
|
|
239
|
+
});
|
|
240
|
+
if ("process" === stepStatus && void 0 !== mergedPercent) numberNode = /*#__PURE__*/ jsx(ProgressIcon, {
|
|
241
|
+
percent: mergedPercent,
|
|
242
|
+
children: numberNode
|
|
243
|
+
});
|
|
244
|
+
iconContent = numberNode;
|
|
245
|
+
}
|
|
246
|
+
let iconNode = /*#__PURE__*/ jsx(StepIcon, {
|
|
247
|
+
children: iconContent
|
|
248
|
+
});
|
|
249
|
+
if (iconRender) iconNode = iconRender(iconNode, {
|
|
250
|
+
index: stepIndex,
|
|
251
|
+
active,
|
|
252
|
+
item,
|
|
253
|
+
components: {
|
|
254
|
+
Icon: StepIcon
|
|
255
|
+
}
|
|
256
|
+
});
|
|
257
|
+
const accessibilityProps = clickable ? {
|
|
258
|
+
role: "button",
|
|
259
|
+
tabIndex: 0,
|
|
260
|
+
onClick: (event)=>{
|
|
261
|
+
item.onClick?.(event);
|
|
262
|
+
handleStepClick(displayIndex_0);
|
|
263
|
+
},
|
|
264
|
+
onKeyDown: _temp
|
|
265
|
+
} : {};
|
|
266
|
+
const itemKey = originIndex >= 0 ? `step-${initial + originIndex}` : item.key;
|
|
267
|
+
const stepNode = /*#__PURE__*/ jsxs("div", {
|
|
268
|
+
...accessibilityProps,
|
|
269
|
+
"data-tao-step": "",
|
|
270
|
+
"data-tao-status": stepStatus,
|
|
271
|
+
"data-tao-active": active || void 0,
|
|
272
|
+
"data-tao-disabled": item.disabled || void 0,
|
|
273
|
+
"data-tao-custom": item.icon ? true : void 0,
|
|
274
|
+
"data-tao-empty-header": hasTitle || hasSubTitle ? void 0 : true,
|
|
275
|
+
"data-tao-ellipsis": isEllipsisStep || void 0,
|
|
276
|
+
"aria-current": active ? "step" : void 0,
|
|
277
|
+
className: cx(classNames?.item, itemClassNames?.item, item.className),
|
|
278
|
+
style: {
|
|
279
|
+
...styles?.item,
|
|
280
|
+
...itemStyles?.item,
|
|
281
|
+
...item.style
|
|
282
|
+
},
|
|
283
|
+
children: [
|
|
284
|
+
/*#__PURE__*/ jsx(StepsItemSemanticContext.Provider, {
|
|
285
|
+
value: {
|
|
286
|
+
classNames: itemClassNames,
|
|
287
|
+
styles: itemStyles
|
|
288
|
+
},
|
|
289
|
+
children: /*#__PURE__*/ jsxs("div", {
|
|
290
|
+
"data-tao-step-wrapper": "",
|
|
291
|
+
className: cx(classNames?.itemWrapper, itemClassNames?.itemWrapper),
|
|
292
|
+
style: {
|
|
293
|
+
...styles?.itemWrapper,
|
|
294
|
+
...itemStyles?.itemWrapper
|
|
295
|
+
},
|
|
296
|
+
children: [
|
|
297
|
+
iconNode,
|
|
298
|
+
/*#__PURE__*/ jsxs("div", {
|
|
299
|
+
"data-tao-step-section": "",
|
|
300
|
+
className: cx(classNames?.itemSection, itemClassNames?.itemSection),
|
|
301
|
+
style: {
|
|
302
|
+
...styles?.itemSection,
|
|
303
|
+
...itemStyles?.itemSection
|
|
304
|
+
},
|
|
305
|
+
children: [
|
|
306
|
+
/*#__PURE__*/ jsxs("div", {
|
|
307
|
+
"data-tao-step-header": "",
|
|
308
|
+
className: cx(classNames?.itemHeader, itemClassNames?.itemHeader),
|
|
309
|
+
style: {
|
|
310
|
+
...styles?.itemHeader,
|
|
311
|
+
...itemStyles?.itemHeader
|
|
312
|
+
},
|
|
313
|
+
children: [
|
|
314
|
+
hasTitle && /*#__PURE__*/ jsx("div", {
|
|
315
|
+
"data-tao-step-title": "",
|
|
316
|
+
className: cx(classNames?.itemTitle, itemClassNames?.itemTitle),
|
|
317
|
+
style: {
|
|
318
|
+
...styles?.itemTitle,
|
|
319
|
+
...itemStyles?.itemTitle
|
|
320
|
+
},
|
|
321
|
+
children: item.title
|
|
322
|
+
}),
|
|
323
|
+
hasSubTitle && /*#__PURE__*/ jsx("div", {
|
|
324
|
+
"data-tao-step-subtitle": "",
|
|
325
|
+
title: "string" == typeof item.subTitle ? item.subTitle : void 0,
|
|
326
|
+
className: cx(classNames?.itemSubtitle, itemClassNames?.itemSubtitle),
|
|
327
|
+
style: {
|
|
328
|
+
...styles?.itemSubtitle,
|
|
329
|
+
...itemStyles?.itemSubtitle
|
|
330
|
+
},
|
|
331
|
+
children: item.subTitle
|
|
332
|
+
}),
|
|
333
|
+
!isLast && /*#__PURE__*/ jsx("div", {
|
|
334
|
+
"data-tao-step-rail": "",
|
|
335
|
+
"data-tao-status": nextStatus,
|
|
336
|
+
className: cx(classNames?.itemRail, itemClassNames?.itemRail),
|
|
337
|
+
style: {
|
|
338
|
+
...styles?.itemRail,
|
|
339
|
+
...itemStyles?.itemRail
|
|
340
|
+
}
|
|
341
|
+
})
|
|
342
|
+
]
|
|
343
|
+
}),
|
|
344
|
+
hasContent && /*#__PURE__*/ jsx("div", {
|
|
345
|
+
"data-tao-step-content": "",
|
|
346
|
+
className: cx(classNames?.itemContent, itemClassNames?.itemContent),
|
|
347
|
+
style: {
|
|
348
|
+
...styles?.itemContent,
|
|
349
|
+
...itemStyles?.itemContent
|
|
350
|
+
},
|
|
351
|
+
children: item.content
|
|
352
|
+
})
|
|
353
|
+
]
|
|
354
|
+
})
|
|
355
|
+
]
|
|
356
|
+
})
|
|
357
|
+
}),
|
|
358
|
+
isPanel && /*#__PURE__*/ jsx(PanelArrow, {})
|
|
359
|
+
]
|
|
360
|
+
}, itemKey);
|
|
361
|
+
if (isInline && hasContent) return /*#__PURE__*/ jsx(Tooltip, {
|
|
362
|
+
title: item.content,
|
|
363
|
+
children: stepNode
|
|
364
|
+
}, itemKey);
|
|
365
|
+
return stepNode;
|
|
366
|
+
};
|
|
367
|
+
$[51] = classNames?.item;
|
|
368
|
+
$[52] = classNames?.itemContent;
|
|
369
|
+
$[53] = classNames?.itemHeader;
|
|
370
|
+
$[54] = classNames?.itemRail;
|
|
371
|
+
$[55] = classNames?.itemSection;
|
|
372
|
+
$[56] = classNames?.itemSubtitle;
|
|
373
|
+
$[57] = classNames?.itemTitle;
|
|
374
|
+
$[58] = classNames?.itemWrapper;
|
|
375
|
+
$[59] = displayCurrent;
|
|
376
|
+
$[60] = displaySteps.length;
|
|
377
|
+
$[61] = handleStepClick;
|
|
378
|
+
$[62] = iconRender;
|
|
379
|
+
$[63] = initial;
|
|
380
|
+
$[64] = isDot;
|
|
381
|
+
$[65] = isInline;
|
|
382
|
+
$[66] = isPanel;
|
|
383
|
+
$[67] = mergedPercent;
|
|
384
|
+
$[68] = onChange;
|
|
385
|
+
$[69] = statuses;
|
|
386
|
+
$[70] = styles?.item;
|
|
387
|
+
$[71] = styles?.itemContent;
|
|
388
|
+
$[72] = styles?.itemHeader;
|
|
389
|
+
$[73] = styles?.itemRail;
|
|
390
|
+
$[74] = styles?.itemSection;
|
|
391
|
+
$[75] = styles?.itemSubtitle;
|
|
392
|
+
$[76] = styles?.itemTitle;
|
|
393
|
+
$[77] = styles?.itemWrapper;
|
|
394
|
+
$[78] = t22;
|
|
395
|
+
} else t22 = $[78];
|
|
396
|
+
t21 = displaySteps.map(t22);
|
|
397
|
+
$[23] = classNames?.item;
|
|
398
|
+
$[24] = classNames?.itemContent;
|
|
399
|
+
$[25] = classNames?.itemHeader;
|
|
400
|
+
$[26] = classNames?.itemRail;
|
|
401
|
+
$[27] = classNames?.itemSection;
|
|
402
|
+
$[28] = classNames?.itemSubtitle;
|
|
403
|
+
$[29] = classNames?.itemTitle;
|
|
404
|
+
$[30] = classNames?.itemWrapper;
|
|
405
|
+
$[31] = displayCurrent;
|
|
406
|
+
$[32] = displaySteps;
|
|
407
|
+
$[33] = handleStepClick;
|
|
408
|
+
$[34] = iconRender;
|
|
409
|
+
$[35] = initial;
|
|
410
|
+
$[36] = isDot;
|
|
411
|
+
$[37] = isInline;
|
|
412
|
+
$[38] = isPanel;
|
|
413
|
+
$[39] = mergedPercent;
|
|
414
|
+
$[40] = onChange;
|
|
415
|
+
$[41] = statuses;
|
|
416
|
+
$[42] = styles?.item;
|
|
417
|
+
$[43] = styles?.itemContent;
|
|
418
|
+
$[44] = styles?.itemHeader;
|
|
419
|
+
$[45] = styles?.itemRail;
|
|
420
|
+
$[46] = styles?.itemSection;
|
|
421
|
+
$[47] = styles?.itemSubtitle;
|
|
422
|
+
$[48] = styles?.itemTitle;
|
|
423
|
+
$[49] = styles?.itemWrapper;
|
|
424
|
+
$[50] = t21;
|
|
425
|
+
} else t21 = $[50];
|
|
426
|
+
let t22;
|
|
427
|
+
if ($[79] !== semanticValue || $[80] !== t21) {
|
|
428
|
+
t22 = /*#__PURE__*/ jsx(StepsSemanticContext.Provider, {
|
|
429
|
+
value: semanticValue,
|
|
430
|
+
children: t21
|
|
431
|
+
});
|
|
432
|
+
$[79] = semanticValue;
|
|
433
|
+
$[80] = t21;
|
|
434
|
+
$[81] = t22;
|
|
435
|
+
} else t22 = $[81];
|
|
436
|
+
let t23;
|
|
437
|
+
if ($[82] !== mergedOrientation || $[83] !== mergedTitlePlacement || $[84] !== mergedType || $[85] !== resolvedSize || $[86] !== rootStyle || $[87] !== t16 || $[88] !== t17 || $[89] !== t18 || $[90] !== t20 || $[91] !== t22 || $[92] !== variant) {
|
|
438
|
+
t23 = /*#__PURE__*/ jsx("div", {
|
|
439
|
+
"data-tao-steps": "",
|
|
440
|
+
"data-tao-orientation": mergedOrientation,
|
|
441
|
+
"data-tao-title-placement": mergedTitlePlacement,
|
|
442
|
+
"data-tao-type": mergedType,
|
|
443
|
+
"data-tao-variant": variant,
|
|
444
|
+
"data-tao-size": resolvedSize,
|
|
445
|
+
"data-tao-ellipsis": t16,
|
|
446
|
+
"data-tao-max-count": t17,
|
|
447
|
+
"data-tao-with-progress": t18,
|
|
448
|
+
className: t20,
|
|
449
|
+
style: rootStyle,
|
|
450
|
+
children: t22
|
|
451
|
+
});
|
|
452
|
+
$[82] = mergedOrientation;
|
|
453
|
+
$[83] = mergedTitlePlacement;
|
|
454
|
+
$[84] = mergedType;
|
|
455
|
+
$[85] = resolvedSize;
|
|
456
|
+
$[86] = rootStyle;
|
|
457
|
+
$[87] = t16;
|
|
458
|
+
$[88] = t17;
|
|
459
|
+
$[89] = t18;
|
|
460
|
+
$[90] = t20;
|
|
461
|
+
$[91] = t22;
|
|
462
|
+
$[92] = variant;
|
|
463
|
+
$[93] = t23;
|
|
464
|
+
} else t23 = $[93];
|
|
465
|
+
return t23;
|
|
466
|
+
}
|
|
467
|
+
function _temp(event_0) {
|
|
468
|
+
if ("Enter" === event_0.key || " " === event_0.key) {
|
|
469
|
+
event_0.preventDefault();
|
|
470
|
+
event_0.currentTarget.click();
|
|
471
|
+
}
|
|
472
|
+
}
|
|
473
|
+
export { Steps };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { StepItem } from './steps';
|
|
2
|
+
/**
|
|
3
|
+
* `maxCount` collapsing. Ported from antd's `useDisplaySteps` so the visible
|
|
4
|
+
* range, the remapped `current`, and the ellipsis statuses behave identically.
|
|
5
|
+
*/
|
|
6
|
+
export interface DisplayStep {
|
|
7
|
+
item: StepItem;
|
|
8
|
+
/** Index in the original `items` array; `-1` for a generated ellipsis step. */
|
|
9
|
+
originIndex: number;
|
|
10
|
+
/** Generated placeholder standing in for a hidden range. */
|
|
11
|
+
ellipsis?: boolean;
|
|
12
|
+
}
|
|
13
|
+
export interface DisplayStepsResult {
|
|
14
|
+
canApplyMaxCount: boolean;
|
|
15
|
+
displaySteps: DisplayStep[];
|
|
16
|
+
/** Index of `current` within `displaySteps`; negative when out of range. */
|
|
17
|
+
displayCurrent: number;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Convert `items` + `current` into the list Steps actually renders. When steps
|
|
21
|
+
* collapse, callers still see the original indexes: `onChange` maps a display
|
|
22
|
+
* position back through `originIndex`.
|
|
23
|
+
*/
|
|
24
|
+
export declare function useDisplaySteps(items: StepItem[], current: number, initial: number, maxCount: number | undefined): DisplayStepsResult;
|