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
package/dist/index.js
CHANGED
|
@@ -8093,6 +8093,7 @@ function SPagination({
|
|
|
8093
8093
|
// src/components/SStepper/stepper.config.ts
|
|
8094
8094
|
var STEPPER_SIZES = ["sm", "lg"];
|
|
8095
8095
|
var V2 = (path) => `var(--cmp-stepper-${path})`;
|
|
8096
|
+
var VF = (path, fallback) => `var(--cmp-stepper-${path}, ${fallback})`;
|
|
8096
8097
|
var STEPPER_SIZE_CONFIG = {
|
|
8097
8098
|
sm: {
|
|
8098
8099
|
sequenceSize: V2("sm-sequence-size"),
|
|
@@ -8122,16 +8123,17 @@ var STEPPER_COLORS = {
|
|
|
8122
8123
|
sequenceBorder: {
|
|
8123
8124
|
active: V2("sequence-border-active"),
|
|
8124
8125
|
default: V2("sequence-border-default"),
|
|
8125
|
-
completed:
|
|
8126
|
+
completed: VF("sequence-border-completed", "#93C4FF")
|
|
8126
8127
|
},
|
|
8127
8128
|
sequenceBg: {
|
|
8128
8129
|
active: V2("sequence-bg-active"),
|
|
8129
8130
|
default: V2("sequence-bg-default"),
|
|
8130
|
-
completed:
|
|
8131
|
+
completed: VF("sequence-bg-completed", "#EFF6FF")
|
|
8131
8132
|
},
|
|
8132
8133
|
sequenceText: {
|
|
8133
8134
|
active: V2("sequence-text-active"),
|
|
8134
|
-
default: V2("sequence-text-default")
|
|
8135
|
+
default: V2("sequence-text-default"),
|
|
8136
|
+
completed: VF("sequence-text-completed", "#0075FF")
|
|
8135
8137
|
},
|
|
8136
8138
|
text: {
|
|
8137
8139
|
active: V2("text-active"),
|
|
@@ -8139,27 +8141,428 @@ var STEPPER_COLORS = {
|
|
|
8139
8141
|
completed: V2("text-completed")
|
|
8140
8142
|
}
|
|
8141
8143
|
};
|
|
8144
|
+
var STEPPER_HORIZONTAL_COMPLETED_COLORS = {
|
|
8145
|
+
sequenceBorder: STEPPER_COLORS.sequenceBorder.completed,
|
|
8146
|
+
sequenceBg: STEPPER_COLORS.sequenceBg.completed,
|
|
8147
|
+
sequenceIcon: STEPPER_COLORS.sequenceText.completed,
|
|
8148
|
+
text: STEPPER_COLORS.text.completed
|
|
8149
|
+
};
|
|
8150
|
+
var STEPPER_VERTICAL_LAYOUT = {
|
|
8151
|
+
width: VF("vertical-width", "240px"),
|
|
8152
|
+
itemGap: VF("vertical-item-gap", "12px"),
|
|
8153
|
+
itemPaddingX: VF("vertical-item-paddingX", "16px"),
|
|
8154
|
+
itemPaddingY: VF("vertical-item-paddingY", "8px"),
|
|
8155
|
+
titlePaddingTop: VF("vertical-title-paddingTop", "12px"),
|
|
8156
|
+
titlePaddingBottom: VF("vertical-title-paddingBottom", "4px"),
|
|
8157
|
+
titleFontSize: VF("vertical-title-font-size", "11px"),
|
|
8158
|
+
titleLineHeight: VF("vertical-title-line-height", "18px"),
|
|
8159
|
+
accentStripeWidth: VF("vertical-item-accentStripe-width", "2px"),
|
|
8160
|
+
accentStripeColor: VF("vertical-item-accentStripe-color", "#64ABFF")
|
|
8161
|
+
};
|
|
8162
|
+
var STEPPER_VERTICAL_COLORS = {
|
|
8163
|
+
itemBg: {
|
|
8164
|
+
default: VF("vertical-item-bg-default", "#FFFFFF"),
|
|
8165
|
+
hover: VF("vertical-item-bg-hover", "#F6F6F6"),
|
|
8166
|
+
selected: VF("vertical-item-bg-selected", "#EFF6FF")
|
|
8167
|
+
},
|
|
8168
|
+
titleText: VF("vertical-title-text", "#004290"),
|
|
8169
|
+
textDefault: STEPPER_COLORS.text.default,
|
|
8170
|
+
textCompleted: STEPPER_COLORS.text.completed,
|
|
8171
|
+
sequenceBorderActive: STEPPER_COLORS.sequenceBorder.active,
|
|
8172
|
+
sequenceBgActive: STEPPER_COLORS.sequenceBg.active,
|
|
8173
|
+
sequenceTextActive: STEPPER_COLORS.sequenceText.active,
|
|
8174
|
+
sequenceTextDefault: STEPPER_COLORS.sequenceText.default,
|
|
8175
|
+
sequenceBorderCompleted: VF("vertical-sequence-border-completed", "#93C4FF"),
|
|
8176
|
+
sequenceBgCompleted: VF("vertical-sequence-bg-completed", "#EFF6FF"),
|
|
8177
|
+
sequenceIconCompleted: VF("vertical-sequence-icon-completed", "#0075FF"),
|
|
8178
|
+
errorBadge: "#FB4444"
|
|
8179
|
+
};
|
|
8180
|
+
var ERROR_TOOLTIP_MESSAGE = "\uD655\uC778\uC774 \uD544\uC694\uD55C \uD56D\uBAA9\uC774 \uC788\uC2B5\uB2C8\uB2E4.";
|
|
8142
8181
|
function getItemValue(item, index) {
|
|
8143
8182
|
return item.value ?? String(index + 1);
|
|
8144
8183
|
}
|
|
8145
|
-
function
|
|
8184
|
+
function groupAdjacentItems(items) {
|
|
8185
|
+
return items.reduce(
|
|
8186
|
+
(groups, item, index) => {
|
|
8187
|
+
const currentGroup = item.group;
|
|
8188
|
+
const previous = groups[groups.length - 1];
|
|
8189
|
+
if (currentGroup && previous?.group === currentGroup) {
|
|
8190
|
+
previous.items.push(item);
|
|
8191
|
+
return groups;
|
|
8192
|
+
}
|
|
8193
|
+
groups.push({ group: currentGroup, startIndex: index, items: [item] });
|
|
8194
|
+
return groups;
|
|
8195
|
+
},
|
|
8196
|
+
[]
|
|
8197
|
+
);
|
|
8198
|
+
}
|
|
8199
|
+
var SStepper = /* @__PURE__ */ forwardRef(function SStepper2({
|
|
8146
8200
|
items,
|
|
8147
8201
|
value,
|
|
8148
8202
|
size = "sm",
|
|
8203
|
+
vertical = false,
|
|
8204
|
+
clickable,
|
|
8205
|
+
onValueChange,
|
|
8149
8206
|
ariaLabel = "\uC9C4\uD589 \uB2E8\uACC4",
|
|
8150
8207
|
className,
|
|
8151
8208
|
style
|
|
8152
|
-
}) {
|
|
8209
|
+
}, ref) {
|
|
8153
8210
|
const config = STEPPER_SIZE_CONFIG[size];
|
|
8211
|
+
const isClickable = clickable ?? vertical;
|
|
8212
|
+
const [hoveredIndex, setHoveredIndex] = useState(null);
|
|
8213
|
+
const [tooltipHoverValue, setTooltipHoverValue] = useState(null);
|
|
8214
|
+
const [customTooltipOpen, setCustomTooltipOpen] = useState(false);
|
|
8215
|
+
const [verticalAccentStripeStyle, setVerticalAccentStripeStyle] = useState({
|
|
8216
|
+
height: 0,
|
|
8217
|
+
opacity: 0,
|
|
8218
|
+
transform: "translateY(0px)"
|
|
8219
|
+
});
|
|
8220
|
+
const verticalItemRefs = useRef([]);
|
|
8154
8221
|
const activeIndex = Math.max(
|
|
8155
8222
|
0,
|
|
8156
8223
|
items.findIndex((item, index) => getItemValue(item, index) === value)
|
|
8157
8224
|
);
|
|
8158
|
-
const
|
|
8159
|
-
|
|
8225
|
+
const lastCompletedIndex = items.reduce(
|
|
8226
|
+
(lastIndex, item, index) => item.completed === true ? index : lastIndex,
|
|
8227
|
+
-1
|
|
8228
|
+
);
|
|
8229
|
+
const resolvedClickableIndex = lastCompletedIndex + 1;
|
|
8230
|
+
const [visitedMaxIndex, setVisitedMaxIndex] = useState(activeIndex);
|
|
8231
|
+
const firstErrorIndex = items.findIndex((item) => item.error === true);
|
|
8232
|
+
useImperativeHandle(
|
|
8233
|
+
ref,
|
|
8234
|
+
() => ({
|
|
8235
|
+
showItemTooltip: () => setCustomTooltipOpen(true),
|
|
8236
|
+
hideItemTooltip: () => setCustomTooltipOpen(false)
|
|
8237
|
+
}),
|
|
8238
|
+
[]
|
|
8239
|
+
);
|
|
8240
|
+
useLayoutEffect(() => {
|
|
8241
|
+
setVisitedMaxIndex((current) => Math.max(current, activeIndex));
|
|
8242
|
+
}, [activeIndex]);
|
|
8243
|
+
useLayoutEffect(() => {
|
|
8244
|
+
setCustomTooltipOpen(false);
|
|
8245
|
+
}, [activeIndex]);
|
|
8246
|
+
useLayoutEffect(() => {
|
|
8247
|
+
if (!vertical) return;
|
|
8248
|
+
const activeItem = verticalItemRefs.current[activeIndex];
|
|
8249
|
+
if (!activeItem) {
|
|
8250
|
+
setVerticalAccentStripeStyle((current) => ({ ...current, opacity: 0 }));
|
|
8251
|
+
return;
|
|
8252
|
+
}
|
|
8253
|
+
setVerticalAccentStripeStyle({
|
|
8254
|
+
height: activeItem.offsetHeight,
|
|
8255
|
+
opacity: 1,
|
|
8256
|
+
transform: `translateY(${activeItem.offsetTop}px)`
|
|
8257
|
+
});
|
|
8258
|
+
}, [activeIndex, vertical, items]);
|
|
8259
|
+
const getState = (item, index) => {
|
|
8160
8260
|
if (index === activeIndex) return "active";
|
|
8261
|
+
if (item.completed != null) return item.completed ? "completed" : "default";
|
|
8161
8262
|
return "default";
|
|
8162
8263
|
};
|
|
8264
|
+
const emitValueChange = (item, index) => {
|
|
8265
|
+
onValueChange?.(getItemValue(item, index), item, index);
|
|
8266
|
+
};
|
|
8267
|
+
const isWithinClickableIndex = (index) => index <= resolvedClickableIndex;
|
|
8268
|
+
const renderStepContent = (item, index, options = {}) => {
|
|
8269
|
+
const { isVertical = false, roleListItem = true, hovered = false } = options;
|
|
8270
|
+
const state2 = getState(item, index);
|
|
8271
|
+
const isHorizontalCompleted = !isVertical && state2 === "completed";
|
|
8272
|
+
const isVerticalCompleted = isVertical && state2 === "completed";
|
|
8273
|
+
const isVerticalLastActive = isVertical && state2 === "default" && index === visitedMaxIndex;
|
|
8274
|
+
const showsCheckIcon = state2 === "completed";
|
|
8275
|
+
const itemColor = (() => {
|
|
8276
|
+
if (isHorizontalCompleted) return STEPPER_HORIZONTAL_COMPLETED_COLORS.text;
|
|
8277
|
+
if (!isVertical) return STEPPER_COLORS.text[state2];
|
|
8278
|
+
if (state2 === "active") return STEPPER_COLORS.text.active;
|
|
8279
|
+
if (isVerticalCompleted) return STEPPER_VERTICAL_COLORS.textCompleted;
|
|
8280
|
+
return STEPPER_VERTICAL_COLORS.textDefault;
|
|
8281
|
+
})();
|
|
8282
|
+
const sequenceBorderColor = (() => {
|
|
8283
|
+
if (isVerticalCompleted) {
|
|
8284
|
+
return STEPPER_VERTICAL_COLORS.sequenceBorderCompleted;
|
|
8285
|
+
}
|
|
8286
|
+
if (isVertical && (state2 === "active" || isVerticalLastActive)) {
|
|
8287
|
+
return STEPPER_VERTICAL_COLORS.sequenceBorderActive;
|
|
8288
|
+
}
|
|
8289
|
+
if (isHorizontalCompleted) return STEPPER_HORIZONTAL_COMPLETED_COLORS.sequenceBorder;
|
|
8290
|
+
return STEPPER_COLORS.sequenceBorder[state2];
|
|
8291
|
+
})();
|
|
8292
|
+
const sequenceBg = (() => {
|
|
8293
|
+
if (isVerticalCompleted) {
|
|
8294
|
+
return STEPPER_VERTICAL_COLORS.sequenceBgCompleted;
|
|
8295
|
+
}
|
|
8296
|
+
if (isVertical && (state2 === "active" || isVerticalLastActive)) {
|
|
8297
|
+
return STEPPER_VERTICAL_COLORS.sequenceBgActive;
|
|
8298
|
+
}
|
|
8299
|
+
if (isHorizontalCompleted) return STEPPER_HORIZONTAL_COMPLETED_COLORS.sequenceBg;
|
|
8300
|
+
return STEPPER_COLORS.sequenceBg[state2];
|
|
8301
|
+
})();
|
|
8302
|
+
const sequenceColor = (() => {
|
|
8303
|
+
if (isVerticalCompleted) {
|
|
8304
|
+
return STEPPER_VERTICAL_COLORS.sequenceIconCompleted;
|
|
8305
|
+
}
|
|
8306
|
+
if (isVertical && (state2 === "active" || isVerticalLastActive)) {
|
|
8307
|
+
return STEPPER_VERTICAL_COLORS.sequenceTextActive;
|
|
8308
|
+
}
|
|
8309
|
+
if (isVertical) return STEPPER_VERTICAL_COLORS.sequenceTextDefault;
|
|
8310
|
+
if (isHorizontalCompleted) return STEPPER_HORIZONTAL_COMPLETED_COLORS.sequenceIcon;
|
|
8311
|
+
return STEPPER_COLORS.sequenceText[state2];
|
|
8312
|
+
})();
|
|
8313
|
+
const itemStyle = {
|
|
8314
|
+
gap: STEPPER_LAYOUT.itemGap,
|
|
8315
|
+
color: itemColor,
|
|
8316
|
+
fontWeight: state2 === "active" || isVertical && hovered ? config.fontWeightActive : config.fontWeightDefault
|
|
8317
|
+
};
|
|
8318
|
+
const sequenceStyle = {
|
|
8319
|
+
width: config.sequenceSize,
|
|
8320
|
+
height: config.sequenceSize,
|
|
8321
|
+
flexBasis: config.sequenceSize,
|
|
8322
|
+
borderRadius: STEPPER_LAYOUT.sequenceRadius,
|
|
8323
|
+
borderWidth: STEPPER_LAYOUT.sequenceBorderWidth,
|
|
8324
|
+
borderColor: sequenceBorderColor,
|
|
8325
|
+
background: sequenceBg,
|
|
8326
|
+
color: sequenceColor
|
|
8327
|
+
};
|
|
8328
|
+
return /* @__PURE__ */ jsxs(
|
|
8329
|
+
"span",
|
|
8330
|
+
{
|
|
8331
|
+
role: roleListItem ? "listitem" : void 0,
|
|
8332
|
+
"aria-current": roleListItem && state2 === "active" ? "step" : void 0,
|
|
8333
|
+
className: "inline-flex items-center whitespace-nowrap",
|
|
8334
|
+
style: itemStyle,
|
|
8335
|
+
children: [
|
|
8336
|
+
/* @__PURE__ */ jsx(
|
|
8337
|
+
"span",
|
|
8338
|
+
{
|
|
8339
|
+
"aria-hidden": true,
|
|
8340
|
+
className: "box-border inline-flex shrink-0 items-center justify-center border border-solid font-bold",
|
|
8341
|
+
style: sequenceStyle,
|
|
8342
|
+
children: showsCheckIcon ? /* @__PURE__ */ jsx(SIcon, { name: "check", size: STEPPER_LAYOUT.sequenceIcon, color: "currentColor" }) : index + 1
|
|
8343
|
+
}
|
|
8344
|
+
),
|
|
8345
|
+
/* @__PURE__ */ jsx("span", { children: item.label })
|
|
8346
|
+
]
|
|
8347
|
+
}
|
|
8348
|
+
);
|
|
8349
|
+
};
|
|
8350
|
+
const renderClickableStepContent = (item, index, isVertical = false) => {
|
|
8351
|
+
const isDisabled = !isWithinClickableIndex(index);
|
|
8352
|
+
return /* @__PURE__ */ jsx(
|
|
8353
|
+
"button",
|
|
8354
|
+
{
|
|
8355
|
+
type: "button",
|
|
8356
|
+
disabled: isDisabled,
|
|
8357
|
+
className: cn(
|
|
8358
|
+
"m-0 inline-flex w-full items-center border-0 bg-transparent p-0 text-left",
|
|
8359
|
+
isDisabled ? "cursor-default" : "cursor-pointer"
|
|
8360
|
+
),
|
|
8361
|
+
style: { font: "inherit", color: "inherit" },
|
|
8362
|
+
onClick: () => {
|
|
8363
|
+
if (!isDisabled) emitValueChange(item, index);
|
|
8364
|
+
},
|
|
8365
|
+
children: renderStepContent(item, index, { isVertical, roleListItem: false })
|
|
8366
|
+
}
|
|
8367
|
+
);
|
|
8368
|
+
};
|
|
8369
|
+
if (vertical) {
|
|
8370
|
+
const groups = groupAdjacentItems(items);
|
|
8371
|
+
return /* @__PURE__ */ jsxs(
|
|
8372
|
+
"div",
|
|
8373
|
+
{
|
|
8374
|
+
role: "list",
|
|
8375
|
+
"aria-label": ariaLabel,
|
|
8376
|
+
className: cn("relative inline-flex flex-col items-start", className),
|
|
8377
|
+
style: {
|
|
8378
|
+
width: STEPPER_VERTICAL_LAYOUT.width,
|
|
8379
|
+
fontSize: config.fontSize,
|
|
8380
|
+
lineHeight: config.lineHeight,
|
|
8381
|
+
...style
|
|
8382
|
+
},
|
|
8383
|
+
children: [
|
|
8384
|
+
/* @__PURE__ */ jsx(
|
|
8385
|
+
"span",
|
|
8386
|
+
{
|
|
8387
|
+
"aria-hidden": "true",
|
|
8388
|
+
"data-stepper-accent-stripe": "true",
|
|
8389
|
+
className: "pointer-events-none absolute left-0 top-0 z-[1]",
|
|
8390
|
+
style: {
|
|
8391
|
+
width: STEPPER_VERTICAL_LAYOUT.accentStripeWidth,
|
|
8392
|
+
background: STEPPER_VERTICAL_LAYOUT.accentStripeColor,
|
|
8393
|
+
transition: "transform 160ms ease, height 160ms ease, opacity 120ms ease",
|
|
8394
|
+
...verticalAccentStripeStyle
|
|
8395
|
+
}
|
|
8396
|
+
}
|
|
8397
|
+
),
|
|
8398
|
+
groups.map((group) => {
|
|
8399
|
+
const groupKey = group.group ?? getItemValue(group.items[0], group.startIndex);
|
|
8400
|
+
return /* @__PURE__ */ jsxs(
|
|
8401
|
+
"div",
|
|
8402
|
+
{
|
|
8403
|
+
className: "flex w-full flex-col items-start",
|
|
8404
|
+
children: [
|
|
8405
|
+
group.group && /* @__PURE__ */ jsx(
|
|
8406
|
+
"div",
|
|
8407
|
+
{
|
|
8408
|
+
className: "flex w-full items-center overflow-hidden",
|
|
8409
|
+
style: {
|
|
8410
|
+
gap: STEPPER_VERTICAL_LAYOUT.itemGap,
|
|
8411
|
+
paddingLeft: STEPPER_VERTICAL_LAYOUT.itemPaddingX,
|
|
8412
|
+
paddingRight: STEPPER_VERTICAL_LAYOUT.itemPaddingX,
|
|
8413
|
+
paddingTop: STEPPER_VERTICAL_LAYOUT.titlePaddingTop,
|
|
8414
|
+
paddingBottom: STEPPER_VERTICAL_LAYOUT.titlePaddingBottom,
|
|
8415
|
+
background: STEPPER_VERTICAL_COLORS.itemBg.default,
|
|
8416
|
+
color: STEPPER_VERTICAL_COLORS.titleText,
|
|
8417
|
+
fontSize: STEPPER_VERTICAL_LAYOUT.titleFontSize,
|
|
8418
|
+
lineHeight: STEPPER_VERTICAL_LAYOUT.titleLineHeight,
|
|
8419
|
+
fontWeight: 700
|
|
8420
|
+
},
|
|
8421
|
+
children: /* @__PURE__ */ jsx("span", { className: "whitespace-nowrap", children: group.group })
|
|
8422
|
+
}
|
|
8423
|
+
),
|
|
8424
|
+
group.items.map((item, itemIndex) => {
|
|
8425
|
+
const index = group.startIndex + itemIndex;
|
|
8426
|
+
const state2 = getState(item, index);
|
|
8427
|
+
const itemValue = getItemValue(item, index);
|
|
8428
|
+
const canClickItem = isClickable && isWithinClickableIndex(index);
|
|
8429
|
+
const isDisabled = !canClickItem;
|
|
8430
|
+
const isHovered = hoveredIndex === index && canClickItem && state2 !== "active";
|
|
8431
|
+
const itemContainerStyle = {
|
|
8432
|
+
gap: STEPPER_VERTICAL_LAYOUT.itemGap,
|
|
8433
|
+
paddingLeft: STEPPER_VERTICAL_LAYOUT.itemPaddingX,
|
|
8434
|
+
paddingRight: STEPPER_VERTICAL_LAYOUT.itemPaddingX,
|
|
8435
|
+
paddingTop: STEPPER_VERTICAL_LAYOUT.itemPaddingY,
|
|
8436
|
+
paddingBottom: STEPPER_VERTICAL_LAYOUT.itemPaddingY,
|
|
8437
|
+
background: state2 === "active" ? STEPPER_VERTICAL_COLORS.itemBg.selected : isHovered ? STEPPER_VERTICAL_COLORS.itemBg.hover : STEPPER_VERTICAL_COLORS.itemBg.default
|
|
8438
|
+
};
|
|
8439
|
+
const handleMouseEnter = () => {
|
|
8440
|
+
if (canClickItem) setHoveredIndex(index);
|
|
8441
|
+
};
|
|
8442
|
+
const handleMouseLeave = () => {
|
|
8443
|
+
setHoveredIndex((current) => current === index ? null : current);
|
|
8444
|
+
};
|
|
8445
|
+
const stepContent = renderStepContent(item, index, {
|
|
8446
|
+
isVertical: true,
|
|
8447
|
+
roleListItem: false,
|
|
8448
|
+
hovered: isHovered
|
|
8449
|
+
});
|
|
8450
|
+
const errorBadge = item.error ? /* @__PURE__ */ jsx(
|
|
8451
|
+
"span",
|
|
8452
|
+
{
|
|
8453
|
+
"aria-hidden": "true",
|
|
8454
|
+
"data-stepper-error-badge": "true",
|
|
8455
|
+
className: "inline-flex shrink-0 overflow-hidden rounded-full",
|
|
8456
|
+
style: {
|
|
8457
|
+
width: 6,
|
|
8458
|
+
height: 6,
|
|
8459
|
+
background: STEPPER_VERTICAL_COLORS.errorBadge
|
|
8460
|
+
}
|
|
8461
|
+
}
|
|
8462
|
+
) : null;
|
|
8463
|
+
const isTooltipHovered = tooltipHoverValue === itemValue;
|
|
8464
|
+
const isCustomTooltipOpen = customTooltipOpen && index === firstErrorIndex;
|
|
8465
|
+
const showTooltip = item.error === true && (isTooltipHovered || isCustomTooltipOpen);
|
|
8466
|
+
const handleTooltipMouseEnter = () => setTooltipHoverValue(itemValue);
|
|
8467
|
+
const handleTooltipMouseLeave = () => {
|
|
8468
|
+
setTooltipHoverValue((current) => current === itemValue ? null : current);
|
|
8469
|
+
};
|
|
8470
|
+
const labelBadge = /* @__PURE__ */ jsx(
|
|
8471
|
+
STooltip2,
|
|
8472
|
+
{
|
|
8473
|
+
trigger: "none",
|
|
8474
|
+
open: showTooltip,
|
|
8475
|
+
content: ERROR_TOOLTIP_MESSAGE,
|
|
8476
|
+
tooltipType: "danger",
|
|
8477
|
+
placement: "right",
|
|
8478
|
+
children: /* @__PURE__ */ jsxs(
|
|
8479
|
+
"span",
|
|
8480
|
+
{
|
|
8481
|
+
className: cn(
|
|
8482
|
+
"relative z-[3] inline-flex items-center",
|
|
8483
|
+
isClickable && (isDisabled ? "cursor-default" : "cursor-pointer")
|
|
8484
|
+
),
|
|
8485
|
+
style: { gap: STEPPER_VERTICAL_LAYOUT.itemGap },
|
|
8486
|
+
onMouseEnter: handleTooltipMouseEnter,
|
|
8487
|
+
onMouseLeave: handleTooltipMouseLeave,
|
|
8488
|
+
onClick: isClickable ? () => {
|
|
8489
|
+
if (!isDisabled) emitValueChange(item, index);
|
|
8490
|
+
} : void 0,
|
|
8491
|
+
children: [
|
|
8492
|
+
stepContent,
|
|
8493
|
+
errorBadge
|
|
8494
|
+
]
|
|
8495
|
+
}
|
|
8496
|
+
)
|
|
8497
|
+
}
|
|
8498
|
+
);
|
|
8499
|
+
if (isClickable) {
|
|
8500
|
+
return /* @__PURE__ */ jsxs(
|
|
8501
|
+
"div",
|
|
8502
|
+
{
|
|
8503
|
+
ref: (node) => {
|
|
8504
|
+
verticalItemRefs.current[index] = node;
|
|
8505
|
+
},
|
|
8506
|
+
role: "listitem",
|
|
8507
|
+
"aria-current": state2 === "active" ? "step" : void 0,
|
|
8508
|
+
className: cn(
|
|
8509
|
+
"relative flex w-full items-center overflow-hidden",
|
|
8510
|
+
isDisabled ? "cursor-default" : "cursor-pointer"
|
|
8511
|
+
),
|
|
8512
|
+
onMouseEnter: handleMouseEnter,
|
|
8513
|
+
onMouseLeave: handleMouseLeave,
|
|
8514
|
+
style: itemContainerStyle,
|
|
8515
|
+
children: [
|
|
8516
|
+
/* @__PURE__ */ jsx(
|
|
8517
|
+
"button",
|
|
8518
|
+
{
|
|
8519
|
+
type: "button",
|
|
8520
|
+
disabled: isDisabled,
|
|
8521
|
+
"aria-label": item.label,
|
|
8522
|
+
className: cn(
|
|
8523
|
+
"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)",
|
|
8524
|
+
isDisabled ? "cursor-default" : "cursor-pointer"
|
|
8525
|
+
),
|
|
8526
|
+
onClick: () => {
|
|
8527
|
+
if (!isDisabled) emitValueChange(item, index);
|
|
8528
|
+
}
|
|
8529
|
+
}
|
|
8530
|
+
),
|
|
8531
|
+
labelBadge
|
|
8532
|
+
]
|
|
8533
|
+
},
|
|
8534
|
+
itemValue
|
|
8535
|
+
);
|
|
8536
|
+
}
|
|
8537
|
+
return /* @__PURE__ */ jsx(
|
|
8538
|
+
"div",
|
|
8539
|
+
{
|
|
8540
|
+
ref: (node) => {
|
|
8541
|
+
verticalItemRefs.current[index] = node;
|
|
8542
|
+
},
|
|
8543
|
+
role: "listitem",
|
|
8544
|
+
"aria-current": state2 === "active" ? "step" : void 0,
|
|
8545
|
+
className: cn(
|
|
8546
|
+
"relative flex w-full items-center overflow-hidden",
|
|
8547
|
+
isClickable && (canClickItem ? "cursor-pointer" : "cursor-default")
|
|
8548
|
+
),
|
|
8549
|
+
onMouseEnter: handleMouseEnter,
|
|
8550
|
+
onMouseLeave: handleMouseLeave,
|
|
8551
|
+
style: itemContainerStyle,
|
|
8552
|
+
children: labelBadge
|
|
8553
|
+
},
|
|
8554
|
+
itemValue
|
|
8555
|
+
);
|
|
8556
|
+
})
|
|
8557
|
+
]
|
|
8558
|
+
},
|
|
8559
|
+
`${groupKey}-${group.startIndex}`
|
|
8560
|
+
);
|
|
8561
|
+
})
|
|
8562
|
+
]
|
|
8563
|
+
}
|
|
8564
|
+
);
|
|
8565
|
+
}
|
|
8163
8566
|
return /* @__PURE__ */ jsx(
|
|
8164
8567
|
"div",
|
|
8165
8568
|
{
|
|
@@ -8173,43 +8576,8 @@ function SStepper({
|
|
|
8173
8576
|
...style
|
|
8174
8577
|
},
|
|
8175
8578
|
children: items.map((item, index) => {
|
|
8176
|
-
const state2 = getState(index);
|
|
8177
|
-
const
|
|
8178
|
-
gap: STEPPER_LAYOUT.itemGap,
|
|
8179
|
-
color: STEPPER_COLORS.text[state2],
|
|
8180
|
-
fontWeight: state2 === "active" ? config.fontWeightActive : config.fontWeightDefault
|
|
8181
|
-
};
|
|
8182
|
-
const sequenceStyle = {
|
|
8183
|
-
width: config.sequenceSize,
|
|
8184
|
-
height: config.sequenceSize,
|
|
8185
|
-
flexBasis: config.sequenceSize,
|
|
8186
|
-
borderRadius: STEPPER_LAYOUT.sequenceRadius,
|
|
8187
|
-
borderWidth: STEPPER_LAYOUT.sequenceBorderWidth,
|
|
8188
|
-
borderColor: STEPPER_COLORS.sequenceBorder[state2],
|
|
8189
|
-
background: STEPPER_COLORS.sequenceBg[state2],
|
|
8190
|
-
color: state2 === "completed" ? STEPPER_COLORS.text.completed : STEPPER_COLORS.sequenceText[state2]
|
|
8191
|
-
};
|
|
8192
|
-
const content = /* @__PURE__ */ jsxs(
|
|
8193
|
-
"span",
|
|
8194
|
-
{
|
|
8195
|
-
role: "listitem",
|
|
8196
|
-
"aria-current": state2 === "active" ? "step" : void 0,
|
|
8197
|
-
className: "inline-flex items-center whitespace-nowrap",
|
|
8198
|
-
style: itemStyle,
|
|
8199
|
-
children: [
|
|
8200
|
-
/* @__PURE__ */ jsx(
|
|
8201
|
-
"span",
|
|
8202
|
-
{
|
|
8203
|
-
"aria-hidden": true,
|
|
8204
|
-
className: "box-border inline-flex shrink-0 items-center justify-center border border-solid font-bold",
|
|
8205
|
-
style: sequenceStyle,
|
|
8206
|
-
children: state2 === "completed" ? /* @__PURE__ */ jsx(SIcon, { name: "check", size: STEPPER_LAYOUT.sequenceIcon, color: "currentColor" }) : index + 1
|
|
8207
|
-
}
|
|
8208
|
-
),
|
|
8209
|
-
/* @__PURE__ */ jsx("span", { children: item.label })
|
|
8210
|
-
]
|
|
8211
|
-
}
|
|
8212
|
-
);
|
|
8579
|
+
const state2 = getState(item, index);
|
|
8580
|
+
const content = isClickable ? /* @__PURE__ */ jsx("span", { role: "listitem", "aria-current": state2 === "active" ? "step" : void 0, children: renderClickableStepContent(item, index) }) : renderStepContent(item, index);
|
|
8213
8581
|
return /* @__PURE__ */ jsxs(
|
|
8214
8582
|
"span",
|
|
8215
8583
|
{
|
|
@@ -8248,7 +8616,7 @@ function SStepper({
|
|
|
8248
8616
|
})
|
|
8249
8617
|
}
|
|
8250
8618
|
);
|
|
8251
|
-
}
|
|
8619
|
+
});
|
|
8252
8620
|
function runRules(value, rules) {
|
|
8253
8621
|
if (!rules || rules.length === 0) return "";
|
|
8254
8622
|
for (const rule of rules) {
|