@box/unified-share-modal 1.54.0 → 2.0.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/collaborator-list/collaborator-list.js +8 -6
- package/dist/esm/lib/hooks/use-collaboration-form.js +79 -65
- package/dist/esm/lib/utils/email.js +8 -0
- package/dist/esm/lib/utils/index.js +21 -19
- package/dist/i18n/en-x-pseudo.js +162 -162
- package/dist/i18n/en-x-pseudo.properties +162 -162
- package/dist/types/lib/stories/shared.d.ts +1 -1
- package/dist/types/lib/types.d.ts +3 -3
- package/dist/types/lib/utils/email.d.ts +5 -0
- package/dist/types/lib/utils/index.d.ts +1 -0
- package/package.json +9 -9
package/dist/esm/lib/components/unified-share-form-modal/collaborator-list/collaborator-list.js
CHANGED
|
@@ -19,10 +19,10 @@ function Z() {
|
|
|
19
19
|
const {
|
|
20
20
|
formatMessage: o
|
|
21
21
|
} = S(), l = x() === z.Small, {
|
|
22
|
-
collaborators:
|
|
22
|
+
collaborators: f,
|
|
23
23
|
config: s,
|
|
24
|
-
eventService:
|
|
25
|
-
isFetching:
|
|
24
|
+
eventService: b,
|
|
25
|
+
isFetching: _,
|
|
26
26
|
isSubmitting: k,
|
|
27
27
|
item: v,
|
|
28
28
|
variant: C
|
|
@@ -31,7 +31,7 @@ function Z() {
|
|
|
31
31
|
type: y
|
|
32
32
|
} = v, {
|
|
33
33
|
onCollaboratorsManagementClick: n
|
|
34
|
-
} =
|
|
34
|
+
} = b, c = C === "desktop", {
|
|
35
35
|
containerRef: d,
|
|
36
36
|
previousForm: m,
|
|
37
37
|
setForm: F
|
|
@@ -69,13 +69,15 @@ function Z() {
|
|
|
69
69
|
children: [/* @__PURE__ */ e(p, {
|
|
70
70
|
hideHeader: !0,
|
|
71
71
|
isRowHeader: !0,
|
|
72
|
+
width: "11fr",
|
|
72
73
|
children: o(r.nameColumn)
|
|
73
74
|
}), !l && /* @__PURE__ */ e(p, {
|
|
74
75
|
hideHeader: !0,
|
|
76
|
+
width: "10fr",
|
|
75
77
|
children: o(r.roleColumn)
|
|
76
78
|
})]
|
|
77
79
|
}), /* @__PURE__ */ e(D, {
|
|
78
|
-
children:
|
|
80
|
+
children: f.slice(0, s.collaboratorsLimit).map((h) => /* @__PURE__ */ e(H, {
|
|
79
81
|
collaborator: h,
|
|
80
82
|
isSmall: l
|
|
81
83
|
}, h.id))
|
|
@@ -83,7 +85,7 @@ function Z() {
|
|
|
83
85
|
})
|
|
84
86
|
})
|
|
85
87
|
}), d && /* @__PURE__ */ L(/* @__PURE__ */ a(u, {
|
|
86
|
-
children: [!
|
|
88
|
+
children: [!_ && /* @__PURE__ */ e(i.Footer, {
|
|
87
89
|
children: /* @__PURE__ */ e(i.Footer.SecondaryButton, {
|
|
88
90
|
onClick: () => F(m === "invite" ? m : "default"),
|
|
89
91
|
children: o(r.doneButton)
|
|
@@ -1,82 +1,96 @@
|
|
|
1
|
-
import { useCallback as
|
|
2
|
-
import { useUnifiedShareFormContext as
|
|
3
|
-
import { useUnifiedShareModalContext as
|
|
4
|
-
import { useFormValidation as
|
|
5
|
-
import { useSharingAction as
|
|
6
|
-
|
|
1
|
+
import { useCallback as c } from "react";
|
|
2
|
+
import { useUnifiedShareFormContext as q } from "../contexts/unified-share-form-context.js";
|
|
3
|
+
import { useUnifiedShareModalContext as M } from "../contexts/unified-share-modal-context.js";
|
|
4
|
+
import { useFormValidation as O } from "./use-form-validation.js";
|
|
5
|
+
import { useSharingAction as P } from "./use-sharing-action.js";
|
|
6
|
+
import { parseEmails as k } from "../utils/email.js";
|
|
7
|
+
const Q = (U, w) => {
|
|
7
8
|
const {
|
|
8
|
-
errors:
|
|
9
|
-
setFieldError:
|
|
10
|
-
validateCollaborationLimit:
|
|
11
|
-
validateUserContact:
|
|
12
|
-
validateUserSelector:
|
|
13
|
-
} =
|
|
14
|
-
config:
|
|
15
|
-
contactService:
|
|
16
|
-
} =
|
|
17
|
-
collaborationLimit:
|
|
18
|
-
} =
|
|
19
|
-
collaborationRole:
|
|
20
|
-
form:
|
|
9
|
+
errors: g,
|
|
10
|
+
setFieldError: r,
|
|
11
|
+
validateCollaborationLimit: l,
|
|
12
|
+
validateUserContact: C,
|
|
13
|
+
validateUserSelector: u
|
|
14
|
+
} = O(), {
|
|
15
|
+
config: x,
|
|
16
|
+
contactService: E
|
|
17
|
+
} = M(), {
|
|
18
|
+
collaborationLimit: s
|
|
19
|
+
} = x, {
|
|
20
|
+
collaborationRole: y,
|
|
21
|
+
form: V,
|
|
21
22
|
messageValue: R,
|
|
22
|
-
setContactValue:
|
|
23
|
-
setMessageValue:
|
|
24
|
-
setUserContacts:
|
|
25
|
-
shieldRestriction:
|
|
26
|
-
userContacts:
|
|
27
|
-
} =
|
|
28
|
-
onAction:
|
|
29
|
-
} =
|
|
30
|
-
|
|
31
|
-
} =
|
|
32
|
-
|
|
33
|
-
},
|
|
34
|
-
|
|
35
|
-
}, [
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
if (o && o.id)
|
|
41
|
-
return o;
|
|
42
|
-
}
|
|
43
|
-
return g(t.value) ? null : {
|
|
44
|
-
email: t.value,
|
|
23
|
+
setContactValue: m,
|
|
24
|
+
setMessageValue: L,
|
|
25
|
+
setUserContacts: d,
|
|
26
|
+
shieldRestriction: f,
|
|
27
|
+
userContacts: o
|
|
28
|
+
} = q(), {
|
|
29
|
+
onAction: A
|
|
30
|
+
} = P(U, w), {
|
|
31
|
+
getContactsByEmail: p
|
|
32
|
+
} = E, v = () => {
|
|
33
|
+
d([]), m(""), L(""), r("user-contact", "");
|
|
34
|
+
}, B = c((t) => {
|
|
35
|
+
l(o, s) || r("user-contact", ""), m(t);
|
|
36
|
+
}, [s, m, r, o, l]), S = c(async (t) => {
|
|
37
|
+
const a = t.filter((e) => e.id === void 0).map((e) => e.value);
|
|
38
|
+
let i = {};
|
|
39
|
+
return p && a.length > 0 && (i = await p(a) ?? {}), t.map((e) => e.id !== void 0 ? e : i[e.value] || {
|
|
40
|
+
email: e.value,
|
|
45
41
|
id: 0,
|
|
46
42
|
isExternalUser: !0,
|
|
47
|
-
name:
|
|
48
|
-
value:
|
|
49
|
-
};
|
|
50
|
-
}, [
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
43
|
+
name: e.value,
|
|
44
|
+
value: e.value
|
|
45
|
+
});
|
|
46
|
+
}, [p]), h = c(async (t) => {
|
|
47
|
+
r("user-contact", ""), u(t);
|
|
48
|
+
let a;
|
|
49
|
+
if (t.length < o.length)
|
|
50
|
+
a = t;
|
|
51
|
+
else if (t[t.length - 1].id !== void 0)
|
|
52
|
+
a = [...o, t[t.length - 1]];
|
|
53
|
+
else {
|
|
54
|
+
const i = t[t.length - 1].value, e = k(i);
|
|
55
|
+
if (e.length === 0) {
|
|
56
|
+
C(i);
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
const b = new Set(o.filter((n) => !!n.email).map((n) => n.email.toLowerCase())), T = e.filter((n) => {
|
|
60
|
+
const F = n.toLowerCase();
|
|
61
|
+
return b.has(F) ? !1 : (b.add(F), !0);
|
|
62
|
+
}), j = await S(T.map((n) => ({
|
|
63
|
+
value: n
|
|
64
|
+
})));
|
|
65
|
+
a = [...o, ...j];
|
|
54
66
|
}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
67
|
+
s && l(a, s), d(a);
|
|
68
|
+
}, [s, S, r, d, o, l, C, u]), I = c((t) => {
|
|
69
|
+
const a = t.relatedTarget?.closest(".collaboration-user-selector");
|
|
70
|
+
if (document.querySelector('div[role="listbox"][aria-labelledby^="user-contacts"]')?.contains(t.relatedTarget) || a)
|
|
71
|
+
return;
|
|
72
|
+
const e = t.target.value.trim();
|
|
73
|
+
e && h([...o, {
|
|
74
|
+
value: e
|
|
61
75
|
}]);
|
|
62
|
-
}, [
|
|
76
|
+
}, [h, o]);
|
|
63
77
|
return {
|
|
64
|
-
errors:
|
|
65
|
-
handleFormReset:
|
|
78
|
+
errors: g,
|
|
79
|
+
handleFormReset: v,
|
|
66
80
|
handleFormSubmit: async () => {
|
|
67
|
-
if (
|
|
81
|
+
if (g["user-contact"] || u(o))
|
|
68
82
|
return !0;
|
|
69
83
|
const t = {
|
|
70
|
-
contacts:
|
|
84
|
+
contacts: o,
|
|
71
85
|
message: R
|
|
72
86
|
};
|
|
73
|
-
return
|
|
87
|
+
return V === "invite" && (t.role = y.id), f.isJustificationAllowed && (t.justificationReason = f.justificationReason, t.classificationId = f.classificationId), await A(t), v(), !1;
|
|
74
88
|
},
|
|
75
|
-
handleSelectedUsersChange:
|
|
76
|
-
handleUserSelectorBlur:
|
|
77
|
-
updateContactValue:
|
|
89
|
+
handleSelectedUsersChange: h,
|
|
90
|
+
handleUserSelectorBlur: I,
|
|
91
|
+
updateContactValue: B
|
|
78
92
|
};
|
|
79
93
|
};
|
|
80
94
|
export {
|
|
81
|
-
|
|
95
|
+
Q as useCollaborationForm
|
|
82
96
|
};
|
|
@@ -1,29 +1,31 @@
|
|
|
1
1
|
import { getAvatarBadgeSize as a, getDefaultCollaborationRole as t, getFirstInitial as r, isCollaboratorRestricted as s, isCollaboratorRoleSupported as i, isInvitationRoleSupported as d } from "./collaborator.js";
|
|
2
|
-
import { formatDateFromTimestampToCalendarDate as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
2
|
+
import { formatDateFromTimestampToCalendarDate as n, formatDateFromTimestampToDateString as m, formatTomorrowDateToCalendarDate as p } from "./date.js";
|
|
3
|
+
import { parseEmails as f } from "./email.js";
|
|
4
|
+
import { callOnKeyboardEvent as w } from "./event.js";
|
|
5
|
+
import { getUpdatedLinkSettingsFormData as D } from "./form.js";
|
|
6
|
+
import { getAllowedAccessLevels as b, getAllowedPermissionLevels as c } from "./permission.js";
|
|
7
|
+
import { doesPasswordContainInvalidCharacter as S, doesPasswordContainLetter as T, doesPasswordContainMinCharacters as u, doesPasswordContainMixedCase as A, doesPasswordContainNumber as F, doesPasswordContainSymbol as L, isEmailValid as R, isVanityNameValid as y } from "./validation.js";
|
|
7
8
|
export {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
9
|
+
w as callOnKeyboardEvent,
|
|
10
|
+
S as doesPasswordContainInvalidCharacter,
|
|
11
|
+
T as doesPasswordContainLetter,
|
|
12
|
+
u as doesPasswordContainMinCharacters,
|
|
13
|
+
A as doesPasswordContainMixedCase,
|
|
14
|
+
F as doesPasswordContainNumber,
|
|
15
|
+
L as doesPasswordContainSymbol,
|
|
16
|
+
n as formatDateFromTimestampToCalendarDate,
|
|
16
17
|
m as formatDateFromTimestampToDateString,
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
p as formatTomorrowDateToCalendarDate,
|
|
19
|
+
b as getAllowedAccessLevels,
|
|
20
|
+
c as getAllowedPermissionLevels,
|
|
20
21
|
a as getAvatarBadgeSize,
|
|
21
22
|
t as getDefaultCollaborationRole,
|
|
22
23
|
r as getFirstInitial,
|
|
23
|
-
|
|
24
|
+
D as getUpdatedLinkSettingsFormData,
|
|
24
25
|
s as isCollaboratorRestricted,
|
|
25
26
|
i as isCollaboratorRoleSupported,
|
|
26
|
-
|
|
27
|
+
R as isEmailValid,
|
|
27
28
|
d as isInvitationRoleSupported,
|
|
28
|
-
|
|
29
|
+
y as isVanityNameValid,
|
|
30
|
+
f as parseEmails
|
|
29
31
|
};
|