@patternfly/chatbot 6.3.0-prerelease.8 → 6.3.0-prerelease.9
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.
@@ -1,4 +1,15 @@
|
|
1
1
|
"use strict";
|
2
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
3
|
+
var t = {};
|
4
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
5
|
+
t[p] = s[p];
|
6
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
7
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
8
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
9
|
+
t[p[i]] = s[p[i]];
|
10
|
+
}
|
11
|
+
return t;
|
12
|
+
};
|
2
13
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
14
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
15
|
};
|
@@ -9,7 +20,8 @@ exports.MessageBox = void 0;
|
|
9
20
|
// ============================================================================
|
10
21
|
const react_1 = __importDefault(require("react"));
|
11
22
|
const JumpButton_1 = __importDefault(require("./JumpButton"));
|
12
|
-
const MessageBoxBase = (
|
23
|
+
const MessageBoxBase = (_a) => {
|
24
|
+
var { announcement, ariaLabel = 'Scrollable message log', children, innerRef, className, position = 'top' } = _a, props = __rest(_a, ["announcement", "ariaLabel", "children", "innerRef", "className", "position"]);
|
13
25
|
const [atTop, setAtTop] = react_1.default.useState(false);
|
14
26
|
const [atBottom, setAtBottom] = react_1.default.useState(true);
|
15
27
|
const [isOverflowing, setIsOverflowing] = react_1.default.useState(false);
|
@@ -65,7 +77,7 @@ const MessageBoxBase = ({ announcement, ariaLabel = 'Scrollable message log', ch
|
|
65
77
|
}, [checkOverflow, handleScroll, messageBoxRef]);
|
66
78
|
return (react_1.default.createElement(react_1.default.Fragment, null,
|
67
79
|
react_1.default.createElement(JumpButton_1.default, { position: "top", isHidden: isOverflowing && atTop, onClick: scrollToTop }),
|
68
|
-
react_1.default.createElement("div", { role: "region", tabIndex: 0, "aria-label": ariaLabel, className: `pf-chatbot__messagebox ${position === 'bottom' && 'pf-chatbot__messagebox--bottom'} ${className !== null && className !== void 0 ? className : ''}`, ref: innerRef !== null && innerRef !== void 0 ? innerRef : messageBoxRef },
|
80
|
+
react_1.default.createElement("div", Object.assign({ role: "region", tabIndex: 0, "aria-label": ariaLabel, className: `pf-chatbot__messagebox ${position === 'bottom' && 'pf-chatbot__messagebox--bottom'} ${className !== null && className !== void 0 ? className : ''}`, ref: innerRef !== null && innerRef !== void 0 ? innerRef : messageBoxRef }, props),
|
69
81
|
children,
|
70
82
|
react_1.default.createElement("div", { className: "pf-chatbot__messagebox-announcement", "aria-live": "polite" }, announcement)),
|
71
83
|
react_1.default.createElement(JumpButton_1.default, { position: "bottom", isHidden: isOverflowing && atBottom, onClick: scrollToBottom })));
|
@@ -1,9 +1,21 @@
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
2
|
+
var t = {};
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
4
|
+
t[p] = s[p];
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
8
|
+
t[p[i]] = s[p[i]];
|
9
|
+
}
|
10
|
+
return t;
|
11
|
+
};
|
1
12
|
// ============================================================================
|
2
13
|
// Chatbot Main - Messages
|
3
14
|
// ============================================================================
|
4
15
|
import React from 'react';
|
5
16
|
import JumpButton from './JumpButton';
|
6
|
-
const MessageBoxBase = (
|
17
|
+
const MessageBoxBase = (_a) => {
|
18
|
+
var { announcement, ariaLabel = 'Scrollable message log', children, innerRef, className, position = 'top' } = _a, props = __rest(_a, ["announcement", "ariaLabel", "children", "innerRef", "className", "position"]);
|
7
19
|
const [atTop, setAtTop] = React.useState(false);
|
8
20
|
const [atBottom, setAtBottom] = React.useState(true);
|
9
21
|
const [isOverflowing, setIsOverflowing] = React.useState(false);
|
@@ -59,7 +71,7 @@ const MessageBoxBase = ({ announcement, ariaLabel = 'Scrollable message log', ch
|
|
59
71
|
}, [checkOverflow, handleScroll, messageBoxRef]);
|
60
72
|
return (React.createElement(React.Fragment, null,
|
61
73
|
React.createElement(JumpButton, { position: "top", isHidden: isOverflowing && atTop, onClick: scrollToTop }),
|
62
|
-
React.createElement("div", { role: "region", tabIndex: 0, "aria-label": ariaLabel, className: `pf-chatbot__messagebox ${position === 'bottom' && 'pf-chatbot__messagebox--bottom'} ${className !== null && className !== void 0 ? className : ''}`, ref: innerRef !== null && innerRef !== void 0 ? innerRef : messageBoxRef },
|
74
|
+
React.createElement("div", Object.assign({ role: "region", tabIndex: 0, "aria-label": ariaLabel, className: `pf-chatbot__messagebox ${position === 'bottom' && 'pf-chatbot__messagebox--bottom'} ${className !== null && className !== void 0 ? className : ''}`, ref: innerRef !== null && innerRef !== void 0 ? innerRef : messageBoxRef }, props),
|
63
75
|
children,
|
64
76
|
React.createElement("div", { className: "pf-chatbot__messagebox-announcement", "aria-live": "polite" }, announcement)),
|
65
77
|
React.createElement(JumpButton, { position: "bottom", isHidden: isOverflowing && atBottom, onClick: scrollToBottom })));
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@patternfly/chatbot",
|
3
|
-
"version": "6.3.0-prerelease.
|
3
|
+
"version": "6.3.0-prerelease.9",
|
4
4
|
"description": "This library provides React components based on PatternFly 6 that can be used to build chatbots.",
|
5
5
|
"main": "dist/cjs/index.js",
|
6
6
|
"module": "dist/esm/index.js",
|
@@ -25,7 +25,8 @@ const MessageBoxBase: React.FunctionComponent<MessageBoxProps> = ({
|
|
25
25
|
children,
|
26
26
|
innerRef,
|
27
27
|
className,
|
28
|
-
position = 'top'
|
28
|
+
position = 'top',
|
29
|
+
...props
|
29
30
|
}: MessageBoxProps) => {
|
30
31
|
const [atTop, setAtTop] = React.useState(false);
|
31
32
|
const [atBottom, setAtBottom] = React.useState(true);
|
@@ -96,6 +97,7 @@ const MessageBoxBase: React.FunctionComponent<MessageBoxProps> = ({
|
|
96
97
|
aria-label={ariaLabel}
|
97
98
|
className={`pf-chatbot__messagebox ${position === 'bottom' && 'pf-chatbot__messagebox--bottom'} ${className ?? ''}`}
|
98
99
|
ref={innerRef ?? messageBoxRef}
|
100
|
+
{...props}
|
99
101
|
>
|
100
102
|
{children}
|
101
103
|
<div className="pf-chatbot__messagebox-announcement" aria-live="polite">
|