@box/unified-share-modal 3.1.32 → 3.1.34

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.
@@ -10,111 +10,109 @@ import { t as ne } from "./shared-with-avatars.js";
10
10
  import { t as re } from "./shield-restriction-notice.js";
11
11
  import { t as ie } from "./text-area-container.js";
12
12
  import { useCallback as o, useEffect as s, useRef as ae, useState as oe } from "react";
13
- import c from "clsx";
14
- import { useIntl as l } from "react-intl";
15
- import { Focusable as u, Modal as d, Text as f, Tooltip as p, useBlueprintModernization as m, useLabelable as h, useNotification as se, useUniqueId as ce } from "@box/blueprint-web";
16
- import { Fragment as le, jsx as g, jsxs as _ } from "react/jsx-runtime";
17
- import { createPortal as ue } from "react-dom";
18
- import { Globe as de } from "@box/blueprint-web-assets/icons/Medium";
13
+ import { useIntl as se } from "react-intl";
14
+ import { Focusable as c, Modal as l, Text as u, Tooltip as d, useLabelable as f, useNotification as p, useUniqueId as m } from "@box/blueprint-web";
15
+ import { Fragment as h, jsx as g, jsxs as _ } from "react/jsx-runtime";
16
+ import { createPortal as ce } from "react-dom";
17
+ import { Globe as le } from "@box/blueprint-web-assets/icons/Medium";
19
18
  import { bpSize040 as v } from "@box/blueprint-web-assets/tokens/tokens";
20
- import { UserSelectorContainer as fe } from "@box/user-selector";
19
+ import { UserSelectorContainer as ue } from "@box/user-selector";
21
20
  import '../styles/collaboration-section.css';var y = {
22
- container: "_container_8nyxi_27",
23
- label: "_label_8nyxi_33",
24
- modernized: "_modernized_8nyxi_40",
25
- security: "_security_8nyxi_69",
26
- disclosures: "_disclosures_8nyxi_73",
27
- icon: "_icon_8nyxi_79",
28
- access: "_access_8nyxi_85"
21
+ container: "_container_1w5nm_27",
22
+ label: "_label_1w5nm_33",
23
+ security: "_security_1w5nm_60",
24
+ disclosures: "_disclosures_1w5nm_64",
25
+ icon: "_icon_1w5nm_70",
26
+ access: "_access_1w5nm_76"
29
27
  };
30
28
  function b() {
31
- let { formatMessage: b } = l(), [x, S] = oe(), { enableModernizedComponents: pe } = m(), { addNotification: me } = se(), { validateShieldRestriction: C } = ee(), { contactValue: w, containerRef: T, form: E, setForm: D, setUserContacts: O, shieldRestriction: k, userContacts: A } = r(), { collaborationAccess: j, collaborationNotices: M, config: N, contactService: P, invitationFormNotices: F, isFetching: I, isSubmitting: L, item: R, onOpenChange: z, sharingService: he, variant: ge } = e(), { permissions: B = {}, type: _e } = R, { getContacts: V, getContactsAvatarUrls: H } = P, { sendInvitations: ve, sendSharedLink: ye } = he, be = ge === "desktop", U = E === "default" || E === "invite", W = E === "invite" || E === "email", xe = E === "invite" && N.collaborationMessage, Se = E === "email" && N.sharedLinkEmailMessage, G = A.some((e) => e.isExternalUser), K, q;
32
- E === "invite" && (K = ve, q = "invite-collaborators"), E === "email" && (K = ye, q = "email-shared-link");
33
- let { errors: Ce, handleFormReset: J, handleFormSubmit: we, handleSelectedUsersChange: Y, handleUserSelectorBlur: Te, updateContactValue: Ee } = te(K, q), X = ae(E === "email" ? "email" : "invite");
29
+ let { formatMessage: b } = se(), [x, S] = oe(), { addNotification: de } = p(), { validateShieldRestriction: fe } = ee(), { contactValue: pe, containerRef: C, form: w, setForm: T, setUserContacts: E, shieldRestriction: D, userContacts: O } = r(), { collaborationAccess: k, collaborationNotices: A, config: j, contactService: M, invitationFormNotices: N, isFetching: P, isSubmitting: F, item: I, onOpenChange: L, sharingService: R, variant: z } = e(), { permissions: B = {}, type: me } = I, { getContacts: V, getContactsAvatarUrls: H } = M, { sendInvitations: he, sendSharedLink: ge } = R, _e = z === "desktop", U = w === "default" || w === "invite", W = w === "invite" || w === "email", ve = w === "invite" && j.collaborationMessage, ye = w === "email" && j.sharedLinkEmailMessage, G = O.some((e) => e.isExternalUser), K, q;
30
+ w === "invite" && (K = he, q = "invite-collaborators"), w === "email" && (K = ge, q = "email-shared-link");
31
+ let { errors: be, handleFormReset: J, handleFormSubmit: xe, handleSelectedUsersChange: Y, handleUserSelectorBlur: Se, updateContactValue: Ce } = te(K, q), X = ae(w === "email" ? "email" : "invite");
34
32
  s(() => {
35
- X.current = E === "email" ? "email" : "invite";
36
- }, [E]), s(() => {
37
- (!A.length || !A.some((e) => e.chipVariant === "error")) && S(null);
38
- }, [A]);
39
- let De = o((e) => (e.stopPropagation(), !0), []), Oe = o((e) => V ? V(e, X.current) : Promise.resolve([]), [V]), ke = o((e) => H ? H(e) : Promise.resolve({}), [H]), Ae = (e) => {
40
- W || D("invite"), Ee(e);
41
- }, je = o((e) => {
33
+ X.current = w === "email" ? "email" : "invite";
34
+ }, [w]), s(() => {
35
+ (!O.length || !O.some((e) => e.chipVariant === "error")) && S(null);
36
+ }, [O]);
37
+ let we = o((e) => (e.stopPropagation(), !0), []), Te = o((e) => V ? V(e, X.current) : Promise.resolve([]), [V]), Ee = o((e) => H ? H(e) : Promise.resolve({}), [H]), De = (e) => {
38
+ W || T("invite"), Ce(e);
39
+ }, Oe = o((e) => {
42
40
  let n = e.clipboardData.getData("text");
43
- t(n).length !== 0 && (e.preventDefault(), W || D("invite"), Y([...A, { value: n }]));
41
+ t(n).length !== 0 && (e.preventDefault(), W || T("invite"), Y([...O, { value: n }]));
44
42
  }, [
45
43
  Y,
46
44
  W,
47
- D,
48
- A
49
- ]), Me = () => {
50
- J(), D("default");
51
- }, Ne = async () => {
45
+ T,
46
+ O
47
+ ]), ke = () => {
48
+ J(), T("default");
49
+ }, Ae = async () => {
52
50
  try {
53
51
  if (x) {
54
- let e = C(A, k);
52
+ let e = fe(O, D);
55
53
  if (e) {
56
- me({
54
+ de({
57
55
  ...n(b, "error"),
58
56
  styledText: e
59
57
  });
60
58
  return;
61
59
  }
62
60
  }
63
- if (await we()) return;
64
- J(), z(!1), D("default");
61
+ if (await xe()) return;
62
+ J(), L(!1), T("default");
65
63
  } catch (e) {
66
64
  if (!e.shieldRestriction) return;
67
- let { shieldRestriction: t } = e, n = [...t.restrictedEmails ?? [], ...t.restrictedGroups ?? []], r = A.map((e) => n.includes(e.email) || n.includes(`${e.id}`) ? {
65
+ let { shieldRestriction: t } = e, n = [...t.restrictedEmails ?? [], ...t.restrictedGroups ?? []], r = O.map((e) => n.includes(e.email) || n.includes(`${e.id}`) ? {
68
66
  ...e,
69
67
  chipVariant: "error"
70
68
  } : e);
71
- S(t), O(r);
69
+ S(t), E(r);
72
70
  }
73
71
  }, Z, Q = !1;
74
- U && !B.canInviteCollaborator && (Z = b(i.inviteDisabledTooltip), Q = !0), U && _e === "web_link" && (Z = b(i.inviteWebLinkDisabledTooltip), Q = !0);
75
- let $ = ce("usm-UserContacts-"), Pe = h(b(U ? i.invitePeopleLabel : i.emailSharedLinkLabel), $);
72
+ U && !B.canInviteCollaborator && (Z = b(i.inviteDisabledTooltip), Q = !0), U && me === "web_link" && (Z = b(i.inviteWebLinkDisabledTooltip), Q = !0);
73
+ let $ = m("usm-UserContacts-"), je = f(b(U ? i.invitePeopleLabel : i.emailSharedLinkLabel), $);
76
74
  return /* @__PURE__ */ _("form", {
77
75
  className: y.container,
78
76
  onSubmit: (e) => e.preventDefault(),
79
77
  children: [
80
78
  x && /* @__PURE__ */ g(re, {
81
79
  error: x,
82
- isLoading: L,
80
+ isLoading: F,
83
81
  onSelectedUsersChange: Y
84
82
  }),
85
- M,
83
+ A,
86
84
  /* @__PURE__ */ _("div", { children: [
87
- U && N.collaborators && /* @__PURE__ */ g(ne, {}),
88
- /* @__PURE__ */ g(Pe, { className: c(y.label, pe && y.modernized) }),
89
- /* @__PURE__ */ g(p, {
85
+ U && j.collaborators && /* @__PURE__ */ g(ne, {}),
86
+ /* @__PURE__ */ g(je, { className: y.label }),
87
+ /* @__PURE__ */ g(d, {
90
88
  content: Z,
91
89
  "data-testid": "usm-UserContacts-tooltip",
92
90
  open: Z ? void 0 : !1,
93
91
  side: "bottom",
94
- children: /* @__PURE__ */ g(u, {
92
+ children: /* @__PURE__ */ g(c, {
95
93
  focusable: Q,
96
- children: /* @__PURE__ */ g(fe, {
94
+ children: /* @__PURE__ */ g(ue, {
97
95
  autoFocus: B.canInviteCollaborator,
98
96
  className: "usm-UserContacts-input",
99
97
  clearButtonAriaLabel: b(i.clearButton),
100
98
  clearOnBlur: !1,
101
99
  "data-target-id": "PillSelectorDropdown-AddNamesOrEmailAddresses",
102
- disabled: Q || L,
100
+ disabled: Q || F,
103
101
  displayChipVariant: (e) => e.chipVariant,
104
- error: Ce.userContacts,
105
- fetchAvatarUrls: ke,
106
- fetchUsers: Oe,
107
- hideOnEscape: De,
102
+ error: be.userContacts,
103
+ fetchAvatarUrls: Ee,
104
+ fetchUsers: Te,
105
+ hideOnEscape: we,
108
106
  idForLabel: $,
109
- inputValue: w,
107
+ inputValue: pe,
110
108
  label: null,
111
- onBlur: Te,
112
- onInputValueChange: Ae,
113
- onPaste: je,
109
+ onBlur: Se,
110
+ onInputValueChange: De,
111
+ onPaste: Oe,
114
112
  onSelectedUsersChange: Y,
115
- placeholder: A.length ? "" : b(i.invitePeoplePlaceholder),
116
- portalElement: T,
117
- selectedUsers: A,
113
+ placeholder: O.length ? "" : b(i.invitePeoplePlaceholder),
114
+ portalElement: C,
115
+ selectedUsers: O,
118
116
  selectOnEnterOrTab: !0,
119
117
  variant: W ? "textarea" : "input"
120
118
  })
@@ -122,39 +120,39 @@ function b() {
122
120
  }),
123
121
  U && /* @__PURE__ */ _("div", {
124
122
  className: y.access,
125
- children: [N.collaborationRole && /* @__PURE__ */ g(a, {}), j]
123
+ children: [j.collaborationRole && /* @__PURE__ */ g(a, {}), k]
126
124
  })
127
125
  ] }),
128
- (xe || Se) && /* @__PURE__ */ g(ie, { maxCount: N.collaborationMessageLimit }),
129
- W && (G || F) && /* @__PURE__ */ _("div", {
126
+ (ve || ye) && /* @__PURE__ */ g(ie, { maxCount: j.collaborationMessageLimit }),
127
+ W && (G || N) && /* @__PURE__ */ _("div", {
130
128
  className: y.disclosures,
131
129
  children: [G && /* @__PURE__ */ _("div", {
132
130
  className: y.security,
133
- children: [/* @__PURE__ */ g(de, {
131
+ children: [/* @__PURE__ */ g(le, {
134
132
  className: y.icon,
135
133
  height: v,
136
134
  width: v
137
- }), /* @__PURE__ */ g(f, {
135
+ }), /* @__PURE__ */ g(u, {
138
136
  as: "span",
139
137
  color: "textOnLightSecondary",
140
138
  children: b(i.contentSharedWithExternalCollaborators)
141
139
  })]
142
- }), F]
140
+ }), N]
143
141
  }),
144
- W && T && /*#__PURE__*/ ue(/* @__PURE__ */ _(le, { children: [!I && /* @__PURE__ */ _(d.Footer, { children: [/* @__PURE__ */ g(d.Footer.SecondaryButton, {
145
- disabled: L,
146
- onClick: Me,
142
+ W && C && /*#__PURE__*/ ce(/* @__PURE__ */ _(h, { children: [!P && /* @__PURE__ */ _(l.Footer, { children: [/* @__PURE__ */ g(l.Footer.SecondaryButton, {
143
+ disabled: F,
144
+ onClick: ke,
147
145
  children: b(i.cancelButton)
148
- }), /* @__PURE__ */ g(d.Footer.PrimaryButton, {
146
+ }), /* @__PURE__ */ g(l.Footer.PrimaryButton, {
149
147
  "data-target-id": "Modal.Footer.PrimaryButton-USMSendInvite",
150
- loading: L,
148
+ loading: F,
151
149
  loadingAriaLabel: b(i.loadingLabel),
152
- onClick: Ne,
150
+ onClick: Ae,
153
151
  children: b(i.sendButton)
154
- })] }), !be && /* @__PURE__ */ g(d.Close, {
152
+ })] }), !_e && /* @__PURE__ */ g(l.Close, {
155
153
  "aria-label": b(i.closeButton),
156
- disabled: L
157
- })] }), T)
154
+ disabled: F
155
+ })] }), C)
158
156
  ]
159
157
  });
160
158
  }
@@ -1 +1 @@
1
- ._container_8nyxi_27{gap:var(--bp-space-040);flex-direction:column;display:flex}._label_8nyxi_33{padding:var(--bp-space-010) 0;color:var(--text-text-on-light);overflow-wrap:break-word;margin-block-end:var(--space-2);display:block}._label_8nyxi_33._modernized_8nyxi_40{font-weight:var(--bp-font-weight-bold);font-size:var(--bp-font-size-05);font-family:var(--bp-font-font-family), -apple-system, BlinkMacSystemFont, "San Francisco", "Segoe UI", Roboto, "Helvetica Neue", sans-serif;font-style:normal;line-height:var(--bp-font-line-height-04);letter-spacing:var(--bp-font-letter-spacing-01)}:where(body.is-inter-font) ._label_8nyxi_33._modernized_8nyxi_40{letter-spacing:0;text-transform:none;font-family:InterVariable,-apple-system,BlinkMacSystemFont,San Francisco,Segoe UI,Roboto,Helvetica Neue,sans-serif;font-size:.875rem;font-style:normal;font-weight:600;line-height:1.25rem;text-decoration:none}._label_8nyxi_33:not(._modernized_8nyxi_40){font-weight:var(--body-default-bold-font-weight);font-size:var(--body-default-bold-font-size);font-family:var(--body-default-bold-font-family);line-height:var(--body-default-bold-line-height);letter-spacing:var(--body-default-bold-letter-spacing);text-transform:var(--body-default-bold-text-case);-webkit-text-decoration:var(--body-default-bold-text-decoration);text-decoration:var(--body-default-bold-text-decoration)}._security_8nyxi_69{margin-top:calc(var(--bp-space-010) * -1)}._disclosures_8nyxi_73{gap:var(--bp-space-010);flex-direction:column;display:flex}._icon_8nyxi_79{height:var(--bp-size-050);margin-right:var(--bp-space-010);vertical-align:text-bottom}._access_8nyxi_85{gap:var(--bp-space-010);margin-top:var(--bp-space-030);flex-wrap:wrap;display:flex}
1
+ ._container_1w5nm_27{gap:var(--bp-space-040);flex-direction:column;display:flex}._label_1w5nm_33{font-weight:var(--bp-font-weight-bold);font-size:var(--bp-font-size-05);font-family:var(--bp-font-font-family), -apple-system, BlinkMacSystemFont, "San Francisco", "Segoe UI", Roboto, "Helvetica Neue", sans-serif;font-style:normal;line-height:var(--bp-font-line-height-04);letter-spacing:var(--bp-font-letter-spacing-01)}:where(body.is-inter-font) ._label_1w5nm_33{letter-spacing:0;text-transform:none;font-family:InterVariable,-apple-system,BlinkMacSystemFont,San Francisco,Segoe UI,Roboto,Helvetica Neue,sans-serif;font-size:.875rem;font-style:normal;font-weight:600;line-height:1.25rem;text-decoration:none}._label_1w5nm_33{padding:var(--bp-space-010) 0;color:var(--text-text-on-light);overflow-wrap:break-word;margin-block-end:var(--space-2);display:block}._security_1w5nm_60{margin-top:calc(var(--bp-space-010) * -1)}._disclosures_1w5nm_64{gap:var(--bp-space-010);flex-direction:column;display:flex}._icon_1w5nm_70{height:var(--bp-size-050);margin-right:var(--bp-space-010);vertical-align:text-bottom}._access_1w5nm_76{gap:var(--bp-space-010);margin-top:var(--bp-space-030);flex-wrap:wrap;display:flex}
package/package.json CHANGED
@@ -1,23 +1,23 @@
1
1
  {
2
2
  "name": "@box/unified-share-modal",
3
- "version": "3.1.32",
3
+ "version": "3.1.34",
4
4
  "license": "SEE LICENSE IN LICENSE",
5
5
  "peerDependencies": {
6
- "@box/blueprint-web": "^16.10.0",
7
- "@box/blueprint-web-assets": "^5.5.5",
8
- "@box/copy-input": "^2.1.30",
9
- "@box/user-selector": "^2.1.32",
6
+ "@box/blueprint-web": "^16.11.0",
7
+ "@box/blueprint-web-assets": "^5.5.6",
8
+ "@box/copy-input": "^2.1.31",
9
+ "@box/user-selector": "^2.1.34",
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": "^16.10.0",
17
- "@box/blueprint-web-assets": "^5.5.5",
18
- "@box/copy-input": "^2.1.30",
16
+ "@box/blueprint-web": "^16.11.0",
17
+ "@box/blueprint-web-assets": "^5.5.6",
18
+ "@box/copy-input": "^2.1.31",
19
19
  "@box/eslint-plugin-blueprint": "2.1.10",
20
- "@box/storybook-utils": "1.1.29",
20
+ "@box/storybook-utils": "1.1.30",
21
21
  "react-intl": "^6.4.2"
22
22
  },
23
23
  "publishConfig": {