@box/unified-share-modal 1.47.0 → 1.48.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.
@@ -42,7 +42,7 @@ function X({
42
42
  f(), g && g(), m(!1);
43
43
  }, y = async () => {
44
44
  await p() || (f(), m(!1));
45
- }, c = L ?? F, _ = S || x;
45
+ }, c = L || F, _ = S || x;
46
46
  return /* @__PURE__ */ o(i, {
47
47
  onOpenChange: u,
48
48
  open: s,
@@ -1,44 +1,49 @@
1
- import { createContext as b, useContext as p, useState as e, useCallback as v, useMemo as g } from "react";
2
- import { useUnifiedShareModalContext as w } from "./unified-share-modal-context.js";
3
- import { jsx as M } from "react/jsx-runtime";
4
- const u = /* @__PURE__ */ b(null), E = () => {
5
- const t = p(u);
1
+ import { createContext as V, useContext as b, useState as e, useCallback as g, useEffect as w, useMemo as M } from "react";
2
+ import { useUnifiedShareModalContext as P } from "./unified-share-modal-context.js";
3
+ import { jsx as E } from "react/jsx-runtime";
4
+ const R = /* @__PURE__ */ V(null), q = () => {
5
+ const t = b(R);
6
6
  if (!t)
7
7
  throw new Error("useUnifiedShareFormContext must be used with UnifiedShareFormProvider");
8
8
  return t;
9
- }, q = ({
9
+ }, y = ({
10
10
  children: t
11
11
  }) => {
12
12
  const {
13
- initialContacts: d
14
- } = w(), [o, m] = e("default"), [n, f] = e(null), [s, h] = e(d), [r, C] = e(""), [i, x] = e(""), [a, S] = e(), [c, R] = e({}), l = v((F) => {
15
- R((V) => ({
16
- ...V,
17
- ...F
13
+ initialContacts: o,
14
+ isOpen: n
15
+ } = P(), [s, r] = e("default"), [i, U] = e(null), [a, c] = e(o), [l, u] = e(""), [d, f] = e(""), [m, h] = e(), [C, x] = e({}), S = g((p) => {
16
+ x((v) => ({
17
+ ...v,
18
+ ...p
18
19
  }));
19
- }, []), U = g(() => ({
20
- collaborationRole: a,
21
- contactValue: r,
22
- containerRef: n,
23
- form: o,
24
- messageValue: i,
25
- setCollaborationRole: S,
26
- setContactValue: C,
27
- setContainerRef: f,
28
- setForm: m,
29
- setMessageValue: x,
30
- setShieldRestriction: l,
31
- setUserContacts: h,
32
- shieldRestriction: c,
33
- userContacts: s
34
- }), [a, r, n, o, l, i, c, s]);
35
- return /* @__PURE__ */ M(u.Provider, {
36
- value: U,
20
+ }, []);
21
+ w(() => {
22
+ n || (r("default"), c(o), u(""), f(""), h(void 0), x({}));
23
+ }, [o, n]);
24
+ const F = M(() => ({
25
+ collaborationRole: m,
26
+ contactValue: l,
27
+ containerRef: i,
28
+ form: s,
29
+ messageValue: d,
30
+ setCollaborationRole: h,
31
+ setContactValue: u,
32
+ setContainerRef: U,
33
+ setForm: r,
34
+ setMessageValue: f,
35
+ setShieldRestriction: S,
36
+ setUserContacts: c,
37
+ shieldRestriction: C,
38
+ userContacts: a
39
+ }), [m, l, i, s, S, d, C, a]);
40
+ return /* @__PURE__ */ E(R.Provider, {
41
+ value: F,
37
42
  children: t
38
43
  });
39
44
  };
40
45
  export {
41
- u as UnifiedShareFormContext,
42
- q as UnifiedShareFormProvider,
43
- E as useUnifiedShareFormContext
46
+ R as UnifiedShareFormContext,
47
+ y as UnifiedShareFormProvider,
48
+ q as useUnifiedShareFormContext
44
49
  };
@@ -1,64 +1,68 @@
1
- import { createContext as I, useContext as T, useState as S, useMemo as V } from "react";
2
- import { DEFAULT_CONFIGURATION as j } from "../constants.js";
3
- import { jsx as A } from "react/jsx-runtime";
4
- const v = /* @__PURE__ */ I(null), L = () => {
5
- const e = T(v);
1
+ import { createContext as T, useContext as V, useState as v, useEffect as j, useMemo as A } from "react";
2
+ import { DEFAULT_CONFIGURATION as D } from "../constants.js";
3
+ import { jsx as F } from "react/jsx-runtime";
4
+ const E = /* @__PURE__ */ T(null), R = () => {
5
+ const e = V(E);
6
6
  if (!e)
7
7
  throw new Error("useUnifiedShareModalContext must be used with UnifiedShareModalContext.Provider");
8
8
  return e;
9
- }, N = ({
9
+ }, _ = ({
10
10
  children: e,
11
- collaborationAccess: o,
11
+ collaborationAccess: r,
12
12
  collaborationNotices: t,
13
- collaborationRoles: r,
14
- collaborators: n,
15
- config: d,
13
+ collaborationRoles: d,
14
+ collaborators: f,
15
+ config: n,
16
16
  contactService: u,
17
17
  currentUser: a,
18
- eventService: s,
19
- initialContacts: f,
20
- isFetching: i,
21
- isOpen: l,
18
+ eventService: i,
19
+ initialContacts: s,
20
+ isFetching: l,
21
+ isOpen: o,
22
22
  isSubmitting: x,
23
23
  item: m,
24
- onOpenChange: C,
25
- sharedLink: U,
26
- sharingService: h,
27
- variant: M
24
+ onOpenChange: h,
25
+ sharedLink: C,
26
+ sharingService: U,
27
+ variant: c
28
28
  }) => {
29
- const [c, P] = S(null), [w, p] = S("unified-share-form"), E = V(() => ({
30
- collaborationAccess: o,
29
+ const [M, P] = v(null), [w, S] = v("unified-share-form");
30
+ j(() => {
31
+ o || S("unified-share-form");
32
+ }, [o]);
33
+ const I = A(() => ({
34
+ collaborationAccess: r,
31
35
  collaborationNotices: t,
32
- collaborationRoles: r ?? [],
33
- collaborator: c,
34
- collaborators: n ?? [],
36
+ collaborationRoles: d ?? [],
37
+ collaborator: M,
38
+ collaborators: f ?? [],
35
39
  config: {
36
- ...j,
37
- ...d
40
+ ...D,
41
+ ...n
38
42
  },
39
43
  contactService: u ?? {},
40
44
  currentUser: a ?? {},
41
- eventService: s ?? {},
42
- initialContacts: f ?? [],
43
- isFetching: i,
44
- isOpen: l,
45
+ eventService: i ?? {},
46
+ initialContacts: s ?? [],
47
+ isFetching: l,
48
+ isOpen: o,
45
49
  isSubmitting: x,
46
50
  item: m,
47
- onOpenChange: C,
51
+ onOpenChange: h,
48
52
  setCollaborator: P,
49
- setView: p,
50
- sharedLink: U ?? {},
51
- sharingService: h ?? {},
52
- variant: M,
53
+ setView: S,
54
+ sharedLink: C ?? {},
55
+ sharingService: U ?? {},
56
+ variant: c,
53
57
  view: w
54
- }), [o, t, r, c, n, d, u, a, s, f, i, l, x, m, C, U, h, M, w]);
55
- return /* @__PURE__ */ A(v.Provider, {
56
- value: E,
58
+ }), [r, t, d, M, f, n, u, a, i, s, l, o, x, m, h, C, U, c, w]);
59
+ return /* @__PURE__ */ F(E.Provider, {
60
+ value: I,
57
61
  children: e
58
62
  });
59
63
  };
60
64
  export {
61
- v as UnifiedShareModalContext,
62
- N as UnifiedShareModalProvider,
63
- L as useUnifiedShareModalContext
65
+ E as UnifiedShareModalContext,
66
+ _ as UnifiedShareModalProvider,
67
+ R as useUnifiedShareModalContext
64
68
  };
@@ -1,57 +1,57 @@
1
- import { useState as o, useEffect as f, useCallback as C } from "react";
1
+ import { useState as m, useEffect as c, useCallback as D } from "react";
2
2
  import { UnifiedShareBase as E } from "./unified-share-base.js";
3
- import { jsx as m } from "react/jsx-runtime";
3
+ import { jsx as a } from "react/jsx-runtime";
4
4
  import { UnifiedShareModalProvider as F } from "./contexts/unified-share-modal-context.js";
5
5
  function A({
6
- children: t,
7
- collaborationAccess: d,
6
+ children: o,
7
+ collaborationAccess: l,
8
8
  collaborationNotices: n,
9
- collaborationRoles: c,
10
- collaborators: l,
11
- config: h,
12
- contactService: g,
13
- currentUser: u,
14
- eventService: U,
15
- initialContacts: S,
16
- isFetching: p,
17
- isOpen: i,
18
- isSubmitting: v,
19
- item: x,
20
- onLoad: e,
21
- onOpenChange: r,
22
- sharedLink: I,
23
- sharingService: M,
24
- variant: b = "modal"
9
+ collaborationRoles: u,
10
+ collaborators: h,
11
+ config: p,
12
+ contactService: U,
13
+ currentUser: S,
14
+ eventService: g,
15
+ initialContacts: k,
16
+ isFetching: x,
17
+ isOpen: e,
18
+ isSubmitting: I,
19
+ item: M,
20
+ onLoad: i,
21
+ onOpenChange: f,
22
+ sharedLink: b,
23
+ sharingService: j,
24
+ variant: s = "modal"
25
25
  }) {
26
- const j = !!t, [k, s] = o(i ?? !j), [w, y] = o(!!e);
27
- f(() => {
28
- i !== void 0 && s(i);
29
- }, [i]), f(() => {
30
- (async () => (e && await e(), y(!1)))();
31
- }, []);
32
- const B = C((a) => {
33
- i === void 0 && s(a), r && r(a);
34
- }, [i, r]);
35
- return /* @__PURE__ */ m(F, {
36
- collaborationAccess: d,
26
+ const w = !o || s === "desktop", [t, r] = m(e ?? w), [y, B] = m(!!i);
27
+ c(() => {
28
+ e !== void 0 && r(e);
29
+ }, [e]), c(() => {
30
+ (async () => i && (t && await i(), B(!t)))();
31
+ }, [t, i]);
32
+ const C = D((d) => {
33
+ e === void 0 && s !== "desktop" && r(d), f && f(d);
34
+ }, [e, f, s]);
35
+ return /* @__PURE__ */ a(F, {
36
+ collaborationAccess: l,
37
37
  collaborationNotices: n,
38
- collaborationRoles: c,
39
- collaborators: l,
40
- config: h,
41
- contactService: g,
42
- currentUser: u,
43
- eventService: U,
44
- initialContacts: S,
45
- isFetching: p ?? w,
46
- isOpen: k,
47
- isSubmitting: v,
48
- item: x,
49
- onOpenChange: B,
50
- sharedLink: I,
51
- sharingService: M,
52
- variant: b,
53
- children: /* @__PURE__ */ m(E, {
54
- children: t
38
+ collaborationRoles: u,
39
+ collaborators: h,
40
+ config: p,
41
+ contactService: U,
42
+ currentUser: S,
43
+ eventService: g,
44
+ initialContacts: k,
45
+ isFetching: x ?? y,
46
+ isOpen: t,
47
+ isSubmitting: I,
48
+ item: M,
49
+ onOpenChange: C,
50
+ sharedLink: b,
51
+ sharingService: j,
52
+ variant: s,
53
+ children: /* @__PURE__ */ a(E, {
54
+ children: o
55
55
  })
56
56
  });
57
57
  }