@box/unified-share-modal 3.1.32 → 3.1.33
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.
|
@@ -10,111 +10,109 @@ 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
12
|
import { useCallback as o, useEffect as s, useRef as ae, useState as oe } from "react";
|
|
13
|
-
import
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import { Globe as de } from "@box/blueprint-web-assets/icons/Medium";
|
|
13
|
+
import { useIntl as se } from "react-intl";
|
|
14
|
+
import { Focusable as c, Modal as l, Text as u, Tooltip as d, useLabelable as f, useNotification as p, useUniqueId as m } from "@box/blueprint-web";
|
|
15
|
+
import { Fragment as h, jsx as g, jsxs as _ } from "react/jsx-runtime";
|
|
16
|
+
import { createPortal as ce } from "react-dom";
|
|
17
|
+
import { Globe as le } from "@box/blueprint-web-assets/icons/Medium";
|
|
19
18
|
import { bpSize040 as v } from "@box/blueprint-web-assets/tokens/tokens";
|
|
20
|
-
import { UserSelectorContainer as
|
|
19
|
+
import { UserSelectorContainer as ue } from "@box/user-selector";
|
|
21
20
|
import '../styles/collaboration-section.css';var y = {
|
|
22
|
-
container: "
|
|
23
|
-
label: "
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
access: "_access_8nyxi_85"
|
|
21
|
+
container: "_container_1w5nm_27",
|
|
22
|
+
label: "_label_1w5nm_33",
|
|
23
|
+
security: "_security_1w5nm_60",
|
|
24
|
+
disclosures: "_disclosures_1w5nm_64",
|
|
25
|
+
icon: "_icon_1w5nm_70",
|
|
26
|
+
access: "_access_1w5nm_76"
|
|
29
27
|
};
|
|
30
28
|
function b() {
|
|
31
|
-
let { formatMessage: b } =
|
|
32
|
-
|
|
33
|
-
let { errors:
|
|
29
|
+
let { formatMessage: b } = se(), [x, S] = oe(), { addNotification: de } = p(), { validateShieldRestriction: fe } = ee(), { contactValue: pe, containerRef: C, form: w, setForm: T, setUserContacts: E, shieldRestriction: D, userContacts: O } = r(), { collaborationAccess: k, collaborationNotices: A, config: j, contactService: M, invitationFormNotices: N, isFetching: P, isSubmitting: F, item: I, onOpenChange: L, sharingService: R, variant: z } = e(), { permissions: B = {}, type: me } = I, { getContacts: V, getContactsAvatarUrls: H } = M, { sendInvitations: he, sendSharedLink: ge } = R, _e = z === "desktop", U = w === "default" || w === "invite", W = w === "invite" || w === "email", ve = w === "invite" && j.collaborationMessage, ye = w === "email" && j.sharedLinkEmailMessage, G = O.some((e) => e.isExternalUser), K, q;
|
|
30
|
+
w === "invite" && (K = he, q = "invite-collaborators"), w === "email" && (K = ge, q = "email-shared-link");
|
|
31
|
+
let { errors: be, handleFormReset: J, handleFormSubmit: xe, handleSelectedUsersChange: Y, handleUserSelectorBlur: Se, updateContactValue: Ce } = te(K, q), X = ae(w === "email" ? "email" : "invite");
|
|
34
32
|
s(() => {
|
|
35
|
-
X.current =
|
|
36
|
-
}, [
|
|
37
|
-
(!
|
|
38
|
-
}, [
|
|
39
|
-
let
|
|
40
|
-
W ||
|
|
41
|
-
},
|
|
33
|
+
X.current = w === "email" ? "email" : "invite";
|
|
34
|
+
}, [w]), s(() => {
|
|
35
|
+
(!O.length || !O.some((e) => e.chipVariant === "error")) && S(null);
|
|
36
|
+
}, [O]);
|
|
37
|
+
let we = o((e) => (e.stopPropagation(), !0), []), Te = o((e) => V ? V(e, X.current) : Promise.resolve([]), [V]), Ee = o((e) => H ? H(e) : Promise.resolve({}), [H]), De = (e) => {
|
|
38
|
+
W || T("invite"), Ce(e);
|
|
39
|
+
}, Oe = o((e) => {
|
|
42
40
|
let n = e.clipboardData.getData("text");
|
|
43
|
-
t(n).length !== 0 && (e.preventDefault(), W ||
|
|
41
|
+
t(n).length !== 0 && (e.preventDefault(), W || T("invite"), Y([...O, { value: n }]));
|
|
44
42
|
}, [
|
|
45
43
|
Y,
|
|
46
44
|
W,
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
]),
|
|
50
|
-
J(),
|
|
51
|
-
},
|
|
45
|
+
T,
|
|
46
|
+
O
|
|
47
|
+
]), ke = () => {
|
|
48
|
+
J(), T("default");
|
|
49
|
+
}, Ae = async () => {
|
|
52
50
|
try {
|
|
53
51
|
if (x) {
|
|
54
|
-
let e =
|
|
52
|
+
let e = fe(O, D);
|
|
55
53
|
if (e) {
|
|
56
|
-
|
|
54
|
+
de({
|
|
57
55
|
...n(b, "error"),
|
|
58
56
|
styledText: e
|
|
59
57
|
});
|
|
60
58
|
return;
|
|
61
59
|
}
|
|
62
60
|
}
|
|
63
|
-
if (await
|
|
64
|
-
J(),
|
|
61
|
+
if (await xe()) return;
|
|
62
|
+
J(), L(!1), T("default");
|
|
65
63
|
} catch (e) {
|
|
66
64
|
if (!e.shieldRestriction) return;
|
|
67
|
-
let { shieldRestriction: t } = e, n = [...t.restrictedEmails ?? [], ...t.restrictedGroups ?? []], r =
|
|
65
|
+
let { shieldRestriction: t } = e, n = [...t.restrictedEmails ?? [], ...t.restrictedGroups ?? []], r = O.map((e) => n.includes(e.email) || n.includes(`${e.id}`) ? {
|
|
68
66
|
...e,
|
|
69
67
|
chipVariant: "error"
|
|
70
68
|
} : e);
|
|
71
|
-
S(t),
|
|
69
|
+
S(t), E(r);
|
|
72
70
|
}
|
|
73
71
|
}, Z, Q = !1;
|
|
74
|
-
U && !B.canInviteCollaborator && (Z = b(i.inviteDisabledTooltip), Q = !0), U &&
|
|
75
|
-
let $ =
|
|
72
|
+
U && !B.canInviteCollaborator && (Z = b(i.inviteDisabledTooltip), Q = !0), U && me === "web_link" && (Z = b(i.inviteWebLinkDisabledTooltip), Q = !0);
|
|
73
|
+
let $ = m("usm-UserContacts-"), je = f(b(U ? i.invitePeopleLabel : i.emailSharedLinkLabel), $);
|
|
76
74
|
return /* @__PURE__ */ _("form", {
|
|
77
75
|
className: y.container,
|
|
78
76
|
onSubmit: (e) => e.preventDefault(),
|
|
79
77
|
children: [
|
|
80
78
|
x && /* @__PURE__ */ g(re, {
|
|
81
79
|
error: x,
|
|
82
|
-
isLoading:
|
|
80
|
+
isLoading: F,
|
|
83
81
|
onSelectedUsersChange: Y
|
|
84
82
|
}),
|
|
85
|
-
|
|
83
|
+
A,
|
|
86
84
|
/* @__PURE__ */ _("div", { children: [
|
|
87
|
-
U &&
|
|
88
|
-
/* @__PURE__ */ g(
|
|
89
|
-
/* @__PURE__ */ g(
|
|
85
|
+
U && j.collaborators && /* @__PURE__ */ g(ne, {}),
|
|
86
|
+
/* @__PURE__ */ g(je, { className: y.label }),
|
|
87
|
+
/* @__PURE__ */ g(d, {
|
|
90
88
|
content: Z,
|
|
91
89
|
"data-testid": "usm-UserContacts-tooltip",
|
|
92
90
|
open: Z ? void 0 : !1,
|
|
93
91
|
side: "bottom",
|
|
94
|
-
children: /* @__PURE__ */ g(
|
|
92
|
+
children: /* @__PURE__ */ g(c, {
|
|
95
93
|
focusable: Q,
|
|
96
|
-
children: /* @__PURE__ */ g(
|
|
94
|
+
children: /* @__PURE__ */ g(ue, {
|
|
97
95
|
autoFocus: B.canInviteCollaborator,
|
|
98
96
|
className: "usm-UserContacts-input",
|
|
99
97
|
clearButtonAriaLabel: b(i.clearButton),
|
|
100
98
|
clearOnBlur: !1,
|
|
101
99
|
"data-target-id": "PillSelectorDropdown-AddNamesOrEmailAddresses",
|
|
102
|
-
disabled: Q ||
|
|
100
|
+
disabled: Q || F,
|
|
103
101
|
displayChipVariant: (e) => e.chipVariant,
|
|
104
|
-
error:
|
|
105
|
-
fetchAvatarUrls:
|
|
106
|
-
fetchUsers:
|
|
107
|
-
hideOnEscape:
|
|
102
|
+
error: be.userContacts,
|
|
103
|
+
fetchAvatarUrls: Ee,
|
|
104
|
+
fetchUsers: Te,
|
|
105
|
+
hideOnEscape: we,
|
|
108
106
|
idForLabel: $,
|
|
109
|
-
inputValue:
|
|
107
|
+
inputValue: pe,
|
|
110
108
|
label: null,
|
|
111
|
-
onBlur:
|
|
112
|
-
onInputValueChange:
|
|
113
|
-
onPaste:
|
|
109
|
+
onBlur: Se,
|
|
110
|
+
onInputValueChange: De,
|
|
111
|
+
onPaste: Oe,
|
|
114
112
|
onSelectedUsersChange: Y,
|
|
115
|
-
placeholder:
|
|
116
|
-
portalElement:
|
|
117
|
-
selectedUsers:
|
|
113
|
+
placeholder: O.length ? "" : b(i.invitePeoplePlaceholder),
|
|
114
|
+
portalElement: C,
|
|
115
|
+
selectedUsers: O,
|
|
118
116
|
selectOnEnterOrTab: !0,
|
|
119
117
|
variant: W ? "textarea" : "input"
|
|
120
118
|
})
|
|
@@ -122,39 +120,39 @@ function b() {
|
|
|
122
120
|
}),
|
|
123
121
|
U && /* @__PURE__ */ _("div", {
|
|
124
122
|
className: y.access,
|
|
125
|
-
children: [
|
|
123
|
+
children: [j.collaborationRole && /* @__PURE__ */ g(a, {}), k]
|
|
126
124
|
})
|
|
127
125
|
] }),
|
|
128
|
-
(
|
|
129
|
-
W && (G ||
|
|
126
|
+
(ve || ye) && /* @__PURE__ */ g(ie, { maxCount: j.collaborationMessageLimit }),
|
|
127
|
+
W && (G || N) && /* @__PURE__ */ _("div", {
|
|
130
128
|
className: y.disclosures,
|
|
131
129
|
children: [G && /* @__PURE__ */ _("div", {
|
|
132
130
|
className: y.security,
|
|
133
|
-
children: [/* @__PURE__ */ g(
|
|
131
|
+
children: [/* @__PURE__ */ g(le, {
|
|
134
132
|
className: y.icon,
|
|
135
133
|
height: v,
|
|
136
134
|
width: v
|
|
137
|
-
}), /* @__PURE__ */ g(
|
|
135
|
+
}), /* @__PURE__ */ g(u, {
|
|
138
136
|
as: "span",
|
|
139
137
|
color: "textOnLightSecondary",
|
|
140
138
|
children: b(i.contentSharedWithExternalCollaborators)
|
|
141
139
|
})]
|
|
142
|
-
}),
|
|
140
|
+
}), N]
|
|
143
141
|
}),
|
|
144
|
-
W &&
|
|
145
|
-
disabled:
|
|
146
|
-
onClick:
|
|
142
|
+
W && C && /*#__PURE__*/ ce(/* @__PURE__ */ _(h, { children: [!P && /* @__PURE__ */ _(l.Footer, { children: [/* @__PURE__ */ g(l.Footer.SecondaryButton, {
|
|
143
|
+
disabled: F,
|
|
144
|
+
onClick: ke,
|
|
147
145
|
children: b(i.cancelButton)
|
|
148
|
-
}), /* @__PURE__ */ g(
|
|
146
|
+
}), /* @__PURE__ */ g(l.Footer.PrimaryButton, {
|
|
149
147
|
"data-target-id": "Modal.Footer.PrimaryButton-USMSendInvite",
|
|
150
|
-
loading:
|
|
148
|
+
loading: F,
|
|
151
149
|
loadingAriaLabel: b(i.loadingLabel),
|
|
152
|
-
onClick:
|
|
150
|
+
onClick: Ae,
|
|
153
151
|
children: b(i.sendButton)
|
|
154
|
-
})] }), !
|
|
152
|
+
})] }), !_e && /* @__PURE__ */ g(l.Close, {
|
|
155
153
|
"aria-label": b(i.closeButton),
|
|
156
|
-
disabled:
|
|
157
|
-
})] }),
|
|
154
|
+
disabled: F
|
|
155
|
+
})] }), C)
|
|
158
156
|
]
|
|
159
157
|
});
|
|
160
158
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.
|
|
1
|
+
._container_1w5nm_27{gap:var(--bp-space-040);flex-direction:column;display:flex}._label_1w5nm_33{font-weight:var(--bp-font-weight-bold);font-size:var(--bp-font-size-05);font-family:var(--bp-font-font-family), -apple-system, BlinkMacSystemFont, "San Francisco", "Segoe UI", Roboto, "Helvetica Neue", sans-serif;font-style:normal;line-height:var(--bp-font-line-height-04);letter-spacing:var(--bp-font-letter-spacing-01)}:where(body.is-inter-font) ._label_1w5nm_33{letter-spacing:0;text-transform:none;font-family:InterVariable,-apple-system,BlinkMacSystemFont,San Francisco,Segoe UI,Roboto,Helvetica Neue,sans-serif;font-size:.875rem;font-style:normal;font-weight:600;line-height:1.25rem;text-decoration:none}._label_1w5nm_33{padding:var(--bp-space-010) 0;color:var(--text-text-on-light);overflow-wrap:break-word;margin-block-end:var(--space-2);display:block}._security_1w5nm_60{margin-top:calc(var(--bp-space-010) * -1)}._disclosures_1w5nm_64{gap:var(--bp-space-010);flex-direction:column;display:flex}._icon_1w5nm_70{height:var(--bp-size-050);margin-right:var(--bp-space-010);vertical-align:text-bottom}._access_1w5nm_76{gap:var(--bp-space-010);margin-top:var(--bp-space-030);flex-wrap:wrap;display:flex}
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@box/unified-share-modal",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.33",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE",
|
|
5
5
|
"peerDependencies": {
|
|
6
6
|
"@box/blueprint-web": "^16.10.0",
|
|
7
7
|
"@box/blueprint-web-assets": "^5.5.5",
|
|
8
8
|
"@box/copy-input": "^2.1.30",
|
|
9
|
-
"@box/user-selector": "^2.1.
|
|
9
|
+
"@box/user-selector": "^2.1.33",
|
|
10
10
|
"lodash": "^4.17.15",
|
|
11
11
|
"react": "^18.0.0",
|
|
12
12
|
"react-dom": "^18.0.0",
|