@box/unified-share-modal 2.8.8 → 2.8.9

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.
@@ -4,14 +4,14 @@ import { useEffect as F } from "react";
4
4
  import { useIntl as B } from "react-intl";
5
5
  import { Modal as o, Divider as S, Text as k } from "@box/blueprint-web";
6
6
  import n from "./messages.js";
7
- import { jsx as e, jsxs as d } from "react/jsx-runtime";
8
- import { useUnifiedShareModalContext as w } from "../../contexts/unified-share-modal-context.js";
9
- import { useSharingAction as D } from "../../hooks/use-sharing-action.js";
10
- import '../../../../styles/remove-collaborator-modal.css';const M = "_content_166yb_1", P = "_isFullscreen_166yb_1", A = "_body_166yb_10", N = "_divider_166yb_17", i = {
11
- content: M,
12
- isFullscreen: P,
13
- body: A,
14
- divider: N
7
+ import { jsx as e, jsxs as c } from "react/jsx-runtime";
8
+ import { useUnifiedShareModalContext as D } from "../../contexts/unified-share-modal-context.js";
9
+ import { useSharingAction as M } from "../../hooks/use-sharing-action.js";
10
+ import '../../../../styles/remove-collaborator-modal.css';const w = "_content_166yb_1", A = "_isFullscreen_166yb_1", N = "_body_166yb_10", P = "_divider_166yb_17", i = {
11
+ content: w,
12
+ isFullscreen: A,
13
+ body: N,
14
+ divider: P
15
15
  };
16
16
  function q({
17
17
  isOpen: l,
@@ -20,47 +20,47 @@ function q({
20
20
  const {
21
21
  formatMessage: t
22
22
  } = B(), {
23
- collaborator: m,
23
+ collaborator: d,
24
24
  isSubmitting: r,
25
- sharingService: f,
26
- setCollaborator: u,
27
- variant: y
28
- } = w(), {
29
- email: p,
30
- name: h
31
- } = m ?? {}, {
32
- removeCollaborator: b
33
- } = f, a = y === "desktop";
25
+ sharingService: b,
26
+ setCollaborator: m,
27
+ variant: u
28
+ } = D(), {
29
+ email: f,
30
+ name: y
31
+ } = d ?? {}, {
32
+ removeCollaborator: p
33
+ } = b, a = u === "desktop";
34
34
  F(() => {
35
- l || u(null);
36
- }, [l, u]);
37
- const v = async () => {
38
- b && (await b(m), s(!1), await new Promise((c) => setTimeout(c)));
39
- }, {
40
- onAction: _
41
- } = D(v, "remove-collaborator"), g = (c) => {
42
- c.preventDefault();
35
+ l || m(null);
36
+ }, [l, m]);
37
+ const {
38
+ onAction: h
39
+ } = M(p, "remove-collaborator"), v = async () => {
40
+ await h(d), s(!1);
41
+ }, _ = (g) => {
42
+ g.preventDefault();
43
43
  };
44
44
  return /* @__PURE__ */ e(o, {
45
45
  onOpenChange: r ? C : s,
46
46
  open: l,
47
- children: /* @__PURE__ */ d(o.Content, {
47
+ children: /* @__PURE__ */ c(o.Content, {
48
48
  className: x(i.content, a && i.isFullscreen),
49
- onPointerDownOutside: g,
49
+ onPointerDownOutside: _,
50
50
  size: "small",
51
51
  children: [/* @__PURE__ */ e(o.Header, {
52
52
  children: t(n.title)
53
- }), /* @__PURE__ */ d(o.Body, {
53
+ }), /* @__PURE__ */ c(o.Body, {
54
54
  className: i.body,
55
55
  children: [a && /* @__PURE__ */ e(S, {
56
56
  className: i.divider
57
57
  }), /* @__PURE__ */ e(k, {
58
58
  as: "p",
59
59
  children: t(n.bodyText, {
60
- name: p || h
60
+ name: f || y
61
61
  })
62
62
  })]
63
- }), /* @__PURE__ */ d(o.Footer, {
63
+ }), /* @__PURE__ */ c(o.Footer, {
64
64
  children: [/* @__PURE__ */ e(o.Footer.SecondaryButton, {
65
65
  disabled: r,
66
66
  onClick: () => s(!1),
@@ -68,7 +68,7 @@ function q({
68
68
  }), /* @__PURE__ */ e(o.Footer.PrimaryButton, {
69
69
  loading: r,
70
70
  loadingAriaLabel: t(n.loadingLabel),
71
- onClick: _,
71
+ onClick: v,
72
72
  children: t(n.okayButton)
73
73
  })]
74
74
  }), !a && /* @__PURE__ */ e(o.Close, {
@@ -6,34 +6,34 @@ import n from "./messages.js";
6
6
  import { jsx as o, jsxs as d } from "react/jsx-runtime";
7
7
  import { useUnifiedShareModalContext as g } from "../../contexts/unified-share-modal-context.js";
8
8
  import { useSharingAction as x } from "../../hooks/use-sharing-action.js";
9
- import '../../../../styles/remove-collaborator-modal.css';const F = "_content_166yb_1", B = "_isFullscreen_166yb_1", D = "_body_166yb_10", w = "_divider_166yb_17", s = {
9
+ import '../../../../styles/remove-collaborator-modal.css';const F = "_content_166yb_1", B = "_isFullscreen_166yb_1", D = "_body_166yb_10", C = "_divider_166yb_17", s = {
10
10
  content: F,
11
11
  isFullscreen: B,
12
12
  body: D,
13
- divider: w
13
+ divider: C
14
14
  };
15
15
  function z({
16
- isOpen: m,
16
+ isOpen: a,
17
17
  onOpenChange: r
18
18
  }) {
19
19
  const {
20
20
  formatMessage: t
21
21
  } = v(), {
22
22
  isSubmitting: i,
23
- sharingService: u,
24
- variant: b
23
+ sharingService: c,
24
+ variant: m
25
25
  } = g(), {
26
- deleteSharedLink: c
27
- } = u, l = b === "desktop", f = async () => {
28
- c && (await c(), r(!1), await new Promise((a) => setTimeout(a)));
29
- }, {
30
- onAction: h
31
- } = x(f, "delete-shared-link"), y = (a) => {
32
- a.preventDefault();
26
+ deleteSharedLink: u
27
+ } = c, l = m === "desktop", {
28
+ onAction: b
29
+ } = x(u, "delete-shared-link"), h = async () => {
30
+ await b(), r(!1);
31
+ }, y = (f) => {
32
+ f.preventDefault();
33
33
  };
34
34
  return /* @__PURE__ */ o(e, {
35
35
  onOpenChange: i ? _ : r,
36
- open: m,
36
+ open: a,
37
37
  children: /* @__PURE__ */ d(e.Content, {
38
38
  className: p(s.content, l && s.isFullscreen),
39
39
  onPointerDownOutside: y,
@@ -1,49 +1,50 @@
1
1
  import pe from "clsx";
2
- import { useState as he, useRef as fe, useEffect as P, useCallback as C } from "react";
2
+ import { useState as fe, useRef as he, useEffect as R, useCallback as C } from "react";
3
3
  import { createPortal as be } from "react-dom";
4
4
  import { useIntl as ge } from "react-intl";
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
- import { Globe as xe } from "@box/blueprint-web-assets/icons/Medium";
7
- import { bpSize040 as R } from "@box/blueprint-web-assets/tokens/tokens";
8
- import { UserSelectorContainer as ye } from "@box/user-selector";
9
- import { CollaborationRole as Ee } from "./collaboration-role.js";
10
- import { SharedWithAvatars as Ae } from "./shared-with-avatars.js";
11
- import { ShieldRestrictionNotice as Be } from "./shield-restriction-notice.js";
12
- import { TextAreaContainer as Ne } from "./text-area-container.js";
13
- import o from "./messages.js";
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";
5
+ import { useBlueprintModernization as Ce, useNotification as ve, useUniqueId as Se, useLabelable as Ue, Tooltip as _e, Focusable as Fe, Text as xe, Modal as v } from "@box/blueprint-web";
6
+ import { Globe as ye } from "@box/blueprint-web-assets/icons/Medium";
7
+ import { bpSize040 as B } from "@box/blueprint-web-assets/tokens/tokens";
8
+ import { UserSelectorContainer as Ee } from "@box/user-selector";
9
+ import { CollaborationRole as Le } from "./collaboration-role.js";
10
+ import { SharedWithAvatars as Ne } from "./shared-with-avatars.js";
11
+ import { ShieldRestrictionNotice as Ae } from "./shield-restriction-notice.js";
12
+ import { TextAreaContainer as Pe } from "./text-area-container.js";
13
+ import r from "./messages.js";
14
+ import { jsxs as l, jsx as t, Fragment as Re } from "react/jsx-runtime";
15
+ import { useFormValidation as Be } 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
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
- label: Me,
23
- modernized: ze,
24
- security: Oe,
25
- icon: we,
26
- access: We
19
+ import { parseEmails as Te } from "../../../utils/email.js";
20
+ import { getNotificationArgs as Me } from "../../../utils/notification.js";
21
+ import '../../../../../styles/collaboration-section.css';const ze = "_container_1e2gg_2", Ie = "_label_1e2gg_8", Oe = "_modernized_1e2gg_15", we = "_security_1e2gg_33", We = "_icon_1e2gg_37", je = "_access_1e2gg_43", c = {
22
+ container: ze,
23
+ label: Ie,
24
+ modernized: Oe,
25
+ security: we,
26
+ icon: We,
27
+ access: je
27
28
  };
28
- function lt() {
29
+ function dt() {
29
30
  const {
30
- formatMessage: t
31
- } = ge(), [S, y] = he(), {
31
+ formatMessage: o
32
+ } = ge(), [S, E] = fe(), {
32
33
  enableModernizedComponents: k
33
34
  } = Ce(), {
34
35
  addNotification: V
35
36
  } = ve(), {
36
37
  validateShieldRestriction: D
37
- } = Re(), {
38
- contactValue: I,
38
+ } = Be(), {
39
+ contactValue: T,
39
40
  containerRef: U,
40
41
  form: n,
41
42
  setForm: d,
42
- setUserContacts: T,
43
- shieldRestriction: M,
43
+ setUserContacts: M,
44
+ shieldRestriction: z,
44
45
  userContacts: i
45
46
  } = Ve(), {
46
- collaborationAccess: z,
47
+ collaborationAccess: I,
47
48
  collaborationNotices: O,
48
49
  config: p,
49
50
  contactService: w,
@@ -63,83 +64,80 @@ function lt() {
63
64
  sendInvitations: J,
64
65
  sendSharedLink: Q
65
66
  } = q;
66
- let L, x;
67
- n === "invite" && (L = J, x = "invite-collaborators"), n === "email" && (L = Q, x = "email-shared-link");
67
+ let x, y;
68
+ n === "invite" && (x = J, y = "invite-collaborators"), n === "email" && (x = Q, y = "email-shared-link");
68
69
  const {
69
70
  errors: X,
70
- handleFormReset: E,
71
+ handleFormReset: L,
71
72
  handleFormSubmit: Y,
72
- handleSelectedUsersChange: h,
73
+ handleSelectedUsersChange: f,
73
74
  handleUserSelectorBlur: Z,
74
75
  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), A = fe(n === "email" ? "email" : "invite");
76
- P(() => {
77
- A.current = n === "email" ? "email" : "invite";
78
- }, [n]), P(() => {
79
- (!i.length || !i.some((e) => e.chipVariant === "error")) && y(null);
76
+ } = ke(x, y), te = K === "desktop", u = n === "default" || n === "invite", a = n === "invite" || n === "email", oe = i.some((e) => e.isExternalUser), N = he(n === "email" ? "email" : "invite");
77
+ R(() => {
78
+ N.current = n === "email" ? "email" : "invite";
79
+ }, [n]), R(() => {
80
+ (!i.length || !i.some((e) => e.chipVariant === "error")) && E(null);
80
81
  }, [i]);
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
+ const re = C((e) => (e.stopPropagation(), !0), []), ie = C((e) => _ ? _(e, N.current) : Promise.resolve([]), [_]), ne = C((e) => F ? F(e) : Promise.resolve({}), [F]), ae = (e) => {
82
83
  a || d("invite"), ee(e);
83
84
  }, se = C((e) => {
84
85
  const s = e.clipboardData.getData("text");
85
- Ie(s).length !== 0 && (e.preventDefault(), a || d("invite"), h([...i, {
86
+ Te(s).length !== 0 && (e.preventDefault(), a || d("invite"), f([...i, {
86
87
  value: s
87
88
  }]));
88
- }, [h, a, d, i]), le = () => {
89
- E(), d("default");
89
+ }, [f, a, d, i]), le = () => {
90
+ L(), d("default");
90
91
  }, ce = async () => {
91
92
  try {
92
93
  if (S) {
93
- const e = D(i, M);
94
+ const e = D(i, z);
94
95
  if (e) {
95
96
  V({
96
- closeButtonAriaLabel: t(o.closeButton),
97
- sensitivity: "foreground",
98
- styledText: e,
99
- typeIconAriaLabel: t(o.errorNoticeIconAriaLabel),
100
- variant: "error"
97
+ ...Me(o, "error"),
98
+ styledText: e
101
99
  });
102
100
  return;
103
101
  }
104
102
  }
105
103
  if (await Y())
106
104
  return;
107
- E(), G(!1), d("default");
105
+ L(), G(!1), d("default");
108
106
  } catch (e) {
109
107
  if (!e.shieldRestriction)
110
108
  return;
111
109
  const {
112
110
  shieldRestriction: s
113
- } = e, N = [...s.restrictedEmails ?? [], ...s.restrictedGroups ?? []], ue = i.map((g) => N.includes(g.email) || N.includes(`${g.id}`) ? {
111
+ } = e, P = [...s.restrictedEmails ?? [], ...s.restrictedGroups ?? []], ue = i.map((g) => P.includes(g.email) || P.includes(`${g.id}`) ? {
114
112
  ...g,
115
113
  chipVariant: "error"
116
114
  } : g);
117
- y(s), T(ue);
115
+ E(s), M(ue);
118
116
  }
119
117
  };
120
- let f, b = !1;
121
- u && !$.canInviteCollaborator && (f = t(o.inviteDisabledTooltip), b = !0), u && H === "web_link" && (f = t(o.inviteWebLinkDisabledTooltip), b = !0);
122
- const B = Se("user-contacts-"), de = t(u ? o.invitePeopleLabel : o.emailSharedLinkLabel), me = Ue(de, B);
118
+ let h, b = !1;
119
+ u && !$.canInviteCollaborator && (h = o(r.inviteDisabledTooltip), b = !0), u && H === "web_link" && (h = o(r.inviteWebLinkDisabledTooltip), b = !0);
120
+ const A = Se("user-contacts-"), de = o(u ? r.invitePeopleLabel : r.emailSharedLinkLabel), me = Ue(de, A);
123
121
  return /* @__PURE__ */ l("form", {
124
122
  className: c.container,
125
123
  onSubmit: (e) => e.preventDefault(),
126
- children: [S && /* @__PURE__ */ r(Be, {
124
+ children: [S && /* @__PURE__ */ t(Ae, {
127
125
  error: S,
128
126
  isLoading: m,
129
- onSelectedUsersChange: h
127
+ onSelectedUsersChange: f
130
128
  }), O, /* @__PURE__ */ l("div", {
131
- children: [u && p.collaborators && /* @__PURE__ */ r(Ae, {}), /* @__PURE__ */ r(me, {
129
+ children: [u && p.collaborators && /* @__PURE__ */ t(Ne, {}), /* @__PURE__ */ t(me, {
132
130
  className: pe(c.label, k && c.modernized)
133
- }), /* @__PURE__ */ r(_e, {
134
- content: f,
131
+ }), /* @__PURE__ */ t(_e, {
132
+ content: h,
135
133
  "data-testid": "user-contacts-tooltip",
136
- open: f ? void 0 : !1,
134
+ open: h ? void 0 : !1,
137
135
  side: "bottom",
138
- children: /* @__PURE__ */ r(Fe, {
136
+ children: /* @__PURE__ */ t(Fe, {
139
137
  focusable: b,
140
- children: /* @__PURE__ */ r(ye, {
138
+ children: /* @__PURE__ */ t(Ee, {
141
139
  className: "collaboration-user-selector",
142
- clearButtonAriaLabel: t(o.clearButton),
140
+ clearButtonAriaLabel: o(r.clearButton),
143
141
  clearOnBlur: !1,
144
142
  "data-target-id": "PillSelectorDropdown-AddNamesOrEmailAddresses",
145
143
  disabled: b || m,
@@ -148,14 +146,14 @@ function lt() {
148
146
  fetchAvatarUrls: ne,
149
147
  fetchUsers: ie,
150
148
  hideOnEscape: re,
151
- idForLabel: B,
152
- inputValue: I,
149
+ idForLabel: A,
150
+ inputValue: T,
153
151
  label: null,
154
152
  onBlur: Z,
155
153
  onInputValueChange: ae,
156
154
  onPaste: se,
157
- onSelectedUsersChange: h,
158
- placeholder: i.length ? "" : t(o.invitePeoplePlaceholder),
155
+ onSelectedUsersChange: f,
156
+ placeholder: i.length ? "" : o(r.invitePeoplePlaceholder),
159
157
  portalElement: U,
160
158
  selectedUsers: i,
161
159
  selectOnEnterOrTab: !0,
@@ -164,40 +162,40 @@ function lt() {
164
162
  })
165
163
  }), u && /* @__PURE__ */ l("div", {
166
164
  className: c.access,
167
- children: [p.collaborationRole && /* @__PURE__ */ r(Ee, {}), z]
165
+ children: [p.collaborationRole && /* @__PURE__ */ t(Le, {}), I]
168
166
  })]
169
- }), a && p.collaborationMessage && /* @__PURE__ */ r(Ne, {
167
+ }), a && p.collaborationMessage && /* @__PURE__ */ t(Pe, {
170
168
  maxCount: p.collaborationMessageLimit
171
169
  }), a && oe && /* @__PURE__ */ l("div", {
172
170
  className: c.security,
173
- children: [/* @__PURE__ */ r(xe, {
171
+ children: [/* @__PURE__ */ t(ye, {
174
172
  className: c.icon,
175
- height: R,
176
- width: R
177
- }), /* @__PURE__ */ r(Le, {
173
+ height: B,
174
+ width: B
175
+ }), /* @__PURE__ */ t(xe, {
178
176
  as: "span",
179
177
  color: "textOnLightSecondary",
180
- children: t(o.contentSharedWithExternalCollaborators)
178
+ children: o(r.contentSharedWithExternalCollaborators)
181
179
  })]
182
- }), a && U && /* @__PURE__ */ be(/* @__PURE__ */ l(Pe, {
180
+ }), a && U && /* @__PURE__ */ be(/* @__PURE__ */ l(Re, {
183
181
  children: [!W && /* @__PURE__ */ l(v.Footer, {
184
- children: [/* @__PURE__ */ r(v.Footer.SecondaryButton, {
182
+ children: [/* @__PURE__ */ t(v.Footer.SecondaryButton, {
185
183
  disabled: m,
186
184
  onClick: le,
187
- children: t(o.cancelButton)
188
- }), /* @__PURE__ */ r(v.Footer.PrimaryButton, {
185
+ children: o(r.cancelButton)
186
+ }), /* @__PURE__ */ t(v.Footer.PrimaryButton, {
189
187
  loading: m,
190
- loadingAriaLabel: t(o.loadingLabel),
188
+ loadingAriaLabel: o(r.loadingLabel),
191
189
  onClick: ce,
192
- children: t(o.sendButton)
190
+ children: o(r.sendButton)
193
191
  })]
194
- }), !te && /* @__PURE__ */ r(v.Close, {
195
- "aria-label": t(o.closeButton),
192
+ }), !te && /* @__PURE__ */ t(v.Close, {
193
+ "aria-label": o(r.closeButton),
196
194
  disabled: m
197
195
  })]
198
196
  }), U)]
199
197
  });
200
198
  }
201
199
  export {
202
- lt as CollaborationSection
200
+ dt as CollaborationSection
203
201
  };
@@ -12,13 +12,16 @@ const a = (e) => {
12
12
  }, m = (e, s) => ({
13
13
  closeButtonAriaLabel: e(r.noticeCloseLabel),
14
14
  sensitivity: "foreground",
15
+ style: {
16
+ pointerEvents: "auto"
17
+ },
15
18
  typeIconAriaLabel: e(a(s)),
16
19
  variant: s
17
- }), N = (e, s, t, o) => {
20
+ }), N = (e, s, t, c) => {
18
21
  if (!t)
19
22
  return "";
20
- const n = i(t), c = r[`${n}${s === "success" ? "Success" : "Error"}NoticeText`];
21
- return c ? e(c, o) : s === "error" ? e(r.defaultErrorNoticeText) : "";
23
+ const n = i(t), o = r[`${n}${s === "success" ? "Success" : "Error"}NoticeText`];
24
+ return o ? e(o, c) : s === "error" ? e(r.defaultErrorNoticeText) : "";
22
25
  };
23
26
  export {
24
27
  m as getNotificationArgs,
@@ -2,6 +2,9 @@ import { NotificationType, NotificationVariant } from '../types';
2
2
  declare const getNotificationArgs: (formatMessage: any, type: NotificationVariant) => {
3
3
  closeButtonAriaLabel: any;
4
4
  sensitivity: "foreground";
5
+ style: {
6
+ pointerEvents: "auto";
7
+ };
5
8
  typeIconAriaLabel: any;
6
9
  variant: NotificationVariant;
7
10
  };
package/package.json CHANGED
@@ -1,22 +1,22 @@
1
1
  {
2
2
  "name": "@box/unified-share-modal",
3
- "version": "2.8.8",
3
+ "version": "2.8.9",
4
4
  "license": "SEE LICENSE IN LICENSE",
5
5
  "peerDependencies": {
6
- "@box/blueprint-web": "^13.8.2",
7
- "@box/blueprint-web-assets": "^4.109.1",
8
- "@box/copy-input": "^1.39.31",
9
- "@box/user-selector": "^1.73.32",
6
+ "@box/blueprint-web": "^13.8.3",
7
+ "@box/blueprint-web-assets": "^4.109.2",
8
+ "@box/copy-input": "^1.39.32",
9
+ "@box/user-selector": "^1.73.33",
10
10
  "lodash": "^4.17.15",
11
11
  "react": "^18.0.0",
12
12
  "react-dom": "^18.0.0",
13
13
  "react-intl": "^6.4.2"
14
14
  },
15
15
  "devDependencies": {
16
- "@box/blueprint-web": "^13.8.2",
17
- "@box/blueprint-web-assets": "^4.109.1",
18
- "@box/copy-input": "^1.39.31",
19
- "@box/storybook-utils": "0.16.81",
16
+ "@box/blueprint-web": "^13.8.3",
17
+ "@box/blueprint-web-assets": "^4.109.2",
18
+ "@box/copy-input": "^1.39.32",
19
+ "@box/storybook-utils": "0.16.82",
20
20
  "@box/eslint-plugin-blueprint": "1.1.6",
21
21
  "react-intl": "^6.4.2"
22
22
  },