@box/unified-share-modal 2.10.5 → 2.11.1

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