funda-ui 4.6.399 → 4.7.101

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.
@@ -0,0 +1,167 @@
1
+ /* ======================================================
2
+ <!-- Stepper -->
3
+ /* ====================================================== */
4
+ .stepper-container {
5
+ --stepper-color-default: #333;
6
+ --stepper-color-active: white;
7
+ --stepper-color-complete: #2563eb;
8
+ --stepper-bg-default: white;
9
+ --stepper-bg-active: #2563eb;
10
+ --stepper-bg-complete: #22c55e;
11
+ --stepper-border-default: #ccc;
12
+ --stepper-border-active: #2563eb;
13
+ --stepper-border-complete: #22c55e;
14
+ --stepper-indicator-size: 0.875rem;
15
+ --stepper-title-size: 0.875rem;
16
+ position: relative;
17
+ /* NAvigation Header (only horizontal) */
18
+ /* Main Navigation */
19
+ /* Each step item (with circle + title) */
20
+ /* Step Indicator */
21
+ /* Title */
22
+ /* Panels Area */
23
+ /* Buttons */
24
+ /* Panel */
25
+ }
26
+ .stepper-container .stepper-header {
27
+ display: flex;
28
+ align-items: center;
29
+ margin-bottom: 1.5rem;
30
+ flex-wrap: nowrap;
31
+ }
32
+ .stepper-container .step-item {
33
+ flex: none;
34
+ display: flex;
35
+ flex-direction: column;
36
+ align-items: center;
37
+ max-width: 100px;
38
+ position: relative;
39
+ z-index: 1;
40
+ }
41
+ .stepper-container .step-item.step-item--clickable {
42
+ cursor: pointer;
43
+ }
44
+ .stepper-container .step-line {
45
+ flex: 1;
46
+ height: 2px;
47
+ background-color: #ddd;
48
+ margin: 0 4px;
49
+ position: relative;
50
+ top: -10px;
51
+ z-index: 0;
52
+ }
53
+ .stepper-container .step-line--complete {
54
+ background-color: var(--stepper-bg-complete);
55
+ }
56
+ .stepper-container .step-line--active {
57
+ background-color: var(--stepper-bg-complete);
58
+ }
59
+ .stepper-container .step-indicator {
60
+ width: 32px;
61
+ height: 32px;
62
+ margin: 0 auto 0.25rem;
63
+ border-radius: 9999px;
64
+ display: flex;
65
+ align-items: center;
66
+ justify-content: center;
67
+ border: 2px solid #ccc;
68
+ font-size: var(--stepper-indicator-size);
69
+ /* default */
70
+ background-color: var(--stepper-bg-default);
71
+ color: var(--stepper-color-default);
72
+ border-color: var(--stepper-border-default);
73
+ }
74
+ .stepper-container .step-indicator--active {
75
+ background-color: var(--stepper-bg-active);
76
+ color: var(--stepper-color-active);
77
+ border-color: var(--stepper-border-active);
78
+ }
79
+ .stepper-container .step-indicator--complete {
80
+ background-color: var(--stepper-bg-complete);
81
+ color: var(--stepper-color-active);
82
+ border-color: var(--stepper-border-complete);
83
+ }
84
+ .stepper-container .step-title {
85
+ font-size: var(--stepper-title-size);
86
+ /* default */
87
+ color: var(--stepper-color-default);
88
+ }
89
+ .stepper-container .step-title--active {
90
+ font-weight: bold;
91
+ }
92
+ .stepper-container .stepper-buttons {
93
+ display: flex;
94
+ justify-content: space-between;
95
+ margin-top: 1rem;
96
+ }
97
+ .stepper-container .stepper-panel {
98
+ width: 100%;
99
+ }
100
+ .stepper-container .stepper-panel-header {
101
+ font-size: 1.25rem;
102
+ font-weight: bold;
103
+ margin-bottom: 1rem;
104
+ display: none;
105
+ }
106
+ .stepper-container .stepper-panel-content {
107
+ width: 100%;
108
+ }
109
+
110
+ /*------ Verticle ------*/
111
+ .stepper-container.stepper-container--vertical {
112
+ display: flex;
113
+ flex-direction: column;
114
+ gap: 1rem;
115
+ }
116
+ .stepper-container.stepper-container--vertical .vertical-step-row {
117
+ display: flex;
118
+ align-items: flex-start;
119
+ margin-bottom: 1rem;
120
+ }
121
+ .stepper-container.stepper-container--vertical .vertical-step-left {
122
+ flex-shrink: 0;
123
+ width: 50px;
124
+ position: relative;
125
+ }
126
+ .stepper-container.stepper-container--vertical .vertical-step-left .step-item {
127
+ margin-top: 20px;
128
+ }
129
+ .stepper-container.stepper-container--vertical .vertical-step-left .step-line {
130
+ position: absolute;
131
+ left: 20px;
132
+ }
133
+ .stepper-container.stepper-container--vertical .vertical-step-right {
134
+ flex: 1;
135
+ left: 70px;
136
+ width: calc(100% - 70px);
137
+ position: absolute;
138
+ top: 1.5rem;
139
+ }
140
+ .stepper-container.stepper-container--vertical .step-title {
141
+ display: none;
142
+ margin-left: 0.3rem;
143
+ }
144
+ .stepper-container.stepper-container--vertical .stepper-panel-header {
145
+ display: block;
146
+ }
147
+ .stepper-container.stepper-container--vertical .stepper-header {
148
+ display: flex;
149
+ flex-direction: column;
150
+ position: relative;
151
+ padding-left: 2rem;
152
+ }
153
+ .stepper-container.stepper-container--vertical .stepper-header .step-item {
154
+ flex-direction: row;
155
+ max-width: 150px;
156
+ }
157
+ .stepper-container.stepper-container--vertical .stepper-header .step-item:not(:first-child) {
158
+ margin-top: 8px;
159
+ }
160
+ .stepper-container.stepper-container--vertical .step-line {
161
+ flex: auto;
162
+ width: 2px;
163
+ height: 40px;
164
+ margin-top: 4px;
165
+ top: auto;
166
+ left: -24px;
167
+ }
@@ -516,7 +516,7 @@
516
516
  min-width: auto !important;
517
517
  width: auto !important;
518
518
  }
519
- .syntable__wrapper.table-enhanced-responsive-scrolled table thead th:not(last-child) {
519
+ .syntable__wrapper.table-enhanced-responsive-scrolled table thead th:not(:last-child) {
520
520
  border-bottom: 0;
521
521
  }
522
522
  .syntable__wrapper.table-enhanced-responsive-scrolled table tbody {
@@ -568,9 +568,9 @@
568
568
  .syntable__wrapper.table-enhanced-responsive-scrolled table tbody th:first-child {
569
569
  border-top: 0;
570
570
  }
571
- .syntable__wrapper.table-enhanced-responsive-scrolled table th:not(last-child),
572
- .syntable__wrapper.table-enhanced-responsive-scrolled table tbody td:not(last-child),
573
- .syntable__wrapper.table-enhanced-responsive-scrolled table tbody th:not(last-child) {
571
+ .syntable__wrapper.table-enhanced-responsive-scrolled table th:not(:last-child),
572
+ .syntable__wrapper.table-enhanced-responsive-scrolled table tbody td:not(:last-child),
573
+ .syntable__wrapper.table-enhanced-responsive-scrolled table tbody th:not(:last-child) {
574
574
  border-bottom: 0;
575
575
  border-right: 0;
576
576
  }
@@ -0,0 +1,206 @@
1
+
2
+ /* ======================================================
3
+ <!-- Stepper -->
4
+ /* ====================================================== */
5
+
6
+ .stepper-container {
7
+
8
+ --stepper-color-default: #333;
9
+ --stepper-color-active: white;
10
+ --stepper-color-complete: #2563eb;
11
+ --stepper-bg-default: white;
12
+ --stepper-bg-active: #2563eb;
13
+ --stepper-bg-complete: #22c55e;
14
+ --stepper-border-default: #ccc;
15
+ --stepper-border-active: #2563eb;
16
+ --stepper-border-complete: #22c55e;
17
+ --stepper-indicator-size: 0.875rem;
18
+ --stepper-title-size: 0.875rem;
19
+
20
+
21
+ position: relative;
22
+
23
+ /* NAvigation Header (only horizontal) */
24
+ .stepper-header {
25
+ display: flex;
26
+ align-items: center;
27
+ margin-bottom: 1.5rem;
28
+ flex-wrap: nowrap;
29
+ }
30
+
31
+ /* Main Navigation */
32
+ /* Each step item (with circle + title) */
33
+ .step-item {
34
+ flex: none;
35
+ display: flex;
36
+ flex-direction: column;
37
+ align-items: center;
38
+ max-width: 100px;
39
+ position: relative;
40
+ z-index: 1;
41
+
42
+ &.step-item--clickable {
43
+ cursor: pointer;
44
+ }
45
+
46
+ }
47
+
48
+ .step-line {
49
+ flex: 1;
50
+ height: 2px;
51
+ background-color: #ddd;
52
+ margin: 0 4px;
53
+ position: relative;
54
+ top: -10px;
55
+ z-index: 0;
56
+
57
+ &--complete {
58
+ background-color: var(--stepper-bg-complete);
59
+ }
60
+
61
+ &--active {
62
+ background-color: var(--stepper-bg-complete);
63
+ }
64
+
65
+ }
66
+
67
+ /* Step Indicator */
68
+ .step-indicator {
69
+ width: 32px;
70
+ height: 32px;
71
+ margin: 0 auto 0.25rem;
72
+ border-radius: 9999px;
73
+ display: flex;
74
+ align-items: center;
75
+ justify-content: center;
76
+ border: 2px solid #ccc;
77
+ font-size: var(--stepper-indicator-size);
78
+
79
+ /* default */
80
+ background-color: var(--stepper-bg-default);
81
+ color: var(--stepper-color-default);
82
+ border-color: var(--stepper-border-default);
83
+
84
+ &--active {
85
+ background-color: var(--stepper-bg-active);
86
+ color: var(--stepper-color-active);
87
+ border-color: var(--stepper-border-active);
88
+ }
89
+
90
+ &--complete {
91
+ background-color: var(--stepper-bg-complete);
92
+ color: var(--stepper-color-active);
93
+ border-color: var(--stepper-border-complete);
94
+ }
95
+
96
+ }
97
+
98
+
99
+ /* Title */
100
+ .step-title {
101
+ font-size: var(--stepper-title-size);
102
+
103
+ /* default */
104
+ color: var(--stepper-color-default);
105
+
106
+ &--active {
107
+ font-weight: bold;
108
+ }
109
+ }
110
+
111
+
112
+
113
+ /* Panels Area */
114
+ .stepper-panels {
115
+
116
+ }
117
+
118
+ /* Buttons */
119
+ .stepper-buttons {
120
+ display: flex;
121
+ justify-content: space-between;
122
+ margin-top: 1rem;
123
+ }
124
+
125
+ /* Panel */
126
+ .stepper-panel {
127
+ width: 100%;
128
+ }
129
+ .stepper-panel-header {
130
+ font-size: 1.25rem;
131
+ font-weight: bold;
132
+ margin-bottom: 1rem;
133
+ display: none;
134
+ }
135
+ .stepper-panel-content {
136
+ width: 100%;
137
+ }
138
+
139
+
140
+
141
+ }
142
+
143
+
144
+ /*------ Verticle ------*/
145
+ .stepper-container.stepper-container--vertical {
146
+ display: flex;
147
+ flex-direction: column;
148
+ gap: 1rem;
149
+
150
+
151
+ .vertical-step-row {
152
+ display: flex;
153
+ align-items: flex-start;
154
+ margin-bottom: 1rem;
155
+ }
156
+ .vertical-step-left {
157
+ flex-shrink: 0;
158
+ width: 50px;
159
+ position: relative;
160
+
161
+ .step-item {
162
+ margin-top: 20px;
163
+ }
164
+ .step-line {
165
+ position: absolute;
166
+ left: 20px;
167
+ }
168
+ }
169
+
170
+ .vertical-step-right {
171
+ flex: 1;
172
+ left: 70px;
173
+ width: calc(100% - 70px);
174
+ position: absolute;
175
+ top: 1.5rem;
176
+ }
177
+
178
+ .step-title {
179
+ display: none;
180
+ margin-left: .3rem;
181
+ }
182
+ .stepper-panel-header {
183
+ display: block;
184
+ }
185
+ .stepper-header {
186
+ display: flex;
187
+ flex-direction: column;
188
+ position: relative;
189
+ padding-left: 2rem;
190
+ .step-item {
191
+ flex-direction: row;
192
+ max-width: 150px;
193
+ &:not(:first-child) {
194
+ margin-top: 8px;
195
+ }
196
+ }
197
+ }
198
+ .step-line {
199
+ flex: auto;
200
+ width: 2px;
201
+ height: 40px;
202
+ margin-top: 4px;
203
+ top: auto;
204
+ left: -24px;
205
+ }
206
+ }
@@ -0,0 +1,264 @@
1
+ import React, { useRef, useEffect, forwardRef, useImperativeHandle, useState } from 'react';
2
+
3
+ import { clsWrite, combinedCls } from 'funda-utils/dist/cjs/cls';
4
+
5
+ interface StepperPanelProps {
6
+ header: React.ReactNode;
7
+ children?: React.ReactNode;
8
+ style?: React.CSSProperties;
9
+ }
10
+
11
+ interface StepperProps {
12
+ wrapperClassName?: string;
13
+ indicatorClickAllowed?: boolean;
14
+ style?: React.CSSProperties;
15
+ initialStep?: number;
16
+ layout?: 'horizontal' | 'vertical';
17
+ completeIcon?: React.ReactNode;
18
+ disableCompleteIcon?: boolean;
19
+ onChange?: (index: number, isLastStepComplete: boolean) => void;
20
+ children: React.ReactElement<StepperPanelProps>[];
21
+ }
22
+
23
+ interface StepperRef {
24
+ goto: (index: number) => void;
25
+ next: () => void;
26
+ prev: () => void;
27
+ }
28
+
29
+ const StepperPanel: React.FC<StepperPanelProps> = (props) => {
30
+ const {
31
+ header,
32
+ children,
33
+ style
34
+ } = props;
35
+
36
+ return (
37
+ <div className="stepper-panel" style={style}>
38
+ <div className="stepper-panel-header">{header}</div>
39
+ <div className="stepper-panel-content">{children}</div>
40
+ </div>
41
+ );
42
+ };
43
+
44
+ const Stepper = forwardRef<StepperRef, StepperProps>((props, ref) => {
45
+ const {
46
+ wrapperClassName,
47
+ indicatorClickAllowed = false,
48
+ style,
49
+ initialStep = 0,
50
+ layout = 'horizontal',
51
+ completeIcon = <><svg width="20px" height="20px" viewBox="0 0 20 20" fill="none"><path d="M15.3742 5.98559L10.3742 14.9856C9.72664 16.1511 7.97832 15.1798 8.62585 14.0143L13.6258 5.01431C14.2734 3.84876 16.0217 4.82005 15.3742 5.98559Z" fill="#fff"/><path d="M5.1247 9.71907L10.1247 13.7191C11.1659 14.552 9.91646 16.1137 8.87531 15.2808L3.87531 11.2808C2.83415 10.4479 4.08354 8.88615 5.1247 9.71907Z" fill="#fff"/></svg></>,
52
+ disableCompleteIcon = true,
53
+ onChange,
54
+ children
55
+ } = props;
56
+
57
+
58
+ const [isLastStepComplete, setIsLastStepComplete] = useState<boolean>(false);
59
+ const [activeIndex, setActiveIndex] = useState<number>(initialStep);
60
+ const panels = React.Children.toArray(children) as React.ReactElement<StepperPanelProps>[];
61
+ const isVertical: boolean = layout === 'vertical';
62
+ const prevActiveIndexRef = useRef<number>(activeIndex);
63
+ const prevIsLastStepCompleteRef = useRef<boolean>(isLastStepComplete);
64
+
65
+ useImperativeHandle(
66
+ ref,
67
+ () => ({
68
+ goto: (index: number) => {
69
+ if (index >= 0 && index < panels.length) {
70
+ setActiveIndex(index);
71
+ }
72
+ },
73
+ next: () => {
74
+ setActiveIndex((prevState) => {
75
+ const _val = Math.min(prevState + 1, panels.length - 1);
76
+ return _val;
77
+ });
78
+ },
79
+ prev: () => {
80
+ setActiveIndex((prevState) => {
81
+ const _val = Math.max(prevState - 1, 0);
82
+ return _val;
83
+ });
84
+
85
+ setIsLastStepComplete(false);
86
+ },
87
+ setLastStepComplete: (val: boolean) => {
88
+ setIsLastStepComplete(val);
89
+ },
90
+ }),
91
+ [panels.length],
92
+ );
93
+
94
+ const horizontalPanelsGenerator = (): JSX.Element => {
95
+ return <>
96
+ <div className="stepper-header">
97
+ {panels.map((panel, index) => {
98
+ const { header } = panel.props;
99
+ const isActive = index === activeIndex;
100
+ const isCompleted = index < activeIndex || (index === panels.length - 1 && isLastStepComplete);
101
+
102
+ return (
103
+ <React.Fragment key={index}>
104
+ <div
105
+ data-step-index={index}
106
+ className={combinedCls(
107
+ 'step-item',
108
+ {
109
+ 'step-item--clickable': indicatorClickAllowed && !isLastStepComplete
110
+ }
111
+ )}
112
+ onClick={indicatorClickAllowed && !isLastStepComplete ? () => {
113
+ setActiveIndex(index);
114
+ setIsLastStepComplete(false);
115
+ } : undefined}
116
+ >
117
+ <div
118
+ className={combinedCls(
119
+ 'step-indicator',
120
+ {
121
+ 'step-indicator--active': isActive,
122
+ 'step-indicator--complete': isCompleted
123
+ }
124
+ )}
125
+ >
126
+ {isCompleted ? <>{disableCompleteIcon ? index + 1 : completeIcon}</> : index + 1}
127
+ </div>
128
+ <div
129
+ className={combinedCls(
130
+ 'step-title',
131
+ {
132
+ 'step-title--active': isActive
133
+ }
134
+ )}
135
+ >
136
+ {header}
137
+ </div>
138
+ </div>
139
+ {index < panels.length - 1 && (
140
+ <div
141
+ className={combinedCls(
142
+ 'step-line',
143
+ {
144
+ 'step-line--active': index === activeIndex - 1,
145
+ 'step-line--complete': index < activeIndex - 1
146
+ }
147
+ )}
148
+ />
149
+ )}
150
+ </React.Fragment>
151
+ );
152
+ })}
153
+ </div>
154
+
155
+ <div className="stepper-panels">
156
+ {panels[activeIndex]}
157
+ </div>
158
+ </>;
159
+ };
160
+
161
+ const verticalPanelsGenerator = (): JSX.Element => {
162
+ return <>
163
+ {panels.map((panel, index) => {
164
+ const { header } = panel.props;
165
+ const isActive = index === activeIndex;
166
+ const isCompleted = index < activeIndex || (index === panels.length - 1 && isLastStepComplete);
167
+
168
+ return (
169
+ <div key={index} className="vertical-step-row">
170
+ {/* Left */}
171
+ <div className="vertical-step-left">
172
+ <div
173
+ data-step-index={index}
174
+ className={combinedCls(
175
+ 'step-item',
176
+ {
177
+ 'step-item--clickable': indicatorClickAllowed && !isLastStepComplete
178
+ }
179
+ )}
180
+ onClick={indicatorClickAllowed && !isLastStepComplete ? () => {
181
+ setActiveIndex(index);
182
+ setIsLastStepComplete(false);
183
+ } : undefined}
184
+ >
185
+ <div
186
+ className={combinedCls(
187
+ 'step-indicator',
188
+ {
189
+ 'step-indicator--active': isActive,
190
+ 'step-indicator--complete': isCompleted
191
+ }
192
+ )}
193
+ >
194
+ {isCompleted ? <>{disableCompleteIcon ? index + 1 : completeIcon}</> : index + 1}
195
+ </div>
196
+ <div
197
+ className={combinedCls(
198
+ 'step-title',
199
+ {
200
+ 'step-title--active': isActive
201
+ }
202
+ )}
203
+ >
204
+ {header}
205
+ </div>
206
+ </div>
207
+
208
+ {index < panels.length - 1 && (
209
+ <div
210
+ className={combinedCls(
211
+ 'step-line',
212
+ {
213
+ 'step-line--active': index === activeIndex - 1,
214
+ 'step-line--complete': index < activeIndex - 1
215
+ }
216
+ )}
217
+ />
218
+ )}
219
+ </div>
220
+
221
+ {/* Right */}
222
+ {isActive && (
223
+ <div className="vertical-step-right">
224
+ {panels[activeIndex]}
225
+ </div>
226
+ )}
227
+ </div>
228
+ );
229
+ })}
230
+ </>;
231
+ };
232
+
233
+
234
+ useEffect(() => {
235
+ // Only trigger onChange if values actually changed from previous values
236
+ if (prevActiveIndexRef.current !== activeIndex ||
237
+ prevIsLastStepCompleteRef.current !== isLastStepComplete) {
238
+
239
+ prevActiveIndexRef.current = activeIndex;
240
+ prevIsLastStepCompleteRef.current = isLastStepComplete;
241
+
242
+ onChange?.(activeIndex, isLastStepComplete);
243
+ }
244
+ }, [activeIndex, isLastStepComplete]);
245
+
246
+ return (
247
+ <div
248
+ className={combinedCls(
249
+ 'stepper-container',
250
+ clsWrite(wrapperClassName, ''),
251
+ {
252
+ 'stepper-container--vertical': isVertical
253
+ }
254
+ )}
255
+ style={style}
256
+ >
257
+ {!isVertical && horizontalPanelsGenerator()}
258
+ {isVertical && verticalPanelsGenerator()}
259
+ </div>
260
+ );
261
+ });
262
+
263
+ export { Stepper, StepperPanel };
264
+ export type { StepperProps, StepperPanelProps, StepperRef };
@@ -330,7 +330,7 @@
330
330
  min-width: auto !important;
331
331
  width: auto !important;
332
332
 
333
- &:not(last-child) {
333
+ &:not(:last-child) {
334
334
  border-bottom: 0;
335
335
  }
336
336
 
@@ -390,7 +390,7 @@
390
390
  border-top: 0;
391
391
  }
392
392
 
393
- &:not(last-child) {
393
+ &:not(:last-child) {
394
394
  border-bottom: 0;
395
395
  border-right: 0;
396
396
  }
package/lib/esm/index.js CHANGED
@@ -33,6 +33,7 @@ export { default as Scrollbar } from './Scrollbar';
33
33
  export { default as SearchBar } from './SearchBar';
34
34
  export { default as Select } from './Select';
35
35
  export { default as ShowMoreLess } from './ShowMoreLess';
36
+ export { default as Stepper } from './Stepper';
36
37
  export { default as Switch } from './Switch';
37
38
  export { default as Table } from './Table';
38
39
  export { default as Tabs } from './Tabs';
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "author": "UIUX Lab",
3
3
  "email": "uiuxlab@gmail.com",
4
4
  "name": "funda-ui",
5
- "version": "4.6.399",
5
+ "version": "4.7.101",
6
6
  "description": "React components using pure Bootstrap 5+ which does not contain any external style and script libraries.",
7
7
  "repository": {
8
8
  "type": "git",