funda-ui 4.7.108 → 4.7.115
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/Stepper/index.css +30 -22
- package/Stepper/index.js +11 -5
- package/Utils/useHistoryTracker.d.ts +26 -0
- package/Utils/useHistoryTracker.js +475 -0
- package/lib/cjs/Stepper/index.js +11 -5
- package/lib/cjs/Utils/useHistoryTracker.d.ts +26 -0
- package/lib/cjs/Utils/useHistoryTracker.js +475 -0
- package/lib/css/Stepper/index.css +30 -22
- package/lib/esm/Stepper/index.scss +33 -23
- package/lib/esm/Stepper/index.tsx +18 -5
- package/lib/esm/Utils/hooks/useHistoryTracker.tsx +403 -0
- package/package.json +1 -1
- package/Utils/useGlobalUrlListener.d.ts +0 -2
- package/Utils/useGlobalUrlListener.js +0 -157
- package/lib/cjs/Utils/useGlobalUrlListener.d.ts +0 -2
- package/lib/cjs/Utils/useGlobalUrlListener.js +0 -157
- package/lib/esm/Utils/hooks/useGlobalUrlListener.tsx +0 -46
package/Stepper/index.css
CHANGED
|
@@ -14,9 +14,10 @@
|
|
|
14
14
|
--stepper-line-default: #dfdfdf;
|
|
15
15
|
--stepper-line-active: #2563eb;
|
|
16
16
|
--stepper-line-complete: #22c55e;
|
|
17
|
-
--stepper-indicator-size: 0.875rem;
|
|
18
|
-
--stepper-indicator-offset:
|
|
17
|
+
--stepper-indicator-font-size: 0.875rem;
|
|
18
|
+
--stepper-indicator-offset: 60px;
|
|
19
19
|
--stepper-title-size: 0.875rem;
|
|
20
|
+
--stepper-indicator-size: 32px;
|
|
20
21
|
position: relative;
|
|
21
22
|
/* Navigation Header (only horizontal) */
|
|
22
23
|
/* Main Navigation - Each step item (with circle + title) */
|
|
@@ -32,24 +33,25 @@
|
|
|
32
33
|
align-items: flex-start;
|
|
33
34
|
flex-wrap: nowrap;
|
|
34
35
|
position: relative;
|
|
36
|
+
max-width: calc(100% - var(--stepper-indicator-size));
|
|
35
37
|
/* background line */
|
|
36
38
|
}
|
|
37
39
|
.stepper-container .stepper-header::before {
|
|
38
40
|
content: "";
|
|
39
41
|
position: absolute;
|
|
40
42
|
top: 16px; /* Subtract the height of the title */
|
|
41
|
-
left:
|
|
43
|
+
left: 0;
|
|
42
44
|
right: 0;
|
|
43
45
|
height: 2px;
|
|
44
46
|
background-color: var(--stepper-line-default);
|
|
45
47
|
z-index: 1;
|
|
46
|
-
width:
|
|
48
|
+
width: 100%;
|
|
47
49
|
}
|
|
48
50
|
.stepper-container .stepper-header::after {
|
|
49
51
|
content: "";
|
|
50
52
|
position: absolute;
|
|
51
53
|
top: 16px; /* Subtract the height of the title */
|
|
52
|
-
left:
|
|
54
|
+
left: 0;
|
|
53
55
|
height: 2px;
|
|
54
56
|
background-color: var(--stepper-line-complete);
|
|
55
57
|
z-index: 2;
|
|
@@ -58,14 +60,14 @@
|
|
|
58
60
|
}
|
|
59
61
|
.stepper-container .stepper-header::after {
|
|
60
62
|
width: var(--stepper-progress-width, 0%);
|
|
61
|
-
max-width:
|
|
63
|
+
max-width: 100%;
|
|
62
64
|
}
|
|
63
65
|
.stepper-container .step-item {
|
|
64
66
|
flex: none;
|
|
65
67
|
display: flex;
|
|
66
68
|
flex-direction: column;
|
|
67
69
|
align-items: center;
|
|
68
|
-
max-width:
|
|
70
|
+
max-width: 0;
|
|
69
71
|
position: relative;
|
|
70
72
|
z-index: 3;
|
|
71
73
|
}
|
|
@@ -105,15 +107,15 @@
|
|
|
105
107
|
transform: scaleX(1);
|
|
106
108
|
}
|
|
107
109
|
.stepper-container .step-indicator {
|
|
108
|
-
width:
|
|
109
|
-
height:
|
|
110
|
+
width: var(--stepper-indicator-size);
|
|
111
|
+
height: var(--stepper-indicator-size);
|
|
110
112
|
margin: 0 auto 0.25rem;
|
|
111
113
|
border-radius: 9999px;
|
|
112
114
|
display: flex;
|
|
113
115
|
align-items: center;
|
|
114
116
|
justify-content: center;
|
|
115
117
|
border: 2px solid #ccc;
|
|
116
|
-
font-size: var(--stepper-indicator-size);
|
|
118
|
+
font-size: var(--stepper-indicator-font-size);
|
|
117
119
|
/* default */
|
|
118
120
|
background-color: var(--stepper-indicator-default);
|
|
119
121
|
color: var(--stepper-color-default);
|
|
@@ -130,12 +132,17 @@
|
|
|
130
132
|
border-color: var(--stepper-border-complete);
|
|
131
133
|
}
|
|
132
134
|
.stepper-container .step-title {
|
|
135
|
+
white-space: nowrap;
|
|
133
136
|
font-size: var(--stepper-title-size);
|
|
137
|
+
margin-left: calc(var(--stepper-indicator-offset) / 2);
|
|
134
138
|
/* default */
|
|
135
139
|
color: var(--stepper-color-default);
|
|
136
140
|
}
|
|
137
141
|
.stepper-container .step-title--active {
|
|
138
|
-
|
|
142
|
+
color: var(--stepper-indicator-active);
|
|
143
|
+
}
|
|
144
|
+
.stepper-container .step-title--complete {
|
|
145
|
+
color: var(--stepper-indicator-complete);
|
|
139
146
|
}
|
|
140
147
|
.stepper-container .stepper-buttons {
|
|
141
148
|
display: flex;
|
|
@@ -157,10 +164,10 @@
|
|
|
157
164
|
|
|
158
165
|
/*------ Verticle ------*/
|
|
159
166
|
.stepper-container.stepper-container--vertical {
|
|
160
|
-
--stepper-indicator-offset: 50px;
|
|
161
167
|
display: flex;
|
|
162
168
|
flex-direction: column;
|
|
163
|
-
gap:
|
|
169
|
+
gap: 2.5rem; /* line length */
|
|
170
|
+
max-height: calc(100% - var(--stepper-indicator-size));
|
|
164
171
|
/* background line */
|
|
165
172
|
/* Layout */
|
|
166
173
|
/* Title */
|
|
@@ -170,18 +177,18 @@
|
|
|
170
177
|
.stepper-container.stepper-container--vertical::before {
|
|
171
178
|
content: "";
|
|
172
179
|
position: absolute;
|
|
173
|
-
top:
|
|
174
|
-
left:
|
|
180
|
+
top: 0;
|
|
181
|
+
left: calc(var(--stepper-indicator-size) / 2);
|
|
175
182
|
width: 2px;
|
|
176
|
-
height:
|
|
183
|
+
height: 100%;
|
|
177
184
|
background-color: var(--stepper-line-default);
|
|
178
185
|
z-index: 1;
|
|
179
186
|
}
|
|
180
187
|
.stepper-container.stepper-container--vertical::after {
|
|
181
188
|
content: "";
|
|
182
189
|
position: absolute;
|
|
183
|
-
top:
|
|
184
|
-
left:
|
|
190
|
+
top: 0;
|
|
191
|
+
left: calc(var(--stepper-indicator-size) / 2);
|
|
185
192
|
width: 2px;
|
|
186
193
|
background-color: var(--stepper-line-complete);
|
|
187
194
|
z-index: 2;
|
|
@@ -190,7 +197,7 @@
|
|
|
190
197
|
}
|
|
191
198
|
.stepper-container.stepper-container--vertical::after {
|
|
192
199
|
height: var(--stepper-progress-height, 0%);
|
|
193
|
-
max-height:
|
|
200
|
+
max-height: 100%;
|
|
194
201
|
}
|
|
195
202
|
.stepper-container.stepper-container--vertical .vertical-step-row {
|
|
196
203
|
display: flex;
|
|
@@ -198,13 +205,14 @@
|
|
|
198
205
|
}
|
|
199
206
|
.stepper-container.stepper-container--vertical .vertical-step-left {
|
|
200
207
|
flex-shrink: 0;
|
|
201
|
-
width: var(--stepper-indicator-
|
|
208
|
+
width: var(--stepper-indicator-size);
|
|
209
|
+
height: var(--stepper-indicator-size);
|
|
202
210
|
position: relative;
|
|
203
211
|
/* Main Navigation - Each step item (with circle + title) */
|
|
204
212
|
/* Line */
|
|
205
213
|
}
|
|
206
214
|
.stepper-container.stepper-container--vertical .vertical-step-left .step-item {
|
|
207
|
-
margin-top:
|
|
215
|
+
margin-top: 0;
|
|
208
216
|
}
|
|
209
217
|
.stepper-container.stepper-container--vertical .vertical-step-left .step-line {
|
|
210
218
|
position: absolute;
|
|
@@ -216,7 +224,7 @@
|
|
|
216
224
|
left: 70px;
|
|
217
225
|
width: calc(100% - 70px);
|
|
218
226
|
position: absolute;
|
|
219
|
-
top:
|
|
227
|
+
top: 0; /* required */
|
|
220
228
|
}
|
|
221
229
|
.stepper-container.stepper-container--vertical .step-title {
|
|
222
230
|
display: none;
|
package/Stepper/index.js
CHANGED
|
@@ -448,7 +448,8 @@ var Stepper = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.forwardRef)(fun
|
|
|
448
448
|
})
|
|
449
449
|
}, isCompleted ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement((react__WEBPACK_IMPORTED_MODULE_0___default().Fragment), null, disableCompleteIcon ? index + 1 : completeIcon) : index + 1), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", {
|
|
450
450
|
className: (0,funda_utils_dist_cjs_cls__WEBPACK_IMPORTED_MODULE_1__.combinedCls)('step-title', {
|
|
451
|
-
'step-title--active': isActive
|
|
451
|
+
'step-title--active': isActive,
|
|
452
|
+
'step-title--complete': isCompleted
|
|
452
453
|
})
|
|
453
454
|
}, header)), index < panels.length - 1 && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", {
|
|
454
455
|
className: (0,funda_utils_dist_cjs_cls__WEBPACK_IMPORTED_MODULE_1__.combinedCls)('step-line', {
|
|
@@ -467,7 +468,10 @@ var Stepper = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.forwardRef)(fun
|
|
|
467
468
|
var isCompleted = index < activeIndex || index === panels.length - 1 && isLastStepComplete;
|
|
468
469
|
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", {
|
|
469
470
|
key: index,
|
|
470
|
-
className:
|
|
471
|
+
className: (0,funda_utils_dist_cjs_cls__WEBPACK_IMPORTED_MODULE_1__.combinedCls)('vertical-step-row', {
|
|
472
|
+
'vertical-step-row--active': isActive,
|
|
473
|
+
'vertical-step-row--complete': isCompleted
|
|
474
|
+
})
|
|
471
475
|
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", {
|
|
472
476
|
className: "vertical-step-left"
|
|
473
477
|
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", {
|
|
@@ -486,7 +490,8 @@ var Stepper = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.forwardRef)(fun
|
|
|
486
490
|
})
|
|
487
491
|
}, isCompleted ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement((react__WEBPACK_IMPORTED_MODULE_0___default().Fragment), null, disableCompleteIcon ? index + 1 : completeIcon) : index + 1), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", {
|
|
488
492
|
className: (0,funda_utils_dist_cjs_cls__WEBPACK_IMPORTED_MODULE_1__.combinedCls)('step-title', {
|
|
489
|
-
'step-title--active': isActive
|
|
493
|
+
'step-title--active': isActive,
|
|
494
|
+
'step-title--complete': isCompleted
|
|
490
495
|
})
|
|
491
496
|
}, header)), index < panels.length - 1 && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", {
|
|
492
497
|
className: (0,funda_utils_dist_cjs_cls__WEBPACK_IMPORTED_MODULE_1__.combinedCls)('step-line', {
|
|
@@ -511,6 +516,7 @@ var Stepper = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.forwardRef)(fun
|
|
|
511
516
|
'--stepper-progress-height': "".concat(progress, "%")
|
|
512
517
|
};
|
|
513
518
|
} else {
|
|
519
|
+
var defaultProgress = activeIndex / (panels.length - 1) * 100;
|
|
514
520
|
var firstItem = stepItems[0];
|
|
515
521
|
var lastItem = stepItems[stepItems.length - 1];
|
|
516
522
|
if (!firstItem || !lastItem) return {};
|
|
@@ -520,9 +526,9 @@ var Stepper = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.forwardRef)(fun
|
|
|
520
526
|
var currentItem = stepItems[activeIndex];
|
|
521
527
|
if (!currentItem) return {};
|
|
522
528
|
var currentCenter = currentItem.offsetLeft + currentItem.clientWidth / 2;
|
|
523
|
-
var _progress = (currentCenter - firstCenter) / totalWidth * 100;
|
|
529
|
+
var _progress = defaultProgress !== 0 && activeIndex > 0 ? defaultProgress : (currentCenter - firstCenter) / totalWidth * 100;
|
|
524
530
|
return {
|
|
525
|
-
'--stepper-progress-width': "".concat(_progress, "%")
|
|
531
|
+
'--stepper-progress-width': "".concat(isNaN(_progress) ? 0 : _progress, "%")
|
|
526
532
|
};
|
|
527
533
|
}
|
|
528
534
|
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export declare type UseHistoryTrackerChangeFnType = (args: {
|
|
2
|
+
isReady: boolean;
|
|
3
|
+
history: string[];
|
|
4
|
+
forwardHistory: string[];
|
|
5
|
+
currentUrl: string;
|
|
6
|
+
firstUrl: string;
|
|
7
|
+
canGoBack: boolean;
|
|
8
|
+
canGoForward: boolean;
|
|
9
|
+
}) => void;
|
|
10
|
+
export declare type UseHistoryTrackerProps = {
|
|
11
|
+
onChange?: UseHistoryTrackerChangeFnType | null;
|
|
12
|
+
};
|
|
13
|
+
declare const useHistoryTracker: (props: UseHistoryTrackerProps) => {
|
|
14
|
+
isReady: boolean;
|
|
15
|
+
history: string[];
|
|
16
|
+
forwardHistory: string[];
|
|
17
|
+
currentUrl: string;
|
|
18
|
+
firstUrl: string;
|
|
19
|
+
clearHistory: () => void;
|
|
20
|
+
goToHistory: (index: number) => void;
|
|
21
|
+
goBack: () => Promise<unknown>;
|
|
22
|
+
goForward: () => Promise<unknown>;
|
|
23
|
+
canGoBack: () => boolean;
|
|
24
|
+
canGoForward: () => boolean;
|
|
25
|
+
};
|
|
26
|
+
export default useHistoryTracker;
|