react-restyle-components 0.4.48 → 0.4.50
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/lib/src/core-components/src/components/Modal/BasicModal/modal.component.d.ts +3 -1
- package/lib/src/core-components/src/components/Modal/BasicModal/modal.component.js +8 -1
- package/lib/src/core-components/src/components/ProgressStepper/ProgressBar/ProgressBar.d.ts +3 -0
- package/lib/src/core-components/src/components/ProgressStepper/ProgressBar/ProgressBar.js +237 -0
- package/lib/src/core-components/src/components/ProgressStepper/ProgressBar/index.d.ts +2 -0
- package/lib/src/core-components/src/components/ProgressStepper/ProgressBar/index.js +1 -0
- package/lib/src/core-components/src/components/ProgressStepper/ProgressBar/types.d.ts +29 -0
- package/lib/src/core-components/src/components/ProgressStepper/ProgressBar/types.js +1 -0
- package/lib/src/core-components/src/components/ProgressStepper/ProgressStepper/ProgressStepper.d.ts +3 -0
- package/lib/src/core-components/src/components/ProgressStepper/ProgressStepper/ProgressStepper.js +42 -0
- package/lib/src/core-components/src/components/ProgressStepper/ProgressStepper/StepItem.d.ts +3 -0
- package/lib/src/core-components/src/components/ProgressStepper/ProgressStepper/StepItem.js +349 -0
- package/lib/src/core-components/src/components/ProgressStepper/ProgressStepper/index.d.ts +2 -0
- package/lib/src/core-components/src/components/ProgressStepper/ProgressStepper/index.js +1 -0
- package/lib/src/core-components/src/components/ProgressStepper/ProgressStepper/types.d.ts +75 -0
- package/lib/src/core-components/src/components/ProgressStepper/ProgressStepper/types.js +1 -0
- package/lib/src/core-components/src/components/ProgressStepper/index.d.ts +4 -0
- package/lib/src/core-components/src/components/ProgressStepper/index.js +2 -0
- package/lib/src/core-components/src/components/Table/Table.js +53 -14
- package/lib/src/core-components/src/components/Table/types.d.ts +3 -1
- package/lib/src/core-components/src/components/index.d.ts +1 -0
- package/lib/src/core-components/src/components/index.js +1 -0
- package/lib/src/core-components/src/tc.global.css +1 -267
- package/lib/src/core-components/src/tc.module.css +1 -3
- package/package.json +1 -1
|
@@ -70,6 +70,8 @@ export interface ModalProps {
|
|
|
70
70
|
overlayOpacity?: number;
|
|
71
71
|
/** Overlay background color */
|
|
72
72
|
overlayColor?: string;
|
|
73
|
+
/** Base z-index for overlay/content stack */
|
|
74
|
+
zIndex?: number;
|
|
73
75
|
/** Click overlay to close */
|
|
74
76
|
closeOnOverlayClick?: boolean;
|
|
75
77
|
/** Close on Escape key */
|
|
@@ -97,4 +99,4 @@ export interface ModalProps {
|
|
|
97
99
|
/** Modal content */
|
|
98
100
|
children: React.ReactNode;
|
|
99
101
|
}
|
|
100
|
-
export declare const Modal: ({ visible, title, className, contentClassName, headerClassName, style, contentStyle, onClose, isAutoClose, autoCloseDelay, size, position, showCloseButton, closeButton, overlayOpacity, overlayColor, closeOnOverlayClick, closeOnEscape, showHeader, headerBgColor, headerTextColor, borderRadius, maxWidth, contentPadding, headerPadding, animationDuration, classNames, styles, children, }: ModalProps) => React.JSX.Element | null;
|
|
102
|
+
export declare const Modal: ({ visible, title, className, contentClassName, headerClassName, style, contentStyle, onClose, isAutoClose, autoCloseDelay, size, position, showCloseButton, closeButton, overlayOpacity, overlayColor, zIndex, closeOnOverlayClick, closeOnEscape, showHeader, headerBgColor, headerTextColor, borderRadius, maxWidth, contentPadding, headerPadding, animationDuration, classNames, styles, children, }: ModalProps) => React.JSX.Element | null;
|
|
@@ -2,7 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
2
2
|
import { useEffect, useState } from 'react';
|
|
3
3
|
import s from '../../../tc.module.css';
|
|
4
4
|
import { cn } from '../../../utils';
|
|
5
|
-
export const Modal = ({ visible, title = '', className = '', contentClassName = '', headerClassName = '', style = {}, contentStyle = {}, onClose, isAutoClose = false, autoCloseDelay = 1000, size = 'md', position = 'center', showCloseButton = true, closeButton, overlayOpacity = 0.5, overlayColor, closeOnOverlayClick = true, closeOnEscape = true, showHeader = true, headerBgColor, headerTextColor, borderRadius = '0.5rem', maxWidth, contentPadding = '1rem', headerPadding = '1rem', animationDuration = 300, classNames = {}, styles = {}, children, }) => {
|
|
5
|
+
export const Modal = ({ visible, title = '', className = '', contentClassName = '', headerClassName = '', style = {}, contentStyle = {}, onClose, isAutoClose = false, autoCloseDelay = 1000, size = 'md', position = 'center', showCloseButton = true, closeButton, overlayOpacity = 0.5, overlayColor, zIndex = 11000, closeOnOverlayClick = true, closeOnEscape = true, showHeader = true, headerBgColor, headerTextColor, borderRadius = '0.5rem', maxWidth, contentPadding = '1rem', headerPadding = '1rem', animationDuration = 300, classNames = {}, styles = {}, children, }) => {
|
|
6
6
|
const [showModal, setShowModal] = useState(visible);
|
|
7
7
|
const [isAnimating, setIsAnimating] = useState(false);
|
|
8
8
|
useEffect(() => {
|
|
@@ -56,17 +56,24 @@ export const Modal = ({ visible, title = '', className = '', contentClassName =
|
|
|
56
56
|
bottom: s['items-end'],
|
|
57
57
|
};
|
|
58
58
|
const modalMaxWidth = maxWidth || (size !== 'full' ? sizeMaxWidths[size] : '95%');
|
|
59
|
+
const baseZIndex = zIndex ?? 11000;
|
|
60
|
+
const overlayZIndex = styles.overlay?.zIndex ?? baseZIndex;
|
|
61
|
+
const containerZIndex = styles.container?.zIndex ??
|
|
62
|
+
(typeof style.zIndex === 'number' ? style.zIndex : undefined) ??
|
|
63
|
+
baseZIndex + 1;
|
|
59
64
|
if (!showModal)
|
|
60
65
|
return null;
|
|
61
66
|
return (_jsxs(_Fragment, { children: [_jsx("div", { className: cn(s['fixed'], s['inset-0'], s['z-40'], s['bg-black'], classNames.overlay), style: {
|
|
62
67
|
opacity: isAnimating ? overlayOpacity : 0,
|
|
63
68
|
transition: `opacity ${animationDuration}ms ease-in-out`,
|
|
64
69
|
backgroundColor: overlayColor || undefined,
|
|
70
|
+
zIndex: overlayZIndex,
|
|
65
71
|
...styles.overlay,
|
|
66
72
|
}, onClick: handleOverlayClick }), _jsx("div", { className: cn(s['flex'], s['justify-center'], positionClasses[position], s['overflow-x-hidden'], s['overflow-y-auto'], s['fixed'], s['inset-0'], s['z-50'], s['outline-none'], s['focus:outline-none'], className, classNames.container), style: {
|
|
67
73
|
...style,
|
|
68
74
|
transition: `opacity ${animationDuration}ms ease-in-out`,
|
|
69
75
|
opacity: isAnimating ? 1 : 0,
|
|
76
|
+
zIndex: containerZIndex,
|
|
70
77
|
...styles.container,
|
|
71
78
|
}, onClick: handleOverlayClick, children: _jsx("div", { className: cn(s['relative'], s['w-full'], s['my-5'], s['mx-auto'], classNames.wrapper), style: {
|
|
72
79
|
maxWidth: modalMaxWidth,
|
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { forwardRef, useMemo, useEffect } from 'react';
|
|
4
|
+
// Inject keyframes animation styles
|
|
5
|
+
const injectAnimationStyles = () => {
|
|
6
|
+
const styleId = 'progress-bar-animations';
|
|
7
|
+
if (typeof document !== 'undefined' && !document.getElementById(styleId)) {
|
|
8
|
+
const styleSheet = document.createElement('style');
|
|
9
|
+
styleSheet.id = styleId;
|
|
10
|
+
styleSheet.textContent = `
|
|
11
|
+
@keyframes progressBarShimmer {
|
|
12
|
+
0% {
|
|
13
|
+
transform: translateX(-100%);
|
|
14
|
+
}
|
|
15
|
+
100% {
|
|
16
|
+
transform: translateX(100%);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
@keyframes progressBarIndeterminate {
|
|
20
|
+
0% {
|
|
21
|
+
left: -25%;
|
|
22
|
+
}
|
|
23
|
+
100% {
|
|
24
|
+
left: 100%;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
@keyframes progressBarPulse {
|
|
28
|
+
0%, 100% {
|
|
29
|
+
opacity: 1;
|
|
30
|
+
}
|
|
31
|
+
50% {
|
|
32
|
+
opacity: 0.7;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
@keyframes progressBarStripe {
|
|
36
|
+
0% {
|
|
37
|
+
background-position: 0 0;
|
|
38
|
+
}
|
|
39
|
+
100% {
|
|
40
|
+
background-position: 40px 0;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
@keyframes progressBarGlow {
|
|
44
|
+
0%, 100% {
|
|
45
|
+
box-shadow: 0 0 4px currentColor, inset 0 0 4px rgba(255,255,255,0.2);
|
|
46
|
+
}
|
|
47
|
+
50% {
|
|
48
|
+
box-shadow: 0 0 12px currentColor, inset 0 0 8px rgba(255,255,255,0.3);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
@keyframes progressBarSegmentPulse {
|
|
52
|
+
0%, 100% {
|
|
53
|
+
transform: scale(1);
|
|
54
|
+
opacity: 1;
|
|
55
|
+
}
|
|
56
|
+
50% {
|
|
57
|
+
transform: scale(1.02);
|
|
58
|
+
opacity: 0.9;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
`;
|
|
62
|
+
document.head.appendChild(styleSheet);
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
// Color constants
|
|
66
|
+
const colors = {
|
|
67
|
+
primary: '#8B5CF6',
|
|
68
|
+
track: '#E5E7EB',
|
|
69
|
+
text: '#374151',
|
|
70
|
+
supportText: '#6B7280',
|
|
71
|
+
};
|
|
72
|
+
// Size configurations
|
|
73
|
+
const sizeConfig = {
|
|
74
|
+
small: {
|
|
75
|
+
height: '4px',
|
|
76
|
+
borderRadius: '2px',
|
|
77
|
+
labelSize: '0.75rem',
|
|
78
|
+
supportSize: '0.625rem',
|
|
79
|
+
},
|
|
80
|
+
medium: {
|
|
81
|
+
height: '6px',
|
|
82
|
+
borderRadius: '3px',
|
|
83
|
+
labelSize: '0.875rem',
|
|
84
|
+
supportSize: '0.75rem',
|
|
85
|
+
},
|
|
86
|
+
large: {
|
|
87
|
+
height: '8px',
|
|
88
|
+
borderRadius: '4px',
|
|
89
|
+
labelSize: '1rem',
|
|
90
|
+
supportSize: '0.875rem',
|
|
91
|
+
},
|
|
92
|
+
};
|
|
93
|
+
export const ProgressBar = forwardRef(({ label, supportText, value, max = 100, size = 'medium', variant = 'continuous', segments = 4, color, trackColor, showValue = false, isIndeterminate = false, showAnimation = true, className, style, ...rest }, ref) => {
|
|
94
|
+
// Inject animation styles on mount
|
|
95
|
+
useEffect(() => {
|
|
96
|
+
injectAnimationStyles();
|
|
97
|
+
}, []);
|
|
98
|
+
const percentage = useMemo(() => {
|
|
99
|
+
const clampedValue = Math.max(0, Math.min(value, max));
|
|
100
|
+
return (clampedValue / max) * 100;
|
|
101
|
+
}, [value, max]);
|
|
102
|
+
// Check if progress is active (not 0 and not 100)
|
|
103
|
+
const isActive = percentage > 0 && percentage < 100;
|
|
104
|
+
const activeSegments = useMemo(() => {
|
|
105
|
+
if (variant !== 'segmented')
|
|
106
|
+
return 0;
|
|
107
|
+
return Math.ceil((percentage / 100) * segments);
|
|
108
|
+
}, [percentage, segments, variant]);
|
|
109
|
+
const ariaLabel = useMemo(() => {
|
|
110
|
+
if (isIndeterminate)
|
|
111
|
+
return 'Loading...';
|
|
112
|
+
return `${Math.round(percentage)}% complete`;
|
|
113
|
+
}, [percentage, isIndeterminate]);
|
|
114
|
+
const config = sizeConfig[size];
|
|
115
|
+
const containerStyle = {
|
|
116
|
+
display: 'flex',
|
|
117
|
+
flexDirection: 'column',
|
|
118
|
+
gap: '0.5rem',
|
|
119
|
+
width: '100%',
|
|
120
|
+
};
|
|
121
|
+
const labelStyle = {
|
|
122
|
+
fontSize: config.labelSize,
|
|
123
|
+
fontWeight: 600,
|
|
124
|
+
color: colors.text,
|
|
125
|
+
lineHeight: 1.4,
|
|
126
|
+
};
|
|
127
|
+
const supportTextStyle = {
|
|
128
|
+
fontSize: config.supportSize,
|
|
129
|
+
fontWeight: 400,
|
|
130
|
+
color: colors.supportText,
|
|
131
|
+
lineHeight: 1.4,
|
|
132
|
+
};
|
|
133
|
+
const trackStyle = {
|
|
134
|
+
width: '100%',
|
|
135
|
+
height: config.height,
|
|
136
|
+
backgroundColor: trackColor || colors.track,
|
|
137
|
+
borderRadius: config.borderRadius,
|
|
138
|
+
overflow: 'hidden',
|
|
139
|
+
position: 'relative',
|
|
140
|
+
};
|
|
141
|
+
const fillColor = color || colors.primary;
|
|
142
|
+
const fillStyle = {
|
|
143
|
+
height: '100%',
|
|
144
|
+
backgroundColor: fillColor,
|
|
145
|
+
borderRadius: config.borderRadius,
|
|
146
|
+
transition: 'width 0.5s ease-out',
|
|
147
|
+
width: isIndeterminate ? '30%' : `${percentage}%`,
|
|
148
|
+
position: 'relative',
|
|
149
|
+
overflow: 'hidden',
|
|
150
|
+
...(isIndeterminate
|
|
151
|
+
? {
|
|
152
|
+
position: 'absolute',
|
|
153
|
+
animation: 'progressBarIndeterminate 1.5s ease-in-out infinite',
|
|
154
|
+
}
|
|
155
|
+
: {}),
|
|
156
|
+
...(showAnimation && isActive && !isIndeterminate
|
|
157
|
+
? {
|
|
158
|
+
animation: 'progressBarPulse 2s ease-in-out infinite',
|
|
159
|
+
}
|
|
160
|
+
: {}),
|
|
161
|
+
};
|
|
162
|
+
// Shimmer overlay for the fill
|
|
163
|
+
const shimmerStyle = {
|
|
164
|
+
position: 'absolute',
|
|
165
|
+
top: 0,
|
|
166
|
+
left: 0,
|
|
167
|
+
right: 0,
|
|
168
|
+
bottom: 0,
|
|
169
|
+
background: `linear-gradient(
|
|
170
|
+
90deg,
|
|
171
|
+
transparent 0%,
|
|
172
|
+
rgba(255, 255, 255, 0.4) 50%,
|
|
173
|
+
transparent 100%
|
|
174
|
+
)`,
|
|
175
|
+
animation: 'progressBarShimmer 1.5s ease-in-out infinite',
|
|
176
|
+
};
|
|
177
|
+
// Striped effect style (alternative animation)
|
|
178
|
+
const stripedStyle = {
|
|
179
|
+
position: 'absolute',
|
|
180
|
+
top: 0,
|
|
181
|
+
left: 0,
|
|
182
|
+
right: 0,
|
|
183
|
+
bottom: 0,
|
|
184
|
+
backgroundImage: `linear-gradient(
|
|
185
|
+
45deg,
|
|
186
|
+
rgba(255, 255, 255, 0.15) 25%,
|
|
187
|
+
transparent 25%,
|
|
188
|
+
transparent 50%,
|
|
189
|
+
rgba(255, 255, 255, 0.15) 50%,
|
|
190
|
+
rgba(255, 255, 255, 0.15) 75%,
|
|
191
|
+
transparent 75%,
|
|
192
|
+
transparent
|
|
193
|
+
)`,
|
|
194
|
+
backgroundSize: '40px 40px',
|
|
195
|
+
animation: 'progressBarStripe 1s linear infinite',
|
|
196
|
+
};
|
|
197
|
+
const segmentedTrackStyle = {
|
|
198
|
+
display: 'flex',
|
|
199
|
+
gap: '0.25rem',
|
|
200
|
+
width: '100%',
|
|
201
|
+
height: config.height,
|
|
202
|
+
};
|
|
203
|
+
const getSegmentStyle = (isActiveSegment, segmentIndex) => {
|
|
204
|
+
const isLastActiveSegment = segmentIndex === activeSegments - 1 && activeSegments > 0;
|
|
205
|
+
return {
|
|
206
|
+
flex: 1,
|
|
207
|
+
height: '100%',
|
|
208
|
+
backgroundColor: isActiveSegment ? fillColor : trackColor || colors.track,
|
|
209
|
+
borderRadius: config.borderRadius,
|
|
210
|
+
transition: 'all 0.3s ease-in-out',
|
|
211
|
+
position: 'relative',
|
|
212
|
+
overflow: 'hidden',
|
|
213
|
+
...(showAnimation && isLastActiveSegment && isActive
|
|
214
|
+
? {
|
|
215
|
+
animation: 'progressBarSegmentPulse 1.5s ease-in-out infinite',
|
|
216
|
+
boxShadow: `0 0 8px ${fillColor}`,
|
|
217
|
+
}
|
|
218
|
+
: {}),
|
|
219
|
+
};
|
|
220
|
+
};
|
|
221
|
+
const valueContainerStyle = {
|
|
222
|
+
display: 'flex',
|
|
223
|
+
justifyContent: 'space-between',
|
|
224
|
+
alignItems: 'center',
|
|
225
|
+
};
|
|
226
|
+
const valueTextStyle = {
|
|
227
|
+
fontSize: config.supportSize,
|
|
228
|
+
fontWeight: 500,
|
|
229
|
+
color: colors.text,
|
|
230
|
+
};
|
|
231
|
+
return (_jsxs("div", { ref: ref, className: className, style: { ...containerStyle, ...style }, "data-aui": "progress-bar", ...rest, children: [(label || showValue) && (_jsxs("div", { style: valueContainerStyle, children: [label && _jsx("span", { style: labelStyle, children: label }), showValue && !isIndeterminate && (_jsxs("span", { style: valueTextStyle, children: [Math.round(percentage), "%"] }))] })), variant === 'continuous' ? (_jsx("div", { style: trackStyle, role: "progressbar", "aria-valuenow": isIndeterminate ? undefined : value, "aria-valuemin": 0, "aria-valuemax": max, "aria-label": ariaLabel, children: _jsxs("div", { style: fillStyle, children: [showAnimation && (isActive || isIndeterminate) && percentage > 0 && (_jsx("div", { style: shimmerStyle, "aria-hidden": "true" })), showAnimation && isIndeterminate && (_jsx("div", { style: stripedStyle, "aria-hidden": "true" }))] }) })) : (_jsx("div", { style: segmentedTrackStyle, role: "progressbar", "aria-valuenow": value, "aria-valuemin": 0, "aria-valuemax": max, "aria-label": ariaLabel, children: Array.from({ length: segments }).map((_, index) => {
|
|
232
|
+
const isActiveSegment = index < activeSegments;
|
|
233
|
+
const isLastActiveSegment = index === activeSegments - 1 && activeSegments > 0;
|
|
234
|
+
return (_jsx("div", { style: getSegmentStyle(isActiveSegment, index), children: showAnimation && isLastActiveSegment && isActive && (_jsx("div", { style: shimmerStyle, "aria-hidden": "true" })) }, index));
|
|
235
|
+
}) })), supportText && _jsx("span", { style: supportTextStyle, children: supportText })] }));
|
|
236
|
+
});
|
|
237
|
+
ProgressBar.displayName = 'ProgressBar';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './ProgressBar';
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface ProgressBarProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
3
|
+
/** Label text displayed above the progress bar */
|
|
4
|
+
label?: string;
|
|
5
|
+
/** Support text displayed below the progress bar */
|
|
6
|
+
supportText?: string;
|
|
7
|
+
/** Current progress value */
|
|
8
|
+
value: number;
|
|
9
|
+
/** Maximum value (default: 100) */
|
|
10
|
+
max?: number;
|
|
11
|
+
/** Size of the progress bar */
|
|
12
|
+
size?: 'small' | 'medium' | 'large';
|
|
13
|
+
/** Variant of the progress bar */
|
|
14
|
+
variant?: 'continuous' | 'segmented';
|
|
15
|
+
/** Number of segments (for segmented variant) */
|
|
16
|
+
segments?: number;
|
|
17
|
+
/** Custom color for the progress fill */
|
|
18
|
+
color?: string;
|
|
19
|
+
/** Custom color for the track */
|
|
20
|
+
trackColor?: string;
|
|
21
|
+
/** Whether to show the percentage value */
|
|
22
|
+
showValue?: boolean;
|
|
23
|
+
/** Whether the progress bar is in loading/indeterminate state */
|
|
24
|
+
isIndeterminate?: boolean;
|
|
25
|
+
/** Whether to show loading animations (shimmer, pulse effects). Default: true */
|
|
26
|
+
showAnimation?: boolean;
|
|
27
|
+
/** Custom class name */
|
|
28
|
+
className?: string;
|
|
29
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/lib/src/core-components/src/components/ProgressStepper/ProgressStepper/ProgressStepper.js
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { createElement as _createElement } from "react";
|
|
3
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
4
|
+
import { forwardRef, useMemo } from 'react';
|
|
5
|
+
import { StepItem } from './StepItem';
|
|
6
|
+
export const ProgressStepper = forwardRef(({ steps, size = 'medium', orientation = 'horizontal', isPacked = false, indicatorType = 'dot', activeColor = '#8B5CF6', inactiveColor = '#E5E7EB', className, style, ...rest }, ref) => {
|
|
7
|
+
// Generate accessible aria label based on current step
|
|
8
|
+
const ariaLabel = useMemo(() => {
|
|
9
|
+
const currentStepIndex = steps
|
|
10
|
+
.map((step) => step.state !== 'incomplete')
|
|
11
|
+
.lastIndexOf(true);
|
|
12
|
+
const currentStep = steps[currentStepIndex];
|
|
13
|
+
const label = `step ${currentStepIndex + 1} out of ${steps.length}`;
|
|
14
|
+
if (!currentStep?.subSteps?.length) {
|
|
15
|
+
return label;
|
|
16
|
+
}
|
|
17
|
+
if (currentStep.state === 'inprogress') {
|
|
18
|
+
return `${label} part 1`;
|
|
19
|
+
}
|
|
20
|
+
const subStepIndex = currentStep.subSteps?.findIndex((subStep) => subStep.state === 'inprogress');
|
|
21
|
+
if (subStepIndex !== undefined && subStepIndex >= 0) {
|
|
22
|
+
return `${label} part ${subStepIndex + 2}`;
|
|
23
|
+
}
|
|
24
|
+
return label;
|
|
25
|
+
}, [steps]);
|
|
26
|
+
const hiddenAriaStyle = {
|
|
27
|
+
height: 0,
|
|
28
|
+
opacity: 0,
|
|
29
|
+
position: 'absolute',
|
|
30
|
+
overflow: 'hidden',
|
|
31
|
+
};
|
|
32
|
+
const listContainerStyle = {
|
|
33
|
+
display: 'flex',
|
|
34
|
+
flexDirection: orientation === 'horizontal' ? 'row' : 'column',
|
|
35
|
+
alignItems: 'flex-start',
|
|
36
|
+
listStyleType: 'none',
|
|
37
|
+
padding: 0,
|
|
38
|
+
margin: 0,
|
|
39
|
+
};
|
|
40
|
+
return (_jsxs(_Fragment, { children: [_jsx("div", { style: hiddenAriaStyle, "aria-live": "polite", role: "status", children: ariaLabel }), _jsx("ul", { "data-aui": "progress-stepper", ref: ref, "aria-hidden": true, "data-testid": "progress-stepper", style: { ...listContainerStyle, ...style }, className: className, ...rest, children: steps.map((step, index) => (_createElement(StepItem, { ...step, key: step.id || index, index: index, stepsAmount: steps.length, size: size, orientation: orientation, isPacked: isPacked, indicatorType: indicatorType, activeColor: activeColor, inactiveColor: inactiveColor }))) })] }));
|
|
41
|
+
});
|
|
42
|
+
ProgressStepper.displayName = 'ProgressStepper';
|