@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.
- package/dist/esm/lib/components/unified-share-form-modal/unified-share-form-modal.js +33 -31
- package/dist/esm/lib/contexts/unified-share-form-context.js +15 -14
- package/dist/esm/lib/unified-share-modal.js +40 -38
- package/dist/types/lib/contexts/unified-share-form-context.d.ts +2 -1
- package/dist/types/lib/contexts/unified-share-modal-context.d.ts +2 -0
- package/dist/types/lib/unified-share-modal.d.ts +3 -1
- package/package.json +9 -9
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { useState as g, useCallback as
|
|
3
|
-
import { useIntl as
|
|
4
|
-
import { Modal as o, Status as
|
|
5
|
-
import { Shield as
|
|
6
|
-
import { UnifiedShareForm as
|
|
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
|
|
10
|
-
import { useUnifiedShareModalContext as
|
|
11
|
-
import '../../../../styles/unified-share-form-modal.css';const
|
|
12
|
-
content:
|
|
13
|
-
header:
|
|
14
|
-
body:
|
|
15
|
-
hasFooter:
|
|
16
|
-
loading:
|
|
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
|
|
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
|
-
} =
|
|
27
|
-
|
|
26
|
+
} = U(), {
|
|
27
|
+
initialContacts: _,
|
|
28
|
+
isFetching: C,
|
|
28
29
|
item: F
|
|
29
|
-
} =
|
|
30
|
+
} = V(), {
|
|
30
31
|
classification: i,
|
|
31
32
|
name: S
|
|
32
|
-
} = F, [b,
|
|
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]),
|
|
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: [
|
|
41
|
+
children: [M && /* @__PURE__ */ e(o.Trigger, {
|
|
41
42
|
children: d
|
|
42
43
|
}), /* @__PURE__ */ n(o.Content, {
|
|
43
|
-
ref:
|
|
44
|
+
ref: x,
|
|
44
45
|
className: t.content,
|
|
45
|
-
onPointerDownOutside:
|
|
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(
|
|
52
|
+
}), i && /* @__PURE__ */ e(I, {
|
|
52
53
|
colorIndex: i.colorId + 1,
|
|
53
|
-
icon:
|
|
54
|
+
icon: v,
|
|
54
55
|
iconPosition: "left",
|
|
55
56
|
text: i.name.toUpperCase()
|
|
56
57
|
})]
|
|
57
58
|
}), /* @__PURE__ */ e(o.Body, {
|
|
58
|
-
className:
|
|
59
|
-
children: /* @__PURE__ */ n(
|
|
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: [
|
|
67
|
+
children: [C && /* @__PURE__ */ e("div", {
|
|
66
68
|
className: t.loading,
|
|
67
|
-
children: /* @__PURE__ */ e(
|
|
69
|
+
children: /* @__PURE__ */ e(P, {
|
|
68
70
|
"aria-label": r(l.loadingLabel),
|
|
69
71
|
size: "large"
|
|
70
72
|
})
|
|
71
|
-
}), /* @__PURE__ */ e(
|
|
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
|
-
|
|
82
|
+
W as UnifiedShareFormModal
|
|
81
83
|
};
|
|
@@ -1,19 +1,20 @@
|
|
|
1
|
-
import { createContext as
|
|
2
|
-
import { jsx as
|
|
3
|
-
const l = /* @__PURE__ */
|
|
4
|
-
const t =
|
|
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
|
-
},
|
|
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,
|
|
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:
|
|
25
|
-
setContactValue:
|
|
26
|
-
setMessageValue:
|
|
27
|
-
setUserContacts:
|
|
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__ */
|
|
32
|
-
value:
|
|
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
|
-
|
|
39
|
-
|
|
39
|
+
V as UnifiedShareFormProvider,
|
|
40
|
+
R as useUnifiedShareFormContext
|
|
40
41
|
};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { useState as i, useEffect as
|
|
2
|
-
import { DEFAULT_CONFIGURATION as
|
|
3
|
-
import { jsxs as
|
|
4
|
-
import { UnifiedShareModalContext as
|
|
5
|
-
import { UnifiedShareFormModal as
|
|
6
|
-
import { SharedLinkSettingsModal as
|
|
7
|
-
import { RemoveSharedLinkModal as
|
|
8
|
-
import { RemoveCollaboratorModal as
|
|
9
|
-
function
|
|
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
|
-
|
|
17
|
+
initialContacts: u,
|
|
18
|
+
isFetching: g,
|
|
18
19
|
isOpen: o,
|
|
19
|
-
isSubmitting:
|
|
20
|
-
item:
|
|
20
|
+
isSubmitting: C,
|
|
21
|
+
item: M,
|
|
21
22
|
onLoad: t,
|
|
22
|
-
onOpenChange:
|
|
23
|
-
sharedLink:
|
|
24
|
-
sharingService:
|
|
23
|
+
onOpenChange: O,
|
|
24
|
+
sharedLink: U,
|
|
25
|
+
sharingService: v
|
|
25
26
|
}) {
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
-
(async () => (t && await t(),
|
|
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
|
|
31
|
-
|
|
32
|
-
},
|
|
31
|
+
const F = (n) => {
|
|
32
|
+
S(o ?? n), O && O(n);
|
|
33
|
+
}, L = R(() => ({
|
|
33
34
|
collaborationRoles: f ?? [],
|
|
34
|
-
collaborator:
|
|
35
|
+
collaborator: b ?? {},
|
|
35
36
|
collaborators: l ?? [],
|
|
36
37
|
config: {
|
|
37
|
-
...
|
|
38
|
+
...T,
|
|
38
39
|
...d
|
|
39
40
|
},
|
|
40
41
|
contactService: h ?? {},
|
|
41
42
|
currentUser: p ?? {},
|
|
42
43
|
eventService: c ?? {},
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
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:
|
|
57
|
+
onOpenChange: F,
|
|
56
58
|
children: m
|
|
57
|
-
}), /* @__PURE__ */ s(
|
|
59
|
+
}), /* @__PURE__ */ s(N, {
|
|
58
60
|
isOpen: e && r === "shared-link-settings",
|
|
59
61
|
onOpenChange: () => a("unified-share-form")
|
|
60
|
-
}), /* @__PURE__ */ s(
|
|
62
|
+
}), /* @__PURE__ */ s(y, {
|
|
61
63
|
isOpen: e && r === "remove-shared-link",
|
|
62
64
|
onOpenChange: () => a("unified-share-form")
|
|
63
|
-
}), /* @__PURE__ */ s(
|
|
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
|
-
|
|
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.
|
|
3
|
+
"version": "1.28.1",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE",
|
|
5
5
|
"peerDependencies": {
|
|
6
|
-
"@box/blueprint-web": "^12.108.
|
|
7
|
-
"@box/blueprint-web-assets": "^4.89.
|
|
8
|
-
"@box/copy-input": "^1.20.
|
|
9
|
-
"@box/user-selector": "^1.52.
|
|
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.
|
|
17
|
-
"@box/blueprint-web-assets": "^4.89.
|
|
18
|
-
"@box/copy-input": "^1.20.
|
|
19
|
-
"@box/storybook-utils": "0.14.
|
|
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
|
},
|