@box/metadata-editor 2.2.32 → 2.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunks/add-metadata-template-dropdown-with-browser.js +34 -0
- package/dist/chunks/ai-suggestion-field.js +31 -31
- package/dist/chunks/autofill-overlay.js +13 -13
- package/dist/chunks/combobox-with-api-pagination.js +40 -40
- package/dist/chunks/custom-instance-new-field.js +13 -13
- package/dist/chunks/custom-instance.js +19 -19
- package/dist/chunks/delete-confirmation-modal.js +20 -20
- package/dist/chunks/filter-instances-dropdown.js +24 -24
- package/dist/chunks/interactive-header-text.js +8 -8
- package/dist/chunks/metadata-instance-entry.js +24 -24
- package/dist/chunks/metadata-instance-footer.js +7 -7
- package/dist/chunks/metadata-instance-form-ai-disclaimer.js +8 -8
- package/dist/chunks/metadata-instance-form-autofill-button.js +32 -32
- package/dist/chunks/metadata-instance-form-card-wrapper.js +10 -10
- package/dist/chunks/metadata-instance-form-footer.js +10 -10
- package/dist/chunks/metadata-instance-header.js +14 -14
- package/dist/chunks/metadata-instance.js +12 -12
- package/dist/chunks/taxonomy-ancestor-status-pill.js +21 -21
- package/dist/chunks/update-mode-field-wrapper.js +22 -22
- package/dist/chunks/utils.js +26 -26
- package/dist/esm/index.js +21 -20
- package/dist/esm/lib/components/add-metadata-template-dropdown/add-metadata-template-dropdown-with-browser.js +2 -0
- package/dist/esm/lib/components/add-metadata-template-dropdown/add-metadata-template-dropdown.js +24 -2
- package/dist/esm/lib/components/add-metadata-template-dropdown/index.js +3 -2
- package/dist/esm/lib/components/add-metadata-template-dropdown/shared/dropdown-trigger.js +16 -0
- package/dist/esm/lib/components/filter-dropdown-menu/filter-dropdown-menu-empty-state.js +5 -5
- package/dist/esm/lib/components/filter-dropdown-menu/filter-dropdown-menu-list.js +5 -5
- package/dist/esm/lib/components/filter-dropdown-menu/filter-dropdown-menu-search.js +12 -12
- package/dist/esm/lib/components/interactive-text/interactive-text.js +7 -7
- package/dist/esm/lib/components/metadata-editor-fields/components/ai-logo-badge/ai-logo-badge.js +11 -11
- package/dist/esm/lib/components/metadata-editor-fields/components/low-confidence-badge/low-confidence-badge.js +5 -5
- package/dist/esm/lib/components/metadata-editor-fields/components/low-confidence-suggestion-field/low-confidence-suggestion-field.js +17 -17
- package/dist/esm/lib/components/metadata-editor-fields/components/metadata-date-field/metadata-date-field.js +11 -11
- package/dist/esm/lib/components/metadata-editor-fields/components/metadata-enum-field/metadata-enum-field.js +17 -17
- package/dist/esm/lib/components/metadata-editor-fields/components/metadata-float-field/metadata-float-field.js +9 -9
- package/dist/esm/lib/components/metadata-editor-fields/components/metadata-multi-select-field/metadata-multi-select-field.js +10 -10
- package/dist/esm/lib/components/metadata-editor-fields/components/metadata-string-field/metadata-string-field.js +11 -11
- package/dist/esm/lib/components/metadata-editor-fields/components/metadata-taxonomy-field/legacy-metadata-taxonomy-field.js +11 -11
- package/dist/esm/lib/components/metadata-editor-fields/components/metadata-taxonomy-field/metadata-taxonomy-picker-field/metadata-taxonomy-picker-field.js +11 -11
- package/dist/esm/lib/components/metadata-editor-fields/metadata-editor-field-wrapper.js +33 -33
- package/dist/esm/lib/components/metadata-editor-fields/metadata-editor-fields.js +10 -10
- package/dist/esm/lib/components/metadata-empty-state/metadata-empty-state.js +12 -12
- package/dist/esm/lib/components/metadata-instance-editor/subcomponents/metadata-instance-form-inline-notice/metadata-instance-form-inline-notice.js +10 -10
- package/dist/esm/lib/components/metadata-instance-list/subcomponents/metadata-instance-entry/metadata-entry-display.js +4 -4
- package/dist/esm/lib/components/metadata-instance-list/subcomponents/metadata-instance-entry/taxonomy-entry/taxonomy-value.js +6 -6
- package/dist/esm/lib/components/metadata-instance-review-notice/metadata-instance-review-notice.js +7 -7
- package/dist/esm/lib/components/unsaved-changes-modal/unsaved-changes-modal.js +16 -16
- package/dist/styles/add-metadata-template-dropdown-with-browser.css +1 -0
- package/dist/types/index.d.ts +1 -1
- package/dist/types/lib/components/add-metadata-template-dropdown/add-metadata-template-dropdown-with-browser.d.ts +16 -0
- package/dist/types/lib/components/add-metadata-template-dropdown/add-metadata-template-dropdown.d.ts +9 -1
- package/dist/types/lib/components/add-metadata-template-dropdown/index.d.ts +3 -1
- package/dist/types/lib/components/add-metadata-template-dropdown/shared/dropdown-trigger.d.ts +6 -0
- package/dist/types/lib/components/add-metadata-template-dropdown/types.d.ts +32 -22
- package/package.json +12 -12
- package/dist/chunks/add-metadata-template-dropdown.js +0 -84
- package/dist/styles/add-metadata-template-dropdown.css +0 -1
|
@@ -2,30 +2,30 @@ import e from "../../messages.js";
|
|
|
2
2
|
import { i as t } from "../../../../chunks/utils.js";
|
|
3
3
|
import { MetadataEditorFieldWrapper as n } from "./metadata-editor-field-wrapper.js";
|
|
4
4
|
import { useReviewFieldFilter as r } from "./hooks/use-review-field-filter.js";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
5
|
+
import { createElement as i, useEffect as a, useRef as o } from "react";
|
|
6
|
+
import { FormattedMessage as s } from "react-intl";
|
|
7
|
+
import { jsx as c } from "react/jsx-runtime";
|
|
8
|
+
import { Text as l } from "@box/blueprint-web";
|
|
9
9
|
import { FieldArray as u, getIn as d, useFormikContext as f } from "formik";
|
|
10
10
|
var p = (p) => {
|
|
11
|
-
let { shouldShowOnlyReviewFields: m = !1 } = p, { values: h } = f(), g = "metadata.fields", _ = d(h, g), v =
|
|
12
|
-
return
|
|
11
|
+
let { shouldShowOnlyReviewFields: m = !1 } = p, { values: h } = f(), g = "metadata.fields", _ = d(h, g), v = o(null), y = r(_, m), b = _.findIndex((e) => !e.hidden);
|
|
12
|
+
return a(() => {
|
|
13
13
|
b > -1 && v.current?.focus();
|
|
14
|
-
}, []), _.length ? /* @__PURE__ */
|
|
14
|
+
}, []), _.length ? /* @__PURE__ */ c(u, {
|
|
15
15
|
name: g,
|
|
16
16
|
validateOnChange: !1,
|
|
17
|
-
children: () => y.map(({ field: e, originalIndex: t }) => /* @__PURE__ */
|
|
17
|
+
children: () => y.map(({ field: e, originalIndex: t }) => /* @__PURE__ */ i(n, {
|
|
18
18
|
...p,
|
|
19
19
|
key: e.key,
|
|
20
20
|
ref: t === b ? v : null,
|
|
21
21
|
field: e,
|
|
22
22
|
index: t
|
|
23
23
|
}))
|
|
24
|
-
}) : /* @__PURE__ */ l
|
|
24
|
+
}) : /* @__PURE__ */ c(l, {
|
|
25
25
|
as: "span",
|
|
26
26
|
className: t.noAttributesText,
|
|
27
27
|
color: "textOnLightSecondary",
|
|
28
|
-
children: /* @__PURE__ */
|
|
28
|
+
children: /* @__PURE__ */ c(s, { ...e.noTemplateAtributesError })
|
|
29
29
|
});
|
|
30
30
|
};
|
|
31
31
|
export { p as TemplateInstance, p as default };
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import e from "./messages.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
2
|
+
import { useCallback as t } from "react";
|
|
3
|
+
import { useIntl as n } from "react-intl";
|
|
4
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
5
|
+
import { EmptyState as i, Text as a } from "@box/blueprint-web";
|
|
6
6
|
import { JobAnalyzeData as o } from "@box/blueprint-web-assets/illustrations/Small";
|
|
7
7
|
function s({ isAnyEmptyValueHidden: s = !1, isBoxAiSuggestionsFeatureEnabled: c = !1, level: l, onShowEmptyValues: u }) {
|
|
8
|
-
let d =
|
|
8
|
+
let d = n(), f = t(() => l === "manager" ? /* @__PURE__ */ r(a, {
|
|
9
9
|
as: "p",
|
|
10
10
|
children: d.formatMessage(e.managerLevelEmptyStateBody)
|
|
11
|
-
}) : l === "instance" ? s ? /* @__PURE__ */
|
|
11
|
+
}) : l === "instance" ? s ? /* @__PURE__ */ r(i.PrimaryAction, {
|
|
12
12
|
onClick: u,
|
|
13
13
|
children: d.formatMessage(e.instanceLevelSeeEmptyValuesCTA)
|
|
14
|
-
}) : /* @__PURE__ */ a
|
|
14
|
+
}) : /* @__PURE__ */ r(a, {
|
|
15
15
|
as: "h1",
|
|
16
16
|
variant: "titleSmall",
|
|
17
17
|
children: d.formatMessage(e.instanceLevelEmptyStateHeadingNoAttributes)
|
|
18
|
-
}) : /* @__PURE__ */ a
|
|
18
|
+
}) : /* @__PURE__ */ r(a, {
|
|
19
19
|
as: "p",
|
|
20
20
|
children: d.formatMessage(e.fileLevelEmptyStateDefaultBody)
|
|
21
21
|
}), [
|
|
@@ -23,13 +23,13 @@ function s({ isAnyEmptyValueHidden: s = !1, isBoxAiSuggestionsFeatureEnabled: c
|
|
|
23
23
|
s,
|
|
24
24
|
l,
|
|
25
25
|
u
|
|
26
|
-
]), p =
|
|
26
|
+
]), p = t(() => l === "manager" ? /* @__PURE__ */ r(a, {
|
|
27
27
|
as: "h2",
|
|
28
28
|
children: d.formatMessage(e.managerLevelEmptyStateHeading)
|
|
29
|
-
}) : l === "instance" ? s ? /* @__PURE__ */ a
|
|
29
|
+
}) : l === "instance" ? s ? /* @__PURE__ */ r(a, {
|
|
30
30
|
as: "h2",
|
|
31
31
|
children: d.formatMessage(e.instanceLevelEmptyStateHeading)
|
|
32
|
-
}) : null : /* @__PURE__ */ a
|
|
32
|
+
}) : null : /* @__PURE__ */ r(a, {
|
|
33
33
|
as: "h2",
|
|
34
34
|
children: d.formatMessage(e.fileLevelEmptyStateDefaultHeading)
|
|
35
35
|
}), [
|
|
@@ -37,7 +37,7 @@ function s({ isAnyEmptyValueHidden: s = !1, isBoxAiSuggestionsFeatureEnabled: c
|
|
|
37
37
|
s,
|
|
38
38
|
l
|
|
39
39
|
]);
|
|
40
|
-
return /* @__PURE__ */
|
|
40
|
+
return /* @__PURE__ */ r(i, {
|
|
41
41
|
body: f(),
|
|
42
42
|
heading: p(),
|
|
43
43
|
illustration: o,
|
|
@@ -1,28 +1,28 @@
|
|
|
1
1
|
import e from "./messages.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
2
|
+
import { useIntl as t } from "react-intl";
|
|
3
|
+
import { Fragment as n, jsx as r, jsxs as i } from "react/jsx-runtime";
|
|
4
|
+
import { InlineNotice as a, Text as o } from "@box/blueprint-web";
|
|
5
5
|
var s = ({ isLargeFile: s, isBetaLanguageEnabled: c }) => {
|
|
6
|
-
let l =
|
|
7
|
-
return !c && !s ? null : /* @__PURE__ */
|
|
6
|
+
let l = t();
|
|
7
|
+
return !c && !s ? null : /* @__PURE__ */ i(n, { children: [s && /* @__PURE__ */ i(a, {
|
|
8
8
|
variant: "warning",
|
|
9
9
|
variantIconAriaLabel: l.formatMessage(e.largeFileNoticeHeader),
|
|
10
|
-
children: [/* @__PURE__ */
|
|
10
|
+
children: [/* @__PURE__ */ r(o, {
|
|
11
11
|
as: "p",
|
|
12
12
|
variant: "bodyDefaultBold",
|
|
13
13
|
children: l.formatMessage(e.largeFileNoticeHeader)
|
|
14
|
-
}), /* @__PURE__ */ o
|
|
14
|
+
}), /* @__PURE__ */ i(o, {
|
|
15
15
|
as: "p",
|
|
16
16
|
children: [l.formatMessage(e.largeFileNoticeBody), " "]
|
|
17
17
|
})]
|
|
18
|
-
}), c && /* @__PURE__ */
|
|
18
|
+
}), c && /* @__PURE__ */ i(a, {
|
|
19
19
|
variant: "info",
|
|
20
20
|
variantIconAriaLabel: l.formatMessage(e.autofillInBetaNoticeHeader),
|
|
21
|
-
children: [/* @__PURE__ */
|
|
21
|
+
children: [/* @__PURE__ */ r(o, {
|
|
22
22
|
as: "p",
|
|
23
23
|
variant: "bodyDefaultBold",
|
|
24
24
|
children: l.formatMessage(e.autofillInBetaNoticeHeader)
|
|
25
|
-
}), /* @__PURE__ */ o
|
|
25
|
+
}), /* @__PURE__ */ i(o, {
|
|
26
26
|
as: "p",
|
|
27
27
|
children: [l.formatMessage(e.autofillInBetaNoticeBody), " "]
|
|
28
28
|
})]
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { TaxonomyValue as e } from "./taxonomy-entry/taxonomy-value.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
var r = ({ type: r, formattedValue: i, value: a, taxonomyNodeFetcher: o, taxonomyKey: s, scope: c, isExternallyOwned: l }) => r === "taxonomy" ? /* @__PURE__ */
|
|
2
|
+
import { jsx as t } from "react/jsx-runtime";
|
|
3
|
+
import { Text as n } from "@box/blueprint-web";
|
|
4
|
+
var r = ({ type: r, formattedValue: i, value: a, taxonomyNodeFetcher: o, taxonomyKey: s, scope: c, isExternallyOwned: l }) => r === "taxonomy" ? /* @__PURE__ */ t(e, {
|
|
5
5
|
isExternallyOwned: l,
|
|
6
6
|
scope: c,
|
|
7
7
|
taxonomyKey: s,
|
|
8
8
|
taxonomyNodeFetcher: o,
|
|
9
9
|
value: a
|
|
10
|
-
}) : i && /* @__PURE__ */ n
|
|
10
|
+
}) : i && /* @__PURE__ */ t(n, {
|
|
11
11
|
as: "p",
|
|
12
12
|
variant: "bodyDefaultBold",
|
|
13
13
|
children: i
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import "../../../../metadata-editor-fields/components/update-mode-field-wrapper/mulitple-values-utils.js";
|
|
2
2
|
import { messages as e } from "../../../../metadata-editor-fields/components/update-mode-field-wrapper/messages.js";
|
|
3
3
|
import { n as t, t as n } from "../../../../../../../chunks/taxonomy-ancestor-status-pill.js";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
4
|
+
import { useIntl as r } from "react-intl";
|
|
5
|
+
import { jsx as i } from "react/jsx-runtime";
|
|
6
|
+
import { FilterChip as a } from "@box/blueprint-web";
|
|
7
7
|
var o = ({ value: o, taxonomyNodeFetcher: s, taxonomyKey: c, scope: l, isExternallyOwned: u }) => {
|
|
8
|
-
let d =
|
|
8
|
+
let d = r();
|
|
9
9
|
if (!o || !Array.isArray(o) || !o.length) return null;
|
|
10
10
|
let f = d.formatMessage(e.multipleValues);
|
|
11
|
-
return /* @__PURE__ */ a
|
|
11
|
+
return /* @__PURE__ */ i(a.Group, {
|
|
12
12
|
className: t.taxonomyValueGroup,
|
|
13
13
|
disabled: u,
|
|
14
14
|
name: void 0,
|
|
15
15
|
type: "single",
|
|
16
|
-
children: o.map((e) => /* @__PURE__ */
|
|
16
|
+
children: o.map((e) => /* @__PURE__ */ i(n, {
|
|
17
17
|
displayValue: e.displayValue === "Multiple values" ? f : e.displayValue,
|
|
18
18
|
scope: l,
|
|
19
19
|
taxonomyKey: c,
|
package/dist/esm/lib/components/metadata-instance-review-notice/metadata-instance-review-notice.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import e from "./messages.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
2
|
+
import { useIntl as t } from "react-intl";
|
|
3
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
4
|
+
import { ActionableInlineNotice as r, TextToggleButton as i, Tooltip as a } from "@box/blueprint-web";
|
|
5
5
|
import { AlertCircle as o } from "@box/blueprint-web-assets/icons/Medium";
|
|
6
6
|
var s = ({ fieldsNeedingReviewCount: s, isLowScoreFilteringEnabled: c = !1, onTextToggleClick: l }) => {
|
|
7
|
-
let u =
|
|
8
|
-
return /* @__PURE__ */
|
|
7
|
+
let u = t(), d = c ? u.formatMessage(e.showingReviewFields) : u.formatMessage(e.reviewFieldsNoticeHeader, { count: s }), f = c ? u.formatMessage(e.hideButtonTooltip) : u.formatMessage(e.viewButtonTooltip, { count: s });
|
|
8
|
+
return /* @__PURE__ */ n(r, {
|
|
9
9
|
backgroundColor: "backgroundGray",
|
|
10
10
|
iconAriaLabel: u.formatMessage(e.iconAriaLabel),
|
|
11
11
|
text: d,
|
|
12
12
|
icon: o,
|
|
13
|
-
children: /* @__PURE__ */ a
|
|
13
|
+
children: /* @__PURE__ */ n(a, {
|
|
14
14
|
content: f,
|
|
15
|
-
children: /* @__PURE__ */
|
|
15
|
+
children: /* @__PURE__ */ n(i, {
|
|
16
16
|
"data-target-id": c ? "TextToggleButton-metadataEditorReviewFilterHide" : "TextToggleButton-metadataEditorReviewFilterView",
|
|
17
17
|
onPressedChange: l,
|
|
18
18
|
pressed: c,
|
|
@@ -1,43 +1,43 @@
|
|
|
1
1
|
import { EVENT_NAMES as e } from "../../utils/analytics/events.js";
|
|
2
2
|
import t from "./messages.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
3
|
+
import { useCallback as n, useEffect as r, useState as i } from "react";
|
|
4
|
+
import { FormattedMessage as a, useIntl as o } from "react-intl";
|
|
5
|
+
import { jsx as s, jsxs as c } from "react/jsx-runtime";
|
|
6
|
+
import { Modal as l } from "@box/blueprint-web";
|
|
7
7
|
function u({ onBackToEdit: u, onDiscardChanges: d, defaultOpen: f = !0, open: p = f, trackEvent: m }) {
|
|
8
|
-
let h =
|
|
9
|
-
|
|
8
|
+
let h = o(), [g, _] = i(p);
|
|
9
|
+
r(() => _(p), [p]), r(() => {
|
|
10
10
|
g && m?.(e.UNSAVED_MODAL_SHOWN);
|
|
11
11
|
}, [g, m]);
|
|
12
|
-
let v =
|
|
12
|
+
let v = n(() => {
|
|
13
13
|
u(), _(!1);
|
|
14
|
-
}, [u]), y =
|
|
14
|
+
}, [u]), y = n(() => {
|
|
15
15
|
m?.(e.UNSAVED_MODAL_DISCARD), d(), _(!1);
|
|
16
16
|
}, [d, m]);
|
|
17
|
-
return /* @__PURE__ */
|
|
17
|
+
return /* @__PURE__ */ s(l, {
|
|
18
18
|
modal: !0,
|
|
19
|
-
onOpenChange:
|
|
19
|
+
onOpenChange: n((e) => {
|
|
20
20
|
_(e), e || v();
|
|
21
21
|
}, [v]),
|
|
22
22
|
open: g,
|
|
23
|
-
children: /* @__PURE__ */ l
|
|
23
|
+
children: /* @__PURE__ */ c(l.Content, {
|
|
24
24
|
onEscapeKeyDown: (e) => e.stopPropagation(),
|
|
25
25
|
size: "small",
|
|
26
26
|
children: [
|
|
27
|
-
/* @__PURE__ */
|
|
28
|
-
/* @__PURE__ */
|
|
29
|
-
/* @__PURE__ */ l
|
|
27
|
+
/* @__PURE__ */ s(l.Header, { children: /* @__PURE__ */ s(a, { ...t.unsavedChangesModalHeader }) }),
|
|
28
|
+
/* @__PURE__ */ s(l.ScrollableContainer, { children: /* @__PURE__ */ s(l.Body, { children: /* @__PURE__ */ s(a, { ...t.unsavedChangesModalBody }) }) }),
|
|
29
|
+
/* @__PURE__ */ c(l.Footer, { children: [/* @__PURE__ */ s(l.Footer.SecondaryButton, {
|
|
30
30
|
"data-target-id": "Modal.Footer.SecondaryButton-metadataEditorUnsavedDiscard",
|
|
31
31
|
onClick: y,
|
|
32
32
|
size: "large",
|
|
33
33
|
children: h.formatMessage(t.unsavedChangesModalDiscardChangesCTA)
|
|
34
|
-
}), /* @__PURE__ */
|
|
34
|
+
}), /* @__PURE__ */ s(l.Footer.PrimaryButton, {
|
|
35
35
|
"data-target-id": "Modal.Footer.PrimaryButton-metadataEditorUnsavedBackToEdit",
|
|
36
36
|
onClick: v,
|
|
37
37
|
size: "large",
|
|
38
38
|
children: h.formatMessage(t.unsavedChangesModalContinueEditingCTA)
|
|
39
39
|
})] }),
|
|
40
|
-
/* @__PURE__ */
|
|
40
|
+
/* @__PURE__ */ s(l.Close, { "aria-label": h.formatMessage(t.unsavedChangesModalCloseLabel) })
|
|
41
41
|
]
|
|
42
42
|
})
|
|
43
43
|
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
._templateBrowserContainer_175dl_1{width:250px;height:26.5rem}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -12,4 +12,4 @@ export * from './lib/metadata-editor';
|
|
|
12
12
|
export * from './lib/types';
|
|
13
13
|
export * from './lib/utils/api-wrapper';
|
|
14
14
|
export * from './lib/utils/autofill-context';
|
|
15
|
-
export type {
|
|
15
|
+
export type { SearchParams, TaxonomyAncestor, TaxonomyItemsService, TaxonomyNode, TaxonomySearchResult, } from '@box/metadata-taxonomy-picker';
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { AddMetadataTemplateDropdownWithBrowserProps } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* UI shell that renders `MetadataTemplateBrowser` inside a Blueprint `Popover`
|
|
4
|
+
* (namespace browsing, paginated fetching, search, create/edit affordances).
|
|
5
|
+
* Provides the trigger button and content layout — nothing else.
|
|
6
|
+
*
|
|
7
|
+
* Built on Blueprint `Popover` (Radix) rather than `FilterDropdownMenu` (Ariakit)
|
|
8
|
+
* so that nested Blueprint `Modal`s (e.g. the template editor) participate in
|
|
9
|
+
* Radix's shared dismissable-layer stack and do not auto-dismiss the popover.
|
|
10
|
+
*
|
|
11
|
+
* The host owns and constructs both `itemsService` (data) and `eventService`
|
|
12
|
+
* (side effects). This component does not adapt, wrap, or transform either.
|
|
13
|
+
*
|
|
14
|
+
* For a static client-side filtered list, use `AddMetadataTemplateDropdown`.
|
|
15
|
+
*/
|
|
16
|
+
export declare function AddMetadataTemplateDropdownWithBrowser({ canCreateAtRoot, enterpriseId, eventService, isLoading, itemsService, onOpenChange, open, }: Readonly<AddMetadataTemplateDropdownWithBrowserProps>): import("react/jsx-runtime").JSX.Element;
|
package/dist/types/lib/components/add-metadata-template-dropdown/add-metadata-template-dropdown.d.ts
CHANGED
|
@@ -1,2 +1,10 @@
|
|
|
1
1
|
import { AddMetadataTemplateDropdownProps } from './types';
|
|
2
|
-
|
|
2
|
+
/**
|
|
3
|
+
* Static, client-side filtered template picker. Renders a search input plus a
|
|
4
|
+
* flat list of templates. Use this when the host already has the full
|
|
5
|
+
* template list in memory and template create/edit affordances are not needed.
|
|
6
|
+
*
|
|
7
|
+
* For namespace browsing, paginated fetching, or template management, use
|
|
8
|
+
* `AddMetadataTemplateDropdownWithBrowser` instead.
|
|
9
|
+
*/
|
|
10
|
+
export declare function AddMetadataTemplateDropdown({ availableTemplates, onSelect, selectedTemplates, }: AddMetadataTemplateDropdownProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,2 +1,4 @@
|
|
|
1
1
|
export { AddMetadataTemplateDropdown } from './add-metadata-template-dropdown';
|
|
2
|
-
export {
|
|
2
|
+
export { AddMetadataTemplateDropdownWithBrowser } from './add-metadata-template-dropdown-with-browser';
|
|
3
|
+
export { type AddMetadataTemplateDropdownProps, type AddMetadataTemplateDropdownWithBrowserProps, } from './types';
|
|
4
|
+
export { type EventService, type FetchParams, type FetchResponse, type ItemsService, type MetadataNamespace, type MetadataTemplate as BrowserMetadataTemplate, } from '@box/metadata-template-browser';
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared trigger for both the legacy `AddMetadataTemplateDropdown` and the
|
|
3
|
+
* `AddMetadataTemplateDropdownWithBrowser` variant. Keeps the affordance
|
|
4
|
+
* (icon, label, size) consistent across both dropdown surfaces.
|
|
5
|
+
*/
|
|
6
|
+
export declare function DropdownTrigger(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,33 +1,43 @@
|
|
|
1
|
+
import { EventService, ItemsService } from '@box/metadata-template-browser';
|
|
1
2
|
import { MetadataTemplate } from '../../types';
|
|
3
|
+
/**
|
|
4
|
+
* Props for the legacy `AddMetadataTemplateDropdown` — a static, client-side
|
|
5
|
+
* filtered list. Use this variant when the host has the full template list
|
|
6
|
+
* already in memory and template management (create/edit) is not required.
|
|
7
|
+
*/
|
|
2
8
|
export type AddMetadataTemplateDropdownProps = {
|
|
3
9
|
availableTemplates: MetadataTemplate[];
|
|
4
10
|
selectedTemplates: MetadataTemplate[];
|
|
5
11
|
onSelect: (template: MetadataTemplate) => void;
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* Props for `AddMetadataTemplateDropdownWithBrowser` — a pure UI shell that
|
|
15
|
+
* renders `MetadataTemplateBrowser` inside a dropdown popover. The host owns
|
|
16
|
+
* both the data layer (`itemsService`) and the side-effects layer
|
|
17
|
+
* (`eventService`); this component only provides the dropdown chrome.
|
|
18
|
+
*/
|
|
19
|
+
export type AddMetadataTemplateDropdownWithBrowserProps = {
|
|
20
|
+
/** Root namespace FQN passed to the browser (typically the enterprise ID). */
|
|
21
|
+
enterpriseId: string;
|
|
22
|
+
/** Host-owned data service: namespaces, templates, search. */
|
|
23
|
+
itemsService: ItemsService;
|
|
24
|
+
/** Host-owned side-effects service: selection, edit, create, navigation. */
|
|
25
|
+
eventService: EventService;
|
|
26
|
+
/** When true, the browser is rendered in a disabled/loading state. */
|
|
17
27
|
isLoading?: boolean;
|
|
28
|
+
/** Whether template creation is allowed at the root namespace (enterprise level). */
|
|
29
|
+
canCreateAtRoot?: boolean;
|
|
18
30
|
/**
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
31
|
+
* Controlled open state for the dropdown popover. When provided together
|
|
32
|
+
* with `onOpenChange`, the host owns visibility — typical use case is
|
|
33
|
+
* dismissing the dropdown when a flow that escalates to a modal begins
|
|
34
|
+
* (e.g. clicking "Create template"). When omitted, the popover is
|
|
35
|
+
* uncontrolled (Radix manages its own state).
|
|
22
36
|
*/
|
|
23
|
-
|
|
37
|
+
open?: boolean;
|
|
24
38
|
/**
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
* Only active when `isTemplateManagementEnabled` is true.
|
|
39
|
+
* Called whenever Radix proposes a new open state (trigger click, outside
|
|
40
|
+
* click, Esc key, etc.). Required when `open` is provided.
|
|
28
41
|
*/
|
|
29
|
-
|
|
30
|
-
namespaceFqn: string;
|
|
31
|
-
templateKey: string;
|
|
32
|
-
}) => void;
|
|
42
|
+
onOpenChange?: (open: boolean) => void;
|
|
33
43
|
};
|
package/package.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@box/metadata-editor",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.3.1",
|
|
4
4
|
"peerDependencies": {
|
|
5
5
|
"@ariakit/react": "0.4.21",
|
|
6
|
-
"@box/blueprint-web": "^16.8.
|
|
7
|
-
"@box/blueprint-web-assets": "^5.5.
|
|
8
|
-
"@box/box-ai-agent-selector": "^2.1.
|
|
9
|
-
"@box/combobox-with-api": "^2.1.
|
|
10
|
-
"@box/metadata-taxonomy-picker": "^3.1.
|
|
11
|
-
"@box/metadata-template-browser": "^2.1.
|
|
6
|
+
"@box/blueprint-web": "^16.8.5",
|
|
7
|
+
"@box/blueprint-web-assets": "^5.5.3",
|
|
8
|
+
"@box/box-ai-agent-selector": "^2.1.29",
|
|
9
|
+
"@box/combobox-with-api": "^2.1.29",
|
|
10
|
+
"@box/metadata-taxonomy-picker": "^3.1.29",
|
|
11
|
+
"@box/metadata-template-browser": "^2.1.28",
|
|
12
12
|
"formik": "^2.0.3",
|
|
13
13
|
"lodash": "^4.17.15",
|
|
14
14
|
"react": "^17.0.0 || ^18.0.0",
|
|
@@ -18,11 +18,11 @@
|
|
|
18
18
|
"devDependencies": {
|
|
19
19
|
"@ariakit/react": "0.4.21",
|
|
20
20
|
"@box/babel-plugin-target-attributes": "2.1.10",
|
|
21
|
-
"@box/blueprint-web": "^16.8.
|
|
22
|
-
"@box/blueprint-web-assets": "^5.5.
|
|
23
|
-
"@box/box-ai-agent-selector": "^2.1.
|
|
24
|
-
"@box/metadata-taxonomy-picker": "^3.1.
|
|
25
|
-
"@box/storybook-utils": "^1.1.
|
|
21
|
+
"@box/blueprint-web": "^16.8.5",
|
|
22
|
+
"@box/blueprint-web-assets": "^5.5.3",
|
|
23
|
+
"@box/box-ai-agent-selector": "^2.1.29",
|
|
24
|
+
"@box/metadata-taxonomy-picker": "^3.1.29",
|
|
25
|
+
"@box/storybook-utils": "^1.1.27",
|
|
26
26
|
"@testing-library/react": "^15.0.6",
|
|
27
27
|
"react": "^18.3.0",
|
|
28
28
|
"react-dom": "^18.3.0",
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
import { getTemplateDisplayName as e } from "../esm/lib/utils/utils.js";
|
|
2
|
-
import { FilterDropdownMenu as t } from "../esm/lib/components/filter-dropdown-menu/index.js";
|
|
3
|
-
import n from "../esm/lib/components/add-metadata-template-dropdown/messages.js";
|
|
4
|
-
import { IconButton as r } from "@box/blueprint-web";
|
|
5
|
-
import { Plus as i } from "@box/blueprint-web-assets/icons/Fill";
|
|
6
|
-
import { Space2 as a } from "@box/blueprint-web-assets/tokens/px-tokens";
|
|
7
|
-
import { MetadataTemplateBrowser as o } from "@box/metadata-template-browser";
|
|
8
|
-
import { useMemo as s, useState as c } from "react";
|
|
9
|
-
import { useIntl as l } from "react-intl";
|
|
10
|
-
import { Fragment as u, jsx as d, jsxs as f } from "react/jsx-runtime";
|
|
11
|
-
import '../styles/add-metadata-template-dropdown.css';var p = { templateBrowserContainer: "_templateBrowserContainer_z6m4k_1" }, m = parseInt(a, 10), h = "enterprise";
|
|
12
|
-
function g({ availableTemplates: a, onSelect: g, selectedTemplates: _, isTemplateManagementEnabled: v = !1, isLoading: y, onCreateTemplate: b, onEditTemplate: x }) {
|
|
13
|
-
let S = l(), C = S.formatMessage(n.customMetadataName), [w, T] = c(""), E = s(() => a.filter((t) => e(t, C).toLowerCase().includes(w.toLowerCase())), [
|
|
14
|
-
a,
|
|
15
|
-
w,
|
|
16
|
-
C
|
|
17
|
-
]), D = w.length > 0 && E.length === 0, O = (e) => _.some((t) => t.scope === e.scope && t.templateKey === e.templateKey), k = s(() => a.map((t) => ({
|
|
18
|
-
id: t.id,
|
|
19
|
-
displayName: e(t, C) ?? "",
|
|
20
|
-
scope: t.scope,
|
|
21
|
-
templateKey: t.templateKey,
|
|
22
|
-
canEdit: t.canEdit
|
|
23
|
-
})), [a, C]), A = s(() => ({
|
|
24
|
-
onTemplateSelect: async (e) => {
|
|
25
|
-
let t = a.find((t) => t.id === e.id);
|
|
26
|
-
t && g(t);
|
|
27
|
-
},
|
|
28
|
-
...v && {
|
|
29
|
-
onCreateTemplate: (e) => b?.(e),
|
|
30
|
-
onTemplateEdit: (e) => {
|
|
31
|
-
let t = a.find((t) => t.id === e);
|
|
32
|
-
t?.scope && t?.templateKey && x?.({
|
|
33
|
-
namespaceFqn: t.scope,
|
|
34
|
-
templateKey: t.templateKey
|
|
35
|
-
});
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
}), [
|
|
39
|
-
a,
|
|
40
|
-
g,
|
|
41
|
-
v,
|
|
42
|
-
b,
|
|
43
|
-
x
|
|
44
|
-
]), j = s(() => ({
|
|
45
|
-
getTemplates: async () => ({
|
|
46
|
-
entries: k,
|
|
47
|
-
next_marker: void 0
|
|
48
|
-
}),
|
|
49
|
-
getSearchResults: async (e) => {
|
|
50
|
-
let t = e.toLowerCase();
|
|
51
|
-
return {
|
|
52
|
-
entries: k.filter((e) => e.displayName.toLowerCase().includes(t)),
|
|
53
|
-
next_marker: void 0
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
|
-
}), [k]);
|
|
57
|
-
return /* @__PURE__ */ f(t.Root, {
|
|
58
|
-
resetValueOnHide: !0,
|
|
59
|
-
setValue: T,
|
|
60
|
-
children: [/* @__PURE__ */ d(t.Trigger, { triggerButton: /* @__PURE__ */ d(r, {
|
|
61
|
-
"aria-label": S.formatMessage(n.addMetadataTemplatesTriggerButtonLabel),
|
|
62
|
-
icon: i,
|
|
63
|
-
size: "x-small",
|
|
64
|
-
"data-target-id": "IconButton-addMetadataTemplatesTriggerButtonLabel"
|
|
65
|
-
}) }), /* @__PURE__ */ d(t.Content, {
|
|
66
|
-
gutter: m,
|
|
67
|
-
children: v ? /* @__PURE__ */ d("div", {
|
|
68
|
-
className: p.templateBrowserContainer,
|
|
69
|
-
children: /* @__PURE__ */ d(o, {
|
|
70
|
-
enterpriseId: h,
|
|
71
|
-
eventService: A,
|
|
72
|
-
isDisabled: y,
|
|
73
|
-
itemsService: j,
|
|
74
|
-
canCreateAtRoot: !1
|
|
75
|
-
})
|
|
76
|
-
}) : /* @__PURE__ */ f(u, { children: [/* @__PURE__ */ d(t.Search, { placeholder: S.formatMessage(n.addMetadataTemplatesSearchPlaceholder) }), /* @__PURE__ */ d(t.List, { children: D ? /* @__PURE__ */ d(t.EmptyState, {}) : E.map((n) => /* @__PURE__ */ d(t.Item, {
|
|
77
|
-
disabled: O(n),
|
|
78
|
-
onClick: () => g(n),
|
|
79
|
-
value: e(n, C)
|
|
80
|
-
}, n.id)) })] })
|
|
81
|
-
})]
|
|
82
|
-
});
|
|
83
|
-
}
|
|
84
|
-
export { g as t };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
._templateBrowserContainer_z6m4k_1{padding:var(--bp-space-020,.5rem)}
|