@box/unified-share-modal 0.49.0 → 0.50.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/lib/components/shared-link-settings-modal/messages.js +2 -6
- package/dist/esm/lib/components/shared-link-settings-modal/shared-link-settings-modal.js +79 -79
- package/dist/esm/lib/components/unified-share-form-modal/collaboration-section/collaboration-role.js +89 -68
- package/dist/esm/lib/components/unified-share-form-modal/collaboration-section/collaboration-section.js +119 -102
- package/dist/esm/lib/components/unified-share-form-modal/collaboration-section/messages.js +8 -0
- package/dist/esm/lib/components/unified-share-form-modal/shared-link-section/messages.js +12 -0
- package/dist/esm/lib/components/unified-share-form-modal/shared-link-section/shared-link-access.js +42 -39
- package/dist/esm/lib/components/unified-share-form-modal/shared-link-section/shared-link-permission.js +46 -43
- package/dist/esm/lib/components/unified-share-form-modal/shared-link-section/shared-link-section.js +109 -100
- package/dist/esm/lib/components/unified-share-form-modal/unified-share-form-modal.js +56 -47
- package/dist/esm/lib/hooks/use-access-levels.js +18 -17
- package/dist/esm/lib/hooks/use-collaboration-form.js +13 -13
- package/dist/esm/lib/messages.js +11 -7
- package/dist/i18n/bn-IN.js +8 -2
- package/dist/i18n/da-DK.js +8 -2
- package/dist/i18n/de-DE.js +8 -2
- package/dist/i18n/en-AU.js +8 -2
- package/dist/i18n/en-CA.js +8 -2
- package/dist/i18n/en-GB.js +8 -2
- package/dist/i18n/en-US.js +15 -10
- package/dist/i18n/en-US.properties +21 -11
- package/dist/i18n/en-x-pseudo.js +122 -116
- package/dist/i18n/en-x-pseudo.properties +116 -116
- package/dist/i18n/es-419.js +8 -2
- package/dist/i18n/es-ES.js +8 -2
- package/dist/i18n/fi-FI.js +8 -2
- package/dist/i18n/fr-CA.js +8 -2
- package/dist/i18n/fr-FR.js +8 -2
- package/dist/i18n/hi-IN.js +8 -2
- package/dist/i18n/it-IT.js +8 -2
- package/dist/i18n/ja-JP.js +8 -2
- package/dist/i18n/json/src/lib/components/shared-link-settings-modal/messages.json +1 -1
- package/dist/i18n/json/src/lib/components/unified-share-form-modal/collaboration-section/messages.json +1 -1
- package/dist/i18n/json/src/lib/components/unified-share-form-modal/shared-link-section/messages.json +1 -1
- package/dist/i18n/json/src/lib/messages.json +1 -1
- package/dist/i18n/ko-KR.js +8 -2
- package/dist/i18n/nb-NO.js +8 -2
- package/dist/i18n/nl-NL.js +8 -2
- package/dist/i18n/pl-PL.js +8 -2
- package/dist/i18n/pt-BR.js +8 -2
- package/dist/i18n/ru-RU.js +8 -2
- package/dist/i18n/sv-SE.js +8 -2
- package/dist/i18n/tr-TR.js +8 -2
- package/dist/i18n/zh-CN.js +8 -2
- package/dist/i18n/zh-TW.js +8 -2
- package/dist/styles/collaboration-role.css +1 -1
- package/dist/styles/shared-link-section.css +1 -1
- package/dist/styles/unified-share-form-modal.css +1 -1
- package/dist/types/lib/components/shared-link-settings-modal/messages.d.ts +0 -5
- package/dist/types/lib/components/unified-share-form-modal/collaboration-section/messages.d.ts +10 -0
- package/dist/types/lib/components/unified-share-form-modal/shared-link-section/messages.d.ts +15 -0
- package/dist/types/lib/messages.d.ts +5 -0
- package/dist/types/lib/stories/shared.d.ts +10 -0
- package/dist/types/lib/types.d.ts +10 -0
- package/package.json +2 -2
|
@@ -1,111 +1,128 @@
|
|
|
1
|
-
import { useRef as
|
|
2
|
-
import { createPortal as
|
|
3
|
-
import { useIntl as
|
|
4
|
-
import { useUniqueId as
|
|
5
|
-
import { UserSelectorContainer as
|
|
6
|
-
import { CollaborationRole as
|
|
7
|
-
import { SharedWithAvatars as
|
|
8
|
-
import { TextAreaContainer as
|
|
9
|
-
import { COLLABORATION_MESSAGE_CHARACTER_LIMIT as
|
|
10
|
-
import
|
|
11
|
-
import { jsxs as
|
|
12
|
-
import { useCollaborationForm as
|
|
13
|
-
import { useUnifiedShareFormContext as
|
|
14
|
-
import { useUnifiedShareModalContext as
|
|
15
|
-
import '../../../../../styles/collaboration-section.css';const
|
|
16
|
-
container:
|
|
17
|
-
label:
|
|
1
|
+
import { useRef as X, useEffect as Y, useCallback as g } from "react";
|
|
2
|
+
import { createPortal as Z } from "react-dom";
|
|
3
|
+
import { useIntl as $ } from "react-intl";
|
|
4
|
+
import { useUniqueId as ee, useLabelable as te, Tooltip as oe, Focusable as ae, Modal as m } from "@box/blueprint-web";
|
|
5
|
+
import { UserSelectorContainer as ne } from "@box/user-selector";
|
|
6
|
+
import { CollaborationRole as re } from "./collaboration-role.js";
|
|
7
|
+
import { SharedWithAvatars as ie } from "./shared-with-avatars.js";
|
|
8
|
+
import { TextAreaContainer as le } from "./text-area-container.js";
|
|
9
|
+
import { COLLABORATION_MESSAGE_CHARACTER_LIMIT as se } from "../../../constants.js";
|
|
10
|
+
import t from "./messages.js";
|
|
11
|
+
import { jsxs as u, jsx as o, Fragment as ce } from "react/jsx-runtime";
|
|
12
|
+
import { useCollaborationForm as me } from "../../../hooks/use-collaboration-form.js";
|
|
13
|
+
import { useUnifiedShareFormContext as ue } from "../../../contexts/unified-share-form-context.js";
|
|
14
|
+
import { useUnifiedShareModalContext as de } from "../../../contexts/unified-share-modal-context.js";
|
|
15
|
+
import '../../../../../styles/collaboration-section.css';const fe = "_container_19jv3_1", be = "_label_19jv3_7", B = {
|
|
16
|
+
container: fe,
|
|
17
|
+
label: be
|
|
18
18
|
};
|
|
19
|
-
function
|
|
19
|
+
function xe() {
|
|
20
20
|
const {
|
|
21
|
-
formatMessage:
|
|
22
|
-
} =
|
|
23
|
-
contactValue:
|
|
24
|
-
container:
|
|
25
|
-
onModalOpenChange:
|
|
26
|
-
onShareViewChange:
|
|
27
|
-
shareView:
|
|
28
|
-
userContacts:
|
|
29
|
-
} =
|
|
30
|
-
config:
|
|
31
|
-
contactService:
|
|
32
|
-
isFetching:
|
|
33
|
-
isSubmitting:
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
21
|
+
formatMessage: e
|
|
22
|
+
} = $(), {
|
|
23
|
+
contactValue: I,
|
|
24
|
+
container: d,
|
|
25
|
+
onModalOpenChange: S,
|
|
26
|
+
onShareViewChange: f,
|
|
27
|
+
shareView: a,
|
|
28
|
+
userContacts: F
|
|
29
|
+
} = ue(), {
|
|
30
|
+
config: i,
|
|
31
|
+
contactService: T,
|
|
32
|
+
isFetching: _,
|
|
33
|
+
isSubmitting: x,
|
|
34
|
+
item: E,
|
|
35
|
+
sharingService: P
|
|
36
|
+
} = de(), {
|
|
37
|
+
permissions: k = {},
|
|
38
|
+
type: O
|
|
39
|
+
} = E, {
|
|
40
|
+
getContacts: b,
|
|
41
|
+
getContactsAvatarUrls: h
|
|
42
|
+
} = T, {
|
|
43
|
+
sendInvitations: V,
|
|
44
|
+
sendSharedLink: y
|
|
45
|
+
} = P;
|
|
46
|
+
let p, C;
|
|
47
|
+
a === "invite" && (p = V, C = "invite-collaborators"), a === "email" && (p = y, C = "email-shared-link");
|
|
47
48
|
const {
|
|
48
|
-
errors:
|
|
49
|
-
handleFormReset:
|
|
50
|
-
handleFormSubmit:
|
|
51
|
-
handleSelectedUsersChange:
|
|
52
|
-
handleUserSelectorBlur:
|
|
53
|
-
isFormSubmitting:
|
|
54
|
-
updateContactValue:
|
|
55
|
-
} =
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
},
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
49
|
+
errors: M,
|
|
50
|
+
handleFormReset: L,
|
|
51
|
+
handleFormSubmit: R,
|
|
52
|
+
handleSelectedUsersChange: N,
|
|
53
|
+
handleUserSelectorBlur: w,
|
|
54
|
+
isFormSubmitting: j,
|
|
55
|
+
updateContactValue: D
|
|
56
|
+
} = me(p, C), r = a === "default" || a === "invite", l = a === "invite" || a === "email", v = x ?? j, U = X(a === "email" ? "email" : "invite");
|
|
57
|
+
Y(() => {
|
|
58
|
+
U.current = a === "email" ? "email" : "invite";
|
|
59
|
+
}, [a]);
|
|
60
|
+
const W = g((n) => (n.stopPropagation(), !0), []), q = g((n) => b ? b(n, U.current) : Promise.resolve([]), [b]), G = g((n) => h ? h(n) : Promise.resolve({}), [h]), H = (n) => {
|
|
61
|
+
l || f("invite"), D(n);
|
|
62
|
+
}, K = () => {
|
|
63
|
+
L(), f("default");
|
|
64
|
+
}, z = async () => {
|
|
65
|
+
await R() || (L(), S && S(!1), f("default"));
|
|
66
|
+
};
|
|
67
|
+
let s, c = !1;
|
|
68
|
+
r && !k.canInviteCollaborator && (s = e(t.inviteDisabledTooltip), c = !0), r && O === "web_link" && (s = e(t.inviteWebLinkDisabledTooltip), c = !0);
|
|
69
|
+
const A = ee("user-contacts-"), J = e(r ? t.invitePeopleLabel : t.emailSharedLinkLabel), Q = te(J, A);
|
|
70
|
+
return /* @__PURE__ */ u("form", {
|
|
71
|
+
className: B.container,
|
|
72
|
+
onSubmit: (n) => n.preventDefault(),
|
|
73
|
+
children: [i.collaborationNotices, /* @__PURE__ */ u("div", {
|
|
74
|
+
children: [r && i.collaborators && /* @__PURE__ */ o(ie, {}), /* @__PURE__ */ o(Q, {
|
|
75
|
+
className: B.label
|
|
76
|
+
}), /* @__PURE__ */ o(oe, {
|
|
77
|
+
content: s,
|
|
78
|
+
"data-testid": "user-contacts-tooltip",
|
|
79
|
+
open: s ? void 0 : !1,
|
|
80
|
+
side: "bottom",
|
|
81
|
+
children: /* @__PURE__ */ o(ae, {
|
|
82
|
+
focusable: c,
|
|
83
|
+
children: /* @__PURE__ */ o(ne, {
|
|
84
|
+
className: "collaboration-user-selector",
|
|
85
|
+
clearButtonAriaLabel: e(t.clearButton),
|
|
86
|
+
clearOnBlur: !1,
|
|
87
|
+
disabled: c || v,
|
|
88
|
+
error: M["user-contact"],
|
|
89
|
+
fetchAvatarUrls: G,
|
|
90
|
+
fetchUsers: q,
|
|
91
|
+
hideOnEscape: W,
|
|
92
|
+
idForLabel: A,
|
|
93
|
+
inputValue: I,
|
|
94
|
+
label: null,
|
|
95
|
+
onBlur: w,
|
|
96
|
+
onInputValueChange: H,
|
|
97
|
+
onSelectedUsersChange: N,
|
|
98
|
+
placeholder: F.length ? "" : e(t.invitePeoplePlaceholder),
|
|
99
|
+
portalElement: d,
|
|
100
|
+
selectedUsers: F,
|
|
101
|
+
selectOnEnterOrTab: !0,
|
|
102
|
+
variant: l ? "textarea" : "input"
|
|
103
|
+
})
|
|
104
|
+
})
|
|
105
|
+
}), r && i.collaborationRole && /* @__PURE__ */ o(re, {})]
|
|
106
|
+
}), l && i.collaborationMessage && /* @__PURE__ */ o(le, {
|
|
107
|
+
maxCount: se
|
|
108
|
+
}), l && d && /* @__PURE__ */ Z(/* @__PURE__ */ u(ce, {
|
|
109
|
+
children: [!_ && /* @__PURE__ */ u(m.Footer, {
|
|
110
|
+
children: [/* @__PURE__ */ o(m.Footer.SecondaryButton, {
|
|
111
|
+
disabled: v,
|
|
112
|
+
onClick: K,
|
|
113
|
+
children: e(t.cancelButton)
|
|
114
|
+
}), /* @__PURE__ */ o(m.Footer.PrimaryButton, {
|
|
115
|
+
loading: v,
|
|
116
|
+
loadingAriaLabel: e(t.loadingLabel),
|
|
117
|
+
onClick: z,
|
|
118
|
+
children: e(t.sendButton)
|
|
102
119
|
})]
|
|
103
|
-
}), /* @__PURE__ */
|
|
104
|
-
"aria-label":
|
|
120
|
+
}), /* @__PURE__ */ o(m.Close, {
|
|
121
|
+
"aria-label": e(t.closeButton)
|
|
105
122
|
})]
|
|
106
|
-
}),
|
|
123
|
+
}), d)]
|
|
107
124
|
});
|
|
108
125
|
}
|
|
109
126
|
export {
|
|
110
|
-
|
|
127
|
+
xe as CollaborationSection
|
|
111
128
|
};
|
|
@@ -83,6 +83,14 @@ const o = e({
|
|
|
83
83
|
uploaderDescription: {
|
|
84
84
|
id: "groupSharedFeatures.usm.unifiedShareFormModal.collaborationSection.uploaderDescription",
|
|
85
85
|
defaultMessage: "Upload-only"
|
|
86
|
+
},
|
|
87
|
+
inviteDisabledTooltip: {
|
|
88
|
+
id: "groupSharedFeatures.usm.unifiedShareFormModal.collaborationSection.inviteDisabledTooltip",
|
|
89
|
+
defaultMessage: "You do not have permission to invite collaborators"
|
|
90
|
+
},
|
|
91
|
+
inviteWebLinkDisabledTooltip: {
|
|
92
|
+
id: "groupSharedFeatures.usm.unifiedShareFormModal.collaborationSection.inviteWebLinkDisabledTooltip",
|
|
93
|
+
defaultMessage: "Collaborators cannot be added to bookmarks"
|
|
86
94
|
}
|
|
87
95
|
});
|
|
88
96
|
export {
|
|
@@ -12,6 +12,14 @@ const i = e({
|
|
|
12
12
|
id: "groupSharedFeatures.usm.unifiedShareFormModal.sharedLinkSection.sharedLinkToggleTooltip",
|
|
13
13
|
defaultMessage: "Create and copy link"
|
|
14
14
|
},
|
|
15
|
+
createLinkDisabledTooltip: {
|
|
16
|
+
id: "groupSharedFeatures.usm.unifiedShareFormModal.sharedLinkSection.createLinkDisabledTooltip",
|
|
17
|
+
defaultMessage: "You do not have permission to create the link"
|
|
18
|
+
},
|
|
19
|
+
removeLinkDisabledTooltip: {
|
|
20
|
+
id: "groupSharedFeatures.usm.unifiedShareFormModal.sharedLinkSection.removeLinkDisabledTooltip",
|
|
21
|
+
defaultMessage: "You do not have permission to remove the link"
|
|
22
|
+
},
|
|
15
23
|
sharedLinkSettingsLabel: {
|
|
16
24
|
id: "groupSharedFeatures.usm.unifiedShareFormModal.sharedLinkSection.sharedLinkSettingsLabel",
|
|
17
25
|
defaultMessage: "Link Settings"
|
|
@@ -76,6 +84,10 @@ const i = e({
|
|
|
76
84
|
id: "groupSharedFeatures.usm.unifiedShareFormModal.sharedLinkSection.hubsAccessLevelItem",
|
|
77
85
|
defaultMessage: "hub"
|
|
78
86
|
},
|
|
87
|
+
webLinkAccessLevelItem: {
|
|
88
|
+
id: "groupSharedFeatures.usm.unifiedShareFormModal.sharedLinkSection.webLinkAccessLevelItem",
|
|
89
|
+
defaultMessage: "bookmark"
|
|
90
|
+
},
|
|
79
91
|
disabledAccessLevelTooltip: {
|
|
80
92
|
id: "groupSharedFeatures.usm.unifiedShareFormModal.sharedLinkSection.disabledAccessLevelTooltip",
|
|
81
93
|
defaultMessage: "This option is not available due to a security policy"
|
package/dist/esm/lib/components/unified-share-form-modal/shared-link-section/shared-link-access.js
CHANGED
|
@@ -1,67 +1,70 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { useState as
|
|
3
|
-
import { useIntl as
|
|
4
|
-
import { DropdownMenu as n, TriggerButton as
|
|
5
|
-
import
|
|
6
|
-
import { jsxs as
|
|
7
|
-
import { useUnifiedShareModalContext as
|
|
8
|
-
import { useSharingAction as
|
|
9
|
-
import { useAccessLevels as
|
|
10
|
-
import '../../../../../styles/shared-link-access.css';const
|
|
11
|
-
container:
|
|
12
|
-
overrides:
|
|
13
|
-
content:
|
|
1
|
+
import k from "clsx";
|
|
2
|
+
import { useState as M } from "react";
|
|
3
|
+
import { useIntl as I } from "react-intl";
|
|
4
|
+
import { DropdownMenu as n, TriggerButton as z, Tooltip as T, Focusable as q } from "@box/blueprint-web";
|
|
5
|
+
import w from "./messages.js";
|
|
6
|
+
import { jsxs as O, jsx as e } from "react/jsx-runtime";
|
|
7
|
+
import { useUnifiedShareModalContext as j } from "../../../contexts/unified-share-modal-context.js";
|
|
8
|
+
import { useSharingAction as y } from "../../../hooks/use-sharing-action.js";
|
|
9
|
+
import { useAccessLevels as D } from "../../../hooks/use-access-levels.js";
|
|
10
|
+
import '../../../../../styles/shared-link-access.css';const N = "_container_xhq4z_1", R = "_overrides_xhq4z_1", B = "_content_xhq4z_6", s = {
|
|
11
|
+
container: N,
|
|
12
|
+
overrides: R,
|
|
13
|
+
content: B
|
|
14
14
|
};
|
|
15
|
-
function
|
|
15
|
+
function V() {
|
|
16
16
|
const {
|
|
17
17
|
formatMessage: d
|
|
18
|
-
} =
|
|
18
|
+
} = I(), [c, m] = M(!1), {
|
|
19
19
|
isSubmitting: h,
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
20
|
+
item: p,
|
|
21
|
+
sharedLink: u,
|
|
22
|
+
sharingService: f
|
|
23
|
+
} = j(), {
|
|
24
|
+
permissions: g = {}
|
|
24
25
|
} = p, {
|
|
25
|
-
|
|
26
|
+
access: S
|
|
26
27
|
} = u, {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
changeSharedLinkAccess: b
|
|
29
|
+
} = f, {
|
|
30
|
+
isLoading: x,
|
|
31
|
+
onAction: v
|
|
32
|
+
} = y(b), {
|
|
30
33
|
allowedLevels: r,
|
|
31
34
|
selectedAccess: i
|
|
32
|
-
} =
|
|
35
|
+
} = D();
|
|
33
36
|
if (!r.length || !i)
|
|
34
37
|
return null;
|
|
35
38
|
const {
|
|
36
|
-
label:
|
|
39
|
+
label: _
|
|
37
40
|
} = i;
|
|
38
|
-
return /* @__PURE__ */
|
|
41
|
+
return /* @__PURE__ */ O(n.Root, {
|
|
39
42
|
onOpenChange: m,
|
|
40
43
|
open: c,
|
|
41
44
|
children: [/* @__PURE__ */ e(n.Trigger, {
|
|
42
|
-
children: /* @__PURE__ */ e(
|
|
45
|
+
children: /* @__PURE__ */ e(z, {
|
|
43
46
|
caretDirection: c ? "up" : "down",
|
|
44
|
-
className:
|
|
45
|
-
disabled: h ??
|
|
46
|
-
label:
|
|
47
|
+
className: k(s.container, s.overrides),
|
|
48
|
+
disabled: !g.canSetShareAccess || (h ?? x),
|
|
49
|
+
label: _,
|
|
47
50
|
size: "extraSmall",
|
|
48
51
|
variant: "tertiary"
|
|
49
52
|
})
|
|
50
53
|
}), /* @__PURE__ */ e(n.Content, {
|
|
51
54
|
align: "start",
|
|
52
55
|
className: s.content,
|
|
53
|
-
children: r.map((
|
|
56
|
+
children: r.map((A) => {
|
|
54
57
|
const {
|
|
55
58
|
description: a,
|
|
56
|
-
disabledReason:
|
|
59
|
+
disabledReason: C,
|
|
57
60
|
id: t,
|
|
58
61
|
label: l
|
|
59
|
-
} =
|
|
60
|
-
o ||
|
|
62
|
+
} = A, o = S === t, L = () => {
|
|
63
|
+
o || v(t);
|
|
61
64
|
};
|
|
62
|
-
return
|
|
63
|
-
content: d(
|
|
64
|
-
children: /* @__PURE__ */ e(
|
|
65
|
+
return C ? /* @__PURE__ */ e(T, {
|
|
66
|
+
content: d(w.disabledAccessLevelTooltip),
|
|
67
|
+
children: /* @__PURE__ */ e(q, {
|
|
65
68
|
children: /* @__PURE__ */ e(n.CheckboxItem, {
|
|
66
69
|
checked: o,
|
|
67
70
|
disabled: !0,
|
|
@@ -73,7 +76,7 @@ function P() {
|
|
|
73
76
|
})
|
|
74
77
|
}, t) : /* @__PURE__ */ e(n.CheckboxItem, {
|
|
75
78
|
checked: o,
|
|
76
|
-
onSelect:
|
|
79
|
+
onSelect: L,
|
|
77
80
|
children: /* @__PURE__ */ e(n.Item.MainContent, {
|
|
78
81
|
caption: a,
|
|
79
82
|
label: l
|
|
@@ -84,5 +87,5 @@ function P() {
|
|
|
84
87
|
});
|
|
85
88
|
}
|
|
86
89
|
export {
|
|
87
|
-
|
|
90
|
+
V as SharedLinkAccess
|
|
88
91
|
};
|
|
@@ -1,66 +1,69 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { useState as
|
|
3
|
-
import { DropdownMenu as e, TriggerButton as
|
|
4
|
-
import { jsxs as
|
|
5
|
-
import { usePermissionLevels as
|
|
6
|
-
import { useUnifiedShareModalContext as
|
|
7
|
-
import { useSharingAction as
|
|
8
|
-
import '../../../../../styles/shared-link-access.css';const
|
|
9
|
-
container:
|
|
10
|
-
overrides:
|
|
11
|
-
content:
|
|
1
|
+
import k from "clsx";
|
|
2
|
+
import { useState as M } from "react";
|
|
3
|
+
import { DropdownMenu as e, TriggerButton as z } from "@box/blueprint-web";
|
|
4
|
+
import { jsxs as P, jsx as n } from "react/jsx-runtime";
|
|
5
|
+
import { usePermissionLevels as q } from "../../../hooks/use-permission-levels.js";
|
|
6
|
+
import { useUnifiedShareModalContext as w } from "../../../contexts/unified-share-modal-context.js";
|
|
7
|
+
import { useSharingAction as A } from "../../../hooks/use-sharing-action.js";
|
|
8
|
+
import '../../../../../styles/shared-link-access.css';const I = "_container_xhq4z_1", O = "_overrides_xhq4z_1", j = "_content_xhq4z_6", o = {
|
|
9
|
+
container: I,
|
|
10
|
+
overrides: O,
|
|
11
|
+
content: j
|
|
12
12
|
};
|
|
13
|
-
function
|
|
14
|
-
const [
|
|
13
|
+
function E() {
|
|
14
|
+
const [s, a] = M(!1), {
|
|
15
15
|
isSubmitting: l,
|
|
16
|
+
item: m,
|
|
16
17
|
sharedLink: d,
|
|
17
|
-
sharingService:
|
|
18
|
-
} =
|
|
19
|
-
|
|
20
|
-
permission: p
|
|
21
|
-
} = d, {
|
|
22
|
-
changeSharedLinkPermission: u
|
|
18
|
+
sharingService: h
|
|
19
|
+
} = w(), {
|
|
20
|
+
permissions: p = {}
|
|
23
21
|
} = m, {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
} =
|
|
22
|
+
access: u,
|
|
23
|
+
permission: g
|
|
24
|
+
} = d, {
|
|
25
|
+
changeSharedLinkPermission: S
|
|
26
|
+
} = h, {
|
|
27
|
+
isLoading: f,
|
|
28
|
+
onAction: x
|
|
29
|
+
} = A(S), {
|
|
27
30
|
allowedLevels: i,
|
|
28
|
-
selectedPermission:
|
|
29
|
-
} =
|
|
30
|
-
if (
|
|
31
|
+
selectedPermission: r
|
|
32
|
+
} = q();
|
|
33
|
+
if (u === "collaborators" || !i.length || !r)
|
|
31
34
|
return null;
|
|
32
35
|
const {
|
|
33
|
-
label:
|
|
34
|
-
} =
|
|
35
|
-
return /* @__PURE__ */
|
|
36
|
+
label: _
|
|
37
|
+
} = r;
|
|
38
|
+
return /* @__PURE__ */ P(e.Root, {
|
|
36
39
|
onOpenChange: a,
|
|
37
|
-
open:
|
|
40
|
+
open: s,
|
|
38
41
|
children: [/* @__PURE__ */ n(e.Trigger, {
|
|
39
|
-
children: /* @__PURE__ */ n(
|
|
40
|
-
caretDirection:
|
|
41
|
-
className:
|
|
42
|
-
disabled: l ??
|
|
43
|
-
label:
|
|
42
|
+
children: /* @__PURE__ */ n(z, {
|
|
43
|
+
caretDirection: s ? "up" : "down",
|
|
44
|
+
className: k(o.container, o.overrides),
|
|
45
|
+
disabled: !p.canSetShareAccess || (l ?? f),
|
|
46
|
+
label: _,
|
|
44
47
|
size: "extraSmall",
|
|
45
48
|
variant: "tertiary"
|
|
46
49
|
})
|
|
47
50
|
}), /* @__PURE__ */ n(e.Content, {
|
|
48
51
|
align: "start",
|
|
49
52
|
className: o.content,
|
|
50
|
-
children: i.map((
|
|
53
|
+
children: i.map((b) => {
|
|
51
54
|
const {
|
|
52
|
-
description:
|
|
55
|
+
description: v,
|
|
53
56
|
id: t,
|
|
54
|
-
label:
|
|
55
|
-
} =
|
|
56
|
-
c ||
|
|
57
|
+
label: L
|
|
58
|
+
} = b, c = g === t, C = () => {
|
|
59
|
+
c || x(t);
|
|
57
60
|
};
|
|
58
61
|
return /* @__PURE__ */ n(e.CheckboxItem, {
|
|
59
62
|
checked: c,
|
|
60
|
-
onSelect:
|
|
63
|
+
onSelect: C,
|
|
61
64
|
children: /* @__PURE__ */ n(e.Item.MainContent, {
|
|
62
|
-
caption:
|
|
63
|
-
label:
|
|
65
|
+
caption: v,
|
|
66
|
+
label: L
|
|
64
67
|
})
|
|
65
68
|
}, t);
|
|
66
69
|
})
|
|
@@ -68,5 +71,5 @@ function R() {
|
|
|
68
71
|
});
|
|
69
72
|
}
|
|
70
73
|
export {
|
|
71
|
-
|
|
74
|
+
E as SharedLinkPermission
|
|
72
75
|
};
|