Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@uppy/provider-views

Package Overview
Dependencies
Maintainers
5
Versions
109
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@uppy/provider-views - npm Package Compare versions

Comparing version 1.3.0 to 1.4.0

10

lib/Breadcrumbs.js
var _require = require('preact'),
h = _require.h;
h = _require.h; // TODO use Fragment when upgrading to preact X
/* eslint-disable react/jsx-key */
var Breadcrumb = function Breadcrumb(props) {

@@ -11,3 +14,5 @@ return [h("button", {

};
/* eslint-enable react/jsx-key */
module.exports = function (props) {

@@ -19,3 +24,4 @@ return h("div", {

}, props.breadcrumbsIcon), props.directories.map(function (directory, i) {
return Breadcrumb({
return h(Breadcrumb, {
key: directory.id,
getFolder: function getFolder() {

@@ -22,0 +28,0 @@ return props.getFolder(directory.id);

78

lib/index.js

@@ -74,3 +74,4 @@ var _class, _temp;

/**
* @param {object} instance of the plugin
* @param {object} plugin instance of the plugin
* @param {object} opts
*/

@@ -106,2 +107,3 @@ function ProviderView(plugin, opts) {

this.handleScroll = this.handleScroll.bind(this);
this.listAllFiles = this.listAllFiles.bind(this);
this.donePicking = this.donePicking.bind(this);

@@ -254,4 +256,13 @@ this.cancelPicking = this.cancelPicking.bind(this);

this.provider.logout(location.href).then(function (res) {
this.provider.logout().then(function (res) {
if (res.ok) {
if (!res.revoked) {
var message = _this2.plugin.uppy.i18n('companionUnauthorizeHint', {
provider: _this2.plugin.title,
url: res.manual_revoke_url
});
_this2.plugin.uppy.info(message, 'info', 7000);
}
var newState = {

@@ -422,15 +433,11 @@ authenticated: false,

});
return this.provider.list(folder.requestPath).then(function (res) {
var files = [];
res.items.forEach(function (item) {
if (!item.isFolder) {
_this3.addFile(item);
files.push(_this3.providerFileToId(item));
}
return this.listAllFiles(folder.requestPath).then(function (files) {
files.forEach(function (file) {
_this3.addFile(file);
});
var ids = files.map(_this3.providerFileToId);
state = _this3.plugin.getPluginState();
state.selectedFolders[folderId] = {
loading: false,
files: files
files: ids
};

@@ -622,5 +629,37 @@

_proto2.donePicking = function donePicking() {
_proto2.listAllFiles = function listAllFiles(path, files) {
var _this6 = this;
if (files === void 0) {
files = null;
}
files = files || [];
return new Promise(function (resolve, reject) {
_this6.provider.list(path).then(function (res) {
res.items.forEach(function (item) {
if (!item.isFolder) {
files.push(item);
}
});
var moreFiles = res.nextPagePath || null;
if (moreFiles) {
return _this6.listAllFiles(moreFiles, files).then(function (files) {
return resolve(files);
}).catch(function (e) {
return reject(e);
});
} else {
return resolve(files);
}
}).catch(function (e) {
return reject(e);
});
});
};
_proto2.donePicking = function donePicking() {
var _this7 = this;
var _this$plugin$getPlugi5 = this.plugin.getPluginState(),

@@ -631,5 +670,5 @@ currentSelection = _this$plugin$getPlugi5.currentSelection;

if (file.isFolder) {
return _this6.addFolder(file);
return _this7.addFolder(file);
} else {
return _this6.addFile(file);
return _this7.addFile(file);
}

@@ -639,3 +678,3 @@ });

this._loaderWrapper(Promise.all(promises), function () {
_this6.clearSelection();
_this7.clearSelection();
}, function () {});

@@ -658,6 +697,6 @@ };

_proto2._loaderWrapper = function _loaderWrapper(promise, then, catch_) {
var _this7 = this;
var _this8 = this;
promise.then(function (result) {
_this7.plugin.setPluginState({
_this8.plugin.setPluginState({
loading: false

@@ -668,3 +707,3 @@ });

}).catch(function (err) {
_this7.plugin.setPluginState({
_this8.plugin.setPluginState({
loading: false

@@ -725,2 +764,3 @@ });

handleScroll: this.handleScroll,
listAllFiles: this.listAllFiles,
done: this.donePicking,

@@ -743,2 +783,2 @@ cancel: this.cancelPicking,

return ProviderView;
}(), _class.VERSION = "1.3.0", _temp);
}(), _class.VERSION = "1.4.0", _temp);
var _require = require('preact'),
h = _require.h;
function FileIcon() {
return h("svg", {
"aria-hidden": "true",
focusable: "false",
class: "UppyIcon",
width: 11,
height: 14.5,
viewBox: "0 0 44 58"
}, h("path", {
d: "M27.437.517a1 1 0 0 0-.094.03H4.25C2.037.548.217 2.368.217 4.58v48.405c0 2.212 1.82 4.03 4.03 4.03H39.03c2.21 0 4.03-1.818 4.03-4.03V15.61a1 1 0 0 0-.03-.28 1 1 0 0 0 0-.093 1 1 0 0 0-.03-.032 1 1 0 0 0 0-.03 1 1 0 0 0-.032-.063 1 1 0 0 0-.03-.063 1 1 0 0 0-.032 0 1 1 0 0 0-.03-.063 1 1 0 0 0-.032-.03 1 1 0 0 0-.03-.063 1 1 0 0 0-.063-.062l-14.593-14a1 1 0 0 0-.062-.062A1 1 0 0 0 28 .708a1 1 0 0 0-.374-.157 1 1 0 0 0-.156 0 1 1 0 0 0-.03-.03l-.003-.003zM4.25 2.547h22.218v9.97c0 2.21 1.82 4.03 4.03 4.03h10.564v36.438a2.02 2.02 0 0 1-2.032 2.032H4.25c-1.13 0-2.032-.9-2.032-2.032V4.58c0-1.13.902-2.032 2.03-2.032zm24.218 1.345l10.375 9.937.75.718H30.5c-1.13 0-2.032-.9-2.032-2.03V3.89z"
}));
}
function FolderIcon() {
return h("svg", {
"aria-hidden": "true",
focusable: "false",
class: "UppyIcon",
style: {
width: 16,
marginRight: 3
},
viewBox: "0 0 276.157 276.157"
}, h("path", {
d: "M273.08 101.378c-3.3-4.65-8.86-7.32-15.254-7.32h-24.34V67.59c0-10.2-8.3-18.5-18.5-18.5h-85.322c-3.63 0-9.295-2.875-11.436-5.805l-6.386-8.735c-4.982-6.814-15.104-11.954-23.546-11.954H58.73c-9.292 0-18.638 6.608-21.737 15.372l-2.033 5.752c-.958 2.71-4.72 5.37-7.596 5.37H18.5C8.3 49.09 0 57.39 0 67.59v167.07c0 .886.16 1.73.443 2.52.152 3.306 1.18 6.424 3.053 9.064 3.3 4.652 8.86 7.32 15.255 7.32h188.487c11.395 0 23.27-8.425 27.035-19.18l40.677-116.188c2.11-6.035 1.43-12.164-1.87-16.816zM18.5 64.088h8.864c9.295 0 18.64-6.607 21.738-15.37l2.032-5.75c.96-2.712 4.722-5.373 7.597-5.373h29.565c3.63 0 9.295 2.876 11.437 5.806l6.386 8.735c4.982 6.815 15.104 11.954 23.546 11.954h85.322c1.898 0 3.5 1.602 3.5 3.5v26.47H69.34c-11.395 0-23.27 8.423-27.035 19.178L15 191.23V67.59c0-1.898 1.603-3.5 3.5-3.5zm242.29 49.15l-40.676 116.188c-1.674 4.78-7.812 9.135-12.877 9.135H18.75c-1.447 0-2.576-.372-3.02-.997-.442-.625-.422-1.814.057-3.18l40.677-116.19c1.674-4.78 7.812-9.134 12.877-9.134h188.487c1.448 0 2.577.372 3.02.997.443.625.423 1.814-.056 3.18z"
}));
}
function VideoIcon() {
return h("svg", {
"aria-hidden": "true",
focusable: "false",
viewBox: "0 0 58 58"
}, h("path", {
d: "M36.537 28.156l-11-7a1.005 1.005 0 0 0-1.02-.033C24.2 21.3 24 21.635 24 22v14a1 1 0 0 0 1.537.844l11-7a1.002 1.002 0 0 0 0-1.688zM26 34.18V23.82L34.137 29 26 34.18z"
}), h("path", {
d: "M57 6H1a1 1 0 0 0-1 1v44a1 1 0 0 0 1 1h56a1 1 0 0 0 1-1V7a1 1 0 0 0-1-1zM10 28H2v-9h8v9zm-8 2h8v9H2v-9zm10 10V8h34v42H12V40zm44-12h-8v-9h8v9zm-8 2h8v9h-8v-9zm8-22v9h-8V8h8zM2 8h8v9H2V8zm0 42v-9h8v9H2zm54 0h-8v-9h8v9z"
}));
}
module.exports = function (props) {

@@ -9,37 +49,9 @@ if (props.itemIconString === null) return;

case 'file':
return h("svg", {
"aria-hidden": "true",
focusable: "false",
class: "UppyIcon",
width: 11,
height: 14.5,
viewBox: "0 0 44 58"
}, h("path", {
d: "M27.437.517a1 1 0 0 0-.094.03H4.25C2.037.548.217 2.368.217 4.58v48.405c0 2.212 1.82 4.03 4.03 4.03H39.03c2.21 0 4.03-1.818 4.03-4.03V15.61a1 1 0 0 0-.03-.28 1 1 0 0 0 0-.093 1 1 0 0 0-.03-.032 1 1 0 0 0 0-.03 1 1 0 0 0-.032-.063 1 1 0 0 0-.03-.063 1 1 0 0 0-.032 0 1 1 0 0 0-.03-.063 1 1 0 0 0-.032-.03 1 1 0 0 0-.03-.063 1 1 0 0 0-.063-.062l-14.593-14a1 1 0 0 0-.062-.062A1 1 0 0 0 28 .708a1 1 0 0 0-.374-.157 1 1 0 0 0-.156 0 1 1 0 0 0-.03-.03l-.003-.003zM4.25 2.547h22.218v9.97c0 2.21 1.82 4.03 4.03 4.03h10.564v36.438a2.02 2.02 0 0 1-2.032 2.032H4.25c-1.13 0-2.032-.9-2.032-2.032V4.58c0-1.13.902-2.032 2.03-2.032zm24.218 1.345l10.375 9.937.75.718H30.5c-1.13 0-2.032-.9-2.032-2.03V3.89z"
}));
return h(FileIcon, null);
case 'folder':
return h("svg", {
"aria-hidden": "true",
focusable: "false",
class: "UppyIcon",
style: {
width: 16,
marginRight: 3
},
viewBox: "0 0 276.157 276.157"
}, h("path", {
d: "M273.08 101.378c-3.3-4.65-8.86-7.32-15.254-7.32h-24.34V67.59c0-10.2-8.3-18.5-18.5-18.5h-85.322c-3.63 0-9.295-2.875-11.436-5.805l-6.386-8.735c-4.982-6.814-15.104-11.954-23.546-11.954H58.73c-9.292 0-18.638 6.608-21.737 15.372l-2.033 5.752c-.958 2.71-4.72 5.37-7.596 5.37H18.5C8.3 49.09 0 57.39 0 67.59v167.07c0 .886.16 1.73.443 2.52.152 3.306 1.18 6.424 3.053 9.064 3.3 4.652 8.86 7.32 15.255 7.32h188.487c11.395 0 23.27-8.425 27.035-19.18l40.677-116.188c2.11-6.035 1.43-12.164-1.87-16.816zM18.5 64.088h8.864c9.295 0 18.64-6.607 21.738-15.37l2.032-5.75c.96-2.712 4.722-5.373 7.597-5.373h29.565c3.63 0 9.295 2.876 11.437 5.806l6.386 8.735c4.982 6.815 15.104 11.954 23.546 11.954h85.322c1.898 0 3.5 1.602 3.5 3.5v26.47H69.34c-11.395 0-23.27 8.423-27.035 19.178L15 191.23V67.59c0-1.898 1.603-3.5 3.5-3.5zm242.29 49.15l-40.676 116.188c-1.674 4.78-7.812 9.135-12.877 9.135H18.75c-1.447 0-2.576-.372-3.02-.997-.442-.625-.422-1.814.057-3.18l40.677-116.19c1.674-4.78 7.812-9.134 12.877-9.134h188.487c1.448 0 2.577.372 3.02.997.443.625.423 1.814-.056 3.18z"
}));
return h(FolderIcon, null);
case 'video':
return h("svg", {
"aria-hidden": "true",
focusable: "false",
viewBox: "0 0 58 58"
}, h("path", {
d: "M36.537 28.156l-11-7a1.005 1.005 0 0 0-1.02-.033C24.2 21.3 24 21.635 24 22v14a1 1 0 0 0 1.537.844l11-7a1.002 1.002 0 0 0 0-1.688zM26 34.18V23.82L34.137 29 26 34.18z"
}), h("path", {
d: "M57 6H1a1 1 0 0 0-1 1v44a1 1 0 0 0 1 1h56a1 1 0 0 0 1-1V7a1 1 0 0 0-1-1zM10 28H2v-9h8v9zm-8 2h8v9H2v-9zm10 10V8h34v42H12V40zm44-12h-8v-9h8v9zm-8 2h8v9h-8v-9zm8-22v9h-8V8h8zM2 8h8v9H2V8zm0 42v-9h8v9H2zm54 0h-8v-9h8v9z"
}));
return h(VideoIcon, null);

@@ -46,0 +58,0 @@ default:

@@ -48,8 +48,8 @@ var _require = require('preact'),

"data-uppy-super-focusable": true
}), props.type === 'file' // label for a checkbox
? h("label", {
}), props.type === 'file' ? // label for a checkbox
h("label", {
for: props.id,
className: "uppy-u-reset uppy-ProviderBrowserItem-inner"
}, props.itemIconEl, props.showTitles && props.title) // button to open a folder
: h("button", {
}, props.itemIconEl, props.showTitles && props.title) : // button to open a folder
h("button", {
type: "button",

@@ -56,0 +56,0 @@ class: "uppy-u-reset uppy-ProviderBrowserItem-inner",

{
"name": "@uppy/provider-views",
"description": "View library for Uppy remote provider plugins.",
"version": "1.3.0",
"version": "1.4.0",
"license": "MIT",

@@ -22,3 +22,3 @@ "main": "lib/index.js",

"dependencies": {
"@uppy/utils": "^1.3.0",
"@uppy/utils": "^2.0.0",
"classnames": "^2.2.6",

@@ -30,3 +30,3 @@ "preact": "8.2.9"

},
"gitHead": "056a7114a15fc7480a4014342d7f2c19305dc96c"
"gitHead": "4e32e61d7c7821ca5d8641a3df741487ea27f0bb"
}

@@ -8,16 +8,18 @@ const { h, Component } = require('preact')

)
return <div class="uppy-Provider-auth">
<div class="uppy-Provider-authIcon">{this.props.pluginIcon()}</div>
<div class="uppy-Provider-authTitle">
{this.props.i18nArray('authenticateWithTitle', { pluginName: pluginNameComponent })}
return (
<div class="uppy-Provider-auth">
<div class="uppy-Provider-authIcon">{this.props.pluginIcon()}</div>
<div class="uppy-Provider-authTitle">
{this.props.i18nArray('authenticateWithTitle', { pluginName: pluginNameComponent })}
</div>
<button
type="button"
class="uppy-u-reset uppy-c-btn uppy-c-btn-primary uppy-Provider-authBtn"
onclick={this.props.handleAuth}
data-uppy-super-focusable
>
{this.props.i18nArray('authenticateWith', { pluginName: this.props.pluginName })}
</button>
</div>
<button
type="button"
class="uppy-u-reset uppy-c-btn uppy-c-btn-primary uppy-Provider-authBtn"
onclick={this.props.handleAuth}
data-uppy-super-focusable
>
{this.props.i18nArray('authenticateWith', { pluginName: this.props.pluginName })}
</button>
</div>
)
}

@@ -24,0 +26,0 @@ }

const { h } = require('preact')
// TODO use Fragment when upgrading to preact X
/* eslint-disable react/jsx-key */
const Breadcrumb = (props) => [

@@ -7,6 +9,9 @@ <button

class="uppy-u-reset"
onclick={props.getFolder}>{props.title}
onclick={props.getFolder}
>
{props.title}
</button>,
!props.isLast ? ' / ' : ''
]
/* eslint-enable react/jsx-key */

@@ -18,9 +23,10 @@ module.exports = (props) => {

{
props.directories.map((directory, i) => {
return Breadcrumb({
getFolder: () => props.getFolder(directory.id),
title: i === 0 ? props.title : directory.title,
isLast: i + 1 === props.directories.length
})
})
props.directories.map((directory, i) => (
<Breadcrumb
key={directory.id}
getFolder={() => props.getFolder(directory.id)}
title={i === 0 ? props.title : directory.title}
isLast={i + 1 === props.directories.length}
/>
))
}

@@ -27,0 +33,0 @@ </div>

@@ -35,3 +35,3 @@ const classNames = require('classnames')

</div>
{ props.showFilter && <Filter {...props} /> }
{props.showFilter && <Filter {...props} />}
<ItemList

@@ -38,0 +38,0 @@ columns={[{

@@ -17,30 +17,34 @@ const { h, Component } = require('preact')

render () {
return <div class="uppy-ProviderBrowser-search">
<input
class="uppy-u-reset uppy-ProviderBrowser-searchInput"
type="text"
placeholder={this.props.i18n('filter')}
aria-label={this.props.i18n('filter')}
onkeyup={this.preventEnterPress}
onkeydown={this.preventEnterPress}
onkeypress={this.preventEnterPress}
oninput={(e) => this.props.filterQuery(e)}
value={this.props.filterInput} />
<svg aria-hidden="true" focusable="false" class="UppyIcon uppy-ProviderBrowser-searchIcon" width="12" height="12" viewBox="0 0 12 12">
<path d="M8.638 7.99l3.172 3.172a.492.492 0 1 1-.697.697L7.91 8.656a4.977 4.977 0 0 1-2.983.983C2.206 9.639 0 7.481 0 4.819 0 2.158 2.206 0 4.927 0c2.721 0 4.927 2.158 4.927 4.82a4.74 4.74 0 0 1-1.216 3.17zm-3.71.685c2.176 0 3.94-1.726 3.94-3.856 0-2.129-1.764-3.855-3.94-3.855C2.75.964.984 2.69.984 4.819c0 2.13 1.765 3.856 3.942 3.856z" />
</svg>
{ this.props.filterInput &&
<button
class="uppy-u-reset uppy-ProviderBrowser-searchClose"
type="button"
aria-label={this.props.i18n('resetFilter')}
title={this.props.i18n('resetFilter')}
onclick={this.props.filterQuery}>
<svg aria-hidden="true" focusable="false" class="UppyIcon" viewBox="0 0 19 19">
<path d="M17.318 17.232L9.94 9.854 9.586 9.5l-.354.354-7.378 7.378h.707l-.62-.62v.706L9.318 9.94l.354-.354-.354-.354L1.94 1.854v.707l.62-.62h-.706l7.378 7.378.354.354.354-.354 7.378-7.378h-.707l.622.62v-.706L9.854 9.232l-.354.354.354.354 7.378 7.378.708-.707-7.38-7.378v.708l7.38-7.38.353-.353-.353-.353-.622-.622-.353-.353-.354.352-7.378 7.38h.708L2.56 1.23 2.208.88l-.353.353-.622.62-.353.355.352.353 7.38 7.38v-.708l-7.38 7.38-.353.353.352.353.622.622.353.353.354-.353 7.38-7.38h-.708l7.38 7.38z" />
</svg>
</button>
}
</div>
return (
<div class="uppy-ProviderBrowser-search">
<input
class="uppy-u-reset uppy-ProviderBrowser-searchInput"
type="text"
placeholder={this.props.i18n('filter')}
aria-label={this.props.i18n('filter')}
onkeyup={this.preventEnterPress}
onkeydown={this.preventEnterPress}
onkeypress={this.preventEnterPress}
oninput={(e) => this.props.filterQuery(e)}
value={this.props.filterInput}
/>
<svg aria-hidden="true" focusable="false" class="UppyIcon uppy-ProviderBrowser-searchIcon" width="12" height="12" viewBox="0 0 12 12">
<path d="M8.638 7.99l3.172 3.172a.492.492 0 1 1-.697.697L7.91 8.656a4.977 4.977 0 0 1-2.983.983C2.206 9.639 0 7.481 0 4.819 0 2.158 2.206 0 4.927 0c2.721 0 4.927 2.158 4.927 4.82a4.74 4.74 0 0 1-1.216 3.17zm-3.71.685c2.176 0 3.94-1.726 3.94-3.856 0-2.129-1.764-3.855-3.94-3.855C2.75.964.984 2.69.984 4.819c0 2.13 1.765 3.856 3.942 3.856z" />
</svg>
{this.props.filterInput && (
<button
class="uppy-u-reset uppy-ProviderBrowser-searchClose"
type="button"
aria-label={this.props.i18n('resetFilter')}
title={this.props.i18n('resetFilter')}
onclick={this.props.filterQuery}
>
<svg aria-hidden="true" focusable="false" class="UppyIcon" viewBox="0 0 19 19">
<path d="M17.318 17.232L9.94 9.854 9.586 9.5l-.354.354-7.378 7.378h.707l-.62-.62v.706L9.318 9.94l.354-.354-.354-.354L1.94 1.854v.707l.62-.62h-.706l7.378 7.378.354.354.354-.354 7.378-7.378h-.707l.622.62v-.706L9.854 9.232l-.354.354.354.354 7.378 7.378.708-.707-7.38-7.378v.708l7.38-7.38.353-.353-.353-.353-.622-.622-.353-.353-.354.352-7.378 7.38h.708L2.56 1.23 2.208.88l-.353.353-.622.62-.353.355.352.353 7.38 7.38v-.708l-7.38 7.38-.353.353.352.353.622.622.353.353.354-.353 7.38-7.38h-.708l7.38 7.38z" />
</svg>
</button>
)}
</div>
)
}
}
const { h } = require('preact')
module.exports = (props) => {
return <div class="uppy-ProviderBrowser-footer">
<button class="uppy-u-reset uppy-c-btn uppy-c-btn-primary" onclick={props.done}>
{props.i18n('selectX', {
smart_count: props.selected
})}
</button>
<button class="uppy-u-reset uppy-c-btn uppy-c-btn-link" onclick={props.cancel}>
{props.i18n('cancel')}
</button>
</div>
return (
<div class="uppy-ProviderBrowser-footer">
<button class="uppy-u-reset uppy-c-btn uppy-c-btn-primary" onclick={props.done}>
{props.i18n('selectX', {
smart_count: props.selected
})}
</button>
<button class="uppy-u-reset uppy-c-btn uppy-c-btn-link" onclick={props.cancel}>
{props.i18n('cancel')}
</button>
</div>
)
}

@@ -44,3 +44,4 @@ const { h, Component } = require('preact')

/**
* @param {object} instance of the plugin
* @param {object} plugin instance of the plugin
* @param {object} opts
*/

@@ -79,2 +80,3 @@ constructor (plugin, opts) {

this.handleScroll = this.handleScroll.bind(this)
this.listAllFiles = this.listAllFiles.bind(this)
this.donePicking = this.donePicking.bind(this)

@@ -204,5 +206,13 @@ this.cancelPicking = this.cancelPicking.bind(this)

logout () {
this.provider.logout(location.href)
this.provider.logout()
.then((res) => {
if (res.ok) {
if (!res.revoked) {
const message = this.plugin.uppy.i18n('companionUnauthorizeHint', {
provider: this.plugin.title,
url: res.manual_revoke_url
})
this.plugin.uppy.info(message, 'info', 7000)
}
const newState = {

@@ -353,12 +363,9 @@ authenticated: false,

this.plugin.setPluginState({ selectedFolders: folders })
return this.provider.list(folder.requestPath).then((res) => {
const files = []
res.items.forEach((item) => {
if (!item.isFolder) {
this.addFile(item)
files.push(this.providerFileToId(item))
}
return this.listAllFiles(folder.requestPath).then((files) => {
files.forEach((file) => {
this.addFile(file)
})
const ids = files.map(this.providerFileToId)
state = this.plugin.getPluginState()
state.selectedFolders[folderId] = { loading: false, files: files }
state.selectedFolders[folderId] = { loading: false, files: ids }
this.plugin.setPluginState({ selectedFolders: folders })

@@ -503,2 +510,23 @@

listAllFiles (path, files = null) {
files = files || []
return new Promise((resolve, reject) => {
this.provider.list(path).then((res) => {
res.items.forEach((item) => {
if (!item.isFolder) {
files.push(item)
}
})
const moreFiles = res.nextPagePath || null
if (moreFiles) {
return this.listAllFiles(moreFiles, files)
.then((files) => resolve(files))
.catch(e => reject(e))
} else {
return resolve(files)
}
}).catch(e => reject(e))
})
}
donePicking () {

@@ -567,3 +595,4 @@ const { currentSelection } = this.plugin.getPluginState()

i18n={this.plugin.uppy.i18n}
i18nArray={this.plugin.uppy.i18nArray} />
i18nArray={this.plugin.uppy.i18nArray}
/>
</CloseWrapper>

@@ -587,2 +616,3 @@ )

handleScroll: this.handleScroll,
listAllFiles: this.listAllFiles,
done: this.donePicking,

@@ -589,0 +619,0 @@ cancel: this.cancelPicking,

@@ -5,19 +5,21 @@ const { h } = require('preact')

module.exports = (props) => {
return <li class={props.className}>
<div aria-hidden class={`uppy-ProviderBrowserItem-fakeCheckbox ${props.isChecked ? 'uppy-ProviderBrowserItem-fakeCheckbox--is-checked' : ''}`} />
<button
type="button"
class="uppy-u-reset uppy-ProviderBrowserItem-inner"
onclick={props.toggleCheckbox}
return (
<li class={props.className}>
<div aria-hidden class={`uppy-ProviderBrowserItem-fakeCheckbox ${props.isChecked ? 'uppy-ProviderBrowserItem-fakeCheckbox--is-checked' : ''}`} />
<button
type="button"
class="uppy-u-reset uppy-ProviderBrowserItem-inner"
onclick={props.toggleCheckbox}
role="option"
aria-label={props.isChecked ? props.i18n('unselectFileNamed', { name: props.title }) : props.i18n('selectFileNamed', { name: props.title })}
aria-selected={props.isChecked}
aria-disabled={props.isDisabled}
data-uppy-super-focusable
>
{props.itemIconEl}
{props.showTitles && props.title}
</button>
</li>
role="option"
aria-label={props.isChecked ? props.i18n('unselectFileNamed', { name: props.title }) : props.i18n('selectFileNamed', { name: props.title })}
aria-selected={props.isChecked}
aria-disabled={props.isDisabled}
data-uppy-super-focusable
>
{props.itemIconEl}
{props.showTitles && props.title}
</button>
</li>
)
}
const { h } = require('preact')
function FileIcon () {
return (
<svg aria-hidden="true" focusable="false" class="UppyIcon" width={11} height={14.5} viewBox="0 0 44 58">
<path d="M27.437.517a1 1 0 0 0-.094.03H4.25C2.037.548.217 2.368.217 4.58v48.405c0 2.212 1.82 4.03 4.03 4.03H39.03c2.21 0 4.03-1.818 4.03-4.03V15.61a1 1 0 0 0-.03-.28 1 1 0 0 0 0-.093 1 1 0 0 0-.03-.032 1 1 0 0 0 0-.03 1 1 0 0 0-.032-.063 1 1 0 0 0-.03-.063 1 1 0 0 0-.032 0 1 1 0 0 0-.03-.063 1 1 0 0 0-.032-.03 1 1 0 0 0-.03-.063 1 1 0 0 0-.063-.062l-14.593-14a1 1 0 0 0-.062-.062A1 1 0 0 0 28 .708a1 1 0 0 0-.374-.157 1 1 0 0 0-.156 0 1 1 0 0 0-.03-.03l-.003-.003zM4.25 2.547h22.218v9.97c0 2.21 1.82 4.03 4.03 4.03h10.564v36.438a2.02 2.02 0 0 1-2.032 2.032H4.25c-1.13 0-2.032-.9-2.032-2.032V4.58c0-1.13.902-2.032 2.03-2.032zm24.218 1.345l10.375 9.937.75.718H30.5c-1.13 0-2.032-.9-2.032-2.03V3.89z" />
</svg>
)
}
function FolderIcon () {
return (
<svg aria-hidden="true" focusable="false" class="UppyIcon" style={{ width: 16, marginRight: 3 }} viewBox="0 0 276.157 276.157">
<path d="M273.08 101.378c-3.3-4.65-8.86-7.32-15.254-7.32h-24.34V67.59c0-10.2-8.3-18.5-18.5-18.5h-85.322c-3.63 0-9.295-2.875-11.436-5.805l-6.386-8.735c-4.982-6.814-15.104-11.954-23.546-11.954H58.73c-9.292 0-18.638 6.608-21.737 15.372l-2.033 5.752c-.958 2.71-4.72 5.37-7.596 5.37H18.5C8.3 49.09 0 57.39 0 67.59v167.07c0 .886.16 1.73.443 2.52.152 3.306 1.18 6.424 3.053 9.064 3.3 4.652 8.86 7.32 15.255 7.32h188.487c11.395 0 23.27-8.425 27.035-19.18l40.677-116.188c2.11-6.035 1.43-12.164-1.87-16.816zM18.5 64.088h8.864c9.295 0 18.64-6.607 21.738-15.37l2.032-5.75c.96-2.712 4.722-5.373 7.597-5.373h29.565c3.63 0 9.295 2.876 11.437 5.806l6.386 8.735c4.982 6.815 15.104 11.954 23.546 11.954h85.322c1.898 0 3.5 1.602 3.5 3.5v26.47H69.34c-11.395 0-23.27 8.423-27.035 19.178L15 191.23V67.59c0-1.898 1.603-3.5 3.5-3.5zm242.29 49.15l-40.676 116.188c-1.674 4.78-7.812 9.135-12.877 9.135H18.75c-1.447 0-2.576-.372-3.02-.997-.442-.625-.422-1.814.057-3.18l40.677-116.19c1.674-4.78 7.812-9.134 12.877-9.134h188.487c1.448 0 2.577.372 3.02.997.443.625.423 1.814-.056 3.18z" />
</svg>
)
}
function VideoIcon () {
return (
<svg aria-hidden="true" focusable="false" viewBox="0 0 58 58">
<path d="M36.537 28.156l-11-7a1.005 1.005 0 0 0-1.02-.033C24.2 21.3 24 21.635 24 22v14a1 1 0 0 0 1.537.844l11-7a1.002 1.002 0 0 0 0-1.688zM26 34.18V23.82L34.137 29 26 34.18z" />
<path d="M57 6H1a1 1 0 0 0-1 1v44a1 1 0 0 0 1 1h56a1 1 0 0 0 1-1V7a1 1 0 0 0-1-1zM10 28H2v-9h8v9zm-8 2h8v9H2v-9zm10 10V8h34v42H12V40zm44-12h-8v-9h8v9zm-8 2h8v9h-8v-9zm8-22v9h-8V8h8zM2 8h8v9H2V8zm0 42v-9h8v9H2zm54 0h-8v-9h8v9z" />
</svg>
)
}
module.exports = (props) => {

@@ -8,13 +33,7 @@ if (props.itemIconString === null) return

case 'file':
return <svg aria-hidden="true" focusable="false" class="UppyIcon" width={11} height={14.5} viewBox="0 0 44 58">
<path d="M27.437.517a1 1 0 0 0-.094.03H4.25C2.037.548.217 2.368.217 4.58v48.405c0 2.212 1.82 4.03 4.03 4.03H39.03c2.21 0 4.03-1.818 4.03-4.03V15.61a1 1 0 0 0-.03-.28 1 1 0 0 0 0-.093 1 1 0 0 0-.03-.032 1 1 0 0 0 0-.03 1 1 0 0 0-.032-.063 1 1 0 0 0-.03-.063 1 1 0 0 0-.032 0 1 1 0 0 0-.03-.063 1 1 0 0 0-.032-.03 1 1 0 0 0-.03-.063 1 1 0 0 0-.063-.062l-14.593-14a1 1 0 0 0-.062-.062A1 1 0 0 0 28 .708a1 1 0 0 0-.374-.157 1 1 0 0 0-.156 0 1 1 0 0 0-.03-.03l-.003-.003zM4.25 2.547h22.218v9.97c0 2.21 1.82 4.03 4.03 4.03h10.564v36.438a2.02 2.02 0 0 1-2.032 2.032H4.25c-1.13 0-2.032-.9-2.032-2.032V4.58c0-1.13.902-2.032 2.03-2.032zm24.218 1.345l10.375 9.937.75.718H30.5c-1.13 0-2.032-.9-2.032-2.03V3.89z" />
</svg>
return <FileIcon />
case 'folder':
return <svg aria-hidden="true" focusable="false" class="UppyIcon" style={{ width: 16, marginRight: 3 }} viewBox="0 0 276.157 276.157">
<path d="M273.08 101.378c-3.3-4.65-8.86-7.32-15.254-7.32h-24.34V67.59c0-10.2-8.3-18.5-18.5-18.5h-85.322c-3.63 0-9.295-2.875-11.436-5.805l-6.386-8.735c-4.982-6.814-15.104-11.954-23.546-11.954H58.73c-9.292 0-18.638 6.608-21.737 15.372l-2.033 5.752c-.958 2.71-4.72 5.37-7.596 5.37H18.5C8.3 49.09 0 57.39 0 67.59v167.07c0 .886.16 1.73.443 2.52.152 3.306 1.18 6.424 3.053 9.064 3.3 4.652 8.86 7.32 15.255 7.32h188.487c11.395 0 23.27-8.425 27.035-19.18l40.677-116.188c2.11-6.035 1.43-12.164-1.87-16.816zM18.5 64.088h8.864c9.295 0 18.64-6.607 21.738-15.37l2.032-5.75c.96-2.712 4.722-5.373 7.597-5.373h29.565c3.63 0 9.295 2.876 11.437 5.806l6.386 8.735c4.982 6.815 15.104 11.954 23.546 11.954h85.322c1.898 0 3.5 1.602 3.5 3.5v26.47H69.34c-11.395 0-23.27 8.423-27.035 19.178L15 191.23V67.59c0-1.898 1.603-3.5 3.5-3.5zm242.29 49.15l-40.676 116.188c-1.674 4.78-7.812 9.135-12.877 9.135H18.75c-1.447 0-2.576-.372-3.02-.997-.442-.625-.422-1.814.057-3.18l40.677-116.19c1.674-4.78 7.812-9.134 12.877-9.134h188.487c1.448 0 2.577.372 3.02.997.443.625.423 1.814-.056 3.18z" />
</svg>
return <FolderIcon />
case 'video':
return <svg aria-hidden="true" focusable="false" viewBox="0 0 58 58">
<path d="M36.537 28.156l-11-7a1.005 1.005 0 0 0-1.02-.033C24.2 21.3 24 21.635 24 22v14a1 1 0 0 0 1.537.844l11-7a1.002 1.002 0 0 0 0-1.688zM26 34.18V23.82L34.137 29 26 34.18z" /><path d="M57 6H1a1 1 0 0 0-1 1v44a1 1 0 0 0 1 1h56a1 1 0 0 0 1-1V7a1 1 0 0 0-1-1zM10 28H2v-9h8v9zm-8 2h8v9H2v-9zm10 10V8h34v42H12V40zm44-12h-8v-9h8v9zm-8 2h8v9h-8v-9zm8-22v9h-8V8h8zM2 8h8v9H2V8zm0 42v-9h8v9H2zm54 0h-8v-9h8v9z" />
</svg>
return <VideoIcon />
default:

@@ -21,0 +40,0 @@ return <img src={props.itemIconString} />

@@ -26,25 +26,26 @@ const { h } = require('preact')

module.exports = (props) => {
return <li class={props.className}>
<button
type="button"
class={`uppy-u-reset uppy-ProviderBrowserItem-fakeCheckbox ${props.isChecked ? 'uppy-ProviderBrowserItem-fakeCheckbox--is-checked' : ''}`}
onClick={props.toggleCheckbox}
// for the <label/>
id={props.id}
role="option"
aria-label={getAriaLabelOfCheckbox(props)}
aria-selected={props.isChecked}
aria-disabled={props.isDisabled}
data-uppy-super-focusable
/>
return (
<li class={props.className}>
<button
type="button"
class={`uppy-u-reset uppy-ProviderBrowserItem-fakeCheckbox ${props.isChecked ? 'uppy-ProviderBrowserItem-fakeCheckbox--is-checked' : ''}`}
onClick={props.toggleCheckbox}
// for the <label/>
id={props.id}
role="option"
aria-label={getAriaLabelOfCheckbox(props)}
aria-selected={props.isChecked}
aria-disabled={props.isDisabled}
data-uppy-super-focusable
/>
{
props.type === 'file'
{props.type === 'file' ? (
// label for a checkbox
? <label for={props.id} className="uppy-u-reset uppy-ProviderBrowserItem-inner">
<label for={props.id} className="uppy-u-reset uppy-ProviderBrowserItem-inner">
{props.itemIconEl}
{props.showTitles && props.title}
</label>
) : (
// button to open a folder
: <button
<button
type="button"

@@ -58,4 +59,5 @@ class="uppy-u-reset uppy-ProviderBrowserItem-inner"

</button>
}
</li>
)}
</li>
)
}

@@ -23,7 +23,9 @@ const { h } = require('preact')

<div class="uppy-ProviderBrowser-body">
<ul class="uppy-ProviderBrowser-list"
<ul
class="uppy-ProviderBrowser-list"
onscroll={props.handleScroll}
role="listbox"
// making <ul> not focusable for firefox
tabindex="-1">
tabindex="-1"
>
{props.folders.map(folder =>

@@ -30,0 +32,0 @@ Item({

const { h } = require('preact')
module.exports = (props) => {
return <div class="uppy-Provider-loading">
<span>{props.i18n('loading')}</span>
</div>
return (
<div class="uppy-Provider-loading">
<span>{props.i18n('loading')}</span>
</div>
)
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc