@box/unified-share-modal 2.16.8 → 2.16.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/collaboration-section.js +82 -78
- package/dist/chunks/shared-link-section.js +68 -61
- package/dist/chunks/unified-share-form-modal.js +8 -8
- package/dist/esm/lib/contexts/unified-share-modal-context.js +26 -22
- package/dist/esm/lib/unified-share-modal.js +21 -19
- package/dist/styles/collaboration-section.css +1 -1
- package/dist/styles/shared-link-section.css +1 -1
- package/dist/styles/unified-share-form-modal.css +1 -1
- package/dist/types/lib/contexts/unified-share-modal-context.d.ts +5 -1
- package/dist/types/lib/stories/shared.d.ts +4 -0
- package/dist/types/lib/unified-share-modal.d.ts +9 -1
- package/package.json +10 -10
|
@@ -12,93 +12,94 @@ 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
13
|
import c from "clsx";
|
|
14
14
|
import { useIntl as l } from "react-intl";
|
|
15
|
-
import { Focusable as u, Modal as d, Text as f, Tooltip as p, useBlueprintModernization 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
|
|
22
|
-
container: "
|
|
23
|
-
label: "
|
|
24
|
-
modernized: "
|
|
25
|
-
security: "
|
|
26
|
-
|
|
27
|
-
|
|
15
|
+
import { Focusable as u, Modal as d, Text as f, Tooltip as p, useBlueprintModernization as m, useLabelable as h, useNotification as se, useUniqueId as ce } from "@box/blueprint-web";
|
|
16
|
+
import { Fragment as le, jsx as g, jsxs as _ } from "react/jsx-runtime";
|
|
17
|
+
import { createPortal as ue } from "react-dom";
|
|
18
|
+
import { Globe as de } from "@box/blueprint-web-assets/icons/Medium";
|
|
19
|
+
import { bpSize040 as v } from "@box/blueprint-web-assets/tokens/tokens";
|
|
20
|
+
import { UserSelectorContainer as fe } from "@box/user-selector";
|
|
21
|
+
import '../styles/collaboration-section.css';var y = {
|
|
22
|
+
container: "_container_1qux4_2",
|
|
23
|
+
label: "_label_1qux4_8",
|
|
24
|
+
modernized: "_modernized_1qux4_15",
|
|
25
|
+
security: "_security_1qux4_33",
|
|
26
|
+
disclosures: "_disclosures_1qux4_37",
|
|
27
|
+
icon: "_icon_1qux4_43",
|
|
28
|
+
access: "_access_1qux4_49"
|
|
28
29
|
};
|
|
29
|
-
function
|
|
30
|
-
let { formatMessage:
|
|
31
|
-
E === "invite" && (
|
|
32
|
-
let { errors: Ce, handleFormReset:
|
|
30
|
+
function b() {
|
|
31
|
+
let { formatMessage: b } = l(), [x, S] = oe(), { enableModernizedComponents: pe } = m(), { addNotification: me } = se(), { 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, invitationFormNotices: F, isFetching: I, isSubmitting: L, item: R, onOpenChange: z, sharingService: he, variant: ge } = e(), { permissions: B = {}, type: _e } = R, { getContacts: V, getContactsAvatarUrls: H } = P, { sendInvitations: ve, sendSharedLink: ye } = he, be = ge === "desktop", U = E === "default" || E === "invite", W = E === "invite" || E === "email", xe = E === "invite" && N.collaborationMessage, Se = E === "email" && N.sharedLinkEmailMessage, G = A.some((e) => e.isExternalUser), K, q;
|
|
32
|
+
E === "invite" && (K = ve, q = "invite-collaborators"), E === "email" && (K = ye, q = "email-shared-link");
|
|
33
|
+
let { errors: Ce, handleFormReset: J, handleFormSubmit: we, handleSelectedUsersChange: Y, handleUserSelectorBlur: Te, updateContactValue: Ee } = te(K, q), X = ae(E === "email" ? "email" : "invite");
|
|
33
34
|
s(() => {
|
|
34
|
-
|
|
35
|
+
X.current = E === "email" ? "email" : "invite";
|
|
35
36
|
}, [E]), s(() => {
|
|
36
|
-
(!A.length || !A.some((e) => e.chipVariant === "error")) &&
|
|
37
|
+
(!A.length || !A.some((e) => e.chipVariant === "error")) && S(null);
|
|
37
38
|
}, [A]);
|
|
38
|
-
let De = o((e) => (e.stopPropagation(), !0), []), Oe = o((e) => V ? V(e,
|
|
39
|
+
let De = o((e) => (e.stopPropagation(), !0), []), Oe = o((e) => V ? V(e, X.current) : Promise.resolve([]), [V]), ke = o((e) => H ? H(e) : Promise.resolve({}), [H]), Ae = (e) => {
|
|
39
40
|
W || D("invite"), Ee(e);
|
|
40
|
-
},
|
|
41
|
+
}, je = o((e) => {
|
|
41
42
|
let n = e.clipboardData.getData("text");
|
|
42
|
-
t(n).length !== 0 && (e.preventDefault(), W || D("invite"),
|
|
43
|
+
t(n).length !== 0 && (e.preventDefault(), W || D("invite"), Y([...A, { value: n }]));
|
|
43
44
|
}, [
|
|
44
|
-
|
|
45
|
+
Y,
|
|
45
46
|
W,
|
|
46
47
|
D,
|
|
47
48
|
A
|
|
48
|
-
]),
|
|
49
|
-
|
|
50
|
-
},
|
|
49
|
+
]), Me = () => {
|
|
50
|
+
J(), D("default");
|
|
51
|
+
}, Ne = async () => {
|
|
51
52
|
try {
|
|
52
|
-
if (
|
|
53
|
+
if (x) {
|
|
53
54
|
let e = C(A, k);
|
|
54
55
|
if (e) {
|
|
55
|
-
|
|
56
|
-
...n(
|
|
56
|
+
me({
|
|
57
|
+
...n(b, "error"),
|
|
57
58
|
styledText: e
|
|
58
59
|
});
|
|
59
60
|
return;
|
|
60
61
|
}
|
|
61
62
|
}
|
|
62
63
|
if (await we()) return;
|
|
63
|
-
|
|
64
|
+
J(), z(!1), D("default");
|
|
64
65
|
} catch (e) {
|
|
65
66
|
if (!e.shieldRestriction) return;
|
|
66
67
|
let { shieldRestriction: t } = e, n = [...t.restrictedEmails ?? [], ...t.restrictedGroups ?? []], r = A.map((e) => n.includes(e.email) || n.includes(`${e.id}`) ? {
|
|
67
68
|
...e,
|
|
68
69
|
chipVariant: "error"
|
|
69
70
|
} : e);
|
|
70
|
-
|
|
71
|
+
S(t), O(r);
|
|
71
72
|
}
|
|
72
73
|
}, Z, Q = !1;
|
|
73
|
-
U && !B.canInviteCollaborator && (Z =
|
|
74
|
-
let $ =
|
|
75
|
-
return /* @__PURE__ */
|
|
76
|
-
className:
|
|
74
|
+
U && !B.canInviteCollaborator && (Z = b(i.inviteDisabledTooltip), Q = !0), U && _e === "web_link" && (Z = b(i.inviteWebLinkDisabledTooltip), Q = !0);
|
|
75
|
+
let $ = ce("usm-UserContacts-"), Pe = h(b(U ? i.invitePeopleLabel : i.emailSharedLinkLabel), $);
|
|
76
|
+
return /* @__PURE__ */ _("form", {
|
|
77
|
+
className: y.container,
|
|
77
78
|
onSubmit: (e) => e.preventDefault(),
|
|
78
79
|
children: [
|
|
79
|
-
|
|
80
|
-
error:
|
|
81
|
-
isLoading:
|
|
82
|
-
onSelectedUsersChange:
|
|
80
|
+
x && /* @__PURE__ */ g(re, {
|
|
81
|
+
error: x,
|
|
82
|
+
isLoading: L,
|
|
83
|
+
onSelectedUsersChange: Y
|
|
83
84
|
}),
|
|
84
85
|
M,
|
|
85
|
-
/* @__PURE__ */
|
|
86
|
-
U && N.collaborators && /* @__PURE__ */
|
|
87
|
-
/* @__PURE__ */
|
|
88
|
-
/* @__PURE__ */
|
|
86
|
+
/* @__PURE__ */ _("div", { children: [
|
|
87
|
+
U && N.collaborators && /* @__PURE__ */ g(ne, {}),
|
|
88
|
+
/* @__PURE__ */ g(Pe, { className: c(y.label, pe && y.modernized) }),
|
|
89
|
+
/* @__PURE__ */ g(p, {
|
|
89
90
|
content: Z,
|
|
90
91
|
"data-testid": "usm-UserContacts-tooltip",
|
|
91
92
|
open: Z ? void 0 : !1,
|
|
92
93
|
side: "bottom",
|
|
93
|
-
children: /* @__PURE__ */
|
|
94
|
+
children: /* @__PURE__ */ g(u, {
|
|
94
95
|
focusable: Q,
|
|
95
|
-
children: /* @__PURE__ */
|
|
96
|
+
children: /* @__PURE__ */ g(fe, {
|
|
96
97
|
autoFocus: B.canInviteCollaborator,
|
|
97
98
|
className: "usm-UserContacts-input",
|
|
98
|
-
clearButtonAriaLabel:
|
|
99
|
+
clearButtonAriaLabel: b(i.clearButton),
|
|
99
100
|
clearOnBlur: !1,
|
|
100
101
|
"data-target-id": "PillSelectorDropdown-AddNamesOrEmailAddresses",
|
|
101
|
-
disabled: Q ||
|
|
102
|
+
disabled: Q || L,
|
|
102
103
|
displayChipVariant: (e) => e.chipVariant,
|
|
103
104
|
error: Ce.userContacts,
|
|
104
105
|
fetchAvatarUrls: ke,
|
|
@@ -109,9 +110,9 @@ function v() {
|
|
|
109
110
|
label: null,
|
|
110
111
|
onBlur: Te,
|
|
111
112
|
onInputValueChange: Ae,
|
|
112
|
-
onPaste:
|
|
113
|
-
onSelectedUsersChange:
|
|
114
|
-
placeholder: A.length ? "" :
|
|
113
|
+
onPaste: je,
|
|
114
|
+
onSelectedUsersChange: Y,
|
|
115
|
+
placeholder: A.length ? "" : b(i.invitePeoplePlaceholder),
|
|
115
116
|
portalElement: T,
|
|
116
117
|
selectedUsers: A,
|
|
117
118
|
selectOnEnterOrTab: !0,
|
|
@@ -119,39 +120,42 @@ function v() {
|
|
|
119
120
|
})
|
|
120
121
|
})
|
|
121
122
|
}),
|
|
122
|
-
U && /* @__PURE__ */
|
|
123
|
-
className:
|
|
124
|
-
children: [N.collaborationRole && /* @__PURE__ */
|
|
123
|
+
U && /* @__PURE__ */ _("div", {
|
|
124
|
+
className: y.access,
|
|
125
|
+
children: [N.collaborationRole && /* @__PURE__ */ g(a, {}), j]
|
|
125
126
|
})
|
|
126
127
|
] }),
|
|
127
|
-
(
|
|
128
|
-
W &&
|
|
129
|
-
className:
|
|
130
|
-
children: [/* @__PURE__ */
|
|
131
|
-
className:
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
128
|
+
(xe || Se) && /* @__PURE__ */ g(ie, { maxCount: N.collaborationMessageLimit }),
|
|
129
|
+
W && (G || F) && /* @__PURE__ */ _("div", {
|
|
130
|
+
className: y.disclosures,
|
|
131
|
+
children: [G && /* @__PURE__ */ _("div", {
|
|
132
|
+
className: y.security,
|
|
133
|
+
children: [/* @__PURE__ */ g(de, {
|
|
134
|
+
className: y.icon,
|
|
135
|
+
height: v,
|
|
136
|
+
width: v
|
|
137
|
+
}), /* @__PURE__ */ g(f, {
|
|
138
|
+
as: "span",
|
|
139
|
+
color: "textOnLightSecondary",
|
|
140
|
+
children: b(i.contentSharedWithExternalCollaborators)
|
|
141
|
+
})]
|
|
142
|
+
}), F]
|
|
139
143
|
}),
|
|
140
|
-
W && T && /* @__PURE__ */
|
|
141
|
-
disabled:
|
|
142
|
-
onClick: je,
|
|
143
|
-
children: v(i.cancelButton)
|
|
144
|
-
}), /* @__PURE__ */ m(d.Footer.PrimaryButton, {
|
|
145
|
-
"data-target-id": "Modal.Footer.PrimaryButton-USMSendInvite",
|
|
146
|
-
loading: I,
|
|
147
|
-
loadingAriaLabel: v(i.loadingLabel),
|
|
144
|
+
W && T && /* @__PURE__ */ ue(/* @__PURE__ */ _(le, { children: [!I && /* @__PURE__ */ _(d.Footer, { children: [/* @__PURE__ */ g(d.Footer.SecondaryButton, {
|
|
145
|
+
disabled: L,
|
|
148
146
|
onClick: Me,
|
|
149
|
-
children:
|
|
150
|
-
})
|
|
151
|
-
"
|
|
152
|
-
|
|
147
|
+
children: b(i.cancelButton)
|
|
148
|
+
}), /* @__PURE__ */ g(d.Footer.PrimaryButton, {
|
|
149
|
+
"data-target-id": "Modal.Footer.PrimaryButton-USMSendInvite",
|
|
150
|
+
loading: L,
|
|
151
|
+
loadingAriaLabel: b(i.loadingLabel),
|
|
152
|
+
onClick: Ne,
|
|
153
|
+
children: b(i.sendButton)
|
|
154
|
+
})] }), !be && /* @__PURE__ */ g(d.Close, {
|
|
155
|
+
"aria-label": b(i.closeButton),
|
|
156
|
+
disabled: L
|
|
153
157
|
})] }), T)
|
|
154
158
|
]
|
|
155
159
|
});
|
|
156
160
|
}
|
|
157
|
-
export {
|
|
161
|
+
export { b as t };
|
|
@@ -9,40 +9,41 @@ import { t as s } from "./shared-link-access.js";
|
|
|
9
9
|
import { t as ee } from "./shared-link-permission.js";
|
|
10
10
|
import { useCallback as c, useEffect as l, useRef as u } from "react";
|
|
11
11
|
import { useIntl as d } from "react-intl";
|
|
12
|
-
import { Button as
|
|
13
|
-
import { jsx as
|
|
14
|
-
import { ClockBadge as
|
|
12
|
+
import { Button as te, Focusable as ne, Link as f, Status as re, Switch as ie, Text as p, Tooltip as m, useNotification as h } from "@box/blueprint-web";
|
|
13
|
+
import { jsx as g, jsxs as _ } from "react/jsx-runtime";
|
|
14
|
+
import { ClockBadge as v } from "@box/blueprint-web-assets/icons/Line";
|
|
15
15
|
import { CopyInput as y } from "@box/copy-input";
|
|
16
16
|
import { Globe as b, Mail as x } from "@box/blueprint-web-assets/icons/Medium";
|
|
17
17
|
import { SurfaceStatusSurfaceRed as S, bpSize040 as C } from "@box/blueprint-web-assets/tokens/tokens";
|
|
18
18
|
import '../styles/shared-link-section.css';var w = {
|
|
19
|
-
container: "
|
|
20
|
-
toggle: "
|
|
21
|
-
settings: "
|
|
22
|
-
copy: "
|
|
23
|
-
access: "
|
|
24
|
-
|
|
19
|
+
container: "_container_so6jb_1",
|
|
20
|
+
toggle: "_toggle_so6jb_7",
|
|
21
|
+
settings: "_settings_so6jb_13",
|
|
22
|
+
copy: "_copy_so6jb_22",
|
|
23
|
+
access: "_access_so6jb_30",
|
|
24
|
+
disclosures: "_disclosures_so6jb_36",
|
|
25
|
+
icon: "_icon_so6jb_42"
|
|
25
26
|
};
|
|
26
27
|
function T() {
|
|
27
|
-
let { formatMessage: T } = d(), { addNotification: E } =
|
|
28
|
+
let { formatMessage: T } = d(), { addNotification: E } = h(), D = u(null), { isInteracted: O, isSharedLinkAutoCopied: k, isSharedLinkAutoCreated: A, setForm: ae } = a(), { config: j, eventService: M, isFetching: N, isSubmitting: P, item: F, setView: I, sharedLink: L, sharedLinkNotices: R, sharingService: z } = e(), { permissions: B = {} } = F, { onSharedLinkCopy: V, onSharedLinkSettingsClick: H } = M, { createSharedLink: U } = z, { notifications: W, sharedLinkAutoCopy: G, sharedLinkAutoCreate: K } = j, q = !!L.url, J = G && !k.current && !O, Y = K && !A.current && !O, { onAction: X } = o(c(async () => {
|
|
28
29
|
let e = await U();
|
|
29
30
|
return J ? { messages: [] } : e;
|
|
30
31
|
}, [J, U]), "create-shared-link");
|
|
31
32
|
l(() => {
|
|
32
33
|
(async () => {
|
|
33
|
-
|
|
34
|
+
N || P || ((J || Y) && !q && !A.current && (A.current = !0, await X()), J && q && D.current && D.current.click());
|
|
34
35
|
})();
|
|
35
36
|
}, [
|
|
36
37
|
q,
|
|
37
38
|
J,
|
|
38
39
|
Y,
|
|
39
|
-
|
|
40
|
+
N,
|
|
40
41
|
k,
|
|
41
42
|
A,
|
|
42
|
-
|
|
43
|
+
P,
|
|
43
44
|
X
|
|
44
45
|
]);
|
|
45
|
-
let
|
|
46
|
+
let oe = c((e) => {
|
|
46
47
|
if (V && V(e), !J) return;
|
|
47
48
|
k.current = !0;
|
|
48
49
|
let t;
|
|
@@ -58,119 +59,125 @@ function T() {
|
|
|
58
59
|
A,
|
|
59
60
|
W,
|
|
60
61
|
V
|
|
61
|
-
]),
|
|
62
|
+
]), se = async (e) => {
|
|
62
63
|
if (e) {
|
|
63
64
|
await X();
|
|
64
65
|
return;
|
|
65
66
|
}
|
|
66
|
-
|
|
67
|
+
I("remove-shared-link");
|
|
67
68
|
}, Z = () => {
|
|
68
69
|
if (H) {
|
|
69
70
|
H();
|
|
70
71
|
return;
|
|
71
72
|
}
|
|
72
|
-
|
|
73
|
+
I("shared-link-settings");
|
|
73
74
|
}, Q, $ = !1;
|
|
74
|
-
return !q && !
|
|
75
|
+
return !q && !P && (Q = T(i.sharedLinkToggleTooltip)), !q && !B.canShare && (Q = T(i.createLinkDisabledTooltip), $ = !0), q && !B.canSetShareAccess && (Q = T(i.removeLinkDisabledTooltip), $ = !0), /* @__PURE__ */ _("div", {
|
|
75
76
|
className: w.container,
|
|
76
77
|
children: [
|
|
77
|
-
/* @__PURE__ */
|
|
78
|
+
/* @__PURE__ */ g(p, {
|
|
78
79
|
as: "label",
|
|
79
80
|
variant: "bodyDefaultBold",
|
|
80
81
|
children: T(i.shareLinkLabel)
|
|
81
82
|
}),
|
|
82
|
-
/* @__PURE__ */
|
|
83
|
+
/* @__PURE__ */ _("div", {
|
|
83
84
|
className: w.toggle,
|
|
84
85
|
children: [
|
|
85
|
-
/* @__PURE__ */
|
|
86
|
+
/* @__PURE__ */ g(m, {
|
|
86
87
|
align: "start",
|
|
87
88
|
content: Q,
|
|
88
89
|
"data-testid": "usm-SharedLinkToggle-tooltip",
|
|
89
90
|
open: Q ? void 0 : !1,
|
|
90
|
-
children: /* @__PURE__ */
|
|
91
|
+
children: /* @__PURE__ */ g(ne, {
|
|
91
92
|
focusable: $,
|
|
92
|
-
children: /* @__PURE__ */
|
|
93
|
+
children: /* @__PURE__ */ g(ie.Item, {
|
|
93
94
|
autoFocus: !B.canInviteCollaborator,
|
|
94
95
|
checked: q,
|
|
95
96
|
"data-target-id": "Toggle-CreateSharedLink",
|
|
96
|
-
disabled: $ ||
|
|
97
|
+
disabled: $ || P,
|
|
97
98
|
label: T(i.sharedLinkToggleLabel),
|
|
98
|
-
onCheckedChange:
|
|
99
|
+
onCheckedChange: se,
|
|
99
100
|
value: "shared-link"
|
|
100
101
|
})
|
|
101
102
|
})
|
|
102
103
|
}),
|
|
103
|
-
q && !!
|
|
104
|
-
content: T(i.expirationIconTooltip, { expirationDate: t(
|
|
104
|
+
q && !!L.expiresAt && /* @__PURE__ */ g(m, {
|
|
105
|
+
content: T(i.expirationIconTooltip, { expirationDate: t(L.expiresAt) }),
|
|
105
106
|
"data-testid": "usm-SharedLinkExpiration-tooltip",
|
|
106
|
-
children: /* @__PURE__ */
|
|
107
|
+
children: /* @__PURE__ */ g(re, {
|
|
107
108
|
color: S,
|
|
108
109
|
hideText: !0,
|
|
109
|
-
icon:
|
|
110
|
+
icon: v,
|
|
110
111
|
text: T(i.expirationIconLabel)
|
|
111
112
|
})
|
|
112
113
|
}),
|
|
113
|
-
q &&
|
|
114
|
-
"aria-disabled":
|
|
114
|
+
q && j.sharedLinkSettings && /* @__PURE__ */ g(f, {
|
|
115
|
+
"aria-disabled": P,
|
|
115
116
|
"aria-haspopup": "dialog",
|
|
116
117
|
className: w.settings,
|
|
117
118
|
"data-target-id": "PlainButton-SharedLinkSettings",
|
|
118
119
|
onClick: Z,
|
|
119
120
|
onKeyDown: n(Z, { canPreventDefault: !0 }),
|
|
120
121
|
role: "button",
|
|
121
|
-
tabIndex:
|
|
122
|
+
tabIndex: P ? -1 : 0,
|
|
122
123
|
variant: "standalone",
|
|
123
124
|
children: T(i.sharedLinkSettingsLabel)
|
|
124
125
|
})
|
|
125
126
|
]
|
|
126
127
|
}),
|
|
127
|
-
q && /* @__PURE__ */
|
|
128
|
+
q && /* @__PURE__ */ _("div", {
|
|
128
129
|
className: w.copy,
|
|
129
|
-
children: [/* @__PURE__ */
|
|
130
|
+
children: [/* @__PURE__ */ g(y, {
|
|
130
131
|
ref: D,
|
|
131
132
|
autoFocus: K && A.current && !O,
|
|
132
133
|
"data-target-id": "Button-CopySharedLink",
|
|
133
|
-
disabled:
|
|
134
|
+
disabled: P,
|
|
134
135
|
hideLabel: !0,
|
|
135
136
|
label: T(i.sharedLinkUrlLabel),
|
|
136
|
-
onCopy:
|
|
137
|
-
value:
|
|
138
|
-
}),
|
|
137
|
+
onCopy: oe,
|
|
138
|
+
value: L.url
|
|
139
|
+
}), j.sharedLinkEmail && /* @__PURE__ */ g(m, {
|
|
139
140
|
align: "end",
|
|
140
141
|
content: T(i.sharedLinkEmailLabel),
|
|
141
|
-
children: /* @__PURE__ */
|
|
142
|
+
children: /* @__PURE__ */ g(te, {
|
|
142
143
|
"aria-label": T(i.sharedLinkEmailLabel),
|
|
143
144
|
"data-target-id": "Button-SendSharedLink",
|
|
144
|
-
disabled:
|
|
145
|
+
disabled: P,
|
|
145
146
|
endIcon: x,
|
|
146
|
-
onClick: () =>
|
|
147
|
+
onClick: () => ae("email"),
|
|
147
148
|
size: "large",
|
|
148
149
|
variant: "secondary"
|
|
149
150
|
})
|
|
150
151
|
})]
|
|
151
152
|
}),
|
|
152
|
-
q && (
|
|
153
|
+
q && (j.sharedLinkAccess || j.sharedLinkPermission) && /* @__PURE__ */ _("div", {
|
|
153
154
|
className: w.access,
|
|
154
|
-
children: [
|
|
155
|
+
children: [j.sharedLinkAccess && /* @__PURE__ */ g(s, {}), j.sharedLinkPermission && /* @__PURE__ */ g(ee, {})]
|
|
155
156
|
}),
|
|
156
|
-
q &&
|
|
157
|
-
className: w.
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
157
|
+
q && (L.access === "open" || L.access === "company" && L.permission === "can_edit" || R) && /* @__PURE__ */ _("div", {
|
|
158
|
+
className: w.disclosures,
|
|
159
|
+
children: [
|
|
160
|
+
L.access === "open" && /* @__PURE__ */ _("div", { children: [/* @__PURE__ */ g(b, {
|
|
161
|
+
className: w.icon,
|
|
162
|
+
height: C,
|
|
163
|
+
width: C
|
|
164
|
+
}), /* @__PURE__ */ g(p, {
|
|
165
|
+
as: "span",
|
|
166
|
+
color: "textOnLightSecondary",
|
|
167
|
+
children: L.permission === "can_edit" ? T(i.sharedLinkEditablePubliclyAvailable) : T(i.sharedLinkPubliclyAvailable)
|
|
168
|
+
})] }),
|
|
169
|
+
L.access === "company" && L.permission === "can_edit" && /* @__PURE__ */ _("div", { children: [/* @__PURE__ */ g(b, {
|
|
170
|
+
className: w.icon,
|
|
171
|
+
height: C,
|
|
172
|
+
width: C
|
|
173
|
+
}), /* @__PURE__ */ g(p, {
|
|
174
|
+
as: "span",
|
|
175
|
+
color: "textOnLightSecondary",
|
|
176
|
+
children: T(i.sharedLinkElevatedEditableCompanyAvailable)
|
|
177
|
+
})] }),
|
|
178
|
+
R
|
|
179
|
+
]
|
|
180
|
+
})
|
|
174
181
|
]
|
|
175
182
|
});
|
|
176
183
|
}
|
|
@@ -10,14 +10,14 @@ import { useIntl as c } from "react-intl";
|
|
|
10
10
|
import { LoadingIndicator as l, Modal as u } from "@box/blueprint-web";
|
|
11
11
|
import { jsx as d, jsxs as f } from "react/jsx-runtime";
|
|
12
12
|
import '../styles/unified-share-form-modal.css';var p = {
|
|
13
|
-
content: "
|
|
14
|
-
isFullscreen: "
|
|
15
|
-
body: "
|
|
16
|
-
title: "
|
|
17
|
-
hasFooter: "
|
|
18
|
-
loading: "
|
|
19
|
-
form: "
|
|
20
|
-
isLoading: "
|
|
13
|
+
content: "_content_1p1s8_1",
|
|
14
|
+
isFullscreen: "_isFullscreen_1p1s8_4",
|
|
15
|
+
body: "_body_1p1s8_13",
|
|
16
|
+
title: "_title_1p1s8_17",
|
|
17
|
+
hasFooter: "_hasFooter_1p1s8_39",
|
|
18
|
+
loading: "_loading_1p1s8_43",
|
|
19
|
+
form: "_form_1p1s8_51",
|
|
20
|
+
isLoading: "_isLoading_1p1s8_56"
|
|
21
21
|
};
|
|
22
22
|
function m({ children: m, isOpen: h, onOpenChange: g }) {
|
|
23
23
|
let { formatMessage: _ } = c(), { form: v, isCollaboratorsOpen: y, setContainerRef: b, setForm: x } = t(), { eventService: S, isFetching: C, isSubmitting: w, item: T, variant: E } = e(), { onCloseAutoFocus: D } = S, { name: O } = T, k = E === "desktop", A = v === "default" && !y;
|
|
@@ -5,16 +5,16 @@ var s = /* @__PURE__ */ t(null), c = () => {
|
|
|
5
5
|
let e = n(s);
|
|
6
6
|
if (!e) throw Error("useUnifiedShareModalContext must be used with UnifiedShareModalContext.Provider");
|
|
7
7
|
return e;
|
|
8
|
-
}, l = ({ children: t, collaborationAccess: n, collaborationNotices: c, collaborationRoles: l, collaborators: u, config: d, contactService: f, currentUser: p, eventService: m, initialContacts: h,
|
|
9
|
-
let [
|
|
8
|
+
}, l = ({ children: t, collaborationAccess: n, collaborationNotices: c, collaborationRoles: l, collaborators: u, config: d, contactService: f, currentUser: p, eventService: m, initialContacts: h, invitationFormNotices: g, isFetching: _, isOpen: v, isSubmitting: y, item: b, onOpenChange: x, sharedLink: S, sharedLinkNotices: C, sharingService: w, variant: T }) => {
|
|
9
|
+
let [E, D] = a(null), [O, k] = a(!1), [A, j] = a("unified-share-form");
|
|
10
10
|
r(() => {
|
|
11
|
-
|
|
12
|
-
}, [
|
|
13
|
-
let
|
|
11
|
+
v || (k(!1), j("unified-share-form"));
|
|
12
|
+
}, [v]);
|
|
13
|
+
let M = i(() => ({
|
|
14
14
|
collaborationAccess: n,
|
|
15
15
|
collaborationNotices: c,
|
|
16
16
|
collaborationRoles: l ?? [],
|
|
17
|
-
collaborator:
|
|
17
|
+
collaborator: E,
|
|
18
18
|
collaborators: u ?? [],
|
|
19
19
|
config: {
|
|
20
20
|
...e,
|
|
@@ -24,23 +24,25 @@ var s = /* @__PURE__ */ t(null), c = () => {
|
|
|
24
24
|
currentUser: p ?? {},
|
|
25
25
|
eventService: m ?? {},
|
|
26
26
|
initialContacts: h ?? [],
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
27
|
+
invitationFormNotices: g,
|
|
28
|
+
isFetching: _,
|
|
29
|
+
isOpen: v,
|
|
30
|
+
isSubmitting: y ?? O,
|
|
31
|
+
item: b,
|
|
32
|
+
onOpenChange: x,
|
|
33
|
+
setCollaborator: D,
|
|
34
|
+
setIsLoading: k,
|
|
35
|
+
setView: j,
|
|
36
|
+
sharedLink: S ?? {},
|
|
37
|
+
sharedLinkNotices: C,
|
|
38
|
+
sharingService: w ?? {},
|
|
39
|
+
variant: T,
|
|
40
|
+
view: A
|
|
39
41
|
}), [
|
|
40
42
|
n,
|
|
41
43
|
c,
|
|
42
44
|
l,
|
|
43
|
-
|
|
45
|
+
E,
|
|
44
46
|
u,
|
|
45
47
|
d,
|
|
46
48
|
f,
|
|
@@ -48,18 +50,20 @@ var s = /* @__PURE__ */ t(null), c = () => {
|
|
|
48
50
|
m,
|
|
49
51
|
h,
|
|
50
52
|
g,
|
|
51
|
-
E,
|
|
52
53
|
_,
|
|
54
|
+
O,
|
|
53
55
|
v,
|
|
54
56
|
y,
|
|
55
57
|
b,
|
|
56
58
|
x,
|
|
57
59
|
S,
|
|
58
60
|
C,
|
|
59
|
-
|
|
61
|
+
w,
|
|
62
|
+
T,
|
|
63
|
+
A
|
|
60
64
|
]);
|
|
61
65
|
return /* @__PURE__ */ o(s.Provider, {
|
|
62
|
-
value:
|
|
66
|
+
value: M,
|
|
63
67
|
children: t
|
|
64
68
|
});
|
|
65
69
|
};
|
|
@@ -2,21 +2,21 @@ import { UnifiedShareModalProvider as e } from "./contexts/unified-share-modal-c
|
|
|
2
2
|
import { UnifiedShareBase as t } from "./unified-share-base.js";
|
|
3
3
|
import { useCallback as n, useEffect as r, useState as i } from "react";
|
|
4
4
|
import { jsx as a } from "react/jsx-runtime";
|
|
5
|
-
function o({ children: o, collaborationAccess: s, collaborationNotices: c, collaborationRoles: l, collaborators: u, config: d, contactService: f, currentUser: p, eventService: m, initialContacts: h,
|
|
6
|
-
let [
|
|
5
|
+
function o({ children: o, collaborationAccess: s, collaborationNotices: c, collaborationRoles: l, collaborators: u, config: d, contactService: f, currentUser: p, eventService: m, initialContacts: h, invitationFormNotices: g, isFetching: _, isOpen: v, isSubmitting: y, item: b, onLoad: x, onOpenChange: S, sharedLink: C, sharedLinkNotices: w, sharingService: T, variant: E = "modal" }) {
|
|
6
|
+
let [D, O] = i(v ?? (!o || E === "desktop")), [k, A] = i(!!x);
|
|
7
7
|
r(() => {
|
|
8
|
-
|
|
9
|
-
}, [
|
|
8
|
+
v !== void 0 && O(v);
|
|
9
|
+
}, [v]), r(() => {
|
|
10
10
|
(async () => {
|
|
11
|
-
|
|
11
|
+
x && (D && await x(), A(!D));
|
|
12
12
|
})();
|
|
13
|
-
}, [
|
|
14
|
-
let
|
|
15
|
-
|
|
13
|
+
}, [D, x]);
|
|
14
|
+
let j = n((e) => {
|
|
15
|
+
v === void 0 && E !== "desktop" && O(e), S && S(e);
|
|
16
16
|
}, [
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
v,
|
|
18
|
+
S,
|
|
19
|
+
E
|
|
20
20
|
]);
|
|
21
21
|
return /* @__PURE__ */ a(e, {
|
|
22
22
|
collaborationAccess: s,
|
|
@@ -28,14 +28,16 @@ function o({ children: o, collaborationAccess: s, collaborationNotices: c, colla
|
|
|
28
28
|
currentUser: p,
|
|
29
29
|
eventService: m,
|
|
30
30
|
initialContacts: h,
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
31
|
+
invitationFormNotices: g,
|
|
32
|
+
isFetching: _ ?? k,
|
|
33
|
+
isOpen: D,
|
|
34
|
+
isSubmitting: y,
|
|
35
|
+
item: b,
|
|
36
|
+
onOpenChange: j,
|
|
37
|
+
sharedLink: C,
|
|
38
|
+
sharedLinkNotices: w,
|
|
39
|
+
sharingService: T,
|
|
40
|
+
variant: E,
|
|
39
41
|
children: /* @__PURE__ */ a(t, { children: o })
|
|
40
42
|
});
|
|
41
43
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.
|
|
1
|
+
._container_1qux4_2{gap:var(--bp-space-040);flex-direction:column;display:flex}._label_1qux4_8{padding:var(--bp-space-010) 0;color:var(--text-text-on-light);overflow-wrap:break-word;margin-block-end:var(--space-2);display:block}._label_1qux4_8._modernized_1qux4_15{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)}._label_1qux4_8:not(._modernized_1qux4_15){font-weight:var(--body-default-bold-font-weight);font-size:var(--body-default-bold-font-size);font-family:var(--body-default-bold-font-family);line-height:var(--body-default-bold-line-height);letter-spacing:var(--body-default-bold-letter-spacing);text-transform:var(--body-default-bold-text-case);-webkit-text-decoration:var(--body-default-bold-text-decoration);text-decoration:var(--body-default-bold-text-decoration)}._security_1qux4_33{margin-top:calc(var(--bp-space-010) * -1)}._disclosures_1qux4_37{gap:var(--bp-space-010);flex-direction:column;display:flex}._icon_1qux4_43{height:var(--bp-size-050);margin-right:var(--bp-space-010);vertical-align:text-bottom}._access_1qux4_49{gap:var(--bp-space-010);margin-top:var(--bp-space-030);flex-wrap:wrap;display:flex}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.
|
|
1
|
+
._container_so6jb_1{gap:var(--bp-space-030);flex-direction:column;display:flex}._toggle_so6jb_7{gap:var(--bp-space-020);align-items:center;display:flex}._settings_so6jb_13{cursor:pointer;margin-left:auto}._settings_so6jb_13[aria-disabled=true]{opacity:.3;pointer-events:none}._copy_so6jb_22{gap:var(--bp-space-020);display:flex}._copy_so6jb_22>div:first-child{flex-grow:1}._access_so6jb_30{gap:var(--bp-space-010);flex-wrap:wrap;display:flex}._disclosures_so6jb_36{gap:var(--bp-space-010);flex-direction:column;display:flex}._icon_so6jb_42{height:var(--bp-size-050);margin-right:var(--bp-space-010);vertical-align:text-bottom}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.
|
|
1
|
+
._content_1p1s8_1._content_1p1s8_1{max-width:480px}._content_1p1s8_1._content_1p1s8_1._isFullscreen_1p1s8_4{border-radius:0;width:100vw;max-width:none;height:100vh;max-height:none;margin:0;animation:none!important}._content_1p1s8_1._content_1p1s8_1._isFullscreen_1p1s8_4 ._body_1p1s8_13{overflow:hidden auto}._title_1p1s8_17{display:inline}._title_1p1s8_17:not(:last-child):after{content:" ";font-size:2rem;line-height:0}._body_1p1s8_13._body_1p1s8_13{padding-top:0;padding-bottom:var(--bp-space-080);flex-direction:column;flex-grow:1;display:flex;position:relative}._body_1p1s8_13._body_1p1s8_13:before{content:"";width:100vw;display:block}._body_1p1s8_13._body_1p1s8_13._hasFooter_1p1s8_39{padding-bottom:0}._loading_1p1s8_43{padding-bottom:var(--bp-space-080);align-items:center;display:flex;position:absolute;inset:0}._form_1p1s8_51{flex-direction:column;flex-grow:1;display:flex}._form_1p1s8_51._isLoading_1p1s8_56{visibility:hidden}@media (width>374px){._content_1p1s8_1._content_1p1s8_1{overflow:auto}}@media (width>459px){:has(>._content_1p1s8_1._content_1p1s8_1:not(._isFullscreen_1p1s8_4)){padding:var(--bp-space-080);display:flex;overflow:auto}._content_1p1s8_1._content_1p1s8_1{max-height:none;margin:auto;overflow:visible}}
|
|
@@ -12,6 +12,7 @@ export interface UnifiedShareModalContextValue {
|
|
|
12
12
|
currentUser: Partial<User>;
|
|
13
13
|
eventService: EventService;
|
|
14
14
|
initialContacts: UserContactType[];
|
|
15
|
+
invitationFormNotices?: ReactElement | ReactElement[];
|
|
15
16
|
isFetching: boolean;
|
|
16
17
|
isOpen: boolean;
|
|
17
18
|
isSubmitting: boolean;
|
|
@@ -21,6 +22,7 @@ export interface UnifiedShareModalContextValue {
|
|
|
21
22
|
setIsLoading: Dispatch<SetStateAction<boolean>>;
|
|
22
23
|
setView: Dispatch<SetStateAction<ViewType>>;
|
|
23
24
|
sharedLink: Partial<SharedLink>;
|
|
25
|
+
sharedLinkNotices?: ReactElement | ReactElement[];
|
|
24
26
|
sharingService: SharingService;
|
|
25
27
|
variant: VariantType;
|
|
26
28
|
view: ViewType;
|
|
@@ -38,13 +40,15 @@ export interface UnifiedShareModalProviderProps {
|
|
|
38
40
|
currentUser?: User;
|
|
39
41
|
eventService?: EventService;
|
|
40
42
|
initialContacts?: UserContactType[];
|
|
43
|
+
invitationFormNotices?: ReactElement | ReactElement[];
|
|
41
44
|
isFetching: boolean;
|
|
42
45
|
isOpen: boolean;
|
|
43
46
|
isSubmitting?: boolean;
|
|
44
47
|
item: Item;
|
|
45
48
|
onOpenChange: (open: boolean) => void;
|
|
46
49
|
sharedLink?: SharedLink;
|
|
50
|
+
sharedLinkNotices?: ReactElement | ReactElement[];
|
|
47
51
|
sharingService?: SharingService;
|
|
48
52
|
variant: VariantType;
|
|
49
53
|
}
|
|
50
|
-
export declare const UnifiedShareModalProvider: ({ children, collaborationAccess, collaborationNotices, collaborationRoles, collaborators, config, contactService, currentUser, eventService, initialContacts, isFetching, isOpen, isSubmitting, item, onOpenChange, sharedLink, sharingService, variant, }: UnifiedShareModalProviderProps) => import("react/jsx-runtime").JSX.Element;
|
|
54
|
+
export declare const UnifiedShareModalProvider: ({ children, collaborationAccess, collaborationNotices, collaborationRoles, collaborators, config, contactService, currentUser, eventService, initialContacts, invitationFormNotices, isFetching, isOpen, isSubmitting, item, onOpenChange, sharedLink, sharedLinkNotices, sharingService, variant, }: UnifiedShareModalProviderProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
1
2
|
import { UserContactType } from '@box/user-selector';
|
|
2
3
|
import { UnifiedShareModalContextValue } from '../contexts';
|
|
3
4
|
import { UnifiedShareModalProps } from '../unified-share-modal';
|
|
@@ -43,4 +44,7 @@ export declare const useMockSharedLink: (sharedLinkArg: any) => {
|
|
|
43
44
|
};
|
|
44
45
|
export declare const defaultArgs: UnifiedShareModalProps;
|
|
45
46
|
export declare const defaultContext: UnifiedShareModalContextValue;
|
|
47
|
+
export declare const HubAccessDisclosure: ({ children }: {
|
|
48
|
+
children: ReactNode;
|
|
49
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
46
50
|
export declare const UnifiedShareModalTemplate: (props: UnifiedShareModalProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -44,6 +44,10 @@ export interface UnifiedShareModalProps {
|
|
|
44
44
|
* The initially selected users when the Unified Share Modal is opened.
|
|
45
45
|
*/
|
|
46
46
|
initialContacts?: UserContactType[];
|
|
47
|
+
/**
|
|
48
|
+
* The inline notice component(s) to render in the collaboration section when the invitation form is expanded.
|
|
49
|
+
*/
|
|
50
|
+
invitationFormNotices?: ReactElement | ReactElement[];
|
|
47
51
|
/**
|
|
48
52
|
* The controlled fetching state of the Unified Share Modal.
|
|
49
53
|
*
|
|
@@ -78,6 +82,10 @@ export interface UnifiedShareModalProps {
|
|
|
78
82
|
* The shared link for sharing the item with users.
|
|
79
83
|
*/
|
|
80
84
|
sharedLink?: SharedLink;
|
|
85
|
+
/**
|
|
86
|
+
* The inline notice component(s) to render in the shared link section.
|
|
87
|
+
*/
|
|
88
|
+
sharedLinkNotices?: ReactElement | ReactElement[];
|
|
81
89
|
/**
|
|
82
90
|
* The service for managing the collaborations and shared link of the item.
|
|
83
91
|
*/
|
|
@@ -91,4 +99,4 @@ export interface UnifiedShareModalProps {
|
|
|
91
99
|
*/
|
|
92
100
|
variant?: VariantType;
|
|
93
101
|
}
|
|
94
|
-
export declare function UnifiedShareModal({ children, collaborationAccess, collaborationNotices, collaborationRoles, collaborators, config, contactService, currentUser, eventService, initialContacts, isFetching, isOpen: isControlledOpen, isSubmitting, item, onLoad, onOpenChange, sharedLink, sharingService, variant, }: UnifiedShareModalProps): import("react/jsx-runtime").JSX.Element;
|
|
102
|
+
export declare function UnifiedShareModal({ children, collaborationAccess, collaborationNotices, collaborationRoles, collaborators, config, contactService, currentUser, eventService, initialContacts, invitationFormNotices, isFetching, isOpen: isControlledOpen, isSubmitting, item, onLoad, onOpenChange, sharedLink, sharedLinkNotices, sharingService, variant, }: UnifiedShareModalProps): import("react/jsx-runtime").JSX.Element;
|
package/package.json
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@box/unified-share-modal",
|
|
3
|
-
"version": "2.16.
|
|
3
|
+
"version": "2.16.10",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE",
|
|
5
5
|
"peerDependencies": {
|
|
6
|
-
"@box/blueprint-web": "^15.
|
|
7
|
-
"@box/blueprint-web-assets": "^4.
|
|
8
|
-
"@box/copy-input": "^1.43.
|
|
9
|
-
"@box/user-selector": "^1.77.
|
|
6
|
+
"@box/blueprint-web": "^15.5.1",
|
|
7
|
+
"@box/blueprint-web-assets": "^4.122.0",
|
|
8
|
+
"@box/copy-input": "^1.43.10",
|
|
9
|
+
"@box/user-selector": "^1.77.10",
|
|
10
10
|
"lodash": "^4.17.15",
|
|
11
11
|
"react": "^18.0.0",
|
|
12
12
|
"react-dom": "^18.0.0",
|
|
13
13
|
"react-intl": "^6.4.2"
|
|
14
14
|
},
|
|
15
15
|
"devDependencies": {
|
|
16
|
-
"@box/blueprint-web": "^15.
|
|
17
|
-
"@box/blueprint-web-assets": "^4.
|
|
18
|
-
"@box/copy-input": "^1.43.
|
|
19
|
-
"@box/eslint-plugin-blueprint": "1.2.
|
|
20
|
-
"@box/storybook-utils": "0.20.
|
|
16
|
+
"@box/blueprint-web": "^15.5.1",
|
|
17
|
+
"@box/blueprint-web-assets": "^4.122.0",
|
|
18
|
+
"@box/copy-input": "^1.43.10",
|
|
19
|
+
"@box/eslint-plugin-blueprint": "1.2.5",
|
|
20
|
+
"@box/storybook-utils": "0.20.9",
|
|
21
21
|
"react-intl": "^6.4.2"
|
|
22
22
|
},
|
|
23
23
|
"publishConfig": {
|