@box/unified-share-modal 2.12.15 → 2.12.16

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.
Files changed (95) hide show
  1. package/dist/chunks/classification-status.js +62 -0
  2. package/dist/chunks/collaboration-role.js +89 -0
  3. package/dist/chunks/collaboration-section.js +156 -0
  4. package/dist/chunks/collaborator-list-item.js +61 -0
  5. package/dist/chunks/collaborator-list.js +74 -0
  6. package/dist/chunks/remove-collaborator-modal.js +61 -0
  7. package/dist/chunks/remove-shared-link-modal.js +56 -0
  8. package/dist/chunks/shared-link-access.js +65 -0
  9. package/dist/chunks/shared-link-permission.js +67 -0
  10. package/dist/chunks/shared-link-section.js +176 -0
  11. package/dist/chunks/shared-link-settings-modal.js +86 -0
  12. package/dist/chunks/shared-with-avatars.js +48 -0
  13. package/dist/chunks/shield-restriction-notice.js +97 -0
  14. package/dist/chunks/text-area-container.js +36 -0
  15. package/dist/chunks/unified-share-form-modal.js +66 -0
  16. package/dist/chunks/unified-share-form.js +23 -0
  17. package/dist/esm/index.js +2 -4
  18. package/dist/esm/lib/components/classification-status/classification-status.js +2 -80
  19. package/dist/esm/lib/components/classification-status/index.js +2 -4
  20. package/dist/esm/lib/components/classification-status/messages.js +10 -12
  21. package/dist/esm/lib/components/index.js +5 -10
  22. package/dist/esm/lib/components/remove-collaborator-modal/index.js +2 -4
  23. package/dist/esm/lib/components/remove-collaborator-modal/messages.js +26 -28
  24. package/dist/esm/lib/components/remove-collaborator-modal/remove-collaborator-modal.js +2 -84
  25. package/dist/esm/lib/components/remove-shared-link-modal/index.js +2 -4
  26. package/dist/esm/lib/components/remove-shared-link-modal/messages.js +26 -28
  27. package/dist/esm/lib/components/remove-shared-link-modal/remove-shared-link-modal.js +2 -72
  28. package/dist/esm/lib/components/shared-link-settings-modal/download-section.js +35 -61
  29. package/dist/esm/lib/components/shared-link-settings-modal/expiration-section.js +33 -50
  30. package/dist/esm/lib/components/shared-link-settings-modal/index.js +2 -4
  31. package/dist/esm/lib/components/shared-link-settings-modal/messages.js +138 -144
  32. package/dist/esm/lib/components/shared-link-settings-modal/password-section.js +32 -52
  33. package/dist/esm/lib/components/shared-link-settings-modal/shared-link-settings-modal.js +2 -98
  34. package/dist/esm/lib/components/shared-link-settings-modal/shared-link-settings.js +97 -126
  35. package/dist/esm/lib/components/shared-link-settings-modal/vanity-section.js +33 -47
  36. package/dist/esm/lib/components/unified-share-form-modal/collaboration-section/collaboration-role.js +2 -128
  37. package/dist/esm/lib/components/unified-share-form-modal/collaboration-section/collaboration-section.js +2 -202
  38. package/dist/esm/lib/components/unified-share-form-modal/collaboration-section/index.js +2 -4
  39. package/dist/esm/lib/components/unified-share-form-modal/collaboration-section/messages.js +134 -136
  40. package/dist/esm/lib/components/unified-share-form-modal/collaboration-section/shared-with-avatars.js +2 -67
  41. package/dist/esm/lib/components/unified-share-form-modal/collaboration-section/shield-restriction-notice.js +2 -134
  42. package/dist/esm/lib/components/unified-share-form-modal/collaboration-section/text-area-container.js +2 -53
  43. package/dist/esm/lib/components/unified-share-form-modal/collaborator-list/collaborator-avatar.js +48 -60
  44. package/dist/esm/lib/components/unified-share-form-modal/collaborator-list/collaborator-list-item.js +2 -86
  45. package/dist/esm/lib/components/unified-share-form-modal/collaborator-list/collaborator-list.js +2 -101
  46. package/dist/esm/lib/components/unified-share-form-modal/collaborator-list/index.js +2 -4
  47. package/dist/esm/lib/components/unified-share-form-modal/collaborator-list/messages.js +38 -40
  48. package/dist/esm/lib/components/unified-share-form-modal/index.js +2 -4
  49. package/dist/esm/lib/components/unified-share-form-modal/messages.js +46 -48
  50. package/dist/esm/lib/components/unified-share-form-modal/shared-link-section/index.js +2 -4
  51. package/dist/esm/lib/components/unified-share-form-modal/shared-link-section/messages.js +142 -144
  52. package/dist/esm/lib/components/unified-share-form-modal/shared-link-section/shared-link-access.js +2 -102
  53. package/dist/esm/lib/components/unified-share-form-modal/shared-link-section/shared-link-permission.js +2 -105
  54. package/dist/esm/lib/components/unified-share-form-modal/shared-link-section/shared-link-section.js +2 -191
  55. package/dist/esm/lib/components/unified-share-form-modal/unified-share-form-modal.js +2 -85
  56. package/dist/esm/lib/components/unified-share-form-modal/unified-share-form.js +2 -29
  57. package/dist/esm/lib/constants.js +44 -28
  58. package/dist/esm/lib/contexts/index.js +4 -14
  59. package/dist/esm/lib/contexts/shared-link-settings-context.js +50 -59
  60. package/dist/esm/lib/contexts/unified-share-form-context.js +60 -57
  61. package/dist/esm/lib/contexts/unified-share-modal-context.js +65 -68
  62. package/dist/esm/lib/hooks/index.js +7 -14
  63. package/dist/esm/lib/hooks/use-access-levels.js +69 -93
  64. package/dist/esm/lib/hooks/use-collaboration-form.js +75 -95
  65. package/dist/esm/lib/hooks/use-form-validation.js +32 -43
  66. package/dist/esm/lib/hooks/use-link-settings-form.js +49 -64
  67. package/dist/esm/lib/hooks/use-permission-levels.js +33 -50
  68. package/dist/esm/lib/hooks/use-sharing-action.js +44 -59
  69. package/dist/esm/lib/messages.js +106 -108
  70. package/dist/esm/lib/unified-share-base.js +30 -40
  71. package/dist/esm/lib/unified-share-modal.js +41 -59
  72. package/dist/esm/lib/utils/collaborator.js +12 -27
  73. package/dist/esm/lib/utils/date.js +10 -14
  74. package/dist/esm/lib/utils/email.js +5 -7
  75. package/dist/esm/lib/utils/event.js +6 -13
  76. package/dist/esm/lib/utils/form.js +4 -14
  77. package/dist/esm/lib/utils/index.js +9 -34
  78. package/dist/esm/lib/utils/notification.js +19 -28
  79. package/dist/esm/lib/utils/permission.js +15 -22
  80. package/dist/esm/lib/utils/validation.js +2 -11
  81. package/dist/styles/classification-status.css +1 -1
  82. package/dist/styles/collaboration-role.css +1 -1
  83. package/dist/styles/collaboration-section.css +1 -1
  84. package/dist/styles/collaborator-list-item.css +1 -1
  85. package/dist/styles/collaborator-list.css +1 -1
  86. package/dist/styles/remove-collaborator-modal.css +1 -1
  87. package/dist/styles/shared-link-access.css +1 -1
  88. package/dist/styles/shared-link-section.css +1 -1
  89. package/dist/styles/shared-link-settings-modal.css +1 -1
  90. package/dist/styles/shared-with-avatars.css +1 -1
  91. package/dist/styles/shield-restriction-notice.css +1 -1
  92. package/dist/styles/text-area-container.css +1 -1
  93. package/dist/styles/unified-share-form-modal.css +1 -1
  94. package/dist/styles/unified-share-form.css +1 -1
  95. package/package.json +9 -9
@@ -0,0 +1,62 @@
1
+ import { useUnifiedShareModalContext as e } from "../esm/lib/contexts/unified-share-modal-context.js";
2
+ import t from "../esm/lib/components/classification-status/messages.js";
3
+ import { useIntl as n } from "react-intl";
4
+ import { CardTooltip as r, Status as i, Text as a } from "@box/blueprint-web";
5
+ import { jsx as o, jsxs as s } from "react/jsx-runtime";
6
+ import { Shield as c } from "@box/blueprint-web-assets/icons/Line";
7
+ import '../styles/classification-status.css';var l = {
8
+ container: "_container_1dpzl_1",
9
+ tooltip: "_tooltip_1dpzl_5",
10
+ header: "_header_1dpzl_11",
11
+ content: "_content_1dpzl_17"
12
+ };
13
+ function u() {
14
+ let { formatMessage: u } = n(), { item: d } = e(), { classification: f } = d;
15
+ if (!f) return null;
16
+ let { colorId: p, definition: m, name: h, restrictions: g } = f, _ = p + 1;
17
+ return /* @__PURE__ */ o("div", {
18
+ className: l.container,
19
+ children: /* @__PURE__ */ o(r, {
20
+ content: /* @__PURE__ */ s("div", {
21
+ className: l.tooltip,
22
+ children: [/* @__PURE__ */ s("div", {
23
+ className: l.header,
24
+ children: [/* @__PURE__ */ o(i, {
25
+ colorIndex: _,
26
+ hideText: !0,
27
+ icon: c,
28
+ text: ""
29
+ }), /* @__PURE__ */ o(a, {
30
+ as: "h3",
31
+ variant: "bodyDefaultBold",
32
+ children: h
33
+ })]
34
+ }), /* @__PURE__ */ s("div", {
35
+ className: l.content,
36
+ children: [/* @__PURE__ */ s("div", { children: [/* @__PURE__ */ o(a, {
37
+ as: "h4",
38
+ variant: "bodyDefaultBold",
39
+ children: u(t.definitionLabel)
40
+ }), /* @__PURE__ */ o(a, {
41
+ as: "p",
42
+ children: m
43
+ })] }), g && /* @__PURE__ */ s("div", { children: [/* @__PURE__ */ o(a, {
44
+ as: "h4",
45
+ variant: "bodyDefaultBold",
46
+ children: u(t.restrictionsLabel)
47
+ }), /* @__PURE__ */ o(a, {
48
+ as: "p",
49
+ children: g
50
+ })] })]
51
+ })]
52
+ }),
53
+ children: /* @__PURE__ */ o(i, {
54
+ colorIndex: _,
55
+ icon: c,
56
+ iconPosition: "left",
57
+ text: h.toUpperCase()
58
+ })
59
+ })
60
+ });
61
+ }
62
+ export { u as t };
@@ -0,0 +1,89 @@
1
+ import { useUnifiedShareModalContext as e } from "../esm/lib/contexts/unified-share-modal-context.js";
2
+ import { getDefaultCollaborationRole as t, isInvitationRoleSupported as n } from "../esm/lib/utils/collaborator.js";
3
+ import { useUnifiedShareFormContext as r } from "../esm/lib/contexts/unified-share-form-context.js";
4
+ import i from "../esm/lib/components/unified-share-form-modal/messages.js";
5
+ import a from "../esm/lib/components/unified-share-form-modal/collaboration-section/messages.js";
6
+ import { useEffect as o, useMemo as s, useState as c } from "react";
7
+ import { useIntl as l } from "react-intl";
8
+ import { DropdownMenu as u, Focusable as d, Tooltip as f, TriggerButton as p } from "@box/blueprint-web";
9
+ import { jsx as m, jsxs as h } from "react/jsx-runtime";
10
+ import g from "lodash/camelCase";
11
+ import '../styles/collaboration-role.css';var _ = {
12
+ button: "_button_jl1fl_1",
13
+ focusable: "_focusable_jl1fl_10",
14
+ content: "_content_jl1fl_14",
15
+ option: "_option_jl1fl_17"
16
+ };
17
+ function v() {
18
+ let { formatMessage: v } = l(), [y, b] = c(!1), { collaborationRole: x, setCollaborationRole: S } = r(), { collaborationRoles: C, eventService: w, isSubmitting: T, item: E, variant: D } = e(), { permissions: O = {}, type: k } = E, { onCollaborationRoleChange: A } = w, j = D === "desktop", M = s(() => C.map((e) => {
19
+ let { description: t, id: r, label: o } = e, s = n(r), c = g(r), l = c;
20
+ r === "editor" && k === "folder" && (l += "Folder");
21
+ let u = r, d = "";
22
+ return s && (u = v(i[`${c}Role`]), d = v(a[`${l}Description`])), {
23
+ ...e,
24
+ description: t ?? d,
25
+ label: o ?? u
26
+ };
27
+ }), [
28
+ C,
29
+ v,
30
+ k
31
+ ]);
32
+ if (o(() => {
33
+ S(t(M));
34
+ }, [M, S]), !M.length || !x) return null;
35
+ let { id: N, label: P } = x, F;
36
+ return O.canInviteCollaborator || (F = v(a.inviteDisabledTooltip)), k === "web_link" && (F = v(a.inviteWebLinkDisabledTooltip)), F ? /* @__PURE__ */ m(f, {
37
+ align: "start",
38
+ content: F,
39
+ "data-testid": "usm-CollaborationRole-tooltip",
40
+ side: "bottom",
41
+ children: /* @__PURE__ */ m(d, {
42
+ className: _.focusable,
43
+ children: /* @__PURE__ */ m(p, {
44
+ caretDirection: "down",
45
+ className: _.button,
46
+ disabled: !0,
47
+ label: v(a.inviteAsRoleLabel, { role: P }),
48
+ size: "extraSmall",
49
+ variant: "tertiary"
50
+ })
51
+ })
52
+ }) : /* @__PURE__ */ h(u.Root, {
53
+ isFullScreenEnabled: j,
54
+ menuItemsSize: "medium",
55
+ onOpenChange: b,
56
+ open: y,
57
+ children: [/* @__PURE__ */ m(u.Trigger, { children: /* @__PURE__ */ m(p, {
58
+ caretDirection: y ? "up" : "down",
59
+ className: _.button,
60
+ "data-target-id": "PlainButton-InviteePermissionsMenuToggle",
61
+ disabled: T,
62
+ label: v(a.inviteAsRoleLabel, { role: P }),
63
+ size: "extraSmall",
64
+ variant: "tertiary"
65
+ }) }), /* @__PURE__ */ h(u.Content, {
66
+ align: "start",
67
+ className: _.content,
68
+ children: [j && /* @__PURE__ */ h(u.Header, { children: [/* @__PURE__ */ m(u.Header.MenuCloseButton, {
69
+ "aria-label": v(a.closeButton),
70
+ iconVariant: "back"
71
+ }), /* @__PURE__ */ m(u.Header.TextContent, { title: v(a.invitePeopleLabel) })] }), M.map((e) => {
72
+ let { description: t, isDisabled: n, id: r, label: i } = e;
73
+ return /* @__PURE__ */ m(u.CheckboxItem, {
74
+ checked: N === r,
75
+ disabled: n,
76
+ onSelect: () => {
77
+ S(e), A && A(r);
78
+ },
79
+ children: /* @__PURE__ */ m(u.Item.MainContent, {
80
+ caption: t,
81
+ className: _.option,
82
+ label: i
83
+ })
84
+ }, r);
85
+ })]
86
+ })]
87
+ });
88
+ }
89
+ export { v as t };
@@ -0,0 +1,156 @@
1
+ import { useUnifiedShareModalContext as e } from "../esm/lib/contexts/unified-share-modal-context.js";
2
+ import { parseEmails as t } from "../esm/lib/utils/email.js";
3
+ import { getNotificationArgs as n } from "../esm/lib/utils/notification.js";
4
+ import { useUnifiedShareFormContext as r } from "../esm/lib/contexts/unified-share-form-context.js";
5
+ import { useFormValidation as ee } from "../esm/lib/hooks/use-form-validation.js";
6
+ import { useCollaborationForm as te } from "../esm/lib/hooks/use-collaboration-form.js";
7
+ import i from "../esm/lib/components/unified-share-form-modal/collaboration-section/messages.js";
8
+ import { t as a } from "./collaboration-role.js";
9
+ import { t as ne } from "./shared-with-avatars.js";
10
+ import { t as re } from "./shield-restriction-notice.js";
11
+ import { t as ie } from "./text-area-container.js";
12
+ import { useCallback as o, useEffect as s, useRef as ae, useState as c } from "react";
13
+ import l from "clsx";
14
+ import { useIntl as u } from "react-intl";
15
+ import { Focusable as d, Modal as f, Text as p, Tooltip as m, useBlueprintModernization as oe, useLabelable as se, useNotification as ce, useUniqueId as le } from "@box/blueprint-web";
16
+ import { Fragment as ue, jsx as h, jsxs as g } from "react/jsx-runtime";
17
+ import { createPortal as de } from "react-dom";
18
+ import { Globe as fe } from "@box/blueprint-web-assets/icons/Medium";
19
+ import { bpSize040 as _ } from "@box/blueprint-web-assets/tokens/tokens";
20
+ import { UserSelectorContainer as pe } from "@box/user-selector";
21
+ import '../styles/collaboration-section.css';var v = {
22
+ container: "_container_1e2gg_2",
23
+ label: "_label_1e2gg_8",
24
+ modernized: "_modernized_1e2gg_15",
25
+ security: "_security_1e2gg_33",
26
+ icon: "_icon_1e2gg_37",
27
+ access: "_access_1e2gg_43"
28
+ };
29
+ function y() {
30
+ let { formatMessage: y } = u(), [b, x] = c(), { enableModernizedComponents: S } = oe(), { addNotification: C } = ce(), { validateShieldRestriction: w } = ee(), { contactValue: T, containerRef: E, form: D, setForm: O, setUserContacts: k, shieldRestriction: A, userContacts: j } = r(), { collaborationAccess: M, collaborationNotices: N, config: P, contactService: F, isFetching: I, isSubmitting: L, item: R, onOpenChange: z, sharingService: B, variant: me } = e(), { permissions: he = {}, type: ge } = R, { getContacts: V, getContactsAvatarUrls: H } = F, { sendInvitations: _e, sendSharedLink: ve } = B, ye = me === "desktop", U = D === "default" || D === "invite", W = D === "invite" || D === "email", be = D === "invite" && P.collaborationMessage, xe = D === "email" && P.sharedLinkEmailMessage, Se = j.some((e) => e.isExternalUser), G, K;
31
+ D === "invite" && (G = _e, K = "invite-collaborators"), D === "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(D === "email" ? "email" : "invite");
33
+ s(() => {
34
+ Y.current = D === "email" ? "email" : "invite";
35
+ }, [D]), s(() => {
36
+ (!j.length || !j.some((e) => e.chipVariant === "error")) && x(null);
37
+ }, [j]);
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 || O("invite"), Ee(e);
40
+ }, X = o((e) => {
41
+ let n = e.clipboardData.getData("text");
42
+ t(n).length !== 0 && (e.preventDefault(), W || O("invite"), J([...j, { value: n }]));
43
+ }, [
44
+ J,
45
+ W,
46
+ O,
47
+ j
48
+ ]), je = () => {
49
+ q(), O("default");
50
+ }, Me = async () => {
51
+ try {
52
+ if (b) {
53
+ let e = w(j, A);
54
+ if (e) {
55
+ C({
56
+ ...n(y, "error"),
57
+ styledText: e
58
+ });
59
+ return;
60
+ }
61
+ }
62
+ if (await we()) return;
63
+ q(), z(!1), O("default");
64
+ } catch (e) {
65
+ if (!e.shieldRestriction) return;
66
+ let { shieldRestriction: t } = e, n = [...t.restrictedEmails ?? [], ...t.restrictedGroups ?? []], r = j.map((e) => n.includes(e.email) || n.includes(`${e.id}`) ? {
67
+ ...e,
68
+ chipVariant: "error"
69
+ } : e);
70
+ x(t), k(r);
71
+ }
72
+ }, Z, Q = !1;
73
+ U && !he.canInviteCollaborator && (Z = y(i.inviteDisabledTooltip), Q = !0), U && ge === "web_link" && (Z = y(i.inviteWebLinkDisabledTooltip), Q = !0);
74
+ let $ = le("usm-UserContacts-"), Ne = se(y(U ? i.invitePeopleLabel : i.emailSharedLinkLabel), $);
75
+ return /* @__PURE__ */ g("form", {
76
+ className: v.container,
77
+ onSubmit: (e) => e.preventDefault(),
78
+ children: [
79
+ b && /* @__PURE__ */ h(re, {
80
+ error: b,
81
+ isLoading: L,
82
+ onSelectedUsersChange: J
83
+ }),
84
+ N,
85
+ /* @__PURE__ */ g("div", { children: [
86
+ U && P.collaborators && /* @__PURE__ */ h(ne, {}),
87
+ /* @__PURE__ */ h(Ne, { className: l(v.label, S && v.modernized) }),
88
+ /* @__PURE__ */ h(m, {
89
+ content: Z,
90
+ "data-testid": "usm-UserContacts-tooltip",
91
+ open: Z ? void 0 : !1,
92
+ side: "bottom",
93
+ children: /* @__PURE__ */ h(d, {
94
+ focusable: Q,
95
+ children: /* @__PURE__ */ h(pe, {
96
+ className: "usm-UserContacts-input",
97
+ clearButtonAriaLabel: y(i.clearButton),
98
+ clearOnBlur: !1,
99
+ "data-target-id": "PillSelectorDropdown-AddNamesOrEmailAddresses",
100
+ disabled: Q || L,
101
+ displayChipVariant: (e) => e.chipVariant,
102
+ error: Ce.userContacts,
103
+ fetchAvatarUrls: ke,
104
+ fetchUsers: Oe,
105
+ hideOnEscape: De,
106
+ idForLabel: $,
107
+ inputValue: T,
108
+ label: null,
109
+ onBlur: Te,
110
+ onInputValueChange: Ae,
111
+ onPaste: X,
112
+ onSelectedUsersChange: J,
113
+ placeholder: j.length ? "" : y(i.invitePeoplePlaceholder),
114
+ portalElement: E,
115
+ selectedUsers: j,
116
+ selectOnEnterOrTab: !0,
117
+ variant: W ? "textarea" : "input"
118
+ })
119
+ })
120
+ }),
121
+ U && /* @__PURE__ */ g("div", {
122
+ className: v.access,
123
+ children: [P.collaborationRole && /* @__PURE__ */ h(a, {}), M]
124
+ })
125
+ ] }),
126
+ (be || xe) && /* @__PURE__ */ h(ie, { maxCount: P.collaborationMessageLimit }),
127
+ W && Se && /* @__PURE__ */ g("div", {
128
+ className: v.security,
129
+ children: [/* @__PURE__ */ h(fe, {
130
+ className: v.icon,
131
+ height: _,
132
+ width: _
133
+ }), /* @__PURE__ */ h(p, {
134
+ as: "span",
135
+ color: "textOnLightSecondary",
136
+ children: y(i.contentSharedWithExternalCollaborators)
137
+ })]
138
+ }),
139
+ W && E && /* @__PURE__ */ de(/* @__PURE__ */ g(ue, { children: [!I && /* @__PURE__ */ g(f.Footer, { children: [/* @__PURE__ */ h(f.Footer.SecondaryButton, {
140
+ disabled: L,
141
+ onClick: je,
142
+ children: y(i.cancelButton)
143
+ }), /* @__PURE__ */ h(f.Footer.PrimaryButton, {
144
+ "data-target-id": "Modal.Footer.PrimaryButton-USMSendInvite",
145
+ loading: L,
146
+ loadingAriaLabel: y(i.loadingLabel),
147
+ onClick: Me,
148
+ children: y(i.sendButton)
149
+ })] }), !ye && /* @__PURE__ */ h(f.Close, {
150
+ "aria-label": y(i.closeButton),
151
+ disabled: L
152
+ })] }), E)
153
+ ]
154
+ });
155
+ }
156
+ export { y as t };
@@ -0,0 +1,61 @@
1
+ import { useUnifiedShareModalContext as e } from "../esm/lib/contexts/unified-share-modal-context.js";
2
+ import { isCollaboratorRoleSupported as t } from "../esm/lib/utils/collaborator.js";
3
+ import n from "../esm/lib/components/unified-share-form-modal/collaborator-list/messages.js";
4
+ import { CollaboratorAvatar as r } from "../esm/lib/components/unified-share-form-modal/collaborator-list/collaborator-avatar.js";
5
+ import i from "../esm/lib/components/unified-share-form-modal/messages.js";
6
+ import { useIntl as a } from "react-intl";
7
+ import { Cell as o, EllipsizableText as s, IconButton as c, Row as l, Tooltip as u } from "@box/blueprint-web";
8
+ import { jsx as d, jsxs as f } from "react/jsx-runtime";
9
+ import p from "lodash/camelCase";
10
+ import { XMark as m } from "@box/blueprint-web-assets/icons/Fill";
11
+ import '../styles/collaborator-list-item.css';var h = {
12
+ nameCell: "_nameCell_19s89_1",
13
+ nameDetails: "_nameDetails_19s89_7",
14
+ roleCell: "_roleCell_19s89_17"
15
+ };
16
+ function g({ collaborator: g, isSmall: _ }) {
17
+ let { formatMessage: v } = a(), { email: y, hasCustomRole: b, id: x, isPending: S, isRemovable: C, name: w, role: T } = g, { item: E, setCollaborator: D, setView: O } = e(), { permissions: k = {} } = E, A = t(T) ? v(i[`${p(T)}Role`]) : "", j = b ? T : A;
18
+ return /* @__PURE__ */ f(l, {
19
+ id: x,
20
+ children: [/* @__PURE__ */ d(o, { children: /* @__PURE__ */ f("div", {
21
+ className: h.nameCell,
22
+ children: [/* @__PURE__ */ d(r, {
23
+ collaborator: g,
24
+ isBadgeable: !0,
25
+ size: "large"
26
+ }), /* @__PURE__ */ f("div", {
27
+ className: h.nameDetails,
28
+ children: [/* @__PURE__ */ d(s, {
29
+ as: "span",
30
+ lineClamp: 1,
31
+ variant: "bodyDefaultSemibold",
32
+ children: w
33
+ }), y && /* @__PURE__ */ d(s, {
34
+ as: "span",
35
+ color: "textOnLightSecondary",
36
+ lineClamp: 1,
37
+ variant: "caption",
38
+ children: y
39
+ })]
40
+ })]
41
+ }) }), !_ && /* @__PURE__ */ d(o, { children: /* @__PURE__ */ f("div", {
42
+ className: h.roleCell,
43
+ children: [/* @__PURE__ */ d(s, {
44
+ as: "span",
45
+ color: "textOnLightSecondary",
46
+ lineClamp: 1,
47
+ children: S ? v(n.pendingRole) : j
48
+ }), C && k.canRemoveCollaborator && /* @__PURE__ */ d(u, {
49
+ content: v(n.removeButton),
50
+ children: /* @__PURE__ */ d(c, {
51
+ "aria-label": v(n.removeButton),
52
+ icon: m,
53
+ onClick: () => {
54
+ D(g), O("remove-collaborator");
55
+ }
56
+ })
57
+ })]
58
+ }) })]
59
+ });
60
+ }
61
+ export { g as t };
@@ -0,0 +1,74 @@
1
+ import { useUnifiedShareModalContext as e } from "../esm/lib/contexts/unified-share-modal-context.js";
2
+ import { callOnKeyboardEvent as t } from "../esm/lib/utils/event.js";
3
+ import { useUnifiedShareFormContext as n } from "../esm/lib/contexts/unified-share-form-context.js";
4
+ import r from "../esm/lib/components/unified-share-form-modal/collaborator-list/messages.js";
5
+ import { t as i } from "./collaborator-list-item.js";
6
+ import { useIntl as a } from "react-intl";
7
+ import { Breakpoint as o, Column as s, Divider as c, Link as l, Modal as u, Table as d, TableBody as f, TableHeader as p, useBreakpoint as m } from "@box/blueprint-web";
8
+ import { Fragment as h, jsx as g, jsxs as _ } from "react/jsx-runtime";
9
+ import { createPortal as v } from "react-dom";
10
+ import '../styles/collaborator-list.css';var y = {
11
+ divider: "_divider_ozw7g_1",
12
+ manage: "_manage_ozw7g_8",
13
+ link: "_link_ozw7g_14",
14
+ list: "_list_ozw7g_18",
15
+ scroll: "_scroll_ozw7g_34",
16
+ header: "_header_ozw7g_40"
17
+ };
18
+ function b() {
19
+ let { formatMessage: b } = a(), x = m() === o.Small, { collaborators: S, config: C, eventService: w, isFetching: T, isSubmitting: E, item: D, variant: O } = e(), { id: k, type: A } = D, { onCollaboratorsManagementClick: j } = w, M = O === "desktop", { containerRef: N, setIsCollaboratorsOpen: P } = n();
20
+ return /* @__PURE__ */ _(h, { children: [
21
+ M && /* @__PURE__ */ g(c, { className: y.divider }),
22
+ C.collaboratorsManagement && /* @__PURE__ */ g("div", {
23
+ className: y.manage,
24
+ children: j ? /* @__PURE__ */ g(l, {
25
+ className: y.link,
26
+ onClick: j,
27
+ onKeyDown: t(j, { canPreventDefault: !0 }),
28
+ role: "button",
29
+ tabIndex: 0,
30
+ variant: "standalone",
31
+ children: b(r.manageAllLink)
32
+ }) : /* @__PURE__ */ g(l, {
33
+ href: `/${A}/${k}/collaborators`,
34
+ rel: "noopener",
35
+ target: "_blank",
36
+ variant: "standalone",
37
+ children: b(r.manageAllLink)
38
+ })
39
+ }),
40
+ /* @__PURE__ */ g("div", {
41
+ className: y.list,
42
+ children: /* @__PURE__ */ g("div", {
43
+ className: y.scroll,
44
+ children: /* @__PURE__ */ _(d, {
45
+ "aria-label": b(r.listLabel),
46
+ children: [/* @__PURE__ */ _(p, {
47
+ className: y.header,
48
+ children: [/* @__PURE__ */ g(s, {
49
+ hideHeader: !0,
50
+ isRowHeader: !0,
51
+ width: "11fr",
52
+ children: b(r.nameColumn)
53
+ }), !x && /* @__PURE__ */ g(s, {
54
+ hideHeader: !0,
55
+ width: "10fr",
56
+ children: b(r.roleColumn)
57
+ })]
58
+ }), /* @__PURE__ */ g(f, { children: S.slice(0, C.collaboratorsLimit).map((e) => /* @__PURE__ */ g(i, {
59
+ collaborator: e,
60
+ isSmall: x
61
+ }, e.id)) })]
62
+ })
63
+ })
64
+ }),
65
+ N && /* @__PURE__ */ v(/* @__PURE__ */ _(h, { children: [!T && /* @__PURE__ */ g(u.Footer, { children: /* @__PURE__ */ g(u.Footer.SecondaryButton, {
66
+ onClick: () => P(!1),
67
+ children: b(r.doneButton)
68
+ }) }), !M && /* @__PURE__ */ g(u.Close, {
69
+ "aria-label": b(r.closeButton),
70
+ disabled: E
71
+ })] }), N)
72
+ ] });
73
+ }
74
+ export { b as t };
@@ -0,0 +1,61 @@
1
+ import { useUnifiedShareModalContext as e } from "../esm/lib/contexts/unified-share-modal-context.js";
2
+ import { useSharingAction as t } from "../esm/lib/hooks/use-sharing-action.js";
3
+ import n from "../esm/lib/components/remove-collaborator-modal/messages.js";
4
+ import { useEffect as r } from "react";
5
+ import i from "clsx";
6
+ import a from "lodash/noop";
7
+ import { useIntl as o } from "react-intl";
8
+ import { Divider as s, Modal as c, Text as l } from "@box/blueprint-web";
9
+ import { jsx as u, jsxs as d } from "react/jsx-runtime";
10
+ import '../styles/remove-collaborator-modal.css';var f = {
11
+ content: "_content_166yb_1",
12
+ isFullscreen: "_isFullscreen_166yb_1",
13
+ body: "_body_166yb_10",
14
+ divider: "_divider_166yb_17"
15
+ };
16
+ function p({ isOpen: p, onOpenChange: m }) {
17
+ let { formatMessage: h } = o(), { collaborator: g, isSubmitting: _, sharingService: v, setCollaborator: y, variant: b } = e(), { email: x, name: S } = g ?? {}, { removeCollaborator: C } = v, w = b === "desktop";
18
+ r(() => {
19
+ p || y(null);
20
+ }, [p, y]);
21
+ let { onAction: T } = t(C, "remove-collaborator");
22
+ return /* @__PURE__ */ u(c, {
23
+ onOpenChange: _ ? a : m,
24
+ open: p,
25
+ children: /* @__PURE__ */ d(c.Content, {
26
+ className: i(f.content, w && f.isFullscreen),
27
+ onPointerDownOutside: (e) => {
28
+ e.preventDefault();
29
+ },
30
+ size: "small",
31
+ children: [
32
+ /* @__PURE__ */ u(c.Header, { children: h(n.title) }),
33
+ /* @__PURE__ */ d(c.Body, {
34
+ className: f.body,
35
+ children: [w && /* @__PURE__ */ u(s, { className: f.divider }), /* @__PURE__ */ u(l, {
36
+ as: "p",
37
+ children: h(n.bodyText, { name: x || S })
38
+ })]
39
+ }),
40
+ /* @__PURE__ */ d(c.Footer, { children: [/* @__PURE__ */ u(c.Footer.SecondaryButton, {
41
+ disabled: _,
42
+ onClick: () => m(!1),
43
+ children: h(n.cancelButton)
44
+ }), /* @__PURE__ */ u(c.Footer.PrimaryButton, {
45
+ "data-target-id": "Modal.Footer.PrimaryButton-USMRemoveCollaborator",
46
+ loading: _,
47
+ loadingAriaLabel: h(n.loadingLabel),
48
+ onClick: async () => {
49
+ await T(g), m(!1);
50
+ },
51
+ children: h(n.okayButton)
52
+ })] }),
53
+ !w && /* @__PURE__ */ u(c.Close, {
54
+ "aria-label": h(n.closeButton),
55
+ disabled: _
56
+ })
57
+ ]
58
+ })
59
+ });
60
+ }
61
+ export { p as t };
@@ -0,0 +1,56 @@
1
+ import { useUnifiedShareModalContext as e } from "../esm/lib/contexts/unified-share-modal-context.js";
2
+ import { useSharingAction as t } from "../esm/lib/hooks/use-sharing-action.js";
3
+ import n from "../esm/lib/components/remove-shared-link-modal/messages.js";
4
+ import r from "clsx";
5
+ import i from "lodash/noop";
6
+ import { useIntl as a } from "react-intl";
7
+ import { Divider as o, Modal as s, Text as c } from "@box/blueprint-web";
8
+ import { jsx as l, jsxs as u } from "react/jsx-runtime";
9
+ import '../styles/remove-collaborator-modal.css';var d = {
10
+ content: "_content_166yb_1",
11
+ isFullscreen: "_isFullscreen_166yb_1",
12
+ body: "_body_166yb_10",
13
+ divider: "_divider_166yb_17"
14
+ };
15
+ function f({ isOpen: f, onOpenChange: p }) {
16
+ let { formatMessage: m } = a(), { isSubmitting: h, sharingService: g, variant: _ } = e(), { deleteSharedLink: v } = g, y = _ === "desktop", { onAction: b } = t(v, "delete-shared-link");
17
+ return /* @__PURE__ */ l(s, {
18
+ onOpenChange: h ? i : p,
19
+ open: f,
20
+ children: /* @__PURE__ */ u(s.Content, {
21
+ className: r(d.content, y && d.isFullscreen),
22
+ onPointerDownOutside: (e) => {
23
+ e.preventDefault();
24
+ },
25
+ size: "small",
26
+ children: [
27
+ /* @__PURE__ */ l(s.Header, { children: m(n.title) }),
28
+ /* @__PURE__ */ u(s.Body, {
29
+ className: d.body,
30
+ children: [y && /* @__PURE__ */ l(o, { className: d.divider }), /* @__PURE__ */ l(c, {
31
+ as: "p",
32
+ children: m(n.bodyText)
33
+ })]
34
+ }),
35
+ /* @__PURE__ */ u(s.Footer, { children: [/* @__PURE__ */ l(s.Footer.SecondaryButton, {
36
+ disabled: h,
37
+ onClick: () => p(!1),
38
+ children: m(n.cancelButton)
39
+ }), /* @__PURE__ */ l(s.Footer.PrimaryButton, {
40
+ "data-target-id": "Modal.Footer.PrimaryButton-USMRemoveSharedLink",
41
+ loading: h,
42
+ loadingAriaLabel: m(n.loadingLabel),
43
+ onClick: async () => {
44
+ await b(), p(!1);
45
+ },
46
+ children: m(n.okayButton)
47
+ })] }),
48
+ !y && /* @__PURE__ */ l(s.Close, {
49
+ "aria-label": m(n.closeButton),
50
+ disabled: h
51
+ })
52
+ ]
53
+ })
54
+ });
55
+ }
56
+ export { f as t };
@@ -0,0 +1,65 @@
1
+ import { useUnifiedShareModalContext as e } from "../esm/lib/contexts/unified-share-modal-context.js";
2
+ import t from "../esm/lib/components/unified-share-form-modal/shared-link-section/messages.js";
3
+ import { useAccessLevels as n } from "../esm/lib/hooks/use-access-levels.js";
4
+ import { useSharingAction as r } from "../esm/lib/hooks/use-sharing-action.js";
5
+ import { useState as i } from "react";
6
+ import { useIntl as a } from "react-intl";
7
+ import { DropdownMenu as o, Focusable as s, Tooltip as c, TriggerButton as l } from "@box/blueprint-web";
8
+ import { jsx as u, jsxs as d } from "react/jsx-runtime";
9
+ import '../styles/shared-link-access.css';var f = {
10
+ button: "_button_166my_1",
11
+ content: "_content_166my_9",
12
+ option: "_option_166my_12"
13
+ };
14
+ function p() {
15
+ let { formatMessage: p } = a(), [m, h] = i(!1), { isSubmitting: g, item: _, sharedLink: v, sharingService: y, variant: b } = e(), { permissions: x = {} } = _, { access: S } = v, { changeSharedLinkAccess: C } = y, w = b === "desktop", { onAction: T } = r(C), { allowedLevels: E, selectedAccess: D } = n();
16
+ if (!E.length || !D) return null;
17
+ let { label: O } = D;
18
+ return /* @__PURE__ */ d(o.Root, {
19
+ isFullScreenEnabled: w,
20
+ menuItemsSize: "medium",
21
+ onOpenChange: h,
22
+ open: m,
23
+ children: [/* @__PURE__ */ u(o.Trigger, { children: /* @__PURE__ */ u(l, {
24
+ caretDirection: m ? "up" : "down",
25
+ className: f.button,
26
+ "data-target-id": "Button-SharedLinkAccessMenuLabel",
27
+ disabled: !x.canSetShareAccess || g,
28
+ label: O,
29
+ size: "extraSmall",
30
+ variant: "tertiary"
31
+ }) }), /* @__PURE__ */ d(o.Content, {
32
+ align: "start",
33
+ className: f.content,
34
+ children: [w && /* @__PURE__ */ d(o.Header, { children: [/* @__PURE__ */ u(o.Header.MenuCloseButton, {
35
+ "aria-label": p(t.closeButton),
36
+ iconVariant: "back"
37
+ }), /* @__PURE__ */ u(o.Header.TextContent, { title: p(t.shareLinkLabel) })] }), E.map((e) => {
38
+ let { description: n, disabledReason: r, id: i, label: a } = e, l = S === i;
39
+ return r ? /* @__PURE__ */ u(c, {
40
+ content: p(t.disabledAccessLevelTooltip),
41
+ children: /* @__PURE__ */ u(s, { children: /* @__PURE__ */ u(o.CheckboxItem, {
42
+ checked: l,
43
+ disabled: !0,
44
+ children: /* @__PURE__ */ u(o.Item.MainContent, {
45
+ caption: n,
46
+ className: f.option,
47
+ label: a
48
+ })
49
+ }, i) })
50
+ }, i) : /* @__PURE__ */ u(o.CheckboxItem, {
51
+ checked: l,
52
+ onSelect: () => {
53
+ l || T(i);
54
+ },
55
+ children: /* @__PURE__ */ u(o.Item.MainContent, {
56
+ caption: n,
57
+ className: f.option,
58
+ label: a
59
+ })
60
+ }, i);
61
+ })]
62
+ })]
63
+ });
64
+ }
65
+ export { p as t };