@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.
Files changed (81) hide show
  1. package/dist/chunks/classification-status.js +1 -62
  2. package/dist/chunks/collaboration-role.js +1 -89
  3. package/dist/chunks/collaboration-section.js +1 -159
  4. package/dist/chunks/collaborator-list-item.js +1 -61
  5. package/dist/chunks/collaborator-list.js +1 -74
  6. package/dist/chunks/remove-collaborator-modal.js +1 -61
  7. package/dist/chunks/remove-shared-link-modal.js +1 -56
  8. package/dist/chunks/shared-link-access.js +1 -65
  9. package/dist/chunks/shared-link-permission.js +1 -67
  10. package/dist/chunks/shared-link-section.js +1 -184
  11. package/dist/chunks/shared-link-settings-modal.js +1 -86
  12. package/dist/chunks/shared-with-avatars.js +1 -48
  13. package/dist/chunks/shield-restriction-notice.js +1 -97
  14. package/dist/chunks/text-area-container.js +1 -36
  15. package/dist/chunks/unified-share-form-modal.js +1 -67
  16. package/dist/chunks/unified-share-form.js +1 -23
  17. package/dist/esm/index.js +1 -2
  18. package/dist/esm/lib/components/classification-status/classification-status.js +1 -2
  19. package/dist/esm/lib/components/classification-status/index.js +1 -2
  20. package/dist/esm/lib/components/classification-status/messages.js +1 -12
  21. package/dist/esm/lib/components/index.js +1 -5
  22. package/dist/esm/lib/components/remove-collaborator-modal/index.js +1 -2
  23. package/dist/esm/lib/components/remove-collaborator-modal/messages.js +1 -28
  24. package/dist/esm/lib/components/remove-collaborator-modal/remove-collaborator-modal.js +1 -2
  25. package/dist/esm/lib/components/remove-shared-link-modal/index.js +1 -2
  26. package/dist/esm/lib/components/remove-shared-link-modal/messages.js +1 -28
  27. package/dist/esm/lib/components/remove-shared-link-modal/remove-shared-link-modal.js +1 -2
  28. package/dist/esm/lib/components/shared-link-settings-modal/download-section.js +1 -36
  29. package/dist/esm/lib/components/shared-link-settings-modal/expiration-section.js +1 -34
  30. package/dist/esm/lib/components/shared-link-settings-modal/index.js +1 -2
  31. package/dist/esm/lib/components/shared-link-settings-modal/messages.js +1 -140
  32. package/dist/esm/lib/components/shared-link-settings-modal/password-section.js +1 -33
  33. package/dist/esm/lib/components/shared-link-settings-modal/shared-link-settings-modal.js +1 -2
  34. package/dist/esm/lib/components/shared-link-settings-modal/shared-link-settings.js +1 -98
  35. package/dist/esm/lib/components/shared-link-settings-modal/vanity-section.js +1 -34
  36. package/dist/esm/lib/components/unified-share-form-modal/collaboration-section/collaboration-role.js +1 -2
  37. package/dist/esm/lib/components/unified-share-form-modal/collaboration-section/collaboration-section.js +1 -2
  38. package/dist/esm/lib/components/unified-share-form-modal/collaboration-section/index.js +1 -2
  39. package/dist/esm/lib/components/unified-share-form-modal/collaboration-section/messages.js +1 -136
  40. package/dist/esm/lib/components/unified-share-form-modal/collaboration-section/shared-with-avatars.js +1 -2
  41. package/dist/esm/lib/components/unified-share-form-modal/collaboration-section/shield-restriction-notice.js +1 -2
  42. package/dist/esm/lib/components/unified-share-form-modal/collaboration-section/text-area-container.js +1 -2
  43. package/dist/esm/lib/components/unified-share-form-modal/collaborator-list/collaborator-avatar.js +1 -49
  44. package/dist/esm/lib/components/unified-share-form-modal/collaborator-list/collaborator-list-item.js +1 -2
  45. package/dist/esm/lib/components/unified-share-form-modal/collaborator-list/collaborator-list.js +1 -2
  46. package/dist/esm/lib/components/unified-share-form-modal/collaborator-list/index.js +1 -2
  47. package/dist/esm/lib/components/unified-share-form-modal/collaborator-list/messages.js +1 -40
  48. package/dist/esm/lib/components/unified-share-form-modal/index.js +1 -2
  49. package/dist/esm/lib/components/unified-share-form-modal/messages.js +1 -48
  50. package/dist/esm/lib/components/unified-share-form-modal/shared-link-section/index.js +1 -2
  51. package/dist/esm/lib/components/unified-share-form-modal/shared-link-section/messages.js +1 -144
  52. package/dist/esm/lib/components/unified-share-form-modal/shared-link-section/shared-link-access.js +1 -2
  53. package/dist/esm/lib/components/unified-share-form-modal/shared-link-section/shared-link-permission.js +1 -2
  54. package/dist/esm/lib/components/unified-share-form-modal/shared-link-section/shared-link-section.js +1 -2
  55. package/dist/esm/lib/components/unified-share-form-modal/unified-share-form-modal.js +1 -2
  56. package/dist/esm/lib/components/unified-share-form-modal/unified-share-form.js +1 -2
  57. package/dist/esm/lib/constants.js +1 -47
  58. package/dist/esm/lib/contexts/index.js +1 -4
  59. package/dist/esm/lib/contexts/shared-link-settings-context.js +1 -51
  60. package/dist/esm/lib/contexts/unified-share-form-context.js +1 -61
  61. package/dist/esm/lib/contexts/unified-share-modal-context.js +1 -70
  62. package/dist/esm/lib/hooks/index.js +1 -7
  63. package/dist/esm/lib/hooks/use-access-levels.js +1 -70
  64. package/dist/esm/lib/hooks/use-collaboration-form.js +1 -76
  65. package/dist/esm/lib/hooks/use-form-validation.js +1 -33
  66. package/dist/esm/lib/hooks/use-link-settings-form.js +1 -50
  67. package/dist/esm/lib/hooks/use-permission-levels.js +1 -34
  68. package/dist/esm/lib/hooks/use-sharing-action.js +1 -45
  69. package/dist/esm/lib/messages.js +1 -108
  70. package/dist/esm/lib/unified-share-base.js +1 -31
  71. package/dist/esm/lib/unified-share-modal.js +1 -44
  72. package/dist/esm/lib/utils/collaborator.js +1 -12
  73. package/dist/esm/lib/utils/date.js +1 -10
  74. package/dist/esm/lib/utils/email.js +1 -6
  75. package/dist/esm/lib/utils/event.js +1 -7
  76. package/dist/esm/lib/utils/form.js +1 -5
  77. package/dist/esm/lib/utils/index.js +1 -9
  78. package/dist/esm/lib/utils/notification.js +1 -20
  79. package/dist/esm/lib/utils/permission.js +1 -16
  80. package/dist/esm/lib/utils/validation.js +1 -2
  81. package/package.json +10 -10
@@ -1,65 +1 @@
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 };
1
+ import{useUnifiedShareModalContext}from"../esm/lib/contexts/unified-share-modal-context.js";import messages from"../esm/lib/components/unified-share-form-modal/shared-link-section/messages.js";import{useAccessLevels}from"../esm/lib/hooks/use-access-levels.js";import{useSharingAction}from"../esm/lib/hooks/use-sharing-action.js";import{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 '../styles/shared-link-access.css';var shared_link_access_module_default={button:`_button_166my_1`,content:`_content_166my_9`,option:`_option_166my_12`};function SharedLinkAccess(){let{formatMessage}=useIntl(),[isMenuOpen,setIsMenuOpen]=useState(!1),{isSubmitting,item,sharedLink,sharingService,variant}=useUnifiedShareModalContext(),{permissions={}}=item,{access}=sharedLink,{changeSharedLinkAccess}=sharingService,isDesktop=variant===`desktop`,{onAction:onChange}=useSharingAction(changeSharedLinkAccess),{allowedLevels,selectedAccess}=useAccessLevels();if(!allowedLevels.length||!selectedAccess)return null;let{label:selectedLabel}=selectedAccess;return jsxs(DropdownMenu.Root,{isFullScreenEnabled:isDesktop,menuItemsSize:`medium`,onOpenChange:setIsMenuOpen,open:isMenuOpen,children:[jsx(DropdownMenu.Trigger,{children:jsx(TriggerButton,{caretDirection:isMenuOpen?`up`:`down`,className:shared_link_access_module_default.button,"data-target-id":`Button-SharedLinkAccessMenuLabel`,disabled:!permissions.canSetShareAccess||isSubmitting,label:selectedLabel,size:`extraSmall`,variant:`tertiary`})}),jsxs(DropdownMenu.Content,{align:`start`,className:shared_link_access_module_default.content,children:[isDesktop&&jsxs(DropdownMenu.Header,{children:[jsx(DropdownMenu.Header.MenuCloseButton,{"aria-label":formatMessage(messages.closeButton),iconVariant:`back`}),jsx(DropdownMenu.Header.TextContent,{title:formatMessage(messages.shareLinkLabel)})]}),allowedLevels.map(level=>{let{description,disabledReason,id,label}=level,isSelected=access===id;return disabledReason?jsx(Tooltip,{content:formatMessage(messages.disabledAccessLevelTooltip),children:jsx(Focusable,{children:jsx(DropdownMenu.CheckboxItem,{checked:isSelected,disabled:!0,children:jsx(DropdownMenu.Item.MainContent,{caption:description,className:shared_link_access_module_default.option,label})},id)})},id):jsx(DropdownMenu.CheckboxItem,{checked:isSelected,onSelect:()=>{isSelected||onChange(id)},children:jsx(DropdownMenu.Item.MainContent,{caption:description,className:shared_link_access_module_default.option,label})},id)})]})]})}export{SharedLinkAccess as t};
@@ -1,67 +1 @@
1
- import "../esm/lib/constants.js";
2
- import { useUnifiedShareModalContext as e } from "../esm/lib/contexts/unified-share-modal-context.js";
3
- import t from "../esm/lib/components/unified-share-form-modal/shared-link-section/messages.js";
4
- import { useSharingAction as n } from "../esm/lib/hooks/use-sharing-action.js";
5
- import { usePermissionLevels as r } from "../esm/lib/hooks/use-permission-levels.js";
6
- import { useState as i } from "react";
7
- import { useIntl as a } from "react-intl";
8
- import { DropdownMenu as o, Focusable as s, Tooltip as c, TriggerButton as l } from "@box/blueprint-web";
9
- import { jsx as u, jsxs as d } from "react/jsx-runtime";
10
- import '../styles/shared-link-access.css';var f = {
11
- button: "_button_166my_1",
12
- content: "_content_166my_9",
13
- option: "_option_166my_12"
14
- };
15
- function p() {
16
- let { formatMessage: p } = a(), [m, h] = i(!1), { isSubmitting: g, item: _, sharedLink: v, sharingService: y, variant: b } = e(), { permissions: x = {} } = _, { access: S, permission: C } = v, { changeSharedLinkPermission: w } = y, T = b === "desktop", { onAction: E } = n(w), { allowedLevels: D, selectedPermission: O } = r();
17
- if (S === "collaborators" || !D.length || !O) return null;
18
- let { label: k } = O, A = "";
19
- return _.extension === "boxnote" && C === "can_edit" && (A = p(t.canEditBoxNoteDisabledTooltip)), A ? /* @__PURE__ */ u(c, {
20
- align: "start",
21
- content: A,
22
- "data-testid": "usm-SharedLinkPermission-tooltip",
23
- side: "bottom",
24
- children: /* @__PURE__ */ u(s, { children: /* @__PURE__ */ u(l, {
25
- caretDirection: "down",
26
- className: f.button,
27
- disabled: !0,
28
- label: k,
29
- size: "extraSmall",
30
- variant: "tertiary"
31
- }) })
32
- }) : /* @__PURE__ */ d(o.Root, {
33
- isFullScreenEnabled: T,
34
- onOpenChange: h,
35
- open: m,
36
- children: [/* @__PURE__ */ u(o.Trigger, { children: /* @__PURE__ */ u(l, {
37
- caretDirection: m ? "up" : "down",
38
- className: f.button,
39
- "data-target-id": "Button-SharedLinkPermissionsMenuLabel",
40
- disabled: !x.canSetShareAccess || g,
41
- label: k,
42
- size: "extraSmall",
43
- variant: "tertiary"
44
- }) }), /* @__PURE__ */ d(o.Content, {
45
- align: "start",
46
- className: f.content,
47
- children: [T && /* @__PURE__ */ d(o.Header, { children: [/* @__PURE__ */ u(o.Header.MenuCloseButton, {
48
- "aria-label": p(t.closeButton),
49
- iconVariant: "back"
50
- }), /* @__PURE__ */ u(o.Header.TextContent, { title: p(t.shareLinkLabel) })] }), D.map((e) => {
51
- let { description: t, id: n, label: r } = e, i = C === n;
52
- return /* @__PURE__ */ u(o.CheckboxItem, {
53
- checked: i,
54
- onSelect: () => {
55
- i || E(n);
56
- },
57
- children: /* @__PURE__ */ u(o.Item.MainContent, {
58
- caption: t,
59
- className: f.option,
60
- label: r
61
- })
62
- }, n);
63
- })]
64
- })]
65
- });
66
- }
67
- export { p as t };
1
+ import"../esm/lib/constants.js";import{useUnifiedShareModalContext}from"../esm/lib/contexts/unified-share-modal-context.js";import messages from"../esm/lib/components/unified-share-form-modal/shared-link-section/messages.js";import{useSharingAction}from"../esm/lib/hooks/use-sharing-action.js";import{usePermissionLevels}from"../esm/lib/hooks/use-permission-levels.js";import{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 '../styles/shared-link-access.css';var shared_link_permission_module_default={button:`_button_166my_1`,content:`_content_166my_9`,option:`_option_166my_12`};function SharedLinkPermission(){let{formatMessage}=useIntl(),[isMenuOpen,setIsMenuOpen]=useState(!1),{isSubmitting,item,sharedLink,sharingService,variant}=useUnifiedShareModalContext(),{permissions={}}=item,{access,permission}=sharedLink,{changeSharedLinkPermission}=sharingService,isDesktop=variant===`desktop`,{onAction:onChange}=useSharingAction(changeSharedLinkPermission),{allowedLevels,selectedPermission}=usePermissionLevels();if(access===`collaborators`||!allowedLevels.length||!selectedPermission)return null;let{label:selectedLabel}=selectedPermission,disabledTooltipMessage=``;return item.extension===`boxnote`&&permission===`can_edit`&&(disabledTooltipMessage=formatMessage(messages.canEditBoxNoteDisabledTooltip)),disabledTooltipMessage?jsx(Tooltip,{align:`start`,content:disabledTooltipMessage,"data-testid":`usm-SharedLinkPermission-tooltip`,side:`bottom`,children:jsx(Focusable,{children:jsx(TriggerButton,{caretDirection:`down`,className:shared_link_permission_module_default.button,disabled:!0,label:selectedLabel,size:`extraSmall`,variant:`tertiary`})})}):jsxs(DropdownMenu.Root,{isFullScreenEnabled:isDesktop,onOpenChange:setIsMenuOpen,open:isMenuOpen,children:[jsx(DropdownMenu.Trigger,{children:jsx(TriggerButton,{caretDirection:isMenuOpen?`up`:`down`,className:shared_link_permission_module_default.button,"data-target-id":`Button-SharedLinkPermissionsMenuLabel`,disabled:!permissions.canSetShareAccess||isSubmitting,label:selectedLabel,size:`extraSmall`,variant:`tertiary`})}),jsxs(DropdownMenu.Content,{align:`start`,className:shared_link_permission_module_default.content,children:[isDesktop&&jsxs(DropdownMenu.Header,{children:[jsx(DropdownMenu.Header.MenuCloseButton,{"aria-label":formatMessage(messages.closeButton),iconVariant:`back`}),jsx(DropdownMenu.Header.TextContent,{title:formatMessage(messages.shareLinkLabel)})]}),allowedLevels.map(level=>{let{description,id,label}=level,isSelected=permission===id;return jsx(DropdownMenu.CheckboxItem,{checked:isSelected,onSelect:()=>{isSelected||onChange(id)},children:jsx(DropdownMenu.Item.MainContent,{caption:description,className:shared_link_permission_module_default.option,label})},id)})]})]})}export{SharedLinkPermission as t};
@@ -1,184 +1 @@
1
- import { useUnifiedShareModalContext as e } from "../esm/lib/contexts/unified-share-modal-context.js";
2
- import { formatDateFromTimestampToDateString as t } from "../esm/lib/utils/date.js";
3
- import { callOnKeyboardEvent as n } from "../esm/lib/utils/event.js";
4
- import { getNotificationArgs as r } from "../esm/lib/utils/notification.js";
5
- import i from "../esm/lib/components/unified-share-form-modal/shared-link-section/messages.js";
6
- import { useUnifiedShareFormContext as a } from "../esm/lib/contexts/unified-share-form-context.js";
7
- import { useSharingAction as o } from "../esm/lib/hooks/use-sharing-action.js";
8
- import { t as s } from "./shared-link-access.js";
9
- import { t as ee } from "./shared-link-permission.js";
10
- import { useCallback as c, useEffect as l, useRef as u } from "react";
11
- import { useIntl as d } from "react-intl";
12
- import { Button as te, Focusable as ne, Link as f, Status as re, Switch as ie, Text as p, Tooltip as m, useNotification as h } from "@box/blueprint-web";
13
- import { jsx as g, jsxs as _ } from "react/jsx-runtime";
14
- import { ClockBadge as v } from "@box/blueprint-web-assets/icons/Line";
15
- import { CopyInput as y } from "@box/copy-input";
16
- import { Globe as b, Mail as x } from "@box/blueprint-web-assets/icons/Medium";
17
- import { SurfaceStatusSurfaceRed as S, bpSize040 as C } from "@box/blueprint-web-assets/tokens/tokens";
18
- import '../styles/shared-link-section.css';var w = {
19
- container: "_container_so6jb_1",
20
- toggle: "_toggle_so6jb_7",
21
- settings: "_settings_so6jb_13",
22
- copy: "_copy_so6jb_22",
23
- access: "_access_so6jb_30",
24
- disclosures: "_disclosures_so6jb_36",
25
- icon: "_icon_so6jb_42"
26
- };
27
- function T() {
28
- let { formatMessage: T } = d(), { addNotification: E } = h(), D = u(null), { isInteracted: O, isSharedLinkAutoCopied: k, isSharedLinkAutoCreated: A, setForm: ae } = a(), { config: j, eventService: M, isFetching: N, isSubmitting: P, item: F, setView: I, sharedLink: L, sharedLinkNotices: R, sharingService: z } = e(), { permissions: B = {} } = F, { onSharedLinkCopy: V, onSharedLinkSettingsClick: H } = M, { createSharedLink: U } = z, { notifications: W, sharedLinkAutoCopy: G, sharedLinkAutoCreate: K } = j, q = !!L.url, J = G && !k.current && !O, Y = K && !A.current && !O, { onAction: X } = o(c(async () => {
29
- let e = await U();
30
- return J ? { messages: [] } : e;
31
- }, [J, U]), "create-shared-link");
32
- l(() => {
33
- (async () => {
34
- N || P || ((J || Y) && !q && !A.current && (A.current = !0, await X()), J && q && D.current && D.current.click());
35
- })();
36
- }, [
37
- q,
38
- J,
39
- Y,
40
- N,
41
- k,
42
- A,
43
- P,
44
- X
45
- ]);
46
- let oe = c((e) => {
47
- if (V && V(e), !J) return;
48
- k.current = !0;
49
- let t;
50
- t = typeof e == "string" ? A.current ? T(i.autoCreateCopySuccessNoticeText) : T(i.autoCopySuccessNoticeText) : A.current ? T(i.autoCreateCopyErrorNoticeText) : null, t && W.includes("auto-copy-shared-link") && E({
51
- ...r(T, "success"),
52
- styledText: t
53
- });
54
- }, [
55
- E,
56
- T,
57
- J,
58
- k,
59
- A,
60
- W,
61
- V
62
- ]), se = async (e) => {
63
- if (e) {
64
- await X();
65
- return;
66
- }
67
- I("remove-shared-link");
68
- }, Z = () => {
69
- if (H) {
70
- H();
71
- return;
72
- }
73
- I("shared-link-settings");
74
- }, Q, $ = !1;
75
- return !q && !P && (Q = T(i.sharedLinkToggleTooltip)), !q && !B.canShare && (Q = T(i.createLinkDisabledTooltip), $ = !0), q && !B.canSetShareAccess && (Q = T(i.removeLinkDisabledTooltip), $ = !0), /* @__PURE__ */ _("div", {
76
- className: w.container,
77
- children: [
78
- /* @__PURE__ */ g(p, {
79
- as: "label",
80
- variant: "bodyDefaultBold",
81
- children: T(i.shareLinkLabel)
82
- }),
83
- /* @__PURE__ */ _("div", {
84
- className: w.toggle,
85
- children: [
86
- /* @__PURE__ */ g(m, {
87
- align: "start",
88
- content: Q,
89
- "data-testid": "usm-SharedLinkToggle-tooltip",
90
- open: Q ? void 0 : !1,
91
- children: /* @__PURE__ */ g(ne, {
92
- focusable: $,
93
- children: /* @__PURE__ */ g(ie.Item, {
94
- autoFocus: !B.canInviteCollaborator,
95
- checked: q,
96
- "data-target-id": "Toggle-CreateSharedLink",
97
- disabled: $ || P,
98
- label: T(i.sharedLinkToggleLabel),
99
- onCheckedChange: se,
100
- value: "shared-link"
101
- })
102
- })
103
- }),
104
- q && !!L.expiresAt && /* @__PURE__ */ g(m, {
105
- content: T(i.expirationIconTooltip, { expirationDate: t(L.expiresAt) }),
106
- "data-testid": "usm-SharedLinkExpiration-tooltip",
107
- children: /* @__PURE__ */ g(re, {
108
- color: S,
109
- hideText: !0,
110
- icon: v,
111
- text: T(i.expirationIconLabel)
112
- })
113
- }),
114
- q && j.sharedLinkSettings && /* @__PURE__ */ g(f, {
115
- "aria-disabled": P,
116
- "aria-haspopup": "dialog",
117
- className: w.settings,
118
- "data-target-id": "PlainButton-SharedLinkSettings",
119
- onClick: Z,
120
- onKeyDown: n(Z, { canPreventDefault: !0 }),
121
- role: "button",
122
- tabIndex: P ? -1 : 0,
123
- variant: "standalone",
124
- children: T(i.sharedLinkSettingsLabel)
125
- })
126
- ]
127
- }),
128
- q && /* @__PURE__ */ _("div", {
129
- className: w.copy,
130
- children: [/* @__PURE__ */ g(y, {
131
- ref: D,
132
- autoFocus: K && A.current && !O,
133
- "data-target-id": "Button-CopySharedLink",
134
- disabled: P,
135
- hideLabel: !0,
136
- label: T(i.sharedLinkUrlLabel),
137
- onCopy: oe,
138
- value: L.url
139
- }), j.sharedLinkEmail && /* @__PURE__ */ g(m, {
140
- align: "end",
141
- content: T(i.sharedLinkEmailLabel),
142
- children: /* @__PURE__ */ g(te, {
143
- "aria-label": T(i.sharedLinkEmailLabel),
144
- "data-target-id": "Button-SendSharedLink",
145
- disabled: P,
146
- endIcon: x,
147
- onClick: () => ae("email"),
148
- size: "large",
149
- variant: "secondary"
150
- })
151
- })]
152
- }),
153
- q && (j.sharedLinkAccess || j.sharedLinkPermission) && /* @__PURE__ */ _("div", {
154
- className: w.access,
155
- children: [j.sharedLinkAccess && /* @__PURE__ */ g(s, {}), j.sharedLinkPermission && /* @__PURE__ */ g(ee, {})]
156
- }),
157
- q && (L.access === "open" || L.access === "company" && L.permission === "can_edit" || R) && /* @__PURE__ */ _("div", {
158
- className: w.disclosures,
159
- children: [
160
- L.access === "open" && /* @__PURE__ */ _("div", { children: [/* @__PURE__ */ g(b, {
161
- className: w.icon,
162
- height: C,
163
- width: C
164
- }), /* @__PURE__ */ g(p, {
165
- as: "span",
166
- color: "textOnLightSecondary",
167
- children: L.permission === "can_edit" ? T(i.sharedLinkEditablePubliclyAvailable) : T(i.sharedLinkPubliclyAvailable)
168
- })] }),
169
- L.access === "company" && L.permission === "can_edit" && /* @__PURE__ */ _("div", { children: [/* @__PURE__ */ g(b, {
170
- className: w.icon,
171
- height: C,
172
- width: C
173
- }), /* @__PURE__ */ g(p, {
174
- as: "span",
175
- color: "textOnLightSecondary",
176
- children: T(i.sharedLinkElevatedEditableCompanyAvailable)
177
- })] }),
178
- R
179
- ]
180
- })
181
- ]
182
- });
183
- }
184
- export { T as t };
1
+ import{useUnifiedShareModalContext}from"../esm/lib/contexts/unified-share-modal-context.js";import{formatDateFromTimestampToDateString}from"../esm/lib/utils/date.js";import{callOnKeyboardEvent}from"../esm/lib/utils/event.js";import{getNotificationArgs}from"../esm/lib/utils/notification.js";import messages from"../esm/lib/components/unified-share-form-modal/shared-link-section/messages.js";import{useUnifiedShareFormContext}from"../esm/lib/contexts/unified-share-form-context.js";import{useSharingAction}from"../esm/lib/hooks/use-sharing-action.js";import{t as SharedLinkAccess}from"./shared-link-access.js";import{t as SharedLinkPermission}from"./shared-link-permission.js";import{useCallback,useEffect,useRef}from"react";import{useIntl}from"react-intl";import{Button,Focusable,Link,Status,Switch,Text,Tooltip,useNotification}from"@box/blueprint-web";import{jsx,jsxs}from"react/jsx-runtime";import{ClockBadge}from"@box/blueprint-web-assets/icons/Line";import{CopyInput}from"@box/copy-input";import{Globe,Mail}from"@box/blueprint-web-assets/icons/Medium";import{SurfaceStatusSurfaceRed,bpSize040}from"@box/blueprint-web-assets/tokens/tokens";import '../styles/shared-link-section.css';var shared_link_section_module_default={container:`_container_so6jb_1`,toggle:`_toggle_so6jb_7`,settings:`_settings_so6jb_13`,copy:`_copy_so6jb_22`,access:`_access_so6jb_30`,disclosures:`_disclosures_so6jb_36`,icon:`_icon_so6jb_42`};function SharedLinkSection(){let{formatMessage}=useIntl(),{addNotification}=useNotification(),copyInputRef=useRef(null),{isInteracted,isSharedLinkAutoCopied,isSharedLinkAutoCreated,setForm}=useUnifiedShareFormContext(),{config,eventService,isFetching,isSubmitting,item,setView,sharedLink,sharedLinkNotices,sharingService}=useUnifiedShareModalContext(),{permissions={}}=item,{onSharedLinkCopy,onSharedLinkSettingsClick}=eventService,{createSharedLink}=sharingService,{notifications,sharedLinkAutoCopy,sharedLinkAutoCreate}=config,hasSharedLink=!!sharedLink.url,isAutoCopyEnabled=sharedLinkAutoCopy&&!isSharedLinkAutoCopied.current&&!isInteracted,isAutoCreateEnabled=sharedLinkAutoCreate&&!isSharedLinkAutoCreated.current&&!isInteracted,{onAction:onCreate}=useSharingAction(useCallback(async()=>{let response=await createSharedLink();return isAutoCopyEnabled?{messages:[]}:response},[isAutoCopyEnabled,createSharedLink]),`create-shared-link`);useEffect(()=>{(async()=>{isFetching||isSubmitting||((isAutoCopyEnabled||isAutoCreateEnabled)&&!hasSharedLink&&!isSharedLinkAutoCreated.current&&(isSharedLinkAutoCreated.current=!0,await onCreate()),isAutoCopyEnabled&&hasSharedLink&&copyInputRef.current&&copyInputRef.current.click())})()},[hasSharedLink,isAutoCopyEnabled,isAutoCreateEnabled,isFetching,isSharedLinkAutoCopied,isSharedLinkAutoCreated,isSubmitting,onCreate]);let handleCopySuccess=useCallback(result=>{if(onSharedLinkCopy&&onSharedLinkCopy(result),!isAutoCopyEnabled)return;isSharedLinkAutoCopied.current=!0;let message;message=typeof result==`string`?isSharedLinkAutoCreated.current?formatMessage(messages.autoCreateCopySuccessNoticeText):formatMessage(messages.autoCopySuccessNoticeText):isSharedLinkAutoCreated.current?formatMessage(messages.autoCreateCopyErrorNoticeText):null,message&&notifications.includes(`auto-copy-shared-link`)&&addNotification({...getNotificationArgs(formatMessage,`success`),styledText:message})},[addNotification,formatMessage,isAutoCopyEnabled,isSharedLinkAutoCopied,isSharedLinkAutoCreated,notifications,onSharedLinkCopy]),handleSharedLinkToggleChange=async checked=>{if(checked){await onCreate();return}setView(`remove-shared-link`)},handleSharedLinkSettingsClick=()=>{if(onSharedLinkSettingsClick){onSharedLinkSettingsClick();return}setView(`shared-link-settings`)},sharedLinkToggleTooltip,isSharedLinkToggleDisabled=!1;return!hasSharedLink&&!isSubmitting&&(sharedLinkToggleTooltip=formatMessage(messages.sharedLinkToggleTooltip)),!hasSharedLink&&!permissions.canShare&&(sharedLinkToggleTooltip=formatMessage(messages.createLinkDisabledTooltip),isSharedLinkToggleDisabled=!0),hasSharedLink&&!permissions.canSetShareAccess&&(sharedLinkToggleTooltip=formatMessage(messages.removeLinkDisabledTooltip),isSharedLinkToggleDisabled=!0),jsxs(`div`,{className:shared_link_section_module_default.container,children:[jsx(Text,{as:`label`,variant:`bodyDefaultBold`,children:formatMessage(messages.shareLinkLabel)}),jsxs(`div`,{className:shared_link_section_module_default.toggle,children:[jsx(Tooltip,{align:`start`,content:sharedLinkToggleTooltip,"data-testid":`usm-SharedLinkToggle-tooltip`,open:sharedLinkToggleTooltip?void 0:!1,children:jsx(Focusable,{focusable:isSharedLinkToggleDisabled,children:jsx(Switch.Item,{autoFocus:!permissions.canInviteCollaborator,checked:hasSharedLink,"data-target-id":`Toggle-CreateSharedLink`,disabled:isSharedLinkToggleDisabled||isSubmitting,label:formatMessage(messages.sharedLinkToggleLabel),onCheckedChange:handleSharedLinkToggleChange,value:`shared-link`})})}),hasSharedLink&&!!sharedLink.expiresAt&&jsx(Tooltip,{content:formatMessage(messages.expirationIconTooltip,{expirationDate:formatDateFromTimestampToDateString(sharedLink.expiresAt)}),"data-testid":`usm-SharedLinkExpiration-tooltip`,children:jsx(Status,{color:SurfaceStatusSurfaceRed,hideText:!0,icon:ClockBadge,text:formatMessage(messages.expirationIconLabel)})}),hasSharedLink&&config.sharedLinkSettings&&jsx(Link,{"aria-disabled":isSubmitting,"aria-haspopup":`dialog`,className:shared_link_section_module_default.settings,"data-target-id":`PlainButton-SharedLinkSettings`,onClick:handleSharedLinkSettingsClick,onKeyDown:callOnKeyboardEvent(handleSharedLinkSettingsClick,{canPreventDefault:!0}),role:`button`,tabIndex:isSubmitting?-1:0,variant:`standalone`,children:formatMessage(messages.sharedLinkSettingsLabel)})]}),hasSharedLink&&jsxs(`div`,{className:shared_link_section_module_default.copy,children:[jsx(CopyInput,{ref:copyInputRef,autoFocus:sharedLinkAutoCreate&&isSharedLinkAutoCreated.current&&!isInteracted,"data-target-id":`Button-CopySharedLink`,disabled:isSubmitting,hideLabel:!0,label:formatMessage(messages.sharedLinkUrlLabel),onCopy:handleCopySuccess,value:sharedLink.url}),config.sharedLinkEmail&&jsx(Tooltip,{align:`end`,content:formatMessage(messages.sharedLinkEmailLabel),children:jsx(Button,{"aria-label":formatMessage(messages.sharedLinkEmailLabel),"data-target-id":`Button-SendSharedLink`,disabled:isSubmitting,endIcon:Mail,onClick:()=>setForm(`email`),size:`large`,variant:`secondary`})})]}),hasSharedLink&&(config.sharedLinkAccess||config.sharedLinkPermission)&&jsxs(`div`,{className:shared_link_section_module_default.access,children:[config.sharedLinkAccess&&jsx(SharedLinkAccess,{}),config.sharedLinkPermission&&jsx(SharedLinkPermission,{})]}),hasSharedLink&&(sharedLink.access===`open`||sharedLink.access===`company`&&sharedLink.permission===`can_edit`||sharedLinkNotices)&&jsxs(`div`,{className:shared_link_section_module_default.disclosures,children:[sharedLink.access===`open`&&jsxs(`div`,{children:[jsx(Globe,{className:shared_link_section_module_default.icon,height:bpSize040,width:bpSize040}),jsx(Text,{as:`span`,color:`textOnLightSecondary`,children:sharedLink.permission===`can_edit`?formatMessage(messages.sharedLinkEditablePubliclyAvailable):formatMessage(messages.sharedLinkPubliclyAvailable)})]}),sharedLink.access===`company`&&sharedLink.permission===`can_edit`&&jsxs(`div`,{children:[jsx(Globe,{className:shared_link_section_module_default.icon,height:bpSize040,width:bpSize040}),jsx(Text,{as:`span`,color:`textOnLightSecondary`,children:formatMessage(messages.sharedLinkElevatedEditableCompanyAvailable)})]}),sharedLinkNotices]})]})}export{SharedLinkSection as t};
@@ -1,86 +1 @@
1
- import { useUnifiedShareModalContext as e } from "../esm/lib/contexts/unified-share-modal-context.js";
2
- import { useSharedLinkSettingsContext as t } from "../esm/lib/contexts/shared-link-settings-context.js";
3
- import { t as n } from "./classification-status.js";
4
- import r from "../esm/lib/components/shared-link-settings-modal/messages.js";
5
- import { SharedLinkSettings as i } from "../esm/lib/components/shared-link-settings-modal/shared-link-settings.js";
6
- import { useEffect as a, useState as o } from "react";
7
- import s from "clsx";
8
- import { useIntl as c } from "react-intl";
9
- import { Divider as l, LoadingIndicator as u, Modal as d } from "@box/blueprint-web";
10
- import { jsx as f, jsxs as p } from "react/jsx-runtime";
11
- import '../styles/shared-link-settings-modal.css';var m = {
12
- content: "_content_v2gl6_1",
13
- isFullscreen: "_isFullscreen_v2gl6_4",
14
- body: "_body_v2gl6_13",
15
- title: "_title_v2gl6_23",
16
- form: "_form_v2gl6_43",
17
- isLoading: "_isLoading_v2gl6_50",
18
- loading: "_loading_v2gl6_54",
19
- divider: "_divider_v2gl6_62"
20
- };
21
- function h({ isOpen: h, onOpenChange: g }) {
22
- let { formatMessage: _ } = c(), { eventService: v, isSubmitting: y, variant: b } = e(), { onSharedLinkSettingsClose: x, onSharedLinkSettingsLoad: S } = v, C = b === "desktop", { resetForm: w, setContainerRef: T, submitForm: E } = t(), [D, O] = o(!!S);
23
- a(() => {
24
- (async () => {
25
- S && (h && await S(), O(!h));
26
- })();
27
- }, [h, S]);
28
- let k = () => {
29
- y || (w(), x && x(), g(!1));
30
- };
31
- return /* @__PURE__ */ f(d, {
32
- onOpenChange: k,
33
- open: h,
34
- children: /* @__PURE__ */ p(d.Content, {
35
- ref: T,
36
- className: s(m.content, C && m.isFullscreen),
37
- onPointerDownOutside: (e) => {
38
- e.preventDefault();
39
- },
40
- size: "medium",
41
- children: [
42
- /* @__PURE__ */ p(d.Header, { children: [/* @__PURE__ */ f("div", {
43
- className: m.title,
44
- children: _(r.title)
45
- }), /* @__PURE__ */ f(n, {})] }),
46
- /* @__PURE__ */ p("div", {
47
- className: s(m.form),
48
- children: [
49
- D && /* @__PURE__ */ f("div", {
50
- className: m.loading,
51
- children: /* @__PURE__ */ f(u, {
52
- "aria-label": _(r.loadingLabel),
53
- size: "large"
54
- })
55
- }),
56
- /* @__PURE__ */ p(d.Body, {
57
- className: s(m.body, D && m.isLoading),
58
- children: [C && /* @__PURE__ */ f(l, { className: m.divider }), /* @__PURE__ */ f(i, {})]
59
- }),
60
- /* @__PURE__ */ p(d.Footer, {
61
- className: s(D && m.isLoading),
62
- children: [/* @__PURE__ */ f(d.Footer.SecondaryButton, {
63
- disabled: y,
64
- onClick: k,
65
- children: _(r.cancelButton)
66
- }), /* @__PURE__ */ f(d.Footer.PrimaryButton, {
67
- id: "usm-SharedLinkSettingsModal-primaryButton",
68
- loading: y,
69
- loadingAriaLabel: _(r.loadingLabel),
70
- onClick: async () => {
71
- await E() || (w(), g(!1));
72
- },
73
- children: _(r.saveButton)
74
- })]
75
- })
76
- ]
77
- }),
78
- !C && /* @__PURE__ */ f(d.Close, {
79
- "aria-label": _(r.closeButton),
80
- disabled: y
81
- })
82
- ]
83
- })
84
- });
85
- }
86
- export { h as t };
1
+ import{useUnifiedShareModalContext}from"../esm/lib/contexts/unified-share-modal-context.js";import{useSharedLinkSettingsContext}from"../esm/lib/contexts/shared-link-settings-context.js";import{t as ClassificationStatus}from"./classification-status.js";import messages from"../esm/lib/components/shared-link-settings-modal/messages.js";import{SharedLinkSettings}from"../esm/lib/components/shared-link-settings-modal/shared-link-settings.js";import{useEffect,useState}from"react";import clsx from"clsx";import{useIntl}from"react-intl";import{Divider,LoadingIndicator,Modal}from"@box/blueprint-web";import{jsx,jsxs}from"react/jsx-runtime";import '../styles/shared-link-settings-modal.css';var shared_link_settings_modal_module_default={content:`_content_v2gl6_1`,isFullscreen:`_isFullscreen_v2gl6_4`,body:`_body_v2gl6_13`,title:`_title_v2gl6_23`,form:`_form_v2gl6_43`,isLoading:`_isLoading_v2gl6_50`,loading:`_loading_v2gl6_54`,divider:`_divider_v2gl6_62`};function SharedLinkSettingsModal({isOpen,onOpenChange}){let{formatMessage}=useIntl(),{eventService,isSubmitting,variant}=useUnifiedShareModalContext(),{onSharedLinkSettingsClose,onSharedLinkSettingsLoad}=eventService,isDesktop=variant===`desktop`,{resetForm,setContainerRef,submitForm}=useSharedLinkSettingsContext(),[isLoading,setIsLoading]=useState(!!onSharedLinkSettingsLoad);useEffect(()=>{(async()=>{onSharedLinkSettingsLoad&&(isOpen&&await onSharedLinkSettingsLoad(),setIsLoading(!isOpen))})()},[isOpen,onSharedLinkSettingsLoad]);let handleCancel=()=>{isSubmitting||(resetForm(),onSharedLinkSettingsClose&&onSharedLinkSettingsClose(),onOpenChange(!1))};return jsx(Modal,{onOpenChange:handleCancel,open:isOpen,children:jsxs(Modal.Content,{ref:setContainerRef,className:clsx(shared_link_settings_modal_module_default.content,isDesktop&&shared_link_settings_modal_module_default.isFullscreen),onPointerDownOutside:event=>{event.preventDefault()},size:`medium`,children:[jsxs(Modal.Header,{children:[jsx(`div`,{className:shared_link_settings_modal_module_default.title,children:formatMessage(messages.title)}),jsx(ClassificationStatus,{})]}),jsxs(`div`,{className:clsx(shared_link_settings_modal_module_default.form),children:[isLoading&&jsx(`div`,{className:shared_link_settings_modal_module_default.loading,children:jsx(LoadingIndicator,{"aria-label":formatMessage(messages.loadingLabel),size:`large`})}),jsxs(Modal.Body,{className:clsx(shared_link_settings_modal_module_default.body,isLoading&&shared_link_settings_modal_module_default.isLoading),children:[isDesktop&&jsx(Divider,{className:shared_link_settings_modal_module_default.divider}),jsx(SharedLinkSettings,{})]}),jsxs(Modal.Footer,{className:clsx(isLoading&&shared_link_settings_modal_module_default.isLoading),children:[jsx(Modal.Footer.SecondaryButton,{disabled:isSubmitting,onClick:handleCancel,children:formatMessage(messages.cancelButton)}),jsx(Modal.Footer.PrimaryButton,{id:`usm-SharedLinkSettingsModal-primaryButton`,loading:isSubmitting,loadingAriaLabel:formatMessage(messages.loadingLabel),onClick:async()=>{await submitForm()||(resetForm(),onOpenChange(!1))},children:formatMessage(messages.saveButton)})]})]}),!isDesktop&&jsx(Modal.Close,{"aria-label":formatMessage(messages.closeButton),disabled:isSubmitting})]})})}export{SharedLinkSettingsModal as t};
@@ -1,48 +1 @@
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 { 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/collaboration-section/messages.js";
6
- import { useIntl as a } from "react-intl";
7
- import { Avatar as o, Text as s } from "@box/blueprint-web";
8
- import { jsx as c, jsxs as l } from "react/jsx-runtime";
9
- import { Gray10 as u } from "@box/blueprint-web-assets/tokens/tokens";
10
- import '../styles/shared-with-avatars.css';var d = {
11
- container: "_container_13wac_27",
12
- avatars: "_avatars_13wac_44"
13
- }, f = 3;
14
- function p() {
15
- let { formatMessage: p } = a(), { collaborators: m, currentUser: h, eventService: g, isSubmitting: _ } = e(), { setIsCollaboratorsOpen: v } = n(), { onCollaboratorsClick: y } = g, { id: b } = h, x = m.filter(({ isCurrentUser: e, userId: t }) => !(e || b && b === t));
16
- if (!x.length) return null;
17
- let S = x.slice(0, f), C = x.length - f, w = () => {
18
- if (y) {
19
- y();
20
- return;
21
- }
22
- v(!0);
23
- };
24
- return /* @__PURE__ */ l("div", {
25
- "aria-disabled": _,
26
- className: d.container,
27
- onClick: w,
28
- onKeyDown: t(w),
29
- role: "button",
30
- tabIndex: _ ? -1 : 0,
31
- children: [/* @__PURE__ */ c(s, {
32
- as: "span",
33
- color: "textOnLightSecondary",
34
- children: p(i.sharedWithLabel)
35
- }), /* @__PURE__ */ l("div", {
36
- className: d.avatars,
37
- children: [S.map((e) => /* @__PURE__ */ c(r, {
38
- collaborator: e,
39
- size: "medium"
40
- }, e.id)), C > 0 && /* @__PURE__ */ c(o, {
41
- color: u,
42
- size: "medium",
43
- text: `+${C}`
44
- })]
45
- })]
46
- });
47
- }
48
- export { p 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{CollaboratorAvatar}from"../esm/lib/components/unified-share-form-modal/collaborator-list/collaborator-avatar.js";import messages from"../esm/lib/components/unified-share-form-modal/collaboration-section/messages.js";import{useIntl}from"react-intl";import{Avatar,Text}from"@box/blueprint-web";import{jsx,jsxs}from"react/jsx-runtime";import{Gray10}from"@box/blueprint-web-assets/tokens/tokens";import '../styles/shared-with-avatars.css';var shared_with_avatars_module_default={container:`_container_13wac_27`,avatars:`_avatars_13wac_44`},AVATAR_LIMIT=3;function SharedWithAvatars(){let{formatMessage}=useIntl(),{collaborators,currentUser,eventService,isSubmitting}=useUnifiedShareModalContext(),{setIsCollaboratorsOpen}=useUnifiedShareFormContext(),{onCollaboratorsClick}=eventService,{id:currentUserId}=currentUser,sharedWithCollabs=collaborators.filter(({isCurrentUser,userId})=>!(isCurrentUser||currentUserId&&currentUserId===userId));if(!sharedWithCollabs.length)return null;let sharedWithAvatars=sharedWithCollabs.slice(0,AVATAR_LIMIT),sharedWithOverflow=sharedWithCollabs.length-AVATAR_LIMIT,handleClick=()=>{if(onCollaboratorsClick){onCollaboratorsClick();return}setIsCollaboratorsOpen(!0)};return jsxs(`div`,{"aria-disabled":isSubmitting,className:shared_with_avatars_module_default.container,onClick:handleClick,onKeyDown:callOnKeyboardEvent(handleClick),role:`button`,tabIndex:isSubmitting?-1:0,children:[jsx(Text,{as:`span`,color:`textOnLightSecondary`,children:formatMessage(messages.sharedWithLabel)}),jsxs(`div`,{className:shared_with_avatars_module_default.avatars,children:[sharedWithAvatars.map(collaborator=>jsx(CollaboratorAvatar,{collaborator,size:`medium`},collaborator.id)),sharedWithOverflow>0&&jsx(Avatar,{color:Gray10,size:`medium`,text:`+${sharedWithOverflow}`})]})]})}export{SharedWithAvatars as t};
@@ -1,97 +1 @@
1
- import { useUnifiedShareModalContext as e } from "../esm/lib/contexts/unified-share-modal-context.js";
2
- import { isCollaboratorRestricted as t } from "../esm/lib/utils/collaborator.js";
3
- import { callOnKeyboardEvent as n } from "../esm/lib/utils/event.js";
4
- import { useUnifiedShareFormContext as r } from "../esm/lib/contexts/unified-share-form-context.js";
5
- import i from "../esm/lib/components/unified-share-form-modal/collaboration-section/messages.js";
6
- import { useEffect as a, useState as o } from "react";
7
- import { FormattedMessage as s, useIntl as c } from "react-intl";
8
- import { InlineNotice as l, Link as u, LoadingIndicator as d, Select as f } from "@box/blueprint-web";
9
- import { jsx as p } from "react/jsx-runtime";
10
- import m from "lodash/partition";
11
- import '../styles/shield-restriction-notice.css';var h = {
12
- select: "_select_1e0dl_1",
13
- link: "_link_1e0dl_5",
14
- loading: "_loading_1e0dl_9",
15
- notice: "_notice_1e0dl_15"
16
- };
17
- function g({ error: g, isLoading: _, onSelectedUsersChange: v }) {
18
- let { formatMessage: y } = c(), [b, x] = o(!1), [S, C] = o([]), { setShieldRestriction: w, setUserContacts: T, shieldRestriction: E, userContacts: D } = r(), { eventService: O, item: k, contactService: A } = e(), { getJustificationReasons: j } = A, { onRestrictedUsersRemoveClick: M } = O, { isJustificationAllowed: N, restrictionType: P, restrictedEmails: F = [], restrictedGroups: I = [] } = g, L = [...F, ...I];
19
- a(() => (N && w({ isJustificationAllowed: !0 }), () => {
20
- w({ isJustificationAllowed: !1 });
21
- }), [N, w]), a(() => {
22
- (async () => {
23
- if (!(!j || S.length)) try {
24
- x(!0);
25
- let { classificationId: e, options: t } = await j(k);
26
- w({ classificationId: e }), C(t);
27
- } finally {
28
- x(!1);
29
- }
30
- })();
31
- }, [
32
- k,
33
- j,
34
- N,
35
- S,
36
- w
37
- ]);
38
- let R = N ? i.justifiableContactRestrictionRemoveButtonLabel : i.contactRestrictionRemoveButtonLabel, z = () => {
39
- let [e, n] = m(D, (e) => t(e, F, I));
40
- v(n), T(n), M && M(e);
41
- }, B = /* @__PURE__ */ p(f, {
42
- className: h.select,
43
- hideLabel: !0,
44
- label: y(i.businessJustification),
45
- onValueChange: (e) => {
46
- w({ justificationReason: S.find((t) => t.id === e) });
47
- },
48
- placeholder: y(i.justificationSelectPlaceholder),
49
- value: E.justificationReason?.id,
50
- children: /* @__PURE__ */ p(f.Content, {
51
- align: "start",
52
- children: S.map((e) => /* @__PURE__ */ p(f.Option, {
53
- text: e.title,
54
- value: e.id
55
- }, e.id))
56
- })
57
- }), V = /* @__PURE__ */ p(u, {
58
- "aria-disabled": _,
59
- className: h.link,
60
- onClick: z,
61
- onKeyDown: n(z, { canPreventDefault: !0 }),
62
- role: "button",
63
- tabIndex: _ ? -1 : 0,
64
- children: y(R)
65
- }), { message: H, ...U } = P === "information_barrier" ? {
66
- message: i.contactRestrictionInformationBarrierNotice,
67
- count: L.length,
68
- removeLink: V
69
- } : !b && N && S?.length > 0 ? {
70
- message: i.justifiableContactRestrictionNotice,
71
- count: L.length,
72
- justificationSelect: B,
73
- removeLink: V
74
- } : {
75
- message: i.contactRestrictionNotice,
76
- count: L.length,
77
- removeLink: V
78
- };
79
- return /* @__PURE__ */ p(l, {
80
- className: h.notice,
81
- icon: () => null,
82
- role: "alert",
83
- variant: "error",
84
- variantIconAriaLabel: y(i.errorNoticeIconAriaLabel),
85
- children: b ? /* @__PURE__ */ p("div", {
86
- className: h.loading,
87
- children: /* @__PURE__ */ p(d, {
88
- "aria-label": y(i.loadingJustificationReasonsLabel),
89
- size: "small"
90
- })
91
- }) : /* @__PURE__ */ p(s, {
92
- ...H,
93
- values: U
94
- })
95
- });
96
- }
97
- export { g as t };
1
+ import{useUnifiedShareModalContext}from"../esm/lib/contexts/unified-share-modal-context.js";import{isCollaboratorRestricted}from"../esm/lib/utils/collaborator.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/collaboration-section/messages.js";import{useEffect,useState}from"react";import{FormattedMessage,useIntl}from"react-intl";import{InlineNotice,Link,LoadingIndicator,Select}from"@box/blueprint-web";import{jsx}from"react/jsx-runtime";import partition from"lodash/partition";import '../styles/shield-restriction-notice.css';var shield_restriction_notice_module_default={select:`_select_1e0dl_1`,link:`_link_1e0dl_5`,loading:`_loading_1e0dl_9`,notice:`_notice_1e0dl_15`};function ShieldRestrictionNotice({error,isLoading,onSelectedUsersChange}){let{formatMessage}=useIntl(),[isFetching,setIsFetching]=useState(!1),[justificationReasons,setJustificationReasons]=useState([]),{setShieldRestriction,setUserContacts,shieldRestriction,userContacts}=useUnifiedShareFormContext(),{eventService,item,contactService}=useUnifiedShareModalContext(),{getJustificationReasons}=contactService,{onRestrictedUsersRemoveClick}=eventService,{isJustificationAllowed,restrictionType,restrictedEmails=[],restrictedGroups=[]}=error,restrictedContacts=[...restrictedEmails,...restrictedGroups];useEffect(()=>(isJustificationAllowed&&setShieldRestriction({isJustificationAllowed:!0}),()=>{setShieldRestriction({isJustificationAllowed:!1})}),[isJustificationAllowed,setShieldRestriction]),useEffect(()=>{(async()=>{if(!(!getJustificationReasons||justificationReasons.length))try{setIsFetching(!0);let{classificationId,options}=await getJustificationReasons(item);setShieldRestriction({classificationId}),setJustificationReasons(options)}finally{setIsFetching(!1)}})()},[item,getJustificationReasons,isJustificationAllowed,justificationReasons,setShieldRestriction]);let removeButtonLabelMessage=isJustificationAllowed?messages.justifiableContactRestrictionRemoveButtonLabel:messages.contactRestrictionRemoveButtonLabel,handleRemove=()=>{let[removedContacts,allowedContacts]=partition(userContacts,contact=>isCollaboratorRestricted(contact,restrictedEmails,restrictedGroups));onSelectedUsersChange(allowedContacts),setUserContacts(allowedContacts),onRestrictedUsersRemoveClick&&onRestrictedUsersRemoveClick(removedContacts)},justificationSelectSection=jsx(Select,{className:shield_restriction_notice_module_default.select,hideLabel:!0,label:formatMessage(messages.businessJustification),onValueChange:value=>{setShieldRestriction({justificationReason:justificationReasons.find(reason=>reason.id===value)})},placeholder:formatMessage(messages.justificationSelectPlaceholder),value:shieldRestriction.justificationReason?.id,children:jsx(Select.Content,{align:`start`,children:justificationReasons.map(option=>jsx(Select.Option,{text:option.title,value:option.id},option.id))})}),link=jsx(Link,{"aria-disabled":isLoading,className:shield_restriction_notice_module_default.link,onClick:handleRemove,onKeyDown:callOnKeyboardEvent(handleRemove,{canPreventDefault:!0}),role:`button`,tabIndex:isLoading?-1:0,children:formatMessage(removeButtonLabelMessage)}),{message,...values}=restrictionType===`information_barrier`?{message:messages.contactRestrictionInformationBarrierNotice,count:restrictedContacts.length,removeLink:link}:!isFetching&&isJustificationAllowed&&justificationReasons?.length>0?{message:messages.justifiableContactRestrictionNotice,count:restrictedContacts.length,justificationSelect:justificationSelectSection,removeLink:link}:{message:messages.contactRestrictionNotice,count:restrictedContacts.length,removeLink:link};return jsx(InlineNotice,{className:shield_restriction_notice_module_default.notice,icon:()=>null,role:`alert`,variant:`error`,variantIconAriaLabel:formatMessage(messages.errorNoticeIconAriaLabel),children:isFetching?jsx(`div`,{className:shield_restriction_notice_module_default.loading,children:jsx(LoadingIndicator,{"aria-label":formatMessage(messages.loadingJustificationReasonsLabel),size:`small`})}):jsx(FormattedMessage,{...message,values})})}export{ShieldRestrictionNotice as t};
@@ -1,36 +1 @@
1
- import { useUnifiedShareModalContext as e } from "../esm/lib/contexts/unified-share-modal-context.js";
2
- import { useUnifiedShareFormContext as t } from "../esm/lib/contexts/unified-share-form-context.js";
3
- import n from "../esm/lib/components/unified-share-form-modal/collaboration-section/messages.js";
4
- import { useState as r } from "react";
5
- import { useIntl as i } from "react-intl";
6
- import { Text as a, TextArea as o, useUniqueId as s } from "@box/blueprint-web";
7
- import { jsx as c, jsxs as l } from "react/jsx-runtime";
8
- import '../styles/text-area-container.css';var u = {
9
- textArea: "_textArea_v76md_1",
10
- textCount: "_textCount_v76md_5"
11
- };
12
- function d(d) {
13
- let { formatMessage: f } = i(), { isSubmitting: p } = e(), { messageValue: m, setMessageValue: h } = t(), { maxCount: g } = d, [_, v] = r(g), y = s("text-count-");
14
- return /* @__PURE__ */ l("div", { children: [/* @__PURE__ */ c(o, {
15
- className: u.textArea,
16
- disabled: p,
17
- label: f(n.shareMessageLabel),
18
- maxLength: g,
19
- minRows: 3,
20
- onChange: (e) => {
21
- let t = e.target.value;
22
- typeof g == "number" && v(g - t.length), h(t);
23
- },
24
- placeholder: f(n.shareMessagePlaceholder),
25
- value: m,
26
- ...g && { "aria-describedby": y }
27
- }), !!g && /* @__PURE__ */ c(a, {
28
- "aria-label": f(n.shareMessageCharacterCountAriaLabel, { count: _ }),
29
- as: "span",
30
- className: u.textCount,
31
- color: "textOnLightSecondary",
32
- id: y,
33
- children: _
34
- })] });
35
- }
36
- export { d as t };
1
+ import{useUnifiedShareModalContext}from"../esm/lib/contexts/unified-share-modal-context.js";import{useUnifiedShareFormContext}from"../esm/lib/contexts/unified-share-form-context.js";import messages from"../esm/lib/components/unified-share-form-modal/collaboration-section/messages.js";import{useState}from"react";import{useIntl}from"react-intl";import{Text,TextArea,useUniqueId}from"@box/blueprint-web";import{jsx,jsxs}from"react/jsx-runtime";import '../styles/text-area-container.css';var text_area_container_module_default={textArea:`_textArea_v76md_1`,textCount:`_textCount_v76md_5`};function TextAreaContainer(props){let{formatMessage}=useIntl(),{isSubmitting}=useUnifiedShareModalContext(),{messageValue,setMessageValue}=useUnifiedShareFormContext(),{maxCount}=props,[count,setCount]=useState(maxCount),countId=useUniqueId(`text-count-`);return jsxs(`div`,{children:[jsx(TextArea,{className:text_area_container_module_default.textArea,disabled:isSubmitting,label:formatMessage(messages.shareMessageLabel),maxLength:maxCount,minRows:3,onChange:event=>{let nextValue=event.target.value;typeof maxCount==`number`&&setCount(maxCount-nextValue.length),setMessageValue(nextValue)},placeholder:formatMessage(messages.shareMessagePlaceholder),value:messageValue,...maxCount&&{"aria-describedby":countId}}),!!maxCount&&jsx(Text,{"aria-label":formatMessage(messages.shareMessageCharacterCountAriaLabel,{count}),as:`span`,className:text_area_container_module_default.textCount,color:`textOnLightSecondary`,id:countId,children:count})]})}export{TextAreaContainer as t};