@box/unified-share-modal 1.33.0 → 1.35.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/shared-link-settings-modal.js +120 -107
- package/dist/esm/lib/components/unified-share-form-modal/collaboration-section/collaboration-role.js +39 -39
- package/dist/esm/lib/components/unified-share-form-modal/collaboration-section/collaboration-section.js +107 -102
- package/dist/esm/lib/components/unified-share-form-modal/collaboration-section/shared-with-avatars.js +48 -39
- package/dist/esm/lib/components/unified-share-form-modal/shared-link-section/shared-link-section.js +66 -66
- package/dist/esm/lib/unified-share-modal.js +56 -54
- package/dist/styles/collaboration-role.css +1 -1
- package/dist/styles/collaboration-section.css +1 -1
- package/dist/styles/shared-link-section.css +1 -1
- package/dist/styles/shared-link-settings-modal.css +1 -1
- package/dist/types/lib/contexts/unified-share-modal-context.d.ts +1 -0
- package/dist/types/lib/types.d.ts +23 -4
- package/dist/types/lib/unified-share-modal.d.ts +2 -1
- package/package.json +1 -1
|
@@ -1,155 +1,168 @@
|
|
|
1
|
-
import { useMemo as
|
|
2
|
-
import { useIntl as
|
|
3
|
-
import { Modal as
|
|
4
|
-
import { DownloadSection as
|
|
5
|
-
import { ExpirationSection as
|
|
6
|
-
import { PasswordSection as
|
|
7
|
-
import { VanitySection as
|
|
8
|
-
import
|
|
9
|
-
import { jsx as a, jsxs as
|
|
10
|
-
import { useAccessLevels as
|
|
11
|
-
import { formatDateFromTimestampToCalendarDate as
|
|
12
|
-
import { useLinkSettingsForm as
|
|
13
|
-
import { useUnifiedShareModalContext as
|
|
14
|
-
import '../../../../styles/shared-link-settings-modal.css';const
|
|
15
|
-
content:
|
|
16
|
-
body:
|
|
1
|
+
import { useState as q, useMemo as G, useEffect as J } from "react";
|
|
2
|
+
import { useIntl as K } from "react-intl";
|
|
3
|
+
import { Modal as t, LoadingIndicator as Q, Text as W, Link as X } from "@box/blueprint-web";
|
|
4
|
+
import { DownloadSection as Y } from "./download-section.js";
|
|
5
|
+
import { ExpirationSection as Z } from "./expiration-section.js";
|
|
6
|
+
import { PasswordSection as $ } from "./password-section.js";
|
|
7
|
+
import { VanitySection as O } from "./vanity-section.js";
|
|
8
|
+
import s from "./messages.js";
|
|
9
|
+
import { jsx as a, jsxs as w } from "react/jsx-runtime";
|
|
10
|
+
import { useAccessLevels as ee } from "../../hooks/use-access-levels.js";
|
|
11
|
+
import { formatDateFromTimestampToCalendarDate as ae } from "../../utils/date.js";
|
|
12
|
+
import { useLinkSettingsForm as ne } from "../../hooks/use-link-settings-form.js";
|
|
13
|
+
import { useUnifiedShareModalContext as oe } from "../../contexts/unified-share-modal-context.js";
|
|
14
|
+
import '../../../../styles/shared-link-settings-modal.css';const ie = "_content_1r0kk_1", te = "_body_1r0kk_5", se = "_loading_1r0kk_17", f = {
|
|
15
|
+
content: ie,
|
|
16
|
+
body: te,
|
|
17
|
+
loading: se
|
|
17
18
|
};
|
|
18
|
-
function
|
|
19
|
-
isOpen:
|
|
20
|
-
onOpenChange:
|
|
19
|
+
function ye({
|
|
20
|
+
isOpen: c,
|
|
21
|
+
onOpenChange: v
|
|
21
22
|
}) {
|
|
22
23
|
const {
|
|
23
|
-
formatMessage:
|
|
24
|
-
} =
|
|
25
|
-
eventService:
|
|
26
|
-
isSubmitting:
|
|
27
|
-
sharedLink:
|
|
28
|
-
} =
|
|
29
|
-
expiresAt:
|
|
24
|
+
formatMessage: i
|
|
25
|
+
} = K(), [g, C] = q(!1), {
|
|
26
|
+
eventService: k,
|
|
27
|
+
isSubmitting: E,
|
|
28
|
+
sharedLink: x
|
|
29
|
+
} = oe(), {
|
|
30
|
+
expiresAt: m = 0,
|
|
30
31
|
settings: n = {},
|
|
31
|
-
vanityDomain:
|
|
32
|
-
vanityName:
|
|
33
|
-
} =
|
|
34
|
-
onSharedLinkSettingsClose:
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
32
|
+
vanityDomain: L = "",
|
|
33
|
+
vanityName: h = ""
|
|
34
|
+
} = x, {
|
|
35
|
+
onSharedLinkSettingsClose: y,
|
|
36
|
+
onSharedLinkSettingsLoad: p
|
|
37
|
+
} = k, {
|
|
38
|
+
selectedAccess: D
|
|
39
|
+
} = ee(), b = G(() => ({
|
|
40
|
+
expiration: m ? ae(m) : null,
|
|
39
41
|
isDownloadEnabled: !!n.isDownloadEnabled,
|
|
40
|
-
isExpirationEnabled: !!
|
|
42
|
+
isExpirationEnabled: !!m,
|
|
41
43
|
isPasswordEnabled: !!n.isPasswordEnabled,
|
|
42
|
-
isVanityNameEnabled: !!
|
|
44
|
+
isVanityNameEnabled: !!h,
|
|
43
45
|
password: "",
|
|
44
|
-
vanityName:
|
|
45
|
-
}), [
|
|
46
|
-
errors:
|
|
46
|
+
vanityName: h
|
|
47
|
+
}), [m, n, h]), {
|
|
48
|
+
errors: u,
|
|
47
49
|
formData: o,
|
|
48
|
-
handleFormReset:
|
|
49
|
-
handleFormSubmit:
|
|
50
|
-
isUpdating:
|
|
51
|
-
setErrors:
|
|
52
|
-
setFieldError:
|
|
53
|
-
setFieldValue:
|
|
54
|
-
validatePassword:
|
|
55
|
-
} =
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
},
|
|
62
|
-
|
|
63
|
-
},
|
|
64
|
-
|
|
50
|
+
handleFormReset: N,
|
|
51
|
+
handleFormSubmit: F,
|
|
52
|
+
isUpdating: P,
|
|
53
|
+
setErrors: T,
|
|
54
|
+
setFieldError: r,
|
|
55
|
+
setFieldValue: d,
|
|
56
|
+
validatePassword: B
|
|
57
|
+
} = ne(b);
|
|
58
|
+
J(() => {
|
|
59
|
+
(async () => p && (c && await p(), C(!c)))();
|
|
60
|
+
}, [c, p]);
|
|
61
|
+
const S = () => {
|
|
62
|
+
N(), y && y(), v(!1);
|
|
63
|
+
}, A = async () => {
|
|
64
|
+
await F() || (T({}), v(!1));
|
|
65
|
+
}, _ = (e) => {
|
|
66
|
+
r("expiration", void 0), d("isExpirationEnabled", e);
|
|
65
67
|
}, V = (e) => {
|
|
66
|
-
|
|
68
|
+
r("expiration", void 0), d("expiration", e);
|
|
67
69
|
}, M = (e) => {
|
|
68
|
-
|
|
69
|
-
}, _ = (e) => {
|
|
70
|
-
t("password", void 0), r("password", e.target.value);
|
|
70
|
+
r("vanityName", void 0), d("isVanityNameEnabled", e);
|
|
71
71
|
}, I = (e) => {
|
|
72
|
-
r("
|
|
72
|
+
r("vanityName", void 0), d("vanityName", e.target.value);
|
|
73
73
|
}, j = (e) => {
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
74
|
+
r("password", void 0), d("isPasswordEnabled", e);
|
|
75
|
+
}, z = (e) => {
|
|
76
|
+
r("password", void 0), d("password", e.target.value);
|
|
77
|
+
}, U = (e) => {
|
|
78
|
+
d("isDownloadEnabled", e);
|
|
79
|
+
}, H = (e) => {
|
|
80
|
+
const R = document.getElementById("usm-SharedLinkSettingsModal-primaryButton")?.contains(e.relatedTarget);
|
|
81
|
+
b.isPasswordEnabled && !o.password || R || B(o.password);
|
|
82
|
+
}, l = E || P;
|
|
83
|
+
return /* @__PURE__ */ a(t, {
|
|
84
|
+
onOpenChange: S,
|
|
85
|
+
open: c,
|
|
86
|
+
children: /* @__PURE__ */ w(t.Content, {
|
|
87
|
+
className: f.content,
|
|
82
88
|
size: "medium",
|
|
83
|
-
children: [/* @__PURE__ */ a(
|
|
84
|
-
children: s
|
|
85
|
-
}), /* @__PURE__ */
|
|
86
|
-
className:
|
|
87
|
-
|
|
89
|
+
children: [/* @__PURE__ */ a(t.Header, {
|
|
90
|
+
children: i(s.title)
|
|
91
|
+
}), /* @__PURE__ */ w(t.Body, {
|
|
92
|
+
className: f.body,
|
|
93
|
+
inert: g ? "" : null,
|
|
94
|
+
children: [g && /* @__PURE__ */ a("div", {
|
|
95
|
+
className: f.loading,
|
|
96
|
+
children: /* @__PURE__ */ a(Q, {
|
|
97
|
+
"aria-label": i(s.loadingLabel),
|
|
98
|
+
size: "large"
|
|
99
|
+
})
|
|
100
|
+
}), /* @__PURE__ */ a(W, {
|
|
88
101
|
as: "p",
|
|
89
102
|
color: "textOnLightSecondary",
|
|
90
|
-
children: s
|
|
91
|
-
learnSharedLinkSettingsLink: /* @__PURE__ */ a(
|
|
103
|
+
children: i(s.subtitle, {
|
|
104
|
+
learnSharedLinkSettingsLink: /* @__PURE__ */ a(X, {
|
|
92
105
|
href: "https://support.box.com/hc/en-us/articles/360043697554-Configuring-Individual-Shared-Link-Settings",
|
|
93
106
|
rel: "noreferrer",
|
|
94
107
|
target: "_blank",
|
|
95
|
-
children: s
|
|
108
|
+
children: i(s.learnSharedLinkSettingsLink)
|
|
96
109
|
})
|
|
97
110
|
})
|
|
98
|
-
}), /* @__PURE__ */ a(
|
|
111
|
+
}), /* @__PURE__ */ a(Z, {
|
|
99
112
|
canChange: !!n.canChangeExpiration,
|
|
100
|
-
error:
|
|
113
|
+
error: u.expiration,
|
|
101
114
|
expiration: o.expiration,
|
|
102
115
|
isChecked: o.isExpirationEnabled,
|
|
103
116
|
isDisabled: l,
|
|
104
|
-
onChange:
|
|
105
|
-
onToggle:
|
|
106
|
-
}), /* @__PURE__ */ a(
|
|
117
|
+
onChange: V,
|
|
118
|
+
onToggle: _
|
|
119
|
+
}), /* @__PURE__ */ a($, {
|
|
107
120
|
canChange: !!n.canChangePassword,
|
|
108
|
-
error:
|
|
109
|
-
isAvailable: n.isPasswordAvailable &&
|
|
121
|
+
error: u.password,
|
|
122
|
+
isAvailable: n.isPasswordAvailable && D?.id === "open",
|
|
110
123
|
isChecked: o.isPasswordEnabled,
|
|
111
|
-
isDefaultChecked:
|
|
124
|
+
isDefaultChecked: b.isPasswordEnabled,
|
|
112
125
|
isDisabled: l,
|
|
113
|
-
onBlur:
|
|
114
|
-
onChange:
|
|
115
|
-
onFocus: () =>
|
|
116
|
-
onToggle:
|
|
126
|
+
onBlur: H,
|
|
127
|
+
onChange: z,
|
|
128
|
+
onFocus: () => r("password", void 0),
|
|
129
|
+
onToggle: j,
|
|
117
130
|
password: o.password
|
|
118
|
-
}), /* @__PURE__ */ a(
|
|
131
|
+
}), /* @__PURE__ */ a(O, {
|
|
119
132
|
canChange: !!n.canChangeVanityName,
|
|
120
|
-
error:
|
|
133
|
+
error: u.vanityName,
|
|
121
134
|
isAvailable: !!n.isVanityNameAvailable,
|
|
122
135
|
isChecked: o.isVanityNameEnabled,
|
|
123
136
|
isDisabled: l,
|
|
124
|
-
onChange:
|
|
125
|
-
onToggle:
|
|
126
|
-
vanityDomain:
|
|
137
|
+
onChange: I,
|
|
138
|
+
onToggle: M,
|
|
139
|
+
vanityDomain: L,
|
|
127
140
|
vanityName: o.vanityName
|
|
128
|
-
}), /* @__PURE__ */ a(
|
|
141
|
+
}), /* @__PURE__ */ a(Y, {
|
|
129
142
|
canChange: !!n.canChangeDownload,
|
|
130
143
|
isAvailable: !!n.isDownloadAvailable,
|
|
131
144
|
isChecked: o.isDownloadEnabled,
|
|
132
145
|
isDisabled: l,
|
|
133
|
-
onToggle:
|
|
146
|
+
onToggle: U
|
|
134
147
|
})]
|
|
135
|
-
}), /* @__PURE__ */
|
|
136
|
-
children: [/* @__PURE__ */ a(
|
|
148
|
+
}), !g && /* @__PURE__ */ w(t.Footer, {
|
|
149
|
+
children: [/* @__PURE__ */ a(t.Footer.SecondaryButton, {
|
|
137
150
|
disabled: l,
|
|
138
|
-
onClick:
|
|
139
|
-
children: s
|
|
140
|
-
}), /* @__PURE__ */ a(
|
|
151
|
+
onClick: S,
|
|
152
|
+
children: i(s.cancelButton)
|
|
153
|
+
}), /* @__PURE__ */ a(t.Footer.PrimaryButton, {
|
|
141
154
|
id: "usm-SharedLinkSettingsModal-primaryButton",
|
|
142
155
|
loading: l,
|
|
143
|
-
loadingAriaLabel: s
|
|
144
|
-
onClick:
|
|
145
|
-
children: s
|
|
156
|
+
loadingAriaLabel: i(s.loadingLabel),
|
|
157
|
+
onClick: A,
|
|
158
|
+
children: i(s.saveButton)
|
|
146
159
|
})]
|
|
147
|
-
}), /* @__PURE__ */ a(
|
|
148
|
-
"aria-label": s
|
|
160
|
+
}), /* @__PURE__ */ a(t.Close, {
|
|
161
|
+
"aria-label": i(s.closeButton)
|
|
149
162
|
})]
|
|
150
163
|
})
|
|
151
164
|
});
|
|
152
165
|
}
|
|
153
166
|
export {
|
|
154
|
-
|
|
167
|
+
ye as SharedLinkSettingsModal
|
|
155
168
|
};
|
package/dist/esm/lib/components/unified-share-form-modal/collaboration-section/collaboration-role.js
CHANGED
|
@@ -1,66 +1,66 @@
|
|
|
1
1
|
import _ from "clsx";
|
|
2
|
-
import
|
|
3
|
-
import { useState as
|
|
4
|
-
import { useIntl as
|
|
5
|
-
import { Tooltip as
|
|
6
|
-
import
|
|
2
|
+
import L from "lodash/camelCase";
|
|
3
|
+
import { useState as k, useMemo as w, useEffect as q } from "react";
|
|
4
|
+
import { useIntl as F } from "react-intl";
|
|
5
|
+
import { Tooltip as N, Focusable as O, TriggerButton as D, DropdownMenu as r } from "@box/blueprint-web";
|
|
6
|
+
import $ from "../messages.js";
|
|
7
7
|
import n from "./messages.js";
|
|
8
|
-
import { jsx as e, jsxs as
|
|
9
|
-
import { isInvitationRoleSupported as
|
|
10
|
-
import { useUnifiedShareFormContext as
|
|
11
|
-
import { useUnifiedShareModalContext as
|
|
12
|
-
import '../../../../../styles/collaboration-role.css';const
|
|
13
|
-
container:
|
|
14
|
-
overrides:
|
|
15
|
-
focusable:
|
|
8
|
+
import { jsx as e, jsxs as j } from "react/jsx-runtime";
|
|
9
|
+
import { isInvitationRoleSupported as z, getDefaultCollaborationRole as A } from "../../../utils/collaborator.js";
|
|
10
|
+
import { useUnifiedShareFormContext as P } from "../../../contexts/unified-share-form-context.js";
|
|
11
|
+
import { useUnifiedShareModalContext as U } from "../../../contexts/unified-share-modal-context.js";
|
|
12
|
+
import '../../../../../styles/collaboration-role.css';const B = "_container_1fonq_1", E = "_overrides_1fonq_4", W = "_focusable_1fonq_9", l = {
|
|
13
|
+
container: B,
|
|
14
|
+
overrides: E,
|
|
15
|
+
focusable: W
|
|
16
16
|
};
|
|
17
17
|
function te() {
|
|
18
18
|
const {
|
|
19
19
|
formatMessage: o
|
|
20
|
-
} =
|
|
20
|
+
} = F(), [b, M] = k(!1), {
|
|
21
21
|
collaborationRole: u,
|
|
22
22
|
setCollaborationRole: d
|
|
23
|
-
} =
|
|
23
|
+
} = P(), {
|
|
24
24
|
collaborationRoles: g,
|
|
25
25
|
isSubmitting: S,
|
|
26
|
-
item:
|
|
27
|
-
} =
|
|
28
|
-
permissions:
|
|
26
|
+
item: I
|
|
27
|
+
} = U(), {
|
|
28
|
+
permissions: T = {},
|
|
29
29
|
type: m
|
|
30
|
-
} =
|
|
30
|
+
} = I, s = w(() => g.map((i) => {
|
|
31
31
|
const {
|
|
32
32
|
description: p,
|
|
33
33
|
id: t,
|
|
34
34
|
label: c
|
|
35
|
-
} = i,
|
|
36
|
-
let
|
|
37
|
-
t === "editor" && m === "folder" && (
|
|
35
|
+
} = i, f = z(t), h = L(t);
|
|
36
|
+
let x = h;
|
|
37
|
+
t === "editor" && m === "folder" && (x += "Folder");
|
|
38
38
|
let C = t, R = "";
|
|
39
|
-
return
|
|
39
|
+
return f && (C = o($[`${h}Role`]), R = o(n[`${x}Description`])), {
|
|
40
40
|
...i,
|
|
41
41
|
description: p ?? R,
|
|
42
42
|
label: c ?? C
|
|
43
43
|
};
|
|
44
44
|
}), [g, o, m]);
|
|
45
|
-
if (
|
|
46
|
-
d(
|
|
47
|
-
}, [
|
|
45
|
+
if (q(() => {
|
|
46
|
+
d(A(s));
|
|
47
|
+
}, [s, d]), !s.length || !u)
|
|
48
48
|
return null;
|
|
49
49
|
const {
|
|
50
|
-
id:
|
|
50
|
+
id: y,
|
|
51
51
|
label: v
|
|
52
52
|
} = u;
|
|
53
53
|
let a;
|
|
54
|
-
return
|
|
54
|
+
return T.canInviteCollaborator || (a = o(n.inviteDisabledTooltip)), m === "web_link" && (a = o(n.inviteWebLinkDisabledTooltip)), a ? /* @__PURE__ */ e(N, {
|
|
55
55
|
align: "start",
|
|
56
56
|
content: a,
|
|
57
57
|
"data-testid": "collaboration-role-tooltip",
|
|
58
58
|
side: "bottom",
|
|
59
|
-
children: /* @__PURE__ */ e(
|
|
60
|
-
className:
|
|
59
|
+
children: /* @__PURE__ */ e(O, {
|
|
60
|
+
className: l.focusable,
|
|
61
61
|
children: /* @__PURE__ */ e(D, {
|
|
62
62
|
caretDirection: "down",
|
|
63
|
-
className: _(
|
|
63
|
+
className: _(l.container, l.overrides),
|
|
64
64
|
disabled: !0,
|
|
65
65
|
label: o(n.inviteAsRoleLabel, {
|
|
66
66
|
role: v
|
|
@@ -69,13 +69,13 @@ function te() {
|
|
|
69
69
|
variant: "tertiary"
|
|
70
70
|
})
|
|
71
71
|
})
|
|
72
|
-
}) : /* @__PURE__ */
|
|
72
|
+
}) : /* @__PURE__ */ j(r.Root, {
|
|
73
73
|
onOpenChange: M,
|
|
74
|
-
open:
|
|
74
|
+
open: b,
|
|
75
75
|
children: [/* @__PURE__ */ e(r.Trigger, {
|
|
76
76
|
children: /* @__PURE__ */ e(D, {
|
|
77
|
-
caretDirection:
|
|
78
|
-
className: _(
|
|
77
|
+
caretDirection: b ? "up" : "down",
|
|
78
|
+
className: _(l.container, l.overrides),
|
|
79
79
|
disabled: S,
|
|
80
80
|
label: o(n.inviteAsRoleLabel, {
|
|
81
81
|
role: v
|
|
@@ -85,20 +85,20 @@ function te() {
|
|
|
85
85
|
})
|
|
86
86
|
}), /* @__PURE__ */ e(r.Content, {
|
|
87
87
|
align: "start",
|
|
88
|
-
children:
|
|
88
|
+
children: s.map((i) => {
|
|
89
89
|
const {
|
|
90
90
|
description: p,
|
|
91
91
|
isDisabled: t,
|
|
92
92
|
id: c,
|
|
93
|
-
label:
|
|
93
|
+
label: f
|
|
94
94
|
} = i;
|
|
95
95
|
return /* @__PURE__ */ e(r.CheckboxItem, {
|
|
96
|
-
checked:
|
|
96
|
+
checked: y === c,
|
|
97
97
|
disabled: t,
|
|
98
98
|
onSelect: () => d(i),
|
|
99
99
|
children: /* @__PURE__ */ e(r.Item.MainContent, {
|
|
100
100
|
caption: p,
|
|
101
|
-
label:
|
|
101
|
+
label: f
|
|
102
102
|
})
|
|
103
103
|
}, c);
|
|
104
104
|
})
|