@box/unified-share-modal 1.14.0 → 1.14.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.
|
@@ -7,7 +7,7 @@ import { useAccessLevels as X } from "../../hooks/use-access-levels.js";
|
|
|
7
7
|
import { formatDateFromTimestampToCalendarDate as Y, formatTomorrowDateToCalendarDate as Z } from "../../utils/date.js";
|
|
8
8
|
import { useLinkSettingsForm as aa } from "../../hooks/use-link-settings-form.js";
|
|
9
9
|
import { useUnifiedShareModalContext as ea } from "../../contexts/unified-share-modal-context.js";
|
|
10
|
-
import '../../../../styles/shared-link-settings-modal.css';const na = "
|
|
10
|
+
import '../../../../styles/shared-link-settings-modal.css';const na = "_content_149ez_1", ia = "_body_149ez_5", S = {
|
|
11
11
|
content: na,
|
|
12
12
|
body: ia
|
|
13
13
|
}, oa = "••••••••";
|
|
@@ -58,15 +58,15 @@ function ba({
|
|
|
58
58
|
l("expiration", void 0), s("expiration", o);
|
|
59
59
|
}, U = (o) => {
|
|
60
60
|
l("vanityName", void 0), s("isVanityNameEnabled", o);
|
|
61
|
-
},
|
|
61
|
+
}, z = (o) => {
|
|
62
62
|
l("vanityName", void 0), s("vanityName", o.target.value);
|
|
63
|
-
},
|
|
63
|
+
}, R = (o) => {
|
|
64
64
|
l("password", void 0), s("isPasswordEnabled", o);
|
|
65
|
-
},
|
|
65
|
+
}, W = (o) => {
|
|
66
66
|
l("password", void 0), s("password", o.target.value);
|
|
67
|
-
},
|
|
67
|
+
}, j = (o) => {
|
|
68
68
|
s("isDownloadEnabled", o);
|
|
69
|
-
},
|
|
69
|
+
}, $ = (o) => {
|
|
70
70
|
var C;
|
|
71
71
|
const H = (C = document.getElementById("usm-SharedLinkSettingsModal-primaryButton")) == null ? void 0 : C.contains(o.relatedTarget);
|
|
72
72
|
b.isPasswordEnabled && !t.password || H || B(t.password);
|
|
@@ -119,7 +119,7 @@ function ba({
|
|
|
119
119
|
checked: t.isPasswordEnabled,
|
|
120
120
|
disabled: !i.canChangePassword,
|
|
121
121
|
label: a(e.passwordToggleText),
|
|
122
|
-
onCheckedChange:
|
|
122
|
+
onCheckedChange: R,
|
|
123
123
|
value: "password-settings"
|
|
124
124
|
}), t.isPasswordEnabled && /* @__PURE__ */ d(L, {
|
|
125
125
|
children: [i.canChangePassword && /* @__PURE__ */ n(E, {
|
|
@@ -131,8 +131,8 @@ function ba({
|
|
|
131
131
|
error: p.password,
|
|
132
132
|
hideLabel: !0,
|
|
133
133
|
label: a(e.passwordToggleText),
|
|
134
|
-
onBlur:
|
|
135
|
-
onChange:
|
|
134
|
+
onBlur: $,
|
|
135
|
+
onChange: W,
|
|
136
136
|
onFocus: () => l("password", void 0),
|
|
137
137
|
placeholder: b.isPasswordEnabled ? oa : a(e.passwordInputPlaceholder),
|
|
138
138
|
type: "password",
|
|
@@ -154,7 +154,7 @@ function ba({
|
|
|
154
154
|
error: p.vanityName,
|
|
155
155
|
hideLabel: !0,
|
|
156
156
|
label: a(e.vanityNameInputLabel),
|
|
157
|
-
onChange:
|
|
157
|
+
onChange: z,
|
|
158
158
|
placeholder: a(e.vanityNameInputPlaceholder),
|
|
159
159
|
value: t.vanityName
|
|
160
160
|
}), i.canChangeVanityName && /* @__PURE__ */ n(y, {
|
|
@@ -165,7 +165,7 @@ function ba({
|
|
|
165
165
|
checked: t.isDownloadEnabled,
|
|
166
166
|
disabled: !i.canChangeDownload,
|
|
167
167
|
label: a(e.downloadSettingsToggleText),
|
|
168
|
-
onCheckedChange:
|
|
168
|
+
onCheckedChange: j,
|
|
169
169
|
value: "download-link-settings"
|
|
170
170
|
})]
|
|
171
171
|
}), /* @__PURE__ */ d(r.Footer, {
|
package/dist/esm/lib/components/unified-share-form-modal/shared-link-section/shared-link-section.js
CHANGED
|
@@ -1,18 +1,19 @@
|
|
|
1
|
-
import { useRef as b, useState as j, useCallback as x, useEffect as
|
|
1
|
+
import { useRef as b, useState as j, useCallback as x, useEffect as I } from "react";
|
|
2
2
|
import { useIntl as K } from "react-intl";
|
|
3
3
|
import { Text as V, Tooltip as T, Focusable as O, Switch as G, Status as H, Link as J, Button as Q } from "@box/blueprint-web";
|
|
4
|
-
import { ClockBadge as W
|
|
4
|
+
import { ClockBadge as W } from "@box/blueprint-web-assets/icons/Line";
|
|
5
|
+
import { Mail as X } from "@box/blueprint-web-assets/icons/Medium";
|
|
5
6
|
import { SurfaceStatusSurfaceRed as Y } from "@box/blueprint-web-assets/tokens/tokens";
|
|
6
7
|
import { CopyInput as Z } from "@box/copy-input";
|
|
7
8
|
import { SharedLinkAccess as $ } from "./shared-link-access.js";
|
|
8
9
|
import { SharedLinkPermission as ee } from "./shared-link-permission.js";
|
|
9
10
|
import t from "./messages.js";
|
|
10
|
-
import { jsxs as g, jsx as
|
|
11
|
+
import { jsxs as g, jsx as o } from "react/jsx-runtime";
|
|
11
12
|
import { useUnifiedShareFormContext as te } from "../../../contexts/unified-share-form-context.js";
|
|
12
13
|
import { useUnifiedShareModalContext as ie } from "../../../contexts/unified-share-modal-context.js";
|
|
13
|
-
import { useSharingAction as
|
|
14
|
-
import { formatDateFromTimestampToDateString as
|
|
15
|
-
import { callOnKeyboardEvent as
|
|
14
|
+
import { useSharingAction as N } from "../../../hooks/use-sharing-action.js";
|
|
15
|
+
import { formatDateFromTimestampToDateString as oe } from "../../../utils/date.js";
|
|
16
|
+
import { callOnKeyboardEvent as ne } from "../../../utils/event.js";
|
|
16
17
|
import '../../../../../styles/shared-link-section.css';const ae = "_container_q90iz_1", se = "_toggle_q90iz_7", re = "_settings_q90iz_13", ce = "_copy_q90iz_22", le = "_access_q90iz_30", d = {
|
|
17
18
|
container: ae,
|
|
18
19
|
toggle: se,
|
|
@@ -20,47 +21,47 @@ import '../../../../../styles/shared-link-section.css';const ae = "_container_q9
|
|
|
20
21
|
copy: ce,
|
|
21
22
|
access: le
|
|
22
23
|
};
|
|
23
|
-
function
|
|
24
|
+
function Ae() {
|
|
24
25
|
const {
|
|
25
26
|
formatMessage: e
|
|
26
27
|
} = K(), k = b(!0), L = b(null), u = b(null), {
|
|
27
28
|
onModalViewChange: h,
|
|
28
|
-
onShareViewChange:
|
|
29
|
+
onShareViewChange: P
|
|
29
30
|
} = te(), {
|
|
30
|
-
config:
|
|
31
|
+
config: n,
|
|
31
32
|
isFetching: v,
|
|
32
|
-
isSubmitting:
|
|
33
|
-
item:
|
|
33
|
+
isSubmitting: w,
|
|
34
|
+
item: E,
|
|
34
35
|
sharedLink: m,
|
|
35
36
|
sharingService: F
|
|
36
37
|
} = ie(), {
|
|
37
38
|
permissions: A = {}
|
|
38
|
-
} =
|
|
39
|
+
} = E, {
|
|
39
40
|
createSharedLink: z
|
|
40
41
|
} = F, {
|
|
41
42
|
sharedLinkAutoCopy: r,
|
|
42
43
|
sharedLinkAutoCreate: C
|
|
43
|
-
} =
|
|
44
|
+
} = n;
|
|
44
45
|
let _ = "create-shared-link";
|
|
45
46
|
r && (_ = "auto-copy-shared-link");
|
|
46
47
|
const {
|
|
47
48
|
isLoading: q,
|
|
48
49
|
onAction: y
|
|
49
|
-
} =
|
|
50
|
+
} = N(z, _), i = !!m.url, a = w ?? q, [S, R] = j(!1), p = x(async () => {
|
|
50
51
|
i || (await y(), R(!0));
|
|
51
|
-
}, [i, y]),
|
|
52
|
+
}, [i, y]), M = x(async () => (p(), new Promise((s) => {
|
|
52
53
|
u.current = {
|
|
53
54
|
resolve: s
|
|
54
55
|
};
|
|
55
56
|
})), [p]), {
|
|
56
57
|
onAction: D
|
|
57
|
-
} =
|
|
58
|
-
|
|
58
|
+
} = N(M, "auto-copy-shared-link");
|
|
59
|
+
I(() => {
|
|
59
60
|
!k.current || v || (r ? D() : C && p(), k.current = !1);
|
|
60
|
-
}, [v, k, r, C, p, D]),
|
|
61
|
+
}, [v, k, r, C, p, D]), I(() => {
|
|
61
62
|
i && r && L.current && L.current.click();
|
|
62
63
|
}, [i, r]);
|
|
63
|
-
const
|
|
64
|
+
const B = x((l) => {
|
|
64
65
|
if (!u.current)
|
|
65
66
|
return;
|
|
66
67
|
let s;
|
|
@@ -76,20 +77,20 @@ function ve() {
|
|
|
76
77
|
let c, f = !1;
|
|
77
78
|
return !i && !a && (c = e(t.sharedLinkToggleTooltip)), !i && !A.canShare && (c = e(t.createLinkDisabledTooltip), f = !0), i && !A.canSetShareAccess && (c = e(t.removeLinkDisabledTooltip), f = !0), /* @__PURE__ */ g("div", {
|
|
78
79
|
className: d.container,
|
|
79
|
-
children: [/* @__PURE__ */
|
|
80
|
+
children: [/* @__PURE__ */ o(V, {
|
|
80
81
|
as: "label",
|
|
81
82
|
variant: "bodyDefaultBold",
|
|
82
83
|
children: e(t.shareLinkLabel)
|
|
83
84
|
}), /* @__PURE__ */ g("div", {
|
|
84
85
|
className: d.toggle,
|
|
85
|
-
children: [/* @__PURE__ */
|
|
86
|
+
children: [/* @__PURE__ */ o(T, {
|
|
86
87
|
align: "start",
|
|
87
88
|
content: c,
|
|
88
89
|
"data-testid": "shared-link-tooltip",
|
|
89
90
|
open: c ? void 0 : !1,
|
|
90
|
-
children: /* @__PURE__ */
|
|
91
|
+
children: /* @__PURE__ */ o(O, {
|
|
91
92
|
focusable: f,
|
|
92
|
-
children: /* @__PURE__ */
|
|
93
|
+
children: /* @__PURE__ */ o(G.Item, {
|
|
93
94
|
checked: i,
|
|
94
95
|
disabled: f || a,
|
|
95
96
|
label: e(t.sharedLinkToggleLabel),
|
|
@@ -97,23 +98,23 @@ function ve() {
|
|
|
97
98
|
value: "shared-link"
|
|
98
99
|
})
|
|
99
100
|
})
|
|
100
|
-
}), i && !!m.expiresAt && /* @__PURE__ */
|
|
101
|
+
}), i && !!m.expiresAt && /* @__PURE__ */ o(T, {
|
|
101
102
|
content: e(t.expirationIconTooltip, {
|
|
102
|
-
expirationDate:
|
|
103
|
+
expirationDate: oe(m.expiresAt)
|
|
103
104
|
}),
|
|
104
105
|
"data-testid": "expiration-date-tooltip",
|
|
105
|
-
children: /* @__PURE__ */
|
|
106
|
+
children: /* @__PURE__ */ o(H, {
|
|
106
107
|
color: Y,
|
|
107
108
|
hideText: !0,
|
|
108
109
|
icon: W,
|
|
109
110
|
text: e(t.expirationIconLabel)
|
|
110
111
|
})
|
|
111
|
-
}), i &&
|
|
112
|
+
}), i && n.sharedLinkSettings && /* @__PURE__ */ o(J, {
|
|
112
113
|
"aria-disabled": a,
|
|
113
114
|
"aria-haspopup": "dialog",
|
|
114
115
|
className: d.settings,
|
|
115
116
|
onClick: () => h("shared-link-settings"),
|
|
116
|
-
onKeyDown:
|
|
117
|
+
onKeyDown: ne(() => h("shared-link-settings"), {
|
|
117
118
|
canPreventDefault: !0
|
|
118
119
|
}),
|
|
119
120
|
role: "button",
|
|
@@ -123,32 +124,32 @@ function ve() {
|
|
|
123
124
|
})]
|
|
124
125
|
}), i && /* @__PURE__ */ g("div", {
|
|
125
126
|
className: d.copy,
|
|
126
|
-
children: [/* @__PURE__ */
|
|
127
|
+
children: [/* @__PURE__ */ o(Z, {
|
|
127
128
|
ref: L,
|
|
128
129
|
autoFocus: C && i,
|
|
129
130
|
disabled: a,
|
|
130
131
|
hideLabel: !0,
|
|
131
132
|
label: e(t.sharedLinkUrlLabel),
|
|
132
|
-
onCopy:
|
|
133
|
+
onCopy: B,
|
|
133
134
|
value: m.url
|
|
134
|
-
}),
|
|
135
|
+
}), n.sharedLinkEmail && /* @__PURE__ */ o(T, {
|
|
135
136
|
align: "end",
|
|
136
137
|
content: e(t.sharedLinkEmailLabel),
|
|
137
|
-
children: /* @__PURE__ */
|
|
138
|
+
children: /* @__PURE__ */ o(Q, {
|
|
138
139
|
"aria-label": e(t.sharedLinkEmailLabel),
|
|
139
140
|
disabled: a,
|
|
140
141
|
icon: X,
|
|
141
|
-
onClick: () =>
|
|
142
|
+
onClick: () => P("email"),
|
|
142
143
|
size: "large",
|
|
143
144
|
variant: "secondary"
|
|
144
145
|
})
|
|
145
146
|
})]
|
|
146
|
-
}), i && (
|
|
147
|
+
}), i && (n.sharedLinkAccess || n.sharedLinkPermission) && /* @__PURE__ */ g("div", {
|
|
147
148
|
className: d.access,
|
|
148
|
-
children: [
|
|
149
|
+
children: [n.sharedLinkAccess && /* @__PURE__ */ o($, {}), n.sharedLinkPermission && /* @__PURE__ */ o(ee, {})]
|
|
149
150
|
})]
|
|
150
151
|
});
|
|
151
152
|
}
|
|
152
153
|
export {
|
|
153
|
-
|
|
154
|
+
Ae as SharedLinkSection
|
|
154
155
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.
|
|
1
|
+
._content_149ez_1._content_149ez_1{max-width:480px}._body_149ez_5._body_149ez_5{display:flex;flex-direction:column;gap:var(--space-4);padding-top:0;padding-bottom:0;overflow:auto}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@box/unified-share-modal",
|
|
3
|
-
"version": "1.14.
|
|
3
|
+
"version": "1.14.1",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE",
|
|
5
5
|
"peerDependencies": {
|
|
6
6
|
"@box/blueprint-web": "^9.18.13",
|
|
@@ -13,9 +13,9 @@
|
|
|
13
13
|
"react-intl": "^6.4.2"
|
|
14
14
|
},
|
|
15
15
|
"devDependencies": {
|
|
16
|
-
"@box/blueprint-web": "^12.99.
|
|
16
|
+
"@box/blueprint-web": "^12.99.1",
|
|
17
17
|
"@box/blueprint-web-assets": "^4.82.0",
|
|
18
|
-
"@box/copy-input": "^1.13.
|
|
18
|
+
"@box/copy-input": "^1.13.1",
|
|
19
19
|
"@box/storybook-utils": "0.14.19",
|
|
20
20
|
"@box/eslint-plugin-blueprint": "1.0.5",
|
|
21
21
|
"react-intl": "^6.4.2"
|