@box/unified-share-modal 2.8.6 → 2.8.7
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/shared-link-settings-modal/expiration-section.js +19 -15
- package/dist/esm/lib/components/shared-link-settings-modal/shared-link-settings-modal.js +57 -55
- package/dist/esm/lib/components/shared-link-settings-modal/shared-link-settings.js +4 -4
- package/dist/esm/lib/components/unified-share-form-modal/shared-link-section/shared-link-section.js +50 -48
- package/dist/esm/lib/contexts/shared-link-settings-context.js +40 -38
- package/dist/styles/shared-link-settings-modal.css +1 -1
- package/dist/types/lib/contexts/shared-link-settings-context.d.ts +3 -1
- package/package.json +1 -1
|
@@ -1,41 +1,45 @@
|
|
|
1
|
-
import { useIntl as
|
|
2
|
-
import { Switch as x, DateI18nProvider as
|
|
1
|
+
import { useIntl as c } from "react-intl";
|
|
2
|
+
import { Switch as x, DateI18nProvider as b, DatePicker as d } from "@box/blueprint-web";
|
|
3
3
|
import a from "./messages.js";
|
|
4
|
-
import { jsxs as
|
|
5
|
-
import {
|
|
6
|
-
|
|
4
|
+
import { jsxs as k, Fragment as L, jsx as r } from "react/jsx-runtime";
|
|
5
|
+
import { useSharedLinkSettingsContext as u } from "../../contexts/shared-link-settings-context.js";
|
|
6
|
+
import { formatTomorrowDateToCalendarDate as f } from "../../utils/date.js";
|
|
7
|
+
function C({
|
|
7
8
|
canChange: i,
|
|
8
|
-
error:
|
|
9
|
+
error: o,
|
|
9
10
|
expiration: l,
|
|
10
11
|
isChecked: n,
|
|
11
|
-
isDisabled:
|
|
12
|
+
isDisabled: t,
|
|
12
13
|
onChange: p,
|
|
13
14
|
onToggle: m
|
|
14
15
|
}) {
|
|
15
16
|
const {
|
|
16
17
|
formatMessage: e
|
|
17
|
-
} =
|
|
18
|
-
|
|
18
|
+
} = c(), {
|
|
19
|
+
containerRef: s
|
|
20
|
+
} = u();
|
|
21
|
+
return /* @__PURE__ */ k(L, {
|
|
19
22
|
children: [/* @__PURE__ */ r(x.Item, {
|
|
20
23
|
checked: n,
|
|
21
|
-
disabled:
|
|
24
|
+
disabled: t || !i,
|
|
22
25
|
label: e(a.linkExpirationToggleText),
|
|
23
26
|
onCheckedChange: m,
|
|
24
27
|
value: "link-expiration-settings"
|
|
25
28
|
}), n && // Get the locale from the user's operating system settings
|
|
26
|
-
/* @__PURE__ */ r(
|
|
29
|
+
/* @__PURE__ */ r(b, {
|
|
27
30
|
locale: navigator.language || "en-US",
|
|
28
31
|
children: /* @__PURE__ */ r(d, {
|
|
29
32
|
calendarAriaLabel: e(a.linkExpirationCalendarAriaLabel),
|
|
30
33
|
clearDatePickerAriaLabel: e(a.linkExpirationClearDatePickerAriaLabel),
|
|
31
|
-
error:
|
|
34
|
+
error: o,
|
|
32
35
|
hideLabel: !0,
|
|
33
|
-
isDisabled:
|
|
36
|
+
isDisabled: t || !i,
|
|
34
37
|
label: e(a.linkExpirationDatePickerLabel),
|
|
35
|
-
minValue:
|
|
38
|
+
minValue: f(),
|
|
36
39
|
nextMonthAriaLabel: e(a.linkExpirationNextMonthAriaLabel),
|
|
37
40
|
onChange: p,
|
|
38
41
|
openCalendarDropdownAriaLabel: e(a.linkExpirationOpenCalendarDropdownAriaLabel),
|
|
42
|
+
portalElement: s,
|
|
39
43
|
previousMonthAriaLabel: e(a.linkExpirationPreviousMonthAriaLabel),
|
|
40
44
|
value: l
|
|
41
45
|
})
|
|
@@ -43,5 +47,5 @@ function f({
|
|
|
43
47
|
});
|
|
44
48
|
}
|
|
45
49
|
export {
|
|
46
|
-
|
|
50
|
+
C as ExpirationSection
|
|
47
51
|
};
|
|
@@ -1,90 +1,92 @@
|
|
|
1
1
|
import l from "clsx";
|
|
2
|
-
import { useState as
|
|
3
|
-
import { useIntl as
|
|
4
|
-
import { Modal as
|
|
5
|
-
import { SharedLinkSettings as
|
|
2
|
+
import { useState as C, useEffect as F } from "react";
|
|
3
|
+
import { useIntl as B } from "react-intl";
|
|
4
|
+
import { Modal as i, LoadingIndicator as N, Divider as x } from "@box/blueprint-web";
|
|
5
|
+
import { SharedLinkSettings as D } from "./shared-link-settings.js";
|
|
6
6
|
import n from "./messages.js";
|
|
7
|
-
import { jsx as
|
|
8
|
-
import { ClassificationStatus as
|
|
9
|
-
import { useUnifiedShareModalContext as
|
|
10
|
-
import { useSharedLinkSettingsContext as
|
|
11
|
-
import '../../../../styles/shared-link-settings-modal.css';const
|
|
12
|
-
content:
|
|
13
|
-
isFullscreen:
|
|
14
|
-
body:
|
|
15
|
-
title:
|
|
16
|
-
form:
|
|
17
|
-
isLoading:
|
|
18
|
-
loading:
|
|
7
|
+
import { jsx as e, jsxs as s } from "react/jsx-runtime";
|
|
8
|
+
import { ClassificationStatus as M } from "../classification-status/classification-status.js";
|
|
9
|
+
import { useUnifiedShareModalContext as w } from "../../contexts/unified-share-modal-context.js";
|
|
10
|
+
import { useSharedLinkSettingsContext as I } from "../../contexts/shared-link-settings-context.js";
|
|
11
|
+
import '../../../../styles/shared-link-settings-modal.css';const P = "_content_54561_1", j = "_isFullscreen_54561_4", z = "_body_54561_13", A = "_title_54561_23", E = "_form_54561_43", H = "_isLoading_54561_50", R = "_loading_54561_54", U = "_divider_54561_62", t = {
|
|
12
|
+
content: P,
|
|
13
|
+
isFullscreen: j,
|
|
14
|
+
body: z,
|
|
15
|
+
title: A,
|
|
16
|
+
form: E,
|
|
17
|
+
isLoading: H,
|
|
18
|
+
loading: R,
|
|
19
19
|
divider: U
|
|
20
20
|
};
|
|
21
|
-
function
|
|
21
|
+
function Z({
|
|
22
22
|
isOpen: a,
|
|
23
|
-
onOpenChange:
|
|
23
|
+
onOpenChange: f
|
|
24
24
|
}) {
|
|
25
25
|
const {
|
|
26
26
|
formatMessage: o
|
|
27
|
-
} =
|
|
27
|
+
} = B(), {
|
|
28
28
|
eventService: h,
|
|
29
29
|
isSubmitting: r,
|
|
30
30
|
variant: S
|
|
31
|
-
} =
|
|
32
|
-
onSharedLinkSettingsClose:
|
|
31
|
+
} = w(), {
|
|
32
|
+
onSharedLinkSettingsClose: u,
|
|
33
33
|
onSharedLinkSettingsLoad: d
|
|
34
34
|
} = h, c = S === "desktop", {
|
|
35
|
-
resetForm:
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
35
|
+
resetForm: g,
|
|
36
|
+
setContainerRef: L,
|
|
37
|
+
submitForm: b
|
|
38
|
+
} = I(), [m, p] = C(!!d);
|
|
39
|
+
F(() => {
|
|
40
|
+
(async () => d && (a && await d(), p(!a)))();
|
|
40
41
|
}, [a, d]);
|
|
41
42
|
const _ = () => {
|
|
42
|
-
r || (
|
|
43
|
-
},
|
|
44
|
-
await
|
|
45
|
-
},
|
|
46
|
-
|
|
43
|
+
r || (g(), u && u(), f(!1));
|
|
44
|
+
}, v = async () => {
|
|
45
|
+
await b() || (g(), f(!1));
|
|
46
|
+
}, y = (k) => {
|
|
47
|
+
k.preventDefault();
|
|
47
48
|
};
|
|
48
|
-
return /* @__PURE__ */ i
|
|
49
|
+
return /* @__PURE__ */ e(i, {
|
|
49
50
|
onOpenChange: _,
|
|
50
51
|
open: a,
|
|
51
|
-
children: /* @__PURE__ */ s(
|
|
52
|
-
|
|
53
|
-
|
|
52
|
+
children: /* @__PURE__ */ s(i.Content, {
|
|
53
|
+
ref: L,
|
|
54
|
+
className: l(t.content, c && t.isFullscreen),
|
|
55
|
+
onPointerDownOutside: y,
|
|
54
56
|
size: "medium",
|
|
55
|
-
children: [/* @__PURE__ */ s(
|
|
56
|
-
children: [/* @__PURE__ */
|
|
57
|
-
className:
|
|
57
|
+
children: [/* @__PURE__ */ s(i.Header, {
|
|
58
|
+
children: [/* @__PURE__ */ e("div", {
|
|
59
|
+
className: t.title,
|
|
58
60
|
children: o(n.title)
|
|
59
|
-
}), /* @__PURE__ */
|
|
61
|
+
}), /* @__PURE__ */ e(M, {})]
|
|
60
62
|
}), /* @__PURE__ */ s("div", {
|
|
61
|
-
className: l(
|
|
62
|
-
children: [m && /* @__PURE__ */
|
|
63
|
-
className:
|
|
64
|
-
children: /* @__PURE__ */
|
|
63
|
+
className: l(t.form),
|
|
64
|
+
children: [m && /* @__PURE__ */ e("div", {
|
|
65
|
+
className: t.loading,
|
|
66
|
+
children: /* @__PURE__ */ e(N, {
|
|
65
67
|
"aria-label": o(n.loadingLabel),
|
|
66
68
|
size: "large"
|
|
67
69
|
})
|
|
68
|
-
}), /* @__PURE__ */ s(
|
|
69
|
-
className: l(
|
|
70
|
-
children: [c && /* @__PURE__ */
|
|
71
|
-
className:
|
|
72
|
-
}), /* @__PURE__ */
|
|
73
|
-
}), /* @__PURE__ */ s(
|
|
74
|
-
className: l(m &&
|
|
75
|
-
children: [/* @__PURE__ */ i
|
|
70
|
+
}), /* @__PURE__ */ s(i.Body, {
|
|
71
|
+
className: l(t.body, m && t.isLoading),
|
|
72
|
+
children: [c && /* @__PURE__ */ e(x, {
|
|
73
|
+
className: t.divider
|
|
74
|
+
}), /* @__PURE__ */ e(D, {})]
|
|
75
|
+
}), /* @__PURE__ */ s(i.Footer, {
|
|
76
|
+
className: l(m && t.isLoading),
|
|
77
|
+
children: [/* @__PURE__ */ e(i.Footer.SecondaryButton, {
|
|
76
78
|
disabled: r,
|
|
77
79
|
onClick: _,
|
|
78
80
|
children: o(n.cancelButton)
|
|
79
|
-
}), /* @__PURE__ */ i
|
|
81
|
+
}), /* @__PURE__ */ e(i.Footer.PrimaryButton, {
|
|
80
82
|
id: "usm-SharedLinkSettingsModal-primaryButton",
|
|
81
83
|
loading: r,
|
|
82
84
|
loadingAriaLabel: o(n.loadingLabel),
|
|
83
|
-
onClick:
|
|
85
|
+
onClick: v,
|
|
84
86
|
children: o(n.saveButton)
|
|
85
87
|
})]
|
|
86
88
|
})]
|
|
87
|
-
}), !c && /* @__PURE__ */ i
|
|
89
|
+
}), !c && /* @__PURE__ */ e(i.Close, {
|
|
88
90
|
"aria-label": o(n.closeButton),
|
|
89
91
|
disabled: r
|
|
90
92
|
})]
|
|
@@ -92,5 +94,5 @@ function Y({
|
|
|
92
94
|
});
|
|
93
95
|
}
|
|
94
96
|
export {
|
|
95
|
-
|
|
97
|
+
Z as SharedLinkSettingsModal
|
|
96
98
|
};
|
|
@@ -8,15 +8,15 @@ import { VanitySection as _ } from "./vanity-section.js";
|
|
|
8
8
|
import n from "./messages.js";
|
|
9
9
|
import { jsxs as q, Fragment as z, jsx as s } from "react/jsx-runtime";
|
|
10
10
|
import { useAccessLevels as G } from "../../hooks/use-access-levels.js";
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
11
|
+
import { useUnifiedShareModalContext as H } from "../../contexts/unified-share-modal-context.js";
|
|
12
|
+
import { useSharedLinkSettingsContext as J } from "../../contexts/shared-link-settings-context.js";
|
|
13
13
|
function se() {
|
|
14
14
|
const {
|
|
15
15
|
formatMessage: t
|
|
16
16
|
} = F(), {
|
|
17
17
|
isSubmitting: r,
|
|
18
18
|
sharedLink: b
|
|
19
|
-
} =
|
|
19
|
+
} = H(), {
|
|
20
20
|
settings: w = {},
|
|
21
21
|
vanityDomain: v = ""
|
|
22
22
|
} = b, {
|
|
@@ -36,7 +36,7 @@ function se() {
|
|
|
36
36
|
setFieldError: i,
|
|
37
37
|
setFieldValue: o,
|
|
38
38
|
validatePassword: E
|
|
39
|
-
} =
|
|
39
|
+
} = J(), u = V(() => {
|
|
40
40
|
if (!l)
|
|
41
41
|
return null;
|
|
42
42
|
switch (l.id) {
|
package/dist/esm/lib/components/unified-share-form-modal/shared-link-section/shared-link-section.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { useRef as G, useCallback as
|
|
1
|
+
import { useRef as G, useCallback as P, useEffect as V } from "react";
|
|
2
2
|
import { useIntl as q } from "react-intl";
|
|
3
|
-
import { useNotification as H, Text as
|
|
3
|
+
import { useNotification as H, Text as C, Tooltip as v, Focusable as J, Switch as Q, Status as W, Link as X, Button as Y } from "@box/blueprint-web";
|
|
4
4
|
import { ClockBadge as Z } from "@box/blueprint-web-assets/icons/Line";
|
|
5
|
-
import { Mail as $, Globe as
|
|
5
|
+
import { Mail as $, Globe as B } from "@box/blueprint-web-assets/icons/Medium";
|
|
6
6
|
import { SurfaceStatusSurfaceRed as ee, bpSize040 as g } from "@box/blueprint-web-assets/tokens/tokens";
|
|
7
7
|
import { CopyInput as te } from "@box/copy-input";
|
|
8
8
|
import { SharedLinkAccess as ie } from "./shared-link-access.js";
|
|
@@ -27,72 +27,74 @@ function Ie() {
|
|
|
27
27
|
const {
|
|
28
28
|
formatMessage: e
|
|
29
29
|
} = q(), {
|
|
30
|
-
addNotification:
|
|
30
|
+
addNotification: x
|
|
31
31
|
} = H(), k = G(null), {
|
|
32
32
|
isInteracted: f,
|
|
33
33
|
isSharedLinkAutoCopied: L,
|
|
34
34
|
isSharedLinkAutoCreated: r,
|
|
35
|
-
setForm:
|
|
35
|
+
setForm: F
|
|
36
36
|
} = ne(), {
|
|
37
37
|
config: s,
|
|
38
|
-
eventService:
|
|
39
|
-
isFetching:
|
|
38
|
+
eventService: M,
|
|
39
|
+
isFetching: T,
|
|
40
40
|
isSubmitting: n,
|
|
41
|
-
item:
|
|
42
|
-
setView:
|
|
41
|
+
item: O,
|
|
42
|
+
setView: _,
|
|
43
43
|
sharedLink: o,
|
|
44
|
-
sharingService:
|
|
44
|
+
sharingService: R
|
|
45
45
|
} = oe(), {
|
|
46
|
-
permissions:
|
|
47
|
-
} = M, {
|
|
48
|
-
onSharedLinkCopy: S,
|
|
49
|
-
onSharedLinkSettingsClick: A
|
|
50
|
-
} = F, {
|
|
51
|
-
createSharedLink: N
|
|
46
|
+
permissions: A = {}
|
|
52
47
|
} = O, {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
48
|
+
onSharedLinkCopy: S,
|
|
49
|
+
onSharedLinkSettingsClick: N
|
|
50
|
+
} = M, {
|
|
51
|
+
createSharedLink: E
|
|
52
|
+
} = R, {
|
|
53
|
+
notifications: D,
|
|
54
|
+
sharedLinkAutoCopy: b,
|
|
55
|
+
sharedLinkAutoCreate: j
|
|
56
|
+
} = s, a = !!o.url, h = b && !L.current && !f, w = j && !r.current && !f, U = P(async () => {
|
|
57
|
+
const l = await E();
|
|
58
58
|
return h ? {
|
|
59
59
|
messages: []
|
|
60
60
|
} : l;
|
|
61
|
-
}, [h,
|
|
62
|
-
onAction:
|
|
61
|
+
}, [h, E]), {
|
|
62
|
+
onAction: y
|
|
63
63
|
} = re(U, "create-shared-link");
|
|
64
64
|
V(() => {
|
|
65
|
-
(async () =>
|
|
66
|
-
}, [a, h,
|
|
67
|
-
const z =
|
|
65
|
+
(async () => T || n || ((h || w) && !a && (await y(), r.current = !0), h && a && k.current && (k.current.click(), L.current = !0)))();
|
|
66
|
+
}, [a, h, w, T, L, r, n, y]);
|
|
67
|
+
const z = P((l) => {
|
|
68
|
+
if (S && S(l), !b || !D.includes("auto-copy-shared-link"))
|
|
69
|
+
return;
|
|
68
70
|
let p;
|
|
69
|
-
typeof l != "string" ? p = r.current ? e(t.autoCreateCopyErrorNoticeText) : null : p = r.current ? e(t.autoCreateCopySuccessNoticeText) : e(t.autoCopySuccessNoticeText), p &&
|
|
71
|
+
typeof l != "string" ? p = r.current ? e(t.autoCreateCopyErrorNoticeText) : null : p = r.current ? e(t.autoCreateCopySuccessNoticeText) : e(t.autoCopySuccessNoticeText), p && x({
|
|
70
72
|
...se(e, "success"),
|
|
71
73
|
styledText: p
|
|
72
|
-
})
|
|
73
|
-
}, [
|
|
74
|
+
});
|
|
75
|
+
}, [x, e, r, D, S, b]), K = async (l) => {
|
|
74
76
|
if (l) {
|
|
75
|
-
await
|
|
77
|
+
await y();
|
|
76
78
|
return;
|
|
77
79
|
}
|
|
78
|
-
|
|
79
|
-
},
|
|
80
|
-
if (
|
|
81
|
-
|
|
80
|
+
_("remove-shared-link");
|
|
81
|
+
}, I = () => {
|
|
82
|
+
if (N) {
|
|
83
|
+
N();
|
|
82
84
|
return;
|
|
83
85
|
}
|
|
84
|
-
|
|
86
|
+
_("shared-link-settings");
|
|
85
87
|
};
|
|
86
88
|
let u, m = !1;
|
|
87
|
-
return !a && !n && (u = e(t.sharedLinkToggleTooltip)), !a && !
|
|
89
|
+
return !a && !n && (u = e(t.sharedLinkToggleTooltip)), !a && !A.canShare && (u = e(t.createLinkDisabledTooltip), m = !0), a && !A.canSetShareAccess && (u = e(t.removeLinkDisabledTooltip), m = !0), /* @__PURE__ */ d("div", {
|
|
88
90
|
className: c.container,
|
|
89
|
-
children: [/* @__PURE__ */ i(
|
|
91
|
+
children: [/* @__PURE__ */ i(C, {
|
|
90
92
|
as: "label",
|
|
91
93
|
variant: "bodyDefaultBold",
|
|
92
94
|
children: e(t.shareLinkLabel)
|
|
93
95
|
}), /* @__PURE__ */ d("div", {
|
|
94
96
|
className: c.toggle,
|
|
95
|
-
children: [/* @__PURE__ */ i(
|
|
97
|
+
children: [/* @__PURE__ */ i(v, {
|
|
96
98
|
align: "start",
|
|
97
99
|
content: u,
|
|
98
100
|
"data-testid": "shared-link-tooltip",
|
|
@@ -108,7 +110,7 @@ function Ie() {
|
|
|
108
110
|
value: "shared-link"
|
|
109
111
|
})
|
|
110
112
|
})
|
|
111
|
-
}), a && !!o.expiresAt && /* @__PURE__ */ i(
|
|
113
|
+
}), a && !!o.expiresAt && /* @__PURE__ */ i(v, {
|
|
112
114
|
content: e(t.expirationIconTooltip, {
|
|
113
115
|
expirationDate: ce(o.expiresAt)
|
|
114
116
|
}),
|
|
@@ -124,8 +126,8 @@ function Ie() {
|
|
|
124
126
|
"aria-haspopup": "dialog",
|
|
125
127
|
className: c.settings,
|
|
126
128
|
"data-target-id": "PlainButton-SharedLinkSettings",
|
|
127
|
-
onClick:
|
|
128
|
-
onKeyDown: le(
|
|
129
|
+
onClick: I,
|
|
130
|
+
onKeyDown: le(I, {
|
|
129
131
|
canPreventDefault: !0
|
|
130
132
|
}),
|
|
131
133
|
role: "button",
|
|
@@ -137,14 +139,14 @@ function Ie() {
|
|
|
137
139
|
className: c.copy,
|
|
138
140
|
children: [/* @__PURE__ */ i(te, {
|
|
139
141
|
ref: k,
|
|
140
|
-
autoFocus:
|
|
142
|
+
autoFocus: j && r.current && !f,
|
|
141
143
|
"data-target-id": "Button-CopySharedLink",
|
|
142
144
|
disabled: n,
|
|
143
145
|
hideLabel: !0,
|
|
144
146
|
label: e(t.sharedLinkUrlLabel),
|
|
145
147
|
onCopy: z,
|
|
146
148
|
value: o.url
|
|
147
|
-
}), s.sharedLinkEmail && /* @__PURE__ */ i(
|
|
149
|
+
}), s.sharedLinkEmail && /* @__PURE__ */ i(v, {
|
|
148
150
|
align: "end",
|
|
149
151
|
content: e(t.sharedLinkEmailLabel),
|
|
150
152
|
children: /* @__PURE__ */ i(Y, {
|
|
@@ -152,7 +154,7 @@ function Ie() {
|
|
|
152
154
|
"data-target-id": "Button-SendSharedLink",
|
|
153
155
|
disabled: n,
|
|
154
156
|
icon: $,
|
|
155
|
-
onClick: () =>
|
|
157
|
+
onClick: () => F("email"),
|
|
156
158
|
size: "large",
|
|
157
159
|
variant: "secondary"
|
|
158
160
|
})
|
|
@@ -161,21 +163,21 @@ function Ie() {
|
|
|
161
163
|
className: c.access,
|
|
162
164
|
children: [s.sharedLinkAccess && /* @__PURE__ */ i(ie, {}), s.sharedLinkPermission && /* @__PURE__ */ i(ae, {})]
|
|
163
165
|
}), a && o.access === "open" && /* @__PURE__ */ d("div", {
|
|
164
|
-
children: [/* @__PURE__ */ i(
|
|
166
|
+
children: [/* @__PURE__ */ i(B, {
|
|
165
167
|
className: c.icon,
|
|
166
168
|
height: g,
|
|
167
169
|
width: g
|
|
168
|
-
}), /* @__PURE__ */ i(
|
|
170
|
+
}), /* @__PURE__ */ i(C, {
|
|
169
171
|
as: "span",
|
|
170
172
|
color: "textOnLightSecondary",
|
|
171
173
|
children: o.permission === "can_edit" ? e(t.sharedLinkEditablePubliclyAvailable) : e(t.sharedLinkPubliclyAvailable)
|
|
172
174
|
})]
|
|
173
175
|
}), a && o.access === "company" && o.permission === "can_edit" && /* @__PURE__ */ d("div", {
|
|
174
|
-
children: [/* @__PURE__ */ i(
|
|
176
|
+
children: [/* @__PURE__ */ i(B, {
|
|
175
177
|
className: c.icon,
|
|
176
178
|
height: g,
|
|
177
179
|
width: g
|
|
178
|
-
}), /* @__PURE__ */ i(
|
|
180
|
+
}), /* @__PURE__ */ i(C, {
|
|
179
181
|
as: "span",
|
|
180
182
|
color: "textOnLightSecondary",
|
|
181
183
|
children: e(t.sharedLinkElevatedEditableCompanyAvailable)
|
|
@@ -1,58 +1,60 @@
|
|
|
1
|
-
import { createContext as
|
|
2
|
-
import { useUnifiedShareModalContext as
|
|
3
|
-
import { jsx as
|
|
4
|
-
import { formatDateFromTimestampToCalendarDate as
|
|
5
|
-
import { useLinkSettingsForm as
|
|
6
|
-
const
|
|
7
|
-
const e =
|
|
1
|
+
import { createContext as E, useContext as F, useState as C, useMemo as x } from "react";
|
|
2
|
+
import { useUnifiedShareModalContext as g } from "./unified-share-modal-context.js";
|
|
3
|
+
import { jsx as k } from "react/jsx-runtime";
|
|
4
|
+
import { formatDateFromTimestampToCalendarDate as L } from "../utils/date.js";
|
|
5
|
+
import { useLinkSettingsForm as v } from "../hooks/use-link-settings-form.js";
|
|
6
|
+
const f = /* @__PURE__ */ E(null), M = () => {
|
|
7
|
+
const e = F(f);
|
|
8
8
|
if (!e)
|
|
9
9
|
throw new Error("useSharedLinkSettingsContext must be used with SharedLinkSettingsProvider");
|
|
10
10
|
return e;
|
|
11
|
-
},
|
|
11
|
+
}, N = ({
|
|
12
12
|
children: e
|
|
13
13
|
}) => {
|
|
14
14
|
const {
|
|
15
15
|
sharedLink: h
|
|
16
|
-
} =
|
|
16
|
+
} = g(), {
|
|
17
17
|
expiresAt: t = 0,
|
|
18
18
|
settings: p = {},
|
|
19
|
-
vanityName:
|
|
19
|
+
vanityName: n = ""
|
|
20
20
|
} = h, {
|
|
21
|
-
isDownloadEnabled:
|
|
21
|
+
isDownloadEnabled: r,
|
|
22
22
|
isPasswordEnabled: s
|
|
23
|
-
} = p, o = x(() => ({
|
|
24
|
-
expiration: t ?
|
|
25
|
-
isDownloadEnabled: !!
|
|
23
|
+
} = p, [i, b] = C(null), o = x(() => ({
|
|
24
|
+
expiration: t ? L(t) : null,
|
|
25
|
+
isDownloadEnabled: !!r,
|
|
26
26
|
isExpirationEnabled: !!t,
|
|
27
27
|
isPasswordEnabled: !!s,
|
|
28
|
-
isVanityNameEnabled: !!
|
|
28
|
+
isVanityNameEnabled: !!n,
|
|
29
29
|
password: "",
|
|
30
|
-
vanityName:
|
|
31
|
-
}), [t,
|
|
32
|
-
errors:
|
|
33
|
-
formData:
|
|
34
|
-
handleFormReset:
|
|
35
|
-
handleFormSubmit:
|
|
36
|
-
setFieldError:
|
|
37
|
-
setFieldValue:
|
|
38
|
-
validatePassword:
|
|
39
|
-
} =
|
|
40
|
-
|
|
41
|
-
|
|
30
|
+
vanityName: n
|
|
31
|
+
}), [t, r, s, n]), {
|
|
32
|
+
errors: a,
|
|
33
|
+
formData: d,
|
|
34
|
+
handleFormReset: m,
|
|
35
|
+
handleFormSubmit: l,
|
|
36
|
+
setFieldError: u,
|
|
37
|
+
setFieldValue: c,
|
|
38
|
+
validatePassword: S
|
|
39
|
+
} = v(o), w = x(() => ({
|
|
40
|
+
containerRef: i,
|
|
41
|
+
errors: a,
|
|
42
|
+
formData: d,
|
|
42
43
|
initialFormData: o,
|
|
43
|
-
resetForm:
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
44
|
+
resetForm: m,
|
|
45
|
+
setContainerRef: b,
|
|
46
|
+
setFieldError: u,
|
|
47
|
+
setFieldValue: c,
|
|
48
|
+
submitForm: l,
|
|
49
|
+
validatePassword: S
|
|
50
|
+
}), [i, a, d, m, l, o, u, c, S]);
|
|
51
|
+
return /* @__PURE__ */ k(f.Provider, {
|
|
52
|
+
value: w,
|
|
51
53
|
children: e
|
|
52
54
|
});
|
|
53
55
|
};
|
|
54
56
|
export {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
57
|
+
f as SharedLinkSettingsContext,
|
|
58
|
+
N as SharedLinkSettingsProvider,
|
|
59
|
+
M as useSharedLinkSettingsContext
|
|
58
60
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.
|
|
1
|
+
._content_54561_1._content_54561_1{max-width:480px}._content_54561_1._content_54561_1._isFullscreen_54561_4{width:100vw;max-width:none;height:100vh;max-height:none;margin:0;border-radius:0;animation:none}._content_54561_1._content_54561_1._isFullscreen_54561_4 ._body_54561_13{overflow:hidden auto}._content_54561_1._content_54561_1 [data-radix-popper-content-wrapper]:has([data-side=top]){margin-top:max(332px - var(--radix-popper-available-height),0px)}._content_54561_1._content_54561_1 [data-radix-popper-content-wrapper]:has([data-side=bottom]){margin-top:min((332px - var(--radix-popper-available-height)) * -1,0px)}._title_54561_23{display:inline}._title_54561_23:after{display:inline-block;width:var(--bp-space-020);content:""}._body_54561_13._body_54561_13{display:flex;flex-direction:column;flex-grow:1;gap:var(--bp-space-040);margin-bottom:calc(var(--bp-space-010) * -1);padding-top:0;padding-bottom:var(--bp-space-010);overflow:auto}._form_54561_43{position:relative;display:flex;flex-direction:column;flex-grow:1;overflow:hidden}._form_54561_43 ._isLoading_54561_50{visibility:hidden}._loading_54561_54{position:absolute;inset:0;display:flex;align-items:center;padding-bottom:var(--bp-space-080)}._divider_54561_62._divider_54561_62{position:sticky;top:0;z-index:1;width:100%}
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
import { ReactNode } from 'react';
|
|
1
|
+
import { Dispatch, ReactNode, SetStateAction } from 'react';
|
|
2
2
|
import { FormErrors } from '../hooks/use-form-validation';
|
|
3
3
|
import { LinkSettingsFormData } from '../types';
|
|
4
4
|
export interface SharedLinkSettingsContextValue {
|
|
5
|
+
containerRef: HTMLDivElement | null;
|
|
5
6
|
errors: FormErrors;
|
|
6
7
|
formData: LinkSettingsFormData;
|
|
7
8
|
initialFormData: LinkSettingsFormData;
|
|
8
9
|
resetForm: () => void;
|
|
10
|
+
setContainerRef: Dispatch<SetStateAction<HTMLDivElement | null>>;
|
|
9
11
|
setFieldError: (field: any, error: any) => void;
|
|
10
12
|
setFieldValue: (field: any, value: any) => void;
|
|
11
13
|
submitForm: () => Promise<boolean>;
|