funda-ui 4.7.625 → 4.7.701

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 (84) 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 +1 -1
  8. package/EventCalendarTimeline/index.js +11 -1
  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/useSSE.d.ts +9 -0
  28. package/Utils/useSSE.js +211 -0
  29. package/all.d.ts +1 -0
  30. package/all.js +1 -0
  31. package/lib/cjs/CascadingSelect/index.js +2 -2
  32. package/lib/cjs/CascadingSelectE2E/index.js +2 -2
  33. package/lib/cjs/Chatbox/index.js +3 -17
  34. package/lib/cjs/Checkbox/index.js +3 -3
  35. package/lib/cjs/ColorPicker/index.js +3 -18
  36. package/lib/cjs/Date/index.js +3 -18
  37. package/lib/cjs/EventCalendarTimeline/index.d.ts +1 -1
  38. package/lib/cjs/EventCalendarTimeline/index.js +11 -1
  39. package/lib/cjs/File/index.d.ts +9 -0
  40. package/lib/cjs/File/index.js +245 -93
  41. package/lib/cjs/Input/index.js +3 -18
  42. package/lib/cjs/LiveSearch/index.js +3 -18
  43. package/lib/cjs/NativeSelect/index.js +3 -3
  44. package/lib/cjs/NumberInput/index.js +3 -18
  45. package/lib/cjs/Popover/index.d.ts +4 -0
  46. package/lib/cjs/Popover/index.js +1808 -0
  47. package/lib/cjs/Radio/index.js +3 -3
  48. package/lib/cjs/RangeSlider/index.js +3 -18
  49. package/lib/cjs/SearchBar/index.js +3 -18
  50. package/lib/cjs/Select/index.js +3 -2
  51. package/lib/cjs/Switch/index.js +3 -3
  52. package/lib/cjs/TagInput/index.js +12 -23
  53. package/lib/cjs/Textarea/index.js +3 -17
  54. package/lib/cjs/Utils/useSSE.d.ts +9 -0
  55. package/lib/cjs/Utils/useSSE.js +211 -0
  56. package/lib/cjs/index.d.ts +1 -0
  57. package/lib/cjs/index.js +1 -0
  58. package/lib/css/Popover/index.css +198 -0
  59. package/lib/css/TagInput/index.css +31 -31
  60. package/lib/esm/CascadingSelect/index.tsx +2 -2
  61. package/lib/esm/CascadingSelectE2E/index.tsx +2 -2
  62. package/lib/esm/Checkbox/index.tsx +3 -3
  63. package/lib/esm/ColorPicker/index.tsx +4 -15
  64. package/lib/esm/EventCalendarTimeline/index.tsx +11 -2
  65. package/lib/esm/File/index.tsx +148 -23
  66. package/lib/esm/Input/index.tsx +6 -17
  67. package/lib/esm/NativeSelect/index.tsx +3 -3
  68. package/lib/esm/NumberInput/index.tsx +7 -15
  69. package/lib/esm/Popover/Popover.tsx +251 -0
  70. package/lib/esm/Popover/PopoverClose.tsx +51 -0
  71. package/lib/esm/Popover/PopoverContent.tsx +72 -0
  72. package/lib/esm/Popover/PopoverTrigger.tsx +62 -0
  73. package/lib/esm/Popover/index.scss +272 -0
  74. package/lib/esm/Popover/index.tsx +4 -0
  75. package/lib/esm/Radio/index.tsx +3 -3
  76. package/lib/esm/SearchBar/index.tsx +8 -12
  77. package/lib/esm/Select/index.tsx +2 -2
  78. package/lib/esm/Switch/index.tsx +3 -3
  79. package/lib/esm/TagInput/index.scss +24 -24
  80. package/lib/esm/TagInput/index.tsx +13 -20
  81. package/lib/esm/Textarea/index.tsx +6 -14
  82. package/lib/esm/Utils/hooks/useSSE.tsx +109 -0
  83. package/lib/esm/index.js +1 -0
  84. package/package.json +1 -1
@@ -0,0 +1,72 @@
1
+ import React, { forwardRef } from 'react';
2
+ import RootPortal from 'funda-root-portal';
3
+ import { combinedCls } from 'funda-utils/dist/cjs/cls';
4
+
5
+
6
+ import { usePopoverContext } from './Popover';
7
+
8
+ // PopoverContent component
9
+ export type PopoverContentProps = {
10
+ children: React.ReactNode;
11
+ className?: string;
12
+ };
13
+
14
+ const PopoverContent = forwardRef<HTMLDivElement, PopoverContentProps>((props, ref) => {
15
+ const { children, className } = props;
16
+ const {
17
+ isOpen,
18
+ contentRef,
19
+ id,
20
+ direction,
21
+ size,
22
+ popupArrowStyle,
23
+ popupContentStyle,
24
+ wrapperClassName,
25
+ position
26
+ } = usePopoverContext();
27
+
28
+ const wrapperRef = (node: HTMLDivElement | null) => {
29
+ if (node) {
30
+ (contentRef as React.MutableRefObject<HTMLDivElement | null>).current = node;
31
+ }
32
+ if (typeof ref === 'function') {
33
+ ref(node);
34
+ } else if (ref && node) {
35
+ (ref as React.MutableRefObject<HTMLDivElement | null>).current = node;
36
+ }
37
+ };
38
+
39
+ return (
40
+ <RootPortal show={isOpen} containerClassName="Popover">
41
+ <div
42
+ ref={wrapperRef}
43
+ id={`cus-popover__wrapper-${id}`}
44
+ className={combinedCls(
45
+ 'cus-popover__wrapper',
46
+ wrapperClassName,
47
+ 'active'
48
+ )}
49
+ role="popover"
50
+ data-microtip-position={direction || 'top'}
51
+ data-microtip-size={size || 'auto'}
52
+ style={{
53
+ left: position.x,
54
+ top: position.y,
55
+ display: 'none',
56
+ ...popupArrowStyle
57
+ }}
58
+ >
59
+ <div
60
+ className={combinedCls('cus-popover__content', className)}
61
+ style={popupContentStyle}
62
+ >
63
+ {children}
64
+ </div>
65
+ </div>
66
+ </RootPortal>
67
+ );
68
+ });
69
+
70
+ PopoverContent.displayName = 'PopoverContent';
71
+
72
+ export default PopoverContent;
@@ -0,0 +1,62 @@
1
+ import React, { forwardRef } from 'react';
2
+ import { clsWrite, combinedCls } from 'funda-utils/dist/cjs/cls';
3
+
4
+
5
+ import { usePopoverContext } from './Popover';
6
+
7
+ // PopoverTrigger component
8
+ export type PopoverTriggerProps = {
9
+ asChild?: boolean;
10
+ className?: string;
11
+ children: React.ReactNode;
12
+ };
13
+
14
+ const PopoverTrigger = forwardRef<HTMLElement, PopoverTriggerProps>((props, ref) => {
15
+ const { asChild, className, children } = props;
16
+ const { triggerRef, setIsOpen, isOpen, id, direction, size } = usePopoverContext();
17
+
18
+ const handleClick = (e: React.MouseEvent) => {
19
+ e.preventDefault();
20
+ setIsOpen(!isOpen);
21
+ };
22
+
23
+ const setRefs = (node: HTMLElement | null) => {
24
+ if (node) {
25
+ (triggerRef as React.MutableRefObject<HTMLElement | null>).current = node;
26
+ }
27
+ if (typeof ref === 'function') {
28
+ ref(node);
29
+ } else if (ref && node) {
30
+ (ref as React.MutableRefObject<HTMLElement | null>).current = node;
31
+ }
32
+ };
33
+
34
+ const triggerProps: any = {
35
+ ref: setRefs,
36
+ 'data-overlay-id': `cus-popover__wrapper-${id}`,
37
+ className: combinedCls(
38
+ 'cus-popover__trigger',
39
+ clsWrite(className, 'd-inline-block')
40
+ ),
41
+ 'data-microtip-position': direction || 'top',
42
+ 'data-microtip-size': size || 'auto',
43
+ onClick: handleClick
44
+ };
45
+
46
+ if (asChild && React.isValidElement(children)) {
47
+ return React.cloneElement(children as React.ReactElement<any>, {
48
+ ...triggerProps,
49
+ ...(children.props || {})
50
+ });
51
+ }
52
+
53
+ return (
54
+ <div {...triggerProps}>
55
+ {children}
56
+ </div>
57
+ );
58
+ });
59
+
60
+ PopoverTrigger.displayName = 'PopoverTrigger';
61
+
62
+ export default PopoverTrigger;
@@ -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
  }