funda-ui 4.7.152 → 4.7.155

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.
@@ -171,7 +171,9 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
171
171
  var RootPortal = function RootPortal(props) {
172
172
  var containerClassName = props.containerClassName,
173
173
  show = props.show,
174
- children = props.children;
174
+ children = props.children,
175
+ _props$usePortal = props.usePortal,
176
+ usePortal = _props$usePortal === void 0 ? true : _props$usePortal;
175
177
  var containerRef = (0, react__WEBPACK_IMPORTED_MODULE_0__.useRef)();
176
178
 
177
179
  // Move HTML templates to tag end body </body>
@@ -182,15 +184,20 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
182
184
  // Use `containerRef.current` to ensure the correctness of the nextjs framework. It may report an error document as undefined
183
185
 
184
186
  (0, react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(function () {
185
- containerRef.current = document.createElement('div');
186
- containerRef.current.className = "root-portal-container ".concat(containerClassName || '');
187
- document.body.appendChild(containerRef.current);
187
+ if (usePortal) {
188
+ containerRef.current = document.createElement('div');
189
+ containerRef.current.className = "root-portal-container ".concat(containerClassName || '');
190
+ document.body.appendChild(containerRef.current);
191
+ }
188
192
  return function () {
189
- if (containerRef.current) {
193
+ if (usePortal && containerRef.current) {
190
194
  containerRef.current.remove();
191
195
  }
192
196
  };
193
- }, []);
197
+ }, [usePortal]);
198
+ if (!usePortal) {
199
+ return show ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(react__WEBPACK_IMPORTED_MODULE_0___default().Fragment, null, children) : null;
200
+ }
194
201
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(react__WEBPACK_IMPORTED_MODULE_0___default().Fragment, null, containerRef.current && show && /*#__PURE__*/(0, react_dom__WEBPACK_IMPORTED_MODULE_1__.createPortal)(children, containerRef.current));
195
202
  };
196
203
  /* harmony default export */
@@ -171,7 +171,9 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
171
171
  var RootPortal = function RootPortal(props) {
172
172
  var containerClassName = props.containerClassName,
173
173
  show = props.show,
174
- children = props.children;
174
+ children = props.children,
175
+ _props$usePortal = props.usePortal,
176
+ usePortal = _props$usePortal === void 0 ? true : _props$usePortal;
175
177
  var containerRef = (0, react__WEBPACK_IMPORTED_MODULE_0__.useRef)();
176
178
 
177
179
  // Move HTML templates to tag end body </body>
@@ -182,15 +184,20 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
182
184
  // Use `containerRef.current` to ensure the correctness of the nextjs framework. It may report an error document as undefined
183
185
 
184
186
  (0, react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(function () {
185
- containerRef.current = document.createElement('div');
186
- containerRef.current.className = "root-portal-container ".concat(containerClassName || '');
187
- document.body.appendChild(containerRef.current);
187
+ if (usePortal) {
188
+ containerRef.current = document.createElement('div');
189
+ containerRef.current.className = "root-portal-container ".concat(containerClassName || '');
190
+ document.body.appendChild(containerRef.current);
191
+ }
188
192
  return function () {
189
- if (containerRef.current) {
193
+ if (usePortal && containerRef.current) {
190
194
  containerRef.current.remove();
191
195
  }
192
196
  };
193
- }, []);
197
+ }, [usePortal]);
198
+ if (!usePortal) {
199
+ return show ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(react__WEBPACK_IMPORTED_MODULE_0___default().Fragment, null, children) : null;
200
+ }
194
201
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(react__WEBPACK_IMPORTED_MODULE_0___default().Fragment, null, containerRef.current && show && /*#__PURE__*/(0, react_dom__WEBPACK_IMPORTED_MODULE_1__.createPortal)(children, containerRef.current));
195
202
  };
196
203
  /* harmony default export */
@@ -3,6 +3,7 @@ export declare type RootPortalProps = {
3
3
  containerClassName?: string;
4
4
  children?: React.ReactNode;
5
5
  show?: boolean;
6
+ usePortal?: boolean;
6
7
  };
7
- declare const RootPortal: (props: RootPortalProps) => JSX.Element;
8
+ declare const RootPortal: (props: RootPortalProps) => JSX.Element | null;
8
9
  export default RootPortal;
@@ -110,7 +110,9 @@ __webpack_require__.r(__webpack_exports__);
110
110
  var RootPortal = function RootPortal(props) {
111
111
  var containerClassName = props.containerClassName,
112
112
  show = props.show,
113
- children = props.children;
113
+ children = props.children,
114
+ _props$usePortal = props.usePortal,
115
+ usePortal = _props$usePortal === void 0 ? true : _props$usePortal;
114
116
  var containerRef = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)();
115
117
 
116
118
  // Move HTML templates to tag end body </body>
@@ -121,15 +123,20 @@ var RootPortal = function RootPortal(props) {
121
123
  // Use `containerRef.current` to ensure the correctness of the nextjs framework. It may report an error document as undefined
122
124
 
123
125
  (0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(function () {
124
- containerRef.current = document.createElement('div');
125
- containerRef.current.className = "root-portal-container ".concat(containerClassName || '');
126
- document.body.appendChild(containerRef.current);
126
+ if (usePortal) {
127
+ containerRef.current = document.createElement('div');
128
+ containerRef.current.className = "root-portal-container ".concat(containerClassName || '');
129
+ document.body.appendChild(containerRef.current);
130
+ }
127
131
  return function () {
128
- if (containerRef.current) {
132
+ if (usePortal && containerRef.current) {
129
133
  containerRef.current.remove();
130
134
  }
131
135
  };
132
- }, []);
136
+ }, [usePortal]);
137
+ if (!usePortal) {
138
+ return show ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement((react__WEBPACK_IMPORTED_MODULE_0___default().Fragment), null, children) : null;
139
+ }
133
140
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement((react__WEBPACK_IMPORTED_MODULE_0___default().Fragment), null, containerRef.current && show && /*#__PURE__*/(0,react_dom__WEBPACK_IMPORTED_MODULE_1__.createPortal)(children, containerRef.current));
134
141
  };
135
142
  /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (RootPortal);
@@ -171,7 +171,9 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
171
171
  var RootPortal = function RootPortal(props) {
172
172
  var containerClassName = props.containerClassName,
173
173
  show = props.show,
174
- children = props.children;
174
+ children = props.children,
175
+ _props$usePortal = props.usePortal,
176
+ usePortal = _props$usePortal === void 0 ? true : _props$usePortal;
175
177
  var containerRef = (0, react__WEBPACK_IMPORTED_MODULE_0__.useRef)();
176
178
 
177
179
  // Move HTML templates to tag end body </body>
@@ -182,15 +184,20 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
182
184
  // Use `containerRef.current` to ensure the correctness of the nextjs framework. It may report an error document as undefined
183
185
 
184
186
  (0, react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(function () {
185
- containerRef.current = document.createElement('div');
186
- containerRef.current.className = "root-portal-container ".concat(containerClassName || '');
187
- document.body.appendChild(containerRef.current);
187
+ if (usePortal) {
188
+ containerRef.current = document.createElement('div');
189
+ containerRef.current.className = "root-portal-container ".concat(containerClassName || '');
190
+ document.body.appendChild(containerRef.current);
191
+ }
188
192
  return function () {
189
- if (containerRef.current) {
193
+ if (usePortal && containerRef.current) {
190
194
  containerRef.current.remove();
191
195
  }
192
196
  };
193
- }, []);
197
+ }, [usePortal]);
198
+ if (!usePortal) {
199
+ return show ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(react__WEBPACK_IMPORTED_MODULE_0___default().Fragment, null, children) : null;
200
+ }
194
201
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(react__WEBPACK_IMPORTED_MODULE_0___default().Fragment, null, containerRef.current && show && /*#__PURE__*/(0, react_dom__WEBPACK_IMPORTED_MODULE_1__.createPortal)(children, containerRef.current));
195
202
  };
196
203
  /* harmony default export */
@@ -171,7 +171,9 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
171
171
  var RootPortal = function RootPortal(props) {
172
172
  var containerClassName = props.containerClassName,
173
173
  show = props.show,
174
- children = props.children;
174
+ children = props.children,
175
+ _props$usePortal = props.usePortal,
176
+ usePortal = _props$usePortal === void 0 ? true : _props$usePortal;
175
177
  var containerRef = (0, react__WEBPACK_IMPORTED_MODULE_0__.useRef)();
176
178
 
177
179
  // Move HTML templates to tag end body </body>
@@ -182,15 +184,20 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
182
184
  // Use `containerRef.current` to ensure the correctness of the nextjs framework. It may report an error document as undefined
183
185
 
184
186
  (0, react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(function () {
185
- containerRef.current = document.createElement('div');
186
- containerRef.current.className = "root-portal-container ".concat(containerClassName || '');
187
- document.body.appendChild(containerRef.current);
187
+ if (usePortal) {
188
+ containerRef.current = document.createElement('div');
189
+ containerRef.current.className = "root-portal-container ".concat(containerClassName || '');
190
+ document.body.appendChild(containerRef.current);
191
+ }
188
192
  return function () {
189
- if (containerRef.current) {
193
+ if (usePortal && containerRef.current) {
190
194
  containerRef.current.remove();
191
195
  }
192
196
  };
193
- }, []);
197
+ }, [usePortal]);
198
+ if (!usePortal) {
199
+ return show ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(react__WEBPACK_IMPORTED_MODULE_0___default().Fragment, null, children) : null;
200
+ }
194
201
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(react__WEBPACK_IMPORTED_MODULE_0___default().Fragment, null, containerRef.current && show && /*#__PURE__*/(0, react_dom__WEBPACK_IMPORTED_MODULE_1__.createPortal)(children, containerRef.current));
195
202
  };
196
203
  /* harmony default export */
@@ -171,7 +171,9 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
171
171
  var RootPortal = function RootPortal(props) {
172
172
  var containerClassName = props.containerClassName,
173
173
  show = props.show,
174
- children = props.children;
174
+ children = props.children,
175
+ _props$usePortal = props.usePortal,
176
+ usePortal = _props$usePortal === void 0 ? true : _props$usePortal;
175
177
  var containerRef = (0, react__WEBPACK_IMPORTED_MODULE_0__.useRef)();
176
178
 
177
179
  // Move HTML templates to tag end body </body>
@@ -182,15 +184,20 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
182
184
  // Use `containerRef.current` to ensure the correctness of the nextjs framework. It may report an error document as undefined
183
185
 
184
186
  (0, react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(function () {
185
- containerRef.current = document.createElement('div');
186
- containerRef.current.className = "root-portal-container ".concat(containerClassName || '');
187
- document.body.appendChild(containerRef.current);
187
+ if (usePortal) {
188
+ containerRef.current = document.createElement('div');
189
+ containerRef.current.className = "root-portal-container ".concat(containerClassName || '');
190
+ document.body.appendChild(containerRef.current);
191
+ }
188
192
  return function () {
189
- if (containerRef.current) {
193
+ if (usePortal && containerRef.current) {
190
194
  containerRef.current.remove();
191
195
  }
192
196
  };
193
- }, []);
197
+ }, [usePortal]);
198
+ if (!usePortal) {
199
+ return show ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(react__WEBPACK_IMPORTED_MODULE_0___default().Fragment, null, children) : null;
200
+ }
194
201
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(react__WEBPACK_IMPORTED_MODULE_0___default().Fragment, null, containerRef.current && show && /*#__PURE__*/(0, react_dom__WEBPACK_IMPORTED_MODULE_1__.createPortal)(children, containerRef.current));
195
202
  };
196
203
  /* harmony default export */
@@ -154,6 +154,7 @@
154
154
  right: 0;
155
155
  z-index: 1031;
156
156
  height: var(--custom-chatbox-h);
157
+ /* disable popup */
157
158
  /* message list */
158
159
  /* dot loading */
159
160
  /* control area */
@@ -164,6 +165,12 @@
164
165
  /* default questions */
165
166
  /* Tooltip */
166
167
  }
168
+ .custom-chatbox-container.popup-none {
169
+ position: relative;
170
+ bottom: auto;
171
+ right: auto;
172
+ box-shadow: none;
173
+ }
167
174
  .custom-chatbox-container details {
168
175
  font-style: italic;
169
176
  margin: 0;
@@ -375,6 +382,7 @@
375
382
  border: 1px solid var(--custom-chatbox-gray-color);
376
383
  border-radius: 0.35rem;
377
384
  transition: all 0.3s ease;
385
+ background: var(--custom-chatbox-input-bg);
378
386
  }
379
387
  .custom-chatbox-container .msgcontrol img, .custom-chatbox-container .msgcontrol svg, .custom-chatbox-container .msgcontrol video, .custom-chatbox-container .msgcontrol canvas, .custom-chatbox-container .msgcontrol audio, .custom-chatbox-container .msgcontrol iframe, .custom-chatbox-container .msgcontrol embed, .custom-chatbox-container .msgcontrol object {
380
388
  display: inline;
@@ -189,6 +189,14 @@
189
189
  z-index: 1031;
190
190
  height: var(--custom-chatbox-h);
191
191
 
192
+ /* disable popup */
193
+ &.popup-none {
194
+ position: relative;
195
+ bottom: auto;
196
+ right: auto;
197
+ box-shadow: none;
198
+ }
199
+
192
200
  details {
193
201
  font-style: italic;
194
202
  margin: 0;
@@ -449,6 +457,7 @@
449
457
  border: 1px solid var(--custom-chatbox-gray-color);
450
458
  border-radius: 0.35rem;
451
459
  transition: all 0.3s ease;
460
+ background: var(--custom-chatbox-input-bg);
452
461
 
453
462
  img, svg, video, canvas, audio, iframe, embed, object {
454
463
  display: inline;
@@ -12,7 +12,6 @@ import useClickOutside from 'funda-utils/dist/cjs/useClickOutside';
12
12
  import { htmlEncode } from 'funda-utils/dist/cjs/sanitize';
13
13
 
14
14
 
15
-
16
15
  // loader
17
16
  import PureLoader from './PureLoader';
18
17
  import TypingEffect from "./TypingEffect";
@@ -129,6 +128,7 @@ export type ChatboxProps = {
129
128
  defaultQuestions?: QuestionData;
130
129
  showCopyBtn?: boolean; // Whether to show copy button for each reply
131
130
  autoCopyReply?: boolean; // Whether to automatically copy reply to clipboard
131
+ usePopUp?: boolean;
132
132
  customRequest?: CustomRequestFunction;
133
133
  renderParser?: (input: string) => Promise<string>;
134
134
  requestBodyFormatter?: (body: any, contextData: Record<string, any>, conversationHistory: MessageDetail[]) => Promise<Record<string, any>>;
@@ -319,6 +319,7 @@ const Chatbox = (props: ChatboxProps) => {
319
319
  toolkitButtons,
320
320
  newChatButton,
321
321
  maxHistoryLength,
322
+ usePopUp,
322
323
  customRequest,
323
324
  onQuestionClick,
324
325
  onCopyCallback,
@@ -399,6 +400,7 @@ const Chatbox = (props: ChatboxProps) => {
399
400
  maxHistoryLength,
400
401
  toolkitButtons,
401
402
  newChatButton,
403
+ usePopUp,
402
404
  customRequest,
403
405
  onQuestionClick,
404
406
  onCopyCallback,
@@ -1330,7 +1332,7 @@ const Chatbox = (props: ChatboxProps) => {
1330
1332
  return (
1331
1333
  <>
1332
1334
 
1333
- <RootPortal show={true} containerClassName="Chatbox">
1335
+ <RootPortal show={true} usePortal={args().usePopUp} containerClassName="Chatbox">
1334
1336
 
1335
1337
  {/**------------- BUBBLE -------------*/}
1336
1338
  {args().bubble ? <>
@@ -1353,7 +1355,7 @@ const Chatbox = (props: ChatboxProps) => {
1353
1355
  {/**------------- CLOSE BUTTON------------- */}
1354
1356
 
1355
1357
 
1356
- <div style={{ display: show ? 'block' : 'none' }} className={`${args().prefix || 'custom-'}chatbox-container`} ref={rootRef}>
1358
+ <div style={{ display: show ? 'block' : 'none' }} className={`${args().prefix || 'custom-'}chatbox-container ${typeof args().usePopUp !== 'undefined' && args().usePopUp === false ? 'popup-none' : ''}`} ref={rootRef}>
1357
1359
 
1358
1360
  {/**------------- NO DATA -------------*/}
1359
1361
  {msgList.length === 0 ? <>
@@ -1393,7 +1395,8 @@ const Chatbox = (props: ChatboxProps) => {
1393
1395
 
1394
1396
 
1395
1397
  {/**------------- MESSAGES LIST -------------*/}
1396
- <div className="messages" ref={msgContainerRef}>
1398
+ {/** Prevent excessive height overflow */}
1399
+ <div className={`messages ${msgList.length === 0 ? 'd-none' : ''}`} ref={msgContainerRef}>
1397
1400
 
1398
1401
  {msgList.map((msg, index) => {
1399
1402
 
@@ -6,13 +6,15 @@ export type RootPortalProps = {
6
6
  containerClassName?: string;
7
7
  children?: React.ReactNode;
8
8
  show?: boolean;
9
+ usePortal?: boolean;
9
10
  };
10
11
 
11
12
  const RootPortal = (props: RootPortalProps) => {
12
13
  const {
13
14
  containerClassName,
14
15
  show,
15
- children
16
+ children,
17
+ usePortal = true
16
18
  } = props;
17
19
 
18
20
  const containerRef = useRef<HTMLElement>();
@@ -25,19 +27,23 @@ const RootPortal = (props: RootPortalProps) => {
25
27
  // Use `containerRef.current` to ensure the correctness of the nextjs framework. It may report an error document as undefined
26
28
 
27
29
  useEffect(() => {
28
-
29
- containerRef.current = document.createElement('div');
30
- containerRef.current.className = `root-portal-container ${containerClassName || ''}`;
31
- document.body.appendChild(containerRef.current);
32
-
30
+ if (usePortal) {
31
+ containerRef.current = document.createElement('div');
32
+ containerRef.current.className = `root-portal-container ${containerClassName || ''}`;
33
+ document.body.appendChild(containerRef.current);
34
+ }
33
35
 
34
36
  return () => {
35
- if (containerRef.current) {
37
+ if (usePortal && containerRef.current) {
36
38
  containerRef.current.remove();
37
39
  }
38
40
  };
39
- }, []);
41
+ }, [usePortal]);
40
42
 
43
+ if (!usePortal) {
44
+ return show ? <>{children}</> : null;
45
+ }
46
+
41
47
  return (
42
48
  <>
43
49
  {containerRef.current && show && createPortal(
@@ -7,6 +7,7 @@ import { clsWrite, combinedCls } from 'funda-utils/dist/cjs/cls';
7
7
  import { actualPropertyValue, getTextTop } from 'funda-utils/dist/cjs/inputsCalculation';
8
8
  import useDebounce from 'funda-utils/dist/cjs/useDebounce';
9
9
 
10
+
10
11
  export type TextareaProps = {
11
12
  contentRef?: React.ForwardedRef<any>; // could use "Array" on contentRef.current, such as contentRef.current[0], contentRef.current[1]
12
13
  wrapperClassName?: string;
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.7.152",
5
+ "version": "4.7.155",
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",