@box/unified-share-modal 2.12.14 → 2.12.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.
Files changed (95) hide show
  1. package/dist/chunks/classification-status.js +62 -0
  2. package/dist/chunks/collaboration-role.js +89 -0
  3. package/dist/chunks/collaboration-section.js +156 -0
  4. package/dist/chunks/collaborator-list-item.js +61 -0
  5. package/dist/chunks/collaborator-list.js +74 -0
  6. package/dist/chunks/remove-collaborator-modal.js +61 -0
  7. package/dist/chunks/remove-shared-link-modal.js +56 -0
  8. package/dist/chunks/shared-link-access.js +65 -0
  9. package/dist/chunks/shared-link-permission.js +67 -0
  10. package/dist/chunks/shared-link-section.js +176 -0
  11. package/dist/chunks/shared-link-settings-modal.js +86 -0
  12. package/dist/chunks/shared-with-avatars.js +48 -0
  13. package/dist/chunks/shield-restriction-notice.js +97 -0
  14. package/dist/chunks/text-area-container.js +36 -0
  15. package/dist/chunks/unified-share-form-modal.js +66 -0
  16. package/dist/chunks/unified-share-form.js +23 -0
  17. package/dist/esm/index.js +2 -4
  18. package/dist/esm/lib/components/classification-status/classification-status.js +2 -80
  19. package/dist/esm/lib/components/classification-status/index.js +2 -4
  20. package/dist/esm/lib/components/classification-status/messages.js +10 -12
  21. package/dist/esm/lib/components/index.js +5 -10
  22. package/dist/esm/lib/components/remove-collaborator-modal/index.js +2 -4
  23. package/dist/esm/lib/components/remove-collaborator-modal/messages.js +26 -28
  24. package/dist/esm/lib/components/remove-collaborator-modal/remove-collaborator-modal.js +2 -84
  25. package/dist/esm/lib/components/remove-shared-link-modal/index.js +2 -4
  26. package/dist/esm/lib/components/remove-shared-link-modal/messages.js +26 -28
  27. package/dist/esm/lib/components/remove-shared-link-modal/remove-shared-link-modal.js +2 -72
  28. package/dist/esm/lib/components/shared-link-settings-modal/download-section.js +35 -61
  29. package/dist/esm/lib/components/shared-link-settings-modal/expiration-section.js +33 -50
  30. package/dist/esm/lib/components/shared-link-settings-modal/index.js +2 -4
  31. package/dist/esm/lib/components/shared-link-settings-modal/messages.js +138 -144
  32. package/dist/esm/lib/components/shared-link-settings-modal/password-section.js +32 -52
  33. package/dist/esm/lib/components/shared-link-settings-modal/shared-link-settings-modal.js +2 -98
  34. package/dist/esm/lib/components/shared-link-settings-modal/shared-link-settings.js +97 -126
  35. package/dist/esm/lib/components/shared-link-settings-modal/vanity-section.js +33 -47
  36. package/dist/esm/lib/components/unified-share-form-modal/collaboration-section/collaboration-role.js +2 -128
  37. package/dist/esm/lib/components/unified-share-form-modal/collaboration-section/collaboration-section.js +2 -202
  38. package/dist/esm/lib/components/unified-share-form-modal/collaboration-section/index.js +2 -4
  39. package/dist/esm/lib/components/unified-share-form-modal/collaboration-section/messages.js +134 -136
  40. package/dist/esm/lib/components/unified-share-form-modal/collaboration-section/shared-with-avatars.js +2 -67
  41. package/dist/esm/lib/components/unified-share-form-modal/collaboration-section/shield-restriction-notice.js +2 -134
  42. package/dist/esm/lib/components/unified-share-form-modal/collaboration-section/text-area-container.js +2 -53
  43. package/dist/esm/lib/components/unified-share-form-modal/collaborator-list/collaborator-avatar.js +48 -60
  44. package/dist/esm/lib/components/unified-share-form-modal/collaborator-list/collaborator-list-item.js +2 -86
  45. package/dist/esm/lib/components/unified-share-form-modal/collaborator-list/collaborator-list.js +2 -101
  46. package/dist/esm/lib/components/unified-share-form-modal/collaborator-list/index.js +2 -4
  47. package/dist/esm/lib/components/unified-share-form-modal/collaborator-list/messages.js +38 -40
  48. package/dist/esm/lib/components/unified-share-form-modal/index.js +2 -4
  49. package/dist/esm/lib/components/unified-share-form-modal/messages.js +46 -48
  50. package/dist/esm/lib/components/unified-share-form-modal/shared-link-section/index.js +2 -4
  51. package/dist/esm/lib/components/unified-share-form-modal/shared-link-section/messages.js +142 -144
  52. package/dist/esm/lib/components/unified-share-form-modal/shared-link-section/shared-link-access.js +2 -102
  53. package/dist/esm/lib/components/unified-share-form-modal/shared-link-section/shared-link-permission.js +2 -105
  54. package/dist/esm/lib/components/unified-share-form-modal/shared-link-section/shared-link-section.js +2 -191
  55. package/dist/esm/lib/components/unified-share-form-modal/unified-share-form-modal.js +2 -85
  56. package/dist/esm/lib/components/unified-share-form-modal/unified-share-form.js +2 -29
  57. package/dist/esm/lib/constants.js +44 -28
  58. package/dist/esm/lib/contexts/index.js +4 -14
  59. package/dist/esm/lib/contexts/shared-link-settings-context.js +50 -59
  60. package/dist/esm/lib/contexts/unified-share-form-context.js +60 -57
  61. package/dist/esm/lib/contexts/unified-share-modal-context.js +65 -68
  62. package/dist/esm/lib/hooks/index.js +7 -14
  63. package/dist/esm/lib/hooks/use-access-levels.js +69 -93
  64. package/dist/esm/lib/hooks/use-collaboration-form.js +75 -95
  65. package/dist/esm/lib/hooks/use-form-validation.js +32 -43
  66. package/dist/esm/lib/hooks/use-link-settings-form.js +49 -64
  67. package/dist/esm/lib/hooks/use-permission-levels.js +33 -50
  68. package/dist/esm/lib/hooks/use-sharing-action.js +44 -59
  69. package/dist/esm/lib/messages.js +106 -108
  70. package/dist/esm/lib/unified-share-base.js +30 -40
  71. package/dist/esm/lib/unified-share-modal.js +41 -59
  72. package/dist/esm/lib/utils/collaborator.js +12 -27
  73. package/dist/esm/lib/utils/date.js +10 -14
  74. package/dist/esm/lib/utils/email.js +5 -7
  75. package/dist/esm/lib/utils/event.js +6 -13
  76. package/dist/esm/lib/utils/form.js +4 -14
  77. package/dist/esm/lib/utils/index.js +9 -34
  78. package/dist/esm/lib/utils/notification.js +19 -28
  79. package/dist/esm/lib/utils/permission.js +15 -22
  80. package/dist/esm/lib/utils/validation.js +2 -11
  81. package/dist/styles/classification-status.css +1 -1
  82. package/dist/styles/collaboration-role.css +1 -1
  83. package/dist/styles/collaboration-section.css +1 -1
  84. package/dist/styles/collaborator-list-item.css +1 -1
  85. package/dist/styles/collaborator-list.css +1 -1
  86. package/dist/styles/remove-collaborator-modal.css +1 -1
  87. package/dist/styles/shared-link-access.css +1 -1
  88. package/dist/styles/shared-link-section.css +1 -1
  89. package/dist/styles/shared-link-settings-modal.css +1 -1
  90. package/dist/styles/shared-with-avatars.css +1 -1
  91. package/dist/styles/shield-restriction-notice.css +1 -1
  92. package/dist/styles/text-area-container.css +1 -1
  93. package/dist/styles/unified-share-form-modal.css +1 -1
  94. package/dist/styles/unified-share-form.css +1 -1
  95. package/package.json +10 -10
@@ -1,127 +1,98 @@
1
- import { useMemo as V } from "react";
2
- import { useIntl as F } from "react-intl";
3
- import { InlineNotice as I, Text as M, Link as B } from "@box/blueprint-web";
4
- import { DownloadSection as O } from "./download-section.js";
5
- import { ExpirationSection as j } from "./expiration-section.js";
6
- import { PasswordSection as U } from "./password-section.js";
7
- import { VanitySection as _ } from "./vanity-section.js";
8
- import n from "./messages.js";
9
- import { jsxs as q, Fragment as z, jsx as s } from "react/jsx-runtime";
10
- import { useAccessLevels as G } from "../../hooks/use-access-levels.js";
11
- import { useUnifiedShareModalContext as H } from "../../contexts/unified-share-modal-context.js";
12
- import { useSharedLinkSettingsContext as J } from "../../contexts/shared-link-settings-context.js";
13
- function se() {
14
- const {
15
- formatMessage: t
16
- } = F(), {
17
- isSubmitting: r,
18
- sharedLink: b
19
- } = H(), {
20
- settings: w = {},
21
- vanityDomain: v = ""
22
- } = b, {
23
- canChangeDownload: c,
24
- canChangeExpiration: g,
25
- canChangePassword: m,
26
- canChangeVanityName: h,
27
- isDownloadAvailable: C,
28
- isPasswordAvailable: f,
29
- isVanityNameAvailable: S
30
- } = w, {
31
- selectedAccess: l
32
- } = G(), {
33
- errors: d,
34
- formData: a,
35
- initialFormData: p,
36
- setFieldError: i,
37
- setFieldValue: o,
38
- validatePassword: E
39
- } = J(), u = V(() => {
40
- if (!l)
41
- return null;
42
- switch (l.id) {
43
- case "collaborators":
44
- return n.subtitleCollaborators;
45
- case "open":
46
- return a.isDownloadEnabled ? n.subtitleOpenDownload : n.subtitleOpenView;
47
- case "company":
48
- return a.isDownloadEnabled ? n.subtitleCompanyDownload : n.subtitleCompanyView;
49
- default:
50
- return null;
51
- }
52
- }, [a.isDownloadEnabled, l]), x = (e) => {
53
- i("expiration", void 0), o("isExpirationEnabled", e);
54
- }, y = (e) => {
55
- i("expiration", void 0), o("expiration", e);
56
- }, D = (e) => {
57
- i("vanityName", void 0), o("isVanityNameEnabled", e);
58
- }, k = (e) => {
59
- i("vanityName", void 0), o("vanityName", e.target.value);
60
- }, N = (e) => {
61
- i("password", void 0), o("isPasswordEnabled", e);
62
- }, L = (e) => {
63
- i("password", void 0), o("password", e.target.value);
64
- }, A = (e) => {
65
- o("isDownloadEnabled", e);
66
- }, P = (e) => {
67
- const T = document.getElementById("usm-SharedLinkSettingsModal-primaryButton")?.contains(e.relatedTarget);
68
- p.isPasswordEnabled && !a.password || T || E(a.password);
69
- };
70
- return /* @__PURE__ */ q(z, {
71
- children: [!(c && g && m && h) && /* @__PURE__ */ s(I, {
72
- variant: "warning",
73
- variantIconAriaLabel: t(n.warningNoticeIconAriaLabel),
74
- children: t(n.inaccessibleSettingsNotice)
75
- }), u && /* @__PURE__ */ s(M, {
76
- as: "p",
77
- color: "textOnLightSecondary",
78
- children: t(u, {
79
- learnSharedLinkSettingsLink: /* @__PURE__ */ s(B, {
80
- href: "https://support.box.com/hc/en-us/articles/360043697554-Configuring-Individual-Shared-Link-Settings",
81
- rel: "noreferrer",
82
- target: "_blank",
83
- children: t(n.learnSharedLinkSettingsLink)
84
- })
85
- })
86
- }), /* @__PURE__ */ s(j, {
87
- canChange: !!g,
88
- error: d.expiration,
89
- expiration: a.expiration,
90
- isChecked: a.isExpirationEnabled,
91
- isDisabled: r,
92
- onChange: y,
93
- onToggle: x
94
- }), /* @__PURE__ */ s(U, {
95
- canChange: !!m,
96
- error: d.password,
97
- isAvailable: f && l?.id === "open",
98
- isChecked: a.isPasswordEnabled,
99
- isDefaultChecked: p.isPasswordEnabled,
100
- isDisabled: r,
101
- onBlur: P,
102
- onChange: L,
103
- onFocus: () => i("password", void 0),
104
- onToggle: N,
105
- password: a.password
106
- }), /* @__PURE__ */ s(_, {
107
- canChange: !!h,
108
- error: d.vanityName,
109
- isAvailable: !!S,
110
- isChecked: a.isVanityNameEnabled,
111
- isDisabled: r,
112
- onChange: k,
113
- onToggle: D,
114
- vanityDomain: v,
115
- vanityName: a.vanityName
116
- }), /* @__PURE__ */ s(O, {
117
- canChange: !!c,
118
- isAvailable: !!C,
119
- isChecked: a.isDownloadEnabled,
120
- isDisabled: r,
121
- onToggle: A
122
- })]
123
- });
1
+ import { useUnifiedShareModalContext as e } from "../../contexts/unified-share-modal-context.js";
2
+ import { useAccessLevels as t } from "../../hooks/use-access-levels.js";
3
+ import { useSharedLinkSettingsContext as n } from "../../contexts/shared-link-settings-context.js";
4
+ import r from "./messages.js";
5
+ import { DownloadSection as i } from "./download-section.js";
6
+ import { ExpirationSection as a } from "./expiration-section.js";
7
+ import { PasswordSection as o } from "./password-section.js";
8
+ import { VanitySection as s } from "./vanity-section.js";
9
+ import { useMemo as c } from "react";
10
+ import { useIntl as l } from "react-intl";
11
+ import { InlineNotice as u, Link as d, Text as f } from "@box/blueprint-web";
12
+ import { Fragment as p, jsx as m, jsxs as h } from "react/jsx-runtime";
13
+ function g() {
14
+ let { formatMessage: g } = l(), { isSubmitting: _, sharedLink: v } = e(), { settings: y = {}, vanityDomain: b = "" } = v, { canChangeDownload: x, canChangeExpiration: S, canChangePassword: C, canChangeVanityName: w, isDownloadAvailable: T, isPasswordAvailable: E, isVanityNameAvailable: D } = y, { selectedAccess: O } = t(), { errors: k, formData: A, initialFormData: j, setFieldError: M, setFieldValue: N, validatePassword: P } = n(), F = c(() => {
15
+ if (!O) return null;
16
+ switch (O.id) {
17
+ case "collaborators": return r.subtitleCollaborators;
18
+ case "open": return A.isDownloadEnabled ? r.subtitleOpenDownload : r.subtitleOpenView;
19
+ case "company": return A.isDownloadEnabled ? r.subtitleCompanyDownload : r.subtitleCompanyView;
20
+ default: return null;
21
+ }
22
+ }, [A.isDownloadEnabled, O]);
23
+ return /* @__PURE__ */ h(p, { children: [
24
+ !(x && S && C && w) && /* @__PURE__ */ m(u, {
25
+ variant: "warning",
26
+ variantIconAriaLabel: g(r.warningNoticeIconAriaLabel),
27
+ children: g(r.inaccessibleSettingsNotice)
28
+ }),
29
+ F && /* @__PURE__ */ m(f, {
30
+ as: "p",
31
+ color: "textOnLightSecondary",
32
+ children: g(F, { learnSharedLinkSettingsLink: /* @__PURE__ */ m(d, {
33
+ href: "https://support.box.com/hc/en-us/articles/360043697554-Configuring-Individual-Shared-Link-Settings",
34
+ rel: "noreferrer",
35
+ target: "_blank",
36
+ children: g(r.learnSharedLinkSettingsLink)
37
+ }) })
38
+ }),
39
+ /* @__PURE__ */ m(a, {
40
+ canChange: !!S,
41
+ error: k.expiration,
42
+ expiration: A.expiration,
43
+ isChecked: A.isExpirationEnabled,
44
+ isDisabled: _,
45
+ onChange: (e) => {
46
+ M("expiration", void 0), N("expiration", e);
47
+ },
48
+ onToggle: (e) => {
49
+ M("expiration", void 0), N("isExpirationEnabled", e);
50
+ }
51
+ }),
52
+ /* @__PURE__ */ m(o, {
53
+ canChange: !!C,
54
+ error: k.password,
55
+ isAvailable: E && O?.id === "open",
56
+ isChecked: A.isPasswordEnabled,
57
+ isDefaultChecked: j.isPasswordEnabled,
58
+ isDisabled: _,
59
+ onBlur: (e) => {
60
+ let t = document.getElementById("usm-SharedLinkSettingsModal-primaryButton")?.contains(e.relatedTarget);
61
+ j.isPasswordEnabled && !A.password || t || P(A.password);
62
+ },
63
+ onChange: (e) => {
64
+ M("password", void 0), N("password", e.target.value);
65
+ },
66
+ onFocus: () => M("password", void 0),
67
+ onToggle: (e) => {
68
+ M("password", void 0), N("isPasswordEnabled", e);
69
+ },
70
+ password: A.password
71
+ }),
72
+ /* @__PURE__ */ m(s, {
73
+ canChange: !!w,
74
+ error: k.vanityName,
75
+ isAvailable: !!D,
76
+ isChecked: A.isVanityNameEnabled,
77
+ isDisabled: _,
78
+ onChange: (e) => {
79
+ M("vanityName", void 0), N("vanityName", e.target.value);
80
+ },
81
+ onToggle: (e) => {
82
+ M("vanityName", void 0), N("isVanityNameEnabled", e);
83
+ },
84
+ vanityDomain: b,
85
+ vanityName: A.vanityName
86
+ }),
87
+ /* @__PURE__ */ m(i, {
88
+ canChange: !!x,
89
+ isAvailable: !!T,
90
+ isChecked: A.isDownloadEnabled,
91
+ isDisabled: _,
92
+ onToggle: (e) => {
93
+ N("isDownloadEnabled", e);
94
+ }
95
+ })
96
+ ] });
124
97
  }
125
- export {
126
- se as SharedLinkSettings
127
- };
98
+ export { g as SharedLinkSettings };
@@ -1,48 +1,34 @@
1
- import { useIntl as g } from "react-intl";
2
- import { Switch as v, InlineNotice as I, TextInput as b, Text as f } from "@box/blueprint-web";
3
- import t from "./messages.js";
4
- import { jsxs as o, Fragment as m, jsx as i } from "react/jsx-runtime";
5
- function L({
6
- canChange: n,
7
- error: c,
8
- isAvailable: s,
9
- isChecked: a,
10
- isDisabled: r,
11
- onChange: d,
12
- onToggle: u,
13
- vanityDomain: p,
14
- vanityName: l
15
- }) {
16
- const {
17
- formatMessage: e
18
- } = g();
19
- return s ? /* @__PURE__ */ o(m, {
20
- children: [/* @__PURE__ */ i(v.Item, {
21
- checked: a,
22
- disabled: r || !n,
23
- label: e(t.vanityNameToggleText),
24
- onCheckedChange: u,
25
- value: "vanity-domain-settings"
26
- }), a && /* @__PURE__ */ o(m, {
27
- children: [n && /* @__PURE__ */ i(I, {
28
- variant: "warning",
29
- variantIconAriaLabel: e(t.warningNoticeIconAriaLabel),
30
- children: e(t.vanityDomainSettingsWarningText)
31
- }), /* @__PURE__ */ i(b, {
32
- disabled: r || !n,
33
- error: c,
34
- hideLabel: !0,
35
- label: e(t.vanityNameInputLabel),
36
- onChange: d,
37
- placeholder: e(t.vanityNameInputPlaceholder),
38
- value: l
39
- }), n && /* @__PURE__ */ i(f, {
40
- as: "p",
41
- children: `${p}${l}`
42
- })]
43
- })]
44
- }) : null;
1
+ import e from "./messages.js";
2
+ import { useIntl as t } from "react-intl";
3
+ import { InlineNotice as n, Switch as r, Text as i, TextInput as a } from "@box/blueprint-web";
4
+ import { Fragment as o, jsx as s, jsxs as c } from "react/jsx-runtime";
5
+ function l({ canChange: l, error: u, isAvailable: d, isChecked: f, isDisabled: p, onChange: m, onToggle: h, vanityDomain: g, vanityName: _ }) {
6
+ let { formatMessage: v } = t();
7
+ return d ? /* @__PURE__ */ c(o, { children: [/* @__PURE__ */ s(r.Item, {
8
+ checked: f,
9
+ disabled: p || !l,
10
+ label: v(e.vanityNameToggleText),
11
+ onCheckedChange: h,
12
+ value: "vanity-domain-settings"
13
+ }), f && /* @__PURE__ */ c(o, { children: [
14
+ l && /* @__PURE__ */ s(n, {
15
+ variant: "warning",
16
+ variantIconAriaLabel: v(e.warningNoticeIconAriaLabel),
17
+ children: v(e.vanityDomainSettingsWarningText)
18
+ }),
19
+ /* @__PURE__ */ s(a, {
20
+ disabled: p || !l,
21
+ error: u,
22
+ hideLabel: !0,
23
+ label: v(e.vanityNameInputLabel),
24
+ onChange: m,
25
+ placeholder: v(e.vanityNameInputPlaceholder),
26
+ value: _
27
+ }),
28
+ l && /* @__PURE__ */ s(i, {
29
+ as: "p",
30
+ children: `${g}${_}`
31
+ })
32
+ ] })] }) : null;
45
33
  }
46
- export {
47
- L as VanitySection
48
- };
34
+ export { l as VanitySection };
@@ -1,128 +1,2 @@
1
- import w from "lodash/camelCase";
2
- import { useState as B, useMemo as F, useEffect as z } from "react";
3
- import { useIntl as H } from "react-intl";
4
- import { Tooltip as O, Focusable as P, TriggerButton as D, DropdownMenu as o } from "@box/blueprint-web";
5
- import $ from "../messages.js";
6
- import n from "./messages.js";
7
- import { jsx as t, jsxs as f } from "react/jsx-runtime";
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
- import { useUnifiedShareModalContext as V } from "../../../contexts/unified-share-modal-context.js";
11
- import '../../../../../styles/collaboration-role.css';const W = "_button_jl1fl_1", q = "_focusable_jl1fl_10", G = "_content_jl1fl_14", J = "_option_jl1fl_17", s = {
12
- button: W,
13
- focusable: q,
14
- content: G,
15
- option: J
16
- };
17
- function le() {
18
- const {
19
- formatMessage: e
20
- } = H(), [g, x] = B(!1), {
21
- collaborationRole: C,
22
- setCollaborationRole: m
23
- } = U(), {
24
- collaborationRoles: h,
25
- eventService: T,
26
- isSubmitting: k,
27
- item: j,
28
- variant: L
29
- } = V(), {
30
- permissions: y = {},
31
- type: p
32
- } = j, {
33
- onCollaborationRoleChange: v
34
- } = T, R = L === "desktop", r = F(() => h.map((l) => {
35
- const {
36
- description: u,
37
- id: i,
38
- label: a
39
- } = l, b = A(i), d = w(i);
40
- let _ = d;
41
- i === "editor" && p === "folder" && (_ += "Folder");
42
- let I = i, M = "";
43
- return b && (I = e($[`${d}Role`]), M = e(n[`${_}Description`])), {
44
- ...l,
45
- description: u ?? M,
46
- label: a ?? I
47
- };
48
- }), [h, e, p]);
49
- if (z(() => {
50
- m(E(r));
51
- }, [r, m]), !r.length || !C)
52
- return null;
53
- const {
54
- id: N,
55
- label: S
56
- } = C;
57
- let c;
58
- return y.canInviteCollaborator || (c = e(n.inviteDisabledTooltip)), p === "web_link" && (c = e(n.inviteWebLinkDisabledTooltip)), c ? /* @__PURE__ */ t(O, {
59
- align: "start",
60
- content: c,
61
- "data-testid": "usm-CollaborationRole-tooltip",
62
- side: "bottom",
63
- children: /* @__PURE__ */ t(P, {
64
- className: s.focusable,
65
- children: /* @__PURE__ */ t(D, {
66
- caretDirection: "down",
67
- className: s.button,
68
- disabled: !0,
69
- label: e(n.inviteAsRoleLabel, {
70
- role: S
71
- }),
72
- size: "extraSmall",
73
- variant: "tertiary"
74
- })
75
- })
76
- }) : /* @__PURE__ */ f(o.Root, {
77
- isFullScreenEnabled: R,
78
- menuItemsSize: "medium",
79
- onOpenChange: x,
80
- open: g,
81
- children: [/* @__PURE__ */ t(o.Trigger, {
82
- children: /* @__PURE__ */ t(D, {
83
- caretDirection: g ? "up" : "down",
84
- className: s.button,
85
- "data-target-id": "PlainButton-InviteePermissionsMenuToggle",
86
- disabled: k,
87
- label: e(n.inviteAsRoleLabel, {
88
- role: S
89
- }),
90
- size: "extraSmall",
91
- variant: "tertiary"
92
- })
93
- }), /* @__PURE__ */ f(o.Content, {
94
- align: "start",
95
- className: s.content,
96
- children: [R && /* @__PURE__ */ f(o.Header, {
97
- children: [/* @__PURE__ */ t(o.Header.MenuCloseButton, {
98
- "aria-label": e(n.closeButton),
99
- iconVariant: "back"
100
- }), /* @__PURE__ */ t(o.Header.TextContent, {
101
- title: e(n.invitePeopleLabel)
102
- })]
103
- }), r.map((l) => {
104
- const {
105
- description: u,
106
- isDisabled: i,
107
- id: a,
108
- label: b
109
- } = l, d = () => {
110
- m(l), v && v(a);
111
- };
112
- return /* @__PURE__ */ t(o.CheckboxItem, {
113
- checked: N === a,
114
- disabled: i,
115
- onSelect: d,
116
- children: /* @__PURE__ */ t(o.Item.MainContent, {
117
- caption: u,
118
- className: s.option,
119
- label: b
120
- })
121
- }, a);
122
- })]
123
- })]
124
- });
125
- }
126
- export {
127
- le as CollaborationRole
128
- };
1
+ import { t as e } from "../../../../../chunks/collaboration-role.js";
2
+ export { e as CollaborationRole };
@@ -1,202 +1,2 @@
1
- import fe from "clsx";
2
- import { useState as be, useRef as ge, useEffect as A, useCallback as C } from "react";
3
- import { createPortal as Ce } from "react-dom";
4
- import { useIntl as ve } from "react-intl";
5
- import { useBlueprintModernization as Se, useNotification as Ue, useUniqueId as Fe, useLabelable as _e, Tooltip as xe, Focusable as Ee, Text as ye, Modal as v } from "@box/blueprint-web";
6
- import { Globe as Le } from "@box/blueprint-web-assets/icons/Medium";
7
- import { bpSize040 as B } from "@box/blueprint-web-assets/tokens/tokens";
8
- import { UserSelectorContainer as Me } from "@box/user-selector";
9
- import { CollaborationRole as Ne } from "./collaboration-role.js";
10
- import { SharedWithAvatars as Pe } from "./shared-with-avatars.js";
11
- import { ShieldRestrictionNotice as Ae } from "./shield-restriction-notice.js";
12
- import { TextAreaContainer as Be } from "./text-area-container.js";
13
- import i from "./messages.js";
14
- import { jsxs as l, jsx as t, Fragment as Re } from "react/jsx-runtime";
15
- import { useFormValidation as ke } from "../../../hooks/use-form-validation.js";
16
- import { useCollaborationForm as Ve } from "../../../hooks/use-collaboration-form.js";
17
- import { useUnifiedShareFormContext as De } 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 { getNotificationArgs as ze } from "../../../utils/notification.js";
21
- import '../../../../../styles/collaboration-section.css';const Oe = "_container_1e2gg_2", we = "_label_1e2gg_8", We = "_modernized_1e2gg_15", je = "_security_1e2gg_33", Ge = "_icon_1e2gg_37", qe = "_access_1e2gg_43", c = {
22
- container: Oe,
23
- label: we,
24
- modernized: We,
25
- security: je,
26
- icon: Ge,
27
- access: qe
28
- };
29
- function ut() {
30
- const {
31
- formatMessage: o
32
- } = ve(), [S, y] = be(), {
33
- enableModernizedComponents: R
34
- } = Se(), {
35
- addNotification: k
36
- } = Ue(), {
37
- validateShieldRestriction: V
38
- } = ke(), {
39
- contactValue: D,
40
- containerRef: U,
41
- form: r,
42
- setForm: d,
43
- setUserContacts: I,
44
- shieldRestriction: T,
45
- userContacts: a
46
- } = De(), {
47
- collaborationAccess: z,
48
- collaborationNotices: O,
49
- config: m,
50
- contactService: w,
51
- isFetching: W,
52
- isSubmitting: u,
53
- item: j,
54
- onOpenChange: G,
55
- sharingService: q,
56
- variant: K
57
- } = Ie(), {
58
- permissions: $ = {},
59
- type: H
60
- } = j, {
61
- getContacts: F,
62
- getContactsAvatarUrls: _
63
- } = w, {
64
- sendInvitations: J,
65
- sendSharedLink: Q
66
- } = q, X = K === "desktop", h = r === "default" || r === "invite", n = r === "invite" || r === "email", Y = r === "invite" && m.collaborationMessage, Z = r === "email" && m.sharedLinkEmailMessage, ee = a.some((e) => e.isExternalUser);
67
- let x, E;
68
- r === "invite" && (x = J, E = "invite-collaborators"), r === "email" && (x = Q, E = "email-shared-link");
69
- const {
70
- errors: te,
71
- handleFormReset: L,
72
- handleFormSubmit: oe,
73
- handleSelectedUsersChange: p,
74
- handleUserSelectorBlur: re,
75
- updateContactValue: ie
76
- } = Ve(x, E), M = ge(r === "email" ? "email" : "invite");
77
- A(() => {
78
- M.current = r === "email" ? "email" : "invite";
79
- }, [r]), A(() => {
80
- (!a.length || !a.some((e) => e.chipVariant === "error")) && y(null);
81
- }, [a]);
82
- const ae = C((e) => (e.stopPropagation(), !0), []), ne = C((e) => F ? F(e, M.current) : Promise.resolve([]), [F]), se = C((e) => _ ? _(e) : Promise.resolve({}), [_]), le = (e) => {
83
- n || d("invite"), ie(e);
84
- }, ce = C((e) => {
85
- const s = e.clipboardData.getData("text");
86
- Te(s).length !== 0 && (e.preventDefault(), n || d("invite"), p([...a, {
87
- value: s
88
- }]));
89
- }, [p, n, d, a]), de = () => {
90
- L(), d("default");
91
- }, me = async () => {
92
- try {
93
- if (S) {
94
- const e = V(a, T);
95
- if (e) {
96
- k({
97
- ...ze(o, "error"),
98
- styledText: e
99
- });
100
- return;
101
- }
102
- }
103
- if (await oe())
104
- return;
105
- L(), G(!1), d("default");
106
- } catch (e) {
107
- if (!e.shieldRestriction)
108
- return;
109
- const {
110
- shieldRestriction: s
111
- } = e, P = [...s.restrictedEmails ?? [], ...s.restrictedGroups ?? []], pe = a.map((g) => P.includes(g.email) || P.includes(`${g.id}`) ? {
112
- ...g,
113
- chipVariant: "error"
114
- } : g);
115
- y(s), I(pe);
116
- }
117
- };
118
- let f, b = !1;
119
- h && !$.canInviteCollaborator && (f = o(i.inviteDisabledTooltip), b = !0), h && H === "web_link" && (f = o(i.inviteWebLinkDisabledTooltip), b = !0);
120
- const N = Fe("usm-UserContacts-"), ue = o(h ? i.invitePeopleLabel : i.emailSharedLinkLabel), he = _e(ue, N);
121
- return /* @__PURE__ */ l("form", {
122
- className: c.container,
123
- onSubmit: (e) => e.preventDefault(),
124
- children: [S && /* @__PURE__ */ t(Ae, {
125
- error: S,
126
- isLoading: u,
127
- onSelectedUsersChange: p
128
- }), O, /* @__PURE__ */ l("div", {
129
- children: [h && m.collaborators && /* @__PURE__ */ t(Pe, {}), /* @__PURE__ */ t(he, {
130
- className: fe(c.label, R && c.modernized)
131
- }), /* @__PURE__ */ t(xe, {
132
- content: f,
133
- "data-testid": "usm-UserContacts-tooltip",
134
- open: f ? void 0 : !1,
135
- side: "bottom",
136
- children: /* @__PURE__ */ t(Ee, {
137
- focusable: b,
138
- children: /* @__PURE__ */ t(Me, {
139
- className: "usm-UserContacts-input",
140
- clearButtonAriaLabel: o(i.clearButton),
141
- clearOnBlur: !1,
142
- "data-target-id": "PillSelectorDropdown-AddNamesOrEmailAddresses",
143
- disabled: b || u,
144
- displayChipVariant: (e) => e.chipVariant,
145
- error: te.userContacts,
146
- fetchAvatarUrls: se,
147
- fetchUsers: ne,
148
- hideOnEscape: ae,
149
- idForLabel: N,
150
- inputValue: D,
151
- label: null,
152
- onBlur: re,
153
- onInputValueChange: le,
154
- onPaste: ce,
155
- onSelectedUsersChange: p,
156
- placeholder: a.length ? "" : o(i.invitePeoplePlaceholder),
157
- portalElement: U,
158
- selectedUsers: a,
159
- selectOnEnterOrTab: !0,
160
- variant: n ? "textarea" : "input"
161
- })
162
- })
163
- }), h && /* @__PURE__ */ l("div", {
164
- className: c.access,
165
- children: [m.collaborationRole && /* @__PURE__ */ t(Ne, {}), z]
166
- })]
167
- }), (Y || Z) && /* @__PURE__ */ t(Be, {
168
- maxCount: m.collaborationMessageLimit
169
- }), n && ee && /* @__PURE__ */ l("div", {
170
- className: c.security,
171
- children: [/* @__PURE__ */ t(Le, {
172
- className: c.icon,
173
- height: B,
174
- width: B
175
- }), /* @__PURE__ */ t(ye, {
176
- as: "span",
177
- color: "textOnLightSecondary",
178
- children: o(i.contentSharedWithExternalCollaborators)
179
- })]
180
- }), n && U && /* @__PURE__ */ Ce(/* @__PURE__ */ l(Re, {
181
- children: [!W && /* @__PURE__ */ l(v.Footer, {
182
- children: [/* @__PURE__ */ t(v.Footer.SecondaryButton, {
183
- disabled: u,
184
- onClick: de,
185
- children: o(i.cancelButton)
186
- }), /* @__PURE__ */ t(v.Footer.PrimaryButton, {
187
- "data-target-id": "Modal.Footer.PrimaryButton-USMSendInvite",
188
- loading: u,
189
- loadingAriaLabel: o(i.loadingLabel),
190
- onClick: me,
191
- children: o(i.sendButton)
192
- })]
193
- }), !X && /* @__PURE__ */ t(v.Close, {
194
- "aria-label": o(i.closeButton),
195
- disabled: u
196
- })]
197
- }), U)]
198
- });
199
- }
200
- export {
201
- ut as CollaborationSection
202
- };
1
+ import { t as e } from "../../../../../chunks/collaboration-section.js";
2
+ export { e as CollaborationSection };
@@ -1,4 +1,2 @@
1
- import { CollaborationSection as t } from "./collaboration-section.js";
2
- export {
3
- t as CollaborationSection
4
- };
1
+ import { t as e } from "../../../../../chunks/collaboration-section.js";
2
+ export { e as CollaborationSection };