@box/metadata-editor 0.67.2 → 0.67.4
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/lib/components/combobox-with-api-pagination/use-async-list.js +24 -23
- package/esm/lib/components/combobox-with-api-pagination/utils/is-abort-error.js +13 -0
- package/esm/lib/components/metadata-editor-fields/components/ai-suggestion-field/ai-suggestion-field.js +13 -13
- package/package.json +2 -2
- package/styles/ai-suggestion-field.css +1 -1
- package/types/lib/components/combobox-with-api-pagination/utils/is-abort-error.d.ts +1 -0
@@ -1,9 +1,10 @@
|
|
1
|
-
import { useReducer as
|
1
|
+
import { useReducer as O } from "react";
|
2
2
|
import { RequestStates as u } from "./request.js";
|
3
|
+
import { isAbortError as I } from "./utils/is-abort-error.js";
|
3
4
|
var s = /* @__PURE__ */ function(r) {
|
4
5
|
return r.LOAD_MORE = "LOAD_MORE", r.RELOAD = "RELOAD", r.SEARCH = "SEARCH", r.SET_ERROR = "SET_ERROR", r.SET_LOADING = "SET_LOADING", r;
|
5
6
|
}(s || {});
|
6
|
-
function
|
7
|
+
function a(r, e) {
|
7
8
|
switch (e.type) {
|
8
9
|
case s.LOAD_MORE:
|
9
10
|
return {
|
@@ -58,52 +59,52 @@ function E(r, e) {
|
|
58
59
|
function S(r, e) {
|
59
60
|
return e.requestInitiator === s.LOAD_MORE && e.requestState === u.IN_PROGRESS && r.type === s.LOAD_MORE;
|
60
61
|
}
|
61
|
-
function
|
62
|
+
function m(r, e) {
|
62
63
|
return E(r, e) || S(r, e);
|
63
64
|
}
|
64
|
-
function
|
65
|
+
function p(r, e) {
|
65
66
|
var t;
|
66
67
|
E(r, e) && e.abortController.abort(), S(r, e) && ((t = r.abortController) == null || t.abort());
|
67
68
|
}
|
68
|
-
function
|
69
|
+
function h(r, e) {
|
69
70
|
return S(r, e);
|
70
71
|
}
|
71
72
|
async function R(r, e, t, n) {
|
72
|
-
const
|
73
|
-
if (
|
73
|
+
const o = new AbortController();
|
74
|
+
if (m(r, t) && p(r, t), !h(r, t)) {
|
74
75
|
n({
|
75
76
|
type: s.SET_LOADING,
|
76
77
|
requestInitiator: r.type,
|
77
|
-
abortController:
|
78
|
+
abortController: o
|
78
79
|
});
|
79
80
|
try {
|
80
|
-
const
|
81
|
+
const l = await e({
|
81
82
|
items: t.items.slice(),
|
82
|
-
signal:
|
83
|
+
signal: o.signal,
|
83
84
|
marker: r.type === s.LOAD_MORE ? t.marker : null,
|
84
85
|
searchInput: r.searchInput ?? t.searchInput
|
85
|
-
}),
|
86
|
+
}), i = l.searchInput ?? r.searchInput ?? t.searchInput;
|
86
87
|
n({
|
87
88
|
type: r.type,
|
88
|
-
...
|
89
|
-
searchInput:
|
90
|
-
abortController:
|
89
|
+
...l,
|
90
|
+
searchInput: i,
|
91
|
+
abortController: o
|
91
92
|
});
|
92
|
-
} catch (
|
93
|
-
if ((
|
93
|
+
} catch (l) {
|
94
|
+
if (I(l))
|
94
95
|
return;
|
95
96
|
n({
|
96
97
|
type: s.SET_ERROR,
|
97
|
-
error:
|
98
|
-
abortController:
|
98
|
+
error: l,
|
99
|
+
abortController: o
|
99
100
|
});
|
100
101
|
}
|
101
102
|
}
|
102
103
|
}
|
103
|
-
function
|
104
|
+
function _(r) {
|
104
105
|
const {
|
105
106
|
load: e
|
106
|
-
} = r, [t, n] =
|
107
|
+
} = r, [t, n] = O(a, {
|
107
108
|
error: null,
|
108
109
|
items: [],
|
109
110
|
requestInitiator: null,
|
@@ -125,12 +126,12 @@ function C(r) {
|
|
125
126
|
}, e, t, n),
|
126
127
|
requestInitiator: t.requestInitiator,
|
127
128
|
searchInput: t.searchInput,
|
128
|
-
search: (
|
129
|
+
search: (o) => R({
|
129
130
|
type: s.SEARCH,
|
130
|
-
searchInput:
|
131
|
+
searchInput: o
|
131
132
|
}, e, t, n)
|
132
133
|
};
|
133
134
|
}
|
134
135
|
export {
|
135
|
-
|
136
|
+
_ as useAsyncList
|
136
137
|
};
|
@@ -1,20 +1,20 @@
|
|
1
1
|
import "../../../../../../styles/ai-suggestion-field.css";
|
2
|
-
import { Text as
|
2
|
+
import { Text as g, IconButton as l, DropdownMenu as t } from "@box/blueprint-web";
|
3
3
|
import { Checkmark as u, Ellipsis as S } from "@box/blueprint-web-assets/icons/Fill";
|
4
4
|
import { useIntl as h, FormattedMessage as n } from "react-intl";
|
5
5
|
import r from "./messages.js";
|
6
6
|
import { formatSuggestionValue as w } from "./utils.js";
|
7
7
|
import { jsx as e, jsxs as a } from "react/jsx-runtime";
|
8
|
-
const I = "
|
8
|
+
const I = "_wrapperGradient_t2yak_1", _ = "_wrapper_t2yak_1", f = "_buttons_t2yak_18", k = "_selectTrigger_t2yak_22", i = {
|
9
9
|
wrapperGradient: I,
|
10
10
|
wrapper: _,
|
11
11
|
buttons: f,
|
12
|
-
selectTrigger:
|
12
|
+
selectTrigger: k
|
13
13
|
};
|
14
|
-
function
|
15
|
-
aiSuggestion:
|
14
|
+
function A({
|
15
|
+
aiSuggestion: c,
|
16
16
|
onAiSuggestionAppend: s,
|
17
|
-
onAiSuggestionReplace:
|
17
|
+
onAiSuggestionReplace: p,
|
18
18
|
onAiSuggestionIgnore: d,
|
19
19
|
type: m
|
20
20
|
}) {
|
@@ -24,23 +24,23 @@ function D({
|
|
24
24
|
children: /* @__PURE__ */ a("div", {
|
25
25
|
className: i.wrapper,
|
26
26
|
children: [/* @__PURE__ */ a("div", {
|
27
|
-
children: [/* @__PURE__ */ e(
|
27
|
+
children: [/* @__PURE__ */ e(g, {
|
28
28
|
as: "p",
|
29
29
|
color: "textOnLightSecondary",
|
30
30
|
variant: "caption",
|
31
31
|
children: /* @__PURE__ */ e(n, {
|
32
32
|
...r.aiSuggestionCaption
|
33
33
|
})
|
34
|
-
}), /* @__PURE__ */ e(
|
34
|
+
}), /* @__PURE__ */ e(g, {
|
35
35
|
as: "p",
|
36
|
-
children: w(
|
36
|
+
children: w(c, {
|
37
37
|
type: m,
|
38
38
|
locale: o.locale
|
39
39
|
})
|
40
40
|
})]
|
41
41
|
}), /* @__PURE__ */ a("div", {
|
42
42
|
className: i.buttons,
|
43
|
-
children: [/* @__PURE__ */ e(
|
43
|
+
children: [/* @__PURE__ */ e(l, {
|
44
44
|
"aria-label": o.formatMessage(r.aiSuggestionAppend),
|
45
45
|
icon: u,
|
46
46
|
onClick: s,
|
@@ -49,7 +49,7 @@ function D({
|
|
49
49
|
}), /* @__PURE__ */ a(t.Root, {
|
50
50
|
children: [/* @__PURE__ */ e(t.Trigger, {
|
51
51
|
className: i.selectTrigger,
|
52
|
-
children: /* @__PURE__ */ e(
|
52
|
+
children: /* @__PURE__ */ e(l, {
|
53
53
|
"aria-label": o.formatMessage(r.aiSuggestionOptions),
|
54
54
|
icon: S,
|
55
55
|
"data-target-id": "IconButton-aiSuggestionOptions"
|
@@ -62,7 +62,7 @@ function D({
|
|
62
62
|
...r.aiSuggestionAppend
|
63
63
|
})
|
64
64
|
}), /* @__PURE__ */ e(t.Item, {
|
65
|
-
onSelect:
|
65
|
+
onSelect: p,
|
66
66
|
"data-target-id": "DropdownMenu.Item-aiSuggestionClearAndReplace",
|
67
67
|
children: /* @__PURE__ */ e(n, {
|
68
68
|
...r.aiSuggestionClearAndReplace
|
@@ -81,5 +81,5 @@ function D({
|
|
81
81
|
});
|
82
82
|
}
|
83
83
|
export {
|
84
|
-
|
84
|
+
A as AiSuggestionField
|
85
85
|
};
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@box/metadata-editor",
|
3
|
-
"version": "0.67.
|
3
|
+
"version": "0.67.4",
|
4
4
|
"peerDependencies": {
|
5
5
|
"@ariakit/react": "0.4.5",
|
6
6
|
"@box/blueprint-web": "^7.30.3",
|
@@ -53,5 +53,5 @@
|
|
53
53
|
"**/*.css"
|
54
54
|
],
|
55
55
|
"license": "SEE LICENSE IN LICENSE",
|
56
|
-
"gitHead": "
|
56
|
+
"gitHead": "5550b436926d1ba8d9baaee86700020cf730cf14"
|
57
57
|
}
|
@@ -1 +1 @@
|
|
1
|
-
.
|
1
|
+
._wrapperGradient_t2yak_1{background:linear-gradient(135deg,#fe03dc 0%,#2784fa 100%);border-radius:0 0 var(--radius-2) var(--radius-2)}._wrapperGradient_t2yak_1 ._wrapper_t2yak_1{display:flex;justify-content:space-between;align-items:center;-webkit-user-select:none;user-select:none;padding:var(--space-2) var(--space-3);position:relative;box-sizing:border-box;background:var(--box-blue-02);background-clip:padding-box;border:var(--border-1) solid transparent;border-radius:inherit}._wrapperGradient_t2yak_1 ._wrapper_t2yak_1 ._buttons_t2yak_18{display:flex;gap:var(--space-1)}._wrapperGradient_t2yak_1 ._wrapper_t2yak_1 ._selectTrigger_t2yak_22{width:var(--size-6);height:var(--size-6)}._wrapperGradient_t2yak_1 ._wrapper_t2yak_1>div>p{overflow-wrap:anywhere}
|
@@ -0,0 +1 @@
|
|
1
|
+
export declare function isAbortError(error: unknown): boolean;
|