@box/unified-share-modal 2.13.13 → 2.14.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -9,16 +9,16 @@ import { t as a } from "./collaboration-role.js";
|
|
|
9
9
|
import { t as ne } from "./shared-with-avatars.js";
|
|
10
10
|
import { t as re } from "./shield-restriction-notice.js";
|
|
11
11
|
import { t as ie } from "./text-area-container.js";
|
|
12
|
-
import { useCallback as o, useEffect as s, useRef as ae, useState as
|
|
13
|
-
import
|
|
14
|
-
import { useIntl as
|
|
15
|
-
import { Focusable as
|
|
16
|
-
import { Fragment as
|
|
17
|
-
import { createPortal as
|
|
18
|
-
import { Globe as
|
|
19
|
-
import { bpSize040 as
|
|
20
|
-
import { UserSelectorContainer as
|
|
21
|
-
import '../styles/collaboration-section.css';var
|
|
12
|
+
import { useCallback as o, useEffect as s, useRef as ae, useState as oe } from "react";
|
|
13
|
+
import c from "clsx";
|
|
14
|
+
import { useIntl as l } from "react-intl";
|
|
15
|
+
import { Focusable as u, Modal as d, Text as f, Tooltip as p, useBlueprintModernization as se, useLabelable as ce, useNotification as le, useUniqueId as ue } from "@box/blueprint-web";
|
|
16
|
+
import { Fragment as de, jsx as m, jsxs as h } from "react/jsx-runtime";
|
|
17
|
+
import { createPortal as fe } from "react-dom";
|
|
18
|
+
import { Globe as pe } from "@box/blueprint-web-assets/icons/Medium";
|
|
19
|
+
import { bpSize040 as g } from "@box/blueprint-web-assets/tokens/tokens";
|
|
20
|
+
import { UserSelectorContainer as me } from "@box/user-selector";
|
|
21
|
+
import '../styles/collaboration-section.css';var _ = {
|
|
22
22
|
container: "_container_1e2gg_2",
|
|
23
23
|
label: "_label_1e2gg_8",
|
|
24
24
|
modernized: "_modernized_1e2gg_15",
|
|
@@ -26,131 +26,132 @@ import '../styles/collaboration-section.css';var v = {
|
|
|
26
26
|
icon: "_icon_1e2gg_37",
|
|
27
27
|
access: "_access_1e2gg_43"
|
|
28
28
|
};
|
|
29
|
-
function
|
|
30
|
-
let { formatMessage:
|
|
31
|
-
|
|
32
|
-
let { errors: Ce, handleFormReset: q, handleFormSubmit: we, handleSelectedUsersChange: J, handleUserSelectorBlur: Te, updateContactValue: Ee } = te(G, K), Y = ae(
|
|
29
|
+
function v() {
|
|
30
|
+
let { formatMessage: v } = l(), [y, b] = oe(), { enableModernizedComponents: x } = se(), { addNotification: S } = le(), { validateShieldRestriction: C } = ee(), { contactValue: w, containerRef: T, form: E, setForm: D, setUserContacts: O, shieldRestriction: k, userContacts: A } = r(), { collaborationAccess: j, collaborationNotices: M, config: N, contactService: P, isFetching: F, isSubmitting: I, item: L, onOpenChange: R, sharingService: z, variant: he } = e(), { permissions: B = {}, type: ge } = L, { getContacts: V, getContactsAvatarUrls: H } = P, { sendInvitations: _e, sendSharedLink: ve } = z, ye = he === "desktop", U = E === "default" || E === "invite", W = E === "invite" || E === "email", be = E === "invite" && N.collaborationMessage, xe = E === "email" && N.sharedLinkEmailMessage, Se = A.some((e) => e.isExternalUser), G, K;
|
|
31
|
+
E === "invite" && (G = _e, K = "invite-collaborators"), E === "email" && (G = ve, K = "email-shared-link");
|
|
32
|
+
let { errors: Ce, handleFormReset: q, handleFormSubmit: we, handleSelectedUsersChange: J, handleUserSelectorBlur: Te, updateContactValue: Ee } = te(G, K), Y = ae(E === "email" ? "email" : "invite");
|
|
33
33
|
s(() => {
|
|
34
|
-
Y.current =
|
|
35
|
-
}, [
|
|
36
|
-
(!
|
|
37
|
-
}, [
|
|
34
|
+
Y.current = E === "email" ? "email" : "invite";
|
|
35
|
+
}, [E]), s(() => {
|
|
36
|
+
(!A.length || !A.some((e) => e.chipVariant === "error")) && b(null);
|
|
37
|
+
}, [A]);
|
|
38
38
|
let De = o((e) => (e.stopPropagation(), !0), []), Oe = o((e) => V ? V(e, Y.current) : Promise.resolve([]), [V]), ke = o((e) => H ? H(e) : Promise.resolve({}), [H]), Ae = (e) => {
|
|
39
|
-
W ||
|
|
39
|
+
W || D("invite"), Ee(e);
|
|
40
40
|
}, X = o((e) => {
|
|
41
41
|
let n = e.clipboardData.getData("text");
|
|
42
|
-
t(n).length !== 0 && (e.preventDefault(), W ||
|
|
42
|
+
t(n).length !== 0 && (e.preventDefault(), W || D("invite"), J([...A, { value: n }]));
|
|
43
43
|
}, [
|
|
44
44
|
J,
|
|
45
45
|
W,
|
|
46
|
-
|
|
47
|
-
|
|
46
|
+
D,
|
|
47
|
+
A
|
|
48
48
|
]), je = () => {
|
|
49
|
-
q(),
|
|
49
|
+
q(), D("default");
|
|
50
50
|
}, Me = async () => {
|
|
51
51
|
try {
|
|
52
|
-
if (
|
|
53
|
-
let e =
|
|
52
|
+
if (y) {
|
|
53
|
+
let e = C(A, k);
|
|
54
54
|
if (e) {
|
|
55
|
-
|
|
56
|
-
...n(
|
|
55
|
+
S({
|
|
56
|
+
...n(v, "error"),
|
|
57
57
|
styledText: e
|
|
58
58
|
});
|
|
59
59
|
return;
|
|
60
60
|
}
|
|
61
61
|
}
|
|
62
62
|
if (await we()) return;
|
|
63
|
-
q(),
|
|
63
|
+
q(), R(!1), D("default");
|
|
64
64
|
} catch (e) {
|
|
65
65
|
if (!e.shieldRestriction) return;
|
|
66
|
-
let { shieldRestriction: t } = e, n = [...t.restrictedEmails ?? [], ...t.restrictedGroups ?? []], r =
|
|
66
|
+
let { shieldRestriction: t } = e, n = [...t.restrictedEmails ?? [], ...t.restrictedGroups ?? []], r = A.map((e) => n.includes(e.email) || n.includes(`${e.id}`) ? {
|
|
67
67
|
...e,
|
|
68
68
|
chipVariant: "error"
|
|
69
69
|
} : e);
|
|
70
|
-
|
|
70
|
+
b(t), O(r);
|
|
71
71
|
}
|
|
72
72
|
}, Z, Q = !1;
|
|
73
|
-
U && !
|
|
74
|
-
let $ =
|
|
75
|
-
return /* @__PURE__ */
|
|
76
|
-
className:
|
|
73
|
+
U && !B.canInviteCollaborator && (Z = v(i.inviteDisabledTooltip), Q = !0), U && ge === "web_link" && (Z = v(i.inviteWebLinkDisabledTooltip), Q = !0);
|
|
74
|
+
let $ = ue("usm-UserContacts-"), Ne = ce(v(U ? i.invitePeopleLabel : i.emailSharedLinkLabel), $);
|
|
75
|
+
return /* @__PURE__ */ h("form", {
|
|
76
|
+
className: _.container,
|
|
77
77
|
onSubmit: (e) => e.preventDefault(),
|
|
78
78
|
children: [
|
|
79
|
-
|
|
80
|
-
error:
|
|
81
|
-
isLoading:
|
|
79
|
+
y && /* @__PURE__ */ m(re, {
|
|
80
|
+
error: y,
|
|
81
|
+
isLoading: I,
|
|
82
82
|
onSelectedUsersChange: J
|
|
83
83
|
}),
|
|
84
|
-
|
|
85
|
-
/* @__PURE__ */
|
|
86
|
-
U &&
|
|
87
|
-
/* @__PURE__ */
|
|
88
|
-
/* @__PURE__ */
|
|
84
|
+
M,
|
|
85
|
+
/* @__PURE__ */ h("div", { children: [
|
|
86
|
+
U && N.collaborators && /* @__PURE__ */ m(ne, {}),
|
|
87
|
+
/* @__PURE__ */ m(Ne, { className: c(_.label, x && _.modernized) }),
|
|
88
|
+
/* @__PURE__ */ m(p, {
|
|
89
89
|
content: Z,
|
|
90
90
|
"data-testid": "usm-UserContacts-tooltip",
|
|
91
91
|
open: Z ? void 0 : !1,
|
|
92
92
|
side: "bottom",
|
|
93
|
-
children: /* @__PURE__ */
|
|
93
|
+
children: /* @__PURE__ */ m(u, {
|
|
94
94
|
focusable: Q,
|
|
95
|
-
children: /* @__PURE__ */
|
|
95
|
+
children: /* @__PURE__ */ m(me, {
|
|
96
|
+
autoFocus: B.canInviteCollaborator,
|
|
96
97
|
className: "usm-UserContacts-input",
|
|
97
|
-
clearButtonAriaLabel:
|
|
98
|
+
clearButtonAriaLabel: v(i.clearButton),
|
|
98
99
|
clearOnBlur: !1,
|
|
99
100
|
"data-target-id": "PillSelectorDropdown-AddNamesOrEmailAddresses",
|
|
100
|
-
disabled: Q ||
|
|
101
|
+
disabled: Q || I,
|
|
101
102
|
displayChipVariant: (e) => e.chipVariant,
|
|
102
103
|
error: Ce.userContacts,
|
|
103
104
|
fetchAvatarUrls: ke,
|
|
104
105
|
fetchUsers: Oe,
|
|
105
106
|
hideOnEscape: De,
|
|
106
107
|
idForLabel: $,
|
|
107
|
-
inputValue:
|
|
108
|
+
inputValue: w,
|
|
108
109
|
label: null,
|
|
109
110
|
onBlur: Te,
|
|
110
111
|
onInputValueChange: Ae,
|
|
111
112
|
onPaste: X,
|
|
112
113
|
onSelectedUsersChange: J,
|
|
113
|
-
placeholder:
|
|
114
|
-
portalElement:
|
|
115
|
-
selectedUsers:
|
|
114
|
+
placeholder: A.length ? "" : v(i.invitePeoplePlaceholder),
|
|
115
|
+
portalElement: T,
|
|
116
|
+
selectedUsers: A,
|
|
116
117
|
selectOnEnterOrTab: !0,
|
|
117
118
|
variant: W ? "textarea" : "input"
|
|
118
119
|
})
|
|
119
120
|
})
|
|
120
121
|
}),
|
|
121
|
-
U && /* @__PURE__ */
|
|
122
|
-
className:
|
|
123
|
-
children: [
|
|
122
|
+
U && /* @__PURE__ */ h("div", {
|
|
123
|
+
className: _.access,
|
|
124
|
+
children: [N.collaborationRole && /* @__PURE__ */ m(a, {}), j]
|
|
124
125
|
})
|
|
125
126
|
] }),
|
|
126
|
-
(be || xe) && /* @__PURE__ */
|
|
127
|
-
W && Se && /* @__PURE__ */
|
|
128
|
-
className:
|
|
129
|
-
children: [/* @__PURE__ */
|
|
130
|
-
className:
|
|
131
|
-
height:
|
|
132
|
-
width:
|
|
133
|
-
}), /* @__PURE__ */
|
|
127
|
+
(be || xe) && /* @__PURE__ */ m(ie, { maxCount: N.collaborationMessageLimit }),
|
|
128
|
+
W && Se && /* @__PURE__ */ h("div", {
|
|
129
|
+
className: _.security,
|
|
130
|
+
children: [/* @__PURE__ */ m(pe, {
|
|
131
|
+
className: _.icon,
|
|
132
|
+
height: g,
|
|
133
|
+
width: g
|
|
134
|
+
}), /* @__PURE__ */ m(f, {
|
|
134
135
|
as: "span",
|
|
135
136
|
color: "textOnLightSecondary",
|
|
136
|
-
children:
|
|
137
|
+
children: v(i.contentSharedWithExternalCollaborators)
|
|
137
138
|
})]
|
|
138
139
|
}),
|
|
139
|
-
W &&
|
|
140
|
-
disabled:
|
|
140
|
+
W && T && /* @__PURE__ */ fe(/* @__PURE__ */ h(de, { children: [!F && /* @__PURE__ */ h(d.Footer, { children: [/* @__PURE__ */ m(d.Footer.SecondaryButton, {
|
|
141
|
+
disabled: I,
|
|
141
142
|
onClick: je,
|
|
142
|
-
children:
|
|
143
|
-
}), /* @__PURE__ */
|
|
143
|
+
children: v(i.cancelButton)
|
|
144
|
+
}), /* @__PURE__ */ m(d.Footer.PrimaryButton, {
|
|
144
145
|
"data-target-id": "Modal.Footer.PrimaryButton-USMSendInvite",
|
|
145
|
-
loading:
|
|
146
|
-
loadingAriaLabel:
|
|
146
|
+
loading: I,
|
|
147
|
+
loadingAriaLabel: v(i.loadingLabel),
|
|
147
148
|
onClick: Me,
|
|
148
|
-
children:
|
|
149
|
-
})] }), !ye && /* @__PURE__ */
|
|
150
|
-
"aria-label":
|
|
151
|
-
disabled:
|
|
152
|
-
})] }),
|
|
149
|
+
children: v(i.sendButton)
|
|
150
|
+
})] }), !ye && /* @__PURE__ */ m(d.Close, {
|
|
151
|
+
"aria-label": v(i.closeButton),
|
|
152
|
+
disabled: I
|
|
153
|
+
})] }), T)
|
|
153
154
|
]
|
|
154
155
|
});
|
|
155
156
|
}
|
|
156
|
-
export {
|
|
157
|
+
export { v as t };
|