@orbe-agro/client-core 5.6.350 → 5.6.352

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/dist/@ecme/assets/styles/app.css +3 -0
  2. package/dist/@ecme/assets/styles/tailwind/index.css +3 -0
  3. package/dist/@ecme/components/template/Footer.js +1 -1
  4. package/dist/@ecme/components/ui/Input/Input.js +1 -3
  5. package/dist/@ecme/components/ui/Input/Input.js.map +1 -1
  6. package/dist/@ecme/components/view/ChatBox/ChatBox.js +1 -7
  7. package/dist/@ecme/components/view/ChatBox/ChatBox.js.map +1 -1
  8. package/dist/@ecme/components/view/ChatBox/components/ChatInput.js +30 -63
  9. package/dist/@ecme/components/view/ChatBox/components/ChatInput.js.map +1 -1
  10. package/dist/@ecme/locales/lang/en/nav.js +2 -1
  11. package/dist/@ecme/locales/lang/en/nav.js.map +1 -1
  12. package/dist/@ecme/views/concepts/ai/Chat/components/AiChatBox.js +75 -0
  13. package/dist/@ecme/views/concepts/ai/Chat/components/AiChatBox.js.map +1 -0
  14. package/dist/@ecme/views/concepts/ai/Chat/components/AiChatInput.js +121 -0
  15. package/dist/@ecme/views/concepts/ai/Chat/components/AiChatInput.js.map +1 -0
  16. package/dist/@ecme/views/concepts/ai/Chat/components/ChatView.js +2 -3
  17. package/dist/@ecme/views/concepts/ai/Chat/components/ChatView.js.map +1 -1
  18. package/dist/@ecme/views/concepts/chat/Chat/components/ChatBody.js +1 -1
  19. package/dist/@ecme/views/concepts/chat/Chat/components/ChatBody.js.map +1 -1
  20. package/dist/@types/@ecme/components/ui/Input/Input.d.ts.map +1 -1
  21. package/dist/@types/@ecme/components/view/ChatBox/ChatBox.d.ts.map +1 -1
  22. package/dist/@types/@ecme/components/view/ChatBox/components/ChatInput.d.ts +1 -12
  23. package/dist/@types/@ecme/components/view/ChatBox/components/ChatInput.d.ts.map +1 -1
  24. package/dist/@types/@ecme/locales/lang/en/index.d.ts +1 -0
  25. package/dist/@types/@ecme/locales/lang/en/index.d.ts.map +1 -1
  26. package/dist/@types/@ecme/locales/lang/en/nav.d.ts +1 -0
  27. package/dist/@types/@ecme/locales/lang/en/nav.d.ts.map +1 -1
  28. package/dist/@types/@ecme/locales/lang/ptBR/index.d.ts +1 -0
  29. package/dist/@types/@ecme/locales/lang/ptBR/index.d.ts.map +1 -1
  30. package/dist/@types/@ecme/views/concepts/ai/Chat/components/AiChatBox.d.ts +25 -0
  31. package/dist/@types/@ecme/views/concepts/ai/Chat/components/AiChatBox.d.ts.map +1 -0
  32. package/dist/@types/@ecme/views/concepts/ai/Chat/components/AiChatInput.d.ts +38 -0
  33. package/dist/@types/@ecme/views/concepts/ai/Chat/components/AiChatInput.d.ts.map +1 -0
  34. package/dist/@types/base/@types/api/request/dm/TConfiguracaoNotificacaoRequest.d.ts +12 -0
  35. package/dist/@types/base/@types/api/request/dm/TConfiguracaoNotificacaoRequest.d.ts.map +1 -0
  36. package/dist/@types/base/@types/api/response/dadosMestres/TConfiguracaoNotificacaoResponse.d.ts +18 -0
  37. package/dist/@types/base/@types/api/response/dadosMestres/TConfiguracaoNotificacaoResponse.d.ts.map +1 -0
  38. package/dist/@types/base/configs/endpoints.config/dm/config/configuracaoNotificacao.d.ts +28 -0
  39. package/dist/@types/base/configs/endpoints.config/dm/config/configuracaoNotificacao.d.ts.map +1 -0
  40. package/dist/@types/base/configs/endpoints.config/dm/dm.d.ts +26 -0
  41. package/dist/@types/base/configs/endpoints.config/dm/dm.d.ts.map +1 -1
  42. package/dist/@types/base/configs/endpoints.config/endpoints.navigation.d.ts +26 -0
  43. package/dist/@types/base/configs/endpoints.config/endpoints.navigation.d.ts.map +1 -1
  44. package/dist/@types/base/configs/navigation.config/submenu/dadosMestres/cadastros.submenu.d.ts.map +1 -1
  45. package/dist/@types/base/configs/navigation.config/submenu/dadosMestres/config/configuracaoNotificacao.submenu.d.ts +4 -0
  46. package/dist/@types/base/configs/navigation.config/submenu/dadosMestres/config/configuracaoNotificacao.submenu.d.ts.map +1 -0
  47. package/dist/@types/base/locales/lang/ptBR/modules/DadosMestres/dadosMestres.nav.d.ts +1 -0
  48. package/dist/@types/base/locales/lang/ptBR/modules/DadosMestres/dadosMestres.nav.d.ts.map +1 -1
  49. package/dist/@types/base/services/modules/dm/configuracaoNotificacao/ConfiguracaoNotificacaoService.d.ts +10 -0
  50. package/dist/@types/base/services/modules/dm/configuracaoNotificacao/ConfiguracaoNotificacaoService.d.ts.map +1 -0
  51. package/dist/base/@types/api/request/dm/TConfiguracaoNotificacaoRequest.js +2 -0
  52. package/dist/base/@types/api/request/dm/TConfiguracaoNotificacaoRequest.js.map +1 -0
  53. package/dist/base/@types/api/response/dadosMestres/TConfiguracaoNotificacaoResponse.js +2 -0
  54. package/dist/base/@types/api/response/dadosMestres/TConfiguracaoNotificacaoResponse.js.map +1 -0
  55. package/dist/base/assets/styles/init.css +3 -0
  56. package/dist/base/configs/endpoints.config/dm/config/configuracaoNotificacao.js +13 -0
  57. package/dist/base/configs/endpoints.config/dm/config/configuracaoNotificacao.js.map +1 -0
  58. package/dist/base/configs/endpoints.config/dm/dm.js +3 -1
  59. package/dist/base/configs/endpoints.config/dm/dm.js.map +1 -1
  60. package/dist/base/configs/navigation.config/submenu/dadosMestres/cadastros.submenu.js +3 -1
  61. package/dist/base/configs/navigation.config/submenu/dadosMestres/cadastros.submenu.js.map +1 -1
  62. package/dist/base/configs/navigation.config/submenu/dadosMestres/config/configuracaoNotificacao.submenu.js +16 -0
  63. package/dist/base/configs/navigation.config/submenu/dadosMestres/config/configuracaoNotificacao.submenu.js.map +1 -0
  64. package/dist/base/locales/lang/ptBR/modules/DadosMestres/dadosMestres.nav.js +1 -0
  65. package/dist/base/locales/lang/ptBR/modules/DadosMestres/dadosMestres.nav.js.map +1 -1
  66. package/dist/base/services/modules/dm/configuracaoNotificacao/ConfiguracaoNotificacaoService.js +52 -0
  67. package/dist/base/services/modules/dm/configuracaoNotificacao/ConfiguracaoNotificacaoService.js.map +1 -0
  68. package/lib/@ecme/components/ui/Input/Input.tsx +1 -3
  69. package/lib/@ecme/components/view/ChatBox/ChatBox.tsx +0 -6
  70. package/lib/@ecme/components/view/ChatBox/components/ChatInput.tsx +35 -100
  71. package/lib/@ecme/locales/lang/en/nav.ts +1 -0
  72. package/lib/@ecme/views/concepts/ai/Chat/components/AiChatBox.tsx +96 -0
  73. package/lib/@ecme/views/concepts/ai/Chat/components/AiChatInput.tsx +173 -0
  74. package/lib/@ecme/views/concepts/ai/Chat/components/ChatView.tsx +3 -3
  75. package/lib/@ecme/views/concepts/chat/Chat/components/ChatBody.tsx +1 -1
  76. package/lib/base/@types/api/request/dm/TConfiguracaoNotificacaoRequest.ts +13 -0
  77. package/lib/base/@types/api/response/dadosMestres/TConfiguracaoNotificacaoResponse.ts +19 -0
  78. package/lib/base/configs/endpoints.config/dm/config/configuracaoNotificacao.ts +12 -0
  79. package/lib/base/configs/endpoints.config/dm/dm.ts +3 -1
  80. package/lib/base/configs/navigation.config/submenu/dadosMestres/cadastros.submenu.ts +2 -0
  81. package/lib/base/configs/navigation.config/submenu/dadosMestres/config/configuracaoNotificacao.submenu.ts +16 -0
  82. package/lib/base/locales/lang/ptBR/modules/DadosMestres/dadosMestres.nav.ts +1 -0
  83. package/lib/base/services/modules/dm/configuracaoNotificacao/ConfiguracaoNotificacaoService.ts +58 -0
  84. package/package.json +1 -1
@@ -5584,6 +5584,9 @@ video {
5584
5584
  .h-\[42px\]{
5585
5585
  height: 42px;
5586
5586
  }
5587
+ .h-\[50px\]{
5588
+ height: 50px;
5589
+ }
5587
5590
  .h-\[56px\]{
5588
5591
  height: 56px;
5589
5592
  }
@@ -1661,6 +1661,9 @@ video {
1661
1661
  .h-\[42px\] {
1662
1662
  height: 42px;
1663
1663
  }
1664
+ .h-\[50px\] {
1665
+ height: 50px;
1666
+ }
1664
1667
  .h-\[56px\] {
1665
1668
  height: 56px;
1666
1669
  }
@@ -3,7 +3,7 @@ import Container from "../shared/Container.js";
3
3
  import classNames from "../../utils/classNames.js";
4
4
  import { APP_NAME } from "../../constants/app.constant.js";
5
5
  import { PAGE_CONTAINER_GUTTER_X } from "../../constants/theme.constant.js";
6
- const version = true ? "5.6.350" : "0.0.0";
6
+ const version = true ? "5.6.352" : "0.0.0";
7
7
  const FooterContent = () => {
8
8
  return /* @__PURE__ */ jsxs("div", { className: "flex w-full flex-auto items-center justify-between", children: [
9
9
  /* @__PURE__ */ jsxs("span", { children: [
@@ -104,9 +104,7 @@ const Input = (props) => {
104
104
  return gutterStyle;
105
105
  };
106
106
  const inputProps = {
107
- // Sem estilo do template, mas com as classes de quem chamou: `unstyle`
108
- // remove a aparência padrão, não o className.
109
- className: !unstyle ? inputClass : className,
107
+ className: !unstyle ? inputClass : "",
110
108
  disabled,
111
109
  type,
112
110
  ref,
@@ -1 +1 @@
1
- {"version":3,"file":"Input.js","sources":["../../../../../lib/@ecme/components/ui/Input/Input.tsx"],"sourcesContent":["import { useState, useEffect, useRef } from \"react\";\nimport classNames from \"classnames\";\nimport { useConfig } from \"../ConfigProvider\";\nimport { useForm, useFormItem } from \"../Form/context\";\nimport { useInputGroup } from \"../InputGroup/context\";\nimport { CONTROL_SIZES } from \"../utils/constants\";\nimport isNil from \"lodash/isNil\";\nimport type { CommonProps, TypeAttributes } from \"../@types/common\";\nimport type {\n InputHTMLAttributes,\n ElementType,\n ReactNode,\n HTMLInputTypeAttribute,\n ClassAttributes,\n Ref,\n} from \"react\";\n\nexport interface InputProps\n extends CommonProps,\n Omit<\n InputHTMLAttributes<HTMLInputElement | HTMLTextAreaElement>,\n \"size\" | \"prefix\"\n > {\n asElement?: ElementType;\n disabled?: boolean;\n invalid?: boolean;\n prefix?: string | ReactNode;\n rows?: number;\n ref?: Ref<ElementType | HTMLInputElement | HTMLTextAreaElement>;\n size?: TypeAttributes.ControlSize;\n suffix?: string | ReactNode;\n textArea?: boolean;\n type?: HTMLInputTypeAttribute;\n unstyle?: boolean;\n disallowWhitespaceOnly?: boolean;\n}\n\nconst Input = (props: InputProps) => {\n const {\n asElement: Component = \"input\",\n className,\n disabled,\n invalid,\n prefix,\n size,\n suffix,\n textArea,\n type = \"text\",\n ref,\n rows,\n style,\n unstyle = false,\n disallowWhitespaceOnly = false,\n ...rest\n } = props;\n\n const [prefixGutter, setPrefixGutter] = useState(0);\n const [suffixGutter, setSuffixGutter] = useState(0);\n\n const { controlSize, direction } = useConfig();\n const formControlSize = useForm()?.size;\n const formItemInvalid = useFormItem()?.invalid;\n const inputGroupSize = useInputGroup()?.size;\n\n const inputSize = size || inputGroupSize || formControlSize || controlSize;\n\n const isInputInvalid = invalid || formItemInvalid;\n\n const fixControlledValue = (\n val: string | number | readonly string[] | undefined\n ) => {\n if (typeof val === \"undefined\" || val === null) {\n return \"\";\n }\n return val;\n };\n\n if (\"value\" in props) {\n rest.value = fixControlledValue(props.value);\n delete rest.defaultValue;\n }\n\n const inputDefaultClass = \"input\";\n const inputSizeClass = `input-${inputSize} ${CONTROL_SIZES[inputSize].h}`;\n const inputFocusClass = `focus:ring-primary focus-within:ring-primary focus-within:border-primary focus:border-primary`;\n const inputWrapperClass = classNames(\n \"input-wrapper\",\n prefix || suffix ? className : \"\"\n );\n const inputClass = classNames(\n inputDefaultClass,\n !textArea && inputSizeClass,\n !isInputInvalid && inputFocusClass,\n !prefix && !suffix ? className : \"\",\n disabled && \"input-disabled\",\n isInputInvalid && \"input-invalid\",\n textArea && \"input-textarea\"\n );\n\n const prefixNode = useRef<HTMLDivElement>(null);\n const suffixNode = useRef<HTMLDivElement>(null);\n\n const getAffixSize = () => {\n if (!prefixNode.current && !suffixNode.current) {\n return;\n }\n const prefixNodeWidth = prefixNode?.current?.offsetWidth;\n const suffixNodeWidth = suffixNode?.current?.offsetWidth;\n\n if (isNil(prefixNodeWidth) && isNil(suffixNodeWidth)) {\n return;\n }\n\n if (prefixNodeWidth) {\n setPrefixGutter(prefixNodeWidth);\n }\n\n if (suffixNodeWidth) {\n setSuffixGutter(suffixNodeWidth);\n }\n };\n\n useEffect(() => {\n getAffixSize();\n }, [prefix, suffix]);\n\n const remToPxConvertion = (pixel: number) => 0.0625 * pixel;\n\n const affixGutterStyle = () => {\n const leftGutter = `${remToPxConvertion(prefixGutter) + 1}rem`;\n const rightGutter = `${remToPxConvertion(suffixGutter) + 1}rem`;\n const gutterStyle: {\n paddingLeft?: string;\n paddingRight?: string;\n } = {};\n\n if (direction === \"ltr\") {\n if (prefix) {\n gutterStyle.paddingLeft = leftGutter;\n }\n\n if (suffix) {\n gutterStyle.paddingRight = rightGutter;\n }\n }\n\n if (direction === \"rtl\") {\n if (prefix) {\n gutterStyle.paddingRight = leftGutter;\n }\n\n if (suffix) {\n gutterStyle.paddingLeft = rightGutter;\n }\n }\n\n return gutterStyle;\n };\n\n const inputProps = {\n // Sem estilo do template, mas com as classes de quem chamou: `unstyle`\n // remove a aparência padrão, não o className.\n className: !unstyle ? inputClass : className,\n disabled,\n type,\n ref,\n ...rest,\n };\n\n if (disallowWhitespaceOnly && type === \"text\") {\n inputProps.pattern = \"\\\\S(?!\\\\s*$).*\"; \n inputProps.title = \"Este campo não pode conter apenas espaços.\"; \n }\n\n const renderTextArea = (\n <textarea\n style={style}\n rows={rows}\n {...(inputProps as ClassAttributes<HTMLTextAreaElement>)}\n ></textarea>\n );\n\n const renderInput = (\n <Component style={{ ...affixGutterStyle(), ...style }} {...inputProps} />\n );\n\n const renderAffixInput = (\n <span className={inputWrapperClass}>\n {prefix ? (\n <div ref={prefixNode} className=\"input-suffix-start\">\n {\" \"}\n {prefix}{\" \"}\n </div>\n ) : null}\n {renderInput}\n {suffix ? (\n <div ref={suffixNode} className=\"input-suffix-end\">\n {suffix}\n </div>\n ) : null}\n </span>\n );\n\n const renderChildren = () => {\n if (textArea) {\n return renderTextArea;\n }\n\n if (prefix || suffix) {\n return renderAffixInput;\n } else {\n return renderInput;\n }\n };\n\n return renderChildren();\n};\n\nexport default Input;\n"],"names":[],"mappings":";;;;;;;;;AAqCA,MAAM,QAAQ,C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AAA,GAAoB,GAAG,SAAU,GAAG,WAAA,CAAY;AAGzE,QAAM,mBACJ,qBAAC,QAAA,EAAK,WAAW,mBACd,UAAA;AAAA,IAAA,SACC,qBAAC,OAAA,EAAI,KAAK,YAAY,WAAU,sBAC7B,UAAA;AAAA,MAAA;AAAA,MACA;AAAA,MAAQ;AAAA,IAAA,EAAA,CACX,IACE;AAAA,IACH;AAAA,IACA,6BACE,OAAA,EAAI,KAAK,YAAY,WAAU,oBAC7B,kBACH,IACE;AAAA,EAAA,GACN;AAGF,QAAM,iBAAiB,MAAM;AAC3B,QAAI,UAAU;AACZ,aAAO;AAAA,IACT;AAEA,QAAI,UAAU,QAAQ;AACpB,aAAO;AAAA,IACT,OAAO;AACL,aAAO;AAAA,IACT;AAAA,EACF;AAEA,SAAO,eAAA;AACT;"}
1
+ {"version":3,"file":"Input.js","sources":["../../../../../lib/@ecme/components/ui/Input/Input.tsx"],"sourcesContent":["import { useState, useEffect, useRef } from \"react\";\nimport classNames from \"classnames\";\nimport { useConfig } from \"../ConfigProvider\";\nimport { useForm, useFormItem } from \"../Form/context\";\nimport { useInputGroup } from \"../InputGroup/context\";\nimport { CONTROL_SIZES } from \"../utils/constants\";\nimport isNil from \"lodash/isNil\";\nimport type { CommonProps, TypeAttributes } from \"../@types/common\";\nimport type {\n InputHTMLAttributes,\n ElementType,\n ReactNode,\n HTMLInputTypeAttribute,\n ClassAttributes,\n Ref,\n} from \"react\";\n\nexport interface InputProps\n extends CommonProps,\n Omit<\n InputHTMLAttributes<HTMLInputElement | HTMLTextAreaElement>,\n \"size\" | \"prefix\"\n > {\n asElement?: ElementType;\n disabled?: boolean;\n invalid?: boolean;\n prefix?: string | ReactNode;\n rows?: number;\n ref?: Ref<ElementType | HTMLInputElement | HTMLTextAreaElement>;\n size?: TypeAttributes.ControlSize;\n suffix?: string | ReactNode;\n textArea?: boolean;\n type?: HTMLInputTypeAttribute;\n unstyle?: boolean;\n disallowWhitespaceOnly?: boolean;\n}\n\nconst Input = (props: InputProps) => {\n const {\n asElement: Component = \"input\",\n className,\n disabled,\n invalid,\n prefix,\n size,\n suffix,\n textArea,\n type = \"text\",\n ref,\n rows,\n style,\n unstyle = false,\n disallowWhitespaceOnly = false,\n ...rest\n } = props;\n\n const [prefixGutter, setPrefixGutter] = useState(0);\n const [suffixGutter, setSuffixGutter] = useState(0);\n\n const { controlSize, direction } = useConfig();\n const formControlSize = useForm()?.size;\n const formItemInvalid = useFormItem()?.invalid;\n const inputGroupSize = useInputGroup()?.size;\n\n const inputSize = size || inputGroupSize || formControlSize || controlSize;\n\n const isInputInvalid = invalid || formItemInvalid;\n\n const fixControlledValue = (\n val: string | number | readonly string[] | undefined\n ) => {\n if (typeof val === \"undefined\" || val === null) {\n return \"\";\n }\n return val;\n };\n\n if (\"value\" in props) {\n rest.value = fixControlledValue(props.value);\n delete rest.defaultValue;\n }\n\n const inputDefaultClass = \"input\";\n const inputSizeClass = `input-${inputSize} ${CONTROL_SIZES[inputSize].h}`;\n const inputFocusClass = `focus:ring-primary focus-within:ring-primary focus-within:border-primary focus:border-primary`;\n const inputWrapperClass = classNames(\n \"input-wrapper\",\n prefix || suffix ? className : \"\"\n );\n const inputClass = classNames(\n inputDefaultClass,\n !textArea && inputSizeClass,\n !isInputInvalid && inputFocusClass,\n !prefix && !suffix ? className : \"\",\n disabled && \"input-disabled\",\n isInputInvalid && \"input-invalid\",\n textArea && \"input-textarea\"\n );\n\n const prefixNode = useRef<HTMLDivElement>(null);\n const suffixNode = useRef<HTMLDivElement>(null);\n\n const getAffixSize = () => {\n if (!prefixNode.current && !suffixNode.current) {\n return;\n }\n const prefixNodeWidth = prefixNode?.current?.offsetWidth;\n const suffixNodeWidth = suffixNode?.current?.offsetWidth;\n\n if (isNil(prefixNodeWidth) && isNil(suffixNodeWidth)) {\n return;\n }\n\n if (prefixNodeWidth) {\n setPrefixGutter(prefixNodeWidth);\n }\n\n if (suffixNodeWidth) {\n setSuffixGutter(suffixNodeWidth);\n }\n };\n\n useEffect(() => {\n getAffixSize();\n }, [prefix, suffix]);\n\n const remToPxConvertion = (pixel: number) => 0.0625 * pixel;\n\n const affixGutterStyle = () => {\n const leftGutter = `${remToPxConvertion(prefixGutter) + 1}rem`;\n const rightGutter = `${remToPxConvertion(suffixGutter) + 1}rem`;\n const gutterStyle: {\n paddingLeft?: string;\n paddingRight?: string;\n } = {};\n\n if (direction === \"ltr\") {\n if (prefix) {\n gutterStyle.paddingLeft = leftGutter;\n }\n\n if (suffix) {\n gutterStyle.paddingRight = rightGutter;\n }\n }\n\n if (direction === \"rtl\") {\n if (prefix) {\n gutterStyle.paddingRight = leftGutter;\n }\n\n if (suffix) {\n gutterStyle.paddingLeft = rightGutter;\n }\n }\n\n return gutterStyle;\n };\n\n const inputProps = {\n className: !unstyle ? inputClass : \"\",\n disabled,\n type,\n ref,\n ...rest,\n };\n\n if (disallowWhitespaceOnly && type === \"text\") {\n inputProps.pattern = \"\\\\S(?!\\\\s*$).*\"; \n inputProps.title = \"Este campo não pode conter apenas espaços.\"; \n }\n\n const renderTextArea = (\n <textarea\n style={style}\n rows={rows}\n {...(inputProps as ClassAttributes<HTMLTextAreaElement>)}\n ></textarea>\n );\n\n const renderInput = (\n <Component style={{ ...affixGutterStyle(), ...style }} {...inputProps} />\n );\n\n const renderAffixInput = (\n <span className={inputWrapperClass}>\n {prefix ? (\n <div ref={prefixNode} className=\"input-suffix-start\">\n {\" \"}\n {prefix}{\" \"}\n </div>\n ) : null}\n {renderInput}\n {suffix ? (\n <div ref={suffixNode} className=\"input-suffix-end\">\n {suffix}\n </div>\n ) : null}\n </span>\n );\n\n const renderChildren = () => {\n if (textArea) {\n return renderTextArea;\n }\n\n if (prefix || suffix) {\n return renderAffixInput;\n } else {\n return renderInput;\n }\n };\n\n return renderChildren();\n};\n\nexport default Input;\n"],"names":[],"mappings":";;;;;;;;;AAqCA,MAAM,QAAQ,CAAC,UAAsB;AACnC,QAAM;AAAA,IACJ,WAAW,YAAY;AAAA,IACvB;AAA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AAK,WAAW,mBACd,UAAA;AAAA,IAAA,SACC,qBAAC,OAAA,EAAI,KAAK,YAAY,WAAU,sBAC7B,UAAA;AAAA,MAAA;AAAA,MACA;AAAA,MAAQ;AAAA,IAAA,EAAA,CACX,IACE;AAAA,IACH;AAAA,IACA,6BACE,OAAA,EAAI,KAAK,YAAY,WAAU,oBAC7B,kBACH,IACE;AAAA,EAAA,GACN;AAGF,QAAM,iBAAiB,MAAM;AAC3B,QAAI,UAAU;AACZ,aAAO;AAAA,IACT;AAEA,QAAI,UAAU,QAAQ;AACpB,aAAO;AAAA,IACT,OAAO;AACL,aAAO;AAAA,IACT;AAAA,EACF;AAEA,SAAO,eAAA;AACT;"}
@@ -12,9 +12,6 @@ const ChatBox = forwardRef((props, ref) => {
12
12
  placeholder,
13
13
  onInputChange,
14
14
  inputActions,
15
- uploadProps,
16
- executando,
17
- onStop,
18
15
  showAvatar,
19
16
  avatarGap,
20
17
  customRenderer,
@@ -38,10 +35,7 @@ const ChatBox = forwardRef((props, ref) => {
38
35
  {
39
36
  placeholder,
40
37
  onInputChange,
41
- inputActions,
42
- uploadProps,
43
- executando,
44
- onStop
38
+ inputActions
45
39
  }
46
40
  ),
47
41
  children: [
@@ -1 +1 @@
1
- {"version":3,"file":"ChatBox.js","sources":["../../../../../lib/@ecme/components/view/ChatBox/ChatBox.tsx"],"sourcesContent":["import ChatContainer from './components/ChatContainer'\nimport MessageList from './components/MessageList'\nimport ChatInput from './components/ChatInput'\nimport type { MessageListProps } from './components/MessageList'\nimport type { ChatContainerProps } from './components/ChatContainer'\nimport type { ChatInputProps } from './components/ChatInput'\nimport type { ReactNode } from 'react'\nimport { forwardRef } from 'react'\nimport type { ScrollBarRef } from '@/components/ui/ScrollBar'\n\nexport type MessageList = MessageListProps['list']\n\nexport type ChatBoxProps = {\n messageList: MessageList\n header?: ChatContainerProps['header']\n showMessageList?: boolean\n children?: ReactNode\n containerClass?: string\n} & Omit<MessageListProps, 'list'> &\n ChatInputProps\n\nconst ChatBox = forwardRef<ScrollBarRef, ChatBoxProps>((props, ref) => {\n const {\n messageList,\n showMessageList = true,\n children,\n header,\n placeholder,\n onInputChange,\n inputActions,\n uploadProps,\n executando,\n onStop,\n showAvatar,\n avatarGap,\n customRenderer,\n customAction,\n bubbleClass,\n myBubbleClass,\n botBubbleClass,\n errorBubbleClass,\n renderTyping,\n typing,\n messageListClass,\n containerClass,\n } = props\n\n return (\n <ChatContainer\n className={containerClass}\n header={header}\n input={\n <ChatInput\n placeholder={placeholder}\n onInputChange={onInputChange}\n inputActions={inputActions}\n uploadProps={uploadProps}\n executando={executando}\n onStop={onStop}\n />\n }\n >\n {showMessageList && (\n <MessageList\n ref={ref}\n list={messageList}\n showAvatar={showAvatar}\n avatarGap={avatarGap}\n customRenderer={customRenderer}\n customAction={customAction}\n typing={typing}\n messageListClass={messageListClass}\n bubbleClass={bubbleClass}\n myBubbleClass={myBubbleClass}\n botBubbleClass={botBubbleClass}\n errorBubbleClass={errorBubbleClass}\n renderTyping={renderTyping}\n /> )}\n {children}\n </ChatContainer>\n )\n})\n\nChatBox.displayName = 'ChatBox'\n\nexport default ChatBox\n"],"names":[],"mappings":";;;;;AAqBA,MAAM,UAAU,WAAuC,CAAC,OAAO,QAAQ;AACnE,QAAM;AAAA,IACF;AAAA,IACA,kBAAkB;AAAA,IAClB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EAAA,IACA;AAEJ,SACI;AAAA,IAAC;AAAA,IAAA;AAAA,MACG,WAAW;AAAA,MACX;AAAA,MACA,OACI;AAAA,QAAC;AAAA,QAAA;AAAA,UACG;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,QAAA;AAAA,MAAA;AAAA,MAIP,UAAA;AAAA,QAAA,mBACG;AAAA,UAAC;AAAA,UAAA;AAAA,YACG;AAAA,YACA,MAAM;AAAA,YACN;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,UAAA;AAAA,QAAA;AAAA,QAEP;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGb,CAAC;AAED,QAAQ,cAAc;"}
1
+ {"version":3,"file":"ChatBox.js","sources":["../../../../../lib/@ecme/components/view/ChatBox/ChatBox.tsx"],"sourcesContent":["import ChatContainer from './components/ChatContainer'\nimport MessageList from './components/MessageList'\nimport ChatInput from './components/ChatInput'\nimport type { MessageListProps } from './components/MessageList'\nimport type { ChatContainerProps } from './components/ChatContainer'\nimport type { ChatInputProps } from './components/ChatInput'\nimport type { ReactNode } from 'react'\nimport { forwardRef } from 'react'\nimport type { ScrollBarRef } from '@/components/ui/ScrollBar'\n\nexport type MessageList = MessageListProps['list']\n\nexport type ChatBoxProps = {\n messageList: MessageList\n header?: ChatContainerProps['header']\n showMessageList?: boolean\n children?: ReactNode\n containerClass?: string\n} & Omit<MessageListProps, 'list'> &\n ChatInputProps\n\nconst ChatBox = forwardRef<ScrollBarRef, ChatBoxProps>((props, ref) => {\n const {\n messageList,\n showMessageList = true,\n children,\n header,\n placeholder,\n onInputChange,\n inputActions,\n showAvatar,\n avatarGap,\n customRenderer,\n customAction,\n bubbleClass,\n myBubbleClass,\n botBubbleClass,\n errorBubbleClass,\n renderTyping,\n typing,\n messageListClass,\n containerClass,\n } = props\n\n return (\n <ChatContainer\n className={containerClass}\n header={header}\n input={\n <ChatInput\n placeholder={placeholder}\n onInputChange={onInputChange}\n inputActions={inputActions}\n />\n }\n >\n {showMessageList && (\n <MessageList\n ref={ref}\n list={messageList}\n showAvatar={showAvatar}\n avatarGap={avatarGap}\n customRenderer={customRenderer}\n customAction={customAction}\n typing={typing}\n messageListClass={messageListClass}\n bubbleClass={bubbleClass}\n myBubbleClass={myBubbleClass}\n botBubbleClass={botBubbleClass}\n errorBubbleClass={errorBubbleClass}\n renderTyping={renderTyping}\n /> )}\n {children}\n </ChatContainer>\n )\n})\n\nChatBox.displayName = 'ChatBox'\n\nexport default ChatBox\n"],"names":[],"mappings":";;;;;AAqBA,MAAM,UAAU,WAAuC,CAAC,OAAO,QAAQ;AACnE,QAAM;AAAA,IACF;AAAA,IACA,kBAAkB;AAAA,IAClB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EAAA,IACA;AAEJ,SACI;AAAA,IAAC;AAAA,IAAA;AAAA,MACG,WAAW;AAAA,MACX;AAAA,MACA,OACI;AAAA,QAAC;AAAA,QAAA;AAAA,UACG;AAAA,UACA;AAAA,UACA;AAAA,QAAA;AAAA,MAAA;AAAA,MAIP,UAAA;AAAA,QAAA,mBACG;AAAA,UAAC;AAAA,UAAA;AAAA,YACG;AAAA,YACA,MAAM;AAAA,YACN;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,UAAA;AAAA,QAAA;AAAA,QAEP;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGb,CAAC;AAED,QAAQ,cAAc;"}
@@ -1,121 +1,88 @@
1
1
  import { jsxs, jsx, Fragment } from "react/jsx-runtime";
2
2
  import { useState, useRef } from "react";
3
3
  import "../../../ui/Button/index.js";
4
- import "../../../ui/Input/index.js";
5
4
  import "../../../ui/Upload/index.js";
6
5
  import hooks from "../../../ui/hooks/index.js";
7
- import { TbPhotoPlus, TbPlayerStopFilled, TbArrowRight } from "react-icons/tb";
6
+ import { TbPhotoPlus, TbArrowRight } from "react-icons/tb";
8
7
  import Upload from "../../../ui/Upload/Upload.js";
9
- import Input from "../../../ui/Input/Input.js";
10
8
  import Button from "../../../ui/Button/Button.js";
11
9
  const { useMergeRef } = hooks;
12
- const CLASSES_DO_TEXTAREA = "w-full max-h-[6.25rem] resize-none overflow-y-auto bg-transparent p-0 leading-5 heading-text placeholder:text-gray-400 focus:outline-none";
13
10
  const ChatInput = (props) => {
14
11
  const [attachments, setAttachments] = useState([]);
15
- const {
16
- placeholder,
17
- onInputChange,
18
- ref = null,
19
- inputActions,
20
- uploadProps,
21
- executando = false,
22
- onStop
23
- } = props;
12
+ const { placeholder, onInputChange, ref = null, inputActions } = props;
24
13
  const inputRef = useRef(null);
25
- const ajustarAltura = (el) => {
26
- el.style.height = "auto";
27
- el.style.height = `${el.scrollHeight}px`;
28
- };
29
14
  const handleInputClear = () => {
30
15
  if (inputRef.current) {
31
16
  inputRef.current.value = "";
32
- inputRef.current.style.height = "";
33
17
  }
34
18
  setAttachments([]);
35
19
  };
36
- const enviar = () => {
37
- const value = inputRef.current?.value ?? "";
38
- if (!value.trim() && attachments.length === 0) {
39
- return;
20
+ const handleChange = () => {
21
+ if (inputRef.current?.value) {
22
+ onInputChange?.({
23
+ value: inputRef.current?.value || "",
24
+ attachments
25
+ });
26
+ handleInputClear();
40
27
  }
41
- onInputChange?.({ value, attachments });
42
- handleInputClear();
43
28
  };
44
29
  const handleKeyDown = (event) => {
45
- if (event.key === "Enter" && !event.shiftKey && !event.nativeEvent.isComposing) {
46
- event.preventDefault();
47
- if (!executando) {
48
- enviar();
49
- }
30
+ if (event.key === "Enter") {
31
+ onInputChange?.({
32
+ value: inputRef.current?.value || "",
33
+ attachments
34
+ });
35
+ handleInputClear();
50
36
  }
51
37
  };
52
- return /* @__PURE__ */ jsxs("div", { className: "shrink-0 border-2 border-gray-200 dark:border-gray-700 rounded-xl px-3 py-2 flex flex-col gap-1.5 transition-colors focus-within:border-gray-400 dark:focus-within:border-gray-500", children: [
38
+ return /* @__PURE__ */ jsxs("div", { className: "border-2 border-gray-200 dark:border-gray-700 rounded-xl min-h-[50px] px-3 flex flex-col", children: [
53
39
  attachments.length > 0 && /* @__PURE__ */ jsx(
54
40
  Upload,
55
41
  {
56
42
  fileList: attachments,
57
- fileListClass: "mt-0 flex flex-wrap gap-2",
43
+ fileListClass: "flex gap-4",
58
44
  fileItemClass: "flex gap-8",
59
45
  onFileRemove: setAttachments,
60
46
  children: /* @__PURE__ */ jsx(Fragment, {})
61
47
  }
62
48
  ),
63
- /* @__PURE__ */ jsx(
64
- Input,
65
- {
66
- ref: useMergeRef(inputRef, ref),
67
- textArea: true,
68
- unstyle: true,
69
- rows: 1,
70
- placeholder,
71
- onKeyDown: handleKeyDown,
72
- onChange: (event) => ajustarAltura(event.currentTarget),
73
- className: CLASSES_DO_TEXTAREA
74
- }
75
- ),
76
- /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 w-full", children: [
49
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 w-full h-[50px]", children: [
77
50
  /* @__PURE__ */ jsx(
78
51
  Upload,
79
52
  {
80
- ...uploadProps,
81
53
  fileList: attachments,
82
54
  showList: false,
83
55
  onChange: setAttachments,
84
56
  children: /* @__PURE__ */ jsx(
85
57
  "button",
86
58
  {
87
- className: "text-xl heading-text enabled:hover:text-primary disabled:cursor-not-allowed disabled:opacity-40 px-1 py-2",
59
+ className: "text-xl heading-text hover:text-primary px-1 py-2",
88
60
  type: "button",
89
- disabled: uploadProps?.disabled,
90
61
  children: /* @__PURE__ */ jsx(TbPhotoPlus, {})
91
62
  }
92
63
  )
93
64
  }
94
65
  ),
95
- inputActions,
96
- /* @__PURE__ */ jsx("div", { className: "ltr:ml-auto rtl:mr-auto shrink-0", children: executando ? /* @__PURE__ */ jsx(
97
- Button,
66
+ /* @__PURE__ */ jsx(
67
+ "input",
98
68
  {
99
- size: "xs",
100
- shape: "circle",
101
- variant: "solid",
102
- icon: /* @__PURE__ */ jsx(TbPlayerStopFilled, {}),
103
- "aria-label": "Parar a resposta",
104
- title: "Parar a resposta",
105
- onClick: onStop
69
+ ref: useMergeRef(inputRef, ref),
70
+ className: "flex-1 h-full placeholder:text-gray-400 bg-transparent focus:outline-none heading-text",
71
+ placeholder,
72
+ onKeyDown: handleKeyDown
106
73
  }
107
- ) : /* @__PURE__ */ jsx(
74
+ ),
75
+ inputActions,
76
+ /* @__PURE__ */ jsx(
108
77
  Button,
109
78
  {
110
79
  size: "xs",
111
80
  shape: "circle",
112
81
  variant: "solid",
113
82
  icon: /* @__PURE__ */ jsx(TbArrowRight, {}),
114
- "aria-label": "Enviar",
115
- title: "Enviar",
116
- onClick: enviar
83
+ onClick: handleChange
117
84
  }
118
- ) })
85
+ )
119
86
  ] })
120
87
  ] });
121
88
  };
@@ -1 +1 @@
1
- {"version":3,"file":"ChatInput.js","sources":["../../../../../../lib/@ecme/components/view/ChatBox/components/ChatInput.tsx"],"sourcesContent":["import { useState, useRef } from 'react'\nimport Button from '@/components/ui/Button'\nimport Input from '@/components/ui/Input'\nimport Upload from '@/components/ui/Upload'\nimport hooks from '@/components/ui/hooks'\nimport { TbPhotoPlus, TbArrowRight, TbPlayerStopFilled } from 'react-icons/tb'\nimport type { UploadProps } from '@/components/ui/Upload'\nimport type { KeyboardEvent, ReactNode, Ref } from 'react'\n\nexport type ChatInputProps = {\n placeholder?: string\n onInputChange?: (payload: { value: string; attachments: File[] }) => void\n ref?: Ref<HTMLTextAreaElement>\n /** Controles extras dentro da caixa, logo antes do botão de enviar. */\n inputActions?: ReactNode\n /** Restrições do seletor de anexos (tipos aceitos, validação e bloqueio). */\n uploadProps?: Pick<UploadProps, 'accept' | 'beforeUpload' | 'disabled'>\n /**\n * Uma resposta está chegando: o botão de enviar vira o de parar, e o Enter\n * não envia — senão abriria uma segunda resposta na mesma conversa. O texto\n * digitado fica na caixa para depois.\n */\n executando?: boolean\n /** Para a resposta que está chegando. */\n onStop?: () => void\n}\n\nconst { useMergeRef } = hooks\n\n/**\n * A altura inicial é `rows={1}`. Daí cresce com o conteúdo até o `max-h` de\n * 5 linhas de 20px (`leading-5`, o ritmo do texto de 14px do app); passando\n * disso, o próprio textarea rola.\n */\nconst CLASSES_DO_TEXTAREA =\n 'w-full max-h-[6.25rem] resize-none overflow-y-auto bg-transparent p-0 leading-5 heading-text placeholder:text-gray-400 focus:outline-none'\n\nconst ChatInput = (props: ChatInputProps) => {\n const [attachments, setAttachments] = useState<File[]>([])\n\n const {\n placeholder,\n onInputChange,\n ref = null,\n inputActions,\n uploadProps,\n executando = false,\n onStop,\n } = props\n\n const inputRef = useRef<HTMLTextAreaElement>(null)\n\n /** Cresce com o conteúdo; o `max-h` do textarea é o limite. */\n const ajustarAltura = (el: HTMLInputElement | HTMLTextAreaElement) => {\n el.style.height = 'auto'\n el.style.height = `${el.scrollHeight}px`\n }\n\n const handleInputClear = () => {\n if (inputRef.current) {\n inputRef.current.value = ''\n // Volta para a altura de uma linha.\n inputRef.current.style.height = ''\n }\n setAttachments([])\n }\n\n /** Envia texto, anexos ou os dois; com a caixa vazia não faz nada. */\n const enviar = () => {\n const value = inputRef.current?.value ?? ''\n if (!value.trim() && attachments.length === 0) {\n return\n }\n onInputChange?.({ value, attachments })\n handleInputClear()\n }\n\n const handleKeyDown = (\n event: KeyboardEvent<HTMLInputElement | HTMLTextAreaElement>,\n ) => {\n // Enter envia; Shift+Enter quebra linha. Composição de IME (acentos)\n // não envia: o Enter ali está confirmando o caractere.\n if (\n event.key === 'Enter' &&\n !event.shiftKey &&\n !event.nativeEvent.isComposing\n ) {\n event.preventDefault()\n if (!executando) {\n enviar()\n }\n }\n }\n\n return (\n <div className=\"shrink-0 border-2 border-gray-200 dark:border-gray-700 rounded-xl px-3 py-2 flex flex-col gap-1.5 transition-colors focus-within:border-gray-400 dark:focus-within:border-gray-500\">\n {attachments.length > 0 && (\n <Upload\n fileList={attachments}\n fileListClass=\"mt-0 flex flex-wrap gap-2\"\n fileItemClass=\"flex gap-8\"\n onFileRemove={setAttachments}\n >\n <></>\n </Upload>\n )}\n <Input\n ref={useMergeRef(inputRef, ref)}\n textArea\n unstyle\n rows={1}\n placeholder={placeholder}\n onKeyDown={handleKeyDown}\n onChange={(event) => ajustarAltura(event.currentTarget)}\n className={CLASSES_DO_TEXTAREA}\n />\n <div className=\"flex items-center gap-2 w-full\">\n <Upload\n {...uploadProps}\n fileList={attachments}\n showList={false}\n onChange={setAttachments}\n >\n <button\n className=\"text-xl heading-text enabled:hover:text-primary disabled:cursor-not-allowed disabled:opacity-40 px-1 py-2\"\n type=\"button\"\n disabled={uploadProps?.disabled}\n >\n <TbPhotoPlus />\n </button>\n </Upload>\n {inputActions}\n <div className=\"ltr:ml-auto rtl:mr-auto shrink-0\">\n {executando ? (\n <Button\n size=\"xs\"\n shape=\"circle\"\n variant=\"solid\"\n icon={<TbPlayerStopFilled />}\n aria-label=\"Parar a resposta\"\n title=\"Parar a resposta\"\n onClick={onStop}\n />\n ) : (\n <Button\n size=\"xs\"\n shape=\"circle\"\n variant=\"solid\"\n icon={<TbArrowRight />}\n aria-label=\"Enviar\"\n title=\"Enviar\"\n onClick={enviar}\n />\n )}\n </div>\n </div>\n </div>\n )\n}\n\nexport default ChatInput\n"],"names":[],"mappings":";;;;;;;;;;AA2BA,MAAM,EAAE,gBAAgB;AAOxB,MAAM,sBACF;AAEJ,MAAM,YAAY,CAAC,UAA0B;AACzC,QAAM,CAAC,aAAa,cAAc,IAAI,SAAiB,CAAA,CAAE;AAEzD,QAAM;AAAA,IACF;AAAA,IACA;AAAA,IACA,MAAM;AAAA,IACN;AAAA,IACA;AAAA,IACA,aAAa;AAAA,IACb;AAAA,EAAA,IACA;AAEJ,QAAM,WAAW,OAA4B,IAAI;AAGjD,QAAM,gBAAgB,CAAC,OAA+C;AAClE,OAAG,MAAM,SAAS;AAClB,OAAG,MAAM,SAAS,GAAG,GAAG,YAAY;AAAA,EACxC;AAEA,QAAM,mBAAmB,MAAM;AAC3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aAAa;AAAA,cAEvB,8BAAC,aAAA,CAAA,CAAY;AAAA,YAAA;AAAA,UAAA;AAAA,QACjB;AAAA,MAAA;AAAA,MAEH;AAAA,MACD,oBAAC,OAAA,EAAI,WAAU,oCACV,UAAA,aACG;AAAA,QAAC;AAAA,QAAA;AAAA,UACG,MAAK;AAAA,UACL,OAAM;AAAA,UACN,SAAQ;AAAA,UACR,0BAAO,oBAAA,EAAmB;AAAA,UAC1B,cAAW;AAAA,UACX,OAAM;AAAA,UACN,SAAS;AAAA,QAAA;AAAA,MAAA,IAGb;AAAA,QAAC;AAAA,QAAA;AAAA,UACG,MAAK;AAAA,UACL,OAAM;AAAA,UACN,SAAQ;AAAA,UACR,0BAAO,cAAA,EAAa;AAAA,UACpB,cAAW;AAAA,UACX,OAAM;AAAA,UACN,SAAS;AAAA,QAAA;AAAA,MAAA,EACb,CAER;AAAA,IAAA,EAAA,CACJ;AAAA,EAAA,GACJ;AAER;"}
1
+ {"version":3,"file":"ChatInput.js","sources":["../../../../../../lib/@ecme/components/view/ChatBox/components/ChatInput.tsx"],"sourcesContent":["import { useState, useRef } from 'react'\nimport Button from '@/components/ui/Button'\nimport Upload from '@/components/ui/Upload'\nimport hooks from '@/components/ui/hooks'\nimport { TbPhotoPlus, TbArrowRight } from 'react-icons/tb'\nimport type { KeyboardEvent, ReactNode, Ref } from 'react'\n\nexport type ChatInputProps = {\n placeholder?: string\n onInputChange?: (payload: { value: string; attachments: File[] }) => void\n ref?: Ref<HTMLInputElement>\n /** Controles extras dentro da caixa, logo antes do botão de enviar. */\n inputActions?: ReactNode\n}\n\nconst { useMergeRef } = hooks\n\nconst ChatInput = (props: ChatInputProps) => {\n const [attachments, setAttachments] = useState<File[]>([])\n\n const { placeholder, onInputChange, ref = null, inputActions } = props\n\n const inputRef = useRef<HTMLInputElement>(null)\n\n const handleInputClear = () => {\n if (inputRef.current) {\n inputRef.current.value = ''\n }\n setAttachments([])\n }\n\n const handleChange = () => {\n if (inputRef.current?.value) {\n onInputChange?.({\n value: inputRef.current?.value || '',\n attachments,\n })\n handleInputClear()\n }\n }\n\n const handleKeyDown = (event: KeyboardEvent<HTMLInputElement>) => {\n if (event.key === 'Enter') {\n onInputChange?.({\n value: inputRef.current?.value || '',\n attachments,\n })\n handleInputClear()\n }\n }\n\n return (\n <div className=\"border-2 border-gray-200 dark:border-gray-700 rounded-xl min-h-[50px] px-3 flex flex-col\">\n {attachments.length > 0 && (\n <Upload\n fileList={attachments}\n fileListClass=\"flex gap-4\"\n fileItemClass=\"flex gap-8\"\n onFileRemove={setAttachments}\n >\n <></>\n </Upload>\n )}\n <div className=\"flex items-center gap-2 w-full h-[50px]\">\n <Upload\n fileList={attachments}\n showList={false}\n onChange={setAttachments}\n >\n <button\n className=\"text-xl heading-text hover:text-primary px-1 py-2\"\n type=\"button\"\n >\n <TbPhotoPlus />\n </button>\n </Upload>\n <input\n ref={useMergeRef(inputRef, ref)}\n className=\"flex-1 h-full placeholder:text-gray-400 bg-transparent focus:outline-none heading-text\"\n placeholder={placeholder}\n onKeyDown={handleKeyDown}\n />\n {inputActions}\n <Button\n size=\"xs\"\n shape=\"circle\"\n variant=\"solid\"\n icon={<TbArrowRight />}\n onClick={handleChange}\n />\n </div>\n </div>\n )\n}\n\nexport default ChatInput\n"],"names":[],"mappings":";;;;;;;;AAeA,MAAM,EAAE,gBAAgB;AAExB,MAAM,YAAY,CAAC,UAA0B;AACzC,QAAM,CAAC,aAAa,cAAc,IAAI,SAAiB,CAAA,CAAE;AAEzD,QAAM,EAAE,aAAa,eAAe,MAAM,MAAM,iBAAiB;AAEjE,QAAM,WAAW,OAAyB,IAAI;AAE9C,QAAM,mBAAmB,MAAM;AAC3B,QAAI,SAAS,SAAS;AAClB,eAAS,QAAQ,QAAQ;AAAA,IAC7B;AACA,mBAAe,CAAA,CAAE;AAAA,EACrB;AAEA,QAAM,eAAe,MAAM;AACvB,QAAI,SAAS,SAAS,OAAO;AACzB,sBAAgB;AAAA,QACZ,OAAO,SAAS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14
- area: "Area"
14
+ area: "Area",
15
+ configuracaoNotificacao: "Notification Settings"
15
16
  },
16
17
  mock: {
17
18
  title: "Mock Module",
@@ -1 +1 @@
1
- {"version":3,"file":"nav.js","sources":["../../../../../lib/@ecme/locales/lang/en/nav.ts"],"sourcesContent":["import docusign from '@base/locales/lang/en/modules/docusign/docusign.nav'\n\nexport default {\n nav: {\n modules: {\n title: 'Modules',\n adm: {\n title: 'Administration',\n users: 'Users',\n roles: 'Roles',\n tarefasAgendadas: 'Scheduled Tasks'\n },\n dadosMestres: {\n infoProdutor: 'Info Record',\n area: 'Area',\n },\n mock: {\n title: 'Mock Module',\n dashboard: 'Dashboard',\n reports: 'Reports',\n },\n originacao: {\n relatorios: {\n title: 'Reports',\n relatorioAuditoriaMensal: {\n title: 'Monthly Audit Report',\n }\n }\n },\n ...docusign,\n },\n },\n}\n"],"names":[],"mappings":";AAEA,MAAA,MAAe;AAAA,EACX,KAAK;AAAA,IACD,SAAS;AAAA,MACL,OAAO;AAAA,MACP,KAAK;AAAA,QACD,OAAO;AAAA,QACP,OAAO;AAAA,QACP,OAAO;AAAA,QACP,kBAAkB;AAAA,MAAA;AAAA,MAEtB,cAAc;AAAA,QACV,cAAc;AAAA,QACd,MAAM;AAAA,MAAA;AAAA,MAEV,MAAM;AAAA,QACF,OAAO;AAAA,QACP,WAAW;AAAA,QACX,SAAS;AAAA,MAAA;AAAA,MAEb,YAAY;AAAA,QACR,YAAY;AAAA,UACR,OAAO;AAAA,UACP,0BAA0B;AAAA,YACtB,OAAO;AAAA,UAAA;AAAA,QACX;AAAA,MACJ;AAAA,MAEJ,GAAG;AAAA,IAAA;AAAA,EACP;AAER;"}
1
+ {"version":3,"file":"nav.js","sources":["../../../../../lib/@ecme/locales/lang/en/nav.ts"],"sourcesContent":["import docusign from '@base/locales/lang/en/modules/docusign/docusign.nav'\n\nexport default {\n nav: {\n modules: {\n title: 'Modules',\n adm: {\n title: 'Administration',\n users: 'Users',\n roles: 'Roles',\n tarefasAgendadas: 'Scheduled Tasks'\n },\n dadosMestres: {\n infoProdutor: 'Info Record',\n area: 'Area',\n configuracaoNotificacao: 'Notification Settings',\n },\n mock: {\n title: 'Mock Module',\n dashboard: 'Dashboard',\n reports: 'Reports',\n },\n originacao: {\n relatorios: {\n title: 'Reports',\n relatorioAuditoriaMensal: {\n title: 'Monthly Audit Report',\n }\n }\n },\n ...docusign,\n },\n },\n}\n"],"names":[],"mappings":";AAEA,MAAA,MAAe;AAAA,EACX,KAAK;AAAA,IACD,SAAS;AAAA,MACL,OAAO;AAAA,MACP,KAAK;AAAA,QACD,OAAO;AAAA,QACP,OAAO;AAAA,QACP,OAAO;AAAA,QACP,kBAAkB;AAAA,MAAA;AAAA,MAEtB,cAAc;AAAA,QACV,cAAc;AAAA,QACd,MAAM;AAAA,QACN,yBAAyB;AAAA,MAAA;AAAA,MAE7B,MAAM;AAAA,QACF,OAAO;AAAA,QACP,WAAW;AAAA,QACX,SAAS;AAAA,MAAA;AAAA,MAEb,YAAY;AAAA,QACR,YAAY;AAAA,UACR,OAAO;AAAA,UACP,0BAA0B;AAAA,YACtB,OAAO;AAAA,UAAA;AAAA,QACX;AAAA,MACJ;AAAA,MAEJ,GAAG;AAAA,IAAA;AAAA,EACP;AAER;"}
@@ -0,0 +1,75 @@
1
+ import { jsxs, jsx } from "react/jsx-runtime";
2
+ import { forwardRef } from "react";
3
+ import ChatContainer from "../../../../../components/view/ChatBox/components/ChatContainer.js";
4
+ import MessageList from "../../../../../components/view/ChatBox/components/MessageList.js";
5
+ import AiChatInput from "./AiChatInput.js";
6
+ const AiChatBox = forwardRef((props, ref) => {
7
+ const {
8
+ messageList,
9
+ showMessageList = true,
10
+ children,
11
+ header,
12
+ placeholder,
13
+ onInputChange,
14
+ inputActions,
15
+ uploadProps,
16
+ executando,
17
+ onStop,
18
+ showAvatar,
19
+ avatarGap,
20
+ customRenderer,
21
+ customAction,
22
+ bubbleClass,
23
+ myBubbleClass,
24
+ botBubbleClass,
25
+ errorBubbleClass,
26
+ renderTyping,
27
+ typing,
28
+ messageListClass,
29
+ containerClass
30
+ } = props;
31
+ return /* @__PURE__ */ jsxs(
32
+ ChatContainer,
33
+ {
34
+ className: containerClass,
35
+ header,
36
+ input: /* @__PURE__ */ jsx(
37
+ AiChatInput,
38
+ {
39
+ placeholder,
40
+ onInputChange,
41
+ inputActions,
42
+ uploadProps,
43
+ executando,
44
+ onStop
45
+ }
46
+ ),
47
+ children: [
48
+ showMessageList && /* @__PURE__ */ jsx(
49
+ MessageList,
50
+ {
51
+ ref,
52
+ list: messageList,
53
+ showAvatar,
54
+ avatarGap,
55
+ customRenderer,
56
+ customAction,
57
+ typing,
58
+ messageListClass,
59
+ bubbleClass,
60
+ myBubbleClass,
61
+ botBubbleClass,
62
+ errorBubbleClass,
63
+ renderTyping
64
+ }
65
+ ),
66
+ children
67
+ ]
68
+ }
69
+ );
70
+ });
71
+ AiChatBox.displayName = "AiChatBox";
72
+ export {
73
+ AiChatBox as default
74
+ };
75
+ //# sourceMappingURL=AiChatBox.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AiChatBox.js","sources":["../../../../../../../lib/@ecme/views/concepts/ai/Chat/components/AiChatBox.tsx"],"sourcesContent":["import { forwardRef } from 'react'\nimport ChatContainer from '@/components/view/ChatBox/components/ChatContainer'\nimport MessageList from '@/components/view/ChatBox/components/MessageList'\nimport AiChatInput from './AiChatInput'\nimport type { ReactNode } from 'react'\nimport type { ChatContainerProps } from '@/components/view/ChatBox/components/ChatContainer'\nimport type { MessageListProps } from '@/components/view/ChatBox/components/MessageList'\nimport type { ScrollBarRef } from '@/components/ui/ScrollBar'\nimport type { AiChatInputProps } from './AiChatInput'\n\n/**\n * O ChatBox do Orbe AI: a lista de mensagens com a caixa de mensagem própria.\n *\n * Cópia do `ChatBox` (`@/components/view/ChatBox`) que troca só a caixa de\n * mensagem pela `AiChatInput`. O container (`ChatContainer`) e a lista\n * (`MessageList`) continuam sendo os originais, sem alteração.\n *\n * É uma cópia de propósito: o ChatBox original é usado fora do chat (o chat de\n * template e os microfrontends que consomem o client-core) e não pode mudar\n * por causa do Orbe AI.\n */\nexport type AiChatBoxProps = {\n messageList: MessageListProps['list']\n header?: ChatContainerProps['header']\n showMessageList?: boolean\n children?: ReactNode\n containerClass?: string\n} & Omit<MessageListProps, 'list'> &\n AiChatInputProps\n\nconst AiChatBox = forwardRef<ScrollBarRef, AiChatBoxProps>((props, ref) => {\n const {\n messageList,\n showMessageList = true,\n children,\n header,\n placeholder,\n onInputChange,\n inputActions,\n uploadProps,\n executando,\n onStop,\n showAvatar,\n avatarGap,\n customRenderer,\n customAction,\n bubbleClass,\n myBubbleClass,\n botBubbleClass,\n errorBubbleClass,\n renderTyping,\n typing,\n messageListClass,\n containerClass,\n } = props\n\n return (\n <ChatContainer\n className={containerClass}\n header={header}\n input={\n <AiChatInput\n placeholder={placeholder}\n onInputChange={onInputChange}\n inputActions={inputActions}\n uploadProps={uploadProps}\n executando={executando}\n onStop={onStop}\n />\n }\n >\n {showMessageList && (\n <MessageList\n ref={ref}\n list={messageList}\n showAvatar={showAvatar}\n avatarGap={avatarGap}\n customRenderer={customRenderer}\n customAction={customAction}\n typing={typing}\n messageListClass={messageListClass}\n bubbleClass={bubbleClass}\n myBubbleClass={myBubbleClass}\n botBubbleClass={botBubbleClass}\n errorBubbleClass={errorBubbleClass}\n renderTyping={renderTyping}\n />\n )}\n {children}\n </ChatContainer>\n )\n})\n\nAiChatBox.displayName = 'AiChatBox'\n\nexport default AiChatBox\n"],"names":[],"mappings":";;;;;AA8BA,MAAM,YAAY,WAAyC,CAAC,OAAO,QAAQ;AACvE,QAAM;AAAA,IACF;AAAA,IACA,kBAAkB;AAAA,IAClB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EAAA,IACA;AAEJ,SACI;AAAA,IAAC;AAAA,IAAA;AAAA,MACG,WAAW;AAAA,MACX;AAAA,MACA,OACI;AAAA,QAAC;AAAA,QAAA;AAAA,UACG;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,QAAA;AAAA,MAAA;AAAA,MAIP,UAAA;AAAA,QAAA,mBACG;AAAA,UAAC;AAAA,UAAA;AAAA,YACG;AAAA,YACA,MAAM;AAAA,YACN;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,UAAA;AAAA,QAAA;AAAA,QAGP;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGb,CAAC;AAED,UAAU,cAAc;"}
@@ -0,0 +1,121 @@
1
+ import { jsxs, jsx, Fragment } from "react/jsx-runtime";
2
+ import { useState, useRef } from "react";
3
+ import "../../../../../components/ui/Button/index.js";
4
+ import "../../../../../components/ui/Upload/index.js";
5
+ import hooks from "../../../../../components/ui/hooks/index.js";
6
+ import { TbPhotoPlus, TbPlayerStopFilled, TbArrowRight } from "react-icons/tb";
7
+ import Upload from "../../../../../components/ui/Upload/Upload.js";
8
+ import Button from "../../../../../components/ui/Button/Button.js";
9
+ const { useMergeRef } = hooks;
10
+ const CLASSES_DO_TEXTAREA = "w-full max-h-[6.25rem] resize-none overflow-y-auto bg-transparent p-0 leading-5 heading-text placeholder:text-gray-400 focus:outline-none";
11
+ const AiChatInput = (props) => {
12
+ const [attachments, setAttachments] = useState([]);
13
+ const {
14
+ placeholder,
15
+ onInputChange,
16
+ ref = null,
17
+ inputActions,
18
+ uploadProps,
19
+ executando = false,
20
+ onStop
21
+ } = props;
22
+ const inputRef = useRef(null);
23
+ const ajustarAltura = (el) => {
24
+ el.style.height = "auto";
25
+ el.style.height = `${el.scrollHeight}px`;
26
+ };
27
+ const handleInputClear = () => {
28
+ if (inputRef.current) {
29
+ inputRef.current.value = "";
30
+ inputRef.current.style.height = "";
31
+ }
32
+ setAttachments([]);
33
+ };
34
+ const enviar = () => {
35
+ const value = inputRef.current?.value ?? "";
36
+ if (!value.trim() && attachments.length === 0) {
37
+ return;
38
+ }
39
+ onInputChange?.({ value, attachments });
40
+ handleInputClear();
41
+ };
42
+ const handleKeyDown = (event) => {
43
+ if (event.key === "Enter" && !event.shiftKey && !event.nativeEvent.isComposing) {
44
+ event.preventDefault();
45
+ if (!executando) {
46
+ enviar();
47
+ }
48
+ }
49
+ };
50
+ return /* @__PURE__ */ jsxs("div", { className: "shrink-0 border-2 border-gray-200 dark:border-gray-700 rounded-xl px-3 py-2 flex flex-col gap-1.5 transition-colors focus-within:border-gray-400 dark:focus-within:border-gray-500", children: [
51
+ attachments.length > 0 && /* @__PURE__ */ jsx(
52
+ Upload,
53
+ {
54
+ fileList: attachments,
55
+ fileListClass: "mt-0 flex flex-wrap gap-2",
56
+ fileItemClass: "flex gap-8",
57
+ onFileRemove: setAttachments,
58
+ children: /* @__PURE__ */ jsx(Fragment, {})
59
+ }
60
+ ),
61
+ /* @__PURE__ */ jsx(
62
+ "textarea",
63
+ {
64
+ ref: useMergeRef(inputRef, ref),
65
+ rows: 1,
66
+ placeholder,
67
+ onKeyDown: handleKeyDown,
68
+ onChange: (event) => ajustarAltura(event.currentTarget),
69
+ className: CLASSES_DO_TEXTAREA
70
+ }
71
+ ),
72
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 w-full", children: [
73
+ /* @__PURE__ */ jsx(
74
+ Upload,
75
+ {
76
+ ...uploadProps,
77
+ fileList: attachments,
78
+ showList: false,
79
+ onChange: setAttachments,
80
+ children: /* @__PURE__ */ jsx(
81
+ "button",
82
+ {
83
+ className: "text-xl heading-text enabled:hover:text-primary disabled:cursor-not-allowed disabled:opacity-40 px-1 py-2",
84
+ type: "button",
85
+ disabled: uploadProps?.disabled,
86
+ children: /* @__PURE__ */ jsx(TbPhotoPlus, {})
87
+ }
88
+ )
89
+ }
90
+ ),
91
+ inputActions,
92
+ /* @__PURE__ */ jsx("div", { className: "ltr:ml-auto rtl:mr-auto shrink-0", children: executando ? /* @__PURE__ */ jsx(
93
+ Button,
94
+ {
95
+ size: "xs",
96
+ shape: "circle",
97
+ variant: "solid",
98
+ icon: /* @__PURE__ */ jsx(TbPlayerStopFilled, {}),
99
+ "aria-label": "Parar a resposta",
100
+ title: "Parar a resposta",
101
+ onClick: onStop
102
+ }
103
+ ) : /* @__PURE__ */ jsx(
104
+ Button,
105
+ {
106
+ size: "xs",
107
+ shape: "circle",
108
+ variant: "solid",
109
+ icon: /* @__PURE__ */ jsx(TbArrowRight, {}),
110
+ "aria-label": "Enviar",
111
+ title: "Enviar",
112
+ onClick: enviar
113
+ }
114
+ ) })
115
+ ] })
116
+ ] });
117
+ };
118
+ export {
119
+ AiChatInput as default
120
+ };
121
+ //# sourceMappingURL=AiChatInput.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AiChatInput.js","sources":["../../../../../../../lib/@ecme/views/concepts/ai/Chat/components/AiChatInput.tsx"],"sourcesContent":["import { useState, useRef } from 'react'\nimport Button from '@/components/ui/Button'\nimport Upload from '@/components/ui/Upload'\nimport hooks from '@/components/ui/hooks'\nimport { TbPhotoPlus, TbArrowRight, TbPlayerStopFilled } from 'react-icons/tb'\nimport type { UploadProps } from '@/components/ui/Upload'\nimport type { KeyboardEvent, ReactNode, Ref } from 'react'\n\n/**\n * Caixa de mensagem do Orbe AI.\n *\n * Cópia do `ChatInput` do ChatBox (`@/components/view/ChatBox/components/\n * ChatInput`), alterada só para o chat: textarea que cresce com o texto, Enter\n * envia e Shift+Enter quebra linha, botão de parar a resposta e restrições de\n * upload por modelo.\n *\n * É uma cópia de propósito: o ChatBox original é usado em outros lugares do\n * projeto e pelos microfrontends que consomem o client-core, e as mudanças do\n * chat não podem alterar a aparência nem o comportamento deles. Mudança na\n * caixa do Orbe AI vem aqui, não no original.\n */\nexport type AiChatInputProps = {\n placeholder?: string\n onInputChange?: (payload: { value: string; attachments: File[] }) => void\n ref?: Ref<HTMLTextAreaElement>\n /** Controles extras dentro da caixa, logo antes do botão de enviar. */\n inputActions?: ReactNode\n /** Restrições do seletor de anexos (tipos aceitos, validação e bloqueio). */\n uploadProps?: Pick<UploadProps, 'accept' | 'beforeUpload' | 'disabled'>\n /**\n * Uma resposta está chegando: o botão de enviar vira o de parar, e o Enter\n * não envia — senão abriria uma segunda resposta na mesma conversa. O texto\n * digitado fica na caixa para depois.\n */\n executando?: boolean\n /** Para a resposta que está chegando. */\n onStop?: () => void\n}\n\nconst { useMergeRef } = hooks\n\n/**\n * A altura inicial é `rows={1}`. Daí cresce com o conteúdo até o `max-h` de\n * 5 linhas de 20px (`leading-5`, o ritmo do texto de 14px do app); passando\n * disso, o próprio textarea rola.\n *\n * Textarea nativo, e não o `Input` do template com `unstyle`: o `Input`\n * descarta o `className` quando está sem estilo, e mudar isso nele alteraria\n * todos os inputs do projeto.\n */\nconst CLASSES_DO_TEXTAREA =\n 'w-full max-h-[6.25rem] resize-none overflow-y-auto bg-transparent p-0 leading-5 heading-text placeholder:text-gray-400 focus:outline-none'\n\nconst AiChatInput = (props: AiChatInputProps) => {\n const [attachments, setAttachments] = useState<File[]>([])\n\n const {\n placeholder,\n onInputChange,\n ref = null,\n inputActions,\n uploadProps,\n executando = false,\n onStop,\n } = props\n\n const inputRef = useRef<HTMLTextAreaElement>(null)\n\n /** Cresce com o conteúdo; o `max-h` do textarea é o limite. */\n const ajustarAltura = (el: HTMLTextAreaElement) => {\n el.style.height = 'auto'\n el.style.height = `${el.scrollHeight}px`\n }\n\n const handleInputClear = () => {\n if (inputRef.current) {\n inputRef.current.value = ''\n // Volta para a altura de uma linha.\n inputRef.current.style.height = ''\n }\n setAttachments([])\n }\n\n /** Envia texto, anexos ou os dois; com a caixa vazia não faz nada. */\n const enviar = () => {\n const value = inputRef.current?.value ?? ''\n if (!value.trim() && attachments.length === 0) {\n return\n }\n onInputChange?.({ value, attachments })\n handleInputClear()\n }\n\n const handleKeyDown = (event: KeyboardEvent<HTMLTextAreaElement>) => {\n // Enter envia; Shift+Enter quebra linha. Composição de IME (acentos)\n // não envia: o Enter ali está confirmando o caractere.\n if (\n event.key === 'Enter' &&\n !event.shiftKey &&\n !event.nativeEvent.isComposing\n ) {\n event.preventDefault()\n if (!executando) {\n enviar()\n }\n }\n }\n\n return (\n <div className=\"shrink-0 border-2 border-gray-200 dark:border-gray-700 rounded-xl px-3 py-2 flex flex-col gap-1.5 transition-colors focus-within:border-gray-400 dark:focus-within:border-gray-500\">\n {attachments.length > 0 && (\n <Upload\n fileList={attachments}\n fileListClass=\"mt-0 flex flex-wrap gap-2\"\n fileItemClass=\"flex gap-8\"\n onFileRemove={setAttachments}\n >\n <></>\n </Upload>\n )}\n <textarea\n ref={useMergeRef(inputRef, ref)}\n rows={1}\n placeholder={placeholder}\n onKeyDown={handleKeyDown}\n onChange={(event) => ajustarAltura(event.currentTarget)}\n className={CLASSES_DO_TEXTAREA}\n />\n <div className=\"flex items-center gap-2 w-full\">\n <Upload\n {...uploadProps}\n fileList={attachments}\n showList={false}\n onChange={setAttachments}\n >\n <button\n className=\"text-xl heading-text enabled:hover:text-primary disabled:cursor-not-allowed disabled:opacity-40 px-1 py-2\"\n type=\"button\"\n disabled={uploadProps?.disabled}\n >\n <TbPhotoPlus />\n </button>\n </Upload>\n {inputActions}\n <div className=\"ltr:ml-auto rtl:mr-auto shrink-0\">\n {executando ? (\n <Button\n size=\"xs\"\n shape=\"circle\"\n variant=\"solid\"\n icon={<TbPlayerStopFilled />}\n aria-label=\"Parar a resposta\"\n title=\"Parar a resposta\"\n onClick={onStop}\n />\n ) : (\n <Button\n size=\"xs\"\n shape=\"circle\"\n variant=\"solid\"\n icon={<TbArrowRight />}\n aria-label=\"Enviar\"\n title=\"Enviar\"\n onClick={enviar}\n />\n )}\n </div>\n </div>\n </div>\n )\n}\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AAAA,MAAC;AAAA,MAAA;AAAA,QACG,KAAK,YAAY,UAAU,GAAG;AAAA,QAC9B,MAAM;AAAA,QACN;AAAA,QACA,WAAW;AAAA,QACX,UAAU,CAAC,UAAU,cAAc,MAAM,aAAa;AAAA,QACtD,WAAW;AAAA,MAAA;AAAA,IAAA;AAAA,IAEf,qBAAC,OAAA,EAAI,WAAU,kCACX,UAAA;AAAA,MAAA;AAAA,QAAC;AAAA,QAAA;AAAA,UACI,GAAG;AAAA,UACJ,UAAU;AAAA,UACV,UAAU;AAAA,UACV,UAAU;AAAA,UAEV,UAAA;AAAA,YAAC;AAAA,YAAA;AAAA,cACG,WAAU;AAAA,cACV,MAAK;AAAA,cACL,UAAU,aAAa;AAAA,cAEvB,8BAAC,aAAA,CAAA,CAAY;AAAA,YAAA;AAAA,UAAA;AAAA,QACjB;AAAA,MAAA;AAAA,MAEH;AAAA,MACD,oBAAC,OAAA,EAAI,WAAU,oCACV,UAAA,aACG;AAAA,QAAC;AAAA,QAAA;AAAA,UACG,MAAK;AAAA,UACL,OAAM;AAAA,UACN,SAAQ;AAAA,UACR,0BAAO,oBAAA,EAAmB;AAAA,UAC1B,cAAW;AAAA,UACX,OAAM;AAAA,UACN,SAAS;AAAA,QAAA;AAAA,MAAA,IAGb;AAAA,QAAC;AAAA,QAAA;AAAA,UACG,MAAK;AAAA,UACL,OAAM;AAAA,UACN,SAAQ;AAAA,UACR,0BAAO,cAAA,EAAa;AAAA,UACpB,cAAW;AAAA,UACX,OAAM;AAAA,UACN,SAAS;AAAA,QAAA;AAAA,MAAA,EACb,CAER;AAAA,IAAA,EAAA,CACJ;AAAA,EAAA,GACJ;AAER;"}
@@ -1,7 +1,7 @@
1
1
  import { jsxs, jsx } from "react/jsx-runtime";
2
2
  import { useRef, useEffect, useMemo } from "react";
3
3
  import "../../../../../components/ui/Card/index.js";
4
- import "../../../../../components/view/ChatBox/index.js";
4
+ import AiChatBox from "./AiChatBox.js";
5
5
  import ChatLandingView from "./ChatLandingView.js";
6
6
  import ChatMobileNav from "./ChatMobileNav.js";
7
7
  import ChatCustomContent from "./ChatCustomContent.js";
@@ -23,7 +23,6 @@ import useChatSend from "../hooks/useChatSend.js";
23
23
  import useConversationMessages from "../hooks/useConversationMessages.js";
24
24
  import useModelos from "../hooks/useModelos.js";
25
25
  import Card from "../../../../../components/ui/Card/Card.js";
26
- import ChatBox from "../../../../../components/view/ChatBox/ChatBox.js";
27
26
  const BALAO_AGENTE = "prose rounded-xl bg-gray-100 px-5 py-2.5 text-sm text-gray-900 dark:bg-gray-700 dark:text-gray-100";
28
27
  const ChatView = ({
29
28
  showMobileNav = true,
@@ -76,7 +75,7 @@ const ChatView = ({
76
75
  return /* @__PURE__ */ jsxs(Card, { className: "flex-1 h-full", bodyClass: "h-full", children: [
77
76
  showMobileNav && /* @__PURE__ */ jsx(ChatMobileNav, {}),
78
77
  /* @__PURE__ */ jsx(
79
- ChatBox,
78
+ AiChatBox,
80
79
  {
81
80
  ref: scrollRef,
82
81
  messageList,