@box/box-ai-content-answers 0.105.0 → 0.106.0

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.
package/esm/index.js CHANGED
@@ -1,18 +1,20 @@
1
1
  import { BoxAiContentAnswers as e } from "./lib/box-ai-content-answers.js";
2
- import { AnswerContent as n } from "./lib/components/answer/answer-content.js";
3
- import { withApiWrapper as R } from "./lib/components/api-wrapper/api-wrapper.js";
4
- import { C as s } from "../chunks/clear-conversation-button.js";
5
- import { IntelligenceModal as A } from "./lib/components/modal/modal.js";
6
- import { A as f, C as m, R as C } from "../chunks/types.js";
7
- import { APP_MODE as T } from "./lib/constants.js";
2
+ import { AnswerContent as p } from "./lib/components/answer/answer-content.js";
3
+ import { withApiWrapper as s } from "./lib/components/api-wrapper/api-wrapper.js";
4
+ import { C as x } from "../chunks/clear-conversation-button.js";
5
+ import { IntelligenceModal as a } from "./lib/components/modal/modal.js";
6
+ import { usePromptFocus as A } from "./lib/hooks/usePromptFocus.js";
7
+ import { A as C, C as i, R as T } from "../chunks/types.js";
8
+ import { APP_MODE as O } from "./lib/constants.js";
8
9
  export {
9
- f as ANSWER_ERROR,
10
- T as APP_MODE,
11
- n as AnswerContent,
10
+ C as ANSWER_ERROR,
11
+ O as APP_MODE,
12
+ p as AnswerContent,
12
13
  e as BoxAiContentAnswers,
13
- m as CONTENT_ERROR,
14
- s as ClearConversationButton,
15
- A as IntelligenceModal,
16
- C as REQUEST_STATE,
17
- R as withApiWrapper
14
+ i as CONTENT_ERROR,
15
+ x as ClearConversationButton,
16
+ a as IntelligenceModal,
17
+ T as REQUEST_STATE,
18
+ A as usePromptFocus,
19
+ s as withApiWrapper
18
20
  };
@@ -0,0 +1,34 @@
1
+ import { useRef as c, useEffect as u } from "react";
2
+ import { INPUT_TARGET_ID as s } from "../components/footer/constants.js";
3
+ const l = (o, e, n) => () => {
4
+ const r = e.querySelector(o);
5
+ r && (r.focus(), n());
6
+ }, i = (o, e, n) => {
7
+ const r = document.querySelector(e);
8
+ if (!r)
9
+ return null;
10
+ const t = new MutationObserver(l(o, r, () => {
11
+ t.disconnect(), n();
12
+ }));
13
+ return t.observe(document, {
14
+ childList: !0,
15
+ subtree: !0
16
+ }), t;
17
+ };
18
+ function a(o) {
19
+ const e = c(null), n = `[data-target-id="${s}"]`, r = () => {
20
+ const t = document.querySelector(n);
21
+ t ? t.focus() : e != null && e.current || (e.current = i(n, o, () => {
22
+ e.current = null;
23
+ }));
24
+ };
25
+ return u(() => () => {
26
+ var t;
27
+ (t = e == null ? void 0 : e.current) == null || t.disconnect();
28
+ }, [e]), {
29
+ focusPrompt: r
30
+ };
31
+ }
32
+ export {
33
+ a as usePromptFocus
34
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@box/box-ai-content-answers",
3
- "version": "0.105.0",
3
+ "version": "0.106.0",
4
4
  "peerDependencies": {
5
5
  "@box/blueprint-web": "^7.8.0",
6
6
  "@box/blueprint-web-assets": "^4.35.0",
@@ -57,5 +57,5 @@
57
57
  "**/*.css"
58
58
  ],
59
59
  "license": "SEE LICENSE IN LICENSE",
60
- "gitHead": "d9896953657518cadffe1c467b9c60b05b13b1e7"
60
+ "gitHead": "530ba3e33c3c8edfa7c55ac99525e6fd67e3da5f"
61
61
  }
package/types/index.d.ts CHANGED
@@ -3,5 +3,6 @@ export * from './lib/components/answer/answer-content';
3
3
  export * from './lib/components/api-wrapper/api-wrapper';
4
4
  export * from './lib/components/modal/clear-conversation-button';
5
5
  export * from './lib/components/modal/modal';
6
+ export * from './lib/hooks/usePromptFocus';
6
7
  export * from './lib/types';
7
8
  export * from './lib/constants';
@@ -0,0 +1,3 @@
1
+ export declare function usePromptFocus(containerSelector: string): {
2
+ focusPrompt: () => void;
3
+ };
@@ -35,3 +35,4 @@ export declare const defaultBoxAiContentAnswersProps: {
35
35
  export declare const WithUpdatedRequestInProgress: (props: BoxAiContentAnswersProps) => import("react/jsx-runtime").JSX.Element;
36
36
  export declare const DefaultBoxAIContentAnswers: (props: BoxAiContentAnswersProps) => import("react/jsx-runtime").JSX.Element;
37
37
  export declare const DefaultBoxAISidebar: (props: BoxAiContentAnswersProps) => import("react/jsx-runtime").JSX.Element;
38
+ export declare const WithFocusableBoxAISidebarInput: (props: BoxAiContentAnswersProps) => import("react/jsx-runtime").JSX.Element;