@box/metadata-editor 2.2.31 → 2.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunks/add-metadata-template-dropdown-with-browser.js +34 -0
- package/dist/chunks/ai-suggestion-field.js +31 -31
- package/dist/chunks/autofill-overlay.js +13 -13
- package/dist/chunks/combobox-with-api-pagination.js +40 -40
- package/dist/chunks/custom-instance-new-field.js +13 -13
- package/dist/chunks/custom-instance.js +19 -19
- package/dist/chunks/delete-confirmation-modal.js +20 -20
- package/dist/chunks/filter-instances-dropdown.js +24 -24
- package/dist/chunks/interactive-header-text.js +8 -8
- package/dist/chunks/metadata-instance-entry.js +24 -24
- package/dist/chunks/metadata-instance-footer.js +7 -7
- package/dist/chunks/metadata-instance-form-ai-disclaimer.js +8 -8
- package/dist/chunks/metadata-instance-form-autofill-button.js +32 -32
- package/dist/chunks/metadata-instance-form-card-wrapper.js +10 -10
- package/dist/chunks/metadata-instance-form-footer.js +10 -10
- package/dist/chunks/metadata-instance-header.js +14 -14
- package/dist/chunks/metadata-instance.js +12 -12
- package/dist/chunks/taxonomy-ancestor-status-pill.js +21 -21
- package/dist/chunks/update-mode-field-wrapper.js +22 -22
- package/dist/chunks/utils.js +26 -26
- package/dist/esm/index.js +21 -20
- package/dist/esm/lib/components/add-metadata-template-dropdown/add-metadata-template-dropdown-with-browser.js +2 -0
- package/dist/esm/lib/components/add-metadata-template-dropdown/add-metadata-template-dropdown.js +24 -2
- package/dist/esm/lib/components/add-metadata-template-dropdown/index.js +3 -2
- package/dist/esm/lib/components/add-metadata-template-dropdown/shared/dropdown-trigger.js +16 -0
- package/dist/esm/lib/components/filter-dropdown-menu/filter-dropdown-menu-empty-state.js +5 -5
- package/dist/esm/lib/components/filter-dropdown-menu/filter-dropdown-menu-list.js +5 -5
- package/dist/esm/lib/components/filter-dropdown-menu/filter-dropdown-menu-search.js +12 -12
- package/dist/esm/lib/components/interactive-text/interactive-text.js +7 -7
- package/dist/esm/lib/components/metadata-editor-fields/components/ai-logo-badge/ai-logo-badge.js +11 -11
- package/dist/esm/lib/components/metadata-editor-fields/components/low-confidence-badge/low-confidence-badge.js +5 -5
- package/dist/esm/lib/components/metadata-editor-fields/components/low-confidence-suggestion-field/low-confidence-suggestion-field.js +17 -17
- package/dist/esm/lib/components/metadata-editor-fields/components/metadata-date-field/metadata-date-field.js +11 -11
- package/dist/esm/lib/components/metadata-editor-fields/components/metadata-enum-field/metadata-enum-field.js +17 -17
- package/dist/esm/lib/components/metadata-editor-fields/components/metadata-float-field/metadata-float-field.js +9 -9
- package/dist/esm/lib/components/metadata-editor-fields/components/metadata-multi-select-field/metadata-multi-select-field.js +10 -10
- package/dist/esm/lib/components/metadata-editor-fields/components/metadata-string-field/metadata-string-field.js +11 -11
- package/dist/esm/lib/components/metadata-editor-fields/components/metadata-taxonomy-field/legacy-metadata-taxonomy-field.js +11 -11
- package/dist/esm/lib/components/metadata-editor-fields/components/metadata-taxonomy-field/metadata-taxonomy-picker-field/metadata-taxonomy-picker-field.js +11 -11
- package/dist/esm/lib/components/metadata-editor-fields/metadata-editor-field-wrapper.js +33 -33
- package/dist/esm/lib/components/metadata-editor-fields/metadata-editor-fields.js +10 -10
- package/dist/esm/lib/components/metadata-empty-state/metadata-empty-state.js +12 -12
- package/dist/esm/lib/components/metadata-instance-editor/subcomponents/metadata-instance-form-inline-notice/metadata-instance-form-inline-notice.js +10 -10
- package/dist/esm/lib/components/metadata-instance-list/subcomponents/metadata-instance-entry/metadata-entry-display.js +4 -4
- package/dist/esm/lib/components/metadata-instance-list/subcomponents/metadata-instance-entry/taxonomy-entry/taxonomy-value.js +6 -6
- package/dist/esm/lib/components/metadata-instance-review-notice/metadata-instance-review-notice.js +7 -7
- package/dist/esm/lib/components/unsaved-changes-modal/unsaved-changes-modal.js +16 -16
- package/dist/styles/add-metadata-template-dropdown-with-browser.css +1 -0
- package/dist/types/index.d.ts +1 -1
- package/dist/types/lib/components/add-metadata-template-dropdown/add-metadata-template-dropdown-with-browser.d.ts +16 -0
- package/dist/types/lib/components/add-metadata-template-dropdown/add-metadata-template-dropdown.d.ts +9 -1
- package/dist/types/lib/components/add-metadata-template-dropdown/index.d.ts +3 -1
- package/dist/types/lib/components/add-metadata-template-dropdown/shared/dropdown-trigger.d.ts +6 -0
- package/dist/types/lib/components/add-metadata-template-dropdown/types.d.ts +32 -22
- package/package.json +12 -12
- package/dist/chunks/add-metadata-template-dropdown.js +0 -84
- package/dist/styles/add-metadata-template-dropdown.css +0 -1
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import e from "../esm/lib/components/add-metadata-template-dropdown/messages.js";
|
|
2
|
+
import { useIntl as t } from "react-intl";
|
|
3
|
+
import { jsx as n, jsxs as r } from "react/jsx-runtime";
|
|
4
|
+
import { IconButton as i, Popover as a } from "@box/blueprint-web";
|
|
5
|
+
import { Plus as o } from "@box/blueprint-web-assets/icons/Fill";
|
|
6
|
+
import { MetadataTemplateBrowser as s } from "@box/metadata-template-browser";
|
|
7
|
+
import '../styles/add-metadata-template-dropdown-with-browser.css';var c = { templateBrowserContainer: "_templateBrowserContainer_175dl_1" };
|
|
8
|
+
function l({ canCreateAtRoot: l = !1, enterpriseId: u, eventService: d, isLoading: f, itemsService: p, onOpenChange: m, open: h }) {
|
|
9
|
+
let g = t().formatMessage(e.addMetadataTemplatesTriggerButtonLabel);
|
|
10
|
+
return /* @__PURE__ */ r(a.Root, {
|
|
11
|
+
onOpenChange: m,
|
|
12
|
+
open: h,
|
|
13
|
+
children: [/* @__PURE__ */ n(a.Trigger, { children: /* @__PURE__ */ n(i, {
|
|
14
|
+
"aria-label": g,
|
|
15
|
+
icon: o,
|
|
16
|
+
size: "x-small",
|
|
17
|
+
"data-target-id": "IconButton-addMetadataTemplatesTriggerButtonLabel"
|
|
18
|
+
}) }), /* @__PURE__ */ n(a.ContentContainer, {
|
|
19
|
+
align: "end",
|
|
20
|
+
"aria-label": g,
|
|
21
|
+
children: /* @__PURE__ */ n("div", {
|
|
22
|
+
className: c.templateBrowserContainer,
|
|
23
|
+
children: /* @__PURE__ */ n(s, {
|
|
24
|
+
canCreateAtRoot: l,
|
|
25
|
+
enterpriseId: u,
|
|
26
|
+
eventService: d,
|
|
27
|
+
isDisabled: f,
|
|
28
|
+
itemsService: p
|
|
29
|
+
})
|
|
30
|
+
})
|
|
31
|
+
})]
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
export { l as t };
|
|
@@ -4,19 +4,19 @@ import { n } from "./types.js";
|
|
|
4
4
|
import { t as r } from "./field-action-bar.module.js";
|
|
5
5
|
import i from "../esm/lib/components/metadata-editor-fields/components/ai-suggestion-field/messages.js";
|
|
6
6
|
import { formatSuggestionValue as a } from "../esm/lib/components/metadata-editor-fields/components/ai-suggestion-field/utils.js";
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import
|
|
11
|
-
import {
|
|
12
|
-
import y from "
|
|
7
|
+
import { useEffect as o, useRef as s } from "react";
|
|
8
|
+
import { FormattedMessage as c, useIntl as l } from "react-intl";
|
|
9
|
+
import { Fragment as u, jsx as d, jsxs as f } from "react/jsx-runtime";
|
|
10
|
+
import p from "clsx";
|
|
11
|
+
import { DropdownMenu as m, IconButton as h, Text as g, useBlueprintModernization as _ } from "@box/blueprint-web";
|
|
12
|
+
import { Checkmark as v, Ellipsis as y } from "@box/blueprint-web-assets/icons/Fill";
|
|
13
13
|
import '../styles/ai-suggestion-field.css';var b = {
|
|
14
14
|
wrapper: "_wrapper_132y2_1",
|
|
15
15
|
selectTrigger: "_selectTrigger_132y2_1"
|
|
16
16
|
};
|
|
17
17
|
function x({ aiSuggestion: x, onAiSuggestionAppend: S, onAiSuggestionReplace: C, onAiSuggestionIgnore: w, type: T, isSameValue: E, confidenceLevel: D }) {
|
|
18
|
-
let O =
|
|
19
|
-
|
|
18
|
+
let O = l(), { enableModernizedComponents: k } = _(), { trackEvent: A } = t(), j = s(!1);
|
|
19
|
+
o(() => {
|
|
20
20
|
j.current || x == null || !A || (j.current = !0, A(e.AI_SUGGESTION_SHOWN, {
|
|
21
21
|
fieldType: T,
|
|
22
22
|
confidenceLevel: D,
|
|
@@ -30,67 +30,67 @@ function x({ aiSuggestion: x, onAiSuggestionAppend: S, onAiSuggestionReplace: C,
|
|
|
30
30
|
A
|
|
31
31
|
]);
|
|
32
32
|
let M = D === n.High ? i.confidenceLevelHigh : i.confidenceLevelLow, N = D ? O.formatMessage(M) : void 0;
|
|
33
|
-
return /* @__PURE__ */
|
|
33
|
+
return /* @__PURE__ */ d("div", {
|
|
34
34
|
className: r.wrapperGradient,
|
|
35
35
|
"data-modern": k,
|
|
36
|
-
children: /* @__PURE__ */
|
|
37
|
-
className:
|
|
38
|
-
children: E ? /* @__PURE__ */
|
|
36
|
+
children: /* @__PURE__ */ d("div", {
|
|
37
|
+
className: p(r.wrapper, b.wrapper),
|
|
38
|
+
children: E ? /* @__PURE__ */ f(u, { children: [/* @__PURE__ */ d(g, {
|
|
39
39
|
as: "p",
|
|
40
40
|
color: "textOnLightSecondary",
|
|
41
41
|
variant: "caption",
|
|
42
42
|
children: D ? O.formatMessage(i.sameValueAiSuggestionCaptionWithLevel, { level: N }) : O.formatMessage(i.sameValueAiSuggestionCaption)
|
|
43
|
-
}), /* @__PURE__ */
|
|
43
|
+
}), /* @__PURE__ */ d("div", {
|
|
44
44
|
className: r.buttons,
|
|
45
|
-
children: /* @__PURE__ */
|
|
45
|
+
children: /* @__PURE__ */ d(h, {
|
|
46
46
|
"aria-label": D ? O.formatMessage(i.aiSuggestionAccept) : O.formatMessage(i.aiSuggestionConfirm),
|
|
47
47
|
"data-target-id": D ? "IconButton-aiSuggestionAccept" : "IconButton-aiSuggestionConfirmSame",
|
|
48
|
-
icon:
|
|
48
|
+
icon: v,
|
|
49
49
|
onClick: D ? C : w,
|
|
50
50
|
size: "x-small"
|
|
51
51
|
})
|
|
52
|
-
})] }) : /* @__PURE__ */
|
|
52
|
+
})] }) : /* @__PURE__ */ f(u, { children: [/* @__PURE__ */ f("div", { children: [/* @__PURE__ */ d(g, {
|
|
53
53
|
as: "p",
|
|
54
54
|
color: "textOnLightSecondary",
|
|
55
55
|
variant: "caption",
|
|
56
56
|
children: D ? O.formatMessage(i.aiSuggestionCaptionWithLevel, { level: N }) : O.formatMessage(i.aiSuggestionCaption)
|
|
57
|
-
}), /* @__PURE__ */
|
|
57
|
+
}), /* @__PURE__ */ d(g, {
|
|
58
58
|
as: "p",
|
|
59
59
|
children: a(x, {
|
|
60
60
|
type: T,
|
|
61
61
|
locale: O.locale
|
|
62
62
|
})
|
|
63
|
-
})] }), /* @__PURE__ */
|
|
63
|
+
})] }), /* @__PURE__ */ f("div", {
|
|
64
64
|
className: r.buttons,
|
|
65
|
-
children: [/* @__PURE__ */
|
|
65
|
+
children: [/* @__PURE__ */ d(h, {
|
|
66
66
|
"aria-label": O.formatMessage(T === "multiSelect" ? i.aiSuggestionAppend : i.aiSuggestionClearAndReplace),
|
|
67
67
|
"data-target-id": T === "multiSelect" ? "IconButton-aiSuggestionAppend" : "IconButton-aiSuggestionClearAndReplace",
|
|
68
|
-
icon:
|
|
68
|
+
icon: v,
|
|
69
69
|
onClick: T === "multiSelect" ? S : C,
|
|
70
70
|
size: "x-small"
|
|
71
|
-
}), /* @__PURE__ */
|
|
71
|
+
}), /* @__PURE__ */ f(m.Root, { children: [/* @__PURE__ */ d(m.Trigger, {
|
|
72
72
|
className: b.selectTrigger,
|
|
73
|
-
children: /* @__PURE__ */
|
|
73
|
+
children: /* @__PURE__ */ d(h, {
|
|
74
74
|
"aria-label": O.formatMessage(i.aiSuggestionOptions),
|
|
75
75
|
"data-target-id": "IconButton-aiSuggestionOptions",
|
|
76
|
-
icon:
|
|
76
|
+
icon: y
|
|
77
77
|
})
|
|
78
|
-
}), /* @__PURE__ */
|
|
79
|
-
T === "multiSelect" && /* @__PURE__ */
|
|
78
|
+
}), /* @__PURE__ */ f(m.Content, { children: [
|
|
79
|
+
T === "multiSelect" && /* @__PURE__ */ d(m.Item, {
|
|
80
80
|
"data-target-id": "DropdownMenu.Item-aiSuggestionAppend",
|
|
81
81
|
onSelect: S,
|
|
82
|
-
children: /* @__PURE__ */
|
|
82
|
+
children: /* @__PURE__ */ d(c, { ...i.aiSuggestionAppend })
|
|
83
83
|
}),
|
|
84
|
-
/* @__PURE__ */
|
|
84
|
+
/* @__PURE__ */ d(m.Item, {
|
|
85
85
|
"data-target-id": "DropdownMenu.Item-metadataAiSuggestionClearAndReplace",
|
|
86
86
|
onSelect: C,
|
|
87
|
-
children: /* @__PURE__ */
|
|
87
|
+
children: /* @__PURE__ */ d(c, { ...i.aiSuggestionClearAndReplace })
|
|
88
88
|
}),
|
|
89
|
-
/* @__PURE__ */
|
|
90
|
-
/* @__PURE__ */
|
|
89
|
+
/* @__PURE__ */ d(m.Separator, {}),
|
|
90
|
+
/* @__PURE__ */ d(m.Item, {
|
|
91
91
|
"data-target-id": "DropdownMenu.Item-metadataAiSuggestionIgnore",
|
|
92
92
|
onSelect: w,
|
|
93
|
-
children: /* @__PURE__ */
|
|
93
|
+
children: /* @__PURE__ */ d(c, { ...i.aiSuggestionIgnore })
|
|
94
94
|
})
|
|
95
95
|
] })] })]
|
|
96
96
|
})] })
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { EXTRACT_AI_AGENT_LOCAL_STORAGE_KEY as e } from "../esm/lib/constants.js";
|
|
2
2
|
import t from "../esm/lib/components/metadata-instance-editor/subcomponents/autofill-overlay/messages.js";
|
|
3
3
|
import { useErrorMessaging as n } from "../esm/lib/components/metadata-instance-editor/subcomponents/autofill-overlay/useErrorMessaging.js";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import
|
|
8
|
-
import u from "
|
|
4
|
+
import { useState as 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 { LoadingIndicator as c, Text as l, TextButton as u } from "@box/blueprint-web";
|
|
9
9
|
import { Size5 as d, SurfaceStatusSurfaceError as f } from "@box/blueprint-web-assets/tokens/tokens";
|
|
10
10
|
import { AlertTriangle as p } from "@box/blueprint-web-assets/icons/Line";
|
|
11
11
|
import '../styles/autofill-overlay.css';var m = {
|
|
@@ -17,41 +17,41 @@ import '../styles/autofill-overlay.css';var m = {
|
|
|
17
17
|
overlayIcon: "_overlayIcon_16p2j_29",
|
|
18
18
|
testContainerStyle: "_testContainerStyle_16p2j_35"
|
|
19
19
|
}, h = ({ errorCode: h, isFetchingSuggestions: g, isLongLoading: _ }) => {
|
|
20
|
-
let v =
|
|
20
|
+
let v = i(), [y, b] = r(!1), x = n(h), S = v.formatMessage(t.defaultLoadingMessage);
|
|
21
21
|
h && (S = x.title);
|
|
22
22
|
let C = localStorage.getItem(e);
|
|
23
23
|
_ && C === "standard" && (S = v.formatMessage(t.longLoadingTitle));
|
|
24
24
|
let w = _ && C === "standard" ? v.formatMessage(t.longLoadingDescription) : h && x.description;
|
|
25
|
-
return !g && !h || y ? null : /* @__PURE__ */
|
|
26
|
-
className:
|
|
25
|
+
return !g && !h || y ? null : /* @__PURE__ */ o("div", {
|
|
26
|
+
className: s(m.autofillOverlay, h && m.withError),
|
|
27
27
|
children: [
|
|
28
|
-
h ? /* @__PURE__ */
|
|
28
|
+
h ? /* @__PURE__ */ a(p, {
|
|
29
29
|
className: m.overlayIcon,
|
|
30
30
|
color: f,
|
|
31
31
|
height: d,
|
|
32
32
|
role: "presentation",
|
|
33
33
|
width: d
|
|
34
|
-
}) : /* @__PURE__ */ c
|
|
34
|
+
}) : /* @__PURE__ */ a(c, {
|
|
35
35
|
"aria-label": v.formatMessage(t.loadingAriaLabel),
|
|
36
36
|
"aria-live": "polite",
|
|
37
37
|
className: m.overlayIcon,
|
|
38
38
|
size: "large",
|
|
39
39
|
variant: "default"
|
|
40
40
|
}),
|
|
41
|
-
/* @__PURE__ */
|
|
41
|
+
/* @__PURE__ */ a(l, {
|
|
42
42
|
as: "p",
|
|
43
43
|
className: m.autofillOverlayTitle,
|
|
44
44
|
variant: "subtitle",
|
|
45
45
|
children: S
|
|
46
46
|
}),
|
|
47
|
-
w && /* @__PURE__ */
|
|
47
|
+
w && /* @__PURE__ */ a(l, {
|
|
48
48
|
as: "p",
|
|
49
49
|
className: m.autofillOverlayDescription,
|
|
50
50
|
color: "textOnLightSecondary",
|
|
51
51
|
variant: "bodyDefault",
|
|
52
52
|
children: w
|
|
53
53
|
}),
|
|
54
|
-
h && /* @__PURE__ */
|
|
54
|
+
h && /* @__PURE__ */ a(u, {
|
|
55
55
|
className: m.dismissButton,
|
|
56
56
|
onClick: () => b(!0),
|
|
57
57
|
"data-target-id": "TextButton-dismissButton",
|
|
@@ -2,13 +2,13 @@ import e from "../esm/lib/components/combobox-with-api-pagination/messages.js";
|
|
|
2
2
|
import { useAsyncList as t } from "../esm/lib/components/combobox-with-api-pagination/use-async-list.js";
|
|
3
3
|
import { useControllableState as n } from "../esm/lib/components/combobox-with-api-pagination/utils/use-controllable-state.js";
|
|
4
4
|
import { useTrackVisibility as r } from "../esm/lib/components/combobox-with-api-pagination/utils/use-intersection-observer.js";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import
|
|
10
|
-
import {
|
|
11
|
-
import S from "
|
|
5
|
+
import { forwardRef as i, useCallback as a, useEffect as o, useMemo as s, useRef as c } from "react";
|
|
6
|
+
import { FormattedMessage as l, useIntl as u } from "react-intl";
|
|
7
|
+
import { ComboboxItemValue as d } from "@ariakit/react";
|
|
8
|
+
import { Fragment as f, jsx as p, jsxs as m } from "react/jsx-runtime";
|
|
9
|
+
import h from "clsx";
|
|
10
|
+
import { Combobox as g, InlineNotice as _, LoadingIndicator as v, Text as y, useForkRef as b } from "@box/blueprint-web";
|
|
11
|
+
import { Loader as x, Search as S } from "@box/blueprint-web-assets/icons/Fill";
|
|
12
12
|
import { IconIconOnLightSecondary as C, Size1 as w, Size6 as T } from "@box/blueprint-web-assets/tokens/tokens";
|
|
13
13
|
import '../styles/combobox-with-api-pagination.css';var E = {
|
|
14
14
|
container: "_container_ks7iw_27",
|
|
@@ -18,29 +18,29 @@ import '../styles/combobox-with-api-pagination.css';var E = {
|
|
|
18
18
|
option: "_option_ks7iw_60",
|
|
19
19
|
errorComboboxOption: "_errorComboboxOption_ks7iw_64",
|
|
20
20
|
errorComboboxOptionText: "_errorComboboxOptionText_ks7iw_69"
|
|
21
|
-
}, D = /*#__PURE__*/
|
|
22
|
-
let { formatMessage: r } =
|
|
23
|
-
return /* @__PURE__ */
|
|
21
|
+
}, D = /*#__PURE__*/ i(({ onTryAgain: t }, n) => {
|
|
22
|
+
let { formatMessage: r } = u();
|
|
23
|
+
return /* @__PURE__ */ m(f, { children: [/* @__PURE__ */ p(_, {
|
|
24
24
|
variant: "error",
|
|
25
25
|
variantIconAriaLabel: r(e.loadingResultsErrorIconLabel),
|
|
26
|
-
children: /* @__PURE__ */
|
|
27
|
-
}), /* @__PURE__ */
|
|
26
|
+
children: /* @__PURE__ */ p(l, { ...e.loadingResultsErrorMessage })
|
|
27
|
+
}), /* @__PURE__ */ p(g.Option, {
|
|
28
28
|
ref: n,
|
|
29
29
|
className: E.errorComboboxOption,
|
|
30
30
|
onClick: t,
|
|
31
|
-
children: /* @__PURE__ */
|
|
31
|
+
children: /* @__PURE__ */ m(y, {
|
|
32
32
|
as: "span",
|
|
33
33
|
className: E.errorComboboxOptionText,
|
|
34
34
|
color: "textOnLightLink",
|
|
35
35
|
variant: "bodyDefaultBold",
|
|
36
|
-
children: [/* @__PURE__ */
|
|
36
|
+
children: [/* @__PURE__ */ p(l, { ...e.loadingResultsErrorAction }), /* @__PURE__ */ p(x, {
|
|
37
37
|
color: "currentColor",
|
|
38
38
|
height: "12px",
|
|
39
39
|
width: "12px"
|
|
40
40
|
})]
|
|
41
41
|
})
|
|
42
42
|
})] });
|
|
43
|
-
}), O = "__LOADING__", k = "__LOADING_ERROR__", A = "0px 0px 20px 0px", j = /* @__PURE__ */
|
|
43
|
+
}), O = "__LOADING__", k = "__LOADING_ERROR__", A = "0px 0px 20px 0px", j = /* @__PURE__ */ p(S, {
|
|
44
44
|
color: C,
|
|
45
45
|
height: T,
|
|
46
46
|
role: "presentation",
|
|
@@ -49,9 +49,9 @@ import '../styles/combobox-with-api-pagination.css';var E = {
|
|
|
49
49
|
boxSizing: "border-box"
|
|
50
50
|
},
|
|
51
51
|
width: T
|
|
52
|
-
}), M = /*#__PURE__*/
|
|
53
|
-
let { defaultFetcher:
|
|
54
|
-
let r = await
|
|
52
|
+
}), M = /*#__PURE__*/ i(function(i, l) {
|
|
53
|
+
let { defaultFetcher: f, onInputValueChange: m, value: _, onValueChange: y, noResultMessage: x, defaultValue: S = [], loadingAriaLabel: C, multiselect: w = !1, disabled: T, className: M, displaySingleSelectionAsChip: N = !0, ...P } = i, { formatMessage: F } = u(), I = c(null), L = c(!0), R = t({ async load({ marker: e, searchInput: t, signal: n }) {
|
|
54
|
+
let r = await f({
|
|
55
55
|
signal: n,
|
|
56
56
|
marker: e,
|
|
57
57
|
searchInput: t
|
|
@@ -60,42 +60,42 @@ import '../styles/combobox-with-api-pagination.css';var E = {
|
|
|
60
60
|
items: r.options,
|
|
61
61
|
marker: r.marker
|
|
62
62
|
};
|
|
63
|
-
} }), z =
|
|
63
|
+
} }), z = c(!1), B = a(() => {
|
|
64
64
|
z.current ||= (R.reload(), !0);
|
|
65
65
|
}, []), [V, H] = n({
|
|
66
|
-
prop:
|
|
67
|
-
defaultProp:
|
|
68
|
-
onChange:
|
|
66
|
+
prop: _,
|
|
67
|
+
defaultProp: S,
|
|
68
|
+
onChange: y
|
|
69
69
|
}), U = !w && V.length === 1, W = (e) => {
|
|
70
70
|
e === void 0 ? (H([]), (!L.current || !N) && (R.search(""), L.current = !0)) : H(Array.isArray(e) ? e : [e]);
|
|
71
|
-
}, G =
|
|
72
|
-
let { value: n, displayValue: r, ...
|
|
73
|
-
if (n === O) return R.hasNextPage ? /* @__PURE__ */
|
|
74
|
-
...
|
|
71
|
+
}, G = s(() => V.length === 0 ? w ? [] : void 0 : w ? V : V[0], [w, V]), K = s(() => V.filter((e) => !R.items.some((t) => t.value === e.value)), [V, R.items]), q = (t) => {
|
|
72
|
+
let { value: n, displayValue: r, ...i } = t;
|
|
73
|
+
if (n === O) return R.hasNextPage ? /* @__PURE__ */ p(g.Option, {
|
|
74
|
+
...i,
|
|
75
75
|
ref: Z,
|
|
76
76
|
disabled: !0,
|
|
77
77
|
value: n,
|
|
78
|
-
children: /* @__PURE__ */
|
|
78
|
+
children: /* @__PURE__ */ p(v, {
|
|
79
79
|
"aria-label": F(e.loadingMoreAriaLabel),
|
|
80
80
|
style: { position: "unset" }
|
|
81
81
|
})
|
|
82
82
|
}) : null;
|
|
83
|
-
if (n === k && R.hasError && !R.isEmpty) return /* @__PURE__ */
|
|
83
|
+
if (n === k && R.hasError && !R.isEmpty) return /* @__PURE__ */ p(D, { onTryAgain: () => {
|
|
84
84
|
R.loadMore(), I.current?.focus();
|
|
85
85
|
} });
|
|
86
86
|
if (K.some((e) => e.value === n)) return null;
|
|
87
|
-
let
|
|
88
|
-
return /* @__PURE__ */
|
|
89
|
-
...
|
|
87
|
+
let a = V.some((e) => e.value === n);
|
|
88
|
+
return /* @__PURE__ */ p(g.Option, {
|
|
89
|
+
...i,
|
|
90
90
|
className: E.option,
|
|
91
91
|
value: n,
|
|
92
|
-
children: /* @__PURE__ */
|
|
93
|
-
className:
|
|
92
|
+
children: /* @__PURE__ */ p(d, {
|
|
93
|
+
className: h(E.highlightOptionText, a && E.selected),
|
|
94
94
|
value: r || n
|
|
95
95
|
})
|
|
96
96
|
});
|
|
97
97
|
}, J = (e) => {
|
|
98
|
-
if (
|
|
98
|
+
if (m?.(e), U && e === "") {
|
|
99
99
|
L.current = !1;
|
|
100
100
|
return;
|
|
101
101
|
}
|
|
@@ -103,9 +103,9 @@ import '../styles/combobox-with-api-pagination.css';var E = {
|
|
|
103
103
|
}, Y = () => {
|
|
104
104
|
R.reload(), I.current?.focus();
|
|
105
105
|
}, X;
|
|
106
|
-
X = R.hasError && !R.isLoading ? /* @__PURE__ */
|
|
106
|
+
X = R.hasError && !R.isLoading ? /* @__PURE__ */ p(D, { onTryAgain: Y }) : R.isEmpty && !R.isLoading ? x || F(e.noResults) : void 0;
|
|
107
107
|
let [Z, { rootRef: Q, isVisible: $ }] = r({ rootMargin: A });
|
|
108
|
-
|
|
108
|
+
o(() => {
|
|
109
109
|
if (!($ && R.hasNextPage)) return;
|
|
110
110
|
let e = setTimeout(() => {
|
|
111
111
|
R.loadMore();
|
|
@@ -114,7 +114,7 @@ import '../styles/combobox-with-api-pagination.css';var E = {
|
|
|
114
114
|
clearTimeout(e);
|
|
115
115
|
};
|
|
116
116
|
}, [$]);
|
|
117
|
-
let ee =
|
|
117
|
+
let ee = s(() => {
|
|
118
118
|
let e = R.hasNextPage ? {
|
|
119
119
|
displayValue: O,
|
|
120
120
|
value: O
|
|
@@ -135,11 +135,11 @@ import '../styles/combobox-with-api-pagination.css';var E = {
|
|
|
135
135
|
R.items,
|
|
136
136
|
K
|
|
137
137
|
]);
|
|
138
|
-
return /* @__PURE__ */
|
|
138
|
+
return /* @__PURE__ */ p(g, {
|
|
139
139
|
as: "input",
|
|
140
140
|
...P,
|
|
141
|
-
ref:
|
|
142
|
-
className:
|
|
141
|
+
ref: b(I, l),
|
|
142
|
+
className: h({ [E.disabled]: U }, M),
|
|
143
143
|
clearButtonAriaLabel: F(e.clearButtonAriaLabel),
|
|
144
144
|
disabled: T || U,
|
|
145
145
|
displaySingleSelectionAsChip: N,
|
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
import e from "../esm/lib/components/metadata-instance-editor/subcomponents/custom-instance-new-field/messages.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
2
|
+
import { useState as t } from "react";
|
|
3
|
+
import { useIntl as n } from "react-intl";
|
|
4
|
+
import { jsx as r, jsxs as i } from "react/jsx-runtime";
|
|
5
|
+
import { Button as a, Card as o, TextInput as s } from "@box/blueprint-web";
|
|
6
6
|
import '../styles/custom-instance-new-field.css';var c = {
|
|
7
7
|
customInstanceNewFieldCard: "_customInstanceNewFieldCard_fcftk_1",
|
|
8
8
|
customInstanceNewFieldFooter: "_customInstanceNewFieldFooter_fcftk_6",
|
|
9
9
|
inputWrapper: "_inputWrapper_fcftk_13"
|
|
10
10
|
}, l = (l) => {
|
|
11
|
-
let { onAdd: u, onCancel: d, formKeys: f = [] } = l, p =
|
|
11
|
+
let { onAdd: u, onCancel: d, formKeys: f = [] } = l, p = n(), [m, h] = t(""), [g, _] = t(""), [v, y] = t(""), b = f.length !== 0, x = (e) => {
|
|
12
12
|
h(e), v && y("");
|
|
13
13
|
};
|
|
14
|
-
return /* @__PURE__ */
|
|
14
|
+
return /* @__PURE__ */ i(o, {
|
|
15
15
|
"aria-label": p.formatMessage(e.addAttributeGroupAriaLabel),
|
|
16
16
|
className: c.customInstanceNewFieldCard,
|
|
17
17
|
"data-testid": "customInstanceNewField",
|
|
18
18
|
role: "group",
|
|
19
19
|
children: [
|
|
20
|
-
/* @__PURE__ */
|
|
20
|
+
/* @__PURE__ */ r("div", {
|
|
21
21
|
className: c.inputWrapper,
|
|
22
|
-
children: /* @__PURE__ */
|
|
22
|
+
children: /* @__PURE__ */ r(s, {
|
|
23
23
|
autoFocus: !0,
|
|
24
24
|
error: v,
|
|
25
25
|
label: p.formatMessage(e.customKeyLabel),
|
|
@@ -29,23 +29,23 @@ import '../styles/custom-instance-new-field.css';var c = {
|
|
|
29
29
|
value: m
|
|
30
30
|
})
|
|
31
31
|
}),
|
|
32
|
-
/* @__PURE__ */
|
|
32
|
+
/* @__PURE__ */ r("div", {
|
|
33
33
|
className: c.inputWrapper,
|
|
34
|
-
children: /* @__PURE__ */
|
|
34
|
+
children: /* @__PURE__ */ r(s, {
|
|
35
35
|
label: p.formatMessage(e.valueLabel),
|
|
36
36
|
onChange: (e) => _(e.target.value),
|
|
37
37
|
placeholder: p.formatMessage(e.valuePlaceholder),
|
|
38
38
|
value: g
|
|
39
39
|
})
|
|
40
40
|
}),
|
|
41
|
-
/* @__PURE__ */
|
|
41
|
+
/* @__PURE__ */ i("div", {
|
|
42
42
|
className: c.customInstanceNewFieldFooter,
|
|
43
|
-
children: [b && /* @__PURE__ */
|
|
43
|
+
children: [b && /* @__PURE__ */ r(a, {
|
|
44
44
|
onClick: d,
|
|
45
45
|
variant: "secondary",
|
|
46
46
|
"data-target-id": "Button-cancelCTA",
|
|
47
47
|
children: p.formatMessage(e.cancelCTA)
|
|
48
|
-
}), /* @__PURE__ */
|
|
48
|
+
}), /* @__PURE__ */ r(a, {
|
|
49
49
|
onClick: () => {
|
|
50
50
|
m ? m.startsWith("$") ? y(p.formatMessage(e.customErrorInternalKey)) : f.includes(m) ? y(p.formatMessage(e.customErrorDuplicateKey)) : u(m, g) : y(p.formatMessage(e.keyFieldRequiredError));
|
|
51
51
|
},
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { t as e } from "./custom-instance-new-field.js";
|
|
2
2
|
import t from "../esm/lib/components/metadata-instance-editor/subcomponents/custom-instance/messages.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
3
|
+
import { useEffect as n, useRef as r, useState as i } from "react";
|
|
4
|
+
import { useIntl as a } from "react-intl";
|
|
5
|
+
import { jsx as o, jsxs as s } from "react/jsx-runtime";
|
|
6
|
+
import { IconButton as c, TextButton as l, TextInput as u } from "@box/blueprint-web";
|
|
7
7
|
import { Field as d, FieldArray as f, useFormikContext as p } from "formik";
|
|
8
8
|
import { Trash as m } from "@box/blueprint-web-assets/icons/Line";
|
|
9
9
|
import '../styles/custom-instance.css';var h = {
|
|
@@ -12,56 +12,56 @@ import '../styles/custom-instance.css';var h = {
|
|
|
12
12
|
customInstanceFieldInput: "_customInstanceFieldInput_xq8r7_12",
|
|
13
13
|
customInstanceFieldIcon: "_customInstanceFieldIcon_xq8r7_16"
|
|
14
14
|
}, g = (g) => {
|
|
15
|
-
let { isLoading: _ } = g, { values: v } = p(), y =
|
|
15
|
+
let { isLoading: _ } = g, { values: v } = p(), y = a(), [b, x] = i(!v.metadata.fields.length), [S, C] = i(0), w = () => {
|
|
16
16
|
C(v.metadata.fields.length);
|
|
17
17
|
}, T = (e) => {
|
|
18
18
|
C(e === 0 ? 0 : e - 1);
|
|
19
|
-
}, E =
|
|
20
|
-
return
|
|
19
|
+
}, E = r(null);
|
|
20
|
+
return n(() => {
|
|
21
21
|
v.metadata.fields.length > 0 ? E.current.focus() : x(!0);
|
|
22
|
-
}, [S, v.metadata.fields.length]), /* @__PURE__ */
|
|
22
|
+
}, [S, v.metadata.fields.length]), /* @__PURE__ */ o("div", { children: /* @__PURE__ */ o(f, {
|
|
23
23
|
name: "metadata.fields",
|
|
24
|
-
children: ({ remove:
|
|
24
|
+
children: ({ remove: n, push: r }) => /* @__PURE__ */ s("div", {
|
|
25
25
|
className: h.customInstance,
|
|
26
26
|
children: [
|
|
27
|
-
v?.metadata.fields.map((e, r) => /* @__PURE__ */
|
|
27
|
+
v?.metadata.fields.map((e, r) => /* @__PURE__ */ s("div", {
|
|
28
28
|
className: h.customInstanceField,
|
|
29
|
-
children: [/* @__PURE__ */
|
|
29
|
+
children: [/* @__PURE__ */ o("div", {
|
|
30
30
|
className: h.customInstanceFieldInput,
|
|
31
|
-
children: /* @__PURE__ */
|
|
31
|
+
children: /* @__PURE__ */ o(d, {
|
|
32
32
|
name: `metadata.fields[${r}].value`,
|
|
33
|
-
children: ({ field: n, meta:
|
|
33
|
+
children: ({ field: n, meta: i }) => /* @__PURE__ */ o(u, {
|
|
34
34
|
...n,
|
|
35
35
|
ref: r === S ? E : null,
|
|
36
36
|
disabled: _,
|
|
37
|
-
error:
|
|
37
|
+
error: i.error,
|
|
38
38
|
label: e.key,
|
|
39
39
|
placeholder: y.formatMessage(t.setValuePlaceholder)
|
|
40
40
|
})
|
|
41
41
|
})
|
|
42
|
-
}), /* @__PURE__ */
|
|
42
|
+
}), /* @__PURE__ */ o(c, {
|
|
43
43
|
"aria-label": y.formatMessage(t.removeAttribute, { fieldName: e.key }),
|
|
44
44
|
className: h.customInstanceFieldIcon,
|
|
45
45
|
disabled: _,
|
|
46
46
|
icon: m,
|
|
47
47
|
onClick: () => {
|
|
48
|
-
|
|
48
|
+
n(r), T(r);
|
|
49
49
|
},
|
|
50
50
|
size: "x-small",
|
|
51
51
|
"data-target-id": "IconButton-removeAttribute"
|
|
52
52
|
})]
|
|
53
53
|
}, e.key)),
|
|
54
|
-
b && /* @__PURE__ */
|
|
54
|
+
b && /* @__PURE__ */ o(e, {
|
|
55
55
|
formKeys: v.metadata.fields.map((e) => e.key),
|
|
56
56
|
onAdd: (e, t) => {
|
|
57
|
-
|
|
57
|
+
r({
|
|
58
58
|
key: e,
|
|
59
59
|
value: t
|
|
60
60
|
}), w(), x(!1);
|
|
61
61
|
},
|
|
62
62
|
onCancel: () => x(!1)
|
|
63
63
|
}),
|
|
64
|
-
!b && /* @__PURE__ */ l
|
|
64
|
+
!b && /* @__PURE__ */ o(l, {
|
|
65
65
|
disabled: _,
|
|
66
66
|
onClick: () => x(!0),
|
|
67
67
|
"data-target-id": "TextButton-addAttribute",
|
|
@@ -1,54 +1,54 @@
|
|
|
1
1
|
import e from "../esm/lib/components/metadata-instance-editor/subcomponents/delete-confirmation-modal/messages.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
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 { Checkbox as o, Modal as s, Text as c, TextInput as l } from "@box/blueprint-web";
|
|
6
6
|
import '../styles/delete-confirmation-modal.css';var u = { modalBody: "_modalBody_1wc7x_1" }, d = ({ onConfirm: d, templateName: f, onDismiss: p, open: m, isCheckboxEnabled: h }) => {
|
|
7
|
-
let g =
|
|
7
|
+
let g = r(), [_, v] = t(""), [y, b] = t(!1), x = (e) => {
|
|
8
8
|
e || (p(), v(""), b(!1));
|
|
9
9
|
}, S = f || g.formatMessage(e.deleteConfirmationModalCustomMetadata), C = _ === S, w = () => {
|
|
10
10
|
b(!y);
|
|
11
11
|
}, T = () => {
|
|
12
12
|
d(), x(!1);
|
|
13
13
|
};
|
|
14
|
-
return /* @__PURE__ */
|
|
14
|
+
return /* @__PURE__ */ i(s, {
|
|
15
15
|
onOpenChange: x,
|
|
16
16
|
open: m,
|
|
17
|
-
children: /* @__PURE__ */
|
|
17
|
+
children: /* @__PURE__ */ a(s.Content, {
|
|
18
18
|
onEscapeKeyDown: (e) => e.stopPropagation(),
|
|
19
19
|
size: "small",
|
|
20
20
|
children: [
|
|
21
|
-
/* @__PURE__ */
|
|
21
|
+
/* @__PURE__ */ i(s.Header, {
|
|
22
22
|
"aria-label": g.formatMessage(e.deleteConfirmationModalHeaderAriaLabel),
|
|
23
|
-
children: /* @__PURE__ */
|
|
23
|
+
children: /* @__PURE__ */ i(n, {
|
|
24
24
|
...e.deleteConfirmationModalHeader,
|
|
25
25
|
values: { templateName: S }
|
|
26
26
|
})
|
|
27
27
|
}),
|
|
28
|
-
/* @__PURE__ */
|
|
28
|
+
/* @__PURE__ */ i(s.ScrollableContainer, { children: /* @__PURE__ */ a(s.Body, {
|
|
29
29
|
className: u.modalBody,
|
|
30
30
|
children: [
|
|
31
|
-
/* @__PURE__ */ c
|
|
31
|
+
/* @__PURE__ */ i(c, {
|
|
32
32
|
as: "p",
|
|
33
|
-
children: h ? /* @__PURE__ */
|
|
33
|
+
children: h ? /* @__PURE__ */ i(n, {
|
|
34
34
|
...e.deleteConfirmationModalBodyFirstParagraphCheckboxVersion,
|
|
35
35
|
values: { templateName: S }
|
|
36
|
-
}) : /* @__PURE__ */
|
|
36
|
+
}) : /* @__PURE__ */ i(n, {
|
|
37
37
|
...e.deleteConfirmationModalBodyFirstParagraph,
|
|
38
38
|
values: { templateName: S }
|
|
39
39
|
})
|
|
40
40
|
}),
|
|
41
|
-
!h && /* @__PURE__ */ c
|
|
41
|
+
!h && /* @__PURE__ */ i(c, {
|
|
42
42
|
as: "p",
|
|
43
|
-
children: /* @__PURE__ */
|
|
43
|
+
children: /* @__PURE__ */ i(n, { ...e.deleteConfirmationModalBodySecondParagraph })
|
|
44
44
|
}),
|
|
45
|
-
h ? /* @__PURE__ */
|
|
45
|
+
h ? /* @__PURE__ */ i(o.Item, {
|
|
46
46
|
checked: y,
|
|
47
47
|
"data-resin-target": "checkbox",
|
|
48
48
|
label: g.formatMessage(e.deleteConfirmationModalBodyCheckboxLabel),
|
|
49
49
|
onCheckedChange: w,
|
|
50
50
|
value: "overageCheckbox"
|
|
51
|
-
}) : /* @__PURE__ */
|
|
51
|
+
}) : /* @__PURE__ */ i(l, {
|
|
52
52
|
label: g.formatMessage(e.deleteConfirmationModalBodyInputFieldLabel),
|
|
53
53
|
onChange: (e) => v(e.target.value),
|
|
54
54
|
placeholder: S,
|
|
@@ -57,18 +57,18 @@ import '../styles/delete-confirmation-modal.css';var u = { modalBody: "_modalBod
|
|
|
57
57
|
})
|
|
58
58
|
]
|
|
59
59
|
}) }),
|
|
60
|
-
/* @__PURE__ */
|
|
60
|
+
/* @__PURE__ */ a(s.Footer, { children: [/* @__PURE__ */ i(s.Footer.SecondaryButton, {
|
|
61
61
|
onClick: () => x(!1),
|
|
62
62
|
size: "large",
|
|
63
63
|
"data-target-id": "Modal.Footer.SecondaryButton-deleteConfirmationModalCancelButton",
|
|
64
64
|
children: g.formatMessage(e.deleteConfirmationModalCancelButton)
|
|
65
|
-
}), /* @__PURE__ */
|
|
65
|
+
}), /* @__PURE__ */ i(s.Footer.PrimaryButton, {
|
|
66
66
|
disabled: h ? !y : !C,
|
|
67
67
|
onClick: T,
|
|
68
68
|
size: "large",
|
|
69
69
|
children: g.formatMessage(h ? e.deleteConfirmationModalConfirmButtonCheckboxVersion : e.deleteConfirmationModalConfirmButton)
|
|
70
70
|
})] }),
|
|
71
|
-
/* @__PURE__ */
|
|
71
|
+
/* @__PURE__ */ i(s.Close, { "aria-label": g.formatMessage(e.deleteConfirmationModalDismissButton) })
|
|
72
72
|
]
|
|
73
73
|
})
|
|
74
74
|
});
|