@box/metadata-editor 2.3.9 → 2.3.10

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.
Files changed (158) hide show
  1. package/dist/chunks/add-metadata-template-dropdown-with-browser.js +1 -34
  2. package/dist/chunks/ai-suggestion-field.js +1 -100
  3. package/dist/chunks/autofill-overlay.js +1 -63
  4. package/dist/chunks/combobox-with-api-pagination.js +1 -161
  5. package/dist/chunks/custom-instance-new-field.js +1 -60
  6. package/dist/chunks/custom-instance.js +1 -74
  7. package/dist/chunks/delete-confirmation-modal.js +1 -76
  8. package/dist/chunks/field-action-bar.module.js +1 -7
  9. package/dist/chunks/filter-dropdown-menu.module.js +1 -12
  10. package/dist/chunks/filter-instances-dropdown.js +1 -84
  11. package/dist/chunks/interactive-header-text.js +1 -19
  12. package/dist/chunks/interactive-text.module.js +1 -5
  13. package/dist/chunks/metadata-editor.js +1 -9
  14. package/dist/chunks/metadata-instance-content.js +1 -43
  15. package/dist/chunks/metadata-instance-entry.js +1 -104
  16. package/dist/chunks/metadata-instance-footer.js +1 -25
  17. package/dist/chunks/metadata-instance-form-ai-disclaimer.js +1 -28
  18. package/dist/chunks/metadata-instance-form-autofill-button.js +1 -113
  19. package/dist/chunks/metadata-instance-form-card-wrapper.js +1 -54
  20. package/dist/chunks/metadata-instance-form-footer.js +1 -43
  21. package/dist/chunks/metadata-instance-form-header.js +1 -45
  22. package/dist/chunks/metadata-instance-header.js +1 -52
  23. package/dist/chunks/metadata-instance-list.js +1 -20
  24. package/dist/chunks/metadata-instance.js +1 -60
  25. package/dist/chunks/shared-field-styles.module.js +1 -6
  26. package/dist/chunks/taxonomy-ancestor-status-pill.js +1 -90
  27. package/dist/chunks/types.js +1 -8
  28. package/dist/chunks/update-mode-field-wrapper.js +1 -80
  29. package/dist/chunks/utils.js +1 -88
  30. package/dist/chunks/utils2.js +1 -53
  31. package/dist/esm/index.js +1 -25
  32. package/dist/esm/lib/components/add-metadata-template-dropdown/add-metadata-template-dropdown-with-browser.js +1 -2
  33. package/dist/esm/lib/components/add-metadata-template-dropdown/add-metadata-template-dropdown.js +1 -24
  34. package/dist/esm/lib/components/add-metadata-template-dropdown/index.js +1 -3
  35. package/dist/esm/lib/components/add-metadata-template-dropdown/messages.js +1 -20
  36. package/dist/esm/lib/components/add-metadata-template-dropdown/shared/dropdown-trigger.js +1 -16
  37. package/dist/esm/lib/components/combobox-with-api-pagination/combobox-with-api-pagination.js +1 -2
  38. package/dist/esm/lib/components/combobox-with-api-pagination/index.js +1 -2
  39. package/dist/esm/lib/components/combobox-with-api-pagination/messages.js +1 -32
  40. package/dist/esm/lib/components/combobox-with-api-pagination/request.js +1 -4
  41. package/dist/esm/lib/components/combobox-with-api-pagination/use-async-list.js +1 -118
  42. package/dist/esm/lib/components/combobox-with-api-pagination/utils/is-abort-error.js +1 -11
  43. package/dist/esm/lib/components/combobox-with-api-pagination/utils/use-controllable-state.js +1 -35
  44. package/dist/esm/lib/components/combobox-with-api-pagination/utils/use-intersection-observer.js +1 -75
  45. package/dist/esm/lib/components/filter-dropdown-menu/filter-dropdown-menu-content.js +1 -14
  46. package/dist/esm/lib/components/filter-dropdown-menu/filter-dropdown-menu-empty-state.js +1 -17
  47. package/dist/esm/lib/components/filter-dropdown-menu/filter-dropdown-menu-item.js +1 -15
  48. package/dist/esm/lib/components/filter-dropdown-menu/filter-dropdown-menu-list.js +1 -17
  49. package/dist/esm/lib/components/filter-dropdown-menu/filter-dropdown-menu-root.js +1 -14
  50. package/dist/esm/lib/components/filter-dropdown-menu/filter-dropdown-menu-search.js +1 -37
  51. package/dist/esm/lib/components/filter-dropdown-menu/filter-dropdown-menu-trigger.js +1 -8
  52. package/dist/esm/lib/components/filter-dropdown-menu/index.js +1 -17
  53. package/dist/esm/lib/components/filter-dropdown-menu/messages.js +1 -12
  54. package/dist/esm/lib/components/filter-instances-dropdown/filter-instances-dropdown.js +1 -2
  55. package/dist/esm/lib/components/filter-instances-dropdown/index.js +1 -2
  56. package/dist/esm/lib/components/filter-instances-dropdown/messages.js +1 -20
  57. package/dist/esm/lib/components/interactive-header-text/interactive-header-text.js +1 -2
  58. package/dist/esm/lib/components/interactive-text/interactive-text.js +1 -18
  59. package/dist/esm/lib/components/metadata-editor-fields/components/ai-logo-badge/ai-logo-badge.js +1 -36
  60. package/dist/esm/lib/components/metadata-editor-fields/components/ai-logo-badge/index.js +1 -2
  61. package/dist/esm/lib/components/metadata-editor-fields/components/ai-suggestion-field/ai-suggestion-field.js +1 -2
  62. package/dist/esm/lib/components/metadata-editor-fields/components/ai-suggestion-field/index.js +1 -2
  63. package/dist/esm/lib/components/metadata-editor-fields/components/ai-suggestion-field/messages.js +1 -52
  64. package/dist/esm/lib/components/metadata-editor-fields/components/ai-suggestion-field/utils.js +1 -13
  65. package/dist/esm/lib/components/metadata-editor-fields/components/constants.js +1 -2
  66. package/dist/esm/lib/components/metadata-editor-fields/components/low-confidence-badge/index.js +1 -2
  67. package/dist/esm/lib/components/metadata-editor-fields/components/low-confidence-badge/low-confidence-badge.js +1 -24
  68. package/dist/esm/lib/components/metadata-editor-fields/components/low-confidence-suggestion-field/index.js +1 -2
  69. package/dist/esm/lib/components/metadata-editor-fields/components/low-confidence-suggestion-field/low-confidence-suggestion-field.js +1 -68
  70. package/dist/esm/lib/components/metadata-editor-fields/components/low-confidence-suggestion-field/messages.js +1 -32
  71. package/dist/esm/lib/components/metadata-editor-fields/components/metadata-date-field/metadata-date-field.js +1 -44
  72. package/dist/esm/lib/components/metadata-editor-fields/components/metadata-enum-field/metadata-enum-field.js +1 -48
  73. package/dist/esm/lib/components/metadata-editor-fields/components/metadata-float-field/metadata-float-field.js +1 -34
  74. package/dist/esm/lib/components/metadata-editor-fields/components/metadata-float-field/use-float-validation.js +1 -9
  75. package/dist/esm/lib/components/metadata-editor-fields/components/metadata-multi-select-field/metadata-multi-select-field.js +1 -41
  76. package/dist/esm/lib/components/metadata-editor-fields/components/metadata-string-field/metadata-string-field.js +1 -29
  77. package/dist/esm/lib/components/metadata-editor-fields/components/metadata-taxonomy-field/legacy-metadata-taxonomy-field.js +1 -67
  78. package/dist/esm/lib/components/metadata-editor-fields/components/metadata-taxonomy-field/metadata-taxonomy-field.js +1 -16
  79. package/dist/esm/lib/components/metadata-editor-fields/components/metadata-taxonomy-field/metadata-taxonomy-picker-field/metadata-taxonomy-picker-field.js +1 -53
  80. package/dist/esm/lib/components/metadata-editor-fields/components/metadata-taxonomy-field/metadata-taxonomy-picker-field/value-mapping.js +1 -30
  81. package/dist/esm/lib/components/metadata-editor-fields/components/update-mode-field-wrapper/messages.js +1 -32
  82. package/dist/esm/lib/components/metadata-editor-fields/components/update-mode-field-wrapper/mulitple-values-utils.js +1 -8
  83. package/dist/esm/lib/components/metadata-editor-fields/components/update-mode-field-wrapper/update-mode-field-wrapper.js +1 -2
  84. package/dist/esm/lib/components/metadata-editor-fields/editor-field-types.js +1 -32
  85. package/dist/esm/lib/components/metadata-editor-fields/hooks/use-memoized-field-label.js +1 -12
  86. package/dist/esm/lib/components/metadata-editor-fields/hooks/use-review-field-filter.js +1 -36
  87. package/dist/esm/lib/components/metadata-editor-fields/hooks/use-view-reference-tooltip.js +1 -41
  88. package/dist/esm/lib/components/metadata-editor-fields/messages.js +1 -12
  89. package/dist/esm/lib/components/metadata-editor-fields/metadata-editor-field-wrapper.js +1 -189
  90. package/dist/esm/lib/components/metadata-editor-fields/metadata-editor-fields.js +1 -31
  91. package/dist/esm/lib/components/metadata-editor-fields/utils.js +1 -2
  92. package/dist/esm/lib/components/metadata-empty-state/messages.js +1 -44
  93. package/dist/esm/lib/components/metadata-empty-state/metadata-empty-state.js +1 -47
  94. package/dist/esm/lib/components/metadata-instance-editor/index.js +1 -9
  95. package/dist/esm/lib/components/metadata-instance-editor/subcomponents/autofill-overlay/autofill-overlay.js +1 -2
  96. package/dist/esm/lib/components/metadata-instance-editor/subcomponents/autofill-overlay/messages.js +1 -40
  97. package/dist/esm/lib/components/metadata-instance-editor/subcomponents/autofill-overlay/useErrorMessaging.js +1 -23
  98. package/dist/esm/lib/components/metadata-instance-editor/subcomponents/custom-instance/custom-instance.js +1 -2
  99. package/dist/esm/lib/components/metadata-instance-editor/subcomponents/custom-instance/messages.js +1 -16
  100. package/dist/esm/lib/components/metadata-instance-editor/subcomponents/custom-instance-new-field/custom-instance-new-field.js +1 -2
  101. package/dist/esm/lib/components/metadata-instance-editor/subcomponents/custom-instance-new-field/messages.js +1 -44
  102. package/dist/esm/lib/components/metadata-instance-editor/subcomponents/delete-confirmation-modal/delete-confirmation-modal.js +1 -2
  103. package/dist/esm/lib/components/metadata-instance-editor/subcomponents/delete-confirmation-modal/messages.js +1 -52
  104. package/dist/esm/lib/components/metadata-instance-editor/subcomponents/metadata-instance-form/constants.js +1 -2
  105. package/dist/esm/lib/components/metadata-instance-editor/subcomponents/metadata-instance-form/metadata-instance-form-card-wrapper.js +1 -2
  106. package/dist/esm/lib/components/metadata-instance-editor/subcomponents/metadata-instance-form/metadata-instance-form.js +1 -136
  107. package/dist/esm/lib/components/metadata-instance-editor/subcomponents/metadata-instance-form/utils.js +1 -2
  108. package/dist/esm/lib/components/metadata-instance-editor/subcomponents/metadata-instance-form-ai-disclaimer/metadata-instance-form-ai-disclaimer.js +1 -2
  109. package/dist/esm/lib/components/metadata-instance-editor/subcomponents/metadata-instance-form-autofill-button/messages.js +1 -24
  110. package/dist/esm/lib/components/metadata-instance-editor/subcomponents/metadata-instance-form-autofill-button/metadata-instance-form-autofill-button.js +1 -2
  111. package/dist/esm/lib/components/metadata-instance-editor/subcomponents/metadata-instance-form-footer/messages.js +1 -20
  112. package/dist/esm/lib/components/metadata-instance-editor/subcomponents/metadata-instance-form-footer/metadata-instance-form-footer.js +1 -2
  113. package/dist/esm/lib/components/metadata-instance-editor/subcomponents/metadata-instance-form-header/messages.js +1 -6
  114. package/dist/esm/lib/components/metadata-instance-editor/subcomponents/metadata-instance-form-header/metadata-instance-form-header.js +1 -2
  115. package/dist/esm/lib/components/metadata-instance-editor/subcomponents/metadata-instance-form-inline-notice/messages.js +1 -20
  116. package/dist/esm/lib/components/metadata-instance-editor/subcomponents/metadata-instance-form-inline-notice/metadata-instance-form-inline-notice.js +1 -31
  117. package/dist/esm/lib/components/metadata-instance-list/index.js +1 -6
  118. package/dist/esm/lib/components/metadata-instance-list/metadata-instance-list.js +1 -2
  119. package/dist/esm/lib/components/metadata-instance-list/subcomponents/metadata-instance/metadata-instance.js +1 -2
  120. package/dist/esm/lib/components/metadata-instance-list/subcomponents/metadata-instance-content/metadata-instance-content.js +1 -2
  121. package/dist/esm/lib/components/metadata-instance-list/subcomponents/metadata-instance-entry/messages.js +1 -6
  122. package/dist/esm/lib/components/metadata-instance-list/subcomponents/metadata-instance-entry/metadata-entry-display.js +1 -15
  123. package/dist/esm/lib/components/metadata-instance-list/subcomponents/metadata-instance-entry/metadata-instance-entry.js +1 -2
  124. package/dist/esm/lib/components/metadata-instance-list/subcomponents/metadata-instance-entry/taxonomy-entry/messages.js +1 -24
  125. package/dist/esm/lib/components/metadata-instance-list/subcomponents/metadata-instance-entry/taxonomy-entry/taxonomy-ancestor-status-pill.js +1 -2
  126. package/dist/esm/lib/components/metadata-instance-list/subcomponents/metadata-instance-entry/taxonomy-entry/taxonomy-value.js +1 -25
  127. package/dist/esm/lib/components/metadata-instance-list/subcomponents/metadata-instance-footer/messages.js +1 -12
  128. package/dist/esm/lib/components/metadata-instance-list/subcomponents/metadata-instance-footer/metadata-instance-footer.js +1 -2
  129. package/dist/esm/lib/components/metadata-instance-list/subcomponents/metadata-instance-header/messages.js +1 -16
  130. package/dist/esm/lib/components/metadata-instance-list/subcomponents/metadata-instance-header/metadata-instance-header.js +1 -2
  131. package/dist/esm/lib/components/metadata-instance-review-notice/messages.js +1 -32
  132. package/dist/esm/lib/components/metadata-instance-review-notice/metadata-instance-review-notice.js +1 -24
  133. package/dist/esm/lib/components/unsaved-changes-modal/index.js +1 -2
  134. package/dist/esm/lib/components/unsaved-changes-modal/messages.js +1 -24
  135. package/dist/esm/lib/components/unsaved-changes-modal/unsaved-changes-modal.js +1 -45
  136. package/dist/esm/lib/components/unsaved-changes-modal/utils.js +1 -4
  137. package/dist/esm/lib/constants.js +1 -15
  138. package/dist/esm/lib/defaults.js +1 -16
  139. package/dist/esm/lib/mappers.js +1 -23
  140. package/dist/esm/lib/messages.js +1 -129
  141. package/dist/esm/lib/metadata-editor.js +1 -2
  142. package/dist/esm/lib/utils/analytics/analytics-context.js +1 -11
  143. package/dist/esm/lib/utils/analytics/events.js +1 -9
  144. package/dist/esm/lib/utils/analytics/index.js +1 -4
  145. package/dist/esm/lib/utils/analytics/with-analytics.js +1 -11
  146. package/dist/esm/lib/utils/api-wrapper.js +1 -13
  147. package/dist/esm/lib/utils/autofill-context.js +1 -66
  148. package/dist/esm/lib/utils/check-if-has-bounding-boxes.js +1 -2
  149. package/dist/esm/lib/utils/confidence-score/format-confidence-score-percent.js +1 -4
  150. package/dist/esm/lib/utils/confidence-score/get-confidence-score-tooltip.js +1 -13
  151. package/dist/esm/lib/utils/confidence-score/get-fields-needing-review.js +1 -6
  152. package/dist/esm/lib/utils/confidence-score/index.js +1 -5
  153. package/dist/esm/lib/utils/confidence-score/is-confidence-score-needing-review.js +1 -5
  154. package/dist/esm/lib/utils/confidence-score/messages.js +1 -16
  155. package/dist/esm/lib/utils/convertDate.js +1 -24
  156. package/dist/esm/lib/utils/is-interactive-form-element.js +1 -2
  157. package/dist/esm/lib/utils/utils.js +1 -4
  158. package/package.json +13 -13
@@ -1,52 +1 @@
1
- import { EXTRACT_AGENTS_MAP as e, EXTRACT_AI_AGENT_LOCAL_STORAGE_KEY as t } from "../esm/lib/constants.js";
2
- import { autofillMessages as n } from "../esm/lib/messages.js";
3
- import { getTooltipContent as r } from "../esm/lib/utils/utils.js";
4
- import { t as i } from "./interactive-header-text.js";
5
- import a from "../esm/lib/components/metadata-instance-list/subcomponents/metadata-instance-header/messages.js";
6
- import { useMemo as o } from "react";
7
- import { useIntl as s } from "react-intl";
8
- import { BoxAiAdvancedLogo24 as c, BoxAiLogo24 as l } from "@box/blueprint-web-assets/icons/Logo";
9
- import { jsx as u, jsxs as d } from "react/jsx-runtime";
10
- import { IconButton as f, Tooltip as p } from "@box/blueprint-web";
11
- import { Pencil as m } from "@box/blueprint-web-assets/icons/Line";
12
- import { useLocalStorageAIAgents as h } from "@box/box-ai-agent-selector";
13
- import '../styles/metadata-instance-header.css';var g = {
14
- metadataInstanceHeader: "_metadataInstanceHeader_17bsu_1",
15
- iconButtonsContainer: "_iconButtonsContainer_17bsu_6",
16
- title: "_title_17bsu_14"
17
- }, _ = ({ areAiSuggestionsAvailable: _, canEdit: v, isAiSuggestionsFeatureEnabled: y, isBetaLanguageEnabled: b, onEdit: x, onAutofill: S, templateName: C, isAdvancedExtractAgentEnabled: w = !1 }) => {
18
- let T = s(), E = C || T.formatMessage(a.customInstanceTitle), D = y && C, [O] = h(t), k = w && e[O]?.AGENT_ID, A = o(() => r(w, O, T), [
19
- w,
20
- O,
21
- T
22
- ]);
23
- return /* @__PURE__ */ d("div", {
24
- className: g.metadataInstanceHeader,
25
- children: [/* @__PURE__ */ u(i, {
26
- className: g.title,
27
- title: E
28
- }), v && /* @__PURE__ */ d("div", {
29
- className: g.iconButtonsContainer,
30
- children: [D && /* @__PURE__ */ u(p, {
31
- content: A,
32
- children: /* @__PURE__ */ u(f, {
33
- "aria-label": T.formatMessage(n.autofillButtonAriaLabelWithTemplateName, { templateName: C }),
34
- disabled: !_,
35
- icon: O === "enhanced" && w ? c : l,
36
- onClick: () => S(k || void 0),
37
- variant: "icon-logo",
38
- "data-target-id": "IconButton-autofillButtonAriaLabelWithTemplateName"
39
- })
40
- }), /* @__PURE__ */ u(p, {
41
- content: T.formatMessage(a.editButtonTooltip),
42
- children: /* @__PURE__ */ u(f, {
43
- "aria-label": T.formatMessage(a.editButtonAriaLabel, { templateName: C }),
44
- icon: m,
45
- onClick: x,
46
- "data-target-id": "IconButton-editButtonAriaLabel"
47
- })
48
- })]
49
- })]
50
- });
51
- };
52
- export { _ as t };
1
+ import{EXTRACT_AGENTS_MAP,EXTRACT_AI_AGENT_LOCAL_STORAGE_KEY}from"../esm/lib/constants.js";import{autofillMessages}from"../esm/lib/messages.js";import{getTooltipContent}from"../esm/lib/utils/utils.js";import{t as InteractiveHeaderText}from"./interactive-header-text.js";import messages from"../esm/lib/components/metadata-instance-list/subcomponents/metadata-instance-header/messages.js";import{useMemo}from"react";import{useIntl}from"react-intl";import{BoxAiAdvancedLogo24,BoxAiLogo24}from"@box/blueprint-web-assets/icons/Logo";import{jsx,jsxs}from"react/jsx-runtime";import{IconButton,Tooltip}from"@box/blueprint-web";import{Pencil}from"@box/blueprint-web-assets/icons/Line";import{useLocalStorageAIAgents}from"@box/box-ai-agent-selector";import '../styles/metadata-instance-header.css';var metadata_instance_header_module_default={metadataInstanceHeader:`_metadataInstanceHeader_17bsu_1`,iconButtonsContainer:`_iconButtonsContainer_17bsu_6`,title:`_title_17bsu_14`},MetadataInstanceHeader=({areAiSuggestionsAvailable,canEdit,isAiSuggestionsFeatureEnabled,isBetaLanguageEnabled,onEdit,onAutofill,templateName,isAdvancedExtractAgentEnabled=!1})=>{let intl=useIntl(),title=templateName||intl.formatMessage(messages.customInstanceTitle),showAiButton=isAiSuggestionsFeatureEnabled&&templateName,[storedAgent]=useLocalStorageAIAgents(EXTRACT_AI_AGENT_LOCAL_STORAGE_KEY),agentId=isAdvancedExtractAgentEnabled&&EXTRACT_AGENTS_MAP[storedAgent]?.AGENT_ID,tooltipContent=useMemo(()=>getTooltipContent(isAdvancedExtractAgentEnabled,storedAgent,intl),[isAdvancedExtractAgentEnabled,storedAgent,intl]);return jsxs(`div`,{className:metadata_instance_header_module_default.metadataInstanceHeader,children:[jsx(InteractiveHeaderText,{className:metadata_instance_header_module_default.title,title}),canEdit&&jsxs(`div`,{className:metadata_instance_header_module_default.iconButtonsContainer,children:[showAiButton&&jsx(Tooltip,{content:tooltipContent,children:jsx(IconButton,{"aria-label":intl.formatMessage(autofillMessages.autofillButtonAriaLabelWithTemplateName,{templateName}),disabled:!areAiSuggestionsAvailable,icon:storedAgent===`enhanced`&&isAdvancedExtractAgentEnabled?BoxAiAdvancedLogo24:BoxAiLogo24,onClick:()=>onAutofill(agentId||void 0),variant:`icon-logo`,"data-target-id":`IconButton-autofillButtonAriaLabelWithTemplateName`})}),jsx(Tooltip,{content:intl.formatMessage(messages.editButtonTooltip),children:jsx(IconButton,{"aria-label":intl.formatMessage(messages.editButtonAriaLabel,{templateName}),icon:Pencil,onClick:onEdit,"data-target-id":`IconButton-editButtonAriaLabel`})})]})]})};export{MetadataInstanceHeader as t};
@@ -1,20 +1 @@
1
- import { getVisibleTemplates as e } from "../esm/lib/utils/utils.js";
2
- import { t } from "./metadata-instance.js";
3
- import { jsx as n } from "react/jsx-runtime";
4
- import '../styles/metadata-instance-list.css';var r = { metadataInstanceList: "_metadataInstanceList_bd83w_1" }, i = ({ areAiSuggestionsAvailable: i, isAiSuggestionsFeatureEnabled: a, isBetaLanguageEnabled: o, onEdit: s, onSelectMetadataField: c, selectedMetadataFieldId: l, templateInstances: u, taxonomyNodeFetcher: d, isAdvancedExtractAgentEnabled: f = !1, isConfidenceScoreReviewEnabled: p = !1, isBoundingBoxEnabled: m = !1 }) => /* @__PURE__ */ n("div", {
5
- className: r.metadataInstanceList,
6
- children: e(u).map((e) => /* @__PURE__ */ n(t, {
7
- areAiSuggestionsAvailable: i,
8
- isAdvancedExtractAgentEnabled: f,
9
- isAiSuggestionsFeatureEnabled: a,
10
- isBetaLanguageEnabled: o,
11
- isConfidenceScoreReviewEnabled: p,
12
- isBoundingBoxEnabled: m,
13
- onEdit: s,
14
- onSelectMetadataField: c,
15
- selectedMetadataFieldId: l,
16
- taxonomyNodeFetcher: d,
17
- templateInstance: e
18
- }, e.id))
19
- });
20
- export { i as t };
1
+ import{getVisibleTemplates}from"../esm/lib/utils/utils.js";import{t as MetadataInstance}from"./metadata-instance.js";import{jsx}from"react/jsx-runtime";import '../styles/metadata-instance-list.css';var metadata_instance_list_module_default={metadataInstanceList:`_metadataInstanceList_bd83w_1`},MetadataInstanceList=({areAiSuggestionsAvailable,isAiSuggestionsFeatureEnabled,isBetaLanguageEnabled,onEdit,onSelectMetadataField,selectedMetadataFieldId,templateInstances,taxonomyNodeFetcher,isAdvancedExtractAgentEnabled=!1,isConfidenceScoreReviewEnabled=!1,isBoundingBoxEnabled=!1})=>jsx(`div`,{className:metadata_instance_list_module_default.metadataInstanceList,children:getVisibleTemplates(templateInstances).map(templateInstance=>jsx(MetadataInstance,{areAiSuggestionsAvailable,isAdvancedExtractAgentEnabled,isAiSuggestionsFeatureEnabled,isBetaLanguageEnabled,isConfidenceScoreReviewEnabled,isBoundingBoxEnabled,onEdit,onSelectMetadataField,selectedMetadataFieldId,taxonomyNodeFetcher,templateInstance},templateInstance.id))});export{MetadataInstanceList as t};
@@ -1,60 +1 @@
1
- import { MetadataEmptyState as e } from "../esm/lib/components/metadata-empty-state/metadata-empty-state.js";
2
- import { useAutofill as t } from "../esm/lib/utils/autofill-context.js";
3
- import { getFieldsNeedingReview as n } from "../esm/lib/utils/confidence-score/get-fields-needing-review.js";
4
- import { MetadataInstanceReviewNotice as r } from "../esm/lib/components/metadata-instance-review-notice/metadata-instance-review-notice.js";
5
- import { t as i } from "./metadata-instance-content.js";
6
- import { t as a } from "./metadata-instance-footer.js";
7
- import { t as o } from "./metadata-instance-header.js";
8
- import { useState as s } from "react";
9
- import { Fragment as c, jsx as l, jsxs as u } from "react/jsx-runtime";
10
- import { Card as d, Divider as f } from "@box/blueprint-web";
11
- import '../styles/metadata-instance.css';var p = {
12
- topDivider: "_topDivider_1xnom_1",
13
- reviewNotice: "_reviewNotice_1xnom_5",
14
- bottomDivider: "_bottomDivider_1xnom_9"
15
- }, m = ({ areAiSuggestionsAvailable: m, isAiSuggestionsFeatureEnabled: h, isBetaLanguageEnabled: g, onEdit: _, onSelectMetadataField: v, selectedMetadataFieldId: y, templateInstance: b, taxonomyNodeFetcher: x, isAdvancedExtractAgentEnabled: S = !1, isConfidenceScoreReviewEnabled: C = !1, isBoundingBoxEnabled: w = !1 }) => {
16
- let T = b.fields, E = (e) => !e.value || Array.isArray(e.value) && e.value.length === 0, D = T.every(E), O = T.some(E), k = T.length > 0, A = n(T).length, j = C && A > 0 && b.canEdit, [M, N] = s(!0), { getAiSuggestions: P } = t();
17
- return /* @__PURE__ */ u(d, { children: [
18
- /* @__PURE__ */ l(o, {
19
- areAiSuggestionsAvailable: m,
20
- canEdit: b.canEdit,
21
- isAdvancedExtractAgentEnabled: S,
22
- isAiSuggestionsFeatureEnabled: h,
23
- isBetaLanguageEnabled: g,
24
- onAutofill: (e) => {
25
- _(b), P(b.templateKey, b.scope, e);
26
- },
27
- onEdit: () => _(b),
28
- templateName: b?.displayName
29
- }),
30
- /* @__PURE__ */ l(f, { className: p.topDivider }),
31
- j && /* @__PURE__ */ l("div", {
32
- className: p.reviewNotice,
33
- children: /* @__PURE__ */ l(r, {
34
- fieldsNeedingReviewCount: A,
35
- onTextToggleClick: () => {
36
- _(b, !0);
37
- }
38
- })
39
- }),
40
- M && D ? /* @__PURE__ */ l(e, {
41
- isAnyEmptyValueHidden: k,
42
- isBoxAiSuggestionsFeatureEnabled: h,
43
- level: "instance",
44
- onShowEmptyValues: () => N(!1)
45
- }) : /* @__PURE__ */ u(c, { children: [/* @__PURE__ */ l(i, {
46
- isConfidenceScoreReviewEnabled: C,
47
- isBoundingBoxEnabled: w,
48
- onSelectMetadataField: v,
49
- selectedMetadataFieldId: y,
50
- shouldHideEmptyValues: M,
51
- taxonomyNodeFetcher: x,
52
- templateInstance: b
53
- }), O && /* @__PURE__ */ u(c, { children: [/* @__PURE__ */ l(f, { className: p.bottomDivider }), /* @__PURE__ */ l(a, {
54
- isAnyEmptyValueHidden: M,
55
- onHideEmptyValues: () => N(!0),
56
- onShowEmptyValues: () => N(!1)
57
- })] })] })
58
- ] });
59
- };
60
- export { m as t };
1
+ import{MetadataEmptyState}from"../esm/lib/components/metadata-empty-state/metadata-empty-state.js";import{useAutofill}from"../esm/lib/utils/autofill-context.js";import{getFieldsNeedingReview}from"../esm/lib/utils/confidence-score/get-fields-needing-review.js";import{MetadataInstanceReviewNotice}from"../esm/lib/components/metadata-instance-review-notice/metadata-instance-review-notice.js";import{t as MetadataInstanceContent}from"./metadata-instance-content.js";import{t as MetadataInstanceFooter}from"./metadata-instance-footer.js";import{t as MetadataInstanceHeader}from"./metadata-instance-header.js";import{useState}from"react";import{Fragment,jsx,jsxs}from"react/jsx-runtime";import{Card,Divider}from"@box/blueprint-web";import '../styles/metadata-instance.css';var metadata_instance_module_default={topDivider:`_topDivider_1xnom_1`,reviewNotice:`_reviewNotice_1xnom_5`,bottomDivider:`_bottomDivider_1xnom_9`},MetadataInstance=({areAiSuggestionsAvailable,isAiSuggestionsFeatureEnabled,isBetaLanguageEnabled,onEdit,onSelectMetadataField,selectedMetadataFieldId,templateInstance,taxonomyNodeFetcher,isAdvancedExtractAgentEnabled=!1,isConfidenceScoreReviewEnabled=!1,isBoundingBoxEnabled=!1})=>{let metadataFields=templateInstance.fields,hasNonEmptyValue=field=>!field.value||Array.isArray(field.value)&&field.value.length===0,areAllValuesEmpty=metadataFields.every(hasNonEmptyValue),areSomeValuesEmpty=metadataFields.some(hasNonEmptyValue),hasFields=metadataFields.length>0,fieldsNeedingReviewCount=getFieldsNeedingReview(metadataFields).length,shouldShowReviewNotice=isConfidenceScoreReviewEnabled&&fieldsNeedingReviewCount>0&&templateInstance.canEdit,[shouldHideEmptyValues,setShouldHideEmptyValues]=useState(!0),{getAiSuggestions}=useAutofill();return jsxs(Card,{children:[jsx(MetadataInstanceHeader,{areAiSuggestionsAvailable,canEdit:templateInstance.canEdit,isAdvancedExtractAgentEnabled,isAiSuggestionsFeatureEnabled,isBetaLanguageEnabled,onAutofill:agentId=>{onEdit(templateInstance),getAiSuggestions(templateInstance.templateKey,templateInstance.scope,agentId)},onEdit:()=>onEdit(templateInstance),templateName:templateInstance?.displayName}),jsx(Divider,{className:metadata_instance_module_default.topDivider}),shouldShowReviewNotice&&jsx(`div`,{className:metadata_instance_module_default.reviewNotice,children:jsx(MetadataInstanceReviewNotice,{fieldsNeedingReviewCount,onTextToggleClick:()=>{onEdit(templateInstance,!0)}})}),shouldHideEmptyValues&&areAllValuesEmpty?jsx(MetadataEmptyState,{isAnyEmptyValueHidden:hasFields,isBoxAiSuggestionsFeatureEnabled:isAiSuggestionsFeatureEnabled,level:`instance`,onShowEmptyValues:()=>setShouldHideEmptyValues(!1)}):jsxs(Fragment,{children:[jsx(MetadataInstanceContent,{isConfidenceScoreReviewEnabled,isBoundingBoxEnabled,onSelectMetadataField,selectedMetadataFieldId,shouldHideEmptyValues,taxonomyNodeFetcher,templateInstance}),areSomeValuesEmpty&&jsxs(Fragment,{children:[jsx(Divider,{className:metadata_instance_module_default.bottomDivider}),jsx(MetadataInstanceFooter,{isAnyEmptyValueHidden:shouldHideEmptyValues,onHideEmptyValues:()=>setShouldHideEmptyValues(!0),onShowEmptyValues:()=>setShouldHideEmptyValues(!1)})]})]})]})};export{MetadataInstance as t};
@@ -1,6 +1 @@
1
- import '../styles/shared-field-styles.css';var e = {
2
- spacious: "_spacious_1325e_1",
3
- clickableField: "_clickableField_1325e_5",
4
- selectedField: "_selectedField_1325e_14"
5
- };
6
- export { e as t };
1
+ import '../styles/shared-field-styles.css';var shared_field_styles_module_default={spacious:`_spacious_1325e_1`,clickableField:`_clickableField_1325e_5`,selectedField:`_selectedField_1325e_14`};export{shared_field_styles_module_default as t};
@@ -1,90 +1 @@
1
- import e from "../esm/lib/components/metadata-instance-list/subcomponents/metadata-instance-entry/taxonomy-entry/messages.js";
2
- import { useState as t } from "react";
3
- import { FormattedMessage as n, useIntl as r } from "react-intl";
4
- import { jsx as i, jsxs as a } from "react/jsx-runtime";
5
- import { FilterChip as o, InlineNotice as s, LoadingIndicator as c, Popover as l, TextButton as u } from "@box/blueprint-web";
6
- import { Loader as d } from "@box/blueprint-web-assets/icons/Fill";
7
- import f from "lodash/orderBy";
8
- import '../styles/taxonomy-ancestor-status-pill.css';var p = {
9
- popoverContentContainer: "_popoverContentContainer_sgjw6_27",
10
- popoverMainContent: "_popoverMainContent_sgjw6_32",
11
- loadingIndicatorWrapper: "_loadingIndicatorWrapper_sgjw6_36",
12
- errorMessageWrapper: "_errorMessageWrapper_sgjw6_43",
13
- errorMessageWrapperText: "_errorMessageWrapperText_sgjw6_48",
14
- taxonomyAncestorTable: "_taxonomyAncestorTable_sgjw6_56",
15
- taxonomyValueGroup: "_taxonomyValueGroup_sgjw6_123",
16
- taxonomyValueButton: "_taxonomyValueButton_sgjw6_128",
17
- taxonomyValueLabel: "_taxonomyValueLabel_sgjw6_138"
18
- }, m = { right: 24 }, h = (e) => {
19
- e.stopPropagation();
20
- }, g = (e) => {
21
- (e.key === "ArrowLeft" || e.key === "ArrowRight") && e.stopPropagation();
22
- };
23
- function _({ taxonomyNodeFetcher: _, scope: v, taxonomyKey: y, value: b, displayValue: x }) {
24
- let { formatMessage: S } = r(), [C, w] = t([]), [T, E] = t(!1), [D, O] = t(!1), [k, A] = t(!1), j = f(C, (e) => e.level), M = async () => {
25
- E(!0), O(!1), A(!0);
26
- try {
27
- w(await _(v, y, b));
28
- } catch {
29
- O(!0);
30
- } finally {
31
- E(!1);
32
- }
33
- };
34
- return /* @__PURE__ */ a(l.Root, {
35
- onOpenChange: A,
36
- open: k,
37
- children: [/* @__PURE__ */ i(l.Trigger, { children: /* @__PURE__ */ i(o.ChipButton, {
38
- "aria-checked": void 0,
39
- className: p.taxonomyValueButton,
40
- disabled: !_,
41
- onClick: M,
42
- onKeyDown: g,
43
- role: void 0,
44
- value: x,
45
- children: /* @__PURE__ */ i(o.Label, {
46
- className: p.taxonomyValueLabel,
47
- children: x
48
- })
49
- }) }), /* @__PURE__ */ i(l.ContentContainer, {
50
- align: "start",
51
- className: p.popoverContentContainer,
52
- collisionPadding: m,
53
- onEscapeKeyDown: h,
54
- children: /* @__PURE__ */ a(l.MainContent, {
55
- className: p.popoverMainContent,
56
- children: [
57
- D && /* @__PURE__ */ a("div", {
58
- className: p.errorMessageWrapper,
59
- children: [/* @__PURE__ */ i(s, {
60
- variant: "error",
61
- variantIconAriaLabel: S(e.loadingResultsErrorIconLabel),
62
- children: /* @__PURE__ */ i(n, { ...e.loadingResultsErrorMessage })
63
- }), /* @__PURE__ */ i(u, {
64
- className: p.errorMessageWrapperText,
65
- icon: d,
66
- onClick: M,
67
- "data-target-id": "TextButton-loadingResultsErrorAction",
68
- children: S(e.loadingResultsErrorAction)
69
- })]
70
- }),
71
- T && /* @__PURE__ */ i("div", {
72
- className: p.loadingIndicatorWrapper,
73
- children: /* @__PURE__ */ i(c, {
74
- "aria-label": S(e.loadingAriaLabel),
75
- size: "large"
76
- })
77
- }),
78
- !D && !T && /* @__PURE__ */ i("table", {
79
- className: p.taxonomyAncestorTable,
80
- children: /* @__PURE__ */ i("tbody", { children: j.map((t) => /* @__PURE__ */ a("tr", { children: [/* @__PURE__ */ i("th", {
81
- scope: "row",
82
- children: t.levelName
83
- }), /* @__PURE__ */ i("td", { children: t.levelValue || /* @__PURE__ */ i(n, { ...e.emptyAncestorLevelValue }) })] }, t.id || t.level)) })
84
- })
85
- ]
86
- })
87
- })]
88
- });
89
- }
90
- export { p as n, _ as t };
1
+ import messages from"../esm/lib/components/metadata-instance-list/subcomponents/metadata-instance-entry/taxonomy-entry/messages.js";import{useState}from"react";import{FormattedMessage,useIntl}from"react-intl";import{jsx,jsxs}from"react/jsx-runtime";import{FilterChip,InlineNotice,LoadingIndicator,Popover,TextButton}from"@box/blueprint-web";import{Loader}from"@box/blueprint-web-assets/icons/Fill";import orderBy from"lodash/orderBy";import '../styles/taxonomy-ancestor-status-pill.css';var taxonomy_value_module_default={popoverContentContainer:`_popoverContentContainer_sgjw6_27`,popoverMainContent:`_popoverMainContent_sgjw6_32`,loadingIndicatorWrapper:`_loadingIndicatorWrapper_sgjw6_36`,errorMessageWrapper:`_errorMessageWrapper_sgjw6_43`,errorMessageWrapperText:`_errorMessageWrapperText_sgjw6_48`,taxonomyAncestorTable:`_taxonomyAncestorTable_sgjw6_56`,taxonomyValueGroup:`_taxonomyValueGroup_sgjw6_123`,taxonomyValueButton:`_taxonomyValueButton_sgjw6_128`,taxonomyValueLabel:`_taxonomyValueLabel_sgjw6_138`},collisionPadding={right:24},handleEscapeKeyDown=e=>{e.stopPropagation()},handleKeyDown=e=>{(e.key===`ArrowLeft`||e.key===`ArrowRight`)&&e.stopPropagation()};function TaxonomyAncestorStatusPill({taxonomyNodeFetcher,scope,taxonomyKey,value,displayValue}){let{formatMessage}=useIntl(),[ancestorData,setAncestorData]=useState([]),[isLoading,setIsLoading]=useState(!1),[isError,setIsError]=useState(!1),[isPopoverOpen,setIsPopoverOpen]=useState(!1),orderedAncestorValuesByLevel=orderBy(ancestorData,ancestor=>ancestor.level),handleClick=async()=>{setIsLoading(!0),setIsError(!1),setIsPopoverOpen(!0);try{setAncestorData(await taxonomyNodeFetcher(scope,taxonomyKey,value))}catch{setIsError(!0)}finally{setIsLoading(!1)}};return jsxs(Popover.Root,{onOpenChange:setIsPopoverOpen,open:isPopoverOpen,children:[jsx(Popover.Trigger,{children:jsx(FilterChip.ChipButton,{"aria-checked":void 0,className:taxonomy_value_module_default.taxonomyValueButton,disabled:!taxonomyNodeFetcher,onClick:handleClick,onKeyDown:handleKeyDown,role:void 0,value:displayValue,children:jsx(FilterChip.Label,{className:taxonomy_value_module_default.taxonomyValueLabel,children:displayValue})})}),jsx(Popover.ContentContainer,{align:`start`,className:taxonomy_value_module_default.popoverContentContainer,collisionPadding,onEscapeKeyDown:handleEscapeKeyDown,children:jsxs(Popover.MainContent,{className:taxonomy_value_module_default.popoverMainContent,children:[isError&&jsxs(`div`,{className:taxonomy_value_module_default.errorMessageWrapper,children:[jsx(InlineNotice,{variant:`error`,variantIconAriaLabel:formatMessage(messages.loadingResultsErrorIconLabel),children:jsx(FormattedMessage,{...messages.loadingResultsErrorMessage})}),jsx(TextButton,{className:taxonomy_value_module_default.errorMessageWrapperText,icon:Loader,onClick:handleClick,"data-target-id":`TextButton-loadingResultsErrorAction`,children:formatMessage(messages.loadingResultsErrorAction)})]}),isLoading&&jsx(`div`,{className:taxonomy_value_module_default.loadingIndicatorWrapper,children:jsx(LoadingIndicator,{"aria-label":formatMessage(messages.loadingAriaLabel),size:`large`})}),!isError&&!isLoading&&jsx(`table`,{className:taxonomy_value_module_default.taxonomyAncestorTable,children:jsx(`tbody`,{children:orderedAncestorValuesByLevel.map(ancestorValue=>jsxs(`tr`,{children:[jsx(`th`,{scope:`row`,children:ancestorValue.levelName}),jsx(`td`,{children:ancestorValue.levelValue||jsx(FormattedMessage,{...messages.emptyAncestorLevelValue})})]},ancestorValue.id||ancestorValue.level))})})]})})]})}export{taxonomy_value_module_default as n,TaxonomyAncestorStatusPill as t};
@@ -1,8 +1 @@
1
- var e = /* @__PURE__ */ function(e) {
2
- return e.ClearAndReplace = "clearAndReplace", e.RemoveEntered = "removeEntered", e.ReplaceEntered = "replaceEntered", e.Append = "append", e;
3
- }({}), t = /* @__PURE__ */ function(e) {
4
- return e.Initial = "INITIAL", e.Pending = "PENDING", e.Applied = "APPLIED", e;
5
- }({}), n = /* @__PURE__ */ function(e) {
6
- return e.Low = "LOW", e.Medium = "MEDIUM", e.High = "HIGH", e;
7
- }({});
8
- export { n, e as r, t };
1
+ var UpdateMode=function(UpdateMode){return UpdateMode.ClearAndReplace=`clearAndReplace`,UpdateMode.RemoveEntered=`removeEntered`,UpdateMode.ReplaceEntered=`replaceEntered`,UpdateMode.Append=`append`,UpdateMode}({}),AiSuggestionState=function(AiSuggestionState){return AiSuggestionState.Initial=`INITIAL`,AiSuggestionState.Pending=`PENDING`,AiSuggestionState.Applied=`APPLIED`,AiSuggestionState}({}),ConfidenceLevel=function(ConfidenceLevel){return ConfidenceLevel.Low=`LOW`,ConfidenceLevel.Medium=`MEDIUM`,ConfidenceLevel.High=`HIGH`,ConfidenceLevel}({});export{ConfidenceLevel as n,UpdateMode as r,AiSuggestionState as t};
@@ -1,80 +1 @@
1
- import { MULTI_VALUE_DEFAULT_OPTION as e } from "../esm/lib/components/metadata-editor-fields/components/update-mode-field-wrapper/mulitple-values-utils.js";
2
- import { r as t } from "./types.js";
3
- import { messages as n } from "../esm/lib/components/metadata-editor-fields/components/update-mode-field-wrapper/messages.js";
4
- import r from "react";
5
- import { useIntl as i } from "react-intl";
6
- import { jsx as a, jsxs as o } from "react/jsx-runtime";
7
- import s from "clsx";
8
- import { IconButton as c, Radio as l } from "@box/blueprint-web";
9
- import { Settings as u, XMark as d } from "@box/blueprint-web-assets/icons/Fill";
10
- import { Field as f, getIn as p, useFormikContext as m } from "formik";
11
- import '../styles/update-mode-field-wrapper.css';var h = {
12
- wrapperContianer: "_wrapperContianer_19nqy_1",
13
- fieldContainer: "_fieldContainer_19nqy_6",
14
- field: "_field_19nqy_6",
15
- collapseButton: "_collapseButton_19nqy_14",
16
- radioContainer: "_radioContainer_19nqy_20",
17
- additionalFieldContainer: "_additionalFieldContainer_19nqy_23",
18
- hidden: "_hidden_19nqy_27"
19
- }, g = (e) => e === t.ReplaceEntered, _ = (e, t) => e === "string" || e === "multiSelect" || t, v = ({ children: v, fieldNamePrefix: y, fieldType: b, isTaxonomyMultiSelect: x }) => {
20
- let { setFieldValue: S, values: C } = m(), w = i(), T = `${y}.updateMode.mode`, E = p(C, T), D = v && r.Children.only(v), O = p(C, `${y}.options`, []).filter((t) => t.id !== e.id).map(({ key: e }) => e), k = p(C, `${y}.updateMode.isOpened`);
21
- return /* @__PURE__ */ o("div", {
22
- className: h.wrapperContianer,
23
- children: [/* @__PURE__ */ o("div", {
24
- className: h.fieldContainer,
25
- children: [/* @__PURE__ */ a("span", {
26
- className: h.field,
27
- children: v
28
- }), /* @__PURE__ */ a(c, {
29
- "aria-label": w.formatMessage(n.toggleUpdateModeSelectiorAriaLabel),
30
- className: h.collapseButton,
31
- "data-testid": `${D.props.label}-update-mode-toggle`,
32
- icon: k ? d : u,
33
- onClick: () => {
34
- S(`${y}.updateMode.isOpened`, !k);
35
- },
36
- size: "small",
37
- "data-target-id": "IconButton-toggleUpdateModeSelectiorAriaLabel"
38
- })]
39
- }), /* @__PURE__ */ o("div", {
40
- className: s(h.radioContainer, { [h.hidden]: !k }),
41
- children: [/* @__PURE__ */ a(f, {
42
- name: `${y}.updateMode.mode`,
43
- children: ({ field: e }) => /* @__PURE__ */ o(l.Group, {
44
- "data-testid": `${D.props.label}-radio-group`,
45
- loop: !0,
46
- onValueChange: (e) => S(T, e),
47
- orientation: "vertical",
48
- value: e.value,
49
- children: [
50
- _(b, x) && /* @__PURE__ */ a(l.Item, {
51
- label: w.formatMessage(n.append),
52
- value: t.Append
53
- }),
54
- /* @__PURE__ */ a(l.Item, {
55
- label: w.formatMessage(n.clearAndReplace),
56
- value: t.ClearAndReplace
57
- }),
58
- /* @__PURE__ */ a(l.Item, {
59
- label: w.formatMessage(n.removeEntered),
60
- value: t.RemoveEntered
61
- }),
62
- /* @__PURE__ */ a(l.Item, {
63
- label: w.formatMessage(n.replaceEntered),
64
- value: t.ReplaceEntered
65
- })
66
- ]
67
- })
68
- }), g(E) && D && /* @__PURE__ */ a("div", {
69
- className: h.additionalFieldContainer,
70
- children: /*#__PURE__*/ r.cloneElement(D, {
71
- updateModePrefix: `${y}.updateMode`,
72
- options: O,
73
- label: w.formatMessage(n.with)
74
- })
75
- })]
76
- })]
77
- });
78
- };
79
- v.displayName = "UpdateModeFieldWrapper";
80
- export { v as t };
1
+ import{MULTI_VALUE_DEFAULT_OPTION}from"../esm/lib/components/metadata-editor-fields/components/update-mode-field-wrapper/mulitple-values-utils.js";import{r as UpdateMode}from"./types.js";import{messages}from"../esm/lib/components/metadata-editor-fields/components/update-mode-field-wrapper/messages.js";import React from"react";import{useIntl}from"react-intl";import{jsx,jsxs}from"react/jsx-runtime";import clsx from"clsx";import{IconButton,Radio}from"@box/blueprint-web";import{Settings,XMark}from"@box/blueprint-web-assets/icons/Fill";import{Field,getIn,useFormikContext}from"formik";import '../styles/update-mode-field-wrapper.css';var update_mode_field_wrapper_module_default={wrapperContianer:`_wrapperContianer_19nqy_1`,fieldContainer:`_fieldContainer_19nqy_6`,field:`_field_19nqy_6`,collapseButton:`_collapseButton_19nqy_14`,radioContainer:`_radioContainer_19nqy_20`,additionalFieldContainer:`_additionalFieldContainer_19nqy_23`,hidden:`_hidden_19nqy_27`},shouldShowAdditionalInput=updateMode=>updateMode===UpdateMode.ReplaceEntered,shouldShowAppendOption=(fieldType,isTaxonomyMultiSelect)=>fieldType===`string`||fieldType===`multiSelect`||isTaxonomyMultiSelect,UpdateModeFieldWrapper=({children,fieldNamePrefix,fieldType,isTaxonomyMultiSelect})=>{let{setFieldValue,values}=useFormikContext(),intl=useIntl(),updateModeFieldName=`${fieldNamePrefix}.updateMode.mode`,updateModeValue=getIn(values,updateModeFieldName),fieldEl=children&&React.Children.only(children),fieldOptions=getIn(values,`${fieldNamePrefix}.options`,[]).filter(option=>option.id!==MULTI_VALUE_DEFAULT_OPTION.id).map(({key})=>key),isOpened=getIn(values,`${fieldNamePrefix}.updateMode.isOpened`);return jsxs(`div`,{className:update_mode_field_wrapper_module_default.wrapperContianer,children:[jsxs(`div`,{className:update_mode_field_wrapper_module_default.fieldContainer,children:[jsx(`span`,{className:update_mode_field_wrapper_module_default.field,children}),jsx(IconButton,{"aria-label":intl.formatMessage(messages.toggleUpdateModeSelectiorAriaLabel),className:update_mode_field_wrapper_module_default.collapseButton,"data-testid":`${fieldEl.props.label}-update-mode-toggle`,icon:isOpened?XMark:Settings,onClick:()=>{setFieldValue(`${fieldNamePrefix}.updateMode.isOpened`,!isOpened)},size:`small`,"data-target-id":`IconButton-toggleUpdateModeSelectiorAriaLabel`})]}),jsxs(`div`,{className:clsx(update_mode_field_wrapper_module_default.radioContainer,{[update_mode_field_wrapper_module_default.hidden]:!isOpened}),children:[jsx(Field,{name:`${fieldNamePrefix}.updateMode.mode`,children:({field})=>jsxs(Radio.Group,{"data-testid":`${fieldEl.props.label}-radio-group`,loop:!0,onValueChange:value=>setFieldValue(updateModeFieldName,value),orientation:`vertical`,value:field.value,children:[shouldShowAppendOption(fieldType,isTaxonomyMultiSelect)&&jsx(Radio.Item,{label:intl.formatMessage(messages.append),value:UpdateMode.Append}),jsx(Radio.Item,{label:intl.formatMessage(messages.clearAndReplace),value:UpdateMode.ClearAndReplace}),jsx(Radio.Item,{label:intl.formatMessage(messages.removeEntered),value:UpdateMode.RemoveEntered}),jsx(Radio.Item,{label:intl.formatMessage(messages.replaceEntered),value:UpdateMode.ReplaceEntered})]})}),shouldShowAdditionalInput(updateModeValue)&&fieldEl&&jsx(`div`,{className:update_mode_field_wrapper_module_default.additionalFieldContainer,children:React.cloneElement(fieldEl,{updateModePrefix:`${fieldNamePrefix}.updateMode`,options:fieldOptions,label:intl.formatMessage(messages.with)})})]})]})};UpdateModeFieldWrapper.displayName=`UpdateModeFieldWrapper`;export{UpdateModeFieldWrapper as t};
@@ -1,88 +1 @@
1
- import { isConfidenceScoreNeedingReview as e } from "../esm/lib/utils/confidence-score/is-confidence-score-needing-review.js";
2
- import { convertISOStringtoRFC3339String as t } from "../esm/lib/utils/convertDate.js";
3
- import { t as n } from "./interactive-text.module.js";
4
- import { AiLogoBadge as r } from "../esm/lib/components/metadata-editor-fields/components/ai-logo-badge/ai-logo-badge.js";
5
- import { LowConfidenceBadge as i } from "../esm/lib/components/metadata-editor-fields/components/low-confidence-badge/low-confidence-badge.js";
6
- import { createElement as a, memo as o, useRef as s } from "react";
7
- import { Focusable as c } from "@ariakit/react";
8
- import { jsx as l, jsxs as u } from "react/jsx-runtime";
9
- import d from "clsx";
10
- import { Tooltip as f, useForkRef as p, useIsEllipsized as m } from "@box/blueprint-web";
11
- import '../styles/utils.css';var h = {
12
- noAttributesText: "_noAttributesText_570s9_2",
13
- fieldWrapper: "_fieldWrapper_570s9_6",
14
- hasSuggestion: "_hasSuggestion_570s9_11",
15
- hasConfidenceReview: "_hasConfidenceReview_570s9_16",
16
- dateField: "_dateField_570s9_44",
17
- aiApproved: "_aiApproved_570s9_49",
18
- labelWrapper: "_labelWrapper_570s9_93",
19
- labelText: "_labelText_570s9_100",
20
- labelTruncated: "_labelTruncated_570s9_103"
21
- };
22
- function g({ as: e, fieldDescription: t, fieldName: r, labelClassName: i, labelRef: o, ...h }) {
23
- let g = s(null), _ = p(g, o);
24
- return /* @__PURE__ */ l(f, {
25
- content: m(g) ? /* @__PURE__ */ u("div", { children: [/* @__PURE__ */ l("div", { children: r }), /* @__PURE__ */ l("div", { children: t })] }) : t,
26
- children: /* @__PURE__ */ l(c, { render: /*#__PURE__*/ a(e, {
27
- className: d(i, n.interactiveTextHint),
28
- ...h,
29
- ref: _
30
- }, r) })
31
- });
32
- }
33
- function _({ as: e, fieldName: t, labelClassName: n, labelRef: r, ...i }) {
34
- let o = s(null), u = p(o, r), d = m(o) ? t : void 0, h = /*#__PURE__*/ a(e, {
35
- className: n,
36
- ...i,
37
- ref: u
38
- }, t);
39
- return d ? /* @__PURE__ */ l(f, {
40
- content: d,
41
- children: /* @__PURE__ */ l(c, { render: h })
42
- }) : h;
43
- }
44
- var v = /*#__PURE__*/ o(function({ fieldName: t, fieldDescription: n, isAiSuggestionApplied: a, as: o, confidenceScore: s, labelProps: c }) {
45
- let { className: f, ref: p, ...m } = c, v = d(f || h.labelText, h.labelTruncated), y = !!s && e(s), b = () => s && y ? /* @__PURE__ */ l(i, {}) : a || s ? /* @__PURE__ */ l(r, { confidenceScore: s }) : null, x = n ? /* @__PURE__ */ l(g, {
46
- as: o,
47
- fieldDescription: n,
48
- fieldName: t,
49
- labelClassName: v,
50
- labelRef: p,
51
- ...m
52
- }) : /* @__PURE__ */ l(_, {
53
- as: o,
54
- fieldName: t,
55
- labelClassName: v,
56
- labelRef: p,
57
- ...m
58
- });
59
- return /* @__PURE__ */ u("div", {
60
- className: h.labelWrapper,
61
- children: [x, b()]
62
- });
63
- }, (e, t) => {
64
- let n = e.labelProps, r = t.labelProps;
65
- return e.fieldName === t.fieldName && e.fieldDescription === t.fieldDescription && e.isAiSuggestionApplied === t.isAiSuggestionApplied && e.confidenceScore === t.confidenceScore && e.as === t.as && n.className === r.className && n.htmlFor === r.htmlFor && n.id === r.id;
66
- }), y = (e, t, n = !1, r = "label", i) => (a) => /* @__PURE__ */ l(v, {
67
- as: r,
68
- confidenceScore: i,
69
- fieldDescription: t,
70
- fieldName: e,
71
- isAiSuggestionApplied: n,
72
- labelProps: a
73
- }), b = (e, t, n = !1, r) => /* @__PURE__ */ l(v, {
74
- as: "span",
75
- confidenceScore: r,
76
- fieldDescription: t,
77
- fieldName: e,
78
- isAiSuggestionApplied: n,
79
- labelProps: {}
80
- }), x = (e) => {
81
- try {
82
- let n = t(e), r = new Date(n);
83
- return isNaN(r.getTime()) ? null : n;
84
- } catch {
85
- return null;
86
- }
87
- };
88
- export { h as i, b as n, x as r, y as t };
1
+ import{isConfidenceScoreNeedingReview}from"../esm/lib/utils/confidence-score/is-confidence-score-needing-review.js";import{convertISOStringtoRFC3339String}from"../esm/lib/utils/convertDate.js";import{t as interactive_text_module_default}from"./interactive-text.module.js";import{AiLogoBadge}from"../esm/lib/components/metadata-editor-fields/components/ai-logo-badge/ai-logo-badge.js";import{LowConfidenceBadge}from"../esm/lib/components/metadata-editor-fields/components/low-confidence-badge/low-confidence-badge.js";import{createElement,memo,useRef}from"react";import{Focusable}from"@ariakit/react";import{jsx,jsxs}from"react/jsx-runtime";import clsx from"clsx";import{Tooltip,useForkRef,useIsEllipsized}from"@box/blueprint-web";import '../styles/utils.css';var metadata_editor_fields_module_default={noAttributesText:`_noAttributesText_570s9_2`,fieldWrapper:`_fieldWrapper_570s9_6`,hasSuggestion:`_hasSuggestion_570s9_11`,hasConfidenceReview:`_hasConfidenceReview_570s9_16`,dateField:`_dateField_570s9_44`,aiApproved:`_aiApproved_570s9_49`,labelWrapper:`_labelWrapper_570s9_93`,labelText:`_labelText_570s9_100`,labelTruncated:`_labelTruncated_570s9_103`};function LabelTextWithDescriptionTooltip({as,fieldDescription,fieldName,labelClassName,labelRef:refFromLabelable,...rest}){let textRef=useRef(null),mergedLabelRef=useForkRef(textRef,refFromLabelable);return jsx(Tooltip,{content:useIsEllipsized(textRef)?jsxs(`div`,{children:[jsx(`div`,{children:fieldName}),jsx(`div`,{children:fieldDescription})]}):fieldDescription,children:jsx(Focusable,{render:createElement(as,{className:clsx(labelClassName,interactive_text_module_default.interactiveTextHint),...rest,ref:mergedLabelRef},fieldName)})})}function LabelTextEllipsisAwareTooltip({as,fieldName,labelClassName,labelRef:refFromLabelable,...rest}){let textRef=useRef(null),mergedLabelRef=useForkRef(textRef,refFromLabelable),tooltipContent=useIsEllipsized(textRef)?fieldName:void 0,labelNode=createElement(as,{className:labelClassName,...rest,ref:mergedLabelRef},fieldName);return tooltipContent?jsx(Tooltip,{content:tooltipContent,children:jsx(Focusable,{render:labelNode})}):labelNode}var LabelContent=memo(function({fieldName,fieldDescription,isAiSuggestionApplied,as,confidenceScore,labelProps}){let{className,ref:refFromLabelable,...rest}=labelProps,labelClassName=clsx(className||metadata_editor_fields_module_default.labelText,metadata_editor_fields_module_default.labelTruncated),isLowConfidenceScore=!!confidenceScore&&isConfidenceScoreNeedingReview(confidenceScore),renderBadge=()=>confidenceScore&&isLowConfidenceScore?jsx(LowConfidenceBadge,{}):isAiSuggestionApplied||confidenceScore?jsx(AiLogoBadge,{confidenceScore}):null,textBlock=fieldDescription?jsx(LabelTextWithDescriptionTooltip,{as,fieldDescription,fieldName,labelClassName,labelRef:refFromLabelable,...rest}):jsx(LabelTextEllipsisAwareTooltip,{as,fieldName,labelClassName,labelRef:refFromLabelable,...rest});return jsxs(`div`,{className:metadata_editor_fields_module_default.labelWrapper,children:[textBlock,renderBadge()]})},(prev,next)=>{let pLP=prev.labelProps,nLP=next.labelProps;return prev.fieldName===next.fieldName&&prev.fieldDescription===next.fieldDescription&&prev.isAiSuggestionApplied===next.isAiSuggestionApplied&&prev.confidenceScore===next.confidenceScore&&prev.as===next.as&&pLP.className===nLP.className&&pLP.htmlFor===nLP.htmlFor&&pLP.id===nLP.id}),getFieldLabel=(fieldName,fieldDescription,isAiSuggestionApplied=!1,as=`label`,confidenceScore)=>labelProps=>jsx(LabelContent,{as,confidenceScore,fieldDescription,fieldName,isAiSuggestionApplied,labelProps}),getFieldLabelContent=(fieldName,fieldDescription,isAiSuggestionApplied=!1,confidenceScore)=>jsx(LabelContent,{as:`span`,confidenceScore,fieldDescription,fieldName,isAiSuggestionApplied,labelProps:{}}),tryParseDateSuggestion=suggestedDate=>{try{let normalizedDate=convertISOStringtoRFC3339String(suggestedDate),dateObj=new Date(normalizedDate);return isNaN(dateObj.getTime())?null:normalizedDate}catch{return null}};export{metadata_editor_fields_module_default as i,getFieldLabelContent as n,tryParseDateSuggestion as r,getFieldLabel as t};
@@ -1,53 +1 @@
1
- import { TEMPLATE_CUSTOM_PROPERTIES as e } from "../esm/lib/constants.js";
2
- import t from "lodash/isEqual";
3
- import n from "lodash/isArray";
4
- import r from "lodash/isEmpty";
5
- var i = {
6
- ADD: "add",
7
- REMOVE: "remove",
8
- REPLACE: "replace",
9
- TEST: "test"
10
- }, a = "AI_ACCEPTED", o = "AI_EXTRACTED", s = (e, n, r) => {
11
- let i = !n.isExtracted && r.isExtracted, a = r.targetLocation && !t(n.targetLocation, r.targetLocation);
12
- return i || a ? [g(`${e}/process`, o)] : [];
13
- }, c = (e, t) => e.value === t.value && e.level === t.level && e.isAccepted === t.isAccepted, l = (e) => e.value === void 0 || e.value === null || e.value === "" || n(e.value) && r(e.value), u = (e, t, n) => {
14
- let r = t.confidenceScore, i = n.confidenceScore;
15
- return !i || r && c(r, i) ? [] : d(e, i);
16
- }, d = (e, t) => {
17
- let n = [];
18
- return t.isAccepted && n.push(g(`${e}/process`, a)), n.push(g(`${e}/confidenceScore`, t.value), g(`${e}/confidenceLevel`, t.level)), n;
19
- }, f = (e, n, r) => {
20
- let i = n.targetLocation, a = r.targetLocation, o = n.confidenceScore?.isAccepted ?? !1, s = r.confidenceScore?.isAccepted ?? !1, c = !o && s;
21
- return a && (!t(i, a) || c) ? [g(`${e}/targetLocation`, JSON.stringify(a))] : [];
22
- }, p = (n, r) => {
23
- let i = [], a = n.metadata.fields, o = r.templateKey === e, c = new Map(r.fields.map((e) => [e.key, e])), d = new Map(a.map((e) => [e.key, e]));
24
- return a.forEach((e) => {
25
- let n = c.get(e.key);
26
- if (!n) {
27
- i.push(g(e.key, m(e)));
28
- return;
29
- }
30
- if (t(e, n)) return;
31
- let r = !t(e.value, n.value);
32
- !o && l(n) && !l(e) ? i.push(g(e.key, m(e))) : (!o && r && n.value !== null && !l(e) || o && r) && (i.push(h(n.key, m(n))), i.push(v(e.key, m(e)))), i.push(...s(e.key, n, e)), i.push(...u(e.key, n, e)), i.push(...f(e.key, n, e));
33
- }), r.fields.forEach((e) => {
34
- let t = d.get(e.key);
35
- (!t || !o && l(t) && !l(e)) && (i.push(h(e.key, m(e))), i.push(_(e.key)));
36
- }), i;
37
- }, m = (e) => e.type === "float" ? Number(e.value) : e.type === "taxonomy" ? e.value.map((e) => e.value) : e.type === "date" && typeof e.value == "string" ? new Date(e.value).toISOString() : e.value, h = (e, t) => ({
38
- op: i.TEST,
39
- path: `/${e}`,
40
- value: t
41
- }), g = (e, t) => ({
42
- op: i.ADD,
43
- path: `/${e}`,
44
- value: t
45
- }), _ = (e) => ({
46
- op: i.REMOVE,
47
- path: `/${e}`
48
- }), v = (e, t) => ({
49
- op: i.REPLACE,
50
- path: `/${e}`,
51
- value: t
52
- });
53
- export { m as n, i as r, p as t };
1
+ import{TEMPLATE_CUSTOM_PROPERTIES}from"../esm/lib/constants.js";import isEqual from"lodash/isEqual";import isArray from"lodash/isArray";import isEmpty from"lodash/isEmpty";var JSONPatchOp={ADD:`add`,REMOVE:`remove`,REPLACE:`replace`,TEST:`test`},AI_ACCEPTED_PROCESS=`AI_ACCEPTED`,AI_EXTRACTED_PROCESS=`AI_EXTRACTED`,getAiExtractedOperations=(key,originalField,newField)=>{let isValueNewlyExtracted=!originalField.isExtracted&&newField.isExtracted,isTargetLocationChanged=newField.targetLocation&&!isEqual(originalField.targetLocation,newField.targetLocation);return isValueNewlyExtracted||isTargetLocationChanged?[getAddOperation(`${key}/process`,AI_EXTRACTED_PROCESS)]:[]},isScoreUnchanged=(a,b)=>a.value===b.value&&a.level===b.level&&a.isAccepted===b.isAccepted,isFieldEmpty=field=>field.value===void 0||field.value===null||field.value===``||isArray(field.value)&&isEmpty(field.value),getConfidenceScoreOperations=(key,originalField,newField)=>{let originalScore=originalField.confidenceScore,newScore=newField.confidenceScore;return!newScore||originalScore&&isScoreUnchanged(originalScore,newScore)?[]:getScoreUpsertOps(key,newScore)},getScoreUpsertOps=(key,newScore)=>{let ops=[];return newScore.isAccepted&&ops.push(getAddOperation(`${key}/process`,AI_ACCEPTED_PROCESS)),ops.push(getAddOperation(`${key}/confidenceScore`,newScore.value),getAddOperation(`${key}/confidenceLevel`,newScore.level)),ops},getTargetLocationOperations=(key,originalField,newField)=>{let originalTargetLocation=originalField.targetLocation,newTargetLocation=newField.targetLocation,originalAcceptanceStatus=originalField.confidenceScore?.isAccepted??!1,newAcceptanceStatus=newField.confidenceScore?.isAccepted??!1,isValueNewlyAccepted=!originalAcceptanceStatus&&newAcceptanceStatus;return newTargetLocation&&(!isEqual(originalTargetLocation,newTargetLocation)||isValueNewlyAccepted)?[getAddOperation(`${key}/targetLocation`,JSON.stringify(newTargetLocation))]:[]},createJSONPatch=(formValues,originalData)=>{let operations=[],newFields=formValues.metadata.fields,isCustomMetadataInstance=originalData.templateKey===TEMPLATE_CUSTOM_PROPERTIES,originalDataMap=new Map(originalData.fields.map(item=>[item.key,item])),newDataMap=new Map(newFields.map(item=>[item.key,item]));return newFields.forEach(newField=>{let originalField=originalDataMap.get(newField.key);if(!originalField){operations.push(getAddOperation(newField.key,getFormatedFieldValue(newField)));return}if(isEqual(newField,originalField))return;let isValueChanged=!isEqual(newField.value,originalField.value);!isCustomMetadataInstance&&isFieldEmpty(originalField)&&!isFieldEmpty(newField)?operations.push(getAddOperation(newField.key,getFormatedFieldValue(newField))):(!isCustomMetadataInstance&&isValueChanged&&originalField.value!==null&&!isFieldEmpty(newField)||isCustomMetadataInstance&&isValueChanged)&&(operations.push(getTestOperation(originalField.key,getFormatedFieldValue(originalField))),operations.push(getReplaceOperation(newField.key,getFormatedFieldValue(newField)))),operations.push(...getAiExtractedOperations(newField.key,originalField,newField)),operations.push(...getConfidenceScoreOperations(newField.key,originalField,newField)),operations.push(...getTargetLocationOperations(newField.key,originalField,newField))}),originalData.fields.forEach(originalField=>{let newField=newDataMap.get(originalField.key);(!newField||!isCustomMetadataInstance&&isFieldEmpty(newField)&&!isFieldEmpty(originalField))&&(operations.push(getTestOperation(originalField.key,getFormatedFieldValue(originalField))),operations.push(getRemoveOperation(originalField.key)))}),operations},getFormatedFieldValue=field=>field.type===`float`?Number(field.value):field.type===`taxonomy`?field.value.map(option=>option.value):field.type===`date`&&typeof field.value==`string`?new Date(field.value).toISOString():field.value,getTestOperation=(key,value)=>({op:JSONPatchOp.TEST,path:`/${key}`,value}),getAddOperation=(key,value)=>({op:JSONPatchOp.ADD,path:`/${key}`,value}),getRemoveOperation=key=>({op:JSONPatchOp.REMOVE,path:`/${key}`}),getReplaceOperation=(key,value)=>({op:JSONPatchOp.REPLACE,path:`/${key}`,value});export{getFormatedFieldValue as n,JSONPatchOp as r,createJSONPatch as t};
package/dist/esm/index.js CHANGED
@@ -1,25 +1 @@
1
- import { FilterDropdownMenu as e } from "./lib/components/filter-dropdown-menu/index.js";
2
- import { AddMetadataTemplateDropdown as t } from "./lib/components/add-metadata-template-dropdown/add-metadata-template-dropdown.js";
3
- import { t as n } from "../chunks/add-metadata-template-dropdown-with-browser.js";
4
- import "./lib/components/add-metadata-template-dropdown/index.js";
5
- import { t as r } from "../chunks/combobox-with-api-pagination.js";
6
- import "./lib/components/combobox-with-api-pagination/index.js";
7
- import { t as i } from "../chunks/filter-instances-dropdown.js";
8
- import "./lib/components/filter-instances-dropdown/index.js";
9
- import { MULTI_VALUE_DEFAULT_OPTION as a, MULTI_VALUE_DEFAULT_TAXONOMY_OPTION as o, MULTI_VALUE_DEFAULT_VALUE as s } from "./lib/components/metadata-editor-fields/components/update-mode-field-wrapper/mulitple-values-utils.js";
10
- import { MetadataEmptyState as c } from "./lib/components/metadata-empty-state/metadata-empty-state.js";
11
- import { AutofillContext as l, AutofillContextProvider as u, TIMEOUT_10_SECONDS as d, useAutofill as f } from "./lib/utils/autofill-context.js";
12
- import { n as p, r as m, t as h } from "../chunks/types.js";
13
- import { UnsavedChangesModal as g } from "./lib/components/unsaved-changes-modal/unsaved-changes-modal.js";
14
- import { t as _ } from "../chunks/custom-instance-new-field.js";
15
- import { t as v } from "../chunks/delete-confirmation-modal.js";
16
- import { r as y } from "../chunks/utils2.js";
17
- import { t as b } from "../chunks/metadata-instance-form-autofill-button.js";
18
- import { t as x } from "../chunks/metadata-instance-form-header.js";
19
- import { MetadataInstanceForm as S } from "./lib/components/metadata-instance-editor/index.js";
20
- import { t as C } from "../chunks/metadata-instance-header.js";
21
- import { MetadataInstance as w, MetadataInstanceList as T } from "./lib/components/metadata-instance-list/index.js";
22
- import { defaultInitialValues as E, defaultMetadataValueMap as D } from "./lib/defaults.js";
23
- import { t as O } from "../chunks/metadata-editor.js";
24
- import { withApiWrapper as k } from "./lib/utils/api-wrapper.js";
25
- export { t as AddMetadataTemplateDropdown, n as AddMetadataTemplateDropdownWithBrowser, h as AiSuggestionState, l as AutofillContext, u as AutofillContextProvider, r as ComboboxWithApiPagination, p as ConfidenceLevel, _ as CustomInstanceNewField, v as DeleteConfirmationModal, e as FilterDropdownMenu, i as FilterInstancesDropdown, y as JSONPatchOp, a as MULTI_VALUE_DEFAULT_OPTION, o as MULTI_VALUE_DEFAULT_TAXONOMY_OPTION, s as MULTI_VALUE_DEFAULT_VALUE, O as MetadataEditor, c as MetadataEmptyState, w as MetadataInstance, S as MetadataInstanceForm, b as MetadataInstanceFormAutofillButton, x as MetadataInstanceFormHeader, C as MetadataInstanceHeader, T as MetadataInstanceList, d as TIMEOUT_10_SECONDS, g as UnsavedChangesModal, m as UpdateMode, E as defaultInitialValues, D as defaultMetadataValueMap, f as useAutofill, k as withApiWrapper };
1
+ import{FilterDropdownMenu}from"./lib/components/filter-dropdown-menu/index.js";import{AddMetadataTemplateDropdown}from"./lib/components/add-metadata-template-dropdown/add-metadata-template-dropdown.js";import{t as AddMetadataTemplateDropdownWithBrowser}from"../chunks/add-metadata-template-dropdown-with-browser.js";import"./lib/components/add-metadata-template-dropdown/index.js";import{t as ComboboxWithApiPagination}from"../chunks/combobox-with-api-pagination.js";import"./lib/components/combobox-with-api-pagination/index.js";import{t as FilterInstancesDropdown}from"../chunks/filter-instances-dropdown.js";import"./lib/components/filter-instances-dropdown/index.js";import{MULTI_VALUE_DEFAULT_OPTION,MULTI_VALUE_DEFAULT_TAXONOMY_OPTION,MULTI_VALUE_DEFAULT_VALUE}from"./lib/components/metadata-editor-fields/components/update-mode-field-wrapper/mulitple-values-utils.js";import{MetadataEmptyState}from"./lib/components/metadata-empty-state/metadata-empty-state.js";import{AutofillContext,AutofillContextProvider,TIMEOUT_10_SECONDS,useAutofill}from"./lib/utils/autofill-context.js";import{n as ConfidenceLevel,r as UpdateMode,t as AiSuggestionState}from"../chunks/types.js";import{UnsavedChangesModal}from"./lib/components/unsaved-changes-modal/unsaved-changes-modal.js";import{t as CustomInstanceNewField}from"../chunks/custom-instance-new-field.js";import{t as DeleteConfirmationModal}from"../chunks/delete-confirmation-modal.js";import{r as JSONPatchOp}from"../chunks/utils2.js";import{t as MetadataInstanceFormAutofillButton}from"../chunks/metadata-instance-form-autofill-button.js";import{t as MetadataInstanceFormHeader}from"../chunks/metadata-instance-form-header.js";import{MetadataInstanceForm}from"./lib/components/metadata-instance-editor/index.js";import{t as MetadataInstanceHeader}from"../chunks/metadata-instance-header.js";import{MetadataInstance,MetadataInstanceList}from"./lib/components/metadata-instance-list/index.js";import{defaultInitialValues,defaultMetadataValueMap}from"./lib/defaults.js";import{t as MetadataEditor}from"../chunks/metadata-editor.js";import{withApiWrapper}from"./lib/utils/api-wrapper.js";export{AddMetadataTemplateDropdown,AddMetadataTemplateDropdownWithBrowser,AiSuggestionState,AutofillContext,AutofillContextProvider,ComboboxWithApiPagination,ConfidenceLevel,CustomInstanceNewField,DeleteConfirmationModal,FilterDropdownMenu,FilterInstancesDropdown,JSONPatchOp,MULTI_VALUE_DEFAULT_OPTION,MULTI_VALUE_DEFAULT_TAXONOMY_OPTION,MULTI_VALUE_DEFAULT_VALUE,MetadataEditor,MetadataEmptyState,MetadataInstance,MetadataInstanceForm,MetadataInstanceFormAutofillButton,MetadataInstanceFormHeader,MetadataInstanceHeader,MetadataInstanceList,TIMEOUT_10_SECONDS,UnsavedChangesModal,UpdateMode,defaultInitialValues,defaultMetadataValueMap,useAutofill,withApiWrapper};
@@ -1,2 +1 @@
1
- import { t as e } from "../../../../chunks/add-metadata-template-dropdown-with-browser.js";
2
- export { e as AddMetadataTemplateDropdownWithBrowser };
1
+ import{t as AddMetadataTemplateDropdownWithBrowser}from"../../../../chunks/add-metadata-template-dropdown-with-browser.js";export{AddMetadataTemplateDropdownWithBrowser};
@@ -1,24 +1 @@
1
- import { getTemplateDisplayName as e } from "../../utils/utils.js";
2
- import { FilterDropdownMenu as t } from "../filter-dropdown-menu/index.js";
3
- import n from "./messages.js";
4
- import { DropdownTrigger as r } from "./shared/dropdown-trigger.js";
5
- import { useMemo as i, useState as a } from "react";
6
- import { useIntl as o } from "react-intl";
7
- import { jsx as s, jsxs as c } from "react/jsx-runtime";
8
- function l({ availableTemplates: l, onSelect: u, selectedTemplates: d }) {
9
- let f = o(), p = f.formatMessage(n.customMetadataName), [m, h] = a(""), g = i(() => l.filter((t) => e(t, p).toLowerCase().includes(m.toLowerCase())), [
10
- l,
11
- m,
12
- p
13
- ]), _ = m.length > 0 && g.length === 0, v = (e) => d.some((t) => t.scope === e.scope && t.templateKey === e.templateKey);
14
- return /* @__PURE__ */ c(t.Root, {
15
- resetValueOnHide: !0,
16
- setValue: h,
17
- children: [/* @__PURE__ */ s(r, {}), /* @__PURE__ */ c(t.Content, { children: [/* @__PURE__ */ s(t.Search, { placeholder: f.formatMessage(n.addMetadataTemplatesSearchPlaceholder) }), /* @__PURE__ */ s(t.List, { children: _ ? /* @__PURE__ */ s(t.EmptyState, {}) : g.map((n) => /* @__PURE__ */ s(t.Item, {
18
- disabled: v(n),
19
- onClick: () => u(n),
20
- value: e(n, p)
21
- }, n.id)) })] })]
22
- });
23
- }
24
- export { l as AddMetadataTemplateDropdown };
1
+ import{getTemplateDisplayName}from"../../utils/utils.js";import{FilterDropdownMenu}from"../filter-dropdown-menu/index.js";import messages from"./messages.js";import{DropdownTrigger}from"./shared/dropdown-trigger.js";import{useMemo,useState}from"react";import{useIntl}from"react-intl";import{jsx,jsxs}from"react/jsx-runtime";function AddMetadataTemplateDropdown({availableTemplates,onSelect,selectedTemplates}){let intl=useIntl(),customMetadataName=intl.formatMessage(messages.customMetadataName),[searchValue,setSearchValue]=useState(``),filteredElements=useMemo(()=>availableTemplates.filter(template=>getTemplateDisplayName(template,customMetadataName).toLowerCase().includes(searchValue.toLowerCase())),[availableTemplates,searchValue,customMetadataName]),shouldShowEmptyState=searchValue.length>0&&filteredElements.length===0,isTemplateAlreadySelected=template=>selectedTemplates.some(selectedTemplate=>selectedTemplate.scope===template.scope&&selectedTemplate.templateKey===template.templateKey);return jsxs(FilterDropdownMenu.Root,{resetValueOnHide:!0,setValue:setSearchValue,children:[jsx(DropdownTrigger,{}),jsxs(FilterDropdownMenu.Content,{children:[jsx(FilterDropdownMenu.Search,{placeholder:intl.formatMessage(messages.addMetadataTemplatesSearchPlaceholder)}),jsx(FilterDropdownMenu.List,{children:shouldShowEmptyState?jsx(FilterDropdownMenu.EmptyState,{}):filteredElements.map(template=>jsx(FilterDropdownMenu.Item,{disabled:isTemplateAlreadySelected(template),onClick:()=>onSelect(template),value:getTemplateDisplayName(template,customMetadataName)},template.id))})]})]})}export{AddMetadataTemplateDropdown};
@@ -1,3 +1 @@
1
- import { AddMetadataTemplateDropdown as e } from "./add-metadata-template-dropdown.js";
2
- import { t } from "../../../../chunks/add-metadata-template-dropdown-with-browser.js";
3
- export { e as AddMetadataTemplateDropdown, t as AddMetadataTemplateDropdownWithBrowser };
1
+ import{AddMetadataTemplateDropdown}from"./add-metadata-template-dropdown.js";import{t as AddMetadataTemplateDropdownWithBrowser}from"../../../../chunks/add-metadata-template-dropdown-with-browser.js";export{AddMetadataTemplateDropdown,AddMetadataTemplateDropdownWithBrowser};
@@ -1,20 +1 @@
1
- import { defineMessages as e } from "react-intl";
2
- var t = e({
3
- customMetadataName: {
4
- id: "groupSharedFeatures.metadataEditor.addMetadataTemplate.customMetadataName",
5
- defaultMessage: "Custom Metadata"
6
- },
7
- addMetadataTemplatesSearchPlaceholder: {
8
- id: "groupSharedFeatures.metadataEditor.addMetadataTemplate.search.placeholder",
9
- defaultMessage: "Search templates"
10
- },
11
- addMetadataTemplatesTriggerButtonLabel: {
12
- id: "groupSharedFeatures.metadataEditor.addMetadataTemplate.trigger.label",
13
- defaultMessage: "Add template"
14
- },
15
- createTemplateButtonLabel: {
16
- id: "groupSharedFeatures.metadataEditor.addMetadataTemplate.createTemplate.button.label",
17
- defaultMessage: "New Template"
18
- }
19
- });
20
- export { t as default };
1
+ import{defineMessages}from"react-intl";var messages=defineMessages({customMetadataName:{id:`groupSharedFeatures.metadataEditor.addMetadataTemplate.customMetadataName`,defaultMessage:`Custom Metadata`},addMetadataTemplatesSearchPlaceholder:{id:`groupSharedFeatures.metadataEditor.addMetadataTemplate.search.placeholder`,defaultMessage:`Search templates`},addMetadataTemplatesTriggerButtonLabel:{id:`groupSharedFeatures.metadataEditor.addMetadataTemplate.trigger.label`,defaultMessage:`Add template`},createTemplateButtonLabel:{id:`groupSharedFeatures.metadataEditor.addMetadataTemplate.createTemplate.button.label`,defaultMessage:`New Template`}});export{messages as default};