sellmate-design-system-react 7.0.0 → 7.1.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/dist/components/SStepper/README.md +17 -0
- package/dist/components/SStepper/SStepper.d.ts +21 -1
- package/dist/components/SStepper/index.d.ts +1 -1
- package/dist/components/SStepper/stepper.config.d.ts +40 -0
- package/dist/index.cjs +413 -45
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +413 -45
- package/dist/index.js.map +1 -1
- package/dist/llms-full.txt +16 -0
- package/dist/styles.css +3 -0
- package/package.json +1 -1
|
@@ -11,20 +11,37 @@
|
|
|
11
11
|
| `items` | `SStepperItem[]` | — | 단계 목록 |
|
|
12
12
|
| `value?` | `string` | — | 현재 활성 단계 value |
|
|
13
13
|
| `size?` | `SStepperSize` | `'sm'` | 크기 |
|
|
14
|
+
| `vertical?` | `boolean` | `false` | 세로형 여부 |
|
|
15
|
+
| `clickable?` | `boolean` | — | 단계 클릭 가능 여부. 미지정 시 가로형=false, 세로형=true |
|
|
14
16
|
| `ariaLabel?` | `string` | `'진행 단계'` | 접근성 레이블 |
|
|
15
17
|
| `className?` | `string` | — | |
|
|
16
18
|
| `style?` | `CSSProperties` | — | |
|
|
17
19
|
|
|
20
|
+
#### Events
|
|
21
|
+
|
|
22
|
+
| Event | Type | Description |
|
|
23
|
+
|-------|------|-------------|
|
|
24
|
+
| `onValueChange` | `(value: string, item: SStepperItem, index: number) => void` | 단계 선택 시 호출 |
|
|
25
|
+
|
|
26
|
+
#### Methods (ref)
|
|
27
|
+
|
|
28
|
+
| Method | Type | Description |
|
|
29
|
+
|--------|------|-------------|
|
|
30
|
+
| `showItemTooltip` | `() => void` | error 아이템 중 첫 번째에 툴팁을 연다. error 아이템이 없으면 아무 일도 일어나지 않는다. |
|
|
31
|
+
| `hideItemTooltip` | `() => void` | 열려있는 커스텀 툴팁을 닫는다. 활성 단계(value prop)가 바뀌면 별도 호출 없이도 자동으로 닫힌다. |
|
|
32
|
+
|
|
18
33
|
## Dependencies
|
|
19
34
|
|
|
20
35
|
### Depends on
|
|
21
36
|
|
|
22
37
|
- [SIcon](../SIcon)
|
|
38
|
+
- [STooltip](../STooltip)
|
|
23
39
|
|
|
24
40
|
### Graph
|
|
25
41
|
|
|
26
42
|
```mermaid
|
|
27
43
|
graph TD;
|
|
28
44
|
SStepper --> SIcon
|
|
45
|
+
SStepper --> STooltip
|
|
29
46
|
style SStepper fill:#f9f,stroke:#333,stroke-width:4px
|
|
30
47
|
```
|
|
@@ -7,10 +7,30 @@ export interface SStepperProps {
|
|
|
7
7
|
value?: string;
|
|
8
8
|
/** 크기 */
|
|
9
9
|
size?: SStepperSize;
|
|
10
|
+
/** 세로형 여부 */
|
|
11
|
+
vertical?: boolean;
|
|
12
|
+
/** 단계 클릭 가능 여부. 미지정 시 가로형=false, 세로형=true */
|
|
13
|
+
clickable?: boolean;
|
|
14
|
+
/** 단계 선택 시 호출 */
|
|
15
|
+
onValueChange?: (value: string, item: SStepperItem, index: number) => void;
|
|
10
16
|
/** 접근성 레이블 */
|
|
11
17
|
ariaLabel?: string;
|
|
12
18
|
className?: string;
|
|
13
19
|
style?: CSSProperties;
|
|
14
20
|
}
|
|
21
|
+
/**
|
|
22
|
+
* ref 로 노출되는 커스텀 툴팁 제어 API. 세로형 전용 — items 중 error 가 true 인 첫 번째
|
|
23
|
+
* 아이템의 텍스트+뱃지 영역에 표시된다.
|
|
24
|
+
*
|
|
25
|
+
* 지금은 대상(첫 번째 error 아이템 하나)·문구·스타일이 hover 툴팁(ERROR_TOOLTIP_MESSAGE, danger)과
|
|
26
|
+
* 동일하게 고정되어 있다 — 열고 닫는 타이밍만 소비자가 제어한다. 대상 아이템을 지정하거나
|
|
27
|
+
* content·type 을 커스터마이즈하는 기능은 필요해지면 추가한다(지금은 만들지 않음).
|
|
28
|
+
*/
|
|
29
|
+
export interface SStepperHandle {
|
|
30
|
+
/** error 아이템 중 첫 번째에 툴팁을 연다. error 아이템이 없으면 아무 일도 일어나지 않는다. */
|
|
31
|
+
showItemTooltip: () => void;
|
|
32
|
+
/** 열려있는 커스텀 툴팁을 닫는다. 활성 단계(value prop)가 바뀌면 별도 호출 없이도 자동으로 닫힌다. */
|
|
33
|
+
hideItemTooltip: () => void;
|
|
34
|
+
}
|
|
15
35
|
/** SStepper — sd-stepper 포팅. 단계 진행 상태 표시 전용. */
|
|
16
|
-
export declare
|
|
36
|
+
export declare const SStepper: import("react").ForwardRefExoticComponent<SStepperProps & import("react").RefAttributes<SStepperHandle>>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { SStepper, type SStepperProps } from './SStepper';
|
|
1
|
+
export { SStepper, type SStepperHandle, type SStepperProps } from './SStepper';
|
|
2
2
|
export { STEPPER_SIZES, type SStepperItem, type SStepperSize } from './stepper.config';
|
|
@@ -3,6 +3,9 @@ export type SStepperSize = (typeof STEPPER_SIZES)[number];
|
|
|
3
3
|
export type SStepperItem = {
|
|
4
4
|
label: string;
|
|
5
5
|
value?: string;
|
|
6
|
+
group?: string;
|
|
7
|
+
completed?: boolean;
|
|
8
|
+
error?: boolean;
|
|
6
9
|
};
|
|
7
10
|
export declare const STEPPER_SIZE_CONFIG: Record<SStepperSize, {
|
|
8
11
|
sequenceSize: string;
|
|
@@ -34,6 +37,7 @@ export declare const STEPPER_COLORS: {
|
|
|
34
37
|
sequenceText: {
|
|
35
38
|
active: string;
|
|
36
39
|
default: string;
|
|
40
|
+
completed: string;
|
|
37
41
|
};
|
|
38
42
|
text: {
|
|
39
43
|
active: string;
|
|
@@ -41,3 +45,39 @@ export declare const STEPPER_COLORS: {
|
|
|
41
45
|
completed: string;
|
|
42
46
|
};
|
|
43
47
|
};
|
|
48
|
+
export declare const STEPPER_HORIZONTAL_COMPLETED_COLORS: {
|
|
49
|
+
sequenceBorder: string;
|
|
50
|
+
sequenceBg: string;
|
|
51
|
+
sequenceIcon: string;
|
|
52
|
+
text: string;
|
|
53
|
+
};
|
|
54
|
+
export declare const STEPPER_VERTICAL_LAYOUT: {
|
|
55
|
+
width: string;
|
|
56
|
+
itemGap: string;
|
|
57
|
+
itemPaddingX: string;
|
|
58
|
+
itemPaddingY: string;
|
|
59
|
+
titlePaddingTop: string;
|
|
60
|
+
titlePaddingBottom: string;
|
|
61
|
+
titleFontSize: string;
|
|
62
|
+
titleLineHeight: string;
|
|
63
|
+
accentStripeWidth: string;
|
|
64
|
+
accentStripeColor: string;
|
|
65
|
+
};
|
|
66
|
+
export declare const STEPPER_VERTICAL_COLORS: {
|
|
67
|
+
itemBg: {
|
|
68
|
+
default: string;
|
|
69
|
+
hover: string;
|
|
70
|
+
selected: string;
|
|
71
|
+
};
|
|
72
|
+
titleText: string;
|
|
73
|
+
textDefault: string;
|
|
74
|
+
textCompleted: string;
|
|
75
|
+
sequenceBorderActive: string;
|
|
76
|
+
sequenceBgActive: string;
|
|
77
|
+
sequenceTextActive: string;
|
|
78
|
+
sequenceTextDefault: string;
|
|
79
|
+
sequenceBorderCompleted: string;
|
|
80
|
+
sequenceBgCompleted: string;
|
|
81
|
+
sequenceIconCompleted: string;
|
|
82
|
+
errorBadge: string;
|
|
83
|
+
};
|
package/dist/index.cjs
CHANGED
|
@@ -8121,6 +8121,7 @@ function SPagination({
|
|
|
8121
8121
|
// src/components/SStepper/stepper.config.ts
|
|
8122
8122
|
var STEPPER_SIZES = ["sm", "lg"];
|
|
8123
8123
|
var V2 = (path) => `var(--cmp-stepper-${path})`;
|
|
8124
|
+
var VF = (path, fallback) => `var(--cmp-stepper-${path}, ${fallback})`;
|
|
8124
8125
|
var STEPPER_SIZE_CONFIG = {
|
|
8125
8126
|
sm: {
|
|
8126
8127
|
sequenceSize: V2("sm-sequence-size"),
|
|
@@ -8150,16 +8151,17 @@ var STEPPER_COLORS = {
|
|
|
8150
8151
|
sequenceBorder: {
|
|
8151
8152
|
active: V2("sequence-border-active"),
|
|
8152
8153
|
default: V2("sequence-border-default"),
|
|
8153
|
-
completed:
|
|
8154
|
+
completed: VF("sequence-border-completed", "#93C4FF")
|
|
8154
8155
|
},
|
|
8155
8156
|
sequenceBg: {
|
|
8156
8157
|
active: V2("sequence-bg-active"),
|
|
8157
8158
|
default: V2("sequence-bg-default"),
|
|
8158
|
-
completed:
|
|
8159
|
+
completed: VF("sequence-bg-completed", "#EFF6FF")
|
|
8159
8160
|
},
|
|
8160
8161
|
sequenceText: {
|
|
8161
8162
|
active: V2("sequence-text-active"),
|
|
8162
|
-
default: V2("sequence-text-default")
|
|
8163
|
+
default: V2("sequence-text-default"),
|
|
8164
|
+
completed: VF("sequence-text-completed", "#0075FF")
|
|
8163
8165
|
},
|
|
8164
8166
|
text: {
|
|
8165
8167
|
active: V2("text-active"),
|
|
@@ -8167,27 +8169,428 @@ var STEPPER_COLORS = {
|
|
|
8167
8169
|
completed: V2("text-completed")
|
|
8168
8170
|
}
|
|
8169
8171
|
};
|
|
8172
|
+
var STEPPER_HORIZONTAL_COMPLETED_COLORS = {
|
|
8173
|
+
sequenceBorder: STEPPER_COLORS.sequenceBorder.completed,
|
|
8174
|
+
sequenceBg: STEPPER_COLORS.sequenceBg.completed,
|
|
8175
|
+
sequenceIcon: STEPPER_COLORS.sequenceText.completed,
|
|
8176
|
+
text: STEPPER_COLORS.text.completed
|
|
8177
|
+
};
|
|
8178
|
+
var STEPPER_VERTICAL_LAYOUT = {
|
|
8179
|
+
width: VF("vertical-width", "240px"),
|
|
8180
|
+
itemGap: VF("vertical-item-gap", "12px"),
|
|
8181
|
+
itemPaddingX: VF("vertical-item-paddingX", "16px"),
|
|
8182
|
+
itemPaddingY: VF("vertical-item-paddingY", "8px"),
|
|
8183
|
+
titlePaddingTop: VF("vertical-title-paddingTop", "12px"),
|
|
8184
|
+
titlePaddingBottom: VF("vertical-title-paddingBottom", "4px"),
|
|
8185
|
+
titleFontSize: VF("vertical-title-font-size", "11px"),
|
|
8186
|
+
titleLineHeight: VF("vertical-title-line-height", "18px"),
|
|
8187
|
+
accentStripeWidth: VF("vertical-item-accentStripe-width", "2px"),
|
|
8188
|
+
accentStripeColor: VF("vertical-item-accentStripe-color", "#64ABFF")
|
|
8189
|
+
};
|
|
8190
|
+
var STEPPER_VERTICAL_COLORS = {
|
|
8191
|
+
itemBg: {
|
|
8192
|
+
default: VF("vertical-item-bg-default", "#FFFFFF"),
|
|
8193
|
+
hover: VF("vertical-item-bg-hover", "#F6F6F6"),
|
|
8194
|
+
selected: VF("vertical-item-bg-selected", "#EFF6FF")
|
|
8195
|
+
},
|
|
8196
|
+
titleText: VF("vertical-title-text", "#004290"),
|
|
8197
|
+
textDefault: STEPPER_COLORS.text.default,
|
|
8198
|
+
textCompleted: STEPPER_COLORS.text.completed,
|
|
8199
|
+
sequenceBorderActive: STEPPER_COLORS.sequenceBorder.active,
|
|
8200
|
+
sequenceBgActive: STEPPER_COLORS.sequenceBg.active,
|
|
8201
|
+
sequenceTextActive: STEPPER_COLORS.sequenceText.active,
|
|
8202
|
+
sequenceTextDefault: STEPPER_COLORS.sequenceText.default,
|
|
8203
|
+
sequenceBorderCompleted: VF("vertical-sequence-border-completed", "#93C4FF"),
|
|
8204
|
+
sequenceBgCompleted: VF("vertical-sequence-bg-completed", "#EFF6FF"),
|
|
8205
|
+
sequenceIconCompleted: VF("vertical-sequence-icon-completed", "#0075FF"),
|
|
8206
|
+
errorBadge: "#FB4444"
|
|
8207
|
+
};
|
|
8208
|
+
var ERROR_TOOLTIP_MESSAGE = "\uD655\uC778\uC774 \uD544\uC694\uD55C \uD56D\uBAA9\uC774 \uC788\uC2B5\uB2C8\uB2E4.";
|
|
8170
8209
|
function getItemValue(item, index) {
|
|
8171
8210
|
return item.value ?? String(index + 1);
|
|
8172
8211
|
}
|
|
8173
|
-
function
|
|
8212
|
+
function groupAdjacentItems(items) {
|
|
8213
|
+
return items.reduce(
|
|
8214
|
+
(groups, item, index) => {
|
|
8215
|
+
const currentGroup = item.group;
|
|
8216
|
+
const previous = groups[groups.length - 1];
|
|
8217
|
+
if (currentGroup && previous?.group === currentGroup) {
|
|
8218
|
+
previous.items.push(item);
|
|
8219
|
+
return groups;
|
|
8220
|
+
}
|
|
8221
|
+
groups.push({ group: currentGroup, startIndex: index, items: [item] });
|
|
8222
|
+
return groups;
|
|
8223
|
+
},
|
|
8224
|
+
[]
|
|
8225
|
+
);
|
|
8226
|
+
}
|
|
8227
|
+
var SStepper = /* @__PURE__ */ react.forwardRef(function SStepper2({
|
|
8174
8228
|
items,
|
|
8175
8229
|
value,
|
|
8176
8230
|
size = "sm",
|
|
8231
|
+
vertical = false,
|
|
8232
|
+
clickable,
|
|
8233
|
+
onValueChange,
|
|
8177
8234
|
ariaLabel = "\uC9C4\uD589 \uB2E8\uACC4",
|
|
8178
8235
|
className,
|
|
8179
8236
|
style
|
|
8180
|
-
}) {
|
|
8237
|
+
}, ref) {
|
|
8181
8238
|
const config = STEPPER_SIZE_CONFIG[size];
|
|
8239
|
+
const isClickable = clickable ?? vertical;
|
|
8240
|
+
const [hoveredIndex, setHoveredIndex] = react.useState(null);
|
|
8241
|
+
const [tooltipHoverValue, setTooltipHoverValue] = react.useState(null);
|
|
8242
|
+
const [customTooltipOpen, setCustomTooltipOpen] = react.useState(false);
|
|
8243
|
+
const [verticalAccentStripeStyle, setVerticalAccentStripeStyle] = react.useState({
|
|
8244
|
+
height: 0,
|
|
8245
|
+
opacity: 0,
|
|
8246
|
+
transform: "translateY(0px)"
|
|
8247
|
+
});
|
|
8248
|
+
const verticalItemRefs = react.useRef([]);
|
|
8182
8249
|
const activeIndex = Math.max(
|
|
8183
8250
|
0,
|
|
8184
8251
|
items.findIndex((item, index) => getItemValue(item, index) === value)
|
|
8185
8252
|
);
|
|
8186
|
-
const
|
|
8187
|
-
|
|
8253
|
+
const lastCompletedIndex = items.reduce(
|
|
8254
|
+
(lastIndex, item, index) => item.completed === true ? index : lastIndex,
|
|
8255
|
+
-1
|
|
8256
|
+
);
|
|
8257
|
+
const resolvedClickableIndex = lastCompletedIndex + 1;
|
|
8258
|
+
const [visitedMaxIndex, setVisitedMaxIndex] = react.useState(activeIndex);
|
|
8259
|
+
const firstErrorIndex = items.findIndex((item) => item.error === true);
|
|
8260
|
+
react.useImperativeHandle(
|
|
8261
|
+
ref,
|
|
8262
|
+
() => ({
|
|
8263
|
+
showItemTooltip: () => setCustomTooltipOpen(true),
|
|
8264
|
+
hideItemTooltip: () => setCustomTooltipOpen(false)
|
|
8265
|
+
}),
|
|
8266
|
+
[]
|
|
8267
|
+
);
|
|
8268
|
+
react.useLayoutEffect(() => {
|
|
8269
|
+
setVisitedMaxIndex((current) => Math.max(current, activeIndex));
|
|
8270
|
+
}, [activeIndex]);
|
|
8271
|
+
react.useLayoutEffect(() => {
|
|
8272
|
+
setCustomTooltipOpen(false);
|
|
8273
|
+
}, [activeIndex]);
|
|
8274
|
+
react.useLayoutEffect(() => {
|
|
8275
|
+
if (!vertical) return;
|
|
8276
|
+
const activeItem = verticalItemRefs.current[activeIndex];
|
|
8277
|
+
if (!activeItem) {
|
|
8278
|
+
setVerticalAccentStripeStyle((current) => ({ ...current, opacity: 0 }));
|
|
8279
|
+
return;
|
|
8280
|
+
}
|
|
8281
|
+
setVerticalAccentStripeStyle({
|
|
8282
|
+
height: activeItem.offsetHeight,
|
|
8283
|
+
opacity: 1,
|
|
8284
|
+
transform: `translateY(${activeItem.offsetTop}px)`
|
|
8285
|
+
});
|
|
8286
|
+
}, [activeIndex, vertical, items]);
|
|
8287
|
+
const getState = (item, index) => {
|
|
8188
8288
|
if (index === activeIndex) return "active";
|
|
8289
|
+
if (item.completed != null) return item.completed ? "completed" : "default";
|
|
8189
8290
|
return "default";
|
|
8190
8291
|
};
|
|
8292
|
+
const emitValueChange = (item, index) => {
|
|
8293
|
+
onValueChange?.(getItemValue(item, index), item, index);
|
|
8294
|
+
};
|
|
8295
|
+
const isWithinClickableIndex = (index) => index <= resolvedClickableIndex;
|
|
8296
|
+
const renderStepContent = (item, index, options = {}) => {
|
|
8297
|
+
const { isVertical = false, roleListItem = true, hovered = false } = options;
|
|
8298
|
+
const state2 = getState(item, index);
|
|
8299
|
+
const isHorizontalCompleted = !isVertical && state2 === "completed";
|
|
8300
|
+
const isVerticalCompleted = isVertical && state2 === "completed";
|
|
8301
|
+
const isVerticalLastActive = isVertical && state2 === "default" && index === visitedMaxIndex;
|
|
8302
|
+
const showsCheckIcon = state2 === "completed";
|
|
8303
|
+
const itemColor = (() => {
|
|
8304
|
+
if (isHorizontalCompleted) return STEPPER_HORIZONTAL_COMPLETED_COLORS.text;
|
|
8305
|
+
if (!isVertical) return STEPPER_COLORS.text[state2];
|
|
8306
|
+
if (state2 === "active") return STEPPER_COLORS.text.active;
|
|
8307
|
+
if (isVerticalCompleted) return STEPPER_VERTICAL_COLORS.textCompleted;
|
|
8308
|
+
return STEPPER_VERTICAL_COLORS.textDefault;
|
|
8309
|
+
})();
|
|
8310
|
+
const sequenceBorderColor = (() => {
|
|
8311
|
+
if (isVerticalCompleted) {
|
|
8312
|
+
return STEPPER_VERTICAL_COLORS.sequenceBorderCompleted;
|
|
8313
|
+
}
|
|
8314
|
+
if (isVertical && (state2 === "active" || isVerticalLastActive)) {
|
|
8315
|
+
return STEPPER_VERTICAL_COLORS.sequenceBorderActive;
|
|
8316
|
+
}
|
|
8317
|
+
if (isHorizontalCompleted) return STEPPER_HORIZONTAL_COMPLETED_COLORS.sequenceBorder;
|
|
8318
|
+
return STEPPER_COLORS.sequenceBorder[state2];
|
|
8319
|
+
})();
|
|
8320
|
+
const sequenceBg = (() => {
|
|
8321
|
+
if (isVerticalCompleted) {
|
|
8322
|
+
return STEPPER_VERTICAL_COLORS.sequenceBgCompleted;
|
|
8323
|
+
}
|
|
8324
|
+
if (isVertical && (state2 === "active" || isVerticalLastActive)) {
|
|
8325
|
+
return STEPPER_VERTICAL_COLORS.sequenceBgActive;
|
|
8326
|
+
}
|
|
8327
|
+
if (isHorizontalCompleted) return STEPPER_HORIZONTAL_COMPLETED_COLORS.sequenceBg;
|
|
8328
|
+
return STEPPER_COLORS.sequenceBg[state2];
|
|
8329
|
+
})();
|
|
8330
|
+
const sequenceColor = (() => {
|
|
8331
|
+
if (isVerticalCompleted) {
|
|
8332
|
+
return STEPPER_VERTICAL_COLORS.sequenceIconCompleted;
|
|
8333
|
+
}
|
|
8334
|
+
if (isVertical && (state2 === "active" || isVerticalLastActive)) {
|
|
8335
|
+
return STEPPER_VERTICAL_COLORS.sequenceTextActive;
|
|
8336
|
+
}
|
|
8337
|
+
if (isVertical) return STEPPER_VERTICAL_COLORS.sequenceTextDefault;
|
|
8338
|
+
if (isHorizontalCompleted) return STEPPER_HORIZONTAL_COMPLETED_COLORS.sequenceIcon;
|
|
8339
|
+
return STEPPER_COLORS.sequenceText[state2];
|
|
8340
|
+
})();
|
|
8341
|
+
const itemStyle = {
|
|
8342
|
+
gap: STEPPER_LAYOUT.itemGap,
|
|
8343
|
+
color: itemColor,
|
|
8344
|
+
fontWeight: state2 === "active" || isVertical && hovered ? config.fontWeightActive : config.fontWeightDefault
|
|
8345
|
+
};
|
|
8346
|
+
const sequenceStyle = {
|
|
8347
|
+
width: config.sequenceSize,
|
|
8348
|
+
height: config.sequenceSize,
|
|
8349
|
+
flexBasis: config.sequenceSize,
|
|
8350
|
+
borderRadius: STEPPER_LAYOUT.sequenceRadius,
|
|
8351
|
+
borderWidth: STEPPER_LAYOUT.sequenceBorderWidth,
|
|
8352
|
+
borderColor: sequenceBorderColor,
|
|
8353
|
+
background: sequenceBg,
|
|
8354
|
+
color: sequenceColor
|
|
8355
|
+
};
|
|
8356
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
8357
|
+
"span",
|
|
8358
|
+
{
|
|
8359
|
+
role: roleListItem ? "listitem" : void 0,
|
|
8360
|
+
"aria-current": roleListItem && state2 === "active" ? "step" : void 0,
|
|
8361
|
+
className: "inline-flex items-center whitespace-nowrap",
|
|
8362
|
+
style: itemStyle,
|
|
8363
|
+
children: [
|
|
8364
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
8365
|
+
"span",
|
|
8366
|
+
{
|
|
8367
|
+
"aria-hidden": true,
|
|
8368
|
+
className: "box-border inline-flex shrink-0 items-center justify-center border border-solid font-bold",
|
|
8369
|
+
style: sequenceStyle,
|
|
8370
|
+
children: showsCheckIcon ? /* @__PURE__ */ jsxRuntime.jsx(SIcon, { name: "check", size: STEPPER_LAYOUT.sequenceIcon, color: "currentColor" }) : index + 1
|
|
8371
|
+
}
|
|
8372
|
+
),
|
|
8373
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { children: item.label })
|
|
8374
|
+
]
|
|
8375
|
+
}
|
|
8376
|
+
);
|
|
8377
|
+
};
|
|
8378
|
+
const renderClickableStepContent = (item, index, isVertical = false) => {
|
|
8379
|
+
const isDisabled = !isWithinClickableIndex(index);
|
|
8380
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
8381
|
+
"button",
|
|
8382
|
+
{
|
|
8383
|
+
type: "button",
|
|
8384
|
+
disabled: isDisabled,
|
|
8385
|
+
className: cn(
|
|
8386
|
+
"m-0 inline-flex w-full items-center border-0 bg-transparent p-0 text-left",
|
|
8387
|
+
isDisabled ? "cursor-default" : "cursor-pointer"
|
|
8388
|
+
),
|
|
8389
|
+
style: { font: "inherit", color: "inherit" },
|
|
8390
|
+
onClick: () => {
|
|
8391
|
+
if (!isDisabled) emitValueChange(item, index);
|
|
8392
|
+
},
|
|
8393
|
+
children: renderStepContent(item, index, { isVertical, roleListItem: false })
|
|
8394
|
+
}
|
|
8395
|
+
);
|
|
8396
|
+
};
|
|
8397
|
+
if (vertical) {
|
|
8398
|
+
const groups = groupAdjacentItems(items);
|
|
8399
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
8400
|
+
"div",
|
|
8401
|
+
{
|
|
8402
|
+
role: "list",
|
|
8403
|
+
"aria-label": ariaLabel,
|
|
8404
|
+
className: cn("relative inline-flex flex-col items-start", className),
|
|
8405
|
+
style: {
|
|
8406
|
+
width: STEPPER_VERTICAL_LAYOUT.width,
|
|
8407
|
+
fontSize: config.fontSize,
|
|
8408
|
+
lineHeight: config.lineHeight,
|
|
8409
|
+
...style
|
|
8410
|
+
},
|
|
8411
|
+
children: [
|
|
8412
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
8413
|
+
"span",
|
|
8414
|
+
{
|
|
8415
|
+
"aria-hidden": "true",
|
|
8416
|
+
"data-stepper-accent-stripe": "true",
|
|
8417
|
+
className: "pointer-events-none absolute left-0 top-0 z-[1]",
|
|
8418
|
+
style: {
|
|
8419
|
+
width: STEPPER_VERTICAL_LAYOUT.accentStripeWidth,
|
|
8420
|
+
background: STEPPER_VERTICAL_LAYOUT.accentStripeColor,
|
|
8421
|
+
transition: "transform 160ms ease, height 160ms ease, opacity 120ms ease",
|
|
8422
|
+
...verticalAccentStripeStyle
|
|
8423
|
+
}
|
|
8424
|
+
}
|
|
8425
|
+
),
|
|
8426
|
+
groups.map((group) => {
|
|
8427
|
+
const groupKey = group.group ?? getItemValue(group.items[0], group.startIndex);
|
|
8428
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
8429
|
+
"div",
|
|
8430
|
+
{
|
|
8431
|
+
className: "flex w-full flex-col items-start",
|
|
8432
|
+
children: [
|
|
8433
|
+
group.group && /* @__PURE__ */ jsxRuntime.jsx(
|
|
8434
|
+
"div",
|
|
8435
|
+
{
|
|
8436
|
+
className: "flex w-full items-center overflow-hidden",
|
|
8437
|
+
style: {
|
|
8438
|
+
gap: STEPPER_VERTICAL_LAYOUT.itemGap,
|
|
8439
|
+
paddingLeft: STEPPER_VERTICAL_LAYOUT.itemPaddingX,
|
|
8440
|
+
paddingRight: STEPPER_VERTICAL_LAYOUT.itemPaddingX,
|
|
8441
|
+
paddingTop: STEPPER_VERTICAL_LAYOUT.titlePaddingTop,
|
|
8442
|
+
paddingBottom: STEPPER_VERTICAL_LAYOUT.titlePaddingBottom,
|
|
8443
|
+
background: STEPPER_VERTICAL_COLORS.itemBg.default,
|
|
8444
|
+
color: STEPPER_VERTICAL_COLORS.titleText,
|
|
8445
|
+
fontSize: STEPPER_VERTICAL_LAYOUT.titleFontSize,
|
|
8446
|
+
lineHeight: STEPPER_VERTICAL_LAYOUT.titleLineHeight,
|
|
8447
|
+
fontWeight: 700
|
|
8448
|
+
},
|
|
8449
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "whitespace-nowrap", children: group.group })
|
|
8450
|
+
}
|
|
8451
|
+
),
|
|
8452
|
+
group.items.map((item, itemIndex) => {
|
|
8453
|
+
const index = group.startIndex + itemIndex;
|
|
8454
|
+
const state2 = getState(item, index);
|
|
8455
|
+
const itemValue = getItemValue(item, index);
|
|
8456
|
+
const canClickItem = isClickable && isWithinClickableIndex(index);
|
|
8457
|
+
const isDisabled = !canClickItem;
|
|
8458
|
+
const isHovered = hoveredIndex === index && canClickItem && state2 !== "active";
|
|
8459
|
+
const itemContainerStyle = {
|
|
8460
|
+
gap: STEPPER_VERTICAL_LAYOUT.itemGap,
|
|
8461
|
+
paddingLeft: STEPPER_VERTICAL_LAYOUT.itemPaddingX,
|
|
8462
|
+
paddingRight: STEPPER_VERTICAL_LAYOUT.itemPaddingX,
|
|
8463
|
+
paddingTop: STEPPER_VERTICAL_LAYOUT.itemPaddingY,
|
|
8464
|
+
paddingBottom: STEPPER_VERTICAL_LAYOUT.itemPaddingY,
|
|
8465
|
+
background: state2 === "active" ? STEPPER_VERTICAL_COLORS.itemBg.selected : isHovered ? STEPPER_VERTICAL_COLORS.itemBg.hover : STEPPER_VERTICAL_COLORS.itemBg.default
|
|
8466
|
+
};
|
|
8467
|
+
const handleMouseEnter = () => {
|
|
8468
|
+
if (canClickItem) setHoveredIndex(index);
|
|
8469
|
+
};
|
|
8470
|
+
const handleMouseLeave = () => {
|
|
8471
|
+
setHoveredIndex((current) => current === index ? null : current);
|
|
8472
|
+
};
|
|
8473
|
+
const stepContent = renderStepContent(item, index, {
|
|
8474
|
+
isVertical: true,
|
|
8475
|
+
roleListItem: false,
|
|
8476
|
+
hovered: isHovered
|
|
8477
|
+
});
|
|
8478
|
+
const errorBadge = item.error ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
8479
|
+
"span",
|
|
8480
|
+
{
|
|
8481
|
+
"aria-hidden": "true",
|
|
8482
|
+
"data-stepper-error-badge": "true",
|
|
8483
|
+
className: "inline-flex shrink-0 overflow-hidden rounded-full",
|
|
8484
|
+
style: {
|
|
8485
|
+
width: 6,
|
|
8486
|
+
height: 6,
|
|
8487
|
+
background: STEPPER_VERTICAL_COLORS.errorBadge
|
|
8488
|
+
}
|
|
8489
|
+
}
|
|
8490
|
+
) : null;
|
|
8491
|
+
const isTooltipHovered = tooltipHoverValue === itemValue;
|
|
8492
|
+
const isCustomTooltipOpen = customTooltipOpen && index === firstErrorIndex;
|
|
8493
|
+
const showTooltip = item.error === true && (isTooltipHovered || isCustomTooltipOpen);
|
|
8494
|
+
const handleTooltipMouseEnter = () => setTooltipHoverValue(itemValue);
|
|
8495
|
+
const handleTooltipMouseLeave = () => {
|
|
8496
|
+
setTooltipHoverValue((current) => current === itemValue ? null : current);
|
|
8497
|
+
};
|
|
8498
|
+
const labelBadge = /* @__PURE__ */ jsxRuntime.jsx(
|
|
8499
|
+
STooltip2,
|
|
8500
|
+
{
|
|
8501
|
+
trigger: "none",
|
|
8502
|
+
open: showTooltip,
|
|
8503
|
+
content: ERROR_TOOLTIP_MESSAGE,
|
|
8504
|
+
tooltipType: "danger",
|
|
8505
|
+
placement: "right",
|
|
8506
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
8507
|
+
"span",
|
|
8508
|
+
{
|
|
8509
|
+
className: cn(
|
|
8510
|
+
"relative z-[3] inline-flex items-center",
|
|
8511
|
+
isClickable && (isDisabled ? "cursor-default" : "cursor-pointer")
|
|
8512
|
+
),
|
|
8513
|
+
style: { gap: STEPPER_VERTICAL_LAYOUT.itemGap },
|
|
8514
|
+
onMouseEnter: handleTooltipMouseEnter,
|
|
8515
|
+
onMouseLeave: handleTooltipMouseLeave,
|
|
8516
|
+
onClick: isClickable ? () => {
|
|
8517
|
+
if (!isDisabled) emitValueChange(item, index);
|
|
8518
|
+
} : void 0,
|
|
8519
|
+
children: [
|
|
8520
|
+
stepContent,
|
|
8521
|
+
errorBadge
|
|
8522
|
+
]
|
|
8523
|
+
}
|
|
8524
|
+
)
|
|
8525
|
+
}
|
|
8526
|
+
);
|
|
8527
|
+
if (isClickable) {
|
|
8528
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
8529
|
+
"div",
|
|
8530
|
+
{
|
|
8531
|
+
ref: (node) => {
|
|
8532
|
+
verticalItemRefs.current[index] = node;
|
|
8533
|
+
},
|
|
8534
|
+
role: "listitem",
|
|
8535
|
+
"aria-current": state2 === "active" ? "step" : void 0,
|
|
8536
|
+
className: cn(
|
|
8537
|
+
"relative flex w-full items-center overflow-hidden",
|
|
8538
|
+
isDisabled ? "cursor-default" : "cursor-pointer"
|
|
8539
|
+
),
|
|
8540
|
+
onMouseEnter: handleMouseEnter,
|
|
8541
|
+
onMouseLeave: handleMouseLeave,
|
|
8542
|
+
style: itemContainerStyle,
|
|
8543
|
+
children: [
|
|
8544
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
8545
|
+
"button",
|
|
8546
|
+
{
|
|
8547
|
+
type: "button",
|
|
8548
|
+
disabled: isDisabled,
|
|
8549
|
+
"aria-label": item.label,
|
|
8550
|
+
className: cn(
|
|
8551
|
+
"absolute inset-0 z-[2] m-0 border-0 bg-transparent p-0 text-left outline-none focus-visible:outline focus-visible:outline-2 focus-visible:outline-(--sys-color-border-accent)",
|
|
8552
|
+
isDisabled ? "cursor-default" : "cursor-pointer"
|
|
8553
|
+
),
|
|
8554
|
+
onClick: () => {
|
|
8555
|
+
if (!isDisabled) emitValueChange(item, index);
|
|
8556
|
+
}
|
|
8557
|
+
}
|
|
8558
|
+
),
|
|
8559
|
+
labelBadge
|
|
8560
|
+
]
|
|
8561
|
+
},
|
|
8562
|
+
itemValue
|
|
8563
|
+
);
|
|
8564
|
+
}
|
|
8565
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
8566
|
+
"div",
|
|
8567
|
+
{
|
|
8568
|
+
ref: (node) => {
|
|
8569
|
+
verticalItemRefs.current[index] = node;
|
|
8570
|
+
},
|
|
8571
|
+
role: "listitem",
|
|
8572
|
+
"aria-current": state2 === "active" ? "step" : void 0,
|
|
8573
|
+
className: cn(
|
|
8574
|
+
"relative flex w-full items-center overflow-hidden",
|
|
8575
|
+
isClickable && (canClickItem ? "cursor-pointer" : "cursor-default")
|
|
8576
|
+
),
|
|
8577
|
+
onMouseEnter: handleMouseEnter,
|
|
8578
|
+
onMouseLeave: handleMouseLeave,
|
|
8579
|
+
style: itemContainerStyle,
|
|
8580
|
+
children: labelBadge
|
|
8581
|
+
},
|
|
8582
|
+
itemValue
|
|
8583
|
+
);
|
|
8584
|
+
})
|
|
8585
|
+
]
|
|
8586
|
+
},
|
|
8587
|
+
`${groupKey}-${group.startIndex}`
|
|
8588
|
+
);
|
|
8589
|
+
})
|
|
8590
|
+
]
|
|
8591
|
+
}
|
|
8592
|
+
);
|
|
8593
|
+
}
|
|
8191
8594
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
8192
8595
|
"div",
|
|
8193
8596
|
{
|
|
@@ -8201,43 +8604,8 @@ function SStepper({
|
|
|
8201
8604
|
...style
|
|
8202
8605
|
},
|
|
8203
8606
|
children: items.map((item, index) => {
|
|
8204
|
-
const state2 = getState(index);
|
|
8205
|
-
const
|
|
8206
|
-
gap: STEPPER_LAYOUT.itemGap,
|
|
8207
|
-
color: STEPPER_COLORS.text[state2],
|
|
8208
|
-
fontWeight: state2 === "active" ? config.fontWeightActive : config.fontWeightDefault
|
|
8209
|
-
};
|
|
8210
|
-
const sequenceStyle = {
|
|
8211
|
-
width: config.sequenceSize,
|
|
8212
|
-
height: config.sequenceSize,
|
|
8213
|
-
flexBasis: config.sequenceSize,
|
|
8214
|
-
borderRadius: STEPPER_LAYOUT.sequenceRadius,
|
|
8215
|
-
borderWidth: STEPPER_LAYOUT.sequenceBorderWidth,
|
|
8216
|
-
borderColor: STEPPER_COLORS.sequenceBorder[state2],
|
|
8217
|
-
background: STEPPER_COLORS.sequenceBg[state2],
|
|
8218
|
-
color: state2 === "completed" ? STEPPER_COLORS.text.completed : STEPPER_COLORS.sequenceText[state2]
|
|
8219
|
-
};
|
|
8220
|
-
const content = /* @__PURE__ */ jsxRuntime.jsxs(
|
|
8221
|
-
"span",
|
|
8222
|
-
{
|
|
8223
|
-
role: "listitem",
|
|
8224
|
-
"aria-current": state2 === "active" ? "step" : void 0,
|
|
8225
|
-
className: "inline-flex items-center whitespace-nowrap",
|
|
8226
|
-
style: itemStyle,
|
|
8227
|
-
children: [
|
|
8228
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
8229
|
-
"span",
|
|
8230
|
-
{
|
|
8231
|
-
"aria-hidden": true,
|
|
8232
|
-
className: "box-border inline-flex shrink-0 items-center justify-center border border-solid font-bold",
|
|
8233
|
-
style: sequenceStyle,
|
|
8234
|
-
children: state2 === "completed" ? /* @__PURE__ */ jsxRuntime.jsx(SIcon, { name: "check", size: STEPPER_LAYOUT.sequenceIcon, color: "currentColor" }) : index + 1
|
|
8235
|
-
}
|
|
8236
|
-
),
|
|
8237
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { children: item.label })
|
|
8238
|
-
]
|
|
8239
|
-
}
|
|
8240
|
-
);
|
|
8607
|
+
const state2 = getState(item, index);
|
|
8608
|
+
const content = isClickable ? /* @__PURE__ */ jsxRuntime.jsx("span", { role: "listitem", "aria-current": state2 === "active" ? "step" : void 0, children: renderClickableStepContent(item, index) }) : renderStepContent(item, index);
|
|
8241
8609
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
8242
8610
|
"span",
|
|
8243
8611
|
{
|
|
@@ -8276,7 +8644,7 @@ function SStepper({
|
|
|
8276
8644
|
})
|
|
8277
8645
|
}
|
|
8278
8646
|
);
|
|
8279
|
-
}
|
|
8647
|
+
});
|
|
8280
8648
|
function runRules(value, rules) {
|
|
8281
8649
|
if (!rules || rules.length === 0) return "";
|
|
8282
8650
|
for (const rule of rules) {
|