@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.
- package/dist/chunks/add-metadata-template-dropdown-with-browser.js +1 -34
- package/dist/chunks/ai-suggestion-field.js +1 -100
- package/dist/chunks/autofill-overlay.js +1 -63
- package/dist/chunks/combobox-with-api-pagination.js +1 -161
- package/dist/chunks/custom-instance-new-field.js +1 -60
- package/dist/chunks/custom-instance.js +1 -74
- package/dist/chunks/delete-confirmation-modal.js +1 -76
- package/dist/chunks/field-action-bar.module.js +1 -7
- package/dist/chunks/filter-dropdown-menu.module.js +1 -12
- package/dist/chunks/filter-instances-dropdown.js +1 -84
- package/dist/chunks/interactive-header-text.js +1 -19
- package/dist/chunks/interactive-text.module.js +1 -5
- package/dist/chunks/metadata-editor.js +1 -9
- package/dist/chunks/metadata-instance-content.js +1 -43
- package/dist/chunks/metadata-instance-entry.js +1 -104
- package/dist/chunks/metadata-instance-footer.js +1 -25
- package/dist/chunks/metadata-instance-form-ai-disclaimer.js +1 -28
- package/dist/chunks/metadata-instance-form-autofill-button.js +1 -113
- package/dist/chunks/metadata-instance-form-card-wrapper.js +1 -54
- package/dist/chunks/metadata-instance-form-footer.js +1 -43
- package/dist/chunks/metadata-instance-form-header.js +1 -45
- package/dist/chunks/metadata-instance-header.js +1 -52
- package/dist/chunks/metadata-instance-list.js +1 -20
- package/dist/chunks/metadata-instance.js +1 -60
- package/dist/chunks/shared-field-styles.module.js +1 -6
- package/dist/chunks/taxonomy-ancestor-status-pill.js +1 -90
- package/dist/chunks/types.js +1 -8
- package/dist/chunks/update-mode-field-wrapper.js +1 -80
- package/dist/chunks/utils.js +1 -88
- package/dist/chunks/utils2.js +1 -53
- package/dist/esm/index.js +1 -25
- package/dist/esm/lib/components/add-metadata-template-dropdown/add-metadata-template-dropdown-with-browser.js +1 -2
- package/dist/esm/lib/components/add-metadata-template-dropdown/add-metadata-template-dropdown.js +1 -24
- package/dist/esm/lib/components/add-metadata-template-dropdown/index.js +1 -3
- package/dist/esm/lib/components/add-metadata-template-dropdown/messages.js +1 -20
- package/dist/esm/lib/components/add-metadata-template-dropdown/shared/dropdown-trigger.js +1 -16
- package/dist/esm/lib/components/combobox-with-api-pagination/combobox-with-api-pagination.js +1 -2
- package/dist/esm/lib/components/combobox-with-api-pagination/index.js +1 -2
- package/dist/esm/lib/components/combobox-with-api-pagination/messages.js +1 -32
- package/dist/esm/lib/components/combobox-with-api-pagination/request.js +1 -4
- package/dist/esm/lib/components/combobox-with-api-pagination/use-async-list.js +1 -118
- package/dist/esm/lib/components/combobox-with-api-pagination/utils/is-abort-error.js +1 -11
- package/dist/esm/lib/components/combobox-with-api-pagination/utils/use-controllable-state.js +1 -35
- package/dist/esm/lib/components/combobox-with-api-pagination/utils/use-intersection-observer.js +1 -75
- package/dist/esm/lib/components/filter-dropdown-menu/filter-dropdown-menu-content.js +1 -14
- package/dist/esm/lib/components/filter-dropdown-menu/filter-dropdown-menu-empty-state.js +1 -17
- package/dist/esm/lib/components/filter-dropdown-menu/filter-dropdown-menu-item.js +1 -15
- package/dist/esm/lib/components/filter-dropdown-menu/filter-dropdown-menu-list.js +1 -17
- package/dist/esm/lib/components/filter-dropdown-menu/filter-dropdown-menu-root.js +1 -14
- package/dist/esm/lib/components/filter-dropdown-menu/filter-dropdown-menu-search.js +1 -37
- package/dist/esm/lib/components/filter-dropdown-menu/filter-dropdown-menu-trigger.js +1 -8
- package/dist/esm/lib/components/filter-dropdown-menu/index.js +1 -17
- package/dist/esm/lib/components/filter-dropdown-menu/messages.js +1 -12
- package/dist/esm/lib/components/filter-instances-dropdown/filter-instances-dropdown.js +1 -2
- package/dist/esm/lib/components/filter-instances-dropdown/index.js +1 -2
- package/dist/esm/lib/components/filter-instances-dropdown/messages.js +1 -20
- package/dist/esm/lib/components/interactive-header-text/interactive-header-text.js +1 -2
- package/dist/esm/lib/components/interactive-text/interactive-text.js +1 -18
- package/dist/esm/lib/components/metadata-editor-fields/components/ai-logo-badge/ai-logo-badge.js +1 -36
- package/dist/esm/lib/components/metadata-editor-fields/components/ai-logo-badge/index.js +1 -2
- package/dist/esm/lib/components/metadata-editor-fields/components/ai-suggestion-field/ai-suggestion-field.js +1 -2
- package/dist/esm/lib/components/metadata-editor-fields/components/ai-suggestion-field/index.js +1 -2
- package/dist/esm/lib/components/metadata-editor-fields/components/ai-suggestion-field/messages.js +1 -52
- package/dist/esm/lib/components/metadata-editor-fields/components/ai-suggestion-field/utils.js +1 -13
- package/dist/esm/lib/components/metadata-editor-fields/components/constants.js +1 -2
- package/dist/esm/lib/components/metadata-editor-fields/components/low-confidence-badge/index.js +1 -2
- package/dist/esm/lib/components/metadata-editor-fields/components/low-confidence-badge/low-confidence-badge.js +1 -24
- package/dist/esm/lib/components/metadata-editor-fields/components/low-confidence-suggestion-field/index.js +1 -2
- package/dist/esm/lib/components/metadata-editor-fields/components/low-confidence-suggestion-field/low-confidence-suggestion-field.js +1 -68
- package/dist/esm/lib/components/metadata-editor-fields/components/low-confidence-suggestion-field/messages.js +1 -32
- package/dist/esm/lib/components/metadata-editor-fields/components/metadata-date-field/metadata-date-field.js +1 -44
- package/dist/esm/lib/components/metadata-editor-fields/components/metadata-enum-field/metadata-enum-field.js +1 -48
- package/dist/esm/lib/components/metadata-editor-fields/components/metadata-float-field/metadata-float-field.js +1 -34
- package/dist/esm/lib/components/metadata-editor-fields/components/metadata-float-field/use-float-validation.js +1 -9
- package/dist/esm/lib/components/metadata-editor-fields/components/metadata-multi-select-field/metadata-multi-select-field.js +1 -41
- package/dist/esm/lib/components/metadata-editor-fields/components/metadata-string-field/metadata-string-field.js +1 -29
- package/dist/esm/lib/components/metadata-editor-fields/components/metadata-taxonomy-field/legacy-metadata-taxonomy-field.js +1 -67
- package/dist/esm/lib/components/metadata-editor-fields/components/metadata-taxonomy-field/metadata-taxonomy-field.js +1 -16
- package/dist/esm/lib/components/metadata-editor-fields/components/metadata-taxonomy-field/metadata-taxonomy-picker-field/metadata-taxonomy-picker-field.js +1 -53
- package/dist/esm/lib/components/metadata-editor-fields/components/metadata-taxonomy-field/metadata-taxonomy-picker-field/value-mapping.js +1 -30
- package/dist/esm/lib/components/metadata-editor-fields/components/update-mode-field-wrapper/messages.js +1 -32
- package/dist/esm/lib/components/metadata-editor-fields/components/update-mode-field-wrapper/mulitple-values-utils.js +1 -8
- package/dist/esm/lib/components/metadata-editor-fields/components/update-mode-field-wrapper/update-mode-field-wrapper.js +1 -2
- package/dist/esm/lib/components/metadata-editor-fields/editor-field-types.js +1 -32
- package/dist/esm/lib/components/metadata-editor-fields/hooks/use-memoized-field-label.js +1 -12
- package/dist/esm/lib/components/metadata-editor-fields/hooks/use-review-field-filter.js +1 -36
- package/dist/esm/lib/components/metadata-editor-fields/hooks/use-view-reference-tooltip.js +1 -41
- package/dist/esm/lib/components/metadata-editor-fields/messages.js +1 -12
- package/dist/esm/lib/components/metadata-editor-fields/metadata-editor-field-wrapper.js +1 -189
- package/dist/esm/lib/components/metadata-editor-fields/metadata-editor-fields.js +1 -31
- package/dist/esm/lib/components/metadata-editor-fields/utils.js +1 -2
- package/dist/esm/lib/components/metadata-empty-state/messages.js +1 -44
- package/dist/esm/lib/components/metadata-empty-state/metadata-empty-state.js +1 -47
- package/dist/esm/lib/components/metadata-instance-editor/index.js +1 -9
- package/dist/esm/lib/components/metadata-instance-editor/subcomponents/autofill-overlay/autofill-overlay.js +1 -2
- package/dist/esm/lib/components/metadata-instance-editor/subcomponents/autofill-overlay/messages.js +1 -40
- package/dist/esm/lib/components/metadata-instance-editor/subcomponents/autofill-overlay/useErrorMessaging.js +1 -23
- package/dist/esm/lib/components/metadata-instance-editor/subcomponents/custom-instance/custom-instance.js +1 -2
- package/dist/esm/lib/components/metadata-instance-editor/subcomponents/custom-instance/messages.js +1 -16
- package/dist/esm/lib/components/metadata-instance-editor/subcomponents/custom-instance-new-field/custom-instance-new-field.js +1 -2
- package/dist/esm/lib/components/metadata-instance-editor/subcomponents/custom-instance-new-field/messages.js +1 -44
- package/dist/esm/lib/components/metadata-instance-editor/subcomponents/delete-confirmation-modal/delete-confirmation-modal.js +1 -2
- package/dist/esm/lib/components/metadata-instance-editor/subcomponents/delete-confirmation-modal/messages.js +1 -52
- package/dist/esm/lib/components/metadata-instance-editor/subcomponents/metadata-instance-form/constants.js +1 -2
- package/dist/esm/lib/components/metadata-instance-editor/subcomponents/metadata-instance-form/metadata-instance-form-card-wrapper.js +1 -2
- package/dist/esm/lib/components/metadata-instance-editor/subcomponents/metadata-instance-form/metadata-instance-form.js +1 -136
- package/dist/esm/lib/components/metadata-instance-editor/subcomponents/metadata-instance-form/utils.js +1 -2
- package/dist/esm/lib/components/metadata-instance-editor/subcomponents/metadata-instance-form-ai-disclaimer/metadata-instance-form-ai-disclaimer.js +1 -2
- package/dist/esm/lib/components/metadata-instance-editor/subcomponents/metadata-instance-form-autofill-button/messages.js +1 -24
- package/dist/esm/lib/components/metadata-instance-editor/subcomponents/metadata-instance-form-autofill-button/metadata-instance-form-autofill-button.js +1 -2
- package/dist/esm/lib/components/metadata-instance-editor/subcomponents/metadata-instance-form-footer/messages.js +1 -20
- package/dist/esm/lib/components/metadata-instance-editor/subcomponents/metadata-instance-form-footer/metadata-instance-form-footer.js +1 -2
- package/dist/esm/lib/components/metadata-instance-editor/subcomponents/metadata-instance-form-header/messages.js +1 -6
- package/dist/esm/lib/components/metadata-instance-editor/subcomponents/metadata-instance-form-header/metadata-instance-form-header.js +1 -2
- package/dist/esm/lib/components/metadata-instance-editor/subcomponents/metadata-instance-form-inline-notice/messages.js +1 -20
- package/dist/esm/lib/components/metadata-instance-editor/subcomponents/metadata-instance-form-inline-notice/metadata-instance-form-inline-notice.js +1 -31
- package/dist/esm/lib/components/metadata-instance-list/index.js +1 -6
- package/dist/esm/lib/components/metadata-instance-list/metadata-instance-list.js +1 -2
- package/dist/esm/lib/components/metadata-instance-list/subcomponents/metadata-instance/metadata-instance.js +1 -2
- package/dist/esm/lib/components/metadata-instance-list/subcomponents/metadata-instance-content/metadata-instance-content.js +1 -2
- package/dist/esm/lib/components/metadata-instance-list/subcomponents/metadata-instance-entry/messages.js +1 -6
- package/dist/esm/lib/components/metadata-instance-list/subcomponents/metadata-instance-entry/metadata-entry-display.js +1 -15
- package/dist/esm/lib/components/metadata-instance-list/subcomponents/metadata-instance-entry/metadata-instance-entry.js +1 -2
- package/dist/esm/lib/components/metadata-instance-list/subcomponents/metadata-instance-entry/taxonomy-entry/messages.js +1 -24
- package/dist/esm/lib/components/metadata-instance-list/subcomponents/metadata-instance-entry/taxonomy-entry/taxonomy-ancestor-status-pill.js +1 -2
- package/dist/esm/lib/components/metadata-instance-list/subcomponents/metadata-instance-entry/taxonomy-entry/taxonomy-value.js +1 -25
- package/dist/esm/lib/components/metadata-instance-list/subcomponents/metadata-instance-footer/messages.js +1 -12
- package/dist/esm/lib/components/metadata-instance-list/subcomponents/metadata-instance-footer/metadata-instance-footer.js +1 -2
- package/dist/esm/lib/components/metadata-instance-list/subcomponents/metadata-instance-header/messages.js +1 -16
- package/dist/esm/lib/components/metadata-instance-list/subcomponents/metadata-instance-header/metadata-instance-header.js +1 -2
- package/dist/esm/lib/components/metadata-instance-review-notice/messages.js +1 -32
- package/dist/esm/lib/components/metadata-instance-review-notice/metadata-instance-review-notice.js +1 -24
- package/dist/esm/lib/components/unsaved-changes-modal/index.js +1 -2
- package/dist/esm/lib/components/unsaved-changes-modal/messages.js +1 -24
- package/dist/esm/lib/components/unsaved-changes-modal/unsaved-changes-modal.js +1 -45
- package/dist/esm/lib/components/unsaved-changes-modal/utils.js +1 -4
- package/dist/esm/lib/constants.js +1 -15
- package/dist/esm/lib/defaults.js +1 -16
- package/dist/esm/lib/mappers.js +1 -23
- package/dist/esm/lib/messages.js +1 -129
- package/dist/esm/lib/metadata-editor.js +1 -2
- package/dist/esm/lib/utils/analytics/analytics-context.js +1 -11
- package/dist/esm/lib/utils/analytics/events.js +1 -9
- package/dist/esm/lib/utils/analytics/index.js +1 -4
- package/dist/esm/lib/utils/analytics/with-analytics.js +1 -11
- package/dist/esm/lib/utils/api-wrapper.js +1 -13
- package/dist/esm/lib/utils/autofill-context.js +1 -66
- package/dist/esm/lib/utils/check-if-has-bounding-boxes.js +1 -2
- package/dist/esm/lib/utils/confidence-score/format-confidence-score-percent.js +1 -4
- package/dist/esm/lib/utils/confidence-score/get-confidence-score-tooltip.js +1 -13
- package/dist/esm/lib/utils/confidence-score/get-fields-needing-review.js +1 -6
- package/dist/esm/lib/utils/confidence-score/index.js +1 -5
- package/dist/esm/lib/utils/confidence-score/is-confidence-score-needing-review.js +1 -5
- package/dist/esm/lib/utils/confidence-score/messages.js +1 -16
- package/dist/esm/lib/utils/convertDate.js +1 -24
- package/dist/esm/lib/utils/is-interactive-form-element.js +1 -2
- package/dist/esm/lib/utils/utils.js +1 -4
- package/package.json +13 -13
|
@@ -1,34 +1 @@
|
|
|
1
|
-
import
|
|
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 };
|
|
1
|
+
import messages from"../esm/lib/components/add-metadata-template-dropdown/messages.js";import{useIntl}from"react-intl";import{jsx,jsxs}from"react/jsx-runtime";import{IconButton,Popover}from"@box/blueprint-web";import{Plus}from"@box/blueprint-web-assets/icons/Fill";import{MetadataTemplateBrowser}from"@box/metadata-template-browser";import '../styles/add-metadata-template-dropdown-with-browser.css';var add_metadata_template_dropdown_module_default={templateBrowserContainer:`_templateBrowserContainer_175dl_1`};function AddMetadataTemplateDropdownWithBrowser({canCreateAtRoot=!1,enterpriseId,eventService,isLoading,itemsService,onOpenChange,open}){let triggerLabel=useIntl().formatMessage(messages.addMetadataTemplatesTriggerButtonLabel);return jsxs(Popover.Root,{onOpenChange,open,children:[jsx(Popover.Trigger,{children:jsx(IconButton,{"aria-label":triggerLabel,icon:Plus,size:`x-small`,"data-target-id":`IconButton-addMetadataTemplatesTriggerButtonLabel`})}),jsx(Popover.ContentContainer,{align:`end`,"aria-label":triggerLabel,children:jsx(`div`,{className:add_metadata_template_dropdown_module_default.templateBrowserContainer,children:jsx(MetadataTemplateBrowser,{canCreateAtRoot,enterpriseId,eventService,isDisabled:isLoading,itemsService})})})]})}export{AddMetadataTemplateDropdownWithBrowser as t};
|
|
@@ -1,100 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { useMetadataEditorAnalytics as t } from "../esm/lib/utils/analytics/analytics-context.js";
|
|
3
|
-
import { n } from "./types.js";
|
|
4
|
-
import { t as r } from "./field-action-bar.module.js";
|
|
5
|
-
import i from "../esm/lib/components/metadata-editor-fields/components/ai-suggestion-field/messages.js";
|
|
6
|
-
import { formatSuggestionValue as a } from "../esm/lib/components/metadata-editor-fields/components/ai-suggestion-field/utils.js";
|
|
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
|
-
import '../styles/ai-suggestion-field.css';var b = {
|
|
14
|
-
wrapper: "_wrapper_132y2_1",
|
|
15
|
-
selectTrigger: "_selectTrigger_132y2_1"
|
|
16
|
-
};
|
|
17
|
-
function x({ aiSuggestion: x, onAiSuggestionAppend: S, onAiSuggestionReplace: C, onAiSuggestionIgnore: w, type: T, isSameValue: E, confidenceLevel: D }) {
|
|
18
|
-
let O = l(), { enableModernizedComponents: k } = _(), { trackEvent: A } = t(), j = s(!1);
|
|
19
|
-
o(() => {
|
|
20
|
-
j.current || x == null || !A || (j.current = !0, A(e.AI_SUGGESTION_SHOWN, {
|
|
21
|
-
fieldType: T,
|
|
22
|
-
confidenceLevel: D,
|
|
23
|
-
isSameValue: E
|
|
24
|
-
}));
|
|
25
|
-
}, [
|
|
26
|
-
x,
|
|
27
|
-
D,
|
|
28
|
-
E,
|
|
29
|
-
T,
|
|
30
|
-
A
|
|
31
|
-
]);
|
|
32
|
-
let M = D === n.High ? i.confidenceLevelHigh : i.confidenceLevelLow, N = D ? O.formatMessage(M) : void 0;
|
|
33
|
-
return /* @__PURE__ */ d("div", {
|
|
34
|
-
className: r.wrapperGradient,
|
|
35
|
-
"data-modern": k,
|
|
36
|
-
children: /* @__PURE__ */ d("div", {
|
|
37
|
-
className: p(r.wrapper, b.wrapper),
|
|
38
|
-
children: E ? /* @__PURE__ */ f(u, { children: [/* @__PURE__ */ d(g, {
|
|
39
|
-
as: "p",
|
|
40
|
-
color: "textOnLightSecondary",
|
|
41
|
-
variant: "caption",
|
|
42
|
-
children: D ? O.formatMessage(i.sameValueAiSuggestionCaptionWithLevel, { level: N }) : O.formatMessage(i.sameValueAiSuggestionCaption)
|
|
43
|
-
}), /* @__PURE__ */ d("div", {
|
|
44
|
-
className: r.buttons,
|
|
45
|
-
children: /* @__PURE__ */ d(h, {
|
|
46
|
-
"aria-label": D ? O.formatMessage(i.aiSuggestionAccept) : O.formatMessage(i.aiSuggestionConfirm),
|
|
47
|
-
"data-target-id": D ? "IconButton-aiSuggestionAccept" : "IconButton-aiSuggestionConfirmSame",
|
|
48
|
-
icon: v,
|
|
49
|
-
onClick: D ? C : w,
|
|
50
|
-
size: "x-small"
|
|
51
|
-
})
|
|
52
|
-
})] }) : /* @__PURE__ */ f(u, { children: [/* @__PURE__ */ f("div", { children: [/* @__PURE__ */ d(g, {
|
|
53
|
-
as: "p",
|
|
54
|
-
color: "textOnLightSecondary",
|
|
55
|
-
variant: "caption",
|
|
56
|
-
children: D ? O.formatMessage(i.aiSuggestionCaptionWithLevel, { level: N }) : O.formatMessage(i.aiSuggestionCaption)
|
|
57
|
-
}), /* @__PURE__ */ d(g, {
|
|
58
|
-
as: "p",
|
|
59
|
-
children: a(x, {
|
|
60
|
-
type: T,
|
|
61
|
-
locale: O.locale
|
|
62
|
-
})
|
|
63
|
-
})] }), /* @__PURE__ */ f("div", {
|
|
64
|
-
className: r.buttons,
|
|
65
|
-
children: [/* @__PURE__ */ d(h, {
|
|
66
|
-
"aria-label": O.formatMessage(T === "multiSelect" ? i.aiSuggestionAppend : i.aiSuggestionClearAndReplace),
|
|
67
|
-
"data-target-id": T === "multiSelect" ? "IconButton-aiSuggestionAppend" : "IconButton-aiSuggestionClearAndReplace",
|
|
68
|
-
icon: v,
|
|
69
|
-
onClick: T === "multiSelect" ? S : C,
|
|
70
|
-
size: "x-small"
|
|
71
|
-
}), /* @__PURE__ */ f(m.Root, { children: [/* @__PURE__ */ d(m.Trigger, {
|
|
72
|
-
className: b.selectTrigger,
|
|
73
|
-
children: /* @__PURE__ */ d(h, {
|
|
74
|
-
"aria-label": O.formatMessage(i.aiSuggestionOptions),
|
|
75
|
-
"data-target-id": "IconButton-aiSuggestionOptions",
|
|
76
|
-
icon: y
|
|
77
|
-
})
|
|
78
|
-
}), /* @__PURE__ */ f(m.Content, { children: [
|
|
79
|
-
T === "multiSelect" && /* @__PURE__ */ d(m.Item, {
|
|
80
|
-
"data-target-id": "DropdownMenu.Item-aiSuggestionAppend",
|
|
81
|
-
onSelect: S,
|
|
82
|
-
children: /* @__PURE__ */ d(c, { ...i.aiSuggestionAppend })
|
|
83
|
-
}),
|
|
84
|
-
/* @__PURE__ */ d(m.Item, {
|
|
85
|
-
"data-target-id": "DropdownMenu.Item-metadataAiSuggestionClearAndReplace",
|
|
86
|
-
onSelect: C,
|
|
87
|
-
children: /* @__PURE__ */ d(c, { ...i.aiSuggestionClearAndReplace })
|
|
88
|
-
}),
|
|
89
|
-
/* @__PURE__ */ d(m.Separator, {}),
|
|
90
|
-
/* @__PURE__ */ d(m.Item, {
|
|
91
|
-
"data-target-id": "DropdownMenu.Item-metadataAiSuggestionIgnore",
|
|
92
|
-
onSelect: w,
|
|
93
|
-
children: /* @__PURE__ */ d(c, { ...i.aiSuggestionIgnore })
|
|
94
|
-
})
|
|
95
|
-
] })] })]
|
|
96
|
-
})] })
|
|
97
|
-
})
|
|
98
|
-
});
|
|
99
|
-
}
|
|
100
|
-
export { x as t };
|
|
1
|
+
import{EVENT_NAMES}from"../esm/lib/utils/analytics/events.js";import{useMetadataEditorAnalytics}from"../esm/lib/utils/analytics/analytics-context.js";import{n as ConfidenceLevel}from"./types.js";import{t as field_action_bar_module_default}from"./field-action-bar.module.js";import messages_default from"../esm/lib/components/metadata-editor-fields/components/ai-suggestion-field/messages.js";import{formatSuggestionValue}from"../esm/lib/components/metadata-editor-fields/components/ai-suggestion-field/utils.js";import{useEffect,useRef}from"react";import{FormattedMessage,useIntl}from"react-intl";import{Fragment,jsx,jsxs}from"react/jsx-runtime";import clsx from"clsx";import{DropdownMenu,IconButton,Text,useBlueprintModernization}from"@box/blueprint-web";import{Checkmark,Ellipsis}from"@box/blueprint-web-assets/icons/Fill";import '../styles/ai-suggestion-field.css';var ai_suggestion_field_module_default={wrapper:`_wrapper_132y2_1`,selectTrigger:`_selectTrigger_132y2_1`};function AiSuggestionField({aiSuggestion,onAiSuggestionAppend,onAiSuggestionReplace,onAiSuggestionIgnore,type,isSameValue,confidenceLevel}){let intl=useIntl(),{enableModernizedComponents}=useBlueprintModernization(),{trackEvent}=useMetadataEditorAnalytics(),hasTrackedShownRef=useRef(!1);useEffect(()=>{hasTrackedShownRef.current||aiSuggestion==null||!trackEvent||(hasTrackedShownRef.current=!0,trackEvent(EVENT_NAMES.AI_SUGGESTION_SHOWN,{fieldType:type,confidenceLevel,isSameValue}))},[aiSuggestion,confidenceLevel,isSameValue,type,trackEvent]);let confidenceLevelMessage=confidenceLevel===ConfidenceLevel.High?messages_default.confidenceLevelHigh:messages_default.confidenceLevelLow,captionLevel=confidenceLevel?intl.formatMessage(confidenceLevelMessage):void 0;return jsx(`div`,{className:field_action_bar_module_default.wrapperGradient,"data-modern":enableModernizedComponents,children:jsx(`div`,{className:clsx(field_action_bar_module_default.wrapper,ai_suggestion_field_module_default.wrapper),children:isSameValue?jsxs(Fragment,{children:[jsx(Text,{as:`p`,color:`textOnLightSecondary`,variant:`caption`,children:confidenceLevel?intl.formatMessage(messages_default.sameValueAiSuggestionCaptionWithLevel,{level:captionLevel}):intl.formatMessage(messages_default.sameValueAiSuggestionCaption)}),jsx(`div`,{className:field_action_bar_module_default.buttons,children:jsx(IconButton,{"aria-label":confidenceLevel?intl.formatMessage(messages_default.aiSuggestionAccept):intl.formatMessage(messages_default.aiSuggestionConfirm),"data-target-id":confidenceLevel?`IconButton-aiSuggestionAccept`:`IconButton-aiSuggestionConfirmSame`,icon:Checkmark,onClick:confidenceLevel?onAiSuggestionReplace:onAiSuggestionIgnore,size:`x-small`})})]}):jsxs(Fragment,{children:[jsxs(`div`,{children:[jsx(Text,{as:`p`,color:`textOnLightSecondary`,variant:`caption`,children:confidenceLevel?intl.formatMessage(messages_default.aiSuggestionCaptionWithLevel,{level:captionLevel}):intl.formatMessage(messages_default.aiSuggestionCaption)}),jsx(Text,{as:`p`,children:formatSuggestionValue(aiSuggestion,{type,locale:intl.locale})})]}),jsxs(`div`,{className:field_action_bar_module_default.buttons,children:[jsx(IconButton,{"aria-label":intl.formatMessage(type===`multiSelect`?messages_default.aiSuggestionAppend:messages_default.aiSuggestionClearAndReplace),"data-target-id":type===`multiSelect`?`IconButton-aiSuggestionAppend`:`IconButton-aiSuggestionClearAndReplace`,icon:Checkmark,onClick:type===`multiSelect`?onAiSuggestionAppend:onAiSuggestionReplace,size:`x-small`}),jsxs(DropdownMenu.Root,{children:[jsx(DropdownMenu.Trigger,{className:ai_suggestion_field_module_default.selectTrigger,children:jsx(IconButton,{"aria-label":intl.formatMessage(messages_default.aiSuggestionOptions),"data-target-id":`IconButton-aiSuggestionOptions`,icon:Ellipsis})}),jsxs(DropdownMenu.Content,{children:[type===`multiSelect`&&jsx(DropdownMenu.Item,{"data-target-id":`DropdownMenu.Item-aiSuggestionAppend`,onSelect:onAiSuggestionAppend,children:jsx(FormattedMessage,{...messages_default.aiSuggestionAppend})}),jsx(DropdownMenu.Item,{"data-target-id":`DropdownMenu.Item-metadataAiSuggestionClearAndReplace`,onSelect:onAiSuggestionReplace,children:jsx(FormattedMessage,{...messages_default.aiSuggestionClearAndReplace})}),jsx(DropdownMenu.Separator,{}),jsx(DropdownMenu.Item,{"data-target-id":`DropdownMenu.Item-metadataAiSuggestionIgnore`,onSelect:onAiSuggestionIgnore,children:jsx(FormattedMessage,{...messages_default.aiSuggestionIgnore})})]})]})]})]})})})}export{AiSuggestionField as t};
|
|
@@ -1,63 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import t from "../esm/lib/components/metadata-instance-editor/subcomponents/autofill-overlay/messages.js";
|
|
3
|
-
import { useErrorMessaging as n } from "../esm/lib/components/metadata-instance-editor/subcomponents/autofill-overlay/useErrorMessaging.js";
|
|
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
|
-
import { Size5 as d, SurfaceStatusSurfaceError as f } from "@box/blueprint-web-assets/tokens/tokens";
|
|
10
|
-
import { AlertTriangle as p } from "@box/blueprint-web-assets/icons/Line";
|
|
11
|
-
import '../styles/autofill-overlay.css';var m = {
|
|
12
|
-
autofillOverlay: "_autofillOverlay_16p2j_1",
|
|
13
|
-
withError: "_withError_16p2j_12",
|
|
14
|
-
autofillOverlayTitle: "_autofillOverlayTitle_16p2j_16",
|
|
15
|
-
autofillOverlayDescription: "_autofillOverlayDescription_16p2j_21",
|
|
16
|
-
dismissButton: "_dismissButton_16p2j_25",
|
|
17
|
-
overlayIcon: "_overlayIcon_16p2j_29",
|
|
18
|
-
testContainerStyle: "_testContainerStyle_16p2j_35"
|
|
19
|
-
}, h = ({ errorCode: h, isFetchingSuggestions: g, isLongLoading: _ }) => {
|
|
20
|
-
let v = i(), [y, b] = r(!1), x = n(h), S = v.formatMessage(t.defaultLoadingMessage);
|
|
21
|
-
h && (S = x.title);
|
|
22
|
-
let C = localStorage.getItem(e);
|
|
23
|
-
_ && C === "standard" && (S = v.formatMessage(t.longLoadingTitle));
|
|
24
|
-
let w = _ && C === "standard" ? v.formatMessage(t.longLoadingDescription) : h && x.description;
|
|
25
|
-
return !g && !h || y ? null : /* @__PURE__ */ o("div", {
|
|
26
|
-
className: s(m.autofillOverlay, h && m.withError),
|
|
27
|
-
children: [
|
|
28
|
-
h ? /* @__PURE__ */ a(p, {
|
|
29
|
-
className: m.overlayIcon,
|
|
30
|
-
color: f,
|
|
31
|
-
height: d,
|
|
32
|
-
role: "presentation",
|
|
33
|
-
width: d
|
|
34
|
-
}) : /* @__PURE__ */ a(c, {
|
|
35
|
-
"aria-label": v.formatMessage(t.loadingAriaLabel),
|
|
36
|
-
"aria-live": "polite",
|
|
37
|
-
className: m.overlayIcon,
|
|
38
|
-
size: "large",
|
|
39
|
-
variant: "default"
|
|
40
|
-
}),
|
|
41
|
-
/* @__PURE__ */ a(l, {
|
|
42
|
-
as: "p",
|
|
43
|
-
className: m.autofillOverlayTitle,
|
|
44
|
-
variant: "subtitle",
|
|
45
|
-
children: S
|
|
46
|
-
}),
|
|
47
|
-
w && /* @__PURE__ */ a(l, {
|
|
48
|
-
as: "p",
|
|
49
|
-
className: m.autofillOverlayDescription,
|
|
50
|
-
color: "textOnLightSecondary",
|
|
51
|
-
variant: "bodyDefault",
|
|
52
|
-
children: w
|
|
53
|
-
}),
|
|
54
|
-
h && /* @__PURE__ */ a(u, {
|
|
55
|
-
className: m.dismissButton,
|
|
56
|
-
onClick: () => b(!0),
|
|
57
|
-
"data-target-id": "TextButton-dismissButton",
|
|
58
|
-
children: v.formatMessage(t.dismissButton)
|
|
59
|
-
})
|
|
60
|
-
]
|
|
61
|
-
});
|
|
62
|
-
};
|
|
63
|
-
export { h as t };
|
|
1
|
+
import{EXTRACT_AI_AGENT_LOCAL_STORAGE_KEY}from"../esm/lib/constants.js";import messages from"../esm/lib/components/metadata-instance-editor/subcomponents/autofill-overlay/messages.js";import{useErrorMessaging}from"../esm/lib/components/metadata-instance-editor/subcomponents/autofill-overlay/useErrorMessaging.js";import{useState}from"react";import{useIntl}from"react-intl";import{jsx,jsxs}from"react/jsx-runtime";import clsx from"clsx";import{LoadingIndicator,Text,TextButton}from"@box/blueprint-web";import{Size5,SurfaceStatusSurfaceError}from"@box/blueprint-web-assets/tokens/tokens";import{AlertTriangle}from"@box/blueprint-web-assets/icons/Line";import '../styles/autofill-overlay.css';var autofill_overlay_module_default={autofillOverlay:`_autofillOverlay_16p2j_1`,withError:`_withError_16p2j_12`,autofillOverlayTitle:`_autofillOverlayTitle_16p2j_16`,autofillOverlayDescription:`_autofillOverlayDescription_16p2j_21`,dismissButton:`_dismissButton_16p2j_25`,overlayIcon:`_overlayIcon_16p2j_29`,testContainerStyle:`_testContainerStyle_16p2j_35`},AutofillOverlay=({errorCode,isFetchingSuggestions,isLongLoading})=>{let intl=useIntl(),[isDismissed,setIsDismissed]=useState(!1),errorMessage=useErrorMessaging(errorCode),title=intl.formatMessage(messages.defaultLoadingMessage);errorCode&&(title=errorMessage.title);let storedAgent=localStorage.getItem(EXTRACT_AI_AGENT_LOCAL_STORAGE_KEY);isLongLoading&&storedAgent===`standard`&&(title=intl.formatMessage(messages.longLoadingTitle));let description=isLongLoading&&storedAgent===`standard`?intl.formatMessage(messages.longLoadingDescription):errorCode&&errorMessage.description;return!isFetchingSuggestions&&!errorCode||isDismissed?null:jsxs(`div`,{className:clsx(autofill_overlay_module_default.autofillOverlay,errorCode&&autofill_overlay_module_default.withError),children:[errorCode?jsx(AlertTriangle,{className:autofill_overlay_module_default.overlayIcon,color:SurfaceStatusSurfaceError,height:Size5,role:`presentation`,width:Size5}):jsx(LoadingIndicator,{"aria-label":intl.formatMessage(messages.loadingAriaLabel),"aria-live":`polite`,className:autofill_overlay_module_default.overlayIcon,size:`large`,variant:`default`}),jsx(Text,{as:`p`,className:autofill_overlay_module_default.autofillOverlayTitle,variant:`subtitle`,children:title}),description&&jsx(Text,{as:`p`,className:autofill_overlay_module_default.autofillOverlayDescription,color:`textOnLightSecondary`,variant:`bodyDefault`,children:description}),errorCode&&jsx(TextButton,{className:autofill_overlay_module_default.dismissButton,onClick:()=>setIsDismissed(!0),"data-target-id":`TextButton-dismissButton`,children:intl.formatMessage(messages.dismissButton)})]})};export{AutofillOverlay as t};
|
|
@@ -1,161 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { useAsyncList as t } from "../esm/lib/components/combobox-with-api-pagination/use-async-list.js";
|
|
3
|
-
import { useControllableState as n } from "../esm/lib/components/combobox-with-api-pagination/utils/use-controllable-state.js";
|
|
4
|
-
import { useTrackVisibility as r } from "../esm/lib/components/combobox-with-api-pagination/utils/use-intersection-observer.js";
|
|
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
|
-
import { IconIconOnLightSecondary as C, Size1 as w, Size6 as T } from "@box/blueprint-web-assets/tokens/tokens";
|
|
13
|
-
import '../styles/combobox-with-api-pagination.css';var E = {
|
|
14
|
-
disabled: "_disabled_9lkdk_27",
|
|
15
|
-
highlightOptionText: "_highlightOptionText_9lkdk_31",
|
|
16
|
-
selected: "_selected_9lkdk_53",
|
|
17
|
-
option: "_option_9lkdk_73",
|
|
18
|
-
errorComboboxOption: "_errorComboboxOption_9lkdk_77",
|
|
19
|
-
errorComboboxOptionText: "_errorComboboxOptionText_9lkdk_82"
|
|
20
|
-
}, D = /*#__PURE__*/ i(({ onTryAgain: t }, n) => {
|
|
21
|
-
let { formatMessage: r } = u();
|
|
22
|
-
return /* @__PURE__ */ m(f, { children: [/* @__PURE__ */ p(_, {
|
|
23
|
-
variant: "error",
|
|
24
|
-
variantIconAriaLabel: r(e.loadingResultsErrorIconLabel),
|
|
25
|
-
children: /* @__PURE__ */ p(l, { ...e.loadingResultsErrorMessage })
|
|
26
|
-
}), /* @__PURE__ */ p(g.Option, {
|
|
27
|
-
ref: n,
|
|
28
|
-
className: E.errorComboboxOption,
|
|
29
|
-
onClick: t,
|
|
30
|
-
children: /* @__PURE__ */ m(y, {
|
|
31
|
-
as: "span",
|
|
32
|
-
className: E.errorComboboxOptionText,
|
|
33
|
-
color: "textOnLightLink",
|
|
34
|
-
variant: "bodyDefaultBold",
|
|
35
|
-
children: [/* @__PURE__ */ p(l, { ...e.loadingResultsErrorAction }), /* @__PURE__ */ p(x, {
|
|
36
|
-
color: "currentColor",
|
|
37
|
-
height: "12px",
|
|
38
|
-
width: "12px"
|
|
39
|
-
})]
|
|
40
|
-
})
|
|
41
|
-
})] });
|
|
42
|
-
}), O = "__LOADING__", k = "__LOADING_ERROR__", A = "0px 0px 20px 0px", j = /* @__PURE__ */ p(S, {
|
|
43
|
-
color: C,
|
|
44
|
-
height: T,
|
|
45
|
-
role: "presentation",
|
|
46
|
-
style: {
|
|
47
|
-
padding: w,
|
|
48
|
-
boxSizing: "border-box"
|
|
49
|
-
},
|
|
50
|
-
width: T
|
|
51
|
-
}), M = /*#__PURE__*/ i(function(i, l) {
|
|
52
|
-
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 }) {
|
|
53
|
-
let r = await f({
|
|
54
|
-
signal: n,
|
|
55
|
-
marker: e,
|
|
56
|
-
searchInput: t
|
|
57
|
-
});
|
|
58
|
-
return {
|
|
59
|
-
items: r.options,
|
|
60
|
-
marker: r.marker
|
|
61
|
-
};
|
|
62
|
-
} }), z = c(!1), B = a(() => {
|
|
63
|
-
z.current ||= (R.reload(), !0);
|
|
64
|
-
}, []), [V, H] = n({
|
|
65
|
-
prop: _,
|
|
66
|
-
defaultProp: S,
|
|
67
|
-
onChange: y
|
|
68
|
-
}), U = !w && V.length === 1, W = (e) => {
|
|
69
|
-
e === void 0 ? (H([]), (!L.current || !N) && (R.search(""), L.current = !0)) : H(Array.isArray(e) ? e : [e]);
|
|
70
|
-
}, 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) => {
|
|
71
|
-
let { value: n, displayValue: r, ...i } = t;
|
|
72
|
-
if (n === O) return R.hasNextPage ? /* @__PURE__ */ p(g.Option, {
|
|
73
|
-
...i,
|
|
74
|
-
ref: Z,
|
|
75
|
-
disabled: !0,
|
|
76
|
-
value: n,
|
|
77
|
-
children: /* @__PURE__ */ p(v, {
|
|
78
|
-
"aria-label": F(e.loadingMoreAriaLabel),
|
|
79
|
-
style: { position: "unset" }
|
|
80
|
-
})
|
|
81
|
-
}) : null;
|
|
82
|
-
if (n === k && R.hasError && !R.isEmpty) return /* @__PURE__ */ p(D, { onTryAgain: () => {
|
|
83
|
-
R.loadMore(), I.current?.focus();
|
|
84
|
-
} });
|
|
85
|
-
if (K.some((e) => e.value === n)) return null;
|
|
86
|
-
let a = V.some((e) => e.value === n);
|
|
87
|
-
return /* @__PURE__ */ p(g.Option, {
|
|
88
|
-
...i,
|
|
89
|
-
className: E.option,
|
|
90
|
-
value: n,
|
|
91
|
-
children: /* @__PURE__ */ p(d, {
|
|
92
|
-
className: h(E.highlightOptionText, a && E.selected),
|
|
93
|
-
value: r || n
|
|
94
|
-
})
|
|
95
|
-
});
|
|
96
|
-
}, J = (e) => {
|
|
97
|
-
if (m?.(e), U && e === "") {
|
|
98
|
-
L.current = !1;
|
|
99
|
-
return;
|
|
100
|
-
}
|
|
101
|
-
R.search(e);
|
|
102
|
-
}, Y = () => {
|
|
103
|
-
R.reload(), I.current?.focus();
|
|
104
|
-
}, X;
|
|
105
|
-
X = R.hasError && !R.isLoading ? /* @__PURE__ */ p(D, { onTryAgain: Y }) : R.isEmpty && !R.isLoading ? x || F(e.noResults) : void 0;
|
|
106
|
-
let [Z, { rootRef: Q, isVisible: $ }] = r({ rootMargin: A });
|
|
107
|
-
o(() => {
|
|
108
|
-
if (!($ && R.hasNextPage)) return;
|
|
109
|
-
let e = setTimeout(() => {
|
|
110
|
-
R.loadMore();
|
|
111
|
-
}, 100);
|
|
112
|
-
return () => {
|
|
113
|
-
clearTimeout(e);
|
|
114
|
-
};
|
|
115
|
-
}, [$]);
|
|
116
|
-
let ee = s(() => {
|
|
117
|
-
let e = R.hasNextPage ? {
|
|
118
|
-
displayValue: O,
|
|
119
|
-
value: O
|
|
120
|
-
} : null, t = !e && R.hasError && !R.isEmpty ? {
|
|
121
|
-
displayValue: k,
|
|
122
|
-
value: k
|
|
123
|
-
} : null;
|
|
124
|
-
return [
|
|
125
|
-
...R.items,
|
|
126
|
-
...K,
|
|
127
|
-
e,
|
|
128
|
-
t
|
|
129
|
-
].filter(Boolean);
|
|
130
|
-
}, [
|
|
131
|
-
R.hasNextPage,
|
|
132
|
-
R.hasError,
|
|
133
|
-
R.isEmpty,
|
|
134
|
-
R.items,
|
|
135
|
-
K
|
|
136
|
-
]);
|
|
137
|
-
return /* @__PURE__ */ p(g, {
|
|
138
|
-
as: "input",
|
|
139
|
-
...P,
|
|
140
|
-
ref: b(I, l),
|
|
141
|
-
className: h({ [E.disabled]: U }, M),
|
|
142
|
-
clearButtonAriaLabel: F(e.clearButtonAriaLabel),
|
|
143
|
-
disabled: T || U,
|
|
144
|
-
displaySingleSelectionAsChip: N,
|
|
145
|
-
displayValue: (e) => e.displayValue || e.value,
|
|
146
|
-
endComboboxIcon: j,
|
|
147
|
-
focusLoop: !1,
|
|
148
|
-
getPopoverRef: Q,
|
|
149
|
-
loading: R.isReloading,
|
|
150
|
-
loadingAriaLabel: C || F(e.loadingAriaLabel),
|
|
151
|
-
multiselect: w,
|
|
152
|
-
noResultMessage: X,
|
|
153
|
-
onFocus: B,
|
|
154
|
-
onInputValueChange: J,
|
|
155
|
-
onValueChange: W,
|
|
156
|
-
options: ee,
|
|
157
|
-
renderOption: q,
|
|
158
|
-
value: G
|
|
159
|
-
});
|
|
160
|
-
});
|
|
161
|
-
export { M as t };
|
|
1
|
+
import messages from"../esm/lib/components/combobox-with-api-pagination/messages.js";import{useAsyncList}from"../esm/lib/components/combobox-with-api-pagination/use-async-list.js";import{useControllableState}from"../esm/lib/components/combobox-with-api-pagination/utils/use-controllable-state.js";import{useTrackVisibility}from"../esm/lib/components/combobox-with-api-pagination/utils/use-intersection-observer.js";import{forwardRef,useCallback,useEffect,useMemo,useRef}from"react";import{FormattedMessage,useIntl}from"react-intl";import{ComboboxItemValue}from"@ariakit/react";import{Fragment,jsx,jsxs}from"react/jsx-runtime";import clsx from"clsx";import{Combobox as Combobox$1,InlineNotice,LoadingIndicator,Text,useForkRef}from"@box/blueprint-web";import{Loader,Search}from"@box/blueprint-web-assets/icons/Fill";import{IconIconOnLightSecondary,Size1,Size6}from"@box/blueprint-web-assets/tokens/tokens";import '../styles/combobox-with-api-pagination.css';var combobox_with_api_pagination_module_default={disabled:`_disabled_9lkdk_27`,highlightOptionText:`_highlightOptionText_9lkdk_31`,selected:`_selected_9lkdk_53`,option:`_option_9lkdk_73`,errorComboboxOption:`_errorComboboxOption_9lkdk_77`,errorComboboxOptionText:`_errorComboboxOptionText_9lkdk_82`},ComboboxWithApiError=forwardRef(({onTryAgain},forwardedRef)=>{let{formatMessage}=useIntl();return jsxs(Fragment,{children:[jsx(InlineNotice,{variant:`error`,variantIconAriaLabel:formatMessage(messages.loadingResultsErrorIconLabel),children:jsx(FormattedMessage,{...messages.loadingResultsErrorMessage})}),jsx(Combobox$1.Option,{ref:forwardedRef,className:combobox_with_api_pagination_module_default.errorComboboxOption,onClick:onTryAgain,children:jsxs(Text,{as:`span`,className:combobox_with_api_pagination_module_default.errorComboboxOptionText,color:`textOnLightLink`,variant:`bodyDefaultBold`,children:[jsx(FormattedMessage,{...messages.loadingResultsErrorAction}),jsx(Loader,{color:`currentColor`,height:`12px`,width:`12px`})]})})]})}),LOAD_MORE_VALUE=`__LOADING__`,LOAD_MORE_ERROR_VALUE=`__LOADING_ERROR__`,INTERSECTION_ROOT_MARGIN=`0px 0px 20px 0px`,EndComboboxSearchIcon=jsx(Search,{color:IconIconOnLightSecondary,height:Size6,role:`presentation`,style:{padding:Size1,boxSizing:`border-box`},width:Size6}),ComboboxWithApiPagination=forwardRef(function(props,forwardedRef){let{defaultFetcher,onInputValueChange,value,onValueChange,noResultMessage,defaultValue=[],loadingAriaLabel,multiselect=!1,disabled,className,displaySingleSelectionAsChip=!0,...rest}=props,{formatMessage}=useIntl(),inputRef=useRef(null),shouldFetchOnSearch=useRef(!0),list=useAsyncList({async load({marker,searchInput,signal}){let res=await defaultFetcher({signal,marker,searchInput});return{items:res.options,marker:res.marker}}}),didDispatchInitialFetch=useRef(!1),fetchOptions=useCallback(()=>{didDispatchInitialFetch.current||=(list.reload(),!0)},[]),[selectedValue,setSelectedOption]=useControllableState({prop:value,defaultProp:defaultValue,onChange:onValueChange}),isSingleSelectValueSelected=!multiselect&&selectedValue.length===1,handleOnValueChange=selectedOptions=>{selectedOptions===void 0?(setSelectedOption([]),(!shouldFetchOnSearch.current||!displaySingleSelectionAsChip)&&(list.search(``),shouldFetchOnSearch.current=!0)):setSelectedOption(Array.isArray(selectedOptions)?selectedOptions:[selectedOptions])},comboboxValue=useMemo(()=>selectedValue.length===0?multiselect?[]:void 0:multiselect?selectedValue:selectedValue[0],[multiselect,selectedValue]),selectedOptionsWithoutItems=useMemo(()=>selectedValue.filter(option=>!list.items.some(item=>item.value===option.value)),[selectedValue,list.items]),renderInfiniteOption=option=>{let{value:optionValue,displayValue,...optionRest}=option;if(optionValue===LOAD_MORE_VALUE)return list.hasNextPage?jsx(Combobox$1.Option,{...optionRest,ref:triggerRef,disabled:!0,value:optionValue,children:jsx(LoadingIndicator,{"aria-label":formatMessage(messages.loadingMoreAriaLabel),style:{position:`unset`}})}):null;if(optionValue===LOAD_MORE_ERROR_VALUE&&list.hasError&&!list.isEmpty)return jsx(ComboboxWithApiError,{onTryAgain:()=>{list.loadMore(),inputRef.current?.focus()}});if(selectedOptionsWithoutItems.some(optionWithoutItem=>optionWithoutItem.value===optionValue))return null;let isSelected=selectedValue.some(selectedOption=>selectedOption.value===optionValue);return jsx(Combobox$1.Option,{...optionRest,className:combobox_with_api_pagination_module_default.option,value:optionValue,children:jsx(ComboboxItemValue,{className:clsx(combobox_with_api_pagination_module_default.highlightOptionText,isSelected&&combobox_with_api_pagination_module_default.selected),value:displayValue||optionValue})})},handleOnInputValueChange=inputVal=>{if(onInputValueChange?.(inputVal),isSingleSelectValueSelected&&inputVal===``){shouldFetchOnSearch.current=!1;return}list.search(inputVal)},handleTryAgain=()=>{list.reload(),inputRef.current?.focus()},noResultMessageFromState;noResultMessageFromState=list.hasError&&!list.isLoading?jsx(ComboboxWithApiError,{onTryAgain:handleTryAgain}):list.isEmpty&&!list.isLoading?noResultMessage||formatMessage(messages.noResults):void 0;let[triggerRef,{rootRef:popoverRef,isVisible}]=useTrackVisibility({rootMargin:INTERSECTION_ROOT_MARGIN});useEffect(()=>{if(!(isVisible&&list.hasNextPage))return;let timer=setTimeout(()=>{list.loadMore()},100);return()=>{clearTimeout(timer)}},[isVisible]);let finalOptions=useMemo(()=>{let loadMoreOption=list.hasNextPage?{displayValue:LOAD_MORE_VALUE,value:LOAD_MORE_VALUE}:null,loadMoreErrorOption=!loadMoreOption&&list.hasError&&!list.isEmpty?{displayValue:LOAD_MORE_ERROR_VALUE,value:LOAD_MORE_ERROR_VALUE}:null;return[...list.items,...selectedOptionsWithoutItems,loadMoreOption,loadMoreErrorOption].filter(Boolean)},[list.hasNextPage,list.hasError,list.isEmpty,list.items,selectedOptionsWithoutItems]);return jsx(Combobox$1,{as:`input`,...rest,ref:useForkRef(inputRef,forwardedRef),className:clsx({[combobox_with_api_pagination_module_default.disabled]:isSingleSelectValueSelected},className),clearButtonAriaLabel:formatMessage(messages.clearButtonAriaLabel),disabled:disabled||isSingleSelectValueSelected,displaySingleSelectionAsChip,displayValue:option=>option.displayValue||option.value,endComboboxIcon:EndComboboxSearchIcon,focusLoop:!1,getPopoverRef:popoverRef,loading:list.isReloading,loadingAriaLabel:loadingAriaLabel||formatMessage(messages.loadingAriaLabel),multiselect,noResultMessage:noResultMessageFromState,onFocus:fetchOptions,onInputValueChange:handleOnInputValueChange,onValueChange:handleOnValueChange,options:finalOptions,renderOption:renderInfiniteOption,value:comboboxValue})});export{ComboboxWithApiPagination as t};
|
|
@@ -1,60 +1 @@
|
|
|
1
|
-
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
|
-
import '../styles/custom-instance-new-field.css';var c = {
|
|
7
|
-
customInstanceNewFieldCard: "_customInstanceNewFieldCard_fcftk_1",
|
|
8
|
-
customInstanceNewFieldFooter: "_customInstanceNewFieldFooter_fcftk_6",
|
|
9
|
-
inputWrapper: "_inputWrapper_fcftk_13"
|
|
10
|
-
}, l = (l) => {
|
|
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
|
-
h(e), v && y("");
|
|
13
|
-
};
|
|
14
|
-
return /* @__PURE__ */ i(o, {
|
|
15
|
-
"aria-label": p.formatMessage(e.addAttributeGroupAriaLabel),
|
|
16
|
-
className: c.customInstanceNewFieldCard,
|
|
17
|
-
"data-testid": "customInstanceNewField",
|
|
18
|
-
role: "group",
|
|
19
|
-
children: [
|
|
20
|
-
/* @__PURE__ */ r("div", {
|
|
21
|
-
className: c.inputWrapper,
|
|
22
|
-
children: /* @__PURE__ */ r(s, {
|
|
23
|
-
autoFocus: !0,
|
|
24
|
-
error: v,
|
|
25
|
-
label: p.formatMessage(e.customKeyLabel),
|
|
26
|
-
onChange: (e) => x(e.target.value),
|
|
27
|
-
placeholder: p.formatMessage(e.customKeyPlaceholder),
|
|
28
|
-
required: !0,
|
|
29
|
-
value: m
|
|
30
|
-
})
|
|
31
|
-
}),
|
|
32
|
-
/* @__PURE__ */ r("div", {
|
|
33
|
-
className: c.inputWrapper,
|
|
34
|
-
children: /* @__PURE__ */ r(s, {
|
|
35
|
-
label: p.formatMessage(e.valueLabel),
|
|
36
|
-
onChange: (e) => _(e.target.value),
|
|
37
|
-
placeholder: p.formatMessage(e.valuePlaceholder),
|
|
38
|
-
value: g
|
|
39
|
-
})
|
|
40
|
-
}),
|
|
41
|
-
/* @__PURE__ */ i("div", {
|
|
42
|
-
className: c.customInstanceNewFieldFooter,
|
|
43
|
-
children: [b && /* @__PURE__ */ r(a, {
|
|
44
|
-
onClick: d,
|
|
45
|
-
variant: "secondary",
|
|
46
|
-
"data-target-id": "Button-cancelCTA",
|
|
47
|
-
children: p.formatMessage(e.cancelCTA)
|
|
48
|
-
}), /* @__PURE__ */ r(a, {
|
|
49
|
-
onClick: () => {
|
|
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
|
-
},
|
|
52
|
-
variant: "primary",
|
|
53
|
-
"data-target-id": "Button-addNewFieldCTA",
|
|
54
|
-
children: p.formatMessage(e.addNewFieldCTA)
|
|
55
|
-
})]
|
|
56
|
-
})
|
|
57
|
-
]
|
|
58
|
-
});
|
|
59
|
-
};
|
|
60
|
-
export { l as t };
|
|
1
|
+
import messages from"../esm/lib/components/metadata-instance-editor/subcomponents/custom-instance-new-field/messages.js";import{useState}from"react";import{useIntl}from"react-intl";import{jsx,jsxs}from"react/jsx-runtime";import{Button,Card,TextInput}from"@box/blueprint-web";import '../styles/custom-instance-new-field.css';var custom_instance_new_field_module_default={customInstanceNewFieldCard:`_customInstanceNewFieldCard_fcftk_1`,customInstanceNewFieldFooter:`_customInstanceNewFieldFooter_fcftk_6`,inputWrapper:`_inputWrapper_fcftk_13`},CustomInstanceNewField=props=>{let{onAdd,onCancel,formKeys=[]}=props,intl=useIntl(),[key,setKey]=useState(``),[value,setValue]=useState(``),[error,setError]=useState(``),isCancellable=formKeys.length!==0,handleKeyChange=newKey=>{setKey(newKey),error&&setError(``)};return jsxs(Card,{"aria-label":intl.formatMessage(messages.addAttributeGroupAriaLabel),className:custom_instance_new_field_module_default.customInstanceNewFieldCard,"data-testid":`customInstanceNewField`,role:`group`,children:[jsx(`div`,{className:custom_instance_new_field_module_default.inputWrapper,children:jsx(TextInput,{autoFocus:!0,error,label:intl.formatMessage(messages.customKeyLabel),onChange:e=>handleKeyChange(e.target.value),placeholder:intl.formatMessage(messages.customKeyPlaceholder),required:!0,value:key})}),jsx(`div`,{className:custom_instance_new_field_module_default.inputWrapper,children:jsx(TextInput,{label:intl.formatMessage(messages.valueLabel),onChange:e=>setValue(e.target.value),placeholder:intl.formatMessage(messages.valuePlaceholder),value})}),jsxs(`div`,{className:custom_instance_new_field_module_default.customInstanceNewFieldFooter,children:[isCancellable&&jsx(Button,{onClick:onCancel,variant:`secondary`,"data-target-id":`Button-cancelCTA`,children:intl.formatMessage(messages.cancelCTA)}),jsx(Button,{onClick:()=>{key?key.startsWith(`$`)?setError(intl.formatMessage(messages.customErrorInternalKey)):formKeys.includes(key)?setError(intl.formatMessage(messages.customErrorDuplicateKey)):onAdd(key,value):setError(intl.formatMessage(messages.keyFieldRequiredError))},variant:`primary`,"data-target-id":`Button-addNewFieldCTA`,children:intl.formatMessage(messages.addNewFieldCTA)})]})]})};export{CustomInstanceNewField as t};
|
|
@@ -1,74 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import t from "../esm/lib/components/metadata-instance-editor/subcomponents/custom-instance/messages.js";
|
|
3
|
-
import { useEffect as n, useRef as r, useState as i } from "react";
|
|
4
|
-
import { useIntl as a } from "react-intl";
|
|
5
|
-
import { jsx as o, jsxs as s } from "react/jsx-runtime";
|
|
6
|
-
import { IconButton as c, TextButton as l, TextInput as u } from "@box/blueprint-web";
|
|
7
|
-
import { Field as d, FieldArray as f, useFormikContext as p } from "formik";
|
|
8
|
-
import { Trash as m } from "@box/blueprint-web-assets/icons/Line";
|
|
9
|
-
import '../styles/custom-instance.css';var h = {
|
|
10
|
-
customInstance: "_customInstance_xq8r7_1",
|
|
11
|
-
customInstanceField: "_customInstanceField_xq8r7_7",
|
|
12
|
-
customInstanceFieldInput: "_customInstanceFieldInput_xq8r7_12",
|
|
13
|
-
customInstanceFieldIcon: "_customInstanceFieldIcon_xq8r7_16"
|
|
14
|
-
}, g = (g) => {
|
|
15
|
-
let { isLoading: _ } = g, { values: v } = p(), y = a(), [b, x] = i(!v.metadata.fields.length), [S, C] = i(0), w = () => {
|
|
16
|
-
C(v.metadata.fields.length);
|
|
17
|
-
}, T = (e) => {
|
|
18
|
-
C(e === 0 ? 0 : e - 1);
|
|
19
|
-
}, E = r(null);
|
|
20
|
-
return n(() => {
|
|
21
|
-
v.metadata.fields.length > 0 ? E.current.focus() : x(!0);
|
|
22
|
-
}, [S, v.metadata.fields.length]), /* @__PURE__ */ o("div", { children: /* @__PURE__ */ o(f, {
|
|
23
|
-
name: "metadata.fields",
|
|
24
|
-
children: ({ remove: n, push: r }) => /* @__PURE__ */ s("div", {
|
|
25
|
-
className: h.customInstance,
|
|
26
|
-
children: [
|
|
27
|
-
v?.metadata.fields.map((e, r) => /* @__PURE__ */ s("div", {
|
|
28
|
-
className: h.customInstanceField,
|
|
29
|
-
children: [/* @__PURE__ */ o("div", {
|
|
30
|
-
className: h.customInstanceFieldInput,
|
|
31
|
-
children: /* @__PURE__ */ o(d, {
|
|
32
|
-
name: `metadata.fields[${r}].value`,
|
|
33
|
-
children: ({ field: n, meta: i }) => /* @__PURE__ */ o(u, {
|
|
34
|
-
...n,
|
|
35
|
-
ref: r === S ? E : null,
|
|
36
|
-
disabled: _,
|
|
37
|
-
error: i.error,
|
|
38
|
-
label: e.key,
|
|
39
|
-
placeholder: y.formatMessage(t.setValuePlaceholder)
|
|
40
|
-
})
|
|
41
|
-
})
|
|
42
|
-
}), /* @__PURE__ */ o(c, {
|
|
43
|
-
"aria-label": y.formatMessage(t.removeAttribute, { fieldName: e.key }),
|
|
44
|
-
className: h.customInstanceFieldIcon,
|
|
45
|
-
disabled: _,
|
|
46
|
-
icon: m,
|
|
47
|
-
onClick: () => {
|
|
48
|
-
n(r), T(r);
|
|
49
|
-
},
|
|
50
|
-
size: "x-small",
|
|
51
|
-
"data-target-id": "IconButton-removeAttribute"
|
|
52
|
-
})]
|
|
53
|
-
}, e.key)),
|
|
54
|
-
b && /* @__PURE__ */ o(e, {
|
|
55
|
-
formKeys: v.metadata.fields.map((e) => e.key),
|
|
56
|
-
onAdd: (e, t) => {
|
|
57
|
-
r({
|
|
58
|
-
key: e,
|
|
59
|
-
value: t
|
|
60
|
-
}), w(), x(!1);
|
|
61
|
-
},
|
|
62
|
-
onCancel: () => x(!1)
|
|
63
|
-
}),
|
|
64
|
-
!b && /* @__PURE__ */ o(l, {
|
|
65
|
-
disabled: _,
|
|
66
|
-
onClick: () => x(!0),
|
|
67
|
-
"data-target-id": "TextButton-addAttribute",
|
|
68
|
-
children: y.formatMessage(t.addAttribute)
|
|
69
|
-
})
|
|
70
|
-
]
|
|
71
|
-
})
|
|
72
|
-
}) });
|
|
73
|
-
};
|
|
74
|
-
export { g as t };
|
|
1
|
+
import{t as CustomInstanceNewField}from"./custom-instance-new-field.js";import messages from"../esm/lib/components/metadata-instance-editor/subcomponents/custom-instance/messages.js";import{useEffect,useRef,useState}from"react";import{useIntl}from"react-intl";import{jsx,jsxs}from"react/jsx-runtime";import{IconButton,TextButton,TextInput}from"@box/blueprint-web";import{Field,FieldArray,useFormikContext}from"formik";import{Trash}from"@box/blueprint-web-assets/icons/Line";import '../styles/custom-instance.css';var custom_instance_module_default={customInstance:`_customInstance_xq8r7_1`,customInstanceField:`_customInstanceField_xq8r7_7`,customInstanceFieldInput:`_customInstanceFieldInput_xq8r7_12`,customInstanceFieldIcon:`_customInstanceFieldIcon_xq8r7_16`},CustomInstance=props=>{let{isLoading}=props,{values}=useFormikContext(),intl=useIntl(),[isNewFieldVisible,setIsNewFieldVisible]=useState(!values.metadata.fields.length),[autoFocusIndex,setAutoFocusIndex]=useState(0),handleAddAttribute=()=>{setAutoFocusIndex(values.metadata.fields.length)},handleRemoveAttribute=index=>{setAutoFocusIndex(index===0?0:index-1)},focusRef=useRef(null);return useEffect(()=>{values.metadata.fields.length>0?focusRef.current.focus():setIsNewFieldVisible(!0)},[autoFocusIndex,values.metadata.fields.length]),jsx(`div`,{children:jsx(FieldArray,{name:`metadata.fields`,children:({remove,push})=>jsxs(`div`,{className:custom_instance_module_default.customInstance,children:[values?.metadata.fields.map((metadataField,index)=>jsxs(`div`,{className:custom_instance_module_default.customInstanceField,children:[jsx(`div`,{className:custom_instance_module_default.customInstanceFieldInput,children:jsx(Field,{name:`metadata.fields[${index}].value`,children:({field,meta})=>jsx(TextInput,{...field,ref:index===autoFocusIndex?focusRef:null,disabled:isLoading,error:meta.error,label:metadataField.key,placeholder:intl.formatMessage(messages.setValuePlaceholder)})})}),jsx(IconButton,{"aria-label":intl.formatMessage(messages.removeAttribute,{fieldName:metadataField.key}),className:custom_instance_module_default.customInstanceFieldIcon,disabled:isLoading,icon:Trash,onClick:()=>{remove(index),handleRemoveAttribute(index)},size:`x-small`,"data-target-id":`IconButton-removeAttribute`})]},metadataField.key)),isNewFieldVisible&&jsx(CustomInstanceNewField,{formKeys:values.metadata.fields.map(field=>field.key),onAdd:(key,value)=>{push({key,value}),handleAddAttribute(),setIsNewFieldVisible(!1)},onCancel:()=>setIsNewFieldVisible(!1)}),!isNewFieldVisible&&jsx(TextButton,{disabled:isLoading,onClick:()=>setIsNewFieldVisible(!0),"data-target-id":`TextButton-addAttribute`,children:intl.formatMessage(messages.addAttribute)})]})})})};export{CustomInstance as t};
|
|
@@ -1,76 +1 @@
|
|
|
1
|
-
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
|
-
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 = r(), [_, v] = t(""), [y, b] = t(!1), x = (e) => {
|
|
8
|
-
e || (p(), v(""), b(!1));
|
|
9
|
-
}, S = f || g.formatMessage(e.deleteConfirmationModalCustomMetadata), C = _ === S, w = () => {
|
|
10
|
-
b(!y);
|
|
11
|
-
}, T = () => {
|
|
12
|
-
d(), x(!1);
|
|
13
|
-
};
|
|
14
|
-
return /* @__PURE__ */ i(s, {
|
|
15
|
-
onOpenChange: x,
|
|
16
|
-
open: m,
|
|
17
|
-
children: /* @__PURE__ */ a(s.Content, {
|
|
18
|
-
onEscapeKeyDown: (e) => e.stopPropagation(),
|
|
19
|
-
size: "small",
|
|
20
|
-
children: [
|
|
21
|
-
/* @__PURE__ */ i(s.Header, {
|
|
22
|
-
"aria-label": g.formatMessage(e.deleteConfirmationModalHeaderAriaLabel),
|
|
23
|
-
children: /* @__PURE__ */ i(n, {
|
|
24
|
-
...e.deleteConfirmationModalHeader,
|
|
25
|
-
values: { templateName: S }
|
|
26
|
-
})
|
|
27
|
-
}),
|
|
28
|
-
/* @__PURE__ */ i(s.ScrollableContainer, { children: /* @__PURE__ */ a(s.Body, {
|
|
29
|
-
className: u.modalBody,
|
|
30
|
-
children: [
|
|
31
|
-
/* @__PURE__ */ i(c, {
|
|
32
|
-
as: "p",
|
|
33
|
-
children: h ? /* @__PURE__ */ i(n, {
|
|
34
|
-
...e.deleteConfirmationModalBodyFirstParagraphCheckboxVersion,
|
|
35
|
-
values: { templateName: S }
|
|
36
|
-
}) : /* @__PURE__ */ i(n, {
|
|
37
|
-
...e.deleteConfirmationModalBodyFirstParagraph,
|
|
38
|
-
values: { templateName: S }
|
|
39
|
-
})
|
|
40
|
-
}),
|
|
41
|
-
!h && /* @__PURE__ */ i(c, {
|
|
42
|
-
as: "p",
|
|
43
|
-
children: /* @__PURE__ */ i(n, { ...e.deleteConfirmationModalBodySecondParagraph })
|
|
44
|
-
}),
|
|
45
|
-
h ? /* @__PURE__ */ i(o.Item, {
|
|
46
|
-
checked: y,
|
|
47
|
-
"data-resin-target": "checkbox",
|
|
48
|
-
label: g.formatMessage(e.deleteConfirmationModalBodyCheckboxLabel),
|
|
49
|
-
onCheckedChange: w,
|
|
50
|
-
value: "overageCheckbox"
|
|
51
|
-
}) : /* @__PURE__ */ i(l, {
|
|
52
|
-
label: g.formatMessage(e.deleteConfirmationModalBodyInputFieldLabel),
|
|
53
|
-
onChange: (e) => v(e.target.value),
|
|
54
|
-
placeholder: S,
|
|
55
|
-
required: !0,
|
|
56
|
-
value: _
|
|
57
|
-
})
|
|
58
|
-
]
|
|
59
|
-
}) }),
|
|
60
|
-
/* @__PURE__ */ a(s.Footer, { children: [/* @__PURE__ */ i(s.Footer.SecondaryButton, {
|
|
61
|
-
onClick: () => x(!1),
|
|
62
|
-
size: "large",
|
|
63
|
-
"data-target-id": "Modal.Footer.SecondaryButton-deleteConfirmationModalCancelButton",
|
|
64
|
-
children: g.formatMessage(e.deleteConfirmationModalCancelButton)
|
|
65
|
-
}), /* @__PURE__ */ i(s.Footer.PrimaryButton, {
|
|
66
|
-
disabled: h ? !y : !C,
|
|
67
|
-
onClick: T,
|
|
68
|
-
size: "large",
|
|
69
|
-
children: g.formatMessage(h ? e.deleteConfirmationModalConfirmButtonCheckboxVersion : e.deleteConfirmationModalConfirmButton)
|
|
70
|
-
})] }),
|
|
71
|
-
/* @__PURE__ */ i(s.Close, { "aria-label": g.formatMessage(e.deleteConfirmationModalDismissButton) })
|
|
72
|
-
]
|
|
73
|
-
})
|
|
74
|
-
});
|
|
75
|
-
};
|
|
76
|
-
export { d as t };
|
|
1
|
+
import messages from"../esm/lib/components/metadata-instance-editor/subcomponents/delete-confirmation-modal/messages.js";import{useState}from"react";import{FormattedMessage,useIntl}from"react-intl";import{jsx,jsxs}from"react/jsx-runtime";import{Checkbox,Modal,Text,TextInput}from"@box/blueprint-web";import '../styles/delete-confirmation-modal.css';var delete_confirmation_modal_module_default={modalBody:`_modalBody_1wc7x_1`},DeleteConfirmationModal=({onConfirm,templateName,onDismiss,open,isCheckboxEnabled})=>{let intl=useIntl(),[inputValue,setInputValue]=useState(``),[isChecked,setIsChecked]=useState(!1),handleOpenChange=openState=>{openState||(onDismiss(),setInputValue(``),setIsChecked(!1))},formattedTemplateName=templateName||intl.formatMessage(messages.deleteConfirmationModalCustomMetadata),isInputValueValid=inputValue===formattedTemplateName,handleCheckboxChange=()=>{setIsChecked(!isChecked)},handleConfirm=()=>{onConfirm(),handleOpenChange(!1)};return jsx(Modal,{onOpenChange:handleOpenChange,open,children:jsxs(Modal.Content,{onEscapeKeyDown:e=>e.stopPropagation(),size:`small`,children:[jsx(Modal.Header,{"aria-label":intl.formatMessage(messages.deleteConfirmationModalHeaderAriaLabel),children:jsx(FormattedMessage,{...messages.deleteConfirmationModalHeader,values:{templateName:formattedTemplateName}})}),jsx(Modal.ScrollableContainer,{children:jsxs(Modal.Body,{className:delete_confirmation_modal_module_default.modalBody,children:[jsx(Text,{as:`p`,children:isCheckboxEnabled?jsx(FormattedMessage,{...messages.deleteConfirmationModalBodyFirstParagraphCheckboxVersion,values:{templateName:formattedTemplateName}}):jsx(FormattedMessage,{...messages.deleteConfirmationModalBodyFirstParagraph,values:{templateName:formattedTemplateName}})}),!isCheckboxEnabled&&jsx(Text,{as:`p`,children:jsx(FormattedMessage,{...messages.deleteConfirmationModalBodySecondParagraph})}),isCheckboxEnabled?jsx(Checkbox.Item,{checked:isChecked,"data-resin-target":`checkbox`,label:intl.formatMessage(messages.deleteConfirmationModalBodyCheckboxLabel),onCheckedChange:handleCheckboxChange,value:`overageCheckbox`}):jsx(TextInput,{label:intl.formatMessage(messages.deleteConfirmationModalBodyInputFieldLabel),onChange:event=>setInputValue(event.target.value),placeholder:formattedTemplateName,required:!0,value:inputValue})]})}),jsxs(Modal.Footer,{children:[jsx(Modal.Footer.SecondaryButton,{onClick:()=>handleOpenChange(!1),size:`large`,"data-target-id":`Modal.Footer.SecondaryButton-deleteConfirmationModalCancelButton`,children:intl.formatMessage(messages.deleteConfirmationModalCancelButton)}),jsx(Modal.Footer.PrimaryButton,{disabled:isCheckboxEnabled?!isChecked:!isInputValueValid,onClick:handleConfirm,size:`large`,children:intl.formatMessage(isCheckboxEnabled?messages.deleteConfirmationModalConfirmButtonCheckboxVersion:messages.deleteConfirmationModalConfirmButton)})]}),jsx(Modal.Close,{"aria-label":intl.formatMessage(messages.deleteConfirmationModalDismissButton)})]})})};export{DeleteConfirmationModal as t};
|
|
@@ -1,7 +1 @@
|
|
|
1
|
-
import '../styles/field-action-bar.css';var
|
|
2
|
-
wrapperGradient: "_wrapperGradient_9h730_1",
|
|
3
|
-
wrapper: "_wrapper_9h730_1",
|
|
4
|
-
buttons: "_buttons_9h730_25",
|
|
5
|
-
loader: "_loader_9h730_30"
|
|
6
|
-
};
|
|
7
|
-
export { e as t };
|
|
1
|
+
import '../styles/field-action-bar.css';var field_action_bar_module_default={wrapperGradient:`_wrapperGradient_9h730_1`,wrapper:`_wrapper_9h730_1`,buttons:`_buttons_9h730_25`,loader:`_loader_9h730_30`};export{field_action_bar_module_default as t};
|
|
@@ -1,12 +1 @@
|
|
|
1
|
-
import '../styles/filter-dropdown-menu.css';var
|
|
2
|
-
content: "_content_19nii_27",
|
|
3
|
-
scrollableContainer: "_scrollableContainer_19nii_58",
|
|
4
|
-
item: "_item_19nii_63",
|
|
5
|
-
option: "_option_19nii_73",
|
|
6
|
-
search: "_search_19nii_94",
|
|
7
|
-
searchIcon: "_searchIcon_19nii_99",
|
|
8
|
-
clearSearchIcon: "_clearSearchIcon_19nii_108",
|
|
9
|
-
searchInput: "_searchInput_19nii_116",
|
|
10
|
-
searchDivider: "_searchDivider_19nii_171"
|
|
11
|
-
};
|
|
12
|
-
export { e as t };
|
|
1
|
+
import '../styles/filter-dropdown-menu.css';var filter_dropdown_menu_module_default={content:`_content_19nii_27`,scrollableContainer:`_scrollableContainer_19nii_58`,item:`_item_19nii_63`,option:`_option_19nii_73`,search:`_search_19nii_94`,searchIcon:`_searchIcon_19nii_99`,clearSearchIcon:`_clearSearchIcon_19nii_108`,searchInput:`_searchInput_19nii_116`,searchDivider:`_searchDivider_19nii_171`};export{filter_dropdown_menu_module_default as t};
|