@box/unified-share-modal 2.4.2 → 2.6.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.
@@ -1,12 +1,12 @@
1
1
  import w from "lodash/camelCase";
2
- import { useState as F, useMemo as z, useEffect as B } from "react";
2
+ import { useState as B, useMemo as F, useEffect as z } from "react";
3
3
  import { useIntl as H } from "react-intl";
4
- import { Tooltip as O, Focusable as $, TriggerButton as M, DropdownMenu as o } from "@box/blueprint-web";
5
- import A from "../messages.js";
4
+ import { Tooltip as O, Focusable as P, TriggerButton as D, DropdownMenu as o } from "@box/blueprint-web";
5
+ import $ from "../messages.js";
6
6
  import n from "./messages.js";
7
7
  import { jsx as t, jsxs as f } from "react/jsx-runtime";
8
- import { isInvitationRoleSupported as E, getDefaultCollaborationRole as U } from "../../../utils/collaborator.js";
9
- import { useUnifiedShareFormContext as P } from "../../../contexts/unified-share-form-context.js";
8
+ import { isInvitationRoleSupported as A, getDefaultCollaborationRole as E } from "../../../utils/collaborator.js";
9
+ import { useUnifiedShareFormContext as U } from "../../../contexts/unified-share-form-context.js";
10
10
  import { useUnifiedShareModalContext as W } from "../../../contexts/unified-share-modal-context.js";
11
11
  import '../../../../../styles/collaboration-role.css';const q = "_button_jl1fl_1", G = "_focusable_jl1fl_10", J = "_content_jl1fl_14", K = "_option_jl1fl_17", a = {
12
12
  button: q,
@@ -14,13 +14,13 @@ import '../../../../../styles/collaboration-role.css';const q = "_button_jl1fl_1
14
14
  content: J,
15
15
  option: K
16
16
  };
17
- function ie() {
17
+ function le() {
18
18
  const {
19
19
  formatMessage: e
20
- } = H(), [g, x] = F(!1), {
20
+ } = H(), [g, x] = B(!1), {
21
21
  collaborationRole: h,
22
22
  setCollaborationRole: m
23
- } = P(), {
23
+ } = U(), {
24
24
  collaborationRoles: C,
25
25
  eventService: T,
26
26
  isSubmitting: j,
@@ -30,29 +30,29 @@ function ie() {
30
30
  permissions: y = {},
31
31
  type: p
32
32
  } = k, {
33
- onCollaborationRoleChange: S
34
- } = T, _ = L === "desktop", r = z(() => C.map((i) => {
33
+ onCollaborationRoleChange: v
34
+ } = T, S = L === "desktop", r = F(() => C.map((l) => {
35
35
  const {
36
- description: b,
37
- id: l,
36
+ description: u,
37
+ id: i,
38
38
  label: s
39
- } = i, u = E(l), d = w(l);
39
+ } = l, b = A(i), d = w(i);
40
40
  let R = d;
41
- l === "editor" && p === "folder" && (R += "Folder");
42
- let D = l, I = "";
43
- return u && (D = e(A[`${d}Role`]), I = e(n[`${R}Description`])), {
44
- ...i,
45
- description: b ?? I,
46
- label: s ?? D
41
+ i === "editor" && p === "folder" && (R += "Folder");
42
+ let I = i, M = "";
43
+ return b && (I = e($[`${d}Role`]), M = e(n[`${R}Description`])), {
44
+ ...l,
45
+ description: u ?? M,
46
+ label: s ?? I
47
47
  };
48
48
  }), [C, e, p]);
49
- if (B(() => {
50
- m(U(r));
49
+ if (z(() => {
50
+ m(E(r));
51
51
  }, [r, m]), !r.length || !h)
52
52
  return null;
53
53
  const {
54
54
  id: N,
55
- label: v
55
+ label: _
56
56
  } = h;
57
57
  let c;
58
58
  return y.canInviteCollaborator || (c = e(n.inviteDisabledTooltip)), p === "web_link" && (c = e(n.inviteWebLinkDisabledTooltip)), c ? /* @__PURE__ */ t(O, {
@@ -60,31 +60,32 @@ function ie() {
60
60
  content: c,
61
61
  "data-testid": "collaboration-role-tooltip",
62
62
  side: "bottom",
63
- children: /* @__PURE__ */ t($, {
63
+ children: /* @__PURE__ */ t(P, {
64
64
  className: a.focusable,
65
- children: /* @__PURE__ */ t(M, {
65
+ children: /* @__PURE__ */ t(D, {
66
66
  caretDirection: "down",
67
67
  className: a.button,
68
68
  disabled: !0,
69
69
  label: e(n.inviteAsRoleLabel, {
70
- role: v
70
+ role: _
71
71
  }),
72
72
  size: "extraSmall",
73
73
  variant: "tertiary"
74
74
  })
75
75
  })
76
76
  }) : /* @__PURE__ */ f(o.Root, {
77
- isFullScreenEnabled: _,
77
+ isFullScreenEnabled: S,
78
78
  menuItemsSize: "medium",
79
79
  onOpenChange: x,
80
80
  open: g,
81
81
  children: [/* @__PURE__ */ t(o.Trigger, {
82
- children: /* @__PURE__ */ t(M, {
82
+ children: /* @__PURE__ */ t(D, {
83
83
  caretDirection: g ? "up" : "down",
84
84
  className: a.button,
85
+ "data-target-id": "PlainButton-InviteePermissionsMenuToggle",
85
86
  disabled: j,
86
87
  label: e(n.inviteAsRoleLabel, {
87
- role: v
88
+ role: _
88
89
  }),
89
90
  size: "extraSmall",
90
91
  variant: "tertiary"
@@ -92,29 +93,29 @@ function ie() {
92
93
  }), /* @__PURE__ */ f(o.Content, {
93
94
  align: "start",
94
95
  className: a.content,
95
- children: [_ && /* @__PURE__ */ f(o.Header, {
96
+ children: [S && /* @__PURE__ */ f(o.Header, {
96
97
  children: [/* @__PURE__ */ t(o.Header.TextContent, {
97
98
  title: e(n.invitePeopleLabel)
98
99
  }), /* @__PURE__ */ t(o.Header.MenuCloseButton, {
99
100
  "aria-label": e(n.closeButton)
100
101
  })]
101
- }), r.map((i) => {
102
+ }), r.map((l) => {
102
103
  const {
103
- description: b,
104
- isDisabled: l,
104
+ description: u,
105
+ isDisabled: i,
105
106
  id: s,
106
- label: u
107
- } = i, d = () => {
108
- m(i), S && S(s);
107
+ label: b
108
+ } = l, d = () => {
109
+ m(l), v && v(s);
109
110
  };
110
111
  return /* @__PURE__ */ t(o.CheckboxItem, {
111
112
  checked: N === s,
112
- disabled: l,
113
+ disabled: i,
113
114
  onSelect: d,
114
115
  children: /* @__PURE__ */ t(o.Item.MainContent, {
115
- caption: b,
116
+ caption: u,
116
117
  className: a.option,
117
- label: u
118
+ label: b
118
119
  })
119
120
  }, s);
120
121
  })]
@@ -122,5 +123,5 @@ function ie() {
122
123
  });
123
124
  }
124
125
  export {
125
- ie as CollaborationRole
126
+ le as CollaborationRole
126
127
  };
@@ -1,24 +1,24 @@
1
- import he from "clsx";
2
- import { useState as pe, useRef as fe, useEffect as R, useCallback as C } from "react";
1
+ import pe from "clsx";
2
+ import { useState as he, useRef as fe, useEffect as P, useCallback as C } from "react";
3
3
  import { createPortal as be } from "react-dom";
4
4
  import { useIntl as ge } from "react-intl";
5
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
6
  import { Globe as xe } from "@box/blueprint-web-assets/icons/Medium";
7
- import { bpSize040 as P } from "@box/blueprint-web-assets/tokens/tokens";
7
+ import { bpSize040 as R } from "@box/blueprint-web-assets/tokens/tokens";
8
8
  import { UserSelectorContainer as ye } from "@box/user-selector";
9
9
  import { CollaborationRole as Ee } from "./collaboration-role.js";
10
- import { SharedWithAvatars as Be } from "./shared-with-avatars.js";
11
- import { ShieldRestrictionNotice as Ae } from "./shield-restriction-notice.js";
10
+ import { SharedWithAvatars as Ae } from "./shared-with-avatars.js";
11
+ import { ShieldRestrictionNotice as Be } from "./shield-restriction-notice.js";
12
12
  import { TextAreaContainer as Ne } from "./text-area-container.js";
13
13
  import o from "./messages.js";
14
- import { jsxs as l, jsx as r, Fragment as Re } from "react/jsx-runtime";
15
- import { useFormValidation as Pe } from "../../../hooks/use-form-validation.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";
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
- import { useUnifiedShareModalContext as Ie } from "../../../contexts/unified-share-modal-context.js";
19
- import { parseEmails as Te } from "../../../utils/email.js";
20
- import '../../../../../styles/collaboration-section.css';const De = "_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: De,
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
22
  label: Me,
23
23
  modernized: ze,
24
24
  security: Oe,
@@ -28,24 +28,24 @@ import '../../../../../styles/collaboration-section.css';const De = "_container_
28
28
  function lt() {
29
29
  const {
30
30
  formatMessage: t
31
- } = ge(), [S, y] = pe(), {
31
+ } = ge(), [S, y] = he(), {
32
32
  enableModernizedComponents: k
33
33
  } = Ce(), {
34
34
  addNotification: V
35
35
  } = ve(), {
36
- validateShieldRestriction: I
37
- } = Pe(), {
38
- contactValue: T,
36
+ validateShieldRestriction: D
37
+ } = Re(), {
38
+ contactValue: I,
39
39
  containerRef: U,
40
40
  form: n,
41
41
  setForm: d,
42
- setUserContacts: D,
42
+ setUserContacts: T,
43
43
  shieldRestriction: M,
44
44
  userContacts: i
45
45
  } = Ve(), {
46
46
  collaborationAccess: z,
47
47
  collaborationNotices: O,
48
- config: h,
48
+ config: p,
49
49
  contactService: w,
50
50
  isFetching: W,
51
51
  isSubmitting: m,
@@ -53,7 +53,7 @@ function lt() {
53
53
  onOpenChange: G,
54
54
  sharingService: q,
55
55
  variant: K
56
- } = Ie(), {
56
+ } = De(), {
57
57
  permissions: $ = {},
58
58
  type: H
59
59
  } = j, {
@@ -69,28 +69,28 @@ function lt() {
69
69
  errors: X,
70
70
  handleFormReset: E,
71
71
  handleFormSubmit: Y,
72
- handleSelectedUsersChange: p,
72
+ handleSelectedUsersChange: h,
73
73
  handleUserSelectorBlur: Z,
74
74
  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), B = fe(n === "email" ? "email" : "invite");
76
- R(() => {
77
- B.current = n === "email" ? "email" : "invite";
78
- }, [n]), R(() => {
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
79
  (!i.length || !i.some((e) => e.chipVariant === "error")) && y(null);
80
80
  }, [i]);
81
- const re = C((e) => (e.stopPropagation(), !0), []), ie = C((e) => _ ? _(e, B.current) : Promise.resolve([]), [_]), ne = C((e) => F ? F(e) : Promise.resolve({}), [F]), ae = (e) => {
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
82
  a || d("invite"), ee(e);
83
83
  }, se = C((e) => {
84
84
  const s = e.clipboardData.getData("text");
85
- Te(s).length !== 0 && (e.preventDefault(), a || d("invite"), p([...i, {
85
+ Ie(s).length !== 0 && (e.preventDefault(), a || d("invite"), h([...i, {
86
86
  value: s
87
87
  }]));
88
- }, [p, a, d, i]), le = () => {
88
+ }, [h, a, d, i]), le = () => {
89
89
  E(), d("default");
90
90
  }, ce = async () => {
91
91
  try {
92
92
  if (S) {
93
- const e = I(i, M);
93
+ const e = D(i, M);
94
94
  if (e) {
95
95
  V({
96
96
  closeButtonAriaLabel: t(o.closeButton),
@@ -114,22 +114,22 @@ function lt() {
114
114
  ...g,
115
115
  chipVariant: "error"
116
116
  } : g);
117
- y(s), D(ue);
117
+ y(s), T(ue);
118
118
  }
119
119
  };
120
120
  let f, b = !1;
121
121
  u && !$.canInviteCollaborator && (f = t(o.inviteDisabledTooltip), b = !0), u && H === "web_link" && (f = t(o.inviteWebLinkDisabledTooltip), b = !0);
122
- const A = Se("user-contacts-"), de = t(u ? o.invitePeopleLabel : o.emailSharedLinkLabel), me = Ue(de, A);
122
+ const B = Se("user-contacts-"), de = t(u ? o.invitePeopleLabel : o.emailSharedLinkLabel), me = Ue(de, B);
123
123
  return /* @__PURE__ */ l("form", {
124
124
  className: c.container,
125
125
  onSubmit: (e) => e.preventDefault(),
126
- children: [S && /* @__PURE__ */ r(Ae, {
126
+ children: [S && /* @__PURE__ */ r(Be, {
127
127
  error: S,
128
128
  isLoading: m,
129
- onSelectedUsersChange: p
129
+ onSelectedUsersChange: h
130
130
  }), O, /* @__PURE__ */ l("div", {
131
- children: [u && h.collaborators && /* @__PURE__ */ r(Be, {}), /* @__PURE__ */ r(me, {
132
- className: he(c.label, k && c.modernized)
131
+ children: [u && p.collaborators && /* @__PURE__ */ r(Ae, {}), /* @__PURE__ */ r(me, {
132
+ className: pe(c.label, k && c.modernized)
133
133
  }), /* @__PURE__ */ r(_e, {
134
134
  content: f,
135
135
  "data-testid": "user-contacts-tooltip",
@@ -141,19 +141,20 @@ function lt() {
141
141
  className: "collaboration-user-selector",
142
142
  clearButtonAriaLabel: t(o.clearButton),
143
143
  clearOnBlur: !1,
144
+ "data-target-id": "PillSelectorDropdown-AddNamesOrEmailAddresses",
144
145
  disabled: b || m,
145
146
  displayChipVariant: (e) => e.chipVariant,
146
147
  error: X["user-contact"],
147
148
  fetchAvatarUrls: ne,
148
149
  fetchUsers: ie,
149
150
  hideOnEscape: re,
150
- idForLabel: A,
151
- inputValue: T,
151
+ idForLabel: B,
152
+ inputValue: I,
152
153
  label: null,
153
154
  onBlur: Z,
154
155
  onInputValueChange: ae,
155
156
  onPaste: se,
156
- onSelectedUsersChange: p,
157
+ onSelectedUsersChange: h,
157
158
  placeholder: i.length ? "" : t(o.invitePeoplePlaceholder),
158
159
  portalElement: U,
159
160
  selectedUsers: i,
@@ -163,22 +164,22 @@ function lt() {
163
164
  })
164
165
  }), u && /* @__PURE__ */ l("div", {
165
166
  className: c.access,
166
- children: [h.collaborationRole && /* @__PURE__ */ r(Ee, {}), z]
167
+ children: [p.collaborationRole && /* @__PURE__ */ r(Ee, {}), z]
167
168
  })]
168
- }), a && h.collaborationMessage && /* @__PURE__ */ r(Ne, {
169
- maxCount: h.collaborationMessageLimit
169
+ }), a && p.collaborationMessage && /* @__PURE__ */ r(Ne, {
170
+ maxCount: p.collaborationMessageLimit
170
171
  }), a && oe && /* @__PURE__ */ l("div", {
171
172
  className: c.security,
172
173
  children: [/* @__PURE__ */ r(xe, {
173
174
  className: c.icon,
174
- height: P,
175
- width: P
175
+ height: R,
176
+ width: R
176
177
  }), /* @__PURE__ */ r(Le, {
177
178
  as: "span",
178
179
  color: "textOnLightSecondary",
179
180
  children: t(o.contentSharedWithExternalCollaborators)
180
181
  })]
181
- }), a && U && /* @__PURE__ */ be(/* @__PURE__ */ l(Re, {
182
+ }), a && U && /* @__PURE__ */ be(/* @__PURE__ */ l(Pe, {
182
183
  children: [!W && /* @__PURE__ */ l(v.Footer, {
183
184
  children: [/* @__PURE__ */ r(v.Footer.SecondaryButton, {
184
185
  disabled: m,
@@ -1,8 +1,8 @@
1
1
  import { useState as y } from "react";
2
2
  import { useIntl as T } from "react-intl";
3
- import { DropdownMenu as e, TriggerButton as N, Tooltip as w, Focusable as B } from "@box/blueprint-web";
3
+ import { DropdownMenu as e, TriggerButton as B, Tooltip as N, Focusable as w } from "@box/blueprint-web";
4
4
  import i from "./messages.js";
5
- import { jsxs as r, jsx as t } from "react/jsx-runtime";
5
+ import { jsxs as a, jsx as t } from "react/jsx-runtime";
6
6
  import { useUnifiedShareModalContext as D } from "../../../contexts/unified-share-modal-context.js";
7
7
  import { useSharingAction as H } from "../../../hooks/use-sharing-action.js";
8
8
  import { useAccessLevels as O } from "../../../hooks/use-access-levels.js";
@@ -14,71 +14,72 @@ import '../../../../../styles/shared-link-access.css';const j = "_button_166my_1
14
14
  function Q() {
15
15
  const {
16
16
  formatMessage: s
17
- } = T(), [a, h] = y(!1), {
17
+ } = T(), [r, h] = y(!1), {
18
18
  isSubmitting: b,
19
- item: f,
20
- sharedLink: S,
19
+ item: S,
20
+ sharedLink: f,
21
21
  sharingService: g,
22
22
  variant: k
23
23
  } = D(), {
24
- permissions: C = {}
25
- } = f, {
26
- access: L
24
+ permissions: L = {}
27
25
  } = S, {
28
- changeSharedLinkAccess: _
26
+ access: C
27
+ } = f, {
28
+ changeSharedLinkAccess: A
29
29
  } = g, l = k === "desktop", {
30
- onAction: x
31
- } = H(_), {
30
+ onAction: M
31
+ } = H(A), {
32
32
  allowedLevels: d,
33
33
  selectedAccess: m
34
34
  } = O();
35
35
  if (!d.length || !m)
36
36
  return null;
37
37
  const {
38
- label: A
38
+ label: _
39
39
  } = m;
40
- return /* @__PURE__ */ r(e.Root, {
40
+ return /* @__PURE__ */ a(e.Root, {
41
41
  isFullScreenEnabled: l,
42
42
  menuItemsSize: "medium",
43
43
  onOpenChange: h,
44
- open: a,
44
+ open: r,
45
45
  children: [/* @__PURE__ */ t(e.Trigger, {
46
- children: /* @__PURE__ */ t(N, {
47
- caretDirection: a ? "up" : "down",
46
+ children: /* @__PURE__ */ t(B, {
47
+ caretDirection: r ? "up" : "down",
48
48
  className: o.button,
49
- disabled: !C.canSetShareAccess || b,
50
- label: A,
49
+ "data-target-id": "Button-SharedLinkAccessMenuLabel",
50
+ disabled: !L.canSetShareAccess || b,
51
+ label: _,
51
52
  size: "extraSmall",
52
53
  variant: "tertiary"
53
54
  })
54
- }), /* @__PURE__ */ r(e.Content, {
55
+ }), /* @__PURE__ */ a(e.Content, {
55
56
  align: "start",
56
57
  className: o.content,
57
- children: [l && /* @__PURE__ */ r(e.Header, {
58
+ children: [l && /* @__PURE__ */ a(e.Header, {
58
59
  children: [/* @__PURE__ */ t(e.Header.TextContent, {
59
60
  title: s(i.shareLinkLabel)
60
61
  }), /* @__PURE__ */ t(e.Header.MenuCloseButton, {
61
62
  "aria-label": s(i.closeButton)
62
63
  })]
63
- }), d.map((M) => {
64
+ }), d.map((x) => {
64
65
  const {
65
- description: p,
66
+ description: u,
66
67
  disabledReason: I,
67
68
  id: n,
68
- label: u
69
- } = M, c = L === n, v = () => {
70
- c || x(n);
69
+ label: p
70
+ } = x, c = C === n, v = () => {
71
+ c || M(n);
71
72
  };
72
- return I ? /* @__PURE__ */ t(w, {
73
+ return I ? /* @__PURE__ */ t(N, {
73
74
  content: s(i.disabledAccessLevelTooltip),
74
- children: /* @__PURE__ */ t(B, {
75
+ children: /* @__PURE__ */ t(w, {
75
76
  children: /* @__PURE__ */ t(e.CheckboxItem, {
76
77
  checked: c,
77
78
  disabled: !0,
78
79
  children: /* @__PURE__ */ t(e.Item.MainContent, {
79
- caption: p,
80
+ caption: u,
80
81
  className: o.option,
81
- label: u
82
+ label: p
82
83
  })
83
84
  }, n)
84
85
  })
@@ -86,9 +87,9 @@ function Q() {
86
87
  checked: c,
87
88
  onSelect: v,
88
89
  children: /* @__PURE__ */ t(e.Item.MainContent, {
89
- caption: p,
90
+ caption: u,
90
91
  className: o.option,
91
- label: u
92
+ label: p
92
93
  })
93
94
  }, n);
94
95
  })]
@@ -1,10 +1,10 @@
1
- import { useState as I } from "react";
2
- import { useIntl as O } from "react-intl";
3
- import { Tooltip as B, Focusable as D, TriggerButton as f, DropdownMenu as t } from "@box/blueprint-web";
4
- import { FILE_EXTENSION_BOX_NOTE as w } from "../../../constants.js";
1
+ import { useState as E } from "react";
2
+ import { useIntl as I } from "react-intl";
3
+ import { Tooltip as O, Focusable as D, TriggerButton as f, DropdownMenu as t } from "@box/blueprint-web";
4
+ import { FILE_EXTENSION_BOX_NOTE as P } from "../../../constants.js";
5
5
  import r from "./messages.js";
6
6
  import { jsx as e, jsxs as a } from "react/jsx-runtime";
7
- import { usePermissionLevels as P } from "../../../hooks/use-permission-levels.js";
7
+ import { usePermissionLevels as w } from "../../../hooks/use-permission-levels.js";
8
8
  import { useUnifiedShareModalContext as A } from "../../../contexts/unified-share-modal-context.js";
9
9
  import { useSharingAction as F } from "../../../hooks/use-sharing-action.js";
10
10
  import '../../../../../styles/shared-link-access.css';const H = "_button_166my_1", j = "_content_166my_9", z = "_option_166my_12", n = {
@@ -15,34 +15,34 @@ import '../../../../../styles/shared-link-access.css';const H = "_button_166my_1
15
15
  function W() {
16
16
  const {
17
17
  formatMessage: o
18
- } = O(), [l, g] = I(!1), {
18
+ } = I(), [l, g] = E(!1), {
19
19
  isSubmitting: S,
20
20
  item: c,
21
21
  sharedLink: _,
22
- sharingService: x,
22
+ sharingService: L,
23
23
  variant: k
24
24
  } = A(), {
25
- permissions: L = {}
25
+ permissions: x = {}
26
26
  } = c, {
27
- access: C,
28
- permission: m
27
+ access: M,
28
+ permission: d
29
29
  } = _, {
30
- changeSharedLinkPermission: M
31
- } = x, d = k === "desktop", {
30
+ changeSharedLinkPermission: C
31
+ } = L, m = k === "desktop", {
32
32
  onAction: N
33
- } = F(M), {
33
+ } = F(C), {
34
34
  allowedLevels: p,
35
35
  selectedPermission: u
36
- } = P();
37
- if (C === "collaborators" || !p.length || !u)
36
+ } = w();
37
+ if (M === "collaborators" || !p.length || !u)
38
38
  return null;
39
39
  const {
40
40
  label: h
41
41
  } = u;
42
- let s = "";
43
- return c.extension === w && m === "can_edit" && (s = o(r.canEditBoxNoteDisabledTooltip)), s ? /* @__PURE__ */ e(B, {
42
+ let i = "";
43
+ return c.extension === P && d === "can_edit" && (i = o(r.canEditBoxNoteDisabledTooltip)), i ? /* @__PURE__ */ e(O, {
44
44
  align: "start",
45
- content: s,
45
+ content: i,
46
46
  "data-testid": "shared-link-permission-tooltip",
47
47
  side: "bottom",
48
48
  children: /* @__PURE__ */ e(D, {
@@ -56,14 +56,15 @@ function W() {
56
56
  })
57
57
  })
58
58
  }) : /* @__PURE__ */ a(t.Root, {
59
- isFullScreenEnabled: d,
59
+ isFullScreenEnabled: m,
60
60
  onOpenChange: g,
61
61
  open: l,
62
62
  children: [/* @__PURE__ */ e(t.Trigger, {
63
63
  children: /* @__PURE__ */ e(f, {
64
64
  caretDirection: l ? "up" : "down",
65
65
  className: n.button,
66
- disabled: !L.canSetShareAccess || S,
66
+ "data-target-id": "Button-SharedLinkPermissionsMenuLabel",
67
+ disabled: !x.canSetShareAccess || S,
67
68
  label: h,
68
69
  size: "extraSmall",
69
70
  variant: "tertiary"
@@ -71,7 +72,7 @@ function W() {
71
72
  }), /* @__PURE__ */ a(t.Content, {
72
73
  align: "start",
73
74
  className: n.content,
74
- children: [d && /* @__PURE__ */ a(t.Header, {
75
+ children: [m && /* @__PURE__ */ a(t.Header, {
75
76
  children: [/* @__PURE__ */ e(t.Header.TextContent, {
76
77
  title: o(r.shareLinkLabel)
77
78
  }), /* @__PURE__ */ e(t.Header.MenuCloseButton, {
@@ -80,20 +81,20 @@ function W() {
80
81
  }), p.map((T) => {
81
82
  const {
82
83
  description: v,
83
- id: i,
84
+ id: s,
84
85
  label: y
85
- } = T, b = m === i, E = () => {
86
- b || N(i);
86
+ } = T, b = d === s, B = () => {
87
+ b || N(s);
87
88
  };
88
89
  return /* @__PURE__ */ e(t.CheckboxItem, {
89
90
  checked: b,
90
- onSelect: E,
91
+ onSelect: B,
91
92
  children: /* @__PURE__ */ e(t.Item.MainContent, {
92
93
  caption: v,
93
94
  className: n.option,
94
95
  label: y
95
96
  })
96
- }, i);
97
+ }, s);
97
98
  })]
98
99
  })]
99
100
  });
@@ -3,7 +3,7 @@ import { useIntl as G } from "react-intl";
3
3
  import { Text as _, Tooltip as A, Focusable as V, Switch as q, Status as H, Link as J, Button as Q } from "@box/blueprint-web";
4
4
  import { ClockBadge as W } from "@box/blueprint-web-assets/icons/Line";
5
5
  import { Mail as X, Globe as j } from "@box/blueprint-web-assets/icons/Medium";
6
- import { SurfaceStatusSurfaceRed as Y, bpSize040 as k } from "@box/blueprint-web-assets/tokens/tokens";
6
+ import { SurfaceStatusSurfaceRed as Y, bpSize040 as g } from "@box/blueprint-web-assets/tokens/tokens";
7
7
  import { CopyInput as Z } from "@box/copy-input";
8
8
  import { SharedLinkAccess as $ } from "./shared-link-access.js";
9
9
  import { SharedLinkPermission as ee } from "./shared-link-permission.js";
@@ -12,8 +12,8 @@ import { jsxs as l, jsx as i } from "react/jsx-runtime";
12
12
  import { useUnifiedShareFormContext as te } from "../../../contexts/unified-share-form-context.js";
13
13
  import { useUnifiedShareModalContext as ie } from "../../../contexts/unified-share-modal-context.js";
14
14
  import { useSharingAction as w } from "../../../hooks/use-sharing-action.js";
15
- import { formatDateFromTimestampToDateString as ne } from "../../../utils/date.js";
16
- import { callOnKeyboardEvent as ae } from "../../../utils/event.js";
15
+ import { formatDateFromTimestampToDateString as ae } from "../../../utils/date.js";
16
+ import { callOnKeyboardEvent as ne } from "../../../utils/event.js";
17
17
  import '../../../../../styles/shared-link-section.css';const oe = "_container_j966c_1", se = "_toggle_j966c_7", re = "_settings_j966c_13", ce = "_copy_j966c_22", le = "_access_j966c_30", de = "_icon_j966c_36", r = {
18
18
  container: oe,
19
19
  toggle: se,
@@ -25,57 +25,57 @@ import '../../../../../styles/shared-link-section.css';const oe = "_container_j9
25
25
  function Te() {
26
26
  const {
27
27
  formatMessage: e
28
- } = G(), g = v(!0), L = v(null), p = v(null), {
28
+ } = G(), k = v(!0), L = v(null), m = v(null), {
29
29
  setForm: I
30
30
  } = te(), {
31
31
  config: s,
32
32
  isFetching: T,
33
- isSubmitting: a,
33
+ isSubmitting: n,
34
34
  item: F,
35
35
  setView: b,
36
36
  sharedLink: o,
37
- sharingService: R
37
+ sharingService: B
38
38
  } = ie(), {
39
- permissions: E = {}
39
+ permissions: P = {}
40
40
  } = F, {
41
- createSharedLink: B
42
- } = R, {
41
+ createSharedLink: R
42
+ } = B, {
43
43
  sharedLinkAutoCopy: d,
44
44
  sharedLinkAutoCreate: y
45
45
  } = s;
46
- let N = "create-shared-link";
47
- d && (N = "auto-copy-shared-link");
46
+ let E = "create-shared-link";
47
+ d && (E = "auto-copy-shared-link");
48
48
  const {
49
49
  onAction: S
50
- } = w(B, N), n = !!o.url, [C, M] = K(!1), u = x(async () => {
51
- n || (await S(), M(!0));
52
- }, [n, S]), O = x(async () => (u(), new Promise((c) => {
53
- p.current = {
50
+ } = w(R, E), a = !!o.url, [C, M] = K(!1), p = x(async () => {
51
+ a || (await S(), M(!0));
52
+ }, [a, S]), O = x(async () => (p(), new Promise((c) => {
53
+ m.current = {
54
54
  resolve: c
55
55
  };
56
- })), [u]), {
57
- onAction: P
56
+ })), [p]), {
57
+ onAction: N
58
58
  } = w(O, "auto-copy-shared-link");
59
59
  D(() => {
60
- !g.current || T || (d ? P() : y && u(), g.current = !1);
61
- }, [T, g, d, y, u, P]), D(() => {
62
- n && d && !a && L.current && L.current.click();
63
- }, [n, a, d]);
64
- const U = x((m) => {
65
- if (!p.current)
60
+ !k.current || T || (d ? N() : y && p(), k.current = !1);
61
+ }, [T, k, d, y, p, N]), D(() => {
62
+ a && d && !n && L.current && L.current.click();
63
+ }, [a, n, d]);
64
+ const U = x((u) => {
65
+ if (!m.current)
66
66
  return;
67
67
  let c;
68
- m instanceof Error ? c = C ? e(t.autoCreateCopyErrorNoticeText) : null : c = e(C ? t.autoCreateCopySuccessNoticeText : t.autoCopySuccessNoticeText), c && p.current.resolve({
68
+ u instanceof Error ? c = C ? e(t.autoCreateCopyErrorNoticeText) : null : c = e(C ? t.autoCreateCopySuccessNoticeText : t.autoCopySuccessNoticeText), c && m.current.resolve({
69
69
  messages: [{
70
70
  text: c,
71
71
  type: "success"
72
72
  }]
73
- }), p.current = null;
74
- }, [e, C]), z = async (m) => {
75
- m || b("remove-shared-link"), m && await S();
73
+ }), m.current = null;
74
+ }, [e, C]), z = async (u) => {
75
+ u || b("remove-shared-link"), u && await S();
76
76
  };
77
77
  let h, f = !1;
78
- return !n && !a && (h = e(t.sharedLinkToggleTooltip)), !n && !E.canShare && (h = e(t.createLinkDisabledTooltip), f = !0), n && !E.canSetShareAccess && (h = e(t.removeLinkDisabledTooltip), f = !0), /* @__PURE__ */ l("div", {
78
+ return !a && !n && (h = e(t.sharedLinkToggleTooltip)), !a && !P.canShare && (h = e(t.createLinkDisabledTooltip), f = !0), a && !P.canSetShareAccess && (h = e(t.removeLinkDisabledTooltip), f = !0), /* @__PURE__ */ l("div", {
79
79
  className: r.container,
80
80
  children: [/* @__PURE__ */ i(_, {
81
81
  as: "label",
@@ -91,16 +91,17 @@ function Te() {
91
91
  children: /* @__PURE__ */ i(V, {
92
92
  focusable: f,
93
93
  children: /* @__PURE__ */ i(q.Item, {
94
- checked: n,
95
- disabled: f || a,
94
+ checked: a,
95
+ "data-target-id": "Toggle-CreateSharedLink",
96
+ disabled: f || n,
96
97
  label: e(t.sharedLinkToggleLabel),
97
98
  onCheckedChange: z,
98
99
  value: "shared-link"
99
100
  })
100
101
  })
101
- }), n && !!o.expiresAt && /* @__PURE__ */ i(A, {
102
+ }), a && !!o.expiresAt && /* @__PURE__ */ i(A, {
102
103
  content: e(t.expirationIconTooltip, {
103
- expirationDate: ne(o.expiresAt)
104
+ expirationDate: ae(o.expiresAt)
104
105
  }),
105
106
  "data-testid": "expiration-date-tooltip",
106
107
  children: /* @__PURE__ */ i(H, {
@@ -109,25 +110,27 @@ function Te() {
109
110
  icon: W,
110
111
  text: e(t.expirationIconLabel)
111
112
  })
112
- }), n && s.sharedLinkSettings && /* @__PURE__ */ i(J, {
113
- "aria-disabled": a,
113
+ }), a && s.sharedLinkSettings && /* @__PURE__ */ i(J, {
114
+ "aria-disabled": n,
114
115
  "aria-haspopup": "dialog",
115
116
  className: r.settings,
117
+ "data-target-id": "PlainButton-SharedLinkSettings",
116
118
  onClick: () => b("shared-link-settings"),
117
- onKeyDown: ae(() => b("shared-link-settings"), {
119
+ onKeyDown: ne(() => b("shared-link-settings"), {
118
120
  canPreventDefault: !0
119
121
  }),
120
122
  role: "button",
121
- tabIndex: a ? -1 : 0,
123
+ tabIndex: n ? -1 : 0,
122
124
  variant: "standalone",
123
125
  children: e(t.sharedLinkSettingsLabel)
124
126
  })]
125
- }), n && /* @__PURE__ */ l("div", {
127
+ }), a && /* @__PURE__ */ l("div", {
126
128
  className: r.copy,
127
129
  children: [/* @__PURE__ */ i(Z, {
128
130
  ref: L,
129
- autoFocus: y && n,
130
- disabled: a,
131
+ autoFocus: y && a,
132
+ "data-target-id": "Button-CopySharedLink",
133
+ disabled: n,
131
134
  hideLabel: !0,
132
135
  label: e(t.sharedLinkUrlLabel),
133
136
  onCopy: U,
@@ -137,31 +140,32 @@ function Te() {
137
140
  content: e(t.sharedLinkEmailLabel),
138
141
  children: /* @__PURE__ */ i(Q, {
139
142
  "aria-label": e(t.sharedLinkEmailLabel),
140
- disabled: a,
143
+ "data-target-id": "Button-SendSharedLink",
144
+ disabled: n,
141
145
  icon: X,
142
146
  onClick: () => I("email"),
143
147
  size: "large",
144
148
  variant: "secondary"
145
149
  })
146
150
  })]
147
- }), n && (s.sharedLinkAccess || s.sharedLinkPermission) && /* @__PURE__ */ l("div", {
151
+ }), a && (s.sharedLinkAccess || s.sharedLinkPermission) && /* @__PURE__ */ l("div", {
148
152
  className: r.access,
149
153
  children: [s.sharedLinkAccess && /* @__PURE__ */ i($, {}), s.sharedLinkPermission && /* @__PURE__ */ i(ee, {})]
150
- }), n && o.access === "open" && /* @__PURE__ */ l("div", {
154
+ }), a && o.access === "open" && /* @__PURE__ */ l("div", {
151
155
  children: [/* @__PURE__ */ i(j, {
152
156
  className: r.icon,
153
- height: k,
154
- width: k
157
+ height: g,
158
+ width: g
155
159
  }), /* @__PURE__ */ i(_, {
156
160
  as: "span",
157
161
  color: "textOnLightSecondary",
158
162
  children: o.permission === "can_edit" ? e(t.sharedLinkEditablePubliclyAvailable) : e(t.sharedLinkPubliclyAvailable)
159
163
  })]
160
- }), n && o.access === "company" && o.permission === "can_edit" && /* @__PURE__ */ l("div", {
164
+ }), a && o.access === "company" && o.permission === "can_edit" && /* @__PURE__ */ l("div", {
161
165
  children: [/* @__PURE__ */ i(j, {
162
166
  className: r.icon,
163
- height: k,
164
- width: k
167
+ height: g,
168
+ width: g
165
169
  }), /* @__PURE__ */ i(_, {
166
170
  as: "span",
167
171
  color: "textOnLightSecondary",
@@ -2,7 +2,7 @@ export default {
2
2
  "groupSharedFeatures.usm.autoCopySharedLinkErrorNoticeText": "共有リンクを作成できません。後でもう一度やり直してください。",
3
3
  "groupSharedFeatures.usm.classificationStatus.definitionLabel": "定義",
4
4
  "groupSharedFeatures.usm.classificationStatus.restrictionsLabel": "制約事項",
5
- "groupSharedFeatures.usm.contactsLimitErrorMessage": "一度に追加できるコラボレータは最大{maxContacts}人までです。何件かに分けて、もう一度招待し直してください。",
5
+ "groupSharedFeatures.usm.contactsLimitErrorMessage": "一度に追加できるコラボレータは最大{maxContacts}人までです。招待を何回かに分けて、もう一度やり直してください。",
6
6
  "groupSharedFeatures.usm.createSharedLinkErrorNoticeText": "共有リンクを作成できません。後でもう一度やり直してください。",
7
7
  "groupSharedFeatures.usm.createSharedLinkSuccessNoticeText": "共有リンクを作成しました。",
8
8
  "groupSharedFeatures.usm.defaultErrorNoticeText": "問題が発生しました。後でもう一度やり直してください。",
@@ -5,7 +5,7 @@ groupSharedFeatures.usm.classificationStatus.definitionLabel = 定義
5
5
  # Label for the section to show the restrictions of the classification label
6
6
  groupSharedFeatures.usm.classificationStatus.restrictionsLabel = 制約事項
7
7
  # Error message when more than the maximum number of contacts is entered
8
- groupSharedFeatures.usm.contactsLimitErrorMessage = 一度に追加できるコラボレータは最大{maxContacts}人までです。何件かに分けて、もう一度招待し直してください。
8
+ groupSharedFeatures.usm.contactsLimitErrorMessage = 一度に追加できるコラボレータは最大{maxContacts}人までです。招待を何回かに分けて、もう一度やり直してください。
9
9
  # Notification text when the shared link failed to be created
10
10
  groupSharedFeatures.usm.createSharedLinkErrorNoticeText = 共有リンクを作成できません。後でもう一度やり直してください。
11
11
  # Notification text when the shared link is successfully created
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@box/unified-share-modal",
3
- "version": "2.4.2",
3
+ "version": "2.6.0",
4
4
  "license": "SEE LICENSE IN LICENSE",
5
5
  "peerDependencies": {
6
6
  "@box/blueprint-web": "^13.3.0",