diff --git a/packages/module/patternfly-docs/content/extensions/chatbot/examples/UI/ChatbotMessageBarDisabled.tsx b/packages/module/patternfly-docs/content/extensions/chatbot/examples/UI/ChatbotMessageBarDisabled.tsx new file mode 100644 index 00000000..1712882f --- /dev/null +++ b/packages/module/patternfly-docs/content/extensions/chatbot/examples/UI/ChatbotMessageBarDisabled.tsx @@ -0,0 +1,26 @@ +import React from 'react'; +import { MessageBar } from '@patternfly/chatbot/dist/dynamic/MessageBar'; +import { Checkbox } from '@patternfly/react-core'; + +export const ChatbotMessageBarDisabledExample: React.FunctionComponent = () => { + const [isDisabled, setIsDisabled] = React.useState(false); + const handleSend = (message) => alert(message); + + return ( + <> + setIsDisabled(!isDisabled)} + id="disabled" + name="disabled" + /> + + + ); +}; diff --git a/packages/module/patternfly-docs/content/extensions/chatbot/examples/UI/UI.md b/packages/module/patternfly-docs/content/extensions/chatbot/examples/UI/UI.md index 2f841801..18c9910b 100644 --- a/packages/module/patternfly-docs/content/extensions/chatbot/examples/UI/UI.md +++ b/packages/module/patternfly-docs/content/extensions/chatbot/examples/UI/UI.md @@ -257,6 +257,18 @@ In this example, the locale is set to to ja-JP. You can try it out by saying "ha ``` +### Message bar with always-shown send button + +By default, the send button is only shown once a user has entered a valid message. If you choose to keep the send button visible at all times, disable the button when there is no valid message to send. + +To always show the send button in the message bar, use the `alwaysShowSendButton` prop. Use the `isSendButtonDisabled` prop to disable the button as needed. If you want to enable or disable the send button based on the presence of text in the message bar, you can detect text via the `onChange` prop for ``. + +To disable the send button in the following example, select the "Disable send button" checkbox. When the button is disabled, you also cannot send via the enter key. + +```js file="./ChatbotMessageBarDisabled.tsx" + +``` + ### Message bar with attach menu appended to attach button You can change the behavior of the attach button to open a menu, rather than the default file viewer for your operating system. This menu can display different actions related to attachments. diff --git a/packages/module/src/MessageBar/SendButton.scss b/packages/module/src/MessageBar/SendButton.scss index 548432d4..51476ac5 100644 --- a/packages/module/src/MessageBar/SendButton.scss +++ b/packages/module/src/MessageBar/SendButton.scss @@ -7,9 +7,14 @@ width: 3rem; height: 3rem; + .pf-v6-c-button__icon { + --pf-v6-c-button__icon--Color: var(--pf-t--global--color--brand--default); + } + &:hover, &:focus { background-color: var(--pf-t--chatbot--blue-icon--background--color--hover); + color: var(--pf-t--global--color--brand--hover); .pf-v6-c-button__icon { color: var(--pf-t--chatbot--blue-icon--fill--hover); @@ -17,6 +22,25 @@ } } +.pf-v6-theme-dark { + .pf-v6-c-button.pf-chatbot__button--send { + background-color: var(--pf-t--global--color--brand--default); + .pf-v6-c-button__icon { + --pf-v6-c-button__icon--Color: var(--pf-t--global--icon--color--inverse); + } + } + + .pf-v6-c-button:disabled.pf-chatbot__button--send:disabled { + --pf-v6-c-button--disabled--Color: var(--pf-t--global--icon--color--disabled); + background-color: var(--pf-t--global--background--color--disabled--default); + } + + .pf-v6-c-button.pf-chatbot__button--send:hover, + .pf-v6-c-button.pf-chatbot__button--send:focus { + background-color: var(--pf-t--chatbot--blue-icon--background--color--hover); + } +} + @keyframes motionSendButton { 0% { opacity: 0; diff --git a/packages/module/src/MessageBar/SendButton.tsx b/packages/module/src/MessageBar/SendButton.tsx index 4e72dc7d..39400437 100644 --- a/packages/module/src/MessageBar/SendButton.tsx +++ b/packages/module/src/MessageBar/SendButton.tsx @@ -37,8 +37,8 @@ export const SendButton: React.FunctionComponent = ({ {...tooltipProps} >