@uppy/informer
Advanced tools
Comparing version 2.0.5 to 2.1.0
"use strict"; | ||
const { | ||
h, | ||
Component, | ||
createRef | ||
} = require('preact'); | ||
var _preact = require("preact"); | ||
const TRANSITION_MS = 300; | ||
module.exports = class FadeIn extends Component { | ||
class FadeIn extends _preact.Component { | ||
constructor() { | ||
super(...arguments); | ||
this.ref = createRef(); | ||
this.ref = (0, _preact.createRef)(); | ||
} | ||
@@ -32,3 +29,3 @@ | ||
} = this.props; | ||
return h("div", { | ||
return (0, _preact.h)("div", { | ||
className: "uppy-Informer-animated", | ||
@@ -39,2 +36,4 @@ ref: this.ref | ||
}; | ||
} | ||
module.exports = FadeIn; |
"use strict"; | ||
var _class, _temp; | ||
/* eslint-disable jsx-a11y/no-noninteractive-element-interactions */ | ||
/* eslint-disable jsx-a11y/click-events-have-key-events */ | ||
const { | ||
h | ||
} = require('preact'); | ||
const { | ||
UIPlugin | ||
} = require('@uppy/core'); | ||
const FadeIn = require('./FadeIn'); | ||
const TransitionGroup = require('./TransitionGroup'); | ||
/** | ||
* Informer | ||
* Shows rad message bubbles | ||
* used like this: `uppy.info('hello world', 'info', 5000)` | ||
* or for errors: `uppy.info('Error uploading img.jpg', 'error', 5000)` | ||
* | ||
*/ | ||
module.exports = (_temp = _class = class Informer extends UIPlugin { | ||
// eslint-disable-next-line global-require | ||
constructor(uppy, opts) { | ||
super(uppy, opts); | ||
this.render = state => { | ||
return h("div", { | ||
className: "uppy uppy-Informer" | ||
}, h(TransitionGroup, null, state.info.map(info => h(FadeIn, { | ||
key: info.message | ||
}, h("p", { | ||
role: "alert" | ||
}, info.message, ' ', info.details && h("span", { | ||
"aria-label": info.details, | ||
"data-microtip-position": "top-left", | ||
"data-microtip-size": "medium", | ||
role: "tooltip" // eslint-disable-next-line no-alert | ||
, | ||
onClick: () => alert(`${info.message} \n\n ${info.details}`) | ||
}, "?")))))); | ||
}; | ||
this.type = 'progressindicator'; | ||
this.id = this.opts.id || 'Informer'; | ||
this.title = 'Informer'; // set default options | ||
const defaultOptions = {}; // merge default options with the ones set by user | ||
this.opts = { ...defaultOptions, | ||
...opts | ||
}; | ||
} | ||
install() { | ||
const { | ||
target | ||
} = this.opts; | ||
if (target) { | ||
this.mount(target, this); | ||
} | ||
} | ||
}, _class.VERSION = "2.0.5", _temp); | ||
module.exports = require("./Informer.js"); |
@@ -0,1 +1,5 @@ | ||
"use strict"; | ||
var _preact = require("preact"); | ||
/* eslint-disable */ | ||
@@ -6,11 +10,2 @@ | ||
*/ | ||
'use strict'; | ||
const { | ||
Component, | ||
cloneElement, | ||
h, | ||
toChildArray | ||
} = require('preact'); | ||
function assign(obj, props) { | ||
@@ -91,3 +86,3 @@ return Object.assign(obj, props); | ||
class TransitionGroup extends Component { | ||
class TransitionGroup extends _preact.Component { | ||
constructor(props, context) { | ||
@@ -97,3 +92,3 @@ super(props, context); | ||
this.state = { | ||
children: getChildMapping(toChildArray(toChildArray(this.props.children)) || []) | ||
children: getChildMapping((0, _preact.toChildArray)((0, _preact.toChildArray)(this.props.children)) || []) | ||
}; | ||
@@ -124,3 +119,3 @@ this.performAppear = this.performAppear.bind(this); | ||
componentWillReceiveProps(nextProps) { | ||
const nextChildMapping = getChildMapping(toChildArray(nextProps.children) || []); | ||
const nextChildMapping = getChildMapping((0, _preact.toChildArray)(nextProps.children) || []); | ||
const prevChildMapping = this.state.children; | ||
@@ -199,3 +194,3 @@ this.setState(prevState => ({ | ||
const currentChildMapping = getChildMapping(toChildArray(this.props.children) || []); | ||
const currentChildMapping = getChildMapping((0, _preact.toChildArray)(this.props.children) || []); | ||
@@ -230,3 +225,3 @@ if (!currentChildMapping || !currentChildMapping.hasOwnProperty(key)) { | ||
const currentChildMapping = getChildMapping(toChildArray(this.props.children) || []); | ||
const currentChildMapping = getChildMapping((0, _preact.toChildArray)(this.props.children) || []); | ||
@@ -277,3 +272,3 @@ if (!currentChildMapping || !currentChildMapping.hasOwnProperty(key)) { | ||
delete this.currentlyTransitioningKeys[key]; | ||
const currentChildMapping = getChildMapping(toChildArray(this.props.children) || []); | ||
const currentChildMapping = getChildMapping((0, _preact.toChildArray)(this.props.children) || []); | ||
@@ -318,3 +313,3 @@ if (currentChildMapping && currentChildMapping.hasOwnProperty(key)) { | ||
const ref = linkRef(this, key), | ||
el = cloneElement(childFactory(child), { | ||
el = (0, _preact.cloneElement)(childFactory(child), { | ||
ref, | ||
@@ -328,3 +323,3 @@ key | ||
return h(component, props, childrenToRender); | ||
return (0, _preact.h)(component, props, childrenToRender); | ||
} | ||
@@ -331,0 +326,0 @@ |
{ | ||
"name": "@uppy/informer", | ||
"description": "A notification and error pop-up bar for Uppy.", | ||
"version": "2.0.5", | ||
"version": "2.1.0", | ||
"license": "MIT", | ||
@@ -9,2 +9,3 @@ "main": "lib/index.js", | ||
"types": "types/index.d.ts", | ||
"type": "module", | ||
"keywords": [ | ||
@@ -27,8 +28,8 @@ "file uploader", | ||
"dependencies": { | ||
"@uppy/utils": "^4.0.4", | ||
"@uppy/utils": "^4.1.0", | ||
"preact": "^10.5.13" | ||
}, | ||
"peerDependencies": { | ||
"@uppy/core": "^2.1.3" | ||
"@uppy/core": "^2.3.0" | ||
} | ||
} |
@@ -32,4 +32,2 @@ # @uppy/informer | ||
We recommend installing from npm and then using a module bundler such as [Webpack](https://webpack.js.org/), [Browserify](http://browserify.org/) or [Rollup.js](http://rollupjs.org/). | ||
Alternatively, you can also use this plugin in a pre-built bundle from Transloadit’s CDN: Edgly. In that case `Uppy` will attach itself to the global `window.Uppy` object. See the [main Uppy documentation](https://uppy.io/docs/#Installation) for instructions. | ||
@@ -36,0 +34,0 @@ |
@@ -1,66 +0,1 @@ | ||
/* eslint-disable jsx-a11y/no-noninteractive-element-interactions */ | ||
/* eslint-disable jsx-a11y/click-events-have-key-events */ | ||
const { h } = require('preact') | ||
const { UIPlugin } = require('@uppy/core') | ||
const FadeIn = require('./FadeIn') | ||
const TransitionGroup = require('./TransitionGroup') | ||
/** | ||
* Informer | ||
* Shows rad message bubbles | ||
* used like this: `uppy.info('hello world', 'info', 5000)` | ||
* or for errors: `uppy.info('Error uploading img.jpg', 'error', 5000)` | ||
* | ||
*/ | ||
module.exports = class Informer extends UIPlugin { | ||
// eslint-disable-next-line global-require | ||
static VERSION = require('../package.json').version | ||
constructor (uppy, opts) { | ||
super(uppy, opts) | ||
this.type = 'progressindicator' | ||
this.id = this.opts.id || 'Informer' | ||
this.title = 'Informer' | ||
// set default options | ||
const defaultOptions = {} | ||
// merge default options with the ones set by user | ||
this.opts = { ...defaultOptions, ...opts } | ||
} | ||
render = (state) => { | ||
return ( | ||
<div className="uppy uppy-Informer"> | ||
<TransitionGroup> | ||
{state.info.map((info) => ( | ||
<FadeIn key={info.message}> | ||
<p role="alert"> | ||
{info.message} | ||
{' '} | ||
{info.details && ( | ||
<span | ||
aria-label={info.details} | ||
data-microtip-position="top-left" | ||
data-microtip-size="medium" | ||
role="tooltip" | ||
// eslint-disable-next-line no-alert | ||
onClick={() => alert(`${info.message} \n\n ${info.details}`)} | ||
> | ||
? | ||
</span> | ||
)} | ||
</p> | ||
</FadeIn> | ||
))} | ||
</TransitionGroup> | ||
</div> | ||
) | ||
} | ||
install () { | ||
const { target } = this.opts | ||
if (target) { | ||
this.mount(target, this) | ||
} | ||
} | ||
} | ||
export { default } from './Informer.jsx' |
@@ -5,5 +5,4 @@ /* eslint-disable */ | ||
*/ | ||
'use strict' | ||
const { Component, cloneElement, h, toChildArray } = require('preact') | ||
import { Component, cloneElement, h, toChildArray } from 'preact' | ||
@@ -290,2 +289,2 @@ function assign (obj, props) { | ||
module.exports = TransitionGroup | ||
export default TransitionGroup |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
53193
22
Yes
740
41
Updated@uppy/utils@^4.1.0