@box/metadata-editor 2.2.32 → 2.3.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/dist/chunks/add-metadata-template-dropdown-with-browser.js +34 -0
- package/dist/chunks/ai-suggestion-field.js +31 -31
- package/dist/chunks/autofill-overlay.js +13 -13
- package/dist/chunks/combobox-with-api-pagination.js +40 -40
- package/dist/chunks/custom-instance-new-field.js +13 -13
- package/dist/chunks/custom-instance.js +19 -19
- package/dist/chunks/delete-confirmation-modal.js +20 -20
- package/dist/chunks/filter-instances-dropdown.js +24 -24
- package/dist/chunks/interactive-header-text.js +8 -8
- package/dist/chunks/metadata-instance-entry.js +24 -24
- package/dist/chunks/metadata-instance-footer.js +7 -7
- package/dist/chunks/metadata-instance-form-ai-disclaimer.js +8 -8
- package/dist/chunks/metadata-instance-form-autofill-button.js +32 -32
- package/dist/chunks/metadata-instance-form-card-wrapper.js +10 -10
- package/dist/chunks/metadata-instance-form-footer.js +10 -10
- package/dist/chunks/metadata-instance-header.js +14 -14
- package/dist/chunks/metadata-instance.js +12 -12
- package/dist/chunks/taxonomy-ancestor-status-pill.js +21 -21
- package/dist/chunks/update-mode-field-wrapper.js +22 -22
- package/dist/chunks/utils.js +26 -26
- package/dist/esm/index.js +21 -20
- package/dist/esm/lib/components/add-metadata-template-dropdown/add-metadata-template-dropdown-with-browser.js +2 -0
- package/dist/esm/lib/components/add-metadata-template-dropdown/add-metadata-template-dropdown.js +24 -2
- package/dist/esm/lib/components/add-metadata-template-dropdown/index.js +3 -2
- package/dist/esm/lib/components/add-metadata-template-dropdown/shared/dropdown-trigger.js +16 -0
- package/dist/esm/lib/components/filter-dropdown-menu/filter-dropdown-menu-empty-state.js +5 -5
- package/dist/esm/lib/components/filter-dropdown-menu/filter-dropdown-menu-list.js +5 -5
- package/dist/esm/lib/components/filter-dropdown-menu/filter-dropdown-menu-search.js +12 -12
- package/dist/esm/lib/components/interactive-text/interactive-text.js +7 -7
- package/dist/esm/lib/components/metadata-editor-fields/components/ai-logo-badge/ai-logo-badge.js +11 -11
- package/dist/esm/lib/components/metadata-editor-fields/components/low-confidence-badge/low-confidence-badge.js +5 -5
- package/dist/esm/lib/components/metadata-editor-fields/components/low-confidence-suggestion-field/low-confidence-suggestion-field.js +17 -17
- package/dist/esm/lib/components/metadata-editor-fields/components/metadata-date-field/metadata-date-field.js +11 -11
- package/dist/esm/lib/components/metadata-editor-fields/components/metadata-enum-field/metadata-enum-field.js +17 -17
- package/dist/esm/lib/components/metadata-editor-fields/components/metadata-float-field/metadata-float-field.js +9 -9
- package/dist/esm/lib/components/metadata-editor-fields/components/metadata-multi-select-field/metadata-multi-select-field.js +10 -10
- package/dist/esm/lib/components/metadata-editor-fields/components/metadata-string-field/metadata-string-field.js +11 -11
- package/dist/esm/lib/components/metadata-editor-fields/components/metadata-taxonomy-field/legacy-metadata-taxonomy-field.js +11 -11
- package/dist/esm/lib/components/metadata-editor-fields/components/metadata-taxonomy-field/metadata-taxonomy-picker-field/metadata-taxonomy-picker-field.js +11 -11
- package/dist/esm/lib/components/metadata-editor-fields/metadata-editor-field-wrapper.js +33 -33
- package/dist/esm/lib/components/metadata-editor-fields/metadata-editor-fields.js +10 -10
- package/dist/esm/lib/components/metadata-empty-state/metadata-empty-state.js +12 -12
- package/dist/esm/lib/components/metadata-instance-editor/subcomponents/metadata-instance-form-inline-notice/metadata-instance-form-inline-notice.js +10 -10
- package/dist/esm/lib/components/metadata-instance-list/subcomponents/metadata-instance-entry/metadata-entry-display.js +4 -4
- package/dist/esm/lib/components/metadata-instance-list/subcomponents/metadata-instance-entry/taxonomy-entry/taxonomy-value.js +6 -6
- package/dist/esm/lib/components/metadata-instance-review-notice/metadata-instance-review-notice.js +7 -7
- package/dist/esm/lib/components/unsaved-changes-modal/unsaved-changes-modal.js +16 -16
- package/dist/styles/add-metadata-template-dropdown-with-browser.css +1 -0
- package/dist/types/index.d.ts +1 -1
- package/dist/types/lib/components/add-metadata-template-dropdown/add-metadata-template-dropdown-with-browser.d.ts +16 -0
- package/dist/types/lib/components/add-metadata-template-dropdown/add-metadata-template-dropdown.d.ts +9 -1
- package/dist/types/lib/components/add-metadata-template-dropdown/index.d.ts +3 -1
- package/dist/types/lib/components/add-metadata-template-dropdown/shared/dropdown-trigger.d.ts +6 -0
- package/dist/types/lib/components/add-metadata-template-dropdown/types.d.ts +32 -22
- package/package.json +1 -1
- package/dist/chunks/add-metadata-template-dropdown.js +0 -84
- package/dist/styles/add-metadata-template-dropdown.css +0 -1
|
@@ -2,13 +2,13 @@ import { EVENT_NAMES as e } from "../../../../utils/analytics/events.js";
|
|
|
2
2
|
import { useMetadataEditorAnalytics as t } from "../../../../utils/analytics/analytics-context.js";
|
|
3
3
|
import n from "../../../../utils/confidence-score/messages.js";
|
|
4
4
|
import r from "../../messages.js";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
5
|
+
import { useIntl as i } from "react-intl";
|
|
6
|
+
import { jsx as a } from "react/jsx-runtime";
|
|
7
|
+
import { Status as o, Tooltip as s } from "@box/blueprint-web";
|
|
8
8
|
import { SurfaceStatusSurfaceGray as c } from "@box/blueprint-web-assets/tokens/tokens";
|
|
9
9
|
import { AlertCircle as l } from "@box/blueprint-web-assets/icons/Medium";
|
|
10
10
|
function u() {
|
|
11
|
-
let { formatMessage: u } =
|
|
11
|
+
let { formatMessage: u } = i(), { trackEvent: d } = t(), f = /* @__PURE__ */ a(o, {
|
|
12
12
|
color: c,
|
|
13
13
|
interactive: !0,
|
|
14
14
|
text: u(r.lowConfidenceBadge).toUpperCase(),
|
|
@@ -16,7 +16,7 @@ function u() {
|
|
|
16
16
|
iconPosition: "left",
|
|
17
17
|
onMouseEnter: () => d(e.LOW_CONF_BADGE_HOVER)
|
|
18
18
|
});
|
|
19
|
-
return /* @__PURE__ */ s
|
|
19
|
+
return /* @__PURE__ */ a(s, {
|
|
20
20
|
content: u(n.tooltipLowConfidence),
|
|
21
21
|
children: f
|
|
22
22
|
});
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { t as e } from "../../../../../../chunks/field-action-bar.module.js";
|
|
2
2
|
import t from "./messages.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
3
|
+
import { useEffect as n, useRef as r, useState as i } from "react";
|
|
4
|
+
import { useIntl as a } from "react-intl";
|
|
5
|
+
import { jsx as o, jsxs as s } from "react/jsx-runtime";
|
|
6
|
+
import { IconButton as c, LoadingIndicator as l, Text as u, Tooltip as d, useBlueprintModernization as f } from "@box/blueprint-web";
|
|
7
7
|
import { Checkmark as p, XMark as m } from "@box/blueprint-web-assets/icons/Medium";
|
|
8
8
|
var h = 800;
|
|
9
9
|
function g({ onAccept: g, onClear: _ }) {
|
|
10
|
-
let v =
|
|
11
|
-
|
|
10
|
+
let v = a(), { enableModernizedComponents: y } = f(), [b, x] = i(!1), S = r(void 0);
|
|
11
|
+
n(() => () => clearTimeout(S.current), []);
|
|
12
12
|
let C = (e) => {
|
|
13
13
|
clearTimeout(S.current), x(!0);
|
|
14
14
|
try {
|
|
@@ -19,41 +19,41 @@ function g({ onAccept: g, onClear: _ }) {
|
|
|
19
19
|
}, h);
|
|
20
20
|
}
|
|
21
21
|
};
|
|
22
|
-
return /* @__PURE__ */
|
|
22
|
+
return /* @__PURE__ */ o("div", {
|
|
23
23
|
className: e.wrapperGradient,
|
|
24
24
|
"data-modern": y,
|
|
25
|
-
children: /* @__PURE__ */
|
|
25
|
+
children: /* @__PURE__ */ s("div", {
|
|
26
26
|
className: e.wrapper,
|
|
27
|
-
children: [/* @__PURE__ */
|
|
27
|
+
children: [/* @__PURE__ */ s("div", { children: [/* @__PURE__ */ o(u, {
|
|
28
28
|
as: "p",
|
|
29
29
|
color: "textOnLightSecondary",
|
|
30
30
|
variant: "caption",
|
|
31
31
|
children: v.formatMessage(t.needsReview)
|
|
32
|
-
}), /* @__PURE__ */
|
|
32
|
+
}), /* @__PURE__ */ o(u, {
|
|
33
33
|
as: "p",
|
|
34
34
|
color: "textOnLightDefault",
|
|
35
35
|
variant: "bodySmallSemibold",
|
|
36
36
|
children: v.formatMessage(t.description)
|
|
37
|
-
})] }), b ? /* @__PURE__ */
|
|
37
|
+
})] }), b ? /* @__PURE__ */ o("div", {
|
|
38
38
|
className: e.loader,
|
|
39
|
-
children: /* @__PURE__ */
|
|
39
|
+
children: /* @__PURE__ */ o(l, {
|
|
40
40
|
"aria-label": v.formatMessage(t.reviewActionLoadingAriaLabel),
|
|
41
41
|
size: "small"
|
|
42
42
|
})
|
|
43
|
-
}) : /* @__PURE__ */
|
|
43
|
+
}) : /* @__PURE__ */ s("div", {
|
|
44
44
|
className: e.buttons,
|
|
45
|
-
children: [/* @__PURE__ */ d
|
|
45
|
+
children: [/* @__PURE__ */ o(d, {
|
|
46
46
|
content: v.formatMessage(t.acceptValueTooltip),
|
|
47
|
-
children: /* @__PURE__ */
|
|
47
|
+
children: /* @__PURE__ */ o(c, {
|
|
48
48
|
"aria-label": v.formatMessage(t.acceptValueAriaLabel),
|
|
49
49
|
"data-target-id": "IconButton-metadataEditorLowConfAccept",
|
|
50
50
|
icon: p,
|
|
51
51
|
onClick: () => C(g),
|
|
52
52
|
size: "x-small"
|
|
53
53
|
})
|
|
54
|
-
}), /* @__PURE__ */ d
|
|
54
|
+
}), /* @__PURE__ */ o(d, {
|
|
55
55
|
content: v.formatMessage(t.clearValueTooltip),
|
|
56
|
-
children: /* @__PURE__ */
|
|
56
|
+
children: /* @__PURE__ */ o(c, {
|
|
57
57
|
"aria-label": v.formatMessage(t.clearValueAriaLabel),
|
|
58
58
|
"data-target-id": "IconButton-metadataEditorLowConfClear",
|
|
59
59
|
icon: m,
|
|
@@ -1,33 +1,33 @@
|
|
|
1
1
|
import e from "../../../../messages.js";
|
|
2
2
|
import { convertCalendarDateToISOString as t, convertIsoStringToCalendarDate as n } from "../../../../utils/convertDate.js";
|
|
3
3
|
import { useMemoizedFieldLabel as r } from "../../hooks/use-memoized-field-label.js";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
4
|
+
import { forwardRef as i, memo as a, useCallback as o, useMemo as s } from "react";
|
|
5
|
+
import { useIntl as c } from "react-intl";
|
|
6
|
+
import { jsx as l } from "react/jsx-runtime";
|
|
7
|
+
import { DateI18nProvider as u, DatePicker as d } from "@box/blueprint-web";
|
|
8
8
|
import { getIn as f, useFormikContext as p } from "formik";
|
|
9
|
-
var m = /*#__PURE__*/
|
|
10
|
-
let C = `${x ?? _}.value`, w =
|
|
9
|
+
var m = /*#__PURE__*/ a(d), h = /*#__PURE__*/ i(({ className: i, description: a, isAiSuggestionApplied: d, confidenceScore: h, disableForm: g, fieldNamePrefix: _, label: v, onValueEdited: y, portalElement: b, updateModePrefix: x }, S) => {
|
|
10
|
+
let C = `${x ?? _}.value`, w = c(), { values: T, errors: E, touched: D, setFieldTouched: O, setFieldValue: k } = p(), A = f(T, C), j = s(() => n(A), [A]), M = f(D, C) ? f(E, C) : void 0, N = r(v, a, d, "span", h), P = o((e) => {
|
|
11
11
|
k(C, t(e)), y();
|
|
12
12
|
}, [
|
|
13
13
|
C,
|
|
14
14
|
k,
|
|
15
15
|
y
|
|
16
|
-
]), F =
|
|
16
|
+
]), F = o(() => {
|
|
17
17
|
O(C, !0);
|
|
18
18
|
}, [C, O]);
|
|
19
|
-
return /* @__PURE__ */
|
|
19
|
+
return /* @__PURE__ */ l("div", {
|
|
20
20
|
"data-testid": `${v}-field`,
|
|
21
|
-
children: /* @__PURE__ */
|
|
21
|
+
children: /* @__PURE__ */ l(u, {
|
|
22
22
|
locale: w.locale,
|
|
23
|
-
children: /* @__PURE__ */
|
|
23
|
+
children: /* @__PURE__ */ l(m, {
|
|
24
24
|
calendarAriaLabel: w.formatMessage(e.selectDate),
|
|
25
25
|
clearDatePickerAriaLabel: w.formatMessage(e.clearSelectedDate),
|
|
26
26
|
nextMonthAriaLabel: w.formatMessage(e.switchToNextMonth),
|
|
27
27
|
openCalendarDropdownAriaLabel: w.formatMessage(e.openCalendar),
|
|
28
28
|
previousMonthAriaLabel: w.formatMessage(e.switchToPreviousMonth),
|
|
29
29
|
ref: S,
|
|
30
|
-
className:
|
|
30
|
+
className: i,
|
|
31
31
|
dataTargetId: "DatePicker-MetadataEditorDateField",
|
|
32
32
|
error: M,
|
|
33
33
|
isDisabled: g,
|
|
@@ -2,39 +2,39 @@ import e from "../../../../messages.js";
|
|
|
2
2
|
import "../update-mode-field-wrapper/mulitple-values-utils.js";
|
|
3
3
|
import { messages as t } from "../update-mode-field-wrapper/messages.js";
|
|
4
4
|
import { useMemoizedFieldLabel as n } from "../../hooks/use-memoized-field-label.js";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
5
|
+
import { forwardRef as r } from "react";
|
|
6
|
+
import { FormattedMessage as i, useIntl as a } from "react-intl";
|
|
7
|
+
import { jsx as o, jsxs as s } from "react/jsx-runtime";
|
|
8
|
+
import { SELECT_EMPTY_VALUE as c, Select as l } from "@box/blueprint-web";
|
|
9
9
|
import { Field as u, getIn as d, useFormikContext as f } from "formik";
|
|
10
|
-
var p = /*#__PURE__*/
|
|
11
|
-
let { setFieldValue: w, values: T } = f(), { formatMessage: E } =
|
|
12
|
-
return /* @__PURE__ */
|
|
10
|
+
var p = /*#__PURE__*/ r(({ className: r, isAiSuggestionApplied: p, confidenceScore: m, description: h, disableForm: g, fieldNamePrefix: _, updateModePrefix: v, label: y, onValueEdited: b, options: x, portalElement: S }, C) => {
|
|
11
|
+
let { setFieldValue: w, values: T } = f(), { formatMessage: E } = a(), D = `${v ?? _}.value`, O = E(t.multipleValues), k = (x || d(T, `${_}.options`, [])).map((e) => typeof e == "string" ? e : e.key), A = E(e.selectValuePlaceholder), j = n(y, h, p, "label", m), M = (e) => e === "Multiple values" ? O : e;
|
|
12
|
+
return /* @__PURE__ */ o("div", {
|
|
13
13
|
"data-testid": `${y}-field`,
|
|
14
|
-
children: /* @__PURE__ */
|
|
14
|
+
children: /* @__PURE__ */ o(u, {
|
|
15
15
|
name: D,
|
|
16
|
-
children: ({ field: t }) => /* @__PURE__ */
|
|
16
|
+
children: ({ field: t }) => /* @__PURE__ */ o(l, {
|
|
17
17
|
ref: C,
|
|
18
|
-
className:
|
|
18
|
+
className: r,
|
|
19
19
|
"data-target-id": "Select-MetadataEditorEnumField",
|
|
20
20
|
disabled: g,
|
|
21
21
|
label: j,
|
|
22
22
|
onValueChange: (e) => {
|
|
23
|
-
w(D, e ===
|
|
23
|
+
w(D, e === c ? "" : e), b();
|
|
24
24
|
},
|
|
25
25
|
placeholder: A,
|
|
26
26
|
...t,
|
|
27
|
-
value: t.value ===
|
|
28
|
-
children: /* @__PURE__ */ l
|
|
27
|
+
value: t.value === c ? "" : t.value,
|
|
28
|
+
children: /* @__PURE__ */ s(l.Content, {
|
|
29
29
|
container: S,
|
|
30
30
|
onEscapeKeyDown: (e) => e.stopPropagation(),
|
|
31
|
-
children: [/* @__PURE__ */
|
|
31
|
+
children: [/* @__PURE__ */ o(l.Option, {
|
|
32
32
|
text: A,
|
|
33
|
-
value:
|
|
34
|
-
children: /* @__PURE__ */
|
|
33
|
+
value: c,
|
|
34
|
+
children: /* @__PURE__ */ o(i, { ...e.selectValuePlaceholder })
|
|
35
35
|
}), k?.map((e) => {
|
|
36
36
|
let t = M(e);
|
|
37
|
-
return /* @__PURE__ */
|
|
37
|
+
return /* @__PURE__ */ o(l.Option, {
|
|
38
38
|
text: t,
|
|
39
39
|
value: e,
|
|
40
40
|
children: t
|
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
import { useMemoizedFieldLabel as e } from "../../hooks/use-memoized-field-label.js";
|
|
2
2
|
import { useFloatValidation as t } from "./use-float-validation.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
3
|
+
import { forwardRef as n, useRef as r } from "react";
|
|
4
|
+
import { jsx as i } from "react/jsx-runtime";
|
|
5
|
+
import { TextInput as a } from "@box/blueprint-web";
|
|
6
6
|
import { Field as o, getIn as s, useFormikContext as c } from "formik";
|
|
7
|
-
var l = /*#__PURE__*/
|
|
8
|
-
let { values: v, setFieldValue: y, setFieldTouched: b } = c(), x = `${g ?? p}.value`, S =
|
|
7
|
+
var l = /*#__PURE__*/ n(({ className: n, description: l, isAiSuggestionApplied: u, confidenceScore: d, label: f, fieldNamePrefix: p, disableForm: m, onValueEdited: h, updateModePrefix: g }, _) => {
|
|
8
|
+
let { values: v, setFieldValue: y, setFieldTouched: b } = c(), x = `${g ?? p}.value`, S = r(s(v, x)), { validateFloats: C } = t(), w = e(f, l, u, "label", d), T = (e) => {
|
|
9
9
|
S.current = e, y(x, e), h();
|
|
10
10
|
}, E = (e) => {
|
|
11
11
|
b(e, !0);
|
|
12
12
|
};
|
|
13
|
-
return /* @__PURE__ */
|
|
13
|
+
return /* @__PURE__ */ i("div", {
|
|
14
14
|
"data-testid": `${f}-field`,
|
|
15
|
-
children: /* @__PURE__ */
|
|
15
|
+
children: /* @__PURE__ */ i(o, {
|
|
16
16
|
name: `${x}`,
|
|
17
17
|
validate: () => C(S.current),
|
|
18
|
-
children: ({ field: e, meta: t }) => /* @__PURE__ */ a
|
|
18
|
+
children: ({ field: e, meta: t }) => /* @__PURE__ */ i(a, {
|
|
19
19
|
...e,
|
|
20
20
|
ref: _,
|
|
21
|
-
className:
|
|
21
|
+
className: n,
|
|
22
22
|
"data-target-id": "TextInput-MetadataEditorFloatField",
|
|
23
23
|
disabled: m,
|
|
24
24
|
error: t.error,
|
|
@@ -2,23 +2,23 @@ import e from "../../../../messages.js";
|
|
|
2
2
|
import "../update-mode-field-wrapper/mulitple-values-utils.js";
|
|
3
3
|
import { messages as t } from "../update-mode-field-wrapper/messages.js";
|
|
4
4
|
import { useMemoizedFieldLabel as n } from "../../hooks/use-memoized-field-label.js";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
5
|
+
import { forwardRef as r } from "react";
|
|
6
|
+
import { useIntl as i } from "react-intl";
|
|
7
|
+
import { jsx as a } from "react/jsx-runtime";
|
|
8
|
+
import { Combobox as o } from "@box/blueprint-web";
|
|
9
9
|
import { Field as s, getIn as c, useFormikContext as l } from "formik";
|
|
10
|
-
var u = /*#__PURE__*/
|
|
11
|
-
let { setFieldValue: x, values: S } = l(), { formatMessage: C } =
|
|
12
|
-
return /* @__PURE__ */
|
|
10
|
+
var u = /*#__PURE__*/ r(({ className: r, isAiSuggestionApplied: u, confidenceScore: d, description: f, disableForm: p, fieldNamePrefix: m, label: h, onValueEdited: g, options: _, portalElement: v, updateModePrefix: y }, b) => {
|
|
11
|
+
let { setFieldValue: x, values: S } = l(), { formatMessage: C } = i(), w = `${y ?? m}.value`, T = C(t.multipleValues), E = (_ || c(S, `${m}.options`, [])).map((e) => typeof e == "string" ? e : e.key), D = n(h, f, u, "label", d), O = (e, t) => t.toLowerCase().includes(e.toLowerCase());
|
|
12
|
+
return /* @__PURE__ */ a("div", {
|
|
13
13
|
"data-testid": `${h}-field`,
|
|
14
|
-
children: /* @__PURE__ */
|
|
14
|
+
children: /* @__PURE__ */ a(s, {
|
|
15
15
|
name: w,
|
|
16
16
|
children: ({ field: t }) => {
|
|
17
17
|
let n = (t.value?.length || 0) === 0 ? C(e.multiselectPlaceholder) : "";
|
|
18
|
-
return /* @__PURE__ */ o
|
|
18
|
+
return /* @__PURE__ */ a(o, {
|
|
19
19
|
ref: b,
|
|
20
20
|
as: "input",
|
|
21
|
-
className:
|
|
21
|
+
className: r,
|
|
22
22
|
"data-target-id": "Combobox-MetadataEditorMultiSelectField",
|
|
23
23
|
disabled: p,
|
|
24
24
|
displayValue: (e) => e === "Multiple values" ? T : e,
|
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
import e from "../../../../messages.js";
|
|
2
2
|
import { useMemoizedFieldLabel as t } from "../../hooks/use-memoized-field-label.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
3
|
+
import { forwardRef as n } from "react";
|
|
4
|
+
import { useIntl as r } from "react-intl";
|
|
5
|
+
import { jsx as i } from "react/jsx-runtime";
|
|
6
|
+
import { TextInput as a } from "@box/blueprint-web";
|
|
7
7
|
import { Field as o } from "formik";
|
|
8
|
-
var s = /*#__PURE__*/
|
|
9
|
-
let g =
|
|
10
|
-
return /* @__PURE__ */
|
|
8
|
+
var s = /*#__PURE__*/ n(({ className: n, description: s, isAiSuggestionApplied: c, confidenceScore: l, disableForm: u, fieldNamePrefix: d, label: f, onValueEdited: p, updateModePrefix: m }, h) => {
|
|
9
|
+
let g = r(), _ = `${m ?? d}.value`, v = t(f, s, c, "label", l);
|
|
10
|
+
return /* @__PURE__ */ i("div", {
|
|
11
11
|
"data-testid": `${f}-field`,
|
|
12
|
-
children: /* @__PURE__ */
|
|
12
|
+
children: /* @__PURE__ */ i(o, {
|
|
13
13
|
name: _,
|
|
14
|
-
children: ({ field: t, meta:
|
|
14
|
+
children: ({ field: t, meta: r }) => /* @__PURE__ */ i(a, {
|
|
15
15
|
...t,
|
|
16
16
|
ref: h,
|
|
17
|
-
className:
|
|
17
|
+
className: n,
|
|
18
18
|
"data-target-id": "TextInput-metadataEditorStringField",
|
|
19
19
|
disabled: u,
|
|
20
|
-
error:
|
|
20
|
+
error: r.error,
|
|
21
21
|
label: v,
|
|
22
22
|
onChangeCapture: p,
|
|
23
23
|
placeholder: g.formatMessage(e.setValuePlaceholder)
|
|
@@ -2,14 +2,14 @@ import e from "../../../../messages.js";
|
|
|
2
2
|
import "../update-mode-field-wrapper/mulitple-values-utils.js";
|
|
3
3
|
import { messages as t } from "../update-mode-field-wrapper/messages.js";
|
|
4
4
|
import { useMemoizedFieldLabel as n } from "../../hooks/use-memoized-field-label.js";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
5
|
+
import { forwardRef as r, useCallback as i } from "react";
|
|
6
|
+
import { useIntl as a } from "react-intl";
|
|
7
|
+
import { jsx as o } from "react/jsx-runtime";
|
|
8
|
+
import { Tooltip as s } from "@box/blueprint-web";
|
|
9
9
|
import { Field as c, getIn as l, useFormikContext as u } from "formik";
|
|
10
10
|
import { ComboboxWithApiPagination as d, ComboboxWithApiTreeView as f } from "@box/combobox-with-api";
|
|
11
|
-
var p = (e, t) => e === "Multiple values" ? t : e, m = /*#__PURE__*/
|
|
12
|
-
let { formatMessage: D } =
|
|
11
|
+
var p = (e, t) => e === "Multiple values" ? t : e, m = /*#__PURE__*/ r(({ description: r, disableForm: m, isAiSuggestionApplied: h, confidenceScore: g, fieldNamePrefix: _, label: v, onValueEdited: y, portalElement: b, taxonomyOptionsFetcher: x, updateModePrefix: S, className: C, isExternallyOwned: w, isMultilevelTaxonomyFieldEnabled: T }, E) => {
|
|
12
|
+
let { formatMessage: D } = a(), O = `${S ?? _}.value`, { setFieldValue: k, values: A } = u(), { metadata: { templateKey: j, scope: M } } = A, { key: N, optionsRules: { multiSelect: P, selectableLevels: F }, levels: I } = l(A, _), L = D(t.multipleValues), R = T && F?.some((e) => e > 1), z = m || w, B = n(v, r, h, "label", g), V = i((e) => x(M, j, N, F?.[0], e), [
|
|
13
13
|
N,
|
|
14
14
|
M,
|
|
15
15
|
F,
|
|
@@ -17,18 +17,18 @@ var p = (e, t) => e === "Multiple values" ? t : e, m = /*#__PURE__*/ i(({ descri
|
|
|
17
17
|
j
|
|
18
18
|
]), H = (t) => P || !t?.length ? D(e.taxonomyPlaceholder) : void 0, U = (e) => {
|
|
19
19
|
k(O, e), y();
|
|
20
|
-
}, W = /* @__PURE__ */
|
|
20
|
+
}, W = /* @__PURE__ */ o("div", {
|
|
21
21
|
"data-testid": `${v}-field`,
|
|
22
22
|
onKeyDown: (e) => e.stopPropagation(),
|
|
23
23
|
role: "presentation",
|
|
24
|
-
children: /* @__PURE__ */
|
|
24
|
+
children: /* @__PURE__ */ o(c, {
|
|
25
25
|
name: O,
|
|
26
26
|
children: ({ field: e }) => {
|
|
27
27
|
let t = Array.isArray(e.value) ? e.value.map((e) => ({
|
|
28
28
|
...e,
|
|
29
29
|
displayValue: p(e.displayValue, L)
|
|
30
30
|
})) : e.value;
|
|
31
|
-
return R ? /* @__PURE__ */
|
|
31
|
+
return R ? /* @__PURE__ */ o(f, {
|
|
32
32
|
ref: E,
|
|
33
33
|
className: C,
|
|
34
34
|
closeOnSelection: R,
|
|
@@ -43,7 +43,7 @@ var p = (e, t) => e === "Multiple values" ? t : e, m = /*#__PURE__*/ i(({ descri
|
|
|
43
43
|
portalElement: b,
|
|
44
44
|
selectableLevels: F,
|
|
45
45
|
value: t
|
|
46
|
-
}) : /* @__PURE__ */
|
|
46
|
+
}) : /* @__PURE__ */ o(d, {
|
|
47
47
|
ref: E,
|
|
48
48
|
className: C,
|
|
49
49
|
dataTargetId: "ComboboxWithApiPagination-MetadataEditorTaxonomyField",
|
|
@@ -59,7 +59,7 @@ var p = (e, t) => e === "Multiple values" ? t : e, m = /*#__PURE__*/ i(({ descri
|
|
|
59
59
|
}
|
|
60
60
|
})
|
|
61
61
|
});
|
|
62
|
-
return w ? /* @__PURE__ */ s
|
|
62
|
+
return w ? /* @__PURE__ */ o(s, {
|
|
63
63
|
content: D(e.taxonomyExternallyOwned),
|
|
64
64
|
children: W
|
|
65
65
|
}) : W;
|
|
@@ -2,14 +2,14 @@ import e from "../../../../../messages.js";
|
|
|
2
2
|
import { messages as t } from "../../update-mode-field-wrapper/messages.js";
|
|
3
3
|
import { n } from "../../../../../../../chunks/utils.js";
|
|
4
4
|
import { getTaxonomyPickerMode as r, mapFormValueToTaxonomyValues as i, mapLevelsToTaxonomyLevels as a, mapTaxonomyValuesToFormValue as o } from "./value-mapping.js";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
5
|
+
import { forwardRef as s, useMemo as c } from "react";
|
|
6
|
+
import { useIntl as l } from "react-intl";
|
|
7
|
+
import { jsx as u } from "react/jsx-runtime";
|
|
8
|
+
import { Tooltip as d } from "@box/blueprint-web";
|
|
9
9
|
import { Field as f, getIn as p, useFormikContext as m } from "formik";
|
|
10
10
|
import { MetadataTaxonomyPicker as h } from "@box/metadata-taxonomy-picker";
|
|
11
|
-
var g = /*#__PURE__*/
|
|
12
|
-
let { formatMessage: O } =
|
|
11
|
+
var g = /*#__PURE__*/ s(({ description: s, disableForm: g, isAiSuggestionApplied: _, confidenceScore: v, fieldNamePrefix: y, label: b, onValueEdited: x, portalElement: S, updateModePrefix: C, className: w, isExternallyOwned: T, createTaxonomyItemsService: E }, D) => {
|
|
12
|
+
let { formatMessage: O } = l(), k = `${C ?? y}.value`, { setFieldValue: A, values: j } = m(), { metadata: { templateKey: M, scope: N } } = j, { key: P, optionsRules: { multiSelect: F, selectableLevels: I }, levels: L } = p(j, y), R = O(t.multipleValues), z = g || T, B = c(() => E({
|
|
13
13
|
scope: N,
|
|
14
14
|
templateKey: M,
|
|
15
15
|
fieldKey: P
|
|
@@ -18,17 +18,17 @@ var g = /*#__PURE__*/ c(({ description: c, disableForm: g, isAiSuggestionApplied
|
|
|
18
18
|
N,
|
|
19
19
|
M,
|
|
20
20
|
P
|
|
21
|
-
]), V = r(I), H =
|
|
21
|
+
]), V = r(I), H = c(() => a(L, I), [L, I]), U = n(b, s ?? void 0, _, v), W = (t) => F || !t.length ? O(e.taxonomyPlaceholder) : void 0, G = (e) => {
|
|
22
22
|
A(k, o(e)), x();
|
|
23
|
-
}, K = /* @__PURE__ */
|
|
23
|
+
}, K = /* @__PURE__ */ u("div", {
|
|
24
24
|
"data-testid": `${b}-field`,
|
|
25
25
|
onKeyDown: (e) => e.stopPropagation(),
|
|
26
26
|
role: "presentation",
|
|
27
|
-
children: /* @__PURE__ */
|
|
27
|
+
children: /* @__PURE__ */ u(f, {
|
|
28
28
|
name: k,
|
|
29
29
|
children: ({ field: e }) => {
|
|
30
30
|
let t = i(e.value, R);
|
|
31
|
-
return /* @__PURE__ */
|
|
31
|
+
return /* @__PURE__ */ u(h, {
|
|
32
32
|
ref: D,
|
|
33
33
|
containerClassName: w,
|
|
34
34
|
disabled: z,
|
|
@@ -45,7 +45,7 @@ var g = /*#__PURE__*/ c(({ description: c, disableForm: g, isAiSuggestionApplied
|
|
|
45
45
|
}
|
|
46
46
|
})
|
|
47
47
|
});
|
|
48
|
-
return T ? /* @__PURE__ */ d
|
|
48
|
+
return T ? /* @__PURE__ */ u(d, {
|
|
49
49
|
content: O(e.taxonomyExternallyOwned),
|
|
50
50
|
children: K
|
|
51
51
|
}) : K;
|
|
@@ -4,31 +4,31 @@ import { checkIfHasBoundingBoxes as n } from "../../utils/check-if-has-bounding-
|
|
|
4
4
|
import { isConfidenceScoreNeedingReview as r } from "../../utils/confidence-score/is-confidence-score-needing-review.js";
|
|
5
5
|
import { isInteractiveFormElement as i } from "../../utils/is-interactive-form-element.js";
|
|
6
6
|
import { t as a } from "../../../../chunks/shared-field-styles.module.js";
|
|
7
|
-
import { t as
|
|
8
|
-
import { LowConfidenceSuggestionField as
|
|
7
|
+
import { t as ee } from "../../../../chunks/ai-suggestion-field.js";
|
|
8
|
+
import { LowConfidenceSuggestionField as o } from "./components/low-confidence-suggestion-field/low-confidence-suggestion-field.js";
|
|
9
9
|
import { t as te } from "../../../../chunks/update-mode-field-wrapper.js";
|
|
10
10
|
import { i as s } from "../../../../chunks/utils.js";
|
|
11
11
|
import { editorFieldTypes as ne } from "./editor-field-types.js";
|
|
12
12
|
import { useViewReferenceTooltip as re } from "./hooks/use-view-reference-tooltip.js";
|
|
13
|
-
import {
|
|
14
|
-
import { forwardRef as l, memo as u, useCallback as d, useEffect as f, useMemo as ie } from "react";
|
|
13
|
+
import { forwardRef as c, memo as l, useCallback as u, useEffect as d, useMemo as ie } from "react";
|
|
15
14
|
import { useIntl as ae } from "react-intl";
|
|
16
|
-
import { jsx as
|
|
17
|
-
import
|
|
15
|
+
import { jsx as f, jsxs as oe } from "react/jsx-runtime";
|
|
16
|
+
import p from "clsx";
|
|
17
|
+
import { Tooltip as m } from "@box/blueprint-web";
|
|
18
18
|
import { useFormikContext as h } from "formik";
|
|
19
19
|
import se from "lodash/isEqual";
|
|
20
20
|
import ce from "lodash/isUndefined";
|
|
21
|
-
var g = /*#__PURE__*/
|
|
22
|
-
let { setFieldValue: T } = h(), { formatMessage: E } = ae(), D = g.aiSuggestionState || t.Initial, O = D === t.Pending, k = D === t.Applied, A = D === t.Initial, j = ne[g.type], { aiSuggestion: M, aiSuggestionConfidenceScore: N, aiSuggestionTargetLocation: P, type: F, value: I } = g, L = j && !g.hidden, R = !ce(g.updateMode), z = `metadata.fields[${le}]`, B = g.type === "taxonomy" && g.optionsRules?.multiSelect, V = ue || S, H = S && !!g.confidenceScore, U = H && r(g.confidenceScore), fe = H && !O && !r(g.confidenceScore), W = de === g.id, pe = n(g.targetLocation), G = V && pe && !!C, { isTooltipOpen: K, handleMouseOver: me, handleMouseLeave: he, handleFocus: ge, handleBlur: _e } = re(G), ve =
|
|
21
|
+
var g = /*#__PURE__*/ l(/*#__PURE__*/ c(({ disableForm: c, portalElement: l, field: g, index: le, taxonomyOptionsFetcher: _, isExternallyOwned: v, isMultilevelTaxonomyFieldEnabled: y, isTaxonomyPickerEnabled: b, createTaxonomyItemsService: x, isConfidenceScoreReviewEnabled: S = !1, isBoundingBoxEnabled: ue = !1, onSelectMetadataField: C, selectedMetadataFieldId: de }, w) => {
|
|
22
|
+
let { setFieldValue: T } = h(), { formatMessage: E } = ae(), D = g.aiSuggestionState || t.Initial, O = D === t.Pending, k = D === t.Applied, A = D === t.Initial, j = ne[g.type], { aiSuggestion: M, aiSuggestionConfidenceScore: N, aiSuggestionTargetLocation: P, type: F, value: I } = g, L = j && !g.hidden, R = !ce(g.updateMode), z = `metadata.fields[${le}]`, B = g.type === "taxonomy" && g.optionsRules?.multiSelect, V = ue || S, H = S && !!g.confidenceScore, U = H && r(g.confidenceScore), fe = H && !O && !r(g.confidenceScore), W = de === g.id, pe = n(g.targetLocation), G = V && pe && !!C, { isTooltipOpen: K, handleMouseOver: me, handleMouseLeave: he, handleFocus: ge, handleBlur: _e } = re(G), ve = p({
|
|
23
23
|
[s.aiApproved]: k || fe || g.isExtracted,
|
|
24
24
|
[s.hasSuggestion]: O,
|
|
25
25
|
[s.hasConfidenceReview]: !O && U,
|
|
26
26
|
[s.dateField]: F === "date"
|
|
27
|
-
}), q =
|
|
27
|
+
}), q = u((e, t) => {
|
|
28
28
|
T(`${z}.${e}`, t);
|
|
29
|
-
}, [z, T]), J =
|
|
29
|
+
}, [z, T]), J = u((e) => {
|
|
30
30
|
q("aiSuggestionState", e);
|
|
31
|
-
}, [q]), Y =
|
|
31
|
+
}, [q]), Y = u((e, n = !1) => {
|
|
32
32
|
q("value", e), J(t.Applied), q("isExtracted", !0), V && P && (q("targetLocation", P), q("aiSuggestionTargetLocation", void 0)), S && N && (q("confidenceScore", n ? {
|
|
33
33
|
...N,
|
|
34
34
|
isAccepted: !0
|
|
@@ -40,14 +40,14 @@ var g = /*#__PURE__*/ u(/*#__PURE__*/ l(({ disableForm: l, portalElement: u, fie
|
|
|
40
40
|
P,
|
|
41
41
|
S,
|
|
42
42
|
V
|
|
43
|
-
]), X =
|
|
43
|
+
]), X = u(() => {
|
|
44
44
|
J(t.Initial), q("aiSuggestion", void 0), V && q("aiSuggestionTargetLocation", void 0), S && q("aiSuggestionConfidenceScore", void 0);
|
|
45
45
|
}, [
|
|
46
46
|
J,
|
|
47
47
|
q,
|
|
48
48
|
S,
|
|
49
49
|
V
|
|
50
|
-
]), Z =
|
|
50
|
+
]), Z = u(() => {
|
|
51
51
|
g.confidenceScore && q("confidenceScore", {
|
|
52
52
|
...g.confidenceScore,
|
|
53
53
|
isAccepted: !0
|
|
@@ -56,14 +56,14 @@ var g = /*#__PURE__*/ u(/*#__PURE__*/ l(({ disableForm: l, portalElement: u, fie
|
|
|
56
56
|
q,
|
|
57
57
|
g.confidenceScore,
|
|
58
58
|
C
|
|
59
|
-
]), ye =
|
|
59
|
+
]), ye = u(() => {
|
|
60
60
|
J(t.Initial), q("aiSuggestion", void 0), q("isExtracted", !1), q("value", F === "multiSelect" || F === "taxonomy" ? [] : ""), q("confidenceScore", void 0), q("targetLocation", void 0), C?.(null);
|
|
61
61
|
}, [
|
|
62
62
|
q,
|
|
63
63
|
F,
|
|
64
64
|
C,
|
|
65
65
|
J
|
|
66
|
-
]), Q =
|
|
66
|
+
]), Q = u(() => {
|
|
67
67
|
X(), g.isExtracted && q("isExtracted", !1), V && g.targetLocation && (q("targetLocation", void 0), C?.(null)), S && g.confidenceScore && (q("confidenceScore", void 0), C?.(null));
|
|
68
68
|
}, [
|
|
69
69
|
X,
|
|
@@ -74,21 +74,21 @@ var g = /*#__PURE__*/ u(/*#__PURE__*/ l(({ disableForm: l, portalElement: u, fie
|
|
|
74
74
|
q,
|
|
75
75
|
C,
|
|
76
76
|
V
|
|
77
|
-
]), be =
|
|
77
|
+
]), be = u((e) => {
|
|
78
78
|
C && (i(e.target) || C(g));
|
|
79
|
-
}, [g, C]), xe =
|
|
79
|
+
}, [g, C]), xe = u((e) => {
|
|
80
80
|
if (e.key === "Enter") {
|
|
81
81
|
if (!C || i(e.target)) return;
|
|
82
82
|
e.preventDefault(), e.stopPropagation(), C(g);
|
|
83
83
|
}
|
|
84
84
|
}, [g, C]);
|
|
85
|
-
|
|
85
|
+
d(() => {
|
|
86
86
|
O && (!I || Array.isArray(I) && I.length === 0) && Y(M);
|
|
87
87
|
}, [
|
|
88
88
|
M,
|
|
89
89
|
O,
|
|
90
90
|
Y
|
|
91
|
-
]),
|
|
91
|
+
]), d(() => {
|
|
92
92
|
A && M && J(t.Pending);
|
|
93
93
|
}, [
|
|
94
94
|
A,
|
|
@@ -111,14 +111,14 @@ var g = /*#__PURE__*/ u(/*#__PURE__*/ l(({ disableForm: l, portalElement: u, fie
|
|
|
111
111
|
tabIndex: 0
|
|
112
112
|
};
|
|
113
113
|
if (R) {
|
|
114
|
-
let t = /* @__PURE__ */
|
|
114
|
+
let t = /* @__PURE__ */ f(te, {
|
|
115
115
|
fieldNamePrefix: z,
|
|
116
116
|
fieldType: g.type,
|
|
117
117
|
isTaxonomyMultiSelect: B,
|
|
118
|
-
children: /* @__PURE__ */
|
|
118
|
+
children: /* @__PURE__ */ f(j, {
|
|
119
119
|
ref: w,
|
|
120
120
|
description: g.description,
|
|
121
|
-
disableForm:
|
|
121
|
+
disableForm: c,
|
|
122
122
|
fieldNamePrefix: z,
|
|
123
123
|
isAiSuggestionApplied: !1,
|
|
124
124
|
isExternallyOwned: v,
|
|
@@ -128,29 +128,29 @@ var g = /*#__PURE__*/ u(/*#__PURE__*/ l(({ disableForm: l, portalElement: u, fie
|
|
|
128
128
|
label: g.displayName,
|
|
129
129
|
levels: g.levels,
|
|
130
130
|
onValueEdited: Q,
|
|
131
|
-
portalElement:
|
|
131
|
+
portalElement: l,
|
|
132
132
|
taxonomyOptionsFetcher: _
|
|
133
133
|
})
|
|
134
134
|
}, g.key);
|
|
135
|
-
return G ? /* @__PURE__ */
|
|
135
|
+
return G ? /* @__PURE__ */ f(m, {
|
|
136
136
|
content: E(e.viewOnDocument),
|
|
137
137
|
open: K,
|
|
138
|
-
children: /* @__PURE__ */
|
|
139
|
-
className:
|
|
138
|
+
children: /* @__PURE__ */ f("div", {
|
|
139
|
+
className: p(a.spacious, a.clickableField, W && a.selectedField),
|
|
140
140
|
...$,
|
|
141
141
|
children: t
|
|
142
142
|
})
|
|
143
143
|
}) : t;
|
|
144
144
|
}
|
|
145
145
|
let Ce = /* @__PURE__ */ oe("div", {
|
|
146
|
-
className:
|
|
146
|
+
className: p(s.fieldWrapper, V && a.spacious, G && a.clickableField, G && W && a.selectedField),
|
|
147
147
|
...G && $,
|
|
148
148
|
children: [
|
|
149
|
-
/* @__PURE__ */
|
|
149
|
+
/* @__PURE__ */ f(j, {
|
|
150
150
|
ref: w,
|
|
151
151
|
className: ve,
|
|
152
152
|
description: g.description,
|
|
153
|
-
disableForm:
|
|
153
|
+
disableForm: c,
|
|
154
154
|
fieldNamePrefix: z,
|
|
155
155
|
isAiSuggestionApplied: k || g.isExtracted,
|
|
156
156
|
isExternallyOwned: v,
|
|
@@ -160,10 +160,10 @@ var g = /*#__PURE__*/ u(/*#__PURE__*/ l(({ disableForm: l, portalElement: u, fie
|
|
|
160
160
|
createTaxonomyItemsService: x,
|
|
161
161
|
label: g.displayName,
|
|
162
162
|
onValueEdited: Q,
|
|
163
|
-
portalElement:
|
|
163
|
+
portalElement: l,
|
|
164
164
|
taxonomyOptionsFetcher: _
|
|
165
165
|
}),
|
|
166
|
-
O && /* @__PURE__ */
|
|
166
|
+
O && /* @__PURE__ */ f(ee, {
|
|
167
167
|
aiSuggestion: M,
|
|
168
168
|
confidenceLevel: S ? N?.level : void 0,
|
|
169
169
|
isSameValue: Se,
|
|
@@ -174,13 +174,13 @@ var g = /*#__PURE__*/ u(/*#__PURE__*/ l(({ disableForm: l, portalElement: u, fie
|
|
|
174
174
|
onAiSuggestionReplace: () => Y(M, !0),
|
|
175
175
|
type: F
|
|
176
176
|
}),
|
|
177
|
-
!O && U && /* @__PURE__ */
|
|
177
|
+
!O && U && /* @__PURE__ */ f(o, {
|
|
178
178
|
onAccept: Z,
|
|
179
179
|
onClear: ye
|
|
180
180
|
})
|
|
181
181
|
]
|
|
182
182
|
}, g.key);
|
|
183
|
-
return /* @__PURE__ */
|
|
183
|
+
return /* @__PURE__ */ f(m, {
|
|
184
184
|
content: E(e.viewOnDocument),
|
|
185
185
|
open: G && K,
|
|
186
186
|
children: Ce
|