@box/unified-share-modal 2.12.15 → 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 +9 -9
@@ -0,0 +1,67 @@
1
+ import "../esm/lib/constants.js";
2
+ import { useUnifiedShareModalContext as e } from "../esm/lib/contexts/unified-share-modal-context.js";
3
+ import t from "../esm/lib/components/unified-share-form-modal/shared-link-section/messages.js";
4
+ import { useSharingAction as n } from "../esm/lib/hooks/use-sharing-action.js";
5
+ import { usePermissionLevels as r } from "../esm/lib/hooks/use-permission-levels.js";
6
+ import { useState as i } from "react";
7
+ import { useIntl as a } from "react-intl";
8
+ import { DropdownMenu as o, Focusable as s, Tooltip as c, TriggerButton as l } from "@box/blueprint-web";
9
+ import { jsx as u, jsxs as d } from "react/jsx-runtime";
10
+ import '../styles/shared-link-access.css';var f = {
11
+ button: "_button_166my_1",
12
+ content: "_content_166my_9",
13
+ option: "_option_166my_12"
14
+ };
15
+ function p() {
16
+ let { formatMessage: p } = a(), [m, h] = i(!1), { isSubmitting: g, item: _, sharedLink: v, sharingService: y, variant: b } = e(), { permissions: x = {} } = _, { access: S, permission: C } = v, { changeSharedLinkPermission: w } = y, T = b === "desktop", { onAction: E } = n(w), { allowedLevels: D, selectedPermission: O } = r();
17
+ if (S === "collaborators" || !D.length || !O) return null;
18
+ let { label: k } = O, A = "";
19
+ return _.extension === "boxnote" && C === "can_edit" && (A = p(t.canEditBoxNoteDisabledTooltip)), A ? /* @__PURE__ */ u(c, {
20
+ align: "start",
21
+ content: A,
22
+ "data-testid": "usm-SharedLinkPermission-tooltip",
23
+ side: "bottom",
24
+ children: /* @__PURE__ */ u(s, { children: /* @__PURE__ */ u(l, {
25
+ caretDirection: "down",
26
+ className: f.button,
27
+ disabled: !0,
28
+ label: k,
29
+ size: "extraSmall",
30
+ variant: "tertiary"
31
+ }) })
32
+ }) : /* @__PURE__ */ d(o.Root, {
33
+ isFullScreenEnabled: T,
34
+ onOpenChange: h,
35
+ open: m,
36
+ children: [/* @__PURE__ */ u(o.Trigger, { children: /* @__PURE__ */ u(l, {
37
+ caretDirection: m ? "up" : "down",
38
+ className: f.button,
39
+ "data-target-id": "Button-SharedLinkPermissionsMenuLabel",
40
+ disabled: !x.canSetShareAccess || g,
41
+ label: k,
42
+ size: "extraSmall",
43
+ variant: "tertiary"
44
+ }) }), /* @__PURE__ */ d(o.Content, {
45
+ align: "start",
46
+ className: f.content,
47
+ children: [T && /* @__PURE__ */ d(o.Header, { children: [/* @__PURE__ */ u(o.Header.MenuCloseButton, {
48
+ "aria-label": p(t.closeButton),
49
+ iconVariant: "back"
50
+ }), /* @__PURE__ */ u(o.Header.TextContent, { title: p(t.shareLinkLabel) })] }), D.map((e) => {
51
+ let { description: t, id: n, label: r } = e, i = C === n;
52
+ return /* @__PURE__ */ u(o.CheckboxItem, {
53
+ checked: i,
54
+ onSelect: () => {
55
+ i || E(n);
56
+ },
57
+ children: /* @__PURE__ */ u(o.Item.MainContent, {
58
+ caption: t,
59
+ className: f.option,
60
+ label: r
61
+ })
62
+ }, n);
63
+ })]
64
+ })]
65
+ });
66
+ }
67
+ export { p as t };
@@ -0,0 +1,176 @@
1
+ import { useUnifiedShareModalContext as e } from "../esm/lib/contexts/unified-share-modal-context.js";
2
+ import { formatDateFromTimestampToDateString as t } from "../esm/lib/utils/date.js";
3
+ import { callOnKeyboardEvent as n } from "../esm/lib/utils/event.js";
4
+ import { getNotificationArgs as r } from "../esm/lib/utils/notification.js";
5
+ import i from "../esm/lib/components/unified-share-form-modal/shared-link-section/messages.js";
6
+ import { useUnifiedShareFormContext as a } from "../esm/lib/contexts/unified-share-form-context.js";
7
+ import { useSharingAction as o } from "../esm/lib/hooks/use-sharing-action.js";
8
+ import { t as s } from "./shared-link-access.js";
9
+ import { t as ee } from "./shared-link-permission.js";
10
+ import { useCallback as c, useEffect as l, useRef as u } from "react";
11
+ import { useIntl as d } from "react-intl";
12
+ import { Button as f, Focusable as te, Link as p, Status as ne, Switch as re, Text as m, Tooltip as h, useNotification as g } from "@box/blueprint-web";
13
+ import { jsx as _, jsxs as v } from "react/jsx-runtime";
14
+ import { ClockBadge as ie } from "@box/blueprint-web-assets/icons/Line";
15
+ import { CopyInput as y } from "@box/copy-input";
16
+ import { Globe as b, Mail as x } from "@box/blueprint-web-assets/icons/Medium";
17
+ import { SurfaceStatusSurfaceRed as S, bpSize040 as C } from "@box/blueprint-web-assets/tokens/tokens";
18
+ import '../styles/shared-link-section.css';var w = {
19
+ container: "_container_j966c_1",
20
+ toggle: "_toggle_j966c_7",
21
+ settings: "_settings_j966c_13",
22
+ copy: "_copy_j966c_22",
23
+ access: "_access_j966c_30",
24
+ icon: "_icon_j966c_36"
25
+ };
26
+ function T() {
27
+ let { formatMessage: T } = d(), { addNotification: E } = g(), D = u(null), { isInteracted: O, isSharedLinkAutoCopied: k, isSharedLinkAutoCreated: A, setForm: j } = a(), { config: M, eventService: N, isFetching: P, isSubmitting: F, item: I, setView: L, sharedLink: R, sharingService: z } = e(), { permissions: B = {} } = I, { onSharedLinkCopy: V, onSharedLinkSettingsClick: H } = N, { createSharedLink: U } = z, { notifications: W, sharedLinkAutoCopy: G, sharedLinkAutoCreate: K } = M, q = !!R.url, J = G && !k.current && !O, Y = K && !A.current && !O, { onAction: X } = o(c(async () => {
28
+ let e = await U();
29
+ return J ? { messages: [] } : e;
30
+ }, [J, U]), "create-shared-link");
31
+ l(() => {
32
+ (async () => {
33
+ P || F || ((J || Y) && !q && !A.current && (A.current = !0, await X()), J && q && D.current && D.current.click());
34
+ })();
35
+ }, [
36
+ q,
37
+ J,
38
+ Y,
39
+ P,
40
+ k,
41
+ A,
42
+ F,
43
+ X
44
+ ]);
45
+ let ae = c((e) => {
46
+ if (V && V(e), !J) return;
47
+ k.current = !0;
48
+ let t;
49
+ t = typeof e == "string" ? A.current ? T(i.autoCreateCopySuccessNoticeText) : T(i.autoCopySuccessNoticeText) : A.current ? T(i.autoCreateCopyErrorNoticeText) : null, t && W.includes("auto-copy-shared-link") && E({
50
+ ...r(T, "success"),
51
+ styledText: t
52
+ });
53
+ }, [
54
+ E,
55
+ T,
56
+ J,
57
+ k,
58
+ A,
59
+ W,
60
+ V
61
+ ]), oe = async (e) => {
62
+ if (e) {
63
+ await X();
64
+ return;
65
+ }
66
+ L("remove-shared-link");
67
+ }, Z = () => {
68
+ if (H) {
69
+ H();
70
+ return;
71
+ }
72
+ L("shared-link-settings");
73
+ }, Q, $ = !1;
74
+ return !q && !F && (Q = T(i.sharedLinkToggleTooltip)), !q && !B.canShare && (Q = T(i.createLinkDisabledTooltip), $ = !0), q && !B.canSetShareAccess && (Q = T(i.removeLinkDisabledTooltip), $ = !0), /* @__PURE__ */ v("div", {
75
+ className: w.container,
76
+ children: [
77
+ /* @__PURE__ */ _(m, {
78
+ as: "label",
79
+ variant: "bodyDefaultBold",
80
+ children: T(i.shareLinkLabel)
81
+ }),
82
+ /* @__PURE__ */ v("div", {
83
+ className: w.toggle,
84
+ children: [
85
+ /* @__PURE__ */ _(h, {
86
+ align: "start",
87
+ content: Q,
88
+ "data-testid": "usm-SharedLinkToggle-tooltip",
89
+ open: Q ? void 0 : !1,
90
+ children: /* @__PURE__ */ _(te, {
91
+ focusable: $,
92
+ children: /* @__PURE__ */ _(re.Item, {
93
+ checked: q,
94
+ "data-target-id": "Toggle-CreateSharedLink",
95
+ disabled: $ || F,
96
+ label: T(i.sharedLinkToggleLabel),
97
+ onCheckedChange: oe,
98
+ value: "shared-link"
99
+ })
100
+ })
101
+ }),
102
+ q && !!R.expiresAt && /* @__PURE__ */ _(h, {
103
+ content: T(i.expirationIconTooltip, { expirationDate: t(R.expiresAt) }),
104
+ "data-testid": "usm-SharedLinkExpiration-tooltip",
105
+ children: /* @__PURE__ */ _(ne, {
106
+ color: S,
107
+ hideText: !0,
108
+ icon: ie,
109
+ text: T(i.expirationIconLabel)
110
+ })
111
+ }),
112
+ q && M.sharedLinkSettings && /* @__PURE__ */ _(p, {
113
+ "aria-disabled": F,
114
+ "aria-haspopup": "dialog",
115
+ className: w.settings,
116
+ "data-target-id": "PlainButton-SharedLinkSettings",
117
+ onClick: Z,
118
+ onKeyDown: n(Z, { canPreventDefault: !0 }),
119
+ role: "button",
120
+ tabIndex: F ? -1 : 0,
121
+ variant: "standalone",
122
+ children: T(i.sharedLinkSettingsLabel)
123
+ })
124
+ ]
125
+ }),
126
+ q && /* @__PURE__ */ v("div", {
127
+ className: w.copy,
128
+ children: [/* @__PURE__ */ _(y, {
129
+ ref: D,
130
+ autoFocus: K && A.current && !O,
131
+ "data-target-id": "Button-CopySharedLink",
132
+ disabled: F,
133
+ hideLabel: !0,
134
+ label: T(i.sharedLinkUrlLabel),
135
+ onCopy: ae,
136
+ value: R.url
137
+ }), M.sharedLinkEmail && /* @__PURE__ */ _(h, {
138
+ align: "end",
139
+ content: T(i.sharedLinkEmailLabel),
140
+ children: /* @__PURE__ */ _(f, {
141
+ "aria-label": T(i.sharedLinkEmailLabel),
142
+ "data-target-id": "Button-SendSharedLink",
143
+ disabled: F,
144
+ endIcon: x,
145
+ onClick: () => j("email"),
146
+ size: "large",
147
+ variant: "secondary"
148
+ })
149
+ })]
150
+ }),
151
+ q && (M.sharedLinkAccess || M.sharedLinkPermission) && /* @__PURE__ */ v("div", {
152
+ className: w.access,
153
+ children: [M.sharedLinkAccess && /* @__PURE__ */ _(s, {}), M.sharedLinkPermission && /* @__PURE__ */ _(ee, {})]
154
+ }),
155
+ q && R.access === "open" && /* @__PURE__ */ v("div", { children: [/* @__PURE__ */ _(b, {
156
+ className: w.icon,
157
+ height: C,
158
+ width: C
159
+ }), /* @__PURE__ */ _(m, {
160
+ as: "span",
161
+ color: "textOnLightSecondary",
162
+ children: R.permission === "can_edit" ? T(i.sharedLinkEditablePubliclyAvailable) : T(i.sharedLinkPubliclyAvailable)
163
+ })] }),
164
+ q && R.access === "company" && R.permission === "can_edit" && /* @__PURE__ */ v("div", { children: [/* @__PURE__ */ _(b, {
165
+ className: w.icon,
166
+ height: C,
167
+ width: C
168
+ }), /* @__PURE__ */ _(m, {
169
+ as: "span",
170
+ color: "textOnLightSecondary",
171
+ children: T(i.sharedLinkElevatedEditableCompanyAvailable)
172
+ })] })
173
+ ]
174
+ });
175
+ }
176
+ export { T as t };
@@ -0,0 +1,86 @@
1
+ import { useUnifiedShareModalContext as e } from "../esm/lib/contexts/unified-share-modal-context.js";
2
+ import { useSharedLinkSettingsContext as t } from "../esm/lib/contexts/shared-link-settings-context.js";
3
+ import { t as n } from "./classification-status.js";
4
+ import r from "../esm/lib/components/shared-link-settings-modal/messages.js";
5
+ import { SharedLinkSettings as i } from "../esm/lib/components/shared-link-settings-modal/shared-link-settings.js";
6
+ import { useEffect as a, useState as o } from "react";
7
+ import s from "clsx";
8
+ import { useIntl as c } from "react-intl";
9
+ import { Divider as l, LoadingIndicator as u, Modal as d } from "@box/blueprint-web";
10
+ import { jsx as f, jsxs as p } from "react/jsx-runtime";
11
+ import '../styles/shared-link-settings-modal.css';var m = {
12
+ content: "_content_54561_1",
13
+ isFullscreen: "_isFullscreen_54561_4",
14
+ body: "_body_54561_13",
15
+ title: "_title_54561_23",
16
+ form: "_form_54561_43",
17
+ isLoading: "_isLoading_54561_50",
18
+ loading: "_loading_54561_54",
19
+ divider: "_divider_54561_62"
20
+ };
21
+ function h({ isOpen: h, onOpenChange: g }) {
22
+ let { formatMessage: _ } = c(), { eventService: v, isSubmitting: y, variant: b } = e(), { onSharedLinkSettingsClose: x, onSharedLinkSettingsLoad: S } = v, C = b === "desktop", { resetForm: w, setContainerRef: T, submitForm: E } = t(), [D, O] = o(!!S);
23
+ a(() => {
24
+ (async () => {
25
+ S && (h && await S(), O(!h));
26
+ })();
27
+ }, [h, S]);
28
+ let k = () => {
29
+ y || (w(), x && x(), g(!1));
30
+ };
31
+ return /* @__PURE__ */ f(d, {
32
+ onOpenChange: k,
33
+ open: h,
34
+ children: /* @__PURE__ */ p(d.Content, {
35
+ ref: T,
36
+ className: s(m.content, C && m.isFullscreen),
37
+ onPointerDownOutside: (e) => {
38
+ e.preventDefault();
39
+ },
40
+ size: "medium",
41
+ children: [
42
+ /* @__PURE__ */ p(d.Header, { children: [/* @__PURE__ */ f("div", {
43
+ className: m.title,
44
+ children: _(r.title)
45
+ }), /* @__PURE__ */ f(n, {})] }),
46
+ /* @__PURE__ */ p("div", {
47
+ className: s(m.form),
48
+ children: [
49
+ D && /* @__PURE__ */ f("div", {
50
+ className: m.loading,
51
+ children: /* @__PURE__ */ f(u, {
52
+ "aria-label": _(r.loadingLabel),
53
+ size: "large"
54
+ })
55
+ }),
56
+ /* @__PURE__ */ p(d.Body, {
57
+ className: s(m.body, D && m.isLoading),
58
+ children: [C && /* @__PURE__ */ f(l, { className: m.divider }), /* @__PURE__ */ f(i, {})]
59
+ }),
60
+ /* @__PURE__ */ p(d.Footer, {
61
+ className: s(D && m.isLoading),
62
+ children: [/* @__PURE__ */ f(d.Footer.SecondaryButton, {
63
+ disabled: y,
64
+ onClick: k,
65
+ children: _(r.cancelButton)
66
+ }), /* @__PURE__ */ f(d.Footer.PrimaryButton, {
67
+ id: "usm-SharedLinkSettingsModal-primaryButton",
68
+ loading: y,
69
+ loadingAriaLabel: _(r.loadingLabel),
70
+ onClick: async () => {
71
+ await E() || (w(), g(!1));
72
+ },
73
+ children: _(r.saveButton)
74
+ })]
75
+ })
76
+ ]
77
+ }),
78
+ !C && /* @__PURE__ */ f(d.Close, {
79
+ "aria-label": _(r.closeButton),
80
+ disabled: y
81
+ })
82
+ ]
83
+ })
84
+ });
85
+ }
86
+ export { h as t };
@@ -0,0 +1,48 @@
1
+ import { useUnifiedShareModalContext as e } from "../esm/lib/contexts/unified-share-modal-context.js";
2
+ import { callOnKeyboardEvent as t } from "../esm/lib/utils/event.js";
3
+ import { useUnifiedShareFormContext as n } from "../esm/lib/contexts/unified-share-form-context.js";
4
+ import { CollaboratorAvatar as r } from "../esm/lib/components/unified-share-form-modal/collaborator-list/collaborator-avatar.js";
5
+ import i from "../esm/lib/components/unified-share-form-modal/collaboration-section/messages.js";
6
+ import { useIntl as a } from "react-intl";
7
+ import { Avatar as o, Text as s } from "@box/blueprint-web";
8
+ import { jsx as c, jsxs as l } from "react/jsx-runtime";
9
+ import { Gray10 as u } from "@box/blueprint-web-assets/tokens/tokens";
10
+ import '../styles/shared-with-avatars.css';var d = {
11
+ container: "_container_1ku5s_2",
12
+ avatars: "_avatars_1ku5s_19"
13
+ }, f = 3;
14
+ function p() {
15
+ let { formatMessage: p } = a(), { collaborators: m, currentUser: h, eventService: g, isSubmitting: _ } = e(), { setIsCollaboratorsOpen: v } = n(), { onCollaboratorsClick: y } = g, { id: b } = h, x = m.filter(({ isCurrentUser: e, userId: t }) => !(e || b && b === t));
16
+ if (!x.length) return null;
17
+ let S = x.slice(0, f), C = x.length - f, w = () => {
18
+ if (y) {
19
+ y();
20
+ return;
21
+ }
22
+ v(!0);
23
+ };
24
+ return /* @__PURE__ */ l("div", {
25
+ "aria-disabled": _,
26
+ className: d.container,
27
+ onClick: w,
28
+ onKeyDown: t(w),
29
+ role: "button",
30
+ tabIndex: _ ? -1 : 0,
31
+ children: [/* @__PURE__ */ c(s, {
32
+ as: "span",
33
+ color: "textOnLightSecondary",
34
+ children: p(i.sharedWithLabel)
35
+ }), /* @__PURE__ */ l("div", {
36
+ className: d.avatars,
37
+ children: [S.map((e) => /* @__PURE__ */ c(r, {
38
+ collaborator: e,
39
+ size: "medium"
40
+ }, e.id)), C > 0 && /* @__PURE__ */ c(o, {
41
+ color: u,
42
+ size: "medium",
43
+ text: `+${C}`
44
+ })]
45
+ })]
46
+ });
47
+ }
48
+ export { p as t };
@@ -0,0 +1,97 @@
1
+ import { useUnifiedShareModalContext as e } from "../esm/lib/contexts/unified-share-modal-context.js";
2
+ import { isCollaboratorRestricted as t } from "../esm/lib/utils/collaborator.js";
3
+ import { callOnKeyboardEvent as n } from "../esm/lib/utils/event.js";
4
+ import { useUnifiedShareFormContext as r } from "../esm/lib/contexts/unified-share-form-context.js";
5
+ import i from "../esm/lib/components/unified-share-form-modal/collaboration-section/messages.js";
6
+ import { useEffect as a, useState as o } from "react";
7
+ import { FormattedMessage as s, useIntl as c } from "react-intl";
8
+ import { InlineNotice as l, Link as u, LoadingIndicator as d, Select as f } from "@box/blueprint-web";
9
+ import { jsx as p } from "react/jsx-runtime";
10
+ import m from "lodash/partition";
11
+ import '../styles/shield-restriction-notice.css';var h = {
12
+ select: "_select_1e0dl_1",
13
+ link: "_link_1e0dl_5",
14
+ loading: "_loading_1e0dl_9",
15
+ notice: "_notice_1e0dl_15"
16
+ };
17
+ function g({ error: g, isLoading: _, onSelectedUsersChange: v }) {
18
+ let { formatMessage: y } = c(), [b, x] = o(!1), [S, C] = o([]), { setShieldRestriction: w, setUserContacts: T, shieldRestriction: E, userContacts: D } = r(), { eventService: O, item: k, contactService: A } = e(), { getJustificationReasons: j } = A, { onRestrictedUsersRemoveClick: M } = O, { isJustificationAllowed: N, restrictionType: P, restrictedEmails: F = [], restrictedGroups: I = [] } = g, L = [...F, ...I];
19
+ a(() => (N && w({ isJustificationAllowed: !0 }), () => {
20
+ w({ isJustificationAllowed: !1 });
21
+ }), [N, w]), a(() => {
22
+ (async () => {
23
+ if (!(!j || S.length)) try {
24
+ x(!0);
25
+ let { classificationId: e, options: t } = await j(k);
26
+ w({ classificationId: e }), C(t);
27
+ } finally {
28
+ x(!1);
29
+ }
30
+ })();
31
+ }, [
32
+ k,
33
+ j,
34
+ N,
35
+ S,
36
+ w
37
+ ]);
38
+ let R = N ? i.justifiableContactRestrictionRemoveButtonLabel : i.contactRestrictionRemoveButtonLabel, z = () => {
39
+ let [e, n] = m(D, (e) => t(e, F, I));
40
+ v(n), T(n), M && M(e);
41
+ }, B = /* @__PURE__ */ p(f, {
42
+ className: h.select,
43
+ hideLabel: !0,
44
+ label: y(i.businessJustification),
45
+ onValueChange: (e) => {
46
+ w({ justificationReason: S.find((t) => t.id === e) });
47
+ },
48
+ placeholder: y(i.justificationSelectPlaceholder),
49
+ value: E.justificationReason?.id,
50
+ children: /* @__PURE__ */ p(f.Content, {
51
+ align: "start",
52
+ children: S.map((e) => /* @__PURE__ */ p(f.Option, {
53
+ text: e.title,
54
+ value: e.id
55
+ }, e.id))
56
+ })
57
+ }), V = /* @__PURE__ */ p(u, {
58
+ "aria-disabled": _,
59
+ className: h.link,
60
+ onClick: z,
61
+ onKeyDown: n(z, { canPreventDefault: !0 }),
62
+ role: "button",
63
+ tabIndex: _ ? -1 : 0,
64
+ children: y(R)
65
+ }), { message: H, ...U } = P === "information_barrier" ? {
66
+ message: i.contactRestrictionInformationBarrierNotice,
67
+ count: L.length,
68
+ removeLink: V
69
+ } : !b && N && S?.length > 0 ? {
70
+ message: i.justifiableContactRestrictionNotice,
71
+ count: L.length,
72
+ justificationSelect: B,
73
+ removeLink: V
74
+ } : {
75
+ message: i.contactRestrictionNotice,
76
+ count: L.length,
77
+ removeLink: V
78
+ };
79
+ return /* @__PURE__ */ p(l, {
80
+ className: h.notice,
81
+ icon: () => null,
82
+ role: "alert",
83
+ variant: "error",
84
+ variantIconAriaLabel: y(i.errorNoticeIconAriaLabel),
85
+ children: b ? /* @__PURE__ */ p("div", {
86
+ className: h.loading,
87
+ children: /* @__PURE__ */ p(d, {
88
+ "aria-label": y(i.loadingJustificationReasonsLabel),
89
+ size: "small"
90
+ })
91
+ }) : /* @__PURE__ */ p(s, {
92
+ ...H,
93
+ values: U
94
+ })
95
+ });
96
+ }
97
+ export { g as t };
@@ -0,0 +1,36 @@
1
+ import { useUnifiedShareModalContext as e } from "../esm/lib/contexts/unified-share-modal-context.js";
2
+ import { useUnifiedShareFormContext as t } from "../esm/lib/contexts/unified-share-form-context.js";
3
+ import n from "../esm/lib/components/unified-share-form-modal/collaboration-section/messages.js";
4
+ import { useState as r } from "react";
5
+ import { useIntl as i } from "react-intl";
6
+ import { Text as a, TextArea as o, useUniqueId as s } from "@box/blueprint-web";
7
+ import { jsx as c, jsxs as l } from "react/jsx-runtime";
8
+ import '../styles/text-area-container.css';var u = {
9
+ textArea: "_textArea_v76md_1",
10
+ textCount: "_textCount_v76md_5"
11
+ };
12
+ function d(d) {
13
+ let { formatMessage: f } = i(), { isSubmitting: p } = e(), { messageValue: m, setMessageValue: h } = t(), { maxCount: g } = d, [_, v] = r(g), y = s("text-count-");
14
+ return /* @__PURE__ */ l("div", { children: [/* @__PURE__ */ c(o, {
15
+ className: u.textArea,
16
+ disabled: p,
17
+ label: f(n.shareMessageLabel),
18
+ maxLength: g,
19
+ minRows: 3,
20
+ onChange: (e) => {
21
+ let t = e.target.value;
22
+ typeof g == "number" && v(g - t.length), h(t);
23
+ },
24
+ placeholder: f(n.shareMessagePlaceholder),
25
+ value: m,
26
+ ...g && { "aria-describedby": y }
27
+ }), !!g && /* @__PURE__ */ c(a, {
28
+ "aria-label": f(n.shareMessageCharacterCountAriaLabel, { count: _ }),
29
+ as: "span",
30
+ className: u.textCount,
31
+ color: "textOnLightSecondary",
32
+ id: y,
33
+ children: _
34
+ })] });
35
+ }
36
+ export { d as t };
@@ -0,0 +1,66 @@
1
+ import { useUnifiedShareModalContext as e } from "../esm/lib/contexts/unified-share-modal-context.js";
2
+ import { useUnifiedShareFormContext as t } from "../esm/lib/contexts/unified-share-form-context.js";
3
+ import { t as n } from "./classification-status.js";
4
+ import r from "../esm/lib/components/unified-share-form-modal/messages.js";
5
+ import { t as i } from "./collaborator-list.js";
6
+ import { t as a } from "./unified-share-form.js";
7
+ import { useCallback as o } from "react";
8
+ import s from "clsx";
9
+ import { useIntl as c } from "react-intl";
10
+ import { LoadingIndicator as l, Modal as u } from "@box/blueprint-web";
11
+ import { jsx as d, jsxs as f } from "react/jsx-runtime";
12
+ import '../styles/unified-share-form-modal.css';var p = {
13
+ content: "_content_1k0mu_1",
14
+ isFullscreen: "_isFullscreen_1k0mu_4",
15
+ body: "_body_1k0mu_13",
16
+ title: "_title_1k0mu_17",
17
+ hasFooter: "_hasFooter_1k0mu_39",
18
+ loading: "_loading_1k0mu_43",
19
+ form: "_form_1k0mu_51",
20
+ isLoading: "_isLoading_1k0mu_56"
21
+ };
22
+ function m({ children: m, isOpen: h, onOpenChange: g }) {
23
+ let { formatMessage: _ } = c(), { isCollaboratorsOpen: v, setContainerRef: y, setForm: b } = t(), { isFetching: x, isSubmitting: S, item: C, variant: w } = e(), { form: T } = t(), { name: E } = C, D = w === "desktop", O = T === "default" && !v;
24
+ return /* @__PURE__ */ f(u, {
25
+ onOpenChange: o((e) => {
26
+ S || (b("default"), g(e));
27
+ }, [
28
+ S,
29
+ g,
30
+ b
31
+ ]),
32
+ open: h,
33
+ children: [!!m && /* @__PURE__ */ d(u.Trigger, { children: m }), /* @__PURE__ */ f(u.Content, {
34
+ ref: y,
35
+ className: s(p.content, D && p.isFullscreen),
36
+ onPointerDownOutside: (e) => {
37
+ e.preventDefault();
38
+ },
39
+ size: "medium",
40
+ children: [
41
+ /* @__PURE__ */ f(u.Header, { children: [/* @__PURE__ */ d("div", {
42
+ className: p.title,
43
+ children: _(r.title, { itemName: E })
44
+ }), /* @__PURE__ */ d(n, {})] }),
45
+ /* @__PURE__ */ f(u.Body, {
46
+ className: s(p.body, !O && p.hasFooter),
47
+ children: [x && /* @__PURE__ */ d("div", {
48
+ className: p.loading,
49
+ children: /* @__PURE__ */ d(l, {
50
+ "aria-label": _(r.loadingLabel),
51
+ size: "large"
52
+ })
53
+ }), /* @__PURE__ */ d("div", {
54
+ className: s(p.form, x && p.isLoading),
55
+ children: d(v ? i : a, {})
56
+ })]
57
+ }),
58
+ !D && O && /* @__PURE__ */ d(u.Close, {
59
+ "aria-label": _(r.closeButton),
60
+ disabled: S
61
+ })
62
+ ]
63
+ })]
64
+ });
65
+ }
66
+ export { m as t };
@@ -0,0 +1,23 @@
1
+ import { useUnifiedShareModalContext as e } from "../esm/lib/contexts/unified-share-modal-context.js";
2
+ import { useUnifiedShareFormContext as t } from "../esm/lib/contexts/unified-share-form-context.js";
3
+ import { t as n } from "./collaboration-section.js";
4
+ import { t as r } from "./shared-link-section.js";
5
+ import { Divider as i } from "@box/blueprint-web";
6
+ import { jsx as a, jsxs as o } from "react/jsx-runtime";
7
+ import '../styles/unified-share-form.css';var s = {
8
+ container: "_container_rq40p_1",
9
+ divider: "_divider_rq40p_6"
10
+ };
11
+ function c() {
12
+ let { config: c, variant: l } = e(), { form: u } = t(), d = l === "desktop", f = u === "default", p = c.collaboration, m = c.sharedLink && f;
13
+ return /* @__PURE__ */ o("div", {
14
+ className: s.container,
15
+ children: [
16
+ d && /* @__PURE__ */ a(i, { className: s.divider }),
17
+ p && /* @__PURE__ */ a(n, {}),
18
+ p && m && /* @__PURE__ */ a(i, { className: s.divider }),
19
+ m && /* @__PURE__ */ a(r, {})
20
+ ]
21
+ });
22
+ }
23
+ export { c as t };
package/dist/esm/index.js CHANGED
@@ -1,4 +1,2 @@
1
- import { UnifiedShareModal as r } from "./lib/unified-share-modal.js";
2
- export {
3
- r as UnifiedShareModal
4
- };
1
+ import { UnifiedShareModal as e } from "./lib/unified-share-modal.js";
2
+ export { e as UnifiedShareModal };