@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,64 @@
1
+ import f from "lodash/camelCase";
2
+ import { useIntl as g } from "react-intl";
3
+ import { Row as _, Cell as i, Text as o } from "@box/blueprint-web";
4
+ import { CollaboratorAvatar as u } from "./collaborator-avatar.js";
5
+ import b from "../messages.js";
6
+ import v from "./messages.js";
7
+ import { jsxs as a, jsx as e } from "react/jsx-runtime";
8
+ import { isCollaboratorRoleSupported as x } from "../../../utils/collaborator.js";
9
+ import '../../../../../styles/collaborator-list-item.css';const D = "_nameCell_1qrwh_1", R = "_nameDetails_1qrwh_7", w = "_roleCell_1qrwh_14", r = {
10
+ nameCell: D,
11
+ nameDetails: R,
12
+ roleCell: w
13
+ };
14
+ function $({
15
+ collaborator: t
16
+ }) {
17
+ const {
18
+ formatMessage: s
19
+ } = g(), {
20
+ email: n,
21
+ hasCustomRole: m,
22
+ id: c,
23
+ isPending: d,
24
+ name: p,
25
+ role: l
26
+ } = t, h = x(l) ? s(b[`${f(l)}Role`]) : "", C = m ? l : h;
27
+ return /* @__PURE__ */ a(_, {
28
+ id: c,
29
+ children: [/* @__PURE__ */ e(i, {
30
+ children: /* @__PURE__ */ a("div", {
31
+ className: r.nameCell,
32
+ children: [/* @__PURE__ */ e(u, {
33
+ collaborator: t,
34
+ isBadgeable: !0,
35
+ size: "large"
36
+ }), /* @__PURE__ */ a("div", {
37
+ className: r.nameDetails,
38
+ children: [/* @__PURE__ */ e(o, {
39
+ as: "span",
40
+ variant: "bodyDefaultSemibold",
41
+ children: p
42
+ }), n && /* @__PURE__ */ e(o, {
43
+ as: "span",
44
+ color: "textOnLightSecondary",
45
+ variant: "caption",
46
+ children: n
47
+ })]
48
+ })]
49
+ })
50
+ }), /* @__PURE__ */ e(i, {
51
+ children: /* @__PURE__ */ e("div", {
52
+ className: r.roleCell,
53
+ children: /* @__PURE__ */ e(o, {
54
+ as: "span",
55
+ color: "textOnLightSecondary",
56
+ children: d ? s(v.pendingRole) : C
57
+ })
58
+ })
59
+ })]
60
+ });
61
+ }
62
+ export {
63
+ $ as CollaboratorListItem
64
+ };
@@ -0,0 +1,85 @@
1
+ import { createPortal as _ } from "react-dom";
2
+ import { useIntl as p } from "react-intl";
3
+ import { Link as j, Table as v, TableHeader as k, Column as d, TableBody as x, Modal as t } from "@box/blueprint-web";
4
+ import { CollaboratorListItem as y } from "./collaborator-list-item.js";
5
+ import r from "./messages.js";
6
+ import { jsxs as a, jsx as e, Fragment as F } from "react/jsx-runtime";
7
+ import { useUnifiedShareModalContext as L } from "../../../contexts/unified-share-modal-context.js";
8
+ import { useUnifiedShareFormContext as M } from "../../../contexts/unified-share-form-context.js";
9
+ import '../../../../../styles/collaborators-view.css';const S = "_manage_jjd85_1", B = "_list_jjd85_7", H = "_scroll_jjd85_24", N = "_header_jjd85_30", l = {
10
+ manage: S,
11
+ list: B,
12
+ scroll: H,
13
+ header: N
14
+ };
15
+ function R() {
16
+ const {
17
+ formatMessage: o
18
+ } = p(), {
19
+ collaborators: m,
20
+ config: n,
21
+ eventService: h,
22
+ isFetching: i,
23
+ item: u
24
+ } = L(), {
25
+ id: f,
26
+ type: b
27
+ } = u, {
28
+ onCollaboratorsManageClick: s
29
+ } = h, {
30
+ container: c,
31
+ onShareViewChange: g
32
+ } = M();
33
+ return /* @__PURE__ */ a("div", {
34
+ inert: i ? "" : null,
35
+ children: [n.collaboratorsManagement && /* @__PURE__ */ e("div", {
36
+ className: l.manage,
37
+ children: /* @__PURE__ */ e(j, {
38
+ href: `/${b}/${f}/collaborators`,
39
+ rel: "noopener",
40
+ target: "_blank",
41
+ variant: "standalone",
42
+ ...s && {
43
+ onClick: s
44
+ },
45
+ children: o(r.manageAllLink)
46
+ })
47
+ }), /* @__PURE__ */ e("div", {
48
+ className: l.list,
49
+ children: /* @__PURE__ */ e("div", {
50
+ className: l.scroll,
51
+ children: /* @__PURE__ */ a(v, {
52
+ "aria-label": o(r.listLabel),
53
+ children: [/* @__PURE__ */ a(k, {
54
+ className: l.header,
55
+ children: [/* @__PURE__ */ e(d, {
56
+ hideHeader: !0,
57
+ isRowHeader: !0,
58
+ children: o(r.nameColumn)
59
+ }), /* @__PURE__ */ e(d, {
60
+ hideHeader: !0,
61
+ children: o(r.roleColumn)
62
+ })]
63
+ }), /* @__PURE__ */ e(x, {
64
+ items: m.slice(0, n.collaboratorsLimit),
65
+ children: (C) => /* @__PURE__ */ e(y, {
66
+ collaborator: C
67
+ })
68
+ })]
69
+ })
70
+ })
71
+ }), c && /* @__PURE__ */ _(/* @__PURE__ */ a(F, {
72
+ children: [!i && /* @__PURE__ */ e(t.Footer, {
73
+ children: /* @__PURE__ */ e(t.Footer.SecondaryButton, {
74
+ onClick: () => g("default"),
75
+ children: o(r.doneButton)
76
+ })
77
+ }), /* @__PURE__ */ e(t.Close, {
78
+ "aria-label": o(r.closeButton)
79
+ })]
80
+ }), c)]
81
+ });
82
+ }
83
+ export {
84
+ R as CollaboratorsView
85
+ };
@@ -0,0 +1,4 @@
1
+ import { CollaboratorsView as a } from "./collaborators-view.js";
2
+ export {
3
+ a as CollaboratorsView
4
+ };
@@ -0,0 +1,38 @@
1
+ import { defineMessages as e } from "react-intl";
2
+ const o = e({
3
+ closeButton: {
4
+ id: "groupSharedFeatures.usm.unifiedShareFormModal.collaboratorsView.closeButton",
5
+ defaultMessage: "Close"
6
+ },
7
+ doneButton: {
8
+ id: "groupSharedFeatures.usm.unifiedShareFormModal.collaboratorsView.doneButton",
9
+ defaultMessage: "Done"
10
+ },
11
+ manageAllLink: {
12
+ id: "groupSharedFeatures.usm.unifiedShareFormModal.collaboratorsView.manageAllLink",
13
+ defaultMessage: "Manage All"
14
+ },
15
+ listLabel: {
16
+ id: "groupSharedFeatures.usm.unifiedShareFormModal.collaboratorsView.listLabel",
17
+ defaultMessage: "Collaborators"
18
+ },
19
+ nameColumn: {
20
+ id: "groupSharedFeatures.usm.unifiedShareFormModal.collaboratorsView.nameColumn",
21
+ defaultMessage: "Name"
22
+ },
23
+ roleColumn: {
24
+ id: "groupSharedFeatures.usm.unifiedShareFormModal.collaboratorsView.roleColumn",
25
+ defaultMessage: "Role"
26
+ },
27
+ expiresBadge: {
28
+ id: "groupSharedFeatures.usm.unifiedShareFormModal.collaboratorsView.expiresBadge",
29
+ defaultMessage: "Access expires on {date}"
30
+ },
31
+ pendingRole: {
32
+ id: "groupSharedFeatures.usm.unifiedShareFormModal.collaboratorsView.pendingRole",
33
+ defaultMessage: "Pending"
34
+ }
35
+ });
36
+ export {
37
+ o as default
38
+ };
@@ -0,0 +1,4 @@
1
+ import { UnifiedShareFormModal as e } from "./unified-share-form-modal.js";
2
+ export {
3
+ e as UnifiedShareFormModal
4
+ };
@@ -0,0 +1,50 @@
1
+ import { defineMessages as e } from "react-intl";
2
+ const a = e({
3
+ title: {
4
+ id: "groupSharedFeatures.usm.unifiedShareFormModal.title",
5
+ defaultMessage: "Share ‘{itemName}’"
6
+ },
7
+ closeButton: {
8
+ id: "groupSharedFeatures.usm.unifiedShareFormModal.closeButton",
9
+ defaultMessage: "Close"
10
+ },
11
+ loadingLabel: {
12
+ id: "groupSharedFeatures.usm.unifiedShareFormModal.loadingLabel",
13
+ defaultMessage: "Loading"
14
+ },
15
+ ownerRole: {
16
+ id: "groupSharedFeatures.usm.unifiedShareFormModal.ownerRole",
17
+ defaultMessage: "Owner"
18
+ },
19
+ coOwnerRole: {
20
+ id: "groupSharedFeatures.usm.unifiedShareFormModal.coOwnerRole",
21
+ defaultMessage: "Co-owner"
22
+ },
23
+ editorRole: {
24
+ id: "groupSharedFeatures.usm.unifiedShareFormModal.editorRole",
25
+ defaultMessage: "Editor"
26
+ },
27
+ viewerUploaderRole: {
28
+ id: "groupSharedFeatures.usm.unifiedShareFormModal.viewerUploaderRole",
29
+ defaultMessage: "Viewer Uploader"
30
+ },
31
+ previewerUploaderRole: {
32
+ id: "groupSharedFeatures.usm.unifiedShareFormModal.previewerUploaderRole",
33
+ defaultMessage: "Previewer Uploader"
34
+ },
35
+ viewerRole: {
36
+ id: "groupSharedFeatures.usm.unifiedShareFormModal.viewerRole",
37
+ defaultMessage: "Viewer"
38
+ },
39
+ previewerRole: {
40
+ id: "groupSharedFeatures.usm.unifiedShareFormModal.previewerRole",
41
+ defaultMessage: "Previewer"
42
+ },
43
+ uploaderRole: {
44
+ id: "groupSharedFeatures.usm.unifiedShareFormModal.uploaderRole",
45
+ defaultMessage: "Uploader"
46
+ }
47
+ });
48
+ export {
49
+ a as default
50
+ };
@@ -0,0 +1,4 @@
1
+ import { SharedLinkSection as r } from "./shared-link-section.js";
2
+ export {
3
+ r as SharedLinkSection
4
+ };
@@ -0,0 +1,98 @@
1
+ import { defineMessages as e } from "react-intl";
2
+ const i = e({
3
+ shareLinkLabel: {
4
+ id: "groupSharedFeatures.usm.unifiedShareFormModal.sharedLinkSection.shareLinkLabel",
5
+ defaultMessage: "Share Link"
6
+ },
7
+ sharedLinkToggleLabel: {
8
+ id: "groupSharedFeatures.usm.unifiedShareFormModal.sharedLinkSection.sharedLinkToggleLabel",
9
+ defaultMessage: "Shared link"
10
+ },
11
+ sharedLinkToggleTooltip: {
12
+ id: "groupSharedFeatures.usm.unifiedShareFormModal.sharedLinkSection.sharedLinkToggleTooltip",
13
+ defaultMessage: "Create and copy link"
14
+ },
15
+ sharedLinkSettingsLabel: {
16
+ id: "groupSharedFeatures.usm.unifiedShareFormModal.sharedLinkSection.sharedLinkSettingsLabel",
17
+ defaultMessage: "Link Settings"
18
+ },
19
+ sharedLinkUrlLabel: {
20
+ id: "groupSharedFeatures.usm.unifiedShareFormModal.sharedLinkSection.sharedLinkUrlLabel",
21
+ defaultMessage: "Shared link URL"
22
+ },
23
+ sharedLinkEmailLabel: {
24
+ id: "groupSharedFeatures.usm.unifiedShareFormModal.sharedLinkSection.sharedLinkEmailLabel",
25
+ defaultMessage: "Send Shared Link"
26
+ },
27
+ expirationIconLabel: {
28
+ id: "groupSharedFeatures.usm.unifiedShareFormModal.sharedLinkSection.expirationIconLabel",
29
+ defaultMessage: "Expires"
30
+ },
31
+ expirationIconTooltip: {
32
+ id: "groupSharedFeatures.usm.unifiedShareFormModal.sharedLinkSection.expirationIconTooltip",
33
+ defaultMessage: "This link will expire and be inaccessible on {expirationDate}"
34
+ },
35
+ openAccessLevelLabel: {
36
+ id: "groupSharedFeatures.usm.unifiedShareFormModal.sharedLinkSection.openAccessLevelLabel",
37
+ defaultMessage: "People with the link"
38
+ },
39
+ openAccessLevelDescription: {
40
+ id: "groupSharedFeatures.usm.unifiedShareFormModal.sharedLinkSection.openAccessLevelDescription",
41
+ defaultMessage: "Publicly accessible and no sign-in required"
42
+ },
43
+ companyAccessLevelLabel: {
44
+ id: "groupSharedFeatures.usm.unifiedShareFormModal.sharedLinkSection.companyAccessLevelLabel",
45
+ defaultMessage: "People in your company"
46
+ },
47
+ companyAccessLevelDescription: {
48
+ id: "groupSharedFeatures.usm.unifiedShareFormModal.sharedLinkSection.companyAccessLevelDescription",
49
+ defaultMessage: "Anyone in your company with the link or people invited to this {item} can access"
50
+ },
51
+ enterpriseAccessLevelLabel: {
52
+ id: "groupSharedFeatures.usm.unifiedShareFormModal.sharedLinkSection.enterpriseAccessLevelLabel",
53
+ defaultMessage: "People in {enterprise}"
54
+ },
55
+ enterpriseAccessLevelDescription: {
56
+ id: "groupSharedFeatures.usm.unifiedShareFormModal.sharedLinkSection.enterpriseAccessLevelDescription",
57
+ defaultMessage: "Anyone at {enterprise} with the link or people invited to this {item} can access"
58
+ },
59
+ collaboratorsAccessLevelLabel: {
60
+ id: "groupSharedFeatures.usm.unifiedShareFormModal.sharedLinkSection.collaboratorsAccessLevelLabel",
61
+ defaultMessage: "Invited people only"
62
+ },
63
+ collaboratorsAccessLevelDescription: {
64
+ id: "groupSharedFeatures.usm.unifiedShareFormModal.sharedLinkSection.collaboratorsAccessLevelDescription",
65
+ defaultMessage: "Only invited people can access this {item}"
66
+ },
67
+ fileAccessLevelItem: {
68
+ id: "groupSharedFeatures.usm.unifiedShareFormModal.sharedLinkSection.fileAccessLevelItem",
69
+ defaultMessage: "file"
70
+ },
71
+ folderAccessLevelItem: {
72
+ id: "groupSharedFeatures.usm.unifiedShareFormModal.sharedLinkSection.folderAccessLevelItem",
73
+ defaultMessage: "folder"
74
+ },
75
+ hubsAccessLevelItem: {
76
+ id: "groupSharedFeatures.usm.unifiedShareFormModal.sharedLinkSection.hubsAccessLevelItem",
77
+ defaultMessage: "hub"
78
+ },
79
+ disabledAccessLevelTooltip: {
80
+ id: "groupSharedFeatures.usm.unifiedShareFormModal.sharedLinkSection.disabledAccessLevelTooltip",
81
+ defaultMessage: "This option is not available due to a security policy"
82
+ },
83
+ autoCreateCopyErrorNoticeText: {
84
+ id: "groupSharedFeatures.usm.unifiedShareFormModal.sharedLinkSection.autoCreateCopyErrorNoticeText",
85
+ defaultMessage: "Shared link created. Click Copy to share."
86
+ },
87
+ autoCreateCopySuccessNoticeText: {
88
+ id: "groupSharedFeatures.usm.unifiedShareFormModal.sharedLinkSection.autoCreateCopySuccessNoticeText",
89
+ defaultMessage: "Shared link created and copied to clipboard."
90
+ },
91
+ autoCopySuccessNoticeText: {
92
+ id: "groupSharedFeatures.usm.unifiedShareFormModal.sharedLinkSection.autoCopySuccessNoticeText",
93
+ defaultMessage: "Shared link copied to clipboard."
94
+ }
95
+ });
96
+ export {
97
+ i as default
98
+ };
@@ -0,0 +1,86 @@
1
+ import _ from "clsx";
2
+ import { useState as C } from "react";
3
+ import { useIntl as L } from "react-intl";
4
+ import { DropdownMenu as n, TriggerButton as k, Tooltip as A, Focusable as M } from "@box/blueprint-web";
5
+ import I from "./messages.js";
6
+ import { jsxs as z, jsx as e } from "react/jsx-runtime";
7
+ import { useUnifiedShareModalContext as T } from "../../../contexts/unified-share-modal-context.js";
8
+ import { useSharingAction as q } from "../../../hooks/use-sharing-action.js";
9
+ import { useAccessLevels as w } from "../../../hooks/use-access-levels.js";
10
+ import '../../../../../styles/shared-link-access.css';const O = "_container_xhq4z_1", j = "_overrides_xhq4z_1", y = "_content_xhq4z_6", o = {
11
+ container: O,
12
+ overrides: j,
13
+ content: y
14
+ };
15
+ function J() {
16
+ const {
17
+ formatMessage: d
18
+ } = L(), [s, m] = C(!1), {
19
+ isSubmitting: h,
20
+ sharedLink: p,
21
+ sharingService: u
22
+ } = T(), {
23
+ access: r
24
+ } = p, {
25
+ changeSharedLinkAccess: f
26
+ } = u, {
27
+ isLoading: g,
28
+ onAction: b
29
+ } = q(f), {
30
+ allowedLevels: c,
31
+ selectedAccess: i
32
+ } = w();
33
+ if (!c.length || !i)
34
+ return null;
35
+ const {
36
+ label: x
37
+ } = i;
38
+ return /* @__PURE__ */ z(n.Root, {
39
+ onOpenChange: m,
40
+ open: s,
41
+ children: [/* @__PURE__ */ e(n.Trigger, {
42
+ children: /* @__PURE__ */ e(k, {
43
+ caretDirection: s ? "up" : "down",
44
+ className: _(o.container, o.overrides),
45
+ disabled: h ?? g,
46
+ label: x,
47
+ size: "extraSmall",
48
+ variant: "tertiary"
49
+ })
50
+ }), /* @__PURE__ */ e(n.Content, {
51
+ align: "start",
52
+ className: o.content,
53
+ children: c.map((v) => {
54
+ const {
55
+ description: a,
56
+ disabledReason: S,
57
+ id: t,
58
+ label: l
59
+ } = v;
60
+ return S ? /* @__PURE__ */ e(A, {
61
+ content: d(I.disabledAccessLevelTooltip),
62
+ children: /* @__PURE__ */ e(M, {
63
+ children: /* @__PURE__ */ e(n.CheckboxItem, {
64
+ checked: r === t,
65
+ disabled: !0,
66
+ children: /* @__PURE__ */ e(n.Item.MainContent, {
67
+ caption: a,
68
+ label: l
69
+ })
70
+ }, t)
71
+ })
72
+ }, t) : /* @__PURE__ */ e(n.CheckboxItem, {
73
+ checked: r === t,
74
+ onSelect: () => b(t),
75
+ children: /* @__PURE__ */ e(n.Item.MainContent, {
76
+ caption: a,
77
+ label: l
78
+ })
79
+ }, t);
80
+ })
81
+ })]
82
+ });
83
+ }
84
+ export {
85
+ J as SharedLinkAccess
86
+ };
@@ -0,0 +1,19 @@
1
+ import e from "clsx";
2
+ import { TriggerButton as o } from "@box/blueprint-web";
3
+ import { jsx as n } from "react/jsx-runtime";
4
+ import '../../../../../styles/shared-link-permission.css';const i = "_container_1l4s8_1", t = "_overrides_1l4s8_1", r = {
5
+ container: i,
6
+ overrides: t
7
+ };
8
+ function l() {
9
+ return /* @__PURE__ */ n(o, {
10
+ caretDirection: "down",
11
+ className: e(r.container, r.overrides),
12
+ label: "Can view and download",
13
+ size: "extraSmall",
14
+ variant: "tertiary"
15
+ });
16
+ }
17
+ export {
18
+ l as SharedLinkPermission
19
+ };
@@ -0,0 +1,144 @@
1
+ import { useRef as y, useState as R, useCallback as b, useEffect as _ } from "react";
2
+ import { useIntl as F } from "react-intl";
3
+ import { Text as B, Tooltip as S, Switch as M, Status as U, Link as j, Button as K } from "@box/blueprint-web";
4
+ import { ClockBadge as V, Envelope as z } from "@box/blueprint-web-assets/icons/Line";
5
+ import { SurfaceStatusSurfaceRed as O } from "@box/blueprint-web-assets/tokens/tokens";
6
+ import { CopyInput as G } from "@box/copy-input";
7
+ import { SharedLinkAccess as H } from "./shared-link-access.js";
8
+ import { SharedLinkPermission as J } from "./shared-link-permission.js";
9
+ import t from "./messages.js";
10
+ import { jsxs as h, jsx as o } from "react/jsx-runtime";
11
+ import { useUnifiedShareFormContext as Q } from "../../../contexts/unified-share-form-context.js";
12
+ import { useUnifiedShareModalContext as W } from "../../../contexts/unified-share-modal-context.js";
13
+ import { useSharingAction as T } from "../../../hooks/use-sharing-action.js";
14
+ import { formatDateFromTimestampToDateString as X } from "../../../utils/date.js";
15
+ import { callOnKeyboardEvent as Y } from "../../../utils/event.js";
16
+ import '../../../../../styles/shared-link-section.css';const Z = "_container_cabqc_1", $ = "_toggle_cabqc_7", ee = "_settings_cabqc_13", te = "_copy_cabqc_18", ne = "_access_cabqc_26", c = {
17
+ container: Z,
18
+ toggle: $,
19
+ settings: ee,
20
+ copy: te,
21
+ access: ne
22
+ };
23
+ function Le() {
24
+ const {
25
+ formatMessage: e
26
+ } = F(), p = y(!0), f = y(null), l = y(null), {
27
+ onModalViewChange: d,
28
+ onShareViewChange: E
29
+ } = Q(), {
30
+ config: a,
31
+ isSubmitting: g,
32
+ sharedLink: u,
33
+ sharingService: I
34
+ } = W(), {
35
+ createSharedLink: N
36
+ } = I, {
37
+ sharedLinkAutoCopy: r,
38
+ sharedLinkAutoCreate: k
39
+ } = a, n = !!u.url, [L, P] = R(!1);
40
+ let x = "create-shared-link";
41
+ r && (x = "auto-copy-shared-link");
42
+ const {
43
+ isLoading: v,
44
+ onAction: C
45
+ } = T(N, x), m = b(async () => {
46
+ n || (await C(), P(!0));
47
+ }, [n, C]), w = b(async () => (m(), new Promise((i) => {
48
+ l.current = {
49
+ resolve: i
50
+ };
51
+ })), [m]), {
52
+ onAction: A
53
+ } = T(w, "auto-copy-shared-link");
54
+ _(() => {
55
+ p.current && (r ? A() : k && m(), p.current = !1);
56
+ }, [p, r, k, m, A]), _(() => {
57
+ n && r && f.current && f.current.click();
58
+ }, [n, r]);
59
+ const D = b((s) => {
60
+ if (!l.current)
61
+ return;
62
+ let i;
63
+ s instanceof Error ? i = L ? e(t.autoCreateCopyErrorNoticeText) : null : i = e(L ? t.autoCreateCopySuccessNoticeText : t.autoCopySuccessNoticeText), i && l.current.resolve({
64
+ messages: [{
65
+ text: i,
66
+ type: "success"
67
+ }]
68
+ }), l.current = null;
69
+ }, [e, L]), q = async (s) => {
70
+ !s && d && d("remove-shared-link"), s && await C();
71
+ };
72
+ return /* @__PURE__ */ h("div", {
73
+ className: c.container,
74
+ children: [/* @__PURE__ */ o(B, {
75
+ as: "label",
76
+ variant: "bodyDefaultBold",
77
+ children: e(t.shareLinkLabel)
78
+ }), /* @__PURE__ */ h("div", {
79
+ className: c.toggle,
80
+ children: [/* @__PURE__ */ o(S, {
81
+ align: "start",
82
+ content: e(t.sharedLinkToggleTooltip),
83
+ "data-testid": "shared-link-tooltip",
84
+ open: n ? !1 : void 0,
85
+ children: /* @__PURE__ */ o(M.Item, {
86
+ checked: n,
87
+ disabled: g ?? v,
88
+ label: e(t.sharedLinkToggleLabel),
89
+ onCheckedChange: q,
90
+ value: "shared-link"
91
+ })
92
+ }), n && !!u.expiresAt && /* @__PURE__ */ o(S, {
93
+ content: e(t.expirationIconTooltip, {
94
+ expirationDate: X(u.expiresAt)
95
+ }),
96
+ "data-testid": "expiration-date-tooltip",
97
+ children: /* @__PURE__ */ o(U, {
98
+ color: O,
99
+ hideText: !0,
100
+ icon: V,
101
+ text: e(t.expirationIconLabel)
102
+ })
103
+ }), n && a.sharedLinkSettings && /* @__PURE__ */ o(j, {
104
+ className: c.settings,
105
+ onClick: () => d("shared-link-settings"),
106
+ onKeyDown: Y(() => d("shared-link-settings"), {
107
+ canPreventDefault: !0
108
+ }),
109
+ role: "button",
110
+ tabIndex: 0,
111
+ variant: "standalone",
112
+ children: e(t.sharedLinkSettingsLabel)
113
+ })]
114
+ }), n && /* @__PURE__ */ h("div", {
115
+ className: c.copy,
116
+ children: [/* @__PURE__ */ o(G, {
117
+ ref: f,
118
+ autoFocus: k && n,
119
+ disabled: g ?? v,
120
+ hideLabel: !0,
121
+ label: e(t.sharedLinkUrlLabel),
122
+ onCopy: D,
123
+ value: u.url
124
+ }), a.sharedLinkEmail && /* @__PURE__ */ o(S, {
125
+ align: "end",
126
+ content: e(t.sharedLinkEmailLabel),
127
+ children: /* @__PURE__ */ o(K, {
128
+ "aria-label": e(t.sharedLinkEmailLabel),
129
+ disabled: g,
130
+ icon: z,
131
+ onClick: () => E("email"),
132
+ size: "large",
133
+ variant: "secondary"
134
+ })
135
+ })]
136
+ }), n && (a.sharedLinkAccess || a.sharedLinkPermission) && /* @__PURE__ */ h("div", {
137
+ className: c.access,
138
+ children: [a.sharedLinkAccess && /* @__PURE__ */ o(H, {}), a.sharedLinkPermission && /* @__PURE__ */ o(J, {})]
139
+ })]
140
+ });
141
+ }
142
+ export {
143
+ Le as SharedLinkSection
144
+ };
@@ -0,0 +1,72 @@
1
+ import y from "clsx";
2
+ import { useState as h, useCallback as w } from "react";
3
+ import { useIntl as x } from "react-intl";
4
+ import { Modal as o, LoadingIndicator as N } from "@box/blueprint-web";
5
+ import { UnifiedShareForm as U } from "./unified-share-form.js";
6
+ import i from "./messages.js";
7
+ import { jsxs as s, jsx as e } from "react/jsx-runtime";
8
+ import { UnifiedShareFormProvider as v } from "../../contexts/unified-share-form-context.js";
9
+ import { useUnifiedShareModalContext as D } from "../../contexts/unified-share-modal-context.js";
10
+ import '../../../../styles/unified-share-form-modal.css';const O = "_body_1udrf_1", P = "_hasFooter_1udrf_12", V = "_loading_1udrf_16", j = "_content_1udrf_38", t = {
11
+ body: O,
12
+ hasFooter: P,
13
+ loading: V,
14
+ content: j
15
+ };
16
+ function A({
17
+ children: d,
18
+ isOpen: u,
19
+ onOpenChange: n,
20
+ onModalViewChange: g
21
+ }) {
22
+ const {
23
+ formatMessage: r
24
+ } = x(), {
25
+ isFetching: p,
26
+ item: _
27
+ } = D(), {
28
+ name: F
29
+ } = _, [b, C] = h(null), [l, c] = h("default"), M = !!d, m = l !== "default", f = w((a) => {
30
+ c("default"), n && n(a);
31
+ }, [n]), S = (a) => {
32
+ a.preventDefault();
33
+ };
34
+ return /* @__PURE__ */ s(o, {
35
+ onOpenChange: f,
36
+ open: u,
37
+ children: [M && /* @__PURE__ */ e(o.Trigger, {
38
+ children: d
39
+ }), /* @__PURE__ */ s(o.Content, {
40
+ ref: C,
41
+ className: t.content,
42
+ onPointerDownOutside: S,
43
+ size: "medium",
44
+ children: [/* @__PURE__ */ e(o.Header, {
45
+ children: r(i.title, {
46
+ itemName: F
47
+ })
48
+ }), /* @__PURE__ */ e(o.Body, {
49
+ className: y(t.body, m && t.hasFooter),
50
+ children: /* @__PURE__ */ s(v, {
51
+ container: b,
52
+ onModalOpenChange: f,
53
+ onModalViewChange: g,
54
+ onShareViewChange: c,
55
+ shareView: l,
56
+ children: [p && /* @__PURE__ */ e("div", {
57
+ className: t.loading,
58
+ children: /* @__PURE__ */ e(N, {
59
+ "aria-label": r(i.loadingLabel),
60
+ size: "large"
61
+ })
62
+ }), /* @__PURE__ */ e(U, {})]
63
+ })
64
+ }), !m && /* @__PURE__ */ e(o.Close, {
65
+ "aria-label": r(i.closeButton)
66
+ })]
67
+ })]
68
+ });
69
+ }
70
+ export {
71
+ A as UnifiedShareFormModal
72
+ };