funda-ui 4.7.625 → 4.7.711

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 (90) hide show
  1. package/CascadingSelect/index.js +2 -2
  2. package/CascadingSelectE2E/index.js +2 -2
  3. package/Chatbox/index.js +3 -17
  4. package/Checkbox/index.js +3 -3
  5. package/ColorPicker/index.js +3 -18
  6. package/Date/index.js +3 -18
  7. package/EventCalendarTimeline/index.d.ts +2 -2
  8. package/EventCalendarTimeline/index.js +24 -6
  9. package/File/index.d.ts +9 -0
  10. package/File/index.js +245 -93
  11. package/Input/index.js +3 -18
  12. package/LiveSearch/index.js +3 -18
  13. package/NativeSelect/index.js +3 -3
  14. package/NumberInput/index.js +3 -18
  15. package/Popover/index.css +198 -0
  16. package/Popover/index.d.ts +4 -0
  17. package/Popover/index.js +1808 -0
  18. package/README.md +1 -0
  19. package/Radio/index.js +3 -3
  20. package/RangeSlider/index.js +3 -18
  21. package/SearchBar/index.js +3 -18
  22. package/Select/index.js +3 -2
  23. package/Switch/index.js +3 -3
  24. package/TagInput/index.css +31 -31
  25. package/TagInput/index.js +12 -23
  26. package/Textarea/index.js +3 -17
  27. package/Utils/usePageVisibility.d.ts +5 -0
  28. package/Utils/usePageVisibility.js +166 -0
  29. package/Utils/useSSE.d.ts +50 -0
  30. package/Utils/useSSE.js +235 -0
  31. package/all.d.ts +1 -0
  32. package/all.js +1 -0
  33. package/lib/cjs/CascadingSelect/index.js +2 -2
  34. package/lib/cjs/CascadingSelectE2E/index.js +2 -2
  35. package/lib/cjs/Chatbox/index.js +3 -17
  36. package/lib/cjs/Checkbox/index.js +3 -3
  37. package/lib/cjs/ColorPicker/index.js +3 -18
  38. package/lib/cjs/Date/index.js +3 -18
  39. package/lib/cjs/EventCalendarTimeline/index.d.ts +2 -2
  40. package/lib/cjs/EventCalendarTimeline/index.js +24 -6
  41. package/lib/cjs/File/index.d.ts +9 -0
  42. package/lib/cjs/File/index.js +245 -93
  43. package/lib/cjs/Input/index.js +3 -18
  44. package/lib/cjs/LiveSearch/index.js +3 -18
  45. package/lib/cjs/NativeSelect/index.js +3 -3
  46. package/lib/cjs/NumberInput/index.js +3 -18
  47. package/lib/cjs/Popover/index.d.ts +4 -0
  48. package/lib/cjs/Popover/index.js +1808 -0
  49. package/lib/cjs/Radio/index.js +3 -3
  50. package/lib/cjs/RangeSlider/index.js +3 -18
  51. package/lib/cjs/SearchBar/index.js +3 -18
  52. package/lib/cjs/Select/index.js +3 -2
  53. package/lib/cjs/Switch/index.js +3 -3
  54. package/lib/cjs/TagInput/index.js +12 -23
  55. package/lib/cjs/Textarea/index.js +3 -17
  56. package/lib/cjs/Utils/usePageVisibility.d.ts +5 -0
  57. package/lib/cjs/Utils/usePageVisibility.js +166 -0
  58. package/lib/cjs/Utils/useSSE.d.ts +50 -0
  59. package/lib/cjs/Utils/useSSE.js +235 -0
  60. package/lib/cjs/index.d.ts +1 -0
  61. package/lib/cjs/index.js +1 -0
  62. package/lib/css/Popover/index.css +198 -0
  63. package/lib/css/TagInput/index.css +31 -31
  64. package/lib/esm/CascadingSelect/index.tsx +2 -2
  65. package/lib/esm/CascadingSelectE2E/index.tsx +2 -2
  66. package/lib/esm/Checkbox/index.tsx +3 -3
  67. package/lib/esm/ColorPicker/index.tsx +4 -15
  68. package/lib/esm/EventCalendarTimeline/index.tsx +30 -13
  69. package/lib/esm/File/index.tsx +148 -23
  70. package/lib/esm/Input/index.tsx +6 -17
  71. package/lib/esm/ModalDialog/index.tsx +0 -1
  72. package/lib/esm/NativeSelect/index.tsx +3 -3
  73. package/lib/esm/NumberInput/index.tsx +7 -15
  74. package/lib/esm/Popover/Popover.tsx +251 -0
  75. package/lib/esm/Popover/PopoverClose.tsx +51 -0
  76. package/lib/esm/Popover/PopoverContent.tsx +72 -0
  77. package/lib/esm/Popover/PopoverTrigger.tsx +62 -0
  78. package/lib/esm/Popover/index.scss +272 -0
  79. package/lib/esm/Popover/index.tsx +4 -0
  80. package/lib/esm/Radio/index.tsx +3 -3
  81. package/lib/esm/SearchBar/index.tsx +8 -12
  82. package/lib/esm/Select/index.tsx +2 -2
  83. package/lib/esm/Switch/index.tsx +3 -3
  84. package/lib/esm/TagInput/index.scss +24 -24
  85. package/lib/esm/TagInput/index.tsx +13 -20
  86. package/lib/esm/Textarea/index.tsx +6 -14
  87. package/lib/esm/Utils/hooks/usePageVisibility.tsx +84 -0
  88. package/lib/esm/Utils/hooks/useSSE.tsx +134 -0
  89. package/lib/esm/index.js +1 -0
  90. package/package.json +1 -1
@@ -0,0 +1,272 @@
1
+
2
+
3
+ /* ======================================================
4
+ <!-- Popover -->
5
+ /* ====================================================== */
6
+
7
+
8
+ /*
9
+ * 1. Base Styles
10
+ * 2. Position Modifiers - Top
11
+ * 3. Position Modifiers - Top Left
12
+ * 4. Position Modifiers - Top Right
13
+ * 5. Position Modifiers - Bottom
14
+ * 6. Position Modifiers - Bottom Left
15
+ * 7. Position Modifiers - Bottom Right
16
+ * 8. Position Modifiers - Left
17
+ * 9. Position Modifiers - Right
18
+ * 10. Size
19
+ */
20
+
21
+ .cus-popover__wrapper {
22
+
23
+ --cus-popover-box-shadow: 0 5px 15px 0 rgba(0,0,0,.07), 0 15px 35px 0 rgba(50,50,93,.1);
24
+ --cus-popover-content-bg: rgba(17, 17, 17, 0.9);
25
+ --cus-popover-content-color: #fff;
26
+ --cus-popover-content-font-size: 0.75em;
27
+ --cus-popover-content-padding-x: 1em;
28
+ --cus-popover-content-padding-y: .5em;
29
+ --cus-popover-content-line-height: 1.5;
30
+ --cus-popover-arrow-bg-top: url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2236px%22%20height%3D%2212px%22%3E%3Cpath%20fill%3D%22rgba%2817,%2017,%2017,%200.9%29%22%20transform%3D%22rotate%280%29%22%20d%3D%22M2.658,0.000%20C-13.615,0.000%2050.938,0.000%2034.662,0.000%20C28.662,0.000%2023.035,12.002%2018.660,12.002%20C14.285,12.002%208.594,0.000%202.658,0.000%20Z%22/%3E%3C/svg%3E") no-repeat;
31
+ --cus-popover-arrow-bg-bottom: url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2236px%22%20height%3D%2212px%22%3E%3Cpath%20fill%3D%22rgba%2817,%2017,%2017,%200.9%29%22%20transform%3D%22rotate%28180%2018%206%29%22%20d%3D%22M2.658,0.000%20C-13.615,0.000%2050.938,0.000%2034.662,0.000%20C28.662,0.000%2023.035,12.002%2018.660,12.002%20C14.285,12.002%208.594,0.000%202.658,0.000%20Z%22/%3E%3C/svg%3E") no-repeat;
32
+ --cus-popover-arrow-bg-left: url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2212px%22%20height%3D%2236px%22%3E%3Cpath%20fill%3D%22rgba%2817,%2017,%2017,%200.9%29%22%20transform%3D%22rotate%28-90%2018%2018%29%22%20d%3D%22M2.658,0.000%20C-13.615,0.000%2050.938,0.000%2034.662,0.000%20C28.662,0.000%2023.035,12.002%2018.660,12.002%20C14.285,12.002%208.594,0.000%202.658,0.000%20Z%22/%3E%3C/svg%3E") no-repeat;
33
+ --cus-popover-arrow-bg-right: url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2212px%22%20height%3D%2236px%22%3E%3Cpath%20fill%3D%22rgba%2817,%2017,%2017,%200.9%29%22%20transform%3D%22rotate%2890%206%206%29%22%20d%3D%22M2.658,0.000%20C-13.615,0.000%2050.938,0.000%2034.662,0.000%20C28.662,0.000%2023.035,12.002%2018.660,12.002%20C14.285,12.002%208.594,0.000%202.658,0.000%20Z%22/%3E%3C/svg%3E") no-repeat;
34
+
35
+ --cus-popover-arrow-width: 18px;
36
+ --cus-popover-arrow-height: 6px;
37
+
38
+
39
+ position: absolute;
40
+ z-index: 1055; /* --bs-modal-zindex */
41
+ pointer-events: none;
42
+ display: none;
43
+ margin-top: -.2rem;
44
+
45
+ &::before {
46
+ background-size: 100% auto !important;
47
+ content: "";
48
+ position: absolute;
49
+ }
50
+
51
+ &.active {
52
+ display: block !important;
53
+
54
+ &::before,
55
+ > .cus-popover__content {
56
+ opacity: 1;
57
+ }
58
+ }
59
+
60
+ &:focus {
61
+
62
+ &::before,
63
+ > .cus-popover__content {
64
+ opacity: 1;
65
+ }
66
+ }
67
+
68
+
69
+ &::before,
70
+ > .cus-popover__content {
71
+ backface-visibility: hidden;
72
+ will-change: transform;
73
+ opacity: 0;
74
+ box-sizing: border-box;
75
+ z-index: 10;
76
+ transform-origin: top;
77
+ box-shadow: var(--cus-popover-box-shadow);
78
+ transition: none !important; /* Don't use transition if position is outside window */
79
+ }
80
+
81
+
82
+
83
+ /*
84
+ ---------------------------
85
+ 1. Base Styles
86
+ ---------------------------
87
+ */
88
+
89
+ > .cus-popover__content {
90
+ pointer-events: auto;
91
+ background: var(--cus-popover-content-bg);
92
+ border-radius: 4px;
93
+ color: var(--cus-popover-content-color);
94
+ content: attr(aria-label);
95
+ font-size: var(--cus-popover-content-font-size);
96
+ font-weight: normal;
97
+ text-transform: none;
98
+ padding: var(--cus-popover-content-padding-y) var(--cus-popover-content-padding-x);
99
+ white-space: nowrap;
100
+ box-sizing: content-box;
101
+ line-height: var(--cus-popover-content-line-height);
102
+
103
+
104
+ img {
105
+ height: auto !important;
106
+ margin: .5rem 0;
107
+ }
108
+
109
+ }
110
+
111
+
112
+
113
+ /*
114
+ ---------------------------
115
+ 2. Position Modifiers - Top
116
+ ---------------------------
117
+ */
118
+
119
+ &[data-microtip-position|="top"] {
120
+ &::before {
121
+ background: var(--cus-popover-arrow-bg-top);
122
+ height: var(--cus-popover-arrow-height);
123
+ width: var(--cus-popover-arrow-width);
124
+ }
125
+
126
+ > .cus-popover__content {
127
+ margin-bottom: var(--cus-popover-arrow-height);
128
+ }
129
+
130
+ &::before {
131
+ top: calc(100% - var(--cus-popover-arrow-height));
132
+ left: calc(var(--cus-popover-arrow-width)/2 * -1);
133
+ }
134
+
135
+ > .cus-popover__content {
136
+ bottom: calc(100% + var(--cus-popover-arrow-height));
137
+ left: 50%;
138
+ transform: translateX(-50%);
139
+ }
140
+ }
141
+
142
+
143
+ /*
144
+ ---------------------------
145
+ 3. Position Modifiers - Top Left
146
+ ---------------------------
147
+ */
148
+
149
+ &[data-microtip-position="top-left"] {
150
+ > .cus-popover__content {
151
+ bottom: calc(100% + var(--cus-popover-arrow-height));
152
+ left: 50%;
153
+ transform: translateX(calc(-100% + var(--cus-popover-arrow-width)));
154
+ }
155
+
156
+ }
157
+
158
+
159
+
160
+ /*
161
+ ---------------------------
162
+ 4. Position Modifiers - Top Right
163
+ ---------------------------
164
+ */
165
+
166
+ &[data-microtip-position="top-right"] {
167
+ > .cus-popover__content {
168
+ bottom: calc(100% + var(--cus-popover-arrow-height));
169
+ left: 50%;
170
+ transform: translateX(calc(0% - var(--cus-popover-arrow-width)));
171
+ }
172
+ }
173
+
174
+ /*
175
+ ---------------------------
176
+ 5. Position Modifiers - Bottom
177
+ ---------------------------
178
+ */
179
+
180
+
181
+ &[data-microtip-position|="bottom"] {
182
+ &::before {
183
+ background: var(--cus-popover-arrow-bg-bottom);
184
+ height: var(--cus-popover-arrow-height);
185
+ width: var(--cus-popover-arrow-width);
186
+ margin-top: 5px;
187
+ margin-bottom: 0;
188
+ }
189
+
190
+ > .cus-popover__content {
191
+ margin-top: var(--cus-popover-arrow-height);
192
+ }
193
+
194
+ &::before {
195
+ bottom: calc(100% - var(--cus-popover-arrow-height));
196
+ left: calc(var(--cus-popover-arrow-width)/2 * -1);
197
+ }
198
+
199
+ > .cus-popover__content {
200
+ bottom: auto;
201
+ top: calc(100% + var(--cus-popover-arrow-height));
202
+ left: 50%;
203
+ transform: translateX(-50%);
204
+ }
205
+ }
206
+
207
+
208
+ /*
209
+ ---------------------------
210
+ 6. Position Modifiers - Bottom Left
211
+ ---------------------------
212
+ */
213
+
214
+
215
+ &[data-microtip-position="bottom-left"] {
216
+ > .cus-popover__content {
217
+ bottom: auto;
218
+ top: calc(100% + var(--cus-popover-arrow-height));
219
+ left: 50%;
220
+ transform: translateX(calc(-100% + var(--cus-popover-arrow-width)));
221
+ }
222
+ }
223
+
224
+ /*
225
+ ---------------------------
226
+ 7. Position Modifiers - Bottom Right
227
+ ---------------------------
228
+ */
229
+
230
+
231
+ &[data-microtip-position="bottom-right"] {
232
+ > .cus-popover__content {
233
+ bottom: auto;
234
+ top: calc(100% + var(--cus-popover-arrow-height));
235
+ left: 50%;
236
+ transform: translateX(calc(0% - var(--cus-popover-arrow-width)));
237
+ }
238
+ }
239
+
240
+
241
+
242
+
243
+ /*
244
+ ---------------------------
245
+ 10. Size
246
+ ---------------------------
247
+ */
248
+ &[data-microtip-size="auto"].cus-popover__content {
249
+ white-space: nowrap;
250
+ width: auto;
251
+ max-width: 530px;
252
+ overflow: hidden;
253
+ text-overflow: ellipsis;
254
+ }
255
+
256
+ &[data-microtip-size="small"].cus-popover__content {
257
+ white-space: initial;
258
+ width: 80px;
259
+ }
260
+
261
+ &[data-microtip-size="medium"].cus-popover__content {
262
+ white-space: initial;
263
+ width: 150px;
264
+ }
265
+
266
+ &[data-microtip-size="large"].cus-popover__content {
267
+ white-space: initial;
268
+ width: 260px;
269
+ }
270
+
271
+ }
272
+
@@ -0,0 +1,4 @@
1
+ export { default } from './Popover';
2
+ export { default as PopoverTrigger } from './PopoverTrigger';
3
+ export { default as PopoverContent } from './PopoverContent';
4
+ export { default as PopoverClose } from './PopoverClose';
@@ -355,7 +355,7 @@ const Radio = forwardRef((props: RadioProps, externalRef: any) => {
355
355
 
356
356
  //
357
357
  function handleFocus(event: any) {
358
- rootRef.current?.classList.add('focus');
358
+ rootRef.current?.classList.add('focus-floating');
359
359
 
360
360
  //
361
361
  onFocus?.(event);
@@ -374,7 +374,7 @@ const Radio = forwardRef((props: RadioProps, externalRef: any) => {
374
374
 
375
375
  //----
376
376
  //remove focus style
377
- rootRef.current?.classList.remove('focus');
377
+ rootRef.current?.classList.remove('focus-floating');
378
378
 
379
379
 
380
380
  //
@@ -390,7 +390,7 @@ const Radio = forwardRef((props: RadioProps, externalRef: any) => {
390
390
 
391
391
  //----
392
392
  //remove focus style
393
- rootRef.current?.classList.remove('focus');
393
+ rootRef.current?.classList.remove('focus-floating');
394
394
 
395
395
  //
396
396
  onBlur?.(event);
@@ -114,7 +114,6 @@ const SearchBar = forwardRef((props: SearchBarProps, externalRef: any) => {
114
114
  }
115
115
 
116
116
  function handleFocus(event: FocusEvent<HTMLInputElement>) {
117
- rootRef.current?.classList.add('focus');
118
117
 
119
118
  //
120
119
  onFocus?.(event, onComposition);
@@ -125,11 +124,7 @@ const SearchBar = forwardRef((props: SearchBarProps, externalRef: any) => {
125
124
 
126
125
  setChangedVal(val);
127
126
 
128
- //----
129
- //remove focus style
130
- if (val === '') {
131
- rootRef.current?.classList.remove('focus');
132
- }
127
+
133
128
 
134
129
  //
135
130
  onChange?.(event, onComposition);
@@ -140,11 +135,7 @@ const SearchBar = forwardRef((props: SearchBarProps, externalRef: any) => {
140
135
  const val = event.target.value;
141
136
 
142
137
 
143
- //----
144
- //remove focus style
145
- if (val === '') {
146
- rootRef.current?.classList.remove('focus');
147
- }
138
+
148
139
 
149
140
  //
150
141
  onBlur?.(event, onComposition);
@@ -178,7 +169,12 @@ const SearchBar = forwardRef((props: SearchBarProps, externalRef: any) => {
178
169
  <>
179
170
 
180
171
 
181
- <div className={clsWrite(wrapperClassName, 'mb-3 position-relative')} ref={rootRef}>
172
+ <div className={combinedCls(
173
+ clsWrite(wrapperClassName, 'mb-3 position-relative'),
174
+ {
175
+ 'focus-floating': changedVal !== ''
176
+ }
177
+ )} ref={rootRef}>
182
178
  {label ? <>{typeof label === 'string' ? <label htmlFor={idRes} className="form-label" dangerouslySetInnerHTML={{ __html: `${label}` }}></label> : <label htmlFor={idRes} className="form-label" >{label}</label>}</> : null}
183
179
 
184
180
  <div className={combinedCls(
@@ -1207,10 +1207,10 @@ const Select = forwardRef((props: SelectProps, externalRef: any) => {
1207
1207
 
1208
1208
  if (parseFloat(oldHeight) > filteredHeight) {
1209
1209
  listContentRef.current.style.height = filteredHeight + 'px';
1210
- console.log('popwinContainerHeightAdjust - height changed to:', filteredHeight);
1210
+ // console.log('popwinContainerHeightAdjust - height changed to:', filteredHeight);
1211
1211
  } else {
1212
1212
  listContentRef.current.style.height = oldHeight + 'px';
1213
- console.log('popwinContainerHeightAdjust - height kept as:', oldHeight);
1213
+ // console.log('popwinContainerHeightAdjust - height kept as:', oldHeight);
1214
1214
  }
1215
1215
 
1216
1216
  }
@@ -55,7 +55,7 @@ const Switch = forwardRef((props: SwitchProps, externalRef: any) => {
55
55
  const [val, setVal] = useState<boolean>(false); // Avoid the error "react checkbox changing an uncontrolled input to be controlled"
56
56
 
57
57
  function handleFocus(event: any) {
58
- rootRef.current?.classList.add('focus');
58
+ rootRef.current?.classList.add('focus-floating');
59
59
 
60
60
  //
61
61
  onFocus?.(event);
@@ -69,7 +69,7 @@ const Switch = forwardRef((props: SwitchProps, externalRef: any) => {
69
69
 
70
70
  //----
71
71
  //remove focus style
72
- rootRef.current?.classList.remove('focus');
72
+ rootRef.current?.classList.remove('focus-floating');
73
73
 
74
74
  //
75
75
  if (typeof (onChange) === 'function') {
@@ -85,7 +85,7 @@ const Switch = forwardRef((props: SwitchProps, externalRef: any) => {
85
85
 
86
86
  //----
87
87
  //remove focus style
88
- rootRef.current?.classList.remove('focus');
88
+ rootRef.current?.classList.remove('focus-floating');
89
89
 
90
90
  //
91
91
  onBlur?.(event);
@@ -2,17 +2,17 @@
2
2
  <!-- Tag Input -->
3
3
  /* ====================================================== */
4
4
 
5
- .tag-input__wrapper {
5
+ .taginput__wrapper {
6
6
 
7
- --tag-input-control-border-radius: 0.375rem;
8
- --tag-input-control-wrapper-bg: #fff;
9
- --tag-input-control-wrapper-border-color: #dee2e6;
10
- --tag-input-control-color: #adb5bd;
11
- --tag-input-list-bg: #efefef;
12
- --tag-input-removebtn-fill: #000;
13
- --tag-input-removebtn-hover-fill: #f00;
14
- --tag-input-focus-border-color:#86b7fe;
15
- --tag-input-focus-box-shadow: 0 0 0 0.25rem rgba(13,110,253,.25);
7
+ --taginput-control-border-radius: 0.375rem;
8
+ --taginput-control-wrapper-bg: #fff;
9
+ --taginput-control-wrapper-border-color: #dee2e6;
10
+ --taginput-control-color: #adb5bd;
11
+ --taginput-list-bg: #efefef;
12
+ --taginput-removebtn-fill: #000;
13
+ --taginput-removebtn-hover-fill: #f00;
14
+ --taginput-focus-border-color:#86b7fe;
15
+ --taginput-focus-box-shadow: 0 0 0 0.25rem rgba(13,110,253,.25);
16
16
 
17
17
 
18
18
  display: flex;
@@ -26,7 +26,7 @@
26
26
  }
27
27
 
28
28
 
29
- .tag-input__control-wrapper {
29
+ .taginput__control-wrapper {
30
30
  display: flex;
31
31
 
32
32
  > div {
@@ -37,16 +37,16 @@
37
37
 
38
38
  /* bootstrap style that match ".form-control" */
39
39
  padding: 0.375rem;
40
- background-color: var(--tag-input-control-wrapper-bg);
40
+ background-color: var(--taginput-control-wrapper-bg);
41
41
  background-clip: padding-box;
42
- border: 1px solid var(--tag-input-control-wrapper-border-color);
42
+ border: 1px solid var(--taginput-control-wrapper-border-color);
43
43
  appearance: none;
44
- border-radius: var(--tag-input-control-border-radius);
44
+ border-radius: var(--taginput-control-border-radius);
45
45
  transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
46
46
  padding-bottom: 1px;
47
47
 
48
48
 
49
- .tag-input__control {
49
+ .taginput__control {
50
50
  margin-bottom: 0.375rem;
51
51
 
52
52
  input {
@@ -61,7 +61,7 @@
61
61
  font-size: 0.875rem;
62
62
  font-weight: 400;
63
63
  line-height: 1.5;
64
- color: var(--tag-input-control-color);
64
+ color: var(--taginput-control-color);
65
65
 
66
66
  &:focus {
67
67
  outline: none;
@@ -76,14 +76,14 @@
76
76
  }
77
77
 
78
78
 
79
- ul.tag-input__list {
79
+ ul.taginput__list {
80
80
  li {
81
81
  display: inline-block;
82
82
  margin: 5px;
83
83
  margin-bottom: 0;
84
84
  padding: .1rem 1.5rem .1rem 1rem;
85
85
  font-size: 0.875rem;
86
- background: var(--tag-input-list-bg);
86
+ background: var(--taginput-list-bg);
87
87
  border-radius: 30px;
88
88
  overflow: hidden;
89
89
  text-overflow: ellipsis;
@@ -100,12 +100,12 @@
100
100
  transform: translateY(-50%);
101
101
 
102
102
  path {
103
- fill: var(--tag-input-removebtn-fill);
103
+ fill: var(--taginput-removebtn-fill);
104
104
  }
105
105
 
106
106
  &:hover {
107
107
  path {
108
- fill: var(--tag-input-removebtn-hover-fill);
108
+ fill: var(--taginput-removebtn-hover-fill);
109
109
  }
110
110
  }
111
111
  }
@@ -114,11 +114,11 @@
114
114
 
115
115
  }
116
116
 
117
- &.focus {
118
- .tag-input__control-wrapper {
117
+ &.focus-floating {
118
+ .taginput__control-wrapper {
119
119
  > div {
120
- box-shadow: var(--tag-input-focus-box-shadow);
121
- border-color: var(--tag-input-focus-border-color);
120
+ box-shadow: var(--taginput-focus-box-shadow);
121
+ border-color: var(--taginput-focus-border-color);
122
122
  }
123
123
  }
124
124
  }
@@ -209,12 +209,6 @@ const TagInput = forwardRef((props: TagInputProps, externalRef: any) => {
209
209
  function handleChange(event: ChangeEvent<HTMLInputElement>) {
210
210
 
211
211
  const val = event.target.value;
212
-
213
- //----
214
- //remove focus style
215
- if (val === '') {
216
- rootRef.current?.classList.remove('focus');
217
- }
218
212
 
219
213
  //
220
214
  let _alreadyInItems = alreadyInItems;
@@ -239,7 +233,8 @@ const TagInput = forwardRef((props: TagInputProps, externalRef: any) => {
239
233
 
240
234
 
241
235
  function handleFocus(event: FocusEvent<HTMLInputElement>) {
242
- rootRef.current?.classList.add('focus');
236
+ // tag style
237
+ rootRef.current?.classList.add('focus-floating');
243
238
 
244
239
  //
245
240
  onFocus?.(event);
@@ -250,14 +245,9 @@ const TagInput = forwardRef((props: TagInputProps, externalRef: any) => {
250
245
  const el = event.target;
251
246
  const val = event.target.value;
252
247
 
248
+ setUserInput('');
249
+ setAlreadyInItems(false);
253
250
 
254
- //----
255
- //remove focus style
256
- if (val === '') {
257
- rootRef.current?.classList.remove('focus');
258
- }
259
-
260
- //
261
251
  onBlur?.(event);
262
252
  }
263
253
 
@@ -277,16 +267,19 @@ const TagInput = forwardRef((props: TagInputProps, externalRef: any) => {
277
267
  <>
278
268
 
279
269
  <div className={combinedCls(
280
- 'tag-input__wrapper',
281
- clsWrite(wrapperClassName, 'mb-3 position-relative')
270
+ 'taginput__wrapper',
271
+ clsWrite(wrapperClassName, 'mb-3 position-relative'),
272
+ {
273
+ 'focus-floating': userInput !== ''
274
+ }
282
275
  )} ref={rootRef}>
283
276
 
284
277
  {label ? <>{typeof label === 'string' ? <label htmlFor={`label-${idRes}`} className="form-label" dangerouslySetInnerHTML={{__html: `${label}`}}></label> : <label htmlFor={`label-${idRes}`} className="form-label">{label}</label>}</> : null}
285
278
 
286
279
 
287
- <div className="tag-input__control-wrapper">
280
+ <div className="taginput__control-wrapper">
288
281
  <div>
289
- <ul className="tag-input__list">
282
+ <ul className="taginput__list">
290
283
 
291
284
  {/* ITEMS LIST */}
292
285
  {typeof renderSelectedValue === 'function' ? <>
@@ -308,7 +301,7 @@ const TagInput = forwardRef((props: TagInputProps, externalRef: any) => {
308
301
 
309
302
 
310
303
  <div className={combinedCls(
311
- 'tag-input__control',
304
+ 'taginput__control',
312
305
  {
313
306
  'disabled': disabled
314
307
  }
@@ -321,7 +314,7 @@ const TagInput = forwardRef((props: TagInputProps, externalRef: any) => {
321
314
 
322
315
  // Don't use "name", it's just a container to display the label
323
316
  data-name={name?.match(/(\[.*?\])/gi) ? `${name.split('[')[0]}-label[]` : `${name}-label`}
324
- data-tag-input
317
+ data-taginput
325
318
  autoComplete={typeof autoComplete === 'undefined' ? 'off' : autoComplete}
326
319
  autoCapitalize={typeof autoCapitalize === 'undefined' ? 'off' : autoCapitalize}
327
320
  spellCheck={typeof spellCheck === 'undefined' ? false : spellCheck}
@@ -335,7 +335,6 @@ const Textarea = forwardRef((props: TextareaProps, externalRef: any) => {
335
335
 
336
336
  function handleFocus(event: FocusEvent<HTMLTextAreaElement>): void {
337
337
  const el = event.target;
338
- rootRef.current?.classList.add('focus');
339
338
 
340
339
  //
341
340
  onFocus?.(event, valRef.current as HTMLTextAreaElement);
@@ -346,12 +345,6 @@ const Textarea = forwardRef((props: TextareaProps, externalRef: any) => {
346
345
 
347
346
  setChangedVal(curVal);
348
347
 
349
- //----
350
- //remove focus style
351
- if (curVal === '') {
352
- rootRef.current?.classList.remove('focus');
353
- }
354
-
355
348
  //
356
349
  onChange?.(event, valRef.current as HTMLTextAreaElement, curVal);
357
350
 
@@ -368,12 +361,6 @@ const Textarea = forwardRef((props: TextareaProps, externalRef: any) => {
368
361
  const val = el.value;
369
362
 
370
363
 
371
- //----
372
- //remove focus style
373
- if (val === '') {
374
- rootRef.current?.classList.remove('focus');
375
- }
376
-
377
364
  //
378
365
  onBlur?.(event, valRef.current as HTMLTextAreaElement);
379
366
 
@@ -516,7 +503,12 @@ const Textarea = forwardRef((props: TextareaProps, externalRef: any) => {
516
503
  return (
517
504
  <>
518
505
 
519
- <div className={clsWrite(wrapperClassName, 'mb-3 position-relative')} ref={rootRef}>
506
+ <div className={combinedCls(
507
+ clsWrite(wrapperClassName, 'mb-3 position-relative'),
508
+ {
509
+ 'focus-floating': changedVal !== ''
510
+ }
511
+ )} ref={rootRef}>
520
512
  {label ? <>{typeof label === 'string' ? <label htmlFor={idRes} className="form-label" dangerouslySetInnerHTML={{__html: `${label}`}}></label> : <label htmlFor={idRes} className="form-label">{label}</label>}</> : null}
521
513
 
522
514