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