@box/unified-share-modal 0.45.1

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 (175) hide show
  1. package/LICENSE +379 -0
  2. package/README.md +57 -0
  3. package/dist/esm/index.js +4 -0
  4. package/dist/esm/lib/components/index.js +8 -0
  5. package/dist/esm/lib/components/remove-shared-link-modal/index.js +4 -0
  6. package/dist/esm/lib/components/remove-shared-link-modal/messages.js +30 -0
  7. package/dist/esm/lib/components/remove-shared-link-modal/remove-shared-link-modal.js +59 -0
  8. package/dist/esm/lib/components/shared-link-settings-modal/index.js +4 -0
  9. package/dist/esm/lib/components/shared-link-settings-modal/messages.js +106 -0
  10. package/dist/esm/lib/components/shared-link-settings-modal/shared-link-settings-modal.js +181 -0
  11. package/dist/esm/lib/components/unified-share-form-modal/collaboration-section/collaboration-role.js +89 -0
  12. package/dist/esm/lib/components/unified-share-form-modal/collaboration-section/collaboration-section.js +108 -0
  13. package/dist/esm/lib/components/unified-share-form-modal/collaboration-section/index.js +4 -0
  14. package/dist/esm/lib/components/unified-share-form-modal/collaboration-section/messages.js +90 -0
  15. package/dist/esm/lib/components/unified-share-form-modal/collaboration-section/shared-with-avatars.js +58 -0
  16. package/dist/esm/lib/components/unified-share-form-modal/collaboration-section/text-area-container.js +58 -0
  17. package/dist/esm/lib/components/unified-share-form-modal/collaborators-view/collaborator-avatar.js +65 -0
  18. package/dist/esm/lib/components/unified-share-form-modal/collaborators-view/collaborator-list-item.js +64 -0
  19. package/dist/esm/lib/components/unified-share-form-modal/collaborators-view/collaborators-view.js +85 -0
  20. package/dist/esm/lib/components/unified-share-form-modal/collaborators-view/index.js +4 -0
  21. package/dist/esm/lib/components/unified-share-form-modal/collaborators-view/messages.js +38 -0
  22. package/dist/esm/lib/components/unified-share-form-modal/index.js +4 -0
  23. package/dist/esm/lib/components/unified-share-form-modal/messages.js +50 -0
  24. package/dist/esm/lib/components/unified-share-form-modal/shared-link-section/index.js +4 -0
  25. package/dist/esm/lib/components/unified-share-form-modal/shared-link-section/messages.js +98 -0
  26. package/dist/esm/lib/components/unified-share-form-modal/shared-link-section/shared-link-access.js +86 -0
  27. package/dist/esm/lib/components/unified-share-form-modal/shared-link-section/shared-link-permission.js +19 -0
  28. package/dist/esm/lib/components/unified-share-form-modal/shared-link-section/shared-link-section.js +144 -0
  29. package/dist/esm/lib/components/unified-share-form-modal/unified-share-form-modal.js +72 -0
  30. package/dist/esm/lib/components/unified-share-form-modal/unified-share-form.js +29 -0
  31. package/dist/esm/lib/constants.js +25 -0
  32. package/dist/esm/lib/contexts/index.js +9 -0
  33. package/dist/esm/lib/contexts/unified-share-form-context.js +40 -0
  34. package/dist/esm/lib/contexts/unified-share-modal-context.js +11 -0
  35. package/dist/esm/lib/hooks/index.js +12 -0
  36. package/dist/esm/lib/hooks/use-access-levels.js +51 -0
  37. package/dist/esm/lib/hooks/use-collaboration-form.js +70 -0
  38. package/dist/esm/lib/hooks/use-form-validation.js +31 -0
  39. package/dist/esm/lib/hooks/use-link-settings-form.js +60 -0
  40. package/dist/esm/lib/hooks/use-sharing-action.js +71 -0
  41. package/dist/esm/lib/messages.js +70 -0
  42. package/dist/esm/lib/store.js +30 -0
  43. package/dist/esm/lib/unified-share-modal.js +65 -0
  44. package/dist/esm/lib/utils/collaborator.js +26 -0
  45. package/dist/esm/lib/utils/date.js +14 -0
  46. package/dist/esm/lib/utils/event.js +14 -0
  47. package/dist/esm/lib/utils/index.js +19 -0
  48. package/dist/esm/lib/utils/permission.js +14 -0
  49. package/dist/esm/lib/utils/validation.js +5 -0
  50. package/dist/i18n/bn-IN.js +157 -0
  51. package/dist/i18n/bn-IN.properties +290 -0
  52. package/dist/i18n/da-DK.js +157 -0
  53. package/dist/i18n/da-DK.properties +290 -0
  54. package/dist/i18n/de-DE.js +157 -0
  55. package/dist/i18n/de-DE.properties +290 -0
  56. package/dist/i18n/en-AU.js +157 -0
  57. package/dist/i18n/en-AU.properties +290 -0
  58. package/dist/i18n/en-CA.js +157 -0
  59. package/dist/i18n/en-CA.properties +290 -0
  60. package/dist/i18n/en-GB.js +157 -0
  61. package/dist/i18n/en-GB.properties +290 -0
  62. package/dist/i18n/en-US.js +111 -0
  63. package/dist/i18n/en-US.properties +218 -0
  64. package/dist/i18n/en-x-pseudo.js +157 -0
  65. package/dist/i18n/en-x-pseudo.properties +290 -0
  66. package/dist/i18n/es-419.js +157 -0
  67. package/dist/i18n/es-419.properties +290 -0
  68. package/dist/i18n/es-ES.js +157 -0
  69. package/dist/i18n/es-ES.properties +290 -0
  70. package/dist/i18n/fi-FI.js +157 -0
  71. package/dist/i18n/fi-FI.properties +290 -0
  72. package/dist/i18n/fr-CA.js +157 -0
  73. package/dist/i18n/fr-CA.properties +290 -0
  74. package/dist/i18n/fr-FR.js +157 -0
  75. package/dist/i18n/fr-FR.properties +290 -0
  76. package/dist/i18n/hi-IN.js +157 -0
  77. package/dist/i18n/hi-IN.properties +290 -0
  78. package/dist/i18n/it-IT.js +157 -0
  79. package/dist/i18n/it-IT.properties +290 -0
  80. package/dist/i18n/ja-JP.js +157 -0
  81. package/dist/i18n/ja-JP.properties +290 -0
  82. package/dist/i18n/json/src/lib/components/remove-shared-link-modal/messages.json +1 -0
  83. package/dist/i18n/json/src/lib/components/shared-link-settings-modal/messages.json +1 -0
  84. package/dist/i18n/json/src/lib/components/unified-share-form-modal/collaboration-section/messages.json +1 -0
  85. package/dist/i18n/json/src/lib/components/unified-share-form-modal/collaborators-view/messages.json +1 -0
  86. package/dist/i18n/json/src/lib/components/unified-share-form-modal/messages.json +1 -0
  87. package/dist/i18n/json/src/lib/components/unified-share-form-modal/shared-link-section/messages.json +1 -0
  88. package/dist/i18n/json/src/lib/messages.json +1 -0
  89. package/dist/i18n/ko-KR.js +157 -0
  90. package/dist/i18n/ko-KR.properties +290 -0
  91. package/dist/i18n/nb-NO.js +157 -0
  92. package/dist/i18n/nb-NO.properties +290 -0
  93. package/dist/i18n/nl-NL.js +157 -0
  94. package/dist/i18n/nl-NL.properties +290 -0
  95. package/dist/i18n/pl-PL.js +157 -0
  96. package/dist/i18n/pl-PL.properties +290 -0
  97. package/dist/i18n/pt-BR.js +157 -0
  98. package/dist/i18n/pt-BR.properties +290 -0
  99. package/dist/i18n/ru-RU.js +157 -0
  100. package/dist/i18n/ru-RU.properties +290 -0
  101. package/dist/i18n/sv-SE.js +157 -0
  102. package/dist/i18n/sv-SE.properties +290 -0
  103. package/dist/i18n/tr-TR.js +157 -0
  104. package/dist/i18n/tr-TR.properties +290 -0
  105. package/dist/i18n/zh-CN.js +157 -0
  106. package/dist/i18n/zh-CN.properties +290 -0
  107. package/dist/i18n/zh-TW.js +157 -0
  108. package/dist/i18n/zh-TW.properties +290 -0
  109. package/dist/styles/collaboration-role.css +1 -0
  110. package/dist/styles/collaboration-section.css +1 -0
  111. package/dist/styles/collaborator-avatar.css +1 -0
  112. package/dist/styles/collaborator-list-item.css +1 -0
  113. package/dist/styles/collaborators-view.css +1 -0
  114. package/dist/styles/remove-shared-link-modal.css +1 -0
  115. package/dist/styles/shared-link-access.css +1 -0
  116. package/dist/styles/shared-link-permission.css +1 -0
  117. package/dist/styles/shared-link-section.css +1 -0
  118. package/dist/styles/shared-link-settings-modal.css +1 -0
  119. package/dist/styles/shared-with-avatars.css +1 -0
  120. package/dist/styles/text-area-container.css +1 -0
  121. package/dist/styles/unified-share-form-modal.css +1 -0
  122. package/dist/styles/unified-share-form.css +1 -0
  123. package/dist/types/index.d.ts +1 -0
  124. package/dist/types/lib/components/index.d.ts +3 -0
  125. package/dist/types/lib/components/remove-shared-link-modal/index.d.ts +1 -0
  126. package/dist/types/lib/components/remove-shared-link-modal/messages.d.ts +33 -0
  127. package/dist/types/lib/components/remove-shared-link-modal/remove-shared-link-modal.d.ts +5 -0
  128. package/dist/types/lib/components/remove-shared-link-modal/stories/shared.d.ts +3 -0
  129. package/dist/types/lib/components/shared-link-settings-modal/index.d.ts +1 -0
  130. package/dist/types/lib/components/shared-link-settings-modal/messages.d.ts +123 -0
  131. package/dist/types/lib/components/shared-link-settings-modal/shared-link-settings-modal.d.ts +5 -0
  132. package/dist/types/lib/components/shared-link-settings-modal/stories/shared.d.ts +36 -0
  133. package/dist/types/lib/components/unified-share-form-modal/collaboration-section/collaboration-role.d.ts +1 -0
  134. package/dist/types/lib/components/unified-share-form-modal/collaboration-section/collaboration-section.d.ts +1 -0
  135. package/dist/types/lib/components/unified-share-form-modal/collaboration-section/index.d.ts +1 -0
  136. package/dist/types/lib/components/unified-share-form-modal/collaboration-section/messages.d.ts +108 -0
  137. package/dist/types/lib/components/unified-share-form-modal/collaboration-section/shared-with-avatars.d.ts +1 -0
  138. package/dist/types/lib/components/unified-share-form-modal/collaboration-section/text-area-container.d.ts +3 -0
  139. package/dist/types/lib/components/unified-share-form-modal/collaborators-view/collaborator-avatar.d.ts +8 -0
  140. package/dist/types/lib/components/unified-share-form-modal/collaborators-view/collaborator-list-item.d.ts +5 -0
  141. package/dist/types/lib/components/unified-share-form-modal/collaborators-view/collaborators-view.d.ts +1 -0
  142. package/dist/types/lib/components/unified-share-form-modal/collaborators-view/index.d.ts +1 -0
  143. package/dist/types/lib/components/unified-share-form-modal/collaborators-view/messages.d.ts +43 -0
  144. package/dist/types/lib/components/unified-share-form-modal/index.d.ts +1 -0
  145. package/dist/types/lib/components/unified-share-form-modal/messages.d.ts +58 -0
  146. package/dist/types/lib/components/unified-share-form-modal/shared-link-section/index.d.ts +1 -0
  147. package/dist/types/lib/components/unified-share-form-modal/shared-link-section/messages.d.ts +118 -0
  148. package/dist/types/lib/components/unified-share-form-modal/shared-link-section/shared-link-access.d.ts +1 -0
  149. package/dist/types/lib/components/unified-share-form-modal/shared-link-section/shared-link-permission.d.ts +1 -0
  150. package/dist/types/lib/components/unified-share-form-modal/shared-link-section/shared-link-section.d.ts +1 -0
  151. package/dist/types/lib/components/unified-share-form-modal/stories/shared.d.ts +15 -0
  152. package/dist/types/lib/components/unified-share-form-modal/unified-share-form-modal.d.ts +9 -0
  153. package/dist/types/lib/components/unified-share-form-modal/unified-share-form.d.ts +1 -0
  154. package/dist/types/lib/constants.d.ts +7 -0
  155. package/dist/types/lib/contexts/index.d.ts +2 -0
  156. package/dist/types/lib/contexts/unified-share-form-context.d.ts +25 -0
  157. package/dist/types/lib/contexts/unified-share-modal-context.d.ts +16 -0
  158. package/dist/types/lib/hooks/index.d.ts +5 -0
  159. package/dist/types/lib/hooks/use-access-levels.d.ts +6 -0
  160. package/dist/types/lib/hooks/use-collaboration-form.d.ts +10 -0
  161. package/dist/types/lib/hooks/use-form-validation.d.ts +18 -0
  162. package/dist/types/lib/hooks/use-link-settings-form.d.ts +10 -0
  163. package/dist/types/lib/hooks/use-sharing-action.d.ts +7 -0
  164. package/dist/types/lib/messages.d.ts +83 -0
  165. package/dist/types/lib/store.d.ts +21 -0
  166. package/dist/types/lib/stories/shared.d.ts +22 -0
  167. package/dist/types/lib/types.d.ts +387 -0
  168. package/dist/types/lib/unified-share-modal.d.ts +20 -0
  169. package/dist/types/lib/utils/collaborator.d.ts +8 -0
  170. package/dist/types/lib/utils/date.d.ts +3 -0
  171. package/dist/types/lib/utils/event.d.ts +13 -0
  172. package/dist/types/lib/utils/index.d.ts +5 -0
  173. package/dist/types/lib/utils/permission.d.ts +3 -0
  174. package/dist/types/lib/utils/validation.d.ts +2 -0
  175. package/package.json +54 -0
@@ -0,0 +1,181 @@
1
+ import { useMemo as H } from "react";
2
+ import { useIntl as O } from "react-intl";
3
+ import { Modal as r, Text as C, Link as Y, Switch as d, DateI18nProvider as q, DatePicker as G, InlineNotice as E, TextInput as k } from "@box/blueprint-web";
4
+ import e from "./messages.js";
5
+ import { jsx as n, jsxs as s, Fragment as L } from "react/jsx-runtime";
6
+ import { useAccessLevels as J } from "../../hooks/use-access-levels.js";
7
+ import { formatDateFromTimestampToCalendarDate as K, formatTomorrowDateToCalendarDate as Q } from "../../utils/date.js";
8
+ import { useLinkSettingsForm as X } from "../../hooks/use-link-settings-form.js";
9
+ import { useUnifiedShareModalContext as Z } from "../../contexts/unified-share-modal-context.js";
10
+ import '../../../../styles/shared-link-settings-modal.css';const aa = "_content_1wiic_1", ea = "_body_1wiic_5", D = {
11
+ content: aa,
12
+ body: ea
13
+ }, na = "••••••••";
14
+ function ga({
15
+ isOpen: P,
16
+ onOpenChange: c
17
+ }) {
18
+ const {
19
+ formatMessage: a
20
+ } = O(), {
21
+ eventService: f,
22
+ isSubmitting: N,
23
+ sharedLink: S
24
+ } = Z(), {
25
+ expiresAt: p,
26
+ permissions: i = {},
27
+ vanityDomain: T,
28
+ vanityName: h
29
+ } = S, {
30
+ onSharedLinkSettingsClose: v
31
+ } = f, {
32
+ selectedAccess: g
33
+ } = J(), b = p ? K(p) : void 0, w = H(() => ({
34
+ expiration: b,
35
+ isDownloadEnabled: i.isDownloadEnabled ?? !1,
36
+ isExpirationEnabled: !!b,
37
+ isPasswordEnabled: i.isPasswordEnabled ?? !1,
38
+ isVanityEnabled: !!h,
39
+ password: "",
40
+ vanityName: h || ""
41
+ }), [b, i, h]), {
42
+ errors: u,
43
+ formData: o,
44
+ handleFormReset: x,
45
+ handleFormSubmit: A,
46
+ isUpdating: I,
47
+ setFieldError: m,
48
+ setFieldValue: l
49
+ } = X(w), V = () => {
50
+ x(), v && v(), c(!1);
51
+ }, F = async () => {
52
+ await A() || (x(), c(!1));
53
+ }, M = (t) => {
54
+ l("isExpirationEnabled", t);
55
+ }, _ = (t) => {
56
+ m("expiration", void 0), l("expiration", t);
57
+ }, B = (t) => {
58
+ l("isVanityEnabled", t);
59
+ }, U = (t) => {
60
+ m("vanityName", void 0), l("vanityName", t.target.value);
61
+ }, R = (t) => {
62
+ l("isPasswordEnabled", t);
63
+ }, W = (t) => {
64
+ m("password", void 0), l("password", t.target.value);
65
+ }, j = (t) => {
66
+ l("isDownloadEnabled", t);
67
+ }, $ = i.canChangeVanityName && !!o.vanityName, z = `${T || ""}${o.vanityName}`, y = N || I;
68
+ return /* @__PURE__ */ n(r, {
69
+ onOpenChange: c,
70
+ open: P,
71
+ children: /* @__PURE__ */ s(r.Content, {
72
+ className: D.content,
73
+ size: "medium",
74
+ children: [/* @__PURE__ */ n(r.Header, {
75
+ children: a(e.title)
76
+ }), /* @__PURE__ */ s(r.Body, {
77
+ className: D.body,
78
+ children: [/* @__PURE__ */ n(C, {
79
+ as: "p",
80
+ color: "textOnLightSecondary",
81
+ children: a(e.subtitle, {
82
+ learnSharedLinkSettingsLink: /* @__PURE__ */ n(Y, {
83
+ href: "https://support.box.com/hc/en-us/articles/360043697554-Configuring-Individual-Shared-Link-Settings",
84
+ rel: "noreferrer",
85
+ target: "_blank",
86
+ children: a(e.learnSharedLinkSettingsLink)
87
+ })
88
+ })
89
+ }), /* @__PURE__ */ n(d.Item, {
90
+ checked: o.isExpirationEnabled,
91
+ disabled: !i.canChangeExpiration,
92
+ label: a(e.linkExpirationToggleText),
93
+ onCheckedChange: M,
94
+ value: "link-expiration-settings"
95
+ }), o.isExpirationEnabled && // Get the locale from the user's operating system settings
96
+ /* @__PURE__ */ n(q, {
97
+ locale: navigator.language || "en-US",
98
+ children: /* @__PURE__ */ n(G, {
99
+ calendarAriaLabel: a(e.linkExpirationCalendarAriaLabel),
100
+ clearDatePickerAriaLabel: a(e.linkExpirationClearDatePickerAriaLabel),
101
+ error: u.expiration,
102
+ hideLabel: !0,
103
+ isDisabled: !i.canChangeExpiration,
104
+ label: a(e.linkExpirationDatePickerLabel),
105
+ minValue: Q(),
106
+ nextMonthAriaLabel: a(e.linkExpirationNextMonthAriaLabel),
107
+ onChange: _,
108
+ openCalendarDropdownAriaLabel: a(e.linkExpirationOpenCalendarDropdownAriaLabel),
109
+ previousMonthAriaLabel: a(e.linkExpirationPreviousMonthAriaLabel),
110
+ value: o.expiration
111
+ })
112
+ }), i.isPasswordAvailable && (g == null ? void 0 : g.id) === "open" && /* @__PURE__ */ n(d.Item, {
113
+ checked: o.isPasswordEnabled,
114
+ disabled: !i.canChangePassword,
115
+ label: a(e.passwordToggleText),
116
+ onCheckedChange: R,
117
+ value: "password-settings"
118
+ }), o.isPasswordEnabled && /* @__PURE__ */ s(L, {
119
+ children: [i.canChangePassword && /* @__PURE__ */ n(E, {
120
+ variant: "warning",
121
+ variantIconAriaLabel: a(e.warningNoticeIconAriaLabel),
122
+ children: a(e.passwordWarningText)
123
+ }), /* @__PURE__ */ n(k, {
124
+ disabled: !i.canChangePassword,
125
+ hideLabel: !0,
126
+ label: a(e.passwordToggleText),
127
+ onChange: W,
128
+ placeholder: w.isPasswordEnabled ? na : a(e.passwordInputPlaceholder),
129
+ type: "password",
130
+ value: o.password
131
+ })]
132
+ }), i.isVanityNameAvailable && /* @__PURE__ */ n(d.Item, {
133
+ checked: o.isVanityEnabled,
134
+ disabled: !i.canChangeVanityName,
135
+ label: a(e.vanityNameToggleText),
136
+ onCheckedChange: B,
137
+ value: "vanity-domain-settings"
138
+ }), o.isVanityEnabled && /* @__PURE__ */ s(L, {
139
+ children: [i.canChangeVanityName && /* @__PURE__ */ n(E, {
140
+ variant: "warning",
141
+ variantIconAriaLabel: a(e.warningNoticeIconAriaLabel),
142
+ children: a(e.vanityDomainSettingsWarningText)
143
+ }), /* @__PURE__ */ n(k, {
144
+ disabled: !i.canChangeVanityName,
145
+ error: u.vanityName,
146
+ hideLabel: !0,
147
+ label: a(e.vanityNameInputLabel),
148
+ onChange: U,
149
+ placeholder: a(e.vanityNameInputPlaceholder),
150
+ value: o.vanityName
151
+ }), $ && /* @__PURE__ */ n(C, {
152
+ as: "p",
153
+ children: z
154
+ })]
155
+ }), i.isDownloadAvailable && /* @__PURE__ */ n(d.Item, {
156
+ checked: o.isDownloadEnabled,
157
+ disabled: !i.canChangeDownload,
158
+ label: a(e.downloadSettingsToggleText),
159
+ onCheckedChange: j,
160
+ value: "download-link-settings"
161
+ })]
162
+ }), /* @__PURE__ */ s(r.Footer, {
163
+ children: [/* @__PURE__ */ n(r.Footer.SecondaryButton, {
164
+ disabled: y,
165
+ onClick: V,
166
+ children: a(e.cancelButton)
167
+ }), /* @__PURE__ */ n(r.Footer.PrimaryButton, {
168
+ loading: y,
169
+ loadingAriaLabel: a(e.loadingLabel),
170
+ onClick: F,
171
+ children: a(e.saveButton)
172
+ })]
173
+ }), /* @__PURE__ */ n(r.Close, {
174
+ "aria-label": a(e.closeButton)
175
+ })]
176
+ })
177
+ });
178
+ }
179
+ export {
180
+ ga as SharedLinkSettingsModal
181
+ };
@@ -0,0 +1,89 @@
1
+ import I from "clsx";
2
+ import _ from "lodash/camelCase";
3
+ import { useState as y, useMemo as L, useEffect as O } from "react";
4
+ import { useIntl as T } from "react-intl";
5
+ import { DropdownMenu as t, TriggerButton as $ } from "@box/blueprint-web";
6
+ import j from "../messages.js";
7
+ import x from "./messages.js";
8
+ import { jsxs as k, jsx as r } from "react/jsx-runtime";
9
+ import { isInvitationRoleSupported as w, getDefaultCollaborationRole as F } from "../../../utils/collaborator.js";
10
+ import { useUnifiedShareFormContext as P } from "../../../contexts/unified-share-form-context.js";
11
+ import { useUnifiedShareModalContext as U } from "../../../contexts/unified-share-modal-context.js";
12
+ import '../../../../../styles/collaboration-role.css';const z = "_container_19dff_1", A = "_overrides_19dff_5", C = {
13
+ container: z,
14
+ overrides: A
15
+ };
16
+ function X() {
17
+ const {
18
+ formatMessage: i
19
+ } = T(), [d, R] = y(!1), {
20
+ collaborationRole: m,
21
+ setCollaborationRole: l
22
+ } = P(), {
23
+ collaborationRoles: p,
24
+ isSubmitting: M,
25
+ item: S
26
+ } = U(), {
27
+ type: f
28
+ } = S, n = L(() => p.map((o) => {
29
+ const {
30
+ description: a,
31
+ id: e,
32
+ label: s
33
+ } = o, c = w(e), u = _(e);
34
+ let b = u;
35
+ e === "editor" && f === "folder" && (b += "Folder");
36
+ let g = e, h = "";
37
+ return c && (g = i(j[`${u}Role`]), h = i(x[`${b}Description`])), {
38
+ ...o,
39
+ description: a ?? h,
40
+ label: s ?? g
41
+ };
42
+ }), [p, i, f]);
43
+ if (O(() => {
44
+ l(F(n));
45
+ }, [n, l]), !n.length || !m)
46
+ return null;
47
+ const {
48
+ id: v,
49
+ label: D
50
+ } = m;
51
+ return /* @__PURE__ */ k(t.Root, {
52
+ onOpenChange: R,
53
+ open: d,
54
+ children: [/* @__PURE__ */ r(t.Trigger, {
55
+ children: /* @__PURE__ */ r($, {
56
+ caretDirection: d ? "up" : "down",
57
+ className: I(C.container, C.overrides),
58
+ disabled: M,
59
+ label: i(x.inviteAsRoleLabel, {
60
+ role: D
61
+ }),
62
+ size: "extraSmall",
63
+ variant: "tertiary"
64
+ })
65
+ }), /* @__PURE__ */ r(t.Content, {
66
+ align: "start",
67
+ children: n.map((o) => {
68
+ const {
69
+ description: a,
70
+ isDisabled: e,
71
+ id: s,
72
+ label: c
73
+ } = o;
74
+ return /* @__PURE__ */ r(t.CheckboxItem, {
75
+ checked: v === s,
76
+ disabled: e,
77
+ onSelect: () => l(o),
78
+ children: /* @__PURE__ */ r(t.Item.MainContent, {
79
+ caption: a,
80
+ label: c
81
+ })
82
+ }, s);
83
+ })
84
+ })]
85
+ });
86
+ }
87
+ export {
88
+ X as CollaborationRole
89
+ };
@@ -0,0 +1,108 @@
1
+ import { useCallback as C } from "react";
2
+ import { createPortal as G } from "react-dom";
3
+ import { useIntl as H } from "react-intl";
4
+ import { useUniqueId as K, useLabelable as W, Modal as i } from "@box/blueprint-web";
5
+ import { UserSelectorContainer as z } from "@box/user-selector";
6
+ import { CollaborationRole as J } from "./collaboration-role.js";
7
+ import { SharedWithAvatars as Q } from "./shared-with-avatars.js";
8
+ import { TextAreaContainer as X } from "./text-area-container.js";
9
+ import { COLLABORATION_MESSAGE_CHARACTER_LIMIT as Y } from "../../../constants.js";
10
+ import o from "./messages.js";
11
+ import { jsxs as s, jsx as a, Fragment as Z } from "react/jsx-runtime";
12
+ import { useCollaborationForm as $ } from "../../../hooks/use-collaboration-form.js";
13
+ import { useUnifiedShareFormContext as ee } from "../../../contexts/unified-share-form-context.js";
14
+ import { useUnifiedShareModalContext as te } from "../../../contexts/unified-share-modal-context.js";
15
+ import '../../../../../styles/collaboration-section.css';const oe = "_container_19jv3_1", ae = "_label_19jv3_7", U = {
16
+ container: oe,
17
+ label: ae
18
+ };
19
+ function ge() {
20
+ const {
21
+ formatMessage: t
22
+ } = H(), {
23
+ contactValue: A,
24
+ container: c,
25
+ onModalOpenChange: g,
26
+ onShareViewChange: m,
27
+ shareView: r,
28
+ userContacts: v
29
+ } = ee(), {
30
+ config: n,
31
+ contactService: B,
32
+ isFetching: x,
33
+ isSubmitting: u,
34
+ sharingService: I
35
+ } = te(), {
36
+ getContacts: d,
37
+ getContactsAvatarUrls: h
38
+ } = B, {
39
+ sendInvites: P,
40
+ sendSharedLink: _
41
+ } = I, f = r === "default" || r === "invite", l = r === "invite" || r === "email";
42
+ let b, p;
43
+ r === "invite" && (b = P, p = "invite-collaborators"), r === "email" && (b = _, p = "email-shared-link");
44
+ const {
45
+ errors: E,
46
+ handleFormReset: S,
47
+ handleFormSubmit: O,
48
+ handleSelectedUsersChange: M,
49
+ handleUserSelectorBlur: V,
50
+ isFormSubmitting: F,
51
+ updateContactValue: k
52
+ } = $(b, p), N = C((e) => (e.stopPropagation(), !0), []), R = C((e) => d ? d(e) : Promise.resolve([]), [d]), y = C((e) => h ? h(e) : Promise.resolve({}), [h]), T = (e) => {
53
+ l || m("invite"), k(e);
54
+ }, j = () => {
55
+ S(), m("default");
56
+ }, w = async () => {
57
+ await O() || (S(), g && g(!1), m("default"));
58
+ }, L = K("user-contacts-"), q = t(f ? o.invitePeopleLabel : o.emailSharedLinkLabel), D = W(q, L);
59
+ return /* @__PURE__ */ s("form", {
60
+ className: U.container,
61
+ onSubmit: (e) => e.preventDefault(),
62
+ children: [n.collaborationNotices, /* @__PURE__ */ s("div", {
63
+ children: [f && n.collaborators && /* @__PURE__ */ a(Q, {}), /* @__PURE__ */ a(D, {
64
+ className: U.label
65
+ }), /* @__PURE__ */ a(z, {
66
+ className: "collaboration-user-selector",
67
+ clearButtonAriaLabel: t(o.clearButton),
68
+ clearOnBlur: !1,
69
+ disabled: u,
70
+ error: E["user-contact"],
71
+ fetchAvatarUrls: y,
72
+ fetchUsers: R,
73
+ hideOnEscape: N,
74
+ idForLabel: L,
75
+ inputValue: A,
76
+ label: null,
77
+ onBlur: V,
78
+ onInputValueChange: T,
79
+ onSelectedUsersChange: M,
80
+ placeholder: v.length ? "" : t(o.invitePeoplePlaceholder),
81
+ portalElement: c,
82
+ selectedUsers: v,
83
+ selectOnEnterOrTab: !0,
84
+ variant: l ? "textarea" : "input"
85
+ }), f && n.collaborationRole && /* @__PURE__ */ a(J, {})]
86
+ }), l && n.collaborationMessage && /* @__PURE__ */ a(X, {
87
+ maxCount: Y
88
+ }), l && c && /* @__PURE__ */ G(/* @__PURE__ */ s(Z, {
89
+ children: [!x && /* @__PURE__ */ s(i.Footer, {
90
+ children: [/* @__PURE__ */ a(i.Footer.SecondaryButton, {
91
+ disabled: u ?? F,
92
+ onClick: j,
93
+ children: t(o.cancelButton)
94
+ }), /* @__PURE__ */ a(i.Footer.PrimaryButton, {
95
+ loading: u ?? F,
96
+ loadingAriaLabel: t(o.loadingLabel),
97
+ onClick: w,
98
+ children: t(o.sendButton)
99
+ })]
100
+ }), /* @__PURE__ */ a(i.Close, {
101
+ "aria-label": t(o.closeButton)
102
+ })]
103
+ }), c)]
104
+ });
105
+ }
106
+ export {
107
+ ge as CollaborationSection
108
+ };
@@ -0,0 +1,4 @@
1
+ import { CollaborationSection as t } from "./collaboration-section.js";
2
+ export {
3
+ t as CollaborationSection
4
+ };
@@ -0,0 +1,90 @@
1
+ import { defineMessages as e } from "react-intl";
2
+ const o = e({
3
+ cancelButton: {
4
+ id: "groupSharedFeatures.usm.unifiedShareFormModal.collaborationSection.cancelButton",
5
+ defaultMessage: "Cancel"
6
+ },
7
+ closeButton: {
8
+ id: "groupSharedFeatures.usm.unifiedShareFormModal.collaborationSection.closeButton",
9
+ defaultMessage: "Close"
10
+ },
11
+ clearButton: {
12
+ id: "groupSharedFeatures.usm.unifiedShareFormModal.collaborationSection.clearButton",
13
+ defaultMessage: "Clear"
14
+ },
15
+ sendButton: {
16
+ id: "groupSharedFeatures.usm.unifiedShareFormModal.collaborationSection.sendButton",
17
+ defaultMessage: "Send"
18
+ },
19
+ loadingLabel: {
20
+ id: "groupSharedFeatures.usm.unifiedShareFormModal.collaborationSection.loadingLabel",
21
+ defaultMessage: "Loading"
22
+ },
23
+ invitePeopleLabel: {
24
+ id: "groupSharedFeatures.usm.unifiedShareFormModal.collaborationSection.invitePeopleLabel",
25
+ defaultMessage: "Invite People"
26
+ },
27
+ invitePeoplePlaceholder: {
28
+ id: "groupSharedFeatures.usm.unifiedShareFormModal.collaborationSection.invitePeoplePlaceholder",
29
+ defaultMessage: "Add names or email addresses"
30
+ },
31
+ emailSharedLinkLabel: {
32
+ id: "groupSharedFeatures.usm.unifiedShareFormModal.collaborationSection.emailSharedLinkLabel",
33
+ defaultMessage: "Email Shared Link"
34
+ },
35
+ inviteAsRoleLabel: {
36
+ id: "groupSharedFeatures.usm.unifiedShareFormModal.collaborationSection.inviteAsRoleLabel",
37
+ defaultMessage: "Invite as {role}"
38
+ },
39
+ sharedWithLabel: {
40
+ id: "groupSharedFeatures.usm.unifiedShareFormModal.collaborationSection.sharedWithLabel",
41
+ defaultMessage: "Shared with"
42
+ },
43
+ shareMessageLabel: {
44
+ id: "groupSharedFeatures.usm.unifiedShareFormModal.collaborationSection.shareMessageLabel",
45
+ defaultMessage: "Message (optional)"
46
+ },
47
+ shareMessagePlaceholder: {
48
+ id: "groupSharedFeatures.usm.unifiedShareFormModal.collaborationSection.shareMessagePlaceholder",
49
+ defaultMessage: "Add a message"
50
+ },
51
+ shareMessageCharacterCountAriaLabel: {
52
+ id: "groupSharedFeatures.usm.unifiedShareFormModal.collaborationSection.shareMessageCharacterCountAriaLabel",
53
+ defaultMessage: "{count} characters remaining"
54
+ },
55
+ coOwnerDescription: {
56
+ id: "groupSharedFeatures.usm.unifiedShareFormModal.collaborationSection.coOwnerDescription",
57
+ defaultMessage: "Manage security, upload, download, preview, share, edit, and delete"
58
+ },
59
+ editorDescription: {
60
+ id: "groupSharedFeatures.usm.unifiedShareFormModal.collaborationSection.editorDescription",
61
+ defaultMessage: "Upload, download, preview, share, and edit"
62
+ },
63
+ editorFolderDescription: {
64
+ id: "groupSharedFeatures.usm.unifiedShareFormModal.collaborationSection.editorFolderDescription",
65
+ defaultMessage: "Upload, download, preview, share, edit, and delete"
66
+ },
67
+ viewerUploaderDescription: {
68
+ id: "groupSharedFeatures.usm.unifiedShareFormModal.collaborationSection.viewerUploaderDescription",
69
+ defaultMessage: "Upload, download, preview, share, and edit"
70
+ },
71
+ previewerUploaderDescription: {
72
+ id: "groupSharedFeatures.usm.unifiedShareFormModal.collaborationSection.previewerUploaderDescription",
73
+ defaultMessage: "Upload and preview"
74
+ },
75
+ viewerDescription: {
76
+ id: "groupSharedFeatures.usm.unifiedShareFormModal.collaborationSection.viewerDescription",
77
+ defaultMessage: "Download, preview, and share"
78
+ },
79
+ previewerDescription: {
80
+ id: "groupSharedFeatures.usm.unifiedShareFormModal.collaborationSection.previewerDescription",
81
+ defaultMessage: "Preview-only"
82
+ },
83
+ uploaderDescription: {
84
+ id: "groupSharedFeatures.usm.unifiedShareFormModal.collaborationSection.uploaderDescription",
85
+ defaultMessage: "Upload-only"
86
+ }
87
+ });
88
+ export {
89
+ o as default
90
+ };
@@ -0,0 +1,58 @@
1
+ import { useIntl as p } from "react-intl";
2
+ import { Text as v, Avatar as x } from "@box/blueprint-web";
3
+ import { Gray10 as b } from "@box/blueprint-web-assets/tokens/tokens";
4
+ import { CollaboratorAvatar as g } from "../collaborators-view/collaborator-avatar.js";
5
+ import A from "./messages.js";
6
+ import { jsxs as i, jsx as e } from "react/jsx-runtime";
7
+ import { callOnKeyboardEvent as _ } from "../../../utils/event.js";
8
+ import { useUnifiedShareModalContext as C } from "../../../contexts/unified-share-modal-context.js";
9
+ import { useUnifiedShareFormContext as S } from "../../../contexts/unified-share-form-context.js";
10
+ import '../../../../../styles/shared-with-avatars.css';const y = "_container_ixnh3_1", I = "_avatars_ixnh3_18", l = {
11
+ container: y,
12
+ avatars: I
13
+ }, c = 3;
14
+ function K() {
15
+ const {
16
+ formatMessage: m
17
+ } = p(), {
18
+ collaborators: d,
19
+ currentUser: h,
20
+ isSubmitting: o
21
+ } = C(), {
22
+ onShareViewChange: a
23
+ } = S(), {
24
+ id: n
25
+ } = h, t = d.filter(({
26
+ isCurrentUser: r,
27
+ userId: u
28
+ }) => !(r || n && n === u));
29
+ if (!t.length)
30
+ return null;
31
+ const f = t.slice(0, c), s = t.length - c;
32
+ return /* @__PURE__ */ i("div", {
33
+ "aria-disabled": o,
34
+ className: l.container,
35
+ onClick: () => a("collaborators"),
36
+ onKeyDown: _(() => a("collaborators")),
37
+ role: "button",
38
+ tabIndex: o ? -1 : 0,
39
+ children: [/* @__PURE__ */ e(v, {
40
+ as: "span",
41
+ color: "textOnLightSecondary",
42
+ children: m(A.sharedWithLabel)
43
+ }), /* @__PURE__ */ i("div", {
44
+ className: l.avatars,
45
+ children: [f.map((r) => /* @__PURE__ */ e(g, {
46
+ collaborator: r,
47
+ size: "medium"
48
+ }, r.id)), s > 0 && /* @__PURE__ */ e(x, {
49
+ color: b,
50
+ size: "medium",
51
+ text: `+${s}`
52
+ })]
53
+ })]
54
+ });
55
+ }
56
+ export {
57
+ K as SharedWithAvatars
58
+ };
@@ -0,0 +1,58 @@
1
+ import { useState as C } from "react";
2
+ import { useIntl as g } from "react-intl";
3
+ import { useUniqueId as p, TextArea as b, Text as A } from "@box/blueprint-web";
4
+ import a from "./messages.js";
5
+ import { jsxs as M, jsx as i } from "react/jsx-runtime";
6
+ import { useUnifiedShareModalContext as _ } from "../../../contexts/unified-share-modal-context.js";
7
+ import { useUnifiedShareFormContext as v } from "../../../contexts/unified-share-form-context.js";
8
+ import '../../../../../styles/text-area-container.css';const S = "_textArea_v76md_1", y = "_textCount_v76md_5", u = {
9
+ textArea: S,
10
+ textCount: y
11
+ };
12
+ function q(c) {
13
+ const {
14
+ formatMessage: t
15
+ } = g(), {
16
+ isSubmitting: l
17
+ } = _(), {
18
+ messageValue: m,
19
+ setMessageValue: x
20
+ } = v(), {
21
+ maxCount: e
22
+ } = c, [o, d] = C(e), s = p("text-count-"), h = (f) => {
23
+ const n = f.target.value;
24
+ if (typeof e == "number") {
25
+ const r = e - n.length;
26
+ if (r < 0)
27
+ return;
28
+ d(r);
29
+ }
30
+ x(n);
31
+ };
32
+ return /* @__PURE__ */ M("div", {
33
+ children: [/* @__PURE__ */ i(b, {
34
+ className: u.textArea,
35
+ disabled: l,
36
+ label: t(a.shareMessageLabel),
37
+ minRows: 3,
38
+ onChange: h,
39
+ placeholder: t(a.shareMessagePlaceholder),
40
+ value: m,
41
+ ...e && {
42
+ "aria-describedby": s
43
+ }
44
+ }), !!e && /* @__PURE__ */ i(A, {
45
+ "aria-label": t(a.shareMessageCharacterCountAriaLabel, {
46
+ count: o
47
+ }),
48
+ as: "span",
49
+ className: u.textCount,
50
+ color: "textOnLightSecondary",
51
+ id: s,
52
+ children: o
53
+ })]
54
+ });
55
+ }
56
+ export {
57
+ q as TextAreaContainer
58
+ };
@@ -0,0 +1,65 @@
1
+ import { useCallback as c } from "react";
2
+ import { useIntl as A } from "react-intl";
3
+ import { Avatar as b, IconBadge as f } from "@box/blueprint-web";
4
+ import C from "./messages.js";
5
+ import { jsx as t } from "react/jsx-runtime";
6
+ import { getFirstInitial as I, getAvatarBadgeSize as g } from "../../../utils/collaborator.js";
7
+ import { formatDateFromTimestampToDateString as B } from "../../../utils/date.js";
8
+ import '../../../../../styles/collaborator-avatar.css';const S = "_avatar_1jpa6_1", D = {
9
+ avatar: S
10
+ };
11
+ function k({
12
+ collaborator: v,
13
+ isBadgeable: e,
14
+ size: a = "large"
15
+ }) {
16
+ const {
17
+ formatMessage: d
18
+ } = A(), {
19
+ avatarUrl: x,
20
+ expiresAt: r,
21
+ hasCustomAvatar: u,
22
+ id: i,
23
+ isExternal: s,
24
+ name: n
25
+ } = v, m = u === !1 ? void 0 : x, o = c(() => /* @__PURE__ */ t(b, {
26
+ alt: "",
27
+ className: D.avatar,
28
+ colorIndex: parseInt(i, 10),
29
+ size: a,
30
+ src: m,
31
+ text: I(n)
32
+ }), [m, i, n, a]), l = c(() => /* @__PURE__ */ t(f, {
33
+ offset: {
34
+ bottom: -4,
35
+ right: -4
36
+ },
37
+ size: g(a),
38
+ variant: "collaborator-external",
39
+ children: /* @__PURE__ */ t(o, {})
40
+ }), [o, a]);
41
+ if (e && r) {
42
+ const h = typeof r == "number" ? B(r) : r, p = d(C.expiresBadge, {
43
+ date: h
44
+ });
45
+ return /* @__PURE__ */ t(f, {
46
+ offset: {
47
+ bottom: 20,
48
+ right: 20
49
+ },
50
+ showTooltipOnBadge: !0,
51
+ size: g(a),
52
+ tooltipConfig: {
53
+ tooltipAriaLabel: p,
54
+ tooltipContent: p,
55
+ tooltipSide: "right"
56
+ },
57
+ variant: "status-pending",
58
+ children: s ? /* @__PURE__ */ t(l, {}) : /* @__PURE__ */ t(o, {})
59
+ });
60
+ }
61
+ return e && s ? /* @__PURE__ */ t(l, {}) : /* @__PURE__ */ t(o, {});
62
+ }
63
+ export {
64
+ k as CollaboratorAvatar
65
+ };