@box/metadata-editor 0.70.2 → 0.70.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/chunks/utils.js +31 -24
- package/esm/lib/components/combobox-with-api-pagination/combobox-with-api-pagination.js +126 -126
- package/esm/lib/components/metadata-editor-fields/components/metadata-multi-select-field/metadata-multi-select-field.js +40 -39
- package/esm/lib/components/metadata-editor-fields/metadata-editor-field-wrapper.js +39 -35
- package/esm/lib/components/metadata-editor-fields/utils.js +3 -2
- package/package.json +3 -3
- package/styles/combobox-with-api-pagination.css +1 -1
- package/types/lib/components/metadata-editor-fields/utils.d.ts +1 -0
- package/types/lib/test-utils/sample-data.d.ts +2 -1
package/chunks/utils.js
CHANGED
@@ -1,35 +1,42 @@
|
|
1
1
|
import "../styles/utils.css";
|
2
|
-
import { BoxAiLogo as
|
2
|
+
import { BoxAiLogo as s } from "@box/blueprint-web-assets/icons/Logo";
|
3
3
|
import n from "../esm/lib/components/interactive-text/interactive-text.js";
|
4
|
-
import { jsxs as _, jsx as
|
5
|
-
const
|
6
|
-
noAttributesText:
|
7
|
-
fieldWrapper:
|
4
|
+
import { jsxs as _, jsx as o } from "react/jsx-runtime";
|
5
|
+
const c = "_noAttributesText_ix3i9_753", x = "_fieldWrapper_ix3i9_757", b = "_hasSuggestion_ix3i9_762", p = "_error_ix3i9_770", g = "_dateField_ix3i9_782", d = "_suggestionApplied_ix3i9_786", u = "_comboboxContainer_ix3i9_786", m = "_labelWrapper_ix3i9_800", T = "_labelText_ix3i9_806", h = "_labelIcon_ix3i9_809", t = {
|
6
|
+
noAttributesText: c,
|
7
|
+
fieldWrapper: x,
|
8
8
|
hasSuggestion: b,
|
9
9
|
error: p,
|
10
|
-
dateField:
|
11
|
-
suggestionApplied:
|
12
|
-
comboboxContainer:
|
13
|
-
labelWrapper:
|
10
|
+
dateField: g,
|
11
|
+
suggestionApplied: d,
|
12
|
+
comboboxContainer: u,
|
13
|
+
labelWrapper: m,
|
14
14
|
labelText: T,
|
15
|
-
labelIcon:
|
16
|
-
},
|
17
|
-
className:
|
18
|
-
children: [i ? /* @__PURE__ */
|
19
|
-
as:
|
20
|
-
className:
|
15
|
+
labelIcon: h
|
16
|
+
}, f = (e, i, r = !1, a = "label") => (l) => /* @__PURE__ */ _("div", {
|
17
|
+
className: t.labelWrapper,
|
18
|
+
children: [i ? /* @__PURE__ */ o(n, {
|
19
|
+
as: a,
|
20
|
+
className: t.labelText,
|
21
21
|
tooltipText: i,
|
22
22
|
...l,
|
23
|
-
children:
|
24
|
-
}) : /* @__PURE__ */
|
25
|
-
className:
|
23
|
+
children: e
|
24
|
+
}) : /* @__PURE__ */ o("label", {
|
25
|
+
className: t.labelText,
|
26
26
|
...l,
|
27
|
-
children:
|
28
|
-
}),
|
29
|
-
className:
|
27
|
+
children: e
|
28
|
+
}), r && /* @__PURE__ */ o(s, {
|
29
|
+
className: t.labelIcon
|
30
30
|
})]
|
31
|
-
})
|
31
|
+
}), F = (e) => {
|
32
|
+
try {
|
33
|
+
return new Date(e).toISOString();
|
34
|
+
} catch {
|
35
|
+
return null;
|
36
|
+
}
|
37
|
+
};
|
32
38
|
export {
|
33
|
-
|
34
|
-
|
39
|
+
f as g,
|
40
|
+
t as s,
|
41
|
+
F as t
|
35
42
|
};
|
@@ -1,49 +1,50 @@
|
|
1
1
|
import "../../../../styles/combobox-with-api-pagination.css";
|
2
|
-
import { ComboboxItemValue as
|
3
|
-
import { Combobox as
|
4
|
-
import { Search as
|
5
|
-
import { IconIconOnLightSecondary as
|
6
|
-
import { useForkRef as
|
7
|
-
import
|
8
|
-
import { forwardRef as
|
9
|
-
import { useIntl as
|
10
|
-
import
|
11
|
-
import { useAsyncList as
|
12
|
-
import { useControllableState as
|
13
|
-
import { useTrackVisibility as
|
14
|
-
import { jsx as r, jsxs as
|
15
|
-
const
|
16
|
-
container:
|
17
|
-
disabled:
|
18
|
-
highlightOptionText:
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
2
|
+
import { ComboboxItemValue as oe } from "@ariakit/react";
|
3
|
+
import { Combobox as d, LoadingIndicator as te, InlineNotice as re, Text as ne } from "@box/blueprint-web";
|
4
|
+
import { Search as ie, Loader as se } from "@box/blueprint-web-assets/icons/Fill";
|
5
|
+
import { IconIconOnLightSecondary as ae, Size6 as M, Size1 as le } from "@box/blueprint-web-assets/tokens/tokens";
|
6
|
+
import { useForkRef as ce } from "@box/blueprint-web/lib-esm/utils/useForkRef";
|
7
|
+
import T from "clsx";
|
8
|
+
import { forwardRef as F, useRef as C, useCallback as ue, useMemo as L, useEffect as me } from "react";
|
9
|
+
import { useIntl as P, FormattedMessage as V } from "react-intl";
|
10
|
+
import i from "./messages.js";
|
11
|
+
import { useAsyncList as de } from "./use-async-list.js";
|
12
|
+
import { useControllableState as pe } from "./utils/use-controllable-state.js";
|
13
|
+
import { useTrackVisibility as he } from "./utils/use-intersection-observer.js";
|
14
|
+
import { jsx as r, jsxs as N, Fragment as fe } from "react/jsx-runtime";
|
15
|
+
const be = "_container_1m7se_1", ge = "_disabled_1m7se_7", xe = "_highlightOptionText_1m7se_11", _e = "_selected_1m7se_23", Oe = "_option_1m7se_34", Re = "_errorComboboxOption_1m7se_38", Ce = "_errorComboboxOptionText_1m7se_43", a = {
|
16
|
+
container: be,
|
17
|
+
disabled: ge,
|
18
|
+
highlightOptionText: xe,
|
19
|
+
selected: _e,
|
20
|
+
option: Oe,
|
21
|
+
errorComboboxOption: Re,
|
22
|
+
errorComboboxOptionText: Ce
|
23
|
+
}, S = /* @__PURE__ */ F(({
|
23
24
|
onTryAgain: y
|
24
25
|
}, p) => {
|
25
26
|
const {
|
26
27
|
formatMessage: h
|
27
|
-
} =
|
28
|
-
return /* @__PURE__ */
|
29
|
-
children: [/* @__PURE__ */ r(
|
28
|
+
} = P();
|
29
|
+
return /* @__PURE__ */ N(fe, {
|
30
|
+
children: [/* @__PURE__ */ r(re, {
|
30
31
|
variant: "error",
|
31
|
-
variantIconAriaLabel: h(
|
32
|
-
children: /* @__PURE__ */ r(
|
33
|
-
...
|
32
|
+
variantIconAriaLabel: h(i.loadingResultsErrorIconLabel),
|
33
|
+
children: /* @__PURE__ */ r(V, {
|
34
|
+
...i.loadingResultsErrorMessage
|
34
35
|
})
|
35
|
-
}), /* @__PURE__ */ r(
|
36
|
+
}), /* @__PURE__ */ r(d.Option, {
|
36
37
|
ref: p,
|
37
|
-
className:
|
38
|
+
className: a.errorComboboxOption,
|
38
39
|
onClick: y,
|
39
|
-
children: /* @__PURE__ */
|
40
|
+
children: /* @__PURE__ */ N(ne, {
|
40
41
|
as: "span",
|
41
|
-
className:
|
42
|
+
className: a.errorComboboxOptionText,
|
42
43
|
color: "textOnLightLink",
|
43
44
|
variant: "bodyDefaultBold",
|
44
|
-
children: [/* @__PURE__ */ r(
|
45
|
-
...
|
46
|
-
}), /* @__PURE__ */ r(
|
45
|
+
children: [/* @__PURE__ */ r(V, {
|
46
|
+
...i.loadingResultsErrorAction
|
47
|
+
}), /* @__PURE__ */ r(se, {
|
47
48
|
color: "currentColor",
|
48
49
|
height: "12px",
|
49
50
|
width: "12px"
|
@@ -51,158 +52,157 @@ const go = "_container_181ao_1", xo = "_disabled_181ao_7", Oo = "_highlightOptio
|
|
51
52
|
})
|
52
53
|
})]
|
53
54
|
});
|
54
|
-
}), A = "__LOADING__", E = "__LOADING_ERROR__",
|
55
|
-
color:
|
55
|
+
}), A = "__LOADING__", E = "__LOADING_ERROR__", Le = "0px 0px 20px 0px", Ae = /* @__PURE__ */ r(ie, {
|
56
|
+
color: ae,
|
56
57
|
height: M,
|
57
58
|
role: "presentation",
|
58
59
|
style: {
|
59
|
-
padding:
|
60
|
+
padding: le,
|
60
61
|
boxSizing: "border-box"
|
61
62
|
},
|
62
63
|
width: M
|
63
|
-
}),
|
64
|
+
}), Be = /* @__PURE__ */ F(function(p, h) {
|
64
65
|
const {
|
65
|
-
defaultFetcher:
|
66
|
+
defaultFetcher: k,
|
66
67
|
onInputValueChange: f,
|
67
|
-
value:
|
68
|
-
onValueChange:
|
69
|
-
noResultMessage:
|
70
|
-
defaultValue:
|
71
|
-
loadingAriaLabel:
|
72
|
-
multiselect:
|
73
|
-
disabled:
|
74
|
-
className:
|
75
|
-
...
|
68
|
+
value: D,
|
69
|
+
onValueChange: w,
|
70
|
+
noResultMessage: B,
|
71
|
+
defaultValue: W = [],
|
72
|
+
loadingAriaLabel: z,
|
73
|
+
multiselect: l = !1,
|
74
|
+
disabled: G,
|
75
|
+
className: j,
|
76
|
+
...U
|
76
77
|
} = p, {
|
77
78
|
formatMessage: u
|
78
|
-
} =
|
79
|
+
} = P(), b = C(null), g = C(!0), e = de({
|
79
80
|
async load({
|
80
|
-
marker:
|
81
|
+
marker: o,
|
81
82
|
searchInput: t,
|
82
83
|
signal: R
|
83
84
|
}) {
|
84
|
-
const
|
85
|
+
const c = await k({
|
85
86
|
signal: R,
|
86
|
-
marker:
|
87
|
+
marker: o,
|
87
88
|
searchInput: t
|
88
89
|
});
|
89
90
|
return {
|
90
|
-
items:
|
91
|
-
marker:
|
91
|
+
items: c.options,
|
92
|
+
marker: c.marker
|
92
93
|
};
|
93
94
|
}
|
94
|
-
}), v = C(!1),
|
95
|
-
v.current || (
|
96
|
-
}, []), [n, x] =
|
97
|
-
prop:
|
98
|
-
defaultProp:
|
99
|
-
onChange:
|
100
|
-
}),
|
101
|
-
|
102
|
-
},
|
95
|
+
}), v = C(!1), q = ue(() => {
|
96
|
+
v.current || (e.reload(), v.current = !0);
|
97
|
+
}, []), [n, x] = pe({
|
98
|
+
prop: D,
|
99
|
+
defaultProp: W,
|
100
|
+
onChange: w
|
101
|
+
}), _ = !l && n.length === 1, H = (o) => {
|
102
|
+
o === void 0 ? (x([]), g.current || (e.search(""), g.current = !0)) : Array.isArray(o) ? x(o) : x([o]);
|
103
|
+
}, J = L(() => n.length === 0 ? l ? [] : void 0 : l ? n : n[0], [l, n]), O = L(() => n.filter((o) => !e.items.some((t) => t.value === o.value)), [n, e.items]), K = (o) => {
|
103
104
|
const {
|
104
105
|
value: t,
|
105
106
|
displayValue: R,
|
106
|
-
...
|
107
|
-
} =
|
107
|
+
...c
|
108
|
+
} = o;
|
108
109
|
if (t === A)
|
109
|
-
return
|
110
|
-
...
|
111
|
-
ref:
|
110
|
+
return e.hasNextPage ? /* @__PURE__ */ r(d.Option, {
|
111
|
+
...c,
|
112
|
+
ref: Y,
|
112
113
|
disabled: !0,
|
113
114
|
value: t,
|
114
|
-
children: /* @__PURE__ */ r(
|
115
|
-
"aria-label": u(
|
115
|
+
children: /* @__PURE__ */ r(te, {
|
116
|
+
"aria-label": u(i.loadingMoreAriaLabel),
|
116
117
|
style: {
|
117
118
|
position: "unset"
|
118
119
|
}
|
119
120
|
})
|
120
121
|
}) : null;
|
121
|
-
if (t === E &&
|
122
|
-
return /* @__PURE__ */ r(
|
122
|
+
if (t === E && e.hasError && !e.isEmpty)
|
123
|
+
return /* @__PURE__ */ r(S, {
|
123
124
|
onTryAgain: () => {
|
124
|
-
var
|
125
|
-
|
125
|
+
var s;
|
126
|
+
e.loadMore(), (s = b.current) == null || s.focus();
|
126
127
|
}
|
127
128
|
});
|
128
|
-
if (
|
129
|
+
if (O.some((s) => s.value === t))
|
129
130
|
return null;
|
130
|
-
const
|
131
|
-
return /* @__PURE__ */ r(
|
132
|
-
...
|
133
|
-
className:
|
134
|
-
disabled: $(),
|
131
|
+
const ee = n.some((s) => s.value === t);
|
132
|
+
return /* @__PURE__ */ r(d.Option, {
|
133
|
+
...c,
|
134
|
+
className: a.option,
|
135
135
|
value: t,
|
136
|
-
children: /* @__PURE__ */ r(
|
137
|
-
className:
|
136
|
+
children: /* @__PURE__ */ r(oe, {
|
137
|
+
className: T(a.highlightOptionText, ee && a.selected),
|
138
138
|
value: R || t
|
139
139
|
})
|
140
140
|
});
|
141
|
-
},
|
142
|
-
if (f == null || f(
|
141
|
+
}, Q = (o) => {
|
142
|
+
if (f == null || f(o), _ && o === "") {
|
143
143
|
g.current = !1;
|
144
144
|
return;
|
145
145
|
}
|
146
|
-
|
147
|
-
},
|
148
|
-
var
|
149
|
-
|
146
|
+
e.search(o);
|
147
|
+
}, X = () => {
|
148
|
+
var o;
|
149
|
+
e.reload(), (o = b.current) == null || o.focus();
|
150
150
|
};
|
151
|
-
let
|
152
|
-
|
153
|
-
onTryAgain:
|
154
|
-
}) :
|
155
|
-
const [
|
156
|
-
rootRef:
|
151
|
+
let m;
|
152
|
+
e.hasError && !e.isLoading ? m = /* @__PURE__ */ r(S, {
|
153
|
+
onTryAgain: X
|
154
|
+
}) : e.isEmpty && !e.isLoading ? m = B || u(i.noResults) : m = void 0;
|
155
|
+
const [Y, {
|
156
|
+
rootRef: Z,
|
157
157
|
isVisible: I
|
158
|
-
}] =
|
159
|
-
rootMargin:
|
158
|
+
}] = he({
|
159
|
+
rootMargin: Le
|
160
160
|
});
|
161
|
-
|
162
|
-
if (!(I &&
|
161
|
+
me(() => {
|
162
|
+
if (!(I && e.hasNextPage))
|
163
163
|
return;
|
164
164
|
const t = setTimeout(() => {
|
165
|
-
|
165
|
+
e.loadMore();
|
166
166
|
}, 100);
|
167
167
|
return () => {
|
168
168
|
clearTimeout(t);
|
169
169
|
};
|
170
170
|
}, [I]);
|
171
|
-
const
|
172
|
-
const
|
171
|
+
const $ = L(() => {
|
172
|
+
const o = e.hasNextPage ? {
|
173
173
|
displayValue: A,
|
174
174
|
value: A
|
175
|
-
} : null, t = !
|
175
|
+
} : null, t = !o && e.hasError && !e.isEmpty ? {
|
176
176
|
displayValue: E,
|
177
177
|
value: E
|
178
178
|
} : null;
|
179
|
-
return [...
|
180
|
-
}, [
|
181
|
-
return /* @__PURE__ */ r(
|
179
|
+
return [...e.items, ...O, o, t].filter(Boolean);
|
180
|
+
}, [e.hasNextPage, e.hasError, e.isEmpty, e.items, O]);
|
181
|
+
return /* @__PURE__ */ r(d, {
|
182
182
|
as: "input",
|
183
|
-
...
|
184
|
-
ref:
|
185
|
-
className:
|
186
|
-
[
|
187
|
-
},
|
188
|
-
clearButtonAriaLabel: u(
|
189
|
-
disabled:
|
190
|
-
displayValue: (
|
191
|
-
endComboboxIcon:
|
183
|
+
...U,
|
184
|
+
ref: ce(b, h),
|
185
|
+
className: T({
|
186
|
+
[a.disabled]: _
|
187
|
+
}, j),
|
188
|
+
clearButtonAriaLabel: u(i.clearButtonAriaLabel),
|
189
|
+
disabled: G || _,
|
190
|
+
displayValue: (o) => o.displayValue || o.value,
|
191
|
+
endComboboxIcon: Ae,
|
192
192
|
focusLoop: !1,
|
193
|
-
getPopoverRef:
|
194
|
-
loading:
|
195
|
-
loadingAriaLabel:
|
196
|
-
multiselect:
|
197
|
-
noResultMessage:
|
198
|
-
onFocus:
|
199
|
-
onInputValueChange:
|
200
|
-
onValueChange:
|
201
|
-
options:
|
202
|
-
renderOption:
|
203
|
-
value:
|
193
|
+
getPopoverRef: Z,
|
194
|
+
loading: e.isReloading,
|
195
|
+
loadingAriaLabel: z || u(i.loadingAriaLabel),
|
196
|
+
multiselect: l,
|
197
|
+
noResultMessage: m,
|
198
|
+
onFocus: q,
|
199
|
+
onInputValueChange: Q,
|
200
|
+
onValueChange: H,
|
201
|
+
options: $,
|
202
|
+
renderOption: K,
|
203
|
+
value: J
|
204
204
|
});
|
205
205
|
});
|
206
206
|
export {
|
207
|
-
|
207
|
+
Be as ComboboxWithApiPagination
|
208
208
|
};
|
@@ -1,53 +1,54 @@
|
|
1
1
|
import { Combobox as w } from "@box/blueprint-web";
|
2
|
-
import { useFormikContext as x, getIn as
|
3
|
-
import { forwardRef as
|
4
|
-
import { useIntl as
|
5
|
-
import
|
6
|
-
import { g as
|
7
|
-
import { fieldDefaultProps as
|
8
|
-
import { jsx as
|
9
|
-
const
|
10
|
-
className:
|
11
|
-
isAiSuggestionApplied:
|
12
|
-
description:
|
13
|
-
disableForm:
|
14
|
-
fieldNamePrefix:
|
2
|
+
import { useFormikContext as x, getIn as M, Field as $ } from "formik";
|
3
|
+
import { forwardRef as I } from "react";
|
4
|
+
import { useIntl as j } from "react-intl";
|
5
|
+
import k from "../../../../messages.js";
|
6
|
+
import { g as D } from "../../../../../../chunks/utils.js";
|
7
|
+
import { fieldDefaultProps as O } from "../constants.js";
|
8
|
+
import { jsx as t } from "react/jsx-runtime";
|
9
|
+
const E = /* @__PURE__ */ I(({
|
10
|
+
className: i,
|
11
|
+
isAiSuggestionApplied: n,
|
12
|
+
description: m,
|
13
|
+
disableForm: u,
|
14
|
+
fieldNamePrefix: o,
|
15
15
|
label: l,
|
16
|
-
onValueEdited:
|
17
|
-
options:
|
18
|
-
portalElement:
|
19
|
-
updateModePrefix:
|
20
|
-
},
|
16
|
+
onValueEdited: d,
|
17
|
+
options: f,
|
18
|
+
portalElement: c,
|
19
|
+
updateModePrefix: p
|
20
|
+
}, g) => {
|
21
21
|
const {
|
22
|
-
setFieldValue:
|
22
|
+
setFieldValue: h,
|
23
23
|
values: F
|
24
|
-
} = x(),
|
24
|
+
} = x(), v = j(), r = `${p ?? o}.value`, C = f || M(F, `${o}.options`, []).map(({
|
25
25
|
key: e
|
26
|
-
}) => e),
|
27
|
-
return /* @__PURE__ */
|
26
|
+
}) => e), L = (e, a) => a.toLowerCase().includes(e.toLowerCase());
|
27
|
+
return /* @__PURE__ */ t("div", {
|
28
28
|
"data-testid": `${l}-field`,
|
29
|
-
children: /* @__PURE__ */
|
30
|
-
name:
|
29
|
+
children: /* @__PURE__ */ t($, {
|
30
|
+
name: r,
|
31
31
|
children: ({
|
32
32
|
field: e
|
33
33
|
}) => {
|
34
|
-
var
|
35
|
-
|
36
|
-
|
37
|
-
|
34
|
+
var s;
|
35
|
+
const b = (((s = e.value) == null ? void 0 : s.length) || 0) === 0 ? v.formatMessage(k.multiselectPlaceholder) : "";
|
36
|
+
return /* @__PURE__ */ t(w, {
|
37
|
+
...O,
|
38
|
+
ref: g,
|
38
39
|
as: "input",
|
39
|
-
className:
|
40
|
-
disabled:
|
41
|
-
filterFn:
|
42
|
-
label:
|
40
|
+
className: i,
|
41
|
+
disabled: u,
|
42
|
+
filterFn: L,
|
43
|
+
label: D(l, m, n),
|
43
44
|
multiselect: !0,
|
44
45
|
name: e.name,
|
45
|
-
onValueChange: (
|
46
|
-
|
46
|
+
onValueChange: (V) => {
|
47
|
+
h(r, V), d();
|
47
48
|
},
|
48
|
-
options:
|
49
|
-
placeholder:
|
50
|
-
portalElement:
|
49
|
+
options: C,
|
50
|
+
placeholder: b,
|
51
|
+
portalElement: c,
|
51
52
|
value: e.value
|
52
53
|
});
|
53
54
|
}
|
@@ -55,6 +56,6 @@ const A = /* @__PURE__ */ $(({
|
|
55
56
|
});
|
56
57
|
});
|
57
58
|
export {
|
58
|
-
|
59
|
-
|
59
|
+
E as MetadataMultiSelectField,
|
60
|
+
E as default
|
60
61
|
};
|
@@ -1,79 +1,83 @@
|
|
1
1
|
import I from "clsx";
|
2
|
-
import { useFormikContext as
|
3
|
-
import
|
4
|
-
import { forwardRef as
|
2
|
+
import { useFormikContext as P } from "formik";
|
3
|
+
import V from "lodash/isUndefined";
|
4
|
+
import { forwardRef as v, useState as F, useCallback as C, useEffect as R } from "react";
|
5
5
|
import { AiSuggestionField as T } from "./components/ai-suggestion-field/ai-suggestion-field.js";
|
6
6
|
import { UpdateModeFieldWrapper as U } from "./components/update-mode-field-wrapper/update-mode-field-wrapper.js";
|
7
7
|
import { editorFieldTypes as b } from "./editor-field-types.js";
|
8
|
-
import { s as n } from "../../../../chunks/utils.js";
|
9
|
-
import { jsx as a, jsxs as
|
10
|
-
const
|
11
|
-
disableForm:
|
8
|
+
import { t as j, s as n } from "../../../../chunks/utils.js";
|
9
|
+
import { jsx as a, jsxs as $ } from "react/jsx-runtime";
|
10
|
+
const Q = /* @__PURE__ */ v(({
|
11
|
+
disableForm: g,
|
12
12
|
portalElement: u,
|
13
13
|
field: e,
|
14
14
|
index: M,
|
15
|
-
taxonomyOptionsFetcher:
|
16
|
-
},
|
15
|
+
taxonomyOptionsFetcher: c
|
16
|
+
}, m) => {
|
17
17
|
var x;
|
18
18
|
const {
|
19
|
-
setFieldValue:
|
20
|
-
} =
|
21
|
-
|
22
|
-
type: A,
|
19
|
+
setFieldValue: S
|
20
|
+
} = P(), [N, f] = F(!0), [r, A] = F(!1), p = b[e.type], {
|
21
|
+
type: l,
|
23
22
|
value: y
|
24
|
-
} = e
|
25
|
-
|
23
|
+
} = e;
|
24
|
+
let {
|
25
|
+
aiSuggestion: t
|
26
|
+
} = e;
|
27
|
+
l === "date" && typeof t == "string" && (t = j(t));
|
28
|
+
const W = p && !e.hidden, k = !V(e.updateMode), s = `metadata.fields[${M}]`, w = e.type === "taxonomy" && ((x = e.optionsRules) == null ? void 0 : x.multiSelect), i = t && N, E = I({
|
29
|
+
[n.suggestionApplied]: r,
|
26
30
|
[n.hasSuggestion]: i,
|
27
|
-
[n.dateField]:
|
28
|
-
}), o =
|
29
|
-
|
30
|
-
}, [s,
|
31
|
+
[n.dateField]: l === "date"
|
32
|
+
}), o = C((d) => {
|
33
|
+
S(`${s}.value`, d), f(!1), A(!0);
|
34
|
+
}, [s, S]);
|
31
35
|
R(() => {
|
32
36
|
!i || y || o(t);
|
33
37
|
}, [i, t, o]);
|
34
38
|
const h = () => {
|
35
|
-
|
39
|
+
r && A(!1);
|
36
40
|
};
|
37
41
|
return W ? k ? /* @__PURE__ */ a(U, {
|
38
42
|
fieldNamePrefix: s,
|
39
43
|
fieldType: e.type,
|
40
44
|
isTaxonomyMultiSelect: w,
|
41
|
-
children: /* @__PURE__ */ a(
|
42
|
-
ref:
|
45
|
+
children: /* @__PURE__ */ a(p, {
|
46
|
+
ref: m,
|
43
47
|
description: e.description,
|
44
|
-
disableForm:
|
48
|
+
disableForm: g,
|
45
49
|
fieldNamePrefix: s,
|
46
50
|
isAiSuggestionApplied: !1,
|
47
51
|
label: e.displayName,
|
48
52
|
onValueEdited: h,
|
49
53
|
portalElement: u,
|
50
|
-
taxonomyOptionsFetcher:
|
54
|
+
taxonomyOptionsFetcher: c
|
51
55
|
})
|
52
|
-
}, e.key) : /* @__PURE__ */
|
56
|
+
}, e.key) : /* @__PURE__ */ $("div", {
|
53
57
|
className: n.fieldWrapper,
|
54
|
-
children: [/* @__PURE__ */ a(
|
55
|
-
ref:
|
58
|
+
children: [/* @__PURE__ */ a(p, {
|
59
|
+
ref: m,
|
56
60
|
className: E,
|
57
61
|
description: e.description,
|
58
|
-
disableForm:
|
62
|
+
disableForm: g,
|
59
63
|
fieldNamePrefix: s,
|
60
|
-
isAiSuggestionApplied:
|
64
|
+
isAiSuggestionApplied: r,
|
61
65
|
label: e.displayName,
|
62
66
|
onValueEdited: h,
|
63
67
|
portalElement: u,
|
64
|
-
taxonomyOptionsFetcher:
|
68
|
+
taxonomyOptionsFetcher: c
|
65
69
|
}), i && /* @__PURE__ */ a(T, {
|
66
70
|
aiSuggestion: t,
|
67
71
|
onAiSuggestionAppend: () => {
|
68
|
-
const
|
69
|
-
o(
|
72
|
+
const d = [...new Set([y, t].flat())];
|
73
|
+
o(d);
|
70
74
|
},
|
71
|
-
onAiSuggestionIgnore: () =>
|
75
|
+
onAiSuggestionIgnore: () => f(!1),
|
72
76
|
onAiSuggestionReplace: () => o(t),
|
73
|
-
type:
|
77
|
+
type: l
|
74
78
|
})]
|
75
79
|
}, e.key) : null;
|
76
80
|
});
|
77
81
|
export {
|
78
|
-
|
82
|
+
Q as MetadataEditorFieldWrapper
|
79
83
|
};
|
@@ -1,7 +1,8 @@
|
|
1
1
|
import "@box/blueprint-web-assets/icons/Logo";
|
2
2
|
import "../interactive-text/interactive-text.js";
|
3
|
-
import { g as
|
3
|
+
import { g as i, t as g } from "../../../../chunks/utils.js";
|
4
4
|
import "react/jsx-runtime";
|
5
5
|
export {
|
6
|
-
|
6
|
+
i as getFieldLabel,
|
7
|
+
g as tryParseDateSuggestion
|
7
8
|
};
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@box/metadata-editor",
|
3
|
-
"version": "0.70.
|
3
|
+
"version": "0.70.4",
|
4
4
|
"peerDependencies": {
|
5
5
|
"@ariakit/react": "0.4.5",
|
6
6
|
"@box/blueprint-web": "^7.30.3",
|
@@ -14,7 +14,7 @@
|
|
14
14
|
"devDependencies": {
|
15
15
|
"@ariakit/react": "0.4.5",
|
16
16
|
"@box/babel-plugin-target-attributes": "1.3.0",
|
17
|
-
"@box/blueprint-web": "^7.36.
|
17
|
+
"@box/blueprint-web": "^7.36.4",
|
18
18
|
"@box/blueprint-web-assets": "^4.28.0",
|
19
19
|
"@box/storybook-utils": "^0.7.0",
|
20
20
|
"@testing-library/react": "^15.0.6",
|
@@ -53,5 +53,5 @@
|
|
53
53
|
"**/*.css"
|
54
54
|
],
|
55
55
|
"license": "SEE LICENSE IN LICENSE",
|
56
|
-
"gitHead": "
|
56
|
+
"gitHead": "f4b966f2a285a04d8ac254cd9556395293541f8a"
|
57
57
|
}
|
@@ -1 +1 @@
|
|
1
|
-
.
|
1
|
+
._container_1m7se_1{display:flex;gap:var(--space-1);justify-content:center}._disabled_1m7se_7._disabled_1m7se_7{opacity:unset}._highlightOptionText_1m7se_11 [data-user-value]{font-weight:700;font-size:.875rem;font-family:Lato,-apple-system,BlinkMacSystemFont,San Francisco,Segoe UI,Roboto,Helvetica Neue,sans-serif;line-height:1.25rem;letter-spacing:.01875rem;text-transform:none;text-decoration:none}._highlightOptionText_1m7se_11 [data-autocomplete-value]{color:var(--text-text-on-light-secondary)}._highlightOptionText_1m7se_11._selected_1m7se_23,._highlightOptionText_1m7se_11._selected_1m7se_23 span{color:var(--text-text-on-light);font-weight:700;font-size:.875rem;font-family:Lato,-apple-system,BlinkMacSystemFont,San Francisco,Segoe UI,Roboto,Helvetica Neue,sans-serif;line-height:1.25rem;letter-spacing:.01875rem;text-transform:none;text-decoration:none}._option_1m7se_34:nth-last-child(1 of._option_1m7se_34){scroll-margin-block-end:var(--space-12)}._errorComboboxOption_1m7se_38[role=option]{display:flex;align-items:center;justify-content:center}._errorComboboxOption_1m7se_38[role=option] ._errorComboboxOptionText_1m7se_43{display:flex;gap:var(--space-1);align-items:center}
|
@@ -1,2 +1,3 @@
|
|
1
1
|
import { type Labelable, type TextProps } from '@box/blueprint-web';
|
2
2
|
export declare const getFieldLabel: (fieldName: string, fieldDescription: string | undefined, isAiSuggestionApplied?: boolean, as?: TextProps['as']) => Labelable['label'];
|
3
|
+
export declare const tryParseDateSuggestion: (suggestedDate: string) => string;
|
@@ -20,6 +20,7 @@ declare const templateOptions: MetadataTemplateOption[];
|
|
20
20
|
declare const fields: MetadataTemplateField[];
|
21
21
|
declare const floatInstanceField: MetadataTemplateField;
|
22
22
|
declare const allFieldsTemplateInstance: MetadataTemplateInstance;
|
23
|
+
declare const differentDatesSuggestionTemplateInstance: MetadataTemplateInstance;
|
23
24
|
declare const templateInstanceWithoutEmptyValues: MetadataTemplateInstance;
|
24
25
|
declare const emptyTemplateInstance: MetadataTemplateInstance;
|
25
26
|
declare const templateInstanceWithAllFieldsEmpty: MetadataTemplateInstance;
|
@@ -39,4 +40,4 @@ declare const firstTemplateInstanceFieldsWithSuggestions: MetadataTemplateField[
|
|
39
40
|
declare const secondTemplateInstance: MetadataTemplate;
|
40
41
|
declare const secondTemplateSuggestions: AutofillSuggestions;
|
41
42
|
declare const secondTemplateInstanceFieldsWithSuggestions: MetadataTemplateField[];
|
42
|
-
export { allFieldsSuggestions, allFieldsTemplate, allFieldsTemplateInstance, allFieldsWithAiSuggestions, customTemplate, customTemplateInstance, customTemplateInstanceWithAllFieldsEmpty, customTemplateInstanceWithoutEditPermissions, customTemplateInstanceWithoutEmptyValues, dateField, emptyCustomTemplateInstance, emptyTemplateInstance, enumField, fields, firstTemplateInstance, firstTemplateInstanceFieldsWithSuggestions, firstTemplateSuggestions, floatField, floatInstanceField, hiddenField, multiSelectField, noFieldsTemplate, nonHiddenFieldsTemplate, nonHiddenFieldsWithValuesTemplate, noValueField, secondTemplateInstance, secondTemplateInstanceFieldsWithSuggestions, secondTemplateSuggestions, stringField, taxonomyMultiSelectSingleLevelField, taxonomyMultiSelectSingleLevelFieldWithValue, taxonomySingleSelectSingleLevelField, taxonomySingleSelectSingleLevelFieldWithValue, templateInstancesList, templateInstanceWithAllFieldsEmpty, templateInstanceWithoutEditPermissions, templateInstanceWithoutEmptyValues, templateInstanceWithSomeFieldsEmpty, templateOptions, templates, };
|
43
|
+
export { allFieldsSuggestions, allFieldsTemplate, allFieldsTemplateInstance, allFieldsWithAiSuggestions, customTemplate, customTemplateInstance, customTemplateInstanceWithAllFieldsEmpty, customTemplateInstanceWithoutEditPermissions, customTemplateInstanceWithoutEmptyValues, dateField, differentDatesSuggestionTemplateInstance, emptyCustomTemplateInstance, emptyTemplateInstance, enumField, fields, firstTemplateInstance, firstTemplateInstanceFieldsWithSuggestions, firstTemplateSuggestions, floatField, floatInstanceField, hiddenField, multiSelectField, noFieldsTemplate, nonHiddenFieldsTemplate, nonHiddenFieldsWithValuesTemplate, noValueField, secondTemplateInstance, secondTemplateInstanceFieldsWithSuggestions, secondTemplateSuggestions, stringField, taxonomyMultiSelectSingleLevelField, taxonomyMultiSelectSingleLevelFieldWithValue, taxonomySingleSelectSingleLevelField, taxonomySingleSelectSingleLevelFieldWithValue, templateInstancesList, templateInstanceWithAllFieldsEmpty, templateInstanceWithoutEditPermissions, templateInstanceWithoutEmptyValues, templateInstanceWithSomeFieldsEmpty, templateOptions, templates, };
|