@box/unified-share-modal 1.44.6 → 1.45.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.
Files changed (54) hide show
  1. package/dist/esm/lib/components/remove-collaborator-modal/remove-collaborator-modal.js +59 -47
  2. package/dist/esm/lib/components/remove-shared-link-modal/remove-shared-link-modal.js +48 -36
  3. package/dist/esm/lib/components/shared-link-settings-modal/shared-link-settings-modal.js +76 -156
  4. package/dist/esm/lib/components/shared-link-settings-modal/shared-link-settings.js +114 -0
  5. package/dist/esm/lib/components/unified-share-form-modal/collaboration-section/collaboration-role.js +81 -73
  6. package/dist/esm/lib/components/unified-share-form-modal/collaboration-section/collaboration-section.js +99 -98
  7. package/dist/esm/lib/components/unified-share-form-modal/collaborator-list/collaborator-avatar.js +21 -25
  8. package/dist/esm/lib/components/unified-share-form-modal/collaborator-list/collaborator-list.js +63 -60
  9. package/dist/esm/lib/components/unified-share-form-modal/shared-link-section/messages.js +4 -0
  10. package/dist/esm/lib/components/unified-share-form-modal/shared-link-section/shared-link-access.js +73 -65
  11. package/dist/esm/lib/components/unified-share-form-modal/shared-link-section/shared-link-permission.js +72 -64
  12. package/dist/esm/lib/components/unified-share-form-modal/shared-link-section/shared-link-section.js +20 -20
  13. package/dist/esm/lib/components/unified-share-form-modal/unified-share-form-modal.js +64 -57
  14. package/dist/esm/lib/components/unified-share-form-modal/unified-share-form.js +21 -20
  15. package/dist/i18n/bn-IN.js +1 -0
  16. package/dist/i18n/da-DK.js +1 -0
  17. package/dist/i18n/de-DE.js +1 -0
  18. package/dist/i18n/en-AU.js +1 -0
  19. package/dist/i18n/en-CA.js +1 -0
  20. package/dist/i18n/en-GB.js +1 -0
  21. package/dist/i18n/en-US.js +1 -0
  22. package/dist/i18n/en-US.properties +2 -0
  23. package/dist/i18n/en-x-pseudo.js +1 -0
  24. package/dist/i18n/es-419.js +1 -0
  25. package/dist/i18n/es-ES.js +1 -0
  26. package/dist/i18n/fi-FI.js +1 -0
  27. package/dist/i18n/fr-CA.js +1 -0
  28. package/dist/i18n/fr-FR.js +1 -0
  29. package/dist/i18n/hi-IN.js +1 -0
  30. package/dist/i18n/it-IT.js +1 -0
  31. package/dist/i18n/ja-JP.js +1 -0
  32. package/dist/i18n/json/src/lib/components/unified-share-form-modal/shared-link-section/messages.json +1 -1
  33. package/dist/i18n/ko-KR.js +1 -0
  34. package/dist/i18n/nb-NO.js +1 -0
  35. package/dist/i18n/nl-NL.js +1 -0
  36. package/dist/i18n/pl-PL.js +1 -0
  37. package/dist/i18n/pt-BR.js +1 -0
  38. package/dist/i18n/ru-RU.js +1 -0
  39. package/dist/i18n/sv-SE.js +1 -0
  40. package/dist/i18n/tr-TR.js +1 -0
  41. package/dist/i18n/zh-CN.js +1 -0
  42. package/dist/i18n/zh-TW.js +1 -0
  43. package/dist/styles/collaboration-section.css +1 -1
  44. package/dist/styles/collaborator-list.css +1 -1
  45. package/dist/styles/remove-collaborator-modal.css +1 -0
  46. package/dist/styles/shared-link-access.css +1 -1
  47. package/dist/styles/shared-link-section.css +1 -1
  48. package/dist/styles/shared-link-settings-modal.css +1 -1
  49. package/dist/styles/unified-share-form-modal.css +1 -1
  50. package/dist/styles/unified-share-form.css +1 -1
  51. package/dist/types/lib/components/shared-link-settings-modal/shared-link-settings.d.ts +1 -0
  52. package/dist/types/lib/components/unified-share-form-modal/shared-link-section/messages.d.ts +5 -0
  53. package/package.json +1 -1
  54. package/dist/styles/collaborator-avatar.css +0 -1
@@ -1,67 +1,79 @@
1
- import { useEffect as x } from "react";
2
- import { useIntl as y } from "react-intl";
3
- import { Modal as o, Text as B } from "@box/blueprint-web";
4
- import r from "./messages.js";
5
- import { jsx as e, jsxs as c } from "react/jsx-runtime";
6
- import { useUnifiedShareModalContext as C } from "../../contexts/unified-share-modal-context.js";
7
- import { useSharingAction as S } from "../../hooks/use-sharing-action.js";
8
- function T({
9
- isOpen: i,
10
- onOpenChange: a
1
+ import x from "clsx";
2
+ import { useEffect as B } from "react";
3
+ import { useIntl as C } from "react-intl";
4
+ import { Modal as o, Divider as S, Text as k } from "@box/blueprint-web";
5
+ import i from "./messages.js";
6
+ import { jsx as e, jsxs as a } from "react/jsx-runtime";
7
+ import { useUnifiedShareModalContext as M } from "../../contexts/unified-share-modal-context.js";
8
+ import { useSharingAction as w } from "../../hooks/use-sharing-action.js";
9
+ import '../../../../styles/remove-collaborator-modal.css';const A = "_content_166yb_1", D = "_isFullscreen_166yb_1", L = "_body_166yb_10", N = "_divider_166yb_17", r = {
10
+ content: A,
11
+ isFullscreen: D,
12
+ body: L,
13
+ divider: N
14
+ };
15
+ function U({
16
+ isOpen: n,
17
+ onOpenChange: s
11
18
  }) {
12
19
  const {
13
20
  formatMessage: t
14
- } = y(), {
15
- collaborator: l,
16
- isSubmitting: d,
17
- sharingService: f,
18
- setCollaborator: n
19
21
  } = C(), {
20
- email: u,
21
- name: b
22
- } = l ?? {}, {
23
- removeCollaborator: s
24
- } = f;
25
- x(() => {
26
- i || n(null);
27
- }, [i, n]);
22
+ collaborator: c,
23
+ isSubmitting: u,
24
+ sharingService: f,
25
+ setCollaborator: d,
26
+ variant: y
27
+ } = M(), {
28
+ email: v,
29
+ name: _
30
+ } = c ?? {}, {
31
+ removeCollaborator: m
32
+ } = f, l = y === "desktop";
33
+ B(() => {
34
+ n || d(null);
35
+ }, [n, d]);
28
36
  const h = async () => {
29
- s && (await s(l), a(!1), await new Promise((v) => setTimeout(v)));
37
+ m && (await m(c), s(!1), await new Promise((F) => setTimeout(F)));
30
38
  }, {
31
- isLoading: g,
32
- onAction: p
33
- } = S(h, "remove-collaborator"), m = d ?? g;
39
+ isLoading: p,
40
+ onAction: g
41
+ } = w(h, "remove-collaborator"), b = u ?? p;
34
42
  return /* @__PURE__ */ e(o, {
35
- onOpenChange: a,
36
- open: i,
37
- children: /* @__PURE__ */ c(o.Content, {
43
+ onOpenChange: s,
44
+ open: n,
45
+ children: /* @__PURE__ */ a(o.Content, {
46
+ className: x(r.content, l && r.isFullscreen),
38
47
  size: "small",
39
48
  children: [/* @__PURE__ */ e(o.Header, {
40
- children: t(r.title)
41
- }), /* @__PURE__ */ e(o.Body, {
42
- children: /* @__PURE__ */ e(B, {
49
+ children: t(i.title)
50
+ }), /* @__PURE__ */ a(o.Body, {
51
+ className: r.body,
52
+ children: [l && /* @__PURE__ */ e(S, {
53
+ className: r.divider
54
+ }), /* @__PURE__ */ e(k, {
43
55
  as: "p",
44
- children: t(r.bodyText, {
45
- name: u || b
56
+ children: t(i.bodyText, {
57
+ name: v || _
46
58
  })
47
- })
48
- }), /* @__PURE__ */ c(o.Footer, {
59
+ })]
60
+ }), /* @__PURE__ */ a(o.Footer, {
49
61
  children: [/* @__PURE__ */ e(o.Footer.SecondaryButton, {
50
- disabled: m,
51
- onClick: () => a(!1),
52
- children: t(r.cancelButton)
62
+ disabled: b,
63
+ onClick: () => s(!1),
64
+ children: t(i.cancelButton)
53
65
  }), /* @__PURE__ */ e(o.Footer.PrimaryButton, {
54
- loading: m,
55
- loadingAriaLabel: t(r.loadingLabel),
56
- onClick: p,
57
- children: t(r.okayButton)
66
+ loading: b,
67
+ loadingAriaLabel: t(i.loadingLabel),
68
+ onClick: g,
69
+ children: t(i.okayButton)
58
70
  })]
59
- }), /* @__PURE__ */ e(o.Close, {
60
- "aria-label": t(r.closeButton)
71
+ }), !l && /* @__PURE__ */ e(o.Close, {
72
+ "aria-label": t(i.closeButton)
61
73
  })]
62
74
  })
63
75
  });
64
76
  }
65
77
  export {
66
- T as RemoveCollaboratorModal
78
+ U as RemoveCollaboratorModal
67
79
  };
@@ -1,55 +1,67 @@
1
- import { useIntl as b } from "react-intl";
2
- import { Modal as e, Text as g } from "@box/blueprint-web";
3
- import t from "./messages.js";
1
+ import p from "clsx";
2
+ import { useIntl as g } from "react-intl";
3
+ import { Modal as e, Divider as k, Text as v } from "@box/blueprint-web";
4
+ import i from "./messages.js";
4
5
  import { jsx as o, jsxs as l } from "react/jsx-runtime";
5
- import { useUnifiedShareModalContext as S } from "../../contexts/unified-share-modal-context.js";
6
- import { useSharingAction as p } from "../../hooks/use-sharing-action.js";
7
- function M({
8
- isOpen: s,
9
- onOpenChange: n
6
+ import { useUnifiedShareModalContext as F } from "../../contexts/unified-share-modal-context.js";
7
+ import { useSharingAction as S } from "../../hooks/use-sharing-action.js";
8
+ import '../../../../styles/remove-collaborator-modal.css';const x = "_content_166yb_1", B = "_isFullscreen_166yb_1", D = "_body_166yb_10", L = "_divider_166yb_17", n = {
9
+ content: x,
10
+ isFullscreen: B,
11
+ body: D,
12
+ divider: L
13
+ };
14
+ function P({
15
+ isOpen: d,
16
+ onOpenChange: s
10
17
  }) {
11
18
  const {
12
- formatMessage: i
13
- } = b(), {
14
- isSubmitting: d,
15
- sharingService: c
16
- } = S(), {
17
- deleteSharedLink: r
18
- } = c, m = async () => {
19
- r && (await r(), n(!1), await new Promise((f) => setTimeout(f)));
19
+ formatMessage: t
20
+ } = g(), {
21
+ isSubmitting: m,
22
+ sharingService: u,
23
+ variant: b
24
+ } = F(), {
25
+ deleteSharedLink: a
26
+ } = u, r = b === "desktop", y = async () => {
27
+ a && (await a(), s(!1), await new Promise((_) => setTimeout(_)));
20
28
  }, {
21
- isLoading: h,
22
- onAction: u
23
- } = p(m, "delete-shared-link"), a = d ?? h;
29
+ isLoading: f,
30
+ onAction: h
31
+ } = S(y, "delete-shared-link"), c = m ?? f;
24
32
  return /* @__PURE__ */ o(e, {
25
- onOpenChange: n,
26
- open: s,
33
+ onOpenChange: s,
34
+ open: d,
27
35
  children: /* @__PURE__ */ l(e.Content, {
36
+ className: p(n.content, r && n.isFullscreen),
28
37
  size: "small",
29
38
  children: [/* @__PURE__ */ o(e.Header, {
30
- children: i(t.title)
31
- }), /* @__PURE__ */ o(e.Body, {
32
- children: /* @__PURE__ */ o(g, {
39
+ children: t(i.title)
40
+ }), /* @__PURE__ */ l(e.Body, {
41
+ className: n.body,
42
+ children: [r && /* @__PURE__ */ o(k, {
43
+ className: n.divider
44
+ }), /* @__PURE__ */ o(v, {
33
45
  as: "p",
34
- children: i(t.bodyText)
35
- })
46
+ children: t(i.bodyText)
47
+ })]
36
48
  }), /* @__PURE__ */ l(e.Footer, {
37
49
  children: [/* @__PURE__ */ o(e.Footer.SecondaryButton, {
38
- disabled: a,
39
- onClick: () => n(!1),
40
- children: i(t.cancelButton)
50
+ disabled: c,
51
+ onClick: () => s(!1),
52
+ children: t(i.cancelButton)
41
53
  }), /* @__PURE__ */ o(e.Footer.PrimaryButton, {
42
- loading: a,
43
- loadingAriaLabel: i(t.loadingLabel),
44
- onClick: u,
45
- children: i(t.okayButton)
54
+ loading: c,
55
+ loadingAriaLabel: t(i.loadingLabel),
56
+ onClick: h,
57
+ children: t(i.okayButton)
46
58
  })]
47
- }), /* @__PURE__ */ o(e.Close, {
48
- "aria-label": i(t.closeButton)
59
+ }), !r && /* @__PURE__ */ o(e.Close, {
60
+ "aria-label": t(i.closeButton)
49
61
  })]
50
62
  })
51
63
  });
52
64
  }
53
65
  export {
54
- M as RemoveSharedLinkModal
66
+ P as RemoveSharedLinkModal
55
67
  };
@@ -1,169 +1,89 @@
1
- import { useState as W, useEffect as X } from "react";
2
- import { useIntl as Y } from "react-intl";
3
- import { Modal as t, LoadingIndicator as Z, InlineNotice as $, Text as O, Link as ee } from "@box/blueprint-web";
4
- import { DownloadSection as ne } from "./download-section.js";
5
- import { ExpirationSection as ae } from "./expiration-section.js";
6
- import { PasswordSection as ie } from "./password-section.js";
7
- import { VanitySection as oe } from "./vanity-section.js";
8
- import i from "./messages.js";
9
- import { jsx as n, jsxs as h } from "react/jsx-runtime";
10
- import { useAccessLevels as te } from "../../hooks/use-access-levels.js";
11
- import { useSharedLinkSettingsContext as se } from "../../contexts/shared-link-settings-context.js";
12
- import { useUnifiedShareModalContext as re } from "../../contexts/unified-share-modal-context.js";
13
- import '../../../../styles/shared-link-settings-modal.css';const le = "_content_1r0kk_1", de = "_body_1r0kk_5", ce = "_loading_1r0kk_17", b = {
14
- content: le,
15
- body: de,
16
- loading: ce
1
+ import r from "clsx";
2
+ import { useState as k, useEffect as w } from "react";
3
+ import { useIntl as C } from "react-intl";
4
+ import { Modal as i, LoadingIndicator as q, Divider as B } from "@box/blueprint-web";
5
+ import { SharedLinkSettings as N } from "./shared-link-settings.js";
6
+ import t from "./messages.js";
7
+ import { jsx as o, jsxs as d } from "react/jsx-runtime";
8
+ import { useUnifiedShareModalContext as M } from "../../contexts/unified-share-modal-context.js";
9
+ import { useSharedLinkSettingsContext as D } from "../../contexts/shared-link-settings-context.js";
10
+ import '../../../../styles/shared-link-settings-modal.css';const I = "_content_1xw3q_1", j = "_isFullscreen_1xw3q_4", z = "_body_1xw3q_13", U = "_form_1xw3q_28", A = "_isLoading_1xw3q_35", E = "_loading_1xw3q_39", H = "_divider_1xw3q_50", e = {
11
+ content: I,
12
+ isFullscreen: j,
13
+ body: z,
14
+ form: U,
15
+ isLoading: A,
16
+ loading: E,
17
+ divider: H
17
18
  };
18
- function ke({
19
- isOpen: d,
20
- onOpenChange: p
19
+ function X({
20
+ isOpen: s,
21
+ onOpenChange: m
21
22
  }) {
22
23
  const {
23
- formatMessage: a
24
- } = Y(), {
25
- eventService: L,
26
- isSubmitting: x,
27
- sharedLink: E
28
- } = re(), {
29
- settings: N = {},
30
- vanityDomain: D = ""
31
- } = E, {
32
- canChangeDownload: u,
33
- canChangeExpiration: S,
34
- canChangePassword: v,
35
- canChangeVanityName: w,
36
- isDownloadAvailable: F,
37
- isPasswordAvailable: A,
38
- isVanityNameAvailable: P
39
- } = N, {
40
- onSharedLinkSettingsClose: f,
41
- onSharedLinkSettingsLoad: c
42
- } = L, {
43
- selectedAccess: B
44
- } = te(), {
45
- errors: g,
46
- formData: o,
47
- initialFormData: C,
48
- isUpdating: T,
49
- resetForm: y,
50
- setFieldError: s,
51
- setFieldValue: r,
52
- submitForm: _,
53
- validatePassword: I
54
- } = se(), [m, V] = W(!!c);
55
- X(() => {
56
- (async () => c && (d && await c(), V(!d)))();
57
- }, [d, c]);
58
- const k = () => {
59
- y(), f && f(), p(!1);
60
- }, M = async () => {
61
- await _() || (y(), p(!1));
62
- }, j = (e) => {
63
- s("expiration", void 0), r("isExpirationEnabled", e);
64
- }, z = (e) => {
65
- s("expiration", void 0), r("expiration", e);
66
- }, U = (e) => {
67
- s("vanityName", void 0), r("isVanityNameEnabled", e);
68
- }, H = (e) => {
69
- s("vanityName", void 0), r("vanityName", e.target.value);
70
- }, q = (e) => {
71
- s("password", void 0), r("isPasswordEnabled", e);
72
- }, G = (e) => {
73
- s("password", void 0), r("password", e.target.value);
74
- }, J = (e) => {
75
- r("isDownloadEnabled", e);
76
- }, K = (e) => {
77
- const R = document.getElementById("usm-SharedLinkSettingsModal-primaryButton")?.contains(e.relatedTarget);
78
- C.isPasswordEnabled && !o.password || R || I(o.password);
79
- }, l = x || T, Q = u && S && v && w;
80
- return /* @__PURE__ */ n(t, {
81
- onOpenChange: k,
82
- open: d,
83
- children: /* @__PURE__ */ h(t.Content, {
84
- className: b.content,
24
+ formatMessage: n
25
+ } = C(), {
26
+ eventService: h,
27
+ isFetching: L,
28
+ isSubmitting: S,
29
+ variant: b
30
+ } = M(), {
31
+ onSharedLinkSettingsClose: g,
32
+ onSharedLinkSettingsLoad: a
33
+ } = h, l = b === "desktop", {
34
+ isUpdating: x,
35
+ resetForm: f,
36
+ submitForm: p
37
+ } = D(), [F, v] = k(!!a);
38
+ w(() => {
39
+ (async () => a && (s && await a(), v(!s)))();
40
+ }, [s, a]);
41
+ const u = () => {
42
+ f(), g && g(), m(!1);
43
+ }, y = async () => {
44
+ await p() || (f(), m(!1));
45
+ }, c = L ?? F, _ = S || x;
46
+ return /* @__PURE__ */ o(i, {
47
+ onOpenChange: u,
48
+ open: s,
49
+ children: /* @__PURE__ */ d(i.Content, {
50
+ className: r(e.content, l && e.isFullscreen),
85
51
  size: "medium",
86
- children: [/* @__PURE__ */ n(t.Header, {
87
- children: a(i.title)
88
- }), /* @__PURE__ */ h(t.Body, {
89
- className: b.body,
90
- inert: m ? "" : null,
91
- children: [m && /* @__PURE__ */ n("div", {
92
- className: b.loading,
93
- children: /* @__PURE__ */ n(Z, {
94
- "aria-label": a(i.loadingLabel),
52
+ children: [/* @__PURE__ */ o(i.Header, {
53
+ children: n(t.title)
54
+ }), /* @__PURE__ */ d("div", {
55
+ className: r(e.form),
56
+ children: [c && /* @__PURE__ */ o("div", {
57
+ className: e.loading,
58
+ children: /* @__PURE__ */ o(q, {
59
+ "aria-label": n(t.loadingLabel),
95
60
  size: "large"
96
61
  })
97
- }), !Q && /* @__PURE__ */ n($, {
98
- variant: "warning",
99
- variantIconAriaLabel: a(i.warningNoticeIconAriaLabel),
100
- children: a(i.inaccessibleSettingsNotice)
101
- }), /* @__PURE__ */ n(O, {
102
- as: "p",
103
- color: "textOnLightSecondary",
104
- children: a(i.subtitle, {
105
- learnSharedLinkSettingsLink: /* @__PURE__ */ n(ee, {
106
- href: "https://support.box.com/hc/en-us/articles/360043697554-Configuring-Individual-Shared-Link-Settings",
107
- rel: "noreferrer",
108
- target: "_blank",
109
- children: a(i.learnSharedLinkSettingsLink)
110
- })
111
- })
112
- }), /* @__PURE__ */ n(ae, {
113
- canChange: !!S,
114
- error: g.expiration,
115
- expiration: o.expiration,
116
- isChecked: o.isExpirationEnabled,
117
- isDisabled: l,
118
- onChange: z,
119
- onToggle: j
120
- }), /* @__PURE__ */ n(ie, {
121
- canChange: !!v,
122
- error: g.password,
123
- isAvailable: A && B?.id === "open",
124
- isChecked: o.isPasswordEnabled,
125
- isDefaultChecked: C.isPasswordEnabled,
126
- isDisabled: l,
127
- onBlur: K,
128
- onChange: G,
129
- onFocus: () => s("password", void 0),
130
- onToggle: q,
131
- password: o.password
132
- }), /* @__PURE__ */ n(oe, {
133
- canChange: !!w,
134
- error: g.vanityName,
135
- isAvailable: !!P,
136
- isChecked: o.isVanityNameEnabled,
137
- isDisabled: l,
138
- onChange: H,
139
- onToggle: U,
140
- vanityDomain: D,
141
- vanityName: o.vanityName
142
- }), /* @__PURE__ */ n(ne, {
143
- canChange: !!u,
144
- isAvailable: !!F,
145
- isChecked: o.isDownloadEnabled,
146
- isDisabled: l,
147
- onToggle: J
148
- })]
149
- }), !m && /* @__PURE__ */ h(t.Footer, {
150
- children: [/* @__PURE__ */ n(t.Footer.SecondaryButton, {
151
- disabled: l,
152
- onClick: k,
153
- children: a(i.cancelButton)
154
- }), /* @__PURE__ */ n(t.Footer.PrimaryButton, {
155
- id: "usm-SharedLinkSettingsModal-primaryButton",
156
- loading: l,
157
- loadingAriaLabel: a(i.loadingLabel),
158
- onClick: M,
159
- children: a(i.saveButton)
62
+ }), /* @__PURE__ */ d(i.Body, {
63
+ className: r(e.body, c && e.isLoading),
64
+ children: [l && /* @__PURE__ */ o(B, {
65
+ className: e.divider
66
+ }), /* @__PURE__ */ o(N, {})]
67
+ }), /* @__PURE__ */ d(i.Footer, {
68
+ className: r(c && e.isLoading),
69
+ children: [/* @__PURE__ */ o(i.Footer.SecondaryButton, {
70
+ disabled: _,
71
+ onClick: u,
72
+ children: n(t.cancelButton)
73
+ }), /* @__PURE__ */ o(i.Footer.PrimaryButton, {
74
+ id: "usm-SharedLinkSettingsModal-primaryButton",
75
+ loading: _,
76
+ loadingAriaLabel: n(t.loadingLabel),
77
+ onClick: y,
78
+ children: n(t.saveButton)
79
+ })]
160
80
  })]
161
- }), /* @__PURE__ */ n(t.Close, {
162
- "aria-label": a(i.closeButton)
81
+ }), !l && /* @__PURE__ */ o(i.Close, {
82
+ "aria-label": n(t.closeButton)
163
83
  })]
164
84
  })
165
85
  });
166
86
  }
167
87
  export {
168
- ke as SharedLinkSettingsModal
88
+ X as SharedLinkSettingsModal
169
89
  };
@@ -0,0 +1,114 @@
1
+ import { useIntl as F } from "react-intl";
2
+ import { InlineNotice as I, Text as B, Link as M } from "@box/blueprint-web";
3
+ import { DownloadSection as j } from "./download-section.js";
4
+ import { ExpirationSection as O } from "./expiration-section.js";
5
+ import { PasswordSection as U } from "./password-section.js";
6
+ import { VanitySection as _ } from "./vanity-section.js";
7
+ import r from "./messages.js";
8
+ import { jsxs as q, Fragment as z, jsx as o } from "react/jsx-runtime";
9
+ import { useAccessLevels as G } from "../../hooks/use-access-levels.js";
10
+ import { useSharedLinkSettingsContext as H } from "../../contexts/shared-link-settings-context.js";
11
+ import { useUnifiedShareModalContext as J } from "../../contexts/unified-share-modal-context.js";
12
+ function oa() {
13
+ const {
14
+ formatMessage: s
15
+ } = F(), {
16
+ isSubmitting: p,
17
+ sharedLink: b
18
+ } = J(), {
19
+ settings: w = {},
20
+ vanityDomain: v = ""
21
+ } = b, {
22
+ canChangeDownload: l,
23
+ canChangeExpiration: c,
24
+ canChangePassword: g,
25
+ canChangeVanityName: m,
26
+ isDownloadAvailable: u,
27
+ isPasswordAvailable: C,
28
+ isVanityNameAvailable: S
29
+ } = w, {
30
+ selectedAccess: f
31
+ } = G(), {
32
+ errors: d,
33
+ formData: e,
34
+ initialFormData: h,
35
+ isUpdating: x,
36
+ setFieldError: n,
37
+ setFieldValue: i,
38
+ validatePassword: E
39
+ } = H(), y = (a) => {
40
+ n("expiration", void 0), i("isExpirationEnabled", a);
41
+ }, k = (a) => {
42
+ n("expiration", void 0), i("expiration", a);
43
+ }, D = (a) => {
44
+ n("vanityName", void 0), i("isVanityNameEnabled", a);
45
+ }, L = (a) => {
46
+ n("vanityName", void 0), i("vanityName", a.target.value);
47
+ }, N = (a) => {
48
+ n("password", void 0), i("isPasswordEnabled", a);
49
+ }, A = (a) => {
50
+ n("password", void 0), i("password", a.target.value);
51
+ }, P = (a) => {
52
+ i("isDownloadEnabled", a);
53
+ }, T = (a) => {
54
+ const V = document.getElementById("usm-SharedLinkSettingsModal-primaryButton")?.contains(a.relatedTarget);
55
+ h.isPasswordEnabled && !e.password || V || E(e.password);
56
+ }, t = p || x;
57
+ return /* @__PURE__ */ q(z, {
58
+ children: [!(l && c && g && m) && /* @__PURE__ */ o(I, {
59
+ variant: "warning",
60
+ variantIconAriaLabel: s(r.warningNoticeIconAriaLabel),
61
+ children: s(r.inaccessibleSettingsNotice)
62
+ }), /* @__PURE__ */ o(B, {
63
+ as: "p",
64
+ color: "textOnLightSecondary",
65
+ children: s(r.subtitle, {
66
+ learnSharedLinkSettingsLink: /* @__PURE__ */ o(M, {
67
+ href: "https://support.box.com/hc/en-us/articles/360043697554-Configuring-Individual-Shared-Link-Settings",
68
+ rel: "noreferrer",
69
+ target: "_blank",
70
+ children: s(r.learnSharedLinkSettingsLink)
71
+ })
72
+ })
73
+ }), /* @__PURE__ */ o(O, {
74
+ canChange: !!c,
75
+ error: d.expiration,
76
+ expiration: e.expiration,
77
+ isChecked: e.isExpirationEnabled,
78
+ isDisabled: t,
79
+ onChange: k,
80
+ onToggle: y
81
+ }), /* @__PURE__ */ o(U, {
82
+ canChange: !!g,
83
+ error: d.password,
84
+ isAvailable: C && f?.id === "open",
85
+ isChecked: e.isPasswordEnabled,
86
+ isDefaultChecked: h.isPasswordEnabled,
87
+ isDisabled: t,
88
+ onBlur: T,
89
+ onChange: A,
90
+ onFocus: () => n("password", void 0),
91
+ onToggle: N,
92
+ password: e.password
93
+ }), /* @__PURE__ */ o(_, {
94
+ canChange: !!m,
95
+ error: d.vanityName,
96
+ isAvailable: !!S,
97
+ isChecked: e.isVanityNameEnabled,
98
+ isDisabled: t,
99
+ onChange: L,
100
+ onToggle: D,
101
+ vanityDomain: v,
102
+ vanityName: e.vanityName
103
+ }), /* @__PURE__ */ o(j, {
104
+ canChange: !!l,
105
+ isAvailable: !!u,
106
+ isChecked: e.isDownloadEnabled,
107
+ isDisabled: t,
108
+ onToggle: P
109
+ })]
110
+ });
111
+ }
112
+ export {
113
+ oa as SharedLinkSettings
114
+ };