@box/unified-share-modal 1.27.0 → 1.28.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.
@@ -1,21 +1,21 @@
1
- import y from "clsx";
2
- import { useState as g, useCallback as w } from "react";
3
- import { useIntl as N } from "react-intl";
4
- import { Modal as o, Status as U, LoadingIndicator as I } from "@box/blueprint-web";
5
- import { Shield as P } from "@box/blueprint-web-assets/icons/Line";
6
- import { UnifiedShareForm as v } from "./unified-share-form.js";
1
+ import w from "clsx";
2
+ import { useState as g, useCallback as N } from "react";
3
+ import { useIntl as U } from "react-intl";
4
+ import { Modal as o, Status as I, LoadingIndicator as P } from "@box/blueprint-web";
5
+ import { Shield as v } from "@box/blueprint-web-assets/icons/Line";
6
+ import { UnifiedShareForm as D } from "./unified-share-form.js";
7
7
  import l from "./messages.js";
8
8
  import { jsxs as n, jsx as e } from "react/jsx-runtime";
9
- import { UnifiedShareFormProvider as D } from "../../contexts/unified-share-form-context.js";
10
- import { useUnifiedShareModalContext as O } from "../../contexts/unified-share-modal-context.js";
11
- import '../../../../styles/unified-share-form-modal.css';const V = "_content_1tnt5_1", j = "_header_1tnt5_5", z = "_body_1tnt5_12", B = "_hasFooter_1tnt5_23", L = "_loading_1tnt5_27", t = {
12
- content: V,
13
- header: j,
14
- body: z,
15
- hasFooter: B,
16
- loading: L
9
+ import { UnifiedShareFormProvider as O } from "../../contexts/unified-share-form-context.js";
10
+ import { useUnifiedShareModalContext as V } from "../../contexts/unified-share-modal-context.js";
11
+ import '../../../../styles/unified-share-form-modal.css';const j = "_content_1tnt5_1", z = "_header_1tnt5_5", B = "_body_1tnt5_12", L = "_hasFooter_1tnt5_23", R = "_loading_1tnt5_27", t = {
12
+ content: j,
13
+ header: z,
14
+ body: B,
15
+ hasFooter: L,
16
+ loading: R
17
17
  };
18
- function Q({
18
+ function W({
19
19
  children: d,
20
20
  isOpen: p,
21
21
  onOpenChange: a,
@@ -23,52 +23,54 @@ function Q({
23
23
  }) {
24
24
  const {
25
25
  formatMessage: r
26
- } = N(), {
27
- isFetching: _,
26
+ } = U(), {
27
+ initialContacts: _,
28
+ isFetching: C,
28
29
  item: F
29
- } = O(), {
30
+ } = V(), {
30
31
  classification: i,
31
32
  name: S
32
- } = F, [b, C] = g(null), [c, m] = g("default"), x = !!d, h = c !== "default", f = w((s) => {
33
+ } = F, [b, x] = g(null), [c, m] = g("default"), M = !!d, h = c !== "default", f = N((s) => {
33
34
  m("default"), a && a(s);
34
- }, [a]), M = (s) => {
35
+ }, [a]), y = (s) => {
35
36
  s.preventDefault();
36
37
  };
37
38
  return /* @__PURE__ */ n(o, {
38
39
  onOpenChange: f,
39
40
  open: p,
40
- children: [x && /* @__PURE__ */ e(o.Trigger, {
41
+ children: [M && /* @__PURE__ */ e(o.Trigger, {
41
42
  children: d
42
43
  }), /* @__PURE__ */ n(o.Content, {
43
- ref: C,
44
+ ref: x,
44
45
  className: t.content,
45
- onPointerDownOutside: M,
46
+ onPointerDownOutside: y,
46
47
  size: "medium",
47
48
  children: [/* @__PURE__ */ n(o.Header, {
48
49
  className: t.header,
49
50
  children: [r(l.title, {
50
51
  itemName: S
51
- }), i && /* @__PURE__ */ e(U, {
52
+ }), i && /* @__PURE__ */ e(I, {
52
53
  colorIndex: i.colorId + 1,
53
- icon: P,
54
+ icon: v,
54
55
  iconPosition: "left",
55
56
  text: i.name.toUpperCase()
56
57
  })]
57
58
  }), /* @__PURE__ */ e(o.Body, {
58
- className: y(t.body, h && t.hasFooter),
59
- children: /* @__PURE__ */ n(D, {
59
+ className: w(t.body, h && t.hasFooter),
60
+ children: /* @__PURE__ */ n(O, {
60
61
  container: b,
62
+ initialContacts: _,
61
63
  onModalOpenChange: f,
62
64
  onModalViewChange: u,
63
65
  onShareViewChange: m,
64
66
  shareView: c,
65
- children: [_ && /* @__PURE__ */ e("div", {
67
+ children: [C && /* @__PURE__ */ e("div", {
66
68
  className: t.loading,
67
- children: /* @__PURE__ */ e(I, {
69
+ children: /* @__PURE__ */ e(P, {
68
70
  "aria-label": r(l.loadingLabel),
69
71
  size: "large"
70
72
  })
71
- }), /* @__PURE__ */ e(v, {})]
73
+ }), /* @__PURE__ */ e(D, {})]
72
74
  })
73
75
  }), !h && /* @__PURE__ */ e(o.Close, {
74
76
  "aria-label": r(l.closeButton)
@@ -77,5 +79,5 @@ function Q({
77
79
  });
78
80
  }
79
81
  export {
80
- Q as UnifiedShareFormModal
82
+ W as UnifiedShareFormModal
81
83
  };
@@ -1,19 +1,20 @@
1
- import { createContext as F, useContext as S, useState as e, useMemo as v } from "react";
2
- import { jsx as b } from "react/jsx-runtime";
3
- const l = /* @__PURE__ */ F({}), p = () => {
4
- const t = S(l);
1
+ import { createContext as S, useContext as v, useState as e, useMemo as b } from "react";
2
+ import { jsx as P } from "react/jsx-runtime";
3
+ const l = /* @__PURE__ */ S({}), R = () => {
4
+ const t = v(l);
5
5
  if (!t)
6
6
  throw new Error("useUnifiedShareFormContext must be used with UnifiedShareFormProvider");
7
7
  return t;
8
- }, R = ({
8
+ }, V = ({
9
9
  children: t,
10
10
  container: o,
11
+ initialContacts: x,
11
12
  onModalOpenChange: r,
12
13
  onModalViewChange: s,
13
14
  onShareViewChange: n,
14
15
  shareView: c
15
16
  }) => {
16
- const [u, x] = e([]), [a, f] = e(""), [i, d] = e(""), [m, C] = e(), U = v(() => ({
17
+ const [u, f] = e(x), [a, d] = e(""), [i, C] = e(""), [m, U] = e(), F = b(() => ({
17
18
  collaborationRole: m,
18
19
  contactValue: a,
19
20
  container: o,
@@ -21,20 +22,20 @@ const l = /* @__PURE__ */ F({}), p = () => {
21
22
  onModalOpenChange: r,
22
23
  onModalViewChange: s,
23
24
  onShareViewChange: n,
24
- setCollaborationRole: C,
25
- setContactValue: f,
26
- setMessageValue: d,
27
- setUserContacts: x,
25
+ setCollaborationRole: U,
26
+ setContactValue: d,
27
+ setMessageValue: C,
28
+ setUserContacts: f,
28
29
  shareView: c,
29
30
  userContacts: u
30
31
  }), [m, a, o, i, r, s, n, c, u]);
31
- return /* @__PURE__ */ b(l.Provider, {
32
- value: U,
32
+ return /* @__PURE__ */ P(l.Provider, {
33
+ value: F,
33
34
  children: t
34
35
  });
35
36
  };
36
37
  export {
37
38
  l as UnifiedShareFormContext,
38
- R as UnifiedShareFormProvider,
39
- p as useUnifiedShareFormContext
39
+ V as UnifiedShareFormProvider,
40
+ R as useUnifiedShareFormContext
40
41
  };
@@ -1,12 +1,12 @@
1
- import { useState as i, useEffect as b, useMemo as L } from "react";
2
- import { DEFAULT_CONFIGURATION as R } from "./constants.js";
3
- import { jsxs as T, jsx as s } from "react/jsx-runtime";
4
- import { UnifiedShareModalContext as j } from "./contexts/unified-share-modal-context.js";
5
- import { UnifiedShareFormModal as A } from "./components/unified-share-form-modal/unified-share-form-modal.js";
6
- import { SharedLinkSettingsModal as E } 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 y } from "./components/remove-collaborator-modal/remove-collaborator-modal.js";
9
- function J({
1
+ import { useState as i, useEffect as k, useMemo as R } from "react";
2
+ import { DEFAULT_CONFIGURATION as T } from "./constants.js";
3
+ import { jsxs as j, jsx as s } from "react/jsx-runtime";
4
+ import { UnifiedShareModalContext as A } from "./contexts/unified-share-modal-context.js";
5
+ import { UnifiedShareFormModal as E } from "./components/unified-share-form-modal/unified-share-form-modal.js";
6
+ import { SharedLinkSettingsModal as N } from "./components/shared-link-settings-modal/shared-link-settings-modal.js";
7
+ import { RemoveSharedLinkModal as y } from "./components/remove-shared-link-modal/remove-shared-link-modal.js";
8
+ import { RemoveCollaboratorModal as D } from "./components/remove-collaborator-modal/remove-collaborator-modal.js";
9
+ function K({
10
10
  children: m,
11
11
  collaborationRoles: f,
12
12
  collaborators: l,
@@ -14,58 +14,60 @@ function J({
14
14
  contactService: h,
15
15
  currentUser: p,
16
16
  eventService: c,
17
- isFetching: u,
17
+ initialContacts: u,
18
+ isFetching: g,
18
19
  isOpen: o,
19
- isSubmitting: g,
20
- item: C,
20
+ isSubmitting: C,
21
+ item: M,
21
22
  onLoad: t,
22
- onOpenChange: M,
23
- sharedLink: O,
24
- sharingService: U
23
+ onOpenChange: O,
24
+ sharedLink: U,
25
+ sharingService: v
25
26
  }) {
26
- const k = !!m, [e, v] = i(o ?? !k), [S, w] = i(!!t), [r, a] = i("unified-share-form"), [x, I] = i();
27
- b(() => v((n) => o ?? n), [o]), b(() => {
28
- (async () => (t && await t(), w(!1)))();
27
+ const w = !!m, [e, S] = i(o ?? !w), [x, I] = i(!!t), [r, a] = i("unified-share-form"), [b, V] = i();
28
+ k(() => S((n) => o ?? n), [o]), k(() => {
29
+ (async () => (t && await t(), I(!1)))();
29
30
  }, []);
30
- const V = (n) => {
31
- v(o ?? n), M && M(n);
32
- }, F = L(() => ({
31
+ const F = (n) => {
32
+ S(o ?? n), O && O(n);
33
+ }, L = R(() => ({
33
34
  collaborationRoles: f ?? [],
34
- collaborator: x ?? {},
35
+ collaborator: b ?? {},
35
36
  collaborators: l ?? [],
36
37
  config: {
37
- ...R,
38
+ ...T,
38
39
  ...d
39
40
  },
40
41
  contactService: h ?? {},
41
42
  currentUser: p ?? {},
42
43
  eventService: c ?? {},
43
- isFetching: u ?? S,
44
- isSubmitting: g,
45
- item: C,
46
- setCollaborator: I,
47
- sharedLink: O ?? {},
48
- sharingService: U ?? {}
49
- }), [f, x, l, d, h, p, c, u, S, g, C, O, U]);
50
- return /* @__PURE__ */ T(j.Provider, {
51
- value: F,
52
- children: [/* @__PURE__ */ s(A, {
44
+ initialContacts: u ?? [],
45
+ isFetching: g ?? x,
46
+ isSubmitting: C,
47
+ item: M,
48
+ setCollaborator: V,
49
+ sharedLink: U ?? {},
50
+ sharingService: v ?? {}
51
+ }), [f, b, l, d, h, p, c, u, g, x, C, M, U, v]);
52
+ return /* @__PURE__ */ j(A.Provider, {
53
+ value: L,
54
+ children: [/* @__PURE__ */ s(E, {
53
55
  isOpen: e && r === "unified-share-form",
54
56
  onModalViewChange: a,
55
- onOpenChange: V,
57
+ onOpenChange: F,
56
58
  children: m
57
- }), /* @__PURE__ */ s(E, {
59
+ }), /* @__PURE__ */ s(N, {
58
60
  isOpen: e && r === "shared-link-settings",
59
61
  onOpenChange: () => a("unified-share-form")
60
- }), /* @__PURE__ */ s(N, {
62
+ }), /* @__PURE__ */ s(y, {
61
63
  isOpen: e && r === "remove-shared-link",
62
64
  onOpenChange: () => a("unified-share-form")
63
- }), /* @__PURE__ */ s(y, {
65
+ }), /* @__PURE__ */ s(D, {
64
66
  isOpen: e && r === "remove-collaborator",
65
67
  onOpenChange: () => a("unified-share-form")
66
68
  })]
67
69
  });
68
70
  }
69
71
  export {
70
- J as UnifiedShareModal
72
+ K as UnifiedShareModal
71
73
  };
@@ -16,10 +16,11 @@ export declare const useUnifiedShareFormContext: () => UnifiedShareFormContextVa
16
16
  interface UnifiedShareFormProviderProps {
17
17
  children: ReactNode;
18
18
  container?: HTMLDivElement | null;
19
+ initialContacts?: UserContactType[];
19
20
  onModalOpenChange?: (open: boolean) => void;
20
21
  onModalViewChange?: (view: ModalViewType) => void;
21
22
  onShareViewChange?: (view: ShareViewType) => void;
22
23
  shareView?: ShareViewType;
23
24
  }
24
- export declare const UnifiedShareFormProvider: ({ children, container, onModalOpenChange, onModalViewChange, onShareViewChange, shareView, }: UnifiedShareFormProviderProps) => import("react/jsx-runtime").JSX.Element;
25
+ export declare const UnifiedShareFormProvider: ({ children, container, initialContacts, onModalOpenChange, onModalViewChange, onShareViewChange, shareView, }: UnifiedShareFormProviderProps) => import("react/jsx-runtime").JSX.Element;
25
26
  export {};
@@ -1,4 +1,5 @@
1
1
  import { Dispatch, SetStateAction } from 'react';
2
+ import { UserContactType } from '@box/user-selector';
2
3
  import { CollaborationRole, Collaborator, Configuration, ContactService, EventService, Item, SharedLink, SharingService, User } from '../types';
3
4
  export interface UnifiedShareModalContextValue {
4
5
  collaborationRoles?: CollaborationRole[];
@@ -8,6 +9,7 @@ export interface UnifiedShareModalContextValue {
8
9
  contactService?: ContactService;
9
10
  currentUser?: Partial<User>;
10
11
  eventService?: EventService;
12
+ initialContacts?: UserContactType[];
11
13
  isFetching?: boolean;
12
14
  isSubmitting?: boolean;
13
15
  item?: Item;
@@ -1,4 +1,5 @@
1
1
  import { ReactElement } from 'react';
2
+ import { UserContactType } from '@box/user-selector';
2
3
  import { CollaborationRole, Collaborator, Configuration, ContactService, EventService, Item, SharedLink, SharingService, User } from './types';
3
4
  export interface UnifiedShareModalProps {
4
5
  children?: ReactElement;
@@ -8,6 +9,7 @@ export interface UnifiedShareModalProps {
8
9
  contactService?: ContactService;
9
10
  currentUser?: User;
10
11
  eventService?: EventService;
12
+ initialContacts?: UserContactType[];
11
13
  isFetching?: boolean;
12
14
  isOpen?: boolean;
13
15
  isSubmitting?: boolean;
@@ -17,4 +19,4 @@ export interface UnifiedShareModalProps {
17
19
  sharedLink?: SharedLink;
18
20
  sharingService?: SharingService;
19
21
  }
20
- export declare function UnifiedShareModal({ children, collaborationRoles, collaborators, config, contactService, currentUser, eventService, isFetching, isOpen, isSubmitting, item, onLoad, onOpenChange, sharedLink, sharingService, }: UnifiedShareModalProps): import("react/jsx-runtime").JSX.Element;
22
+ export declare function UnifiedShareModal({ children, 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,22 +1,22 @@
1
1
  {
2
2
  "name": "@box/unified-share-modal",
3
- "version": "1.27.0",
3
+ "version": "1.28.1",
4
4
  "license": "SEE LICENSE IN LICENSE",
5
5
  "peerDependencies": {
6
- "@box/blueprint-web": "^12.108.2",
7
- "@box/blueprint-web-assets": "^4.89.1",
8
- "@box/copy-input": "^1.20.0",
9
- "@box/user-selector": "^1.52.0",
6
+ "@box/blueprint-web": "^12.108.3",
7
+ "@box/blueprint-web-assets": "^4.89.2",
8
+ "@box/copy-input": "^1.20.1",
9
+ "@box/user-selector": "^1.52.1",
10
10
  "lodash": "^4.17.15",
11
11
  "react": "^18.0.0",
12
12
  "react-dom": "^18.0.0",
13
13
  "react-intl": "^6.4.2"
14
14
  },
15
15
  "devDependencies": {
16
- "@box/blueprint-web": "^12.108.2",
17
- "@box/blueprint-web-assets": "^4.89.1",
18
- "@box/copy-input": "^1.20.0",
19
- "@box/storybook-utils": "0.14.35",
16
+ "@box/blueprint-web": "^12.108.3",
17
+ "@box/blueprint-web-assets": "^4.89.2",
18
+ "@box/copy-input": "^1.20.1",
19
+ "@box/storybook-utils": "0.14.36",
20
20
  "@box/eslint-plugin-blueprint": "1.0.5",
21
21
  "react-intl": "^6.4.2"
22
22
  },