@box/unified-share-modal 1.33.0 → 1.35.0

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.
@@ -1,75 +1,77 @@
1
- import { useState as i, useEffect as I, useMemo as T } from "react";
2
- import { DEFAULT_CONFIGURATION as j } from "./constants.js";
3
- import { jsxs as A, jsx as s } from "react/jsx-runtime";
4
- import { UnifiedShareModalContext as E } from "./contexts/unified-share-modal-context.js";
5
- import { UnifiedShareFormModal as y } from "./components/unified-share-form-modal/unified-share-form-modal.js";
6
- import { SharedLinkSettingsModal as D } from "./components/shared-link-settings-modal/shared-link-settings-modal.js";
7
- import { RemoveSharedLinkModal as G } from "./components/remove-shared-link-modal/remove-shared-link-modal.js";
8
- import { RemoveCollaboratorModal as N } from "./components/remove-collaborator-modal/remove-collaborator-modal.js";
9
- function Q({
1
+ import { useState as i, useEffect as V, useMemo as j } from "react";
2
+ import { DEFAULT_CONFIGURATION as E } from "./constants.js";
3
+ import { jsxs as y, jsx as s } from "react/jsx-runtime";
4
+ import { UnifiedShareModalContext as A } from "./contexts/unified-share-modal-context.js";
5
+ import { UnifiedShareFormModal as D } from "./components/unified-share-form-modal/unified-share-form-modal.js";
6
+ import { SharedLinkSettingsModal as G } from "./components/shared-link-settings-modal/shared-link-settings-modal.js";
7
+ import { RemoveSharedLinkModal as N } from "./components/remove-shared-link-modal/remove-shared-link-modal.js";
8
+ import { RemoveCollaboratorModal as P } from "./components/remove-collaborator-modal/remove-collaborator-modal.js";
9
+ function W({
10
10
  children: m,
11
- collaborationNotices: f,
12
- collaborationRoles: d,
13
- collaborators: l,
14
- config: h,
15
- contactService: p,
16
- currentUser: c,
17
- eventService: u,
18
- initialContacts: g,
19
- isFetching: C,
11
+ collaborationAccess: f,
12
+ collaborationNotices: d,
13
+ collaborationRoles: l,
14
+ collaborators: h,
15
+ config: p,
16
+ contactService: u,
17
+ currentUser: g,
18
+ eventService: c,
19
+ initialContacts: C,
20
+ isFetching: M,
20
21
  isOpen: e,
21
- isSubmitting: M,
22
- item: O,
22
+ isSubmitting: O,
23
+ item: U,
23
24
  onLoad: t,
24
- onOpenChange: U,
25
- sharedLink: v,
26
- sharingService: S
25
+ onOpenChange: v,
26
+ sharedLink: S,
27
+ sharingService: x
27
28
  }) {
28
- const V = !!m, [o, x] = i(e ?? !V), [k, b] = i(!!t), [r, a] = i("unified-share-form"), [w, F] = i();
29
- I(() => x((n) => e ?? n), [e]), I(() => {
30
- (async () => (t && await t(), b(!1)))();
29
+ const F = !!m, [o, k] = i(e ?? !F), [w, L] = i(!!t), [r, a] = i("unified-share-form"), [I, R] = i();
30
+ V(() => k((n) => e ?? n), [e]), V(() => {
31
+ (async () => (t && await t(), L(!1)))();
31
32
  }, []);
32
- const L = (n) => {
33
- x(e ?? n), U && U(n);
34
- }, R = T(() => ({
35
- collaborationNotices: f,
36
- collaborationRoles: d ?? [],
37
- collaborator: w ?? {},
38
- collaborators: l ?? [],
33
+ const T = (n) => {
34
+ k(e ?? n), v && v(n);
35
+ }, b = j(() => ({
36
+ collaborationAccess: f,
37
+ collaborationNotices: d,
38
+ collaborationRoles: l ?? [],
39
+ collaborator: I ?? {},
40
+ collaborators: h ?? [],
39
41
  config: {
40
- ...j,
41
- ...h
42
+ ...E,
43
+ ...p
42
44
  },
43
- contactService: p ?? {},
44
- currentUser: c ?? {},
45
- eventService: u ?? {},
46
- initialContacts: g ?? [],
47
- isFetching: C ?? k,
48
- isSubmitting: M,
49
- item: O,
50
- setCollaborator: F,
51
- sharedLink: v ?? {},
52
- sharingService: S ?? {}
53
- }), [f, d, w, l, h, p, c, u, g, C, k, M, O, v, S]);
54
- return /* @__PURE__ */ A(E.Provider, {
55
- value: R,
56
- children: [/* @__PURE__ */ s(y, {
45
+ contactService: u ?? {},
46
+ currentUser: g ?? {},
47
+ eventService: c ?? {},
48
+ initialContacts: C ?? [],
49
+ isFetching: M ?? w,
50
+ isSubmitting: O,
51
+ item: U,
52
+ setCollaborator: R,
53
+ sharedLink: S ?? {},
54
+ sharingService: x ?? {}
55
+ }), [f, d, l, I, h, p, u, g, c, C, M, w, O, U, S, x]);
56
+ return /* @__PURE__ */ y(A.Provider, {
57
+ value: b,
58
+ children: [/* @__PURE__ */ s(D, {
57
59
  isOpen: o && r === "unified-share-form",
58
60
  onModalViewChange: a,
59
- onOpenChange: L,
61
+ onOpenChange: T,
60
62
  children: m
61
- }), /* @__PURE__ */ s(D, {
63
+ }), /* @__PURE__ */ s(G, {
62
64
  isOpen: o && r === "shared-link-settings",
63
65
  onOpenChange: () => a("unified-share-form")
64
- }), /* @__PURE__ */ s(G, {
66
+ }), /* @__PURE__ */ s(N, {
65
67
  isOpen: o && r === "remove-shared-link",
66
68
  onOpenChange: () => a("unified-share-form")
67
- }), /* @__PURE__ */ s(N, {
69
+ }), /* @__PURE__ */ s(P, {
68
70
  isOpen: o && r === "remove-collaborator",
69
71
  onOpenChange: () => a("unified-share-form")
70
72
  })]
71
73
  });
72
74
  }
73
75
  export {
74
- Q as UnifiedShareModal
76
+ W as UnifiedShareModal
75
77
  };
@@ -1 +1 @@
1
- ._container_xvspw_1{align-self:flex-start;margin-top:var(--space-3)}._container_xvspw_1._overrides_xvspw_5{min-height:unset;font-weight:var(--body-default-font-weight)}._focusable_xvspw_10{justify-self:flex-start}
1
+ ._container_1fonq_1{align-self:flex-start}._container_1fonq_1._overrides_1fonq_4{min-height:unset;font-weight:var(--body-default-font-weight)}._focusable_1fonq_9{justify-self:flex-start}
@@ -1 +1 @@
1
- ._container_1ixpu_2{display:flex;flex-direction:column;gap:var(--space-4)}._label_1ixpu_8{font-weight:var(--body-default-bold-font-weight);font-size:var(--body-default-bold-font-size);font-family:var(--body-default-bold-font-family);line-height:var(--body-default-bold-line-height);letter-spacing:var(--body-default-bold-letter-spacing);text-transform:var(--body-default-bold-text-case);text-decoration:var(--body-default-bold-text-decoration);display:block;margin-block-end:var(--space-2);padding:var(--space-1) 0;color:var(--text-text-on-light);overflow-wrap:break-word}._securityIndicator_1ixpu_23>svg{display:inline-block;margin-bottom:-3px;padding-right:var(--space-1)}
1
+ ._container_wmqot_2{display:flex;flex-direction:column;gap:var(--space-4)}._label_wmqot_8{font-weight:var(--body-default-bold-font-weight);font-size:var(--body-default-bold-font-size);font-family:var(--body-default-bold-font-family);line-height:var(--body-default-bold-line-height);letter-spacing:var(--body-default-bold-letter-spacing);text-transform:var(--body-default-bold-text-case);text-decoration:var(--body-default-bold-text-decoration);display:block;margin-block-end:var(--space-2);padding:var(--space-1) 0;color:var(--text-text-on-light);overflow-wrap:break-word}._securityIndicator_wmqot_23>svg{display:inline-block;margin-bottom:-3px;padding-right:var(--space-1)}._collaborationAccessContainer_wmqot_29{display:flex;gap:var(--space-2);margin-top:var(--space-3)}
@@ -1 +1 @@
1
- ._container_1w9vi_1{display:flex;flex-direction:column;gap:var(--space-3)}._toggle_1w9vi_7{display:flex;gap:var(--space-2);align-items:center}._settings_1w9vi_13{margin-left:auto;cursor:pointer}._settings_1w9vi_13[aria-disabled=true]{opacity:.3;pointer-events:none}._copy_1w9vi_22{display:flex;gap:var(--space-2)}._copy_1w9vi_22>div:first-child{flex-grow:1}._access_1w9vi_30{display:flex;flex-wrap:wrap;gap:var(--space-6)}._securityIndicator_1w9vi_36>svg{display:inline-block;margin-bottom:-3px;padding-right:var(--space-1)}
1
+ ._container_1b8qy_1{display:flex;flex-direction:column;gap:var(--space-3)}._toggle_1b8qy_7{display:flex;gap:var(--space-2);align-items:center}._settings_1b8qy_13{margin-left:auto;cursor:pointer}._settings_1b8qy_13[aria-disabled=true]{opacity:.3;pointer-events:none}._copy_1b8qy_22{display:flex;gap:var(--space-2)}._copy_1b8qy_22>div:first-child{flex-grow:1}._access_1b8qy_30{display:flex;flex-wrap:wrap;gap:var(--space-2)}._securityIndicator_1b8qy_36>svg{display:inline-block;margin-bottom:-3px;padding-right:var(--space-1)}
@@ -1 +1 @@
1
- ._content_1wiic_1._content_1wiic_1{max-width:480px}._body_1wiic_5._body_1wiic_5{display:flex;flex-direction:column;gap:var(--space-4);padding-top:0;padding-bottom:0}
1
+ ._content_1r0kk_1._content_1r0kk_1{max-width:480px}._body_1r0kk_5._body_1r0kk_5{position:relative;display:flex;flex-direction:column;gap:var(--space-4);padding-top:0;padding-bottom:0}._body_1r0kk_5._body_1r0kk_5[inert]{min-height:200px}._loading_1r0kk_17{position:absolute;inset:0;z-index:1;display:flex;align-items:center;padding-bottom:var(--space-8);background-color:var(--gray-white)}
@@ -2,6 +2,7 @@ import { Dispatch, ReactElement, SetStateAction } from 'react';
2
2
  import { UserContactType } from '@box/user-selector';
3
3
  import { CollaborationRole, Collaborator, Configuration, ContactService, EventService, Item, SharedLink, SharingService, User } from '../types';
4
4
  export interface UnifiedShareModalContextValue {
5
+ collaborationAccess?: ReactElement;
5
6
  collaborationNotices?: ReactElement | ReactElement[];
6
7
  collaborationRoles?: CollaborationRole[];
7
8
  collaborator?: Partial<Collaborator>;
@@ -334,14 +334,20 @@ export interface CollaborationRole {
334
334
  label?: string;
335
335
  }
336
336
  export interface EventService {
337
+ /**
338
+ * Function to customize the click behavior of the "Shared with ..." list of avatars.
339
+ *
340
+ * If provided, the default behavior is disabled and the list of collaborators will not be rendered.
341
+ *
342
+ * Used to enhance the experience for managing collaborators such as opening the Collaborators Modal.
343
+ */
337
344
  onCollaboratorsClick?: () => void;
338
345
  /**
339
- * Custom handler to replace the default "Manage All" link behavior.
346
+ * Function to customize the click behavior of the "Manage All" link.
340
347
  *
341
- * When provided, prevents the default navigation and calls this handler instead.
342
- * Useful for opening a CollaboratorsModal or custom dialog without leaving the page.
348
+ * If provided, the default behavior is disabled and the link will be rendered as a button.
343
349
  *
344
- * Use this when you want to override the default navigation behavior.
350
+ * Used to enhance the experience for managing collaborators or override the default navigation behavior.
345
351
  */
346
352
  onCollaboratorsManagementClick?: () => void;
347
353
  /**
@@ -350,8 +356,21 @@ export interface EventService {
350
356
  * This is usually used for data tracking purposes.
351
357
  */
352
358
  onRestrictedUsersRemoveClick?: (contacts: UserContactType[]) => void;
359
+ /**
360
+ * Function to customize the click behavior of the "Link Settings" link.
361
+ *
362
+ * NOTE: This has not been implemented.
363
+ */
353
364
  onSharedLinkSettingsClick?: () => void;
365
+ /**
366
+ * Function to observe when the user closes the view for the shared link settings.
367
+ */
354
368
  onSharedLinkSettingsClose?: () => void;
369
+ /**
370
+ * Function to allow the consumer to fetch data for the shared link settings.
371
+ *
372
+ * Called when the user opens the view for the shared link settings.
373
+ */
355
374
  onSharedLinkSettingsLoad?: () => void;
356
375
  }
357
376
  export interface ContactService {
@@ -3,6 +3,7 @@ import { UserContactType } from '@box/user-selector';
3
3
  import { CollaborationRole, Collaborator, Configuration, ContactService, EventService, Item, SharedLink, SharingService, User } from './types';
4
4
  export interface UnifiedShareModalProps {
5
5
  children?: ReactElement;
6
+ collaborationAccess?: ReactElement;
6
7
  collaborationNotices?: ReactElement | ReactElement[];
7
8
  collaborationRoles?: CollaborationRole[];
8
9
  collaborators?: Collaborator[];
@@ -20,4 +21,4 @@ export interface UnifiedShareModalProps {
20
21
  sharedLink?: SharedLink;
21
22
  sharingService?: SharingService;
22
23
  }
23
- export declare function UnifiedShareModal({ children, collaborationNotices, collaborationRoles, collaborators, config, contactService, currentUser, eventService, initialContacts, isFetching, isOpen, isSubmitting, item, onLoad, onOpenChange, sharedLink, sharingService, }: UnifiedShareModalProps): import("react/jsx-runtime").JSX.Element;
24
+ export declare function UnifiedShareModal({ children, collaborationAccess, collaborationNotices, collaborationRoles, collaborators, config, contactService, currentUser, eventService, initialContacts, isFetching, isOpen, isSubmitting, item, onLoad, onOpenChange, sharedLink, sharingService, }: UnifiedShareModalProps): import("react/jsx-runtime").JSX.Element;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@box/unified-share-modal",
3
- "version": "1.33.0",
3
+ "version": "1.35.0",
4
4
  "license": "SEE LICENSE IN LICENSE",
5
5
  "peerDependencies": {
6
6
  "@box/blueprint-web": "^12.112.0",