@box/metadata-editor 1.64.4 → 1.64.6
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/ai-suggestion-field.js +83 -0
- package/dist/chunks/autofill-overlay.js +63 -0
- package/dist/chunks/combobox-with-api-pagination.js +162 -0
- package/dist/chunks/custom-instance-new-field.js +60 -0
- package/dist/chunks/custom-instance.js +74 -0
- package/dist/chunks/delete-confirmation-modal.js +76 -0
- package/dist/chunks/field-action-bar.module.js +6 -8
- package/dist/chunks/filter-dropdown-menu.module.js +14 -13
- package/dist/chunks/filter-instances-dropdown.js +84 -0
- package/dist/chunks/interactive-header-text.js +19 -0
- package/dist/chunks/interactive-text.js +17 -0
- package/dist/chunks/metadata-editor.js +9 -0
- package/dist/chunks/metadata-instance-content.js +29 -0
- package/dist/chunks/metadata-instance-entry.js +82 -0
- package/dist/chunks/metadata-instance-footer.js +25 -0
- package/dist/chunks/metadata-instance-form-autofill-button.js +113 -0
- package/dist/chunks/metadata-instance-form-card-wrapper.js +47 -70
- package/dist/chunks/metadata-instance-form-footer.js +43 -0
- package/dist/chunks/metadata-instance-form-header.js +45 -0
- package/dist/chunks/metadata-instance-header.js +52 -0
- package/dist/chunks/metadata-instance-list.js +19 -0
- package/dist/chunks/metadata-instance.js +59 -0
- package/dist/chunks/shared-field-styles.module.js +5 -7
- package/dist/chunks/taxonomy-ancestor-status-pill.js +88 -109
- package/dist/chunks/types.js +8 -12
- package/dist/chunks/update-mode-field-wrapper.js +80 -0
- package/dist/chunks/utils.js +57 -54
- package/dist/chunks/utils2.js +50 -70
- package/dist/esm/index.js +27 -52
- package/dist/esm/lib/components/add-metadata-template-dropdown/add-metadata-template-dropdown.js +31 -43
- package/dist/esm/lib/components/add-metadata-template-dropdown/index.js +1 -3
- package/dist/esm/lib/components/add-metadata-template-dropdown/messages.js +15 -17
- package/dist/esm/lib/components/combobox-with-api-pagination/combobox-with-api-pagination.js +2 -205
- package/dist/esm/lib/components/combobox-with-api-pagination/index.js +2 -4
- package/dist/esm/lib/components/combobox-with-api-pagination/messages.js +31 -33
- package/dist/esm/lib/components/combobox-with-api-pagination/request.js +4 -6
- package/dist/esm/lib/components/combobox-with-api-pagination/use-async-list.js +113 -128
- package/dist/esm/lib/components/combobox-with-api-pagination/utils/is-abort-error.js +8 -10
- package/dist/esm/lib/components/combobox-with-api-pagination/utils/use-controllable-state.js +32 -34
- package/dist/esm/lib/components/combobox-with-api-pagination/utils/use-intersection-observer.js +72 -82
- package/dist/esm/lib/components/filter-dropdown-menu/filter-dropdown-menu-content.js +13 -18
- package/dist/esm/lib/components/filter-dropdown-menu/filter-dropdown-menu-empty-state.js +16 -19
- package/dist/esm/lib/components/filter-dropdown-menu/filter-dropdown-menu-item.js +12 -17
- package/dist/esm/lib/components/filter-dropdown-menu/filter-dropdown-menu-list.js +15 -20
- package/dist/esm/lib/components/filter-dropdown-menu/filter-dropdown-menu-root.js +13 -18
- package/dist/esm/lib/components/filter-dropdown-menu/filter-dropdown-menu-search.js +36 -44
- package/dist/esm/lib/components/filter-dropdown-menu/filter-dropdown-menu-trigger.js +7 -12
- package/dist/esm/lib/components/filter-dropdown-menu/index.js +16 -18
- package/dist/esm/lib/components/filter-dropdown-menu/messages.js +10 -12
- package/dist/esm/lib/components/filter-instances-dropdown/filter-instances-dropdown.js +2 -93
- package/dist/esm/lib/components/filter-instances-dropdown/index.js +2 -4
- package/dist/esm/lib/components/filter-instances-dropdown/messages.js +18 -20
- package/dist/esm/lib/components/interactive-header-text/interactive-header-text.js +2 -28
- package/dist/esm/lib/components/interactive-text/interactive-text.js +2 -30
- package/dist/esm/lib/components/metadata-editor-fields/components/ai-logo-badge/ai-logo-badge.js +20 -32
- package/dist/esm/lib/components/metadata-editor-fields/components/ai-logo-badge/index.js +2 -4
- package/dist/esm/lib/components/metadata-editor-fields/components/ai-suggestion-field/ai-suggestion-field.js +2 -110
- package/dist/esm/lib/components/metadata-editor-fields/components/ai-suggestion-field/index.js +2 -4
- package/dist/esm/lib/components/metadata-editor-fields/components/ai-suggestion-field/messages.js +50 -52
- package/dist/esm/lib/components/metadata-editor-fields/components/ai-suggestion-field/utils.js +12 -17
- package/dist/esm/lib/components/metadata-editor-fields/components/constants.js +2 -6
- package/dist/esm/lib/components/metadata-editor-fields/components/low-confidence-badge/index.js +2 -4
- package/dist/esm/lib/components/metadata-editor-fields/components/low-confidence-badge/low-confidence-badge.js +20 -24
- package/dist/esm/lib/components/metadata-editor-fields/components/low-confidence-suggestion-field/index.js +2 -4
- package/dist/esm/lib/components/metadata-editor-fields/components/low-confidence-suggestion-field/low-confidence-suggestion-field.js +66 -75
- package/dist/esm/lib/components/metadata-editor-fields/components/low-confidence-suggestion-field/messages.js +30 -32
- package/dist/esm/lib/components/metadata-editor-fields/components/metadata-date-field/metadata-date-field.js +43 -60
- package/dist/esm/lib/components/metadata-editor-fields/components/metadata-enum-field/metadata-enum-field.js +47 -71
- package/dist/esm/lib/components/metadata-editor-fields/components/metadata-float-field/metadata-float-field.js +32 -54
- package/dist/esm/lib/components/metadata-editor-fields/components/metadata-float-field/use-float-validation.js +8 -14
- package/dist/esm/lib/components/metadata-editor-fields/components/metadata-multi-select-field/metadata-multi-select-field.js +40 -62
- package/dist/esm/lib/components/metadata-editor-fields/components/metadata-string-field/metadata-string-field.js +28 -44
- package/dist/esm/lib/components/metadata-editor-fields/components/metadata-taxonomy-field/metadata-taxonomy-field.js +66 -95
- package/dist/esm/lib/components/metadata-editor-fields/components/update-mode-field-wrapper/messages.js +30 -32
- package/dist/esm/lib/components/metadata-editor-fields/components/update-mode-field-wrapper/mulitple-values-utils.js +7 -11
- package/dist/esm/lib/components/metadata-editor-fields/components/update-mode-field-wrapper/update-mode-field-wrapper.js +2 -92
- package/dist/esm/lib/components/metadata-editor-fields/editor-field-types.js +30 -34
- package/dist/esm/lib/components/metadata-editor-fields/hooks/use-memoized-field-label.js +11 -7
- package/dist/esm/lib/components/metadata-editor-fields/hooks/use-review-field-filter.js +35 -40
- package/dist/esm/lib/components/metadata-editor-fields/hooks/use-view-reference-tooltip.js +39 -34
- package/dist/esm/lib/components/metadata-editor-fields/messages.js +5 -9
- package/dist/esm/lib/components/metadata-editor-fields/metadata-editor-field-wrapper.js +186 -176
- package/dist/esm/lib/components/metadata-editor-fields/metadata-editor-fields.js +30 -42
- package/dist/esm/lib/components/metadata-editor-fields/utils.js +2 -13
- package/dist/esm/lib/components/metadata-empty-state/messages.js +42 -44
- package/dist/esm/lib/components/metadata-empty-state/metadata-empty-state.js +46 -62
- package/dist/esm/lib/components/metadata-instance-editor/index.js +7 -14
- package/dist/esm/lib/components/metadata-instance-editor/subcomponents/autofill-overlay/autofill-overlay.js +2 -64
- package/dist/esm/lib/components/metadata-instance-editor/subcomponents/autofill-overlay/messages.js +39 -41
- package/dist/esm/lib/components/metadata-instance-editor/subcomponents/autofill-overlay/useErrorMessaging.js +21 -26
- package/dist/esm/lib/components/metadata-instance-editor/subcomponents/custom-instance/custom-instance.js +2 -86
- package/dist/esm/lib/components/metadata-instance-editor/subcomponents/custom-instance/messages.js +15 -17
- package/dist/esm/lib/components/metadata-instance-editor/subcomponents/custom-instance-new-field/custom-instance-new-field.js +2 -62
- package/dist/esm/lib/components/metadata-instance-editor/subcomponents/custom-instance-new-field/messages.js +42 -44
- package/dist/esm/lib/components/metadata-instance-editor/subcomponents/delete-confirmation-modal/delete-confirmation-modal.js +2 -91
- package/dist/esm/lib/components/metadata-instance-editor/subcomponents/delete-confirmation-modal/messages.js +50 -52
- package/dist/esm/lib/components/metadata-instance-editor/subcomponents/metadata-instance-form/constants.js +2 -7
- package/dist/esm/lib/components/metadata-instance-editor/subcomponents/metadata-instance-form/messages.js +0 -1
- package/dist/esm/lib/components/metadata-instance-editor/subcomponents/metadata-instance-form/metadata-instance-form-card-wrapper.js +2 -10
- package/dist/esm/lib/components/metadata-instance-editor/subcomponents/metadata-instance-form/metadata-instance-form.js +126 -155
- package/dist/esm/lib/components/metadata-instance-editor/subcomponents/metadata-instance-form/utils.js +2 -9
- package/dist/esm/lib/components/metadata-instance-editor/subcomponents/metadata-instance-form-autofill-button/messages.js +23 -25
- package/dist/esm/lib/components/metadata-instance-editor/subcomponents/metadata-instance-form-autofill-button/metadata-instance-form-autofill-button.js +2 -128
- package/dist/esm/lib/components/metadata-instance-editor/subcomponents/metadata-instance-form-footer/messages.js +19 -21
- package/dist/esm/lib/components/metadata-instance-editor/subcomponents/metadata-instance-form-footer/metadata-instance-form-footer.js +2 -53
- package/dist/esm/lib/components/metadata-instance-editor/subcomponents/metadata-instance-form-header/messages.js +6 -10
- package/dist/esm/lib/components/metadata-instance-editor/subcomponents/metadata-instance-form-header/metadata-instance-form-header.js +2 -58
- package/dist/esm/lib/components/metadata-instance-editor/subcomponents/metadata-instance-form-inline-notice/messages.js +18 -20
- package/dist/esm/lib/components/metadata-instance-editor/subcomponents/metadata-instance-form-inline-notice/metadata-instance-form-inline-notice.js +30 -37
- package/dist/esm/lib/components/metadata-instance-list/index.js +4 -8
- package/dist/esm/lib/components/metadata-instance-list/metadata-instance-list.js +2 -35
- package/dist/esm/lib/components/metadata-instance-list/subcomponents/metadata-instance/metadata-instance.js +2 -79
- package/dist/esm/lib/components/metadata-instance-list/subcomponents/metadata-instance-content/metadata-instance-content.js +2 -40
- package/dist/esm/lib/components/metadata-instance-list/subcomponents/metadata-instance-entry/messages.js +5 -9
- package/dist/esm/lib/components/metadata-instance-list/subcomponents/metadata-instance-entry/metadata-entry-display.js +14 -24
- package/dist/esm/lib/components/metadata-instance-list/subcomponents/metadata-instance-entry/metadata-instance-entry.js +2 -112
- package/dist/esm/lib/components/metadata-instance-list/subcomponents/metadata-instance-entry/taxonomy-entry/messages.js +22 -24
- package/dist/esm/lib/components/metadata-instance-list/subcomponents/metadata-instance-entry/taxonomy-entry/taxonomy-ancestor-status-pill.js +2 -11
- package/dist/esm/lib/components/metadata-instance-list/subcomponents/metadata-instance-entry/taxonomy-entry/taxonomy-value.js +24 -36
- package/dist/esm/lib/components/metadata-instance-list/subcomponents/metadata-instance-footer/messages.js +10 -12
- package/dist/esm/lib/components/metadata-instance-list/subcomponents/metadata-instance-footer/metadata-instance-footer.js +2 -31
- package/dist/esm/lib/components/metadata-instance-list/subcomponents/metadata-instance-header/messages.js +15 -17
- package/dist/esm/lib/components/metadata-instance-list/subcomponents/metadata-instance-header/metadata-instance-header.js +2 -63
- package/dist/esm/lib/components/metadata-instance-review-notice/messages.js +30 -32
- package/dist/esm/lib/components/metadata-instance-review-notice/metadata-instance-review-notice.js +22 -32
- package/dist/esm/lib/components/unsaved-changes-modal/index.js +2 -4
- package/dist/esm/lib/components/unsaved-changes-modal/messages.js +23 -25
- package/dist/esm/lib/components/unsaved-changes-modal/unsaved-changes-modal.js +41 -57
- package/dist/esm/lib/components/unsaved-changes-modal/utils.js +3 -5
- package/dist/esm/lib/constants.js +14 -18
- package/dist/esm/lib/defaults.js +14 -17
- package/dist/esm/lib/mappers.js +22 -28
- package/dist/esm/lib/messages.js +123 -126
- package/dist/esm/lib/metadata-editor.js +2 -14
- package/dist/esm/lib/utils/api-wrapper.js +12 -18
- package/dist/esm/lib/utils/autofill-context.js +65 -67
- package/dist/esm/lib/utils/check-if-has-bounding-boxes.js +2 -4
- package/dist/esm/lib/utils/confidence-score/format-confidence-score-percent.js +3 -5
- package/dist/esm/lib/utils/confidence-score/get-confidence-score-tooltip.js +12 -19
- package/dist/esm/lib/utils/confidence-score/get-fields-needing-review.js +5 -7
- package/dist/esm/lib/utils/confidence-score/index.js +5 -10
- package/dist/esm/lib/utils/confidence-score/is-confidence-score-needing-review.js +4 -6
- package/dist/esm/lib/utils/confidence-score/messages.js +14 -16
- package/dist/esm/lib/utils/convertDate.js +20 -31
- package/dist/esm/lib/utils/is-interactive-form-element.js +2 -4
- package/dist/esm/lib/utils/utils.js +4 -9
- package/dist/styles/autofill-overlay.css +1 -1
- package/dist/styles/combobox-with-api-pagination.css +1 -1
- package/dist/styles/custom-instance-new-field.css +1 -1
- package/dist/styles/custom-instance.css +1 -1
- package/dist/styles/delete-confirmation-modal.css +1 -1
- package/dist/styles/field-action-bar.css +1 -1
- package/dist/styles/filter-dropdown-menu.css +1 -1
- package/dist/styles/filter-instances-dropdown.css +1 -1
- package/dist/styles/interactive-header-text.css +1 -1
- package/dist/styles/interactive-text.css +1 -1
- package/dist/styles/metadata-editor.css +1 -0
- package/dist/styles/metadata-instance-content.css +1 -1
- package/dist/styles/metadata-instance-entry.css +1 -1
- package/dist/styles/metadata-instance-footer.css +1 -1
- package/dist/styles/metadata-instance-form-autofill-button.css +1 -1
- package/dist/styles/metadata-instance-form-card-wrapper.css +1 -1
- package/dist/styles/metadata-instance-form-footer.css +1 -1
- package/dist/styles/metadata-instance-form-header.css +1 -1
- package/dist/styles/metadata-instance-header.css +1 -1
- package/dist/styles/metadata-instance-list.css +1 -1
- package/dist/styles/shared-field-styles.css +1 -1
- package/dist/styles/taxonomy-ancestor-status-pill.css +1 -1
- package/dist/styles/update-mode-field-wrapper.css +1 -1
- package/dist/styles/utils.css +1 -1
- package/dist/types/lib/test-utils/index.d.ts +1 -0
- package/dist/types/lib/test-utils/pending-promise.d.ts +19 -0
- package/package.json +10 -10
|
@@ -1,72 +1,48 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
children: /* @__PURE__ */ y(l.Content, {
|
|
48
|
-
container: V,
|
|
49
|
-
onEscapeKeyDown: (t) => t.stopPropagation(),
|
|
50
|
-
children: [/* @__PURE__ */ a(l.Option, {
|
|
51
|
-
text: d,
|
|
52
|
-
value: r,
|
|
53
|
-
children: /* @__PURE__ */ a(P, {
|
|
54
|
-
...u.selectValuePlaceholder
|
|
55
|
-
})
|
|
56
|
-
}), U?.map((t) => {
|
|
57
|
-
const o = A(t);
|
|
58
|
-
return /* @__PURE__ */ a(l.Option, {
|
|
59
|
-
text: o,
|
|
60
|
-
value: t,
|
|
61
|
-
children: o
|
|
62
|
-
}, t);
|
|
63
|
-
})]
|
|
64
|
-
})
|
|
65
|
-
})
|
|
66
|
-
})
|
|
67
|
-
});
|
|
1
|
+
import e from "../../../../messages.js";
|
|
2
|
+
import "../update-mode-field-wrapper/mulitple-values-utils.js";
|
|
3
|
+
import { messages as t } from "../update-mode-field-wrapper/messages.js";
|
|
4
|
+
import { useMemoizedFieldLabel as n } from "../../hooks/use-memoized-field-label.js";
|
|
5
|
+
import { SELECT_EMPTY_VALUE as r, Select as i } from "@box/blueprint-web";
|
|
6
|
+
import { forwardRef as a } from "react";
|
|
7
|
+
import { FormattedMessage as o, useIntl as s } from "react-intl";
|
|
8
|
+
import { jsx as c, jsxs as l } from "react/jsx-runtime";
|
|
9
|
+
import { Field as u, getIn as d, useFormikContext as f } from "formik";
|
|
10
|
+
var p = /* @__PURE__ */ a(({ className: a, 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 } = s(), 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__ */ c("div", {
|
|
13
|
+
"data-testid": `${y}-field`,
|
|
14
|
+
children: /* @__PURE__ */ c(u, {
|
|
15
|
+
name: D,
|
|
16
|
+
children: ({ field: t }) => /* @__PURE__ */ c(i, {
|
|
17
|
+
ref: C,
|
|
18
|
+
className: a,
|
|
19
|
+
"data-target-id": "Select-MetadataEditorEnumField",
|
|
20
|
+
disabled: g,
|
|
21
|
+
label: j,
|
|
22
|
+
onValueChange: (e) => {
|
|
23
|
+
w(D, e === r ? "" : e), b();
|
|
24
|
+
},
|
|
25
|
+
placeholder: A,
|
|
26
|
+
...t,
|
|
27
|
+
value: t.value === r ? "" : t.value,
|
|
28
|
+
children: /* @__PURE__ */ l(i.Content, {
|
|
29
|
+
container: S,
|
|
30
|
+
onEscapeKeyDown: (e) => e.stopPropagation(),
|
|
31
|
+
children: [/* @__PURE__ */ c(i.Option, {
|
|
32
|
+
text: A,
|
|
33
|
+
value: r,
|
|
34
|
+
children: /* @__PURE__ */ c(o, { ...e.selectValuePlaceholder })
|
|
35
|
+
}), k?.map((e) => {
|
|
36
|
+
let t = M(e);
|
|
37
|
+
return /* @__PURE__ */ c(i.Option, {
|
|
38
|
+
text: t,
|
|
39
|
+
value: e,
|
|
40
|
+
children: t
|
|
41
|
+
}, e);
|
|
42
|
+
})]
|
|
43
|
+
})
|
|
44
|
+
})
|
|
45
|
+
})
|
|
46
|
+
});
|
|
68
47
|
});
|
|
69
|
-
export {
|
|
70
|
-
H as MetadataEnumField,
|
|
71
|
-
H as default
|
|
72
|
-
};
|
|
48
|
+
export { p as MetadataEnumField, p as default };
|
|
@@ -1,56 +1,34 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { useFloatValidation as j } from "./use-float-validation.js";
|
|
1
|
+
import { useMemoizedFieldLabel as e } from "../../hooks/use-memoized-field-label.js";
|
|
2
|
+
import { useFloatValidation as t } from "./use-float-validation.js";
|
|
3
|
+
import { TextInput as n } from "@box/blueprint-web";
|
|
4
|
+
import { forwardRef as r, useRef as i } from "react";
|
|
6
5
|
import { jsx as a } from "react/jsx-runtime";
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
children: ({
|
|
35
|
-
field: e,
|
|
36
|
-
meta: T
|
|
37
|
-
}) => /* @__PURE__ */ a(I, {
|
|
38
|
-
...e,
|
|
39
|
-
ref: f,
|
|
40
|
-
className: l,
|
|
41
|
-
"data-target-id": "TextInput-MetadataEditorFloatField",
|
|
42
|
-
disabled: u,
|
|
43
|
-
error: T.error,
|
|
44
|
-
inputMode: "decimal",
|
|
45
|
-
label: x,
|
|
46
|
-
onBlur: () => M(t),
|
|
47
|
-
onChange: (C) => b(C.currentTarget.value),
|
|
48
|
-
placeholder: "0"
|
|
49
|
-
})
|
|
50
|
-
})
|
|
51
|
-
});
|
|
6
|
+
import { Field as o, getIn as s, useFormikContext as c } from "formik";
|
|
7
|
+
var l = /* @__PURE__ */ r(({ className: r, 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 = i(s(v, x)), { validateFloats: C } = t(), w = e(f, l, u, "label", d), T = (e) => {
|
|
9
|
+
S.current = e, y(x, e), h();
|
|
10
|
+
}, E = (e) => {
|
|
11
|
+
b(e, !0);
|
|
12
|
+
};
|
|
13
|
+
return /* @__PURE__ */ a("div", {
|
|
14
|
+
"data-testid": `${f}-field`,
|
|
15
|
+
children: /* @__PURE__ */ a(o, {
|
|
16
|
+
name: `${x}`,
|
|
17
|
+
validate: () => C(S.current),
|
|
18
|
+
children: ({ field: e, meta: t }) => /* @__PURE__ */ a(n, {
|
|
19
|
+
...e,
|
|
20
|
+
ref: _,
|
|
21
|
+
className: r,
|
|
22
|
+
"data-target-id": "TextInput-MetadataEditorFloatField",
|
|
23
|
+
disabled: m,
|
|
24
|
+
error: t.error,
|
|
25
|
+
inputMode: "decimal",
|
|
26
|
+
label: w,
|
|
27
|
+
onBlur: () => E(x),
|
|
28
|
+
onChange: (e) => T(e.currentTarget.value),
|
|
29
|
+
placeholder: "0"
|
|
30
|
+
})
|
|
31
|
+
})
|
|
32
|
+
});
|
|
52
33
|
});
|
|
53
|
-
export {
|
|
54
|
-
y as MetadataFloatField,
|
|
55
|
-
y as default
|
|
56
|
-
};
|
|
34
|
+
export { l as MetadataFloatField, l as default };
|
|
@@ -1,15 +1,9 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
return t.formatMessage(o.floatFieldInvalidValue);
|
|
9
|
-
}
|
|
10
|
-
};
|
|
11
|
-
};
|
|
12
|
-
export {
|
|
13
|
-
a as isFloatOrBlank,
|
|
14
|
-
i as useFloatValidation
|
|
1
|
+
import e from "../../../../messages.js";
|
|
2
|
+
import { useIntl as t } from "react-intl";
|
|
3
|
+
var n = (e) => e?.length ? /^[-+]?\d+(\.\d+)?$/.test(e) : !0, r = () => {
|
|
4
|
+
let r = t();
|
|
5
|
+
return { validateFloats: (t) => {
|
|
6
|
+
if (!n(t)) return r.formatMessage(e.floatFieldInvalidValue);
|
|
7
|
+
} };
|
|
15
8
|
};
|
|
9
|
+
export { n as isFloatOrBlank, r as useFloatValidation };
|
|
@@ -1,63 +1,41 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
className: m,
|
|
41
|
-
"data-target-id": "Combobox-MetadataEditorMultiSelectField",
|
|
42
|
-
disabled: c,
|
|
43
|
-
displayValue: (t) => t === k ? h : t,
|
|
44
|
-
filterFn: v,
|
|
45
|
-
label: C,
|
|
46
|
-
multiselect: !0,
|
|
47
|
-
name: e.name,
|
|
48
|
-
onValueChange: (t) => {
|
|
49
|
-
b(i, t), p();
|
|
50
|
-
},
|
|
51
|
-
options: M,
|
|
52
|
-
placeholder: y,
|
|
53
|
-
portalElement: g,
|
|
54
|
-
value: e.value
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
})
|
|
58
|
-
});
|
|
1
|
+
import e from "../../../../messages.js";
|
|
2
|
+
import "../update-mode-field-wrapper/mulitple-values-utils.js";
|
|
3
|
+
import { messages as t } from "../update-mode-field-wrapper/messages.js";
|
|
4
|
+
import { useMemoizedFieldLabel as n } from "../../hooks/use-memoized-field-label.js";
|
|
5
|
+
import { Combobox as r } from "@box/blueprint-web";
|
|
6
|
+
import { forwardRef as i } from "react";
|
|
7
|
+
import { useIntl as a } from "react-intl";
|
|
8
|
+
import { jsx as o } from "react/jsx-runtime";
|
|
9
|
+
import { Field as s, getIn as c, useFormikContext as l } from "formik";
|
|
10
|
+
var u = /* @__PURE__ */ i(({ className: i, 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 } = a(), 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__ */ o("div", {
|
|
13
|
+
"data-testid": `${h}-field`,
|
|
14
|
+
children: /* @__PURE__ */ o(s, {
|
|
15
|
+
name: w,
|
|
16
|
+
children: ({ field: t }) => {
|
|
17
|
+
let n = (t.value?.length || 0) === 0 ? C(e.multiselectPlaceholder) : "";
|
|
18
|
+
return /* @__PURE__ */ o(r, {
|
|
19
|
+
ref: b,
|
|
20
|
+
as: "input",
|
|
21
|
+
className: i,
|
|
22
|
+
"data-target-id": "Combobox-MetadataEditorMultiSelectField",
|
|
23
|
+
disabled: p,
|
|
24
|
+
displayValue: (e) => e === "Multiple values" ? T : e,
|
|
25
|
+
filterFn: O,
|
|
26
|
+
label: D,
|
|
27
|
+
multiselect: !0,
|
|
28
|
+
name: t.name,
|
|
29
|
+
onValueChange: (e) => {
|
|
30
|
+
x(w, e), g();
|
|
31
|
+
},
|
|
32
|
+
options: E,
|
|
33
|
+
placeholder: n,
|
|
34
|
+
portalElement: v,
|
|
35
|
+
value: t.value
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
})
|
|
39
|
+
});
|
|
59
40
|
});
|
|
60
|
-
export {
|
|
61
|
-
J as MetadataMultiSelectField,
|
|
62
|
-
J as default
|
|
63
|
-
};
|
|
41
|
+
export { u as MetadataMultiSelectField, u as default };
|
|
@@ -1,45 +1,29 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
}) => /* @__PURE__ */ e(h, {
|
|
28
|
-
...c,
|
|
29
|
-
ref: s,
|
|
30
|
-
className: r,
|
|
31
|
-
"data-target-id": "TextInput-MetadataEditorStringField",
|
|
32
|
-
disabled: d,
|
|
33
|
-
error: g.error,
|
|
34
|
-
label: u,
|
|
35
|
-
onChangeCapture: m,
|
|
36
|
-
placeholder: f.formatMessage(x.setValuePlaceholder)
|
|
37
|
-
})
|
|
38
|
-
})
|
|
39
|
-
});
|
|
1
|
+
import e from "../../../../messages.js";
|
|
2
|
+
import { useMemoizedFieldLabel as t } from "../../hooks/use-memoized-field-label.js";
|
|
3
|
+
import { TextInput as n } from "@box/blueprint-web";
|
|
4
|
+
import { forwardRef as r } from "react";
|
|
5
|
+
import { useIntl as i } from "react-intl";
|
|
6
|
+
import { jsx as a } from "react/jsx-runtime";
|
|
7
|
+
import { Field as o } from "formik";
|
|
8
|
+
var s = /* @__PURE__ */ r(({ className: r, description: s, isAiSuggestionApplied: c, confidenceScore: l, disableForm: u, fieldNamePrefix: d, label: f, onValueEdited: p, updateModePrefix: m }, h) => {
|
|
9
|
+
let g = i(), _ = `${m ?? d}.value`, v = t(f, s, c, "label", l);
|
|
10
|
+
return /* @__PURE__ */ a("div", {
|
|
11
|
+
"data-testid": `${f}-field`,
|
|
12
|
+
children: /* @__PURE__ */ a(o, {
|
|
13
|
+
name: _,
|
|
14
|
+
children: ({ field: t, meta: i }) => /* @__PURE__ */ a(n, {
|
|
15
|
+
...t,
|
|
16
|
+
ref: h,
|
|
17
|
+
className: r,
|
|
18
|
+
"data-target-id": "TextInput-MetadataEditorStringField",
|
|
19
|
+
disabled: u,
|
|
20
|
+
error: i.error,
|
|
21
|
+
label: v,
|
|
22
|
+
onChangeCapture: p,
|
|
23
|
+
placeholder: g.formatMessage(e.setValuePlaceholder)
|
|
24
|
+
})
|
|
25
|
+
})
|
|
26
|
+
});
|
|
40
27
|
});
|
|
41
|
-
|
|
42
|
-
export {
|
|
43
|
-
S as MetadataStringField,
|
|
44
|
-
S as default
|
|
45
|
-
};
|
|
28
|
+
s.displayName = "MetadataStringField";
|
|
29
|
+
export { s as MetadataStringField, s as default };
|
|
@@ -1,96 +1,67 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
levels: _,
|
|
67
|
-
multiselect: n,
|
|
68
|
-
onValueChange: F,
|
|
69
|
-
placeholder: C(e.value),
|
|
70
|
-
portalElement: m,
|
|
71
|
-
selectableLevels: a,
|
|
72
|
-
value: L
|
|
73
|
-
}) : /* @__PURE__ */ o(j, {
|
|
74
|
-
ref: p,
|
|
75
|
-
className: u,
|
|
76
|
-
dataTargetId: "ComboboxWithApiPagination-MetadataEditorTaxonomyField",
|
|
77
|
-
defaultFetcher: T,
|
|
78
|
-
disabled: y,
|
|
79
|
-
label: x,
|
|
80
|
-
multiselect: n,
|
|
81
|
-
onValueChange: F,
|
|
82
|
-
placeholder: C(e.value),
|
|
83
|
-
portalElement: m,
|
|
84
|
-
value: L
|
|
85
|
-
});
|
|
86
|
-
}
|
|
87
|
-
})
|
|
88
|
-
});
|
|
89
|
-
return c ? /* @__PURE__ */ o(K, {
|
|
90
|
-
content: i(I.taxonomyExternallyOwned),
|
|
91
|
-
children: A
|
|
92
|
-
}) : A;
|
|
1
|
+
import e from "../../../../messages.js";
|
|
2
|
+
import "../update-mode-field-wrapper/mulitple-values-utils.js";
|
|
3
|
+
import { messages as t } from "../update-mode-field-wrapper/messages.js";
|
|
4
|
+
import { useMemoizedFieldLabel as n } from "../../hooks/use-memoized-field-label.js";
|
|
5
|
+
import { Tooltip as r } from "@box/blueprint-web";
|
|
6
|
+
import { forwardRef as i, useCallback as a } from "react";
|
|
7
|
+
import { useIntl as o } from "react-intl";
|
|
8
|
+
import { jsx as s } from "react/jsx-runtime";
|
|
9
|
+
import { Field as c, getIn as l, useFormikContext as u } from "formik";
|
|
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__ */ i(({ description: i, 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 } = o(), 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, i, h, "label", g), V = a((e) => x(M, j, N, F?.[0], e), [
|
|
13
|
+
N,
|
|
14
|
+
M,
|
|
15
|
+
F,
|
|
16
|
+
x,
|
|
17
|
+
j
|
|
18
|
+
]), H = (t) => P || !t?.length ? D(e.taxonomyPlaceholder) : void 0, U = (e) => {
|
|
19
|
+
k(O, e), y();
|
|
20
|
+
}, W = /* @__PURE__ */ s("div", {
|
|
21
|
+
"data-testid": `${v}-field`,
|
|
22
|
+
onKeyDown: (e) => e.stopPropagation(),
|
|
23
|
+
role: "presentation",
|
|
24
|
+
children: /* @__PURE__ */ s(c, {
|
|
25
|
+
name: O,
|
|
26
|
+
children: ({ field: e }) => {
|
|
27
|
+
let t = Array.isArray(e.value) ? e.value.map((e) => ({
|
|
28
|
+
...e,
|
|
29
|
+
displayValue: p(e.displayValue, L)
|
|
30
|
+
})) : e.value;
|
|
31
|
+
return R ? /* @__PURE__ */ s(f, {
|
|
32
|
+
ref: E,
|
|
33
|
+
className: C,
|
|
34
|
+
closeOnSelection: R,
|
|
35
|
+
dataTargetId: "ComboboxWithApiTreeView-MetadataEditorTaxonomyField",
|
|
36
|
+
defaultFetcher: V,
|
|
37
|
+
disabled: z,
|
|
38
|
+
label: B,
|
|
39
|
+
levels: I,
|
|
40
|
+
multiselect: P,
|
|
41
|
+
onValueChange: U,
|
|
42
|
+
placeholder: H(e.value),
|
|
43
|
+
portalElement: b,
|
|
44
|
+
selectableLevels: F,
|
|
45
|
+
value: t
|
|
46
|
+
}) : /* @__PURE__ */ s(d, {
|
|
47
|
+
ref: E,
|
|
48
|
+
className: C,
|
|
49
|
+
dataTargetId: "ComboboxWithApiPagination-MetadataEditorTaxonomyField",
|
|
50
|
+
defaultFetcher: V,
|
|
51
|
+
disabled: z,
|
|
52
|
+
label: B,
|
|
53
|
+
multiselect: P,
|
|
54
|
+
onValueChange: U,
|
|
55
|
+
placeholder: H(e.value),
|
|
56
|
+
portalElement: b,
|
|
57
|
+
value: t
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
})
|
|
61
|
+
});
|
|
62
|
+
return w ? /* @__PURE__ */ s(r, {
|
|
63
|
+
content: D(e.taxonomyExternallyOwned),
|
|
64
|
+
children: W
|
|
65
|
+
}) : W;
|
|
93
66
|
});
|
|
94
|
-
export {
|
|
95
|
-
re as MetadataTaxonomyField
|
|
96
|
-
};
|
|
67
|
+
export { m as MetadataTaxonomyField };
|