@box/unified-share-modal 0.48.9 → 0.49.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 (76) hide show
  1. package/dist/esm/lib/components/shared-link-settings-modal/messages.js +2 -6
  2. package/dist/esm/lib/components/shared-link-settings-modal/shared-link-settings-modal.js +79 -79
  3. package/dist/esm/lib/components/unified-share-form-modal/collaboration-section/collaboration-role.js +89 -68
  4. package/dist/esm/lib/components/unified-share-form-modal/collaboration-section/collaboration-section.js +119 -102
  5. package/dist/esm/lib/components/unified-share-form-modal/collaboration-section/messages.js +8 -0
  6. package/dist/esm/lib/components/unified-share-form-modal/shared-link-section/messages.js +12 -0
  7. package/dist/esm/lib/components/unified-share-form-modal/shared-link-section/shared-link-access.js +42 -39
  8. package/dist/esm/lib/components/unified-share-form-modal/shared-link-section/shared-link-permission.js +46 -43
  9. package/dist/esm/lib/components/unified-share-form-modal/shared-link-section/shared-link-section.js +109 -100
  10. package/dist/esm/lib/hooks/use-access-levels.js +18 -17
  11. package/dist/esm/lib/hooks/use-collaboration-form.js +13 -13
  12. package/dist/esm/lib/messages.js +11 -7
  13. package/dist/i18n/bn-IN.js +15 -9
  14. package/dist/i18n/bn-IN.properties +14 -0
  15. package/dist/i18n/da-DK.js +15 -9
  16. package/dist/i18n/da-DK.properties +14 -0
  17. package/dist/i18n/de-DE.js +15 -9
  18. package/dist/i18n/de-DE.properties +14 -0
  19. package/dist/i18n/en-AU.js +8 -2
  20. package/dist/i18n/en-AU.properties +14 -0
  21. package/dist/i18n/en-CA.js +8 -2
  22. package/dist/i18n/en-CA.properties +14 -0
  23. package/dist/i18n/en-GB.js +8 -2
  24. package/dist/i18n/en-GB.properties +14 -0
  25. package/dist/i18n/en-US.js +15 -10
  26. package/dist/i18n/en-US.properties +21 -11
  27. package/dist/i18n/en-x-pseudo.js +122 -116
  28. package/dist/i18n/en-x-pseudo.properties +123 -109
  29. package/dist/i18n/es-419.js +15 -9
  30. package/dist/i18n/es-419.properties +14 -0
  31. package/dist/i18n/es-ES.js +15 -9
  32. package/dist/i18n/es-ES.properties +14 -0
  33. package/dist/i18n/fi-FI.js +15 -9
  34. package/dist/i18n/fi-FI.properties +14 -0
  35. package/dist/i18n/fr-CA.js +15 -9
  36. package/dist/i18n/fr-CA.properties +14 -0
  37. package/dist/i18n/fr-FR.js +15 -9
  38. package/dist/i18n/fr-FR.properties +14 -0
  39. package/dist/i18n/hi-IN.js +15 -9
  40. package/dist/i18n/hi-IN.properties +14 -0
  41. package/dist/i18n/it-IT.js +15 -9
  42. package/dist/i18n/it-IT.properties +14 -0
  43. package/dist/i18n/ja-JP.js +15 -9
  44. package/dist/i18n/ja-JP.properties +14 -0
  45. package/dist/i18n/json/src/lib/components/shared-link-settings-modal/messages.json +1 -1
  46. package/dist/i18n/json/src/lib/components/unified-share-form-modal/collaboration-section/messages.json +1 -1
  47. package/dist/i18n/json/src/lib/components/unified-share-form-modal/shared-link-section/messages.json +1 -1
  48. package/dist/i18n/json/src/lib/messages.json +1 -1
  49. package/dist/i18n/ko-KR.js +15 -9
  50. package/dist/i18n/ko-KR.properties +14 -0
  51. package/dist/i18n/nb-NO.js +15 -9
  52. package/dist/i18n/nb-NO.properties +14 -0
  53. package/dist/i18n/nl-NL.js +15 -9
  54. package/dist/i18n/nl-NL.properties +14 -0
  55. package/dist/i18n/pl-PL.js +15 -9
  56. package/dist/i18n/pl-PL.properties +14 -0
  57. package/dist/i18n/pt-BR.js +15 -9
  58. package/dist/i18n/pt-BR.properties +14 -0
  59. package/dist/i18n/ru-RU.js +15 -9
  60. package/dist/i18n/ru-RU.properties +14 -0
  61. package/dist/i18n/sv-SE.js +15 -9
  62. package/dist/i18n/sv-SE.properties +14 -0
  63. package/dist/i18n/tr-TR.js +15 -9
  64. package/dist/i18n/tr-TR.properties +14 -0
  65. package/dist/i18n/zh-CN.js +15 -9
  66. package/dist/i18n/zh-CN.properties +14 -0
  67. package/dist/i18n/zh-TW.js +15 -9
  68. package/dist/i18n/zh-TW.properties +14 -0
  69. package/dist/styles/collaboration-role.css +1 -1
  70. package/dist/styles/shared-link-section.css +1 -1
  71. package/dist/types/lib/components/shared-link-settings-modal/messages.d.ts +0 -5
  72. package/dist/types/lib/components/unified-share-form-modal/collaboration-section/messages.d.ts +10 -0
  73. package/dist/types/lib/components/unified-share-form-modal/shared-link-section/messages.d.ts +15 -0
  74. package/dist/types/lib/messages.d.ts +5 -0
  75. package/dist/types/lib/stories/shared.d.ts +5 -0
  76. package/package.json +2 -2
@@ -1,111 +1,128 @@
1
- import { useRef as H, useEffect as K, useCallback as C } from "react";
2
- import { createPortal as W } from "react-dom";
3
- import { useIntl as z } from "react-intl";
4
- import { useUniqueId as J, useLabelable as Q, Modal as i } from "@box/blueprint-web";
5
- import { UserSelectorContainer as X } from "@box/user-selector";
6
- import { CollaborationRole as Y } from "./collaboration-role.js";
7
- import { SharedWithAvatars as Z } from "./shared-with-avatars.js";
8
- import { TextAreaContainer as $ } from "./text-area-container.js";
9
- import { COLLABORATION_MESSAGE_CHARACTER_LIMIT as ee } from "../../../constants.js";
10
- import a from "./messages.js";
11
- import { jsxs as s, jsx as n, Fragment as te } from "react/jsx-runtime";
12
- import { useCollaborationForm as oe } from "../../../hooks/use-collaboration-form.js";
13
- import { useUnifiedShareFormContext as ae } from "../../../contexts/unified-share-form-context.js";
14
- import { useUnifiedShareModalContext as ne } from "../../../contexts/unified-share-modal-context.js";
15
- import '../../../../../styles/collaboration-section.css';const re = "_container_19jv3_1", le = "_label_19jv3_7", A = {
16
- container: re,
17
- label: le
1
+ import { useRef as X, useEffect as Y, useCallback as g } from "react";
2
+ import { createPortal as Z } from "react-dom";
3
+ import { useIntl as $ } from "react-intl";
4
+ import { useUniqueId as ee, useLabelable as te, Tooltip as oe, Focusable as ae, Modal as m } from "@box/blueprint-web";
5
+ import { UserSelectorContainer as ne } from "@box/user-selector";
6
+ import { CollaborationRole as re } from "./collaboration-role.js";
7
+ import { SharedWithAvatars as ie } from "./shared-with-avatars.js";
8
+ import { TextAreaContainer as le } from "./text-area-container.js";
9
+ import { COLLABORATION_MESSAGE_CHARACTER_LIMIT as se } from "../../../constants.js";
10
+ import t from "./messages.js";
11
+ import { jsxs as u, jsx as o, Fragment as ce } from "react/jsx-runtime";
12
+ import { useCollaborationForm as me } from "../../../hooks/use-collaboration-form.js";
13
+ import { useUnifiedShareFormContext as ue } from "../../../contexts/unified-share-form-context.js";
14
+ import { useUnifiedShareModalContext as de } from "../../../contexts/unified-share-modal-context.js";
15
+ import '../../../../../styles/collaboration-section.css';const fe = "_container_19jv3_1", be = "_label_19jv3_7", B = {
16
+ container: fe,
17
+ label: be
18
18
  };
19
- function Fe() {
19
+ function xe() {
20
20
  const {
21
- formatMessage: o
22
- } = z(), {
23
- contactValue: B,
24
- container: c,
25
- onModalOpenChange: v,
26
- onShareViewChange: m,
27
- shareView: e,
28
- userContacts: g
29
- } = ae(), {
30
- config: r,
31
- contactService: x,
32
- isFetching: E,
33
- isSubmitting: u,
34
- sharingService: I
35
- } = ne(), {
36
- getContacts: d,
37
- getContactsAvatarUrls: f
38
- } = x, {
39
- sendInvitations: P,
40
- sendSharedLink: _
41
- } = I, h = e === "default" || e === "invite", l = e === "invite" || e === "email", S = H(e === "email" ? "email" : "invite");
42
- K(() => {
43
- S.current = e === "email" ? "email" : "invite";
44
- }, [e]);
45
- let b, p;
46
- e === "invite" && (b = P, p = "invite-collaborators"), e === "email" && (b = _, p = "email-shared-link");
21
+ formatMessage: e
22
+ } = $(), {
23
+ contactValue: I,
24
+ container: d,
25
+ onModalOpenChange: S,
26
+ onShareViewChange: f,
27
+ shareView: a,
28
+ userContacts: F
29
+ } = ue(), {
30
+ config: i,
31
+ contactService: T,
32
+ isFetching: _,
33
+ isSubmitting: x,
34
+ item: E,
35
+ sharingService: P
36
+ } = de(), {
37
+ permissions: k = {},
38
+ type: O
39
+ } = E, {
40
+ getContacts: b,
41
+ getContactsAvatarUrls: h
42
+ } = T, {
43
+ sendInvitations: V,
44
+ sendSharedLink: y
45
+ } = P;
46
+ let p, C;
47
+ a === "invite" && (p = V, C = "invite-collaborators"), a === "email" && (p = y, C = "email-shared-link");
47
48
  const {
48
- errors: O,
49
- handleFormReset: F,
50
- handleFormSubmit: V,
51
- handleSelectedUsersChange: M,
52
- handleUserSelectorBlur: R,
53
- isFormSubmitting: L,
54
- updateContactValue: k
55
- } = oe(b, p), N = C((t) => (t.stopPropagation(), !0), []), y = C((t) => d ? d(t, S.current) : Promise.resolve([]), [d]), T = C((t) => f ? f(t) : Promise.resolve({}), [f]), j = (t) => {
56
- l || m("invite"), k(t);
57
- }, w = () => {
58
- F(), m("default");
59
- }, q = async () => {
60
- await V() || (F(), v && v(!1), m("default"));
61
- }, U = J("user-contacts-"), D = o(h ? a.invitePeopleLabel : a.emailSharedLinkLabel), G = Q(D, U);
62
- return /* @__PURE__ */ s("form", {
63
- className: A.container,
64
- onSubmit: (t) => t.preventDefault(),
65
- children: [r.collaborationNotices, /* @__PURE__ */ s("div", {
66
- children: [h && r.collaborators && /* @__PURE__ */ n(Z, {}), /* @__PURE__ */ n(G, {
67
- className: A.label
68
- }), /* @__PURE__ */ n(X, {
69
- className: "collaboration-user-selector",
70
- clearButtonAriaLabel: o(a.clearButton),
71
- clearOnBlur: !1,
72
- disabled: u,
73
- error: O["user-contact"],
74
- fetchAvatarUrls: T,
75
- fetchUsers: y,
76
- hideOnEscape: N,
77
- idForLabel: U,
78
- inputValue: B,
79
- label: null,
80
- onBlur: R,
81
- onInputValueChange: j,
82
- onSelectedUsersChange: M,
83
- placeholder: g.length ? "" : o(a.invitePeoplePlaceholder),
84
- portalElement: c,
85
- selectedUsers: g,
86
- selectOnEnterOrTab: !0,
87
- variant: l ? "textarea" : "input"
88
- }), h && r.collaborationRole && /* @__PURE__ */ n(Y, {})]
89
- }), l && r.collaborationMessage && /* @__PURE__ */ n($, {
90
- maxCount: ee
91
- }), l && c && /* @__PURE__ */ W(/* @__PURE__ */ s(te, {
92
- children: [!E && /* @__PURE__ */ s(i.Footer, {
93
- children: [/* @__PURE__ */ n(i.Footer.SecondaryButton, {
94
- disabled: u ?? L,
95
- onClick: w,
96
- children: o(a.cancelButton)
97
- }), /* @__PURE__ */ n(i.Footer.PrimaryButton, {
98
- loading: u ?? L,
99
- loadingAriaLabel: o(a.loadingLabel),
100
- onClick: q,
101
- children: o(a.sendButton)
49
+ errors: M,
50
+ handleFormReset: L,
51
+ handleFormSubmit: R,
52
+ handleSelectedUsersChange: N,
53
+ handleUserSelectorBlur: w,
54
+ isFormSubmitting: j,
55
+ updateContactValue: D
56
+ } = me(p, C), r = a === "default" || a === "invite", l = a === "invite" || a === "email", v = x ?? j, U = X(a === "email" ? "email" : "invite");
57
+ Y(() => {
58
+ U.current = a === "email" ? "email" : "invite";
59
+ }, [a]);
60
+ const W = g((n) => (n.stopPropagation(), !0), []), q = g((n) => b ? b(n, U.current) : Promise.resolve([]), [b]), G = g((n) => h ? h(n) : Promise.resolve({}), [h]), H = (n) => {
61
+ l || f("invite"), D(n);
62
+ }, K = () => {
63
+ L(), f("default");
64
+ }, z = async () => {
65
+ await R() || (L(), S && S(!1), f("default"));
66
+ };
67
+ let s, c = !1;
68
+ r && !k.canInviteCollaborator && (s = e(t.inviteDisabledTooltip), c = !0), r && O === "web_link" && (s = e(t.inviteWebLinkDisabledTooltip), c = !0);
69
+ const A = ee("user-contacts-"), J = e(r ? t.invitePeopleLabel : t.emailSharedLinkLabel), Q = te(J, A);
70
+ return /* @__PURE__ */ u("form", {
71
+ className: B.container,
72
+ onSubmit: (n) => n.preventDefault(),
73
+ children: [i.collaborationNotices, /* @__PURE__ */ u("div", {
74
+ children: [r && i.collaborators && /* @__PURE__ */ o(ie, {}), /* @__PURE__ */ o(Q, {
75
+ className: B.label
76
+ }), /* @__PURE__ */ o(oe, {
77
+ content: s,
78
+ "data-testid": "user-contacts-tooltip",
79
+ open: s ? void 0 : !1,
80
+ side: "bottom",
81
+ children: /* @__PURE__ */ o(ae, {
82
+ focusable: c,
83
+ children: /* @__PURE__ */ o(ne, {
84
+ className: "collaboration-user-selector",
85
+ clearButtonAriaLabel: e(t.clearButton),
86
+ clearOnBlur: !1,
87
+ disabled: c || v,
88
+ error: M["user-contact"],
89
+ fetchAvatarUrls: G,
90
+ fetchUsers: q,
91
+ hideOnEscape: W,
92
+ idForLabel: A,
93
+ inputValue: I,
94
+ label: null,
95
+ onBlur: w,
96
+ onInputValueChange: H,
97
+ onSelectedUsersChange: N,
98
+ placeholder: F.length ? "" : e(t.invitePeoplePlaceholder),
99
+ portalElement: d,
100
+ selectedUsers: F,
101
+ selectOnEnterOrTab: !0,
102
+ variant: l ? "textarea" : "input"
103
+ })
104
+ })
105
+ }), r && i.collaborationRole && /* @__PURE__ */ o(re, {})]
106
+ }), l && i.collaborationMessage && /* @__PURE__ */ o(le, {
107
+ maxCount: se
108
+ }), l && d && /* @__PURE__ */ Z(/* @__PURE__ */ u(ce, {
109
+ children: [!_ && /* @__PURE__ */ u(m.Footer, {
110
+ children: [/* @__PURE__ */ o(m.Footer.SecondaryButton, {
111
+ disabled: v,
112
+ onClick: K,
113
+ children: e(t.cancelButton)
114
+ }), /* @__PURE__ */ o(m.Footer.PrimaryButton, {
115
+ loading: v,
116
+ loadingAriaLabel: e(t.loadingLabel),
117
+ onClick: z,
118
+ children: e(t.sendButton)
102
119
  })]
103
- }), /* @__PURE__ */ n(i.Close, {
104
- "aria-label": o(a.closeButton)
120
+ }), /* @__PURE__ */ o(m.Close, {
121
+ "aria-label": e(t.closeButton)
105
122
  })]
106
- }), c)]
123
+ }), d)]
107
124
  });
108
125
  }
109
126
  export {
110
- Fe as CollaborationSection
127
+ xe as CollaborationSection
111
128
  };
@@ -83,6 +83,14 @@ const o = e({
83
83
  uploaderDescription: {
84
84
  id: "groupSharedFeatures.usm.unifiedShareFormModal.collaborationSection.uploaderDescription",
85
85
  defaultMessage: "Upload-only"
86
+ },
87
+ inviteDisabledTooltip: {
88
+ id: "groupSharedFeatures.usm.unifiedShareFormModal.collaborationSection.inviteDisabledTooltip",
89
+ defaultMessage: "You do not have permission to invite collaborators"
90
+ },
91
+ inviteWebLinkDisabledTooltip: {
92
+ id: "groupSharedFeatures.usm.unifiedShareFormModal.collaborationSection.inviteWebLinkDisabledTooltip",
93
+ defaultMessage: "Collaborators cannot be added to bookmarks"
86
94
  }
87
95
  });
88
96
  export {
@@ -12,6 +12,14 @@ const i = e({
12
12
  id: "groupSharedFeatures.usm.unifiedShareFormModal.sharedLinkSection.sharedLinkToggleTooltip",
13
13
  defaultMessage: "Create and copy link"
14
14
  },
15
+ createLinkDisabledTooltip: {
16
+ id: "groupSharedFeatures.usm.unifiedShareFormModal.sharedLinkSection.createLinkDisabledTooltip",
17
+ defaultMessage: "You do not have permission to create the link"
18
+ },
19
+ removeLinkDisabledTooltip: {
20
+ id: "groupSharedFeatures.usm.unifiedShareFormModal.sharedLinkSection.removeLinkDisabledTooltip",
21
+ defaultMessage: "You do not have permission to remove the link"
22
+ },
15
23
  sharedLinkSettingsLabel: {
16
24
  id: "groupSharedFeatures.usm.unifiedShareFormModal.sharedLinkSection.sharedLinkSettingsLabel",
17
25
  defaultMessage: "Link Settings"
@@ -76,6 +84,10 @@ const i = e({
76
84
  id: "groupSharedFeatures.usm.unifiedShareFormModal.sharedLinkSection.hubsAccessLevelItem",
77
85
  defaultMessage: "hub"
78
86
  },
87
+ webLinkAccessLevelItem: {
88
+ id: "groupSharedFeatures.usm.unifiedShareFormModal.sharedLinkSection.webLinkAccessLevelItem",
89
+ defaultMessage: "bookmark"
90
+ },
79
91
  disabledAccessLevelTooltip: {
80
92
  id: "groupSharedFeatures.usm.unifiedShareFormModal.sharedLinkSection.disabledAccessLevelTooltip",
81
93
  defaultMessage: "This option is not available due to a security policy"
@@ -1,67 +1,70 @@
1
- import L from "clsx";
2
- import { useState as k } from "react";
3
- import { useIntl as A } from "react-intl";
4
- import { DropdownMenu as n, TriggerButton as M, Tooltip as I, Focusable as z } from "@box/blueprint-web";
5
- import T from "./messages.js";
6
- import { jsxs as q, jsx as e } from "react/jsx-runtime";
7
- import { useUnifiedShareModalContext as w } from "../../../contexts/unified-share-modal-context.js";
8
- import { useSharingAction as O } from "../../../hooks/use-sharing-action.js";
9
- import { useAccessLevels as j } from "../../../hooks/use-access-levels.js";
10
- import '../../../../../styles/shared-link-access.css';const y = "_container_xhq4z_1", D = "_overrides_xhq4z_1", N = "_content_xhq4z_6", s = {
11
- container: y,
12
- overrides: D,
13
- content: N
1
+ import k from "clsx";
2
+ import { useState as M } from "react";
3
+ import { useIntl as I } from "react-intl";
4
+ import { DropdownMenu as n, TriggerButton as z, Tooltip as T, Focusable as q } from "@box/blueprint-web";
5
+ import w from "./messages.js";
6
+ import { jsxs as O, jsx as e } from "react/jsx-runtime";
7
+ import { useUnifiedShareModalContext as j } from "../../../contexts/unified-share-modal-context.js";
8
+ import { useSharingAction as y } from "../../../hooks/use-sharing-action.js";
9
+ import { useAccessLevels as D } from "../../../hooks/use-access-levels.js";
10
+ import '../../../../../styles/shared-link-access.css';const N = "_container_xhq4z_1", R = "_overrides_xhq4z_1", B = "_content_xhq4z_6", s = {
11
+ container: N,
12
+ overrides: R,
13
+ content: B
14
14
  };
15
- function P() {
15
+ function V() {
16
16
  const {
17
17
  formatMessage: d
18
- } = A(), [c, m] = k(!1), {
18
+ } = I(), [c, m] = M(!1), {
19
19
  isSubmitting: h,
20
- sharedLink: p,
21
- sharingService: u
22
- } = w(), {
23
- access: f
20
+ item: p,
21
+ sharedLink: u,
22
+ sharingService: f
23
+ } = j(), {
24
+ permissions: g = {}
24
25
  } = p, {
25
- changeSharedLinkAccess: g
26
+ access: S
26
27
  } = u, {
27
- isLoading: b,
28
- onAction: x
29
- } = O(g), {
28
+ changeSharedLinkAccess: b
29
+ } = f, {
30
+ isLoading: x,
31
+ onAction: v
32
+ } = y(b), {
30
33
  allowedLevels: r,
31
34
  selectedAccess: i
32
- } = j();
35
+ } = D();
33
36
  if (!r.length || !i)
34
37
  return null;
35
38
  const {
36
- label: S
39
+ label: _
37
40
  } = i;
38
- return /* @__PURE__ */ q(n.Root, {
41
+ return /* @__PURE__ */ O(n.Root, {
39
42
  onOpenChange: m,
40
43
  open: c,
41
44
  children: [/* @__PURE__ */ e(n.Trigger, {
42
- children: /* @__PURE__ */ e(M, {
45
+ children: /* @__PURE__ */ e(z, {
43
46
  caretDirection: c ? "up" : "down",
44
- className: L(s.container, s.overrides),
45
- disabled: h ?? b,
46
- label: S,
47
+ className: k(s.container, s.overrides),
48
+ disabled: !g.canSetShareAccess || (h ?? x),
49
+ label: _,
47
50
  size: "extraSmall",
48
51
  variant: "tertiary"
49
52
  })
50
53
  }), /* @__PURE__ */ e(n.Content, {
51
54
  align: "start",
52
55
  className: s.content,
53
- children: r.map((v) => {
56
+ children: r.map((A) => {
54
57
  const {
55
58
  description: a,
56
- disabledReason: _,
59
+ disabledReason: C,
57
60
  id: t,
58
61
  label: l
59
- } = v, o = f === t, C = () => {
60
- o || x(t);
62
+ } = A, o = S === t, L = () => {
63
+ o || v(t);
61
64
  };
62
- return _ ? /* @__PURE__ */ e(I, {
63
- content: d(T.disabledAccessLevelTooltip),
64
- children: /* @__PURE__ */ e(z, {
65
+ return C ? /* @__PURE__ */ e(T, {
66
+ content: d(w.disabledAccessLevelTooltip),
67
+ children: /* @__PURE__ */ e(q, {
65
68
  children: /* @__PURE__ */ e(n.CheckboxItem, {
66
69
  checked: o,
67
70
  disabled: !0,
@@ -73,7 +76,7 @@ function P() {
73
76
  })
74
77
  }, t) : /* @__PURE__ */ e(n.CheckboxItem, {
75
78
  checked: o,
76
- onSelect: C,
79
+ onSelect: L,
77
80
  children: /* @__PURE__ */ e(n.Item.MainContent, {
78
81
  caption: a,
79
82
  label: l
@@ -84,5 +87,5 @@ function P() {
84
87
  });
85
88
  }
86
89
  export {
87
- P as SharedLinkAccess
90
+ V as SharedLinkAccess
88
91
  };
@@ -1,66 +1,69 @@
1
- import L from "clsx";
2
- import { useState as C } from "react";
3
- import { DropdownMenu as e, TriggerButton as k } from "@box/blueprint-web";
4
- import { jsxs as M, jsx as n } from "react/jsx-runtime";
5
- import { usePermissionLevels as z } from "../../../hooks/use-permission-levels.js";
6
- import { useUnifiedShareModalContext as P } from "../../../contexts/unified-share-modal-context.js";
7
- import { useSharingAction as q } from "../../../hooks/use-sharing-action.js";
8
- import '../../../../../styles/shared-link-access.css';const w = "_container_xhq4z_1", I = "_overrides_xhq4z_1", O = "_content_xhq4z_6", o = {
9
- container: w,
10
- overrides: I,
11
- content: O
1
+ import k from "clsx";
2
+ import { useState as M } from "react";
3
+ import { DropdownMenu as e, TriggerButton as z } from "@box/blueprint-web";
4
+ import { jsxs as P, jsx as n } from "react/jsx-runtime";
5
+ import { usePermissionLevels as q } from "../../../hooks/use-permission-levels.js";
6
+ import { useUnifiedShareModalContext as w } from "../../../contexts/unified-share-modal-context.js";
7
+ import { useSharingAction as A } from "../../../hooks/use-sharing-action.js";
8
+ import '../../../../../styles/shared-link-access.css';const I = "_container_xhq4z_1", O = "_overrides_xhq4z_1", j = "_content_xhq4z_6", o = {
9
+ container: I,
10
+ overrides: O,
11
+ content: j
12
12
  };
13
- function R() {
14
- const [r, a] = C(!1), {
13
+ function E() {
14
+ const [s, a] = M(!1), {
15
15
  isSubmitting: l,
16
+ item: m,
16
17
  sharedLink: d,
17
- sharingService: m
18
- } = P(), {
19
- access: h,
20
- permission: p
21
- } = d, {
22
- changeSharedLinkPermission: u
18
+ sharingService: h
19
+ } = w(), {
20
+ permissions: p = {}
23
21
  } = m, {
24
- isLoading: g,
25
- onAction: f
26
- } = q(u), {
22
+ access: u,
23
+ permission: g
24
+ } = d, {
25
+ changeSharedLinkPermission: S
26
+ } = h, {
27
+ isLoading: f,
28
+ onAction: x
29
+ } = A(S), {
27
30
  allowedLevels: i,
28
- selectedPermission: s
29
- } = z();
30
- if (h === "collaborators" || !i.length || !s)
31
+ selectedPermission: r
32
+ } = q();
33
+ if (u === "collaborators" || !i.length || !r)
31
34
  return null;
32
35
  const {
33
- label: S
34
- } = s;
35
- return /* @__PURE__ */ M(e.Root, {
36
+ label: _
37
+ } = r;
38
+ return /* @__PURE__ */ P(e.Root, {
36
39
  onOpenChange: a,
37
- open: r,
40
+ open: s,
38
41
  children: [/* @__PURE__ */ n(e.Trigger, {
39
- children: /* @__PURE__ */ n(k, {
40
- caretDirection: r ? "up" : "down",
41
- className: L(o.container, o.overrides),
42
- disabled: l ?? g,
43
- label: S,
42
+ children: /* @__PURE__ */ n(z, {
43
+ caretDirection: s ? "up" : "down",
44
+ className: k(o.container, o.overrides),
45
+ disabled: !p.canSetShareAccess || (l ?? f),
46
+ label: _,
44
47
  size: "extraSmall",
45
48
  variant: "tertiary"
46
49
  })
47
50
  }), /* @__PURE__ */ n(e.Content, {
48
51
  align: "start",
49
52
  className: o.content,
50
- children: i.map((x) => {
53
+ children: i.map((b) => {
51
54
  const {
52
- description: _,
55
+ description: v,
53
56
  id: t,
54
- label: b
55
- } = x, c = p === t, v = () => {
56
- c || f(t);
57
+ label: L
58
+ } = b, c = g === t, C = () => {
59
+ c || x(t);
57
60
  };
58
61
  return /* @__PURE__ */ n(e.CheckboxItem, {
59
62
  checked: c,
60
- onSelect: v,
63
+ onSelect: C,
61
64
  children: /* @__PURE__ */ n(e.Item.MainContent, {
62
- caption: _,
63
- label: b
65
+ caption: v,
66
+ label: L
64
67
  })
65
68
  }, t);
66
69
  })
@@ -68,5 +71,5 @@ function R() {
68
71
  });
69
72
  }
70
73
  export {
71
- R as SharedLinkPermission
74
+ E as SharedLinkPermission
72
75
  };