@box/unified-share-modal 2.7.17 → 2.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/lib/components/unified-share-form-modal/collaboration-section/shared-with-avatars.js +27 -29
- package/dist/esm/lib/components/unified-share-form-modal/collaborator-list/collaborator-list.js +54 -55
- package/dist/esm/lib/components/unified-share-form-modal/shared-link-section/shared-link-section.js +92 -78
- package/dist/esm/lib/components/unified-share-form-modal/unified-share-form-modal.js +36 -35
- package/dist/esm/lib/contexts/unified-share-form-context.js +31 -31
- package/dist/types/lib/contexts/unified-share-form-context.d.ts +2 -2
- package/dist/types/lib/types.d.ts +7 -8
- package/package.json +9 -9
|
@@ -1,63 +1,61 @@
|
|
|
1
|
-
import { useIntl as
|
|
2
|
-
import { Text as
|
|
3
|
-
import { Gray10 as
|
|
4
|
-
import { CollaboratorAvatar as
|
|
5
|
-
import
|
|
1
|
+
import { useIntl as x } from "react-intl";
|
|
2
|
+
import { Text as C, Avatar as A } from "@box/blueprint-web";
|
|
3
|
+
import { Gray10 as _ } from "@box/blueprint-web-assets/tokens/tokens";
|
|
4
|
+
import { CollaboratorAvatar as g } from "../collaborator-list/collaborator-avatar.js";
|
|
5
|
+
import I from "./messages.js";
|
|
6
6
|
import { jsxs as l, jsx as e } from "react/jsx-runtime";
|
|
7
|
-
import { useUnifiedShareModalContext as
|
|
8
|
-
import { useUnifiedShareFormContext as
|
|
9
|
-
import { callOnKeyboardEvent as
|
|
10
|
-
import '../../../../../styles/shared-with-avatars.css';const
|
|
11
|
-
container:
|
|
12
|
-
avatars:
|
|
7
|
+
import { useUnifiedShareModalContext as S } from "../../../contexts/unified-share-modal-context.js";
|
|
8
|
+
import { useUnifiedShareFormContext as k } from "../../../contexts/unified-share-form-context.js";
|
|
9
|
+
import { callOnKeyboardEvent as y } from "../../../utils/event.js";
|
|
10
|
+
import '../../../../../styles/shared-with-avatars.css';const W = "_container_1ku5s_2", O = "_avatars_1ku5s_19", c = {
|
|
11
|
+
container: W,
|
|
12
|
+
avatars: O
|
|
13
13
|
}, m = 3;
|
|
14
|
-
function
|
|
14
|
+
function D() {
|
|
15
15
|
const {
|
|
16
16
|
formatMessage: d
|
|
17
|
-
} =
|
|
17
|
+
} = x(), {
|
|
18
18
|
collaborators: f,
|
|
19
19
|
currentUser: u,
|
|
20
20
|
eventService: h,
|
|
21
21
|
isSubmitting: o
|
|
22
|
-
} =
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
setPreviousForm: b
|
|
26
|
-
} = W(), {
|
|
22
|
+
} = S(), {
|
|
23
|
+
setIsCollaboratorsOpen: v
|
|
24
|
+
} = k(), {
|
|
27
25
|
onCollaboratorsClick: a
|
|
28
26
|
} = h, {
|
|
29
27
|
id: s
|
|
30
28
|
} = u, t = f.filter(({
|
|
31
29
|
isCurrentUser: r,
|
|
32
|
-
userId:
|
|
33
|
-
}) => !(r || s && s ===
|
|
30
|
+
userId: b
|
|
31
|
+
}) => !(r || s && s === b));
|
|
34
32
|
if (!t.length)
|
|
35
33
|
return null;
|
|
36
|
-
const
|
|
34
|
+
const p = t.slice(0, m), n = t.length - m, i = () => {
|
|
37
35
|
if (a) {
|
|
38
36
|
a();
|
|
39
37
|
return;
|
|
40
38
|
}
|
|
41
|
-
|
|
39
|
+
v(!0);
|
|
42
40
|
};
|
|
43
41
|
return /* @__PURE__ */ l("div", {
|
|
44
42
|
"aria-disabled": o,
|
|
45
43
|
className: c.container,
|
|
46
44
|
onClick: i,
|
|
47
|
-
onKeyDown:
|
|
45
|
+
onKeyDown: y(i),
|
|
48
46
|
role: "button",
|
|
49
47
|
tabIndex: o ? -1 : 0,
|
|
50
|
-
children: [/* @__PURE__ */ e(
|
|
48
|
+
children: [/* @__PURE__ */ e(C, {
|
|
51
49
|
as: "span",
|
|
52
50
|
color: "textOnLightSecondary",
|
|
53
|
-
children: d(
|
|
51
|
+
children: d(I.sharedWithLabel)
|
|
54
52
|
}), /* @__PURE__ */ l("div", {
|
|
55
53
|
className: c.avatars,
|
|
56
|
-
children: [
|
|
54
|
+
children: [p.map((r) => /* @__PURE__ */ e(g, {
|
|
57
55
|
collaborator: r,
|
|
58
56
|
size: "medium"
|
|
59
|
-
}, r.id)), n > 0 && /* @__PURE__ */ e(
|
|
60
|
-
color:
|
|
57
|
+
}, r.id)), n > 0 && /* @__PURE__ */ e(A, {
|
|
58
|
+
color: _,
|
|
61
59
|
size: "medium",
|
|
62
60
|
text: `+${n}`
|
|
63
61
|
})]
|
|
@@ -65,5 +63,5 @@ function E() {
|
|
|
65
63
|
});
|
|
66
64
|
}
|
|
67
65
|
export {
|
|
68
|
-
|
|
66
|
+
D as SharedWithAvatars
|
|
69
67
|
};
|
package/dist/esm/lib/components/unified-share-form-modal/collaborator-list/collaborator-list.js
CHANGED
|
@@ -1,102 +1,101 @@
|
|
|
1
1
|
import { createPortal as L } from "react-dom";
|
|
2
2
|
import { useIntl as S } from "react-intl";
|
|
3
|
-
import { useBreakpoint as x, Breakpoint as z, Divider as B, Link as
|
|
4
|
-
import { CollaboratorListItem as
|
|
3
|
+
import { useBreakpoint as x, Breakpoint as z, Divider as B, Link as h, Table as N, TableHeader as F, Column as b, TableBody as I, Modal as l } from "@box/blueprint-web";
|
|
4
|
+
import { CollaboratorListItem as M } from "./collaborator-list-item.js";
|
|
5
5
|
import r from "./messages.js";
|
|
6
|
-
import { jsxs as
|
|
7
|
-
import { useUnifiedShareFormContext as
|
|
8
|
-
import { callOnKeyboardEvent as
|
|
9
|
-
import { useUnifiedShareModalContext as
|
|
10
|
-
import '../../../../../styles/collaborator-list.css';const
|
|
11
|
-
divider:
|
|
12
|
-
manage:
|
|
13
|
-
link:
|
|
14
|
-
list:
|
|
15
|
-
scroll:
|
|
16
|
-
header:
|
|
6
|
+
import { jsxs as t, Fragment as g, jsx as e } from "react/jsx-runtime";
|
|
7
|
+
import { useUnifiedShareFormContext as D } from "../../../contexts/unified-share-form-context.js";
|
|
8
|
+
import { callOnKeyboardEvent as H } from "../../../utils/event.js";
|
|
9
|
+
import { useUnifiedShareModalContext as T } from "../../../contexts/unified-share-modal-context.js";
|
|
10
|
+
import '../../../../../styles/collaborator-list.css';const j = "_divider_ozw7g_1", A = "_manage_ozw7g_8", K = "_link_ozw7g_14", O = "_list_ozw7g_18", P = "_scroll_ozw7g_34", R = "_header_ozw7g_40", a = {
|
|
11
|
+
divider: j,
|
|
12
|
+
manage: A,
|
|
13
|
+
link: K,
|
|
14
|
+
list: O,
|
|
15
|
+
scroll: P,
|
|
16
|
+
header: R
|
|
17
17
|
};
|
|
18
|
-
function
|
|
18
|
+
function Y() {
|
|
19
19
|
const {
|
|
20
20
|
formatMessage: o
|
|
21
|
-
} = S(),
|
|
22
|
-
collaborators:
|
|
21
|
+
} = S(), i = x() === z.Small, {
|
|
22
|
+
collaborators: p,
|
|
23
23
|
config: s,
|
|
24
24
|
eventService: f,
|
|
25
|
-
isFetching:
|
|
26
|
-
isSubmitting:
|
|
27
|
-
item:
|
|
28
|
-
variant:
|
|
29
|
-
} =
|
|
30
|
-
id:
|
|
31
|
-
type:
|
|
32
|
-
} =
|
|
25
|
+
isFetching: u,
|
|
26
|
+
isSubmitting: _,
|
|
27
|
+
item: k,
|
|
28
|
+
variant: v
|
|
29
|
+
} = T(), {
|
|
30
|
+
id: C,
|
|
31
|
+
type: w
|
|
32
|
+
} = k, {
|
|
33
33
|
onCollaboratorsManagementClick: n
|
|
34
|
-
} = f, c =
|
|
34
|
+
} = f, c = v === "desktop", {
|
|
35
35
|
containerRef: d,
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
return /* @__PURE__ */ a(u, {
|
|
36
|
+
setIsCollaboratorsOpen: y
|
|
37
|
+
} = D();
|
|
38
|
+
return /* @__PURE__ */ t(g, {
|
|
40
39
|
children: [c && /* @__PURE__ */ e(B, {
|
|
41
|
-
className:
|
|
40
|
+
className: a.divider
|
|
42
41
|
}), s.collaboratorsManagement && /* @__PURE__ */ e("div", {
|
|
43
|
-
className:
|
|
44
|
-
children: n ? /* @__PURE__ */ e(
|
|
45
|
-
className:
|
|
42
|
+
className: a.manage,
|
|
43
|
+
children: n ? /* @__PURE__ */ e(h, {
|
|
44
|
+
className: a.link,
|
|
46
45
|
onClick: n,
|
|
47
|
-
onKeyDown:
|
|
46
|
+
onKeyDown: H(n, {
|
|
48
47
|
canPreventDefault: !0
|
|
49
48
|
}),
|
|
50
49
|
role: "button",
|
|
51
50
|
tabIndex: 0,
|
|
52
51
|
variant: "standalone",
|
|
53
52
|
children: o(r.manageAllLink)
|
|
54
|
-
}) : /* @__PURE__ */ e(
|
|
55
|
-
href: `/${
|
|
53
|
+
}) : /* @__PURE__ */ e(h, {
|
|
54
|
+
href: `/${w}/${C}/collaborators`,
|
|
56
55
|
rel: "noopener",
|
|
57
56
|
target: "_blank",
|
|
58
57
|
variant: "standalone",
|
|
59
58
|
children: o(r.manageAllLink)
|
|
60
59
|
})
|
|
61
60
|
}), /* @__PURE__ */ e("div", {
|
|
62
|
-
className:
|
|
61
|
+
className: a.list,
|
|
63
62
|
children: /* @__PURE__ */ e("div", {
|
|
64
|
-
className:
|
|
65
|
-
children: /* @__PURE__ */
|
|
63
|
+
className: a.scroll,
|
|
64
|
+
children: /* @__PURE__ */ t(N, {
|
|
66
65
|
"aria-label": o(r.listLabel),
|
|
67
|
-
children: [/* @__PURE__ */
|
|
68
|
-
className:
|
|
69
|
-
children: [/* @__PURE__ */ e(
|
|
66
|
+
children: [/* @__PURE__ */ t(F, {
|
|
67
|
+
className: a.header,
|
|
68
|
+
children: [/* @__PURE__ */ e(b, {
|
|
70
69
|
hideHeader: !0,
|
|
71
70
|
isRowHeader: !0,
|
|
72
71
|
width: "11fr",
|
|
73
72
|
children: o(r.nameColumn)
|
|
74
|
-
}), !
|
|
73
|
+
}), !i && /* @__PURE__ */ e(b, {
|
|
75
74
|
hideHeader: !0,
|
|
76
75
|
width: "10fr",
|
|
77
76
|
children: o(r.roleColumn)
|
|
78
77
|
})]
|
|
79
|
-
}), /* @__PURE__ */ e(
|
|
80
|
-
children:
|
|
81
|
-
collaborator:
|
|
82
|
-
isSmall:
|
|
83
|
-
},
|
|
78
|
+
}), /* @__PURE__ */ e(I, {
|
|
79
|
+
children: p.slice(0, s.collaboratorsLimit).map((m) => /* @__PURE__ */ e(M, {
|
|
80
|
+
collaborator: m,
|
|
81
|
+
isSmall: i
|
|
82
|
+
}, m.id))
|
|
84
83
|
})]
|
|
85
84
|
})
|
|
86
85
|
})
|
|
87
|
-
}), d && /* @__PURE__ */ L(/* @__PURE__ */
|
|
88
|
-
children: [!
|
|
89
|
-
children: /* @__PURE__ */ e(
|
|
90
|
-
onClick: () =>
|
|
86
|
+
}), d && /* @__PURE__ */ L(/* @__PURE__ */ t(g, {
|
|
87
|
+
children: [!u && /* @__PURE__ */ e(l.Footer, {
|
|
88
|
+
children: /* @__PURE__ */ e(l.Footer.SecondaryButton, {
|
|
89
|
+
onClick: () => y(!1),
|
|
91
90
|
children: o(r.doneButton)
|
|
92
91
|
})
|
|
93
|
-
}), !c && /* @__PURE__ */ e(
|
|
92
|
+
}), !c && /* @__PURE__ */ e(l.Close, {
|
|
94
93
|
"aria-label": o(r.closeButton),
|
|
95
|
-
disabled:
|
|
94
|
+
disabled: _
|
|
96
95
|
})]
|
|
97
96
|
}), d)]
|
|
98
97
|
});
|
|
99
98
|
}
|
|
100
99
|
export {
|
|
101
|
-
|
|
100
|
+
Y as CollaboratorList
|
|
102
101
|
};
|
package/dist/esm/lib/components/unified-share-form-modal/shared-link-section/shared-link-section.js
CHANGED
|
@@ -1,77 +1,91 @@
|
|
|
1
|
-
import { useRef as
|
|
2
|
-
import { useIntl as
|
|
3
|
-
import { useNotification as
|
|
4
|
-
import { ClockBadge as
|
|
5
|
-
import { Mail as
|
|
6
|
-
import { SurfaceStatusSurfaceRed as
|
|
7
|
-
import { CopyInput as
|
|
8
|
-
import { SharedLinkAccess as
|
|
9
|
-
import { SharedLinkPermission as
|
|
1
|
+
import { useRef as K, useCallback as w, useEffect as G } from "react";
|
|
2
|
+
import { useIntl as V } from "react-intl";
|
|
3
|
+
import { useNotification as q, Text as b, Tooltip as y, Focusable as H, Switch as J, Status as Q, Link as W, Button as X } from "@box/blueprint-web";
|
|
4
|
+
import { ClockBadge as Y } from "@box/blueprint-web-assets/icons/Line";
|
|
5
|
+
import { Mail as Z, Globe as I } from "@box/blueprint-web-assets/icons/Medium";
|
|
6
|
+
import { SurfaceStatusSurfaceRed as $, bpSize040 as g } from "@box/blueprint-web-assets/tokens/tokens";
|
|
7
|
+
import { CopyInput as ee } from "@box/copy-input";
|
|
8
|
+
import { SharedLinkAccess as te } from "./shared-link-access.js";
|
|
9
|
+
import { SharedLinkPermission as ie } from "./shared-link-permission.js";
|
|
10
10
|
import t from "./messages.js";
|
|
11
11
|
import { jsxs as d, jsx as i } from "react/jsx-runtime";
|
|
12
|
-
import { useUnifiedShareFormContext as
|
|
13
|
-
import { useUnifiedShareModalContext as
|
|
14
|
-
import { useSharingAction as
|
|
15
|
-
import { getNotificationArgs as
|
|
16
|
-
import { formatDateFromTimestampToDateString as
|
|
17
|
-
import { callOnKeyboardEvent as
|
|
18
|
-
import '../../../../../styles/shared-link-section.css';const
|
|
19
|
-
container:
|
|
20
|
-
toggle:
|
|
21
|
-
settings:
|
|
22
|
-
copy:
|
|
23
|
-
access:
|
|
24
|
-
icon:
|
|
12
|
+
import { useUnifiedShareFormContext as ae } from "../../../contexts/unified-share-form-context.js";
|
|
13
|
+
import { useUnifiedShareModalContext as ne } from "../../../contexts/unified-share-modal-context.js";
|
|
14
|
+
import { useSharingAction as oe } from "../../../hooks/use-sharing-action.js";
|
|
15
|
+
import { getNotificationArgs as re } from "../../../utils/notification.js";
|
|
16
|
+
import { formatDateFromTimestampToDateString as se } from "../../../utils/date.js";
|
|
17
|
+
import { callOnKeyboardEvent as ce } from "../../../utils/event.js";
|
|
18
|
+
import '../../../../../styles/shared-link-section.css';const le = "_container_j966c_1", de = "_toggle_j966c_7", he = "_settings_j966c_13", ue = "_copy_j966c_22", me = "_access_j966c_30", pe = "_icon_j966c_36", c = {
|
|
19
|
+
container: le,
|
|
20
|
+
toggle: de,
|
|
21
|
+
settings: he,
|
|
22
|
+
copy: ue,
|
|
23
|
+
access: me,
|
|
24
|
+
icon: pe
|
|
25
25
|
};
|
|
26
|
-
function
|
|
26
|
+
function we() {
|
|
27
27
|
const {
|
|
28
28
|
formatMessage: e
|
|
29
|
-
} =
|
|
29
|
+
} = V(), {
|
|
30
30
|
addNotification: C
|
|
31
|
-
} =
|
|
32
|
-
isSharedLinkAutoCopied:
|
|
31
|
+
} = q(), k = K(null), {
|
|
32
|
+
isSharedLinkAutoCopied: f,
|
|
33
33
|
isSharedLinkAutoCreated: r,
|
|
34
|
-
setForm:
|
|
35
|
-
} =
|
|
34
|
+
setForm: P
|
|
35
|
+
} = ae(), {
|
|
36
36
|
config: s,
|
|
37
|
+
eventService: B,
|
|
37
38
|
isFetching: v,
|
|
38
39
|
isSubmitting: n,
|
|
39
|
-
item:
|
|
40
|
-
setView:
|
|
40
|
+
item: F,
|
|
41
|
+
setView: x,
|
|
41
42
|
sharedLink: o,
|
|
42
|
-
sharingService:
|
|
43
|
-
} =
|
|
44
|
-
permissions:
|
|
45
|
-
} =
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
43
|
+
sharingService: M
|
|
44
|
+
} = ne(), {
|
|
45
|
+
permissions: T = {}
|
|
46
|
+
} = F, {
|
|
47
|
+
onSharedLinkCopy: L,
|
|
48
|
+
onSharedLinkSettingsClick: _
|
|
49
|
+
} = B, {
|
|
50
|
+
createSharedLink: A
|
|
51
|
+
} = M, {
|
|
52
|
+
notifications: N,
|
|
53
|
+
sharedLinkAutoCopy: O,
|
|
54
|
+
sharedLinkAutoCreate: E
|
|
55
|
+
} = s, a = !!o.url, h = O && !f.current, D = E && !r.current, R = w(async () => {
|
|
56
|
+
const l = await A();
|
|
53
57
|
return h ? {
|
|
54
58
|
messages: []
|
|
55
59
|
} : l;
|
|
56
|
-
}, [h,
|
|
57
|
-
onAction:
|
|
58
|
-
} =
|
|
59
|
-
|
|
60
|
-
(async () => v || n || ((h ||
|
|
61
|
-
}, [a, h,
|
|
62
|
-
const
|
|
60
|
+
}, [h, A]), {
|
|
61
|
+
onAction: S
|
|
62
|
+
} = oe(R, "create-shared-link");
|
|
63
|
+
G(() => {
|
|
64
|
+
(async () => v || n || ((h || D) && !a && (await S(), r.current = !0), h && a && k.current && (k.current.click(), f.current = !0)))();
|
|
65
|
+
}, [a, h, D, v, f, r, n, S]);
|
|
66
|
+
const U = w((l) => {
|
|
63
67
|
let p;
|
|
64
|
-
typeof l != "string" ? p = r.current ? e(t.autoCreateCopyErrorNoticeText) : null : p = r.current ? e(t.autoCreateCopySuccessNoticeText) : e(t.autoCopySuccessNoticeText), p &&
|
|
65
|
-
...
|
|
68
|
+
typeof l != "string" ? p = r.current ? e(t.autoCreateCopyErrorNoticeText) : null : p = r.current ? e(t.autoCreateCopySuccessNoticeText) : e(t.autoCopySuccessNoticeText), p && N.includes("auto-copy-shared-link") && C({
|
|
69
|
+
...re(e, "success"),
|
|
66
70
|
styledText: p
|
|
67
|
-
});
|
|
68
|
-
}, [C, e, r,
|
|
69
|
-
|
|
71
|
+
}), L && L(l);
|
|
72
|
+
}, [C, e, r, N, L]), z = async (l) => {
|
|
73
|
+
if (l) {
|
|
74
|
+
await S();
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
x("remove-shared-link");
|
|
78
|
+
}, j = () => {
|
|
79
|
+
if (_) {
|
|
80
|
+
_();
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
x("shared-link-settings");
|
|
70
84
|
};
|
|
71
85
|
let u, m = !1;
|
|
72
|
-
return !a && !n && (u = e(t.sharedLinkToggleTooltip)), !a && !
|
|
86
|
+
return !a && !n && (u = e(t.sharedLinkToggleTooltip)), !a && !T.canShare && (u = e(t.createLinkDisabledTooltip), m = !0), a && !T.canSetShareAccess && (u = e(t.removeLinkDisabledTooltip), m = !0), /* @__PURE__ */ d("div", {
|
|
73
87
|
className: c.container,
|
|
74
|
-
children: [/* @__PURE__ */ i(
|
|
88
|
+
children: [/* @__PURE__ */ i(b, {
|
|
75
89
|
as: "label",
|
|
76
90
|
variant: "bodyDefaultBold",
|
|
77
91
|
children: e(t.shareLinkLabel)
|
|
@@ -82,35 +96,35 @@ function Ne() {
|
|
|
82
96
|
content: u,
|
|
83
97
|
"data-testid": "shared-link-tooltip",
|
|
84
98
|
open: u ? void 0 : !1,
|
|
85
|
-
children: /* @__PURE__ */ i(
|
|
99
|
+
children: /* @__PURE__ */ i(H, {
|
|
86
100
|
focusable: m,
|
|
87
|
-
children: /* @__PURE__ */ i(
|
|
101
|
+
children: /* @__PURE__ */ i(J.Item, {
|
|
88
102
|
checked: a,
|
|
89
103
|
"data-target-id": "Toggle-CreateSharedLink",
|
|
90
104
|
disabled: m || n,
|
|
91
105
|
label: e(t.sharedLinkToggleLabel),
|
|
92
|
-
onCheckedChange:
|
|
106
|
+
onCheckedChange: z,
|
|
93
107
|
value: "shared-link"
|
|
94
108
|
})
|
|
95
109
|
})
|
|
96
110
|
}), a && !!o.expiresAt && /* @__PURE__ */ i(y, {
|
|
97
111
|
content: e(t.expirationIconTooltip, {
|
|
98
|
-
expirationDate:
|
|
112
|
+
expirationDate: se(o.expiresAt)
|
|
99
113
|
}),
|
|
100
114
|
"data-testid": "expiration-date-tooltip",
|
|
101
|
-
children: /* @__PURE__ */ i(
|
|
102
|
-
color:
|
|
115
|
+
children: /* @__PURE__ */ i(Q, {
|
|
116
|
+
color: $,
|
|
103
117
|
hideText: !0,
|
|
104
|
-
icon:
|
|
118
|
+
icon: Y,
|
|
105
119
|
text: e(t.expirationIconLabel)
|
|
106
120
|
})
|
|
107
|
-
}), a && s.sharedLinkSettings && /* @__PURE__ */ i(
|
|
121
|
+
}), a && s.sharedLinkSettings && /* @__PURE__ */ i(W, {
|
|
108
122
|
"aria-disabled": n,
|
|
109
123
|
"aria-haspopup": "dialog",
|
|
110
124
|
className: c.settings,
|
|
111
125
|
"data-target-id": "PlainButton-SharedLinkSettings",
|
|
112
|
-
onClick:
|
|
113
|
-
onKeyDown:
|
|
126
|
+
onClick: j,
|
|
127
|
+
onKeyDown: ce(j, {
|
|
114
128
|
canPreventDefault: !0
|
|
115
129
|
}),
|
|
116
130
|
role: "button",
|
|
@@ -120,47 +134,47 @@ function Ne() {
|
|
|
120
134
|
})]
|
|
121
135
|
}), a && /* @__PURE__ */ d("div", {
|
|
122
136
|
className: c.copy,
|
|
123
|
-
children: [/* @__PURE__ */ i(
|
|
124
|
-
ref:
|
|
125
|
-
autoFocus:
|
|
137
|
+
children: [/* @__PURE__ */ i(ee, {
|
|
138
|
+
ref: k,
|
|
139
|
+
autoFocus: E && r.current,
|
|
126
140
|
"data-target-id": "Button-CopySharedLink",
|
|
127
141
|
disabled: n,
|
|
128
142
|
hideLabel: !0,
|
|
129
143
|
label: e(t.sharedLinkUrlLabel),
|
|
130
|
-
onCopy:
|
|
144
|
+
onCopy: U,
|
|
131
145
|
value: o.url
|
|
132
146
|
}), s.sharedLinkEmail && /* @__PURE__ */ i(y, {
|
|
133
147
|
align: "end",
|
|
134
148
|
content: e(t.sharedLinkEmailLabel),
|
|
135
|
-
children: /* @__PURE__ */ i(
|
|
149
|
+
children: /* @__PURE__ */ i(X, {
|
|
136
150
|
"aria-label": e(t.sharedLinkEmailLabel),
|
|
137
151
|
"data-target-id": "Button-SendSharedLink",
|
|
138
152
|
disabled: n,
|
|
139
|
-
icon:
|
|
140
|
-
onClick: () =>
|
|
153
|
+
icon: Z,
|
|
154
|
+
onClick: () => P("email"),
|
|
141
155
|
size: "large",
|
|
142
156
|
variant: "secondary"
|
|
143
157
|
})
|
|
144
158
|
})]
|
|
145
159
|
}), a && (s.sharedLinkAccess || s.sharedLinkPermission) && /* @__PURE__ */ d("div", {
|
|
146
160
|
className: c.access,
|
|
147
|
-
children: [s.sharedLinkAccess && /* @__PURE__ */ i(
|
|
161
|
+
children: [s.sharedLinkAccess && /* @__PURE__ */ i(te, {}), s.sharedLinkPermission && /* @__PURE__ */ i(ie, {})]
|
|
148
162
|
}), a && o.access === "open" && /* @__PURE__ */ d("div", {
|
|
149
|
-
children: [/* @__PURE__ */ i(
|
|
163
|
+
children: [/* @__PURE__ */ i(I, {
|
|
150
164
|
className: c.icon,
|
|
151
165
|
height: g,
|
|
152
166
|
width: g
|
|
153
|
-
}), /* @__PURE__ */ i(
|
|
167
|
+
}), /* @__PURE__ */ i(b, {
|
|
154
168
|
as: "span",
|
|
155
169
|
color: "textOnLightSecondary",
|
|
156
170
|
children: o.permission === "can_edit" ? e(t.sharedLinkEditablePubliclyAvailable) : e(t.sharedLinkPubliclyAvailable)
|
|
157
171
|
})]
|
|
158
172
|
}), a && o.access === "company" && o.permission === "can_edit" && /* @__PURE__ */ d("div", {
|
|
159
|
-
children: [/* @__PURE__ */ i(
|
|
173
|
+
children: [/* @__PURE__ */ i(I, {
|
|
160
174
|
className: c.icon,
|
|
161
175
|
height: g,
|
|
162
176
|
width: g
|
|
163
|
-
}), /* @__PURE__ */ i(
|
|
177
|
+
}), /* @__PURE__ */ i(b, {
|
|
164
178
|
as: "span",
|
|
165
179
|
color: "textOnLightSecondary",
|
|
166
180
|
children: e(t.sharedLinkElevatedEditableCompanyAvailable)
|
|
@@ -169,5 +183,5 @@ function Ne() {
|
|
|
169
183
|
});
|
|
170
184
|
}
|
|
171
185
|
export {
|
|
172
|
-
|
|
186
|
+
we as SharedLinkSection
|
|
173
187
|
};
|
|
@@ -1,78 +1,79 @@
|
|
|
1
1
|
import a from "clsx";
|
|
2
|
-
import { useCallback as
|
|
3
|
-
import { useIntl as
|
|
4
|
-
import { Modal as e, LoadingIndicator as
|
|
5
|
-
import { UnifiedShareForm as
|
|
2
|
+
import { useCallback as N } from "react";
|
|
3
|
+
import { useIntl as v } from "react-intl";
|
|
4
|
+
import { Modal as e, LoadingIndicator as D } from "@box/blueprint-web";
|
|
5
|
+
import { UnifiedShareForm as M } from "./unified-share-form.js";
|
|
6
6
|
import l from "./messages.js";
|
|
7
7
|
import { jsxs as i, jsx as o } from "react/jsx-runtime";
|
|
8
|
-
import { CollaboratorList as
|
|
8
|
+
import { CollaboratorList as O } from "./collaborator-list/collaborator-list.js";
|
|
9
9
|
import { useUnifiedShareFormContext as h } from "../../contexts/unified-share-form-context.js";
|
|
10
10
|
import { useUnifiedShareModalContext as U } from "../../contexts/unified-share-modal-context.js";
|
|
11
11
|
import { ClassificationStatus as k } from "../classification-status/classification-status.js";
|
|
12
|
-
import '../../../../styles/unified-share-form-modal.css';const
|
|
13
|
-
content:
|
|
14
|
-
isFullscreen:
|
|
15
|
-
body:
|
|
16
|
-
hasFooter:
|
|
17
|
-
classificationStatusContainer:
|
|
18
|
-
loading:
|
|
19
|
-
form:
|
|
20
|
-
isLoading:
|
|
12
|
+
import '../../../../styles/unified-share-form-modal.css';const j = "_content_17drm_1", w = "_isFullscreen_17drm_4", z = "_body_17drm_13", B = "_hasFooter_17drm_30", I = "_classificationStatusContainer_17drm_34", P = "_loading_17drm_39", H = "_form_17drm_47", R = "_isLoading_17drm_52", t = {
|
|
13
|
+
content: j,
|
|
14
|
+
isFullscreen: w,
|
|
15
|
+
body: z,
|
|
16
|
+
hasFooter: B,
|
|
17
|
+
classificationStatusContainer: I,
|
|
18
|
+
loading: P,
|
|
19
|
+
form: H,
|
|
20
|
+
isLoading: R
|
|
21
21
|
};
|
|
22
|
-
function
|
|
22
|
+
function Y({
|
|
23
23
|
children: m,
|
|
24
24
|
isOpen: p,
|
|
25
25
|
onOpenChange: c
|
|
26
26
|
}) {
|
|
27
27
|
const {
|
|
28
28
|
formatMessage: n
|
|
29
|
-
} =
|
|
30
|
-
|
|
31
|
-
|
|
29
|
+
} = v(), {
|
|
30
|
+
isCollaboratorsOpen: d,
|
|
31
|
+
setContainerRef: C,
|
|
32
|
+
setForm: f
|
|
32
33
|
} = h(), {
|
|
33
|
-
isFetching:
|
|
34
|
+
isFetching: u,
|
|
34
35
|
isSubmitting: s,
|
|
35
|
-
item:
|
|
36
|
+
item: F,
|
|
36
37
|
variant: b
|
|
37
38
|
} = U(), {
|
|
38
|
-
form:
|
|
39
|
+
form: S
|
|
39
40
|
} = h(), {
|
|
40
|
-
name:
|
|
41
|
-
} =
|
|
42
|
-
s || (
|
|
43
|
-
}, [s, c,
|
|
41
|
+
name: L
|
|
42
|
+
} = F, _ = b === "desktop", g = S === "default", x = N((r) => {
|
|
43
|
+
s || (f("default"), c(r));
|
|
44
|
+
}, [s, c, f]), y = (r) => {
|
|
44
45
|
r.preventDefault();
|
|
45
46
|
};
|
|
46
47
|
return /* @__PURE__ */ i(e, {
|
|
47
|
-
onOpenChange:
|
|
48
|
+
onOpenChange: x,
|
|
48
49
|
open: p,
|
|
49
50
|
children: [!!m && /* @__PURE__ */ o(e.Trigger, {
|
|
50
51
|
children: m
|
|
51
52
|
}), /* @__PURE__ */ i(e.Content, {
|
|
52
|
-
ref:
|
|
53
|
+
ref: C,
|
|
53
54
|
className: a(t.content, _ && t.isFullscreen),
|
|
54
|
-
onPointerDownOutside:
|
|
55
|
+
onPointerDownOutside: y,
|
|
55
56
|
size: "medium",
|
|
56
57
|
children: [/* @__PURE__ */ i(e.Header, {
|
|
57
58
|
children: [n(l.title, {
|
|
58
|
-
itemName:
|
|
59
|
+
itemName: L
|
|
59
60
|
}), /* @__PURE__ */ o("div", {
|
|
60
61
|
className: t.classificationStatusContainer,
|
|
61
62
|
children: /* @__PURE__ */ o(k, {})
|
|
62
63
|
})]
|
|
63
64
|
}), /* @__PURE__ */ i(e.Body, {
|
|
64
65
|
className: a(t.body, !g && t.hasFooter),
|
|
65
|
-
children: [
|
|
66
|
+
children: [u && /* @__PURE__ */ o("div", {
|
|
66
67
|
className: t.loading,
|
|
67
|
-
children: /* @__PURE__ */ o(
|
|
68
|
+
children: /* @__PURE__ */ o(D, {
|
|
68
69
|
"aria-label": n(l.loadingLabel),
|
|
69
70
|
size: "large"
|
|
70
71
|
})
|
|
71
72
|
}), /* @__PURE__ */ o("div", {
|
|
72
|
-
className: a(t.form,
|
|
73
|
-
children:
|
|
73
|
+
className: a(t.form, u && t.isLoading),
|
|
74
|
+
children: d ? /* @__PURE__ */ o(O, {}) : /* @__PURE__ */ o(M, {})
|
|
74
75
|
})]
|
|
75
|
-
}), !_ && g && /* @__PURE__ */ o(e.Close, {
|
|
76
|
+
}), !_ && !d && g && /* @__PURE__ */ o(e.Close, {
|
|
76
77
|
"aria-label": n(l.closeButton),
|
|
77
78
|
disabled: s
|
|
78
79
|
})]
|
|
@@ -80,5 +81,5 @@ function X({
|
|
|
80
81
|
});
|
|
81
82
|
}
|
|
82
83
|
export {
|
|
83
|
-
|
|
84
|
+
Y as UnifiedShareFormModal
|
|
84
85
|
};
|
|
@@ -1,53 +1,53 @@
|
|
|
1
|
-
import { createContext as
|
|
2
|
-
import { useUnifiedShareModalContext as
|
|
3
|
-
import { jsx as
|
|
4
|
-
const
|
|
5
|
-
const t =
|
|
1
|
+
import { createContext as M, useContext as O, useState as e, useRef as F, useCallback as P, useEffect as A, useMemo as E } from "react";
|
|
2
|
+
import { useUnifiedShareModalContext as L } from "./unified-share-modal-context.js";
|
|
3
|
+
import { jsx as j } from "react/jsx-runtime";
|
|
4
|
+
const v = /* @__PURE__ */ M(null), z = () => {
|
|
5
|
+
const t = O(v);
|
|
6
6
|
if (!t)
|
|
7
7
|
throw new Error("useUnifiedShareFormContext must be used with UnifiedShareFormProvider");
|
|
8
8
|
return t;
|
|
9
|
-
},
|
|
9
|
+
}, B = ({
|
|
10
10
|
children: t
|
|
11
11
|
}) => {
|
|
12
12
|
const {
|
|
13
13
|
initialContacts: o,
|
|
14
14
|
isOpen: s
|
|
15
|
-
} =
|
|
16
|
-
R((
|
|
17
|
-
...
|
|
18
|
-
...
|
|
15
|
+
} = L(), [n, r] = e("default"), [a, i] = e(!1), [l, V] = e(null), [c, u] = e(o), [f, d] = e(""), [C, h] = e(""), [m, S] = e(), [x, R] = e({}), p = F(!1), U = F(!1), b = P((k) => {
|
|
16
|
+
R((w) => ({
|
|
17
|
+
...w,
|
|
18
|
+
...k
|
|
19
19
|
}));
|
|
20
20
|
}, []);
|
|
21
|
-
|
|
22
|
-
s || (r("default"),
|
|
21
|
+
A(() => {
|
|
22
|
+
s || (r("default"), i(!1), u(o), d(""), h(""), S(void 0), R({}), p.current = !1, U.current = !1);
|
|
23
23
|
}, [o, s]);
|
|
24
|
-
const
|
|
25
|
-
collaborationRole:
|
|
26
|
-
contactValue:
|
|
27
|
-
containerRef:
|
|
24
|
+
const g = E(() => ({
|
|
25
|
+
collaborationRole: m,
|
|
26
|
+
contactValue: f,
|
|
27
|
+
containerRef: l,
|
|
28
28
|
form: n,
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
29
|
+
isCollaboratorsOpen: a,
|
|
30
|
+
isSharedLinkAutoCopied: p,
|
|
31
|
+
isSharedLinkAutoCreated: U,
|
|
32
|
+
messageValue: C,
|
|
33
33
|
setCollaborationRole: S,
|
|
34
|
-
setContactValue:
|
|
35
|
-
setContainerRef:
|
|
34
|
+
setContactValue: d,
|
|
35
|
+
setContainerRef: V,
|
|
36
36
|
setForm: r,
|
|
37
|
+
setIsCollaboratorsOpen: i,
|
|
37
38
|
setMessageValue: h,
|
|
38
|
-
|
|
39
|
-
setShieldRestriction: v,
|
|
39
|
+
setShieldRestriction: b,
|
|
40
40
|
setUserContacts: u,
|
|
41
41
|
shieldRestriction: x,
|
|
42
|
-
userContacts:
|
|
43
|
-
}), [
|
|
44
|
-
return /* @__PURE__ */
|
|
45
|
-
value:
|
|
42
|
+
userContacts: c
|
|
43
|
+
}), [m, f, l, n, b, a, C, x, c]);
|
|
44
|
+
return /* @__PURE__ */ j(v.Provider, {
|
|
45
|
+
value: g,
|
|
46
46
|
children: t
|
|
47
47
|
});
|
|
48
48
|
};
|
|
49
49
|
export {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
50
|
+
v as UnifiedShareFormContext,
|
|
51
|
+
B as UnifiedShareFormProvider,
|
|
52
|
+
z as useUnifiedShareFormContext
|
|
53
53
|
};
|
|
@@ -6,16 +6,16 @@ export interface UnifiedShareFormContextValue {
|
|
|
6
6
|
contactValue: string;
|
|
7
7
|
containerRef: HTMLDivElement | null;
|
|
8
8
|
form: FormType;
|
|
9
|
+
isCollaboratorsOpen: boolean;
|
|
9
10
|
isSharedLinkAutoCopied: React.MutableRefObject<boolean>;
|
|
10
11
|
isSharedLinkAutoCreated: React.MutableRefObject<boolean>;
|
|
11
12
|
messageValue: string;
|
|
12
|
-
previousForm: FormType;
|
|
13
13
|
setCollaborationRole: Dispatch<SetStateAction<CollaborationRole | undefined>>;
|
|
14
14
|
setContactValue: Dispatch<SetStateAction<string>>;
|
|
15
15
|
setContainerRef: Dispatch<SetStateAction<HTMLDivElement | null>>;
|
|
16
16
|
setForm: Dispatch<SetStateAction<FormType>>;
|
|
17
|
+
setIsCollaboratorsOpen: Dispatch<SetStateAction<boolean>>;
|
|
17
18
|
setMessageValue: Dispatch<SetStateAction<string>>;
|
|
18
|
-
setPreviousForm: Dispatch<SetStateAction<FormType>>;
|
|
19
19
|
setShieldRestriction: Dispatch<SetStateAction<ShieldRestriction>>;
|
|
20
20
|
setUserContacts: Dispatch<SetStateAction<UserContactType[]>>;
|
|
21
21
|
shieldRestriction: ShieldRestriction;
|
|
@@ -18,14 +18,9 @@ export type VariantType = 'desktop' | 'modal';
|
|
|
18
18
|
*/
|
|
19
19
|
export type ViewType = 'unified-share-form' | 'shared-link-settings' | 'remove-shared-link' | 'remove-collaborator';
|
|
20
20
|
/**
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
* - `default` - The initial view which displays the collaboration and shared link sections
|
|
24
|
-
* - `invite` - An expanded view of the collaboration section used for inviting collaborators
|
|
25
|
-
* - `email` - An expanded view of the collaboration section used for emailing the shared link
|
|
26
|
-
* - `collaborators` - A separate view for displaying the list of collaborators on the item
|
|
21
|
+
* Form states in the Unified Share Modal.
|
|
27
22
|
*/
|
|
28
|
-
export type FormType = 'default' | 'invite' | 'email'
|
|
23
|
+
export type FormType = 'default' | 'invite' | 'email';
|
|
29
24
|
/**
|
|
30
25
|
* Supported success and error notifications when the user performs sharing actions.
|
|
31
26
|
*/
|
|
@@ -376,10 +371,14 @@ export interface EventService {
|
|
|
376
371
|
* This is usually used for data tracking purposes.
|
|
377
372
|
*/
|
|
378
373
|
onRestrictedUsersRemoveClick?: (contacts: UserContactType[]) => void;
|
|
374
|
+
/**
|
|
375
|
+
* Function to observe when the shared link is copied to the clipboard.
|
|
376
|
+
*/
|
|
377
|
+
onSharedLinkCopy?: (result: string | Error) => void;
|
|
379
378
|
/**
|
|
380
379
|
* Function to customize the click behavior of the "Link Settings" link.
|
|
381
380
|
*
|
|
382
|
-
*
|
|
381
|
+
* If provided, the default behavior is disabled and the shared link settings will not be opened.
|
|
383
382
|
*/
|
|
384
383
|
onSharedLinkSettingsClick?: () => void;
|
|
385
384
|
/**
|
package/package.json
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@box/unified-share-modal",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.8.0",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE",
|
|
5
5
|
"peerDependencies": {
|
|
6
|
-
"@box/blueprint-web": "^13.7.
|
|
7
|
-
"@box/blueprint-web-assets": "^4.105.
|
|
8
|
-
"@box/copy-input": "^1.39.
|
|
9
|
-
"@box/user-selector": "^1.73.
|
|
6
|
+
"@box/blueprint-web": "^13.7.2",
|
|
7
|
+
"@box/blueprint-web-assets": "^4.105.1",
|
|
8
|
+
"@box/copy-input": "^1.39.24",
|
|
9
|
+
"@box/user-selector": "^1.73.25",
|
|
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": "^13.7.
|
|
17
|
-
"@box/blueprint-web-assets": "^4.105.
|
|
18
|
-
"@box/copy-input": "^1.39.
|
|
19
|
-
"@box/storybook-utils": "0.16.
|
|
16
|
+
"@box/blueprint-web": "^13.7.2",
|
|
17
|
+
"@box/blueprint-web-assets": "^4.105.1",
|
|
18
|
+
"@box/copy-input": "^1.39.24",
|
|
19
|
+
"@box/storybook-utils": "0.16.74",
|
|
20
20
|
"@box/eslint-plugin-blueprint": "1.1.6",
|
|
21
21
|
"react-intl": "^6.4.2"
|
|
22
22
|
},
|