funda-ui 4.7.101 → 4.7.105

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.
Files changed (54) hide show
  1. package/Chatbox/index.js +6 -1
  2. package/Checkbox/index.js +10 -1
  3. package/Date/index.js +12 -2
  4. package/Input/index.js +6 -1
  5. package/LiveSearch/index.js +5 -0
  6. package/MultipleCheckboxes/index.js +27 -1
  7. package/NumberInput/index.js +6 -1
  8. package/Radio/index.js +22 -1
  9. package/RangeSlider/index.js +6 -1
  10. package/Stepper/index.css +109 -34
  11. package/Stepper/index.d.ts +1 -1
  12. package/Stepper/index.js +55 -2
  13. package/TagInput/index.js +10 -1
  14. package/Textarea/index.js +6 -1
  15. package/Toast/index.css +23 -75
  16. package/Toast/index.d.ts +3 -34
  17. package/Toast/index.js +652 -175
  18. package/lib/cjs/Chatbox/index.js +6 -1
  19. package/lib/cjs/Checkbox/index.js +10 -1
  20. package/lib/cjs/Date/index.js +12 -2
  21. package/lib/cjs/Input/index.js +6 -1
  22. package/lib/cjs/LiveSearch/index.js +5 -0
  23. package/lib/cjs/MultipleCheckboxes/index.js +27 -1
  24. package/lib/cjs/NumberInput/index.js +6 -1
  25. package/lib/cjs/Radio/index.js +22 -1
  26. package/lib/cjs/RangeSlider/index.js +6 -1
  27. package/lib/cjs/Stepper/index.d.ts +1 -1
  28. package/lib/cjs/Stepper/index.js +55 -2
  29. package/lib/cjs/TagInput/index.js +10 -1
  30. package/lib/cjs/Textarea/index.js +6 -1
  31. package/lib/cjs/Toast/index.d.ts +3 -34
  32. package/lib/cjs/Toast/index.js +652 -175
  33. package/lib/css/Stepper/index.css +109 -34
  34. package/lib/css/Toast/index.css +23 -75
  35. package/lib/esm/Checkbox/index.tsx +12 -1
  36. package/lib/esm/Date/index.tsx +8 -1
  37. package/lib/esm/Input/index.tsx +8 -1
  38. package/lib/esm/LiveSearch/index.tsx +7 -0
  39. package/lib/esm/MultipleCheckboxes/index.tsx +19 -1
  40. package/lib/esm/NumberInput/index.tsx +8 -1
  41. package/lib/esm/Radio/index.tsx +17 -1
  42. package/lib/esm/Stepper/index.scss +135 -36
  43. package/lib/esm/Stepper/index.tsx +51 -3
  44. package/lib/esm/TagInput/index.tsx +8 -1
  45. package/lib/esm/Textarea/index.tsx +8 -1
  46. package/lib/esm/Toast/Item.tsx +52 -11
  47. package/lib/esm/Toast/Toast.tsx +391 -0
  48. package/lib/esm/Toast/ToastContext.tsx +104 -0
  49. package/lib/esm/Toast/__toast.vanilla.js +422 -0
  50. package/lib/esm/Toast/index.scss +24 -96
  51. package/lib/esm/Toast/index.tsx +3 -374
  52. package/lib/esm/Toast/types.ts +60 -0
  53. package/lib/esm/Toast/useToast.tsx +72 -0
  54. package/package.json +1 -1
@@ -5,19 +5,23 @@
5
5
  --stepper-color-default: #333;
6
6
  --stepper-color-active: white;
7
7
  --stepper-color-complete: #2563eb;
8
- --stepper-bg-default: white;
9
- --stepper-bg-active: #2563eb;
10
- --stepper-bg-complete: #22c55e;
8
+ --stepper-indicator-default: white;
9
+ --stepper-indicator-active: #2563eb;
10
+ --stepper-indicator-complete: #22c55e;
11
11
  --stepper-border-default: #ccc;
12
12
  --stepper-border-active: #2563eb;
13
13
  --stepper-border-complete: #22c55e;
14
+ --stepper-line-default: #dfdfdf;
15
+ --stepper-line-active: #2563eb;
16
+ --stepper-line-complete: #22c55e;
14
17
  --stepper-indicator-size: 0.875rem;
18
+ --stepper-indicator-offset: 100px;
15
19
  --stepper-title-size: 0.875rem;
16
20
  position: relative;
17
- /* NAvigation Header (only horizontal) */
18
- /* Main Navigation */
19
- /* Each step item (with circle + title) */
20
- /* Step Indicator */
21
+ /* Navigation Header (only horizontal) */
22
+ /* Main Navigation - Each step item (with circle + title) */
23
+ /* Line */
24
+ /* Indicator */
21
25
  /* Title */
22
26
  /* Panels Area */
23
27
  /* Buttons */
@@ -25,18 +29,45 @@
25
29
  }
26
30
  .stepper-container .stepper-header {
27
31
  display: flex;
28
- align-items: center;
29
- margin-bottom: 1.5rem;
32
+ align-items: flex-start;
30
33
  flex-wrap: nowrap;
34
+ position: relative;
35
+ /* background line */
36
+ }
37
+ .stepper-container .stepper-header::before {
38
+ content: "";
39
+ position: absolute;
40
+ top: 16px; /* Subtract the height of the title */
41
+ left: 14px;
42
+ right: 0;
43
+ height: 2px;
44
+ background-color: var(--stepper-line-default);
45
+ z-index: 1;
46
+ width: calc(100% - 32px);
47
+ }
48
+ .stepper-container .stepper-header::after {
49
+ content: "";
50
+ position: absolute;
51
+ top: 16px; /* Subtract the height of the title */
52
+ left: 14px;
53
+ height: 2px;
54
+ background-color: var(--stepper-line-complete);
55
+ z-index: 2;
56
+ transition: width 0.3s ease-in-out;
57
+ width: 0;
58
+ }
59
+ .stepper-container .stepper-header::after {
60
+ width: var(--stepper-progress-width, 0%);
61
+ max-width: calc(100% - 32px);
31
62
  }
32
63
  .stepper-container .step-item {
33
64
  flex: none;
34
65
  display: flex;
35
66
  flex-direction: column;
36
67
  align-items: center;
37
- max-width: 100px;
68
+ max-width: var(--stepper-indicator-offset);
38
69
  position: relative;
39
- z-index: 1;
70
+ z-index: 3;
40
71
  }
41
72
  .stepper-container .step-item.step-item--clickable {
42
73
  cursor: pointer;
@@ -44,17 +75,34 @@
44
75
  .stepper-container .step-line {
45
76
  flex: 1;
46
77
  height: 2px;
47
- background-color: #ddd;
78
+ background-color: var(--stepper-line-default);
48
79
  margin: 0 4px;
49
80
  position: relative;
50
81
  top: -10px;
51
82
  z-index: 0;
83
+ overflow: hidden;
84
+ opacity: 0;
85
+ }
86
+ .stepper-container .step-line--active {
87
+ background-color: var(--stepper-line-default);
52
88
  }
53
89
  .stepper-container .step-line--complete {
54
- background-color: var(--stepper-bg-complete);
90
+ background-color: var(--stepper-line-default);
55
91
  }
56
- .stepper-container .step-line--active {
57
- background-color: var(--stepper-bg-complete);
92
+ .stepper-container .step-line::after {
93
+ content: "";
94
+ position: absolute;
95
+ top: 0;
96
+ left: 0;
97
+ width: 100%;
98
+ height: 100%;
99
+ background-color: var(--stepper-line-complete);
100
+ transform: scaleX(0);
101
+ transform-origin: left;
102
+ transition: transform 0.3s ease-in-out;
103
+ }
104
+ .stepper-container .step-line--active::after, .stepper-container .step-line--complete::after {
105
+ transform: scaleX(1);
58
106
  }
59
107
  .stepper-container .step-indicator {
60
108
  width: 32px;
@@ -67,17 +115,17 @@
67
115
  border: 2px solid #ccc;
68
116
  font-size: var(--stepper-indicator-size);
69
117
  /* default */
70
- background-color: var(--stepper-bg-default);
118
+ background-color: var(--stepper-indicator-default);
71
119
  color: var(--stepper-color-default);
72
120
  border-color: var(--stepper-border-default);
73
121
  }
74
122
  .stepper-container .step-indicator--active {
75
- background-color: var(--stepper-bg-active);
123
+ background-color: var(--stepper-indicator-active);
76
124
  color: var(--stepper-color-active);
77
125
  border-color: var(--stepper-border-active);
78
126
  }
79
127
  .stepper-container .step-indicator--complete {
80
- background-color: var(--stepper-bg-complete);
128
+ background-color: var(--stepper-indicator-complete);
81
129
  color: var(--stepper-color-active);
82
130
  border-color: var(--stepper-border-complete);
83
131
  }
@@ -109,19 +157,51 @@
109
157
 
110
158
  /*------ Verticle ------*/
111
159
  .stepper-container.stepper-container--vertical {
160
+ --stepper-indicator-offset: 50px;
112
161
  display: flex;
113
162
  flex-direction: column;
114
- gap: 1rem;
163
+ gap: 1rem; /* line length */
164
+ /* background line */
165
+ /* Layout */
166
+ /* Title */
167
+ /* Panel */
168
+ /* Line */
169
+ }
170
+ .stepper-container.stepper-container--vertical::before {
171
+ content: "";
172
+ position: absolute;
173
+ top: 20px;
174
+ left: 24px;
175
+ width: 2px;
176
+ height: calc(100% - 32px);
177
+ background-color: var(--stepper-line-default);
178
+ z-index: 1;
179
+ }
180
+ .stepper-container.stepper-container--vertical::after {
181
+ content: "";
182
+ position: absolute;
183
+ top: 20px;
184
+ left: 24px;
185
+ width: 2px;
186
+ background-color: var(--stepper-line-complete);
187
+ z-index: 2;
188
+ transition: height 0.3s ease-in-out;
189
+ height: 0;
190
+ }
191
+ .stepper-container.stepper-container--vertical::after {
192
+ height: var(--stepper-progress-height, 0%);
193
+ max-height: calc(100% - 32px);
115
194
  }
116
195
  .stepper-container.stepper-container--vertical .vertical-step-row {
117
196
  display: flex;
118
197
  align-items: flex-start;
119
- margin-bottom: 1rem;
120
198
  }
121
199
  .stepper-container.stepper-container--vertical .vertical-step-left {
122
200
  flex-shrink: 0;
123
- width: 50px;
201
+ width: var(--stepper-indicator-offset);
124
202
  position: relative;
203
+ /* Main Navigation - Each step item (with circle + title) */
204
+ /* Line */
125
205
  }
126
206
  .stepper-container.stepper-container--vertical .vertical-step-left .step-item {
127
207
  margin-top: 20px;
@@ -129,6 +209,7 @@
129
209
  .stepper-container.stepper-container--vertical .vertical-step-left .step-line {
130
210
  position: absolute;
131
211
  left: 20px;
212
+ opacity: 0;
132
213
  }
133
214
  .stepper-container.stepper-container--vertical .vertical-step-right {
134
215
  flex: 1;
@@ -144,19 +225,6 @@
144
225
  .stepper-container.stepper-container--vertical .stepper-panel-header {
145
226
  display: block;
146
227
  }
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
228
  .stepper-container.stepper-container--vertical .step-line {
161
229
  flex: auto;
162
230
  width: 2px;
@@ -165,3 +233,10 @@
165
233
  top: auto;
166
234
  left: -24px;
167
235
  }
236
+ .stepper-container.stepper-container--vertical .step-line::after {
237
+ transform-origin: top;
238
+ transform: scaleY(0);
239
+ }
240
+ .stepper-container.stepper-container--vertical .step-line--active::after, .stepper-container.stepper-container--vertical .step-line--complete::after {
241
+ transform: scaleY(1);
242
+ }
@@ -9,8 +9,8 @@
9
9
  --toasts-offset-bothsides: 15px;
10
10
  --toasts-container-gap: 0.5rem;
11
11
  --toasts-container-width: 350px;
12
- --toasts-progress-height: 5px;
13
- --toasts-progress-bg: rgba(255,255,255,.6);
12
+ --toasts-progress-height: 3px;
13
+ --toasts-progress-bg: rgba(228, 228, 228, 0.6);
14
14
  width: var(--toasts-container-width);
15
15
  position: fixed;
16
16
  left: 50%;
@@ -72,34 +72,28 @@
72
72
  }
73
73
  .toasts__wrapper .toast-container {
74
74
  margin-bottom: var(--toasts-container-gap);
75
+ /* Use clip-path instead of opacity to achieve a fade effect, avoiding the problem of transparency overlay */
76
+ clip-path: inset(0 0 0 0);
77
+ transform: translateY(0);
78
+ /* Rendering of 3D transformations */
79
+ backface-visibility: hidden;
80
+ transform-style: preserve-3d;
81
+ /* init animation */
82
+ /* enter animation */
83
+ /* exit animation */
84
+ }
85
+ .toasts__wrapper .toast-container.animate-ready {
86
+ pointer-events: none;
87
+ clip-path: inset(0 0 100% 0);
88
+ transform: translateY(10px);
75
89
  }
76
- .toasts__wrapper .toast-container.auto-anim-switch--initfirst {
77
- transform: translateY(-20px);
78
- opacity: 0;
90
+ .toasts__wrapper .toast-container.animate-in {
91
+ clip-path: inset(0 0 0 0);
92
+ transform: translateY(0);
79
93
  }
80
- .toasts__wrapper .toast-container.auto-anim-switch--first {
81
- animation-name: toast-anim-show-first;
82
- animation-duration: 0.3s;
83
- animation-timing-function: linear;
84
- animation-delay: 0;
85
- animation-iteration-count: 1;
86
- animation-fill-mode: forwards;
87
- }
88
- .toasts__wrapper .toast-container.auto-anim-switch:not(.only-one) {
89
- animation-name: toast-anim-hide;
90
- animation-duration: 0.3s;
91
- animation-timing-function: linear;
92
- animation-delay: 0;
93
- animation-iteration-count: 1;
94
- animation-fill-mode: forwards;
95
- }
96
- .toasts__wrapper .toast-container.only-one.auto-anim-switch {
97
- animation-name: toast-anim-hide--onlyone;
98
- animation-duration: 0.3s;
99
- animation-timing-function: linear;
100
- animation-delay: 0;
101
- animation-iteration-count: 1;
102
- animation-fill-mode: forwards;
94
+ .toasts__wrapper .toast-container.hide-start {
95
+ clip-path: inset(0 0 100% 0);
96
+ transform: translateY(-10px);
103
97
  }
104
98
  .toasts__wrapper.toasts__wrapper--cascading .toast-container {
105
99
  margin-bottom: 0;
@@ -120,6 +114,7 @@
120
114
  .toasts__wrapper .toast-progress .progress-bar {
121
115
  background: var(--toasts-progress-bg);
122
116
  width: 100%;
117
+ height: 100%;
123
118
  transition: all 0.1s;
124
119
  }
125
120
 
@@ -152,50 +147,3 @@
152
147
  .toast-container.hide-end {
153
148
  display: none;
154
149
  }
155
-
156
- @keyframes toast-anim-initfirst {
157
- 0% {
158
- transform: translateY(-20px);
159
- opacity: 1;
160
- }
161
- 100% {
162
- transform: translateY(20px);
163
- opacity: 0;
164
- }
165
- }
166
- @keyframes toast-anim-show-first {
167
- 0% {
168
- transform: translateY(-20px);
169
- opacity: 0;
170
- }
171
- 100% {
172
- transform: translateY(0);
173
- opacity: 1;
174
- }
175
- }
176
- @keyframes toast-anim-hide {
177
- 0% {
178
- transform: translateY(-100%);
179
- opacity: 1;
180
- }
181
- 100% {
182
- transform: translateY(10px);
183
- opacity: 0;
184
- /* prevent auto-close's item */
185
- display: block;
186
- }
187
- }
188
- @keyframes toast-anim-hide--onlyone {
189
- 0% {
190
- transform: translateY(-100%);
191
- opacity: 1;
192
- /* prevent auto-close's item */
193
- display: block;
194
- }
195
- 100% {
196
- transform: translateY(10px);
197
- opacity: 0;
198
- /* prevent auto-close's item */
199
- display: block;
200
- }
201
- }
@@ -67,16 +67,27 @@ const Checkbox = forwardRef((props: CheckboxProps, externalRef: any) => {
67
67
  control: () => {
68
68
  return valRef.current;
69
69
  },
70
+ getLatestVal: () => {
71
+ return val;
72
+ },
70
73
  clear: (cb?: any) => {
71
74
  setVal(false);
72
75
  cb?.();
76
+
77
+ if (typeof (onChange) === 'function') {
78
+ onChange(null, false);
79
+ }
73
80
  },
74
81
  set: (value: string, cb?: any) => {
75
82
  setVal(value);
76
83
  cb?.();
84
+
85
+ if (typeof (onChange) === 'function') {
86
+ onChange(null, value);
87
+ }
77
88
  }
78
89
  }),
79
- [contentRef],
90
+ [contentRef, val],
80
91
  );
81
92
 
82
93
 
@@ -342,9 +342,14 @@ const Date = forwardRef((props: DateProps, externalRef: any) => {
342
342
  control: () => {
343
343
  return getAllSplittingInputs();
344
344
  },
345
+ getLatestVal: () => {
346
+ return !dateDefaultValueExist ? `` : valueResConverter(changedVal);
347
+ },
345
348
  clear: (cb?: any) => {
346
349
  clearAll();
347
350
  cb?.();
351
+
352
+ onChange?.(inputRef.current, '', false, getAllSplittingInputs());
348
353
  },
349
354
  blur: (cb?: any) => {
350
355
  getAllSplittingInputs().forEach((el: any) => {
@@ -364,9 +369,11 @@ const Date = forwardRef((props: DateProps, externalRef: any) => {
364
369
  initValue(curTargetVal);
365
370
 
366
371
  cb?.();
372
+
373
+ onChange?.(inputRef.current, value, isValidDate(value), getAllSplittingInputs());
367
374
  }
368
375
  }),
369
- [contentRef],
376
+ [contentRef, dateDefaultValueExist, changedVal],
370
377
  );
371
378
 
372
379
 
@@ -308,13 +308,20 @@ const Input = forwardRef((props: InputProps, externalRef: any) => {
308
308
  control: () => {
309
309
  return valRef.current;
310
310
  },
311
+ getLatestVal: () => {
312
+ return changedVal || '';
313
+ },
311
314
  clear: (cb?: any) => {
312
315
  setChangedVal('');
313
316
  cb?.();
317
+
318
+ onChange?.(null, onComposition, valRef.current, '');
314
319
  },
315
320
  set: (value: string, cb?: any) => {
316
321
  setChangedVal(`${value}`);
317
322
  cb?.();
323
+
324
+ onChange?.(null, onComposition, valRef.current, `${value}`);
318
325
  },
319
326
  aiPredictReset: () => {
320
327
  setTimeout(() => { // Avoid conflicts with other asynchronous states, resulting in invalid clearing
@@ -322,7 +329,7 @@ const Input = forwardRef((props: InputProps, externalRef: any) => {
322
329
  }, 0);
323
330
  },
324
331
  }),
325
- [contentRef],
332
+ [contentRef, onComposition, changedVal],
326
333
  );
327
334
 
328
335
  const propExist = (p: any) => {
@@ -196,13 +196,20 @@ const LiveSearch = forwardRef((props: LiveSearchProps, externalRef: any) => {
196
196
  control: () => {
197
197
  return inputRef.current;
198
198
  },
199
+ getLatestVal: () => {
200
+ return changedVal || '';
201
+ },
199
202
  clear: (cb?: any) => {
200
203
  setChangedVal('');
201
204
  cb?.();
205
+
206
+ onChange?.(inputRef.current, [], '', listRef.current);
202
207
  },
203
208
  set: (value: string, cb?: any) => {
204
209
  setChangedVal(`${value}`);
205
210
  cb?.();
211
+
212
+ onChange?.(inputRef.current, [], '', listRef.current);
206
213
  }
207
214
  }),
208
215
  [contentRef],
@@ -150,16 +150,34 @@ const MultipleCheckboxes = forwardRef((props: MultipleCheckboxesProps, externalR
150
150
  control: () => {
151
151
  return getAllControls();
152
152
  },
153
+ getLatestVal: () => {
154
+ return VALUE_BY_BRACKETS ? convertArrToValByBrackets(valRes(selectedItems)) : valRes(selectedItems).join(',');
155
+ },
153
156
  clear: (cb?: any) => {
154
157
  initDefaultValue('', dataInit);
155
158
  cb?.();
159
+
160
+ onChange?.(null, null, '', null, null, null, null);
156
161
  },
157
162
  set: (value: any, cb?: any) => {
158
163
  initDefaultValue(value, dataInit);
159
164
  cb?.();
165
+
166
+ if (Array.isArray(value)) {
167
+ const _resDataCollection = value;
168
+ const _value = value.map((k: any) => k.value);
169
+ const _valueStr = VALUE_BY_BRACKETS ? value.map((k: any) => `[${k.value}]`).join('') : value.map((k: any) => k.value).join(',');
170
+ const _label = value.map((k: any) => k.label);
171
+ const _labelStr = VALUE_BY_BRACKETS ? value.map((k: any) => `[${k.label}]`).join('') : value.map((k: any) => k.label).join(',');
172
+
173
+ onChange?.(null, _value, _valueStr, _label, _labelStr, null, _resDataCollection);
174
+ } else {
175
+ onChange?.(null, null, value, null, null, null, null);
176
+ }
177
+
160
178
  }
161
179
  }),
162
- [dataInit, contentRef],
180
+ [dataInit, contentRef, selectedItems],
163
181
  );
164
182
 
165
183
 
@@ -105,13 +105,20 @@ const NumberInput = forwardRef((props: NumberInputProps, externalRef: any) => {
105
105
  control: () => {
106
106
  return valRef.current;
107
107
  },
108
+ getLatestVal: () => {
109
+ return changedVal || '';
110
+ },
108
111
  clear: (cb?: any) => {
109
112
  setChangedVal('');
110
113
  cb?.();
114
+
115
+ onChange?.(null, valRef.current, Number(''));
111
116
  },
112
117
  set: (value: string, cb?: any) => {
113
118
  setChangedVal(`${value}`);
114
119
  cb?.();
120
+
121
+ onChange?.(null, valRef.current, Number(formatValue(`${value}`)));
115
122
  },
116
123
  increment: (cb?: any) => {
117
124
  handleIncrement(null);
@@ -123,7 +130,7 @@ const NumberInput = forwardRef((props: NumberInputProps, externalRef: any) => {
123
130
  }
124
131
 
125
132
  }),
126
- [contentRef],
133
+ [contentRef, changedVal],
127
134
  );
128
135
 
129
136
  const propExist = (p: any) => {
@@ -162,16 +162,32 @@ const Radio = forwardRef((props: RadioProps, externalRef: any) => {
162
162
  control: () => {
163
163
  return getAllControls();
164
164
  },
165
+ getLatestVal: () => {
166
+ return controlValue || '';
167
+ },
165
168
  clear: (cb?: any) => {
166
169
  setControlValue('');
167
170
  cb?.();
171
+
172
+ if (typeof (onChange) === 'function') {
173
+ const curData: Record<string, unknown> = optionsFlat(dataInit).find((v: any) => v.value == value);
174
+ const currentIndex: number = optionsFlat(dataInit).findIndex((v: any) => v.value == value);
175
+ onChange(null, '', null, null);
176
+ }
177
+
168
178
  },
169
179
  set: (value: string, cb?: any) => {
170
180
  setControlValue(`${value}`);
171
181
  cb?.();
182
+
183
+ if (typeof (onChange) === 'function') {
184
+ const curData: Record<string, unknown> = optionsFlat(dataInit).find((v: any) => v.value == value);
185
+ const currentIndex: number = optionsFlat(dataInit).findIndex((v: any) => v.value == value);
186
+ onChange(null, `${value}`, curData, currentIndex);
187
+ }
172
188
  }
173
189
  }),
174
- [dataInit, contentRef],
190
+ [dataInit, contentRef, controlValue],
175
191
  );
176
192
 
177
193