box-content-preview 3.103.0 → 3.104.0
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/README.md +7 -7
- package/dist/lib/index.js +44 -6
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
[](https://mergify.io)
|
|
3
3
|
[](https://github.com/prettier/prettier)
|
|
4
4
|
[](https://travis-ci.org/box/box-content-preview)
|
|
5
|
-
[](https://github.com/box/box-content-preview)
|
|
6
6
|
[](https://www.npmjs.com/package/box-ui-elements)
|
|
7
7
|
|
|
8
8
|
# [Box Content Preview](https://developer.box.com/docs/box-content-preview)
|
|
@@ -22,11 +22,11 @@ We encourage all users to update their applications to utilize modern browsers f
|
|
|
22
22
|
|
|
23
23
|
## Current Version
|
|
24
24
|
|
|
25
|
-
- Version: v3.
|
|
25
|
+
- Version: v3.104.0
|
|
26
26
|
- Locale: en-US
|
|
27
27
|
|
|
28
|
-
https://cdn01.boxcdn.net/platform/preview/3.
|
|
29
|
-
https://cdn01.boxcdn.net/platform/preview/3.
|
|
28
|
+
https://cdn01.boxcdn.net/platform/preview/3.104.0/en-US/preview.js
|
|
29
|
+
https://cdn01.boxcdn.net/platform/preview/3.104.0/en-US/preview.css
|
|
30
30
|
|
|
31
31
|
## Supported Locales
|
|
32
32
|
|
|
@@ -52,10 +52,10 @@ You can self-host the Box Content Preview library or reference the versions avai
|
|
|
52
52
|
<title>Box Content Preview Demo</title>
|
|
53
53
|
|
|
54
54
|
<!-- Latest version of Preview SDK for your locale -->
|
|
55
|
-
<script src="https://cdn01.boxcdn.net/platform/preview/3.
|
|
55
|
+
<script src="https://cdn01.boxcdn.net/platform/preview/3.104.0/en-US/preview.js"></script>
|
|
56
56
|
<link
|
|
57
57
|
rel="stylesheet"
|
|
58
|
-
href="https://cdn01.boxcdn.net/platform/preview/3.
|
|
58
|
+
href="https://cdn01.boxcdn.net/platform/preview/3.104.0/en-US/preview.css"
|
|
59
59
|
/>
|
|
60
60
|
</head>
|
|
61
61
|
<body>
|
|
@@ -76,7 +76,7 @@ To self-host the Box Content Preview library, follow these steps:
|
|
|
76
76
|
|
|
77
77
|
1. Either fork the repo and check out the version you want to host or download the specific version as a zip:
|
|
78
78
|
|
|
79
|
-
- Check out a specific version with `git checkout v3.
|
|
79
|
+
- Check out a specific version with `git checkout v3.104.0`
|
|
80
80
|
- Download a specific version as a zip from https://github.com/box/box-content-preview/releases
|
|
81
81
|
|
|
82
82
|
2. Install dependencies and build the library with `yarn install && yarn build:i18n && yarn build:prod`
|
package/dist/lib/index.js
CHANGED
|
@@ -1029,7 +1029,7 @@ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e =
|
|
|
1029
1029
|
const CLIENT_NAME = "box-content-preview"; // eslint-disable-line no-undef
|
|
1030
1030
|
const CLIENT_NAME_KEY = 'box_client_name';
|
|
1031
1031
|
const CLIENT_VERSION_KEY = 'box_client_version';
|
|
1032
|
-
const CLIENT_VERSION = "3.
|
|
1032
|
+
const CLIENT_VERSION = "3.104.0"; // eslint-disable-line no-undef
|
|
1033
1033
|
const HEADER_CLIENT_NAME = 'X-Box-Client-Name';
|
|
1034
1034
|
const HEADER_CLIENT_VERSION = 'X-Box-Client-Version';
|
|
1035
1035
|
const PROMISE_MAP = {};
|
|
@@ -3079,12 +3079,16 @@ function useAttention() {
|
|
|
3079
3079
|
setHovered(false);
|
|
3080
3080
|
};
|
|
3081
3081
|
const handleMouseOver = () => setHovered(true);
|
|
3082
|
+
const reset = external_react_.useCallback(() => {
|
|
3083
|
+
setFocused(false);
|
|
3084
|
+
setHovered(false);
|
|
3085
|
+
}, []);
|
|
3082
3086
|
return [isFocused || isHovered, {
|
|
3083
3087
|
onBlur: handleBlur,
|
|
3084
3088
|
onFocus: handleFocus,
|
|
3085
3089
|
onMouseOut: handleMouseOut,
|
|
3086
3090
|
onMouseOver: handleMouseOver
|
|
3087
|
-
}];
|
|
3091
|
+
}, reset];
|
|
3088
3092
|
}
|
|
3089
3093
|
;// ./src/lib/viewers/controls/media/VolumeControls.scss
|
|
3090
3094
|
// extracted by mini-css-extract-plugin
|
|
@@ -3316,14 +3320,17 @@ function VolumeControls({
|
|
|
3316
3320
|
onVolumeChange,
|
|
3317
3321
|
volume = 1
|
|
3318
3322
|
}) {
|
|
3319
|
-
const [isActive, handlers] = useAttention();
|
|
3323
|
+
const [isActive, handlers, resetAttention] = useAttention();
|
|
3324
|
+
const [isPinned, setPinned] = (0,external_react_.useState)(false);
|
|
3320
3325
|
const [isRevealed, setIsRevealed] = (0,external_react_.useState)(false);
|
|
3326
|
+
const wasFlyoutOpenOnPointerDownRef = (0,external_react_.useRef)(true); // first tap on the speaker pins the flyout instead of muting
|
|
3327
|
+
const volumeControlElRef = (0,external_react_.useRef)(null); // root; outside pointerdown unpins the flyout
|
|
3321
3328
|
const revealTimerRef = (0,external_react_.useRef)(0);
|
|
3322
3329
|
const isMuted = !volume;
|
|
3323
3330
|
const Icon = isMuted ? icons_IconVolumeMuted24 : getIcon(volume);
|
|
3324
3331
|
const title = isMuted ? "Unmute" : "Mute";
|
|
3325
3332
|
const value = Math.round(volume * 100);
|
|
3326
|
-
const isOpen = isActive || isRevealed;
|
|
3333
|
+
const isOpen = isActive || isRevealed || isPinned;
|
|
3327
3334
|
(0,external_react_.useEffect)(() => {
|
|
3328
3335
|
if (!keyboardVolumeStep) {
|
|
3329
3336
|
return;
|
|
@@ -3336,6 +3343,24 @@ function VolumeControls({
|
|
|
3336
3343
|
}, VOLUME_FLYOUT_DISMISS_MS);
|
|
3337
3344
|
}, [keyboardVolumeStep]);
|
|
3338
3345
|
(0,external_react_.useEffect)(() => () => window.clearTimeout(revealTimerRef.current), []);
|
|
3346
|
+
(0,external_react_.useEffect)(() => {
|
|
3347
|
+
if (!isPinned) {
|
|
3348
|
+
return undefined;
|
|
3349
|
+
}
|
|
3350
|
+
const closeIfOutside = event => {
|
|
3351
|
+
const volumeControlEl = volumeControlElRef.current;
|
|
3352
|
+
if (!volumeControlEl || volumeControlEl.contains(event.target)) {
|
|
3353
|
+
return;
|
|
3354
|
+
}
|
|
3355
|
+
setPinned(false);
|
|
3356
|
+
resetAttention();
|
|
3357
|
+
window.clearTimeout(revealTimerRef.current);
|
|
3358
|
+
revealTimerRef.current = 0;
|
|
3359
|
+
setIsRevealed(false);
|
|
3360
|
+
};
|
|
3361
|
+
document.addEventListener('pointerdown', closeIfOutside);
|
|
3362
|
+
return () => document.removeEventListener('pointerdown', closeIfOutside);
|
|
3363
|
+
}, [isPinned, resetAttention]);
|
|
3339
3364
|
const handleVolume = (0,external_react_.useCallback)(newValue => {
|
|
3340
3365
|
const newValueToUse = newValue <= 5 ? 0 : newValue;
|
|
3341
3366
|
// make sure the value is always between 0 and 1 since the value passed in could be
|
|
@@ -3343,7 +3368,18 @@ function VolumeControls({
|
|
|
3343
3368
|
const volumeToUse = Math.min(1, newValueToUse / 100);
|
|
3344
3369
|
onVolumeChange(volumeToUse);
|
|
3345
3370
|
}, [onVolumeChange]);
|
|
3371
|
+
const handleTogglePointerDown = (0,external_react_.useCallback)(() => {
|
|
3372
|
+
wasFlyoutOpenOnPointerDownRef.current = isActive || isRevealed || isPinned;
|
|
3373
|
+
}, [isActive, isPinned, isRevealed]);
|
|
3374
|
+
const handleToggleClick = (0,external_react_.useCallback)(() => {
|
|
3375
|
+
if (!wasFlyoutOpenOnPointerDownRef.current) {
|
|
3376
|
+
setPinned(true);
|
|
3377
|
+
return;
|
|
3378
|
+
}
|
|
3379
|
+
onMuteChange(!isMuted);
|
|
3380
|
+
}, [isMuted, onMuteChange]);
|
|
3346
3381
|
return /*#__PURE__*/external_react_["default"].createElement("div", {
|
|
3382
|
+
ref: volumeControlElRef,
|
|
3347
3383
|
className: "bp-VolumeControls",
|
|
3348
3384
|
"data-testid": "bp-volume-controls",
|
|
3349
3385
|
onBlur: event => {
|
|
@@ -3351,6 +3387,7 @@ function VolumeControls({
|
|
|
3351
3387
|
if (event.currentTarget.contains(event.relatedTarget)) {
|
|
3352
3388
|
return;
|
|
3353
3389
|
}
|
|
3390
|
+
setPinned(false);
|
|
3354
3391
|
window.clearTimeout(revealTimerRef.current);
|
|
3355
3392
|
revealTimerRef.current = 0;
|
|
3356
3393
|
setIsRevealed(false);
|
|
@@ -3361,7 +3398,8 @@ function VolumeControls({
|
|
|
3361
3398
|
}, /*#__PURE__*/external_react_["default"].createElement(MediaToggle/* default */.A, {
|
|
3362
3399
|
className: "bp-VolumeControls-toggle",
|
|
3363
3400
|
"data-resin-target": "volumeToggle",
|
|
3364
|
-
onClick:
|
|
3401
|
+
onClick: handleToggleClick,
|
|
3402
|
+
onPointerDown: handleTogglePointerDown,
|
|
3365
3403
|
title: title
|
|
3366
3404
|
}, /*#__PURE__*/external_react_["default"].createElement(Icon, null)), /*#__PURE__*/external_react_["default"].createElement("div", {
|
|
3367
3405
|
"aria-hidden": !isOpen,
|
|
@@ -25098,7 +25136,7 @@ class Browser {
|
|
|
25098
25136
|
;// ./src/lib/Logger.js
|
|
25099
25137
|
/* eslint-disable no-undef */
|
|
25100
25138
|
const CLIENT_NAME = "box-content-preview";
|
|
25101
|
-
const CLIENT_VERSION = "3.
|
|
25139
|
+
const CLIENT_VERSION = "3.104.0";
|
|
25102
25140
|
/* eslint-enable no-undef */
|
|
25103
25141
|
|
|
25104
25142
|
class Logger {
|