@box/unified-share-modal 2.4.2 → 2.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/lib/components/unified-share-form-modal/collaboration-section/collaboration-role.js +40 -39
- package/dist/esm/lib/components/unified-share-form-modal/collaboration-section/collaboration-section.js +43 -42
- package/dist/esm/lib/components/unified-share-form-modal/shared-link-section/shared-link-access.js +32 -31
- package/dist/esm/lib/components/unified-share-form-modal/shared-link-section/shared-link-permission.js +27 -26
- package/dist/esm/lib/components/unified-share-form-modal/shared-link-section/shared-link-section.js +51 -47
- package/dist/i18n/ja-JP.js +1 -1
- package/dist/i18n/ja-JP.properties +1 -1
- package/package.json +1 -1
package/dist/esm/lib/components/unified-share-form-modal/collaboration-section/collaboration-role.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import w from "lodash/camelCase";
|
|
2
|
-
import { useState as
|
|
2
|
+
import { useState as B, useMemo as F, useEffect as z } from "react";
|
|
3
3
|
import { useIntl as H } from "react-intl";
|
|
4
|
-
import { Tooltip as O, Focusable as
|
|
5
|
-
import
|
|
4
|
+
import { Tooltip as O, Focusable as P, TriggerButton as D, DropdownMenu as o } from "@box/blueprint-web";
|
|
5
|
+
import $ from "../messages.js";
|
|
6
6
|
import n from "./messages.js";
|
|
7
7
|
import { jsx as t, jsxs as f } from "react/jsx-runtime";
|
|
8
|
-
import { isInvitationRoleSupported as
|
|
9
|
-
import { useUnifiedShareFormContext as
|
|
8
|
+
import { isInvitationRoleSupported as A, getDefaultCollaborationRole as E } from "../../../utils/collaborator.js";
|
|
9
|
+
import { useUnifiedShareFormContext as U } from "../../../contexts/unified-share-form-context.js";
|
|
10
10
|
import { useUnifiedShareModalContext as W } from "../../../contexts/unified-share-modal-context.js";
|
|
11
11
|
import '../../../../../styles/collaboration-role.css';const q = "_button_jl1fl_1", G = "_focusable_jl1fl_10", J = "_content_jl1fl_14", K = "_option_jl1fl_17", a = {
|
|
12
12
|
button: q,
|
|
@@ -14,13 +14,13 @@ import '../../../../../styles/collaboration-role.css';const q = "_button_jl1fl_1
|
|
|
14
14
|
content: J,
|
|
15
15
|
option: K
|
|
16
16
|
};
|
|
17
|
-
function
|
|
17
|
+
function le() {
|
|
18
18
|
const {
|
|
19
19
|
formatMessage: e
|
|
20
|
-
} = H(), [g, x] =
|
|
20
|
+
} = H(), [g, x] = B(!1), {
|
|
21
21
|
collaborationRole: h,
|
|
22
22
|
setCollaborationRole: m
|
|
23
|
-
} =
|
|
23
|
+
} = U(), {
|
|
24
24
|
collaborationRoles: C,
|
|
25
25
|
eventService: T,
|
|
26
26
|
isSubmitting: j,
|
|
@@ -30,29 +30,29 @@ function ie() {
|
|
|
30
30
|
permissions: y = {},
|
|
31
31
|
type: p
|
|
32
32
|
} = k, {
|
|
33
|
-
onCollaborationRoleChange:
|
|
34
|
-
} = T,
|
|
33
|
+
onCollaborationRoleChange: v
|
|
34
|
+
} = T, S = L === "desktop", r = F(() => C.map((l) => {
|
|
35
35
|
const {
|
|
36
|
-
description:
|
|
37
|
-
id:
|
|
36
|
+
description: u,
|
|
37
|
+
id: i,
|
|
38
38
|
label: s
|
|
39
|
-
} =
|
|
39
|
+
} = l, b = A(i), d = w(i);
|
|
40
40
|
let R = d;
|
|
41
|
-
|
|
42
|
-
let
|
|
43
|
-
return
|
|
44
|
-
...
|
|
45
|
-
description:
|
|
46
|
-
label: s ??
|
|
41
|
+
i === "editor" && p === "folder" && (R += "Folder");
|
|
42
|
+
let I = i, M = "";
|
|
43
|
+
return b && (I = e($[`${d}Role`]), M = e(n[`${R}Description`])), {
|
|
44
|
+
...l,
|
|
45
|
+
description: u ?? M,
|
|
46
|
+
label: s ?? I
|
|
47
47
|
};
|
|
48
48
|
}), [C, e, p]);
|
|
49
|
-
if (
|
|
50
|
-
m(
|
|
49
|
+
if (z(() => {
|
|
50
|
+
m(E(r));
|
|
51
51
|
}, [r, m]), !r.length || !h)
|
|
52
52
|
return null;
|
|
53
53
|
const {
|
|
54
54
|
id: N,
|
|
55
|
-
label:
|
|
55
|
+
label: _
|
|
56
56
|
} = h;
|
|
57
57
|
let c;
|
|
58
58
|
return y.canInviteCollaborator || (c = e(n.inviteDisabledTooltip)), p === "web_link" && (c = e(n.inviteWebLinkDisabledTooltip)), c ? /* @__PURE__ */ t(O, {
|
|
@@ -60,31 +60,32 @@ function ie() {
|
|
|
60
60
|
content: c,
|
|
61
61
|
"data-testid": "collaboration-role-tooltip",
|
|
62
62
|
side: "bottom",
|
|
63
|
-
children: /* @__PURE__ */ t(
|
|
63
|
+
children: /* @__PURE__ */ t(P, {
|
|
64
64
|
className: a.focusable,
|
|
65
|
-
children: /* @__PURE__ */ t(
|
|
65
|
+
children: /* @__PURE__ */ t(D, {
|
|
66
66
|
caretDirection: "down",
|
|
67
67
|
className: a.button,
|
|
68
68
|
disabled: !0,
|
|
69
69
|
label: e(n.inviteAsRoleLabel, {
|
|
70
|
-
role:
|
|
70
|
+
role: _
|
|
71
71
|
}),
|
|
72
72
|
size: "extraSmall",
|
|
73
73
|
variant: "tertiary"
|
|
74
74
|
})
|
|
75
75
|
})
|
|
76
76
|
}) : /* @__PURE__ */ f(o.Root, {
|
|
77
|
-
isFullScreenEnabled:
|
|
77
|
+
isFullScreenEnabled: S,
|
|
78
78
|
menuItemsSize: "medium",
|
|
79
79
|
onOpenChange: x,
|
|
80
80
|
open: g,
|
|
81
81
|
children: [/* @__PURE__ */ t(o.Trigger, {
|
|
82
|
-
children: /* @__PURE__ */ t(
|
|
82
|
+
children: /* @__PURE__ */ t(D, {
|
|
83
83
|
caretDirection: g ? "up" : "down",
|
|
84
84
|
className: a.button,
|
|
85
|
+
"data-target-id": "PlainButton-InviteePermissionsMenuToggle",
|
|
85
86
|
disabled: j,
|
|
86
87
|
label: e(n.inviteAsRoleLabel, {
|
|
87
|
-
role:
|
|
88
|
+
role: _
|
|
88
89
|
}),
|
|
89
90
|
size: "extraSmall",
|
|
90
91
|
variant: "tertiary"
|
|
@@ -92,29 +93,29 @@ function ie() {
|
|
|
92
93
|
}), /* @__PURE__ */ f(o.Content, {
|
|
93
94
|
align: "start",
|
|
94
95
|
className: a.content,
|
|
95
|
-
children: [
|
|
96
|
+
children: [S && /* @__PURE__ */ f(o.Header, {
|
|
96
97
|
children: [/* @__PURE__ */ t(o.Header.TextContent, {
|
|
97
98
|
title: e(n.invitePeopleLabel)
|
|
98
99
|
}), /* @__PURE__ */ t(o.Header.MenuCloseButton, {
|
|
99
100
|
"aria-label": e(n.closeButton)
|
|
100
101
|
})]
|
|
101
|
-
}), r.map((
|
|
102
|
+
}), r.map((l) => {
|
|
102
103
|
const {
|
|
103
|
-
description:
|
|
104
|
-
isDisabled:
|
|
104
|
+
description: u,
|
|
105
|
+
isDisabled: i,
|
|
105
106
|
id: s,
|
|
106
|
-
label:
|
|
107
|
-
} =
|
|
108
|
-
m(
|
|
107
|
+
label: b
|
|
108
|
+
} = l, d = () => {
|
|
109
|
+
m(l), v && v(s);
|
|
109
110
|
};
|
|
110
111
|
return /* @__PURE__ */ t(o.CheckboxItem, {
|
|
111
112
|
checked: N === s,
|
|
112
|
-
disabled:
|
|
113
|
+
disabled: i,
|
|
113
114
|
onSelect: d,
|
|
114
115
|
children: /* @__PURE__ */ t(o.Item.MainContent, {
|
|
115
|
-
caption:
|
|
116
|
+
caption: u,
|
|
116
117
|
className: a.option,
|
|
117
|
-
label:
|
|
118
|
+
label: b
|
|
118
119
|
})
|
|
119
120
|
}, s);
|
|
120
121
|
})]
|
|
@@ -122,5 +123,5 @@ function ie() {
|
|
|
122
123
|
});
|
|
123
124
|
}
|
|
124
125
|
export {
|
|
125
|
-
|
|
126
|
+
le as CollaborationRole
|
|
126
127
|
};
|
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { useState as
|
|
1
|
+
import pe from "clsx";
|
|
2
|
+
import { useState as he, useRef as fe, useEffect as P, useCallback as C } from "react";
|
|
3
3
|
import { createPortal as be } from "react-dom";
|
|
4
4
|
import { useIntl as ge } from "react-intl";
|
|
5
5
|
import { useBlueprintModernization as Ce, useNotification as ve, useUniqueId as Se, useLabelable as Ue, Tooltip as _e, Focusable as Fe, Text as Le, Modal as v } from "@box/blueprint-web";
|
|
6
6
|
import { Globe as xe } from "@box/blueprint-web-assets/icons/Medium";
|
|
7
|
-
import { bpSize040 as
|
|
7
|
+
import { bpSize040 as R } from "@box/blueprint-web-assets/tokens/tokens";
|
|
8
8
|
import { UserSelectorContainer as ye } from "@box/user-selector";
|
|
9
9
|
import { CollaborationRole as Ee } from "./collaboration-role.js";
|
|
10
|
-
import { SharedWithAvatars as
|
|
11
|
-
import { ShieldRestrictionNotice as
|
|
10
|
+
import { SharedWithAvatars as Ae } from "./shared-with-avatars.js";
|
|
11
|
+
import { ShieldRestrictionNotice as Be } from "./shield-restriction-notice.js";
|
|
12
12
|
import { TextAreaContainer as Ne } from "./text-area-container.js";
|
|
13
13
|
import o from "./messages.js";
|
|
14
|
-
import { jsxs as l, jsx as r, Fragment as
|
|
15
|
-
import { useFormValidation as
|
|
14
|
+
import { jsxs as l, jsx as r, Fragment as Pe } from "react/jsx-runtime";
|
|
15
|
+
import { useFormValidation as Re } from "../../../hooks/use-form-validation.js";
|
|
16
16
|
import { useCollaborationForm as ke } from "../../../hooks/use-collaboration-form.js";
|
|
17
17
|
import { useUnifiedShareFormContext as Ve } from "../../../contexts/unified-share-form-context.js";
|
|
18
|
-
import { useUnifiedShareModalContext as
|
|
19
|
-
import { parseEmails as
|
|
20
|
-
import '../../../../../styles/collaboration-section.css';const
|
|
21
|
-
container:
|
|
18
|
+
import { useUnifiedShareModalContext as De } from "../../../contexts/unified-share-modal-context.js";
|
|
19
|
+
import { parseEmails as Ie } from "../../../utils/email.js";
|
|
20
|
+
import '../../../../../styles/collaboration-section.css';const Te = "_container_1e2gg_2", Me = "_label_1e2gg_8", ze = "_modernized_1e2gg_15", Oe = "_security_1e2gg_33", we = "_icon_1e2gg_37", We = "_access_1e2gg_43", c = {
|
|
21
|
+
container: Te,
|
|
22
22
|
label: Me,
|
|
23
23
|
modernized: ze,
|
|
24
24
|
security: Oe,
|
|
@@ -28,24 +28,24 @@ import '../../../../../styles/collaboration-section.css';const De = "_container_
|
|
|
28
28
|
function lt() {
|
|
29
29
|
const {
|
|
30
30
|
formatMessage: t
|
|
31
|
-
} = ge(), [S, y] =
|
|
31
|
+
} = ge(), [S, y] = he(), {
|
|
32
32
|
enableModernizedComponents: k
|
|
33
33
|
} = Ce(), {
|
|
34
34
|
addNotification: V
|
|
35
35
|
} = ve(), {
|
|
36
|
-
validateShieldRestriction:
|
|
37
|
-
} =
|
|
38
|
-
contactValue:
|
|
36
|
+
validateShieldRestriction: D
|
|
37
|
+
} = Re(), {
|
|
38
|
+
contactValue: I,
|
|
39
39
|
containerRef: U,
|
|
40
40
|
form: n,
|
|
41
41
|
setForm: d,
|
|
42
|
-
setUserContacts:
|
|
42
|
+
setUserContacts: T,
|
|
43
43
|
shieldRestriction: M,
|
|
44
44
|
userContacts: i
|
|
45
45
|
} = Ve(), {
|
|
46
46
|
collaborationAccess: z,
|
|
47
47
|
collaborationNotices: O,
|
|
48
|
-
config:
|
|
48
|
+
config: p,
|
|
49
49
|
contactService: w,
|
|
50
50
|
isFetching: W,
|
|
51
51
|
isSubmitting: m,
|
|
@@ -53,7 +53,7 @@ function lt() {
|
|
|
53
53
|
onOpenChange: G,
|
|
54
54
|
sharingService: q,
|
|
55
55
|
variant: K
|
|
56
|
-
} =
|
|
56
|
+
} = De(), {
|
|
57
57
|
permissions: $ = {},
|
|
58
58
|
type: H
|
|
59
59
|
} = j, {
|
|
@@ -69,28 +69,28 @@ function lt() {
|
|
|
69
69
|
errors: X,
|
|
70
70
|
handleFormReset: E,
|
|
71
71
|
handleFormSubmit: Y,
|
|
72
|
-
handleSelectedUsersChange:
|
|
72
|
+
handleSelectedUsersChange: h,
|
|
73
73
|
handleUserSelectorBlur: Z,
|
|
74
74
|
updateContactValue: ee
|
|
75
|
-
} = ke(L, x), te = K === "desktop", u = n === "default" || n === "invite", a = n === "invite" || n === "email", oe = i.some((e) => e.isExternalUser),
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
}, [n]),
|
|
75
|
+
} = ke(L, x), te = K === "desktop", u = n === "default" || n === "invite", a = n === "invite" || n === "email", oe = i.some((e) => e.isExternalUser), A = fe(n === "email" ? "email" : "invite");
|
|
76
|
+
P(() => {
|
|
77
|
+
A.current = n === "email" ? "email" : "invite";
|
|
78
|
+
}, [n]), P(() => {
|
|
79
79
|
(!i.length || !i.some((e) => e.chipVariant === "error")) && y(null);
|
|
80
80
|
}, [i]);
|
|
81
|
-
const re = C((e) => (e.stopPropagation(), !0), []), ie = C((e) => _ ? _(e,
|
|
81
|
+
const re = C((e) => (e.stopPropagation(), !0), []), ie = C((e) => _ ? _(e, A.current) : Promise.resolve([]), [_]), ne = C((e) => F ? F(e) : Promise.resolve({}), [F]), ae = (e) => {
|
|
82
82
|
a || d("invite"), ee(e);
|
|
83
83
|
}, se = C((e) => {
|
|
84
84
|
const s = e.clipboardData.getData("text");
|
|
85
|
-
|
|
85
|
+
Ie(s).length !== 0 && (e.preventDefault(), a || d("invite"), h([...i, {
|
|
86
86
|
value: s
|
|
87
87
|
}]));
|
|
88
|
-
}, [
|
|
88
|
+
}, [h, a, d, i]), le = () => {
|
|
89
89
|
E(), d("default");
|
|
90
90
|
}, ce = async () => {
|
|
91
91
|
try {
|
|
92
92
|
if (S) {
|
|
93
|
-
const e =
|
|
93
|
+
const e = D(i, M);
|
|
94
94
|
if (e) {
|
|
95
95
|
V({
|
|
96
96
|
closeButtonAriaLabel: t(o.closeButton),
|
|
@@ -114,22 +114,22 @@ function lt() {
|
|
|
114
114
|
...g,
|
|
115
115
|
chipVariant: "error"
|
|
116
116
|
} : g);
|
|
117
|
-
y(s),
|
|
117
|
+
y(s), T(ue);
|
|
118
118
|
}
|
|
119
119
|
};
|
|
120
120
|
let f, b = !1;
|
|
121
121
|
u && !$.canInviteCollaborator && (f = t(o.inviteDisabledTooltip), b = !0), u && H === "web_link" && (f = t(o.inviteWebLinkDisabledTooltip), b = !0);
|
|
122
|
-
const
|
|
122
|
+
const B = Se("user-contacts-"), de = t(u ? o.invitePeopleLabel : o.emailSharedLinkLabel), me = Ue(de, B);
|
|
123
123
|
return /* @__PURE__ */ l("form", {
|
|
124
124
|
className: c.container,
|
|
125
125
|
onSubmit: (e) => e.preventDefault(),
|
|
126
|
-
children: [S && /* @__PURE__ */ r(
|
|
126
|
+
children: [S && /* @__PURE__ */ r(Be, {
|
|
127
127
|
error: S,
|
|
128
128
|
isLoading: m,
|
|
129
|
-
onSelectedUsersChange:
|
|
129
|
+
onSelectedUsersChange: h
|
|
130
130
|
}), O, /* @__PURE__ */ l("div", {
|
|
131
|
-
children: [u &&
|
|
132
|
-
className:
|
|
131
|
+
children: [u && p.collaborators && /* @__PURE__ */ r(Ae, {}), /* @__PURE__ */ r(me, {
|
|
132
|
+
className: pe(c.label, k && c.modernized)
|
|
133
133
|
}), /* @__PURE__ */ r(_e, {
|
|
134
134
|
content: f,
|
|
135
135
|
"data-testid": "user-contacts-tooltip",
|
|
@@ -141,19 +141,20 @@ function lt() {
|
|
|
141
141
|
className: "collaboration-user-selector",
|
|
142
142
|
clearButtonAriaLabel: t(o.clearButton),
|
|
143
143
|
clearOnBlur: !1,
|
|
144
|
+
"data-target-id": "PillSelectorDropdown-AddNamesOrEmailAddresses",
|
|
144
145
|
disabled: b || m,
|
|
145
146
|
displayChipVariant: (e) => e.chipVariant,
|
|
146
147
|
error: X["user-contact"],
|
|
147
148
|
fetchAvatarUrls: ne,
|
|
148
149
|
fetchUsers: ie,
|
|
149
150
|
hideOnEscape: re,
|
|
150
|
-
idForLabel:
|
|
151
|
-
inputValue:
|
|
151
|
+
idForLabel: B,
|
|
152
|
+
inputValue: I,
|
|
152
153
|
label: null,
|
|
153
154
|
onBlur: Z,
|
|
154
155
|
onInputValueChange: ae,
|
|
155
156
|
onPaste: se,
|
|
156
|
-
onSelectedUsersChange:
|
|
157
|
+
onSelectedUsersChange: h,
|
|
157
158
|
placeholder: i.length ? "" : t(o.invitePeoplePlaceholder),
|
|
158
159
|
portalElement: U,
|
|
159
160
|
selectedUsers: i,
|
|
@@ -163,22 +164,22 @@ function lt() {
|
|
|
163
164
|
})
|
|
164
165
|
}), u && /* @__PURE__ */ l("div", {
|
|
165
166
|
className: c.access,
|
|
166
|
-
children: [
|
|
167
|
+
children: [p.collaborationRole && /* @__PURE__ */ r(Ee, {}), z]
|
|
167
168
|
})]
|
|
168
|
-
}), a &&
|
|
169
|
-
maxCount:
|
|
169
|
+
}), a && p.collaborationMessage && /* @__PURE__ */ r(Ne, {
|
|
170
|
+
maxCount: p.collaborationMessageLimit
|
|
170
171
|
}), a && oe && /* @__PURE__ */ l("div", {
|
|
171
172
|
className: c.security,
|
|
172
173
|
children: [/* @__PURE__ */ r(xe, {
|
|
173
174
|
className: c.icon,
|
|
174
|
-
height:
|
|
175
|
-
width:
|
|
175
|
+
height: R,
|
|
176
|
+
width: R
|
|
176
177
|
}), /* @__PURE__ */ r(Le, {
|
|
177
178
|
as: "span",
|
|
178
179
|
color: "textOnLightSecondary",
|
|
179
180
|
children: t(o.contentSharedWithExternalCollaborators)
|
|
180
181
|
})]
|
|
181
|
-
}), a && U && /* @__PURE__ */ be(/* @__PURE__ */ l(
|
|
182
|
+
}), a && U && /* @__PURE__ */ be(/* @__PURE__ */ l(Pe, {
|
|
182
183
|
children: [!W && /* @__PURE__ */ l(v.Footer, {
|
|
183
184
|
children: [/* @__PURE__ */ r(v.Footer.SecondaryButton, {
|
|
184
185
|
disabled: m,
|
package/dist/esm/lib/components/unified-share-form-modal/shared-link-section/shared-link-access.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { useState as y } from "react";
|
|
2
2
|
import { useIntl as T } from "react-intl";
|
|
3
|
-
import { DropdownMenu as e, TriggerButton as
|
|
3
|
+
import { DropdownMenu as e, TriggerButton as B, Tooltip as N, Focusable as w } from "@box/blueprint-web";
|
|
4
4
|
import i from "./messages.js";
|
|
5
|
-
import { jsxs as
|
|
5
|
+
import { jsxs as a, jsx as t } from "react/jsx-runtime";
|
|
6
6
|
import { useUnifiedShareModalContext as D } from "../../../contexts/unified-share-modal-context.js";
|
|
7
7
|
import { useSharingAction as H } from "../../../hooks/use-sharing-action.js";
|
|
8
8
|
import { useAccessLevels as O } from "../../../hooks/use-access-levels.js";
|
|
@@ -14,71 +14,72 @@ import '../../../../../styles/shared-link-access.css';const j = "_button_166my_1
|
|
|
14
14
|
function Q() {
|
|
15
15
|
const {
|
|
16
16
|
formatMessage: s
|
|
17
|
-
} = T(), [
|
|
17
|
+
} = T(), [r, h] = y(!1), {
|
|
18
18
|
isSubmitting: b,
|
|
19
|
-
item:
|
|
20
|
-
sharedLink:
|
|
19
|
+
item: S,
|
|
20
|
+
sharedLink: f,
|
|
21
21
|
sharingService: g,
|
|
22
22
|
variant: k
|
|
23
23
|
} = D(), {
|
|
24
|
-
permissions:
|
|
25
|
-
} = f, {
|
|
26
|
-
access: L
|
|
24
|
+
permissions: L = {}
|
|
27
25
|
} = S, {
|
|
28
|
-
|
|
26
|
+
access: C
|
|
27
|
+
} = f, {
|
|
28
|
+
changeSharedLinkAccess: A
|
|
29
29
|
} = g, l = k === "desktop", {
|
|
30
|
-
onAction:
|
|
31
|
-
} = H(
|
|
30
|
+
onAction: M
|
|
31
|
+
} = H(A), {
|
|
32
32
|
allowedLevels: d,
|
|
33
33
|
selectedAccess: m
|
|
34
34
|
} = O();
|
|
35
35
|
if (!d.length || !m)
|
|
36
36
|
return null;
|
|
37
37
|
const {
|
|
38
|
-
label:
|
|
38
|
+
label: _
|
|
39
39
|
} = m;
|
|
40
|
-
return /* @__PURE__ */
|
|
40
|
+
return /* @__PURE__ */ a(e.Root, {
|
|
41
41
|
isFullScreenEnabled: l,
|
|
42
42
|
menuItemsSize: "medium",
|
|
43
43
|
onOpenChange: h,
|
|
44
|
-
open:
|
|
44
|
+
open: r,
|
|
45
45
|
children: [/* @__PURE__ */ t(e.Trigger, {
|
|
46
|
-
children: /* @__PURE__ */ t(
|
|
47
|
-
caretDirection:
|
|
46
|
+
children: /* @__PURE__ */ t(B, {
|
|
47
|
+
caretDirection: r ? "up" : "down",
|
|
48
48
|
className: o.button,
|
|
49
|
-
|
|
50
|
-
|
|
49
|
+
"data-target-id": "Button-SharedLinkAccessMenuLabel",
|
|
50
|
+
disabled: !L.canSetShareAccess || b,
|
|
51
|
+
label: _,
|
|
51
52
|
size: "extraSmall",
|
|
52
53
|
variant: "tertiary"
|
|
53
54
|
})
|
|
54
|
-
}), /* @__PURE__ */
|
|
55
|
+
}), /* @__PURE__ */ a(e.Content, {
|
|
55
56
|
align: "start",
|
|
56
57
|
className: o.content,
|
|
57
|
-
children: [l && /* @__PURE__ */
|
|
58
|
+
children: [l && /* @__PURE__ */ a(e.Header, {
|
|
58
59
|
children: [/* @__PURE__ */ t(e.Header.TextContent, {
|
|
59
60
|
title: s(i.shareLinkLabel)
|
|
60
61
|
}), /* @__PURE__ */ t(e.Header.MenuCloseButton, {
|
|
61
62
|
"aria-label": s(i.closeButton)
|
|
62
63
|
})]
|
|
63
|
-
}), d.map((
|
|
64
|
+
}), d.map((x) => {
|
|
64
65
|
const {
|
|
65
|
-
description:
|
|
66
|
+
description: u,
|
|
66
67
|
disabledReason: I,
|
|
67
68
|
id: n,
|
|
68
|
-
label:
|
|
69
|
-
} =
|
|
70
|
-
c ||
|
|
69
|
+
label: p
|
|
70
|
+
} = x, c = C === n, v = () => {
|
|
71
|
+
c || M(n);
|
|
71
72
|
};
|
|
72
|
-
return I ? /* @__PURE__ */ t(
|
|
73
|
+
return I ? /* @__PURE__ */ t(N, {
|
|
73
74
|
content: s(i.disabledAccessLevelTooltip),
|
|
74
|
-
children: /* @__PURE__ */ t(
|
|
75
|
+
children: /* @__PURE__ */ t(w, {
|
|
75
76
|
children: /* @__PURE__ */ t(e.CheckboxItem, {
|
|
76
77
|
checked: c,
|
|
77
78
|
disabled: !0,
|
|
78
79
|
children: /* @__PURE__ */ t(e.Item.MainContent, {
|
|
79
|
-
caption:
|
|
80
|
+
caption: u,
|
|
80
81
|
className: o.option,
|
|
81
|
-
label:
|
|
82
|
+
label: p
|
|
82
83
|
})
|
|
83
84
|
}, n)
|
|
84
85
|
})
|
|
@@ -86,9 +87,9 @@ function Q() {
|
|
|
86
87
|
checked: c,
|
|
87
88
|
onSelect: v,
|
|
88
89
|
children: /* @__PURE__ */ t(e.Item.MainContent, {
|
|
89
|
-
caption:
|
|
90
|
+
caption: u,
|
|
90
91
|
className: o.option,
|
|
91
|
-
label:
|
|
92
|
+
label: p
|
|
92
93
|
})
|
|
93
94
|
}, n);
|
|
94
95
|
})]
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { useState as
|
|
2
|
-
import { useIntl as
|
|
3
|
-
import { Tooltip as
|
|
4
|
-
import { FILE_EXTENSION_BOX_NOTE as
|
|
1
|
+
import { useState as E } from "react";
|
|
2
|
+
import { useIntl as I } from "react-intl";
|
|
3
|
+
import { Tooltip as O, Focusable as D, TriggerButton as f, DropdownMenu as t } from "@box/blueprint-web";
|
|
4
|
+
import { FILE_EXTENSION_BOX_NOTE as P } from "../../../constants.js";
|
|
5
5
|
import r from "./messages.js";
|
|
6
6
|
import { jsx as e, jsxs as a } from "react/jsx-runtime";
|
|
7
|
-
import { usePermissionLevels as
|
|
7
|
+
import { usePermissionLevels as w } from "../../../hooks/use-permission-levels.js";
|
|
8
8
|
import { useUnifiedShareModalContext as A } from "../../../contexts/unified-share-modal-context.js";
|
|
9
9
|
import { useSharingAction as F } from "../../../hooks/use-sharing-action.js";
|
|
10
10
|
import '../../../../../styles/shared-link-access.css';const H = "_button_166my_1", j = "_content_166my_9", z = "_option_166my_12", n = {
|
|
@@ -15,34 +15,34 @@ import '../../../../../styles/shared-link-access.css';const H = "_button_166my_1
|
|
|
15
15
|
function W() {
|
|
16
16
|
const {
|
|
17
17
|
formatMessage: o
|
|
18
|
-
} =
|
|
18
|
+
} = I(), [l, g] = E(!1), {
|
|
19
19
|
isSubmitting: S,
|
|
20
20
|
item: c,
|
|
21
21
|
sharedLink: _,
|
|
22
|
-
sharingService:
|
|
22
|
+
sharingService: L,
|
|
23
23
|
variant: k
|
|
24
24
|
} = A(), {
|
|
25
|
-
permissions:
|
|
25
|
+
permissions: x = {}
|
|
26
26
|
} = c, {
|
|
27
|
-
access:
|
|
28
|
-
permission:
|
|
27
|
+
access: M,
|
|
28
|
+
permission: d
|
|
29
29
|
} = _, {
|
|
30
|
-
changeSharedLinkPermission:
|
|
31
|
-
} =
|
|
30
|
+
changeSharedLinkPermission: C
|
|
31
|
+
} = L, m = k === "desktop", {
|
|
32
32
|
onAction: N
|
|
33
|
-
} = F(
|
|
33
|
+
} = F(C), {
|
|
34
34
|
allowedLevels: p,
|
|
35
35
|
selectedPermission: u
|
|
36
|
-
} =
|
|
37
|
-
if (
|
|
36
|
+
} = w();
|
|
37
|
+
if (M === "collaborators" || !p.length || !u)
|
|
38
38
|
return null;
|
|
39
39
|
const {
|
|
40
40
|
label: h
|
|
41
41
|
} = u;
|
|
42
|
-
let
|
|
43
|
-
return c.extension ===
|
|
42
|
+
let i = "";
|
|
43
|
+
return c.extension === P && d === "can_edit" && (i = o(r.canEditBoxNoteDisabledTooltip)), i ? /* @__PURE__ */ e(O, {
|
|
44
44
|
align: "start",
|
|
45
|
-
content:
|
|
45
|
+
content: i,
|
|
46
46
|
"data-testid": "shared-link-permission-tooltip",
|
|
47
47
|
side: "bottom",
|
|
48
48
|
children: /* @__PURE__ */ e(D, {
|
|
@@ -56,14 +56,15 @@ function W() {
|
|
|
56
56
|
})
|
|
57
57
|
})
|
|
58
58
|
}) : /* @__PURE__ */ a(t.Root, {
|
|
59
|
-
isFullScreenEnabled:
|
|
59
|
+
isFullScreenEnabled: m,
|
|
60
60
|
onOpenChange: g,
|
|
61
61
|
open: l,
|
|
62
62
|
children: [/* @__PURE__ */ e(t.Trigger, {
|
|
63
63
|
children: /* @__PURE__ */ e(f, {
|
|
64
64
|
caretDirection: l ? "up" : "down",
|
|
65
65
|
className: n.button,
|
|
66
|
-
|
|
66
|
+
"data-target-id": "Button-SharedLinkPermissionsMenuLabel",
|
|
67
|
+
disabled: !x.canSetShareAccess || S,
|
|
67
68
|
label: h,
|
|
68
69
|
size: "extraSmall",
|
|
69
70
|
variant: "tertiary"
|
|
@@ -71,7 +72,7 @@ function W() {
|
|
|
71
72
|
}), /* @__PURE__ */ a(t.Content, {
|
|
72
73
|
align: "start",
|
|
73
74
|
className: n.content,
|
|
74
|
-
children: [
|
|
75
|
+
children: [m && /* @__PURE__ */ a(t.Header, {
|
|
75
76
|
children: [/* @__PURE__ */ e(t.Header.TextContent, {
|
|
76
77
|
title: o(r.shareLinkLabel)
|
|
77
78
|
}), /* @__PURE__ */ e(t.Header.MenuCloseButton, {
|
|
@@ -80,20 +81,20 @@ function W() {
|
|
|
80
81
|
}), p.map((T) => {
|
|
81
82
|
const {
|
|
82
83
|
description: v,
|
|
83
|
-
id:
|
|
84
|
+
id: s,
|
|
84
85
|
label: y
|
|
85
|
-
} = T, b =
|
|
86
|
-
b || N(
|
|
86
|
+
} = T, b = d === s, B = () => {
|
|
87
|
+
b || N(s);
|
|
87
88
|
};
|
|
88
89
|
return /* @__PURE__ */ e(t.CheckboxItem, {
|
|
89
90
|
checked: b,
|
|
90
|
-
onSelect:
|
|
91
|
+
onSelect: B,
|
|
91
92
|
children: /* @__PURE__ */ e(t.Item.MainContent, {
|
|
92
93
|
caption: v,
|
|
93
94
|
className: n.option,
|
|
94
95
|
label: y
|
|
95
96
|
})
|
|
96
|
-
},
|
|
97
|
+
}, s);
|
|
97
98
|
})]
|
|
98
99
|
})]
|
|
99
100
|
});
|
package/dist/esm/lib/components/unified-share-form-modal/shared-link-section/shared-link-section.js
CHANGED
|
@@ -3,7 +3,7 @@ import { useIntl as G } from "react-intl";
|
|
|
3
3
|
import { Text as _, Tooltip as A, Focusable as V, Switch as q, Status as H, Link as J, Button as Q } from "@box/blueprint-web";
|
|
4
4
|
import { ClockBadge as W } from "@box/blueprint-web-assets/icons/Line";
|
|
5
5
|
import { Mail as X, Globe as j } from "@box/blueprint-web-assets/icons/Medium";
|
|
6
|
-
import { SurfaceStatusSurfaceRed as Y, bpSize040 as
|
|
6
|
+
import { SurfaceStatusSurfaceRed as Y, bpSize040 as g } from "@box/blueprint-web-assets/tokens/tokens";
|
|
7
7
|
import { CopyInput as Z } from "@box/copy-input";
|
|
8
8
|
import { SharedLinkAccess as $ } from "./shared-link-access.js";
|
|
9
9
|
import { SharedLinkPermission as ee } from "./shared-link-permission.js";
|
|
@@ -12,8 +12,8 @@ import { jsxs as l, jsx as i } from "react/jsx-runtime";
|
|
|
12
12
|
import { useUnifiedShareFormContext as te } from "../../../contexts/unified-share-form-context.js";
|
|
13
13
|
import { useUnifiedShareModalContext as ie } from "../../../contexts/unified-share-modal-context.js";
|
|
14
14
|
import { useSharingAction as w } from "../../../hooks/use-sharing-action.js";
|
|
15
|
-
import { formatDateFromTimestampToDateString as
|
|
16
|
-
import { callOnKeyboardEvent as
|
|
15
|
+
import { formatDateFromTimestampToDateString as ae } from "../../../utils/date.js";
|
|
16
|
+
import { callOnKeyboardEvent as ne } from "../../../utils/event.js";
|
|
17
17
|
import '../../../../../styles/shared-link-section.css';const oe = "_container_j966c_1", se = "_toggle_j966c_7", re = "_settings_j966c_13", ce = "_copy_j966c_22", le = "_access_j966c_30", de = "_icon_j966c_36", r = {
|
|
18
18
|
container: oe,
|
|
19
19
|
toggle: se,
|
|
@@ -25,57 +25,57 @@ import '../../../../../styles/shared-link-section.css';const oe = "_container_j9
|
|
|
25
25
|
function Te() {
|
|
26
26
|
const {
|
|
27
27
|
formatMessage: e
|
|
28
|
-
} = G(),
|
|
28
|
+
} = G(), k = v(!0), L = v(null), m = v(null), {
|
|
29
29
|
setForm: I
|
|
30
30
|
} = te(), {
|
|
31
31
|
config: s,
|
|
32
32
|
isFetching: T,
|
|
33
|
-
isSubmitting:
|
|
33
|
+
isSubmitting: n,
|
|
34
34
|
item: F,
|
|
35
35
|
setView: b,
|
|
36
36
|
sharedLink: o,
|
|
37
|
-
sharingService:
|
|
37
|
+
sharingService: B
|
|
38
38
|
} = ie(), {
|
|
39
|
-
permissions:
|
|
39
|
+
permissions: P = {}
|
|
40
40
|
} = F, {
|
|
41
|
-
createSharedLink:
|
|
42
|
-
} =
|
|
41
|
+
createSharedLink: R
|
|
42
|
+
} = B, {
|
|
43
43
|
sharedLinkAutoCopy: d,
|
|
44
44
|
sharedLinkAutoCreate: y
|
|
45
45
|
} = s;
|
|
46
|
-
let
|
|
47
|
-
d && (
|
|
46
|
+
let E = "create-shared-link";
|
|
47
|
+
d && (E = "auto-copy-shared-link");
|
|
48
48
|
const {
|
|
49
49
|
onAction: S
|
|
50
|
-
} = w(
|
|
51
|
-
|
|
52
|
-
}, [
|
|
53
|
-
|
|
50
|
+
} = w(R, E), a = !!o.url, [C, M] = K(!1), p = x(async () => {
|
|
51
|
+
a || (await S(), M(!0));
|
|
52
|
+
}, [a, S]), O = x(async () => (p(), new Promise((c) => {
|
|
53
|
+
m.current = {
|
|
54
54
|
resolve: c
|
|
55
55
|
};
|
|
56
|
-
})), [
|
|
57
|
-
onAction:
|
|
56
|
+
})), [p]), {
|
|
57
|
+
onAction: N
|
|
58
58
|
} = w(O, "auto-copy-shared-link");
|
|
59
59
|
D(() => {
|
|
60
|
-
!
|
|
61
|
-
}, [T,
|
|
62
|
-
|
|
63
|
-
}, [
|
|
64
|
-
const U = x((
|
|
65
|
-
if (!
|
|
60
|
+
!k.current || T || (d ? N() : y && p(), k.current = !1);
|
|
61
|
+
}, [T, k, d, y, p, N]), D(() => {
|
|
62
|
+
a && d && !n && L.current && L.current.click();
|
|
63
|
+
}, [a, n, d]);
|
|
64
|
+
const U = x((u) => {
|
|
65
|
+
if (!m.current)
|
|
66
66
|
return;
|
|
67
67
|
let c;
|
|
68
|
-
|
|
68
|
+
u instanceof Error ? c = C ? e(t.autoCreateCopyErrorNoticeText) : null : c = e(C ? t.autoCreateCopySuccessNoticeText : t.autoCopySuccessNoticeText), c && m.current.resolve({
|
|
69
69
|
messages: [{
|
|
70
70
|
text: c,
|
|
71
71
|
type: "success"
|
|
72
72
|
}]
|
|
73
|
-
}),
|
|
74
|
-
}, [e, C]), z = async (
|
|
75
|
-
|
|
73
|
+
}), m.current = null;
|
|
74
|
+
}, [e, C]), z = async (u) => {
|
|
75
|
+
u || b("remove-shared-link"), u && await S();
|
|
76
76
|
};
|
|
77
77
|
let h, f = !1;
|
|
78
|
-
return !
|
|
78
|
+
return !a && !n && (h = e(t.sharedLinkToggleTooltip)), !a && !P.canShare && (h = e(t.createLinkDisabledTooltip), f = !0), a && !P.canSetShareAccess && (h = e(t.removeLinkDisabledTooltip), f = !0), /* @__PURE__ */ l("div", {
|
|
79
79
|
className: r.container,
|
|
80
80
|
children: [/* @__PURE__ */ i(_, {
|
|
81
81
|
as: "label",
|
|
@@ -91,16 +91,17 @@ function Te() {
|
|
|
91
91
|
children: /* @__PURE__ */ i(V, {
|
|
92
92
|
focusable: f,
|
|
93
93
|
children: /* @__PURE__ */ i(q.Item, {
|
|
94
|
-
checked:
|
|
95
|
-
|
|
94
|
+
checked: a,
|
|
95
|
+
"data-target-id": "Toggle-CreateSharedLink",
|
|
96
|
+
disabled: f || n,
|
|
96
97
|
label: e(t.sharedLinkToggleLabel),
|
|
97
98
|
onCheckedChange: z,
|
|
98
99
|
value: "shared-link"
|
|
99
100
|
})
|
|
100
101
|
})
|
|
101
|
-
}),
|
|
102
|
+
}), a && !!o.expiresAt && /* @__PURE__ */ i(A, {
|
|
102
103
|
content: e(t.expirationIconTooltip, {
|
|
103
|
-
expirationDate:
|
|
104
|
+
expirationDate: ae(o.expiresAt)
|
|
104
105
|
}),
|
|
105
106
|
"data-testid": "expiration-date-tooltip",
|
|
106
107
|
children: /* @__PURE__ */ i(H, {
|
|
@@ -109,25 +110,27 @@ function Te() {
|
|
|
109
110
|
icon: W,
|
|
110
111
|
text: e(t.expirationIconLabel)
|
|
111
112
|
})
|
|
112
|
-
}),
|
|
113
|
-
"aria-disabled":
|
|
113
|
+
}), a && s.sharedLinkSettings && /* @__PURE__ */ i(J, {
|
|
114
|
+
"aria-disabled": n,
|
|
114
115
|
"aria-haspopup": "dialog",
|
|
115
116
|
className: r.settings,
|
|
117
|
+
"data-target-id": "PlainButton-SharedLinkSettings",
|
|
116
118
|
onClick: () => b("shared-link-settings"),
|
|
117
|
-
onKeyDown:
|
|
119
|
+
onKeyDown: ne(() => b("shared-link-settings"), {
|
|
118
120
|
canPreventDefault: !0
|
|
119
121
|
}),
|
|
120
122
|
role: "button",
|
|
121
|
-
tabIndex:
|
|
123
|
+
tabIndex: n ? -1 : 0,
|
|
122
124
|
variant: "standalone",
|
|
123
125
|
children: e(t.sharedLinkSettingsLabel)
|
|
124
126
|
})]
|
|
125
|
-
}),
|
|
127
|
+
}), a && /* @__PURE__ */ l("div", {
|
|
126
128
|
className: r.copy,
|
|
127
129
|
children: [/* @__PURE__ */ i(Z, {
|
|
128
130
|
ref: L,
|
|
129
|
-
autoFocus: y &&
|
|
130
|
-
|
|
131
|
+
autoFocus: y && a,
|
|
132
|
+
"data-target-id": "Button-CopySharedLink",
|
|
133
|
+
disabled: n,
|
|
131
134
|
hideLabel: !0,
|
|
132
135
|
label: e(t.sharedLinkUrlLabel),
|
|
133
136
|
onCopy: U,
|
|
@@ -137,31 +140,32 @@ function Te() {
|
|
|
137
140
|
content: e(t.sharedLinkEmailLabel),
|
|
138
141
|
children: /* @__PURE__ */ i(Q, {
|
|
139
142
|
"aria-label": e(t.sharedLinkEmailLabel),
|
|
140
|
-
|
|
143
|
+
"data-target-id": "Button-SendSharedLink",
|
|
144
|
+
disabled: n,
|
|
141
145
|
icon: X,
|
|
142
146
|
onClick: () => I("email"),
|
|
143
147
|
size: "large",
|
|
144
148
|
variant: "secondary"
|
|
145
149
|
})
|
|
146
150
|
})]
|
|
147
|
-
}),
|
|
151
|
+
}), a && (s.sharedLinkAccess || s.sharedLinkPermission) && /* @__PURE__ */ l("div", {
|
|
148
152
|
className: r.access,
|
|
149
153
|
children: [s.sharedLinkAccess && /* @__PURE__ */ i($, {}), s.sharedLinkPermission && /* @__PURE__ */ i(ee, {})]
|
|
150
|
-
}),
|
|
154
|
+
}), a && o.access === "open" && /* @__PURE__ */ l("div", {
|
|
151
155
|
children: [/* @__PURE__ */ i(j, {
|
|
152
156
|
className: r.icon,
|
|
153
|
-
height:
|
|
154
|
-
width:
|
|
157
|
+
height: g,
|
|
158
|
+
width: g
|
|
155
159
|
}), /* @__PURE__ */ i(_, {
|
|
156
160
|
as: "span",
|
|
157
161
|
color: "textOnLightSecondary",
|
|
158
162
|
children: o.permission === "can_edit" ? e(t.sharedLinkEditablePubliclyAvailable) : e(t.sharedLinkPubliclyAvailable)
|
|
159
163
|
})]
|
|
160
|
-
}),
|
|
164
|
+
}), a && o.access === "company" && o.permission === "can_edit" && /* @__PURE__ */ l("div", {
|
|
161
165
|
children: [/* @__PURE__ */ i(j, {
|
|
162
166
|
className: r.icon,
|
|
163
|
-
height:
|
|
164
|
-
width:
|
|
167
|
+
height: g,
|
|
168
|
+
width: g
|
|
165
169
|
}), /* @__PURE__ */ i(_, {
|
|
166
170
|
as: "span",
|
|
167
171
|
color: "textOnLightSecondary",
|
package/dist/i18n/ja-JP.js
CHANGED
|
@@ -2,7 +2,7 @@ export default {
|
|
|
2
2
|
"groupSharedFeatures.usm.autoCopySharedLinkErrorNoticeText": "共有リンクを作成できません。後でもう一度やり直してください。",
|
|
3
3
|
"groupSharedFeatures.usm.classificationStatus.definitionLabel": "定義",
|
|
4
4
|
"groupSharedFeatures.usm.classificationStatus.restrictionsLabel": "制約事項",
|
|
5
|
-
"groupSharedFeatures.usm.contactsLimitErrorMessage": "一度に追加できるコラボレータは最大{maxContacts}
|
|
5
|
+
"groupSharedFeatures.usm.contactsLimitErrorMessage": "一度に追加できるコラボレータは最大{maxContacts}人までです。招待を何回かに分けて、もう一度やり直してください。",
|
|
6
6
|
"groupSharedFeatures.usm.createSharedLinkErrorNoticeText": "共有リンクを作成できません。後でもう一度やり直してください。",
|
|
7
7
|
"groupSharedFeatures.usm.createSharedLinkSuccessNoticeText": "共有リンクを作成しました。",
|
|
8
8
|
"groupSharedFeatures.usm.defaultErrorNoticeText": "問題が発生しました。後でもう一度やり直してください。",
|
|
@@ -5,7 +5,7 @@ groupSharedFeatures.usm.classificationStatus.definitionLabel = 定義
|
|
|
5
5
|
# Label for the section to show the restrictions of the classification label
|
|
6
6
|
groupSharedFeatures.usm.classificationStatus.restrictionsLabel = 制約事項
|
|
7
7
|
# Error message when more than the maximum number of contacts is entered
|
|
8
|
-
groupSharedFeatures.usm.contactsLimitErrorMessage = 一度に追加できるコラボレータは最大{maxContacts}
|
|
8
|
+
groupSharedFeatures.usm.contactsLimitErrorMessage = 一度に追加できるコラボレータは最大{maxContacts}人までです。招待を何回かに分けて、もう一度やり直してください。
|
|
9
9
|
# Notification text when the shared link failed to be created
|
|
10
10
|
groupSharedFeatures.usm.createSharedLinkErrorNoticeText = 共有リンクを作成できません。後でもう一度やり直してください。
|
|
11
11
|
# Notification text when the shared link is successfully created
|