@box/box-ai-agent-selector 0.25.3 → 0.26.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.
@@ -1,22 +1,22 @@
1
- import { useFullTextTooltip as z, FilterChip as g, Popover as d, Tooltip as H, Status as J, LoadingIndicator as X, SmallList as Z, Button as $ } from "@box/blueprint-web";
1
+ import { useFullTextTooltip as z, FilterChip as p, Popover as d, Tooltip as H, Status as J, LoadingIndicator as X, SmallList as Z, Button as $ } from "@box/blueprint-web";
2
2
  import { AlertBadge as q } from "@box/blueprint-web-assets/icons/Fill";
3
3
  import m from "clsx";
4
- import { useState as B, useRef as tt, useEffect as et, useCallback as _ } from "react";
4
+ import { useState as w, useRef as tt, useEffect as et, useCallback as _ } from "react";
5
5
  import { useIntl as at } from "react-intl";
6
6
  import { BoxAiAgent as nt } from "./box-ai-agent.js";
7
- import { LOGGER_BASE_CONFIG as y, LOGGER_ACTION_CLICK as S, LOGGER_TARGET as T } from "./constants.js";
7
+ import { LOGGER_BASE_CONFIG as S, LOGGER_ACTION_CLICK as y, LOGGER_TARGET as T } from "./constants.js";
8
8
  import { ACTIONS as ot } from "./contexts/actions.js";
9
9
  import { useAgentsDispatch as rt } from "./contexts/context.js";
10
10
  import s from "./messages.js";
11
11
  import { R as I } from "../../chunks/types.js";
12
12
  import { jsx as e, jsxs as R } from "react/jsx-runtime";
13
- import '../../styles/box-ai-agent-selector.css';const it = "_agentSelector_1y96v_1", st = "_agentStatus_1y96v_4", lt = "_agentLoader_1y96v_18", ct = "_agentError_1y96v_21", pt = "_triggerChip_1y96v_24", gt = "_agentLabel_1y96v_30", dt = "_dropdownIndicator_1y96v_36", mt = "_sidebar_1y96v_51", _t = "_agentListItemIcon_1y96v_70", ft = "_agentListContainer_1y96v_75", Lt = "_agentListRetryButton_1y96v_105", a = {
13
+ import '../../styles/box-ai-agent-selector.css';const it = "_agentSelector_1y96v_1", st = "_agentStatus_1y96v_4", lt = "_agentLoader_1y96v_18", gt = "_agentError_1y96v_21", ct = "_triggerChip_1y96v_24", pt = "_agentLabel_1y96v_30", dt = "_dropdownIndicator_1y96v_36", mt = "_sidebar_1y96v_51", _t = "_agentListItemIcon_1y96v_70", ft = "_agentListContainer_1y96v_75", Lt = "_agentListRetryButton_1y96v_105", a = {
14
14
  agentSelector: it,
15
15
  agentStatus: st,
16
16
  agentLoader: lt,
17
- agentError: ct,
18
- triggerChip: pt,
19
- agentLabel: gt,
17
+ agentError: gt,
18
+ triggerChip: ct,
19
+ agentLabel: pt,
20
20
  dropdownIndicator: dt,
21
21
  sidebar: mt,
22
22
  agentListItemIcon: _t,
@@ -32,75 +32,76 @@ function Ot({
32
32
  disabled: D,
33
33
  selectedAgent: o,
34
34
  triggerChipClassName: k,
35
- variant: K = "modal"
35
+ variant: M = "modal"
36
36
  }) {
37
37
  const {
38
38
  formatMessage: r
39
- } = at(), [l, c] = B(!1), i = L === I.ERROR, [M, u] = B(i), N = rt(), v = L === I.SUCCESS, E = L === I.IN_PROGRESS, O = r(s.selectAgent), F = r(s.defaultAgent);
40
- let p = "";
41
- v ? p = (o == null ? void 0 : o.name) || O : i && (p = F);
39
+ } = at(), [l, g] = w(!1), i = L === I.ERROR, [F, u] = w(i), N = rt(), v = L === I.SUCCESS, h = L === I.IN_PROGRESS, O = r(s.selectAgent), K = r(s.defaultAgent);
40
+ let c = "";
41
+ v ? c = (o == null ? void 0 : o.name) || O : i && (c = K);
42
42
  const G = tt(null), {
43
43
  Wrapper: j,
44
44
  wrapperProps: A
45
45
  } = z({
46
46
  ref: G,
47
- textValue: p
47
+ textValue: c
48
48
  });
49
49
  et(() => {
50
50
  l && n && n({
51
- ...y,
52
- action: S,
51
+ ...S,
52
+ action: y,
53
53
  target: T.OPEN_SELECTOR
54
54
  });
55
55
  }, [l, n]);
56
- const h = _((t) => {
57
- c(!1), N({
56
+ const C = _((t) => {
57
+ g(!1), N({
58
58
  type: ot.SET_SELECTED_AGENT,
59
59
  id: t.id
60
60
  }), n && n({
61
- ...y,
62
- action: S,
61
+ ...S,
62
+ action: y,
63
63
  target: T.SELECT_AGENT
64
64
  });
65
65
  }, [N, n]), U = _(() => {
66
- c(!1), b(), n && n({
67
- ...y,
68
- action: S,
66
+ g(!1), b(), n && n({
67
+ ...S,
68
+ action: y,
69
69
  target: T.RETRY_LOADING_AGENTS
70
70
  });
71
71
  }, [b, n]), Q = _((t) => {
72
- if (t.key === "Escape" && (c(!1), t.stopPropagation()), t.key === " ") {
72
+ if (t.key === "Escape" && (g(!1), t.stopPropagation()), t.key === " ") {
73
73
  const x = t.target;
74
74
  if (x) {
75
- const W = x.getAttribute("data-key"), w = f.find((Y) => Y.id === W);
76
- w && h(w);
75
+ const W = x.getAttribute("data-key"), B = f.find((Y) => Y.id === W);
76
+ B && C(B);
77
77
  }
78
78
  }
79
- }, [f, h]), V = _((t) => u(i && i && !l && t ? t : !1), [i, l]), C = K === "sidebar" && a.sidebar;
80
- return /* @__PURE__ */ e(g.Group, {
81
- className: m(a.agentSelector, k, C),
79
+ }, [f, C]), V = _((t) => u(i && i && !l && t ? t : !1), [i, l]), E = M === "sidebar" && a.sidebar;
80
+ return /* @__PURE__ */ e(p.Group, {
81
+ className: m(a.agentSelector, k, E),
82
82
  name: O,
83
83
  type: "multiple",
84
84
  children: /* @__PURE__ */ R(d.Root, {
85
85
  modal: !1,
86
- onOpenChange: c,
86
+ onOpenChange: g,
87
87
  open: l,
88
88
  children: [/* @__PURE__ */ e(H, {
89
89
  content: r(s.errorTooltip),
90
90
  onOpenChange: V,
91
- open: M,
91
+ open: F,
92
92
  side: "bottom",
93
93
  variant: "error",
94
94
  children: /* @__PURE__ */ e(d.Trigger, {
95
- disabled: D || E,
96
- children: /* @__PURE__ */ R(g.TriggerChip, {
95
+ disabled: D || h,
96
+ children: /* @__PURE__ */ R(p.TriggerChip, {
97
97
  className: a.triggerChip,
98
+ "data-target-id": "FilterChip.TriggerChip-agentSelectorTrigger",
98
99
  value: "trigger-chip",
99
100
  children: [/* @__PURE__ */ e(J, {
100
101
  className: a.agentStatus,
101
102
  colorIndex: 0,
102
103
  text: r(s.agent)
103
- }), E && /* @__PURE__ */ e(X, {
104
+ }), h && /* @__PURE__ */ e(X, {
104
105
  "aria-label": r(s.loadingMessage),
105
106
  className: a.agentLoader,
106
107
  variant: "default"
@@ -111,20 +112,20 @@ function Ot({
111
112
  width: "1rem"
112
113
  }), /* @__PURE__ */ e(j, {
113
114
  ...A,
114
- children: /* @__PURE__ */ e(g.Label, {
115
+ children: /* @__PURE__ */ e(p.Label, {
115
116
  ref: G,
116
117
  className: a.agentLabel,
117
- children: p
118
+ children: c
118
119
  })
119
- }), !E && /* @__PURE__ */ e("div", {
120
+ }), !h && /* @__PURE__ */ e("div", {
120
121
  className: a.dropdownIndicator,
121
- children: /* @__PURE__ */ e(g.DropdownIndicator, {})
122
+ children: /* @__PURE__ */ e(p.DropdownIndicator, {})
122
123
  })]
123
124
  })
124
125
  })
125
126
  }), /* @__PURE__ */ e(d.ContentContainer, {
126
127
  align: "start",
127
- className: m(a.agentListContainer, C),
128
+ className: m(a.agentListContainer, E),
128
129
  onKeyDownCapture: Q,
129
130
  children: /* @__PURE__ */ R(d.MainContent, {
130
131
  children: [v && /* @__PURE__ */ e(Z, {
@@ -134,12 +135,13 @@ function Ot({
134
135
  children: f.map((t) => /* @__PURE__ */ e(nt, {
135
136
  agent: t,
136
137
  isSelected: (o == null ? void 0 : o.id) === t.id,
137
- onAction: () => h(t)
138
+ onAction: () => C(t)
138
139
  }, t.id))
139
140
  }), i && /* @__PURE__ */ e($, {
140
- className: m(a.agentListRetryButton, C),
141
+ className: m(a.agentListRetryButton, E),
141
142
  onClick: U,
142
143
  variant: "tertiary",
144
+ "data-target-id": "Button-errorMessage",
143
145
  children: r(s.errorMessage)
144
146
  })]
145
147
  })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@box/box-ai-agent-selector",
3
- "version": "0.25.3",
3
+ "version": "0.26.0",
4
4
  "license": "SEE LICENSE IN LICENSE",
5
5
  "peerDependencies": {
6
6
  "@box/blueprint-web": "^7.31.1",
@@ -10,10 +10,11 @@
10
10
  "react-intl": "^6.4.2"
11
11
  },
12
12
  "devDependencies": {
13
- "@box/blueprint-web": "^9.17.0",
14
- "@box/blueprint-web-assets": "^4.33.0",
13
+ "@box/babel-plugin-target-attributes": "1.3.0",
14
+ "@box/blueprint-web": "^9.17.1",
15
+ "@box/blueprint-web-assets": "^4.33.1",
15
16
  "@box/eslint-plugin-blueprint": "^1.0.3",
16
- "@box/storybook-utils": "^0.8.2",
17
+ "@box/storybook-utils": "^0.8.3",
17
18
  "react-intl": "^6.4.2"
18
19
  },
19
20
  "scripts": {
@@ -46,5 +47,5 @@
46
47
  "sideEffects": [
47
48
  "**/*.css"
48
49
  ],
49
- "gitHead": "2587fac4d881d68c8831d6e286a67860dc933160"
50
+ "gitHead": "7bb0c318bc99c06f0734a7b399f25ef339afecb4"
50
51
  }