@box/metadata-editor 2.3.9 → 2.3.11
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 +1 -34
- package/dist/chunks/ai-suggestion-field.js +1 -100
- package/dist/chunks/autofill-overlay.js +1 -63
- package/dist/chunks/combobox-with-api-pagination.js +1 -161
- package/dist/chunks/custom-instance-new-field.js +1 -60
- package/dist/chunks/custom-instance.js +1 -74
- package/dist/chunks/delete-confirmation-modal.js +1 -76
- package/dist/chunks/field-action-bar.module.js +1 -7
- package/dist/chunks/filter-dropdown-menu.module.js +1 -12
- package/dist/chunks/filter-instances-dropdown.js +1 -84
- package/dist/chunks/interactive-header-text.js +1 -19
- package/dist/chunks/interactive-text.module.js +1 -5
- package/dist/chunks/metadata-editor.js +1 -9
- package/dist/chunks/metadata-instance-content.js +1 -43
- package/dist/chunks/metadata-instance-entry.js +1 -104
- package/dist/chunks/metadata-instance-footer.js +1 -25
- package/dist/chunks/metadata-instance-form-ai-disclaimer.js +1 -28
- package/dist/chunks/metadata-instance-form-autofill-button.js +1 -113
- package/dist/chunks/metadata-instance-form-card-wrapper.js +1 -54
- package/dist/chunks/metadata-instance-form-footer.js +1 -43
- package/dist/chunks/metadata-instance-form-header.js +1 -45
- package/dist/chunks/metadata-instance-header.js +1 -52
- package/dist/chunks/metadata-instance-list.js +1 -20
- package/dist/chunks/metadata-instance.js +1 -60
- package/dist/chunks/shared-field-styles.module.js +1 -6
- package/dist/chunks/taxonomy-ancestor-status-pill.js +1 -90
- package/dist/chunks/types.js +1 -8
- package/dist/chunks/update-mode-field-wrapper.js +1 -80
- package/dist/chunks/utils.js +1 -88
- package/dist/chunks/utils2.js +1 -53
- package/dist/esm/index.js +1 -25
- package/dist/esm/lib/components/add-metadata-template-dropdown/add-metadata-template-dropdown-with-browser.js +1 -2
- package/dist/esm/lib/components/add-metadata-template-dropdown/add-metadata-template-dropdown.js +1 -24
- package/dist/esm/lib/components/add-metadata-template-dropdown/index.js +1 -3
- package/dist/esm/lib/components/add-metadata-template-dropdown/messages.js +1 -20
- package/dist/esm/lib/components/add-metadata-template-dropdown/shared/dropdown-trigger.js +1 -16
- package/dist/esm/lib/components/combobox-with-api-pagination/combobox-with-api-pagination.js +1 -2
- package/dist/esm/lib/components/combobox-with-api-pagination/index.js +1 -2
- package/dist/esm/lib/components/combobox-with-api-pagination/messages.js +1 -32
- package/dist/esm/lib/components/combobox-with-api-pagination/request.js +1 -4
- package/dist/esm/lib/components/combobox-with-api-pagination/use-async-list.js +1 -118
- package/dist/esm/lib/components/combobox-with-api-pagination/utils/is-abort-error.js +1 -11
- package/dist/esm/lib/components/combobox-with-api-pagination/utils/use-controllable-state.js +1 -35
- package/dist/esm/lib/components/combobox-with-api-pagination/utils/use-intersection-observer.js +1 -75
- package/dist/esm/lib/components/filter-dropdown-menu/filter-dropdown-menu-content.js +1 -14
- package/dist/esm/lib/components/filter-dropdown-menu/filter-dropdown-menu-empty-state.js +1 -17
- package/dist/esm/lib/components/filter-dropdown-menu/filter-dropdown-menu-item.js +1 -15
- package/dist/esm/lib/components/filter-dropdown-menu/filter-dropdown-menu-list.js +1 -17
- package/dist/esm/lib/components/filter-dropdown-menu/filter-dropdown-menu-root.js +1 -14
- package/dist/esm/lib/components/filter-dropdown-menu/filter-dropdown-menu-search.js +1 -37
- package/dist/esm/lib/components/filter-dropdown-menu/filter-dropdown-menu-trigger.js +1 -8
- package/dist/esm/lib/components/filter-dropdown-menu/index.js +1 -17
- package/dist/esm/lib/components/filter-dropdown-menu/messages.js +1 -12
- package/dist/esm/lib/components/filter-instances-dropdown/filter-instances-dropdown.js +1 -2
- package/dist/esm/lib/components/filter-instances-dropdown/index.js +1 -2
- package/dist/esm/lib/components/filter-instances-dropdown/messages.js +1 -20
- package/dist/esm/lib/components/interactive-header-text/interactive-header-text.js +1 -2
- package/dist/esm/lib/components/interactive-text/interactive-text.js +1 -18
- package/dist/esm/lib/components/metadata-editor-fields/components/ai-logo-badge/ai-logo-badge.js +1 -36
- package/dist/esm/lib/components/metadata-editor-fields/components/ai-logo-badge/index.js +1 -2
- package/dist/esm/lib/components/metadata-editor-fields/components/ai-suggestion-field/ai-suggestion-field.js +1 -2
- package/dist/esm/lib/components/metadata-editor-fields/components/ai-suggestion-field/index.js +1 -2
- package/dist/esm/lib/components/metadata-editor-fields/components/ai-suggestion-field/messages.js +1 -52
- package/dist/esm/lib/components/metadata-editor-fields/components/ai-suggestion-field/utils.js +1 -13
- package/dist/esm/lib/components/metadata-editor-fields/components/constants.js +1 -2
- package/dist/esm/lib/components/metadata-editor-fields/components/low-confidence-badge/index.js +1 -2
- package/dist/esm/lib/components/metadata-editor-fields/components/low-confidence-badge/low-confidence-badge.js +1 -24
- package/dist/esm/lib/components/metadata-editor-fields/components/low-confidence-suggestion-field/index.js +1 -2
- package/dist/esm/lib/components/metadata-editor-fields/components/low-confidence-suggestion-field/low-confidence-suggestion-field.js +1 -68
- package/dist/esm/lib/components/metadata-editor-fields/components/low-confidence-suggestion-field/messages.js +1 -32
- package/dist/esm/lib/components/metadata-editor-fields/components/metadata-date-field/metadata-date-field.js +1 -44
- package/dist/esm/lib/components/metadata-editor-fields/components/metadata-enum-field/metadata-enum-field.js +1 -48
- package/dist/esm/lib/components/metadata-editor-fields/components/metadata-float-field/metadata-float-field.js +1 -34
- package/dist/esm/lib/components/metadata-editor-fields/components/metadata-float-field/use-float-validation.js +1 -9
- package/dist/esm/lib/components/metadata-editor-fields/components/metadata-multi-select-field/metadata-multi-select-field.js +1 -41
- package/dist/esm/lib/components/metadata-editor-fields/components/metadata-string-field/metadata-string-field.js +1 -29
- package/dist/esm/lib/components/metadata-editor-fields/components/metadata-taxonomy-field/legacy-metadata-taxonomy-field.js +1 -67
- package/dist/esm/lib/components/metadata-editor-fields/components/metadata-taxonomy-field/metadata-taxonomy-field.js +1 -16
- package/dist/esm/lib/components/metadata-editor-fields/components/metadata-taxonomy-field/metadata-taxonomy-picker-field/metadata-taxonomy-picker-field.js +1 -53
- package/dist/esm/lib/components/metadata-editor-fields/components/metadata-taxonomy-field/metadata-taxonomy-picker-field/value-mapping.js +1 -30
- package/dist/esm/lib/components/metadata-editor-fields/components/update-mode-field-wrapper/messages.js +1 -32
- package/dist/esm/lib/components/metadata-editor-fields/components/update-mode-field-wrapper/mulitple-values-utils.js +1 -8
- package/dist/esm/lib/components/metadata-editor-fields/components/update-mode-field-wrapper/update-mode-field-wrapper.js +1 -2
- package/dist/esm/lib/components/metadata-editor-fields/editor-field-types.js +1 -32
- package/dist/esm/lib/components/metadata-editor-fields/hooks/use-memoized-field-label.js +1 -12
- package/dist/esm/lib/components/metadata-editor-fields/hooks/use-review-field-filter.js +1 -36
- package/dist/esm/lib/components/metadata-editor-fields/hooks/use-view-reference-tooltip.js +1 -41
- package/dist/esm/lib/components/metadata-editor-fields/messages.js +1 -12
- package/dist/esm/lib/components/metadata-editor-fields/metadata-editor-field-wrapper.js +1 -189
- package/dist/esm/lib/components/metadata-editor-fields/metadata-editor-fields.js +1 -31
- package/dist/esm/lib/components/metadata-editor-fields/utils.js +1 -2
- package/dist/esm/lib/components/metadata-empty-state/messages.js +1 -44
- package/dist/esm/lib/components/metadata-empty-state/metadata-empty-state.js +1 -47
- package/dist/esm/lib/components/metadata-instance-editor/index.js +1 -9
- package/dist/esm/lib/components/metadata-instance-editor/subcomponents/autofill-overlay/autofill-overlay.js +1 -2
- package/dist/esm/lib/components/metadata-instance-editor/subcomponents/autofill-overlay/messages.js +1 -40
- package/dist/esm/lib/components/metadata-instance-editor/subcomponents/autofill-overlay/useErrorMessaging.js +1 -23
- package/dist/esm/lib/components/metadata-instance-editor/subcomponents/custom-instance/custom-instance.js +1 -2
- package/dist/esm/lib/components/metadata-instance-editor/subcomponents/custom-instance/messages.js +1 -16
- package/dist/esm/lib/components/metadata-instance-editor/subcomponents/custom-instance-new-field/custom-instance-new-field.js +1 -2
- package/dist/esm/lib/components/metadata-instance-editor/subcomponents/custom-instance-new-field/messages.js +1 -44
- package/dist/esm/lib/components/metadata-instance-editor/subcomponents/delete-confirmation-modal/delete-confirmation-modal.js +1 -2
- package/dist/esm/lib/components/metadata-instance-editor/subcomponents/delete-confirmation-modal/messages.js +1 -52
- package/dist/esm/lib/components/metadata-instance-editor/subcomponents/metadata-instance-form/constants.js +1 -2
- package/dist/esm/lib/components/metadata-instance-editor/subcomponents/metadata-instance-form/metadata-instance-form-card-wrapper.js +1 -2
- package/dist/esm/lib/components/metadata-instance-editor/subcomponents/metadata-instance-form/metadata-instance-form.js +1 -136
- package/dist/esm/lib/components/metadata-instance-editor/subcomponents/metadata-instance-form/utils.js +1 -2
- package/dist/esm/lib/components/metadata-instance-editor/subcomponents/metadata-instance-form-ai-disclaimer/metadata-instance-form-ai-disclaimer.js +1 -2
- package/dist/esm/lib/components/metadata-instance-editor/subcomponents/metadata-instance-form-autofill-button/messages.js +1 -24
- package/dist/esm/lib/components/metadata-instance-editor/subcomponents/metadata-instance-form-autofill-button/metadata-instance-form-autofill-button.js +1 -2
- package/dist/esm/lib/components/metadata-instance-editor/subcomponents/metadata-instance-form-footer/messages.js +1 -20
- package/dist/esm/lib/components/metadata-instance-editor/subcomponents/metadata-instance-form-footer/metadata-instance-form-footer.js +1 -2
- package/dist/esm/lib/components/metadata-instance-editor/subcomponents/metadata-instance-form-header/messages.js +1 -6
- package/dist/esm/lib/components/metadata-instance-editor/subcomponents/metadata-instance-form-header/metadata-instance-form-header.js +1 -2
- package/dist/esm/lib/components/metadata-instance-editor/subcomponents/metadata-instance-form-inline-notice/messages.js +1 -20
- package/dist/esm/lib/components/metadata-instance-editor/subcomponents/metadata-instance-form-inline-notice/metadata-instance-form-inline-notice.js +1 -31
- package/dist/esm/lib/components/metadata-instance-list/index.js +1 -6
- package/dist/esm/lib/components/metadata-instance-list/metadata-instance-list.js +1 -2
- package/dist/esm/lib/components/metadata-instance-list/subcomponents/metadata-instance/metadata-instance.js +1 -2
- package/dist/esm/lib/components/metadata-instance-list/subcomponents/metadata-instance-content/metadata-instance-content.js +1 -2
- package/dist/esm/lib/components/metadata-instance-list/subcomponents/metadata-instance-entry/messages.js +1 -6
- package/dist/esm/lib/components/metadata-instance-list/subcomponents/metadata-instance-entry/metadata-entry-display.js +1 -15
- package/dist/esm/lib/components/metadata-instance-list/subcomponents/metadata-instance-entry/metadata-instance-entry.js +1 -2
- package/dist/esm/lib/components/metadata-instance-list/subcomponents/metadata-instance-entry/taxonomy-entry/messages.js +1 -24
- package/dist/esm/lib/components/metadata-instance-list/subcomponents/metadata-instance-entry/taxonomy-entry/taxonomy-ancestor-status-pill.js +1 -2
- package/dist/esm/lib/components/metadata-instance-list/subcomponents/metadata-instance-entry/taxonomy-entry/taxonomy-value.js +1 -25
- package/dist/esm/lib/components/metadata-instance-list/subcomponents/metadata-instance-footer/messages.js +1 -12
- package/dist/esm/lib/components/metadata-instance-list/subcomponents/metadata-instance-footer/metadata-instance-footer.js +1 -2
- package/dist/esm/lib/components/metadata-instance-list/subcomponents/metadata-instance-header/messages.js +1 -16
- package/dist/esm/lib/components/metadata-instance-list/subcomponents/metadata-instance-header/metadata-instance-header.js +1 -2
- package/dist/esm/lib/components/metadata-instance-review-notice/messages.js +1 -32
- package/dist/esm/lib/components/metadata-instance-review-notice/metadata-instance-review-notice.js +1 -24
- package/dist/esm/lib/components/unsaved-changes-modal/index.js +1 -2
- package/dist/esm/lib/components/unsaved-changes-modal/messages.js +1 -24
- package/dist/esm/lib/components/unsaved-changes-modal/unsaved-changes-modal.js +1 -45
- package/dist/esm/lib/components/unsaved-changes-modal/utils.js +1 -4
- package/dist/esm/lib/constants.js +1 -15
- package/dist/esm/lib/defaults.js +1 -16
- package/dist/esm/lib/mappers.js +1 -23
- package/dist/esm/lib/messages.js +1 -129
- package/dist/esm/lib/metadata-editor.js +1 -2
- package/dist/esm/lib/utils/analytics/analytics-context.js +1 -11
- package/dist/esm/lib/utils/analytics/events.js +1 -9
- package/dist/esm/lib/utils/analytics/index.js +1 -4
- package/dist/esm/lib/utils/analytics/with-analytics.js +1 -11
- package/dist/esm/lib/utils/api-wrapper.js +1 -13
- package/dist/esm/lib/utils/autofill-context.js +1 -66
- package/dist/esm/lib/utils/check-if-has-bounding-boxes.js +1 -2
- package/dist/esm/lib/utils/confidence-score/format-confidence-score-percent.js +1 -4
- package/dist/esm/lib/utils/confidence-score/get-confidence-score-tooltip.js +1 -13
- package/dist/esm/lib/utils/confidence-score/get-fields-needing-review.js +1 -6
- package/dist/esm/lib/utils/confidence-score/index.js +1 -5
- package/dist/esm/lib/utils/confidence-score/is-confidence-score-needing-review.js +1 -5
- package/dist/esm/lib/utils/confidence-score/messages.js +1 -16
- package/dist/esm/lib/utils/convertDate.js +1 -24
- package/dist/esm/lib/utils/is-interactive-form-element.js +1 -2
- package/dist/esm/lib/utils/utils.js +1 -4
- package/dist/styles/metadata-instance-footer.css +1 -1
- package/package.json +13 -13
package/dist/esm/lib/components/metadata-editor-fields/components/ai-suggestion-field/messages.js
CHANGED
|
@@ -1,52 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
var t = e({
|
|
3
|
-
aiSuggestionCaption: {
|
|
4
|
-
id: "metadataEditor.aiSuggestionField.aiSuggestionCaption",
|
|
5
|
-
defaultMessage: "Box AI suggestion:"
|
|
6
|
-
},
|
|
7
|
-
sameValueAiSuggestionCaption: {
|
|
8
|
-
id: "metadataEditor.aiSuggestionField.sameValueAiSuggestionCaption",
|
|
9
|
-
defaultMessage: "Box AI suggests the same value as above"
|
|
10
|
-
},
|
|
11
|
-
sameValueAiSuggestionCaptionWithLevel: {
|
|
12
|
-
id: "metadataEditor.aiSuggestionField.sameValueAiSuggestionCaptionWithLevel",
|
|
13
|
-
defaultMessage: "Box AI suggests the same value as above ({level} confidence)"
|
|
14
|
-
},
|
|
15
|
-
aiSuggestionOptions: {
|
|
16
|
-
id: "metadataEditor.aiSuggestionField.aiSuggestionOptions",
|
|
17
|
-
defaultMessage: "Options"
|
|
18
|
-
},
|
|
19
|
-
aiSuggestionAppend: {
|
|
20
|
-
id: "metadataEditor.aiSuggestionField.appendLabel",
|
|
21
|
-
defaultMessage: "Append"
|
|
22
|
-
},
|
|
23
|
-
aiSuggestionClearAndReplace: {
|
|
24
|
-
id: "metadataEditor.aiSuggestionField.clearAndReplaceLabel",
|
|
25
|
-
defaultMessage: "Clear and Replace"
|
|
26
|
-
},
|
|
27
|
-
aiSuggestionIgnore: {
|
|
28
|
-
id: "metadataEditor.aiSuggestionField.ignoreLabel",
|
|
29
|
-
defaultMessage: "Ignore"
|
|
30
|
-
},
|
|
31
|
-
aiSuggestionCaptionWithLevel: {
|
|
32
|
-
id: "metadataEditor.aiSuggestionField.aiSuggestionCaptionWithLevel",
|
|
33
|
-
defaultMessage: "Box AI suggestion ({level} confidence)"
|
|
34
|
-
},
|
|
35
|
-
confidenceLevelHigh: {
|
|
36
|
-
id: "metadataEditor.aiSuggestionField.confidenceLevelHigh",
|
|
37
|
-
defaultMessage: "High"
|
|
38
|
-
},
|
|
39
|
-
confidenceLevelLow: {
|
|
40
|
-
id: "metadataEditor.aiSuggestionField.confidenceLevelLow",
|
|
41
|
-
defaultMessage: "Low"
|
|
42
|
-
},
|
|
43
|
-
aiSuggestionConfirm: {
|
|
44
|
-
id: "metadataEditor.aiSuggestionField.dismissLabel",
|
|
45
|
-
defaultMessage: "Confirm"
|
|
46
|
-
},
|
|
47
|
-
aiSuggestionAccept: {
|
|
48
|
-
id: "metadataEditor.aiSuggestionField.acceptLabel",
|
|
49
|
-
defaultMessage: "Accept suggestion"
|
|
50
|
-
}
|
|
51
|
-
});
|
|
52
|
-
export { t as default };
|
|
1
|
+
import{defineMessages}from"react-intl";var messages_default=defineMessages({aiSuggestionCaption:{id:`metadataEditor.aiSuggestionField.aiSuggestionCaption`,defaultMessage:`Box AI suggestion:`},sameValueAiSuggestionCaption:{id:`metadataEditor.aiSuggestionField.sameValueAiSuggestionCaption`,defaultMessage:`Box AI suggests the same value as above`},sameValueAiSuggestionCaptionWithLevel:{id:`metadataEditor.aiSuggestionField.sameValueAiSuggestionCaptionWithLevel`,defaultMessage:`Box AI suggests the same value as above ({level} confidence)`},aiSuggestionOptions:{id:`metadataEditor.aiSuggestionField.aiSuggestionOptions`,defaultMessage:`Options`},aiSuggestionAppend:{id:`metadataEditor.aiSuggestionField.appendLabel`,defaultMessage:`Append`},aiSuggestionClearAndReplace:{id:`metadataEditor.aiSuggestionField.clearAndReplaceLabel`,defaultMessage:`Clear and Replace`},aiSuggestionIgnore:{id:`metadataEditor.aiSuggestionField.ignoreLabel`,defaultMessage:`Ignore`},aiSuggestionCaptionWithLevel:{id:`metadataEditor.aiSuggestionField.aiSuggestionCaptionWithLevel`,defaultMessage:`Box AI suggestion ({level} confidence)`},confidenceLevelHigh:{id:`metadataEditor.aiSuggestionField.confidenceLevelHigh`,defaultMessage:`High`},confidenceLevelLow:{id:`metadataEditor.aiSuggestionField.confidenceLevelLow`,defaultMessage:`Low`},aiSuggestionConfirm:{id:`metadataEditor.aiSuggestionField.dismissLabel`,defaultMessage:`Confirm`},aiSuggestionAccept:{id:`metadataEditor.aiSuggestionField.acceptLabel`,defaultMessage:`Accept suggestion`}});export{messages_default as default};
|
package/dist/esm/lib/components/metadata-editor-fields/components/ai-suggestion-field/utils.js
CHANGED
|
@@ -1,13 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { DateFormatter as t, getLocalTimeZone as n } from "@box/blueprint-web";
|
|
3
|
-
function r(r, { type: i = "string", locale: a = "en" } = {}) {
|
|
4
|
-
if (i === "date" && typeof r == "string") {
|
|
5
|
-
let i = !isNaN(new Date(r).getTime()), o = e(r);
|
|
6
|
-
if (o && i) {
|
|
7
|
-
let e = o.toDate(n());
|
|
8
|
-
return new t(a).format(e);
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
return i === "taxonomy" ? Array.isArray(r) && r.length > 0 ? r.map((e) => e.displayValue).join(", ") : r.toString() : r == null ? null : typeof r == "number" ? r.toString() : Array.isArray(r) ? r.join(", ") : r;
|
|
12
|
-
}
|
|
13
|
-
export { r as formatSuggestionValue };
|
|
1
|
+
import{convertIsoStringToCalendarDate}from"../../../../utils/convertDate.js";import{DateFormatter,getLocalTimeZone}from"@box/blueprint-web";function formatSuggestionValue(value,{type=`string`,locale=`en`}={}){if(type===`date`&&typeof value==`string`){let isValidDate=!isNaN(new Date(value).getTime()),calendarDate=convertIsoStringToCalendarDate(value);if(calendarDate&&isValidDate){let dateValue=calendarDate.toDate(getLocalTimeZone());return new DateFormatter(locale).format(dateValue)}}return type===`taxonomy`?Array.isArray(value)&&value.length>0?value.map(item=>item.displayValue).join(`, `):value.toString():value==null?null:typeof value==`number`?value.toString():Array.isArray(value)?value.join(`, `):value}export{formatSuggestionValue};
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
var
|
|
2
|
-
export { e as fieldDefaultProps };
|
|
1
|
+
var fieldDefaultProps={maxLength:255};export{fieldDefaultProps};
|
package/dist/esm/lib/components/metadata-editor-fields/components/low-confidence-badge/index.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
export { e as LowConfidenceBadge };
|
|
1
|
+
import{LowConfidenceBadge}from"./low-confidence-badge.js";export{LowConfidenceBadge};
|
|
@@ -1,24 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { useMetadataEditorAnalytics as t } from "../../../../utils/analytics/analytics-context.js";
|
|
3
|
-
import n from "../../../../utils/confidence-score/messages.js";
|
|
4
|
-
import r from "../../messages.js";
|
|
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
|
-
import { SurfaceStatusSurfaceGray as c } from "@box/blueprint-web-assets/tokens/tokens";
|
|
9
|
-
import { AlertCircle as l } from "@box/blueprint-web-assets/icons/Medium";
|
|
10
|
-
function u() {
|
|
11
|
-
let { formatMessage: u } = i(), { trackEvent: d } = t(), f = /* @__PURE__ */ a(o, {
|
|
12
|
-
color: c,
|
|
13
|
-
interactive: !0,
|
|
14
|
-
text: u(r.lowConfidenceBadge).toUpperCase(),
|
|
15
|
-
icon: l,
|
|
16
|
-
iconPosition: "left",
|
|
17
|
-
onMouseEnter: () => d(e.LOW_CONF_BADGE_HOVER)
|
|
18
|
-
});
|
|
19
|
-
return /* @__PURE__ */ a(s, {
|
|
20
|
-
content: u(n.tooltipLowConfidence),
|
|
21
|
-
children: f
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
export { u as LowConfidenceBadge };
|
|
1
|
+
import{EVENT_NAMES}from"../../../../utils/analytics/events.js";import{useMetadataEditorAnalytics}from"../../../../utils/analytics/analytics-context.js";import messages from"../../../../utils/confidence-score/messages.js";import messages_default from"../../messages.js";import{useIntl}from"react-intl";import{jsx}from"react/jsx-runtime";import{Status,Tooltip}from"@box/blueprint-web";import{SurfaceStatusSurfaceGray}from"@box/blueprint-web-assets/tokens/tokens";import{AlertCircle}from"@box/blueprint-web-assets/icons/Medium";function LowConfidenceBadge(){let{formatMessage}=useIntl(),{trackEvent}=useMetadataEditorAnalytics(),badge=jsx(Status,{color:SurfaceStatusSurfaceGray,interactive:!0,text:formatMessage(messages_default.lowConfidenceBadge).toUpperCase(),icon:AlertCircle,iconPosition:`left`,onMouseEnter:()=>trackEvent(EVENT_NAMES.LOW_CONF_BADGE_HOVER)});return jsx(Tooltip,{content:formatMessage(messages.tooltipLowConfidence),children:badge})}export{LowConfidenceBadge};
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
export { e as LowConfidenceSuggestionField };
|
|
1
|
+
import{LowConfidenceSuggestionField}from"./low-confidence-suggestion-field.js";export{LowConfidenceSuggestionField};
|
|
@@ -1,68 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import t from "./messages.js";
|
|
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
|
-
import { Checkmark as p, XMark as m } from "@box/blueprint-web-assets/icons/Medium";
|
|
8
|
-
var h = 800;
|
|
9
|
-
function g({ onAccept: g, onClear: _ }) {
|
|
10
|
-
let v = a(), { enableModernizedComponents: y } = f(), [b, x] = i(!1), S = r(void 0);
|
|
11
|
-
n(() => () => clearTimeout(S.current), []);
|
|
12
|
-
let C = (e) => {
|
|
13
|
-
clearTimeout(S.current), x(!0);
|
|
14
|
-
try {
|
|
15
|
-
e();
|
|
16
|
-
} finally {
|
|
17
|
-
S.current = setTimeout(() => {
|
|
18
|
-
x(!1);
|
|
19
|
-
}, h);
|
|
20
|
-
}
|
|
21
|
-
};
|
|
22
|
-
return /* @__PURE__ */ o("div", {
|
|
23
|
-
className: e.wrapperGradient,
|
|
24
|
-
"data-modern": y,
|
|
25
|
-
children: /* @__PURE__ */ s("div", {
|
|
26
|
-
className: e.wrapper,
|
|
27
|
-
children: [/* @__PURE__ */ s("div", { children: [/* @__PURE__ */ o(u, {
|
|
28
|
-
as: "p",
|
|
29
|
-
color: "textOnLightSecondary",
|
|
30
|
-
variant: "caption",
|
|
31
|
-
children: v.formatMessage(t.needsReview)
|
|
32
|
-
}), /* @__PURE__ */ o(u, {
|
|
33
|
-
as: "p",
|
|
34
|
-
color: "textOnLightDefault",
|
|
35
|
-
variant: "bodySmallSemibold",
|
|
36
|
-
children: v.formatMessage(t.description)
|
|
37
|
-
})] }), b ? /* @__PURE__ */ o("div", {
|
|
38
|
-
className: e.loader,
|
|
39
|
-
children: /* @__PURE__ */ o(l, {
|
|
40
|
-
"aria-label": v.formatMessage(t.reviewActionLoadingAriaLabel),
|
|
41
|
-
size: "small"
|
|
42
|
-
})
|
|
43
|
-
}) : /* @__PURE__ */ s("div", {
|
|
44
|
-
className: e.buttons,
|
|
45
|
-
children: [/* @__PURE__ */ o(d, {
|
|
46
|
-
content: v.formatMessage(t.acceptValueTooltip),
|
|
47
|
-
children: /* @__PURE__ */ o(c, {
|
|
48
|
-
"aria-label": v.formatMessage(t.acceptValueAriaLabel),
|
|
49
|
-
"data-target-id": "IconButton-metadataEditorLowConfAccept",
|
|
50
|
-
icon: p,
|
|
51
|
-
onClick: () => C(g),
|
|
52
|
-
size: "x-small"
|
|
53
|
-
})
|
|
54
|
-
}), /* @__PURE__ */ o(d, {
|
|
55
|
-
content: v.formatMessage(t.clearValueTooltip),
|
|
56
|
-
children: /* @__PURE__ */ o(c, {
|
|
57
|
-
"aria-label": v.formatMessage(t.clearValueAriaLabel),
|
|
58
|
-
"data-target-id": "IconButton-metadataEditorLowConfClear",
|
|
59
|
-
icon: m,
|
|
60
|
-
onClick: () => C(_),
|
|
61
|
-
size: "x-small"
|
|
62
|
-
})
|
|
63
|
-
})]
|
|
64
|
-
})]
|
|
65
|
-
})
|
|
66
|
-
});
|
|
67
|
-
}
|
|
68
|
-
export { g as LowConfidenceSuggestionField };
|
|
1
|
+
import{t as field_action_bar_module_default}from"../../../../../../chunks/field-action-bar.module.js";import messages_default from"./messages.js";import{useEffect,useRef,useState}from"react";import{useIntl}from"react-intl";import{jsx,jsxs}from"react/jsx-runtime";import{IconButton,LoadingIndicator,Text,Tooltip,useBlueprintModernization}from"@box/blueprint-web";import{Checkmark,XMark}from"@box/blueprint-web-assets/icons/Medium";var REVIEW_ACTION_DELAY_MS=800;function LowConfidenceSuggestionField({onAccept,onClear}){let intl=useIntl(),{enableModernizedComponents}=useBlueprintModernization(),[isLoading,setIsLoading]=useState(!1),timerRef=useRef(void 0);useEffect(()=>()=>clearTimeout(timerRef.current),[]);let withLoader=action=>{clearTimeout(timerRef.current),setIsLoading(!0);try{action()}finally{timerRef.current=setTimeout(()=>{setIsLoading(!1)},REVIEW_ACTION_DELAY_MS)}};return jsx(`div`,{className:field_action_bar_module_default.wrapperGradient,"data-modern":enableModernizedComponents,children:jsxs(`div`,{className:field_action_bar_module_default.wrapper,children:[jsxs(`div`,{children:[jsx(Text,{as:`p`,color:`textOnLightSecondary`,variant:`caption`,children:intl.formatMessage(messages_default.needsReview)}),jsx(Text,{as:`p`,color:`textOnLightDefault`,variant:`bodySmallSemibold`,children:intl.formatMessage(messages_default.description)})]}),isLoading?jsx(`div`,{className:field_action_bar_module_default.loader,children:jsx(LoadingIndicator,{"aria-label":intl.formatMessage(messages_default.reviewActionLoadingAriaLabel),size:`small`})}):jsxs(`div`,{className:field_action_bar_module_default.buttons,children:[jsx(Tooltip,{content:intl.formatMessage(messages_default.acceptValueTooltip),children:jsx(IconButton,{"aria-label":intl.formatMessage(messages_default.acceptValueAriaLabel),"data-target-id":`IconButton-metadataEditorLowConfAccept`,icon:Checkmark,onClick:()=>withLoader(onAccept),size:`x-small`})}),jsx(Tooltip,{content:intl.formatMessage(messages_default.clearValueTooltip),children:jsx(IconButton,{"aria-label":intl.formatMessage(messages_default.clearValueAriaLabel),"data-target-id":`IconButton-metadataEditorLowConfClear`,icon:XMark,onClick:()=>withLoader(onClear),size:`x-small`})})]})]})})}export{LowConfidenceSuggestionField};
|
|
@@ -1,32 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
var t = e({
|
|
3
|
-
needsReview: {
|
|
4
|
-
id: "metadataEditor.lowConfidenceSuggestionField.needsReview",
|
|
5
|
-
defaultMessage: "Needs review"
|
|
6
|
-
},
|
|
7
|
-
description: {
|
|
8
|
-
id: "metadataEditor.lowConfidenceSuggestionField.description",
|
|
9
|
-
defaultMessage: "Box AI returned low confidence"
|
|
10
|
-
},
|
|
11
|
-
acceptValueTooltip: {
|
|
12
|
-
id: "metadataEditor.lowConfidenceSuggestionField.acceptValueTooltip",
|
|
13
|
-
defaultMessage: "Accept Value"
|
|
14
|
-
},
|
|
15
|
-
clearValueTooltip: {
|
|
16
|
-
id: "metadataEditor.lowConfidenceSuggestionField.clearValueTooltip",
|
|
17
|
-
defaultMessage: "Clear Value"
|
|
18
|
-
},
|
|
19
|
-
acceptValueAriaLabel: {
|
|
20
|
-
id: "metadataEditor.lowConfidenceSuggestionField.acceptValueAriaLabel",
|
|
21
|
-
defaultMessage: "Accept extracted value"
|
|
22
|
-
},
|
|
23
|
-
clearValueAriaLabel: {
|
|
24
|
-
id: "metadataEditor.lowConfidenceSuggestionField.clearValueAriaLabel",
|
|
25
|
-
defaultMessage: "Clear extracted value"
|
|
26
|
-
},
|
|
27
|
-
reviewActionLoadingAriaLabel: {
|
|
28
|
-
id: "metadataEditor.lowConfidenceSuggestionField.reviewActionLoadingAriaLabel",
|
|
29
|
-
defaultMessage: "Processing review action"
|
|
30
|
-
}
|
|
31
|
-
});
|
|
32
|
-
export { t as default };
|
|
1
|
+
import{defineMessages}from"react-intl";var messages_default=defineMessages({needsReview:{id:`metadataEditor.lowConfidenceSuggestionField.needsReview`,defaultMessage:`Needs review`},description:{id:`metadataEditor.lowConfidenceSuggestionField.description`,defaultMessage:`Box AI returned low confidence`},acceptValueTooltip:{id:`metadataEditor.lowConfidenceSuggestionField.acceptValueTooltip`,defaultMessage:`Accept Value`},clearValueTooltip:{id:`metadataEditor.lowConfidenceSuggestionField.clearValueTooltip`,defaultMessage:`Clear Value`},acceptValueAriaLabel:{id:`metadataEditor.lowConfidenceSuggestionField.acceptValueAriaLabel`,defaultMessage:`Accept extracted value`},clearValueAriaLabel:{id:`metadataEditor.lowConfidenceSuggestionField.clearValueAriaLabel`,defaultMessage:`Clear extracted value`},reviewActionLoadingAriaLabel:{id:`metadataEditor.lowConfidenceSuggestionField.reviewActionLoadingAriaLabel`,defaultMessage:`Processing review action`}});export{messages_default as default};
|
|
@@ -1,44 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { convertCalendarDateToISOString as t, convertIsoStringToCalendarDate as n } from "../../../../utils/convertDate.js";
|
|
3
|
-
import { useMemoizedFieldLabel as r } from "../../hooks/use-memoized-field-label.js";
|
|
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
|
-
import { getIn as f, useFormikContext as p } from "formik";
|
|
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
|
-
k(C, t(e)), y();
|
|
12
|
-
}, [
|
|
13
|
-
C,
|
|
14
|
-
k,
|
|
15
|
-
y
|
|
16
|
-
]), F = o(() => {
|
|
17
|
-
O(C, !0);
|
|
18
|
-
}, [C, O]);
|
|
19
|
-
return /* @__PURE__ */ l("div", {
|
|
20
|
-
"data-testid": `${v}-field`,
|
|
21
|
-
children: /* @__PURE__ */ l(u, {
|
|
22
|
-
locale: w.locale,
|
|
23
|
-
children: /* @__PURE__ */ l(m, {
|
|
24
|
-
calendarAriaLabel: w.formatMessage(e.selectDate),
|
|
25
|
-
clearDatePickerAriaLabel: w.formatMessage(e.clearSelectedDate),
|
|
26
|
-
nextMonthAriaLabel: w.formatMessage(e.switchToNextMonth),
|
|
27
|
-
openCalendarDropdownAriaLabel: w.formatMessage(e.openCalendar),
|
|
28
|
-
previousMonthAriaLabel: w.formatMessage(e.switchToPreviousMonth),
|
|
29
|
-
ref: S,
|
|
30
|
-
className: i,
|
|
31
|
-
dataTargetId: "DatePicker-MetadataEditorDateField",
|
|
32
|
-
error: M,
|
|
33
|
-
isDisabled: g,
|
|
34
|
-
label: N,
|
|
35
|
-
name: C,
|
|
36
|
-
onBlur: F,
|
|
37
|
-
onChange: P,
|
|
38
|
-
portalElement: b,
|
|
39
|
-
value: j
|
|
40
|
-
})
|
|
41
|
-
})
|
|
42
|
-
});
|
|
43
|
-
});
|
|
44
|
-
export { h as MetadataDateField, h as default };
|
|
1
|
+
import messages from"../../../../messages.js";import{convertCalendarDateToISOString,convertIsoStringToCalendarDate}from"../../../../utils/convertDate.js";import{useMemoizedFieldLabel}from"../../hooks/use-memoized-field-label.js";import{forwardRef,memo,useCallback,useMemo}from"react";import{useIntl}from"react-intl";import{jsx}from"react/jsx-runtime";import{DateI18nProvider,DatePicker}from"@box/blueprint-web";import{getIn,useFormikContext}from"formik";var MemoizedDatePicker=memo(DatePicker),MetadataDateField=forwardRef(({className,description,isAiSuggestionApplied,confidenceScore,disableForm,fieldNamePrefix,label,onValueEdited,portalElement,updateModePrefix},forwardedRef)=>{let fieldName=`${updateModePrefix??fieldNamePrefix}.value`,intl=useIntl(),{values,errors,touched,setFieldTouched,setFieldValue}=useFormikContext(),formikValue=getIn(values,fieldName),fieldDatePickerValue=useMemo(()=>convertIsoStringToCalendarDate(formikValue),[formikValue]),fieldError=getIn(touched,fieldName)?getIn(errors,fieldName):void 0,fieldLabel=useMemoizedFieldLabel(label,description,isAiSuggestionApplied,`span`,confidenceScore),handleOnChange=useCallback(datePickerValue=>{setFieldValue(fieldName,convertCalendarDateToISOString(datePickerValue)),onValueEdited()},[fieldName,setFieldValue,onValueEdited]),handleOnBlur=useCallback(()=>{setFieldTouched(fieldName,!0)},[fieldName,setFieldTouched]);return jsx(`div`,{"data-testid":`${label}-field`,children:jsx(DateI18nProvider,{locale:intl.locale,children:jsx(MemoizedDatePicker,{calendarAriaLabel:intl.formatMessage(messages.selectDate),clearDatePickerAriaLabel:intl.formatMessage(messages.clearSelectedDate),nextMonthAriaLabel:intl.formatMessage(messages.switchToNextMonth),openCalendarDropdownAriaLabel:intl.formatMessage(messages.openCalendar),previousMonthAriaLabel:intl.formatMessage(messages.switchToPreviousMonth),ref:forwardedRef,className,dataTargetId:`DatePicker-MetadataEditorDateField`,error:fieldError,isDisabled:disableForm,label:fieldLabel,name:fieldName,onBlur:handleOnBlur,onChange:handleOnChange,portalElement,value:fieldDatePickerValue})})})});export{MetadataDateField,MetadataDateField as default};
|
|
@@ -1,48 +1 @@
|
|
|
1
|
-
import
|
|
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 { 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
|
-
import { Field as u, getIn as d, useFormikContext as f } from "formik";
|
|
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
|
-
"data-testid": `${y}-field`,
|
|
14
|
-
children: /* @__PURE__ */ o(u, {
|
|
15
|
-
name: D,
|
|
16
|
-
children: ({ field: t }) => /* @__PURE__ */ o(l, {
|
|
17
|
-
ref: C,
|
|
18
|
-
className: r,
|
|
19
|
-
"data-target-id": "Select-MetadataEditorEnumField",
|
|
20
|
-
disabled: g,
|
|
21
|
-
label: j,
|
|
22
|
-
onValueChange: (e) => {
|
|
23
|
-
w(D, e === c ? "" : e), b();
|
|
24
|
-
},
|
|
25
|
-
placeholder: A,
|
|
26
|
-
...t,
|
|
27
|
-
value: t.value === c ? "" : t.value,
|
|
28
|
-
children: /* @__PURE__ */ s(l.Content, {
|
|
29
|
-
container: S,
|
|
30
|
-
onEscapeKeyDown: (e) => e.stopPropagation(),
|
|
31
|
-
children: [/* @__PURE__ */ o(l.Option, {
|
|
32
|
-
text: A,
|
|
33
|
-
value: c,
|
|
34
|
-
children: /* @__PURE__ */ o(i, { ...e.selectValuePlaceholder })
|
|
35
|
-
}), k?.map((e) => {
|
|
36
|
-
let t = M(e);
|
|
37
|
-
return /* @__PURE__ */ o(l.Option, {
|
|
38
|
-
text: t,
|
|
39
|
-
value: e,
|
|
40
|
-
children: t
|
|
41
|
-
}, e);
|
|
42
|
-
})]
|
|
43
|
-
})
|
|
44
|
-
})
|
|
45
|
-
})
|
|
46
|
-
});
|
|
47
|
-
});
|
|
48
|
-
export { p as MetadataEnumField, p as default };
|
|
1
|
+
import messages from"../../../../messages.js";import"../update-mode-field-wrapper/mulitple-values-utils.js";import{messages as messages$1}from"../update-mode-field-wrapper/messages.js";import{useMemoizedFieldLabel}from"../../hooks/use-memoized-field-label.js";import{forwardRef}from"react";import{FormattedMessage,useIntl}from"react-intl";import{jsx,jsxs}from"react/jsx-runtime";import{SELECT_EMPTY_VALUE,Select}from"@box/blueprint-web";import{Field,getIn,useFormikContext}from"formik";var MetadataEnumField=forwardRef(({className,isAiSuggestionApplied,confidenceScore,description,disableForm,fieldNamePrefix,updateModePrefix,label,onValueEdited,options,portalElement},forwardedRef)=>{let{setFieldValue,values}=useFormikContext(),{formatMessage}=useIntl(),fieldName=`${updateModePrefix??fieldNamePrefix}.value`,multipleValuesLabel=formatMessage(messages$1.multipleValues),fieldOptions=(options||getIn(values,`${fieldNamePrefix}.options`,[])).map(option=>typeof option==`string`?option:option.key),defaultMessage=formatMessage(messages.selectValuePlaceholder),fieldLabel=useMemoizedFieldLabel(label,description,isAiSuggestionApplied,`label`,confidenceScore),getOptionLabel=option=>option===`Multiple values`?multipleValuesLabel:option;return jsx(`div`,{"data-testid":`${label}-field`,children:jsx(Field,{name:fieldName,children:({field})=>jsx(Select,{ref:forwardedRef,className,"data-target-id":`Select-MetadataEditorEnumField`,disabled:disableForm,label:fieldLabel,onValueChange:key=>{setFieldValue(fieldName,key===SELECT_EMPTY_VALUE?``:key),onValueEdited()},placeholder:defaultMessage,...field,value:field.value===SELECT_EMPTY_VALUE?``:field.value,children:jsxs(Select.Content,{container:portalElement,onEscapeKeyDown:e=>e.stopPropagation(),children:[jsx(Select.Option,{text:defaultMessage,value:SELECT_EMPTY_VALUE,children:jsx(FormattedMessage,{...messages.selectValuePlaceholder})}),fieldOptions?.map(option=>{let optionLabel=getOptionLabel(option);return jsx(Select.Option,{text:optionLabel,value:option,children:optionLabel},option)})]})})})})});export{MetadataEnumField,MetadataEnumField as default};
|
|
@@ -1,34 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { useFloatValidation as t } from "./use-float-validation.js";
|
|
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
|
-
import { Field as o, getIn as s, useFormikContext as c } from "formik";
|
|
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
|
-
S.current = e, y(x, e), h();
|
|
10
|
-
}, E = (e) => {
|
|
11
|
-
b(e, !0);
|
|
12
|
-
};
|
|
13
|
-
return /* @__PURE__ */ i("div", {
|
|
14
|
-
"data-testid": `${f}-field`,
|
|
15
|
-
children: /* @__PURE__ */ i(o, {
|
|
16
|
-
name: `${x}`,
|
|
17
|
-
validate: () => C(S.current),
|
|
18
|
-
children: ({ field: e, meta: t }) => /* @__PURE__ */ i(a, {
|
|
19
|
-
...e,
|
|
20
|
-
ref: _,
|
|
21
|
-
className: n,
|
|
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
|
-
});
|
|
33
|
-
});
|
|
34
|
-
export { l as MetadataFloatField, l as default };
|
|
1
|
+
import{useMemoizedFieldLabel}from"../../hooks/use-memoized-field-label.js";import{useFloatValidation}from"./use-float-validation.js";import{forwardRef,useRef}from"react";import{jsx}from"react/jsx-runtime";import{TextInput}from"@box/blueprint-web";import{Field,getIn,useFormikContext}from"formik";var MetadataFloatField=forwardRef(({className,description,isAiSuggestionApplied,confidenceScore,label,fieldNamePrefix,disableForm,onValueEdited,updateModePrefix},forwardedRef)=>{let{values,setFieldValue,setFieldTouched}=useFormikContext(),fieldName=`${updateModePrefix??fieldNamePrefix}.value`,validationRef=useRef(getIn(values,fieldName)),{validateFloats}=useFloatValidation(),fieldLabel=useMemoizedFieldLabel(label,description,isAiSuggestionApplied,`label`,confidenceScore),handleOnChange=value=>{validationRef.current=value,setFieldValue(fieldName,value),onValueEdited()},handleOnBlur=name=>{setFieldTouched(name,!0)};return jsx(`div`,{"data-testid":`${label}-field`,children:jsx(Field,{name:`${fieldName}`,validate:()=>validateFloats(validationRef.current),children:({field,meta})=>jsx(TextInput,{...field,ref:forwardedRef,className,"data-target-id":`TextInput-MetadataEditorFloatField`,disabled:disableForm,error:meta.error,inputMode:`decimal`,label:fieldLabel,onBlur:()=>handleOnBlur(fieldName),onChange:e=>handleOnChange(e.currentTarget.value),placeholder:`0`})})})});export{MetadataFloatField,MetadataFloatField as default};
|
|
@@ -1,9 +1 @@
|
|
|
1
|
-
import
|
|
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
|
-
} };
|
|
8
|
-
};
|
|
9
|
-
export { n as isFloatOrBlank, r as useFloatValidation };
|
|
1
|
+
import messages from"../../../../messages.js";import{useIntl}from"react-intl";var isFloatOrBlank=value=>value?.length?/^[-+]?\d+(\.\d+)?$/.test(value):!0,useFloatValidation=()=>{let intl=useIntl();return{validateFloats:fieldValue=>{if(!isFloatOrBlank(fieldValue))return intl.formatMessage(messages.floatFieldInvalidValue)}}};export{isFloatOrBlank,useFloatValidation};
|
|
@@ -1,41 +1 @@
|
|
|
1
|
-
import
|
|
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 { 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
|
-
import { Field as s, getIn as c, useFormikContext as l } from "formik";
|
|
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
|
-
"data-testid": `${h}-field`,
|
|
14
|
-
children: /* @__PURE__ */ a(s, {
|
|
15
|
-
name: w,
|
|
16
|
-
children: ({ field: t }) => {
|
|
17
|
-
let n = (t.value?.length || 0) === 0 ? C(e.multiselectPlaceholder) : "";
|
|
18
|
-
return /* @__PURE__ */ a(o, {
|
|
19
|
-
ref: b,
|
|
20
|
-
as: "input",
|
|
21
|
-
className: r,
|
|
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
|
-
});
|
|
40
|
-
});
|
|
41
|
-
export { u as MetadataMultiSelectField, u as default };
|
|
1
|
+
import messages from"../../../../messages.js";import"../update-mode-field-wrapper/mulitple-values-utils.js";import{messages as messages$1}from"../update-mode-field-wrapper/messages.js";import{useMemoizedFieldLabel}from"../../hooks/use-memoized-field-label.js";import{forwardRef}from"react";import{useIntl}from"react-intl";import{jsx}from"react/jsx-runtime";import{Combobox}from"@box/blueprint-web";import{Field,getIn,useFormikContext}from"formik";var MetadataMultiSelectField=forwardRef(({className,isAiSuggestionApplied,confidenceScore,description,disableForm,fieldNamePrefix,label,onValueEdited,options,portalElement,updateModePrefix},forwardedRef)=>{let{setFieldValue,values}=useFormikContext(),{formatMessage}=useIntl(),fieldName=`${updateModePrefix??fieldNamePrefix}.value`,multipleValuesLabel=formatMessage(messages$1.multipleValues),filedOptions=(options||getIn(values,`${fieldNamePrefix}.options`,[])).map(option=>typeof option==`string`?option:option.key),fieldLabel=useMemoizedFieldLabel(label,description,isAiSuggestionApplied,`label`,confidenceScore),onFilter=(query,option)=>option.toLowerCase().includes(query.toLowerCase());return jsx(`div`,{"data-testid":`${label}-field`,children:jsx(Field,{name:fieldName,children:({field})=>{let placeholder=(field.value?.length||0)===0?formatMessage(messages.multiselectPlaceholder):``;return jsx(Combobox,{ref:forwardedRef,as:`input`,className,"data-target-id":`Combobox-MetadataEditorMultiSelectField`,disabled:disableForm,displayValue:val=>val===`Multiple values`?multipleValuesLabel:val,filterFn:onFilter,label:fieldLabel,multiselect:!0,name:field.name,onValueChange:value=>{setFieldValue(fieldName,value),onValueEdited()},options:filedOptions,placeholder,portalElement,value:field.value})}})})});export{MetadataMultiSelectField,MetadataMultiSelectField as default};
|
|
@@ -1,29 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { useMemoizedFieldLabel as t } from "../../hooks/use-memoized-field-label.js";
|
|
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
|
-
import { Field as o } from "formik";
|
|
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
|
-
"data-testid": `${f}-field`,
|
|
12
|
-
children: /* @__PURE__ */ i(o, {
|
|
13
|
-
name: _,
|
|
14
|
-
children: ({ field: t, meta: r }) => /* @__PURE__ */ i(a, {
|
|
15
|
-
...t,
|
|
16
|
-
ref: h,
|
|
17
|
-
className: n,
|
|
18
|
-
"data-target-id": "TextInput-metadataEditorStringField",
|
|
19
|
-
disabled: u,
|
|
20
|
-
error: r.error,
|
|
21
|
-
label: v,
|
|
22
|
-
onChangeCapture: p,
|
|
23
|
-
placeholder: g.formatMessage(e.setValuePlaceholder)
|
|
24
|
-
})
|
|
25
|
-
})
|
|
26
|
-
});
|
|
27
|
-
});
|
|
28
|
-
s.displayName = "MetadataStringField";
|
|
29
|
-
export { s as MetadataStringField, s as default };
|
|
1
|
+
import messages from"../../../../messages.js";import{useMemoizedFieldLabel}from"../../hooks/use-memoized-field-label.js";import{forwardRef}from"react";import{useIntl}from"react-intl";import{jsx}from"react/jsx-runtime";import{TextInput}from"@box/blueprint-web";import{Field}from"formik";var MetadataStringField=forwardRef(({className,description,isAiSuggestionApplied,confidenceScore,disableForm,fieldNamePrefix,label,onValueEdited,updateModePrefix},forwardedRef)=>{let intl=useIntl(),fieldName=`${updateModePrefix??fieldNamePrefix}.value`,fieldLabel=useMemoizedFieldLabel(label,description,isAiSuggestionApplied,`label`,confidenceScore);return jsx(`div`,{"data-testid":`${label}-field`,children:jsx(Field,{name:fieldName,children:({field,meta})=>jsx(TextInput,{...field,ref:forwardedRef,className,"data-target-id":`TextInput-metadataEditorStringField`,disabled:disableForm,error:meta.error,label:fieldLabel,onChangeCapture:onValueEdited,placeholder:intl.formatMessage(messages.setValuePlaceholder)})})})});MetadataStringField.displayName=`MetadataStringField`;export{MetadataStringField,MetadataStringField as default};
|
|
@@ -1,67 +1 @@
|
|
|
1
|
-
import
|
|
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 { 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
|
-
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__*/ 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
|
-
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__ */ o("div", {
|
|
21
|
-
"data-testid": `${v}-field`,
|
|
22
|
-
onKeyDown: (e) => e.stopPropagation(),
|
|
23
|
-
role: "presentation",
|
|
24
|
-
children: /* @__PURE__ */ o(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__ */ o(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__ */ o(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__ */ o(s, {
|
|
63
|
-
content: D(e.taxonomyExternallyOwned),
|
|
64
|
-
children: W
|
|
65
|
-
}) : W;
|
|
66
|
-
});
|
|
67
|
-
export { m as LegacyMetadataTaxonomyField };
|
|
1
|
+
import messages from"../../../../messages.js";import"../update-mode-field-wrapper/mulitple-values-utils.js";import{messages as messages$1}from"../update-mode-field-wrapper/messages.js";import{useMemoizedFieldLabel}from"../../hooks/use-memoized-field-label.js";import{forwardRef,useCallback}from"react";import{useIntl}from"react-intl";import{jsx}from"react/jsx-runtime";import{Tooltip}from"@box/blueprint-web";import{Field,getIn,useFormikContext}from"formik";import{ComboboxWithApiPagination,ComboboxWithApiTreeView}from"@box/combobox-with-api";var getFieldValue=(option,multipleValuesLabel)=>option===`Multiple values`?multipleValuesLabel:option,LegacyMetadataTaxonomyField=forwardRef(({description,disableForm,isAiSuggestionApplied,confidenceScore,fieldNamePrefix,label,onValueEdited,portalElement,taxonomyOptionsFetcher,updateModePrefix,className,isExternallyOwned,isMultilevelTaxonomyFieldEnabled},forwardedRef)=>{let{formatMessage}=useIntl(),fieldName=`${updateModePrefix??fieldNamePrefix}.value`,{setFieldValue,values}=useFormikContext(),{metadata:{templateKey,scope}}=values,{key,optionsRules:{multiSelect,selectableLevels},levels}=getIn(values,fieldNamePrefix),multipleValuesLabel=formatMessage(messages$1.multipleValues),isMultilevelTaxonomy=isMultilevelTaxonomyFieldEnabled&&selectableLevels?.some(level=>level>1),isDisabled=disableForm||isExternallyOwned,fieldLabel=useMemoizedFieldLabel(label,description,isAiSuggestionApplied,`label`,confidenceScore),defaultFetcher=useCallback(input=>taxonomyOptionsFetcher(scope,templateKey,key,selectableLevels?.[0],input),[key,scope,selectableLevels,taxonomyOptionsFetcher,templateKey]),getPlaceholder=selectedValues=>multiSelect||!selectedValues?.length?formatMessage(messages.taxonomyPlaceholder):void 0,handleValueChange=value=>{setFieldValue(fieldName,value),onValueEdited()},fieldContent=jsx(`div`,{"data-testid":`${label}-field`,onKeyDown:e=>e.stopPropagation(),role:`presentation`,children:jsx(Field,{name:fieldName,children:({field})=>{let mappedValue=Array.isArray(field.value)?field.value.map(val=>({...val,displayValue:getFieldValue(val.displayValue,multipleValuesLabel)})):field.value;return isMultilevelTaxonomy?jsx(ComboboxWithApiTreeView,{ref:forwardedRef,className,closeOnSelection:isMultilevelTaxonomy,dataTargetId:`ComboboxWithApiTreeView-MetadataEditorTaxonomyField`,defaultFetcher,disabled:isDisabled,label:fieldLabel,levels,multiselect:multiSelect,onValueChange:handleValueChange,placeholder:getPlaceholder(field.value),portalElement,selectableLevels,value:mappedValue}):jsx(ComboboxWithApiPagination,{ref:forwardedRef,className,dataTargetId:`ComboboxWithApiPagination-MetadataEditorTaxonomyField`,defaultFetcher,disabled:isDisabled,label:fieldLabel,multiselect:multiSelect,onValueChange:handleValueChange,placeholder:getPlaceholder(field.value),portalElement,value:mappedValue})}})});return isExternallyOwned?jsx(Tooltip,{content:formatMessage(messages.taxonomyExternallyOwned),children:fieldContent}):fieldContent});export{LegacyMetadataTaxonomyField};
|
|
@@ -1,16 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { MetadataTaxonomyPickerField as t } from "./metadata-taxonomy-picker-field/metadata-taxonomy-picker-field.js";
|
|
3
|
-
import { forwardRef as n } from "react";
|
|
4
|
-
import { jsx as r } from "react/jsx-runtime";
|
|
5
|
-
var i = /*#__PURE__*/ n((n, i) => {
|
|
6
|
-
let { isTaxonomyPickerEnabled: a, createTaxonomyItemsService: o } = n;
|
|
7
|
-
return a && o ? /* @__PURE__ */ r(t, {
|
|
8
|
-
...n,
|
|
9
|
-
ref: i,
|
|
10
|
-
createTaxonomyItemsService: o
|
|
11
|
-
}) : (a && process.env.NODE_ENV !== "production" && console.error("[metadata-editor] isTaxonomyPickerEnabled is true but createTaxonomyItemsService was not provided; falling back to the legacy taxonomy field."), /* @__PURE__ */ r(e, {
|
|
12
|
-
...n,
|
|
13
|
-
ref: i
|
|
14
|
-
}));
|
|
15
|
-
});
|
|
16
|
-
export { i as MetadataTaxonomyField };
|
|
1
|
+
import{LegacyMetadataTaxonomyField}from"./legacy-metadata-taxonomy-field.js";import{MetadataTaxonomyPickerField}from"./metadata-taxonomy-picker-field/metadata-taxonomy-picker-field.js";import{forwardRef}from"react";import{jsx}from"react/jsx-runtime";var MetadataTaxonomyField=forwardRef((props,forwardedRef)=>{let{isTaxonomyPickerEnabled,createTaxonomyItemsService}=props;return isTaxonomyPickerEnabled&&createTaxonomyItemsService?jsx(MetadataTaxonomyPickerField,{...props,ref:forwardedRef,createTaxonomyItemsService}):(isTaxonomyPickerEnabled&&process.env.NODE_ENV!==`production`&&console.error(`[metadata-editor] isTaxonomyPickerEnabled is true but createTaxonomyItemsService was not provided; falling back to the legacy taxonomy field.`),jsx(LegacyMetadataTaxonomyField,{...props,ref:forwardedRef}))});export{MetadataTaxonomyField};
|
|
@@ -1,53 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { messages as t } from "../../update-mode-field-wrapper/messages.js";
|
|
3
|
-
import { n } from "../../../../../../../chunks/utils.js";
|
|
4
|
-
import { getTaxonomyPickerMode as r, mapFormValueToTaxonomyValues as i, mapLevelsToTaxonomyLevels as a, mapTaxonomyValuesToFormValue as o } from "./value-mapping.js";
|
|
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
|
-
import { Field as f, getIn as p, useFormikContext as m } from "formik";
|
|
10
|
-
import { MetadataTaxonomyPicker as h } from "@box/metadata-taxonomy-picker";
|
|
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
|
-
scope: N,
|
|
14
|
-
templateKey: M,
|
|
15
|
-
fieldKey: P
|
|
16
|
-
}), [
|
|
17
|
-
E,
|
|
18
|
-
N,
|
|
19
|
-
M,
|
|
20
|
-
P
|
|
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
|
-
A(k, o(e)), x();
|
|
23
|
-
}, K = /* @__PURE__ */ u("div", {
|
|
24
|
-
"data-testid": `${b}-field`,
|
|
25
|
-
onKeyDown: (e) => e.stopPropagation(),
|
|
26
|
-
role: "presentation",
|
|
27
|
-
children: /* @__PURE__ */ u(f, {
|
|
28
|
-
name: k,
|
|
29
|
-
children: ({ field: e }) => {
|
|
30
|
-
let t = i(e.value, R);
|
|
31
|
-
return /* @__PURE__ */ u(h, {
|
|
32
|
-
ref: D,
|
|
33
|
-
containerClassName: w,
|
|
34
|
-
disabled: z,
|
|
35
|
-
itemsService: B,
|
|
36
|
-
label: U,
|
|
37
|
-
levels: H,
|
|
38
|
-
mode: V,
|
|
39
|
-
multiSelect: F,
|
|
40
|
-
onValueChange: G,
|
|
41
|
-
placeholder: W(t),
|
|
42
|
-
portalElement: S,
|
|
43
|
-
value: t
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
})
|
|
47
|
-
});
|
|
48
|
-
return T ? /* @__PURE__ */ u(d, {
|
|
49
|
-
content: O(e.taxonomyExternallyOwned),
|
|
50
|
-
children: K
|
|
51
|
-
}) : K;
|
|
52
|
-
});
|
|
53
|
-
export { g as MetadataTaxonomyPickerField };
|
|
1
|
+
import messages from"../../../../../messages.js";import{messages as messages$1}from"../../update-mode-field-wrapper/messages.js";import{n as getFieldLabelContent}from"../../../../../../../chunks/utils.js";import{getTaxonomyPickerMode,mapFormValueToTaxonomyValues,mapLevelsToTaxonomyLevels,mapTaxonomyValuesToFormValue}from"./value-mapping.js";import{forwardRef,useMemo}from"react";import{useIntl}from"react-intl";import{jsx}from"react/jsx-runtime";import{Tooltip}from"@box/blueprint-web";import{Field,getIn,useFormikContext}from"formik";import{MetadataTaxonomyPicker}from"@box/metadata-taxonomy-picker";var MetadataTaxonomyPickerField=forwardRef(({description,disableForm,isAiSuggestionApplied,confidenceScore,fieldNamePrefix,label,onValueEdited,portalElement,updateModePrefix,className,isExternallyOwned,createTaxonomyItemsService},forwardedRef)=>{let{formatMessage}=useIntl(),fieldName=`${updateModePrefix??fieldNamePrefix}.value`,{setFieldValue,values}=useFormikContext(),{metadata:{templateKey,scope}}=values,{key,optionsRules:{multiSelect,selectableLevels},levels}=getIn(values,fieldNamePrefix),multipleValuesLabel=formatMessage(messages$1.multipleValues),isDisabled=disableForm||isExternallyOwned,itemsService=useMemo(()=>createTaxonomyItemsService({scope,templateKey,fieldKey:key}),[createTaxonomyItemsService,scope,templateKey,key]),mode=getTaxonomyPickerMode(selectableLevels),pickerLevels=useMemo(()=>mapLevelsToTaxonomyLevels(levels,selectableLevels),[levels,selectableLevels]),fieldLabel=getFieldLabelContent(label,description??void 0,isAiSuggestionApplied,confidenceScore),getPlaceholder=selectedValues=>multiSelect||!selectedValues.length?formatMessage(messages.taxonomyPlaceholder):void 0,handleValueChange=newValues=>{setFieldValue(fieldName,mapTaxonomyValuesToFormValue(newValues)),onValueEdited()},fieldContent=jsx(`div`,{"data-testid":`${label}-field`,onKeyDown:e=>e.stopPropagation(),role:`presentation`,children:jsx(Field,{name:fieldName,children:({field})=>{let pickerValue=mapFormValueToTaxonomyValues(field.value,multipleValuesLabel);return jsx(MetadataTaxonomyPicker,{ref:forwardedRef,containerClassName:className,disabled:isDisabled,itemsService,label:fieldLabel,levels:pickerLevels,mode,multiSelect,onValueChange:handleValueChange,placeholder:getPlaceholder(pickerValue),portalElement,value:pickerValue})}})});return isExternallyOwned?jsx(Tooltip,{content:formatMessage(messages.taxonomyExternallyOwned),children:fieldContent}):fieldContent});export{MetadataTaxonomyPickerField};
|