UNPKG

@engie-group/fluid-design-system-react

Version:

Fluid Design System React

20 lines (17 loc) 1.39 kB
import { jsx, jsxs } from 'react/jsx-runtime'; import React__default, { forwardRef } from 'react'; import { useInert } from '../../../utils/hook.js'; import { Utils } from '../../../utils/util.js'; import { NJText } from '../../text/NJText.js'; import { NJChatInputInput } from '../input/NJChatInputInput.js'; import { NJChatInputContext } from '../NJChatInput.context.js'; const NJChatInputRoot = forwardRef(({ helperText, suggestions, disabled = false, files, primary_action, secondary_actions, variant, ...htmlProps }, forwardedRef) => { const rootEl = React__default.useRef(null); useInert(rootEl, disabled); const chatInputClasses = Utils.classNames('nj-chat-input', { ['nj-chat-input--disabled']: disabled }); return (jsx(NJChatInputContext.Provider, { value: { variant }, children: jsxs("div", { className: chatInputClasses, ref: rootEl, children: [!!suggestions && jsx("div", { className: "nj-chat-input__suggestions", children: suggestions }), jsx(NJChatInputInput, { ...htmlProps, variant: variant, disabled: disabled, ref: forwardedRef, files: files, primary_action: primary_action, secondary_actions: secondary_actions }), !!helperText && (jsx(NJText, { variant: "tertiary", scale: "sm", className: "nj-chat-input__helper-text", children: helperText }))] }) })); }); NJChatInputRoot.displayName = 'NJChatInputRoot'; export { NJChatInputRoot };