@box/unified-share-modal 2.7.18 → 2.8.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,63 +1,61 @@
1
- import { useIntl as A } from "react-intl";
2
- import { Text as _, Avatar as g } from "@box/blueprint-web";
3
- import { Gray10 as S } from "@box/blueprint-web-assets/tokens/tokens";
4
- import { CollaboratorAvatar as k } from "../collaborator-list/collaborator-avatar.js";
5
- import y from "./messages.js";
1
+ import { useIntl as x } from "react-intl";
2
+ import { Text as C, Avatar as A } from "@box/blueprint-web";
3
+ import { Gray10 as _ } from "@box/blueprint-web-assets/tokens/tokens";
4
+ import { CollaboratorAvatar as g } from "../collaborator-list/collaborator-avatar.js";
5
+ import I from "./messages.js";
6
6
  import { jsxs as l, jsx as e } from "react/jsx-runtime";
7
- import { useUnifiedShareModalContext as I } from "../../../contexts/unified-share-modal-context.js";
8
- import { useUnifiedShareFormContext as W } from "../../../contexts/unified-share-form-context.js";
9
- import { callOnKeyboardEvent as U } from "../../../utils/event.js";
10
- import '../../../../../styles/shared-with-avatars.css';const F = "_container_1ku5s_2", L = "_avatars_1ku5s_19", c = {
11
- container: F,
12
- avatars: L
7
+ import { useUnifiedShareModalContext as S } from "../../../contexts/unified-share-modal-context.js";
8
+ import { useUnifiedShareFormContext as k } from "../../../contexts/unified-share-form-context.js";
9
+ import { callOnKeyboardEvent as y } from "../../../utils/event.js";
10
+ import '../../../../../styles/shared-with-avatars.css';const W = "_container_1ku5s_2", O = "_avatars_1ku5s_19", c = {
11
+ container: W,
12
+ avatars: O
13
13
  }, m = 3;
14
- function E() {
14
+ function D() {
15
15
  const {
16
16
  formatMessage: d
17
- } = A(), {
17
+ } = x(), {
18
18
  collaborators: f,
19
19
  currentUser: u,
20
20
  eventService: h,
21
21
  isSubmitting: o
22
- } = I(), {
23
- form: v,
24
- setForm: p,
25
- setPreviousForm: b
26
- } = W(), {
22
+ } = S(), {
23
+ setIsCollaboratorsOpen: v
24
+ } = k(), {
27
25
  onCollaboratorsClick: a
28
26
  } = h, {
29
27
  id: s
30
28
  } = u, t = f.filter(({
31
29
  isCurrentUser: r,
32
- userId: C
33
- }) => !(r || s && s === C));
30
+ userId: b
31
+ }) => !(r || s && s === b));
34
32
  if (!t.length)
35
33
  return null;
36
- const x = t.slice(0, m), n = t.length - m, i = () => {
34
+ const p = t.slice(0, m), n = t.length - m, i = () => {
37
35
  if (a) {
38
36
  a();
39
37
  return;
40
38
  }
41
- b(v), p("collaborators");
39
+ v(!0);
42
40
  };
43
41
  return /* @__PURE__ */ l("div", {
44
42
  "aria-disabled": o,
45
43
  className: c.container,
46
44
  onClick: i,
47
- onKeyDown: U(i),
45
+ onKeyDown: y(i),
48
46
  role: "button",
49
47
  tabIndex: o ? -1 : 0,
50
- children: [/* @__PURE__ */ e(_, {
48
+ children: [/* @__PURE__ */ e(C, {
51
49
  as: "span",
52
50
  color: "textOnLightSecondary",
53
- children: d(y.sharedWithLabel)
51
+ children: d(I.sharedWithLabel)
54
52
  }), /* @__PURE__ */ l("div", {
55
53
  className: c.avatars,
56
- children: [x.map((r) => /* @__PURE__ */ e(k, {
54
+ children: [p.map((r) => /* @__PURE__ */ e(g, {
57
55
  collaborator: r,
58
56
  size: "medium"
59
- }, r.id)), n > 0 && /* @__PURE__ */ e(g, {
60
- color: S,
57
+ }, r.id)), n > 0 && /* @__PURE__ */ e(A, {
58
+ color: _,
61
59
  size: "medium",
62
60
  text: `+${n}`
63
61
  })]
@@ -65,5 +63,5 @@ function E() {
65
63
  });
66
64
  }
67
65
  export {
68
- E as SharedWithAvatars
66
+ D as SharedWithAvatars
69
67
  };
@@ -1,102 +1,101 @@
1
1
  import { createPortal as L } from "react-dom";
2
2
  import { useIntl as S } from "react-intl";
3
- import { useBreakpoint as x, Breakpoint as z, Divider as B, Link as g, Table as N, TableHeader as M, Column as p, TableBody as D, Modal as i } from "@box/blueprint-web";
4
- import { CollaboratorListItem as H } from "./collaborator-list-item.js";
3
+ import { useBreakpoint as x, Breakpoint as z, Divider as B, Link as h, Table as N, TableHeader as F, Column as b, TableBody as I, Modal as l } from "@box/blueprint-web";
4
+ import { CollaboratorListItem as M } from "./collaborator-list-item.js";
5
5
  import r from "./messages.js";
6
- import { jsxs as a, Fragment as u, jsx as e } from "react/jsx-runtime";
7
- import { useUnifiedShareFormContext as I } from "../../../contexts/unified-share-form-context.js";
8
- import { callOnKeyboardEvent as T } from "../../../utils/event.js";
9
- import { useUnifiedShareModalContext as j } from "../../../contexts/unified-share-modal-context.js";
10
- import '../../../../../styles/collaborator-list.css';const A = "_divider_ozw7g_1", K = "_manage_ozw7g_8", P = "_link_ozw7g_14", R = "_list_ozw7g_18", U = "_scroll_ozw7g_34", $ = "_header_ozw7g_40", t = {
11
- divider: A,
12
- manage: K,
13
- link: P,
14
- list: R,
15
- scroll: U,
16
- header: $
6
+ import { jsxs as t, Fragment as g, jsx as e } from "react/jsx-runtime";
7
+ import { useUnifiedShareFormContext as D } from "../../../contexts/unified-share-form-context.js";
8
+ import { callOnKeyboardEvent as H } from "../../../utils/event.js";
9
+ import { useUnifiedShareModalContext as T } from "../../../contexts/unified-share-modal-context.js";
10
+ import '../../../../../styles/collaborator-list.css';const j = "_divider_ozw7g_1", A = "_manage_ozw7g_8", K = "_link_ozw7g_14", O = "_list_ozw7g_18", P = "_scroll_ozw7g_34", R = "_header_ozw7g_40", a = {
11
+ divider: j,
12
+ manage: A,
13
+ link: K,
14
+ list: O,
15
+ scroll: P,
16
+ header: R
17
17
  };
18
- function Z() {
18
+ function Y() {
19
19
  const {
20
20
  formatMessage: o
21
- } = S(), l = x() === z.Small, {
22
- collaborators: b,
21
+ } = S(), i = x() === z.Small, {
22
+ collaborators: p,
23
23
  config: s,
24
24
  eventService: f,
25
- isFetching: _,
26
- isSubmitting: k,
27
- item: v,
28
- variant: C
29
- } = j(), {
30
- id: w,
31
- type: y
32
- } = v, {
25
+ isFetching: u,
26
+ isSubmitting: _,
27
+ item: k,
28
+ variant: v
29
+ } = T(), {
30
+ id: C,
31
+ type: w
32
+ } = k, {
33
33
  onCollaboratorsManagementClick: n
34
- } = f, c = C === "desktop", {
34
+ } = f, c = v === "desktop", {
35
35
  containerRef: d,
36
- previousForm: m,
37
- setForm: F
38
- } = I();
39
- return /* @__PURE__ */ a(u, {
36
+ setIsCollaboratorsOpen: y
37
+ } = D();
38
+ return /* @__PURE__ */ t(g, {
40
39
  children: [c && /* @__PURE__ */ e(B, {
41
- className: t.divider
40
+ className: a.divider
42
41
  }), s.collaboratorsManagement && /* @__PURE__ */ e("div", {
43
- className: t.manage,
44
- children: n ? /* @__PURE__ */ e(g, {
45
- className: t.link,
42
+ className: a.manage,
43
+ children: n ? /* @__PURE__ */ e(h, {
44
+ className: a.link,
46
45
  onClick: n,
47
- onKeyDown: T(n, {
46
+ onKeyDown: H(n, {
48
47
  canPreventDefault: !0
49
48
  }),
50
49
  role: "button",
51
50
  tabIndex: 0,
52
51
  variant: "standalone",
53
52
  children: o(r.manageAllLink)
54
- }) : /* @__PURE__ */ e(g, {
55
- href: `/${y}/${w}/collaborators`,
53
+ }) : /* @__PURE__ */ e(h, {
54
+ href: `/${w}/${C}/collaborators`,
56
55
  rel: "noopener",
57
56
  target: "_blank",
58
57
  variant: "standalone",
59
58
  children: o(r.manageAllLink)
60
59
  })
61
60
  }), /* @__PURE__ */ e("div", {
62
- className: t.list,
61
+ className: a.list,
63
62
  children: /* @__PURE__ */ e("div", {
64
- className: t.scroll,
65
- children: /* @__PURE__ */ a(N, {
63
+ className: a.scroll,
64
+ children: /* @__PURE__ */ t(N, {
66
65
  "aria-label": o(r.listLabel),
67
- children: [/* @__PURE__ */ a(M, {
68
- className: t.header,
69
- children: [/* @__PURE__ */ e(p, {
66
+ children: [/* @__PURE__ */ t(F, {
67
+ className: a.header,
68
+ children: [/* @__PURE__ */ e(b, {
70
69
  hideHeader: !0,
71
70
  isRowHeader: !0,
72
71
  width: "11fr",
73
72
  children: o(r.nameColumn)
74
- }), !l && /* @__PURE__ */ e(p, {
73
+ }), !i && /* @__PURE__ */ e(b, {
75
74
  hideHeader: !0,
76
75
  width: "10fr",
77
76
  children: o(r.roleColumn)
78
77
  })]
79
- }), /* @__PURE__ */ e(D, {
80
- children: b.slice(0, s.collaboratorsLimit).map((h) => /* @__PURE__ */ e(H, {
81
- collaborator: h,
82
- isSmall: l
83
- }, h.id))
78
+ }), /* @__PURE__ */ e(I, {
79
+ children: p.slice(0, s.collaboratorsLimit).map((m) => /* @__PURE__ */ e(M, {
80
+ collaborator: m,
81
+ isSmall: i
82
+ }, m.id))
84
83
  })]
85
84
  })
86
85
  })
87
- }), d && /* @__PURE__ */ L(/* @__PURE__ */ a(u, {
88
- children: [!_ && /* @__PURE__ */ e(i.Footer, {
89
- children: /* @__PURE__ */ e(i.Footer.SecondaryButton, {
90
- onClick: () => F(m === "invite" ? m : "default"),
86
+ }), d && /* @__PURE__ */ L(/* @__PURE__ */ t(g, {
87
+ children: [!u && /* @__PURE__ */ e(l.Footer, {
88
+ children: /* @__PURE__ */ e(l.Footer.SecondaryButton, {
89
+ onClick: () => y(!1),
91
90
  children: o(r.doneButton)
92
91
  })
93
- }), !c && /* @__PURE__ */ e(i.Close, {
92
+ }), !c && /* @__PURE__ */ e(l.Close, {
94
93
  "aria-label": o(r.closeButton),
95
- disabled: k
94
+ disabled: _
96
95
  })]
97
96
  }), d)]
98
97
  });
99
98
  }
100
99
  export {
101
- Z as CollaboratorList
100
+ Y as CollaboratorList
102
101
  };
@@ -1,77 +1,91 @@
1
- import { useRef as O, useCallback as E, useEffect as R } from "react";
2
- import { useIntl as U } from "react-intl";
3
- import { useNotification as z, Text as S, Tooltip as y, Focusable as K, Switch as G, Status as V, Link as q, Button as H } from "@box/blueprint-web";
4
- import { ClockBadge as J } from "@box/blueprint-web-assets/icons/Line";
5
- import { Mail as Q, Globe as D } from "@box/blueprint-web-assets/icons/Medium";
6
- import { SurfaceStatusSurfaceRed as W, bpSize040 as g } from "@box/blueprint-web-assets/tokens/tokens";
7
- import { CopyInput as X } from "@box/copy-input";
8
- import { SharedLinkAccess as Y } from "./shared-link-access.js";
9
- import { SharedLinkPermission as Z } from "./shared-link-permission.js";
1
+ import { useRef as K, useCallback as w, useEffect as G } from "react";
2
+ import { useIntl as V } from "react-intl";
3
+ import { useNotification as q, Text as b, Tooltip as y, Focusable as H, Switch as J, Status as Q, Link as W, Button as X } from "@box/blueprint-web";
4
+ import { ClockBadge as Y } from "@box/blueprint-web-assets/icons/Line";
5
+ import { Mail as Z, Globe as I } from "@box/blueprint-web-assets/icons/Medium";
6
+ import { SurfaceStatusSurfaceRed as $, bpSize040 as g } from "@box/blueprint-web-assets/tokens/tokens";
7
+ import { CopyInput as ee } from "@box/copy-input";
8
+ import { SharedLinkAccess as te } from "./shared-link-access.js";
9
+ import { SharedLinkPermission as ie } from "./shared-link-permission.js";
10
10
  import t from "./messages.js";
11
11
  import { jsxs as d, jsx as i } from "react/jsx-runtime";
12
- import { useUnifiedShareFormContext as $ } from "../../../contexts/unified-share-form-context.js";
13
- import { useUnifiedShareModalContext as ee } from "../../../contexts/unified-share-modal-context.js";
14
- import { useSharingAction as te } from "../../../hooks/use-sharing-action.js";
15
- import { getNotificationArgs as ie } from "../../../utils/notification.js";
16
- import { formatDateFromTimestampToDateString as ae } from "../../../utils/date.js";
17
- import { callOnKeyboardEvent as ne } from "../../../utils/event.js";
18
- import '../../../../../styles/shared-link-section.css';const oe = "_container_j966c_1", re = "_toggle_j966c_7", se = "_settings_j966c_13", ce = "_copy_j966c_22", le = "_access_j966c_30", de = "_icon_j966c_36", c = {
19
- container: oe,
20
- toggle: re,
21
- settings: se,
22
- copy: ce,
23
- access: le,
24
- icon: de
12
+ import { useUnifiedShareFormContext as ae } from "../../../contexts/unified-share-form-context.js";
13
+ import { useUnifiedShareModalContext as ne } from "../../../contexts/unified-share-modal-context.js";
14
+ import { useSharingAction as oe } from "../../../hooks/use-sharing-action.js";
15
+ import { getNotificationArgs as re } from "../../../utils/notification.js";
16
+ import { formatDateFromTimestampToDateString as se } from "../../../utils/date.js";
17
+ import { callOnKeyboardEvent as ce } from "../../../utils/event.js";
18
+ import '../../../../../styles/shared-link-section.css';const le = "_container_j966c_1", de = "_toggle_j966c_7", he = "_settings_j966c_13", ue = "_copy_j966c_22", me = "_access_j966c_30", pe = "_icon_j966c_36", c = {
19
+ container: le,
20
+ toggle: de,
21
+ settings: he,
22
+ copy: ue,
23
+ access: me,
24
+ icon: pe
25
25
  };
26
- function Ne() {
26
+ function we() {
27
27
  const {
28
28
  formatMessage: e
29
- } = U(), {
29
+ } = V(), {
30
30
  addNotification: C
31
- } = z(), f = O(null), {
32
- isSharedLinkAutoCopied: k,
31
+ } = q(), k = K(null), {
32
+ isSharedLinkAutoCopied: f,
33
33
  isSharedLinkAutoCreated: r,
34
- setForm: j
35
- } = $(), {
34
+ setForm: P
35
+ } = ae(), {
36
36
  config: s,
37
+ eventService: B,
37
38
  isFetching: v,
38
39
  isSubmitting: n,
39
- item: w,
40
- setView: L,
40
+ item: F,
41
+ setView: x,
41
42
  sharedLink: o,
42
- sharingService: I
43
- } = ee(), {
44
- permissions: x = {}
45
- } = w, {
46
- createSharedLink: _
47
- } = I, {
48
- notifications: T,
49
- sharedLinkAutoCopy: P,
50
- sharedLinkAutoCreate: A
51
- } = s, a = !!o.url, h = P && !k.current, N = A && !r.current, B = E(async () => {
52
- const l = await _();
43
+ sharingService: M
44
+ } = ne(), {
45
+ permissions: T = {}
46
+ } = F, {
47
+ onSharedLinkCopy: L,
48
+ onSharedLinkSettingsClick: _
49
+ } = B, {
50
+ createSharedLink: A
51
+ } = M, {
52
+ notifications: N,
53
+ sharedLinkAutoCopy: O,
54
+ sharedLinkAutoCreate: E
55
+ } = s, a = !!o.url, h = O && !f.current, D = E && !r.current, R = w(async () => {
56
+ const l = await A();
53
57
  return h ? {
54
58
  messages: []
55
59
  } : l;
56
- }, [h, _]), {
57
- onAction: b
58
- } = te(B, "create-shared-link");
59
- R(() => {
60
- (async () => v || n || ((h || N) && !a && (await b(), r.current = !0), h && a && f.current && (f.current.click(), k.current = !0)))();
61
- }, [a, h, N, v, k, r, n, b]);
62
- const F = E((l) => {
60
+ }, [h, A]), {
61
+ onAction: S
62
+ } = oe(R, "create-shared-link");
63
+ G(() => {
64
+ (async () => v || n || ((h || D) && !a && (await S(), r.current = !0), h && a && k.current && (k.current.click(), f.current = !0)))();
65
+ }, [a, h, D, v, f, r, n, S]);
66
+ const U = w((l) => {
63
67
  let p;
64
- typeof l != "string" ? p = r.current ? e(t.autoCreateCopyErrorNoticeText) : null : p = r.current ? e(t.autoCreateCopySuccessNoticeText) : e(t.autoCopySuccessNoticeText), p && T.includes("auto-copy-shared-link") && C({
65
- ...ie(e, "success"),
68
+ typeof l != "string" ? p = r.current ? e(t.autoCreateCopyErrorNoticeText) : null : p = r.current ? e(t.autoCreateCopySuccessNoticeText) : e(t.autoCopySuccessNoticeText), p && N.includes("auto-copy-shared-link") && C({
69
+ ...re(e, "success"),
66
70
  styledText: p
67
- });
68
- }, [C, e, r, T]), M = async (l) => {
69
- l || L("remove-shared-link"), l && await b();
71
+ }), L && L(l);
72
+ }, [C, e, r, N, L]), z = async (l) => {
73
+ if (l) {
74
+ await S();
75
+ return;
76
+ }
77
+ x("remove-shared-link");
78
+ }, j = () => {
79
+ if (_) {
80
+ _();
81
+ return;
82
+ }
83
+ x("shared-link-settings");
70
84
  };
71
85
  let u, m = !1;
72
- return !a && !n && (u = e(t.sharedLinkToggleTooltip)), !a && !x.canShare && (u = e(t.createLinkDisabledTooltip), m = !0), a && !x.canSetShareAccess && (u = e(t.removeLinkDisabledTooltip), m = !0), /* @__PURE__ */ d("div", {
86
+ return !a && !n && (u = e(t.sharedLinkToggleTooltip)), !a && !T.canShare && (u = e(t.createLinkDisabledTooltip), m = !0), a && !T.canSetShareAccess && (u = e(t.removeLinkDisabledTooltip), m = !0), /* @__PURE__ */ d("div", {
73
87
  className: c.container,
74
- children: [/* @__PURE__ */ i(S, {
88
+ children: [/* @__PURE__ */ i(b, {
75
89
  as: "label",
76
90
  variant: "bodyDefaultBold",
77
91
  children: e(t.shareLinkLabel)
@@ -82,35 +96,35 @@ function Ne() {
82
96
  content: u,
83
97
  "data-testid": "shared-link-tooltip",
84
98
  open: u ? void 0 : !1,
85
- children: /* @__PURE__ */ i(K, {
99
+ children: /* @__PURE__ */ i(H, {
86
100
  focusable: m,
87
- children: /* @__PURE__ */ i(G.Item, {
101
+ children: /* @__PURE__ */ i(J.Item, {
88
102
  checked: a,
89
103
  "data-target-id": "Toggle-CreateSharedLink",
90
104
  disabled: m || n,
91
105
  label: e(t.sharedLinkToggleLabel),
92
- onCheckedChange: M,
106
+ onCheckedChange: z,
93
107
  value: "shared-link"
94
108
  })
95
109
  })
96
110
  }), a && !!o.expiresAt && /* @__PURE__ */ i(y, {
97
111
  content: e(t.expirationIconTooltip, {
98
- expirationDate: ae(o.expiresAt)
112
+ expirationDate: se(o.expiresAt)
99
113
  }),
100
114
  "data-testid": "expiration-date-tooltip",
101
- children: /* @__PURE__ */ i(V, {
102
- color: W,
115
+ children: /* @__PURE__ */ i(Q, {
116
+ color: $,
103
117
  hideText: !0,
104
- icon: J,
118
+ icon: Y,
105
119
  text: e(t.expirationIconLabel)
106
120
  })
107
- }), a && s.sharedLinkSettings && /* @__PURE__ */ i(q, {
121
+ }), a && s.sharedLinkSettings && /* @__PURE__ */ i(W, {
108
122
  "aria-disabled": n,
109
123
  "aria-haspopup": "dialog",
110
124
  className: c.settings,
111
125
  "data-target-id": "PlainButton-SharedLinkSettings",
112
- onClick: () => L("shared-link-settings"),
113
- onKeyDown: ne(() => L("shared-link-settings"), {
126
+ onClick: j,
127
+ onKeyDown: ce(j, {
114
128
  canPreventDefault: !0
115
129
  }),
116
130
  role: "button",
@@ -120,47 +134,47 @@ function Ne() {
120
134
  })]
121
135
  }), a && /* @__PURE__ */ d("div", {
122
136
  className: c.copy,
123
- children: [/* @__PURE__ */ i(X, {
124
- ref: f,
125
- autoFocus: A && r.current,
137
+ children: [/* @__PURE__ */ i(ee, {
138
+ ref: k,
139
+ autoFocus: E && r.current,
126
140
  "data-target-id": "Button-CopySharedLink",
127
141
  disabled: n,
128
142
  hideLabel: !0,
129
143
  label: e(t.sharedLinkUrlLabel),
130
- onCopy: F,
144
+ onCopy: U,
131
145
  value: o.url
132
146
  }), s.sharedLinkEmail && /* @__PURE__ */ i(y, {
133
147
  align: "end",
134
148
  content: e(t.sharedLinkEmailLabel),
135
- children: /* @__PURE__ */ i(H, {
149
+ children: /* @__PURE__ */ i(X, {
136
150
  "aria-label": e(t.sharedLinkEmailLabel),
137
151
  "data-target-id": "Button-SendSharedLink",
138
152
  disabled: n,
139
- icon: Q,
140
- onClick: () => j("email"),
153
+ icon: Z,
154
+ onClick: () => P("email"),
141
155
  size: "large",
142
156
  variant: "secondary"
143
157
  })
144
158
  })]
145
159
  }), a && (s.sharedLinkAccess || s.sharedLinkPermission) && /* @__PURE__ */ d("div", {
146
160
  className: c.access,
147
- children: [s.sharedLinkAccess && /* @__PURE__ */ i(Y, {}), s.sharedLinkPermission && /* @__PURE__ */ i(Z, {})]
161
+ children: [s.sharedLinkAccess && /* @__PURE__ */ i(te, {}), s.sharedLinkPermission && /* @__PURE__ */ i(ie, {})]
148
162
  }), a && o.access === "open" && /* @__PURE__ */ d("div", {
149
- children: [/* @__PURE__ */ i(D, {
163
+ children: [/* @__PURE__ */ i(I, {
150
164
  className: c.icon,
151
165
  height: g,
152
166
  width: g
153
- }), /* @__PURE__ */ i(S, {
167
+ }), /* @__PURE__ */ i(b, {
154
168
  as: "span",
155
169
  color: "textOnLightSecondary",
156
170
  children: o.permission === "can_edit" ? e(t.sharedLinkEditablePubliclyAvailable) : e(t.sharedLinkPubliclyAvailable)
157
171
  })]
158
172
  }), a && o.access === "company" && o.permission === "can_edit" && /* @__PURE__ */ d("div", {
159
- children: [/* @__PURE__ */ i(D, {
173
+ children: [/* @__PURE__ */ i(I, {
160
174
  className: c.icon,
161
175
  height: g,
162
176
  width: g
163
- }), /* @__PURE__ */ i(S, {
177
+ }), /* @__PURE__ */ i(b, {
164
178
  as: "span",
165
179
  color: "textOnLightSecondary",
166
180
  children: e(t.sharedLinkElevatedEditableCompanyAvailable)
@@ -169,5 +183,5 @@ function Ne() {
169
183
  });
170
184
  }
171
185
  export {
172
- Ne as SharedLinkSection
186
+ we as SharedLinkSection
173
187
  };
@@ -1,78 +1,79 @@
1
1
  import a from "clsx";
2
- import { useCallback as y } from "react";
3
- import { useIntl as N } from "react-intl";
4
- import { Modal as e, LoadingIndicator as v } from "@box/blueprint-web";
5
- import { UnifiedShareForm as D } from "./unified-share-form.js";
2
+ import { useCallback as N } from "react";
3
+ import { useIntl as v } from "react-intl";
4
+ import { Modal as e, LoadingIndicator as D } from "@box/blueprint-web";
5
+ import { UnifiedShareForm as M } from "./unified-share-form.js";
6
6
  import l from "./messages.js";
7
7
  import { jsxs as i, jsx as o } from "react/jsx-runtime";
8
- import { CollaboratorList as M } from "./collaborator-list/collaborator-list.js";
8
+ import { CollaboratorList as O } from "./collaborator-list/collaborator-list.js";
9
9
  import { useUnifiedShareFormContext as h } from "../../contexts/unified-share-form-context.js";
10
10
  import { useUnifiedShareModalContext as U } from "../../contexts/unified-share-modal-context.js";
11
11
  import { ClassificationStatus as k } from "../classification-status/classification-status.js";
12
- import '../../../../styles/unified-share-form-modal.css';const O = "_content_17drm_1", j = "_isFullscreen_17drm_4", w = "_body_17drm_13", z = "_hasFooter_17drm_30", B = "_classificationStatusContainer_17drm_34", I = "_loading_17drm_39", P = "_form_17drm_47", H = "_isLoading_17drm_52", t = {
13
- content: O,
14
- isFullscreen: j,
15
- body: w,
16
- hasFooter: z,
17
- classificationStatusContainer: B,
18
- loading: I,
19
- form: P,
20
- isLoading: H
12
+ import '../../../../styles/unified-share-form-modal.css';const j = "_content_17drm_1", w = "_isFullscreen_17drm_4", z = "_body_17drm_13", B = "_hasFooter_17drm_30", I = "_classificationStatusContainer_17drm_34", P = "_loading_17drm_39", H = "_form_17drm_47", R = "_isLoading_17drm_52", t = {
13
+ content: j,
14
+ isFullscreen: w,
15
+ body: z,
16
+ hasFooter: B,
17
+ classificationStatusContainer: I,
18
+ loading: P,
19
+ form: H,
20
+ isLoading: R
21
21
  };
22
- function X({
22
+ function Y({
23
23
  children: m,
24
24
  isOpen: p,
25
25
  onOpenChange: c
26
26
  }) {
27
27
  const {
28
28
  formatMessage: n
29
- } = N(), {
30
- setContainerRef: F,
31
- setForm: d
29
+ } = v(), {
30
+ isCollaboratorsOpen: d,
31
+ setContainerRef: C,
32
+ setForm: f
32
33
  } = h(), {
33
- isFetching: f,
34
+ isFetching: u,
34
35
  isSubmitting: s,
35
- item: C,
36
+ item: F,
36
37
  variant: b
37
38
  } = U(), {
38
- form: u
39
+ form: S
39
40
  } = h(), {
40
- name: S
41
- } = C, _ = b === "desktop", g = u === "default", L = y((r) => {
42
- s || (d("default"), c(r));
43
- }, [s, c, d]), x = (r) => {
41
+ name: L
42
+ } = F, _ = b === "desktop", g = S === "default", x = N((r) => {
43
+ s || (f("default"), c(r));
44
+ }, [s, c, f]), y = (r) => {
44
45
  r.preventDefault();
45
46
  };
46
47
  return /* @__PURE__ */ i(e, {
47
- onOpenChange: L,
48
+ onOpenChange: x,
48
49
  open: p,
49
50
  children: [!!m && /* @__PURE__ */ o(e.Trigger, {
50
51
  children: m
51
52
  }), /* @__PURE__ */ i(e.Content, {
52
- ref: F,
53
+ ref: C,
53
54
  className: a(t.content, _ && t.isFullscreen),
54
- onPointerDownOutside: x,
55
+ onPointerDownOutside: y,
55
56
  size: "medium",
56
57
  children: [/* @__PURE__ */ i(e.Header, {
57
58
  children: [n(l.title, {
58
- itemName: S
59
+ itemName: L
59
60
  }), /* @__PURE__ */ o("div", {
60
61
  className: t.classificationStatusContainer,
61
62
  children: /* @__PURE__ */ o(k, {})
62
63
  })]
63
64
  }), /* @__PURE__ */ i(e.Body, {
64
65
  className: a(t.body, !g && t.hasFooter),
65
- children: [f && /* @__PURE__ */ o("div", {
66
+ children: [u && /* @__PURE__ */ o("div", {
66
67
  className: t.loading,
67
- children: /* @__PURE__ */ o(v, {
68
+ children: /* @__PURE__ */ o(D, {
68
69
  "aria-label": n(l.loadingLabel),
69
70
  size: "large"
70
71
  })
71
72
  }), /* @__PURE__ */ o("div", {
72
- className: a(t.form, f && t.isLoading),
73
- children: u === "collaborators" ? /* @__PURE__ */ o(M, {}) : /* @__PURE__ */ o(D, {})
73
+ className: a(t.form, u && t.isLoading),
74
+ children: d ? /* @__PURE__ */ o(O, {}) : /* @__PURE__ */ o(M, {})
74
75
  })]
75
- }), !_ && g && /* @__PURE__ */ o(e.Close, {
76
+ }), !_ && !d && g && /* @__PURE__ */ o(e.Close, {
76
77
  "aria-label": n(l.closeButton),
77
78
  disabled: s
78
79
  })]
@@ -80,5 +81,5 @@ function X({
80
81
  });
81
82
  }
82
83
  export {
83
- X as UnifiedShareFormModal
84
+ Y as UnifiedShareFormModal
84
85
  };
@@ -1,53 +1,53 @@
1
- import { createContext as w, useContext as M, useState as e, useRef as U, useCallback as A, useEffect as E, useMemo as L } from "react";
2
- import { useUnifiedShareModalContext as j } from "./unified-share-modal-context.js";
3
- import { jsx as O } from "react/jsx-runtime";
4
- const V = /* @__PURE__ */ w(null), B = () => {
5
- const t = M(V);
1
+ import { createContext as M, useContext as O, useState as e, useRef as F, useCallback as P, useEffect as A, useMemo as E } from "react";
2
+ import { useUnifiedShareModalContext as L } from "./unified-share-modal-context.js";
3
+ import { jsx as j } from "react/jsx-runtime";
4
+ const v = /* @__PURE__ */ M(null), z = () => {
5
+ const t = O(v);
6
6
  if (!t)
7
7
  throw new Error("useUnifiedShareFormContext must be used with UnifiedShareFormProvider");
8
8
  return t;
9
- }, D = ({
9
+ }, B = ({
10
10
  children: t
11
11
  }) => {
12
12
  const {
13
13
  initialContacts: o,
14
14
  isOpen: s
15
- } = j(), [n, r] = e("default"), [i, a] = e("default"), [c, b] = e(null), [l, u] = e(o), [d, f] = e(""), [m, h] = e(""), [C, S] = e(), [x, R] = e({}), F = U(!1), p = U(!1), v = A((g) => {
16
- R((k) => ({
17
- ...k,
18
- ...g
15
+ } = L(), [n, r] = e("default"), [a, i] = e(!1), [l, V] = e(null), [c, u] = e(o), [f, d] = e(""), [C, h] = e(""), [m, S] = e(), [x, R] = e({}), p = F(!1), U = F(!1), b = P((k) => {
16
+ R((w) => ({
17
+ ...w,
18
+ ...k
19
19
  }));
20
20
  }, []);
21
- E(() => {
22
- s || (r("default"), a("default"), u(o), f(""), h(""), S(void 0), R({}), F.current = !1, p.current = !1);
21
+ A(() => {
22
+ s || (r("default"), i(!1), u(o), d(""), h(""), S(void 0), R({}), p.current = !1, U.current = !1);
23
23
  }, [o, s]);
24
- const P = L(() => ({
25
- collaborationRole: C,
26
- contactValue: d,
27
- containerRef: c,
24
+ const g = E(() => ({
25
+ collaborationRole: m,
26
+ contactValue: f,
27
+ containerRef: l,
28
28
  form: n,
29
- isSharedLinkAutoCopied: F,
30
- isSharedLinkAutoCreated: p,
31
- messageValue: m,
32
- previousForm: i,
29
+ isCollaboratorsOpen: a,
30
+ isSharedLinkAutoCopied: p,
31
+ isSharedLinkAutoCreated: U,
32
+ messageValue: C,
33
33
  setCollaborationRole: S,
34
- setContactValue: f,
35
- setContainerRef: b,
34
+ setContactValue: d,
35
+ setContainerRef: V,
36
36
  setForm: r,
37
+ setIsCollaboratorsOpen: i,
37
38
  setMessageValue: h,
38
- setPreviousForm: a,
39
- setShieldRestriction: v,
39
+ setShieldRestriction: b,
40
40
  setUserContacts: u,
41
41
  shieldRestriction: x,
42
- userContacts: l
43
- }), [C, d, c, n, v, m, i, x, l]);
44
- return /* @__PURE__ */ O(V.Provider, {
45
- value: P,
42
+ userContacts: c
43
+ }), [m, f, l, n, b, a, C, x, c]);
44
+ return /* @__PURE__ */ j(v.Provider, {
45
+ value: g,
46
46
  children: t
47
47
  });
48
48
  };
49
49
  export {
50
- V as UnifiedShareFormContext,
51
- D as UnifiedShareFormProvider,
52
- B as useUnifiedShareFormContext
50
+ v as UnifiedShareFormContext,
51
+ B as UnifiedShareFormProvider,
52
+ z as useUnifiedShareFormContext
53
53
  };
@@ -6,16 +6,16 @@ export interface UnifiedShareFormContextValue {
6
6
  contactValue: string;
7
7
  containerRef: HTMLDivElement | null;
8
8
  form: FormType;
9
+ isCollaboratorsOpen: boolean;
9
10
  isSharedLinkAutoCopied: React.MutableRefObject<boolean>;
10
11
  isSharedLinkAutoCreated: React.MutableRefObject<boolean>;
11
12
  messageValue: string;
12
- previousForm: FormType;
13
13
  setCollaborationRole: Dispatch<SetStateAction<CollaborationRole | undefined>>;
14
14
  setContactValue: Dispatch<SetStateAction<string>>;
15
15
  setContainerRef: Dispatch<SetStateAction<HTMLDivElement | null>>;
16
16
  setForm: Dispatch<SetStateAction<FormType>>;
17
+ setIsCollaboratorsOpen: Dispatch<SetStateAction<boolean>>;
17
18
  setMessageValue: Dispatch<SetStateAction<string>>;
18
- setPreviousForm: Dispatch<SetStateAction<FormType>>;
19
19
  setShieldRestriction: Dispatch<SetStateAction<ShieldRestriction>>;
20
20
  setUserContacts: Dispatch<SetStateAction<UserContactType[]>>;
21
21
  shieldRestriction: ShieldRestriction;
@@ -18,14 +18,9 @@ export type VariantType = 'desktop' | 'modal';
18
18
  */
19
19
  export type ViewType = 'unified-share-form' | 'shared-link-settings' | 'remove-shared-link' | 'remove-collaborator';
20
20
  /**
21
- * View states of the sharing form in the Unified Share Modal.
22
- *
23
- * - `default` - The initial view which displays the collaboration and shared link sections
24
- * - `invite` - An expanded view of the collaboration section used for inviting collaborators
25
- * - `email` - An expanded view of the collaboration section used for emailing the shared link
26
- * - `collaborators` - A separate view for displaying the list of collaborators on the item
21
+ * Form states in the Unified Share Modal.
27
22
  */
28
- export type FormType = 'default' | 'invite' | 'email' | 'collaborators';
23
+ export type FormType = 'default' | 'invite' | 'email';
29
24
  /**
30
25
  * Supported success and error notifications when the user performs sharing actions.
31
26
  */
@@ -376,10 +371,14 @@ export interface EventService {
376
371
  * This is usually used for data tracking purposes.
377
372
  */
378
373
  onRestrictedUsersRemoveClick?: (contacts: UserContactType[]) => void;
374
+ /**
375
+ * Function to observe when the shared link is copied to the clipboard.
376
+ */
377
+ onSharedLinkCopy?: (result: string | Error) => void;
379
378
  /**
380
379
  * Function to customize the click behavior of the "Link Settings" link.
381
380
  *
382
- * NOTE: This has not been implemented.
381
+ * If provided, the default behavior is disabled and the shared link settings will not be opened.
383
382
  */
384
383
  onSharedLinkSettingsClick?: () => void;
385
384
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@box/unified-share-modal",
3
- "version": "2.7.18",
3
+ "version": "2.8.0",
4
4
  "license": "SEE LICENSE IN LICENSE",
5
5
  "peerDependencies": {
6
6
  "@box/blueprint-web": "^13.7.2",