@box/unified-share-modal 2.8.14 → 2.8.16

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,21 +1,21 @@
1
- import { useRef as G, useCallback as P, useEffect as V } from "react";
1
+ import { useRef as G, useCallback as I, useEffect as V } from "react";
2
2
  import { useIntl as q } from "react-intl";
3
- import { useNotification as H, Text as C, Tooltip as v, Focusable as J, Switch as Q, Status as W, Link as X, Button as Y } from "@box/blueprint-web";
3
+ import { useNotification as H, Text as y, Tooltip as C, Focusable as J, Switch as Q, Status as W, Link as X, Button as Y } from "@box/blueprint-web";
4
4
  import { ClockBadge as Z } from "@box/blueprint-web-assets/icons/Line";
5
- import { Mail as $, Globe as B } from "@box/blueprint-web-assets/icons/Medium";
6
- import { SurfaceStatusSurfaceRed as ee, bpSize040 as g } from "@box/blueprint-web-assets/tokens/tokens";
5
+ import { Mail as $, Globe as P } from "@box/blueprint-web-assets/icons/Medium";
6
+ import { SurfaceStatusSurfaceRed as ee, bpSize040 as k } from "@box/blueprint-web-assets/tokens/tokens";
7
7
  import { CopyInput as te } from "@box/copy-input";
8
8
  import { SharedLinkAccess as ie } from "./shared-link-access.js";
9
9
  import { SharedLinkPermission as ae } from "./shared-link-permission.js";
10
10
  import t from "./messages.js";
11
- import { jsxs as d, jsx as i } from "react/jsx-runtime";
11
+ import { jsxs as h, jsx as i } from "react/jsx-runtime";
12
12
  import { useUnifiedShareFormContext as ne } from "../../../contexts/unified-share-form-context.js";
13
13
  import { useUnifiedShareModalContext as oe } from "../../../contexts/unified-share-modal-context.js";
14
14
  import { useSharingAction as re } from "../../../hooks/use-sharing-action.js";
15
15
  import { getNotificationArgs as se } from "../../../utils/notification.js";
16
16
  import { formatDateFromTimestampToDateString as ce } from "../../../utils/date.js";
17
17
  import { callOnKeyboardEvent as le } from "../../../utils/event.js";
18
- import '../../../../../styles/shared-link-section.css';const de = "_container_j966c_1", he = "_toggle_j966c_7", ue = "_settings_j966c_13", me = "_copy_j966c_22", pe = "_access_j966c_30", ge = "_icon_j966c_36", c = {
18
+ import '../../../../../styles/shared-link-section.css';const de = "_container_j966c_1", he = "_toggle_j966c_7", ue = "_settings_j966c_13", me = "_copy_j966c_22", pe = "_access_j966c_30", ge = "_icon_j966c_36", l = {
19
19
  container: de,
20
20
  toggle: he,
21
21
  settings: ue,
@@ -27,90 +27,90 @@ function Ie() {
27
27
  const {
28
28
  formatMessage: e
29
29
  } = q(), {
30
- addNotification: x
31
- } = H(), k = G(null), {
32
- isInteracted: f,
33
- isSharedLinkAutoCopied: L,
30
+ addNotification: v
31
+ } = H(), f = G(null), {
32
+ isInteracted: L,
33
+ isSharedLinkAutoCopied: m,
34
34
  isSharedLinkAutoCreated: r,
35
- setForm: F
35
+ setForm: B
36
36
  } = ne(), {
37
37
  config: s,
38
- eventService: M,
39
- isFetching: T,
38
+ eventService: F,
39
+ isFetching: x,
40
40
  isSubmitting: n,
41
- item: O,
42
- setView: _,
41
+ item: M,
42
+ setView: T,
43
43
  sharedLink: o,
44
- sharingService: R
44
+ sharingService: O
45
45
  } = oe(), {
46
- permissions: A = {}
47
- } = O, {
48
- onSharedLinkCopy: S,
49
- onSharedLinkSettingsClick: N
46
+ permissions: _ = {}
50
47
  } = M, {
51
- createSharedLink: E
52
- } = R, {
53
- notifications: D,
54
- sharedLinkAutoCopy: b,
55
- sharedLinkAutoCreate: j
56
- } = s, a = !!o.url, h = b && !L.current && !f, w = j && !r.current && !f, U = P(async () => {
57
- const l = await E();
58
- return h ? {
48
+ onSharedLinkCopy: S,
49
+ onSharedLinkSettingsClick: A
50
+ } = F, {
51
+ createSharedLink: N
52
+ } = O, {
53
+ notifications: E,
54
+ sharedLinkAutoCopy: R,
55
+ sharedLinkAutoCreate: D
56
+ } = s, a = !!o.url, c = R && !m.current && !L, j = D && !r.current && !L, U = I(async () => {
57
+ const d = await N();
58
+ return c ? {
59
59
  messages: []
60
- } : l;
61
- }, [h, E]), {
62
- onAction: y
60
+ } : d;
61
+ }, [c, N]), {
62
+ onAction: b
63
63
  } = re(U, "create-shared-link");
64
64
  V(() => {
65
- (async () => T || n || ((h || w) && !a && (await y(), r.current = !0), h && a && k.current && (k.current.click(), L.current = !0)))();
66
- }, [a, h, w, T, L, r, n, y]);
67
- const z = P((l) => {
68
- if (S && S(l), !b || !D.includes("auto-copy-shared-link"))
65
+ (async () => x || n || ((c || j) && !a && (await b(), r.current = !0), c && a && f.current && f.current.click()))();
66
+ }, [a, c, j, x, m, r, n, b]);
67
+ const z = I((d) => {
68
+ if (S && S(d), !c)
69
69
  return;
70
- let p;
71
- typeof l != "string" ? p = r.current ? e(t.autoCreateCopyErrorNoticeText) : null : p = r.current ? e(t.autoCreateCopySuccessNoticeText) : e(t.autoCopySuccessNoticeText), p && x({
70
+ let g;
71
+ typeof d != "string" ? g = r.current ? e(t.autoCreateCopyErrorNoticeText) : null : g = r.current ? e(t.autoCreateCopySuccessNoticeText) : e(t.autoCopySuccessNoticeText), g && E.includes("auto-copy-shared-link") && v({
72
72
  ...se(e, "success"),
73
- styledText: p
74
- });
75
- }, [x, e, r, D, S, b]), K = async (l) => {
76
- if (l) {
77
- await y();
73
+ styledText: g
74
+ }), m.current = !0;
75
+ }, [v, e, c, m, r, E, S]), K = async (d) => {
76
+ if (d) {
77
+ await b();
78
78
  return;
79
79
  }
80
- _("remove-shared-link");
81
- }, I = () => {
82
- if (N) {
83
- N();
80
+ T("remove-shared-link");
81
+ }, w = () => {
82
+ if (A) {
83
+ A();
84
84
  return;
85
85
  }
86
- _("shared-link-settings");
86
+ T("shared-link-settings");
87
87
  };
88
- let u, m = !1;
89
- return !a && !n && (u = e(t.sharedLinkToggleTooltip)), !a && !A.canShare && (u = e(t.createLinkDisabledTooltip), m = !0), a && !A.canSetShareAccess && (u = e(t.removeLinkDisabledTooltip), m = !0), /* @__PURE__ */ d("div", {
90
- className: c.container,
91
- children: [/* @__PURE__ */ i(C, {
88
+ let u, p = !1;
89
+ return !a && !n && (u = e(t.sharedLinkToggleTooltip)), !a && !_.canShare && (u = e(t.createLinkDisabledTooltip), p = !0), a && !_.canSetShareAccess && (u = e(t.removeLinkDisabledTooltip), p = !0), /* @__PURE__ */ h("div", {
90
+ className: l.container,
91
+ children: [/* @__PURE__ */ i(y, {
92
92
  as: "label",
93
93
  variant: "bodyDefaultBold",
94
94
  children: e(t.shareLinkLabel)
95
- }), /* @__PURE__ */ d("div", {
96
- className: c.toggle,
97
- children: [/* @__PURE__ */ i(v, {
95
+ }), /* @__PURE__ */ h("div", {
96
+ className: l.toggle,
97
+ children: [/* @__PURE__ */ i(C, {
98
98
  align: "start",
99
99
  content: u,
100
100
  "data-testid": "shared-link-tooltip",
101
101
  open: u ? void 0 : !1,
102
102
  children: /* @__PURE__ */ i(J, {
103
- focusable: m,
103
+ focusable: p,
104
104
  children: /* @__PURE__ */ i(Q.Item, {
105
105
  checked: a,
106
106
  "data-target-id": "Toggle-CreateSharedLink",
107
- disabled: m || n,
107
+ disabled: p || n,
108
108
  label: e(t.sharedLinkToggleLabel),
109
109
  onCheckedChange: K,
110
110
  value: "shared-link"
111
111
  })
112
112
  })
113
- }), a && !!o.expiresAt && /* @__PURE__ */ i(v, {
113
+ }), a && !!o.expiresAt && /* @__PURE__ */ i(C, {
114
114
  content: e(t.expirationIconTooltip, {
115
115
  expirationDate: ce(o.expiresAt)
116
116
  }),
@@ -124,10 +124,10 @@ function Ie() {
124
124
  }), a && s.sharedLinkSettings && /* @__PURE__ */ i(X, {
125
125
  "aria-disabled": n,
126
126
  "aria-haspopup": "dialog",
127
- className: c.settings,
127
+ className: l.settings,
128
128
  "data-target-id": "PlainButton-SharedLinkSettings",
129
- onClick: I,
130
- onKeyDown: le(I, {
129
+ onClick: w,
130
+ onKeyDown: le(w, {
131
131
  canPreventDefault: !0
132
132
  }),
133
133
  role: "button",
@@ -135,18 +135,18 @@ function Ie() {
135
135
  variant: "standalone",
136
136
  children: e(t.sharedLinkSettingsLabel)
137
137
  })]
138
- }), a && /* @__PURE__ */ d("div", {
139
- className: c.copy,
138
+ }), a && /* @__PURE__ */ h("div", {
139
+ className: l.copy,
140
140
  children: [/* @__PURE__ */ i(te, {
141
- ref: k,
142
- autoFocus: j && r.current && !f,
141
+ ref: f,
142
+ autoFocus: D && r.current && !L,
143
143
  "data-target-id": "Button-CopySharedLink",
144
144
  disabled: n,
145
145
  hideLabel: !0,
146
146
  label: e(t.sharedLinkUrlLabel),
147
147
  onCopy: z,
148
148
  value: o.url
149
- }), s.sharedLinkEmail && /* @__PURE__ */ i(v, {
149
+ }), s.sharedLinkEmail && /* @__PURE__ */ i(C, {
150
150
  align: "end",
151
151
  content: e(t.sharedLinkEmailLabel),
152
152
  children: /* @__PURE__ */ i(Y, {
@@ -154,30 +154,30 @@ function Ie() {
154
154
  "data-target-id": "Button-SendSharedLink",
155
155
  disabled: n,
156
156
  icon: $,
157
- onClick: () => F("email"),
157
+ onClick: () => B("email"),
158
158
  size: "large",
159
159
  variant: "secondary"
160
160
  })
161
161
  })]
162
- }), a && (s.sharedLinkAccess || s.sharedLinkPermission) && /* @__PURE__ */ d("div", {
163
- className: c.access,
162
+ }), a && (s.sharedLinkAccess || s.sharedLinkPermission) && /* @__PURE__ */ h("div", {
163
+ className: l.access,
164
164
  children: [s.sharedLinkAccess && /* @__PURE__ */ i(ie, {}), s.sharedLinkPermission && /* @__PURE__ */ i(ae, {})]
165
- }), a && o.access === "open" && /* @__PURE__ */ d("div", {
166
- children: [/* @__PURE__ */ i(B, {
167
- className: c.icon,
168
- height: g,
169
- width: g
170
- }), /* @__PURE__ */ i(C, {
165
+ }), a && o.access === "open" && /* @__PURE__ */ h("div", {
166
+ children: [/* @__PURE__ */ i(P, {
167
+ className: l.icon,
168
+ height: k,
169
+ width: k
170
+ }), /* @__PURE__ */ i(y, {
171
171
  as: "span",
172
172
  color: "textOnLightSecondary",
173
173
  children: o.permission === "can_edit" ? e(t.sharedLinkEditablePubliclyAvailable) : e(t.sharedLinkPubliclyAvailable)
174
174
  })]
175
- }), a && o.access === "company" && o.permission === "can_edit" && /* @__PURE__ */ d("div", {
176
- children: [/* @__PURE__ */ i(B, {
177
- className: c.icon,
178
- height: g,
179
- width: g
180
- }), /* @__PURE__ */ i(C, {
175
+ }), a && o.access === "company" && o.permission === "can_edit" && /* @__PURE__ */ h("div", {
176
+ children: [/* @__PURE__ */ i(P, {
177
+ className: l.icon,
178
+ height: k,
179
+ width: k
180
+ }), /* @__PURE__ */ i(y, {
181
181
  as: "span",
182
182
  color: "textOnLightSecondary",
183
183
  children: e(t.sharedLinkElevatedEditableCompanyAvailable)
package/package.json CHANGED
@@ -1,22 +1,22 @@
1
1
  {
2
2
  "name": "@box/unified-share-modal",
3
- "version": "2.8.14",
3
+ "version": "2.8.16",
4
4
  "license": "SEE LICENSE IN LICENSE",
5
5
  "peerDependencies": {
6
- "@box/blueprint-web": "^13.9.2",
7
- "@box/blueprint-web-assets": "^4.110.0",
8
- "@box/copy-input": "^1.39.37",
9
- "@box/user-selector": "^1.73.38",
6
+ "@box/blueprint-web": "^13.9.3",
7
+ "@box/blueprint-web-assets": "^4.110.1",
8
+ "@box/copy-input": "^1.39.38",
9
+ "@box/user-selector": "^1.73.39",
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.9.2",
17
- "@box/blueprint-web-assets": "^4.110.0",
18
- "@box/copy-input": "^1.39.37",
19
- "@box/storybook-utils": "0.16.86",
16
+ "@box/blueprint-web": "^13.9.3",
17
+ "@box/blueprint-web-assets": "^4.110.1",
18
+ "@box/copy-input": "^1.39.38",
19
+ "@box/storybook-utils": "0.16.87",
20
20
  "@box/eslint-plugin-blueprint": "1.1.6",
21
21
  "react-intl": "^6.4.2"
22
22
  },